(window.webpackJsonp=window.webpackJsonp||[]).push([[1],{292:function(e,t,n){"use strict";n.r(t);const i=new WeakMap,r=e=>"function"==typeof e&&i.has(e),a=void 0!==window.customElements&&void 0!==window.customElements.polyfillWrapFlushCallback,o=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;for(;t!==n;){const n=t.nextSibling;e.removeChild(t),t=n}},s={},l={},c="{{lit-".concat(String(Math.random()).slice(2),"}}"),h="\x3c!--".concat(c,"--\x3e"),u=new RegExp("".concat(c,"|").concat(h)),d="$lit$";class p{constructor(e,t){this.parts=[],this.element=t;const n=[],i=[],r=document.createTreeWalker(t.content,133,null,!1);let a=0,o=-1,s=0;const{strings:l,values:{length:h}}=e;for(;s0;){const t=l[s],n=g.exec(t)[2],i=n.toLowerCase()+d,r=e.getAttribute(i);e.removeAttribute(i);const a=r.split(u);this.parts.push({type:"attribute",index:o,name:n,strings:a}),s+=a.length-1}}"TEMPLATE"===e.tagName&&(i.push(e),r.currentNode=e.content)}else if(3===e.nodeType){const t=e.data;if(t.indexOf(c)>=0){const i=e.parentNode,r=t.split(u),a=r.length-1;for(let t=0;t{const n=e.length-t.length;return n>=0&&e.slice(n)===t},m=e=>-1!==e.index,v=()=>document.createComment(""),g=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=\/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;class y{constructor(e,t,n){this.__parts=[],this.template=e,this.processor=t,this.options=n}update(e){let t=0;for(const n of this.__parts)void 0!==n&&n.setValue(e[t]),t++;for(const e of this.__parts)void 0!==e&&e.commit()}_clone(){const e=a?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),t=[],n=this.template.parts,i=document.createTreeWalker(e,133,null,!1);let r,o=0,s=0,l=i.nextNode();for(;o-1||n)&&-1===e.indexOf("--\x3e",r+1);const a=g.exec(e);t+=null===a?e+(n?x:h):e.substr(0,a.index)+a[1]+a[2]+d+a[3]+c}return t+=this.strings[e]}getTemplateElement(){const e=document.createElement("template");return e.innerHTML=this.getHTML(),e}}const w=e=>null===e||!("object"==typeof e||"function"==typeof e),_=e=>Array.isArray(e)||!(!e||!e[Symbol.iterator]);class M{constructor(e,t,n){this.dirty=!0,this.element=e,this.name=t,this.strings=n,this.parts=[];for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:this.startNode;o(this.startNode.parentNode,e.nextSibling,this.endNode)}}class T{constructor(e,t,n){if(this.value=void 0,this.__pendingValue=void 0,2!==n.length||""!==n[0]||""!==n[1])throw new Error("Boolean attributes can only contain a single expression");this.element=e,this.name=t,this.strings=n}setValue(e){this.__pendingValue=e}commit(){for(;r(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=s,e(this)}if(this.__pendingValue===s)return;const e=!!this.__pendingValue;this.value!==e&&(e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=e),this.__pendingValue=s}}class A extends M{constructor(e,t,n){super(e,t,n),this.single=2===n.length&&""===n[0]&&""===n[1]}_createPart(){return new L(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}}class L extends S{}let R=!1;try{const e={get capture(){return R=!0,!1}};window.addEventListener("test",e,e),window.removeEventListener("test",e,e)}catch(e){}class P{constructor(e,t,n){this.value=void 0,this.__pendingValue=void 0,this.element=e,this.eventName=t,this.eventContext=n,this.__boundHandleEvent=e=>this.handleEvent(e)}setValue(e){this.__pendingValue=e}commit(){for(;r(this.__pendingValue);){const e=this.__pendingValue;this.__pendingValue=s,e(this)}if(this.__pendingValue===s)return;const e=this.__pendingValue,t=this.value,n=null==e||null!=t&&(e.capture!==t.capture||e.once!==t.once||e.passive!==t.passive),i=null!=e&&(null==t||n);n&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),i&&(this.__options=C(e),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=e,this.__pendingValue=s}handleEvent(e){"function"==typeof this.value?this.value.call(this.eventContext||this.element,e):this.value.handleEvent(e)}}const C=e=>e&&(R?{capture:e.capture,passive:e.passive,once:e.once}:e.capture);new class{handleAttributeExpressions(e,t,n,i){const r=t[0];if("."===r){return new A(e,t.slice(1),n).parts}return"@"===r?[new P(e,t.slice(1),i.eventContext)]:"?"===r?[new T(e,t.slice(1),n)]:new M(e,t,n).parts}handleTextExpression(e){return new E(e)}};function O(e){let t=I.get(e.type);void 0===t&&(t={stringsArray:new WeakMap,keyString:new Map},I.set(e.type,t));let n=t.stringsArray.get(e.strings);if(void 0!==n)return n;const i=e.strings.join(c);return void 0===(n=t.keyString.get(i))&&(n=new p(e,e.getTemplateElement()),t.keyString.set(i,n)),t.stringsArray.set(e.strings,n),n}const I=new Map,D=new WeakMap;(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.1.2");const N=133;function z(e,t){const{element:{content:n},parts:i}=e,r=document.createTreeWalker(n,N,null,!1);let a=F(i),o=i[a],s=-1,l=0;const c=[];let h=null;for(;r.nextNode();){s++;const e=r.currentNode;for(e.previousSibling===h&&(h=null),t.has(e)&&(c.push(e),null===h&&(h=e)),null!==h&&l++;void 0!==o&&o.index===s;)o.index=null!==h?-1:o.index-l,o=i[a=F(i,a)]}c.forEach(e=>e.parentNode.removeChild(e))}const U=e=>{let t=11===e.nodeType?0:1;const n=document.createTreeWalker(e,N,null,!1);for(;n.nextNode();)t++;return t},F=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;for(let n=t+1;n"".concat(e,"--").concat(t);let k=!0;void 0===window.ShadyCSS?k=!1:void 0===window.ShadyCSS.prepareTemplateDom&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),k=!1);const G=e=>t=>{const n=B(t.type,e);let i=I.get(n);void 0===i&&(i={stringsArray:new WeakMap,keyString:new Map},I.set(n,i));let r=i.stringsArray.get(t.strings);if(void 0!==r)return r;const a=t.strings.join(c);if(void 0===(r=i.keyString.get(a))){const n=t.getTemplateElement();k&&window.ShadyCSS.prepareTemplateDom(n,e),r=new p(t,n),i.keyString.set(a,r)}return i.stringsArray.set(t.strings,r),r},V=["html","svg"],H=new Set,j=(e,t,n)=>{H.add(e);const i=n?n.element:document.createElement("template"),r=t.querySelectorAll("style"),{length:a}=r;if(0===a)return void window.ShadyCSS.prepareTemplateStyles(i,e);const o=document.createElement("style");for(let e=0;e{V.forEach(t=>{const n=I.get(B(t,e));void 0!==n&&n.keyString.forEach(e=>{const{element:{content:t}}=e,n=new Set;Array.from(t.querySelectorAll("style")).forEach(e=>{n.add(e)}),z(e,n)})})})(e);const s=i.content;n?function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const{element:{content:i},parts:r}=e;if(null==n)return void i.appendChild(t);const a=document.createTreeWalker(i,N,null,!1);let o=F(r),s=0,l=-1;for(;a.nextNode();){for(l++,a.currentNode===n&&(s=U(t),n.parentNode.insertBefore(t,n));-1!==o&&r[o].index===l;){if(s>0){for(;-1!==o;)r[o].index+=s,o=F(r,o);return}o=F(r,o)}}}(n,o,s.firstChild):s.insertBefore(o,s.firstChild),window.ShadyCSS.prepareTemplateStyles(i,e);const l=s.querySelector("style");if(window.ShadyCSS.nativeShadow&&null!==l)t.insertBefore(l.cloneNode(!0),t.firstChild);else if(n){s.insertBefore(o,s.firstChild);const e=new Set;e.add(o),z(n,e)}};window.JSCompiler_renameProperty=(e,t)=>e;const W={toAttribute(e,t){switch(t){case Boolean:return e?"":null;case Object:case Array:return null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){switch(t){case Boolean:return null!==e;case Number:return null===e?null:Number(e);case Object:case Array:return JSON.parse(e)}return e}},q=(e,t)=>t!==e&&(t==t||e==e),X={attribute:!0,type:String,converter:W,reflect:!1,hasChanged:q},Y=Promise.resolve(!0),Z=1,J=4,K=8,Q=16,$=32,ee="finalized";class te extends HTMLElement{constructor(){super(),this._updateState=0,this._instanceProperties=void 0,this._updatePromise=Y,this._hasConnectedResolver=void 0,this._changedProperties=new Map,this._reflectingProperties=void 0,this.initialize()}static get observedAttributes(){this.finalize();const e=[];return this._classProperties.forEach((t,n)=>{const i=this._attributeNameForProperty(n,t);void 0!==i&&(this._attributeToPropertyMap.set(i,n),e.push(i))}),e}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;const e=Object.getPrototypeOf(this)._classProperties;void 0!==e&&e.forEach((e,t)=>this._classProperties.set(t,e))}}static createProperty(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:X;if(this._ensureClassProperties(),this._classProperties.set(e,t),t.noAccessor||this.prototype.hasOwnProperty(e))return;const n="symbol"==typeof e?Symbol():"__".concat(e);Object.defineProperty(this.prototype,e,{get(){return this[n]},set(t){const i=this[e];this[n]=t,this._requestUpdate(e,i)},configurable:!0,enumerable:!0})}static finalize(){const e=Object.getPrototypeOf(this);if(e.hasOwnProperty(ee)||e.finalize(),this[ee]=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){const e=this.properties,t=[...Object.getOwnPropertyNames(e),..."function"==typeof Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e):[]];for(const n of t)this.createProperty(n,e[n])}}static _attributeNameForProperty(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}static _valueHasChanged(e,t){return(arguments.length>2&&void 0!==arguments[2]?arguments[2]:q)(e,t)}static _propertyValueFromAttribute(e,t){const n=t.type,i=t.converter||W,r="function"==typeof i?i:i.fromAttribute;return r?r(e,n):e}static _propertyValueToAttribute(e,t){if(void 0===t.reflect)return;const n=t.type,i=t.converter;return(i&&i.toAttribute||W.toAttribute)(e,n)}initialize(){this._saveInstanceProperties(),this._requestUpdate()}_saveInstanceProperties(){this.constructor._classProperties.forEach((e,t)=>{if(this.hasOwnProperty(t)){const e=this[t];delete this[t],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(t,e)}})}_applyInstanceProperties(){this._instanceProperties.forEach((e,t)=>this[t]=e),this._instanceProperties=void 0}connectedCallback(){this._updateState=this._updateState|$,this._hasConnectedResolver&&(this._hasConnectedResolver(),this._hasConnectedResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(e,t,n){t!==n&&this._attributeToProperty(e,n)}_propertyToAttribute(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:X;const i=this.constructor,r=i._attributeNameForProperty(e,n);if(void 0!==r){const e=i._propertyValueToAttribute(t,n);if(void 0===e)return;this._updateState=this._updateState|K,null==e?this.removeAttribute(r):this.setAttribute(r,e),this._updateState=this._updateState&~K}}_attributeToProperty(e,t){if(this._updateState&K)return;const n=this.constructor,i=n._attributeToPropertyMap.get(e);if(void 0!==i){const e=n._classProperties.get(i)||X;this._updateState=this._updateState|Q,this[i]=n._propertyValueFromAttribute(t,e),this._updateState=this._updateState&~Q}}_requestUpdate(e,t){let n=!0;if(void 0!==e){const i=this.constructor,r=i._classProperties.get(e)||X;i._valueHasChanged(this[e],t,r.hasChanged)?(this._changedProperties.has(e)||this._changedProperties.set(e,t),!0!==r.reflect||this._updateState&Q||(void 0===this._reflectingProperties&&(this._reflectingProperties=new Map),this._reflectingProperties.set(e,r))):n=!1}!this._hasRequestedUpdate&&n&&this._enqueueUpdate()}requestUpdate(e,t){return this._requestUpdate(e,t),this.updateComplete}async _enqueueUpdate(){let e,t;this._updateState=this._updateState|J;const n=this._updatePromise;this._updatePromise=new Promise((n,i)=>{e=n,t=i});try{await n}catch(e){}this._hasConnected||await new Promise(e=>this._hasConnectedResolver=e);try{const e=this.performUpdate();null!=e&&await e}catch(e){t(e)}e(!this._hasRequestedUpdate)}get _hasConnected(){return this._updateState&$}get _hasRequestedUpdate(){return this._updateState&J}get hasUpdated(){return this._updateState&Z}performUpdate(){this._instanceProperties&&this._applyInstanceProperties();let e=!1;const t=this._changedProperties;try{(e=this.shouldUpdate(t))&&this.update(t)}catch(t){throw e=!1,t}finally{this._markUpdated()}e&&(this._updateState&Z||(this._updateState=this._updateState|Z,this.firstUpdated(t)),this.updated(t))}_markUpdated(){this._changedProperties=new Map,this._updateState=this._updateState&~J}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this._updatePromise}shouldUpdate(e){return!0}update(e){void 0!==this._reflectingProperties&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach((e,t)=>this._propertyToAttribute(t,this[t],e)),this._reflectingProperties=void 0)}updated(e){}firstUpdated(e){}}te[ee]=!0;const ne=(e,t)=>"method"!==t.kind||!t.descriptor||"value"in t.descriptor?{kind:"field",key:Symbol(),placement:"own",descriptor:{},initializer(){"function"==typeof t.initializer&&(this[t.key]=t.initializer.call(this))},finisher(n){n.createProperty(t.key,e)}}:Object.assign({},t,{finisher(n){n.createProperty(t.key,e)}}),ie=(e,t,n)=>{t.constructor.createProperty(n,e)};function re(e){return(t,n)=>void 0!==n?ie(e,t,n):ne(e,t)}const ae="adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype;Symbol();(window.litElementVersions||(window.litElementVersions=[])).push("2.2.1");const oe=e=>e.flat?e.flat(1/0):function e(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];for(let i=0,r=t.length;i(e.add(t),e),new Set).forEach(e=>t.unshift(e))}else e&&t.push(e);return t}initialize(){super.initialize(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow({mode:"open"})}adoptStyles(){const e=this.constructor._styles;0!==e.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?ae?this.renderRoot.adoptedStyleSheets=e.map(e=>e.styleSheet):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(e.map(e=>e.cssText),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}update(e){super.update(e);const t=this.render();t instanceof b&&this.constructor.render(t,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach(e=>{const t=document.createElement("style");t.textContent=e.cssText,this.renderRoot.appendChild(t)}))}render(){}}se.finalized=!0,se.render=(e,t,n)=>{if(!n||"object"!=typeof n||!n.scopeName)throw new Error("The `scopeName` option is required.");const i=n.scopeName,r=D.has(t),a=k&&11===t.nodeType&&!!t.host,s=a&&!H.has(i),l=s?document.createDocumentFragment():t;if(((e,t,n)=>{let i=D.get(t);void 0===i&&(o(t,t.firstChild),D.set(t,i=new E(Object.assign({templateFactory:O},n))),i.appendInto(t)),i.setValue(e),i.commit()})(e,l,Object.assign({templateFactory:G(i)},n)),s){const e=D.get(l);D.delete(l);const n=e.value instanceof y?e.value.template:void 0;j(i,l,n),o(t,t.firstChild),t.appendChild(l),D.set(t,e)}!r&&a&&window.ShadyCSS.styleElement(t.host)};const le=null!=navigator.xr&&null!=self.XRSession&&null!=navigator.xr.supportsSession,ce=le&&self.XRSession.prototype.requestHitTest,he=null!=self.ResizeObserver,ue=null!=self.IntersectionObserver,de=ce,pe=((()=>{const e=navigator.userAgent||navigator.vendor||self.opera;let t=!1;(/(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)})(),Boolean(self.OffscreenCanvas),Boolean(self.OffscreenCanvas)&&Boolean(self.OffscreenCanvas.prototype.transferToImageBitmap),/android/i.test(navigator.userAgent)),fe=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!self.MSStream||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1,me=(()=>{const e=document.createElement("a");return Boolean(e.relList&&e.relList.supports&&e.relList.supports("ar"))})(),ve=fe&&/CriOS\//.test(navigator.userAgent),ge=fe&&/Safari\//.test(navigator.userAgent);!window.ActiveXObject&&window;const ye=document.createElement("template");ye.innerHTML='\n\n
\n \n \n\n \x3c!-- NOTE(cdata): We need to wrap slots because browsers without ShadowDOM\n will have their elements removed by ShadyCSS --\x3e\n
\n \n \n \n
\n\n
\n \n \n \n
\n\n \n\n \n\n
\n
\n \n
\n
\n\n
\n \n
\n
');const xe=e=>{const t=document.createElement("template");return t.innerHTML=ye.innerHTML,window.ShadyCSS&&window.ShadyCSS.prepareTemplate(t,e),t};void 0===Number.EPSILON&&(Number.EPSILON=Math.pow(2,-52)),void 0===Number.isInteger&&(Number.isInteger=function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e}),void 0===Math.sign&&(Math.sign=function(e){return e<0?-1:e>0?1:+e}),"name"in Function.prototype==!1&&Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}}),void 0===Object.assign&&(Object.assign=function(e){if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n>8&255]+qn[e>>16&255]+qn[e>>24&255]+"-"+qn[255&t]+qn[t>>8&255]+"-"+qn[t>>16&15|64]+qn[t>>24&255]+"-"+qn[63&n|128]+qn[n>>8&255]+"-"+qn[n>>16&255]+qn[n>>24&255]+qn[255&i]+qn[i>>8&255]+qn[i>>16&255]+qn[i>>24&255]).toUpperCase()},clamp:function(e,t,n){return Math.max(t,Math.min(n,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,n,i,r){return i+(e-t)*(r-i)/(n-t)},lerp:function(e,t,n){return(1-n)*e+n*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())},degToRad:function(e){return e*Yn.DEG2RAD},radToDeg:function(e){return e*Yn.RAD2DEG},isPowerOfTwo:function(e){return 0==(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))}};function Zn(e,t){this.x=e||0,this.y=t||0}function Jn(e,t,n,i){this._x=e||0,this._y=t||0,this._z=n||0,this._w=void 0!==i?i:1}Object.defineProperties(Zn.prototype,{width:{get:function(){return this.x},set:function(e){this.x=e}},height:{get:function(){return this.y},set:function(e){this.y=e}}}),Object.assign(Zn.prototype,{isVector2:!0,set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.x=e,this.y=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(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:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},applyMatrix3:function(e){var 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:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(e){return this.x*e.x+this.y*e.y},cross:function(e){return this.x*e.y-this.y*e.x},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var e=Math.atan2(this.y,this.x);return e<0&&(e+=2*Math.PI),e},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this},rotateAround:function(e,t){var n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*n-a*i+e.x,this.y=r*i+a*n+e.y,this}}),Object.assign(Jn,{slerp:function(e,t,n,i){return n.copy(e).slerp(t,i)},slerpFlat:function(e,t,n,i,r,a,o){var s=n[i+0],l=n[i+1],c=n[i+2],h=n[i+3],u=r[a+0],d=r[a+1],p=r[a+2],f=r[a+3];if(h!==f||s!==u||l!==d||c!==p){var m=1-o,v=s*u+l*d+c*p+h*f,g=v>=0?1:-1,y=1-v*v;if(y>Number.EPSILON){var x=Math.sqrt(y),b=Math.atan2(x,v*g);m=Math.sin(m*b)/x,o=Math.sin(o*b)/x}var w=o*g;if(s=s*m+u*w,l=l*m+d*w,c=c*m+p*w,h=h*m+f*w,m===1-o){var _=1/Math.sqrt(s*s+l*l+c*c+h*h);s*=_,l*=_,c*=_,h*=_}}e[t]=s,e[t+1]=l,e[t+2]=c,e[t+3]=h}}),Object.defineProperties(Jn.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},w:{get:function(){return this._w},set:function(e){this._w=e,this._onChangeCallback()}}}),Object.assign(Jn.prototype,{isQuaternion:!0,set:function(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this},setFromEuler:function(e,t){if(!e||!e.isEuler)throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=e._x,i=e._y,r=e._z,a=e.order,o=Math.cos,s=Math.sin,l=o(n/2),c=o(i/2),h=o(r/2),u=s(n/2),d=s(i/2),p=s(r/2);return"XYZ"===a?(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):"YXZ"===a?(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):"ZXY"===a?(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):"ZYX"===a?(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):"YZX"===a?(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):"XZY"===a&&(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),!1!==t&&this._onChangeCallback(),this},setFromAxisAngle:function(e,t){var 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:function(e){var t,n=e.elements,i=n[0],r=n[4],a=n[8],o=n[1],s=n[5],l=n[9],c=n[2],h=n[6],u=n[10],d=i+s+u;return d>0?(t=.5/Math.sqrt(d+1),this._w=.25/t,this._x=(h-l)*t,this._y=(a-c)*t,this._z=(o-r)*t):i>s&&i>u?(t=2*Math.sqrt(1+i-s-u),this._w=(h-l)/t,this._x=.25*t,this._y=(r+o)/t,this._z=(a+c)/t):s>u?(t=2*Math.sqrt(1+s-i-u),this._w=(a-c)/t,this._x=(r+o)/t,this._y=.25*t,this._z=(l+h)/t):(t=2*Math.sqrt(1+u-i-s),this._w=(o-r)/t,this._x=(a+c)/t,this._y=(l+h)/t,this._z=.25*t),this._onChangeCallback(),this},setFromUnitVectors:function(e,t){var n=e.dot(t)+1;return n<1e-6?(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:function(e){return 2*Math.acos(Math.abs(Yn.clamp(this.dot(e),-1,1)))},rotateTowards:function(e,t){var n=this.angleTo(e);if(0===n)return this;var i=Math.min(1,t/n);return this.slerp(e,i),this},inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var 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:function(e,t){return void 0!==t?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var n=e._x,i=e._y,r=e._z,a=e._w,o=t._x,s=t._y,l=t._z,c=t._w;return this._x=n*c+a*o+i*l-r*s,this._y=i*c+a*s+r*o-n*l,this._z=r*c+a*l+n*s-i*o,this._w=a*c-n*o-i*s-r*l,this._onChangeCallback(),this},slerp:function(e,t){if(0===t)return this;if(1===t)return this.copy(e);var n=this._x,i=this._y,r=this._z,a=this._w,o=a*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=a,this._x=n,this._y=i,this._z=r,this;var s=1-o*o;if(s<=Number.EPSILON){var l=1-t;return this._w=l*a+t*this._w,this._x=l*n+t*this._x,this._y=l*i+t*this._y,this._z=l*r+t*this._z,this.normalize(),this._onChangeCallback(),this}var c=Math.sqrt(s),h=Math.atan2(c,o),u=Math.sin((1-t)*h)/c,d=Math.sin(t*h)/c;return this._w=a*u+this._w*d,this._x=n*u+this._x*d,this._y=i*u+this._y*d,this._z=r*u+this._z*d,this._onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return void 0===t&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},_onChange:function(e){return this._onChangeCallback=e,this},_onChangeCallback:function(){}});var Kn=new $n,Qn=new Jn;function $n(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0}Object.assign($n.prototype,{isVector3:!0,set:function(e,t,n){return this.x=e,this.y=t,this.z=n,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(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:function(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:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(e){return e&&e.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(Qn.setFromEuler(e))},applyAxisAngle:function(e,t){return this.applyQuaternion(Qn.setFromAxisAngle(e,t))},applyMatrix3:function(e){var 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},applyMatrix4:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements,a=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])*a,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*a,this},applyQuaternion:function(e){var t=this.x,n=this.y,i=this.z,r=e.x,a=e.y,o=e.z,s=e.w,l=s*t+a*i-o*n,c=s*n+o*t-r*i,h=s*i+r*n-a*t,u=-r*t-a*n-o*i;return this.x=l*s+u*-r+c*-o-h*-a,this.y=c*s+u*-a+h*-r-l*-o,this.z=h*s+u*-o+l*-a-c*-r,this},project:function(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)},unproject:function(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)},transformDirection:function(e){var 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:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(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:function(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:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(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:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},cross:function(e,t){return void 0!==t?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)},crossVectors:function(e,t){var n=e.x,i=e.y,r=e.z,a=t.x,o=t.y,s=t.z;return this.x=i*s-r*o,this.y=r*a-n*s,this.z=n*o-i*a,this},projectOnVector:function(e){var t=e.dot(this)/e.lengthSq();return this.copy(e).multiplyScalar(t)},projectOnPlane:function(e){return Kn.copy(this).projectOnVector(e),this.sub(Kn)},reflect:function(e){return this.sub(Kn.copy(e).multiplyScalar(2*this.dot(e)))},angleTo:function(e){var t=Math.sqrt(this.lengthSq()*e.lengthSq());0===t&&console.error("THREE.Vector3: angleTo() can't handle zero length vectors.");var n=this.dot(e)/t;return Math.acos(Yn.clamp(n,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)},setFromSphericalCoords:function(e,t,n){var 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:function(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)},setFromCylindricalCoords:function(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this},setFromMatrixPosition:function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this},setFromMatrixScale:function(e){var 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:function(e,t){return this.fromArray(e.elements,4*t)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}});var ei,ti=new $n;function ni(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}Object.assign(ni.prototype,{isMatrix3:!0,set:function(e,t,n,i,r,a,o,s,l){var c=this.elements;return c[0]=e,c[1]=i,c[2]=o,c[3]=t,c[4]=r,c[5]=s,c[6]=n,c[7]=a,c[8]=l,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return(new this.constructor).fromArray(this.elements)},copy:function(e){var 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},setFromMatrix4:function(e){var 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},applyToBufferAttribute:function(e){for(var t=0,n=e.count;t2048||t.height>2048?t.toDataURL("image/jpeg",.6):t.toDataURL("image/png")}},ri=0;function ai(e,t,n,i,r,a,o,s,l,c){Object.defineProperty(this,"id",{value:ri++}),this.uuid=Yn.generateUUID(),this.name="",this.image=void 0!==e?e:ai.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=void 0!==t?t:ai.DEFAULT_MAPPING,this.wrapS=void 0!==n?n:Et,this.wrapT=void 0!==i?i:Et,this.magFilter=void 0!==r?r:Pt,this.minFilter=void 0!==a?a:Ot,this.anisotropy=void 0!==l?l:1,this.format=void 0!==o?o:Yt,this.type=void 0!==s?s:Dt,this.offset=new Zn(0,0),this.repeat=new Zn(1,1),this.center=new Zn(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new ni,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=void 0!==c?c:Pn,this.version=0,this.onUpdate=null}function oi(e,t,n,i){this.x=e||0,this.y=t||0,this.z=n||0,this.w=void 0!==i?i:1}function si(e,t,n){this.width=e,this.height=t,this.scissor=new oi(0,0,e,t),this.scissorTest=!1,this.viewport=new oi(0,0,e,t),n=n||{},this.texture=new ai(void 0,void 0,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.image={},this.texture.image.width=e,this.texture.image.height=t,this.texture.generateMipmaps=void 0!==n.generateMipmaps&&n.generateMipmaps,this.texture.minFilter=void 0!==n.minFilter?n.minFilter:Pt,this.depthBuffer=void 0===n.depthBuffer||n.depthBuffer,this.stencilBuffer=void 0===n.stencilBuffer||n.stencilBuffer,this.depthTexture=void 0!==n.depthTexture?n.depthTexture:null}function li(e,t,n){si.call(this,e,t,n),this.samples=4}ai.DEFAULT_IMAGE=void 0,ai.DEFAULT_MAPPING=300,ai.prototype=Object.assign(Object.create(Wn.prototype),{constructor:ai,isTexture:!0,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.name=e.name,this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this},toJSON:function(e){var t=void 0===e||"string"==typeof e;if(!t&&void 0!==e.textures[this.uuid])return e.textures[this.uuid];var n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(void 0!==this.image){var i=this.image;if(void 0===i.uuid&&(i.uuid=Yn.generateUUID()),!t&&void 0===e.images[i.uuid]){var r;if(Array.isArray(i)){r=[];for(var a=0,o=i.length;a1)switch(this.wrapS){case St:e.x=e.x-Math.floor(e.x);break;case Et:e.x=e.x<0?0:1;break;case Tt: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 St:e.y=e.y-Math.floor(e.y);break;case Et:e.y=e.y<0?0:1;break;case Tt: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}}),Object.defineProperty(ai.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.defineProperties(oi.prototype,{width:{get:function(){return this.z},set:function(e){this.z=e}},height:{get:function(){return this.w},set:function(e){this.w=e}}}),Object.assign(oi.prototype,{isVector4:!0,set:function(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(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:function(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:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(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:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(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:function(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:function(e,t){return void 0!==t?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(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},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},applyMatrix4:function(e){var t=this.x,n=this.y,i=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*r,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var 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:function(e){var t,n,i,r,a=e.elements,o=a[0],s=a[4],l=a[8],c=a[1],h=a[5],u=a[9],d=a[2],p=a[6],f=a[10];if(Math.abs(s-c)<.01&&Math.abs(l-d)<.01&&Math.abs(u-p)<.01){if(Math.abs(s+c)<.1&&Math.abs(l+d)<.1&&Math.abs(u+p)<.1&&Math.abs(o+h+f-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;var m=(o+1)/2,v=(h+1)/2,g=(f+1)/2,y=(s+c)/4,x=(l+d)/4,b=(u+p)/4;return m>v&&m>g?m<.01?(n=0,i=.707106781,r=.707106781):(i=y/(n=Math.sqrt(m)),r=x/n):v>g?v<.01?(n=.707106781,i=0,r=.707106781):(n=y/(i=Math.sqrt(v)),r=b/i):g<.01?(n=.707106781,i=.707106781,r=0):(n=x/(r=Math.sqrt(g)),i=b/r),this.set(n,i,r,t),this}var w=Math.sqrt((p-u)*(p-u)+(l-d)*(l-d)+(c-s)*(c-s));return Math.abs(w)<.001&&(w=1),this.x=(p-u)/w,this.y=(l-d)/w,this.z=(c-s)/w,this.w=Math.acos((o+h+f-1)/2),this},min:function(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:function(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:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){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:function(){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:function(){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:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(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:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return void 0===t&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromBufferAttribute:function(e,t,n){return void 0!==n&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}}),si.prototype=Object.assign(Object.create(Wn.prototype),{constructor:si,isWebGLRenderTarget:!0,setSize:function(e,t){this.width===e&&this.height===t||(this.width=e,this.height=t,this.texture.image.width=e,this.texture.image.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),li.prototype=Object.assign(Object.create(si.prototype),{constructor:li,isWebGLMultisampleRenderTarget:!0,copy:function(e){return si.prototype.copy.call(this,e),this.samples=e.samples,this}});var ci=new $n,hi=new vi,ui=new $n(0,0,0),di=new $n(1,1,1),pi=new $n,fi=new $n,mi=new $n;function vi(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}Object.assign(vi.prototype,{isMatrix4:!0,set:function(e,t,n,i,r,a,o,s,l,c,h,u,d,p,f,m){var v=this.elements;return v[0]=e,v[4]=t,v[8]=n,v[12]=i,v[1]=r,v[5]=a,v[9]=o,v[13]=s,v[2]=l,v[6]=c,v[10]=h,v[14]=u,v[3]=d,v[7]=p,v[11]=f,v[15]=m,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return(new vi).fromArray(this.elements)},copy:function(e){var 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:function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this},extractBasis:function(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(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:function(e){var t=this.elements,n=e.elements,i=1/ci.setFromMatrixColumn(e,0).length(),r=1/ci.setFromMatrixColumn(e,1).length(),a=1/ci.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]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromEuler:function(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,n=e.x,i=e.y,r=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(i),l=Math.sin(i),c=Math.cos(r),h=Math.sin(r);if("XYZ"===e.order){var u=a*c,d=a*h,p=o*c,f=o*h;t[0]=s*c,t[4]=-s*h,t[8]=l,t[1]=d+p*l,t[5]=u-f*l,t[9]=-o*s,t[2]=f-u*l,t[6]=p+d*l,t[10]=a*s}else if("YXZ"===e.order){var m=s*c,v=s*h,g=l*c,y=l*h;t[0]=m+y*o,t[4]=g*o-v,t[8]=a*l,t[1]=a*h,t[5]=a*c,t[9]=-o,t[2]=v*o-g,t[6]=y+m*o,t[10]=a*s}else if("ZXY"===e.order){m=s*c,v=s*h,g=l*c,y=l*h;t[0]=m-y*o,t[4]=-a*h,t[8]=g+v*o,t[1]=v+g*o,t[5]=a*c,t[9]=y-m*o,t[2]=-a*l,t[6]=o,t[10]=a*s}else if("ZYX"===e.order){u=a*c,d=a*h,p=o*c,f=o*h;t[0]=s*c,t[4]=p*l-d,t[8]=u*l+f,t[1]=s*h,t[5]=f*l+u,t[9]=d*l-p,t[2]=-l,t[6]=o*s,t[10]=a*s}else if("YZX"===e.order){var x=a*s,b=a*l,w=o*s,_=o*l;t[0]=s*c,t[4]=_-x*h,t[8]=w*h+b,t[1]=h,t[5]=a*c,t[9]=-o*c,t[2]=-l*c,t[6]=b*h+w,t[10]=x-_*h}else if("XZY"===e.order){x=a*s,b=a*l,w=o*s,_=o*l;t[0]=s*c,t[4]=-h,t[8]=l*c,t[1]=x*h+_,t[5]=a*c,t[9]=b*h-w,t[2]=w*h-b,t[6]=o*c,t[10]=_*h+x}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:function(e){return this.compose(ui,e,di)},lookAt:function(e,t,n){var i=this.elements;return mi.subVectors(e,t),0===mi.lengthSq()&&(mi.z=1),mi.normalize(),pi.crossVectors(n,mi),0===pi.lengthSq()&&(1===Math.abs(n.z)?mi.x+=1e-4:mi.z+=1e-4,mi.normalize(),pi.crossVectors(n,mi)),pi.normalize(),fi.crossVectors(mi,pi),i[0]=pi.x,i[4]=fi.x,i[8]=mi.x,i[1]=pi.y,i[5]=fi.y,i[9]=mi.y,i[2]=pi.z,i[6]=fi.z,i[10]=mi.z,this},multiply:function(e,t){return void 0!==t?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,i=t.elements,r=this.elements,a=n[0],o=n[4],s=n[8],l=n[12],c=n[1],h=n[5],u=n[9],d=n[13],p=n[2],f=n[6],m=n[10],v=n[14],g=n[3],y=n[7],x=n[11],b=n[15],w=i[0],_=i[4],M=i[8],S=i[12],E=i[1],T=i[5],A=i[9],L=i[13],R=i[2],P=i[6],C=i[10],O=i[14],I=i[3],D=i[7],N=i[11],z=i[15];return r[0]=a*w+o*E+s*R+l*I,r[4]=a*_+o*T+s*P+l*D,r[8]=a*M+o*A+s*C+l*N,r[12]=a*S+o*L+s*O+l*z,r[1]=c*w+h*E+u*R+d*I,r[5]=c*_+h*T+u*P+d*D,r[9]=c*M+h*A+u*C+d*N,r[13]=c*S+h*L+u*O+d*z,r[2]=p*w+f*E+m*R+v*I,r[6]=p*_+f*T+m*P+v*D,r[10]=p*M+f*A+m*C+v*N,r[14]=p*S+f*L+m*O+v*z,r[3]=g*w+y*E+x*R+b*I,r[7]=g*_+y*T+x*P+b*D,r[11]=g*M+y*A+x*C+b*N,r[15]=g*S+y*L+x*O+b*z,this},multiplyScalar:function(e){var 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},applyToBufferAttribute:function(e){for(var t=0,n=e.count;t1){for(var t=0;t1){for(var t=0;t0){i.children=[];for(s=0;s0&&(n.geometries=u),d.length>0&&(n.materials=d),p.length>0&&(n.textures=p),f.length>0&&(n.images=f),o.length>0&&(n.shapes=o)}return n.object=i,n;function m(e){var t=[];for(var n in e){var i=e[n];delete i.metadata,t.push(i)}return t}},clone:function(e){return(new this.constructor).copy(this,e)},copy:function(e,t){if(void 0===t&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),!0===t)for(var n=0;ns)return!1}return!0}Object.assign(Yi.prototype,{isBox3:!0,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromArray:function(e){for(var t=1/0,n=1/0,i=1/0,r=-1/0,a=-1/0,o=-1/0,s=0,l=e.length;sr&&(r=c),h>a&&(a=h),u>o&&(o=u)}return this.min.set(t,n,i),this.max.set(r,a,o),this},setFromBufferAttribute:function(e){for(var t=1/0,n=1/0,i=1/0,r=-1/0,a=-1/0,o=-1/0,s=0,l=e.count;sr&&(r=c),h>a&&(a=h),u>o&&(o=u)}return this.min.set(t,n,i),this.max.set(r,a,o),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)},containsBox:function(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:function(e,t){return void 0===t&&(console.warn("THREE.Box3: .getParameter() target is now required"),t=new $n),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:function(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)},intersectsSphere:function(e){return this.clampPoint(e.center,Ui),Ui.distanceToSquared(e.center)<=e.radius*e.radius},intersectsPlane:function(e){var 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:function(e){if(this.isEmpty())return!1;this.getCenter(ji),Wi.subVectors(this.max,ji),Fi.subVectors(e.a,ji),Bi.subVectors(e.b,ji),ki.subVectors(e.c,ji),Gi.subVectors(Bi,Fi),Vi.subVectors(ki,Bi),Hi.subVectors(Fi,ki);var t=[0,-Gi.z,Gi.y,0,-Vi.z,Vi.y,0,-Hi.z,Hi.y,Gi.z,0,-Gi.x,Vi.z,0,-Vi.x,Hi.z,0,-Hi.x,-Gi.y,Gi.x,0,-Vi.y,Vi.x,0,-Hi.y,Hi.x,0];return!!Zi(t,Fi,Bi,ki,Wi)&&(!!Zi(t=[1,0,0,0,1,0,0,0,1],Fi,Bi,ki,Wi)&&(qi.crossVectors(Gi,Vi),Zi(t=[qi.x,qi.y,qi.z],Fi,Bi,ki,Wi)))},clampPoint:function(e,t){return void 0===t&&(console.warn("THREE.Box3: .clampPoint() target is now required"),t=new $n),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){return Ui.copy(e).clamp(this.min,this.max).sub(e).length()},getBoundingSphere:function(e){return void 0===e&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(e.center),e.radius=.5*this.getSize(Ui).length(),e},intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:function(e){return this.isEmpty()?this:(zi[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),zi[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),zi[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),zi[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),zi[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),zi[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),zi[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),zi[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(zi),this)},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}});var Ji=new Yi;function Ki(e,t){this.center=void 0!==e?e:new $n,this.radius=void 0!==t?t:0}Object.assign(Ki.prototype,{set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(e,t){var n=this.center;void 0!==t?n.copy(t):Ji.setFromPoints(e).getCenter(n);for(var i=0,r=0,a=e.length;rthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t},getBoundingBox:function(e){return void 0===e&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),e=new Yi),e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}});var Qi=new $n,$i=new $n,er=new $n,tr=new $n,nr=new $n,ir=new $n,rr=new $n;function ar(e,t){this.origin=void 0!==e?e:new $n,this.direction=void 0!==t?t:new $n}Object.assign(ar.prototype,{set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){return void 0===t&&(console.warn("THREE.Ray: .at() target is now required"),t=new $n),t.copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this},recast:function(e){return this.origin.copy(this.at(e,Qi)),this},closestPointToPoint:function(e,t){void 0===t&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),t=new $n),t.subVectors(e,this.origin);var n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(e){var t=Qi.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Qi.copy(this.direction).multiplyScalar(t).add(this.origin),Qi.distanceToSquared(e))},distanceSqToSegment:function(e,t,n,i){$i.copy(e).add(t).multiplyScalar(.5),er.copy(t).sub(e).normalize(),tr.copy(this.origin).sub($i);var r,a,o,s,l=.5*e.distanceTo(t),c=-this.direction.dot(er),h=tr.dot(this.direction),u=-tr.dot(er),d=tr.lengthSq(),p=Math.abs(1-c*c);if(p>0)if(a=c*h-u,s=l*p,(r=c*u-h)>=0)if(a>=-s)if(a<=s){var f=1/p;o=(r*=f)*(r+c*(a*=f)+2*h)+a*(c*r+a+2*u)+d}else a=l,o=-(r=Math.max(0,-(c*a+h)))*r+a*(a+2*u)+d;else a=-l,o=-(r=Math.max(0,-(c*a+h)))*r+a*(a+2*u)+d;else a<=-s?o=-(r=Math.max(0,-(-c*l+h)))*r+(a=r>0?-l:Math.min(Math.max(-l,-u),l))*(a+2*u)+d:a<=s?(r=0,o=(a=Math.min(Math.max(-l,-u),l))*(a+2*u)+d):o=-(r=Math.max(0,-(c*l+h)))*r+(a=r>0?l:Math.min(Math.max(-l,-u),l))*(a+2*u)+d;else a=c>0?-l:l,o=-(r=Math.max(0,-(c*a+h)))*r+a*(a+2*u)+d;return n&&n.copy(this.direction).multiplyScalar(r).add(this.origin),i&&i.copy(er).multiplyScalar(a).add($i),o},intersectSphere:function(e,t){Qi.subVectors(e.center,this.origin);var n=Qi.dot(this.direction),i=Qi.dot(Qi)-n*n,r=e.radius*e.radius;if(i>r)return null;var a=Math.sqrt(r-i),o=n-a,s=n+a;return o<0&&s<0?null:o<0?this.at(s,t):this.at(o,t)},intersectsSphere:function(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(0===t)return 0===e.distanceToPoint(this.origin)?0:null;var n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null},intersectPlane:function(e,t){var n=this.distanceToPlane(e);return null===n?null:this.at(n,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);return 0===t||e.normal.dot(this.direction)*t<0},intersectBox:function(e,t){var n,i,r,a,o,s,l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;return l>=0?(n=(e.min.x-u.x)*l,i=(e.max.x-u.x)*l):(n=(e.max.x-u.x)*l,i=(e.min.x-u.x)*l),c>=0?(r=(e.min.y-u.y)*c,a=(e.max.y-u.y)*c):(r=(e.max.y-u.y)*c,a=(e.min.y-u.y)*c),n>a||r>i?null:((r>n||n!=n)&&(n=r),(a=0?(o=(e.min.z-u.z)*h,s=(e.max.z-u.z)*h):(o=(e.max.z-u.z)*h,s=(e.min.z-u.z)*h),n>s||o>i?null:((o>n||n!=n)&&(n=o),(s=0?n:i,t)))},intersectsBox:function(e){return null!==this.intersectBox(e,Qi)},intersectTriangle:function(e,t,n,i,r){nr.subVectors(t,e),ir.subVectors(n,e),rr.crossVectors(nr,ir);var a,o=this.direction.dot(rr);if(o>0){if(i)return null;a=1}else{if(!(o<0))return null;a=-1,o=-o}tr.subVectors(this.origin,e);var s=a*this.direction.dot(ir.crossVectors(tr,ir));if(s<0)return null;var l=a*this.direction.dot(nr.cross(tr));if(l<0)return null;if(s+l>o)return null;var c=-a*tr.dot(rr);return c<0?null:this.at(c/o,r)},applyMatrix4:function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}});var or=new $n,sr=new $n,lr=new ni;function cr(e,t){this.normal=void 0!==e?e:new $n(1,0,0),this.constant=void 0!==t?t:0}Object.assign(cr.prototype,{isPlane:!0,set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(e,t,n){var i=or.subVectors(n,t).cross(sr.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return void 0===t&&(console.warn("THREE.Plane: .projectPoint() target is now required"),t=new $n),t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)},intersectLine:function(e,t){void 0===t&&(console.warn("THREE.Plane: .intersectLine() target is now required"),t=new $n);var n=e.delta(or),i=this.normal.dot(n);if(0===i)return 0===this.distanceToPoint(e.start)?t.copy(e.start):void 0;var r=-(e.start.dot(this.normal)+this.constant)/i;return r<0||r>1?void 0:t.copy(n).multiplyScalar(r).add(e.start)},intersectsLine:function(e){var t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){return void 0===e&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),e=new $n),e.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(e,t){var n=t||lr.getNormalMatrix(e),i=this.coplanarPoint(or).applyMatrix4(e),r=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(r),this},translate:function(e){return this.constant-=e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}});var hr=new $n,ur=new $n,dr=new $n,pr=new $n,fr=new $n,mr=new $n,vr=new $n,gr=new $n,yr=new $n,xr=new $n;function br(e,t,n){this.a=void 0!==e?e:new $n,this.b=void 0!==t?t:new $n,this.c=void 0!==n?n:new $n}Object.assign(br,{getNormal:function(e,t,n,i){void 0===i&&(console.warn("THREE.Triangle: .getNormal() target is now required"),i=new $n),i.subVectors(n,t),hr.subVectors(e,t),i.cross(hr);var r=i.lengthSq();return r>0?i.multiplyScalar(1/Math.sqrt(r)):i.set(0,0,0)},getBarycoord:function(e,t,n,i,r){hr.subVectors(i,t),ur.subVectors(n,t),dr.subVectors(e,t);var a=hr.dot(hr),o=hr.dot(ur),s=hr.dot(dr),l=ur.dot(ur),c=ur.dot(dr),h=a*l-o*o;if(void 0===r&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),r=new $n),0===h)return r.set(-2,-1,-1);var u=1/h,d=(l*s-o*c)*u,p=(a*c-o*s)*u;return r.set(1-d-p,p,d)},containsPoint:function(e,t,n,i){return br.getBarycoord(e,t,n,i,pr),pr.x>=0&&pr.y>=0&&pr.x+pr.y<=1},getUV:function(e,t,n,i,r,a,o,s){return this.getBarycoord(e,t,n,i,pr),s.set(0,0),s.addScaledVector(r,pr.x),s.addScaledVector(a,pr.y),s.addScaledVector(o,pr.z),s},isFrontFacing:function(e,t,n,i){return hr.subVectors(n,t),ur.subVectors(e,t),hr.cross(ur).dot(i)<0}}),Object.assign(br.prototype,{set:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this},setFromPointsAndIndices:function(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},getArea:function(){return hr.subVectors(this.c,this.b),ur.subVectors(this.a,this.b),.5*hr.cross(ur).length()},getMidpoint:function(e){return void 0===e&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),e=new $n),e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(e){return br.getNormal(this.a,this.b,this.c,e)},getPlane:function(e){return void 0===e&&(console.warn("THREE.Triangle: .getPlane() target is now required"),e=new cr),e.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(e,t){return br.getBarycoord(e,this.a,this.b,this.c,t)},getUV:function(e,t,n,i,r){return br.getUV(e,this.a,this.b,this.c,t,n,i,r)},containsPoint:function(e){return br.containsPoint(e,this.a,this.b,this.c)},isFrontFacing:function(e){return br.isFrontFacing(this.a,this.b,this.c,e)},intersectsBox:function(e){return e.intersectsTriangle(this)},closestPointToPoint:function(e,t){void 0===t&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),t=new $n);var n,i,r=this.a,a=this.b,o=this.c;fr.subVectors(a,r),mr.subVectors(o,r),gr.subVectors(e,r);var s=fr.dot(gr),l=mr.dot(gr);if(s<=0&&l<=0)return t.copy(r);yr.subVectors(e,a);var c=fr.dot(yr),h=mr.dot(yr);if(c>=0&&h<=c)return t.copy(a);var u=s*h-c*l;if(u<=0&&s>=0&&c<=0)return n=s/(s-c),t.copy(r).addScaledVector(fr,n);xr.subVectors(e,o);var d=fr.dot(xr),p=mr.dot(xr);if(p>=0&&d<=p)return t.copy(o);var f=d*l-s*p;if(f<=0&&l>=0&&p<=0)return i=l/(l-p),t.copy(r).addScaledVector(mr,i);var m=c*p-d*h;if(m<=0&&h-c>=0&&d-p>=0)return vr.subVectors(o,a),i=(h-c)/(h-c+(d-p)),t.copy(a).addScaledVector(vr,i);var v=1/(m+f+u);return n=f*v,i=u*v,t.copy(r).addScaledVector(fr,n).addScaledVector(mr,i)},equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}});var wr={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},_r={h:0,s:0,l:0},Mr={h:0,s:0,l:0};function Sr(e,t,n){return void 0===t&&void 0===n?this.set(e):this.setRGB(e,t,n)}function Er(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+6*(t-e)*n:n<.5?t:n<2/3?e+6*(t-e)*(2/3-n):e}function Tr(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function Ar(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}function Lr(e,t,n,i,r,a){this.a=e,this.b=t,this.c=n,this.normal=i&&i.isVector3?i:new $n,this.vertexNormals=Array.isArray(i)?i:[],this.color=r&&r.isColor?r:new Sr,this.vertexColors=Array.isArray(r)?r:[],this.materialIndex=void 0!==a?a:0}Object.assign(Sr.prototype,{isColor:!0,r:1,g:1,b:1,set:function(e){return e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e),this},setScalar:function(e){return this.r=e,this.g=e,this.b=e,this},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(255&e)/255,this},setRGB:function(e,t,n){return this.r=e,this.g=t,this.b=n,this},setHSL:function(e,t,n){if(e=Yn.euclideanModulo(e,1),t=Yn.clamp(t,0,1),n=Yn.clamp(n,0,1),0===t)this.r=this.g=this.b=n;else{var i=n<=.5?n*(1+t):n+t-n*t,r=2*n-i;this.r=Er(r,i,e+1/3),this.g=Er(r,i,e),this.b=Er(r,i,e-1/3)}return this},setStyle:function(e){function t(t){void 0!==t&&parseFloat(t)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var i,r=n[1],a=n[2];switch(r){case"rgb":case"rgba":if(i=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,t(i[5]),this;if(i=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,t(i[5]),this;break;case"hsl":case"hsla":if(i=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a)){var o=parseFloat(i[1])/360,s=parseInt(i[2],10)/100,l=parseInt(i[3],10)/100;return t(i[5]),this.setHSL(o,s,l)}}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(e)){var c=n[1],h=c.length;if(3===h)return this.r=parseInt(c.charAt(0)+c.charAt(0),16)/255,this.g=parseInt(c.charAt(1)+c.charAt(1),16)/255,this.b=parseInt(c.charAt(2)+c.charAt(2),16)/255,this;if(6===h)return this.r=parseInt(c.charAt(0)+c.charAt(1),16)/255,this.g=parseInt(c.charAt(2)+c.charAt(3),16)/255,this.b=parseInt(c.charAt(4)+c.charAt(5),16)/255,this}return e&&e.length>0?this.setColorName(e):this},setColorName:function(e){var t=wr[e];return void 0!==t?this.setHex(t):console.warn("THREE.Color: Unknown color "+e),this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return void 0===t&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){void 0===t&&(t=2);var n=t>0?1/t:1;return this.r=Math.pow(e.r,n),this.g=Math.pow(e.g,n),this.b=Math.pow(e.b,n),this},convertGammaToLinear:function(e){return this.copyGammaToLinear(this,e),this},convertLinearToGamma:function(e){return this.copyLinearToGamma(this,e),this},copySRGBToLinear:function(e){return this.r=Tr(e.r),this.g=Tr(e.g),this.b=Tr(e.b),this},copyLinearToSRGB:function(e){return this.r=Ar(e.r),this.g=Ar(e.g),this.b=Ar(e.b),this},convertSRGBToLinear:function(){return this.copySRGBToLinear(this),this},convertLinearToSRGB:function(){return this.copyLinearToSRGB(this),this},getHex:function(){return 255*this.r<<16^255*this.g<<8^255*this.b<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(e){void 0===e&&(console.warn("THREE.Color: .getHSL() target is now required"),e={h:0,s:0,l:0});var t,n,i=this.r,r=this.g,a=this.b,o=Math.max(i,r,a),s=Math.min(i,r,a),l=(s+o)/2;if(s===o)t=0,n=0;else{var c=o-s;switch(n=l<=.5?c/(o+s):c/(2-o-s),o){case i:t=(r-a)/c+(rt&&(t=e[n]);return t}Pr.prototype=Object.assign(Object.create(Wn.prototype),{constructor:Pr,isMaterial:!0,onBeforeCompile:function(){},setValues:function(e){if(void 0!==e)for(var t in e){var n=e[t];if(void 0!==n)if("shading"!==t){var i=this[t];void 0!==i?i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n:console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.")}else console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=1===n;else console.warn("THREE.Material: '"+t+"' parameter is undefined.")}},toJSON:function(e){var t=void 0===e||"string"==typeof e;t&&(e={textures:{},images:{}});var n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};function i(e){var t=[];for(var n in e){var i=e[n];delete i.metadata,t.push(i)}return t}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),void 0!==this.roughness&&(n.roughness=this.roughness),void 0!==this.metalness&&(n.metalness=this.metalness),this.sheen&&this.sheen.isColor&&(n.sheen=this.sheen.getHex()),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&1!==this.emissiveIntensity&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),void 0!==this.shininess&&(n.shininess=this.shininess),void 0!==this.clearcoat&&(n.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid),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.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,n.reflectivity=this.reflectivity,n.refractionRatio=this.refractionRatio,void 0!==this.combine&&(n.combine=this.combine),void 0!==this.envMapIntensity&&(n.envMapIntensity=this.envMapIntensity)),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),void 0!==this.size&&(n.size=this.size),void 0!==this.sizeAttenuation&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==Ie&&(n.blending=this.blending),!0===this.flatShading&&(n.flatShading=this.flatShading),this.side!==Te&&(n.side=this.side),this.vertexColors!==Re&&(n.vertexColors=this.vertexColors),this.opacity<1&&(n.opacity=this.opacity),!0===this.transparent&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.stencilWrite=this.stencilWrite,n.stencilWriteMask=this.stencilWriteMask,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilFuncMask=this.stencilFuncMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation&&0!==this.rotation&&(n.rotation=this.rotation),!0===this.polygonOffset&&(n.polygonOffset=!0),0!==this.polygonOffsetFactor&&(n.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&1!==this.linewidth&&(n.linewidth=this.linewidth),void 0!==this.dashSize&&(n.dashSize=this.dashSize),void 0!==this.gapSize&&(n.gapSize=this.gapSize),void 0!==this.scale&&(n.scale=this.scale),!0===this.dithering&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),!0===this.premultipliedAlpha&&(n.premultipliedAlpha=this.premultipliedAlpha),!0===this.wireframe&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(n.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(n.wireframeLinejoin=this.wireframeLinejoin),!0===this.morphTargets&&(n.morphTargets=!0),!0===this.morphNormals&&(n.morphNormals=!0),!0===this.skinning&&(n.skinning=!0),!1===this.visible&&(n.visible=!1),!1===this.toneMapped&&(n.toneMapped=!1),"{}"!==JSON.stringify(this.userData)&&(n.userData=this.userData),t){var r=i(e.textures),a=i(e.images);r.length>0&&(n.textures=r),a.length>0&&(n.images=a)}return n},clone:function(){return(new this.constructor).copy(this)},copy:function(e){this.name=e.name,this.fog=e.fog,this.blending=e.blending,this.side=e.side,this.flatShading=e.flatShading,this.vertexTangents=e.vertexTangents,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;var t=e.clippingPlanes,n=null;if(null!==t){var i=t.length;n=new Array(i);for(var r=0;r!==i;++r)n[r]=t[r].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.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this},dispose:function(){this.dispatchEvent({type:"dispose"})}}),Cr.prototype=Object.create(Pr.prototype),Cr.prototype.constructor=Cr,Cr.prototype.isMeshBasicMaterial=!0,Cr.prototype.copy=function(e){return Pr.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this},Object.defineProperty(Or.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(Or.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this},copyAt:function(e,t,n){e*=this.itemSize,n*=t.itemSize;for(var i=0,r=this.itemSize;i0,o=r[1]&&r[1].length>0,s=e.morphTargets,l=s.length;if(l>0){t=[];for(var c=0;c0){h=[];for(c=0;c0&&0===n.length&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(c=0;c65535?Br:Ur)(e,1):this.index=e},getAttribute:function(e){return this.attributes[e]},setAttribute:function(e,t){return this.attributes[e]=t,this},deleteAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,n){this.groups.push({start:e,count:t,materialIndex:void 0!==n?n:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix:function(e){var t=this.attributes.position;void 0!==t&&(e.applyToBufferAttribute(t),t.needsUpdate=!0);var n=this.attributes.normal;void 0!==n&&((new ni).getNormalMatrix(e).applyToBufferAttribute(n),n.needsUpdate=!0);var i=this.attributes.tangent;void 0!==i&&((new ni).getNormalMatrix(e).applyToBufferAttribute(i),i.needsUpdate=!0);return null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this},rotateX:function(e){return Wr.makeRotationX(e),this.applyMatrix(Wr),this},rotateY:function(e){return Wr.makeRotationY(e),this.applyMatrix(Wr),this},rotateZ:function(e){return Wr.makeRotationZ(e),this.applyMatrix(Wr),this},translate:function(e,t,n){return Wr.makeTranslation(e,t,n),this.applyMatrix(Wr),this},scale:function(e,t,n){return Wr.makeScale(e,t,n),this.applyMatrix(Wr),this},lookAt:function(e){return qr.lookAt(e),qr.updateMatrix(),this.applyMatrix(qr.matrix),this},center:function(){return this.computeBoundingBox(),this.boundingBox.getCenter(Xr).negate(),this.translate(Xr.x,Xr.y,Xr.z),this},setFromObject:function(e){var t=e.geometry;if(e.isPoints||e.isLine){var n=new kr(3*t.vertices.length,3),i=new kr(3*t.colors.length,3);if(this.setAttribute("position",n.copyVector3sArray(t.vertices)),this.setAttribute("color",i.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var r=new kr(t.lineDistances.length,1);this.setAttribute("lineDistance",r.copyArray(t.lineDistances))}null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone())}else e.isMesh&&t&&t.isGeometry&&this.fromGeometry(t);return this},setFromPoints:function(e){for(var t=[],n=0,i=e.length;n0){var n=new Float32Array(3*e.normals.length);this.setAttribute("normal",new Or(n,3).copyVector3sArray(e.normals))}if(e.colors.length>0){var i=new Float32Array(3*e.colors.length);this.setAttribute("color",new Or(i,3).copyColorsArray(e.colors))}if(e.uvs.length>0){var r=new Float32Array(2*e.uvs.length);this.setAttribute("uv",new Or(r,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){var a=new Float32Array(2*e.uvs2.length);this.setAttribute("uv2",new Or(a,2).copyVector2sArray(e.uvs2))}for(var o in this.groups=e.groups,e.morphTargets){for(var s=[],l=e.morphTargets[o],c=0,h=l.length;c0){var p=new kr(4*e.skinIndices.length,4);this.setAttribute("skinIndex",p.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){var f=new kr(4*e.skinWeights.length,4);this.setAttribute("skinWeight",f.copyVector4sArray(e.skinWeights))}return null!==e.boundingSphere&&(this.boundingSphere=e.boundingSphere.clone()),null!==e.boundingBox&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){null===this.boundingBox&&(this.boundingBox=new Yi);var e=this.attributes.position,t=this.morphAttributes.position;if(void 0!==e){if(this.boundingBox.setFromBufferAttribute(e),t)for(var n=0,i=t.length;n0&&(e.userData=this.userData),void 0!==this.parameters){var t=this.parameters;for(var n in t)void 0!==t[n]&&(e[n]=t[n]);return e}e.data={attributes:{}};var i=this.index;null!==i&&(e.data.index={type:i.array.constructor.name,array:Array.prototype.slice.call(i.array)});var r=this.attributes;for(var n in r){var a=(d=r[n]).toJSON();""!==d.name&&(a.name=d.name),e.data.attributes[n]=a}var o={},s=!1;for(var n in this.morphAttributes){for(var l=this.morphAttributes[n],c=[],h=0,u=l.length;h0&&(o[n]=c,s=!0)}s&&(e.data.morphAttributes=o);var p=this.groups;p.length>0&&(e.data.groups=JSON.parse(JSON.stringify(p)));var f=this.boundingSphere;return null!==f&&(e.data.boundingSphere={center:f.center.toArray(),radius:f.radius}),e},clone:function(){return(new Kr).copy(this)},copy:function(e){var t,n,i;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var r=e.index;null!==r&&this.setIndex(r.clone());var a=e.attributes;for(t in a){var o=a[t];this.setAttribute(t,o.clone())}var s=e.morphAttributes;for(t in s){var l=[],c=s[t];for(n=0,i=c.length;nn.far?null:{distance:l,point:fa.clone(),object:e}}function ga(e,t,n,i,r,a,o,s,l,c,h){ta.fromBufferAttribute(r,l),na.fromBufferAttribute(r,c),ia.fromBufferAttribute(r,h);var u=e.morphTargetInfluences;if(t.morphTargets&&a&&u){sa.set(0,0,0),la.set(0,0,0),ca.set(0,0,0);for(var d=0,p=a.length;d0){var o=r[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=o.length;e0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:function(e,t){var n,i=this.geometry,r=this.material,a=this.matrixWorld;if(void 0!==r&&(null===i.boundingSphere&&i.computeBoundingSphere(),ea.copy(i.boundingSphere),ea.applyMatrix4(a),!1!==e.ray.intersectsSphere(ea)&&(Qr.getInverse(a),$r.copy(e.ray).applyMatrix4(Qr),null===i.boundingBox||!1!==$r.intersectsBox(i.boundingBox))))if(this.drawMode===An){if(i.isBufferGeometry){var o,s,l,c,h,u,d,p,f,m=i.index,v=i.attributes.position,g=i.morphAttributes.position,y=i.attributes.uv,x=i.attributes.uv2,b=i.groups,w=i.drawRange;if(null!==m)if(Array.isArray(r))for(c=0,u=b.length;c0&&(E=R);for(var P=0,C=L.length;P0)for(c=0;c0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var e,t,n;for(this.computeFaceNormals(),e=0,t=this.faces.length;e0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,n,i,r;for(n=0,i=this.faces.length;n=0;n--){var f=d[n];for(this.faces.splice(f,1),o=0,s=this.faceVertexUvs.length;o0,v=p.vertexNormals.length>0,g=1!==p.color.r||1!==p.color.g||1!==p.color.b,y=p.vertexColors.length>0,x=0;if(x=M(x,0,0),x=M(x,1,!0),x=M(x,2,!1),x=M(x,3,f),x=M(x,4,m),x=M(x,5,v),x=M(x,6,g),x=M(x,7,y),o.push(x),o.push(p.a,p.b,p.c),o.push(p.materialIndex),f){var b=this.faceVertexUvs[0][r];o.push(T(b[0]),T(b[1]),T(b[2]))}if(m&&o.push(S(p.normal)),v){var w=p.vertexNormals;o.push(S(w[0]),S(w[1]),S(w[2]))}if(g&&o.push(E(p.color)),y){var _=p.vertexColors;o.push(E(_[0]),E(_[1]),E(_[2]))}}function M(e,t,n){return n?e|1<0&&(e.data.colors=c),u.length>0&&(e.data.uvs=[u]),e.data.faces=o,e},clone:function(){return(new _a).copy(this)},copy:function(e){var t,n,i,r,a,o;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var s=e.vertices;for(t=0,n=s.length;t0?1:-1,c.push(R.x,R.y,R.z),h.push(y/m),h.push(1-x/v),A+=1}}for(x=0;x0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;var r={};for(var a in this.extensions)!0===this.extensions[a]&&(r[a]=!0);return Object.keys(r).length>0&&(t.extensions=r),t},Pa.prototype=Object.assign(Object.create(Di.prototype),{constructor:Pa,isCamera:!0,copy:function(e,t){return Di.prototype.copy.call(this,e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this},getWorldDirection:function(e){void 0===e&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),e=new $n),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()},updateMatrixWorld:function(e){Di.prototype.updateMatrixWorld.call(this,e),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return(new this.constructor).copy(this)}}),Ca.prototype=Object.assign(Object.create(Pa.prototype),{constructor:Ca,isPerspectiveCamera:!0,copy:function(e,t){return Pa.prototype.copy.call(this,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:function(e){var t=.5*this.getFilmHeight()/e;this.fov=2*Yn.RAD2DEG*Math.atan(t),this.updateProjectionMatrix()},getFocalLength:function(){var e=Math.tan(.5*Yn.DEG2RAD*this.fov);return.5*this.getFilmHeight()/e},getEffectiveFOV:function(){return 2*Yn.RAD2DEG*Math.atan(Math.tan(.5*Yn.DEG2RAD*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(e,t,n,i,r,a){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=a,this.updateProjectionMatrix()},clearViewOffset:function(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=this.near,t=e*Math.tan(.5*Yn.DEG2RAD*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i,a=this.view;if(null!==this.view&&this.view.enabled){var o=a.fullWidth,s=a.fullHeight;r+=a.offsetX*i/o,t-=a.offsetY*n/s,i*=a.width/o,n*=a.height/s}var l=this.filmOffset;0!==l&&(r+=e*l/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=Di.prototype.toJSON.call(this,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}});var Oa=90,Ia=1;function Da(e,t,n,i){Di.call(this),this.type="CubeCamera";var r=new Ca(Oa,Ia,e,t);r.up.set(0,-1,0),r.lookAt(new $n(1,0,0)),this.add(r);var a=new Ca(Oa,Ia,e,t);a.up.set(0,-1,0),a.lookAt(new $n(-1,0,0)),this.add(a);var o=new Ca(Oa,Ia,e,t);o.up.set(0,0,1),o.lookAt(new $n(0,1,0)),this.add(o);var s=new Ca(Oa,Ia,e,t);s.up.set(0,0,-1),s.lookAt(new $n(0,-1,0)),this.add(s);var l=new Ca(Oa,Ia,e,t);l.up.set(0,-1,0),l.lookAt(new $n(0,0,1)),this.add(l);var c=new Ca(Oa,Ia,e,t);c.up.set(0,-1,0),c.lookAt(new $n(0,0,-1)),this.add(c),i=i||{format:Xt,magFilter:Pt,minFilter:Pt},this.renderTarget=new Na(n,n,i),this.renderTarget.texture.name="CubeCamera",this.update=function(e,t){null===this.parent&&this.updateMatrixWorld();var n=e.getRenderTarget(),i=this.renderTarget,h=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0),e.render(t,r),e.setRenderTarget(i,1),e.render(t,a),e.setRenderTarget(i,2),e.render(t,o),e.setRenderTarget(i,3),e.render(t,s),e.setRenderTarget(i,4),e.render(t,l),i.texture.generateMipmaps=h,e.setRenderTarget(i,5),e.render(t,c),e.setRenderTarget(n)},this.clear=function(e,t,n,i){for(var r=e.getRenderTarget(),a=this.renderTarget,o=0;o<6;o++)e.setRenderTarget(a,o),e.clear(t,n,i);e.setRenderTarget(r)}}function Na(e,t,n){si.call(this,e,t,n)}function za(e,t,n,i,r,a,o,s,l,c,h,u){ai.call(this,null,a,o,s,l,c,i,r,h,u),this.image={data:e||null,width:t||1,height:n||1},this.magFilter=void 0!==l?l:At,this.minFilter=void 0!==c?c:At,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.needsUpdate=!0}Da.prototype=Object.create(Di.prototype),Da.prototype.constructor=Da,Na.prototype=Object.create(si.prototype),Na.prototype.constructor=Na,Na.prototype.isWebGLRenderTargetCube=!0,Na.prototype.fromEquirectangularTexture=function(e,t){this.texture.type=t.type,this.texture.format=t.format,this.texture.encoding=t.encoding;var n=new Ni,i={uniforms:{tEquirect:{value:null}},vertexShader:["varying vec3 vWorldDirection;","vec3 transformDirection( in vec3 dir, in mat4 matrix ) {","\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );","}","void main() {","\tvWorldDirection = transformDirection( position, modelMatrix );","\t#include ","\t#include ","}"].join("\n"),fragmentShader:["uniform sampler2D tEquirect;","varying vec3 vWorldDirection;","#define RECIPROCAL_PI 0.31830988618","#define RECIPROCAL_PI2 0.15915494","void main() {","\tvec3 direction = normalize( vWorldDirection );","\tvec2 sampleUV;","\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;","\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;","\tgl_FragColor = texture2D( tEquirect, sampleUV );","}"].join("\n")},r=new Ra({type:"CubemapFromEquirect",uniforms:Sa(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Ae,blending:Oe});r.uniforms.tEquirect.value=t;var a=new ma(new Ma(5,5,5),r);n.add(a);var o=new Da(1,10,1);return o.renderTarget=this,o.renderTarget.texture.name="CubeCameraTexture",o.update(e,n),a.geometry.dispose(),a.material.dispose(),this},za.prototype=Object.create(ai.prototype),za.prototype.constructor=za,za.prototype.isDataTexture=!0;var Ua=new Ki,Fa=new $n;function Ba(e,t,n,i,r,a){this.planes=[void 0!==e?e:new cr,void 0!==t?t:new cr,void 0!==n?n:new cr,void 0!==i?i:new cr,void 0!==r?r:new cr,void 0!==a?a:new cr]}Object.assign(Ba.prototype,{set:function(e,t,n,i,r,a){var 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(a),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this},setFromMatrix:function(e){var t=this.planes,n=e.elements,i=n[0],r=n[1],a=n[2],o=n[3],s=n[4],l=n[5],c=n[6],h=n[7],u=n[8],d=n[9],p=n[10],f=n[11],m=n[12],v=n[13],g=n[14],y=n[15];return t[0].setComponents(o-i,h-s,f-u,y-m).normalize(),t[1].setComponents(o+i,h+s,f+u,y+m).normalize(),t[2].setComponents(o+r,h+l,f+d,y+v).normalize(),t[3].setComponents(o-r,h-l,f-d,y-v).normalize(),t[4].setComponents(o-a,h-c,f-p,y-g).normalize(),t[5].setComponents(o+a,h+c,f+p,y+g).normalize(),this},intersectsObject:function(e){var t=e.geometry;return null===t.boundingSphere&&t.computeBoundingSphere(),Ua.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Ua)},intersectsSprite:function(e){return Ua.center.set(0,0,0),Ua.radius=.7071067811865476,Ua.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ua)},intersectsSphere:function(e){for(var t=this.planes,n=e.center,i=-e.radius,r=0;r<6;r++){if(t[r].distanceToPoint(n)0?e.max.x:e.min.x,Fa.y=i.normal.y>0?e.max.y:e.min.y,Fa.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Fa)<0)return!1}return!0},containsPoint:function(e){for(var t=this.planes,n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}});var ka={alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef ALPHATEST\n\tif ( diffuseColor.a < ALPHATEST ) discard;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",begin_vertex:"vec3 transformed = vec3( position );",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {\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\treturn vec2( -1.04, 1.04 ) * a004 + r.zw;\n}\nfloat punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n#if defined ( PHYSICALLY_CORRECT_LIGHTS )\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#else\n\tif( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\treturn pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t}\n\treturn 1.0;\n#endif\n}\nvec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );\n\treturn ( 1.0 - specularColor ) * fresnel + specularColor;\n}\nvec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {\n\tfloat fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );\n\tvec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;\n\treturn Fr * fresnel + F0;\n}\nfloat G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\tfloat gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\treturn 1.0 / ( gl * gv );\n}\nfloat G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\nvec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( incidentLight.direction + viewDir );\n\tfloat dotNL = saturate( dot( normal, incidentLight.direction ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( G * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\nvec3 BRDF_Specular_GGX_Environment( const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\treturn specularColor * brdf.x + brdf.y;\n}\nvoid BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\tvec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );\n\tvec2 brdf = integrateSpecularBRDF( dotNV, roughness );\n\tvec3 FssEss = F * brdf.x + brdf.y;\n\tfloat Ess = brdf.x + brdf.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );\n\tfloat dotNH = saturate( dot( geometry.normal, halfDir ) );\n\tfloat dotLH = saturate( dot( incidentLight.direction, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, dotLH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n}\nfloat GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\treturn ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );\n}\nfloat BlinnExponentToGGXRoughness( const in float blinnExponent ) {\n\treturn sqrt( 2.0 / ( blinnExponent + 2.0 ) );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie(float roughness, float NoH) {\n\tfloat invAlpha = 1.0 / roughness;\n\tfloat cos2h = NoH * NoH;\n\tfloat sin2h = max(1.0 - cos2h, 0.0078125);\treturn (2.0 + invAlpha) * pow(sin2h, invAlpha * 0.5) / (2.0 * PI);\n}\nfloat V_Neubelt(float NoV, float NoL) {\n\treturn saturate(1.0 / (4.0 * (NoL + NoV - NoL * NoV)));\n}\nvec3 BRDF_Specular_Sheen( const in float roughness, const in vec3 L, const in GeometricContext geometry, vec3 specularColor ) {\n\tvec3 N = geometry.normal;\n\tvec3 V = geometry.viewDir;\n\tvec3 H = normalize( V + L );\n\tfloat dotNH = saturate( dot( N, H ) );\n\treturn specularColor * D_Charlie( roughness, dotNH ) * V_Neubelt( dot(N, V), dot(N, L) );\n}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 );\n\t\tfDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\tif ( clipped ) discard;\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\t#if ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP )\n\t\tvarying vec3 vViewPosition;\n\t#endif\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvarying vec3 vViewPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0 && ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif",color_fragment:"#ifdef USE_COLOR\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#ifdef USE_COLOR\n\tvarying vec3 vColor;\n#endif",color_vertex:"#ifdef USE_COLOR\n\tvColor.xyz = color.xyz;\n#endif",common:"#define PI 3.14159265359\n#define PI2 6.28318530718\n#define PI_HALF 1.5707963267949\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n#define LOG2 1.442695\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement(a) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract(sin(sn) * c);\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat max3( vec3 v ) { return max( max( v.x, v.y ), v.z ); }\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nvec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\tfloat distance = dot( planeNormal, point - pointOnPlane );\n\treturn - distance * planeNormal + point;\n}\nfloat sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn sign( dot( point - pointOnPlane, planeNormal ) );\n}\nvec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {\n\treturn lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n return m[ 2 ][ 3 ] == - 1.0;\n}",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n#define cubeUV_textureSize (1024.0)\nint getFaceFromDirection(vec3 direction) {\n\tvec3 absDirection = abs(direction);\n\tint face = -1;\n\tif( absDirection.x > absDirection.z ) {\n\t\tif(absDirection.x > absDirection.y )\n\t\t\tface = direction.x > 0.0 ? 0 : 3;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\telse {\n\t\tif(absDirection.z > absDirection.y )\n\t\t\tface = direction.z > 0.0 ? 2 : 5;\n\t\telse\n\t\t\tface = direction.y > 0.0 ? 1 : 4;\n\t}\n\treturn face;\n}\n#define cubeUV_maxLods1 (log2(cubeUV_textureSize*0.25) - 1.0)\n#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))\nvec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {\n\tfloat scale = exp2(cubeUV_maxLods1 - roughnessLevel);\n\tfloat dxRoughness = dFdx(roughness);\n\tfloat dyRoughness = dFdy(roughness);\n\tvec3 dx = dFdx( vec * scale * dxRoughness );\n\tvec3 dy = dFdy( vec * scale * dyRoughness );\n\tfloat d = max( dot( dx, dx ), dot( dy, dy ) );\n\td = clamp(d, 1.0, cubeUV_rangeClamp);\n\tfloat mipLevel = 0.5 * log2(d);\n\treturn vec2(floor(mipLevel), fract(mipLevel));\n}\n#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)\n#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)\nvec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {\n\tmipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;\n\tfloat a = 16.0 * cubeUV_rcpTextureSize;\n\tvec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );\n\tvec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;\n\tfloat powScale = exp2_packed.x * exp2_packed.y;\n\tfloat scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;\n\tfloat mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;\n\tbool bRes = mipLevel == 0.0;\n\tscale = bRes && (scale < a) ? a : scale;\n\tvec3 r;\n\tvec2 offset;\n\tint face = getFaceFromDirection(direction);\n\tfloat rcpPowScale = 1.0 / powScale;\n\tif( face == 0) {\n\t\tr = vec3(direction.x, -direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 1) {\n\t\tr = vec3(direction.y, direction.x, direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 2) {\n\t\tr = vec3(direction.z, direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;\n\t}\n\telse if( face == 3) {\n\t\tr = vec3(direction.x, direction.z, direction.y);\n\t\toffset = vec2(0.0+mipOffset,0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse if( face == 4) {\n\t\tr = vec3(direction.y, direction.x, -direction.z);\n\t\toffset = vec2(scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\telse {\n\t\tr = vec3(direction.z, -direction.x, direction.y);\n\t\toffset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);\n\t\toffset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;\n\t}\n\tr = normalize(r);\n\tfloat texelOffset = 0.5 * cubeUV_rcpTextureSize;\n\tvec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;\n\tvec2 base = offset + vec2( texelOffset );\n\treturn base + s * ( scale - 2.0 * texelOffset );\n}\n#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)\nvec4 textureCubeUV( sampler2D envMap, vec3 reflectedDirection, float roughness ) {\n\tfloat roughnessVal = roughness* cubeUV_maxLods3;\n\tfloat r1 = floor(roughnessVal);\n\tfloat r2 = r1 + 1.0;\n\tfloat t = fract(roughnessVal);\n\tvec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);\n\tfloat s = mipInfo.y;\n\tfloat level0 = mipInfo.x;\n\tfloat level1 = level0 + 1.0;\n\tlevel1 = level1 > 5.0 ? 5.0 : level1;\n\tlevel0 += min( floor( s + 0.5 ), 5.0 );\n\tvec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);\n\tvec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));\n\tvec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);\n\tvec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));\n\tvec4 result = mix(color10, color20, t);\n\treturn vec4(result.rgb, 1.0);\n}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\ttransformedNormal = mat3( instanceMatrix ) * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = normalMatrix * objectTangent;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vUv );\n\temissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",encodings_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",encodings_pars_fragment:"\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = min( floor( D ) / 255.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\t\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\tvec2 sampleUV;\n\t\treflectVec = normalize( reflectVec );\n\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\tvec4 envColor = texture2D( envMap, sampleUV );\n\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\treflectVec = normalize( reflectVec );\n\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );\n\t\tvec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\tenvColor = envMapTexelToLinear( envColor );\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#if defined( USE_ENVMAP )\n\t#ifdef ENVMAP_MODE_REFRACTION\n\t\tuniform float refractionRatio;\n\t#endif\n\tvec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {\n\t\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, queryVec, 1.0 );\n\t\t#else\n\t\t\tvec4 envMapColor = vec4( 0.0 );\n\t\t#endif\n\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t}\n\tfloat getSpecularMIPLevel( const in float roughness, const in int maxMIPLevel ) {\n\t\tfloat maxMIPLevelScalar = float( maxMIPLevel );\n\t\tfloat sigma = PI * roughness * roughness / ( 1.0 + roughness );\n\t\tfloat desiredMIPLevel = maxMIPLevelScalar + log2( sigma );\n\t\treturn clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );\n\t}\n\tvec3 getLightProbeIndirectRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in int maxMIPLevel ) {\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t vec3 reflectVec = reflect( -viewDir, normal );\n\t\t reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t#else\n\t\t vec3 reflectVec = refract( -viewDir, normal, refractionRatio );\n\t\t#endif\n\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\tfloat specularMIPLevel = getSpecularMIPLevel( roughness, maxMIPLevel );\n\t\t#ifdef ENVMAP_TYPE_CUBE\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\t\tvec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, queryReflectVec, roughness );\n\t\t#elif defined( ENVMAP_TYPE_EQUIREC )\n\t\t\tvec2 sampleUV;\n\t\t\tsampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\t\t\tsampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#elif defined( ENVMAP_TYPE_SPHERE )\n\t\t\tvec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );\n\t\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\t\tvec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#else\n\t\t\t\tvec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );\n\t\t\t#endif\n\t\t\tenvMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;\n\t\t#endif\n\t\treturn envMapColor.rgb * envMapIntensity;\n\t}\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) { \n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tfogDepth = -mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float fogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * fogDepth * fogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, fogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float fogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef TOON\n\tuniform sampler2D gradientMap;\n\tvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\t\tfloat dotNL = dot( normal, lightDirection );\n\t\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t\t#ifdef USE_GRADIENTMAP\n\t\t\treturn texture2D( gradientMap, coord ).rgb;\n\t\t#else\n\t\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t\t#endif\n\t}\n#endif",lightmap_fragment:"#ifdef USE_LIGHTMAP\n\treflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n#endif",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_vertex:"vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = PI * directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( -dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );\n\t\t#endif\n\t}\n#endif",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {\n\tvec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treturn irradiance;\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tdirectLight.color = directionalLight.color;\n\t\tdirectLight.direction = directionalLight.direction;\n\t\tdirectLight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t\tfloat shadowCameraNear;\n\t\tfloat shadowCameraFar;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tdirectLight.color = pointLight.color;\n\t\tdirectLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );\n\t\tdirectLight.visible = ( directLight.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t\tint shadow;\n\t\tfloat shadowBias;\n\t\tfloat shadowRadius;\n\t\tvec2 shadowMapSize;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tdirectLight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tfloat angleCos = dot( directLight.direction, spotLight.direction );\n\t\tif ( angleCos > spotLight.coneCos ) {\n\t\t\tfloat spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\t\tdirectLight.color = spotLight.color;\n\t\t\tdirectLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tdirectLight.visible = true;\n\t\t} else {\n\t\t\tdirectLight.color = vec3( 0.0 );\n\t\t\tdirectLight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {\n\t\tfloat dotNL = dot( geometry.normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tirradiance *= PI;\n\t\t#endif\n\t\treturn irradiance;\n\t}\n#endif",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\nstruct BlinnPhongMaterial {\n\tvec3\tdiffuseColor;\n\tvec3\tspecularColor;\n\tfloat\tspecularShininess;\n\tfloat\tspecularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\t#ifdef TOON\n\t\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\t#else\n\t\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\t\tvec3 irradiance = dotNL * directLight.color;\n\t#endif\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\treflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );\n#ifdef REFLECTIVITY\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n#endif\n#ifdef CLEARCOAT\n\tmaterial.clearcoat = saturate( clearcoat );\tmaterial.clearcoatRoughness = clamp( clearcoatRoughness, 0.04, 1.0 );\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheen;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3\tdiffuseColor;\n\tfloat\tspecularRoughness;\n\tvec3\tspecularColor;\n#ifdef CLEARCOAT\n\tfloat clearcoat;\n\tfloat clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tvec3 sheenColor;\n#endif\n};\n#define MAXIMUM_SPECULAR_COEFFICIENT 0.16\n#define DEFAULT_SPECULAR_COEFFICIENT 0.04\nfloat clearcoatDHRApprox( const in float roughness, const in float dotNL ) {\n\treturn DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.specularRoughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\tirradiance *= PI;\n\t#endif\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNL = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = ccDotNL * directLight.color;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tccIrradiance *= PI;\n\t\t#endif\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t\treflectedLight.directSpecular += ccIrradiance * material.clearcoat * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_Sheen(\n\t\t\tmaterial.specularRoughness,\n\t\t\tdirectLight.direction,\n\t\t\tgeometry,\n\t\t\tmaterial.sheenColor\n\t\t);\n\t#else\n\t\treflectedLight.directSpecular += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry.viewDir, geometry.normal, material.specularColor, material.specularRoughness);\n\t#endif\n\treflectedLight.directDiffuse += ( 1.0 - clearcoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef CLEARCOAT\n\t\tfloat ccDotNV = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular += clearcoatRadiance * material.clearcoat * BRDF_Specular_GGX_Environment( geometry.viewDir, geometry.clearcoatNormal, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearcoatRoughness );\n\t\tfloat ccDotNL = ccDotNV;\n\t\tfloat clearcoatDHR = material.clearcoat * clearcoatDHRApprox( material.clearcoatRoughness, ccDotNL );\n\t#else\n\t\tfloat clearcoatDHR = 0.0;\n\t#endif\n\tfloat clearcoatInv = 1.0 - clearcoatDHR;\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tBRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\n\treflectedLight.indirectSpecular += clearcoatInv * radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec3( pointLight.shadow, directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec3( spotLight.shadow, directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectLight.color *= all( bvec3( directionalLight.shadow, directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\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\tvec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t\t#ifndef PHYSICALLY_CORRECT_LIGHTS\n\t\t\tlightMapIrradiance *= PI;\n\t\t#endif\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.normal, material.specularRoughness, maxMipLevel );\n\t#ifdef CLEARCOAT\n\t\tclearcoatRadiance += getLightProbeIndirectRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness, maxMipLevel );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 texelColor = texture2D( map, vUv );\n\ttexelColor = mapTexelToLinear( texelColor );\n\tdiffuseColor *= texelColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n#endif\n#ifdef USE_MAP\n\tvec4 mapTexel = texture2D( map, uv );\n\tdiffuseColor *= mapTexelToLinear( mapTexel );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\tuniform mat3 uvTransform;\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];\n\tobjectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];\n\tobjectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];\n\tobjectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_MORPHNORMALS\n\tuniform float morphTargetInfluences[ 8 ];\n\t#else\n\tuniform float morphTargetInfluences[ 4 ];\n\t#endif\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];\n\ttransformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];\n\ttransformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];\n\ttransformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];\n\t#ifndef USE_MORPHNORMALS\n\ttransformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];\n\ttransformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];\n\ttransformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];\n\ttransformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];\n\t#endif\n#endif",normal_fragment_begin:"#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t\tbitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;",normal_fragment_maps:"#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\t#ifdef USE_TANGENT\n\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = normalScale * mapN.xy;\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( -vViewPosition, normal, normalScale, normalMap );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec2 normalScale, in sampler2D normalMap ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tfloat scale = sign( st1.t * st0.s - st0.t * st1.s );\n\t\tvec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );\n\t\tvec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );\n\t\tvec3 N = normalize( surf_norm );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy *= normalScale;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tbool frontFacing = dot( cross( S, T ), N ) > 0.0;\n\t\t\tmapN.xy *= ( float( frontFacing ) * 2.0 - 1.0 );\n\t\t#else\n\t\t\tmapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );\n\t\t#endif\n\t\tmat3 tsn = mat3( S, T, N );\n\t\treturn normalize( tsn * mapN );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 vTBN = mat3( tangent, bitangent, clearcoatNormal );\n\t\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t\tmapN.xy = clearcoatNormalScale * mapN.xy;\n\t\tclearcoatNormal = normalize( vTBN * mapN );\n\t#else\n\t\tclearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatNormalScale, clearcoatNormalMap );\n\t#endif\n#endif",clearcoat_normalmap_pars_fragment:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 encodeHalfRGBA ( vec2 v ) {\n\tvec4 encoded = vec4( 0.0 );\n\tconst vec2 offset = vec2( 1.0 / 255.0, 0.0 );\n\tencoded.xy = vec2( v.x, fract( v.x * 255.0 ) );\n\tencoded.xy = encoded.xy - ( encoded.yy * offset );\n\tencoded.zw = vec2( v.y, fract( v.y * 255.0 ) );\n\tencoded.zw = encoded.zw - ( encoded.ww * offset );\n\treturn encoded;\n}\nvec2 decodeHalfRGBA( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn (( near + viewZ ) * far ) / (( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#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#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 decodeHalfRGBA( 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 texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {\n\t\tconst vec2 offset = vec2( 0.0, 1.0 );\n\t\tvec2 texelSize = vec2( 1.0 ) / size;\n\t\tvec2 centroidUV = ( floor( uv * size - 0.5 ) + 0.5 ) * texelSize;\n\t\tfloat lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );\n\t\tfloat lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );\n\t\tfloat rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );\n\t\tfloat rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );\n\t\tvec2 f = fract( uv * size + 0.5 );\n\t\tfloat a = mix( lb, lt, f.y );\n\t\tfloat b = mix( rb, rt, f.y );\n\t\tfloat c = mix( a, b, f.x );\n\t\treturn c;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat 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\tshadow = (\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif",shadowmap_pars_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#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#endif\n#endif",shadowmap_vertex:"#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;\n\t}\n\t#endif\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tshadow *= all( bvec2( directionalLight.shadow, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tshadow *= all( bvec2( spotLight.shadow, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tshadow *= all( bvec2( pointLight.shadow, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\t#ifdef BONE_TEXTURE\n\t\tuniform highp sampler2D boneTexture;\n\t\tuniform int boneTextureSize;\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tfloat j = i * 4.0;\n\t\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\t\ty = dy * ( y + 0.5 );\n\t\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\t\treturn bone;\n\t\t}\n\t#else\n\t\tuniform mat4 boneMatrices[ MAX_BONES ];\n\t\tmat4 getBoneMatrix( const in float i ) {\n\t\t\tmat4 bone = boneMatrices[ int(i) ];\n\t\t\treturn bone;\n\t\t}\n\t#endif\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate(a) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nuniform float toneMappingWhitePoint;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn toneMappingExposure * color;\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\n#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )\nvec3 Uncharted2ToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );\n}",uv_pars_fragment:"#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif",uv_pars_vertex:"#ifdef USE_UV\n\t#ifdef UVS_VERTEX_ONLY\n\t\tvec2 vUv;\n\t#else\n\t\tvarying vec2 vUv;\n\t#endif\n\tuniform mat3 uvTransform;\n#endif",uv_vertex:"#ifdef USE_UV\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n#endif",uv2_pars_fragment:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvarying vec2 vUv2;\n#endif",uv2_pars_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tattribute vec2 uv2;\n\tvarying vec2 vUv2;\n#endif",uv2_vertex:"#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = uv2;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_frag:"uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include \n\t#include \n}",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",cube_frag:"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 = mapTexelToLinear( texColor );\n\tgl_FragColor.a *= opacity;\n\t#include \n\t#include \n}",cube_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n\tgl_Position.z = gl_Position.w;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - gl_FragCoord.z ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( gl_FragCoord.z );\n\t#endif\n}",depth_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main () {\n\t#include \n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include \n\t#include \n\t#include \n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include \n\t\t#include \n\t\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvWorldPosition = worldPosition.xyz;\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV;\n\tsampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\tsampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;\n\tvec4 texColor = texture2D( tEquirect, sampleUV );\n\tgl_FragColor = mapTexelToLinear( texColor );\n\t#include \n\t#include \n}",equirect_vert:"varying vec3 vWorldDirection;\n#include \nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include \n\t#include \n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvLineDistance = scale * lineDistance;\n\tvec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\treflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshbasic_vert:"#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifdef USE_ENVMAP\n\t#include \n\t#include \n\t#include \n\t#include \n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_frag:"uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\treflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include \n\treflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t\tmatcapColor = matcapTexelToLinear( matcapColor );\n\t#else\n\t\tvec4 matcapColor = vec4( 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#ifndef FLAT_SHADED\n\t\tvNormal = normalize( transformedNormal );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include \n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define REFLECTIVITY\n\t#define CLEARCOAT\n\t#define TRANSPARENCY\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef TRANSPARENCY\n\tuniform float transparency;\n#endif\n#ifdef REFLECTIVITY\n\tuniform float reflectivity;\n#endif\n#ifdef CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheen;\n#endif\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#ifdef TRANSPARENCY\n\t\tdiffuseColor.a *= saturate( 1. - transparency + linearToRelativeLuminance( reflectedLight.directSpecular + reflectedLight.indirectSpecular ) );\n\t#endif\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\tvViewPosition = - mvPosition.xyz;\n\t#include \n\t#include \n\t#include \n}",normal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n}",normal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n\t#include \n}",points_vert:"uniform float size;\nuniform float scale;\n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include \n\t#include \n\t#include \n\t#include \n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include \n}",shadow_vert:"#include \n#include \nvoid main() {\n\t#include \n\t#include \n\t#include \n\t#include \n\t#include \n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include \n#include \n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include \n\t#include \n\t#include \n\t#include \n\toutgoingLight = diffuseColor.rgb;\n\tgl_FragColor = vec4( outgoingLight, diffuseColor.a );\n\t#include \n\t#include \n\t#include \n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include \n#include \n#include \n#include \n#include \nvoid main() {\n\t#include \n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include \n\t#include \n\t#include \n}"},Ga={common:{diffuse:{value:new Sr(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new ni},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new Zn(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Sr(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new Sr(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},uvTransform:{value:new ni}},sprite:{diffuse:{value:new Sr(15658734)},opacity:{value:1},center:{value:new Zn(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},uvTransform:{value:new ni}}},Va={basic:{uniforms:Ea([Ga.common,Ga.specularmap,Ga.envmap,Ga.aomap,Ga.lightmap,Ga.fog]),vertexShader:ka.meshbasic_vert,fragmentShader:ka.meshbasic_frag},lambert:{uniforms:Ea([Ga.common,Ga.specularmap,Ga.envmap,Ga.aomap,Ga.lightmap,Ga.emissivemap,Ga.fog,Ga.lights,{emissive:{value:new Sr(0)}}]),vertexShader:ka.meshlambert_vert,fragmentShader:ka.meshlambert_frag},phong:{uniforms:Ea([Ga.common,Ga.specularmap,Ga.envmap,Ga.aomap,Ga.lightmap,Ga.emissivemap,Ga.bumpmap,Ga.normalmap,Ga.displacementmap,Ga.gradientmap,Ga.fog,Ga.lights,{emissive:{value:new Sr(0)},specular:{value:new Sr(1118481)},shininess:{value:30}}]),vertexShader:ka.meshphong_vert,fragmentShader:ka.meshphong_frag},standard:{uniforms:Ea([Ga.common,Ga.envmap,Ga.aomap,Ga.lightmap,Ga.emissivemap,Ga.bumpmap,Ga.normalmap,Ga.displacementmap,Ga.roughnessmap,Ga.metalnessmap,Ga.fog,Ga.lights,{emissive:{value:new Sr(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:ka.meshphysical_vert,fragmentShader:ka.meshphysical_frag},matcap:{uniforms:Ea([Ga.common,Ga.bumpmap,Ga.normalmap,Ga.displacementmap,Ga.fog,{matcap:{value:null}}]),vertexShader:ka.meshmatcap_vert,fragmentShader:ka.meshmatcap_frag},points:{uniforms:Ea([Ga.points,Ga.fog]),vertexShader:ka.points_vert,fragmentShader:ka.points_frag},dashed:{uniforms:Ea([Ga.common,Ga.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:ka.linedashed_vert,fragmentShader:ka.linedashed_frag},depth:{uniforms:Ea([Ga.common,Ga.displacementmap]),vertexShader:ka.depth_vert,fragmentShader:ka.depth_frag},normal:{uniforms:Ea([Ga.common,Ga.bumpmap,Ga.normalmap,Ga.displacementmap,{opacity:{value:1}}]),vertexShader:ka.normal_vert,fragmentShader:ka.normal_frag},sprite:{uniforms:Ea([Ga.sprite,Ga.fog]),vertexShader:ka.sprite_vert,fragmentShader:ka.sprite_frag},background:{uniforms:{uvTransform:{value:new ni},t2D:{value:null}},vertexShader:ka.background_vert,fragmentShader:ka.background_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:ka.cube_vert,fragmentShader:ka.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:ka.equirect_vert,fragmentShader:ka.equirect_frag},distanceRGBA:{uniforms:Ea([Ga.common,Ga.displacementmap,{referencePosition:{value:new $n},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:ka.distanceRGBA_vert,fragmentShader:ka.distanceRGBA_frag},shadow:{uniforms:Ea([Ga.lights,Ga.fog,{color:{value:new Sr(0)},opacity:{value:1}}]),vertexShader:ka.shadow_vert,fragmentShader:ka.shadow_frag}};function Ha(){var e=null,t=!1,n=null;function i(r,a){!1!==t&&(n(r,a),e.requestAnimationFrame(i))}return{start:function(){!0!==t&&null!==n&&(e.requestAnimationFrame(i),t=!0)},stop:function(){t=!1},setAnimationLoop:function(e){n=e},setContext:function(t){e=t}}}function ja(e){var t=new WeakMap;return{get:function(e){return e.isInterleavedBufferAttribute&&(e=e.data),t.get(e)},remove:function(n){n.isInterleavedBufferAttribute&&(n=n.data);var i=t.get(n);i&&(e.deleteBuffer(i.buffer),t.delete(n))},update:function(n,i){n.isInterleavedBufferAttribute&&(n=n.data);var r=t.get(n);void 0===r?t.set(n,function(t,n){var i=t.array,r=t.usage,a=e.createBuffer();e.bindBuffer(n,a),e.bufferData(n,i,r),t.onUploadCallback();var o=5126;return i instanceof Float32Array?o=5126:i instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):i instanceof Uint16Array?o=5123:i instanceof Int16Array?o=5122:i instanceof Uint32Array?o=5125:i instanceof Int32Array?o=5124:i instanceof Int8Array?o=5120:i instanceof Uint8Array&&(o=5121),{buffer:a,type:o,bytesPerElement:i.BYTES_PER_ELEMENT,version:t.version}}(n,i)):r.version0&&e.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(35633,36337).precision>0&&e.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}var a="undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||"undefined"!=typeof WebGL2ComputeRenderingContext&&e instanceof WebGL2ComputeRenderingContext,o=void 0!==n.precision?n.precision:"highp",s=r(o);s!==o&&(console.warn("THREE.WebGLRenderer:",o,"not supported, using",s,"instead."),o=s);var l=!0===n.logarithmicDepthBuffer,c=e.getParameter(34930),h=e.getParameter(35660),u=e.getParameter(3379),d=e.getParameter(34076),p=e.getParameter(34921),f=e.getParameter(36347),m=e.getParameter(36348),v=e.getParameter(36349),g=h>0,y=a||!!t.get("OES_texture_float");return{isWebGL2:a,getMaxAnisotropy:function(){if(void 0!==i)return i;var n=t.get("EXT_texture_filter_anisotropic");return i=null!==n?e.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0},getMaxPrecision:r,precision:o,logarithmicDepthBuffer:l,maxTextures:c,maxVertexTextures:h,maxTextureSize:u,maxCubemapSize:d,maxAttributes:p,maxVertexUniforms:f,maxVaryings:m,maxFragmentUniforms:v,vertexTextures:g,floatFragmentTextures:y,floatVertexTextures:g&&y,maxSamples:a?e.getParameter(36183):0}}function Ja(){var e=this,t=null,n=0,i=!1,r=!1,a=new cr,o=new ni,s={value:null,needsUpdate:!1};function l(){s.value!==t&&(s.value=t,s.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function c(t,n,i,r){var l=null!==t?t.length:0,c=null;if(0!==l){if(c=s.value,!0!==r||null===c){var h=i+4*l,u=n.matrixWorldInverse;o.getNormalMatrix(u),(null===c||c.length65535?Br:Ur)(n,1);p.version=o,t.update(p,34963);var f=r.get(e);f&&t.remove(f),r.set(e,p)}return{get:function(e,t){var r=i.get(t);return r||(t.addEventListener("dispose",a),t.isBufferGeometry?r=t:t.isGeometry&&(void 0===t._bufferGeometry&&(t._bufferGeometry=(new Kr).setFromObject(e)),r=t._bufferGeometry),i.set(t,r),n.memory.geometries++,r)},update:function(e){var n=e.index,i=e.attributes;for(var r in null!==n&&t.update(n,34963),i)t.update(i[r],34962);var a=e.morphAttributes;for(var r in a)for(var o=a[r],s=0,l=o.length;s0)return e;var r=t*n,a=uo[r];if(void 0===a&&(a=new Float32Array(r),uo[r]=a),0!==t){i.toArray(a,0);for(var o=1,s=0;o!==t;++o)s+=n,e[o].toArray(a,s)}return a}function yo(e,t){if(e.length!==t.length)return!1;for(var n=0,i=e.length;n/gm;function ds(e){return e.replace(us,ps)}function ps(e,t){var n=ka[t];if(void 0===n)throw new Error("Can not resolve #include <"+t+">");return ds(n)}var fs=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g;function ms(e){return e.replace(fs,vs)}function vs(e,t,n,i){for(var r="",a=parseInt(t);a0?e.gammaFactor:1,b=a.isWebGL2?"":function(e,t,n){return[(e=e||{}).derivatives||t.envMapCubeUV||t.bumpMap||t.tangentSpaceNormalMap||t.clearcoatNormalMap||t.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(e.fragDepth||t.logarithmicDepthBuffer)&&n.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",e.drawBuffers&&n.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(e.shaderTextureLOD||t.envMap)&&n.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""].filter(ls).join("\n")}(i.extensions,a,t),w=function(e){var t=[];for(var n in e){var i=e[n];!1!==i&&t.push("#define "+n+" "+i)}return t.join("\n")}(d),_=u.createProgram(),M=a.numMultiviewViews;if(i.isRawShaderMaterial?((o=[w].filter(ls).join("\n")).length>0&&(o+="\n"),(s=[b,w].filter(ls).join("\n")).length>0&&(s+="\n")):(o=[gs(a),"#define SHADER_NAME "+r.name,w,a.instancing?"#define USE_INSTANCING":"",a.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+x,"#define MAX_BONES "+a.maxBones,a.useFog&&a.fog?"#define USE_FOG":"",a.useFog&&a.fogExp2?"#define FOG_EXP2":"",a.map?"#define USE_MAP":"",a.envMap?"#define USE_ENVMAP":"",a.envMap?"#define "+g:"",a.lightMap?"#define USE_LIGHTMAP":"",a.aoMap?"#define USE_AOMAP":"",a.emissiveMap?"#define USE_EMISSIVEMAP":"",a.bumpMap?"#define USE_BUMPMAP":"",a.normalMap?"#define USE_NORMALMAP":"",a.normalMap&&a.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",a.normalMap&&a.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",a.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",a.displacementMap&&a.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",a.specularMap?"#define USE_SPECULARMAP":"",a.roughnessMap?"#define USE_ROUGHNESSMAP":"",a.metalnessMap?"#define USE_METALNESSMAP":"",a.alphaMap?"#define USE_ALPHAMAP":"",a.vertexTangents?"#define USE_TANGENT":"",a.vertexColors?"#define USE_COLOR":"",a.vertexUvs?"#define USE_UV":"",a.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",a.flatShading?"#define FLAT_SHADED":"",a.skinning?"#define USE_SKINNING":"",a.useVertexTexture?"#define BONE_TEXTURE":"",a.morphTargets?"#define USE_MORPHTARGETS":"",a.morphNormals&&!1===a.flatShading?"#define USE_MORPHNORMALS":"",a.doubleSided?"#define DOUBLE_SIDED":"",a.flipSided?"#define FLIP_SIDED":"",a.shadowMapEnabled?"#define USE_SHADOWMAP":"",a.shadowMapEnabled?"#define "+m:"",a.sizeAttenuation?"#define USE_SIZEATTENUATION":"",a.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",a.logarithmicDepthBuffer&&(a.isWebGL2||t.get("EXT_frag_depth"))?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#ifdef USE_COLOR","\tattribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","\tattribute vec3 morphTarget0;","\tattribute vec3 morphTarget1;","\tattribute vec3 morphTarget2;","\tattribute vec3 morphTarget3;","\t#ifdef USE_MORPHNORMALS","\t\tattribute vec3 morphNormal0;","\t\tattribute vec3 morphNormal1;","\t\tattribute vec3 morphNormal2;","\t\tattribute vec3 morphNormal3;","\t#else","\t\tattribute vec3 morphTarget4;","\t\tattribute vec3 morphTarget5;","\t\tattribute vec3 morphTarget6;","\t\tattribute vec3 morphTarget7;","\t#endif","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(ls).join("\n"),s=[b,gs(a),"#define SHADER_NAME "+r.name,w,a.alphaTest?"#define ALPHATEST "+a.alphaTest+(a.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+x,a.useFog&&a.fog?"#define USE_FOG":"",a.useFog&&a.fogExp2?"#define FOG_EXP2":"",a.map?"#define USE_MAP":"",a.matcap?"#define USE_MATCAP":"",a.envMap?"#define USE_ENVMAP":"",a.envMap?"#define "+v:"",a.envMap?"#define "+g:"",a.envMap?"#define "+y:"",a.lightMap?"#define USE_LIGHTMAP":"",a.aoMap?"#define USE_AOMAP":"",a.emissiveMap?"#define USE_EMISSIVEMAP":"",a.bumpMap?"#define USE_BUMPMAP":"",a.normalMap?"#define USE_NORMALMAP":"",a.normalMap&&a.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",a.normalMap&&a.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",a.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",a.specularMap?"#define USE_SPECULARMAP":"",a.roughnessMap?"#define USE_ROUGHNESSMAP":"",a.metalnessMap?"#define USE_METALNESSMAP":"",a.alphaMap?"#define USE_ALPHAMAP":"",a.sheen?"#define USE_SHEEN":"",a.vertexTangents?"#define USE_TANGENT":"",a.vertexColors?"#define USE_COLOR":"",a.vertexUvs?"#define USE_UV":"",a.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",a.gradientMap?"#define USE_GRADIENTMAP":"",a.flatShading?"#define FLAT_SHADED":"",a.doubleSided?"#define DOUBLE_SIDED":"",a.flipSided?"#define FLIP_SIDED":"",a.shadowMapEnabled?"#define USE_SHADOWMAP":"",a.shadowMapEnabled?"#define "+m:"",a.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",a.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",a.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",a.logarithmicDepthBuffer&&(a.isWebGL2||t.get("EXT_frag_depth"))?"#define USE_LOGDEPTHBUF_EXT":"",(i.extensions&&i.extensions.shaderTextureLOD||a.envMap)&&(a.isWebGL2||t.get("EXT_shader_texture_lod"))?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",a.toneMapping!==ut?"#define TONE_MAPPING":"",a.toneMapping!==ut?ka.tonemapping_pars_fragment:"",a.toneMapping!==ut?ss("toneMapping",a.toneMapping):"",a.dithering?"#define DITHERING":"",a.outputEncoding||a.mapEncoding||a.matcapEncoding||a.envMapEncoding||a.emissiveMapEncoding?ka.encodings_pars_fragment:"",a.mapEncoding?os("mapTexelToLinear",a.mapEncoding):"",a.matcapEncoding?os("matcapTexelToLinear",a.matcapEncoding):"",a.envMapEncoding?os("envMapTexelToLinear",a.envMapEncoding):"",a.emissiveMapEncoding?os("emissiveMapTexelToLinear",a.emissiveMapEncoding):"",a.outputEncoding?(l="linearToOutputTexel",c=a.outputEncoding,h=rs(c),"vec4 "+l+"( vec4 value ) { return LinearTo"+h[0]+h[1]+"; }"):"",a.depthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(ls).join("\n")),p=hs(p=cs(p=ds(p),a),a),f=hs(f=cs(f=ds(f),a),a),p=ms(p),f=ms(f),a.isWebGL2&&!i.isRawShaderMaterial){var S=!1,E=/^\s*#version\s+300\s+es\s*\n/;i.isShaderMaterial&&null!==p.match(E)&&null!==f.match(E)&&(S=!0,p=p.replace(E,""),f=f.replace(E,"")),o=["#version 300 es\n","#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+o,s=["#version 300 es\n","#define varying in",S?"":"out highp vec4 pc_fragColor;",S?"":"#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"+s,M>0&&(o=(o=o.replace("#version 300 es\n",["#version 300 es\n","#extension GL_OVR_multiview2 : require","layout(num_views = "+M+") in;","#define VIEW_ID gl_ViewID_OVR"].join("\n"))).replace(["uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;"].join("\n"),["uniform mat4 modelViewMatrices["+M+"];","uniform mat4 projectionMatrices["+M+"];","uniform mat4 viewMatrices["+M+"];","uniform mat3 normalMatrices["+M+"];","#define modelViewMatrix modelViewMatrices[VIEW_ID]","#define projectionMatrix projectionMatrices[VIEW_ID]","#define viewMatrix viewMatrices[VIEW_ID]","#define normalMatrix normalMatrices[VIEW_ID]"].join("\n")),s=(s=s.replace("#version 300 es\n",["#version 300 es\n","#extension GL_OVR_multiview2 : require","#define VIEW_ID gl_ViewID_OVR"].join("\n"))).replace("uniform mat4 viewMatrix;",["uniform mat4 viewMatrices["+M+"];","#define viewMatrix viewMatrices[VIEW_ID]"].join("\n")))}var T,A,L=s+f,R=ns(u,35633,o+p),P=ns(u,35632,L);if(u.attachShader(_,R),u.attachShader(_,P),void 0!==i.index0AttributeName?u.bindAttribLocation(_,0,i.index0AttributeName):!0===a.morphTargets&&u.bindAttribLocation(_,0,"position"),u.linkProgram(_),e.debug.checkShaderErrors){var C=u.getProgramInfoLog(_).trim(),O=u.getShaderInfoLog(R).trim(),I=u.getShaderInfoLog(P).trim(),D=!0,N=!0;if(!1===u.getProgramParameter(_,35714)){D=!1;var z=as(u,R,"vertex"),U=as(u,P,"fragment");console.error("THREE.WebGLProgram: shader error: ",u.getError(),"35715",u.getProgramParameter(_,35715),"gl.getProgramInfoLog",C,z,U)}else""!==C?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",C):""!==O&&""!==I||(N=!1);N&&(this.diagnostics={runnable:D,material:i,programLog:C,vertexShader:{log:O,prefix:o},fragmentShader:{log:I,prefix:s}})}return u.deleteShader(R),u.deleteShader(P),this.getUniforms=function(){return void 0===T&&(T=new ts(u,_)),T},this.getAttributes=function(){return void 0===A&&(A=function(e,t){for(var n={},i=e.getProgramParameter(t,35721),r=0;r0,maxBones:y,useVertexTexture:o,morphTargets:t.morphTargets,morphNormals:t.morphNormals,maxMorphTargets:e.maxMorphTargets,maxMorphNormals:e.maxMorphNormals,numDirLights:i.directional.length,numPointLights:i.point.length,numSpotLights:i.spot.length,numRectAreaLights:i.rectArea.length,numHemiLights:i.hemi.length,numDirLightShadows:i.directionalShadowMap.length,numPointLightShadows:i.pointShadowMap.length,numSpotLightShadows:i.spotShadowMap.length,numClippingPlanes:f,numClipIntersection:m,dithering:t.dithering,shadowMapEnabled:e.shadowMap.enabled&&u.length>0,shadowMapType:e.shadowMap.type,toneMapping:t.toneMapped?e.toneMapping:ut,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:t.premultipliedAlpha,alphaTest:t.alphaTest,doubleSided:t.side===Le,flipSided:t.side===Ae,depthPacking:void 0!==t.depthPacking&&t.depthPacking}},this.getProgramCacheKey=function(t,n){var i=[];if(n.shaderID?i.push(n.shaderID):(i.push(t.fragmentShader),i.push(t.vertexShader)),void 0!==t.defines)for(var r in t.defines)i.push(r),i.push(t.defines[r]);for(var a=0;a1&&n.sort(ws),i.length>1&&i.sort(_s)}}}function Ss(){var e=new WeakMap;function t(n){var i=n.target;i.removeEventListener("dispose",t),e.delete(i)}return{get:function(n,i){var r,a=e.get(n);return void 0===a?(r=new Ms,e.set(n,new WeakMap),e.get(n).set(i,r),n.addEventListener("dispose",t)):void 0===(r=a.get(i))&&(r=new Ms,a.set(i,r)),r},dispose:function(){e=new WeakMap}}}function Es(){var e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];var n;switch(t.type){case"DirectionalLight":n={direction:new $n,color:new Sr,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new Zn};break;case"SpotLight":n={position:new $n,direction:new $n,color:new Sr,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new Zn};break;case"PointLight":n={position:new $n,color:new Sr,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new Zn,shadowCameraNear:1,shadowCameraFar:1e3};break;case"HemisphereLight":n={direction:new $n,skyColor:new Sr,groundColor:new Sr};break;case"RectAreaLight":n={color:new Sr,position:new $n,halfWidth:new $n,halfHeight:new $n}}return e[t.id]=n,n}}}var Ts=0;function As(e,t){return(t.castShadow?1:0)-(e.castShadow?1:0)}function Ls(){for(var e=new Es,t={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},n=0;n<9;n++)t.probe.push(new $n);var i=new $n,r=new vi,a=new vi;return{setup:function(n,o,s){for(var l=0,c=0,h=0,u=0;u<9;u++)t.probe[u].set(0,0,0);var d=0,p=0,f=0,m=0,v=0,g=0,y=0,x=0,b=s.matrixWorldInverse;n.sort(As),u=0;for(var w=n.length;u0:!0===s.isGeometry&&(p=s.morphTargets&&s.morphTargets.length>0));var f=!1;!0===t.isSkinnedMesh&&(!0===n.skinning?f=!0:console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",t)),l=u(p,f,!0===t.isInstancedMesh)}else l=d;if(e.localClippingEnabled&&!0===n.clipShadows&&0!==n.clippingPlanes.length){var m=l.uuid,v=n.uuid,x=c[m];void 0===x&&(x={},c[m]=x);var b=x[v];void 0===b&&(b=l.clone(),x[v]=b),l=b}return l.visible=n.visible,l.wireframe=n.wireframe,l.side=o===Ee?null!==n.shadowSide?n.shadowSide:n.side:null!==n.shadowSide?n.shadowSide:h[n.side],l.clipShadows=n.clipShadows,l.clippingPlanes=n.clippingPlanes,l.clipIntersection=n.clipIntersection,l.wireframeLinewidth=n.wireframeLinewidth,l.linewidth=n.linewidth,!0===i.isPointLight&&!0===l.isMeshDistanceMaterial&&(l.referencePosition.setFromMatrixPosition(i.matrixWorld),l.nearDistance=r,l.farDistance=a),l}function b(n,r,a,o,s){if(!1!==n.visible){if(n.layers.test(r.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&s===Ee)&&(!n.frustumCulled||i.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);var l=t.update(n),c=n.material;if(Array.isArray(c))for(var h=l.groups,u=0,d=h.length;un||r.y>n)&&(console.warn("THREE.WebGLShadowMap:",g,"has shadow exceeding max texture size, reducing"),r.x>n&&(a.x=Math.floor(n/x.x),r.x=a.x*x.x,y.mapSize.x=a.x),r.y>n&&(a.y=Math.floor(n/x.y),r.y=a.y*x.y,y.mapSize.y=a.y)),null===y.map&&!y.isPointLightShadow&&this.type===Ee){var w={minFilter:Pt,magFilter:Pt,format:Yt};y.map=new si(r.x,r.y,w),y.map.texture.name=g.name+".shadowMap",y.mapPass=new si(r.x,r.y,w),y.camera.updateProjectionMatrix()}if(null===y.map){w={minFilter:At,magFilter:At,format:Yt};y.map=new si(r.x,r.y,w),y.map.texture.name=g.name+".shadowMap",y.camera.updateProjectionMatrix()}e.setRenderTarget(y.map),e.clear();for(var _=y.getViewportCount(),M=0;M<_;M++){var S=y.getViewport(M);o.set(a.x*S.x,a.y*S.y,a.x*S.z,a.y*S.w),d.viewport(o),y.updateMatrices(g,M),i=y.getFrustum(),b(s,l,y.camera,g,this.type)}y.isPointLightShadow||this.type!==Ee||v(y,l)}else console.warn("THREE.WebGLShadowMap:",g,"has no shadow.")}m.needsUpdate=!1,e.setRenderTarget(c,h,u)}}}function zs(e,t,n){var i=n.isWebGL2;var r=new function(){var t=!1,n=new oi,i=null,r=new oi(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,a,o,s){!0===s&&(t*=o,i*=o,a*=o),n.set(t,i,a,o),!1===r.equals(n)&&(e.clearColor(t,i,a,o),r.copy(n))},reset:function(){t=!1,i=null,r.set(-1,0,0,0)}}},a=new function(){var t=!1,n=null,i=null,r=null;return{setTest:function(e){e?F(2929):B(2929)},setMask:function(i){n===i||t||(e.depthMask(i),n=i)},setFunc:function(t){if(i!==t){if(t)switch(t){case et:e.depthFunc(512);break;case tt:e.depthFunc(519);break;case nt:e.depthFunc(513);break;case it:e.depthFunc(515);break;case rt:e.depthFunc(514);break;case at:e.depthFunc(518);break;case ot:e.depthFunc(516);break;case st:e.depthFunc(517);break;default:e.depthFunc(515)}else e.depthFunc(515);i=t}},setLocked:function(e){t=e},setClear:function(t){r!==t&&(e.clearDepth(t),r=t)},reset:function(){t=!1,n=null,i=null,r=null}}},o=new function(){var t=!1,n=null,i=null,r=null,a=null,o=null,s=null,l=null,c=null;return{setTest:function(e){t||(e?F(2960):B(2960))},setMask:function(i){n===i||t||(e.stencilMask(i),n=i)},setFunc:function(t,n,o){i===t&&r===n&&a===o||(e.stencilFunc(t,n,o),i=t,r=n,a=o)},setOp:function(t,n,i){o===t&&s===n&&l===i||(e.stencilOp(t,n,i),o=t,s=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,a=null,o=null,s=null,l=null,c=null}}},s=e.getParameter(34921),l=new Uint8Array(s),c=new Uint8Array(s),h=new Uint8Array(s),u={},d=null,p=null,f=null,m=null,v=null,g=null,y=null,x=null,b=null,w=!1,_=null,M=null,S=null,E=null,T=null,A=e.getParameter(35661),L=!1,R=0,P=e.getParameter(7938);-1!==P.indexOf("WebGL")?(R=parseFloat(/^WebGL\ ([0-9])/.exec(P)[1]),L=R>=1):-1!==P.indexOf("OpenGL ES")&&(R=parseFloat(/^OpenGL\ ES\ ([0-9])/.exec(P)[1]),L=R>=2);var C=null,O={},I=new oi,D=new oi;function N(t,n,i){var r=new Uint8Array(4),a=e.createTexture();e.bindTexture(t,a),e.texParameteri(t,10241,9728),e.texParameteri(t,10240,9728);for(var o=0;oi||e.height>i)&&(r=i/Math.max(e.width,e.height)),r<1||!0===t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){var a=t?Yn.floorPowerOfTwo:Math.floor,o=a(r*e.width),l=a(r*e.height);void 0===s&&(s=m(o,l));var c=n?m(o,l):s;return c.width=o,c.height=l,c.getContext("2d").drawImage(e,0,0,o,l),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+e.width+"x"+e.height+") to ("+o+"x"+l+")."),c}return"data"in e&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+e.width+"x"+e.height+")."),e}return e}function g(e){return Yn.isPowerOfTwo(e.width)&&Yn.isPowerOfTwo(e.height)}function y(e,t){return e.generateMipmaps&&t&&e.minFilter!==At&&e.minFilter!==Pt}function x(t,n,r,a){e.generateMipmap(t),i.get(n).__maxMipLevel=Math.log(Math.max(r,a))*Math.LOG2E}function b(e,n){if(!1===l)return e;var i=e;return 6403===e&&(5126===n&&(i=33326),5131===n&&(i=33325),5121===n&&(i=33321)),6407===e&&(5126===n&&(i=34837),5131===n&&(i=34843),5121===n&&(i=32849)),6408===e&&(5126===n&&(i=34836),5131===n&&(i=34842),5121===n&&(i=32856)),33325===i||33326===i||34842===i||34836===i?t.get("EXT_color_buffer_float"):34843!==i&&34837!==i||console.warn("THREE.WebGLRenderer: Floating point textures with RGB format not supported. Please use RGBA instead."),i}function w(e){return e===At||e===Lt||e===Rt?9728:9729}function _(t){var n=t.target;n.removeEventListener("dispose",_),function(t){var n=i.get(t);if(void 0===n.__webglInit)return;e.deleteTexture(n.__webglTexture),i.remove(t)}(n),n.isVideoTexture&&p.delete(n),o.memory.textures--}function M(t){var n=t.target;n.removeEventListener("dispose",M),function(t){var n=i.get(t),r=i.get(t.texture);if(!t)return;void 0!==r.__webglTexture&&e.deleteTexture(r.__webglTexture);t.depthTexture&&t.depthTexture.dispose();if(t.isWebGLRenderTargetCube)for(var a=0;a<6;a++)e.deleteFramebuffer(n.__webglFramebuffer[a]),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer[a]);else e.deleteFramebuffer(n.__webglFramebuffer),n.__webglDepthbuffer&&e.deleteRenderbuffer(n.__webglDepthbuffer);if(t.isWebGLMultiviewRenderTarget){e.deleteTexture(n.__webglColorTexture),e.deleteTexture(n.__webglDepthStencilTexture),o.memory.textures-=2;a=0;for(var s=n.__webglViewFramebuffers.length;a0&&r.__version!==e.version){var a=e.image;if(void 0===a)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else{if(!1!==a.complete)return void O(r,e,t);console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}n.activeTexture(33984+t),n.bindTexture(3553,r.__webglTexture)}function T(t,r){if(6===t.image.length){var o=i.get(t);if(t.version>0&&o.__version!==t.version){C(o,t),n.activeTexture(33984+r),n.bindTexture(34067,o.__webglTexture),e.pixelStorei(37440,t.flipY);for(var s=t&&t.isCompressedTexture,c=t.image[0]&&t.image[0].isDataTexture,u=[],d=0;d<6;d++)u[d]=s||c?c?t.image[d].image:t.image[d]:v(t.image[d],!1,!0,h);var p,f=u[0],m=g(f)||l,w=a.convert(t.format),_=a.convert(t.type),M=b(w,_);if(P(34067,t,m),s){for(d=0;d<6;d++){p=u[d].mipmaps;for(var S=0;S1||i.get(a).__currentAnisotropy)&&(e.texParameterf(n,s.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,r.getMaxAnisotropy())),i.get(a).__currentAnisotropy=a.anisotropy)}}function C(t,n){void 0===t.__webglInit&&(t.__webglInit=!0,n.addEventListener("dispose",_),t.__webglTexture=e.createTexture(),o.memory.textures++)}function O(t,i,r){var o=3553;i.isDataTexture2DArray&&(o=35866),i.isDataTexture3D&&(o=32879),C(t,i),n.activeTexture(33984+r),n.bindTexture(o,t.__webglTexture),e.pixelStorei(37440,i.flipY),e.pixelStorei(37441,i.premultiplyAlpha),e.pixelStorei(3317,i.unpackAlignment);var s=function(e){return!l&&(e.wrapS!==Et||e.wrapT!==Et||e.minFilter!==At&&e.minFilter!==Pt)}(i)&&!1===g(i.image),c=v(i.image,s,!1,u),h=g(c)||l,d=a.convert(i.format),p=a.convert(i.type),f=b(d,p);P(o,i,h);var m,w=i.mipmaps;if(i.isDepthTexture){if(f=6402,i.type===kt){if(!1===l)throw new Error("Float Depth Texture only supported in WebGL2.0");f=36012}else l&&(f=33189);i.format===Qt&&6402===f&&i.type!==Ut&&i.type!==Bt&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),i.type=Ut,p=a.convert(i.type)),i.format===$t&&(f=34041,i.type!==Wt&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),i.type=Wt,p=a.convert(i.type))),n.texImage2D(3553,0,f,c.width,c.height,0,d,p,null)}else if(i.isDataTexture)if(w.length>0&&h){for(var _=0,M=w.length;_0&&h){for(_=0,M=w.length;_=c&&console.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+c),S+=1,e},this.resetTextureUnits=function(){S=0},this.setTexture2D=E,this.setTexture2DArray=function(e,t){var r=i.get(e);e.version>0&&r.__version!==e.version?O(r,e,t):(n.activeTexture(33984+t),n.bindTexture(35866,r.__webglTexture))},this.setTexture3D=function(e,t){var r=i.get(e);e.version>0&&r.__version!==e.version?O(r,e,t):(n.activeTexture(33984+t),n.bindTexture(32879,r.__webglTexture))},this.setTextureCube=T,this.setTextureCubeDynamic=A,this.setupRenderTarget=function(r){var s=i.get(r),c=i.get(r.texture);r.addEventListener("dispose",M),c.__webglTexture=e.createTexture(),o.memory.textures++;var h=!0===r.isWebGLRenderTargetCube,u=!0===r.isWebGLMultisampleRenderTarget,d=!0===r.isWebGLMultiviewRenderTarget,p=g(r)||l;if(h){s.__webglFramebuffer=[];for(var f=0;f<6;f++)s.__webglFramebuffer[f]=e.createFramebuffer()}else if(s.__webglFramebuffer=e.createFramebuffer(),u)if(l){s.__webglMultisampledFramebuffer=e.createFramebuffer(),s.__webglColorRenderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(36161,s.__webglColorRenderbuffer);var m=b(a.convert(r.texture.format),a.convert(r.texture.type)),v=z(r);e.renderbufferStorageMultisample(36161,v,m,r.width,r.height),e.bindFramebuffer(36160,s.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064,36161,s.__webglColorRenderbuffer),e.bindRenderbuffer(36161,null),r.depthBuffer&&(s.__webglDepthRenderbuffer=e.createRenderbuffer(),D(s.__webglDepthRenderbuffer,r,!0)),e.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");else if(d){var w=r.width,_=r.height,S=r.numViews;e.bindFramebuffer(36160,s.__webglFramebuffer);var E=t.get("OVR_multiview2");o.memory.textures+=2;var T=e.createTexture();e.bindTexture(35866,T),e.texParameteri(35866,10240,9728),e.texParameteri(35866,10241,9728),e.texImage3D(35866,0,32856,w,_,S,0,6408,5121,null),E.framebufferTextureMultiviewOVR(36160,36064,T,0,0,S);var A=e.createTexture();e.bindTexture(35866,A),e.texParameteri(35866,10240,9728),e.texParameteri(35866,10241,9728),e.texImage3D(35866,0,35056,w,_,S,0,34041,34042,null),E.framebufferTextureMultiviewOVR(36160,33306,A,0,0,S);var L=new Array(S);for(f=0;fd)return!1;for(var n=1,i=t.length;n=0){var c=r[s];if(void 0!==c){var h=c.normalized,u=c.itemSize;if(void 0===(M=b.get(c)))continue;var d=M.buffer,g=M.type,y=M.bytesPerElement;if(c.isInterleavedBufferAttribute){var x=c.data,w=x.stride,_=c.offset;x&&x.isInstancedInterleavedBuffer?(v.enableAttributeAndDivisor(l,x.meshPerAttribute),void 0===t.maxInstancedCount&&(t.maxInstancedCount=x.meshPerAttribute*x.count)):v.enableAttribute(l),p.bindBuffer(34962,d),p.vertexAttribPointer(l,u,g,h,w*y,_*y)}else c.isInstancedBufferAttribute?(v.enableAttributeAndDivisor(l,c.meshPerAttribute),void 0===t.maxInstancedCount&&(t.maxInstancedCount=c.meshPerAttribute*c.count)):v.enableAttribute(l),p.bindBuffer(34962,d),p.vertexAttribPointer(l,u,g,h,0,0)}else if("instanceMatrix"===s){var M;if(void 0===(M=b.get(e.instanceMatrix)))continue;d=M.buffer,g=M.type;v.enableAttributeAndDivisor(l+0,1),v.enableAttributeAndDivisor(l+1,1),v.enableAttributeAndDivisor(l+2,1),v.enableAttributeAndDivisor(l+3,1),p.bindBuffer(34962,d),p.vertexAttribPointer(l+0,4,g,!1,64,0),p.vertexAttribPointer(l+1,4,g,!1,64,16),p.vertexAttribPointer(l+2,4,g,!1,64,32),p.vertexAttribPointer(l+3,4,g,!1,64,48)}else if(void 0!==o){var S=o[s];if(void 0!==S)switch(S.length){case 2:p.vertexAttrib2fv(l,S);break;case 3:p.vertexAttrib3fv(l,S);break;case 4:p.vertexAttrib4fv(l,S);break;default:p.vertexAttrib1fv(l,S)}}}}v.disableUnusedAttributes()}(r,n,i,s),null!==h&&p.bindBuffer(34963,c.buffer));var y=1/0;null!==h?y=h.count:void 0!==u&&(y=u.count);var x=n.drawRange.start*d,_=n.drawRange.count*d,M=null!==a?a.start*d:0,S=null!==a?a.count*d:1/0,E=Math.max(x,M),T=Math.min(y,x+_,M+S)-1,P=Math.max(0,T-E+1);if(0!==P){if(r.isMesh)if(!0===i.wireframe)v.setLineWidth(i.wireframeLinewidth*ie()),g.setMode(1);else switch(r.drawMode){case An:g.setMode(4);break;case Ln:g.setMode(5);break;case Rn:g.setMode(6)}else if(r.isLine){var C=i.linewidth;void 0===C&&(C=1),v.setLineWidth(C*ie()),r.isLineSegments?g.setMode(1):r.isLineLoop?g.setMode(2):g.setMode(3)}else r.isPoints?g.setMode(0):r.isSprite&&g.setMode(4);r.isInstancedMesh?g.renderInstances(n,E,P,r.count):n.isInstancedBufferGeometry?g.renderInstances(n,E,P,n.maxInstancedCount):g.render(E,P)}},this.compile=function(e,t){(d=E.get(e,t)).init(),e.traverse(function(e){e.isLight&&(d.pushLight(e),e.castShadow&&d.pushShadow(e))}),d.setupLights(t),e.traverse(function(t){if(t.material)if(Array.isArray(t.material))for(var n=0;n=0&&e.numSupportedMorphTargets++}if(e.morphNormals){e.numSupportedMorphNormals=0;for(f=0;f=0&&e.numSupportedMorphNormals++}var m=i.shader.uniforms;(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(i.numClippingPlanes=Q.numPlanes,i.numIntersection=Q.numIntersection,m.clippingPlanes=Q.uniform),i.fog=t,i.needsLights=function(e){return e.isMeshLambertMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&!0===e.lights}(e),i.lightsStateVersion=o,i.needsLights&&(m.ambientLightColor.value=r.state.ambient,m.lightProbe.value=r.state.probe,m.directionalLights.value=r.state.directional,m.spotLights.value=r.state.spot,m.rectAreaLights.value=r.state.rectArea,m.pointLights.value=r.state.point,m.hemisphereLights.value=r.state.hemi,m.directionalShadowMap.value=r.state.directionalShadowMap,m.directionalShadowMatrix.value=r.state.directionalShadowMatrix,m.spotShadowMap.value=r.state.spotShadowMap,m.spotShadowMatrix.value=r.state.spotShadowMatrix,m.pointShadowMap.value=r.state.pointShadowMap,m.pointShadowMatrix.value=r.state.pointShadowMatrix);var v=i.program.getUniforms(),g=ts.seqWithValue(v.seq,m);i.uniformsList=g}function xe(e,t,n,i){x.resetTextureUnits();var r=y.get(n),a=d.state.lights;if($&&(ee||e!==k)){var o=e===k&&n.id===F;Q.setState(n.clippingPlanes,n.clipIntersection,n.clipShadows,e,r,o)}!1===n.needsUpdate&&(void 0===r.program?n.needsUpdate=!0:n.fog&&r.fog!==t?n.needsUpdate=!0:r.needsLights&&r.lightsStateVersion!==a.state.version?n.needsUpdate=!0:void 0===r.numClippingPlanes||r.numClippingPlanes===Q.numPlanes&&r.numIntersection===Q.numIntersection||(n.needsUpdate=!0)),n.needsUpdate&&(ye(n,t,i),n.needsUpdate=!1);var s,l,c=!1,h=!1,u=!1,f=r.program,g=f.getUniforms(),b=r.shader.uniforms;if(v.useProgram(f.program)&&(c=!0,h=!0,u=!0),n.id!==F&&(F=n.id,h=!0),c||k!==e){if(f.numMultiviewViews>0?se.updateCameraProjectionMatricesUniform(e,g):g.setValue(p,"projectionMatrix",e.projectionMatrix),m.logarithmicDepthBuffer&&g.setValue(p,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),k!==e&&(k=e,h=!0,u=!0),n.isShaderMaterial||n.isMeshPhongMaterial||n.isMeshStandardMaterial||n.envMap){var w=g.map.cameraPosition;void 0!==w&&w.setValue(p,ne.setFromMatrixPosition(e.matrixWorld))}(n.isMeshPhongMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial)&&g.setValue(p,"isOrthographic",!0===e.isOrthographicCamera),(n.isMeshPhongMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial||n.skinning)&&(f.numMultiviewViews>0?se.updateCameraViewMatricesUniform(e,g):g.setValue(p,"viewMatrix",e.matrixWorldInverse))}if(n.skinning){g.setOptional(p,i,"bindMatrix"),g.setOptional(p,i,"bindMatrixInverse");var _=i.skeleton;if(_){var M=_.bones;if(m.floatVertexTextures){if(void 0===_.boneTexture){var S=Math.sqrt(4*M.length);S=Yn.ceilPowerOfTwo(S),S=Math.max(S,4);var E=new Float32Array(S*S*4);E.set(_.boneMatrices);var T=new za(E,S,S,Yt,kt);_.boneMatrices=E,_.boneTexture=T,_.boneTextureSize=S}g.setValue(p,"boneTexture",_.boneTexture,x),g.setValue(p,"boneTextureSize",_.boneTextureSize)}else g.setOptional(p,_,"boneMatrices")}}return(h||r.receiveShadow!==i.receiveShadow)&&(r.receiveShadow=i.receiveShadow,g.setValue(p,"receiveShadow",i.receiveShadow)),h&&(g.setValue(p,"toneMappingExposure",C.toneMappingExposure),g.setValue(p,"toneMappingWhitePoint",C.toneMappingWhitePoint),r.needsLights&&(l=u,(s=b).ambientLightColor.needsUpdate=l,s.lightProbe.needsUpdate=l,s.directionalLights.needsUpdate=l,s.pointLights.needsUpdate=l,s.spotLights.needsUpdate=l,s.rectAreaLights.needsUpdate=l,s.hemisphereLights.needsUpdate=l),t&&n.fog&&function(e,t){e.fogColor.value.copy(t.color),t.isFog?(e.fogNear.value=t.near,e.fogFar.value=t.far):t.isFogExp2&&(e.fogDensity.value=t.density)}(b,t),n.isMeshBasicMaterial?be(b,n):n.isMeshLambertMaterial?(be(b,n),function(e,t){t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap)}(b,n)):n.isMeshPhongMaterial?(be(b,n),n.isMeshToonMaterial?function(e,t){we(e,t),t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(b,n):we(b,n)):n.isMeshStandardMaterial?(be(b,n),n.isMeshPhysicalMaterial?function(e,t){_e(e,t),e.reflectivity.value=t.reflectivity,e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.sheen&&e.sheen.value.copy(t.sheen);t.clearcoatNormalMap&&(e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),e.clearcoatNormalMap.value=t.clearcoatNormalMap,t.side===Ae&&e.clearcoatNormalScale.value.negate());e.transparency.value=t.transparency}(b,n):_e(b,n)):n.isMeshMatcapMaterial?(be(b,n),function(e,t){t.matcap&&(e.matcap.value=t.matcap);t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===Ae&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===Ae&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(b,n)):n.isMeshDepthMaterial?(be(b,n),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(b,n)):n.isMeshDistanceMaterial?(be(b,n),function(e,t){t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias);e.referencePosition.value.copy(t.referencePosition),e.nearDistance.value=t.nearDistance,e.farDistance.value=t.farDistance}(b,n)):n.isMeshNormalMaterial?(be(b,n),function(e,t){t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===Ae&&(e.bumpScale.value*=-1));t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===Ae&&e.normalScale.value.negate());t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}(b,n)):n.isLineBasicMaterial?(function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity}(b,n),n.isLineDashedMaterial&&function(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(b,n)):n.isPointsMaterial?function(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*X,e.scale.value=.5*q,t.map&&(e.map.value=t.map);t.alphaMap&&(e.alphaMap.value=t.alphaMap);var n;t.map?n=t.map:t.alphaMap&&(n=t.alphaMap);void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}(b,n):n.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);t.alphaMap&&(e.alphaMap.value=t.alphaMap);var n;t.map?n=t.map:t.alphaMap&&(n=t.alphaMap);void 0!==n&&(!0===n.matrixAutoUpdate&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}(b,n):n.isShadowMaterial&&(b.color.value.copy(n.color),b.opacity.value=n.opacity),void 0!==b.ltc_1&&(b.ltc_1.value=Ga.LTC_1),void 0!==b.ltc_2&&(b.ltc_2.value=Ga.LTC_2),ts.upload(p,r.uniformsList,b,x),n.isShaderMaterial&&(n.uniformsNeedUpdate=!1)),n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(ts.upload(p,r.uniformsList,b,x),n.uniformsNeedUpdate=!1),n.isSpriteMaterial&&g.setValue(p,"center",i.center),f.numMultiviewViews>0?se.updateObjectMatricesUniforms(i,e,g):(g.setValue(p,"modelViewMatrix",i.modelViewMatrix),g.setValue(p,"normalMatrix",i.normalMatrix)),g.setValue(p,"modelMatrix",i.matrixWorld),f}function be(e,t){var n;e.opacity.value=t.opacity,t.color&&e.diffuse.value.copy(t.color),t.emissive&&e.emissive.value.copy(t.emissive).multiplyScalar(t.emissiveIntensity),t.map&&(e.map.value=t.map),t.alphaMap&&(e.alphaMap.value=t.alphaMap),t.specularMap&&(e.specularMap.value=t.specularMap),t.envMap&&(e.envMap.value=t.envMap,e.flipEnvMap.value=t.envMap.isCubeTexture?-1:1,e.reflectivity.value=t.reflectivity,e.refractionRatio.value=t.refractionRatio,e.maxMipLevel.value=y.get(t.envMap).__maxMipLevel),t.lightMap&&(e.lightMap.value=t.lightMap,e.lightMapIntensity.value=t.lightMapIntensity),t.aoMap&&(e.aoMap.value=t.aoMap,e.aoMapIntensity.value=t.aoMapIntensity),t.map?n=t.map:t.specularMap?n=t.specularMap:t.displacementMap?n=t.displacementMap:t.normalMap?n=t.normalMap:t.bumpMap?n=t.bumpMap:t.roughnessMap?n=t.roughnessMap:t.metalnessMap?n=t.metalnessMap:t.alphaMap?n=t.alphaMap:t.emissiveMap&&(n=t.emissiveMap),void 0!==n&&(n.isWebGLRenderTarget&&(n=n.texture),!0===n.matrixAutoUpdate&&n.updateMatrix(),e.uvTransform.value.copy(n.matrix))}function we(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===Ae&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===Ae&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias)}function _e(e,t){e.roughness.value=t.roughness,e.metalness.value=t.metalness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap),t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap),t.emissiveMap&&(e.emissiveMap.value=t.emissiveMap),t.bumpMap&&(e.bumpMap.value=t.bumpMap,e.bumpScale.value=t.bumpScale,t.side===Ae&&(e.bumpScale.value*=-1)),t.normalMap&&(e.normalMap.value=t.normalMap,e.normalScale.value.copy(t.normalScale),t.side===Ae&&e.normalScale.value.negate()),t.displacementMap&&(e.displacementMap.value=t.displacementMap,e.displacementScale.value=t.displacementScale,e.displacementBias.value=t.displacementBias),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}fe.setAnimationLoop(function(e){oe.isPresenting()||pe&&pe(e)}),"undefined"!=typeof window&&fe.setContext(window),this.setAnimationLoop=function(e){pe=e,oe.setAnimationLoop(e),fe.start()},this.render=function(e,t){var n,i;if(void 0!==arguments[2]&&(console.warn("THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead."),n=arguments[2]),void 0!==arguments[3]&&(console.warn("THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead."),i=arguments[3]),t&&t.isCamera){if(!O){B.geometry=null,B.program=null,B.wireframe=!1,F=-1,k=null,!0===e.autoUpdate&&e.updateMatrixWorld(),null===t.parent&&t.updateMatrixWorld(),oe.enabled&&(t=oe.getCamera(t)),(d=E.get(e,t)).init(),e.onBeforeRender(C,e,t,n||z),te.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),K.setFromMatrix(te),ee=this.localClippingEnabled,$=Q.init(this.clippingPlanes,ee,t),(u=S.get(e,t)).init(),me(e,t,0,C.sortObjects),!0===C.sortObjects&&u.sort(),$&&Q.beginShadows();var r=d.state.shadowsArray;le.render(r,e,t),d.setupLights(t),$&&Q.endShadows(),this.info.autoReset&&this.info.reset(),void 0!==n&&this.setRenderTarget(n),oe.enabled&&se.isAvailable()&&se.attachCamera(t),T.render(u,e,t,i);var a=u.opaque,o=u.transparent;if(e.overrideMaterial){var s=e.overrideMaterial;a.length&&ve(a,e,t,s),o.length&&ve(o,e,t,s)}else a.length&&ve(a,e,t),o.length&&ve(o,e,t);e.onAfterRender(C,e,t),null!==z&&(x.updateRenderTargetMipmap(z),x.updateMultisampleRenderTarget(z)),v.buffers.depth.setTest(!0),v.buffers.depth.setMask(!0),v.buffers.color.setMask(!0),v.setPolygonOffset(!1),oe.enabled&&(se.isAvailable()&&se.detachCamera(t),oe.submitFrame()),u=null,d=null}}else console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.")},this.setFramebuffer=function(e){I!==e&&null===z&&p.bindFramebuffer(36160,e),I=e},this.getActiveCubeFace=function(){return D},this.getActiveMipmapLevel=function(){return N},this.getRenderTarget=function(){return z},this.setRenderTarget=function(e,t,n){z=e,D=t,N=n,e&&void 0===y.get(e).__webglFramebuffer&&x.setupRenderTarget(e);var i=I,r=!1;if(e){var a=y.get(e).__webglFramebuffer;e.isWebGLRenderTargetCube?(i=a[t||0],r=!0):i=e.isWebGLMultisampleRenderTarget?y.get(e).__webglMultisampledFramebuffer:a,V.copy(e.viewport),H.copy(e.scissor),j=e.scissorTest}else V.copy(Y).multiplyScalar(X).floor(),H.copy(Z).multiplyScalar(X).floor(),j=J;if(U!==i&&(p.bindFramebuffer(36160,i),U=i),v.viewport(V),v.scissor(H),v.setScissorTest(j),r){var o=y.get(e.texture);p.framebufferTexture2D(36160,36064,34069+(t||0),o.__webglTexture,n||0)}},this.readRenderTargetPixels=function(e,t,n,i,r,a,o){if(e&&e.isWebGLRenderTarget){var s=y.get(e).__webglFramebuffer;if(e.isWebGLRenderTargetCube&&void 0!==o&&(s=s[o]),s){var l=!1;s!==U&&(p.bindFramebuffer(36160,s),l=!0);try{var c=e.texture,h=c.format,u=c.type;if(h!==Yt&&P.convert(h)!==p.getParameter(35739))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!(u===Dt||P.convert(u)===p.getParameter(35738)||u===kt&&(m.isWebGL2||f.get("OES_texture_float")||f.get("WEBGL_color_buffer_float"))||u===Gt&&(m.isWebGL2?f.get("EXT_color_buffer_float"):f.get("EXT_color_buffer_half_float"))))return void console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");36053===p.checkFramebufferStatus(36160)?t>=0&&t<=e.width-i&&n>=0&&n<=e.height-r&&p.readPixels(t,n,i,r,P.convert(h),P.convert(u),a):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{l&&p.bindFramebuffer(36160,U)}}}else console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.")},this.copyFramebufferToTexture=function(e,t,n){void 0===n&&(n=0);var i=Math.pow(2,-n),r=Math.floor(t.image.width*i),a=Math.floor(t.image.height*i),o=P.convert(t.format);x.setTexture2D(t,0),p.copyTexImage2D(3553,n,o,e.x,e.y,r,a,0),v.unbindTexture()},this.copyTextureToTexture=function(e,t,n,i){var r=t.image.width,a=t.image.height,o=P.convert(n.format),s=P.convert(n.type);x.setTexture2D(n,0),t.isDataTexture?p.texSubImage2D(3553,i||0,e.x,e.y,r,a,o,s,t.image.data):p.texSubImage2D(3553,i||0,e.x,e.y,o,s,t.image),v.unbindTexture()},this.initTexture=function(e){x.setTexture2D(e,0),v.unbindTexture()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function Js(e,t){this.name="",this.color=new Sr(e),this.density=void 0!==t?t:25e-5}function Ks(e,t,n){this.name="",this.color=new Sr(e),this.near=void 0!==t?t:1,this.far=void 0!==n?n:1e3}function Qs(e,t){this.array=e,this.stride=t,this.count=void 0!==e?e.length/t:0,this.usage=jn,this.updateRange={offset:0,count:-1},this.version=0}function $s(e,t,n,i){this.data=e,this.itemSize=t,this.offset=n,this.normalized=!0===i}function el(e){Pr.call(this),this.type="SpriteMaterial",this.color=new Sr(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.setValues(e)}Object.assign(Xs.prototype,Wn.prototype),Object.assign(Ys.prototype,Wn.prototype),Object.assign(Js.prototype,{isFogExp2:!0,clone:function(){return new Js(this.color,this.density)},toJSON:function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}}),Object.assign(Ks.prototype,{isFog:!0,clone:function(){return new Ks(this.color,this.near,this.far)},toJSON:function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}}),Object.defineProperty(Qs.prototype,"needsUpdate",{set:function(e){!0===e&&this.version++}}),Object.assign(Qs.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setUsage:function(e){return this.usage=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this},copyAt:function(e,t,n){e*=this.stride,n*=t.stride;for(var i=0,r=this.stride;ie.far||t.push({distance:s,point:tl.clone(),uv:br.getUV(tl,sl,ll,cl,hl,ul,dl,new Zn),face:null,object:this})}},clone:function(){return new this.constructor(this.material).copy(this)},copy:function(e){return Di.prototype.copy.call(this,e),void 0!==e.center&&this.center.copy(e.center),this}});var ml=new $n,vl=new $n;function gl(){Di.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}function yl(e,t){e&&e.isGeometry&&console.error("THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."),ma.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new vi,this.bindMatrixInverse=new vi}gl.prototype=Object.assign(Object.create(Di.prototype),{constructor:gl,isLOD:!0,copy:function(e){Di.prototype.copy.call(this,e,!1);for(var t=e.levels,n=0,i=t.length;n1){ml.setFromMatrixPosition(e.matrixWorld),vl.setFromMatrixPosition(this.matrixWorld);var n=ml.distanceTo(vl);t[0].object.visible=!0;for(var i=1,r=t.length;i=t[i].distance;i++)t[i-1].object.visible=!1,t[i].object.visible=!0;for(;io))h.applyMatrix4(this.matrixWorld),(w=e.ray.origin.distanceTo(h))e.far||t.push({distance:w,point:c.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}else for(m=0,v=p.length/3-1;mo))h.applyMatrix4(this.matrixWorld),(w=e.ray.origin.distanceTo(h))e.far||t.push({distance:w,point:c.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}}else if(i.isGeometry){var x=i.vertices,b=x.length;for(m=0;mo))h.applyMatrix4(this.matrixWorld),(w=e.ray.origin.distanceTo(h))e.far||t.push({distance:w,point:c.clone().applyMatrix4(this.matrixWorld),index:m,face:null,faceIndex:null,object:this})}}}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var Cl=new $n,Ol=new $n;function Il(e,t){Pl.call(this,e,t),this.type="LineSegments"}function Dl(e,t){Pl.call(this,e,t),this.type="LineLoop"}function Nl(e){Pr.call(this),this.type="PointsMaterial",this.color=new Sr(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.setValues(e)}Il.prototype=Object.assign(Object.create(Pl.prototype),{constructor:Il,isLineSegments:!0,computeLineDistances:function(){var e=this.geometry;if(e.isBufferGeometry)if(null===e.index){for(var t=e.attributes.position,n=[],i=0,r=t.count;ir.far)return;a.push({distance:c,distanceToRay:Math.sqrt(s),point:l,index:t,face:null,object:o})}}function Vl(e,t,n,i,r,a,o,s,l){ai.call(this,e,t,n,i,r,a,o,s,l),this.format=void 0!==o?o:Xt,this.minFilter=void 0!==a?a:Pt,this.magFilter=void 0!==r?r:Pt,this.generateMipmaps=!1}function Hl(e,t,n,i,r,a,o,s,l,c,h,u){ai.call(this,null,a,o,s,l,c,i,r,h,u),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}function jl(e,t,n,i,r,a,o,s,l){ai.call(this,e,t,n,i,r,a,o,s,l),this.needsUpdate=!0}function Wl(e,t,n,i,r,a,o,s,l,c){if((c=void 0!==c?c:Qt)!==Qt&&c!==$t)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");void 0===n&&c===Qt&&(n=Ut),void 0===n&&c===$t&&(n=Wt),ai.call(this,null,i,r,a,o,s,c,n,l),this.image={width:e,height:t},this.magFilter=void 0!==o?o:At,this.minFilter=void 0!==s?s:At,this.flipY=!1,this.generateMipmaps=!1}function ql(e){Kr.call(this),this.type="WireframeGeometry";var t,n,i,r,a,o,s,l,c,h,u=[],d=[0,0],p={},f=["a","b","c"];if(e&&e.isGeometry){var m=e.faces;for(t=0,i=m.length;t=0?(e(v-1e-5,m,u),d.subVectors(h,u)):(e(v+1e-5,m,u),d.subVectors(u,h)),m-1e-5>=0?(e(v,m-1e-5,u),p.subVectors(h,u)):(e(v,m+1e-5,u),p.subVectors(u,h)),c.crossVectors(d,p).normalize(),s.push(c.x,c.y,c.z),l.push(v,m)}}for(i=0;i.9&&o<.1&&(t<.2&&(a[e+0]+=1),n<.2&&(a[e+2]+=1),i<.2&&(a[e+4]+=1))}}()}(),this.setAttribute("position",new kr(r,3)),this.setAttribute("normal",new kr(r.slice(),3)),this.setAttribute("uv",new kr(a,2)),0===i?this.computeVertexNormals():this.normalizeNormals()}function Kl(e,t){_a.call(this),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Ql(e,t)),this.mergeVertices()}function Ql(e,t){Jl.call(this,[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="TetrahedronBufferGeometry",this.parameters={radius:e,detail:t}}function $l(e,t){_a.call(this),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new ec(e,t)),this.mergeVertices()}function ec(e,t){Jl.call(this,[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="OctahedronBufferGeometry",this.parameters={radius:e,detail:t}}function tc(e,t){_a.call(this),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new nc(e,t)),this.mergeVertices()}function nc(e,t){var n=(1+Math.sqrt(5))/2,i=[-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];Jl.call(this,i,[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="IcosahedronBufferGeometry",this.parameters={radius:e,detail:t}}function ic(e,t){_a.call(this),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new rc(e,t)),this.mergeVertices()}function rc(e,t){var n=(1+Math.sqrt(5))/2,i=1/n,r=[-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];Jl.call(this,r,[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="DodecahedronBufferGeometry",this.parameters={radius:e,detail:t}}function ac(e,t,n,i,r,a){_a.call(this),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:r},void 0!==a&&console.warn("THREE.TubeGeometry: taper has been removed.");var o=new oc(e,t,n,i,r);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals,this.fromBufferGeometry(o),this.mergeVertices()}function oc(e,t,n,i,r){Kr.call(this),this.type="TubeBufferGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:r},t=t||64,n=n||1,i=i||8,r=r||!1;var a=e.computeFrenetFrames(t,r);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;var o,s,l=new $n,c=new $n,h=new Zn,u=new $n,d=[],p=[],f=[],m=[];function v(r){u=e.getPointAt(r/t,u);var o=a.normals[r],h=a.binormals[r];for(s=0;s<=i;s++){var f=s/i*Math.PI*2,m=Math.sin(f),v=-Math.cos(f);c.x=v*o.x+m*h.x,c.y=v*o.y+m*h.y,c.z=v*o.z+m*h.z,c.normalize(),p.push(c.x,c.y,c.z),l.x=u.x+n*c.x,l.y=u.y+n*c.y,l.z=u.z+n*c.z,d.push(l.x,l.y,l.z)}}!function(){for(o=0;o0){var o=r[a[0]];if(void 0!==o)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},e=0,t=o.length;e0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}}),Vl.prototype=Object.assign(Object.create(ai.prototype),{constructor:Vl,isVideoTexture:!0,update:function(){var e=this.image;e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}),Hl.prototype=Object.create(ai.prototype),Hl.prototype.constructor=Hl,Hl.prototype.isCompressedTexture=!0,jl.prototype=Object.create(ai.prototype),jl.prototype.constructor=jl,jl.prototype.isCanvasTexture=!0,Wl.prototype=Object.create(ai.prototype),Wl.prototype.constructor=Wl,Wl.prototype.isDepthTexture=!0,ql.prototype=Object.create(Kr.prototype),ql.prototype.constructor=ql,Xl.prototype=Object.create(_a.prototype),Xl.prototype.constructor=Xl,Yl.prototype=Object.create(Kr.prototype),Yl.prototype.constructor=Yl,Zl.prototype=Object.create(_a.prototype),Zl.prototype.constructor=Zl,Jl.prototype=Object.create(Kr.prototype),Jl.prototype.constructor=Jl,Kl.prototype=Object.create(_a.prototype),Kl.prototype.constructor=Kl,Ql.prototype=Object.create(Jl.prototype),Ql.prototype.constructor=Ql,$l.prototype=Object.create(_a.prototype),$l.prototype.constructor=$l,ec.prototype=Object.create(Jl.prototype),ec.prototype.constructor=ec,tc.prototype=Object.create(_a.prototype),tc.prototype.constructor=tc,nc.prototype=Object.create(Jl.prototype),nc.prototype.constructor=nc,ic.prototype=Object.create(_a.prototype),ic.prototype.constructor=ic,rc.prototype=Object.create(Jl.prototype),rc.prototype.constructor=rc,ac.prototype=Object.create(_a.prototype),ac.prototype.constructor=ac,oc.prototype=Object.create(Kr.prototype),oc.prototype.constructor=oc,oc.prototype.toJSON=function(){var e=Kr.prototype.toJSON.call(this);return e.path=this.parameters.path.toJSON(),e},sc.prototype=Object.create(_a.prototype),sc.prototype.constructor=sc,lc.prototype=Object.create(Kr.prototype),lc.prototype.constructor=lc,cc.prototype=Object.create(_a.prototype),cc.prototype.constructor=cc,hc.prototype=Object.create(Kr.prototype),hc.prototype.constructor=hc;var uc=function(e,t,n){n=n||2;var i,r,a,o,s,l,c,h=t&&t.length,u=h?t[0]*n:e.length,d=dc(e,0,u,n,!0),p=[];if(!d||d.next===d.prev)return p;if(h&&(d=function(e,t,n,i){var r,a,o,s,l,c=[];for(r=0,a=t.length;r80*n){i=a=e[0],r=o=e[1];for(var f=n;fa&&(a=s),l>o&&(o=l);c=0!==(c=Math.max(a-i,o-r))?1/c:0}return fc(d,p,n,i,r,c),p};function dc(e,t,n,i,r){var a,o;if(r===function(e,t,n,i){for(var r=0,a=t,o=n-i;a0)for(a=t;a=t;a-=i)o=Pc(a,e[a],e[a+1],o);return o&&Tc(o,o.next)&&(Cc(o),o=o.next),o}function pc(e,t){if(!e)return e;t||(t=e);var n,i=e;do{if(n=!1,i.steiner||!Tc(i,i.next)&&0!==Ec(i.prev,i,i.next))i=i.next;else{if(Cc(i),(i=t=i.prev)===i.next)break;n=!0}}while(n||i!==t);return t}function fc(e,t,n,i,r,a,o){if(e){!o&&a&&function(e,t,n,i){var r=e;do{null===r.z&&(r.z=wc(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){var t,n,i,r,a,o,s,l,c=1;do{for(n=e,e=null,a=null,o=0;n;){for(o++,i=n,s=0,t=0;t0||l>0&&i;)0!==s&&(0===l||!i||n.z<=i.z)?(r=n,n=n.nextZ,s--):(r=i,i=i.nextZ,l--),a?a.nextZ=r:e=r,r.prevZ=a,a=r;n=i}a.nextZ=null,c*=2}while(o>1)}(r)}(e,i,r,a);for(var s,l,c=e;e.prev!==e.next;)if(s=e.prev,l=e.next,a?vc(e,i,r,a):mc(e))t.push(s.i/n),t.push(e.i/n),t.push(l.i/n),Cc(e),e=l.next,c=l.next;else if((e=l)===c){o?1===o?fc(e=gc(e,t,n),t,n,i,r,a,2):2===o&&yc(e,t,n,i,r,a):fc(pc(e),t,n,i,r,a,1);break}}}function mc(e){var t=e.prev,n=e,i=e.next;if(Ec(t,n,i)>=0)return!1;for(var r=e.next.next;r!==e.prev;){if(Mc(t.x,t.y,n.x,n.y,i.x,i.y,r.x,r.y)&&Ec(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function vc(e,t,n,i){var r=e.prev,a=e,o=e.next;if(Ec(r,a,o)>=0)return!1;for(var s=r.xa.x?r.x>o.x?r.x:o.x:a.x>o.x?a.x:o.x,h=r.y>a.y?r.y>o.y?r.y:o.y:a.y>o.y?a.y:o.y,u=wc(s,l,t,n,i),d=wc(c,h,t,n,i),p=e.prevZ,f=e.nextZ;p&&p.z>=u&&f&&f.z<=d;){if(p!==e.prev&&p!==e.next&&Mc(r.x,r.y,a.x,a.y,o.x,o.y,p.x,p.y)&&Ec(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,f!==e.prev&&f!==e.next&&Mc(r.x,r.y,a.x,a.y,o.x,o.y,f.x,f.y)&&Ec(f.prev,f,f.next)>=0)return!1;f=f.nextZ}for(;p&&p.z>=u;){if(p!==e.prev&&p!==e.next&&Mc(r.x,r.y,a.x,a.y,o.x,o.y,p.x,p.y)&&Ec(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;f&&f.z<=d;){if(f!==e.prev&&f!==e.next&&Mc(r.x,r.y,a.x,a.y,o.x,o.y,f.x,f.y)&&Ec(f.prev,f,f.next)>=0)return!1;f=f.nextZ}return!0}function gc(e,t,n){var i=e;do{var r=i.prev,a=i.next.next;!Tc(r,a)&&Ac(r,i,i.next,a)&&Lc(r,a)&&Lc(a,r)&&(t.push(r.i/n),t.push(i.i/n),t.push(a.i/n),Cc(i),Cc(i.next),i=e=a),i=i.next}while(i!==e);return i}function yc(e,t,n,i,r,a){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&Sc(o,s)){var l=Rc(o,s);return o=pc(o,o.next),l=pc(l,l.next),fc(o,t,n,i,r,a),void fc(l,t,n,i,r,a)}s=s.next}o=o.next}while(o!==e)}function xc(e,t){return e.x-t.x}function bc(e,t){if(t=function(e,t){var n,i=t,r=e.x,a=e.y,o=-1/0;do{if(a<=i.y&&a>=i.next.y&&i.next.y!==i.y){var s=i.x+(a-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(s<=r&&s>o){if(o=s,s===r){if(a===i.y)return i;if(a===i.next.y)return i.next}n=i.x=i.x&&i.x>=h&&r!==i.x&&Mc(an.x)&&Lc(i,e)&&(n=i,d=l),i=i.next;return n}(e,t)){var n=Rc(t,e);pc(n,n.next)}}function wc(e,t,n,i,r){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*r)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-i)*r)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function _c(e){var t=e,n=e;do{(t.x=0&&(e-o)*(i-s)-(n-o)*(t-s)>=0&&(n-o)*(a-s)-(r-o)*(i-s)>=0}function Sc(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&Ac(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}(e,t)&&Lc(e,t)&&Lc(t,e)&&function(e,t){var n=e,i=!1,r=(e.x+t.x)/2,a=(e.y+t.y)/2;do{n.y>a!=n.next.y>a&&n.next.y!==n.y&&r<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next}while(n!==e);return i}(e,t)}function Ec(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Tc(e,t){return e.x===t.x&&e.y===t.y}function Ac(e,t,n,i){return!!(Tc(e,n)&&Tc(t,i)||Tc(e,i)&&Tc(n,t))||Ec(e,t,n)>0!=Ec(e,t,i)>0&&Ec(n,i,e)>0!=Ec(n,i,t)>0}function Lc(e,t){return Ec(e.prev,e,e.next)<0?Ec(e,t,e.next)>=0&&Ec(e,e.prev,t)>=0:Ec(e,t,e.prev)<0||Ec(e,e.next,t)<0}function Rc(e,t){var n=new Oc(e.i,e.x,e.y),i=new Oc(t.i,t.x,t.y),r=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=r,r.prev=n,i.next=n,n.prev=i,a.next=i,i.prev=a,i}function Pc(e,t,n,i){var r=new Oc(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 Cc(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 Oc(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}var Ic={area:function(e){for(var t=e.length,n=0,i=t-1,r=0;r2&&e[t-1].equals(e[0])&&e.pop()}function Nc(e,t){for(var n=0;nNumber.EPSILON){var d=Math.sqrt(h),p=Math.sqrt(l*l+c*c),f=t.x-s/d,m=t.y+o/d,v=((n.x-c/p-f)*c-(n.y+l/p-m)*l)/(o*c-s*l),g=(i=f+o*v-e.x)*i+(r=m+s*v-e.y)*r;if(g<=2)return new Zn(i,r);a=Math.sqrt(g/2)}else{var y=!1;o>Number.EPSILON?l>Number.EPSILON&&(y=!0):o<-Number.EPSILON?l<-Number.EPSILON&&(y=!0):Math.sign(s)===Math.sign(c)&&(y=!0),y?(i=-s,r=o,a=Math.sqrt(h)):(i=o,r=s,a=Math.sqrt(h/2))}return new Zn(i/a,r/a)}for(var k=[],G=0,V=R.length,H=V-1,j=G+1;G=0;C--){for(I=C/p,D=h*Math.cos(I*Math.PI/2),O=u*Math.sin(I*Math.PI/2)+d,G=0,V=R.length;G=0;){n=G,(i=G-1)<0&&(i=e.length-1);var r=0,a=s+2*p;for(r=0;r0)&&f.push(_,M,E),(l!==n-1||c0&&g(!0),t>0&&g(!1)),this.setIndex(c),this.setAttribute("position",new kr(h,3)),this.setAttribute("normal",new kr(u,3)),this.setAttribute("uv",new kr(d,2))}function eh(e,t,n,i,r,a,o){Qc.call(this,0,e,t,n,i,r,a,o),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:a,thetaLength:o}}function th(e,t,n,i,r,a,o){$c.call(this,0,e,t,n,i,r,a,o),this.type="ConeBufferGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:a,thetaLength:o}}function nh(e,t,n,i){_a.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},this.fromBufferGeometry(new ih(e,t,n,i)),this.mergeVertices()}function ih(e,t,n,i){Kr.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},e=e||1,t=void 0!==t?Math.max(3,t):8,n=void 0!==n?n:0,i=void 0!==i?i:2*Math.PI;var r,a,o=[],s=[],l=[],c=[],h=new $n,u=new Zn;for(s.push(0,0,0),l.push(0,0,1),c.push(.5,.5),a=0,r=3;a<=t;a++,r+=3){var d=n+a/t*i;h.x=e*Math.cos(d),h.y=e*Math.sin(d),s.push(h.x,h.y,h.z),l.push(0,0,1),u.x=(s[r]/e+1)/2,u.y=(s[r+1]/e+1)/2,c.push(u.x,u.y)}for(r=1;r<=t;r++)o.push(r,r+1,0);this.setIndex(o),this.setAttribute("position",new kr(s,3)),this.setAttribute("normal",new kr(l,3)),this.setAttribute("uv",new kr(c,2))}kc.prototype=Object.create(_a.prototype),kc.prototype.constructor=kc,Gc.prototype=Object.create(Uc.prototype),Gc.prototype.constructor=Gc,Vc.prototype=Object.create(_a.prototype),Vc.prototype.constructor=Vc,Hc.prototype=Object.create(Kr.prototype),Hc.prototype.constructor=Hc,jc.prototype=Object.create(_a.prototype),jc.prototype.constructor=jc,Wc.prototype=Object.create(Kr.prototype),Wc.prototype.constructor=Wc,qc.prototype=Object.create(_a.prototype),qc.prototype.constructor=qc,Xc.prototype=Object.create(Kr.prototype),Xc.prototype.constructor=Xc,Yc.prototype=Object.create(_a.prototype),Yc.prototype.constructor=Yc,Yc.prototype.toJSON=function(){var e=_a.prototype.toJSON.call(this);return Jc(this.parameters.shapes,e)},Zc.prototype=Object.create(Kr.prototype),Zc.prototype.constructor=Zc,Zc.prototype.toJSON=function(){var e=Kr.prototype.toJSON.call(this);return Jc(this.parameters.shapes,e)},Kc.prototype=Object.create(Kr.prototype),Kc.prototype.constructor=Kc,Qc.prototype=Object.create(_a.prototype),Qc.prototype.constructor=Qc,$c.prototype=Object.create(Kr.prototype),$c.prototype.constructor=$c,eh.prototype=Object.create(Qc.prototype),eh.prototype.constructor=eh,th.prototype=Object.create($c.prototype),th.prototype.constructor=th,nh.prototype=Object.create(_a.prototype),nh.prototype.constructor=nh,ih.prototype=Object.create(Kr.prototype),ih.prototype.constructor=ih;var rh=Object.freeze({__proto__:null,WireframeGeometry:ql,ParametricGeometry:Xl,ParametricBufferGeometry:Yl,TetrahedronGeometry:Kl,TetrahedronBufferGeometry:Ql,OctahedronGeometry:$l,OctahedronBufferGeometry:ec,IcosahedronGeometry:tc,IcosahedronBufferGeometry:nc,DodecahedronGeometry:ic,DodecahedronBufferGeometry:rc,PolyhedronGeometry:Zl,PolyhedronBufferGeometry:Jl,TubeGeometry:ac,TubeBufferGeometry:oc,TorusKnotGeometry:sc,TorusKnotBufferGeometry:lc,TorusGeometry:cc,TorusBufferGeometry:hc,TextGeometry:kc,TextBufferGeometry:Gc,SphereGeometry:Vc,SphereBufferGeometry:Hc,RingGeometry:jc,RingBufferGeometry:Wc,PlaneGeometry:Wa,PlaneBufferGeometry:qa,LatheGeometry:qc,LatheBufferGeometry:Xc,ShapeGeometry:Yc,ShapeBufferGeometry:Zc,ExtrudeGeometry:zc,ExtrudeBufferGeometry:Uc,EdgesGeometry:Kc,ConeGeometry:eh,ConeBufferGeometry:th,CylinderGeometry:Qc,CylinderBufferGeometry:$c,CircleGeometry:nh,CircleBufferGeometry:ih,BoxGeometry:class extends _a{constructor(e,t,n,i,r,a){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:a},this.fromBufferGeometry(new Ma(e,t,n,i,r,a)),this.mergeVertices()}},BoxBufferGeometry:Ma});function ah(e){Pr.call(this),this.type="ShadowMaterial",this.color=new Sr(0),this.transparent=!0,this.setValues(e)}function oh(e){Ra.call(this,e),this.type="RawShaderMaterial"}function sh(e){Pr.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new Sr(16777215),this.roughness=.5,this.metalness=.5,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Sr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=kn,this.normalScale=new Zn(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function lh(e){sh.call(this),this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearcoat=0,this.clearcoatRoughness=0,this.sheen=null,this.clearcoatNormalScale=new Zn(1,1),this.clearcoatNormalMap=null,this.transparency=0,this.setValues(e)}function ch(e){Pr.call(this),this.type="MeshPhongMaterial",this.color=new Sr(16777215),this.specular=new Sr(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Sr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=kn,this.normalScale=new Zn(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=lt,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function hh(e){ch.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(e)}function uh(e){Pr.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=kn,this.normalScale=new Zn(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function dh(e){Pr.call(this),this.type="MeshLambertMaterial",this.color=new Sr(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Sr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=lt,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function ph(e){Pr.call(this),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new Sr(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=kn,this.normalScale=new Zn(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}function fh(e){Sl.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}ah.prototype=Object.create(Pr.prototype),ah.prototype.constructor=ah,ah.prototype.isShadowMaterial=!0,ah.prototype.copy=function(e){return Pr.prototype.copy.call(this,e),this.color.copy(e.color),this},oh.prototype=Object.create(Ra.prototype),oh.prototype.constructor=oh,oh.prototype.isRawShaderMaterial=!0,sh.prototype=Object.create(Pr.prototype),sh.prototype.constructor=sh,sh.prototype.isMeshStandardMaterial=!0,sh.prototype.copy=function(e){return Pr.prototype.copy.call(this,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.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},lh.prototype=Object.create(sh.prototype),lh.prototype.constructor=lh,lh.prototype.isMeshPhysicalMaterial=!0,lh.prototype.copy=function(e){return sh.prototype.copy.call(this,e),this.defines={STANDARD:"",PHYSICAL:""},this.reflectivity=e.reflectivity,this.clearcoat=e.clearcoat,this.clearcoatRoughness=e.clearcoatRoughness,e.sheen?this.sheen=(this.sheen||new Sr).copy(e.sheen):this.sheen=null,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.transparency=e.transparency,this},ch.prototype=Object.create(Pr.prototype),ch.prototype.constructor=ch,ch.prototype.isMeshPhongMaterial=!0,ch.prototype.copy=function(e){return Pr.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},hh.prototype=Object.create(ch.prototype),hh.prototype.constructor=hh,hh.prototype.isMeshToonMaterial=!0,hh.prototype.copy=function(e){return ch.prototype.copy.call(this,e),this.gradientMap=e.gradientMap,this},uh.prototype=Object.create(Pr.prototype),uh.prototype.constructor=uh,uh.prototype.isMeshNormalMaterial=!0,uh.prototype.copy=function(e){return Pr.prototype.copy.call(this,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.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},dh.prototype=Object.create(Pr.prototype),dh.prototype.constructor=dh,dh.prototype.isMeshLambertMaterial=!0,dh.prototype.copy=function(e){return Pr.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},ph.prototype=Object.create(Pr.prototype),ph.prototype.constructor=ph,ph.prototype.isMeshMatcapMaterial=!0,ph.prototype.copy=function(e){return Pr.prototype.copy.call(this,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.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this},fh.prototype=Object.create(Sl.prototype),fh.prototype.constructor=fh,fh.prototype.isLineDashedMaterial=!0,fh.prototype.copy=function(e){return Sl.prototype.copy.call(this,e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this};var mh=Object.freeze({__proto__:null,ShadowMaterial:ah,SpriteMaterial:el,RawShaderMaterial:oh,ShaderMaterial:Ra,PointsMaterial:Nl,MeshPhysicalMaterial:lh,MeshStandardMaterial:sh,MeshPhongMaterial:ch,MeshToonMaterial:hh,MeshNormalMaterial:uh,MeshLambertMaterial:dh,MeshDepthMaterial:Cs,MeshDistanceMaterial:Os,MeshBasicMaterial:Cr,MeshMatcapMaterial:ph,LineDashedMaterial:fh,LineBasicMaterial:Sl,Material:Pr}),vh={arraySlice:function(e,t,n){return vh.isTypedArray(e)?new e.constructor(e.subarray(t,void 0!==n?n:e.length)):e.slice(t,n)},convertArray:function(e,t,n){return!e||!n&&e.constructor===t?e:"number"==typeof t.BYTES_PER_ELEMENT?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){for(var t=e.length,n=new Array(t),i=0;i!==t;++i)n[i]=i;return n.sort(function(t,n){return e[t]-e[n]}),n},sortedArray:function(e,t,n){for(var i=e.length,r=new e.constructor(i),a=0,o=0;o!==i;++a)for(var s=n[a]*t,l=0;l!==t;++l)r[o++]=e[s+l];return r},flattenJSON:function(e,t,n,i){for(var r=1,a=e[0];void 0!==a&&void 0===a[i];)a=e[r++];if(void 0!==a){var o=a[i];if(void 0!==o)if(Array.isArray(o))do{void 0!==(o=a[i])&&(t.push(a.time),n.push.apply(n,o)),a=e[r++]}while(void 0!==a);else if(void 0!==o.toArray)do{void 0!==(o=a[i])&&(t.push(a.time),o.toArray(n,n.length)),a=e[r++]}while(void 0!==a);else do{void 0!==(o=a[i])&&(t.push(a.time),n.push(o)),a=e[r++]}while(void 0!==a)}},subclip:function(e,t,n,i,r){r=r||30;var a=e.clone();a.name=t;for(var o=[],s=0;s=i)){h.push(l.times[d]);for(var f=0;fa.tracks[s].times[0]&&(m=a.tracks[s].times[0]);for(s=0;s=r)break e;var s=t[1];e=(r=t[--n-1]))break t}a=n,n=0}for(;n>>1;et;)--a;if(++a,0!==r||a!==i){r>=a&&(r=(a=Math.max(a,1))-1);var o=this.getValueSize();this.times=vh.arraySlice(n,r,a),this.values=vh.arraySlice(this.values,r*o,a*o)}return this},validate:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);var n=this.times,i=this.values,r=n.length;0===r&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);for(var a=null,o=0;o!==r;o++){var s=n[o];if("number"==typeof s&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,s),e=!1;break}if(null!==a&&a>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,s,a),e=!1;break}a=s}if(void 0!==i&&vh.isTypedArray(i)){o=0;for(var l=i.length;o!==l;++o){var c=i[o];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,c),e=!1;break}}}return e},optimize:function(){for(var e=this.times,t=this.values,n=this.getValueSize(),i=2302===this.getInterpolation(),r=1,a=e.length-1,o=1;o0){e[r]=e[a];for(f=a*n,m=r*n,d=0;d!==n;++d)t[m+d]=t[f+d];++r}return r!==e.length&&(this.times=vh.arraySlice(e,0,r),this.values=vh.arraySlice(t,0,r*n)),this},clone:function(){var e=vh.arraySlice(this.times,0),t=vh.arraySlice(this.values,0),n=new(0,this.constructor)(this.name,e,t);return n.createInterpolant=this.createInterpolant,n}}),_h.prototype=Object.assign(Object.create(wh.prototype),{constructor:_h,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Mh.prototype=Object.assign(Object.create(wh.prototype),{constructor:Mh,ValueTypeName:"color"}),Sh.prototype=Object.assign(Object.create(wh.prototype),{constructor:Sh,ValueTypeName:"number"}),Eh.prototype=Object.assign(Object.create(gh.prototype),{constructor:Eh,interpolate_:function(e,t,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=(n-t)/(i-t),c=s+o;s!==c;s+=4)Jn.slerpFlat(r,0,a,s-o,a,s,l);return r}}),Th.prototype=Object.assign(Object.create(wh.prototype),{constructor:Th,ValueTypeName:"quaternion",DefaultInterpolation:2301,InterpolantFactoryMethodLinear:function(e){return new Eh(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0}),Ah.prototype=Object.assign(Object.create(wh.prototype),{constructor:Ah,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:2300,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0}),Lh.prototype=Object.assign(Object.create(wh.prototype),{constructor:Lh,ValueTypeName:"vector"}),Object.assign(Rh,{parse:function(e){for(var t=[],n=e.tracks,i=1/(e.fps||1),r=0,a=n.length;r!==a;++r)t.push(Ph(n[r]).scale(i));return new Rh(e.name,e.duration,t)},toJSON:function(e){for(var t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid},r=0,a=n.length;r!==a;++r)t.push(wh.toJSON(n[r]));return i},CreateFromMorphTargetSequence:function(e,t,n,i){for(var r=t.length,a=[],o=0;o1){var c=i[u=l[1]];c||(i[u]=c=[]),c.push(s)}}var h=[];for(var u in i)h.push(Rh.CreateFromMorphTargetSequence(u,i[u],t,n));return h},parseAnimation:function(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var n=function(e,t,n,i,r){if(0!==n.length){var a=[],o=[];vh.flattenJSON(n,a,o,i),0!==a.length&&r.push(new e(t,a,o))}},i=[],r=e.name||"default",a=e.length||-1,o=e.fps||30,s=e.hierarchy||[],l=0;l0||0===e.search(/^data\:image\/jpeg/);r.format=i?Xt:Yt,r.needsUpdate=!0,void 0!==t&&t(r)},n,i),r}}),Object.assign(Hh.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(e,t){var n=this.getUtoTmapping(e);return this.getPoint(n,t)},getPoints:function(e){void 0===e&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return t},getSpacedPoints:function(e){void 0===e&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t},getLength:function(){var e=this.getLengths();return e[e.length-1]},getLengths:function(e){if(void 0===e&&(e=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t,n,i=[],r=this.getPoint(0),a=0;for(i.push(0),n=1;n<=e;n++)a+=(t=this.getPoint(n/e)).distanceTo(r),i.push(a),r=t;return this.cacheArcLengths=i,i},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){var n,i=this.getLengths(),r=0,a=i.length;n=t||e*i[a-1];for(var o,s=0,l=a-1;s<=l;)if((o=i[r=Math.floor(s+(l-s)/2)]-n)<0)s=r+1;else{if(!(o>0)){l=r;break}l=r-1}if(i[r=l]===n)return r/(a-1);var c=i[r];return(r+(n-c)/(i[r+1]-c))/(a-1)},getTangent:function(e){var t=e-1e-4,n=e+1e-4;t<0&&(t=0),n>1&&(n=1);var i=this.getPoint(t);return this.getPoint(n).clone().sub(i).normalize()},getTangentAt:function(e){var t=this.getUtoTmapping(e);return this.getTangent(t)},computeFrenetFrames:function(e,t){var n,i,r,a=new $n,o=[],s=[],l=[],c=new $n,h=new vi;for(n=0;n<=e;n++)i=n/e,o[n]=this.getTangentAt(i),o[n].normalize();s[0]=new $n,l[0]=new $n;var u=Number.MAX_VALUE,d=Math.abs(o[0].x),p=Math.abs(o[0].y),f=Math.abs(o[0].z);for(d<=u&&(u=d,a.set(1,0,0)),p<=u&&(u=p,a.set(0,1,0)),f<=u&&a.set(0,0,1),c.crossVectors(o[0],a).normalize(),s[0].crossVectors(o[0],c),l[0].crossVectors(o[0],s[0]),n=1;n<=e;n++)s[n]=s[n-1].clone(),l[n]=l[n-1].clone(),c.crossVectors(o[n-1],o[n]),c.length()>Number.EPSILON&&(c.normalize(),r=Math.acos(Yn.clamp(o[n-1].dot(o[n]),-1,1)),s[n].applyMatrix4(h.makeRotationAxis(c,r))),l[n].crossVectors(o[n],s[n]);if(!0===t)for(r=Math.acos(Yn.clamp(s[0].dot(s[e]),-1,1)),r/=e,o[0].dot(c.crossVectors(s[0],s[e]))>0&&(r=-r),n=1;n<=e;n++)s[n].applyMatrix4(h.makeRotationAxis(o[n],r*n)),l[n].crossVectors(o[n],s[n]);return{tangents:o,normals:s,binormals:l}},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this},toJSON:function(){var e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e},fromJSON:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}),jh.prototype=Object.create(Hh.prototype),jh.prototype.constructor=jh,jh.prototype.isEllipseCurve=!0,jh.prototype.getPoint=function(e,t){for(var n=t||new Zn,i=2*Math.PI,r=this.aEndAngle-this.aStartAngle,a=Math.abs(r)i;)r-=i;r0?0:(Math.floor(Math.abs(h)/l)+1)*l:0===u&&h===l-1&&(h=l-2,u=1),this.closed||h>0?n=s[(h-1)%l]:(Xh.subVectors(s[0],s[1]).add(s[0]),n=Xh),i=s[h%l],r=s[(h+1)%l],this.closed||h+2i.length-2?i.length-1:a+1],h=i[a>i.length-3?i.length-1:a+2];return n.set(Qh(o,s.x,l.x,c.x,h.x),Qh(o,s.y,l.y,c.y,h.y)),n},su.prototype.copy=function(e){Hh.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t=t){var r=n[i]-t,a=this.curves[i],o=a.getLength(),s=0===o?0:1-r/o;return a.getPointAt(s)}i++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,n=0,i=this.curves.length;n1&&!n[n.length-1].equals(n[0])&&n.push(n[0]),n},copy:function(e){Hh.prototype.copy.call(this,e),this.curves=[];for(var t=0,n=e.curves.length;t0){var c=l.getPoint(0);c.equals(this.currentPoint)||this.lineTo(c.x,c.y)}this.curves.push(l);var h=l.getPoint(1);return this.currentPoint.copy(h),this},copy:function(e){return cu.prototype.copy.call(this,e),this.currentPoint.copy(e.currentPoint),this},toJSON:function(){var e=cu.prototype.toJSON.call(this);return e.currentPoint=this.currentPoint.toArray(),e},fromJSON:function(e){return cu.prototype.fromJSON.call(this,e),this.currentPoint.fromArray(e.currentPoint),this}}),uu.prototype=Object.assign(Object.create(hu.prototype),{constructor:uu,getPointsHoles:function(e){for(var t=[],n=0,i=this.holes.length;n0){var a=new kh(new Oh(t));a.setCrossOrigin(this.crossOrigin);for(var o=0,s=e.length;o0?new yl(o,s):new ma(o,s);break;case"InstancedMesh":o=r(e.geometry),s=a(e.material);var l=e.count,c=e.instanceMatrix;(i=new Ml(o,s,l)).instanceMatrix=new Or(new Float32Array(c.array),16);break;case"LOD":i=new gl;break;case"Line":i=new Pl(r(e.geometry),a(e.material),e.mode);break;case"LineLoop":i=new Dl(r(e.geometry),a(e.material));break;case"LineSegments":i=new Il(r(e.geometry),a(e.material));break;case"PointCloud":case"Points":i=new kl(r(e.geometry),a(e.material));break;case"Sprite":i=new pl(a(e.material));break;case"Group":i=new Gs;break;default:i=new Di}if(i.uuid=e.uuid,void 0!==e.name&&(i.name=e.name),void 0!==e.matrix?(i.matrix.fromArray(e.matrix),void 0!==e.matrixAutoUpdate&&(i.matrixAutoUpdate=e.matrixAutoUpdate),i.matrixAutoUpdate&&i.matrix.decompose(i.position,i.quaternion,i.scale)):(void 0!==e.position&&i.position.fromArray(e.position),void 0!==e.rotation&&i.rotation.fromArray(e.rotation),void 0!==e.quaternion&&i.quaternion.fromArray(e.quaternion),void 0!==e.scale&&i.scale.fromArray(e.scale)),void 0!==e.castShadow&&(i.castShadow=e.castShadow),void 0!==e.receiveShadow&&(i.receiveShadow=e.receiveShadow),e.shadow&&(void 0!==e.shadow.bias&&(i.shadow.bias=e.shadow.bias),void 0!==e.shadow.radius&&(i.shadow.radius=e.shadow.radius),void 0!==e.shadow.mapSize&&i.shadow.mapSize.fromArray(e.shadow.mapSize),void 0!==e.shadow.camera&&(i.shadow.camera=this.parseObject(e.shadow.camera))),void 0!==e.visible&&(i.visible=e.visible),void 0!==e.frustumCulled&&(i.frustumCulled=e.frustumCulled),void 0!==e.renderOrder&&(i.renderOrder=e.renderOrder),void 0!==e.userData&&(i.userData=e.userData),void 0!==e.layers&&(i.layers.mask=e.layers),void 0!==e.drawMode&&i.setDrawMode(e.drawMode),void 0!==e.children)for(var h=e.children,u=0;uNumber.EPSILON){if(c<0&&(o=t[a],l=-l,s=t[r],c=-c),e.ys.y)continue;if(e.y===o.y){if(e.x===o.x)return!0}else{var h=c*(e.x-o.x)-l*(e.y-o.y);if(0===h)return!0;if(h<0)continue;i=!i}}else{if(e.y!==o.y)continue;if(s.x<=e.x&&e.x<=o.x||o.x<=e.x&&e.x<=s.x)return!0}}return i}var r=Ic.isClockWise,a=this.subPaths;if(0===a.length)return[];if(!0===t)return n(a);var o,s,l,c=[];if(1===a.length)return s=a[0],(l=new uu).curves=s.curves,c.push(l),c;var h=!r(a[0].getPoints());h=e?!h:h;var u,d,p=[],f=[],m=[],v=0;f[v]=void 0,m[v]=[];for(var g=0,y=a.length;g1){for(var x=!1,b=[],w=0,_=f.length;w<_;w++)p[w]=[];for(w=0,_=f.length;w<_;w++)for(var M=m[w],S=0;S0&&(x||(m=p))}g=0;for(var L=f.length;g0){this.source.connect(this.filters[0]);for(var e=1,t=this.filters.length;e0){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;e=.5)for(var a=0;a!==r;++a)e[t+a]=e[n+a]},_slerp:function(e,t,n,i){Jn.slerpFlat(e,t,e,t,e,n,i)},_lerp:function(e,t,n,i,r){for(var a=1-i,o=0;o!==r;++o){var s=t+o;e[s]=e[s]*a+e[n+o]*i}}});var ld=new RegExp("[\\[\\]\\.:\\/]","g"),cd="[^"+"\\[\\]\\.:\\/".replace("\\.","")+"]",hd=/((?:WC+[\/:])*)/.source.replace("WC","[^\\[\\]\\.:\\/]"),ud=/(WCOD+)?/.source.replace("WCOD",cd),dd=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC","[^\\[\\]\\.:\\/]"),pd=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC","[^\\[\\]\\.:\\/]"),fd=new RegExp("^"+hd+ud+dd+pd+"$"),md=["material","materials","bones"];function vd(e,t,n){var i=n||gd.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}function gd(e,t,n){this.path=t,this.parsedPath=n||gd.parseTrackName(t),this.node=gd.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e}function yd(e,t,n){this._mixer=e,this._clip=t,this._localRoot=n||null;for(var i=t.tracks,r=i.length,a=new Array(r),o={endingStart:Tn,endingEnd:Tn},s=0;s!==r;++s){var l=i[s].createInterpolant(null);a[s]=l,l.settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(r),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=En,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}function xd(e){this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}function bd(e){"string"==typeof e&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}function wd(e,t,n){Qs.call(this,e,t),this.meshPerAttribute=n||1}function _d(e,t,n,i){this.ray=new ar(e,t),this.near=n||0,this.far=i||1/0,this.camera=null,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function Md(e,t){return e.distance-t.distance}function Sd(e,t,n,i){if(!1!==e.visible&&(e.raycast(t,n),!0===i))for(var r=e.children,a=0,o=r.length;a=t){var h=t++,u=e[h];n[u.uuid]=c,e[c]=u,n[l]=h,e[h]=s;for(var d=0,p=r;d!==p;++d){var f=i[d],m=f[h],v=f[c];f[c]=m,f[h]=v}}}this.nCachedObjects_=t},uncache:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,i=this._indicesByUUID,r=this._bindings,a=r.length,o=0,s=arguments.length;o!==s;++o){var l=arguments[o],c=l.uuid,h=i[c];if(void 0!==h)if(delete i[c],h0)for(var l=this._interpolants,c=this._propertyBindings,h=0,u=l.length;h!==u;++h)l[h].evaluate(o),c[h].accumulate(i,s)}else this._updateWeight(e)},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var n=this._weightInterpolant;if(null!==n){var i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),0===i&&(this.enabled=!1))}}return this._effectiveWeight=t,t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var n=this._timeScaleInterpolant;if(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:function(e){var t=this.time+e,n=this._clip.duration,i=this.loop,r=this._loopCount,a=2202===i;if(0===e)return-1===r?t:a&&1==(1&r)?n-t:t;if(2200===i){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(t>=n)t=n;else{if(!(t<0)){this.time=t;break e}t=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=t,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,a)):this._setEndings(0===this.repetitions,!0,a)),t>=n||t<0){var o=Math.floor(t/n);t-=n*o,r+=Math.abs(o);var s=this.repetitions-r;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=e>0?n:0,this.time=t,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(1===s){var l=e<0;this._setEndings(l,!l,a)}else this._setEndings(!1,!1,a);this._loopCount=r,this.time=t,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=t;if(a&&1==(1&r))return n-t}return t},_setEndings:function(e,t,n){var i=this._interpolantSettings;n?(i.endingStart=2401,i.endingEnd=2401):(i.endingStart=e?this.zeroSlopeAtStart?2401:Tn:2402,i.endingEnd=t?this.zeroSlopeAtEnd?2401:Tn:2402)},_scheduleFading:function(e,t,n){var i=this._mixer,r=i.time,a=this._weightInterpolant;null===a&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=r,s[0]=t,o[1]=r+e,s[1]=n,this}}),xd.prototype=Object.assign(Object.create(Wn.prototype),{constructor:xd,_bindAction:function(e,t){var n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,a=e._propertyBindings,o=e._interpolants,s=n.uuid,l=this._bindingsByRootAndName,c=l[s];void 0===c&&(c={},l[s]=c);for(var h=0;h!==r;++h){var u=i[h],d=u.name,p=c[d];if(void 0!==p)a[h]=p;else{if(void 0!==(p=a[h])){null===p._cacheIndex&&(++p.referenceCount,this._addInactiveBinding(p,s,d));continue}var f=t&&t._propertyBindings[h].binding.parsedPath;++(p=new sd(gd.create(n,d,f),u.ValueTypeName,u.getValueSize())).referenceCount,this._addInactiveBinding(p,s,d),a[h]=p}o[h].resultBuffer=p.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(null===e._cacheIndex){var 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)}for(var r=e._propertyBindings,a=0,o=r.length;a!==o;++a){var s=r[a];0==s.useCount++&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,n=0,i=t.length;n!==i;++n){var r=t[n];0==--r.useCount&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var 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:function(e){var t=e._cacheIndex;return null!==t&&tthis.max.x||e.ythis.max.y)},containsBox:function(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:function(e,t){return void 0===t&&(console.warn("THREE.Box2: .getParameter() target is now required"),t=new Zn),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:function(e){return!(e.max.xthis.max.x||e.max.ythis.max.y)},clampPoint:function(e,t){return void 0===t&&(console.warn("THREE.Box2: .clampPoint() target is now required"),t=new Zn),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(e){return Td.copy(e).clamp(this.min,this.max).sub(e).length()},intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}});var Ld=new $n,Rd=new $n;function Pd(e,t){this.start=void 0!==e?e:new $n,this.end=void 0!==t?t:new $n}function Cd(e){Di.call(this),this.material=e,this.render=function(){}}Object.assign(Pd.prototype,{set:function(e,t){return this.start.copy(e),this.end.copy(t),this},clone:function(){return(new this.constructor).copy(this)},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},getCenter:function(e){return void 0===e&&(console.warn("THREE.Line3: .getCenter() target is now required"),e=new $n),e.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){return void 0===e&&(console.warn("THREE.Line3: .delta() target is now required"),e=new $n),e.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){return void 0===t&&(console.warn("THREE.Line3: .at() target is now required"),t=new $n),this.delta(t).multiplyScalar(e).add(this.start)},closestPointToPointParameter:function(e,t){Ld.subVectors(e,this.start),Rd.subVectors(this.end,this.start);var n=Rd.dot(Rd),i=Rd.dot(Ld)/n;return t&&(i=Yn.clamp(i,0,1)),i},closestPointToPoint:function(e,t,n){var i=this.closestPointToPointParameter(e,t);return void 0===n&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new $n),this.delta(n).multiplyScalar(i).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}}),Cd.prototype=Object.create(Di.prototype),Cd.prototype.constructor=Cd,Cd.prototype.isImmediateRenderObject=!0;var Od=new $n,Id=new $n,Dd=new ni,Nd=["a","b","c"];function zd(e,t,n,i){this.object=e,this.size=void 0!==t?t:1;var r=void 0!==n?n:16711680,a=void 0!==i?i:1,o=0,s=this.object.geometry;s&&s.isGeometry?o=3*s.faces.length:s&&s.isBufferGeometry&&(o=s.attributes.normal.count);var l=new Kr,c=new kr(2*o*3,3);l.setAttribute("position",c),Il.call(this,l,new Sl({color:r,linewidth:a})),this.matrixAutoUpdate=!1,this.update()}zd.prototype=Object.create(Il.prototype),zd.prototype.constructor=zd,zd.prototype.update=function(){this.object.updateMatrixWorld(!0),Dd.getNormalMatrix(this.object.matrixWorld);var e=this.object.matrixWorld,t=this.geometry.attributes.position,n=this.object.geometry;if(n&&n.isGeometry)for(var i=n.vertices,r=n.faces,a=0,o=0,s=r.length;o1&&e.multiplyScalar(1/t),this.children[0].material.color.copy(this.material.color)}},jd.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()};var Wd=new $n,qd=new Sr,Xd=new Sr;function Yd(e,t,n){Di.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;var i=new ec(t);i.rotateY(.5*Math.PI),this.material=new Cr({wireframe:!0,fog:!1}),void 0===this.color&&(this.material.vertexColors=Ce);var r=i.getAttribute("position"),a=new Float32Array(3*r.count);i.setAttribute("color",new Or(a,3)),this.add(new ma(i,this.material)),this.update()}function Zd(e,t){this.lightProbe=e,this.size=t;var n={GAMMA_OUTPUT:""},i=new Ra({defines:n,uniforms:{sh:{value:this.lightProbe.sh.coefficients},intensity:{value:this.lightProbe.intensity}},vertexShader:["varying vec3 vNormal;","void main() {","\tvNormal = normalize( normalMatrix * normal );","\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["#define RECIPROCAL_PI 0.318309886","vec3 inverseTransformDirection( in vec3 normal, in mat4 matrix ) {","\t// matrix is assumed to be orthogonal","\treturn normalize( ( vec4( normal, 0.0 ) * matrix ).xyz );","}","vec3 linearToOutput( in vec3 a ) {","\t#ifdef GAMMA_OUTPUT","\t\treturn pow( a, vec3( 1.0 / float( GAMMA_FACTOR ) ) );","\t#else","\t\treturn a;","\t#endif","}","// source: https://graphics.stanford.edu/papers/envmap/envmap.pdf","vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {","\t// normal is assumed to have unit length","\tfloat x = normal.x, y = normal.y, z = normal.z;","\t// band 0","\tvec3 result = shCoefficients[ 0 ] * 0.886227;","\t// band 1","\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;","\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;","\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;","\t// band 2","\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;","\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;","\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );","\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;","\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );","\treturn result;","}","uniform vec3 sh[ 9 ]; // sh coefficients","uniform float intensity; // light probe intensity","varying vec3 vNormal;","void main() {","\tvec3 normal = normalize( vNormal );","\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );","\tvec3 irradiance = shGetIrradianceAt( worldNormal, sh );","\tvec3 outgoingLight = RECIPROCAL_PI * irradiance * intensity;","\toutgoingLight = linearToOutput( outgoingLight );","\tgl_FragColor = vec4( outgoingLight, 1.0 );","}"].join("\n")}),r=new Hc(1,32,16);ma.call(this,r,i),this.onBeforeRender()}function Jd(e,t,n,i){e=e||10,t=t||10,n=new Sr(void 0!==n?n:4473924),i=new Sr(void 0!==i?i:8947848);for(var r=t/2,a=e/t,o=e/2,s=[],l=[],c=0,h=0,u=-o;c<=t;c++,u+=a){s.push(-o,0,u,o,0,u),s.push(u,0,-o,u,0,o);var d=c===r?n:i;d.toArray(l,h),h+=3,d.toArray(l,h),h+=3,d.toArray(l,h),h+=3,d.toArray(l,h),h+=3}var p=new Kr;p.setAttribute("position",new kr(s,3)),p.setAttribute("color",new kr(l,3));var f=new Sl({vertexColors:Ce});Il.call(this,p,f)}function Kd(e,t,n,i,r,a){e=e||10,t=t||16,n=n||8,i=i||64,r=new Sr(void 0!==r?r:4473924),a=new Sr(void 0!==a?a:8947848);var o,s,l,c,h,u,d,p=[],f=[];for(c=0;c<=t;c++)l=c/t*(2*Math.PI),o=Math.sin(l)*e,s=Math.cos(l)*e,p.push(0,0,0),p.push(o,0,s),d=1&c?r:a,f.push(d.r,d.g,d.b),f.push(d.r,d.g,d.b);for(c=0;c<=n;c++)for(d=1&c?r:a,u=e-e/n*c,h=0;h.99999)this.quaternion.set(0,0,0,1);else if(e.y<-.99999)this.quaternion.set(1,0,0,0);else{gp.set(e.z,0,-e.x).normalize();var t=Math.acos(e.y);this.quaternion.setFromAxisAngle(gp,t)}},yp.prototype.setLength=function(e,t,n){void 0===t&&(t=.2*e),void 0===n&&(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()},yp.prototype.setColor=function(e){this.line.material.color.set(e),this.cone.material.color.set(e)},yp.prototype.copy=function(e){return Di.prototype.copy.call(this,e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this},yp.prototype.clone=function(){return(new this.constructor).copy(this)},xp.prototype=Object.create(Il.prototype),xp.prototype.constructor=xp;function bp(e){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),Kh.call(this,e),this.type="catmullrom"}Hh.create=function(e,t){return console.log("THREE.Curve.create() has been deprecated"),e.prototype=Object.create(Hh.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e},Object.assign(cu.prototype,{createPointsGeometry:function(e){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var t=this.getPoints(e);return this.createGeometry(t)},createSpacedPointsGeometry:function(e){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var t=this.getSpacedPoints(e);return this.createGeometry(t)},createGeometry:function(e){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var t=new _a,n=0,i=e.length;n{var n={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(e,n).then(t).catch(i)},n,i)},decodeDracoFile:function(e,t,n,i){var r={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!n};this.decodeGeometry(e,r).then(t)},decodeGeometry:function(e,t){var n,i=this.workerNextTaskID++,r=e.byteLength;for(var a in t.attributeTypes){var o=t.attributeTypes[a];void 0!==o.BYTES_PER_ELEMENT&&(t.attributeTypes[a]=o.name)}var s=this._getWorker(i,r).then(r=>(n=r,new Promise((r,a)=>{n._callbacks[i]={resolve:r,reject:a},n.postMessage({type:"decode",id:i,taskConfig:t,buffer:e},[e])}))).then(e=>this._createGeometry(e.geometry));return s.finally(()=>{n&&i&&this._releaseTask(n,i)}),s},_createGeometry:function(e){var t=new Kr;e.index&&t.setIndex(new Or(e.index.array,1));for(var n=0;n{n.load(e,t,void 0,i)})},_initDecoder:function(){if(this.decoderPending)return this.decoderPending;var 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=>{var n=t[0];e||(this.decoderConfig.wasmBinary=t[1]);var i=wp.DRACOWorker.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:function(e,t){return this._initDecoder().then(()=>{var n;this.workerPool.lengtht._taskLoad?-1:1});return(n=this.workerPool[this.workerPool.length-1])._taskCosts[e]=t,n._taskLoad+=t,n})},_releaseTask:function(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]},debug:function(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))},dispose:function(){for(var e=0;e{var t=e.draco,i=new t.Decoder,s=new t.DecoderBuffer;s.Init(new Int8Array(a),a.byteLength);try{var l=function(e,t,i,r){var a,o,s=r.attributeIDs,l=r.attributeTypes,c=t.GetEncodedGeometryType(i);if(c===e.TRIANGULAR_MESH)a=new e.Mesh,o=t.DecodeBufferToMesh(i,a);else{if(c!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");a=new e.PointCloud,o=t.DecodeBufferToPointCloud(i,a)}if(!o.ok()||0===a.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+o.error_msg());var h={index:null,attributes:[]};for(var u in s){var d,p,f=self[l[u]];if(r.useUniqueIDs)p=s[u],d=t.GetAttributeByUniqueId(a,p);else{if(-1===(p=t.GetAttributeId(a,e[s[u]])))continue;d=t.GetAttribute(a,p)}h.attributes.push(n(e,t,a,u,f,d))}if(c===e.TRIANGULAR_MESH){for(var m=a.num_faces(),v=new Uint32Array(3*m),g=new e.DracoInt32Array,y=0;ye.array.buffer);l.index&&c.push(l.index.array.buffer),self.postMessage({type:"decode",id:r.id,geometry:l},c)}catch(e){console.error(e),self.postMessage({type:"error",id:r.id,error:e.message})}finally{t.destroy(s),t.destroy(i)}})}}},wp.setDecoderPath=function(){console.warn("THREE.DRACOLoader: The .setDecoderPath() method has been removed. Use instance methods.")},wp.setDecoderConfig=function(){console.warn("THREE.DRACOLoader: The .setDecoderConfig() method has been removed. Use instance methods.")},wp.releaseDecoderModule=function(){console.warn("THREE.DRACOLoader: The .releaseDecoderModule() method has been removed. Use instance methods.")},wp.getDecoderModule=function(){console.warn("THREE.DRACOLoader: The .getDecoderModule() method has been removed. Use instance methods.")};var _p,Mp,Sp=function(){function e(e){Dh.call(this,e),this.dracoLoader=null,this.ddsLoader=null}function t(){var e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}e.prototype=Object.assign(Object.create(Dh.prototype),{constructor:e,load:function(e,t,n,i){var r,a=this;r=""!==this.resourcePath?this.resourcePath:""!==this.path?this.path:Eu.extractUrlBase(e),a.manager.itemStart(e);var o=function(t){i?i(t):console.error(t),a.manager.itemError(e),a.manager.itemEnd(e)},s=new zh(a.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),"use-credentials"===a.crossOrigin&&s.setWithCredentials(!0),s.load(e,function(n){try{a.parse(n,r,function(n){t(n),a.manager.itemEnd(e)},o)}catch(e){o(e)}},n,o)},setDRACOLoader:function(e){return this.dracoLoader=e,this},setDDSLoader:function(e){return this.ddsLoader=e,this},parse:function(e,t,s,l){var p,f={};if("string"==typeof e)p=e;else if(Eu.decodeText(new Uint8Array(e,0,4))===o){try{f[n.KHR_BINARY_GLTF]=new c(e)}catch(e){return void(l&&l(e))}p=f[n.KHR_BINARY_GLTF].content}else p=Eu.decodeText(new Uint8Array(e));var m=JSON.parse(p);if(void 0===m.asset||m.asset.version[0]<2)l&&l(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported. Use LegacyGLTFLoader instead."));else{if(m.extensionsUsed)for(var v=0;v=0&&console.warn('THREE.GLTFLoader: Unknown extension "'+g+'".')}}new B(m,f,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,manager:this.manager}).parse(s,l)}}});var n={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",MSFT_TEXTURE_DDS:"MSFT_texture_dds"};function i(e){if(!e)throw new Error("THREE.GLTFLoader: Attempting to load .dds texture without importing DDSLoader");this.name=n.MSFT_TEXTURE_DDS,this.ddsLoader=e}function r(e){this.name=n.KHR_LIGHTS_PUNCTUAL;var t=e.extensions&&e.extensions[n.KHR_LIGHTS_PUNCTUAL]||{};this.lightDefs=t.lights||[]}function a(){this.name=n.KHR_MATERIALS_UNLIT}r.prototype.loadLight=function(e){var t,n=this.lightDefs[e],i=new Sr(16777215);void 0!==n.color&&i.fromArray(n.color);var r=void 0!==n.range?n.range:0;switch(n.type){case"directional":(t=new wu(i)).target.position.set(0,0,-1),t.add(t.target);break;case"point":(t=new yu(i)).distance=r;break;case"spot":(t=new vu(i)).distance=r,n.spot=n.spot||{},n.spot.innerConeAngle=void 0!==n.spot.innerConeAngle?n.spot.innerConeAngle:0,n.spot.outerConeAngle=void 0!==n.spot.outerConeAngle?n.spot.outerConeAngle:Math.PI/4,t.angle=n.spot.outerConeAngle,t.penumbra=1-n.spot.innerConeAngle/n.spot.outerConeAngle,t.target.position.set(0,0,-1),t.add(t.target);break;default:throw new Error('THREE.GLTFLoader: Unexpected light type, "'+n.type+'".')}return t.position.set(0,0,0),t.decay=2,void 0!==n.intensity&&(t.intensity=n.intensity),t.name=n.name||"light_"+e,Promise.resolve(t)},a.prototype.getMaterialType=function(){return Cr},a.prototype.extendParams=function(e,t,n){var i=[];e.color=new Sr(1,1,1),e.opacity=1;var r=t.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){var a=r.baseColorFactor;e.color.fromArray(a),e.opacity=a[3]}void 0!==r.baseColorTexture&&i.push(n.assignTexture(e,"map",r.baseColorTexture))}return Promise.all(i)};var o="glTF",s=12,l={JSON:1313821514,BIN:5130562};function c(e){this.name=n.KHR_BINARY_GLTF,this.content=null,this.body=null;var t=new DataView(e,0,s);if(this.header={magic:Eu.decodeText(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==o)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected. Use LegacyGLTFLoader instead.");for(var i=new DataView(e,s),r=0;r",o).replace("#include ",s).replace("#include ",l).replace("#include ",c).replace("#include ",h);delete a.roughness,delete a.metalness,delete a.roughnessMap,delete a.metalnessMap,a.specular={value:(new Sr).setHex(1118481)},a.glossiness={value:.5},a.specularMap={value:null},a.glossinessMap={value:null},e.vertexShader=r.vertexShader,e.fragmentShader=u,e.uniforms=a,e.defines={STANDARD:""},e.color=new Sr(1,1,1),e.opacity=1;var d=[];if(Array.isArray(i.diffuseFactor)){var p=i.diffuseFactor;e.color.fromArray(p),e.opacity=p[3]}if(void 0!==i.diffuseTexture&&d.push(n.assignTexture(e,"map",i.diffuseTexture)),e.emissive=new Sr(0,0,0),e.glossiness=void 0!==i.glossinessFactor?i.glossinessFactor:1,e.specular=new Sr(1,1,1),Array.isArray(i.specularFactor)&&e.specular.fromArray(i.specularFactor),void 0!==i.specularGlossinessTexture){var f=i.specularGlossinessTexture;d.push(n.assignTexture(e,"glossinessMap",f)),d.push(n.assignTexture(e,"specularMap",f))}return Promise.all(d)},createMaterial:function(e){var t=new Ra({defines:e.defines,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader,uniforms:e.uniforms,fog:!0,lights:!0,opacity:e.opacity,transparent:e.transparent});return t.isGLTFSpecularGlossinessMaterial=!0,t.color=e.color,t.map=void 0===e.map?null:e.map,t.lightMap=null,t.lightMapIntensity=1,t.aoMap=void 0===e.aoMap?null:e.aoMap,t.aoMapIntensity=1,t.emissive=e.emissive,t.emissiveIntensity=1,t.emissiveMap=void 0===e.emissiveMap?null:e.emissiveMap,t.bumpMap=void 0===e.bumpMap?null:e.bumpMap,t.bumpScale=1,t.normalMap=void 0===e.normalMap?null:e.normalMap,e.normalScale&&(t.normalScale=e.normalScale),t.displacementMap=null,t.displacementScale=1,t.displacementBias=0,t.specularMap=void 0===e.specularMap?null:e.specularMap,t.specular=e.specular,t.glossinessMap=void 0===e.glossinessMap?null:e.glossinessMap,t.glossiness=e.glossiness,t.alphaMap=null,t.envMap=void 0===e.envMap?null:e.envMap,t.envMapIntensity=1,t.refractionRatio=.98,t.extensions.derivatives=!0,t},cloneMaterial:function(e){var t=e.clone();t.isGLTFSpecularGlossinessMaterial=!0;for(var n=this.specularGlossinessParams,i=0,r=n.length;i=2&&(i[a++]=e.getY(r)),n>=3&&(i[a++]=e.getZ(r)),n>=4&&(i[a++]=e.getW(r));return new Or(i,n,e.normalized)}return e.clone()}function B(e,n,i){this.json=e||{},this.extensions=n||{},this.options=i||{},this.cache=new t,this.primitiveCache={},this.textureLoader=new Vh(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.fileLoader=new zh(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}function k(e,t,n){var i=t.attributes,r=[];function a(t,i){return n.getDependency("accessor",t).then(function(t){e.setAttribute(i,t)})}for(var o in i){var s=T[o]||o.toLowerCase();s in e.attributes||r.push(a(i[o],s))}if(void 0!==t.indices&&!e.index){var l=n.getDependency("accessor",t.indices).then(function(t){e.setIndex(t)});r.push(l)}return N(e,t),Promise.all(r).then(function(){return void 0!==t.targets?function(e,t,n){for(var i=!1,r=!1,a=0,o=t.length;a=2&&r.setY(T,w[M*o+1]),o>=3&&r.setZ(T,w[M*o+2]),o>=4&&r.setW(T,w[M*o+3]),o>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return r})},B.prototype.loadTexture=function(e){var t,i=this,r=this.json,a=this.options,o=this.textureLoader,s=window.URL||window.webkitURL,l=r.textures[e],c=l.extensions||{},h=(t=c[n.MSFT_TEXTURE_DDS]?r.images[c[n.MSFT_TEXTURE_DDS].source]:r.images[l.source]).uri,u=!1;return void 0!==t.bufferView&&(h=i.getDependency("bufferView",t.bufferView).then(function(e){u=!0;var n=new Blob([e],{type:t.mimeType});return h=s.createObjectURL(n)})),Promise.resolve(h).then(function(e){var t=a.manager.getHandler(e);return t||(t=c[n.MSFT_TEXTURE_DDS]?i.extensions[n.MSFT_TEXTURE_DDS].ddsLoader:o),new Promise(function(n,i){t.load(I(e,a.path),n,void 0,i)})}).then(function(e){!0===u&&s.revokeObjectURL(h),e.flipY=!1,void 0!==l.name&&(e.name=l.name),t.mimeType in O&&(e.format=O[t.mimeType]);var n=(r.samplers||{})[l.sampler]||{};return e.magFilter=M[n.magFilter]||Pt,e.minFilter=M[n.minFilter]||Ot,e.wrapS=S[n.wrapS]||St,e.wrapT=S[n.wrapT]||St,e})},B.prototype.assignTexture=function(e,t,i){var r=this;return this.getDependency("texture",i.index).then(function(a){if(!a.isCompressedTexture)switch(t){case"aoMap":case"emissiveMap":case"metalnessMap":case"normalMap":case"roughnessMap":a.format=Xt}if(r.extensions[n.KHR_TEXTURE_TRANSFORM]){var o=void 0!==i.extensions?i.extensions[n.KHR_TEXTURE_TRANSFORM]:void 0;o&&(a=r.extensions[n.KHR_TEXTURE_TRANSFORM].extendTexture(a,o))}e[t]=a})},B.prototype.assignFinalMaterial=function(e){var t=e.geometry,i=e.material,r=this.extensions,a=void 0!==t.attributes.tangent,o=void 0!==t.attributes.color,s=void 0===t.attributes.normal,l=!0===e.isSkinnedMesh,c=Object.keys(t.morphAttributes).length>0,h=c&&void 0!==t.morphAttributes.normal;if(e.isPoints){var u="PointsMaterial:"+i.uuid,d=this.cache.get(u);d||(d=new Nl,Pr.prototype.copy.call(d,i),d.color.copy(i.color),d.map=i.map,d.sizeAttenuation=!1,this.cache.add(u,d)),i=d}else if(e.isLine){u="LineBasicMaterial:"+i.uuid;var p=this.cache.get(u);p||(p=new Sl,Pr.prototype.copy.call(p,i),p.color.copy(i.color),this.cache.add(u,p)),i=p}if(a||o||s||l||c){u="ClonedMaterial:"+i.uuid+":";i.isGLTFSpecularGlossinessMaterial&&(u+="specular-glossiness:"),l&&(u+="skinning:"),a&&(u+="vertex-tangents:"),o&&(u+="vertex-colors:"),s&&(u+="flat-shading:"),c&&(u+="morph-targets:"),h&&(u+="morph-normals:");var f=this.cache.get(u);f||(f=i.isGLTFSpecularGlossinessMaterial?r[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].cloneMaterial(i):i.clone(),l&&(f.skinning=!0),a&&(f.vertexTangents=!0),o&&(f.vertexColors=Ce),s&&(f.flatShading=!0),c&&(f.morphTargets=!0),h&&(f.morphNormals=!0),this.cache.add(u,f)),i=f}i.aoMap&&void 0===t.attributes.uv2&&void 0!==t.attributes.uv&&(console.log("THREE.GLTFLoader: Duplicating UVs to support aoMap."),t.setAttribute("uv2",new Or(t.attributes.uv.array,2))),i.isGLTFSpecularGlossinessMaterial&&(e.onBeforeRender=r[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].refreshUniforms),e.material=i},B.prototype.loadMaterial=function(e){var t,i=this.json,r=this.extensions,a=i.materials[e],o={},s=a.extensions||{},l=[];if(s[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){var c=r[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];t=c.getMaterialType(),l.push(c.extendParams(o,a,this))}else if(s[n.KHR_MATERIALS_UNLIT]){var h=r[n.KHR_MATERIALS_UNLIT];t=h.getMaterialType(),l.push(h.extendParams(o,a,this))}else{t=sh;var u=a.pbrMetallicRoughness||{};if(o.color=new Sr(1,1,1),o.opacity=1,Array.isArray(u.baseColorFactor)){var d=u.baseColorFactor;o.color.fromArray(d),o.opacity=d[3]}void 0!==u.baseColorTexture&&l.push(this.assignTexture(o,"map",u.baseColorTexture)),o.metalness=void 0!==u.metallicFactor?u.metallicFactor:1,o.roughness=void 0!==u.roughnessFactor?u.roughnessFactor:1,void 0!==u.metallicRoughnessTexture&&(l.push(this.assignTexture(o,"metalnessMap",u.metallicRoughnessTexture)),l.push(this.assignTexture(o,"roughnessMap",u.metallicRoughnessTexture)))}!0===a.doubleSided&&(o.side=Le);var p=a.alphaMode||R;return p===C?o.transparent=!0:(o.transparent=!1,p===P&&(o.alphaTest=void 0!==a.alphaCutoff?a.alphaCutoff:.5)),void 0!==a.normalTexture&&t!==Cr&&(l.push(this.assignTexture(o,"normalMap",a.normalTexture)),o.normalScale=new Zn(1,1),void 0!==a.normalTexture.scale&&o.normalScale.set(a.normalTexture.scale,a.normalTexture.scale)),void 0!==a.occlusionTexture&&t!==Cr&&(l.push(this.assignTexture(o,"aoMap",a.occlusionTexture)),void 0!==a.occlusionTexture.strength&&(o.aoMapIntensity=a.occlusionTexture.strength)),void 0!==a.emissiveFactor&&t!==Cr&&(o.emissive=(new Sr).fromArray(a.emissiveFactor)),void 0!==a.emissiveTexture&&t!==Cr&&l.push(this.assignTexture(o,"emissiveMap",a.emissiveTexture)),Promise.all(l).then(function(){var e;return e=t===Ra?r[n.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(o):new t(o),void 0!==a.name&&(e.name=a.name),e.map&&(e.map.encoding=Cn),e.emissiveMap&&(e.emissiveMap.encoding=Cn),e.specularMap&&(e.specularMap.encoding=Cn),N(e,a),a.extensions&&D(r,e,a),e})},B.prototype.loadGeometries=function(e){var t=this,i=this.extensions,r=this.primitiveCache;function a(e){return i[n.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then(function(n){return k(n,e,t)})}for(var o,s,l=[],c=0,h=e.length;c0&&z(c,n),c.name=n.name||"mesh_"+e,a.length>1&&(c.name+="_"+s),N(c,n),t.assignFinalMaterial(c),o.push(c)}if(1===o.length)return o[0];var p=new Gs;for(s=0,l=o.length;s1){var n=s[l.mesh]++;(t=e.clone()).name+="_instance_"+n,t.onBeforeRender=e.onBeforeRender;for(var i=0,r=t.children.length;i1?new Gs:1===e.length?e[0]:new Di)!==e[0])for(var n=0,i=e.length;n absDirection.z) {\n if (absDirection.x > absDirection.y)\n face = direction.x > 0.0 ? 0.0 : 3.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n } else {\n if (absDirection.z > absDirection.y)\n face = direction.z > 0.0 ? 2.0 : 5.0;\n else\n face = direction.y > 0.0 ? 1.0 : 4.0;\n }\n return face;\n}\n","\n").concat("\nvec2 getUV(vec3 direction, float face) {\n vec2 uv;\n if (face == 0.0) {\n uv = vec2(-direction.z, direction.y) / abs(direction.x);\n } else if (face == 1.0) {\n uv = vec2(direction.x, -direction.z) / abs(direction.y);\n } else if (face == 2.0) {\n uv = direction.xy / abs(direction.z);\n } else if (face == 3.0) {\n uv = vec2(direction.z, direction.y) / abs(direction.x);\n } else if (face == 4.0) {\n uv = direction.xz / abs(direction.y);\n } else {\n uv = vec2(-direction.x, direction.y) / abs(direction.z);\n }\n return 0.5 * (uv + 1.0);\n}\n","\nvec3 bilinearCubeUV(sampler2D envMap, vec3 direction, float mipInt) {\n float face = getFace(direction);\n float filterInt = max(cubeUV_minMipLevel - mipInt, 0.0);\n mipInt = max(mipInt, cubeUV_minMipLevel);\n float faceSize = exp2(mipInt);\n\n float texelSize = 1.0 / (3.0 * cubeUV_maxTileSize);\n\n vec2 uv = getUV(direction, face) * (faceSize - 1.0);\n vec2 f = fract(uv);\n uv += 0.5 - f;\n if (face > 2.0) {\n uv.y += faceSize;\n face -= 3.0;\n }\n uv.x += face * faceSize;\n if(mipInt < cubeUV_maxMipLevel){\n uv.y += 2.0 * cubeUV_maxTileSize;\n }\n uv.y += filterInt * 2.0 * cubeUV_minTileSize;\n uv.x += 3.0 * max(0.0, cubeUV_maxTileSize - 2.0 * faceSize);\n uv *= texelSize;\n\n vec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x += texelSize;\n vec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.y += texelSize;\n vec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x -= texelSize;\n vec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n vec3 tm = mix(tl, tr, f.x);\n vec3 bm = mix(bl, br, f.x);\n return mix(tm, bm, f.y);\n}\n"),Jp="\n#ifdef ENVMAP_TYPE_CUBE_UV\n\n".concat(Zp,"\n").concat(qp,"\n").concat("\nfloat roughnessToMip(float roughness) {\n float mip = 0.0;\n if (roughness >= r1) {\n mip = (r0 - roughness) * (m1 - m0) / (r0 - r1) + m0;\n } else if (roughness >= r4) {\n mip = (r1 - roughness) * (m4 - m1) / (r1 - r4) + m1;\n } else if (roughness >= r5) {\n mip = (r4 - roughness) * (m5 - m4) / (r4 - r5) + m4;\n } else if (roughness >= r6) {\n mip = (r5 - roughness) * (m6 - m5) / (r5 - r6) + m5;\n } else {\n mip = -2.0 * log2(1.16 * roughness);// 1.16 = 1.79^0.25\n }\n return mip;\n}\n","\n\nvec4 textureCubeUV(sampler2D envMap, vec3 sampleDir, float roughness) {\n float mip = clamp(roughnessToMip(roughness), m0, cubeUV_maxMipLevel);\n float mipF = fract(mip);\n float mipInt = floor(mip);\n\n vec3 color0 = bilinearCubeUV(envMap, sampleDir, mipInt);\n if (mipF == 0.0) {\n return vec4(color0, 1.0);\n } else {\n vec3 color1 = bilinearCubeUV(envMap, sampleDir, mipInt + 1.0);\n return vec4(mix(color0, color1, mipF), 1.0);\n }\n}\n#endif\n"),Kp=e=>{e.fragmentShader=e.fragmentShader.replace("#include ",Jp).replace("#include ","\nPhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\n\n// (elalish) This block has been updated to add anti-aliasing.\nmaterial.specularRoughness = max(roughnessFactor, 0.0525);// 0.0525 corresponds to the base mip of a 256 cubemap.\nvec3 dxy = max(abs(dFdx(geometryNormal)), abs(dFdy(geometryNormal)));\nmaterial.specularRoughness += max(max(dxy.x, dxy.y), dxy.z);\nmaterial.specularRoughness = min(material.specularRoughness, 1.0);\n\n#ifdef REFLECTIVITY\n\n\tmaterial.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );\n\n#else\n\n\tmaterial.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );\n\n#endif\n\n#ifdef CLEARCOAT\n\n\tmaterial.clearcoat = saturate( clearcoat ); // Burley clearcoat model\n\tmaterial.clearcoatRoughness = clamp( clearcoatRoughness, 0.04, 1.0 );\n\n#endif\n#ifdef USE_SHEEN\n\n\tmaterial.sheenColor = sheen;\n\n#endif\n")},Qp=e=>{const t=Object.assign(Object.assign({},e),{scene:Vp(e.scene)}),n=e.parser.extensions.KHR_materials_pbrSpecularGlossiness,i=e=>{const t=e.isGLTFSpecularGlossinessMaterial?n.cloneMaterial(e):e.clone();return t.onBeforeCompile=Kp,!t.vertexTangents&&t.normalScale&&(t.normalScale.y*=-1),t};return t.scene.traverse(e=>{e.renderOrder=1e3,null!=n&&e.isMesh&&(e.onBeforeRender=n.refreshUniforms),Array.isArray(e.material)?e.material=e.material.map(i):null!=e.material&&(e.material=i(e.material))}),t},$p=(e,t)=>{for(;e.children.length;)t.add(e.children.shift())},ef=(e,t)=>{let n=0;const i=new $n;return e.traverse(e=>{let r,a;e.updateWorldMatrix(!1,!1);let o=e.geometry;if(void 0!==o)if(o.isGeometry){let s=o.vertices;for(r=0,a=s.length;r>8&255]+tf[e>>16&255]+tf[e>>24&255]+"-"+tf[255&t]+tf[t>>8&255]+"-"+tf[t>>16&15|64]+tf[t>>24&255]+"-"+tf[63&n|128]+tf[n>>8&255]+"-"+tf[n>>16&255]+tf[n>>24&255]+tf[255&i]+tf[i>>8&255]+tf[i>>16&255]+tf[i>>24&255]).toUpperCase()},clamp:function(e,t,n){return Math.max(t,Math.min(n,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,n,i,r){return i+(e-t)*(r-i)/(n-t)},lerp:function(e,t,n){return(1-n)*e+n*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())},degToRad:function(e){return e*rf.DEG2RAD},radToDeg:function(e){return e*rf.RAD2DEG},isPowerOfTwo:function(e){return 0==(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))}};const af=e=>null!=e&&"null"!==e?sf(e):null,of=()=>{if(de)return;const e=[];throw le||e.push("WebXR Device API"),ce||e.push("WebXR Hit Test API"),new Error("The following APIs are required for AR, but are missing in this browser: ".concat(e.join(", ")))},sf=e=>{return new URL(e,window.location.toString()).toString()},lf=(e,t)=>{let n=null;const i=function(){null==n&&(e(...arguments),n=self.setTimeout(()=>n=null,t))};return i.flush=()=>{null!=n&&(self.clearTimeout(n),n=null)},i},cf=(e,t)=>{let n=null;return function(){for(var i=arguments.length,r=new Array(i),a=0;a{n=null,e(...r)},t)}},hf=(e,t,n)=>Math.max(t,Math.min(n,e)),uf=(()=>{const e=(()=>{const e=null!=document.head?Array.from(document.head.querySelectorAll("meta")):[];for(const t of e)if("viewport"===t.name)return!0;return!1})();return e||console.warn('No detected; will cap pixel density at 1.'),()=>e?window.devicePixelRatio:1})(),df=(()=>{const e=new RegExp("[?&]".concat("model-viewer-debug-mode","(&|$)"));return()=>self.ModelViewerElement&&self.ModelViewerElement.debugMode||self.location&&self.location.search&&self.location.search.match(e)})(),pf=e=>{if(null!=e.keys)return e.keys().next().value||null;let t=null;try{e.forEach((e,n,i)=>{throw t=n,new Error})}catch(e){}return t};class ff extends Di{constructor(e){super(),this.raycaster=null,this.name="Reticle";let t=new jc(.1,.11,24,1),n=new Cr({color:16777215});t.applyMatrix((new vi).makeRotationX(Yn.degToRad(-90))),this.ring=new ma(t,n),this.add(this.ring),this.visible=!1,this.camera=e}async update(e,t){this.raycaster=this.raycaster||new _d,this.raycaster.setFromCamera({x:0,y:0},this.camera);const n=this.raycaster.ray;let i,r=new XRRay(n.origin,n.direction);try{i=await e.requestHitTest(r,t)}catch(e){i=[]}if(i.length){const e=i[0],t=(new vi).fromArray(e.hitMatrix);this.position.setFromMatrixPosition(t);const n=(new $n).setFromMatrixPosition(this.camera.matrixWorld),r=Math.atan2(n.x-this.position.x,n.z-this.position.z);this.rotation.set(0,r,0),this.visible=!0}}}const mf=e=>{if(null==e)throw new Error("WebGL is not available!");return e},vf=(e,t)=>mf(e.getContext("webgl",t)||e.getContext("experimental-webgl",t)),gf=e=>{const t={EXT_shader_texture_lod:"\n #extension GL_EXT_shader_texture_lod : enable\n precision mediump float;\n uniform sampler2D tex;\n void main() {\n gl_FragColor = texture2DLodEXT(tex, vec2(0.0, 0.0), 0.0);\n }"};const n=e.getExtension;e.getExtension=i=>{let r;return t[i]?(r=n.call(e,i))&&!function(e,n){const i=e.createShader(e.FRAGMENT_SHADER);e.shaderSource(i,t[n]),e.compileShader(i);const r=e.getShaderParameter(i,e.COMPILE_STATUS);return e.deleteShader(i),r}(e,i)&&(r=null):r=n.call(e,i),r}};var yf,xf,bf,wf,_f,Mf;const Sf=Symbol("presentedScene"),Ef=Symbol("rafId"),Tf=Symbol("currentSession"),Af=Symbol("tick"),Lf=Symbol("refSpace"),Rf=Symbol("resolveCleanup"),Pf=Symbol("outputContext"),Cf=Symbol("onWebXRFrame"),Of=Symbol("postSessionCleanup"),If=new vi,Df=new $n;class Nf extends Wn{constructor(e){super(),this.renderer=e,this.camera=new Ca,this.scene=new Ni,this.dolly=new Di,this.reticle=new ff(this.camera),this.raycaster=null,this[yf]=null,this[xf]=null,this[bf]=null,this[wf]=null,this[_f]=null,this[Mf]=null,this.threeRenderer=e.threeRenderer,this.inputContext=e.context3D,this.camera.matrixAutoUpdate=!1,this.scene.add(this.reticle),this.scene.add(this.dolly)}initializeRenderer(){this.threeRenderer.setPixelRatio(1)}async resolveARSession(){of();const e=await navigator.xr.requestSession("immersive-ar"),t=mf(this.threeRenderer.getContext());await t.makeXRCompatible(),this[Pf]=t,e.updateRenderState({baseLayer:new XRWebGLLayer(e,t,{alpha:!0})});let n=new Promise((t,n)=>{e.requestAnimationFrame(()=>t())});return await n,this.threeRenderer.setFramebuffer(e.renderState.baseLayer.framebuffer),this.threeRenderer.setSize(e.renderState.baseLayer.framebufferWidth,e.renderState.baseLayer.framebufferHeight,!1),e}get presentedScene(){return this[Sf]}async supportsPresentation(){try{return of(),await navigator.xr.supportsSession("immersive-ar"),!0}catch(e){return!1}}async present(e){this.isPresenting&&console.warn("Cannot present while a model is already presenting"),e.model.scale.set(1,1,1),this[Sf]=e,this.initializeRenderer(),this[Tf]=await this.resolveARSession(),this[Tf].addEventListener("end",()=>{this[Of]()},{once:!0}),this[Lf]=await this[Tf].requestReferenceSpace("local"),this[Af]()}async stopPresenting(){if(!this.isPresenting)return;const e=new Promise(e=>{this[Rf]=e});try{const t=this[Tf];this[Tf]=null,t.cancelAnimationFrame(this[Ef]),await t.end(),await e}catch(e){console.warn("Error while trying to end AR session"),console.warn(e),this[Of]()}}[(yf=Pf,xf=Ef,bf=Tf,wf=Lf,_f=Sf,Mf=Rf,Of)](){this.threeRenderer.setFramebuffer(null),null!=this[Sf]&&(this.dolly.remove(this[Sf]),this[Sf].isDirty=!0),this.renderer.setRendererSize(1,1),this[Lf]=null,this[Sf]=null,null!=this[Rf]&&this[Rf]()}get isPresenting(){return null!=this[Sf]}get outputContext(){return this[Pf]}async placeModel(){if(null==this[Tf])return;null==this.raycaster&&(this.raycaster=new _d),this.raycaster.setFromCamera({x:0,y:0},this.camera);const e=this.raycaster.ray;let t,n=new XRRay(e.origin,e.direction);try{t=await this[Tf].requestHitTest(n,this[Lf])}catch(e){}if(t&&t.length){const e=this[Sf],n=t[0],i=If.fromArray(n.hitMatrix);this.dolly.position.setFromMatrixPosition(i);const r=Df.setFromMatrixPosition(this.camera.matrix);this.dolly.lookAt(r.x,this.dolly.position.y,r.z),this.dolly.rotateY(-e.pivot.rotation.y),this.dolly.add(e),this.dispatchEvent({type:"modelmove"})}}processXRInput(e){const{session:t}=e,n=Array.from(t.inputSources).filter(e=>"screen"===e.targetRayMode);0!==n.length&&e.getPose(n[0].targetRaySpace,this[Lf])&&this.placeModel()}[Af](){this[Ef]=this[Tf].requestAnimationFrame((e,t)=>this[Cf](e,t))}[Cf](e,t){const{session:n}=t,i="getDevicePose"in t?t.getDevicePose(this[Lf]):t.getViewerPose(this[Lf]);if(this[Af](),null!=i)for(const e of t.getViewerPose(this[Lf]).views){const i=n.renderState.baseLayer.getViewport(e);this.threeRenderer.setViewport(i.x,i.y,i.width,i.height),this.camera.projectionMatrix.fromArray(e.projectionMatrix);const r=If.fromArray(e.transform.inverse.matrix);this.camera.matrix.getInverse(r),this.camera.updateMatrixWorld(!0),this.reticle.update(this[Tf],this[Lf]),this.processXRInput(t),this.threeRenderer.render(this.scene,this.camera)}}}class zf{constructor(e){e.threeRenderer.debug={checkShaderErrors:!0},Promise.resolve().then(()=>{self.dispatchEvent(new CustomEvent("model-viewer-renderer-debug",{detail:{renderer:e,THREE:{ShaderMaterial:Ra,Texture:ai,Mesh:ma,Scene:Ni,PlaneBufferGeometry:qa,OrthographicCamera:xu,WebGLRenderTarget:si}}}))})}addScene(e){self.dispatchEvent(new CustomEvent("model-viewer-scene-added-debug",{detail:{scene:e}}))}removeScene(e){self.dispatchEvent(new CustomEvent("model-viewer-scene-removed-debug",{detail:{scene:e}}))}}var Uf,Ff,Bf,kf,Gf,Vf,Hf,jf=function(e){Bh.call(this,e),this.type=Dt};jf.prototype=Object.assign(Object.create(Bh.prototype),{constructor:jf,parse:function(e){var t=function(e,t){switch(e){case 1:console.error("RGBELoader Read Error: "+(t||""));break;case 2:console.error("RGBELoader Write Error: "+(t||""));break;case 3:console.error("RGBELoader Bad File Format: "+(t||""));break;default:case 4:console.error("RGBELoader: Error: "+(t||""))}return-1},n=function(e,t,n){t=t||1024;for(var i=e.pos,r=-1,a=0,o="",s=String.fromCharCode.apply(null,new Uint16Array(e.subarray(i,i+128)));0>(r=s.indexOf("\n"))&&a>16&32768,a=i>>12&2047,o=i>>23&255;return o<103?r:o>142?(r|=31744,r|=(255==o?0:1)&&8388607&i):o<113?r|=((a|=2048)>>114-o)+(a>>113-o&1):(r|=o-112<<10|a>>1,r+=1&a)}return function(e,t,i,r){var a=e[t+3],o=Math.pow(2,a-128)/255;i[r+0]=n(e[t+0]*o),i[r+1]=n(e[t+1]*o),i[r+2]=n(e[t+2]*o)}}(),a=new Uint8Array(e);a.pos=0;var o=function(e){var i,r,a=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,o=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,s=/^\s*FORMAT=(\S+)\s*$/,l=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,c={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};if(e.pos>=e.byteLength||!(i=n(e)))return t(1,"no header found");if(!(r=i.match(/^#\?(\S+)$/)))return t(3,"bad initial token");for(c.valid|=1,c.programtype=r[1],c.string+=i+"\n";!1!==(i=n(e));)if(c.string+=i+"\n","#"!==i.charAt(0)){if((r=i.match(a))&&(c.gamma=parseFloat(r[1],10)),(r=i.match(o))&&(c.exposure=parseFloat(r[1],10)),(r=i.match(s))&&(c.valid|=2,c.format=r[1]),(r=i.match(l))&&(c.valid|=4,c.height=parseInt(r[1],10),c.width=parseInt(r[2],10)),2&c.valid&&4&c.valid)break}else c.comments+=i+"\n";return 2&c.valid?4&c.valid?c:t(3,"missing image size specifier"):t(3,"missing format specifier")}(a);if(-1!==o){var s=o.width,l=o.height,c=function(e,n,i){var r,a,o,s,l,c,h,u,d,p,f,m,v,g=n,y=i;if(g<8||g>32767||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);if(g!==(e[2]<<8|e[3]))return t(3,"wrong scanline width");if(!(r=new Uint8Array(4*n*i))||!r.length)return t(4,"unable to allocate buffer space");for(a=0,o=0,u=4*g,v=new Uint8Array(4),c=new Uint8Array(u);y>0&&oe.byteLength)return t(1);if(v[0]=e[o++],v[1]=e[o++],v[2]=e[o++],v[3]=e[o++],2!=v[0]||2!=v[1]||(v[2]<<8|v[3])!=g)return t(3,"bad rgbe scanline format");for(h=0;h128)&&(s-=128),0===s||h+s>u)return t(3,"bad scanline data");if(m)for(l=e[o++],d=0;dXf-qf?(r=Yf[e-Xf+qf-1],i=Zf[e-Xf+qf-1]):0==e&&(i=0),this[om].push(i),this[am].push(r);const a=1/(n-1),o=-a/2,s=1+a/2,l=[o,o,s,o,s,s,o,o,s,s,o,s],c=6,h=6,u=3,d=2,p=1,f=new Float32Array(u*h*c),m=new Float32Array(d*h*c),v=new Float32Array(p*h*c);for(let e=0;e2?0:-1,i=[[t,n,0],[t+2/3,n,0],[t+2/3,n+1,0],[t,n,0],[t+2/3,n+1,0],[t,n+1,0]];f.set([].concat(...i),u*h*e),m.set(l,d*h*e);const r=[e,e,e,e,e,e];v.set(r,p*h*e)}const g=new Kr;g.setAttribute("position",new Or(f,u)),g.setAttribute("uv",new Or(m,d)),g.setAttribute("faceIndex",new Or(v,p)),this[lm].push(g),t>qf&&t--}this[cm].push(new $n(1,1,1),new $n(-1,1,1),new $n(1,1,-1),new $n(-1,1,-1),new $n(0,im,-rm),new $n(rm,0,im),new $n(-rm,0,im),new $n(im,rm,0),new $n(-im,rm,0))}fromDefault(){const e=new Wf,t=this[pm]();return this[fm](e,tm,nm,t),this[xm](t,0,0,em),this[ym](t),this[dm].dispose(),e.dispose(),t}fromScene(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:tm,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:nm;const i=this[pm]();return this[fm](e,t,n,i),this[ym](i),this[dm].dispose(),i}fromEquirectangular(e){e.magFilter=At,e.minFilter=At,e.generateMipmaps=!1;const t=this[pm](e);return this[mm](e,t),this[ym](t),this[dm].dispose(),t}[(Uf=am,Ff=om,Bf=sm,kf=lm,Gf=cm,Vf=hm,Hf=um,pm)](e){const t={magFilter:At,minFilter:At,generateMipmaps:!1,type:e?e.type:Dt,format:e?e.format:Kt,encoding:e?e.encoding:In,depthBuffer:!1,stencilBuffer:!1},n=this[vm](Object.assign(Object.assign({},t),{depthBuffer:!e}));return this[dm]=this[vm](t),n}[fm](e,t,n,i){const r=new Ca(90,1,t,n),a=[1,1,1,1,-1,1],o=[1,1,-1,-1,-1,1],s=this.threeRenderer.gammaOutput,l=this.threeRenderer.toneMapping,c=this.threeRenderer.toneMappingExposure;this.threeRenderer.toneMapping=dt,this.threeRenderer.toneMappingExposure=1,this.threeRenderer.gammaOutput=!1,e.scale.z*=-1,this.threeRenderer.setRenderTarget(i);for(let t=0;t<6;t++){const n=t%3;0==n?(r.up.set(0,a[t],0),r.lookAt(o[t],0,0)):1==n?(r.up.set(0,0,a[t]),r.lookAt(0,o[t],0)):(r.up.set(0,a[t],0),r.lookAt(0,0,o[t])),this[gm](n*Jf,t>2?Jf:0,Jf,Jf),this.threeRenderer.render(e,r)}this.threeRenderer.toneMapping=l,this.threeRenderer.toneMappingExposure=c,this.threeRenderer.gammaOutput=s,e.scale.z*=-1}[mm](e,t){const n=new Ni;n.add(new ma(this[lm][0],this[hm]));const i=this[hm].uniforms;i.envMap.value=e,i.copyEquirectangular.value=!0,i.texelSize.value.set(1/e.image.width,1/e.image.height),i.inputEncoding.value=jp[e.encoding],i.outputEncoding.value=jp[e.encoding],this.threeRenderer.setRenderTarget(t),this[gm](0,0,3*Jf,2*Jf),this.threeRenderer.render(n,this[um])}[vm](e){const t=new si(3*Jf,3*Jf,e);return t.texture.mapping=_t,t.texture.name="PMREM.cubeUv",t}[gm](e,t,n,i){const r=this.threeRenderer.getPixelRatio();this.threeRenderer.setViewport(e/r,t/r,n/r,i/r)}[ym](e){for(let t=1;t$f&&console.warn("sigmaRadians, ".concat(r,", is too large and will clip, as it requested ").concat(d," samples when the maximum is set to ").concat($f));let p=[],f=0;for(let e=0;e<$f;++e){const t=e/u,n=Math.exp(-t*t/2);p.push(n),0==e?f+=n:ee/f),l.envMap.value=e.texture,l.copyEquirectangular.value=!1,l.samples.value=d,l.weights.value=p,l.latitudinal.value="latitudinal"===a,o&&(l.poleAxis.value=o),l.dTheta.value=h,l.mipInt.value=Xf-n,l.inputEncoding.value=jp[e.texture.encoding],l.outputEncoding.value=jp[e.texture.encoding];const m=this[sm][i],v=3*Math.max(0,Jf-2*m),g=(0===i?0:2*Jf)+2*m*(i>Xf-qf?i-Xf+qf:0);this.threeRenderer.autoClear=!1,this.threeRenderer.setRenderTarget(t),this[gm](v,g,3*m,2*m),this.threeRenderer.render(s,this[um])}}class _m extends oh{constructor(e){const t=new Float32Array(e);super({defines:{n:e},uniforms:{envMap:{value:null},copyEquirectangular:{value:!1},texelSize:{value:new Zn(1,1)},samples:{value:1},weights:{value:t},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:new $n(0,1,0)},inputEncoding:{value:jp[Pn]},outputEncoding:{value:jp[Pn]}},vertexShader:"\nprecision mediump float;\nprecision mediump int;\nattribute vec3 position;\nattribute vec2 uv;\nattribute float faceIndex;\nvarying vec3 vOutputDirection;\n".concat(Hp,"\nvoid main() {\n vOutputDirection = getDirection(uv, faceIndex);\n gl_Position = vec4( position, 1.0 );\n}\n "),fragmentShader:"\nprecision mediump float;\nprecision mediump int;\nvarying vec3 vOutputDirection;\nuniform sampler2D envMap;\nuniform bool copyEquirectangular;\nuniform vec2 texelSize;\nuniform int samples;\nuniform float weights[n];\nuniform bool latitudinal;\nuniform float dTheta;\nuniform float mipInt;\nuniform vec3 poleAxis;\n#define RECIPROCAL_PI 0.31830988618\n#define RECIPROCAL_PI2 0.15915494\n".concat(Wp," \nvec4 envMapTexelToLinear(vec4 color) {\n return inputTexelToLinear(color);\n}\n").concat(Zp,"\nvoid main() {\n gl_FragColor = vec4(0.0);\n if (copyEquirectangular) {\n vec3 direction = normalize(vOutputDirection);\n vec2 uv;\n uv.y = asin(clamp(direction.y, -1.0, 1.0)) * RECIPROCAL_PI + 0.5;\n uv.x = atan(direction.z, direction.x) * RECIPROCAL_PI2 + 0.5;\n vec2 f = fract(uv / texelSize - 0.5);\n uv -= f * texelSize;\n vec3 tl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x += texelSize.x;\n vec3 tr = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.y += texelSize.y;\n vec3 br = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n uv.x -= texelSize.x;\n vec3 bl = envMapTexelToLinear(texture2D(envMap, uv)).rgb;\n vec3 tm = mix(tl, tr, f.x);\n vec3 bm = mix(bl, br, f.x);\n gl_FragColor.rgb = mix(tm, bm, f.y);\n } else {\n for (int i = 0; i < n; i++) {\n if (i >= samples)\n break;\n for (int dir = -1; dir < 2; dir += 2) {\n if (i == 0 && dir == 1)\n continue;\n vec3 axis = latitudinal ? poleAxis : cross(poleAxis, vOutputDirection);\n if (all(equal(axis, vec3(0.0))))\n axis = cross(vec3(0.0, 1.0, 0.0), vOutputDirection);\n axis = normalize(axis);\n float theta = dTheta * float(dir * i);\n float cosTheta = cos(theta);\n // Rodrigues' axis-angle rotation\n vec3 sampleDirection = vOutputDirection * cosTheta \n + cross(axis, vOutputDirection) * sin(theta) \n + axis * dot(axis, vOutputDirection) * (1.0 - cosTheta);\n gl_FragColor.rgb +=\n weights[i] * bilinearCubeUV(envMap, sampleDirection, mipInt);\n }\n }\n }\n gl_FragColor = linearToOutputTexel(gl_FragColor);\n}\n "),blending:Oe,depthTest:!1,depthWrite:!1}),this.type="GaussianBlur"}}var Mm,Sm;Ch.enabled=!0;const Em=/\.hdr$/,Tm=new Vh,Am=new jf,Lm=Symbol("environmentMapCache"),Rm=Symbol("generatedEnvironmentMap"),Pm=Symbol("PMREMGenerator"),Cm=Symbol("addMetadata"),Om=Symbol("loadEnvironmentMapFromUrl"),Im=Symbol("loadGeneratedEnvironmentMap"),Dm={url:null,mapping:null};class Nm extends Wn{constructor(e){super(),this[Mm]=null,this[Sm]=new Map,this[Pm]=new wm(e)}get pmremGenerator(){return this[Pm]}async load(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{};try{const n=Em.test(e),i=n?Am:Tm,r=await new Promise((n,r)=>i.load(e,n,e=>{t(e.loaded/e.total*.9)},r));return t(1),this[Cm](r,e,"Equirectangular"),n?(r.encoding=In,r.minFilter=At,r.magFilter=At,r.flipY=!0):r.encoding=On,r}finally{t&&t(1)}}async loadEquirectAsCubeUV(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{},n=null;try{n=await this.load(e,t);const i=this[Pm].fromEquirectangular(n);return this[Cm](i.texture,e,"CubeUV"),i}finally{null!=n&&n.dispose()}}async generateEnvironmentMapAndSkybox(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{progressTracker:i}=n,r=null!=i?i.beginActivity():()=>{};try{let n,a=Promise.resolve(null);e&&(a=this[Om](e,i)),n=t?this[Om](t,i):e?a:this[Im]();let[o,s]=await Promise.all([n,a]);return this[Cm](o.texture,t,"PMREM"),null!=s&&this[Cm](s.texture,e,"PMREM"),{environmentMap:o,skybox:s}}finally{r(1)}}[(Mm=Rm,Sm=Lm,Cm)](e,t,n){e.userData=Object.assign(Object.assign({},Dm),{url:t,mapping:n})}[Om](e,t){if(!this[Lm].has(e)){const n=t?t.beginActivity():()=>{},i=this.loadEquirectAsCubeUV(e,n);this[Lm].set(e,i)}return this[Lm].get(e)}[Im](){return null==this[Rm]&&(this[Rm]=this[Pm].fromDefault()),Promise.resolve(this[Rm])}async dispose(){const e=[];this[Lm].forEach(t=>{e.push(t)}),this[Lm].clear();for(const t of e)try{(await t).dispose()}catch(e){}null!=this[Rm]&&(this[Rm].dispose(),this[Rm]=null)}}var zm,Um;const Fm=Symbol("arRenderer"),Bm=Symbol("onWebGLContextLost"),km=Symbol("webGLContextLostHandler"),Gm=Symbol("singleton");class Vm extends Wn{constructor(e){super(),this.width=0,this.height=0,this.debugger=null,this.scenes=new Set,this[Um]=e=>this[Bm](e);const t={alpha:!1,antialias:!0};de&&Object.assign(t,{alpha:!0,preserveDrawingBuffer:!0}),this.canvas3D=document.createElement("canvas"),this.canvas3D.addEventListener("webglcontextlost",this[km]);try{this.context3D=vf(this.canvas3D,t),gf(this.context3D),this.threeRenderer=new Zs({canvas:this.canvas3D,context:this.context3D}),this.threeRenderer.autoClear=!1,this.threeRenderer.gammaOutput=!0,this.threeRenderer.gammaFactor=2.2,this.threeRenderer.physicallyCorrectLights=!0,this.threeRenderer.setPixelRatio(uf()),this.threeRenderer.shadowMap.enabled=!0,this.threeRenderer.shadowMap.type=Se,this.threeRenderer.shadowMap.autoUpdate=!1,this.debugger=null!=e&&e.debug?new zf(this):null,this.threeRenderer.debug={checkShaderErrors:!!this.debugger},this.threeRenderer.toneMapping=vt}catch(e){this.context3D=null,console.warn(e)}this[Fm]=new Nf(this),this.textureUtils=this.canRender?new Nm(this.threeRenderer):null,this.setRendererSize(1,1),this.lastTick=performance.now()}static get singleton(){return this[Gm]}static resetSingleton(){this[Gm].dispose(),this[Gm]=new Vm({debug:df()})}get canRender(){return null!=this.threeRenderer&&null!=this.context3D}setRendererSize(e,t){this.canRender&&this.threeRenderer.setSize(e,t,!1),this.width=e,this.height=t}registerScene(e){this.scenes.add(e),this.canRender&&this.scenes.size>0&&this.threeRenderer.setAnimationLoop(e=>this.render(e)),null!=this.debugger&&this.debugger.addScene(e)}unregisterScene(e){this.scenes.delete(e),this.canRender&&0===this.scenes.size&&this.threeRenderer.setAnimationLoop(null),null!=this.debugger&&this.debugger.removeScene(e)}async supportsPresentation(){return this.canRender&&this[Fm].supportsPresentation()}get presentedScene(){return this[Fm].presentedScene}async present(e){try{return await this[Fm].present(e)}catch(e){throw await this[Fm].stopPresenting(),e}finally{this.width=this.height=0}}stopPresenting(){return this[Fm].stopPresenting()}get isPresenting(){return null!=this[Fm]&&this[Fm].isPresenting}render(e){if(!this.canRender||this.isPresenting)return;const t=e-this.lastTick,n=uf();n!==this.threeRenderer.getPixelRatio()&&this.threeRenderer.setPixelRatio(n);for(let i of this.scenes){const{element:r,width:a,height:o,context:s}=i;if(r[vg](e,t),!i.visible||!i.isDirty||i.paused)continue;const l=i.getCamera();if(a>this.width||o>this.height){const e=Math.max(a,this.width),t=Math.max(o,this.height);this.setRendererSize(e,t)}const{exposure:c,shadow:h}=i,u="number"==typeof c&&!self.isNaN(c);this.threeRenderer.toneMappingExposure=u?c:1;const d=this.threeRenderer.shadowMap.needsUpdate;null!=h&&(this.threeRenderer.shadowMap.needsUpdate=d||h.needsUpdate,h.needsUpdate=!1),this.threeRenderer.setRenderTarget(null),this.threeRenderer.clearDepth(),this.threeRenderer.setViewport(0,0,a,o),this.threeRenderer.render(i,l);const p=a*n,f=o*n;s.drawImage(this.threeRenderer.domElement,0,this.canvas3D.height-f,p,f,0,0,p,f),i.isDirty=!1}this.lastTick=e}dispose(){null!=this.textureUtils&&this.textureUtils.dispose(),null!=this.threeRenderer&&this.threeRenderer.dispose(),this.textureUtils=null,this.threeRenderer=null,this.scenes.clear(),this.canvas3D.removeEventListener("webglcontextlost",this[km])}[(zm=Gm,Um=km,Bm)](e){this.dispatchEvent({type:"contextlost",sourceEvent:e})}}var Hm,jm,Wm,qm;Vm[zm]=new Vm({debug:df()});const Xm=Symbol("mipmapMaterial"),Ym=Symbol("scene"),Zm=Symbol("flatCamera"),Jm=Symbol("tempTarget");class Km{constructor(){this[Hm]=new Qm,this[jm]=new Ni,this[Wm]=new xu(0,1,0,1,0,1),this[qm]=null,this[Ym].add(new ma(new qa(2,2),this[Xm]))}generateMipmaps(e){const{threeRenderer:t}=Vm.singleton,{roughnessMap:n,normalMap:i}=e;if(null==n||null==i||!n.generateMipmaps||e.userData.roughnessUpdated)return;e.userData.roughnessUpdated=!0;let r=Math.max(n.image.width,i.image.width),a=Math.max(n.image.height,i.image.height);if(!rf.isPowerOfTwo(r)||!rf.isPowerOfTwo(a))return;const o=t.autoClear;if(t.autoClear=!1,null!=this[Jm]&&this[Jm].width===r&&this[Jm].height===a||(null!=this[Jm]&&this[Jm].dispose(),this[Jm]=new si(r,a,{depthBuffer:!1,stencilBuffer:!1})),r!==n.image.width||a!==n.image.height){const n=new si(r,a,{minFilter:It,depthBuffer:!1,stencilBuffer:!1});n.texture.generateMipmaps=!0,t.setRenderTarget(n),e.roughnessMap=n.texture,null!=e.metalnessMap&&(e.metalnessMap=e.roughnessMap),null!=e.aoMap&&(e.aoMap=e.roughnessMap)}t.setRenderTarget(this[Jm]),this[Xm].uniforms.roughnessMap.value=n,this[Xm].uniforms.normalMap.value=i;const s=t.getPixelRatio(),l=new Zn(0,0),c=this[Xm].uniforms.texelSize.value;for(let n=0;r>=1&&a>=1;++n,r/=2,a/=2)c.set(1/r,1/a),0==n&&c.set(0,0),t.setViewport(l.x,l.y,r/s,a/s),t.render(this[Ym],this[Zm]),t.copyFramebufferToTexture(l,e.roughnessMap,n),this[Xm].uniforms.roughnessMap.value=e.roughnessMap;n!==e.roughnessMap&&n.dispose(),t.autoClear=o}}Hm=Xm,jm=Ym,Wm=Zm,qm=Jm;class Qm extends oh{constructor(){super({uniforms:{roughnessMap:{value:null},normalMap:{value:null},texelSize:{value:new Zn(1,1)}},vertexShader:"\nprecision mediump float;\nprecision mediump int;\nattribute vec3 position;\nattribute vec2 uv;\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = vec4( position, 1.0 );\n}\n ",fragmentShader:"\nprecision mediump float;\nprecision mediump int;\nvarying vec2 vUv;\nuniform sampler2D roughnessMap;\nuniform sampler2D normalMap;\nuniform vec2 texelSize;\n".concat(qp,"\n").concat(Xp,"\n").concat(Yp,"\nvoid main() {\n gl_FragColor = texture2D(roughnessMap, vUv, -1.0);\n if (texelSize.x == 0.0) return;\n float roughness = gl_FragColor.g;\n float variance = roughnessToVariance(roughness);\n vec3 avgNormal;\n for (float x = -1.0; x < 2.0; x += 2.0) {\n for (float y = -1.0; y < 2.0; y += 2.0) {\n vec2 uv = vUv + vec2(x, y) * 0.25 * texelSize;\n avgNormal += normalize(texture2D(normalMap, uv, -1.0).xyz - 0.5);\n }\n }\n variance += 1.0 - 0.25 * length(avgNormal);\n gl_FragColor.g = varianceToRoughness(variance);\n}\n "),blending:Oe,depthTest:!1,depthWrite:!1}),this.type="RoughnessMipmap"}}var $m,ev;const tv=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:()=>{};const i=e=>{n(e.loaded/e.total)};return new Promise((n,r)=>{t.load(e,n,i,r)})},nv=Symbol("releaseFromCache"),iv=new Map,rv=new Map,av=Symbol("evictionPolicy");let ov;const sv=new wp,lv=Symbol("loader");class cv{constructor(){this[ev]=new Sp,this.roughnessMipmapper=new Km,this[lv].setDRACOLoader(sv)}static setDRACODecoderLocation(e){ov=e,sv.setDecoderPath(e)}static getDRACODecoderLocation(){return ov}static get cache(){return iv}static clearCache(){iv.forEach((e,t)=>{this.delete(t)}),this[av].reset()}static has(e){return iv.has(e)}static async delete(e){if(!this.has(e))return;const t=iv.get(e);rv.delete(e),iv.delete(e),(await t).scenes.forEach(e=>{e.traverse(e=>{if(!e.isMesh)return;const t=e;(Array.isArray(t.material)?t.material:[t.material]).forEach(e=>{e.dispose()}),t.geometry.dispose()})})}static hasFinishedLoading(e){return!!rv.get(e)}get[($m=av,ev=lv,av)](){return this.constructor[av]}async preload(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{};iv.has(e)||iv.set(e,tv(e,this[lv],e=>{t(.9*e)})),await iv.get(e),t&&t(1),rv.set(e,!0)}async load(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{};await this.preload(e,t);const n=await iv.get(e);null!=n.scene&&n.scene.traverse(e=>{if(e.frustumCulled=!1,e.name||(e.name=e.uuid),!e.isMesh)return;e.castShadow=!0;const t=e;(Array.isArray(t.material)?t.material:[t.material]).forEach(e=>{e.isMeshStandardMaterial&&this.roughnessMipmapper.generateMipmaps(e)})});const i=Qp(n),r=i.scene?i.scene:null;return null!=r&&(r.userData.animations=i.animations,this[av].retain(e),r[nv]=(()=>{let t=!1;return()=>{t||(r.traverse(e=>{if(!e.isMesh)return;const t=e;(Array.isArray(t.material)?t.material:[t.material]).forEach(e=>{e.dispose()})}),this[av].release(e),t=!0)}})()),r}}var hv,uv;cv[$m]=new class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5;this[_p]=new Map,this[Mp]=[],this[Rp]=e,this[Lp]=t}set evictionThreshold(e){this[Lp]=e,this[Ap]()}get evictionThreshold(){return this[Lp]}get cache(){return this[Rp]}retainerCount(e){return this[Ep].get(e)||0}reset(){this[Ep].clear(),this[Tp]=[]}retain(e){this[Ep].has(e)||this[Ep].set(e,0),this[Ep].set(e,this[Ep].get(e)+1);const t=this[Tp].indexOf(e);-1!==t&&this[Tp].splice(t,1),this[Tp].unshift(e),this[Ap]()}release(e){this[Ep].has(e)&&this[Ep].set(e,Math.max(this[Ep].get(e)-1,0)),this[Ap]()}[(_p=Ep,Mp=Tp,Ap)](){if(!(this[Tp].length=this[Lp];--e){const t=this[Tp][e];0===this[Ep].get(t)&&(this[Rp].delete(t),this[Tp].splice(e,1))}}}(cv);const dv=Symbol("cancelPendingSourceChange"),pv=Symbol("currentScene"),fv=45,mv=Symbol("loader");class vv extends Di{constructor(){super(),this[hv]=null,this[uv]=new cv,this.mixer=new xd(null),this.animations=[],this.animationsByName=new Map,this.currentAnimationAction=null,this.modelContainer=new Di,this.animationNames=[],this.boundingBox=new Yi,this.size=new $n,this.idealCameraDistance=0,this.fieldOfViewAspect=0,this.userData={url:null},this.url=null,this.name="Model",this.modelContainer.name="ModelContainer",this.add(this.modelContainer)}get loader(){return this[mv]}hasModel(){return!!this.modelContainer.children.length}applyEnvironmentMap(e){this.modelContainer.traverse(t=>{const n=t;if(Array.isArray(n.material))for(let t of n.material)t.isMeshBasicMaterial||(t.envMap=e,t.needsUpdate=!0);else n.material&&!n.material.isMeshBasicMaterial&&(n.material.envMap=e,n.material.needsUpdate=!0)}),this.dispatchEvent({type:"envmap-change",value:e})}setObject(e){this.clear(),this.modelContainer.add(e),this.updateFraming(),this.dispatchEvent({type:"model-load"})}async setSource(e,t){if(!e||e===this.url)return void(t&&t(1));null!=this[dv]&&(this[dv](),this[dv]=null),this.url=e;let n=null;try{n=await new Promise(async(n,i)=>{this[dv]=()=>i();try{n(await this.loader.load(e,t))}catch(e){i(e)}})}catch(e){if(null==e)return;throw e}this.clear(),this[pv]=n,null!=n&&$p(n,this.modelContainer),this.modelContainer.traverse(e=>{e&&"Mesh"===e.type&&(e.castShadow=!0)});const i=n?n.userData.animations:[],r=new Map,a=[];for(const e of i)r.set(e.name,e),a.push(e.name);this.animations=i,this.animationsByName=r,this.animationNames=a,this.userData.url=e,this.updateFraming(),this.dispatchEvent({type:"model-load",url:e})}set animationTime(e){null!=this.currentAnimationAction&&(this.currentAnimationAction.time=e)}get animationTime(){return null!=this.currentAnimationAction?this.currentAnimationAction.time:0}get hasActiveAnimation(){return null!=this.currentAnimationAction}playAnimation(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;const{animations:n}=this;if(null==n||0===n.length)return void console.warn("Cannot play animation (model does not have any animations)");let i=null;null!=e&&(i=this.animationsByName.get(e)),null==i&&(i=n[0]);try{const{currentAnimationAction:e}=this;this.currentAnimationAction=this.mixer.clipAction(i,this).play(),this.currentAnimationAction.enabled=!0,null!=e&&this.currentAnimationAction!==e&&this.currentAnimationAction.crossFadeFrom(e,t,!1)}catch(e){console.error(e)}}stopAnimation(){null!=this.currentAnimationAction&&(this.currentAnimationAction.stop(),this.currentAnimationAction.reset(),this.currentAnimationAction=null),this.mixer.stopAllAction()}updateAnimation(e){this.mixer.update(e)}clear(){this.url=null,this.userData={url:null},null!=this[pv]&&($p(this.modelContainer,this[pv]),this[pv][nv](),this[pv]=null),null!=this.currentAnimationAction&&(this.currentAnimationAction.stop(),this.currentAnimationAction=null),this.mixer.stopAllAction(),this.mixer.uncacheRoot(this)}updateFraming(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.remove(this.modelContainer),null==e&&(this.boundingBox.setFromObject(this.modelContainer),this.boundingBox.getSize(this.size),e=this.boundingBox.getCenter(new $n));const t=Math.sqrt(ef(this.modelContainer,(t,n)=>Math.max(t,e.distanceToSquared(n)))),n=fv/2*Math.PI/180;this.idealCameraDistance=t/Math.sin(n);const i=Math.tan(n);this.fieldOfViewAspect=ef(this.modelContainer,(t,n)=>{n.sub(e);const i=Math.sqrt(n.x*n.x+n.z*n.z);return Math.max(t,i/(this.idealCameraDistance-Math.abs(n.y)))})/i,this.add(this.modelContainer)}}hv=pv,uv=mv;const gv=.001,yv=.1,xv=9,bv=6,wv=2;class _v extends wu{constructor(e,t,n){super(),this.model=e,this.shadowMaterial=new ah,this.boundingBox=new Yi,this.size=new $n,this.needsUpdate=!1,this.intensity=0,this.castShadow=!0,this.floor=new ma(new qa,this.shadowMaterial),this.floor.rotateX(-Math.PI/2),this.floor.receiveShadow=!0,this.floor.castShadow=!1,this.add(this.floor),this.shadow.camera.up.set(0,0,1),this.target=t,this.setModel(e,n)}setModel(e,t){this.model=e;const{camera:n}=this.shadow;this.boundingBox.copy(e.boundingBox),this.size.copy(e.size);const{boundingBox:i,size:r}=this;if(this.model.animationNames.length>0){const e=Math.max(r.x,r.y,r.z)*wv;r.y=e,i.expandByVector(r.subScalar(e).multiplyScalar(-.5)),i.max.y=e,r.set(e,e,e)}const a=r.y*gv;this.position.y=i.max.y+a,i.getCenter(this.floor.position),this.floor.position.y-=r.y/2+this.position.y-2*a,n.near=0,n.far=r.y,this.setSoftness(t)}setSoftness(e){const t=Math.pow(2,xv-e*(xv-bv));this.setMapSize(t)}setMapSize(e){const{camera:t,mapSize:n,map:i}=this.shadow,{boundingBox:r,size:a}=this;null!=i&&(i.dispose(),this.shadow.map=null),this.model.animationNames.length>0&&(e*=wv);const o=Math.floor(a.x>a.z?e:e*a.x/a.z),s=Math.floor(a.x>a.z?e*a.z/a.x:e);n.set(o,s);const l=2.5*a.x/o,c=2.5*a.z/s;t.left=-r.max.x-l,t.right=-r.min.x+l,t.bottom=r.min.z-c,t.top=r.max.z+c,this.updateMatrixWorld(),this.shadow.updateMatrices(this),this.floor.scale.set(a.x+2*l,a.z+2*c,1),this.needsUpdate=!0}setIntensity(e){this.shadowMaterial.opacity=e*yv,e>0?(this.visible=!0,this.floor.visible=!0):(this.visible=!1,this.floor.visible=!1)}getIntensity(){return this.shadowMaterial.opacity/yv}setRotation(e){this.shadow.camera.up.set(Math.sin(e),0,Math.cos(e)),this.shadow.updateMatrices(this)}}var Mv;const Sv=Math.tan(fv/2*Math.PI/180),Ev=Symbol("paused");class Tv extends Ni{constructor(e){let{canvas:t,element:n,width:i,height:r}=e;super(),this[Mv]=!1,this.aspect=1,this.shadow=null,this.shadowIntensity=0,this.shadowSoftness=1,this.width=1,this.height=1,this.isVisible=!1,this.isDirty=!1,this.exposure=1,this.framedFieldOfView=fv,this.camera=new Ca(45,1,.1,100),this.name="ModelScene",this.element=n,this.canvas=t,this.context=t.getContext("2d"),this.model=new vv,this.camera=new Ca(45,1,.1,100),this.camera.name="MainCamera",this.activeCamera=this.camera,this.pivot=new Di,this.pivot.name="Pivot",this.pivotCenter=new $n,this.skyboxMesh=this.createSkyboxMesh(),this.add(this.pivot),this.pivot.add(this.model),this.setSize(i,r),this.background=new Sr(16777215),this.model.addEventListener("model-load",e=>this.onModelLoad(e))}get paused(){return this[Ev]}pause(){this[Ev]=!0}resume(){this[Ev]=!1}async setModelSource(e,t){try{await this.model.setSource(e,t)}catch(t){throw new Error("Could not set model source to '".concat(e,"': ").concat(t.message))}}setSize(e,t){if(e!==this.width||t!==this.height){this.width=Math.max(e,1),this.height=Math.max(t,1);const n=uf();this.canvas.width=this.width*n,this.canvas.height=this.height*n,this.canvas.style.width="".concat(this.width,"px"),this.canvas.style.height="".concat(this.height,"px"),this.aspect=this.width/this.height,this.frameModel(),Promise.resolve().then(()=>{this.element[xg].render(performance.now())})}}frameModel(){const e=Sv*Math.max(1,this.model.fieldOfViewAspect/this.aspect);this.framedFieldOfView=2*Math.atan(e)*180/Math.PI}getSize(){return{width:this.width,height:this.height}}getCamera(){return this.activeCamera}setCamera(e){this.activeCamera=e}setPivotRotation(e){this.pivot.rotation.y=e,this.pivot.position.x=-this.pivotCenter.x,this.pivot.position.z=-this.pivotCenter.z,this.pivot.position.applyAxisAngle(this.pivot.up,e),this.pivot.position.x+=this.pivotCenter.x,this.pivot.position.z+=this.pivotCenter.z,null!=this.shadow&&this.shadow.setRotation(e)}getPivotRotation(){return this.pivot.rotation.y}onModelLoad(e){this.frameModel(),this.setShadowIntensity(this.shadowIntensity),null!=this.shadow&&this.shadow.setModel(this.model,this.shadowSoftness),this.element[mg](),this.dispatchEvent({type:"model-load",url:e.url})}setShadowIntensity(e){this.shadowIntensity=e,e>0&&this.model.hasModel()&&(null==this.shadow&&(this.shadow=new _v(this.model,this.pivot,this.shadowSoftness),this.pivot.add(this.shadow)),this.shadow.setIntensity(e))}setShadowSoftness(e){this.shadowSoftness=e,null!=this.shadow&&this.shadow.setSoftness(e)}createSkyboxMesh(){const e=new Ma(1,1,1);e.deleteAttribute("normal"),e.deleteAttribute("uv");const t=new Ra({uniforms:{envMap:{value:null},opacity:{value:1}},vertexShader:Va.cube.vertexShader,fragmentShader:Va.cube.fragmentShader,side:Ae,depthTest:!1,depthWrite:!1,fog:!1});t.extensions={derivatives:!0,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1};const n="\n#define ENVMAP_TYPE_CUBE_UV\n#define PI 3.14159265359\n".concat(Jp,"\nuniform sampler2D envMap;\n ");t.onBeforeCompile=e=>{e.fragmentShader=e.fragmentShader.replace("uniform samplerCube tCube;",n).replace("vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );","gl_FragColor = textureCubeUV( envMap, vWorldDirection, 0.0 );").replace("gl_FragColor = mapTexelToLinear( texColor );","")};const i=new ma(e,t);return i.frustumCulled=!1,i.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},i}skyboxMaterial(){return this.skyboxMesh.material}}Mv=Ev;const Av=async e=>new Promise((t,n)=>{const i=e.match(/data:(.*);/);if(!i)return n(new Error("".concat(e," is not a valid data Url")));const r=i[1],a=e.replace(/data:image\/\w+;base64,/,""),o=atob(a),s=[];for(let e=0;e{let n;return(n=Math.max(hf(t,0,1),e.progress))!==e.progress&&(e.progress=n,this[Cv]()),e.progress}}[(Lv=Ov,Rv=Pv,Cv)](){let e=0,t=0,n=0;for(const i of this[Pv]){const{progress:r}=i;e+=r*(Iv/Math.pow(2,t++)),1===r&&n++}n===this.ongoingActivityCount&&(e=1,this[Pv].clear()),this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:e}}))}}var Nv,zv,Uv,Fv,Bv,kv,Gv,Vv,Hv,jv,Wv=function(e,t,n,i){var r,a=arguments.length,o=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(o=(a<3?r(o):a>3?r(t,n,o):r(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o};const qv=1e3,Xv=50,Yv=300,Zv=150,Jv=Symbol("updateSize"),Kv=Symbol("loaded"),Qv=Symbol("template"),$v=Symbol("fallbackResizeHandler"),eg=Symbol("defaultAriaLabel"),tg=Symbol("resizeObserver"),ng=Symbol("intersectionObserver"),ig=Symbol("lastDpr"),rg=Symbol("clearModelTimeout"),ag=Symbol("onContextLost"),og=Symbol("contextLostHandler"),sg=Symbol("isInRenderTree"),lg=Symbol("ariaLabel"),cg=Symbol("loadedTime"),hg=Symbol("updateSource"),ug=Symbol("markLoaded"),dg=Symbol("container"),pg=Symbol("canvas"),fg=Symbol("scene"),mg=Symbol("needsRender"),vg=Symbol("tick"),gg=Symbol("onModelLoad"),yg=Symbol("onResize"),xg=(Symbol("onUserModelOrbit"),Symbol("renderer")),bg=Symbol("progressTracker"),wg=Symbol("getLoaded"),_g=Symbol("getModelIsVisible");class Mg extends te{constructor(){super(),this.alt=null,this.src=null,this[Nv]=!1,this[zv]=!1,this[Uv]=0,this[Fv]=uf(),this[Bv]=null,this[kv]=cf(()=>{const e=this.getBoundingClientRect();this[Jv](e)},Xv),this[Gv]=null,this[Vv]=null,this[Hv]=new Dv,this[jv]=e=>this[ag](e);const e=this.constructor.template;window.ShadyCSS&&window.ShadyCSS.styleElement(this,{}),this.attachShadow({mode:"open",delegatesFocus:!0});const t=this.shadowRoot;let n,i;if(t.appendChild(e.content.cloneNode(!0)),this[dg]=t.querySelector(".container"),this[pg]=t.querySelector("canvas"),this[eg]=this[pg].getAttribute("aria-label"),this.isConnected){const e=this.getBoundingClientRect();n=e.width,i=e.height}else n=Yv,i=Zv;if(this[fg]=new Tv({canvas:this[pg],element:this,width:n,height:i}),this[fg].addEventListener("model-load",e=>{this[ug](),this[gg](e),this.dispatchEvent(new CustomEvent("load",{detail:{url:e.url}}))}),Promise.resolve().then(()=>{this[Jv](this.getBoundingClientRect(),!0)}),he&&(this[tg]=new ResizeObserver(e=>{if(!this[xg].isPresenting)for(let t of e)t.target===this&&this[Jv](t.contentRect)})),ue){const e=this[bg].beginActivity();this[ng]=new IntersectionObserver(t=>{for(let n of t)if(n.target===this){const t=this[sg];this[sg]=this[fg].visible=n.isIntersecting,this.requestUpdate(sg,t),this[sg]&&Promise.resolve().then(()=>{e(1)})}},{root:null,rootMargin:"10px",threshold:0})}else this[sg]=this[fg].visible=!0,this.requestUpdate(sg,!1)}static get is(){return"model-viewer"}static get template(){return this.hasOwnProperty(Qv)||(this[Qv]=xe(this.is)),this[Qv]}static set modelCacheSize(e){cv[av].evictionThreshold=e}static get modelCacheSize(){return cv[av].evictionThreshold}get loaded(){return this[wg]()}get[(Nv=sg,zv=Kv,Uv=cg,Fv=ig,Bv=rg,kv=$v,Gv=tg,Vv=ng,Hv=bg,jv=og,xg)](){return Vm.singleton}get modelIsVisible(){return this[_g]()}connectedCallback(){super.connectedCallback&&super.connectedCallback(),he?this[tg].observe(this):self.addEventListener("resize",this[$v]),ue&&this[ng].observe(this),this[xg].addEventListener("contextlost",this[og]),this[xg].registerScene(this[fg]),this[fg].isDirty=!0,null!=this[rg]&&(self.clearTimeout(this[rg]),this[rg]=null,this.requestUpdate("src",null))}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback(),he?this[tg].unobserve(this):self.removeEventListener("resize",this[$v]),ue&&this[ng].unobserve(this),this[xg].removeEventListener("contextlost",this[og]),this[xg].unregisterScene(this[fg]),this[rg]=self.setTimeout(()=>{this[fg].model.clear()},qv)}updated(e){if(super.updated(e),!e.has("src")||null!=this.src&&this.src===this[fg].model.url||(this[Kv]=!1,this[cg]=0,this[hg]()),e.has("alt")){const e=null==this.alt?this[eg]:this.alt;this[pg].setAttribute("aria-label",e)}}toDataURL(e,t){return this[pg].toDataURL(e,t)}async toBlob(e){const t=e?e.mimeType:void 0,n=e?e.qualityArgument:void 0,i=e?e.idealAspect:void 0,{width:r,height:a,model:o,aspect:s}=this[fg];if(!0===i){const e=o.fieldOfViewAspect>s?r:Math.round(a*o.fieldOfViewAspect),t=o.fieldOfViewAspect>s?Math.round(r/o.fieldOfViewAspect):a;this[Jv]({width:e,height:t}),await new Promise(e=>requestAnimationFrame(e))}try{return new Promise(async(e,i)=>!this[pg].msToBlob||t&&"image/png"!==t?this[pg].toBlob?void this[pg].toBlob(t=>{if(!t)return i(new Error("Unable to retrieve canvas blob"));e(t)},t,n):e(await Av(this[pg].toDataURL(t,n))):e(this[pg].msToBlob()))}finally{this[Jv]({width:r,height:a})}}get[lg](){return null==this.alt||"null"===this.alt?this[eg]:this.alt}[wg](){return this[Kv]}[_g](){return!0}[Jv](e){let{width:t,height:n}=e,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{width:r,height:a}=this[fg].getSize(),o=parseInt(t,10),s=parseInt(n,10);this[dg].style.width="".concat(t,"px"),this[dg].style.height="".concat(n,"px"),(i||r!==o||a!==s)&&this[yg]({width:o,height:s})}[vg](e,t){const n=uf();n!==this[ig]&&(this[ig]=n,this[$v]())}[ug](){this[Kv]||(this[Kv]=!0,this[cg]=performance.now(),this.requestUpdate())}[mg](){this[fg].isDirty=!0}[gg](e){this[mg]()}[yg](e){this[fg].setSize(e.width,e.height),this[mg]()}[ag](e){this.dispatchEvent(new CustomEvent("error",{detail:{type:"webglcontextlost",sourceError:e.sourceEvent}}))}async[hg](){const e=this[bg].beginActivity(),t=this.src;try{this[pg].classList.add("show"),await this[fg].setModelSource(t,t=>e(.9*t))}catch(e){this[pg].classList.remove("show"),this.dispatchEvent(new CustomEvent("error",{detail:e}))}finally{e(1)}}}Wv([re({type:String})],Mg.prototype,"alt",void 0),Wv([re({converter:{fromAttribute:af}})],Mg.prototype,"src",void 0);var Sg=function(e,t,n,i){var r,a=arguments.length,o=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(o=(a<3?r(o):a>3?r(t,n,o):r(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o};const Eg=1e3,Tg=Symbol("changeAnimation"),Ag=Symbol("paused"),Lg=(e,t)=>({type:"number",number:e,unit:t}),Rg=(()=>{const e={};return t=>{const n=t;if(n in e)return e[n];const i=[];let r=0;for(;t;){if(++r>1e3){t="";break}const e=Pg(t),n=e.nodes[0];if(null==n||0===n.terms.length)break;i.push(n),t=e.remainingInput}return e[n]=i}})(),Pg=(()=>{const e=/^(\-\-|[a-z\u0240-\uffff])/i,t=/^([\*\+\/]|[\-]\s)/i,n=/^[\),]/;return i=>{const r=[];for(;i.length&&(i=i.trim(),!n.test(i));)if("("===i[0]){const{nodes:e,remainingInput:t}=Dg(i);i=t,r.push({type:"function",name:{type:"ident",value:"calc"},arguments:e})}else if(e.test(i)){const e=Cg(i),t=e.nodes[0];if("("===(i=e.remainingInput)[0]){const{nodes:e,remainingInput:n}=Dg(i);r.push({type:"function",name:t,arguments:e}),i=n}else r.push(t)}else if(t.test(i))r.push({type:"operator",value:i[0]}),i=i.slice(1);else{const{nodes:e,remainingInput:t}="#"===i[0]?Ig(i):Og(i);if(0===e.length)break;r.push(e[0]),i=t}return{nodes:[{type:"expression",terms:r}],remainingInput:i}}})(),Cg=(()=>{const e=/[^a-z^0-9^_^\-^\u0240-\uffff]/i;return t=>{const n=t.match(e);return{nodes:[{type:"ident",value:null==n?t:t.substr(0,n.index)}],remainingInput:null==n?"":t.substr(n.index)}}})(),Og=(()=>{const e=/[^0-9\.\-]|$/,t=/^[a-z%]+/i,n=/^(m|mm|cm|rad|deg|[%])$/;return i=>{const r=i.match(e),a=null==r?i:i.substr(0,r.index),o=(i=null==r?i:i.slice(r.index)).match(t);let s=null!=o&&""!==o[0]?o[0]:null;const l=null==o?i:i.slice(s.length);return null==s||n.test(s)||(s=null),{nodes:[{type:"number",number:parseFloat(a)||0,unit:s}],remainingInput:l}}})(),Ig=(()=>{const e=/^[a-f0-9]*/i;return t=>{const n=(t=t.slice(1).trim()).match(e);return{nodes:null==n?[]:[{type:"hex",value:n[0]}],remainingInput:null==n?t:t.slice(n[0].length)}}})(),Dg=e=>{const t=[];for(e=e.slice(1).trim();e.length;){const n=Pg(e);if(t.push(n.nodes[0]),","===(e=n.remainingInput.trim())[0])e=e.slice(1).trim();else if(")"===e[0]){e=e.slice(1);break}}return{nodes:t,remainingInput:e}},Ng=Symbol("visitedTypes");class zg{constructor(e){this[Ng]=e}walk(e,t){const n=e.slice();for(;n.length;){const e=n.shift();switch(this[Ng].indexOf(e.type)>-1&&t(e),e.type){case"expression":n.unshift(...e.terms);break;case"function":n.unshift(e.name,...e.arguments)}}}}const Ug=Object.freeze({type:"number",number:0,unit:null});var Fg=function(e,t,n,i){var r,a=arguments.length,o=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(o=(a<3?r(o):a>3?r(t,n,o):r(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o};const Bg=(()=>{const e=document.createElement("a");return e.setAttribute("rel","ar"),e.appendChild(document.createElement("img")),t=>{e.setAttribute("href",t),e.click()}})(),kg=(()=>{const e=document.createElement("a"),t=/(link|title)(=|&)|(\?|&)(link|title)$/;let n=!1;return(i,r,a)=>{if(n)return;const o=self.location.toString(),s=new URL(o),l=new URL(i),c=encodeURIComponent(o),h=l.protocol.replace(":","");l.search&&l.search.match(t)&&console.warn("The model URL (".concat(l.toString(),') contains a "link" and/or "title" query parameter.\n These parameters are used to configure Scene Viewer and will be duplicated in the URL.\n You should choose different query parameter names if possible!')),s.hash="#model-viewer-no-ar-fallback",r=encodeURIComponent(r),l.protocol="intent://",l.search+=(l.search?"&":"")+"link=".concat(c,"&title=").concat(r),"fixed"===a&&(l.search+="&resizable=false");const u="".concat(l.toString(),"#Intent;scheme=").concat(h,";package=com.google.ar.core;action=android.intent.action.VIEW;S.browser_fallback_url=").concat(encodeURIComponent(s.toString()),";end;");self.addEventListener("hashchange",()=>{"#model-viewer-no-ar-fallback"!==self.location.hash||n||(n=!0,self.history.back())},{once:!0}),e.setAttribute("href",u),e.click()}})(),Gg=(e=>t=>{try{const n=Rg(t),i=(n.length?n[0].terms:[]).filter(e=>e&&"ident"===e.type).map(e=>e.value).filter(t=>e.indexOf(t)>-1),r=new Set;for(const e of i)r.add(e);return r}catch(e){}return new Set})(["safari","chrome"]),Vg={QUICK_LOOK:"quick-look",AR_VIEWER:"ar-viewer",UNSTABLE_WEBXR:"unstable-webxr",NONE:"none"},Hg=Symbol("exitFullscreenButtonContainer"),jg=Symbol("arButtonContainer"),Wg=Symbol("defaultExitFullscreenButton"),qg=Symbol("enterARWithWebXR"),Xg=Symbol("canActivateAR"),Yg=Symbol("arMode"),Zg=Symbol("canLaunchQuickLook"),Jg=Symbol("quickLookBrowsers"),Kg=Symbol("arButtonContainerFallbackClickHandler"),Qg=Symbol("onARButtonContainerFallbackClick"),$g=Symbol("arButtonContainerClickHandler"),ey=Symbol("onARButtonContainerClick"),ty=Symbol("exitFullscreenButtonContainerClickHandler"),ny=Symbol("onExitFullscreenButtonClick"),iy=Symbol("fullscreenHandler"),ry=Symbol("onFullscreen"),ay=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,{number:n,unit:i}=e;if(isFinite(n)){if("rad"===e.unit||null==e.unit)return e}else n=t,i="rad";const r="deg"===i&&null!=n,a=r?n:0,o=a*Math.PI/180;return{type:"number",number:o,unit:"rad"}},oy=function(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,{number:i,unit:r}=e;if(isFinite(i)){if("m"===e.unit)return e}else i=n,r="m";switch(r){default:t=1;break;case"cm":t=.01;break;case"mm":t=.001}const a=t*i;return{type:"number",number:a,unit:"m"}},sy=(()=>{const e=e=>e,t={rad:e,deg:ay,m:e,mm:oy,cm:oy};return function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ug,{number:i,unit:r}=e;if(isFinite(i)||(i=n.number,r=n.unit),null==r)return e;const a=t[r];return null==a?n:a(e)}})();var ly,cy,hy;const uy=Symbol("evaluate"),dy=Symbol("lastValue");class py{constructor(){this[ly]=null}static evaluatableFor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ug;if(e instanceof py)return e;if("number"===e.type)return"%"===e.unit?new vy(e,t):e;switch(e.name.value){case"calc":return new wy(e,t);case"env":return new yy(e)}return Ug}static evaluate(e){return e instanceof py?e.evaluate():e}static isConstant(e){return!(e instanceof py)||e.isConstant}static applyIntrinsics(e,t){const{basis:n,keywords:i}=t,{auto:r}=i;return n.map((t,n)=>{const a=null==r[n]?t:r[n];let o=e[n]?e[n]:a;if("ident"===o.type){const e=o.value;e in i&&(o=i[e][n])}return null!=o&&"ident"!==o.type||(o=a),"%"===o.unit?Lg(o.number/100*t.number,t.unit):(o=sy(o,t)).unit!==t.unit?t:o})}get isConstant(){return!1}evaluate(){return this.isConstant&&null!=this[dy]||(this[dy]=this[uy]()),this[dy]}}ly=dy;const fy=Symbol("percentage"),my=Symbol("basis");class vy extends py{constructor(e,t){super(),this[fy]=e,this[my]=t}get isConstant(){return!0}[uy](){return Lg(this[fy].number/100*this[my].number,this[my].unit)}}const gy=Symbol("identNode");class yy extends py{constructor(e){super(),this[cy]=null;const t=e.arguments.length?e.arguments[0].terms[0]:null;null!=t&&"ident"===t.type&&(this[gy]=t)}get isConstant(){return!1}[(cy=gy,uy)](){if(null!=this[gy])switch(this[gy].value){case"window-scroll-y":return{type:"number",number:window.pageYOffset/(Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight)-window.innerHeight)||0,unit:null}}return Ug}}const xy=/[\*\/]/,by=Symbol("evalutor");class wy extends py{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ug;if(super(),this[hy]=null,1!==e.arguments.length)return;const n=e.arguments[0].terms.slice(),i=[];for(;n.length;){const e=n.shift();if(i.length>0){const n=i[i.length-1];if("operator"===n.type&&xy.test(n.value)){const n=i.pop(),r=i.pop();if(null==r)return;i.push(new Ey(n,py.evaluatableFor(r,t),py.evaluatableFor(e,t)));continue}}i.push("operator"===e.type?e:py.evaluatableFor(e,t))}for(;i.length>2;){const[e,n,r]=i.splice(0,3);if("operator"!==n.type)return;i.unshift(new Ey(n,py.evaluatableFor(e,t),py.evaluatableFor(r,t)))}1===i.length&&(this[by]=i[0])}get isConstant(){return null==this[by]||py.isConstant(this[by])}[(hy=by,uy)](){return null!=this[by]?py.evaluate(this[by]):Ug}}const _y=Symbol("operator"),My=Symbol("left"),Sy=Symbol("right");class Ey extends py{constructor(e,t,n){super(),this[_y]=e,this[My]=t,this[Sy]=n}get isConstant(){return py.isConstant(this[My])&&py.isConstant(this[Sy])}[uy](){const e=sy(py.evaluate(this[My])),t=sy(py.evaluate(this[Sy])),{number:n,unit:i}=e,{number:r,unit:a}=t;if(null!=a&&null!=i&&a!=i)return Ug;const o=i||a;let s;switch(this[_y].value){case"+":s=n+r;break;case"-":s=n-r;break;case"/":s=n/r;break;case"*":s=n*r;break;default:return Ug}return{type:"number",number:s,unit:o}}}const Ty=Symbol("evaluatables"),Ay=Symbol("intrinsics");class Ly extends py{constructor(e,t){super(),this[Ay]=t;const n=e[0],i=null!=n?n.terms:[];this[Ty]=t.basis.map((e,t)=>{const n=i[t];return null==n?{type:"ident",value:"auto"}:"ident"===n.type?n:py.evaluatableFor(n,e)})}get isConstant(){for(const e of this[Ty])if(!py.isConstant(e))return!1;return!0}[uy](){const e=this[Ty].map(e=>py.evaluate(e));return py.applyIntrinsics(e,this[Ay]).map(e=>e.number)}}var Ry,Py,Cy,Oy;const Iy=Symbol("instances"),Dy=Symbol("activateListener"),Ny=Symbol("deactivateListener"),zy=Symbol("notifyInstances"),Uy=Symbol("notify"),Fy=Symbol("callback");class By{constructor(e){this[Fy]=e}static[zy](){for(const e of By[Iy])e[Uy]()}static[(Ry=Iy,Dy)](){window.addEventListener("scroll",this[zy],{passive:!0})}static[Ny](){window.removeEventListener("scroll",this[zy])}observe(){0===By[Iy].size&&By[Dy](),By[Iy].add(this)}disconnect(){By[Iy].delete(this),0===By[Iy].size&&By[Ny]()}[Uy](){this[Fy]()}}By[Ry]=new Set;const ky=Symbol("computeStyleCallback"),Gy=Symbol("astWalker"),Vy=Symbol("dependencies"),Hy=Symbol("scrollHandler"),jy=Symbol("onScroll");class Wy{constructor(e){this[Py]={},this[Cy]=new zg(["function"]),this[Oy]=()=>this[jy](),this[ky]=e}observeEffectsFor(e){const t={},n=this[Vy];this[Gy].walk(e,e=>{const{name:i}=e,r=e.arguments[0].terms[0];if("env"===i.value&&null!=r&&"ident"===r.type)switch(r.value){case"window-scroll-y":if(null==t["window-scroll"]){const e="window-scroll"in n?n["window-scroll"]:new By(this[Hy]);e.observe(),delete n["window-scroll"],t["window-scroll"]=e}}});for(const e in n){n[e].disconnect()}this[Vy]=t}dispose(){for(const e in this[Vy]){this[Vy][e].disconnect()}}[(Py=Vy,Cy=Gy,Oy=Hy,jy)](){this[ky]({relatedState:"window-scroll"})}}const qy=e=>{const t=e.observeEffects||!1,n=e.intrinsics instanceof Function?e.intrinsics:()=>e.intrinsics;return(i,r)=>{const a=i.updated,o=i.connectedCallback,s=i.disconnectedCallback,l=Symbol("".concat(r,"StyleEffector")),c=Symbol("".concat(r,"StyleEvaluator")),h=Symbol("".concat(r,"UpdateEvaluator")),u=Symbol("".concat(r,"EvaluateAndSync"));Object.defineProperties(i,{[l]:{value:null,writable:!0},[c]:{value:null,writable:!0},[h]:{value:function(){const e=Rg(this[r]);this[c]=new Ly(e,n(this)),null==this[l]&&t&&(this[l]=new Wy(()=>this[u]())),null!=this[l]&&this[l].observeEffectsFor(e)}},[u]:{value:function(){if(null==this[c])return;const t=this[c].evaluate();this[e.updateHandler](t)}},updated:{value:function(e){e.has(r)&&(this[h](),this[u]()),a.call(this,e)}},connectedCallback:{value:function(){o.call(this),this.requestUpdate(r,this[r])}},disconnectedCallback:{value:function(){s.call(this),null!=this[l]&&(this[l].dispose(),this[l]=null)}}})}};var Xy,Yy,Zy,Jy,Ky,Qy,$y,ex,tx,nx,ix,rx,ax,ox,sx,lx;const cx=Object.freeze({minimumRadius:0,maximumRadius:1/0,minimumPolarAngle:Math.PI/8,maximumPolarAngle:Math.PI-Math.PI/8,minimumAzimuthalAngle:-1/0,maximumAzimuthalAngle:1/0,minimumFieldOfView:10,maximumFieldOfView:45,eventHandlingBehavior:"prevent-all",interactionPolicy:"always-allow"}),hx=Symbol("v"),ux=Symbol("spherical"),dx=Symbol("goalSpherical"),px=Symbol("thetaDamper"),fx=Symbol("phiDamper"),mx=Symbol("radiusDamper"),vx=Symbol("fov"),gx=Symbol("goalLogFov"),yx=Symbol("fovDamper"),xx=Symbol("target"),bx=Symbol("goalTarget"),wx=Symbol("targetDamperX"),_x=Symbol("targetDamperY"),Mx=Symbol("targetDamperZ"),Sx=Symbol("options"),Ex=Symbol("touchMode"),Tx=Symbol("canInteract"),Ax=Symbol("interactionEnabled"),Lx=Symbol("userAdjustOrbit"),Rx=Symbol("isUserChange"),Px=Symbol("isMoving"),Cx=Symbol("moveCamera"),Ox=Symbol("pointerIsDown"),Ix=Symbol("lastPointerPosition"),Dx=Symbol("lastTouches"),Nx=Symbol("pixelLengthToSphericalAngle"),zx=Symbol("twoTouchDistance"),Ux=Symbol("wrapAngle"),Fx=Symbol("onMouseMove"),Bx=Symbol("onMouseDown"),kx=Symbol("onMouseUp"),Gx=Symbol("onTouchStart"),Vx=Symbol("onTouchEnd"),Hx=Symbol("onTouchMove"),jx=Symbol("onWheel"),Wx=Symbol("onKeyDown"),qx=Symbol("handlePointerMove"),Xx=Symbol("handleSinglePointerMove"),Yx=Symbol("handlePointerDown"),Zx=Symbol("handleSinglePointerDown"),Jx=Symbol("handlePointerUp"),Kx=Symbol("handleWheel"),Qx=Symbol("handleKey"),$x=/^touch(start|end|move)$/,eb=Math.PI/8,tb=.1,nb=50,ib=1/nb,rb=2e-4*ib,ab={PAGE_UP:33,PAGE_DOWN:34,LEFT:37,UP:38,RIGHT:39,DOWN:40},ob={USER_INTERACTION:"user-interaction",NONE:"none"};class sb{constructor(){this[Xy]=0}update(e,t,n,i){if(null==e)return t;if(e===t&&0===this[hx])return t;if(n<0)return e;const r=e-t,a=this[hx]+ib*r,o=r+n*a,s=Math.exp(-ib*n),l=(a-ib*o)*s,c=-ib*(l+a*s);return Math.abs(l)=0?(this[hx]=0,t):(this[hx]=l,t+o*s)}}Xy=hx;class lb extends Wn{constructor(e,t){super(),this.camera=e,this.element=t,this[Yy]=!1,this[Zy]=!1,this[Jy]=new Ed,this[Ky]=new Ed,this[Qy]=new sb,this[$y]=new sb,this[ex]=new sb,this[tx]=new sb,this[nx]=new $n,this[ix]=new $n,this[rx]=new sb,this[ax]=new sb,this[ox]=new sb,this[sx]=!1,this[lx]={clientX:0,clientY:0},this[Fx]=e=>this[qx](e),this[Bx]=e=>this[Yx](e),this[kx]=e=>this[Jx](e),this[jx]=e=>this[Kx](e),this[Wx]=e=>this[Qx](e),this[Gx]=e=>this[Yx](e),this[Vx]=e=>this[Jx](e),this[Hx]=e=>this[qx](e),this[Sx]=Object.assign({},cx),this.setOrbit(0,Math.PI/2,1),this.setFieldOfView(100),this.jumpToGoal()}get interactionEnabled(){return this[Ax]}enableInteraction(){if(!1===this[Ax]){const{element:e}=this;e.addEventListener("mousemove",this[Fx]),e.addEventListener("mousedown",this[Bx]),e.addEventListener("wheel",this[jx]),e.addEventListener("keydown",this[Wx]),e.addEventListener("touchstart",this[Gx]),e.addEventListener("touchmove",this[Hx]),self.addEventListener("mouseup",this[kx]),self.addEventListener("touchend",this[Vx]),this.element.style.cursor="grab",this[Ax]=!0}}disableInteraction(){if(!0===this[Ax]){const{element:e}=this;e.removeEventListener("mousemove",this[Fx]),e.removeEventListener("mousedown",this[Bx]),e.removeEventListener("wheel",this[jx]),e.removeEventListener("keydown",this[Wx]),e.removeEventListener("touchstart",this[Gx]),e.removeEventListener("touchmove",this[Hx]),self.removeEventListener("mouseup",this[kx]),self.removeEventListener("touchend",this[Vx]),e.style.cursor="",this[Ax]=!1}}get options(){return this[Sx]}getCameraSpherical(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Ed).copy(this[ux])}getFieldOfView(){return this.camera.fov}applyOptions(e){Object.assign(this[Sx],e),this.setOrbit(),this.setFieldOfView(Math.exp(this[gx])),this.jumpToGoal()}updateNearFar(e,t){this.camera.near=Math.max(e,t/1e3),this.camera.far=t,this.camera.updateProjectionMatrix()}updateAspect(e){this.camera.aspect=e,this.camera.updateProjectionMatrix()}setOrbit(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this[dx].theta,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this[dx].phi,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this[dx].radius;const{minimumAzimuthalAngle:i,maximumAzimuthalAngle:r,minimumPolarAngle:a,maximumPolarAngle:o,minimumRadius:s,maximumRadius:l}=this[Sx],{theta:c,phi:h,radius:u}=this[dx],d=hf(e,i,r);isFinite(i)||isFinite(r)||(this[ux].theta=this[Ux](this[ux].theta-d)+d);const p=hf(t,a,o),f=hf(n,s,l);return(d!==c||p!==h||f!==u)&&(this[dx].theta=d,this[dx].phi=p,this[dx].radius=f,this[dx].makeSafe(),this[Rx]=!1,!0)}setRadius(e){this[dx].radius=e,this.setOrbit()}setFieldOfView(e){const{minimumFieldOfView:t,maximumFieldOfView:n}=this[Sx];e=hf(e,t,n),this[gx]=Math.log(e)}setTarget(e,t,n){this[bx].set(e,t,n)}getTarget(){return this[xx].clone()}adjustOrbit(e,t,n,i){const{theta:r,phi:a,radius:o}=this[dx],s=this[ux].theta-r,l=Math.PI-.001,c=r-hf(e,-l-s,l-s),h=a-t,u=o+n;let d=this.setOrbit(c,h,u);if(0!==i){const e=this[gx]+i;this.setFieldOfView(Math.exp(e)),d=!0}return d}jumpToGoal(){this.update(0,100*nb)}update(e,t){if(this[Px]())return;const{maximumPolarAngle:n,maximumRadius:i,maximumFieldOfView:r}=this[Sx],a=this[ux].theta-this[dx].theta;Math.abs(a)>Math.PI&&!isFinite(this[Sx].minimumAzimuthalAngle)&&!isFinite(this[Sx].maximumAzimuthalAngle)&&(this[ux].theta-=2*Math.sign(a)*Math.PI),this[ux].theta=this[px].update(this[ux].theta,this[dx].theta,t,Math.PI),this[ux].phi=this[fx].update(this[ux].phi,this[dx].phi,t,n),this[ux].radius=this[mx].update(this[ux].radius,this[dx].radius,t,i),this[vx]=this[yx].update(this[vx],this[gx],t,r),this[xx].x=this[wx].update(this[xx].x,this[bx].x,t,i),this[xx].y=this[_x].update(this[xx].y,this[bx].y,t,i),this[xx].z=this[Mx].update(this[xx].z,this[bx].z,t,i),this[Cx]()}[(Yy=Ax,Zy=Rx,Jy=ux,Ky=dx,Qy=px,$y=fx,ex=mx,tx=yx,nx=xx,ix=bx,rx=wx,ax=_x,ox=Mx,sx=Ox,lx=Ix,Px)](){return this[dx].theta===this[ux].theta&&this[dx].phi===this[ux].phi&&this[dx].radius===this[ux].radius&&this[gx]===this[vx]&&this[bx].equals(this[xx])}[Cx](){this[ux].makeSafe(),this.camera.position.setFromSpherical(this[ux]),this.camera.position.add(this[xx]),this.camera.setRotationFromEuler(new xi(this[ux].phi-Math.PI/2,this[ux].theta,0,"YXZ")),this.camera.fov!==Math.exp(this[vx])&&(this.camera.fov=Math.exp(this[vx]),this.camera.updateProjectionMatrix());const e=this[Rx]?ob.USER_INTERACTION:ob.NONE;this.dispatchEvent({type:"change",source:e})}get[Tx](){if("allow-when-focused"==this[Sx].interactionPolicy){return this.element.getRootNode().activeElement===this.element}return"always-allow"===this[Sx].interactionPolicy}[Lx](e,t,n,i){const r=this.adjustOrbit(e,t,n,i);return this[Rx]=!0,this.dispatchEvent({type:"change",source:ob.USER_INTERACTION}),r}[Ux](e){const t=(e+Math.PI)/(2*Math.PI);return 2*(t-Math.floor(t))*Math.PI-Math.PI}[Nx](e){return 2*Math.PI*e/this.element.clientHeight}[zx](e,t){const{clientX:n,clientY:i}=e,{clientX:r,clientY:a}=t,o=r-n,s=a-i;return Math.sqrt(o*o+s*s)}[qx](e){if(!this[Ox]||!this[Tx])return;let t=!1;if($x.test(e.type)){const{touches:n}=e;switch(this[Ex]){case"zoom":if(this[Dx].length>1&&n.length>1){const e=this[zx](this[Dx][0],this[Dx][1]),i=this[zx](n[0],n[1]),r=-1*tb*(i-e)/10;t=this[Lx](0,0,0,r)}break;case"rotate":t=this[Xx](n[0])}this[Dx]=n}else t=this[Xx](e);(t||"prevent-all"===this[Sx].eventHandlingBehavior)&&e.cancelable&&e.preventDefault()}[Xx](e){const{clientX:t,clientY:n}=e,i=this[Nx](t-this[Ix].clientX),r=this[Nx](n-this[Ix].clientY);return this[Ix].clientX=t,this[Ix].clientY=n,this[Lx](i,r,0,0)}[Yx](e){if(this[Ox]=!0,$x.test(e.type)){const{touches:t}=e;switch(t.length){default:case 1:this[Ex]="rotate",this[Zx](t[0]);break;case 2:this[Ex]="zoom"}this[Dx]=t}else this[Zx](e)}[Zx](e){this[Ix].clientX=e.clientX,this[Ix].clientY=e.clientY,this.element.style.cursor="grabbing"}[Jx](e){this.element.style.cursor="grab",this[Ox]=!1}[Kx](e){if(!this[Tx])return;const t=e.deltaY*tb/30;(this[Lx](0,0,0,t)||"prevent-all"===this[Sx].eventHandlingBehavior)&&e.cancelable&&e.preventDefault()}[Qx](e){let t=!1,n=!1;switch(e.keyCode){case ab.PAGE_UP:t=!0,n=this[Lx](0,0,0,tb);break;case ab.PAGE_DOWN:t=!0,n=this[Lx](0,0,0,-1*tb);break;case ab.UP:t=!0,n=this[Lx](0,-eb,0,0);break;case ab.DOWN:t=!0,n=this[Lx](0,eb,0,0);break;case ab.LEFT:t=!0,n=this[Lx](-eb,0,0,0);break;case ab.RIGHT:t=!0,n=this[Lx](eb,0,0,0)}t&&(n||"prevent-all"===this[Sx].eventHandlingBehavior)&&e.cancelable&&e.preventDefault()}}const cb=e=>e<.5?2*e*e:(4-2*e)*e-1,hb=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:cb;return i=>e+(t-e)*n(i)},ub=(e,t)=>{const n=[],i=[];let r=e;for(let e=0;e{const n=t.reduce((e,t)=>e+t,0),i=t.map(e=>e/n);return t=>{let n=0,r=1/0,a=()=>0;for(let o=0;o=0;s--)(r=e[s])&&(o=(a<3?r(o):a>3?r(t,n,o):r(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o};const pb=5e3,fb=ub(0,[{frames:6,value:0},{frames:5,value:-1},{frames:1,value:-1},{frames:8,value:1},{frames:1,value:1},{frames:5,value:0},{frames:12,value:0}]),mb=ub(0,[{frames:2,value:0},{frames:1,value:1},{frames:5,value:1},{frames:1,value:0},{frames:4,value:0}]),vb={AUTO:"auto",WHEN_FOCUSED:"when-focused",NONE:"none"},gb={BASIC:"basic",WIGGLE:"wiggle"},yb={ALWAYS_ALLOW:"always-allow",WHEN_FOCUSED:"allow-when-focused"},xb="0deg 75deg 105%",bb="auto auto auto",wb="auto",_b=e=>({basis:[Lg(e[tw]*Math.PI/180,"rad")],keywords:{auto:[null]}}),Mb={basis:[ay(Lg(10,"deg"))],keywords:{auto:[null]}},Sb=e=>{const t=e[fg];return{basis:[ay(Lg(45,"deg"))],keywords:{auto:[Lg(t.framedFieldOfView,"deg")]}}},Eb=(()=>{const e=Rg(xb)[0].terms,t=sy(e[0]),n=sy(e[1]);return e=>{const i=e[fg].model.idealCameraDistance;return{basis:[t,n,Lg(i,"m")],keywords:{auto:[null,null,Lg(105,"%")]}}}})(),Tb={basis:[Lg(-1/0,"rad"),Lg(Math.PI/8,"rad"),Lg(0,"m")],keywords:{auto:[null,null,null]}},Ab={basis:[Lg(1/0,"rad"),Lg(Math.PI-Math.PI/8,"rad"),Lg(1/0,"m")],keywords:{auto:[null,null,null]}},Lb=e=>{const t=e[fg].model.boundingBox.getCenter(new $n);return{basis:[Lg(t.x,"m"),Lg(t.y,"m"),Lg(t.z,"m")],keywords:{auto:[null,null,null]}}},Rb=Math.PI/2,Pb=Math.PI/3,Cb=Rb/2,Ob=2*Math.PI,Ib=["front","right","back","left"],Db=["upper-","","lower-"],Nb=3e3,zb="Use mouse, touch or arrow keys to control the camera!",Ub=Symbol("controls"),Fb=Symbol("promptElement"),Bb=Symbol("promptAnimatedContainer"),kb=(Symbol("idealCameraDistance"),Symbol("deferInteractionPrompt")),Gb=Symbol("updateAria"),Vb=Symbol("updateCameraForRadius"),Hb=Symbol("blurHandler"),jb=Symbol("focusHandler"),Wb=Symbol("changeHandler"),qb=Symbol("onBlur"),Xb=Symbol("onFocus"),Yb=Symbol("onChange"),Zb=Symbol("shouldPromptUserToInteract"),Jb=Symbol("waitingToPromptUser"),Kb=Symbol("userPromptedOnce"),Qb=Symbol("promptElementVisibleTime"),$b=Symbol("lastPromptOffset"),ew=Symbol("focusedTime"),tw=Symbol("zoomAdjustedFieldOfView"),nw=Symbol("lastSpherical"),iw=Symbol("jumpCamera"),rw=Symbol("syncCameraOrbit"),aw=Symbol("syncFieldOfView"),ow=Symbol("syncCameraTarget"),sw=Symbol("syncMinCameraOrbit"),lw=Symbol("syncMaxCameraOrbit"),cw=Symbol("syncMinFieldOfView"),hw=Symbol("syncMaxFieldOfView");var uw=function(e,t,n,i){var r,a=arguments.length,o=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(o=(a<3?r(o):a>3?r(t,n,o):r(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o};const dw="#ffffff",pw=0,fw=1,mw=1,vw=Symbol("currentEnvironmentMap"),gw=Symbol("applyEnvironmentMap"),yw=Symbol("updateEnvironment"),xw=Symbol("cancelEnvironmentUpdate");var bw,ww;const _w="This page includes one or more 3D models that are loading",Mw="All 3D models in the page have loaded",Sw=100,Ew=Symbol("modelViewerStatusInstance"),Tw=Symbol("updateStatus");bw=Ew,ww=Tw;var Aw=function(e,t,n,i){var r,a=arguments.length,o=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(o=(a<3?r(o):a>3?r(t,n,o):r(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o};const Lw=100,Rw=.2,Pw=0,Cw="https://www.gstatic.com/draco/versioned/decoders/1.3.5/",Ow=32,Iw=13,Dw={AUTO:"auto",INTERACTION:"interaction"},Nw={INTERACTION:"interaction"},zw=new cv,Uw=new class extends Wn{constructor(){super(),this[bw]=null,this.registeredInstanceStatuses=new Map,this.loadingPromises=[],this.statusElement=document.createElement("p"),this.statusUpdateInProgress=!1,this[ww]=cf(()=>this.updateStatus(),Sw);const{statusElement:e}=this,{style:t}=e;e.setAttribute("role","status"),e.classList.add("screen-reader-only"),t.top=t.left="0",t.pointerEvents="none"}registerInstance(e){if(this.registeredInstanceStatuses.has(e))return;let t=()=>{};const n=!1===e.loaded&&!!e.src,i=new Promise(i=>{if(!n)return void i();const r=()=>{i(),e.removeEventListener("load",r),e.removeEventListener("error",r)};e.addEventListener("load",r),e.addEventListener("error",r),t=r});this.registeredInstanceStatuses.set(e,{onUnregistered:t}),this.loadingPromises.push(i),null==this.modelViewerStatusInstance&&(this.modelViewerStatusInstance=e)}unregisterInstance(e){if(!this.registeredInstanceStatuses.has(e))return;const t=this.registeredInstanceStatuses,n=t.get(e);t.delete(e),n.onUnregistered(),this.modelViewerStatusInstance===e&&(this.modelViewerStatusInstance=t.size>0?pf(t):null)}get modelViewerStatusInstance(){return this[Ew]}set modelViewerStatusInstance(e){if(this[Ew]===e)return;const{statusElement:t}=this;null!=e&&null!=e.shadowRoot?e.shadowRoot.appendChild(t):null!=t.parentNode&&t.parentNode.removeChild(t),this[Ew]=e,this[Tw]()}async updateStatus(){if(!this.statusUpdateInProgress&&0!==this.loadingPromises.length){for(this.statusElement.textContent=_w,this.statusUpdateInProgress=!0,this.dispatchEvent({type:"initial-status-announced"});this.loadingPromises.length;){const{loadingPromises:e}=this;this.loadingPromises=[],await Promise.all(e)}this.statusElement.textContent=Mw,this.statusUpdateInProgress=!1,this.dispatchEvent({type:"finished-loading-announced"})}}},Fw=Symbol("defaultProgressBarElement"),Bw=Symbol("defaultProgressMaskElement"),kw=Symbol("posterContainerElement"),Gw=Symbol("defaultPosterElement"),Vw=Symbol("posterDismissalSource"),Hw=Symbol("announceModelVisibility"),jw=Symbol("modelIsReadyForReveal"),Ww=Symbol("shouldAttemptPreload"),qw=Symbol("shouldRevealModel"),Xw=Symbol("showPoster"),Yw=Symbol("hidePoster"),Zw=Symbol("modelIsVisible"),Jw=Symbol("preloadAttempted"),Kw=Symbol("sourceUpdated"),Qw=Symbol("updateLoadingAndVisibility"),$w=Symbol("updateProgressBar"),e_=Symbol("lastReportedProgress"),t_=Symbol("ariaLabelCallToAction"),n_=Symbol("clickHandler"),i_=Symbol("keydownHandler"),r_=Symbol("processHandler"),a_=Symbol("onClick"),o_=Symbol("onKeydown"),s_=Symbol("onProgress");var l_=function(e,t,n,i){var r,a=arguments.length,o=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(o=(a<3?r(o):a>3?r(t,n,o):r(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o};const c_=Symbol("showMlModel"),h_=Symbol("hideMlModel"),u_=Symbol("isHeliosBrowser"),d_=Symbol("mlModel"),p_=.65,f_="150px",m_=Symbol("time"),v_=Symbol("duration");class g_{constructor(e){this[v_]=e,this[m_]=0}get time(){return this[m_]}get timeScale(){return this[m_]/this[v_]}get duration(){return this[v_]}get hasStopped(){return this[m_]>=this[v_]}reset(){this[m_]=0}stop(){this[m_]=this[v_]}tick(e){this[m_]+=e,this.time>=this[v_]&&(this[m_]=this[v_])}}var y_=function(e,t,n,i){var r,a=arguments.length,o=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(o=(a<3?r(o):a>3?r(t,n,o):r(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o};const x_=Math.PI/32,b_=3e3,w_=Symbol("autoRotateTimer"),__=Symbol("cameraChangeHandler"),M_=Symbol("onCameraChange");n.d(t,"ModelViewerElement",function(){return S_});const S_=(e=>{var t,n;class i extends e{constructor(){super(...arguments),this.magicLeap=!1,this[t]=null!=self.mlWorld,this[n]=null}updated(e){if(super.updated(e),!this[u_])return;if(!e.has("magicLeap")&&!e.has("src"))return;const t=this[fg];if(this.magicLeap){!!customElements.get("ml-model")||console.warn(" is not registered. Is prismatic.js loaded?"),t.pause(),this[dg].setAttribute("style","display: none;"),this[c_](),e.has("src")&&this.src&&this.src!==this[d_].getAttribute("src")&&this[d_].setAttribute("src",this.src)}else this[h_](),t.resume(),this[dg].removeAttribute("style")}[(t=u_,n=d_,c_)](){null==this[d_]&&(this[d_]=document.createElement("ml-model"),this[d_].setAttribute("style","display: block; top: 0; left: 0; width: 100%; height: 100%"),this[d_].setAttribute("model-scale","".concat(p_," ").concat(p_," ").concat(p_)),this[d_].setAttribute("z-offset",f_),this[d_].setAttribute("extractable","true"),this[d_].setAttribute("extracted-scale","1"),this[d_].setAttribute("environment-lighting","color-intensity: 5;"),null!=this.src&&this[d_].setAttribute("src",this.src)),this.shadowRoot.appendChild(this[d_])}[h_](){null!=this[d_]&&null!=this[d_].parentNode&&this[d_].parentNode.removeChild(this[d_])}}return l_([re({type:Boolean,attribute:"magic-leap"})],i.prototype,"magicLeap",void 0),i})((e=>{var t,n;class i extends e{constructor(){super(...arguments),this.autoRotate=!1,this.autoRotateDelay=b_,this[t]=new g_(this.autoRotateDelay),this[n]=e=>this[M_](e)}connectedCallback(){super.connectedCallback(),this.addEventListener("camera-change",this[__]),this[w_].stop()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("camera-change",this[__]),this[w_].stop()}updated(e){if(super.updated(e),e.has("autoRotate")&&this[mg](),e.has("autoRotateDelay")){const e=new g_(this.autoRotateDelay);e.tick(this[w_].time),e.hasStopped&&e.reset(),this[w_]=e}}[(t=w_,n=__,vg)](e,t){super[vg](e,t),this.autoRotate&&this.modelIsVisible&&(this[w_].tick(t),this[w_].hasStopped&&(this[fg].setPivotRotation(this[fg].getPivotRotation()+x_*t*.001),this[mg]()))}[M_](e){this.autoRotate&&"user-interaction"===e.detail.source&&this[w_].reset()}get turntableRotation(){return this[fg].getPivotRotation()}resetTurntableRotation(){this[fg].setPivotRotation(0),this[mg]()}}return y_([re({type:Boolean,attribute:"auto-rotate"})],i.prototype,"autoRotate",void 0),y_([re({type:Number,attribute:"auto-rotate-delay"})],i.prototype,"autoRotateDelay",void 0),i})((e=>{var t,n;class i extends e{constructor(){super(...arguments),this.environmentImage=null,this.skyboxImage=null,this.backgroundColor=dw,this.shadowIntensity=pw,this.shadowSoftness=fw,this.exposure=mw,this[t]=null,this[n]=null}updated(e){super.updated(e),e.has("shadowIntensity")&&(this[fg].setShadowIntensity(this.shadowIntensity),this[mg]()),e.has("shadowSoftness")&&(this[fg].setShadowSoftness(this.shadowSoftness),this[mg]()),e.has("exposure")&&(this[fg].exposure=this.exposure,this[mg]()),(e.has("environmentImage")||e.has("skyboxImage")||e.has("backgroundColor")||e.has("experimentalPmrem")||e.has(sg))&&this[yw]()}[(t=vw,n=xw,gg)](e){super[gg](e),null!=this[vw]&&this[gw](this[vw])}async[yw](){if(!this[sg])return;const{skyboxImage:e,backgroundColor:t,environmentImage:n}=this;this[dg].style.backgroundColor=t,null!=this[xw]&&(this[xw](),this[xw]=null);const{textureUtils:i}=this[xg];if(null!=i)try{const{environmentMap:r,skybox:a}=await new Promise(async(t,r)=>{const a=i.generateEnvironmentMapAndSkybox(e,n,{progressTracker:this[bg]});this[xw]=()=>r(a),t(await a)});if(null!=a){const e=this[fg].skyboxMaterial();e.envMap=a.texture,e.uniforms.envMap.value=a.texture,e.needsUpdate=!0,this[fg].add(this[fg].skyboxMesh)}else{this[fg].remove(this[fg].skyboxMesh);const e=new Sr(t);this[fg].background=e}this[gw](r.texture),this[fg].model.dispatchEvent({type:"envmap-update"})}catch(e){if(e instanceof Error)throw this[gw](null),e;const{environmentMap:t,skybox:n}=await e;null!=t&&t.dispose(),null!=n&&n.dispose()}}[gw](e){this[vw]=e,this[fg].model.applyEnvironmentMap(this[vw]),this.dispatchEvent(new CustomEvent("environment-change")),this[mg]()}}return uw([re({type:String,attribute:"environment-image",converter:{fromAttribute:af}})],i.prototype,"environmentImage",void 0),uw([re({type:String,attribute:"skybox-image",converter:{fromAttribute:af}})],i.prototype,"skyboxImage",void 0),uw([re({type:String,attribute:"background-color"})],i.prototype,"backgroundColor",void 0),uw([re({type:Number,attribute:"shadow-intensity"})],i.prototype,"shadowIntensity",void 0),uw([re({type:Number,attribute:"shadow-softness"})],i.prototype,"shadowSoftness",void 0),uw([re({type:Number})],i.prototype,"exposure",void 0),i})((e=>{var t,n,i,r,a,o,s,l,c,h,u,d,p,f,m;class v extends e{constructor(){super(...arguments),this.cameraControls=!1,this.cameraOrbit=xb,this.cameraTarget=bb,this.fieldOfView=wb,this.minCameraOrbit="auto",this.maxCameraOrbit="auto",this.minFieldOfView="auto",this.maxFieldOfView="auto",this.interactionPromptThreshold=Nb,this.interactionPromptStyle=gb.WIGGLE,this.interactionPrompt=vb.AUTO,this.interactionPolicy=yb.ALWAYS_ALLOW,this[t]=this.shadowRoot.querySelector(".interaction-prompt"),this[n]=this.shadowRoot.querySelector(".interaction-prompt > .animated-container"),this[i]=1/0,this[r]=0,this[a]=1/0,this[o]=!1,this[s]=!1,this[l]=!0,this[c]=new lb(this[fg].getCamera(),this[fg].canvas),this[h]=0,this[u]=new Ed,this[d]=!1,this[p]=e=>this[Yb](e),this[f]=()=>this[Xb](),this[m]=()=>this[qb]()}getCameraOrbit(){const{theta:e,phi:t,radius:n}=this[nw];return{theta:e,phi:t,radius:n}}getCameraTarget(){return this[Ub].getTarget()}getFieldOfView(){return this[Ub].getFieldOfView()}jumpCameraToGoal(){this[iw]=!0,this.requestUpdate(iw,!1)}connectedCallback(){super.connectedCallback(),this[Ub].addEventListener("change",this[Wb])}disconnectedCallback(){super.disconnectedCallback(),this[Ub].removeEventListener("change",this[Wb])}updated(e){super.updated(e);const t=this[Ub],n=this[fg];if(e.has("cameraControls")&&(this.cameraControls?(t.enableInteraction(),this.interactionPrompt===vb.AUTO&&(this[Jb]=!0),n.canvas.addEventListener("focus",this[jb]),n.canvas.addEventListener("blur",this[Hb])):(n.canvas.removeEventListener("focus",this[jb]),n.canvas.removeEventListener("blur",this[Hb]),t.disableInteraction(),this[kb]())),(e.has("interactionPrompt")||e.has("cameraControls")||e.has("src"))&&(this.interactionPrompt===vb.AUTO&&this.cameraControls?this[Jb]=!0:this[kb]()),e.has("interactionPromptStyle")&&this[Fb].classList.toggle("wiggle",this.interactionPromptStyle===gb.WIGGLE),e.has("interactionPolicy")){const e=this.interactionPolicy;t.applyOptions({interactionPolicy:e})}!0===this[iw]&&Promise.resolve().then(()=>{this[Ub].jumpToGoal(),this[iw]=!1})}[(t=Fb,n=Bb,i=ew,r=$b,a=Qb,o=Kb,s=Jb,l=Zb,c=Ub,h=tw,u=nw,d=iw,p=Wb,f=jb,m=Hb,aw)](e){this[Ub].setFieldOfView(180*e[0]/Math.PI)}[rw](e){this[Vb](e[2]),this[Ub].setOrbit(e[0],e[1],e[2])}[sw](e){this[Ub].applyOptions({minimumAzimuthalAngle:e[0],minimumPolarAngle:e[1],minimumRadius:e[2]})}[lw](e){this[Ub].applyOptions({maximumAzimuthalAngle:e[0],maximumPolarAngle:e[1],maximumRadius:e[2]})}[cw](e){this[Ub].applyOptions({minimumFieldOfView:180*e[0]/Math.PI})}[hw](e){this[Ub].applyOptions({maximumFieldOfView:180*e[0]/Math.PI})}[ow](e){const[t,n,i]=e,r=this[fg];this[Ub].setTarget(t,n,i),r.pivotCenter.set(t,n,i),r.setPivotRotation(r.getPivotRotation())}[vg](e,t){if(super[vg](e,t),this[Jb]&&this.interactionPrompt!==vb.NONE){const t=this.interactionPrompt===vb.AUTO?this[cg]:this[ew];this.loaded&&e>t+this.interactionPromptThreshold&&(this[fg].canvas.setAttribute("aria-label",zb),this[Kb]=!0,this[Jb]=!1,this[Qb]=e,this[Fb].classList.add("visible"))}if(isFinite(this[Qb])&&this.interactionPromptStyle===gb.WIGGLE){const t=this[fg],n=(e-this[Qb])/pb%1,i=fb(n),r=mb(n),a=i*t.width*.05,o=(i-this[$b])*Math.PI/16;this[Bb].style.transform="translateX(".concat(a,"px)"),this[Bb].style.opacity="".concat(r),this[Ub].adjustOrbit(o,0,0,0),this[$b]=i,this[mg]()}this[Ub].update(e,t);const n=this.getCameraTarget();this[fg].pivotCenter.equals(n)||(this[fg].pivotCenter.copy(n),this[fg].setPivotRotation(this[fg].getPivotRotation()))}[kb](){this[Jb]=!1,this[Fb].classList.remove("visible"),this[Qb]=1/0,this[Kb]&&(this[Zb]=!1)}[Vb](e){const{idealCameraDistance:t}=this[fg].model,n=2*Math.max(t,e);this[Ub].updateNearFar(0,n)}[Gb](){const{theta:e,phi:t}=this[nw],{theta:n,phi:i}=this[Ub].getCameraSpherical(this[nw]),r=this.getRootNode();if(null!=r&&r.activeElement===this){const r=(4+Math.floor((e%Ob+Cb)/Rb))%4,a=(4+Math.floor((n%Ob+Cb)/Rb))%4,o=Math.floor(t/Pb),s=Math.floor(i/Pb);if(a!==r||s!==o){const{canvas:e}=this[fg],t=Ib[a],n=Db[s],i="View from stage ".concat(n).concat(t);e.setAttribute("aria-label",i)}}}[yg](e){const t=this[Ub],n=this[fg].framedFieldOfView;super[yg](e);const i=this[fg].framedFieldOfView,r=t.getFieldOfView()/n;this[tw]=i*r,t.updateAspect(this[fg].aspect),this.requestUpdate("maxFieldOfView",this.maxFieldOfView),this.requestUpdate("fieldOfView",this.fieldOfView),this.jumpCameraToGoal()}[gg](e){super[gg](e);const{framedFieldOfView:t}=this[fg];this[tw]=t,this.requestUpdate("maxFieldOfView",this.maxFieldOfView),this.requestUpdate("fieldOfView",this.fieldOfView),this.requestUpdate("cameraOrbit",this.cameraOrbit),this.requestUpdate("cameraTarget",this.cameraTarget),this.jumpCameraToGoal()}[Xb](){const{canvas:e}=this[fg];isFinite(this[ew])||(this[ew]=performance.now());const t=this[lg];e.getAttribute("aria-label")!==t&&e.setAttribute("aria-label",t),!isFinite(this[Qb])&&this[Zb]&&(this[Jb]=!0)}[qb](){this[Jb]=!1,this[Fb].classList.remove("visible"),this[Qb]=1/0,this[ew]=1/0}[Yb](e){let{source:t}=e;this[Gb](),this[mg](),t===ob.USER_INTERACTION&&this[kb](),this.dispatchEvent(new CustomEvent("camera-change",{detail:{source:t}}))}}return db([re({type:Boolean,attribute:"camera-controls"})],v.prototype,"cameraControls",void 0),db([qy({intrinsics:Eb,observeEffects:!0,updateHandler:rw}),re({type:String,attribute:"camera-orbit",hasChanged:()=>!0})],v.prototype,"cameraOrbit",void 0),db([qy({intrinsics:Lb,observeEffects:!0,updateHandler:ow}),re({type:String,attribute:"camera-target",hasChanged:()=>!0})],v.prototype,"cameraTarget",void 0),db([qy({intrinsics:_b,observeEffects:!0,updateHandler:aw}),re({type:String,attribute:"field-of-view",hasChanged:()=>!0})],v.prototype,"fieldOfView",void 0),db([qy({intrinsics:Tb,updateHandler:sw}),re({type:String,attribute:"min-camera-orbit",hasChanged:()=>!0})],v.prototype,"minCameraOrbit",void 0),db([qy({intrinsics:Ab,updateHandler:lw}),re({type:String,attribute:"max-camera-orbit",hasChanged:()=>!0})],v.prototype,"maxCameraOrbit",void 0),db([qy({intrinsics:Mb,updateHandler:cw}),re({type:String,attribute:"min-field-of-view",hasChanged:()=>!0})],v.prototype,"minFieldOfView",void 0),db([qy({intrinsics:Sb,updateHandler:hw}),re({type:String,attribute:"max-field-of-view",hasChanged:()=>!0})],v.prototype,"maxFieldOfView",void 0),db([re({type:Number,attribute:"interaction-prompt-threshold"})],v.prototype,"interactionPromptThreshold",void 0),db([re({type:String,attribute:"interaction-prompt-style"})],v.prototype,"interactionPromptStyle",void 0),db([re({type:String,attribute:"interaction-prompt"})],v.prototype,"interactionPrompt",void 0),db([re({type:String,attribute:"interaction-policy"})],v.prototype,"interactionPolicy",void 0),v})((e=>{var t,n,i,r,a,o,s,l,c,h;class u extends e{constructor(){super(...arguments),this.ar=!1,this.arScale="auto",this.unstableWebxr=!1,this.iosSrc=null,this.quickLookBrowsers="safari",this[t]=!1,this[n]=this.shadowRoot.querySelector(".ar-button"),this[i]=this.shadowRoot.querySelector(".slot.exit-fullscreen-button"),this[r]=this.shadowRoot.querySelector("#default-exit-fullscreen-button"),this[a]=e=>this[Qg](e),this[o]=e=>this[ey](e),this[s]=()=>this[ny](),this[l]=()=>this[ry](),this[c]=Vg.NONE,this[h]=new Set}get canActivateAR(){return this[Yg]!==Vg.NONE}async activateAR(){switch(this[Yg]){case Vg.QUICK_LOOK:Bg(this.iosSrc);break;case Vg.UNSTABLE_WEBXR:await this[qg]();break;case Vg.AR_VIEWER:kg(this.src,this.alt||"",this.arScale);break;default:console.warn("No AR Mode can be activated. This is probably due to missing configuration or device capabilities")}}connectedCallback(){super.connectedCallback(),document.addEventListener("fullscreenchange",this[iy])}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("fullscreenchange",this[iy])}[(t=Xg,n=jg,i=Hg,r=Wg,a=Kg,o=$g,s=ty,l=iy,c=Yg,h=Jg,ny)](){document.fullscreenElement===this&&document.exitFullscreen()}[ry](){const e=this[fg];if(document.fullscreenElement===this?this[dg].classList.add("fullscreen"):this[dg].classList.remove("fullscreen"),document.fullscreenElement!==this&&this[xg].presentedScene===e)try{this[xg].stopPresenting()}catch(e){console.warn("Unexpected error while stopping AR presentation"),console.error(e)}}async[qg](){console.log("Attempting to present in AR...");try{await this[xg].present(this[fg])}catch(e){console.warn("Error while trying to present to AR"),console.error(e)}}async update(e){if(super.update(e),e.has("quickLookBrowsers")&&(this[Jg]=Gg(this.quickLookBrowsers)),!(e.has("unstableWebxr")||e.has("iosSrc")||e.has("ar")||e.has("src")||e.has("alt")))return;const t=this.unstableWebxr&&de&&await this[xg].supportsPresentation(),n=pe&&this.ar,i=fe&&me&&this[Zg]&&!!this.iosSrc,r=t||n||i;this[Yg]=t?Vg.UNSTABLE_WEBXR:n?Vg.AR_VIEWER:i?Vg.QUICK_LOOK:Vg.NONE,r?(this[jg].classList.add("enabled"),this[jg].addEventListener("click",this[$g]),this[jg].addEventListener("click",this[Kg]),this[Hg].addEventListener("click",this[ty])):(this[jg].removeEventListener("click",this[$g]),this[jg].removeEventListener("click",this[Kg]),this[Hg].removeEventListener("click",this[ty]),this[jg].classList.remove("enabled"))}[Qg](e){this[Yg]===Vg.AR_VIEWER&&this.requestFullscreen()}[ey](e){e.preventDefault(),this.activateAR()}get[Zg](){return ve?this[Jg].has("chrome"):!!ge&&this[Jg].has("safari")}}return Fg([re({type:Boolean,attribute:"ar"})],u.prototype,"ar",void 0),Fg([re({type:String,attribute:"ar-scale"})],u.prototype,"arScale",void 0),Fg([re({type:Boolean,attribute:"unstable-webxr"})],u.prototype,"unstableWebxr",void 0),Fg([re({converter:{fromAttribute:af},attribute:"ios-src"})],u.prototype,"iosSrc",void 0),Fg([re({type:String,attribute:"quick-look-browsers"})],u.prototype,"quickLookBrowsers",void 0),u})((e=>{var t,n,i,r,a,o,s,l,c,h,u,d,p,f,m;class v extends e{constructor(){super(...arguments),this.poster=null,this.reveal=Dw.AUTO,this.preload=!1,this[t]=!1,this[n]=!1,this[i]=!1,this[r]=0,this[a]=null,this[o]=this.shadowRoot.querySelector(".slot.poster"),this[s]=this.shadowRoot.querySelector("#default-poster"),this[l]=this.shadowRoot.querySelector("#default-progress-bar > .bar"),this[c]=this.shadowRoot.querySelector("#default-progress-bar > .mask"),this[h]=this[Gw].getAttribute("aria-label"),this[u]=()=>this[a_](),this[d]=e=>this[o_](e),this[p]=e=>this[s_](e),this[f]=cf(e=>{this.dispatchEvent(new CustomEvent("model-visibility",{detail:{visible:e}}))},Pw),this[m]=lf(e=>{const t=this[Fw].parentNode;requestAnimationFrame(()=>{this[Bw].style.opacity="".concat((1-e)*Rw),this[Fw].style.transform="scaleX(".concat(e,")"),0===e&&(t.removeChild(this[Fw]),t.appendChild(this[Fw])),1===e?this[Fw].classList.add("hide"):this[Fw].classList.remove("hide")})},Lw);const e=(self.ModelViewerElement||{}).dracoDecoderLocation||Cw;cv.setDRACODecoderLocation(e)}static set dracoDecoderLocation(e){cv.setDRACODecoderLocation(e)}static get dracoDecoderLocation(){return cv.getDRACODecoderLocation()}dismissPoster(){this[Vw]=Nw.INTERACTION,this.requestUpdate()}connectedCallback(){super.connectedCallback(),this[kw].addEventListener("click",this[n_]),this[kw].addEventListener("keydown",this[i_]),this[bg].addEventListener("progress",this[r_]),Uw.registerInstance(this)}disconnectedCallback(){super.disconnectedCallback(),this[kw].removeEventListener("click",this[n_]),this[kw].removeEventListener("keydown",this[i_]),this[bg].removeEventListener("progress",this[r_]),Uw.unregisterInstance(this)}async updated(e){super.updated(e),e.has("poster")&&null!=this.poster&&(this[Gw].style.backgroundImage="url(".concat(this.poster,")")),e.has("src")&&(this[jw]||(this[e_]=0),this[Vw]=null,this[Jw]=!1,this[Kw]=!1),e.has("alt")&&this[Gw].setAttribute("aria-label","".concat(this[lg],". ").concat(this[t_])),this[Qw]()}[(t=Zw,n=Jw,i=Kw,r=e_,a=Vw,o=kw,s=Gw,l=Fw,c=Bw,h=t_,u=n_,d=i_,p=r_,f=Hw,m=$w,a_)](){this[Vw]=Nw.INTERACTION,this.requestUpdate()}[o_](e){switch(e.keyCode){case Ow:case Iw:this[Vw]=Nw.INTERACTION}this.requestUpdate()}[s_](e){const t=e.detail.totalProgress;this.requestUpdate(),1===t&&this[$w].flush(),this[$w](t),this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:t}})),this[e_]=Math.max(t,this[e_])}get[jw](){const{src:e}=this;return!!e&&cv.hasFinishedLoading(e)&&1===this[e_]&&this[qw]}get[qw](){return this.reveal===Dw.AUTO||!!this[Vw]}get[Ww](){const{src:e}=this;return!!e&&!cv.hasFinishedLoading(e)&&(this.preload||this[qw])&&this[sg]}async[Qw](){if(this[Ww]&&!this[Jw]){this[Jw]=!0;const e=this[bg].beginActivity();try{const t=this.src,n={url:t};await zw.preload(t,e),this.dispatchEvent(new CustomEvent("preload",{detail:n}))}catch(e){this.dispatchEvent(new CustomEvent("error",{detail:{type:"loadfailure",sourceError:e}}))}finally{e(1),this.requestUpdate()}}this[jw]?await this[hg]():this[Xw]()}[Xw](){const e=this[kw],t=this[Gw],n=parseFloat(self.getComputedStyle(e).opacity);t.removeAttribute("tabindex"),t.removeAttribute("aria-hidden"),e.classList.add("show"),n<1&&e.addEventListener("transitionend",()=>{this[Zw]=!1,this[Hw](!1)},{once:!0})}[Yw](){const e=this[kw],t=this[Gw];e.classList.contains("show")&&(e.classList.remove("show"),e.addEventListener("transitionend",()=>{this[Hw](!0),requestAnimationFrame(()=>{this[Zw]=!0;const e=this.getRootNode();e&&e.activeElement===this&&this[pg].focus(),t.setAttribute("aria-hidden","true"),t.tabIndex=-1})},{once:!0}))}[_g](){return super[_g]()||this[Zw]}[wg](){const e=this.src;return super[wg]()||!(!e||!cv.hasFinishedLoading(e))}async[hg](){this[jw]&&!this[Kw]&&(this[Kw]=!0,await super[hg](),this[Yw]())}}return Aw([re({converter:{fromAttribute:af}})],v.prototype,"poster",void 0),Aw([re({type:String})],v.prototype,"reveal",void 0),Aw([re({type:Boolean})],v.prototype,"preload",void 0),v})((e=>{var t;class n extends e{constructor(){super(...arguments),this.autoplay=!1,this.animationName=void 0,this.animationCrossfadeDuration=300,this[t]=!0}get availableAnimations(){return this.loaded?this[fg].model.animationNames:[]}get paused(){return this[Ag]}get currentTime(){return this[fg].model.animationTime}set currentTime(e){this[fg].model.animationTime=e}pause(){this[Ag]||(this[Ag]=!0,this[xg].threeRenderer.shadowMap.autoUpdate=!1,this.dispatchEvent(new CustomEvent("pause")))}play(){this[Ag]&&this.availableAnimations.length>0&&(this[Ag]=!1,this[xg].threeRenderer.shadowMap.autoUpdate=!0,this[fg].model.hasActiveAnimation||this[Tg](),this.dispatchEvent(new CustomEvent("play")))}[(t=Ag,gg)](){this[Ag]=!0,this.autoplay&&(this[Tg](),this.play())}[vg](e,t){if(super[vg](e,t),this[Ag])return;const{model:n}=this[fg];n.updateAnimation(t/Eg),this[mg]()}updated(e){super.updated(e),e.has("autoplay")&&this.autoplay&&this.play(),e.has("animationName")&&this[Tg]()}async[hg](){return this[fg].model.stopAnimation(),super[hg]()}[Tg](){const{model:e}=this[fg];e.playAnimation(this.animationName,this.animationCrossfadeDuration/Eg),this[Ag]&&(e.updateAnimation(0),this[mg]())}}return Sg([re({type:Boolean})],n.prototype,"autoplay",void 0),Sg([re({type:String,attribute:"animation-name"})],n.prototype,"animationName",void 0),Sg([re({type:Number,attribute:"animation-crossfade-duration"})],n.prototype,"animationCrossfadeDuration",void 0),n})((e=>{var t;const n=e=>{if(null==e.shadowRoot||e.hasAttribute("data-js-focus-visible"))return()=>{};if(!self.applyFocusVisiblePolyfill){const t=()=>{self.applyFocusVisiblePolyfill(e.shadowRoot)};return self.addEventListener("focus-visible-polyfill-ready",t,{once:!0}),()=>{self.removeEventListener("focus-visible-polyfill-ready",t)}}return self.applyFocusVisiblePolyfill(e.shadowRoot),()=>{}},i=Symbol("endPolyfillCoordination");return t=i,class extends e{constructor(){super(...arguments),this[t]=null}connectedCallback(){super.connectedCallback&&super.connectedCallback(),null==this[i]&&(this[i]=n(this))}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback(),null!=this[i]&&(this[i](),this[i]=null)}}})(Mg))))))));customElements.define("model-viewer",S_)}}]); //# sourceMappingURL=vendors~mv.js.map