1119 lines
1.0 MiB
1119 lines
1.0 MiB
/**
|
|
* @license
|
|
* Copyright 2019 Google LLC
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,i=Symbol(),n=new WeakMap;let r=class{constructor(t,e,n){if(this._$cssResult$=!0,n!==i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const i=this.t;if(e&&void 0===t){const e=void 0!==i&&1===i.length;e&&(t=n.get(i)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&n.set(i,t))}return t}toString(){return this.cssText}};const s=e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new r("string"==typeof t?t:t+"",void 0,i))(e)})(t):t,{is:a,defineProperty:o,getOwnPropertyDescriptor:l,getOwnPropertyNames:c,getOwnPropertySymbols:h,getPrototypeOf:u}=Object,d=globalThis,p=d.trustedTypes,A=p?p.emptyScript:"",g=d.reactiveElementPolyfillSupport,m=(t,e)=>t,f={toAttribute(t,e){switch(e){case Boolean:t=t?A:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},b=(t,e)=>!a(t,e),v={attribute:!0,type:String,converter:f,reflect:!1,useDefault:!1,hasChanged:b};
|
|
/**
|
|
* @license
|
|
* Copyright 2017 Google LLC
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/Symbol.metadata??=Symbol("metadata"),d.litPropertyMetadata??=new WeakMap;let y=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=v){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),n=this.getPropertyDescriptor(t,i,e);void 0!==n&&o(this.prototype,t,n)}}static getPropertyDescriptor(t,e,i){const{get:n,set:r}=l(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:n,set(e){const s=n?.call(this);r?.call(this,e),this.requestUpdate(t,s,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??v}static _$Ei(){if(this.hasOwnProperty(m("elementProperties")))return;const t=u(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(m("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(m("properties"))){const t=this.properties,e=[...c(t),...h(t)];for(const i of e)this.createProperty(i,t[i])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const i=this._$Eu(t,e);void 0!==i&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(s(t))}else void 0!==t&&e.push(s(t));return e}static _$Eu(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const i=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((i,n)=>{if(e)i.adoptedStyleSheets=n.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const e of n){const n=document.createElement("style"),r=t.litNonce;void 0!==r&&n.setAttribute("nonce",r),n.textContent=e.cssText,i.appendChild(n)}})(i,this.constructor.elementStyles),i}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$ET(t,e){const i=this.constructor.elementProperties.get(t),n=this.constructor._$Eu(t,i);if(void 0!==n&&!0===i.reflect){const r=(void 0!==i.converter?.toAttribute?i.converter:f).toAttribute(e,i.type);this._$Em=t,null==r?this.removeAttribute(n):this.setAttribute(n,r),this._$Em=null}}_$AK(t,e){const i=this.constructor,n=i._$Eh.get(t);if(void 0!==n&&this._$Em!==n){const t=i.getPropertyOptions(n),r="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:f;this._$Em=n;const s=r.fromAttribute(e,t.type);this[n]=s??this._$Ej?.get(n)??s,this._$Em=null}}requestUpdate(t,e,i,n=!1,r){if(void 0!==t){const s=this.constructor;if(!1===n&&(r=this[t]),i??=s.getPropertyOptions(t),!((i.hasChanged??b)(r,e)||i.useDefault&&i.reflect&&r===this._$Ej?.get(t)&&!this.hasAttribute(s._$Eu(t,i))))return;this.C(t,e,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:i,reflect:n,wrapped:r},s){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,s??e??this[t]),!0!==r||void 0!==s)||(this._$AL.has(t)||(this.hasUpdated||i||(e=void 0),this._$AL.set(t,e)),!0===n&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,i]of t){const{wrapped:t}=i,n=this[e];!0!==t||this._$AL.has(e)||void 0===n||this.C(e,void 0,i,n)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(t){}firstUpdated(t){}};y.elementStyles=[],y.shadowRootOptions={mode:"open"},y[m("elementProperties")]=new Map,y[m("finalized")]=new Map,g?.({ReactiveElement:y}),(d.reactiveElementVersions??=[]).push("2.1.2");
|
|
/**
|
|
* @license
|
|
* Copyright 2017 Google LLC
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
const x=globalThis,_=t=>t,E=x.trustedTypes,S=E?E.createPolicy("lit-html",{createHTML:t=>t}):void 0,C="$lit$",w=`lit$${Math.random().toFixed(9).slice(2)}$`,M="?"+w,I=`<${M}>`,T=document,B=()=>T.createComment(""),R=t=>null===t||"object"!=typeof t&&"function"!=typeof t,D=Array.isArray,L="[ \t\n\f\r]",P=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,F=/-->/g,U=/>/g,N=RegExp(`>|${L}(?:([^\\s"'>=/]+)(${L}*=${L}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),O=/'/g,k=/"/g,Q=/^(?:script|style|textarea|title)$/i,G=(t=>(e,...i)=>({_$litType$:t,strings:e,values:i}))(1),z=Symbol.for("lit-noChange"),H=Symbol.for("lit-nothing"),V=new WeakMap,q=T.createTreeWalker(T,129);function j(t,e){if(!D(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==S?S.createHTML(e):e}const W=(t,e)=>{const i=t.length-1,n=[];let r,s=2===e?"<svg>":3===e?"<math>":"",a=P;for(let e=0;e<i;e++){const i=t[e];let o,l,c=-1,h=0;for(;h<i.length&&(a.lastIndex=h,l=a.exec(i),null!==l);)h=a.lastIndex,a===P?"!--"===l[1]?a=F:void 0!==l[1]?a=U:void 0!==l[2]?(Q.test(l[2])&&(r=RegExp("</"+l[2],"g")),a=N):void 0!==l[3]&&(a=N):a===N?">"===l[0]?(a=r??P,c=-1):void 0===l[1]?c=-2:(c=a.lastIndex-l[2].length,o=l[1],a=void 0===l[3]?N:'"'===l[3]?k:O):a===k||a===O?a=N:a===F||a===U?a=P:(a=N,r=void 0);const u=a===N&&t[e+1].startsWith("/>")?" ":"";s+=a===P?i+I:c>=0?(n.push(o),i.slice(0,c)+C+i.slice(c)+w+u):i+w+(-2===c?e:u)}return[j(t,s+(t[i]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),n]};let X=class t{constructor({strings:e,_$litType$:i},n){let r;this.parts=[];let s=0,a=0;const o=e.length-1,l=this.parts,[c,h]=W(e,i);if(this.el=t.createElement(c,n),q.currentNode=this.el.content,2===i||3===i){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(r=q.nextNode())&&l.length<o;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(C)){const e=h[a++],i=r.getAttribute(t).split(w),n=/([.?@])?(.*)/.exec(e);l.push({type:1,index:s,name:n[2],strings:i,ctor:"."===n[1]?Z:"?"===n[1]?tt:"@"===n[1]?et:$}),r.removeAttribute(t)}else t.startsWith(w)&&(l.push({type:6,index:s}),r.removeAttribute(t));if(Q.test(r.tagName)){const t=r.textContent.split(w),e=t.length-1;if(e>0){r.textContent=E?E.emptyScript:"";for(let i=0;i<e;i++)r.append(t[i],B()),q.nextNode(),l.push({type:2,index:++s});r.append(t[e],B())}}}else if(8===r.nodeType)if(r.data===M)l.push({type:2,index:s});else{let t=-1;for(;-1!==(t=r.data.indexOf(w,t+1));)l.push({type:7,index:s}),t+=w.length-1}s++}}static createElement(t,e){const i=T.createElement("template");return i.innerHTML=t,i}};function K(t,e,i=t,n){if(e===z)return e;let r=void 0!==n?i._$Co?.[n]:i._$Cl;const s=R(e)?void 0:e._$litDirective$;return r?.constructor!==s&&(r?._$AO?.(!1),void 0===s?r=void 0:(r=new s(t),r._$AT(t,i,n)),void 0!==n?(i._$Co??=[])[n]=r:i._$Cl=r),void 0!==r&&(e=K(t,r._$AS(t,e.values),r,n)),e}class J{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:i}=this._$AD,n=(t?.creationScope??T).importNode(e,!0);q.currentNode=n;let r=q.nextNode(),s=0,a=0,o=i[0];for(;void 0!==o;){if(s===o.index){let e;2===o.type?e=new Y(r,r.nextSibling,this,t):1===o.type?e=new o.ctor(r,o.name,o.strings,this,t):6===o.type&&(e=new it(r,this,t)),this._$AV.push(e),o=i[++a]}s!==o?.index&&(r=q.nextNode(),s++)}return q.currentNode=T,n}p(t){let e=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class Y{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,i,n){this.type=2,this._$AH=H,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=n,this._$Cv=n?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=K(this,t,e),R(t)?t===H||null==t||""===t?(this._$AH!==H&&this._$AR(),this._$AH=H):t!==this._$AH&&t!==z&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>D(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==H&&R(this._$AH)?this._$AA.nextSibling.data=t:this.T(T.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:i}=t,n="number"==typeof i?this._$AC(t):(void 0===i.el&&(i.el=X.createElement(j(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===n)this._$AH.p(e);else{const t=new J(n,this),i=t.u(this.options);t.p(e),this.T(i),this._$AH=t}}_$AC(t){let e=V.get(t.strings);return void 0===e&&V.set(t.strings,e=new X(t)),e}k(t){D(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,n=0;for(const r of t)n===e.length?e.push(i=new Y(this.O(B()),this.O(B()),this,this.options)):i=e[n],i._$AI(r),n++;n<e.length&&(this._$AR(i&&i._$AB.nextSibling,n),e.length=n)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=_(t).nextSibling;_(t).remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class ${get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,n,r){this.type=1,this._$AH=H,this._$AN=void 0,this.element=t,this.name=e,this._$AM=n,this.options=r,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=H}_$AI(t,e=this,i,n){const r=this.strings;let s=!1;if(void 0===r)t=K(this,t,e,0),s=!R(t)||t!==this._$AH&&t!==z,s&&(this._$AH=t);else{const n=t;let a,o;for(t=r[0],a=0;a<r.length-1;a++)o=K(this,n[i+a],e,a),o===z&&(o=this._$AH[a]),s||=!R(o)||o!==this._$AH[a],o===H?t=H:t!==H&&(t+=(o??"")+r[a+1]),this._$AH[a]=o}s&&!n&&this.j(t)}j(t){t===H?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}let Z=class extends ${constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===H?void 0:t}};class tt extends ${constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==H)}}class et extends ${constructor(t,e,i,n,r){super(t,e,i,n,r),this.type=5}_$AI(t,e=this){if((t=K(this,t,e,0)??H)===z)return;const i=this._$AH,n=t===H&&i!==H||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,r=t!==H&&(i===H||n);n&&this.element.removeEventListener(this.name,this,i),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class it{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){K(this,t)}}const nt=x.litHtmlPolyfillSupport;nt?.(X,Y),(x.litHtmlVersions??=[]).push("3.3.3");const rt=(t,e,i)=>{const n=i?.renderBefore??e;let r=n._$litPart$;if(void 0===r){const t=i?.renderBefore??null;n._$litPart$=r=new Y(e.insertBefore(B(),t),t,void 0,i??{})}return r._$AI(t),r
|
|
/**
|
|
* @license
|
|
* Copyright 2017 Google LLC
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/},st=globalThis;let at=class extends y{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=rt(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return z}};at._$litElement$=!0,at.finalized=!0,st.litElementHydrateSupport?.({LitElement:at});const ot=st.litElementPolyfillSupport;ot?.({LitElement:at}),(st.litElementVersions??=[]).push("4.2.2");
|
|
/**
|
|
* @license
|
|
* Copyright 2017 Google LLC
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
const lt={attribute:!0,type:String,converter:f,reflect:!1,hasChanged:b},ct=(t=lt,e,i)=>{const{kind:n,metadata:r}=i;let s=globalThis.litPropertyMetadata.get(r);if(void 0===s&&globalThis.litPropertyMetadata.set(r,s=new Map),"setter"===n&&((t=Object.create(t)).wrapped=!0),s.set(i.name,t),"accessor"===n){const{name:n}=i;return{set(i){const r=e.get.call(this);e.set.call(this,i),this.requestUpdate(n,r,t,!0,i)},init(e){return void 0!==e&&this.C(n,void 0,t,e),e}}}if("setter"===n){const{name:n}=i;return function(i){const r=this[n];e.call(this,i),this.requestUpdate(n,r,t,!0,i)}}throw Error("Unsupported decorator location: "+n)};function ht(t){return(e,i)=>"object"==typeof i?ct(t,e,i):((t,e,i)=>{const n=e.hasOwnProperty(i);return e.constructor.createProperty(i,t),n?Object.getOwnPropertyDescriptor(e,i):void 0})(t,e,i)}
|
|
/* @license
|
|
* Copyright 2026 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/var ut=function(t,e,i,n){for(var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n,o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};class dt extends y{constructor(){super(...arguments),this.src=null,this.offset=null,this.orientation=null,this.scale=null,this.background=!1}static get is(){return"extra-model"}updated(t){if(super.updated(t),t.has("src")||t.has("offset")||t.has("orientation")||t.has("scale")||t.has("background")){const e=t.has("src");this.dispatchEvent(new CustomEvent("extra-model-changed",{bubbles:!0,composed:!0,detail:{srcChanged:e,src:this.src,offset:this.offset,orientation:this.orientation,scale:this.scale,background:this.background}}))}}}ut([ht({type:String})],dt.prototype,"src",void 0),ut([ht({type:String})],dt.prototype,"offset",void 0),ut([ht({type:String})],dt.prototype,"orientation",void 0),ut([ht({type:String})],dt.prototype,"scale",void 0),ut([ht({type:Boolean})],dt.prototype,"background",void 0),customElements.define("extra-model",dt);
|
|
/**
|
|
* @license
|
|
* Copyright 2010-2026 Three.js Authors
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
const pt="183",At=1,gt=3,mt=0,ft=1,bt=2,vt=100,yt=101,xt=102,_t=200,Et=201,St=202,Ct=203,wt=204,Mt=205,It=206,Tt=207,Bt=208,Rt=209,Dt=210,Lt=211,Pt=212,Ft=213,Ut=214,Nt=0,Ot=1,kt=2,Qt=3,Gt=4,zt=5,Ht=6,Vt=7,qt=0,jt=1,Wt=2,Xt=1,Kt=2,Jt=3,Yt=4,$t=5,Zt=6,te=7,ee="attached",ie=300,ne=301,re=302,se=303,ae=304,oe=306,le=1e3,ce=1001,he=1002,ue=1003,de=1004,pe=1005,Ae=1006,ge=1007,me=1008,fe=1009,be=1010,ve=1011,ye=1012,xe=1013,_e=1014,Ee=1015,Se=1016,Ce=1017,we=1018,Me=1020,Ie=35902,Te=35899,Be=1022,Re=1023,De=1026,Le=1027,Pe=1028,Fe=1029,Ue=1030,Ne=1031,Oe=1033,ke=33776,Qe=33777,Ge=33778,ze=33779,He=35840,Ve=35841,qe=35842,je=35843,We=36196,Xe=37492,Ke=37496,Je=37488,Ye=37489,$e=37490,Ze=37491,ti=37808,ei=37809,ii=37810,ni=37811,ri=37812,si=37813,ai=37814,oi=37815,li=37816,ci=37817,hi=37818,ui=37819,di=37820,pi=37821,Ai=36492,gi=36494,mi=36495,fi=36283,bi=36284,vi=36285,yi=36286,xi=2200,_i=2201,Ei=2202,Si=2300,Ci=2301,wi=2302,Mi=2400,Ii=2401,Ti=2402,Bi=2500,Ri="",Di="srgb",Li="srgb-linear",Pi="linear",Fi="srgb",Ui=7680,Ni=512,Oi=513,ki=514,Qi=515,Gi=516,zi=517,Hi=518,Vi=519,qi=35044,ji="300 es",Wi=2e3,Xi=2001;function Ki(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function Ji(){const t=Ki("canvas");return t.style.display="block",t}const Yi={};function $i(...t){const e="THREE."+t.shift();console.log(e,...t)}function Zi(t){const e=t[0];if("string"==typeof e&&e.startsWith("TSL:")){const e=t[1];e&&e.isStackTrace?t[0]+=" "+e.getLocation():t[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return t}function tn(...t){const e="THREE."+(t=Zi(t)).shift();{const i=t[0];i&&i.isStackTrace?console.warn(i.getError(e)):console.warn(e,...t)}}function en(...t){const e="THREE."+(t=Zi(t)).shift();{const i=t[0];i&&i.isStackTrace?console.error(i.getError(e)):console.error(e,...t)}}function nn(...t){const e=t.join(" ");e in Yi||(Yi[e]=!0,tn(...t))}const rn={[Nt]:1,[kt]:6,[Gt]:7,[Qt]:5,[Ot]:0,[Ht]:2,[Vt]:4,[zt]:3};class sn{addEventListener(t,e){void 0===this._listeners&&(this._listeners={});const i=this._listeners;void 0===i[t]&&(i[t]=[]),-1===i[t].indexOf(e)&&i[t].push(e)}hasEventListener(t,e){const i=this._listeners;return void 0!==i&&(void 0!==i[t]&&-1!==i[t].indexOf(e))}removeEventListener(t,e){const i=this._listeners;if(void 0===i)return;const n=i[t];if(void 0!==n){const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}dispatchEvent(t){const e=this._listeners;if(void 0===e)return;const i=e[t.type];if(void 0!==i){t.target=this;const e=i.slice(0);for(let i=0,n=e.length;i<n;i++)e[i].call(this,t);t.target=null}}}const an=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let on=1234567;const ln=Math.PI/180,cn=180/Math.PI;function hn(){const t=4294967295*Math.random()|0,e=4294967295*Math.random()|0,i=4294967295*Math.random()|0,n=4294967295*Math.random()|0;return(an[255&t]+an[t>>8&255]+an[t>>16&255]+an[t>>24&255]+"-"+an[255&e]+an[e>>8&255]+"-"+an[e>>16&15|64]+an[e>>24&255]+"-"+an[63&i|128]+an[i>>8&255]+"-"+an[i>>16&255]+an[i>>24&255]+an[255&n]+an[n>>8&255]+an[n>>16&255]+an[n>>24&255]).toLowerCase()}function un(t,e,i){return Math.max(e,Math.min(i,t))}function dn(t,e){return(t%e+e)%e}function pn(t,e,i){return(1-i)*t+i*e}function An(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function gn(t,e){switch(e.constructor){case Float32Array:return t;case Uint32Array:return Math.round(4294967295*t);case Uint16Array:return Math.round(65535*t);case Uint8Array:return Math.round(255*t);case Int32Array:return Math.round(2147483647*t);case Int16Array:return Math.round(32767*t);case Int8Array:return Math.round(127*t);default:throw new Error("Invalid component type.")}}const mn={DEG2RAD:ln,RAD2DEG:cn,generateUUID:hn,clamp:un,euclideanModulo:dn,mapLinear:function(t,e,i,n,r){return n+(t-e)*(r-n)/(i-e)},inverseLerp:function(t,e,i){return t!==e?(i-t)/(e-t):0},lerp:pn,damp:function(t,e,i,n){return pn(t,e,1-Math.exp(-i*n))},pingpong:function(t,e=1){return e-Math.abs(dn(t,2*e)-e)},smoothstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*(3-2*t)},smootherstep:function(t,e,i){return t<=e?0:t>=i?1:(t=(t-e)/(i-e))*t*t*(t*(6*t-15)+10)},randInt:function(t,e){return t+Math.floor(Math.random()*(e-t+1))},randFloat:function(t,e){return t+Math.random()*(e-t)},randFloatSpread:function(t){return t*(.5-Math.random())},seededRandom:function(t){void 0!==t&&(on=t);let e=on+=1831565813;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296},degToRad:function(t){return t*ln},radToDeg:function(t){return t*cn},isPowerOfTwo:function(t){return!(t&t-1)&&0!==t},ceilPowerOfTwo:function(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))},floorPowerOfTwo:function(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))},setQuaternionFromProperEuler:function(t,e,i,n,r){const s=Math.cos,a=Math.sin,o=s(i/2),l=a(i/2),c=s((e+n)/2),h=a((e+n)/2),u=s((e-n)/2),d=a((e-n)/2),p=s((n-e)/2),A=a((n-e)/2);switch(r){case"XYX":t.set(o*h,l*u,l*d,o*c);break;case"YZY":t.set(l*d,o*h,l*u,o*c);break;case"ZXZ":t.set(l*u,l*d,o*h,o*c);break;case"XZX":t.set(o*h,l*A,l*p,o*c);break;case"YXY":t.set(l*p,o*h,l*A,o*c);break;case"ZYZ":t.set(l*A,l*p,o*h,o*c);break;default:tn("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+r)}},normalize:gn,denormalize:An};class fn{constructor(t=0,e=0){fn.prototype.isVector2=!0,this.x=t,this.y=e}get width(){return this.x}set width(t){this.x=t}get height(){return this.y}set height(t){this.y=t}set(t,e){return this.x=t,this.y=e,this}setScalar(t){return this.x=t,this.y=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y)}copy(t){return this.x=t.x,this.y=t.y,this}add(t){return this.x+=t.x,this.y+=t.y,this}addScalar(t){return this.x+=t,this.y+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this}subScalar(t){return this.x-=t,this.y-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}multiplyScalar(t){return this.x*=t,this.y*=t,this}divide(t){return this.x/=t.x,this.y/=t.y,this}divideScalar(t){return this.multiplyScalar(1/t)}applyMatrix3(t){const e=this.x,i=this.y,n=t.elements;return this.x=n[0]*e+n[3]*i+n[6],this.y=n[1]*e+n[4]*i+n[7],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this}clamp(t,e){return this.x=un(this.x,t.x,e.x),this.y=un(this.y,t.y,e.y),this}clampScalar(t,e){return this.x=un(this.x,t,e),this.y=un(this.y,t,e),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(un(i,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(t){return this.x*t.x+this.y*t.y}cross(t){return this.x*t.y-this.y*t.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(un(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y;return e*e+i*i}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this}equals(t){return t.x===this.x&&t.y===this.y}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this}rotateAround(t,e){const i=Math.cos(e),n=Math.sin(e),r=this.x-t.x,s=this.y-t.y;return this.x=r*i-s*n+t.x,this.y=r*n+s*i+t.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class bn{constructor(t=0,e=0,i=0,n=1){this.isQuaternion=!0,this._x=t,this._y=e,this._z=i,this._w=n}static slerpFlat(t,e,i,n,r,s,a){let o=i[n+0],l=i[n+1],c=i[n+2],h=i[n+3],u=r[s+0],d=r[s+1],p=r[s+2],A=r[s+3];if(h!==A||o!==u||l!==d||c!==p){let t=o*u+l*d+c*p+h*A;t<0&&(u=-u,d=-d,p=-p,A=-A,t=-t);let e=1-a;if(t<.9995){const i=Math.acos(t),n=Math.sin(i);e=Math.sin(e*i)/n,o=o*e+u*(a=Math.sin(a*i)/n),l=l*e+d*a,c=c*e+p*a,h=h*e+A*a}else{o=o*e+u*a,l=l*e+d*a,c=c*e+p*a,h=h*e+A*a;const t=1/Math.sqrt(o*o+l*l+c*c+h*h);o*=t,l*=t,c*=t,h*=t}}t[e]=o,t[e+1]=l,t[e+2]=c,t[e+3]=h}static multiplyQuaternionsFlat(t,e,i,n,r,s){const a=i[n],o=i[n+1],l=i[n+2],c=i[n+3],h=r[s],u=r[s+1],d=r[s+2],p=r[s+3];return t[e]=a*p+c*h+o*d-l*u,t[e+1]=o*p+c*u+l*h-a*d,t[e+2]=l*p+c*d+a*u-o*h,t[e+3]=c*p-a*h-o*u-l*d,t}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get w(){return this._w}set w(t){this._w=t,this._onChangeCallback()}set(t,e,i,n){return this._x=t,this._y=e,this._z=i,this._w=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(t){return this._x=t.x,this._y=t.y,this._z=t.z,this._w=t.w,this._onChangeCallback(),this}setFromEuler(t,e=!0){const i=t._x,n=t._y,r=t._z,s=t._order,a=Math.cos,o=Math.sin,l=a(i/2),c=a(n/2),h=a(r/2),u=o(i/2),d=o(n/2),p=o(r/2);switch(s){case"XYZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"YXZ":this._x=u*c*h+l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"ZXY":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h-u*d*p;break;case"ZYX":this._x=u*c*h-l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h+u*d*p;break;case"YZX":this._x=u*c*h+l*d*p,this._y=l*d*h+u*c*p,this._z=l*c*p-u*d*h,this._w=l*c*h-u*d*p;break;case"XZY":this._x=u*c*h-l*d*p,this._y=l*d*h-u*c*p,this._z=l*c*p+u*d*h,this._w=l*c*h+u*d*p;break;default:tn("Quaternion: .setFromEuler() encountered an unknown order: "+s)}return!0===e&&this._onChangeCallback(),this}setFromAxisAngle(t,e){const i=e/2,n=Math.sin(i);return this._x=t.x*n,this._y=t.y*n,this._z=t.z*n,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(t){const e=t.elements,i=e[0],n=e[4],r=e[8],s=e[1],a=e[5],o=e[9],l=e[2],c=e[6],h=e[10],u=i+a+h;if(u>0){const t=.5/Math.sqrt(u+1);this._w=.25/t,this._x=(c-o)*t,this._y=(r-l)*t,this._z=(s-n)*t}else if(i>a&&i>h){const t=2*Math.sqrt(1+i-a-h);this._w=(c-o)/t,this._x=.25*t,this._y=(n+s)/t,this._z=(r+l)/t}else if(a>h){const t=2*Math.sqrt(1+a-i-h);this._w=(r-l)/t,this._x=(n+s)/t,this._y=.25*t,this._z=(o+c)/t}else{const t=2*Math.sqrt(1+h-i-a);this._w=(s-n)/t,this._x=(r+l)/t,this._y=(o+c)/t,this._z=.25*t}return this._onChangeCallback(),this}setFromUnitVectors(t,e){let i=t.dot(e)+1;return i<1e-8?(i=0,Math.abs(t.x)>Math.abs(t.z)?(this._x=-t.y,this._y=t.x,this._z=0,this._w=i):(this._x=0,this._y=-t.z,this._z=t.y,this._w=i)):(this._x=t.y*e.z-t.z*e.y,this._y=t.z*e.x-t.x*e.z,this._z=t.x*e.y-t.y*e.x,this._w=i),this.normalize()}angleTo(t){return 2*Math.acos(Math.abs(un(this.dot(t),-1,1)))}rotateTowards(t,e){const i=this.angleTo(t);if(0===i)return this;const n=Math.min(1,e/i);return this.slerp(t,n),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(t){return this._x*t._x+this._y*t._y+this._z*t._z+this._w*t._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let t=this.length();return 0===t?(this._x=0,this._y=0,this._z=0,this._w=1):(t=1/t,this._x=this._x*t,this._y=this._y*t,this._z=this._z*t,this._w=this._w*t),this._onChangeCallback(),this}multiply(t){return this.multiplyQuaternions(this,t)}premultiply(t){return this.multiplyQuaternions(t,this)}multiplyQuaternions(t,e){const i=t._x,n=t._y,r=t._z,s=t._w,a=e._x,o=e._y,l=e._z,c=e._w;return this._x=i*c+s*a+n*l-r*o,this._y=n*c+s*o+r*a-i*l,this._z=r*c+s*l+i*o-n*a,this._w=s*c-i*a-n*o-r*l,this._onChangeCallback(),this}slerp(t,e){let i=t._x,n=t._y,r=t._z,s=t._w,a=this.dot(t);a<0&&(i=-i,n=-n,r=-r,s=-s,a=-a);let o=1-e;if(a<.9995){const t=Math.acos(a),l=Math.sin(t);o=Math.sin(o*t)/l,e=Math.sin(e*t)/l,this._x=this._x*o+i*e,this._y=this._y*o+n*e,this._z=this._z*o+r*e,this._w=this._w*o+s*e,this._onChangeCallback()}else this._x=this._x*o+i*e,this._y=this._y*o+n*e,this._z=this._z*o+r*e,this._w=this._w*o+s*e,this.normalize();return this}slerpQuaternions(t,e,i){return this.copy(t).slerp(e,i)}random(){const t=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),i=Math.random(),n=Math.sqrt(1-i),r=Math.sqrt(i);return this.set(n*Math.sin(t),n*Math.cos(t),r*Math.sin(e),r*Math.cos(e))}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._w===this._w}fromArray(t,e=0){return this._x=t[e],this._y=t[e+1],this._z=t[e+2],this._w=t[e+3],this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._w,t}fromBufferAttribute(t,e){return this._x=t.getX(e),this._y=t.getY(e),this._z=t.getZ(e),this._w=t.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class vn{constructor(t=0,e=0,i=0){vn.prototype.isVector3=!0,this.x=t,this.y=e,this.z=i}set(t,e,i){return void 0===i&&(i=this.z),this.x=t,this.y=e,this.z=i,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this}multiplyVectors(t,e){return this.x=t.x*e.x,this.y=t.y*e.y,this.z=t.z*e.z,this}applyEuler(t){return this.applyQuaternion(xn.setFromEuler(t))}applyAxisAngle(t,e){return this.applyQuaternion(xn.setFromAxisAngle(t,e))}applyMatrix3(t){const e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[3]*i+r[6]*n,this.y=r[1]*e+r[4]*i+r[7]*n,this.z=r[2]*e+r[5]*i+r[8]*n,this}applyNormalMatrix(t){return this.applyMatrix3(t).normalize()}applyMatrix4(t){const e=this.x,i=this.y,n=this.z,r=t.elements,s=1/(r[3]*e+r[7]*i+r[11]*n+r[15]);return this.x=(r[0]*e+r[4]*i+r[8]*n+r[12])*s,this.y=(r[1]*e+r[5]*i+r[9]*n+r[13])*s,this.z=(r[2]*e+r[6]*i+r[10]*n+r[14])*s,this}applyQuaternion(t){const e=this.x,i=this.y,n=this.z,r=t.x,s=t.y,a=t.z,o=t.w,l=2*(s*n-a*i),c=2*(a*e-r*n),h=2*(r*i-s*e);return this.x=e+o*l+s*h-a*c,this.y=i+o*c+a*l-r*h,this.z=n+o*h+r*c-s*l,this}project(t){return this.applyMatrix4(t.matrixWorldInverse).applyMatrix4(t.projectionMatrix)}unproject(t){return this.applyMatrix4(t.projectionMatrixInverse).applyMatrix4(t.matrixWorld)}transformDirection(t){const e=this.x,i=this.y,n=this.z,r=t.elements;return this.x=r[0]*e+r[4]*i+r[8]*n,this.y=r[1]*e+r[5]*i+r[9]*n,this.z=r[2]*e+r[6]*i+r[10]*n,this.normalize()}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this}divideScalar(t){return this.multiplyScalar(1/t)}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this}clamp(t,e){return this.x=un(this.x,t.x,e.x),this.y=un(this.y,t.y,e.y),this.z=un(this.z,t.z,e.z),this}clampScalar(t,e){return this.x=un(this.x,t,e),this.y=un(this.y,t,e),this.z=un(this.z,t,e),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(un(i,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this}cross(t){return this.crossVectors(this,t)}crossVectors(t,e){const i=t.x,n=t.y,r=t.z,s=e.x,a=e.y,o=e.z;return this.x=n*o-r*a,this.y=r*s-i*o,this.z=i*a-n*s,this}projectOnVector(t){const e=t.lengthSq();if(0===e)return this.set(0,0,0);const i=t.dot(this)/e;return this.copy(t).multiplyScalar(i)}projectOnPlane(t){return yn.copy(this).projectOnVector(t),this.sub(yn)}reflect(t){return this.sub(yn.copy(t).multiplyScalar(2*this.dot(t)))}angleTo(t){const e=Math.sqrt(this.lengthSq()*t.lengthSq());if(0===e)return Math.PI/2;const i=this.dot(t)/e;return Math.acos(un(i,-1,1))}distanceTo(t){return Math.sqrt(this.distanceToSquared(t))}distanceToSquared(t){const e=this.x-t.x,i=this.y-t.y,n=this.z-t.z;return e*e+i*i+n*n}manhattanDistanceTo(t){return Math.abs(this.x-t.x)+Math.abs(this.y-t.y)+Math.abs(this.z-t.z)}setFromSpherical(t){return this.setFromSphericalCoords(t.radius,t.phi,t.theta)}setFromSphericalCoords(t,e,i){const n=Math.sin(e)*t;return this.x=n*Math.sin(i),this.y=Math.cos(e)*t,this.z=n*Math.cos(i),this}setFromCylindrical(t){return this.setFromCylindricalCoords(t.radius,t.theta,t.y)}setFromCylindricalCoords(t,e,i){return this.x=t*Math.sin(e),this.y=i,this.z=t*Math.cos(e),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(t){const e=this.setFromMatrixColumn(t,0).length(),i=this.setFromMatrixColumn(t,1).length(),n=this.setFromMatrixColumn(t,2).length();return this.x=e,this.y=i,this.z=n,this}setFromMatrixColumn(t,e){return this.fromArray(t.elements,4*e)}setFromMatrix3Column(t,e){return this.fromArray(t.elements,3*e)}setFromEuler(t){return this.x=t._x,this.y=t._y,this.z=t._z,this}setFromColor(t){return this.x=t.r,this.y=t.g,this.z=t.b,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const t=Math.random()*Math.PI*2,e=2*Math.random()-1,i=Math.sqrt(1-e*e);return this.x=i*Math.cos(t),this.y=e,this.z=i*Math.sin(t),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const yn=new vn,xn=new bn;class _n{constructor(t,e,i,n,r,s,a,o,l){_n.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],void 0!==t&&this.set(t,e,i,n,r,s,a,o,l)}set(t,e,i,n,r,s,a,o,l){const c=this.elements;return c[0]=t,c[1]=n,c[2]=a,c[3]=e,c[4]=r,c[5]=o,c[6]=i,c[7]=s,c[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(t,e,i){return t.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(t){const e=t.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,n=e.elements,r=this.elements,s=i[0],a=i[3],o=i[6],l=i[1],c=i[4],h=i[7],u=i[2],d=i[5],p=i[8],A=n[0],g=n[3],m=n[6],f=n[1],b=n[4],v=n[7],y=n[2],x=n[5],_=n[8];return r[0]=s*A+a*f+o*y,r[3]=s*g+a*b+o*x,r[6]=s*m+a*v+o*_,r[1]=l*A+c*f+h*y,r[4]=l*g+c*b+h*x,r[7]=l*m+c*v+h*_,r[2]=u*A+d*f+p*y,r[5]=u*g+d*b+p*x,r[8]=u*m+d*v+p*_,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[3]*=t,e[6]*=t,e[1]*=t,e[4]*=t,e[7]*=t,e[2]*=t,e[5]*=t,e[8]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],c=t[8];return e*s*c-e*a*l-i*r*c+i*a*o+n*r*l-n*s*o}invert(){const t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],c=t[8],h=c*s-a*l,u=a*o-c*r,d=l*r-s*o,p=e*h+i*u+n*d;if(0===p)return this.set(0,0,0,0,0,0,0,0,0);const A=1/p;return t[0]=h*A,t[1]=(n*l-c*i)*A,t[2]=(a*i-n*s)*A,t[3]=u*A,t[4]=(c*e-n*o)*A,t[5]=(n*r-a*e)*A,t[6]=d*A,t[7]=(i*o-l*e)*A,t[8]=(s*e-i*r)*A,this}transpose(){let t;const e=this.elements;return t=e[1],e[1]=e[3],e[3]=t,t=e[2],e[2]=e[6],e[6]=t,t=e[5],e[5]=e[7],e[7]=t,this}getNormalMatrix(t){return this.setFromMatrix4(t).invert().transpose()}transposeIntoArray(t){const e=this.elements;return t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8],this}setUvTransform(t,e,i,n,r,s,a){const o=Math.cos(r),l=Math.sin(r);return this.set(i*o,i*l,-i*(o*s+l*a)+s+t,-n*l,n*o,-n*(-l*s+o*a)+a+e,0,0,1),this}scale(t,e){return this.premultiply(En.makeScale(t,e)),this}rotate(t){return this.premultiply(En.makeRotation(-t)),this}translate(t,e){return this.premultiply(En.makeTranslation(t,e)),this}makeTranslation(t,e){return t.isVector2?this.set(1,0,t.x,0,1,t.y,0,0,1):this.set(1,0,t,0,1,e,0,0,1),this}makeRotation(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,i,e,0,0,0,1),this}makeScale(t,e){return this.set(t,0,0,0,e,0,0,0,1),this}equals(t){const e=this.elements,i=t.elements;for(let t=0;t<9;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<9;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t}clone(){return(new this.constructor).fromArray(this.elements)}}const En=new _n,Sn=(new _n).set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Cn=(new _n).set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function wn(){const t={enabled:!0,workingColorSpace:Li,spaces:{},convert:function(t,e,i){return!1!==this.enabled&&e!==i&&e&&i?(this.spaces[e].transfer===Fi&&(t.r=In(t.r),t.g=In(t.g),t.b=In(t.b)),this.spaces[e].primaries!==this.spaces[i].primaries&&(t.applyMatrix3(this.spaces[e].toXYZ),t.applyMatrix3(this.spaces[i].fromXYZ)),this.spaces[i].transfer===Fi&&(t.r=Tn(t.r),t.g=Tn(t.g),t.b=Tn(t.b)),t):t},workingToColorSpace:function(t,e){return this.convert(t,this.workingColorSpace,e)},colorSpaceToWorking:function(t,e){return this.convert(t,e,this.workingColorSpace)},getPrimaries:function(t){return this.spaces[t].primaries},getTransfer:function(t){return t===Ri?Pi:this.spaces[t].transfer},getToneMappingMode:function(t){return this.spaces[t].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(t,e=this.workingColorSpace){return t.fromArray(this.spaces[e].luminanceCoefficients)},define:function(t){Object.assign(this.spaces,t)},_getMatrix:function(t,e,i){return t.copy(this.spaces[e].toXYZ).multiply(this.spaces[i].fromXYZ)},_getDrawingBufferColorSpace:function(t){return this.spaces[t].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(t=this.workingColorSpace){return this.spaces[t].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(e,i){return nn("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),t.workingToColorSpace(e,i)},toWorkingColorSpace:function(e,i){return nn("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),t.colorSpaceToWorking(e,i)}},e=[.64,.33,.3,.6,.15,.06],i=[.2126,.7152,.0722],n=[.3127,.329];return t.define({[Li]:{primaries:e,whitePoint:n,transfer:Pi,toXYZ:Sn,fromXYZ:Cn,luminanceCoefficients:i,workingColorSpaceConfig:{unpackColorSpace:Di},outputColorSpaceConfig:{drawingBufferColorSpace:Di}},[Di]:{primaries:e,whitePoint:n,transfer:Fi,toXYZ:Sn,fromXYZ:Cn,luminanceCoefficients:i,outputColorSpaceConfig:{drawingBufferColorSpace:Di}}}),t}const Mn=wn();function In(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Tn(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}let Bn;class Rn{static getDataURL(t,e="image/png"){if(/^data:/i.test(t.src))return t.src;if("undefined"==typeof HTMLCanvasElement)return t.src;let i;if(t instanceof HTMLCanvasElement)i=t;else{void 0===Bn&&(Bn=Ki("canvas")),Bn.width=t.width,Bn.height=t.height;const e=Bn.getContext("2d");t instanceof ImageData?e.putImageData(t,0,0):e.drawImage(t,0,0,t.width,t.height),i=Bn}return i.toDataURL(e)}static sRGBToLinear(t){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const e=Ki("canvas");e.width=t.width,e.height=t.height;const i=e.getContext("2d");i.drawImage(t,0,0,t.width,t.height);const n=i.getImageData(0,0,t.width,t.height),r=n.data;for(let t=0;t<r.length;t++)r[t]=255*In(r[t]/255);return i.putImageData(n,0,0),e}if(t.data){const e=t.data.slice(0);for(let t=0;t<e.length;t++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[t]=Math.floor(255*In(e[t]/255)):e[t]=In(e[t]);return{data:e,width:t.width,height:t.height}}return tn("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),t}}let Dn=0;class Ln{constructor(t=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Dn++}),this.uuid=hn(),this.data=t,this.dataReady=!0,this.version=0}getSize(t){const e=this.data;return"undefined"!=typeof HTMLVideoElement&&e instanceof HTMLVideoElement?t.set(e.videoWidth,e.videoHeight,0):"undefined"!=typeof VideoFrame&&e instanceof VideoFrame?t.set(e.displayHeight,e.displayWidth,0):null!==e?t.set(e.width,e.height,e.depth||0):t.set(0,0,0),t}set needsUpdate(t){!0===t&&this.version++}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.images[this.uuid])return t.images[this.uuid];const i={uuid:this.uuid,url:""},n=this.data;if(null!==n){let t;if(Array.isArray(n)){t=[];for(let e=0,i=n.length;e<i;e++)n[e].isDataTexture?t.push(Pn(n[e].image)):t.push(Pn(n[e]))}else t=Pn(n);i.url=t}return e||(t.images[this.uuid]=i),i}}function Pn(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap?Rn.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:(tn("Texture: Unable to serialize Texture."),{})}let Fn=0;const Un=new vn;let Nn=class t extends sn{constructor(e=t.DEFAULT_IMAGE,i=t.DEFAULT_MAPPING,n=1001,r=1001,s=1006,a=1008,o=1023,l=fe,c=t.DEFAULT_ANISOTROPY,h=""){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:Fn++}),this.uuid=hn(),this.name="",this.source=new Ln(e),this.mipmaps=[],this.mapping=i,this.channel=0,this.wrapS=n,this.wrapT=r,this.magFilter=s,this.minFilter=a,this.anisotropy=c,this.format=o,this.internalFormat=null,this.type=l,this.offset=new fn(0,0),this.repeat=new fn(1,1),this.center=new fn(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new _n,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(Un).x}get height(){return this.source.getSize(Un).y}get depth(){return this.source.getSize(Un).z}get image(){return this.source.data}set image(t=null){this.source.data=t}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return(new this.constructor).copy(this)}copy(t){return this.name=t.name,this.source=t.source,this.mipmaps=t.mipmaps.slice(0),this.mapping=t.mapping,this.channel=t.channel,this.wrapS=t.wrapS,this.wrapT=t.wrapT,this.magFilter=t.magFilter,this.minFilter=t.minFilter,this.anisotropy=t.anisotropy,this.format=t.format,this.internalFormat=t.internalFormat,this.type=t.type,this.offset.copy(t.offset),this.repeat.copy(t.repeat),this.center.copy(t.center),this.rotation=t.rotation,this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrix.copy(t.matrix),this.generateMipmaps=t.generateMipmaps,this.premultiplyAlpha=t.premultiplyAlpha,this.flipY=t.flipY,this.unpackAlignment=t.unpackAlignment,this.colorSpace=t.colorSpace,this.renderTarget=t.renderTarget,this.isRenderTargetTexture=t.isRenderTargetTexture,this.isArrayTexture=t.isArrayTexture,this.userData=JSON.parse(JSON.stringify(t.userData)),this.needsUpdate=!0,this}setValues(t){for(const e in t){const i=t[e];if(void 0===i){tn(`Texture.setValues(): parameter '${e}' has value of undefined.`);continue}const n=this[e];void 0!==n?n&&i&&n.isVector2&&i.isVector2||n&&i&&n.isVector3&&i.isVector3||n&&i&&n.isMatrix3&&i.isMatrix3?n.copy(i):this[e]=i:tn(`Texture.setValues(): property '${e}' does not exist.`)}}toJSON(t){const e=void 0===t||"string"==typeof t;if(!e&&void 0!==t.textures[this.uuid])return t.textures[this.uuid];const i={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(t).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),e||(t.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(t){if(this.mapping!==ie)return t;if(t.applyMatrix3(this.matrix),t.x<0||t.x>1)switch(this.wrapS){case le:t.x=t.x-Math.floor(t.x);break;case ce:t.x=t.x<0?0:1;break;case he:1===Math.abs(Math.floor(t.x)%2)?t.x=Math.ceil(t.x)-t.x:t.x=t.x-Math.floor(t.x)}if(t.y<0||t.y>1)switch(this.wrapT){case le:t.y=t.y-Math.floor(t.y);break;case ce:t.y=t.y<0?0:1;break;case he:1===Math.abs(Math.floor(t.y)%2)?t.y=Math.ceil(t.y)-t.y:t.y=t.y-Math.floor(t.y)}return this.flipY&&(t.y=1-t.y),t}set needsUpdate(t){!0===t&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(t){!0===t&&this.pmremVersion++}};Nn.DEFAULT_IMAGE=null,Nn.DEFAULT_MAPPING=ie,Nn.DEFAULT_ANISOTROPY=1;class On{constructor(t=0,e=0,i=0,n=1){On.prototype.isVector4=!0,this.x=t,this.y=e,this.z=i,this.w=n}get width(){return this.z}set width(t){this.z=t}get height(){return this.w}set height(t){this.w=t}set(t,e,i,n){return this.x=t,this.y=e,this.z=i,this.w=n,this}setScalar(t){return this.x=t,this.y=t,this.z=t,this.w=t,this}setX(t){return this.x=t,this}setY(t){return this.y=t,this}setZ(t){return this.z=t,this}setW(t){return this.w=t,this}setComponent(t,e){switch(t){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+t)}return this}getComponent(t){switch(t){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+t)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(t){return this.x=t.x,this.y=t.y,this.z=t.z,this.w=void 0!==t.w?t.w:1,this}add(t){return this.x+=t.x,this.y+=t.y,this.z+=t.z,this.w+=t.w,this}addScalar(t){return this.x+=t,this.y+=t,this.z+=t,this.w+=t,this}addVectors(t,e){return this.x=t.x+e.x,this.y=t.y+e.y,this.z=t.z+e.z,this.w=t.w+e.w,this}addScaledVector(t,e){return this.x+=t.x*e,this.y+=t.y*e,this.z+=t.z*e,this.w+=t.w*e,this}sub(t){return this.x-=t.x,this.y-=t.y,this.z-=t.z,this.w-=t.w,this}subScalar(t){return this.x-=t,this.y-=t,this.z-=t,this.w-=t,this}subVectors(t,e){return this.x=t.x-e.x,this.y=t.y-e.y,this.z=t.z-e.z,this.w=t.w-e.w,this}multiply(t){return this.x*=t.x,this.y*=t.y,this.z*=t.z,this.w*=t.w,this}multiplyScalar(t){return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this}applyMatrix4(t){const e=this.x,i=this.y,n=this.z,r=this.w,s=t.elements;return this.x=s[0]*e+s[4]*i+s[8]*n+s[12]*r,this.y=s[1]*e+s[5]*i+s[9]*n+s[13]*r,this.z=s[2]*e+s[6]*i+s[10]*n+s[14]*r,this.w=s[3]*e+s[7]*i+s[11]*n+s[15]*r,this}divide(t){return this.x/=t.x,this.y/=t.y,this.z/=t.z,this.w/=t.w,this}divideScalar(t){return this.multiplyScalar(1/t)}setAxisAngleFromQuaternion(t){this.w=2*Math.acos(t.w);const e=Math.sqrt(1-t.w*t.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=t.x/e,this.y=t.y/e,this.z=t.z/e),this}setAxisAngleFromRotationMatrix(t){let e,i,n,r;const s=.01,a=.1,o=t.elements,l=o[0],c=o[4],h=o[8],u=o[1],d=o[5],p=o[9],A=o[2],g=o[6],m=o[10];if(Math.abs(c-u)<s&&Math.abs(h-A)<s&&Math.abs(p-g)<s){if(Math.abs(c+u)<a&&Math.abs(h+A)<a&&Math.abs(p+g)<a&&Math.abs(l+d+m-3)<a)return this.set(1,0,0,0),this;e=Math.PI;const t=(l+1)/2,o=(d+1)/2,f=(m+1)/2,b=(c+u)/4,v=(h+A)/4,y=(p+g)/4;return t>o&&t>f?t<s?(i=0,n=.707106781,r=.707106781):(i=Math.sqrt(t),n=b/i,r=v/i):o>f?o<s?(i=.707106781,n=0,r=.707106781):(n=Math.sqrt(o),i=b/n,r=y/n):f<s?(i=.707106781,n=.707106781,r=0):(r=Math.sqrt(f),i=v/r,n=y/r),this.set(i,n,r,e),this}let f=Math.sqrt((g-p)*(g-p)+(h-A)*(h-A)+(u-c)*(u-c));return Math.abs(f)<.001&&(f=1),this.x=(g-p)/f,this.y=(h-A)/f,this.z=(u-c)/f,this.w=Math.acos((l+d+m-1)/2),this}setFromMatrixPosition(t){const e=t.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(t){return this.x=Math.min(this.x,t.x),this.y=Math.min(this.y,t.y),this.z=Math.min(this.z,t.z),this.w=Math.min(this.w,t.w),this}max(t){return this.x=Math.max(this.x,t.x),this.y=Math.max(this.y,t.y),this.z=Math.max(this.z,t.z),this.w=Math.max(this.w,t.w),this}clamp(t,e){return this.x=un(this.x,t.x,e.x),this.y=un(this.y,t.y,e.y),this.z=un(this.z,t.z,e.z),this.w=un(this.w,t.w,e.w),this}clampScalar(t,e){return this.x=un(this.x,t,e),this.y=un(this.y,t,e),this.z=un(this.z,t,e),this.w=un(this.w,t,e),this}clampLength(t,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(un(i,t,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(t){return this.x*t.x+this.y*t.y+this.z*t.z+this.w*t.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(t){return this.normalize().multiplyScalar(t)}lerp(t,e){return this.x+=(t.x-this.x)*e,this.y+=(t.y-this.y)*e,this.z+=(t.z-this.z)*e,this.w+=(t.w-this.w)*e,this}lerpVectors(t,e,i){return this.x=t.x+(e.x-t.x)*i,this.y=t.y+(e.y-t.y)*i,this.z=t.z+(e.z-t.z)*i,this.w=t.w+(e.w-t.w)*i,this}equals(t){return t.x===this.x&&t.y===this.y&&t.z===this.z&&t.w===this.w}fromArray(t,e=0){return this.x=t[e],this.y=t[e+1],this.z=t[e+2],this.w=t[e+3],this}toArray(t=[],e=0){return t[e]=this.x,t[e+1]=this.y,t[e+2]=this.z,t[e+3]=this.w,t}fromBufferAttribute(t,e){return this.x=t.getX(e),this.y=t.getY(e),this.z=t.getZ(e),this.w=t.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class kn extends sn{constructor(t=1,e=1,i={}){super(),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Ae,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},i),this.isRenderTarget=!0,this.width=t,this.height=e,this.depth=i.depth,this.scissor=new On(0,0,t,e),this.scissorTest=!1,this.viewport=new On(0,0,t,e),this.textures=[];const n={width:t,height:e,depth:i.depth},r=new Nn(n),s=i.count;for(let t=0;t<s;t++)this.textures[t]=r.clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;this._setTextureOptions(i),this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=i.depthTexture,this.samples=i.samples,this.multiview=i.multiview}_setTextureOptions(t={}){const e={minFilter:Ae,generateMipmaps:!1,flipY:!1,internalFormat:null};void 0!==t.mapping&&(e.mapping=t.mapping),void 0!==t.wrapS&&(e.wrapS=t.wrapS),void 0!==t.wrapT&&(e.wrapT=t.wrapT),void 0!==t.wrapR&&(e.wrapR=t.wrapR),void 0!==t.magFilter&&(e.magFilter=t.magFilter),void 0!==t.minFilter&&(e.minFilter=t.minFilter),void 0!==t.format&&(e.format=t.format),void 0!==t.type&&(e.type=t.type),void 0!==t.anisotropy&&(e.anisotropy=t.anisotropy),void 0!==t.colorSpace&&(e.colorSpace=t.colorSpace),void 0!==t.flipY&&(e.flipY=t.flipY),void 0!==t.generateMipmaps&&(e.generateMipmaps=t.generateMipmaps),void 0!==t.internalFormat&&(e.internalFormat=t.internalFormat);for(let t=0;t<this.textures.length;t++){this.textures[t].setValues(e)}}get texture(){return this.textures[0]}set texture(t){this.textures[0]=t}set depthTexture(t){null!==this._depthTexture&&(this._depthTexture.renderTarget=null),null!==t&&(t.renderTarget=this),this._depthTexture=t}get depthTexture(){return this._depthTexture}setSize(t,e,i=1){if(this.width!==t||this.height!==e||this.depth!==i){this.width=t,this.height=e,this.depth=i;for(let n=0,r=this.textures.length;n<r;n++)this.textures[n].image.width=t,this.textures[n].image.height=e,this.textures[n].image.depth=i,!0!==this.textures[n].isData3DTexture&&(this.textures[n].isArrayTexture=this.textures[n].image.depth>1);this.dispose()}this.viewport.set(0,0,t,e),this.scissor.set(0,0,t,e)}clone(){return(new this.constructor).copy(this)}copy(t){this.width=t.width,this.height=t.height,this.depth=t.depth,this.scissor.copy(t.scissor),this.scissorTest=t.scissorTest,this.viewport.copy(t.viewport),this.textures.length=0;for(let e=0,i=t.textures.length;e<i;e++){this.textures[e]=t.textures[e].clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;const i=Object.assign({},t.textures[e].image);this.textures[e].source=new Ln(i)}return this.depthBuffer=t.depthBuffer,this.stencilBuffer=t.stencilBuffer,this.resolveDepthBuffer=t.resolveDepthBuffer,this.resolveStencilBuffer=t.resolveStencilBuffer,null!==t.depthTexture&&(this.depthTexture=t.depthTexture.clone()),this.samples=t.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Qn extends kn{constructor(t=1,e=1,i={}){super(t,e,i),this.isWebGLRenderTarget=!0}}class Gn extends Nn{constructor(t=null,e=1,i=1,n=1){super(null),this.isDataArrayTexture=!0,this.image={data:t,width:e,height:i,depth:n},this.magFilter=ue,this.minFilter=ue,this.wrapR=ce,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}}class zn extends Nn{constructor(t=null,e=1,i=1,n=1){super(null),this.isData3DTexture=!0,this.image={data:t,width:e,height:i,depth:n},this.magFilter=ue,this.minFilter=ue,this.wrapR=ce,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Hn{constructor(t,e,i,n,r,s,a,o,l,c,h,u,d,p,A,g){Hn.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],void 0!==t&&this.set(t,e,i,n,r,s,a,o,l,c,h,u,d,p,A,g)}set(t,e,i,n,r,s,a,o,l,c,h,u,d,p,A,g){const m=this.elements;return m[0]=t,m[4]=e,m[8]=i,m[12]=n,m[1]=r,m[5]=s,m[9]=a,m[13]=o,m[2]=l,m[6]=c,m[10]=h,m[14]=u,m[3]=d,m[7]=p,m[11]=A,m[15]=g,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return(new Hn).fromArray(this.elements)}copy(t){const e=this.elements,i=t.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this}copyPosition(t){const e=this.elements,i=t.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this}setFromMatrix3(t){const e=t.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(t,e,i){return 0===this.determinant()?(t.set(1,0,0),e.set(0,1,0),i.set(0,0,1),this):(t.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this)}makeBasis(t,e,i){return this.set(t.x,e.x,i.x,0,t.y,e.y,i.y,0,t.z,e.z,i.z,0,0,0,0,1),this}extractRotation(t){if(0===t.determinant())return this.identity();const e=this.elements,i=t.elements,n=1/Vn.setFromMatrixColumn(t,0).length(),r=1/Vn.setFromMatrixColumn(t,1).length(),s=1/Vn.setFromMatrixColumn(t,2).length();return e[0]=i[0]*n,e[1]=i[1]*n,e[2]=i[2]*n,e[3]=0,e[4]=i[4]*r,e[5]=i[5]*r,e[6]=i[6]*r,e[7]=0,e[8]=i[8]*s,e[9]=i[9]*s,e[10]=i[10]*s,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(t){const e=this.elements,i=t.x,n=t.y,r=t.z,s=Math.cos(i),a=Math.sin(i),o=Math.cos(n),l=Math.sin(n),c=Math.cos(r),h=Math.sin(r);if("XYZ"===t.order){const t=s*c,i=s*h,n=a*c,r=a*h;e[0]=o*c,e[4]=-o*h,e[8]=l,e[1]=i+n*l,e[5]=t-r*l,e[9]=-a*o,e[2]=r-t*l,e[6]=n+i*l,e[10]=s*o}else if("YXZ"===t.order){const t=o*c,i=o*h,n=l*c,r=l*h;e[0]=t+r*a,e[4]=n*a-i,e[8]=s*l,e[1]=s*h,e[5]=s*c,e[9]=-a,e[2]=i*a-n,e[6]=r+t*a,e[10]=s*o}else if("ZXY"===t.order){const t=o*c,i=o*h,n=l*c,r=l*h;e[0]=t-r*a,e[4]=-s*h,e[8]=n+i*a,e[1]=i+n*a,e[5]=s*c,e[9]=r-t*a,e[2]=-s*l,e[6]=a,e[10]=s*o}else if("ZYX"===t.order){const t=s*c,i=s*h,n=a*c,r=a*h;e[0]=o*c,e[4]=n*l-i,e[8]=t*l+r,e[1]=o*h,e[5]=r*l+t,e[9]=i*l-n,e[2]=-l,e[6]=a*o,e[10]=s*o}else if("YZX"===t.order){const t=s*o,i=s*l,n=a*o,r=a*l;e[0]=o*c,e[4]=r-t*h,e[8]=n*h+i,e[1]=h,e[5]=s*c,e[9]=-a*c,e[2]=-l*c,e[6]=i*h+n,e[10]=t-r*h}else if("XZY"===t.order){const t=s*o,i=s*l,n=a*o,r=a*l;e[0]=o*c,e[4]=-h,e[8]=l*c,e[1]=t*h+r,e[5]=s*c,e[9]=i*h-n,e[2]=n*h-i,e[6]=a*c,e[10]=r*h+t}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(t){return this.compose(jn,t,Wn)}lookAt(t,e,i){const n=this.elements;return Jn.subVectors(t,e),0===Jn.lengthSq()&&(Jn.z=1),Jn.normalize(),Xn.crossVectors(i,Jn),0===Xn.lengthSq()&&(1===Math.abs(i.z)?Jn.x+=1e-4:Jn.z+=1e-4,Jn.normalize(),Xn.crossVectors(i,Jn)),Xn.normalize(),Kn.crossVectors(Jn,Xn),n[0]=Xn.x,n[4]=Kn.x,n[8]=Jn.x,n[1]=Xn.y,n[5]=Kn.y,n[9]=Jn.y,n[2]=Xn.z,n[6]=Kn.z,n[10]=Jn.z,this}multiply(t){return this.multiplyMatrices(this,t)}premultiply(t){return this.multiplyMatrices(t,this)}multiplyMatrices(t,e){const i=t.elements,n=e.elements,r=this.elements,s=i[0],a=i[4],o=i[8],l=i[12],c=i[1],h=i[5],u=i[9],d=i[13],p=i[2],A=i[6],g=i[10],m=i[14],f=i[3],b=i[7],v=i[11],y=i[15],x=n[0],_=n[4],E=n[8],S=n[12],C=n[1],w=n[5],M=n[9],I=n[13],T=n[2],B=n[6],R=n[10],D=n[14],L=n[3],P=n[7],F=n[11],U=n[15];return r[0]=s*x+a*C+o*T+l*L,r[4]=s*_+a*w+o*B+l*P,r[8]=s*E+a*M+o*R+l*F,r[12]=s*S+a*I+o*D+l*U,r[1]=c*x+h*C+u*T+d*L,r[5]=c*_+h*w+u*B+d*P,r[9]=c*E+h*M+u*R+d*F,r[13]=c*S+h*I+u*D+d*U,r[2]=p*x+A*C+g*T+m*L,r[6]=p*_+A*w+g*B+m*P,r[10]=p*E+A*M+g*R+m*F,r[14]=p*S+A*I+g*D+m*U,r[3]=f*x+b*C+v*T+y*L,r[7]=f*_+b*w+v*B+y*P,r[11]=f*E+b*M+v*R+y*F,r[15]=f*S+b*I+v*D+y*U,this}multiplyScalar(t){const e=this.elements;return e[0]*=t,e[4]*=t,e[8]*=t,e[12]*=t,e[1]*=t,e[5]*=t,e[9]*=t,e[13]*=t,e[2]*=t,e[6]*=t,e[10]*=t,e[14]*=t,e[3]*=t,e[7]*=t,e[11]*=t,e[15]*=t,this}determinant(){const t=this.elements,e=t[0],i=t[4],n=t[8],r=t[12],s=t[1],a=t[5],o=t[9],l=t[13],c=t[2],h=t[6],u=t[10],d=t[14],p=t[3],A=t[7],g=t[11],m=t[15],f=o*d-l*u,b=a*d-l*h,v=a*u-o*h,y=s*d-l*c,x=s*u-o*c,_=s*h-a*c;return e*(A*f-g*b+m*v)-i*(p*f-g*y+m*x)+n*(p*b-A*y+m*_)-r*(p*v-A*x+g*_)}transpose(){const t=this.elements;let e;return e=t[1],t[1]=t[4],t[4]=e,e=t[2],t[2]=t[8],t[8]=e,e=t[6],t[6]=t[9],t[9]=e,e=t[3],t[3]=t[12],t[12]=e,e=t[7],t[7]=t[13],t[13]=e,e=t[11],t[11]=t[14],t[14]=e,this}setPosition(t,e,i){const n=this.elements;return t.isVector3?(n[12]=t.x,n[13]=t.y,n[14]=t.z):(n[12]=t,n[13]=e,n[14]=i),this}invert(){const t=this.elements,e=t[0],i=t[1],n=t[2],r=t[3],s=t[4],a=t[5],o=t[6],l=t[7],c=t[8],h=t[9],u=t[10],d=t[11],p=t[12],A=t[13],g=t[14],m=t[15],f=e*a-i*s,b=e*o-n*s,v=e*l-r*s,y=i*o-n*a,x=i*l-r*a,_=n*l-r*o,E=c*A-h*p,S=c*g-u*p,C=c*m-d*p,w=h*g-u*A,M=h*m-d*A,I=u*m-d*g,T=f*I-b*M+v*w+y*C-x*S+_*E;if(0===T)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const B=1/T;return t[0]=(a*I-o*M+l*w)*B,t[1]=(n*M-i*I-r*w)*B,t[2]=(A*_-g*x+m*y)*B,t[3]=(u*x-h*_-d*y)*B,t[4]=(o*C-s*I-l*S)*B,t[5]=(e*I-n*C+r*S)*B,t[6]=(g*v-p*_-m*b)*B,t[7]=(c*_-u*v+d*b)*B,t[8]=(s*M-a*C+l*E)*B,t[9]=(i*C-e*M-r*E)*B,t[10]=(p*x-A*v+m*f)*B,t[11]=(h*v-c*x-d*f)*B,t[12]=(a*S-s*w-o*E)*B,t[13]=(e*w-i*S+n*E)*B,t[14]=(A*b-p*y-g*f)*B,t[15]=(c*y-h*b+u*f)*B,this}scale(t){const e=this.elements,i=t.x,n=t.y,r=t.z;return e[0]*=i,e[4]*=n,e[8]*=r,e[1]*=i,e[5]*=n,e[9]*=r,e[2]*=i,e[6]*=n,e[10]*=r,e[3]*=i,e[7]*=n,e[11]*=r,this}getMaxScaleOnAxis(){const t=this.elements,e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=t[4]*t[4]+t[5]*t[5]+t[6]*t[6],n=t[8]*t[8]+t[9]*t[9]+t[10]*t[10];return Math.sqrt(Math.max(e,i,n))}makeTranslation(t,e,i){return t.isVector3?this.set(1,0,0,t.x,0,1,0,t.y,0,0,1,t.z,0,0,0,1):this.set(1,0,0,t,0,1,0,e,0,0,1,i,0,0,0,1),this}makeRotationX(t){const e=Math.cos(t),i=Math.sin(t);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this}makeRotationY(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this}makeRotationZ(t){const e=Math.cos(t),i=Math.sin(t);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(t,e){const i=Math.cos(e),n=Math.sin(e),r=1-i,s=t.x,a=t.y,o=t.z,l=r*s,c=r*a;return this.set(l*s+i,l*a-n*o,l*o+n*a,0,l*a+n*o,c*a+i,c*o-n*s,0,l*o-n*a,c*o+n*s,r*o*o+i,0,0,0,0,1),this}makeScale(t,e,i){return this.set(t,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(t,e,i,n,r,s){return this.set(1,i,r,0,t,1,s,0,e,n,1,0,0,0,0,1),this}compose(t,e,i){const n=this.elements,r=e._x,s=e._y,a=e._z,o=e._w,l=r+r,c=s+s,h=a+a,u=r*l,d=r*c,p=r*h,A=s*c,g=s*h,m=a*h,f=o*l,b=o*c,v=o*h,y=i.x,x=i.y,_=i.z;return n[0]=(1-(A+m))*y,n[1]=(d+v)*y,n[2]=(p-b)*y,n[3]=0,n[4]=(d-v)*x,n[5]=(1-(u+m))*x,n[6]=(g+f)*x,n[7]=0,n[8]=(p+b)*_,n[9]=(g-f)*_,n[10]=(1-(u+A))*_,n[11]=0,n[12]=t.x,n[13]=t.y,n[14]=t.z,n[15]=1,this}decompose(t,e,i){const n=this.elements;t.x=n[12],t.y=n[13],t.z=n[14];const r=this.determinant();if(0===r)return i.set(1,1,1),e.identity(),this;let s=Vn.set(n[0],n[1],n[2]).length();const a=Vn.set(n[4],n[5],n[6]).length(),o=Vn.set(n[8],n[9],n[10]).length();r<0&&(s=-s),qn.copy(this);const l=1/s,c=1/a,h=1/o;return qn.elements[0]*=l,qn.elements[1]*=l,qn.elements[2]*=l,qn.elements[4]*=c,qn.elements[5]*=c,qn.elements[6]*=c,qn.elements[8]*=h,qn.elements[9]*=h,qn.elements[10]*=h,e.setFromRotationMatrix(qn),i.x=s,i.y=a,i.z=o,this}makePerspective(t,e,i,n,r,s,a=2e3,o=!1){const l=this.elements,c=2*r/(e-t),h=2*r/(i-n),u=(e+t)/(e-t),d=(i+n)/(i-n);let p,A;if(o)p=r/(s-r),A=s*r/(s-r);else if(a===Wi)p=-(s+r)/(s-r),A=-2*s*r/(s-r);else{if(a!==Xi)throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);p=-s/(s-r),A=-s*r/(s-r)}return l[0]=c,l[4]=0,l[8]=u,l[12]=0,l[1]=0,l[5]=h,l[9]=d,l[13]=0,l[2]=0,l[6]=0,l[10]=p,l[14]=A,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(t,e,i,n,r,s,a=2e3,o=!1){const l=this.elements,c=2/(e-t),h=2/(i-n),u=-(e+t)/(e-t),d=-(i+n)/(i-n);let p,A;if(o)p=1/(s-r),A=s/(s-r);else if(a===Wi)p=-2/(s-r),A=-(s+r)/(s-r);else{if(a!==Xi)throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);p=-1/(s-r),A=-r/(s-r)}return l[0]=c,l[4]=0,l[8]=0,l[12]=u,l[1]=0,l[5]=h,l[9]=0,l[13]=d,l[2]=0,l[6]=0,l[10]=p,l[14]=A,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(t){const e=this.elements,i=t.elements;for(let t=0;t<16;t++)if(e[t]!==i[t])return!1;return!0}fromArray(t,e=0){for(let i=0;i<16;i++)this.elements[i]=t[i+e];return this}toArray(t=[],e=0){const i=this.elements;return t[e]=i[0],t[e+1]=i[1],t[e+2]=i[2],t[e+3]=i[3],t[e+4]=i[4],t[e+5]=i[5],t[e+6]=i[6],t[e+7]=i[7],t[e+8]=i[8],t[e+9]=i[9],t[e+10]=i[10],t[e+11]=i[11],t[e+12]=i[12],t[e+13]=i[13],t[e+14]=i[14],t[e+15]=i[15],t}}const Vn=new vn,qn=new Hn,jn=new vn(0,0,0),Wn=new vn(1,1,1),Xn=new vn,Kn=new vn,Jn=new vn,Yn=new Hn,$n=new bn;class Zn{constructor(t=0,e=0,i=0,n=Zn.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=e,this._z=i,this._order=n}get x(){return this._x}set x(t){this._x=t,this._onChangeCallback()}get y(){return this._y}set y(t){this._y=t,this._onChangeCallback()}get z(){return this._z}set z(t){this._z=t,this._onChangeCallback()}get order(){return this._order}set order(t){this._order=t,this._onChangeCallback()}set(t,e,i,n=this._order){return this._x=t,this._y=e,this._z=i,this._order=n,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(t){return this._x=t._x,this._y=t._y,this._z=t._z,this._order=t._order,this._onChangeCallback(),this}setFromRotationMatrix(t,e=this._order,i=!0){const n=t.elements,r=n[0],s=n[4],a=n[8],o=n[1],l=n[5],c=n[9],h=n[2],u=n[6],d=n[10];switch(e){case"XYZ":this._y=Math.asin(un(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,d),this._z=Math.atan2(-s,r)):(this._x=Math.atan2(u,l),this._z=0);break;case"YXZ":this._x=Math.asin(-un(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(a,d),this._z=Math.atan2(o,l)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(un(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(-h,d),this._z=Math.atan2(-s,l)):(this._y=0,this._z=Math.atan2(o,r));break;case"ZYX":this._y=Math.asin(-un(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(u,d),this._z=Math.atan2(o,r)):(this._x=0,this._z=Math.atan2(-s,l));break;case"YZX":this._z=Math.asin(un(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-c,l),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(a,d));break;case"XZY":this._z=Math.asin(-un(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(u,l),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-c,d),this._y=0);break;default:tn("Euler: .setFromRotationMatrix() encountered an unknown order: "+e)}return this._order=e,!0===i&&this._onChangeCallback(),this}setFromQuaternion(t,e,i){return Yn.makeRotationFromQuaternion(t),this.setFromRotationMatrix(Yn,e,i)}setFromVector3(t,e=this._order){return this.set(t.x,t.y,t.z,e)}reorder(t){return $n.setFromEuler(this),this.setFromQuaternion($n,t)}equals(t){return t._x===this._x&&t._y===this._y&&t._z===this._z&&t._order===this._order}fromArray(t){return this._x=t[0],this._y=t[1],this._z=t[2],void 0!==t[3]&&(this._order=t[3]),this._onChangeCallback(),this}toArray(t=[],e=0){return t[e]=this._x,t[e+1]=this._y,t[e+2]=this._z,t[e+3]=this._order,t}_onChange(t){return this._onChangeCallback=t,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Zn.DEFAULT_ORDER="XYZ";class tr{constructor(){this.mask=1}set(t){this.mask=1<<t>>>0}enable(t){this.mask|=1<<t}enableAll(){this.mask=-1}toggle(t){this.mask^=1<<t}disable(t){this.mask&=~(1<<t)}disableAll(){this.mask=0}test(t){return 0!==(this.mask&t.mask)}isEnabled(t){return!!(this.mask&1<<t)}}let er=0;const ir=new vn,nr=new bn,rr=new Hn,sr=new vn,ar=new vn,or=new vn,lr=new bn,cr=new vn(1,0,0),hr=new vn(0,1,0),ur=new vn(0,0,1),dr={type:"added"},pr={type:"removed"},Ar={type:"childadded",child:null},gr={type:"childremoved",child:null};class mr extends sn{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:er++}),this.uuid=hn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=mr.DEFAULT_UP.clone();const t=new vn,e=new Zn,i=new bn,n=new vn(1,1,1);e._onChange(function(){i.setFromEuler(e,!1)}),i._onChange(function(){e.setFromQuaternion(i,void 0,!1)}),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:t},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:n},modelViewMatrix:{value:new Hn},normalMatrix:{value:new _n}}),this.matrix=new Hn,this.matrixWorld=new Hn,this.matrixAutoUpdate=mr.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=mr.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new tr,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(t){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(t),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(t){return this.quaternion.premultiply(t),this}setRotationFromAxisAngle(t,e){this.quaternion.setFromAxisAngle(t,e)}setRotationFromEuler(t){this.quaternion.setFromEuler(t,!0)}setRotationFromMatrix(t){this.quaternion.setFromRotationMatrix(t)}setRotationFromQuaternion(t){this.quaternion.copy(t)}rotateOnAxis(t,e){return nr.setFromAxisAngle(t,e),this.quaternion.multiply(nr),this}rotateOnWorldAxis(t,e){return nr.setFromAxisAngle(t,e),this.quaternion.premultiply(nr),this}rotateX(t){return this.rotateOnAxis(cr,t)}rotateY(t){return this.rotateOnAxis(hr,t)}rotateZ(t){return this.rotateOnAxis(ur,t)}translateOnAxis(t,e){return ir.copy(t).applyQuaternion(this.quaternion),this.position.add(ir.multiplyScalar(e)),this}translateX(t){return this.translateOnAxis(cr,t)}translateY(t){return this.translateOnAxis(hr,t)}translateZ(t){return this.translateOnAxis(ur,t)}localToWorld(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(this.matrixWorld)}worldToLocal(t){return this.updateWorldMatrix(!0,!1),t.applyMatrix4(rr.copy(this.matrixWorld).invert())}lookAt(t,e,i){t.isVector3?sr.copy(t):sr.set(t,e,i);const n=this.parent;this.updateWorldMatrix(!0,!1),ar.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?rr.lookAt(ar,sr,this.up):rr.lookAt(sr,ar,this.up),this.quaternion.setFromRotationMatrix(rr),n&&(rr.extractRotation(n.matrixWorld),nr.setFromRotationMatrix(rr),this.quaternion.premultiply(nr.invert()))}add(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return t===this?(en("Object3D.add: object can't be added as a child of itself.",t),this):(t&&t.isObject3D?(t.removeFromParent(),t.parent=this,this.children.push(t),t.dispatchEvent(dr),Ar.child=t,this.dispatchEvent(Ar),Ar.child=null):en("Object3D.add: object not an instance of THREE.Object3D.",t),this)}remove(t){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}const e=this.children.indexOf(t);return-1!==e&&(t.parent=null,this.children.splice(e,1),t.dispatchEvent(pr),gr.child=t,this.dispatchEvent(gr),gr.child=null),this}removeFromParent(){const t=this.parent;return null!==t&&t.remove(this),this}clear(){return this.remove(...this.children)}attach(t){return this.updateWorldMatrix(!0,!1),rr.copy(this.matrixWorld).invert(),null!==t.parent&&(t.parent.updateWorldMatrix(!0,!1),rr.multiply(t.parent.matrixWorld)),t.applyMatrix4(rr),t.removeFromParent(),t.parent=this,this.children.push(t),t.updateWorldMatrix(!1,!0),t.dispatchEvent(dr),Ar.child=t,this.dispatchEvent(Ar),Ar.child=null,this}getObjectById(t){return this.getObjectByProperty("id",t)}getObjectByName(t){return this.getObjectByProperty("name",t)}getObjectByProperty(t,e){if(this[t]===e)return this;for(let i=0,n=this.children.length;i<n;i++){const n=this.children[i].getObjectByProperty(t,e);if(void 0!==n)return n}}getObjectsByProperty(t,e,i=[]){this[t]===e&&i.push(this);const n=this.children;for(let r=0,s=n.length;r<s;r++)n[r].getObjectsByProperty(t,e,i);return i}getWorldPosition(t){return this.updateWorldMatrix(!0,!1),t.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ar,t,or),t}getWorldScale(t){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(ar,lr,t),t}getWorldDirection(t){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return t.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(t){t(this);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].traverse(t)}traverseVisible(t){if(!1===this.visible)return;t(this);const e=this.children;for(let i=0,n=e.length;i<n;i++)e[i].traverseVisible(t)}traverseAncestors(t){const e=this.parent;null!==e&&(t(e),e.traverseAncestors(t))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);const t=this.pivot;if(null!==t){const e=t.x,i=t.y,n=t.z,r=this.matrix.elements;r[12]+=e-r[0]*e-r[4]*i-r[8]*n,r[13]+=i-r[1]*e-r[5]*i-r[9]*n,r[14]+=n-r[2]*e-r[6]*i-r[10]*n}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);const e=this.children;for(let i=0,n=e.length;i<n;i++){e[i].updateMatrixWorld(t)}}updateWorldMatrix(t,e){const i=this.parent;if(!0===t&&null!==i&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),!0===this.matrixWorldAutoUpdate&&(null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),!0===e){const t=this.children;for(let e=0,i=t.length;e<i;e++){t[e].updateWorldMatrix(!1,!0)}}}toJSON(t){const e=void 0===t||"string"==typeof t,i={};e&&(t={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const n={};function r(e,i){return void 0===e[i.uuid]&&(e[i.uuid]=i.toJSON(t)),i.uuid}if(n.uuid=this.uuid,n.type=this.type,""!==this.name&&(n.name=this.name),!0===this.castShadow&&(n.castShadow=!0),!0===this.receiveShadow&&(n.receiveShadow=!0),!1===this.visible&&(n.visible=!1),!1===this.frustumCulled&&(n.frustumCulled=!1),0!==this.renderOrder&&(n.renderOrder=this.renderOrder),!1!==this.static&&(n.static=this.static),Object.keys(this.userData).length>0&&(n.userData=this.userData),n.layers=this.layers.mask,n.matrix=this.matrix.toArray(),n.up=this.up.toArray(),null!==this.pivot&&(n.pivot=this.pivot.toArray()),!1===this.matrixAutoUpdate&&(n.matrixAutoUpdate=!1),void 0!==this.morphTargetDictionary&&(n.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),void 0!==this.morphTargetInfluences&&(n.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(n.type="InstancedMesh",n.count=this.count,n.instanceMatrix=this.instanceMatrix.toJSON(),null!==this.instanceColor&&(n.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(n.type="BatchedMesh",n.perObjectFrustumCulled=this.perObjectFrustumCulled,n.sortObjects=this.sortObjects,n.drawRanges=this._drawRanges,n.reservedRanges=this._reservedRanges,n.geometryInfo=this._geometryInfo.map(t=>({...t,boundingBox:t.boundingBox?t.boundingBox.toJSON():void 0,boundingSphere:t.boundingSphere?t.boundingSphere.toJSON():void 0})),n.instanceInfo=this._instanceInfo.map(t=>({...t})),n.availableInstanceIds=this._availableInstanceIds.slice(),n.availableGeometryIds=this._availableGeometryIds.slice(),n.nextIndexStart=this._nextIndexStart,n.nextVertexStart=this._nextVertexStart,n.geometryCount=this._geometryCount,n.maxInstanceCount=this._maxInstanceCount,n.maxVertexCount=this._maxVertexCount,n.maxIndexCount=this._maxIndexCount,n.geometryInitialized=this._geometryInitialized,n.matricesTexture=this._matricesTexture.toJSON(t),n.indirectTexture=this._indirectTexture.toJSON(t),null!==this._colorsTexture&&(n.colorsTexture=this._colorsTexture.toJSON(t)),null!==this.boundingSphere&&(n.boundingSphere=this.boundingSphere.toJSON()),null!==this.boundingBox&&(n.boundingBox=this.boundingBox.toJSON())),this.isScene)this.background&&(this.background.isColor?n.background=this.background.toJSON():this.background.isTexture&&(n.background=this.background.toJSON(t).uuid)),this.environment&&this.environment.isTexture&&!0!==this.environment.isRenderTargetTexture&&(n.environment=this.environment.toJSON(t).uuid);else if(this.isMesh||this.isLine||this.isPoints){n.geometry=r(t.geometries,this.geometry);const e=this.geometry.parameters;if(void 0!==e&&void 0!==e.shapes){const i=e.shapes;if(Array.isArray(i))for(let e=0,n=i.length;e<n;e++){const n=i[e];r(t.shapes,n)}else r(t.shapes,i)}}if(this.isSkinnedMesh&&(n.bindMode=this.bindMode,n.bindMatrix=this.bindMatrix.toArray(),void 0!==this.skeleton&&(r(t.skeletons,this.skeleton),n.skeleton=this.skeleton.uuid)),void 0!==this.material)if(Array.isArray(this.material)){const e=[];for(let i=0,n=this.material.length;i<n;i++)e.push(r(t.materials,this.material[i]));n.material=e}else n.material=r(t.materials,this.material);if(this.children.length>0){n.children=[];for(let e=0;e<this.children.length;e++)n.children.push(this.children[e].toJSON(t).object)}if(this.animations.length>0){n.animations=[];for(let e=0;e<this.animations.length;e++){const i=this.animations[e];n.animations.push(r(t.animations,i))}}if(e){const e=s(t.geometries),n=s(t.materials),r=s(t.textures),a=s(t.images),o=s(t.shapes),l=s(t.skeletons),c=s(t.animations),h=s(t.nodes);e.length>0&&(i.geometries=e),n.length>0&&(i.materials=n),r.length>0&&(i.textures=r),a.length>0&&(i.images=a),o.length>0&&(i.shapes=o),l.length>0&&(i.skeletons=l),c.length>0&&(i.animations=c),h.length>0&&(i.nodes=h)}return i.object=n,i;function s(t){const e=[];for(const i in t){const n=t[i];delete n.metadata,e.push(n)}return e}}clone(t){return(new this.constructor).copy(this,t)}copy(t,e=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),null!==t.pivot&&(this.pivot=t.pivot.clone()),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldAutoUpdate=t.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.static=t.static,this.animations=t.animations.slice(),this.userData=JSON.parse(JSON.stringify(t.userData)),!0===e)for(let e=0;e<t.children.length;e++){const i=t.children[e];this.add(i.clone())}return this}}mr.DEFAULT_UP=new vn(0,1,0),mr.DEFAULT_MATRIX_AUTO_UPDATE=!0,mr.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class fr extends mr{constructor(){super(),this.isGroup=!0,this.type="Group"}}const br={type:"move"};class vr{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return null===this._hand&&(this._hand=new fr,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return null===this._targetRay&&(this._targetRay=new fr,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new vn,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new vn),this._targetRay}getGripSpace(){return null===this._grip&&(this._grip=new fr,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new vn,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new vn),this._grip}dispatchEvent(t){return null!==this._targetRay&&this._targetRay.dispatchEvent(t),null!==this._grip&&this._grip.dispatchEvent(t),null!==this._hand&&this._hand.dispatchEvent(t),this}connect(t){if(t&&t.hand){const e=this._hand;if(e)for(const i of t.hand.values())this._getHandJoint(e,i)}return this.dispatchEvent({type:"connected",data:t}),this}disconnect(t){return this.dispatchEvent({type:"disconnected",data:t}),null!==this._targetRay&&(this._targetRay.visible=!1),null!==this._grip&&(this._grip.visible=!1),null!==this._hand&&(this._hand.visible=!1),this}update(t,e,i){let n=null,r=null,s=null;const a=this._targetRay,o=this._grip,l=this._hand;if(t&&"visible-blurred"!==e.session.visibilityState){if(l&&t.hand){s=!0;for(const n of t.hand.values()){const t=e.getJointPose(n,i),r=this._getHandJoint(l,n);null!==t&&(r.matrix.fromArray(t.transform.matrix),r.matrix.decompose(r.position,r.rotation,r.scale),r.matrixWorldNeedsUpdate=!0,r.jointRadius=t.radius),r.visible=null!==t}const n=l.joints["index-finger-tip"],r=l.joints["thumb-tip"],a=n.position.distanceTo(r.position),o=.02,c=.005;l.inputState.pinching&&a>o+c?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:t.handedness,target:this})):!l.inputState.pinching&&a<=o-c&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:t.handedness,target:this}))}else null!==o&&t.gripSpace&&(r=e.getPose(t.gripSpace,i),null!==r&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1));null!==a&&(n=e.getPose(t.targetRaySpace,i),null===n&&null!==r&&(n=r),null!==n&&(a.matrix.fromArray(n.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,n.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(n.linearVelocity)):a.hasLinearVelocity=!1,n.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(n.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(br)))}return null!==a&&(a.visible=null!==n),null!==o&&(o.visible=null!==r),null!==l&&(l.visible=null!==s),this}_getHandJoint(t,e){if(void 0===t.joints[e.jointName]){const i=new fr;i.matrixAutoUpdate=!1,i.visible=!1,t.joints[e.jointName]=i,t.add(i)}return t.joints[e.jointName]}}const yr={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},xr={h:0,s:0,l:0},_r={h:0,s:0,l:0};function Er(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+6*(e-t)*(2/3-i):t}class Sr{constructor(t,e,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(t,e,i)}set(t,e,i){if(void 0===e&&void 0===i){const e=t;e&&e.isColor?this.copy(e):"number"==typeof e?this.setHex(e):"string"==typeof e&&this.setStyle(e)}else this.setRGB(t,e,i);return this}setScalar(t){return this.r=t,this.g=t,this.b=t,this}setHex(t,e=Di){return t=Math.floor(t),this.r=(t>>16&255)/255,this.g=(t>>8&255)/255,this.b=(255&t)/255,Mn.colorSpaceToWorking(this,e),this}setRGB(t,e,i,n=Mn.workingColorSpace){return this.r=t,this.g=e,this.b=i,Mn.colorSpaceToWorking(this,n),this}setHSL(t,e,i,n=Mn.workingColorSpace){if(t=dn(t,1),e=un(e,0,1),i=un(i,0,1),0===e)this.r=this.g=this.b=i;else{const n=i<=.5?i*(1+e):i+e-i*e,r=2*i-n;this.r=Er(r,n,t+1/3),this.g=Er(r,n,t),this.b=Er(r,n,t-1/3)}return Mn.colorSpaceToWorking(this,n),this}setStyle(t,e=Di){function i(e){void 0!==e&&parseFloat(e)<1&&tn("Color: Alpha component of "+t+" will be ignored.")}let n;if(n=/^(\w+)\(([^\)]*)\)/.exec(t)){let r;const s=n[1],a=n[2];switch(s){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setRGB(Math.min(255,parseInt(r[1],10))/255,Math.min(255,parseInt(r[2],10))/255,Math.min(255,parseInt(r[3],10))/255,e);if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setRGB(Math.min(100,parseInt(r[1],10))/100,Math.min(100,parseInt(r[2],10))/100,Math.min(100,parseInt(r[3],10))/100,e);break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return i(r[4]),this.setHSL(parseFloat(r[1])/360,parseFloat(r[2])/100,parseFloat(r[3])/100,e);break;default:tn("Color: Unknown color model "+t)}}else if(n=/^\#([A-Fa-f\d]+)$/.exec(t)){const i=n[1],r=i.length;if(3===r)return this.setRGB(parseInt(i.charAt(0),16)/15,parseInt(i.charAt(1),16)/15,parseInt(i.charAt(2),16)/15,e);if(6===r)return this.setHex(parseInt(i,16),e);tn("Color: Invalid hex color "+t)}else if(t&&t.length>0)return this.setColorName(t,e);return this}setColorName(t,e=Di){const i=yr[t.toLowerCase()];return void 0!==i?this.setHex(i,e):tn("Color: Unknown color "+t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(t){return this.r=t.r,this.g=t.g,this.b=t.b,this}copySRGBToLinear(t){return this.r=In(t.r),this.g=In(t.g),this.b=In(t.b),this}copyLinearToSRGB(t){return this.r=Tn(t.r),this.g=Tn(t.g),this.b=Tn(t.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(t=Di){return Mn.workingToColorSpace(Cr.copy(this),t),65536*Math.round(un(255*Cr.r,0,255))+256*Math.round(un(255*Cr.g,0,255))+Math.round(un(255*Cr.b,0,255))}getHexString(t=Di){return("000000"+this.getHex(t).toString(16)).slice(-6)}getHSL(t,e=Mn.workingColorSpace){Mn.workingToColorSpace(Cr.copy(this),e);const i=Cr.r,n=Cr.g,r=Cr.b,s=Math.max(i,n,r),a=Math.min(i,n,r);let o,l;const c=(a+s)/2;if(a===s)o=0,l=0;else{const t=s-a;switch(l=c<=.5?t/(s+a):t/(2-s-a),s){case i:o=(n-r)/t+(n<r?6:0);break;case n:o=(r-i)/t+2;break;case r:o=(i-n)/t+4}o/=6}return t.h=o,t.s=l,t.l=c,t}getRGB(t,e=Mn.workingColorSpace){return Mn.workingToColorSpace(Cr.copy(this),e),t.r=Cr.r,t.g=Cr.g,t.b=Cr.b,t}getStyle(t=Di){Mn.workingToColorSpace(Cr.copy(this),t);const e=Cr.r,i=Cr.g,n=Cr.b;return t!==Di?`color(${t} ${e.toFixed(3)} ${i.toFixed(3)} ${n.toFixed(3)})`:`rgb(${Math.round(255*e)},${Math.round(255*i)},${Math.round(255*n)})`}offsetHSL(t,e,i){return this.getHSL(xr),this.setHSL(xr.h+t,xr.s+e,xr.l+i)}add(t){return this.r+=t.r,this.g+=t.g,this.b+=t.b,this}addColors(t,e){return this.r=t.r+e.r,this.g=t.g+e.g,this.b=t.b+e.b,this}addScalar(t){return this.r+=t,this.g+=t,this.b+=t,this}sub(t){return this.r=Math.max(0,this.r-t.r),this.g=Math.max(0,this.g-t.g),this.b=Math.max(0,this.b-t.b),this}multiply(t){return this.r*=t.r,this.g*=t.g,this.b*=t.b,this}multiplyScalar(t){return this.r*=t,this.g*=t,this.b*=t,this}lerp(t,e){return this.r+=(t.r-this.r)*e,this.g+=(t.g-this.g)*e,this.b+=(t.b-this.b)*e,this}lerpColors(t,e,i){return this.r=t.r+(e.r-t.r)*i,this.g=t.g+(e.g-t.g)*i,this.b=t.b+(e.b-t.b)*i,this}lerpHSL(t,e){this.getHSL(xr),t.getHSL(_r);const i=pn(xr.h,_r.h,e),n=pn(xr.s,_r.s,e),r=pn(xr.l,_r.l,e);return this.setHSL(i,n,r),this}setFromVector3(t){return this.r=t.x,this.g=t.y,this.b=t.z,this}applyMatrix3(t){const e=this.r,i=this.g,n=this.b,r=t.elements;return this.r=r[0]*e+r[3]*i+r[6]*n,this.g=r[1]*e+r[4]*i+r[7]*n,this.b=r[2]*e+r[5]*i+r[8]*n,this}equals(t){return t.r===this.r&&t.g===this.g&&t.b===this.b}fromArray(t,e=0){return this.r=t[e],this.g=t[e+1],this.b=t[e+2],this}toArray(t=[],e=0){return t[e]=this.r,t[e+1]=this.g,t[e+2]=this.b,t}fromBufferAttribute(t,e){return this.r=t.getX(e),this.g=t.getY(e),this.b=t.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const Cr=new Sr;Sr.NAMES=yr;class wr extends mr{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Zn,this.environmentIntensity=1,this.environmentRotation=new Zn,this.overrideMaterial=null,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(t,e){return super.copy(t,e),null!==t.background&&(this.background=t.background.clone()),null!==t.environment&&(this.environment=t.environment.clone()),null!==t.fog&&(this.fog=t.fog.clone()),this.backgroundBlurriness=t.backgroundBlurriness,this.backgroundIntensity=t.backgroundIntensity,this.backgroundRotation.copy(t.backgroundRotation),this.environmentIntensity=t.environmentIntensity,this.environmentRotation.copy(t.environmentRotation),null!==t.overrideMaterial&&(this.overrideMaterial=t.overrideMaterial.clone()),this.matrixAutoUpdate=t.matrixAutoUpdate,this}toJSON(t){const e=super.toJSON(t);return null!==this.fog&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),1!==this.backgroundIntensity&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),1!==this.environmentIntensity&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}}const Mr=new vn,Ir=new vn,Tr=new vn,Br=new vn,Rr=new vn,Dr=new vn,Lr=new vn,Pr=new vn,Fr=new vn,Ur=new vn,Nr=new On,Or=new On,kr=new On;class Qr{constructor(t=new vn,e=new vn,i=new vn){this.a=t,this.b=e,this.c=i}static getNormal(t,e,i,n){n.subVectors(i,e),Mr.subVectors(t,e),n.cross(Mr);const r=n.lengthSq();return r>0?n.multiplyScalar(1/Math.sqrt(r)):n.set(0,0,0)}static getBarycoord(t,e,i,n,r){Mr.subVectors(n,e),Ir.subVectors(i,e),Tr.subVectors(t,e);const s=Mr.dot(Mr),a=Mr.dot(Ir),o=Mr.dot(Tr),l=Ir.dot(Ir),c=Ir.dot(Tr),h=s*l-a*a;if(0===h)return r.set(0,0,0),null;const u=1/h,d=(l*o-a*c)*u,p=(s*c-a*o)*u;return r.set(1-d-p,p,d)}static containsPoint(t,e,i,n){return null!==this.getBarycoord(t,e,i,n,Br)&&(Br.x>=0&&Br.y>=0&&Br.x+Br.y<=1)}static getInterpolation(t,e,i,n,r,s,a,o){return null===this.getBarycoord(t,e,i,n,Br)?(o.x=0,o.y=0,"z"in o&&(o.z=0),"w"in o&&(o.w=0),null):(o.setScalar(0),o.addScaledVector(r,Br.x),o.addScaledVector(s,Br.y),o.addScaledVector(a,Br.z),o)}static getInterpolatedAttribute(t,e,i,n,r,s){return Nr.setScalar(0),Or.setScalar(0),kr.setScalar(0),Nr.fromBufferAttribute(t,e),Or.fromBufferAttribute(t,i),kr.fromBufferAttribute(t,n),s.setScalar(0),s.addScaledVector(Nr,r.x),s.addScaledVector(Or,r.y),s.addScaledVector(kr,r.z),s}static isFrontFacing(t,e,i,n){return Mr.subVectors(i,e),Ir.subVectors(t,e),Mr.cross(Ir).dot(n)<0}set(t,e,i){return this.a.copy(t),this.b.copy(e),this.c.copy(i),this}setFromPointsAndIndices(t,e,i,n){return this.a.copy(t[e]),this.b.copy(t[i]),this.c.copy(t[n]),this}setFromAttributeAndIndices(t,e,i,n){return this.a.fromBufferAttribute(t,e),this.b.fromBufferAttribute(t,i),this.c.fromBufferAttribute(t,n),this}clone(){return(new this.constructor).copy(this)}copy(t){return this.a.copy(t.a),this.b.copy(t.b),this.c.copy(t.c),this}getArea(){return Mr.subVectors(this.c,this.b),Ir.subVectors(this.a,this.b),.5*Mr.cross(Ir).length()}getMidpoint(t){return t.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return Qr.getNormal(this.a,this.b,this.c,t)}getPlane(t){return t.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,e){return Qr.getBarycoord(t,this.a,this.b,this.c,e)}getInterpolation(t,e,i,n,r){return Qr.getInterpolation(t,this.a,this.b,this.c,e,i,n,r)}containsPoint(t){return Qr.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return Qr.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(t){return t.intersectsTriangle(this)}closestPointToPoint(t,e){const i=this.a,n=this.b,r=this.c;let s,a;Rr.subVectors(n,i),Dr.subVectors(r,i),Pr.subVectors(t,i);const o=Rr.dot(Pr),l=Dr.dot(Pr);if(o<=0&&l<=0)return e.copy(i);Fr.subVectors(t,n);const c=Rr.dot(Fr),h=Dr.dot(Fr);if(c>=0&&h<=c)return e.copy(n);const u=o*h-c*l;if(u<=0&&o>=0&&c<=0)return s=o/(o-c),e.copy(i).addScaledVector(Rr,s);Ur.subVectors(t,r);const d=Rr.dot(Ur),p=Dr.dot(Ur);if(p>=0&&d<=p)return e.copy(r);const A=d*l-o*p;if(A<=0&&l>=0&&p<=0)return a=l/(l-p),e.copy(i).addScaledVector(Dr,a);const g=c*p-d*h;if(g<=0&&h-c>=0&&d-p>=0)return Lr.subVectors(r,n),a=(h-c)/(h-c+(d-p)),e.copy(n).addScaledVector(Lr,a);const m=1/(g+A+u);return s=A*m,a=u*m,e.copy(i).addScaledVector(Rr,s).addScaledVector(Dr,a)}equals(t){return t.a.equals(this.a)&&t.b.equals(this.b)&&t.c.equals(this.c)}}class Gr{constructor(t=new vn(1/0,1/0,1/0),e=new vn(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=t,this.max=e}set(t,e){return this.min.copy(t),this.max.copy(e),this}setFromArray(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e+=3)this.expandByPoint(Hr.fromArray(t,e));return this}setFromBufferAttribute(t){this.makeEmpty();for(let e=0,i=t.count;e<i;e++)this.expandByPoint(Hr.fromBufferAttribute(t,e));return this}setFromPoints(t){this.makeEmpty();for(let e=0,i=t.length;e<i;e++)this.expandByPoint(t[e]);return this}setFromCenterAndSize(t,e){const i=Hr.copy(e).multiplyScalar(.5);return this.min.copy(t).sub(i),this.max.copy(t).add(i),this}setFromObject(t,e=!1){return this.makeEmpty(),this.expandByObject(t,e)}clone(){return(new this.constructor).copy(this)}copy(t){return this.min.copy(t.min),this.max.copy(t.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(t){return this.isEmpty()?t.set(0,0,0):t.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(t){return this.isEmpty()?t.set(0,0,0):t.subVectors(this.max,this.min)}expandByPoint(t){return this.min.min(t),this.max.max(t),this}expandByVector(t){return this.min.sub(t),this.max.add(t),this}expandByScalar(t){return this.min.addScalar(-t),this.max.addScalar(t),this}expandByObject(t,e=!1){t.updateWorldMatrix(!1,!1);const i=t.geometry;if(void 0!==i){const n=i.getAttribute("position");if(!0===e&&void 0!==n&&!0!==t.isInstancedMesh)for(let e=0,i=n.count;e<i;e++)!0===t.isMesh?t.getVertexPosition(e,Hr):Hr.fromBufferAttribute(n,e),Hr.applyMatrix4(t.matrixWorld),this.expandByPoint(Hr);else void 0!==t.boundingBox?(null===t.boundingBox&&t.computeBoundingBox(),Vr.copy(t.boundingBox)):(null===i.boundingBox&&i.computeBoundingBox(),Vr.copy(i.boundingBox)),Vr.applyMatrix4(t.matrixWorld),this.union(Vr)}const n=t.children;for(let t=0,i=n.length;t<i;t++)this.expandByObject(n[t],e);return this}containsPoint(t){return t.x>=this.min.x&&t.x<=this.max.x&&t.y>=this.min.y&&t.y<=this.max.y&&t.z>=this.min.z&&t.z<=this.max.z}containsBox(t){return this.min.x<=t.min.x&&t.max.x<=this.max.x&&this.min.y<=t.min.y&&t.max.y<=this.max.y&&this.min.z<=t.min.z&&t.max.z<=this.max.z}getParameter(t,e){return e.set((t.x-this.min.x)/(this.max.x-this.min.x),(t.y-this.min.y)/(this.max.y-this.min.y),(t.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(t){return t.max.x>=this.min.x&&t.min.x<=this.max.x&&t.max.y>=this.min.y&&t.min.y<=this.max.y&&t.max.z>=this.min.z&&t.min.z<=this.max.z}intersectsSphere(t){return this.clampPoint(t.center,Hr),Hr.distanceToSquared(t.center)<=t.radius*t.radius}intersectsPlane(t){let e,i;return t.normal.x>0?(e=t.normal.x*this.min.x,i=t.normal.x*this.max.x):(e=t.normal.x*this.max.x,i=t.normal.x*this.min.x),t.normal.y>0?(e+=t.normal.y*this.min.y,i+=t.normal.y*this.max.y):(e+=t.normal.y*this.max.y,i+=t.normal.y*this.min.y),t.normal.z>0?(e+=t.normal.z*this.min.z,i+=t.normal.z*this.max.z):(e+=t.normal.z*this.max.z,i+=t.normal.z*this.min.z),e<=-t.constant&&i>=-t.constant}intersectsTriangle(t){if(this.isEmpty())return!1;this.getCenter(Yr),$r.subVectors(this.max,Yr),qr.subVectors(t.a,Yr),jr.subVectors(t.b,Yr),Wr.subVectors(t.c,Yr),Xr.subVectors(jr,qr),Kr.subVectors(Wr,jr),Jr.subVectors(qr,Wr);let e=[0,-Xr.z,Xr.y,0,-Kr.z,Kr.y,0,-Jr.z,Jr.y,Xr.z,0,-Xr.x,Kr.z,0,-Kr.x,Jr.z,0,-Jr.x,-Xr.y,Xr.x,0,-Kr.y,Kr.x,0,-Jr.y,Jr.x,0];return!!es(e,qr,jr,Wr,$r)&&(e=[1,0,0,0,1,0,0,0,1],!!es(e,qr,jr,Wr,$r)&&(Zr.crossVectors(Xr,Kr),e=[Zr.x,Zr.y,Zr.z],es(e,qr,jr,Wr,$r)))}clampPoint(t,e){return e.copy(t).clamp(this.min,this.max)}distanceToPoint(t){return this.clampPoint(t,Hr).distanceTo(t)}getBoundingSphere(t){return this.isEmpty()?t.makeEmpty():(this.getCenter(t.center),t.radius=.5*this.getSize(Hr).length()),t}intersect(t){return this.min.max(t.min),this.max.min(t.max),this.isEmpty()&&this.makeEmpty(),this}union(t){return this.min.min(t.min),this.max.max(t.max),this}applyMatrix4(t){return this.isEmpty()||(zr[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(t),zr[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(t),zr[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(t),zr[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(t),zr[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(t),zr[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(t),zr[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(t),zr[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(t),this.setFromPoints(zr)),this}translate(t){return this.min.add(t),this.max.add(t),this}equals(t){return t.min.equals(this.min)&&t.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(t){return this.min.fromArray(t.min),this.max.fromArray(t.max),this}}const zr=[new vn,new vn,new vn,new vn,new vn,new vn,new vn,new vn],Hr=new vn,Vr=new Gr,qr=new vn,jr=new vn,Wr=new vn,Xr=new vn,Kr=new vn,Jr=new vn,Yr=new vn,$r=new vn,Zr=new vn,ts=new vn;function es(t,e,i,n,r){for(let s=0,a=t.length-3;s<=a;s+=3){ts.fromArray(t,s);const a=r.x*Math.abs(ts.x)+r.y*Math.abs(ts.y)+r.z*Math.abs(ts.z),o=e.dot(ts),l=i.dot(ts),c=n.dot(ts);if(Math.max(-Math.max(o,l,c),Math.min(o,l,c))>a)return!1}return!0}const is=ns();function ns(){const t=new ArrayBuffer(4),e=new Float32Array(t),i=new Uint32Array(t),n=new Uint32Array(512),r=new Uint32Array(512);for(let t=0;t<256;++t){const e=t-127;e<-27?(n[t]=0,n[256|t]=32768,r[t]=24,r[256|t]=24):e<-14?(n[t]=1024>>-e-14,n[256|t]=1024>>-e-14|32768,r[t]=-e-1,r[256|t]=-e-1):e<=15?(n[t]=e+15<<10,n[256|t]=e+15<<10|32768,r[t]=13,r[256|t]=13):e<128?(n[t]=31744,n[256|t]=64512,r[t]=24,r[256|t]=24):(n[t]=31744,n[256|t]=64512,r[t]=13,r[256|t]=13)}const s=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let t=1;t<1024;++t){let e=t<<13,i=0;for(;!(8388608&e);)e<<=1,i-=8388608;e&=-8388609,i+=947912704,s[t]=e|i}for(let t=1024;t<2048;++t)s[t]=939524096+(t-1024<<13);for(let t=1;t<31;++t)a[t]=t<<23;a[31]=1199570944,a[32]=2147483648;for(let t=33;t<63;++t)a[t]=2147483648+(t-32<<23);a[63]=3347054592;for(let t=1;t<64;++t)32!==t&&(o[t]=1024);return{floatView:e,uint32View:i,baseTable:n,shiftTable:r,mantissaTable:s,exponentTable:a,offsetTable:o}}class rs{static toHalfFloat(t){return function(t){Math.abs(t)>65504&&tn("DataUtils.toHalfFloat(): Value out of range."),t=un(t,-65504,65504),is.floatView[0]=t;const e=is.uint32View[0],i=e>>23&511;return is.baseTable[i]+((8388607&e)>>is.shiftTable[i])}(t)}static fromHalfFloat(t){return function(t){const e=t>>10;return is.uint32View[0]=is.mantissaTable[is.offsetTable[e]+(1023&t)]+is.exponentTable[e],is.floatView[0]}(t)}}const ss=new vn,as=new fn;let os=0;class ls{constructor(t,e,i=!1){if(Array.isArray(t))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:os++}),this.name="",this.array=t,this.itemSize=e,this.count=void 0!==t?t.length/e:0,this.normalized=i,this.usage=qi,this.updateRanges=[],this.gpuType=Ee,this.version=0}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.name=t.name,this.array=new t.array.constructor(t.array),this.itemSize=t.itemSize,this.count=t.count,this.normalized=t.normalized,this.usage=t.usage,this.gpuType=t.gpuType,this}copyAt(t,e,i){t*=this.itemSize,i*=e.itemSize;for(let n=0,r=this.itemSize;n<r;n++)this.array[t+n]=e.array[i+n];return this}copyArray(t){return this.array.set(t),this}applyMatrix3(t){if(2===this.itemSize)for(let e=0,i=this.count;e<i;e++)as.fromBufferAttribute(this,e),as.applyMatrix3(t),this.setXY(e,as.x,as.y);else if(3===this.itemSize)for(let e=0,i=this.count;e<i;e++)ss.fromBufferAttribute(this,e),ss.applyMatrix3(t),this.setXYZ(e,ss.x,ss.y,ss.z);return this}applyMatrix4(t){for(let e=0,i=this.count;e<i;e++)ss.fromBufferAttribute(this,e),ss.applyMatrix4(t),this.setXYZ(e,ss.x,ss.y,ss.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)ss.fromBufferAttribute(this,e),ss.applyNormalMatrix(t),this.setXYZ(e,ss.x,ss.y,ss.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)ss.fromBufferAttribute(this,e),ss.transformDirection(t),this.setXYZ(e,ss.x,ss.y,ss.z);return this}set(t,e=0){return this.array.set(t,e),this}getComponent(t,e){let i=this.array[t*this.itemSize+e];return this.normalized&&(i=An(i,this.array)),i}setComponent(t,e,i){return this.normalized&&(i=gn(i,this.array)),this.array[t*this.itemSize+e]=i,this}getX(t){let e=this.array[t*this.itemSize];return this.normalized&&(e=An(e,this.array)),e}setX(t,e){return this.normalized&&(e=gn(e,this.array)),this.array[t*this.itemSize]=e,this}getY(t){let e=this.array[t*this.itemSize+1];return this.normalized&&(e=An(e,this.array)),e}setY(t,e){return this.normalized&&(e=gn(e,this.array)),this.array[t*this.itemSize+1]=e,this}getZ(t){let e=this.array[t*this.itemSize+2];return this.normalized&&(e=An(e,this.array)),e}setZ(t,e){return this.normalized&&(e=gn(e,this.array)),this.array[t*this.itemSize+2]=e,this}getW(t){let e=this.array[t*this.itemSize+3];return this.normalized&&(e=An(e,this.array)),e}setW(t,e){return this.normalized&&(e=gn(e,this.array)),this.array[t*this.itemSize+3]=e,this}setXY(t,e,i){return t*=this.itemSize,this.normalized&&(e=gn(e,this.array),i=gn(i,this.array)),this.array[t+0]=e,this.array[t+1]=i,this}setXYZ(t,e,i,n){return t*=this.itemSize,this.normalized&&(e=gn(e,this.array),i=gn(i,this.array),n=gn(n,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this}setXYZW(t,e,i,n,r){return t*=this.itemSize,this.normalized&&(e=gn(e,this.array),i=gn(i,this.array),n=gn(n,this.array),r=gn(r,this.array)),this.array[t+0]=e,this.array[t+1]=i,this.array[t+2]=n,this.array[t+3]=r,this}onUpload(t){return this.onUploadCallback=t,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const t={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return""!==this.name&&(t.name=this.name),this.usage!==qi&&(t.usage=this.usage),t}}class cs extends ls{constructor(t,e,i){super(new Uint16Array(t),e,i)}}class hs extends ls{constructor(t,e,i){super(new Uint32Array(t),e,i)}}class us extends ls{constructor(t,e,i){super(new Float32Array(t),e,i)}}const ds=new Gr,ps=new vn,As=new vn;class gs{constructor(t=new vn,e=-1){this.isSphere=!0,this.center=t,this.radius=e}set(t,e){return this.center.copy(t),this.radius=e,this}setFromPoints(t,e){const i=this.center;void 0!==e?i.copy(e):ds.setFromPoints(t).getCenter(i);let n=0;for(let e=0,r=t.length;e<r;e++)n=Math.max(n,i.distanceToSquared(t[e]));return this.radius=Math.sqrt(n),this}copy(t){return this.center.copy(t.center),this.radius=t.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(t){return t.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(t){return t.distanceTo(this.center)-this.radius}intersectsSphere(t){const e=this.radius+t.radius;return t.center.distanceToSquared(this.center)<=e*e}intersectsBox(t){return t.intersectsSphere(this)}intersectsPlane(t){return Math.abs(t.distanceToPoint(this.center))<=this.radius}clampPoint(t,e){const i=this.center.distanceToSquared(t);return e.copy(t),i>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(t){return this.isEmpty()?(t.makeEmpty(),t):(t.set(this.center,this.center),t.expandByScalar(this.radius),t)}applyMatrix4(t){return this.center.applyMatrix4(t),this.radius=this.radius*t.getMaxScaleOnAxis(),this}translate(t){return this.center.add(t),this}expandByPoint(t){if(this.isEmpty())return this.center.copy(t),this.radius=0,this;ps.subVectors(t,this.center);const e=ps.lengthSq();if(e>this.radius*this.radius){const t=Math.sqrt(e),i=.5*(t-this.radius);this.center.addScaledVector(ps,i/t),this.radius+=i}return this}union(t){return t.isEmpty()?this:this.isEmpty()?(this.copy(t),this):(!0===this.center.equals(t.center)?this.radius=Math.max(this.radius,t.radius):(As.subVectors(t.center,this.center).setLength(t.radius),this.expandByPoint(ps.copy(t.center).add(As)),this.expandByPoint(ps.copy(t.center).sub(As))),this)}equals(t){return t.center.equals(this.center)&&t.radius===this.radius}clone(){return(new this.constructor).copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(t){return this.radius=t.radius,this.center.fromArray(t.center),this}}let ms=0;const fs=new Hn,bs=new mr,vs=new vn,ys=new Gr,xs=new Gr,_s=new vn;class Es extends sn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:ms++}),this.uuid=hn(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(t){return Array.isArray(t)?this.index=new(function(t){for(let e=t.length-1;e>=0;--e)if(t[e]>=65535)return!0;return!1}(t)?hs:cs)(t,1):this.index=t,this}setIndirect(t,e=0){return this.indirect=t,this.indirectOffset=e,this}getIndirect(){return this.indirect}getAttribute(t){return this.attributes[t]}setAttribute(t,e){return this.attributes[t]=e,this}deleteAttribute(t){return delete this.attributes[t],this}hasAttribute(t){return void 0!==this.attributes[t]}addGroup(t,e,i=0){this.groups.push({start:t,count:e,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(t,e){this.drawRange.start=t,this.drawRange.count=e}applyMatrix4(t){const e=this.attributes.position;void 0!==e&&(e.applyMatrix4(t),e.needsUpdate=!0);const i=this.attributes.normal;if(void 0!==i){const e=(new _n).getNormalMatrix(t);i.applyNormalMatrix(e),i.needsUpdate=!0}const n=this.attributes.tangent;return void 0!==n&&(n.transformDirection(t),n.needsUpdate=!0),null!==this.boundingBox&&this.computeBoundingBox(),null!==this.boundingSphere&&this.computeBoundingSphere(),this}applyQuaternion(t){return fs.makeRotationFromQuaternion(t),this.applyMatrix4(fs),this}rotateX(t){return fs.makeRotationX(t),this.applyMatrix4(fs),this}rotateY(t){return fs.makeRotationY(t),this.applyMatrix4(fs),this}rotateZ(t){return fs.makeRotationZ(t),this.applyMatrix4(fs),this}translate(t,e,i){return fs.makeTranslation(t,e,i),this.applyMatrix4(fs),this}scale(t,e,i){return fs.makeScale(t,e,i),this.applyMatrix4(fs),this}lookAt(t){return bs.lookAt(t),bs.updateMatrix(),this.applyMatrix4(bs.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(vs).negate(),this.translate(vs.x,vs.y,vs.z),this}setFromPoints(t){const e=this.getAttribute("position");if(void 0===e){const e=[];for(let i=0,n=t.length;i<n;i++){const n=t[i];e.push(n.x,n.y,n.z||0)}this.setAttribute("position",new us(e,3))}else{const i=Math.min(t.length,e.count);for(let n=0;n<i;n++){const i=t[n];e.setXYZ(n,i.x,i.y,i.z||0)}t.length>e.count&&tn("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),e.needsUpdate=!0}return this}computeBoundingBox(){null===this.boundingBox&&(this.boundingBox=new Gr);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return en("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),void this.boundingBox.set(new vn(-1/0,-1/0,-1/0),new vn(1/0,1/0,1/0));if(void 0!==t){if(this.boundingBox.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t<i;t++){const i=e[t];ys.setFromBufferAttribute(i),this.morphTargetsRelative?(_s.addVectors(this.boundingBox.min,ys.min),this.boundingBox.expandByPoint(_s),_s.addVectors(this.boundingBox.max,ys.max),this.boundingBox.expandByPoint(_s)):(this.boundingBox.expandByPoint(ys.min),this.boundingBox.expandByPoint(ys.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&en('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){null===this.boundingSphere&&(this.boundingSphere=new gs);const t=this.attributes.position,e=this.morphAttributes.position;if(t&&t.isGLBufferAttribute)return en("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),void this.boundingSphere.set(new vn,1/0);if(t){const i=this.boundingSphere.center;if(ys.setFromBufferAttribute(t),e)for(let t=0,i=e.length;t<i;t++){const i=e[t];xs.setFromBufferAttribute(i),this.morphTargetsRelative?(_s.addVectors(ys.min,xs.min),ys.expandByPoint(_s),_s.addVectors(ys.max,xs.max),ys.expandByPoint(_s)):(ys.expandByPoint(xs.min),ys.expandByPoint(xs.max))}ys.getCenter(i);let n=0;for(let e=0,r=t.count;e<r;e++)_s.fromBufferAttribute(t,e),n=Math.max(n,i.distanceToSquared(_s));if(e)for(let r=0,s=e.length;r<s;r++){const s=e[r],a=this.morphTargetsRelative;for(let e=0,r=s.count;e<r;e++)_s.fromBufferAttribute(s,e),a&&(vs.fromBufferAttribute(t,e),_s.add(vs)),n=Math.max(n,i.distanceToSquared(_s))}this.boundingSphere.radius=Math.sqrt(n),isNaN(this.boundingSphere.radius)&&en('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const t=this.index,e=this.attributes;if(null===t||void 0===e.position||void 0===e.normal||void 0===e.uv)return void en("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");const i=e.position,n=e.normal,r=e.uv;!1===this.hasAttribute("tangent")&&this.setAttribute("tangent",new ls(new Float32Array(4*i.count),4));const s=this.getAttribute("tangent"),a=[],o=[];for(let t=0;t<i.count;t++)a[t]=new vn,o[t]=new vn;const l=new vn,c=new vn,h=new vn,u=new fn,d=new fn,p=new fn,A=new vn,g=new vn;function m(t,e,n){l.fromBufferAttribute(i,t),c.fromBufferAttribute(i,e),h.fromBufferAttribute(i,n),u.fromBufferAttribute(r,t),d.fromBufferAttribute(r,e),p.fromBufferAttribute(r,n),c.sub(l),h.sub(l),d.sub(u),p.sub(u);const s=1/(d.x*p.y-p.x*d.y);isFinite(s)&&(A.copy(c).multiplyScalar(p.y).addScaledVector(h,-d.y).multiplyScalar(s),g.copy(h).multiplyScalar(d.x).addScaledVector(c,-p.x).multiplyScalar(s),a[t].add(A),a[e].add(A),a[n].add(A),o[t].add(g),o[e].add(g),o[n].add(g))}let f=this.groups;0===f.length&&(f=[{start:0,count:t.count}]);for(let e=0,i=f.length;e<i;++e){const i=f[e],n=i.start;for(let e=n,r=n+i.count;e<r;e+=3)m(t.getX(e+0),t.getX(e+1),t.getX(e+2))}const b=new vn,v=new vn,y=new vn,x=new vn;function _(t){y.fromBufferAttribute(n,t),x.copy(y);const e=a[t];b.copy(e),b.sub(y.multiplyScalar(y.dot(e))).normalize(),v.crossVectors(x,e);const i=v.dot(o[t])<0?-1:1;s.setXYZW(t,b.x,b.y,b.z,i)}for(let e=0,i=f.length;e<i;++e){const i=f[e],n=i.start;for(let e=n,r=n+i.count;e<r;e+=3)_(t.getX(e+0)),_(t.getX(e+1)),_(t.getX(e+2))}}computeVertexNormals(){const t=this.index,e=this.getAttribute("position");if(void 0!==e){let i=this.getAttribute("normal");if(void 0===i)i=new ls(new Float32Array(3*e.count),3),this.setAttribute("normal",i);else for(let t=0,e=i.count;t<e;t++)i.setXYZ(t,0,0,0);const n=new vn,r=new vn,s=new vn,a=new vn,o=new vn,l=new vn,c=new vn,h=new vn;if(t)for(let u=0,d=t.count;u<d;u+=3){const d=t.getX(u+0),p=t.getX(u+1),A=t.getX(u+2);n.fromBufferAttribute(e,d),r.fromBufferAttribute(e,p),s.fromBufferAttribute(e,A),c.subVectors(s,r),h.subVectors(n,r),c.cross(h),a.fromBufferAttribute(i,d),o.fromBufferAttribute(i,p),l.fromBufferAttribute(i,A),a.add(c),o.add(c),l.add(c),i.setXYZ(d,a.x,a.y,a.z),i.setXYZ(p,o.x,o.y,o.z),i.setXYZ(A,l.x,l.y,l.z)}else for(let t=0,a=e.count;t<a;t+=3)n.fromBufferAttribute(e,t+0),r.fromBufferAttribute(e,t+1),s.fromBufferAttribute(e,t+2),c.subVectors(s,r),h.subVectors(n,r),c.cross(h),i.setXYZ(t+0,c.x,c.y,c.z),i.setXYZ(t+1,c.x,c.y,c.z),i.setXYZ(t+2,c.x,c.y,c.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const t=this.attributes.normal;for(let e=0,i=t.count;e<i;e++)_s.fromBufferAttribute(t,e),_s.normalize(),t.setXYZ(e,_s.x,_s.y,_s.z)}toNonIndexed(){function t(t,e){const i=t.array,n=t.itemSize,r=t.normalized,s=new i.constructor(e.length*n);let a=0,o=0;for(let r=0,l=e.length;r<l;r++){a=t.isInterleavedBufferAttribute?e[r]*t.data.stride+t.offset:e[r]*n;for(let t=0;t<n;t++)s[o++]=i[a++]}return new ls(s,n,r)}if(null===this.index)return tn("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const e=new Es,i=this.index.array,n=this.attributes;for(const r in n){const s=t(n[r],i);e.setAttribute(r,s)}const r=this.morphAttributes;for(const n in r){const s=[],a=r[n];for(let e=0,n=a.length;e<n;e++){const n=t(a[e],i);s.push(n)}e.morphAttributes[n]=s}e.morphTargetsRelative=this.morphTargetsRelative;const s=this.groups;for(let t=0,i=s.length;t<i;t++){const i=s[t];e.addGroup(i.start,i.count,i.materialIndex)}return e}toJSON(){const t={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(t.uuid=this.uuid,t.type=this.type,""!==this.name&&(t.name=this.name),Object.keys(this.userData).length>0&&(t.userData=this.userData),void 0!==this.parameters){const e=this.parameters;for(const i in e)void 0!==e[i]&&(t[i]=e[i]);return t}t.data={attributes:{}};const e=this.index;null!==e&&(t.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const i=this.attributes;for(const e in i){const n=i[e];t.data.attributes[e]=n.toJSON(t.data)}const n={};let r=!1;for(const e in this.morphAttributes){const i=this.morphAttributes[e],s=[];for(let e=0,n=i.length;e<n;e++){const n=i[e];s.push(n.toJSON(t.data))}s.length>0&&(n[e]=s,r=!0)}r&&(t.data.morphAttributes=n,t.data.morphTargetsRelative=this.morphTargetsRelative);const s=this.groups;s.length>0&&(t.data.groups=JSON.parse(JSON.stringify(s)));const a=this.boundingSphere;return null!==a&&(t.data.boundingSphere=a.toJSON()),t}clone(){return(new this.constructor).copy(this)}copy(t){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=t.name;const i=t.index;null!==i&&this.setIndex(i.clone());const n=t.attributes;for(const t in n){const i=n[t];this.setAttribute(t,i.clone(e))}const r=t.morphAttributes;for(const t in r){const i=[],n=r[t];for(let t=0,r=n.length;t<r;t++)i.push(n[t].clone(e));this.morphAttributes[t]=i}this.morphTargetsRelative=t.morphTargetsRelative;const s=t.groups;for(let t=0,e=s.length;t<e;t++){const e=s[t];this.addGroup(e.start,e.count,e.materialIndex)}const a=t.boundingBox;null!==a&&(this.boundingBox=a.clone());const o=t.boundingSphere;return null!==o&&(this.boundingSphere=o.clone()),this.drawRange.start=t.drawRange.start,this.drawRange.count=t.drawRange.count,this.userData=t.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Ss{constructor(t,e){this.isInterleavedBuffer=!0,this.array=t,this.stride=e,this.count=void 0!==t?t.length/e:0,this.usage=qi,this.updateRanges=[],this.version=0,this.uuid=hn()}onUploadCallback(){}set needsUpdate(t){!0===t&&this.version++}setUsage(t){return this.usage=t,this}addUpdateRange(t,e){this.updateRanges.push({start:t,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(t){return this.array=new t.array.constructor(t.array),this.count=t.count,this.stride=t.stride,this.usage=t.usage,this}copyAt(t,e,i){t*=this.stride,i*=e.stride;for(let n=0,r=this.stride;n<r;n++)this.array[t+n]=e.array[i+n];return this}set(t,e=0){return this.array.set(t,e),this}clone(t){void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=hn()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const e=new this.array.constructor(t.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(e,this.stride);return i.setUsage(this.usage),i}onUpload(t){return this.onUploadCallback=t,this}toJSON(t){return void 0===t.arrayBuffers&&(t.arrayBuffers={}),void 0===this.array.buffer._uuid&&(this.array.buffer._uuid=hn()),void 0===t.arrayBuffers[this.array.buffer._uuid]&&(t.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const Cs=new vn;class ws{constructor(t,e,i,n=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=t,this.itemSize=e,this.offset=i,this.normalized=n}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(t){this.data.needsUpdate=t}applyMatrix4(t){for(let e=0,i=this.data.count;e<i;e++)Cs.fromBufferAttribute(this,e),Cs.applyMatrix4(t),this.setXYZ(e,Cs.x,Cs.y,Cs.z);return this}applyNormalMatrix(t){for(let e=0,i=this.count;e<i;e++)Cs.fromBufferAttribute(this,e),Cs.applyNormalMatrix(t),this.setXYZ(e,Cs.x,Cs.y,Cs.z);return this}transformDirection(t){for(let e=0,i=this.count;e<i;e++)Cs.fromBufferAttribute(this,e),Cs.transformDirection(t),this.setXYZ(e,Cs.x,Cs.y,Cs.z);return this}getComponent(t,e){let i=this.array[t*this.data.stride+this.offset+e];return this.normalized&&(i=An(i,this.array)),i}setComponent(t,e,i){return this.normalized&&(i=gn(i,this.array)),this.data.array[t*this.data.stride+this.offset+e]=i,this}setX(t,e){return this.normalized&&(e=gn(e,this.array)),this.data.array[t*this.data.stride+this.offset]=e,this}setY(t,e){return this.normalized&&(e=gn(e,this.array)),this.data.array[t*this.data.stride+this.offset+1]=e,this}setZ(t,e){return this.normalized&&(e=gn(e,this.array)),this.data.array[t*this.data.stride+this.offset+2]=e,this}setW(t,e){return this.normalized&&(e=gn(e,this.array)),this.data.array[t*this.data.stride+this.offset+3]=e,this}getX(t){let e=this.data.array[t*this.data.stride+this.offset];return this.normalized&&(e=An(e,this.array)),e}getY(t){let e=this.data.array[t*this.data.stride+this.offset+1];return this.normalized&&(e=An(e,this.array)),e}getZ(t){let e=this.data.array[t*this.data.stride+this.offset+2];return this.normalized&&(e=An(e,this.array)),e}getW(t){let e=this.data.array[t*this.data.stride+this.offset+3];return this.normalized&&(e=An(e,this.array)),e}setXY(t,e,i){return t=t*this.data.stride+this.offset,this.normalized&&(e=gn(e,this.array),i=gn(i,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=i,this}setXYZ(t,e,i,n){return t=t*this.data.stride+this.offset,this.normalized&&(e=gn(e,this.array),i=gn(i,this.array),n=gn(n,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=n,this}setXYZW(t,e,i,n,r){return t=t*this.data.stride+this.offset,this.normalized&&(e=gn(e,this.array),i=gn(i,this.array),n=gn(n,this.array),r=gn(r,this.array)),this.data.array[t+0]=e,this.data.array[t+1]=i,this.data.array[t+2]=n,this.data.array[t+3]=r,this}clone(t){if(void 0===t){$i("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const i=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[i+e])}return new ls(new this.array.constructor(t),this.itemSize,this.normalized)}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.clone(t)),new ws(t.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(t){if(void 0===t){$i("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let e=0;e<this.count;e++){const i=e*this.data.stride+this.offset;for(let e=0;e<this.itemSize;e++)t.push(this.data.array[i+e])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}return void 0===t.interleavedBuffers&&(t.interleavedBuffers={}),void 0===t.interleavedBuffers[this.data.uuid]&&(t.interleavedBuffers[this.data.uuid]=this.data.toJSON(t)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}let Ms=0,Is=class extends sn{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:Ms++}),this.uuid=hn(),this.name="",this.type="Material",this.blending=1,this.side=0,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=204,this.blendDst=205,this.blendEquation=vt,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Sr(0,0,0),this.blendAlpha=0,this.depthFunc=3,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=519,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Ui,this.stencilZFail=Ui,this.stencilZPass=Ui,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(t){this._alphaTest>0!=t>0&&this.version++,this._alphaTest=t}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(t){if(void 0!==t)for(const e in t){const i=t[e];if(void 0===i){tn(`Material: parameter '${e}' has value of undefined.`);continue}const n=this[e];void 0!==n?n&&n.isColor?n.set(i):n&&n.isVector3&&i&&i.isVector3?n.copy(i):this[e]=i:tn(`Material: '${e}' is not a property of THREE.${this.type}.`)}}toJSON(t){const e=void 0===t||"string"==typeof t;e&&(t={textures:{},images:{}});const i={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};function n(t){const e=[];for(const i in t){const n=t[i];delete n.metadata,e.push(n)}return e}if(i.uuid=this.uuid,i.type=this.type,""!==this.name&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),void 0!==this.roughness&&(i.roughness=this.roughness),void 0!==this.metalness&&(i.metalness=this.metalness),void 0!==this.sheen&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),void 0!==this.sheenRoughness&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),void 0!==this.emissiveIntensity&&1!==this.emissiveIntensity&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),void 0!==this.specularIntensity&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),void 0!==this.shininess&&(i.shininess=this.shininess),void 0!==this.clearcoat&&(i.clearcoat=this.clearcoat),void 0!==this.clearcoatRoughness&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(t).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(t).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(t).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(i.sheenColorMap=this.sheenColorMap.toJSON(t).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(i.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(t).uuid),void 0!==this.dispersion&&(i.dispersion=this.dispersion),void 0!==this.iridescence&&(i.iridescence=this.iridescence),void 0!==this.iridescenceIOR&&(i.iridescenceIOR=this.iridescenceIOR),void 0!==this.iridescenceThicknessRange&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(t).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(t).uuid),void 0!==this.anisotropy&&(i.anisotropy=this.anisotropy),void 0!==this.anisotropyRotation&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(t).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(t).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(t).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(t).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(t).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(t).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(t).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(t).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(t).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(t).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(t).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(t).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(t).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(t).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(t).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(t).uuid,void 0!==this.combine&&(i.combine=this.combine)),void 0!==this.envMapRotation&&(i.envMapRotation=this.envMapRotation.toArray()),void 0!==this.envMapIntensity&&(i.envMapIntensity=this.envMapIntensity),void 0!==this.reflectivity&&(i.reflectivity=this.reflectivity),void 0!==this.refractionRatio&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(t).uuid),void 0!==this.transmission&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(t).uuid),void 0!==this.thickness&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(t).uuid),void 0!==this.attenuationDistance&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),void 0!==this.attenuationColor&&(i.attenuationColor=this.attenuationColor.getHex()),void 0!==this.size&&(i.size=this.size),null!==this.shadowSide&&(i.shadowSide=this.shadowSide),void 0!==this.sizeAttenuation&&(i.sizeAttenuation=this.sizeAttenuation),1!==this.blending&&(i.blending=this.blending),0!==this.side&&(i.side=this.side),!0===this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),!0===this.transparent&&(i.transparent=!0),204!==this.blendSrc&&(i.blendSrc=this.blendSrc),205!==this.blendDst&&(i.blendDst=this.blendDst),this.blendEquation!==vt&&(i.blendEquation=this.blendEquation),null!==this.blendSrcAlpha&&(i.blendSrcAlpha=this.blendSrcAlpha),null!==this.blendDstAlpha&&(i.blendDstAlpha=this.blendDstAlpha),null!==this.blendEquationAlpha&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),0!==this.blendAlpha&&(i.blendAlpha=this.blendAlpha),3!==this.depthFunc&&(i.depthFunc=this.depthFunc),!1===this.depthTest&&(i.depthTest=this.depthTest),!1===this.depthWrite&&(i.depthWrite=this.depthWrite),!1===this.colorWrite&&(i.colorWrite=this.colorWrite),255!==this.stencilWriteMask&&(i.stencilWriteMask=this.stencilWriteMask),519!==this.stencilFunc&&(i.stencilFunc=this.stencilFunc),0!==this.stencilRef&&(i.stencilRef=this.stencilRef),255!==this.stencilFuncMask&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Ui&&(i.stencilFail=this.stencilFail),this.stencilZFail!==Ui&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==Ui&&(i.stencilZPass=this.stencilZPass),!0===this.stencilWrite&&(i.stencilWrite=this.stencilWrite),void 0!==this.rotation&&0!==this.rotation&&(i.rotation=this.rotation),!0===this.polygonOffset&&(i.polygonOffset=!0),0!==this.polygonOffsetFactor&&(i.polygonOffsetFactor=this.polygonOffsetFactor),0!==this.polygonOffsetUnits&&(i.polygonOffsetUnits=this.polygonOffsetUnits),void 0!==this.linewidth&&1!==this.linewidth&&(i.linewidth=this.linewidth),void 0!==this.dashSize&&(i.dashSize=this.dashSize),void 0!==this.gapSize&&(i.gapSize=this.gapSize),void 0!==this.scale&&(i.scale=this.scale),!0===this.dithering&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),!0===this.alphaHash&&(i.alphaHash=!0),!0===this.alphaToCoverage&&(i.alphaToCoverage=!0),!0===this.premultipliedAlpha&&(i.premultipliedAlpha=!0),!0===this.forceSinglePass&&(i.forceSinglePass=!0),!1===this.allowOverride&&(i.allowOverride=!1),!0===this.wireframe&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),"round"!==this.wireframeLinecap&&(i.wireframeLinecap=this.wireframeLinecap),"round"!==this.wireframeLinejoin&&(i.wireframeLinejoin=this.wireframeLinejoin),!0===this.flatShading&&(i.flatShading=!0),!1===this.visible&&(i.visible=!1),!1===this.toneMapped&&(i.toneMapped=!1),!1===this.fog&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData),e){const e=n(t.textures),r=n(t.images);e.length>0&&(i.textures=e),r.length>0&&(i.images=r)}return i}clone(){return(new this.constructor).copy(this)}copy(t){this.name=t.name,this.blending=t.blending,this.side=t.side,this.vertexColors=t.vertexColors,this.opacity=t.opacity,this.transparent=t.transparent,this.blendSrc=t.blendSrc,this.blendDst=t.blendDst,this.blendEquation=t.blendEquation,this.blendSrcAlpha=t.blendSrcAlpha,this.blendDstAlpha=t.blendDstAlpha,this.blendEquationAlpha=t.blendEquationAlpha,this.blendColor.copy(t.blendColor),this.blendAlpha=t.blendAlpha,this.depthFunc=t.depthFunc,this.depthTest=t.depthTest,this.depthWrite=t.depthWrite,this.stencilWriteMask=t.stencilWriteMask,this.stencilFunc=t.stencilFunc,this.stencilRef=t.stencilRef,this.stencilFuncMask=t.stencilFuncMask,this.stencilFail=t.stencilFail,this.stencilZFail=t.stencilZFail,this.stencilZPass=t.stencilZPass,this.stencilWrite=t.stencilWrite;const e=t.clippingPlanes;let i=null;if(null!==e){const t=e.length;i=new Array(t);for(let n=0;n!==t;++n)i[n]=e[n].clone()}return this.clippingPlanes=i,this.clipIntersection=t.clipIntersection,this.clipShadows=t.clipShadows,this.shadowSide=t.shadowSide,this.colorWrite=t.colorWrite,this.precision=t.precision,this.polygonOffset=t.polygonOffset,this.polygonOffsetFactor=t.polygonOffsetFactor,this.polygonOffsetUnits=t.polygonOffsetUnits,this.dithering=t.dithering,this.alphaTest=t.alphaTest,this.alphaHash=t.alphaHash,this.alphaToCoverage=t.alphaToCoverage,this.premultipliedAlpha=t.premultipliedAlpha,this.forceSinglePass=t.forceSinglePass,this.allowOverride=t.allowOverride,this.visible=t.visible,this.toneMapped=t.toneMapped,this.userData=JSON.parse(JSON.stringify(t.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(t){!0===t&&this.version++}};const Ts=new vn,Bs=new vn,Rs=new vn,Ds=new vn,Ls=new vn,Ps=new vn,Fs=new vn;class Us{constructor(t=new vn,e=new vn(0,0,-1)){this.origin=t,this.direction=e}set(t,e){return this.origin.copy(t),this.direction.copy(e),this}copy(t){return this.origin.copy(t.origin),this.direction.copy(t.direction),this}at(t,e){return e.copy(this.origin).addScaledVector(this.direction,t)}lookAt(t){return this.direction.copy(t).sub(this.origin).normalize(),this}recast(t){return this.origin.copy(this.at(t,Ts)),this}closestPointToPoint(t,e){e.subVectors(t,this.origin);const i=e.dot(this.direction);return i<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(t){return Math.sqrt(this.distanceSqToPoint(t))}distanceSqToPoint(t){const e=Ts.subVectors(t,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(t):(Ts.copy(this.origin).addScaledVector(this.direction,e),Ts.distanceToSquared(t))}distanceSqToSegment(t,e,i,n){Bs.copy(t).add(e).multiplyScalar(.5),Rs.copy(e).sub(t).normalize(),Ds.copy(this.origin).sub(Bs);const r=.5*t.distanceTo(e),s=-this.direction.dot(Rs),a=Ds.dot(this.direction),o=-Ds.dot(Rs),l=Ds.lengthSq(),c=Math.abs(1-s*s);let h,u,d,p;if(c>0)if(h=s*o-a,u=s*a-o,p=r*c,h>=0)if(u>=-p)if(u<=p){const t=1/c;h*=t,u*=t,d=h*(h+s*u+2*a)+u*(s*h+u+2*o)+l}else u=r,h=Math.max(0,-(s*u+a)),d=-h*h+u*(u+2*o)+l;else u=-r,h=Math.max(0,-(s*u+a)),d=-h*h+u*(u+2*o)+l;else u<=-p?(h=Math.max(0,-(-s*r+a)),u=h>0?-r:Math.min(Math.max(-r,-o),r),d=-h*h+u*(u+2*o)+l):u<=p?(h=0,u=Math.min(Math.max(-r,-o),r),d=u*(u+2*o)+l):(h=Math.max(0,-(s*r+a)),u=h>0?r:Math.min(Math.max(-r,-o),r),d=-h*h+u*(u+2*o)+l);else u=s>0?-r:r,h=Math.max(0,-(s*u+a)),d=-h*h+u*(u+2*o)+l;return i&&i.copy(this.origin).addScaledVector(this.direction,h),n&&n.copy(Bs).addScaledVector(Rs,u),d}intersectSphere(t,e){Ts.subVectors(t.center,this.origin);const i=Ts.dot(this.direction),n=Ts.dot(Ts)-i*i,r=t.radius*t.radius;if(n>r)return null;const s=Math.sqrt(r-n),a=i-s,o=i+s;return o<0?null:a<0?this.at(o,e):this.at(a,e)}intersectsSphere(t){return!(t.radius<0)&&this.distanceSqToPoint(t.center)<=t.radius*t.radius}distanceToPlane(t){const e=t.normal.dot(this.direction);if(0===e)return 0===t.distanceToPoint(this.origin)?0:null;const i=-(this.origin.dot(t.normal)+t.constant)/e;return i>=0?i:null}intersectPlane(t,e){const i=this.distanceToPlane(t);return null===i?null:this.at(i,e)}intersectsPlane(t){const e=t.distanceToPoint(this.origin);if(0===e)return!0;return t.normal.dot(this.direction)*e<0}intersectBox(t,e){let i,n,r,s,a,o;const l=1/this.direction.x,c=1/this.direction.y,h=1/this.direction.z,u=this.origin;return l>=0?(i=(t.min.x-u.x)*l,n=(t.max.x-u.x)*l):(i=(t.max.x-u.x)*l,n=(t.min.x-u.x)*l),c>=0?(r=(t.min.y-u.y)*c,s=(t.max.y-u.y)*c):(r=(t.max.y-u.y)*c,s=(t.min.y-u.y)*c),i>s||r>n?null:((r>i||isNaN(i))&&(i=r),(s<n||isNaN(n))&&(n=s),h>=0?(a=(t.min.z-u.z)*h,o=(t.max.z-u.z)*h):(a=(t.max.z-u.z)*h,o=(t.min.z-u.z)*h),i>o||a>n?null:((a>i||i!=i)&&(i=a),(o<n||n!=n)&&(n=o),n<0?null:this.at(i>=0?i:n,e)))}intersectsBox(t){return null!==this.intersectBox(t,Ts)}intersectTriangle(t,e,i,n,r){Ls.subVectors(e,t),Ps.subVectors(i,t),Fs.crossVectors(Ls,Ps);let s,a=this.direction.dot(Fs);if(a>0){if(n)return null;s=1}else{if(!(a<0))return null;s=-1,a=-a}Ds.subVectors(this.origin,t);const o=s*this.direction.dot(Ps.crossVectors(Ds,Ps));if(o<0)return null;const l=s*this.direction.dot(Ls.cross(Ds));if(l<0)return null;if(o+l>a)return null;const c=-s*Ds.dot(Fs);return c<0?null:this.at(c/a,r)}applyMatrix4(t){return this.origin.applyMatrix4(t),this.direction.transformDirection(t),this}equals(t){return t.origin.equals(this.origin)&&t.direction.equals(this.direction)}clone(){return(new this.constructor).copy(this)}}class Ns extends Is{constructor(t){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Sr(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Zn,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.specularMap=t.specularMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.combine=t.combine,this.reflectivity=t.reflectivity,this.refractionRatio=t.refractionRatio,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.fog=t.fog,this}}const Os=new Hn,ks=new Us,Qs=new gs,Gs=new vn,zs=new vn,Hs=new vn,Vs=new vn,qs=new vn,js=new vn,Ws=new vn,Xs=new vn;class Ks extends mr{constructor(t=new Es,e=new Ns){super(),this.isMesh=!0,this.type="Mesh",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),void 0!==t.morphTargetInfluences&&(this.morphTargetInfluences=t.morphTargetInfluences.slice()),void 0!==t.morphTargetDictionary&&(this.morphTargetDictionary=Object.assign({},t.morphTargetDictionary)),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const i=t[e[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=i.length;t<e;t++){const e=i[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}getVertexPosition(t,e){const i=this.geometry,n=i.attributes.position,r=i.morphAttributes.position,s=i.morphTargetsRelative;e.fromBufferAttribute(n,t);const a=this.morphTargetInfluences;if(r&&a){js.set(0,0,0);for(let i=0,n=r.length;i<n;i++){const n=a[i],o=r[i];0!==n&&(qs.fromBufferAttribute(o,t),s?js.addScaledVector(qs,n):js.addScaledVector(qs.sub(e),n))}e.add(js)}return e}raycast(t,e){const i=this.geometry,n=this.material,r=this.matrixWorld;if(void 0!==n){if(null===i.boundingSphere&&i.computeBoundingSphere(),Qs.copy(i.boundingSphere),Qs.applyMatrix4(r),ks.copy(t.ray).recast(t.near),!1===Qs.containsPoint(ks.origin)){if(null===ks.intersectSphere(Qs,Gs))return;if(ks.origin.distanceToSquared(Gs)>(t.far-t.near)**2)return}Os.copy(r).invert(),ks.copy(t.ray).applyMatrix4(Os),null!==i.boundingBox&&!1===ks.intersectsBox(i.boundingBox)||this._computeIntersections(t,e,ks)}}_computeIntersections(t,e,i){let n;const r=this.geometry,s=this.material,a=r.index,o=r.attributes.position,l=r.attributes.uv,c=r.attributes.uv1,h=r.attributes.normal,u=r.groups,d=r.drawRange;if(null!==a)if(Array.isArray(s))for(let r=0,o=u.length;r<o;r++){const o=u[r],p=s[o.materialIndex];for(let r=Math.max(o.start,d.start),s=Math.min(a.count,Math.min(o.start+o.count,d.start+d.count));r<s;r+=3){n=Js(this,p,t,i,l,c,h,a.getX(r),a.getX(r+1),a.getX(r+2)),n&&(n.faceIndex=Math.floor(r/3),n.face.materialIndex=o.materialIndex,e.push(n))}}else{for(let r=Math.max(0,d.start),o=Math.min(a.count,d.start+d.count);r<o;r+=3){n=Js(this,s,t,i,l,c,h,a.getX(r),a.getX(r+1),a.getX(r+2)),n&&(n.faceIndex=Math.floor(r/3),e.push(n))}}else if(void 0!==o)if(Array.isArray(s))for(let r=0,a=u.length;r<a;r++){const a=u[r],p=s[a.materialIndex];for(let r=Math.max(a.start,d.start),s=Math.min(o.count,Math.min(a.start+a.count,d.start+d.count));r<s;r+=3){n=Js(this,p,t,i,l,c,h,r,r+1,r+2),n&&(n.faceIndex=Math.floor(r/3),n.face.materialIndex=a.materialIndex,e.push(n))}}else{for(let r=Math.max(0,d.start),a=Math.min(o.count,d.start+d.count);r<a;r+=3){n=Js(this,s,t,i,l,c,h,r,r+1,r+2),n&&(n.faceIndex=Math.floor(r/3),e.push(n))}}}}function Js(t,e,i,n,r,s,a,o,l,c){t.getVertexPosition(o,zs),t.getVertexPosition(l,Hs),t.getVertexPosition(c,Vs);const h=function(t,e,i,n,r,s,a,o){let l;if(l=1===e.side?n.intersectTriangle(a,s,r,!0,o):n.intersectTriangle(r,s,a,0===e.side,o),null===l)return null;Xs.copy(o),Xs.applyMatrix4(t.matrixWorld);const c=i.ray.origin.distanceTo(Xs);return c<i.near||c>i.far?null:{distance:c,point:Xs.clone(),object:t}}(t,e,i,n,zs,Hs,Vs,Ws);if(h){const t=new vn;Qr.getBarycoord(Ws,zs,Hs,Vs,t),r&&(h.uv=Qr.getInterpolatedAttribute(r,o,l,c,t,new fn)),s&&(h.uv1=Qr.getInterpolatedAttribute(s,o,l,c,t,new fn)),a&&(h.normal=Qr.getInterpolatedAttribute(a,o,l,c,t,new vn),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));const e={a:o,b:l,c:c,normal:new vn,materialIndex:0};Qr.getNormal(zs,Hs,Vs,e.normal),h.face=e,h.barycoord=t}return h}const Ys=new vn,$s=new On,Zs=new On,ta=new vn,ea=new Hn,ia=new vn,na=new gs,ra=new Hn,sa=new Us;class aa extends Ks{constructor(t,e){super(t,e),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=ee,this.bindMatrix=new Hn,this.bindMatrixInverse=new Hn,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const t=this.geometry;null===this.boundingBox&&(this.boundingBox=new Gr),this.boundingBox.makeEmpty();const e=t.getAttribute("position");for(let t=0;t<e.count;t++)this.getVertexPosition(t,ia),this.boundingBox.expandByPoint(ia)}computeBoundingSphere(){const t=this.geometry;null===this.boundingSphere&&(this.boundingSphere=new gs),this.boundingSphere.makeEmpty();const e=t.getAttribute("position");for(let t=0;t<e.count;t++)this.getVertexPosition(t,ia),this.boundingSphere.expandByPoint(ia)}copy(t,e){return super.copy(t,e),this.bindMode=t.bindMode,this.bindMatrix.copy(t.bindMatrix),this.bindMatrixInverse.copy(t.bindMatrixInverse),this.skeleton=t.skeleton,null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this}raycast(t,e){const i=this.material,n=this.matrixWorld;void 0!==i&&(null===this.boundingSphere&&this.computeBoundingSphere(),na.copy(this.boundingSphere),na.applyMatrix4(n),!1!==t.ray.intersectsSphere(na)&&(ra.copy(n).invert(),sa.copy(t.ray).applyMatrix4(ra),null!==this.boundingBox&&!1===sa.intersectsBox(this.boundingBox)||this._computeIntersections(t,e,sa)))}getVertexPosition(t,e){return super.getVertexPosition(t,e),this.applyBoneTransform(t,e),e}bind(t,e){this.skeleton=t,void 0===e&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const t=new On,e=this.geometry.attributes.skinWeight;for(let i=0,n=e.count;i<n;i++){t.fromBufferAttribute(e,i);const n=1/t.manhattanLength();n!==1/0?t.multiplyScalar(n):t.set(1,0,0,0),e.setXYZW(i,t.x,t.y,t.z,t.w)}}updateMatrixWorld(t){super.updateMatrixWorld(t),this.bindMode===ee?this.bindMatrixInverse.copy(this.matrixWorld).invert():"detached"===this.bindMode?this.bindMatrixInverse.copy(this.bindMatrix).invert():tn("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(t,e){const i=this.skeleton,n=this.geometry;$s.fromBufferAttribute(n.attributes.skinIndex,t),Zs.fromBufferAttribute(n.attributes.skinWeight,t),Ys.copy(e).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let t=0;t<4;t++){const n=Zs.getComponent(t);if(0!==n){const r=$s.getComponent(t);ea.multiplyMatrices(i.bones[r].matrixWorld,i.boneInverses[r]),e.addScaledVector(ta.copy(Ys).applyMatrix4(ea),n)}}return e.applyMatrix4(this.bindMatrixInverse)}}class oa extends mr{constructor(){super(),this.isBone=!0,this.type="Bone"}}class la extends Nn{constructor(t=null,e=1,i=1,n,r,s,a,o,l=1003,c=1003,h,u){super(null,s,a,o,l,c,n,r,h,u),this.isDataTexture=!0,this.image={data:t,width:e,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const ca=new Hn,ha=new Hn;class ua{constructor(t=[],e=[]){this.uuid=hn(),this.bones=t.slice(0),this.boneInverses=e,this.boneMatrices=null,this.previousBoneMatrices=null,this.boneTexture=null,this.init()}init(){const t=this.bones,e=this.boneInverses;if(this.boneMatrices=new Float32Array(16*t.length),0===e.length)this.calculateInverses();else if(t.length!==e.length){tn("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let t=0,e=this.bones.length;t<e;t++)this.boneInverses.push(new Hn)}}calculateInverses(){this.boneInverses.length=0;for(let t=0,e=this.bones.length;t<e;t++){const e=new Hn;this.bones[t]&&e.copy(this.bones[t].matrixWorld).invert(),this.boneInverses.push(e)}}pose(){for(let t=0,e=this.bones.length;t<e;t++){const e=this.bones[t];e&&e.matrixWorld.copy(this.boneInverses[t]).invert()}for(let t=0,e=this.bones.length;t<e;t++){const e=this.bones[t];e&&(e.parent&&e.parent.isBone?(e.matrix.copy(e.parent.matrixWorld).invert(),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))}}update(){const t=this.bones,e=this.boneInverses,i=this.boneMatrices,n=this.boneTexture;for(let n=0,r=t.length;n<r;n++){const r=t[n]?t[n].matrixWorld:ha;ca.multiplyMatrices(r,e[n]),ca.toArray(i,16*n)}null!==n&&(n.needsUpdate=!0)}clone(){return new ua(this.bones,this.boneInverses)}computeBoneTexture(){let t=Math.sqrt(4*this.bones.length);t=4*Math.ceil(t/4),t=Math.max(t,4);const e=new Float32Array(t*t*4);e.set(this.boneMatrices);const i=new la(e,t,t,Re,Ee);return i.needsUpdate=!0,this.boneMatrices=e,this.boneTexture=i,this}getBoneByName(t){for(let e=0,i=this.bones.length;e<i;e++){const i=this.bones[e];if(i.name===t)return i}}dispose(){null!==this.boneTexture&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(t,e){this.uuid=t.uuid;for(let i=0,n=t.bones.length;i<n;i++){const n=t.bones[i];let r=e[n];void 0===r&&(tn("Skeleton: No bone found with UUID:",n),r=new oa),this.bones.push(r),this.boneInverses.push((new Hn).fromArray(t.boneInverses[i]))}return this.init(),this}toJSON(){const t={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};t.uuid=this.uuid;const e=this.bones,i=this.boneInverses;for(let n=0,r=e.length;n<r;n++){const r=e[n];t.bones.push(r.uuid);const s=i[n];t.boneInverses.push(s.toArray())}return t}}class da extends ls{constructor(t,e,i,n=1){super(t,e,i),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=n}copy(t){return super.copy(t),this.meshPerAttribute=t.meshPerAttribute,this}toJSON(){const t=super.toJSON();return t.meshPerAttribute=this.meshPerAttribute,t.isInstancedBufferAttribute=!0,t}}const pa=new Hn,Aa=new Hn,ga=[],ma=new Gr,fa=new Hn,ba=new Ks,va=new gs;class ya extends Ks{constructor(t,e,i){super(t,e),this.isInstancedMesh=!0,this.instanceMatrix=new da(new Float32Array(16*i),16),this.previousInstanceMatrix=null,this.instanceColor=null,this.morphTexture=null,this.count=i,this.boundingBox=null,this.boundingSphere=null;for(let t=0;t<i;t++)this.setMatrixAt(t,fa)}computeBoundingBox(){const t=this.geometry,e=this.count;null===this.boundingBox&&(this.boundingBox=new Gr),null===t.boundingBox&&t.computeBoundingBox(),this.boundingBox.makeEmpty();for(let i=0;i<e;i++)this.getMatrixAt(i,pa),ma.copy(t.boundingBox).applyMatrix4(pa),this.boundingBox.union(ma)}computeBoundingSphere(){const t=this.geometry,e=this.count;null===this.boundingSphere&&(this.boundingSphere=new gs),null===t.boundingSphere&&t.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let i=0;i<e;i++)this.getMatrixAt(i,pa),va.copy(t.boundingSphere).applyMatrix4(pa),this.boundingSphere.union(va)}copy(t,e){return super.copy(t,e),this.instanceMatrix.copy(t.instanceMatrix),null!==t.previousInstanceMatrix&&(this.previousInstanceMatrix=t.previousInstanceMatrix.clone()),null!==t.morphTexture&&(this.morphTexture=t.morphTexture.clone()),null!==t.instanceColor&&(this.instanceColor=t.instanceColor.clone()),this.count=t.count,null!==t.boundingBox&&(this.boundingBox=t.boundingBox.clone()),null!==t.boundingSphere&&(this.boundingSphere=t.boundingSphere.clone()),this}getColorAt(t,e){e.fromArray(this.instanceColor.array,3*t)}getMatrixAt(t,e){e.fromArray(this.instanceMatrix.array,16*t)}getMorphAt(t,e){const i=e.morphTargetInfluences,n=this.morphTexture.source.data.data,r=t*(i.length+1)+1;for(let t=0;t<i.length;t++)i[t]=n[r+t]}raycast(t,e){const i=this.matrixWorld,n=this.count;if(ba.geometry=this.geometry,ba.material=this.material,void 0!==ba.material&&(null===this.boundingSphere&&this.computeBoundingSphere(),va.copy(this.boundingSphere),va.applyMatrix4(i),!1!==t.ray.intersectsSphere(va)))for(let r=0;r<n;r++){this.getMatrixAt(r,pa),Aa.multiplyMatrices(i,pa),ba.matrixWorld=Aa,ba.raycast(t,ga);for(let t=0,i=ga.length;t<i;t++){const i=ga[t];i.instanceId=r,i.object=this,e.push(i)}ga.length=0}}setColorAt(t,e){null===this.instanceColor&&(this.instanceColor=new da(new Float32Array(3*this.instanceMatrix.count).fill(1),3)),e.toArray(this.instanceColor.array,3*t)}setMatrixAt(t,e){e.toArray(this.instanceMatrix.array,16*t)}setMorphAt(t,e){const i=e.morphTargetInfluences,n=i.length+1;null===this.morphTexture&&(this.morphTexture=new la(new Float32Array(n*this.count),n,this.count,Pe,Ee));const r=this.morphTexture.source.data.data;let s=0;for(let t=0;t<i.length;t++)s+=i[t];const a=this.geometry.morphTargetsRelative?1:1-s,o=n*t;r[o]=a,r.set(i,o+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),null!==this.morphTexture&&(this.morphTexture.dispose(),this.morphTexture=null)}}const xa=new vn,_a=new vn,Ea=new _n;class Sa{constructor(t=new vn(1,0,0),e=0){this.isPlane=!0,this.normal=t,this.constant=e}set(t,e){return this.normal.copy(t),this.constant=e,this}setComponents(t,e,i,n){return this.normal.set(t,e,i),this.constant=n,this}setFromNormalAndCoplanarPoint(t,e){return this.normal.copy(t),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(t,e,i){const n=xa.subVectors(i,e).cross(_a.subVectors(t,e)).normalize();return this.setFromNormalAndCoplanarPoint(n,t),this}copy(t){return this.normal.copy(t.normal),this.constant=t.constant,this}normalize(){const t=1/this.normal.length();return this.normal.multiplyScalar(t),this.constant*=t,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(t){return this.normal.dot(t)+this.constant}distanceToSphere(t){return this.distanceToPoint(t.center)-t.radius}projectPoint(t,e){return e.copy(t).addScaledVector(this.normal,-this.distanceToPoint(t))}intersectLine(t,e){const i=t.delta(xa),n=this.normal.dot(i);if(0===n)return 0===this.distanceToPoint(t.start)?e.copy(t.start):null;const r=-(t.start.dot(this.normal)+this.constant)/n;return r<0||r>1?null:e.copy(t.start).addScaledVector(i,r)}intersectsLine(t){const e=this.distanceToPoint(t.start),i=this.distanceToPoint(t.end);return e<0&&i>0||i<0&&e>0}intersectsBox(t){return t.intersectsPlane(this)}intersectsSphere(t){return t.intersectsPlane(this)}coplanarPoint(t){return t.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(t,e){const i=e||Ea.getNormalMatrix(t),n=this.coplanarPoint(xa).applyMatrix4(t),r=this.normal.applyMatrix3(i).normalize();return this.constant=-n.dot(r),this}translate(t){return this.constant-=t.dot(this.normal),this}equals(t){return t.normal.equals(this.normal)&&t.constant===this.constant}clone(){return(new this.constructor).copy(this)}}const Ca=new gs,wa=new fn(.5,.5),Ma=new vn;class Ia{constructor(t=new Sa,e=new Sa,i=new Sa,n=new Sa,r=new Sa,s=new Sa){this.planes=[t,e,i,n,r,s]}set(t,e,i,n,r,s){const a=this.planes;return a[0].copy(t),a[1].copy(e),a[2].copy(i),a[3].copy(n),a[4].copy(r),a[5].copy(s),this}copy(t){const e=this.planes;for(let i=0;i<6;i++)e[i].copy(t.planes[i]);return this}setFromProjectionMatrix(t,e=2e3,i=!1){const n=this.planes,r=t.elements,s=r[0],a=r[1],o=r[2],l=r[3],c=r[4],h=r[5],u=r[6],d=r[7],p=r[8],A=r[9],g=r[10],m=r[11],f=r[12],b=r[13],v=r[14],y=r[15];if(n[0].setComponents(l-s,d-c,m-p,y-f).normalize(),n[1].setComponents(l+s,d+c,m+p,y+f).normalize(),n[2].setComponents(l+a,d+h,m+A,y+b).normalize(),n[3].setComponents(l-a,d-h,m-A,y-b).normalize(),i)n[4].setComponents(o,u,g,v).normalize(),n[5].setComponents(l-o,d-u,m-g,y-v).normalize();else if(n[4].setComponents(l-o,d-u,m-g,y-v).normalize(),e===Wi)n[5].setComponents(l+o,d+u,m+g,y+v).normalize();else{if(e!==Xi)throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);n[5].setComponents(o,u,g,v).normalize()}return this}intersectsObject(t){if(void 0!==t.boundingSphere)null===t.boundingSphere&&t.computeBoundingSphere(),Ca.copy(t.boundingSphere).applyMatrix4(t.matrixWorld);else{const e=t.geometry;null===e.boundingSphere&&e.computeBoundingSphere(),Ca.copy(e.boundingSphere).applyMatrix4(t.matrixWorld)}return this.intersectsSphere(Ca)}intersectsSprite(t){Ca.center.set(0,0,0);const e=wa.distanceTo(t.center);return Ca.radius=.7071067811865476+e,Ca.applyMatrix4(t.matrixWorld),this.intersectsSphere(Ca)}intersectsSphere(t){const e=this.planes,i=t.center,n=-t.radius;for(let t=0;t<6;t++){if(e[t].distanceToPoint(i)<n)return!1}return!0}intersectsBox(t){const e=this.planes;for(let i=0;i<6;i++){const n=e[i];if(Ma.x=n.normal.x>0?t.max.x:t.min.x,Ma.y=n.normal.y>0?t.max.y:t.min.y,Ma.z=n.normal.z>0?t.max.z:t.min.z,n.distanceToPoint(Ma)<0)return!1}return!0}containsPoint(t){const e=this.planes;for(let i=0;i<6;i++)if(e[i].distanceToPoint(t)<0)return!1;return!0}clone(){return(new this.constructor).copy(this)}}class Ta extends Is{constructor(t){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Sr(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.linewidth=t.linewidth,this.linecap=t.linecap,this.linejoin=t.linejoin,this.fog=t.fog,this}}const Ba=new vn,Ra=new vn,Da=new Hn,La=new Us,Pa=new gs,Fa=new vn,Ua=new vn;class Na extends mr{constructor(t=new Es,e=new Ta){super(),this.isLine=!0,this.type="Line",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}computeLineDistances(){const t=this.geometry;if(null===t.index){const e=t.attributes.position,i=[0];for(let t=1,n=e.count;t<n;t++)Ba.fromBufferAttribute(e,t-1),Ra.fromBufferAttribute(e,t),i[t]=i[t-1],i[t]+=Ba.distanceTo(Ra);t.setAttribute("lineDistance",new us(i,1))}else tn("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(t,e){const i=this.geometry,n=this.matrixWorld,r=t.params.Line.threshold,s=i.drawRange;if(null===i.boundingSphere&&i.computeBoundingSphere(),Pa.copy(i.boundingSphere),Pa.applyMatrix4(n),Pa.radius+=r,!1===t.ray.intersectsSphere(Pa))return;Da.copy(n).invert(),La.copy(t.ray).applyMatrix4(Da);const a=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,l=this.isLineSegments?2:1,c=i.index,h=i.attributes.position;if(null!==c){const i=Math.max(0,s.start),n=Math.min(c.count,s.start+s.count);for(let r=i,s=n-1;r<s;r+=l){const i=c.getX(r),n=c.getX(r+1),s=Oa(this,t,La,o,i,n,r);s&&e.push(s)}if(this.isLineLoop){const r=c.getX(n-1),s=c.getX(i),a=Oa(this,t,La,o,r,s,n-1);a&&e.push(a)}}else{const i=Math.max(0,s.start),n=Math.min(h.count,s.start+s.count);for(let r=i,s=n-1;r<s;r+=l){const i=Oa(this,t,La,o,r,r+1,r);i&&e.push(i)}if(this.isLineLoop){const r=Oa(this,t,La,o,n-1,i,n-1);r&&e.push(r)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const i=t[e[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=i.length;t<e;t++){const e=i[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}}function Oa(t,e,i,n,r,s,a){const o=t.geometry.attributes.position;Ba.fromBufferAttribute(o,r),Ra.fromBufferAttribute(o,s);if(i.distanceSqToSegment(Ba,Ra,Fa,Ua)>n)return;Fa.applyMatrix4(t.matrixWorld);const l=e.ray.origin.distanceTo(Fa);return l<e.near||l>e.far?void 0:{distance:l,point:Ua.clone().applyMatrix4(t.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:t}}const ka=new vn,Qa=new vn;class Ga extends Na{constructor(t,e){super(t,e),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const t=this.geometry;if(null===t.index){const e=t.attributes.position,i=[];for(let t=0,n=e.count;t<n;t+=2)ka.fromBufferAttribute(e,t),Qa.fromBufferAttribute(e,t+1),i[t]=0===t?0:i[t-1],i[t+1]=i[t]+ka.distanceTo(Qa);t.setAttribute("lineDistance",new us(i,1))}else tn("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class za extends Na{constructor(t,e){super(t,e),this.isLineLoop=!0,this.type="LineLoop"}}class Ha extends Is{constructor(t){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Sr(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.color.copy(t.color),this.map=t.map,this.alphaMap=t.alphaMap,this.size=t.size,this.sizeAttenuation=t.sizeAttenuation,this.fog=t.fog,this}}const Va=new Hn,qa=new Us,ja=new gs,Wa=new vn;class Xa extends mr{constructor(t=new Es,e=new Ha){super(),this.isPoints=!0,this.type="Points",this.geometry=t,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(t,e){return super.copy(t,e),this.material=Array.isArray(t.material)?t.material.slice():t.material,this.geometry=t.geometry,this}raycast(t,e){const i=this.geometry,n=this.matrixWorld,r=t.params.Points.threshold,s=i.drawRange;if(null===i.boundingSphere&&i.computeBoundingSphere(),ja.copy(i.boundingSphere),ja.applyMatrix4(n),ja.radius+=r,!1===t.ray.intersectsSphere(ja))return;Va.copy(n).invert(),qa.copy(t.ray).applyMatrix4(Va);const a=r/((this.scale.x+this.scale.y+this.scale.z)/3),o=a*a,l=i.index,c=i.attributes.position;if(null!==l){for(let i=Math.max(0,s.start),r=Math.min(l.count,s.start+s.count);i<r;i++){const r=l.getX(i);Wa.fromBufferAttribute(c,r),Ka(Wa,r,o,n,t,e,this)}}else{for(let i=Math.max(0,s.start),r=Math.min(c.count,s.start+s.count);i<r;i++)Wa.fromBufferAttribute(c,i),Ka(Wa,i,o,n,t,e,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,e=Object.keys(t);if(e.length>0){const i=t[e[0]];if(void 0!==i){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let t=0,e=i.length;t<e;t++){const e=i[t].name||String(t);this.morphTargetInfluences.push(0),this.morphTargetDictionary[e]=t}}}}}function Ka(t,e,i,n,r,s,a){const o=qa.distanceSqToPoint(t);if(o<i){const i=new vn;qa.closestPointToPoint(t,i),i.applyMatrix4(n);const l=r.ray.origin.distanceTo(i);if(l<r.near||l>r.far)return;s.push({distance:l,distanceToRay:Math.sqrt(o),point:i,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class Ja extends Nn{constructor(t,e,i,n,r=1006,s=1006,a,o,l){super(t,e,i,n,r,s,a,o,l),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const c=this;"requestVideoFrameCallback"in t&&(this._requestVideoFrameCallbackId=t.requestVideoFrameCallback(function e(){c.needsUpdate=!0,c._requestVideoFrameCallbackId=t.requestVideoFrameCallback(e)}))}clone(){return new this.constructor(this.image).copy(this)}update(){const t=this.image;!1==="requestVideoFrameCallback"in t&&t.readyState>=t.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){0!==this._requestVideoFrameCallbackId&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class Ya extends Nn{constructor(t,e,i,n,r,s,a,o,l,c,h,u){super(null,s,a,o,l,c,n,r,h,u),this.isCompressedTexture=!0,this.image={width:e,height:i},this.mipmaps=t,this.flipY=!1,this.generateMipmaps=!1}}class $a extends Ya{constructor(t,e,i,n,r,s){super(t,e,i,r,s),this.isCompressedArrayTexture=!0,this.image.depth=n,this.wrapR=ce,this.layerUpdates=new Set}addLayerUpdate(t){this.layerUpdates.add(t)}clearLayerUpdates(){this.layerUpdates.clear()}}class Za extends Ya{constructor(t,e,i){super(void 0,t[0].width,t[0].height,e,i,ne),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=t}}class to extends Nn{constructor(t=[],e=301,i,n,r,s,a,o,l,c){super(t,e,i,n,r,s,a,o,l,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(t){this.image=t}}class eo extends Nn{constructor(t,e,i,n,r,s,a,o,l){super(t,e,i,n,r,s,a,o,l),this.isCanvasTexture=!0,this.needsUpdate=!0}}class io extends Nn{constructor(t,e,i=1014,n,r,s,a=1003,o=1003,l,c=1026,h=1){if(c!==De&&c!==Le)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");super({width:t,height:e,depth:h},n,r,s,a,o,c,i,l),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(t){return super.copy(t),this.source=new Ln(Object.assign({},t.image)),this.compareFunction=t.compareFunction,this}toJSON(t){const e=super.toJSON(t);return null!==this.compareFunction&&(e.compareFunction=this.compareFunction),e}}class no extends io{constructor(t,e=1014,i=301,n,r,s=1003,a=1003,o,l=1026){const c={width:t,height:t,depth:1},h=[c,c,c,c,c,c];super(t,t,e,i,n,r,s,a,o,l),this.image=h,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(t){this.image=t}}class ro extends Nn{constructor(t=null){super(),this.sourceTexture=t,this.isExternalTexture=!0}copy(t){return super.copy(t),this.sourceTexture=t.sourceTexture,this}}class so extends Es{constructor(t=1,e=1,i=1,n=1,r=1,s=1){super(),this.type="BoxGeometry",this.parameters={width:t,height:e,depth:i,widthSegments:n,heightSegments:r,depthSegments:s};const a=this;n=Math.floor(n),r=Math.floor(r),s=Math.floor(s);const o=[],l=[],c=[],h=[];let u=0,d=0;function p(t,e,i,n,r,s,p,A,g,m,f){const b=s/g,v=p/m,y=s/2,x=p/2,_=A/2,E=g+1,S=m+1;let C=0,w=0;const M=new vn;for(let s=0;s<S;s++){const a=s*v-x;for(let o=0;o<E;o++){const u=o*b-y;M[t]=u*n,M[e]=a*r,M[i]=_,l.push(M.x,M.y,M.z),M[t]=0,M[e]=0,M[i]=A>0?1:-1,c.push(M.x,M.y,M.z),h.push(o/g),h.push(1-s/m),C+=1}}for(let t=0;t<m;t++)for(let e=0;e<g;e++){const i=u+e+E*t,n=u+e+E*(t+1),r=u+(e+1)+E*(t+1),s=u+(e+1)+E*t;o.push(i,n,s),o.push(n,r,s),w+=6}a.addGroup(d,w,f),d+=w,u+=C}p("z","y","x",-1,-1,i,e,t,s,r,0),p("z","y","x",1,-1,i,e,-t,s,r,1),p("x","z","y",1,1,t,i,e,n,s,2),p("x","z","y",1,-1,t,i,-e,n,s,3),p("x","y","z",1,-1,t,e,i,n,r,4),p("x","y","z",-1,-1,t,e,-i,n,r,5),this.setIndex(o),this.setAttribute("position",new us(l,3)),this.setAttribute("normal",new us(c,3)),this.setAttribute("uv",new us(h,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new so(t.width,t.height,t.depth,t.widthSegments,t.heightSegments,t.depthSegments)}}class ao{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){tn("Curve: .getPoint() not implemented.")}getPointAt(t,e){const i=this.getUtoTmapping(t);return this.getPoint(i,e)}getPoints(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return e}getSpacedPoints(t=5){const e=[];for(let i=0;i<=t;i++)e.push(this.getPointAt(i/t));return e}getLength(){const t=this.getLengths();return t[t.length-1]}getLengths(t=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===t+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let i,n=this.getPoint(0),r=0;e.push(0);for(let s=1;s<=t;s++)i=this.getPoint(s/t),r+=i.distanceTo(n),e.push(r),n=i;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(t,e=null){const i=this.getLengths();let n=0;const r=i.length;let s;s=e||t*i[r-1];let a,o=0,l=r-1;for(;o<=l;)if(n=Math.floor(o+(l-o)/2),a=i[n]-s,a<0)o=n+1;else{if(!(a>0)){l=n;break}l=n-1}if(n=l,i[n]===s)return n/(r-1);const c=i[n];return(n+(s-c)/(i[n+1]-c))/(r-1)}getTangent(t,e){const i=1e-4;let n=t-i,r=t+i;n<0&&(n=0),r>1&&(r=1);const s=this.getPoint(n),a=this.getPoint(r),o=e||(s.isVector2?new fn:new vn);return o.copy(a).sub(s).normalize(),o}getTangentAt(t,e){const i=this.getUtoTmapping(t);return this.getTangent(i,e)}computeFrenetFrames(t,e=!1){const i=new vn,n=[],r=[],s=[],a=new vn,o=new Hn;for(let e=0;e<=t;e++){const i=e/t;n[e]=this.getTangentAt(i,new vn)}r[0]=new vn,s[0]=new vn;let l=Number.MAX_VALUE;const c=Math.abs(n[0].x),h=Math.abs(n[0].y),u=Math.abs(n[0].z);c<=l&&(l=c,i.set(1,0,0)),h<=l&&(l=h,i.set(0,1,0)),u<=l&&i.set(0,0,1),a.crossVectors(n[0],i).normalize(),r[0].crossVectors(n[0],a),s[0].crossVectors(n[0],r[0]);for(let e=1;e<=t;e++){if(r[e]=r[e-1].clone(),s[e]=s[e-1].clone(),a.crossVectors(n[e-1],n[e]),a.length()>Number.EPSILON){a.normalize();const t=Math.acos(un(n[e-1].dot(n[e]),-1,1));r[e].applyMatrix4(o.makeRotationAxis(a,t))}s[e].crossVectors(n[e],r[e])}if(!0===e){let e=Math.acos(un(r[0].dot(r[t]),-1,1));e/=t,n[0].dot(a.crossVectors(r[0],r[t]))>0&&(e=-e);for(let i=1;i<=t;i++)r[i].applyMatrix4(o.makeRotationAxis(n[i],e*i)),s[i].crossVectors(n[i],r[i])}return{tangents:n,normals:r,binormals:s}}clone(){return(new this.constructor).copy(this)}copy(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}toJSON(){const t={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return t.arcLengthDivisions=this.arcLengthDivisions,t.type=this.type,t}fromJSON(t){return this.arcLengthDivisions=t.arcLengthDivisions,this}}class oo extends ao{constructor(t=0,e=0,i=1,n=1,r=0,s=2*Math.PI,a=!1,o=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=t,this.aY=e,this.xRadius=i,this.yRadius=n,this.aStartAngle=r,this.aEndAngle=s,this.aClockwise=a,this.aRotation=o}getPoint(t,e=new fn){const i=e,n=2*Math.PI;let r=this.aEndAngle-this.aStartAngle;const s=Math.abs(r)<Number.EPSILON;for(;r<0;)r+=n;for(;r>n;)r-=n;r<Number.EPSILON&&(r=s?0:n),!0!==this.aClockwise||s||(r===n?r=-n:r-=n);const a=this.aStartAngle+t*r;let o=this.aX+this.xRadius*Math.cos(a),l=this.aY+this.yRadius*Math.sin(a);if(0!==this.aRotation){const t=Math.cos(this.aRotation),e=Math.sin(this.aRotation),i=o-this.aX,n=l-this.aY;o=i*t-n*e+this.aX,l=i*e+n*t+this.aY}return i.set(o,l)}copy(t){return super.copy(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}toJSON(){const t=super.toJSON();return t.aX=this.aX,t.aY=this.aY,t.xRadius=this.xRadius,t.yRadius=this.yRadius,t.aStartAngle=this.aStartAngle,t.aEndAngle=this.aEndAngle,t.aClockwise=this.aClockwise,t.aRotation=this.aRotation,t}fromJSON(t){return super.fromJSON(t),this.aX=t.aX,this.aY=t.aY,this.xRadius=t.xRadius,this.yRadius=t.yRadius,this.aStartAngle=t.aStartAngle,this.aEndAngle=t.aEndAngle,this.aClockwise=t.aClockwise,this.aRotation=t.aRotation,this}}function lo(){let t=0,e=0,i=0,n=0;function r(r,s,a,o){t=r,e=a,i=-3*r+3*s-2*a-o,n=2*r-2*s+a+o}return{initCatmullRom:function(t,e,i,n,s){r(e,i,s*(i-t),s*(n-e))},initNonuniformCatmullRom:function(t,e,i,n,s,a,o){let l=(e-t)/s-(i-t)/(s+a)+(i-e)/a,c=(i-e)/a-(n-e)/(a+o)+(n-i)/o;l*=a,c*=a,r(e,i,l,c)},calc:function(r){const s=r*r;return t+e*r+i*s+n*(s*r)}}}const co=new vn,ho=new lo,uo=new lo,po=new lo;function Ao(t,e,i,n,r){const s=.5*(n-e),a=.5*(r-i),o=t*t;return(2*i-2*n+s+a)*(t*o)+(-3*i+3*n-2*s-a)*o+s*t+i}function go(t,e,i,n){return function(t,e){const i=1-t;return i*i*e}(t,e)+function(t,e){return 2*(1-t)*t*e}(t,i)+function(t,e){return t*t*e}(t,n)}function mo(t,e,i,n,r){return function(t,e){const i=1-t;return i*i*i*e}(t,e)+function(t,e){const i=1-t;return 3*i*i*t*e}(t,i)+function(t,e){return 3*(1-t)*t*t*e}(t,n)+function(t,e){return t*t*t*e}(t,r)}class fo extends ao{constructor(t=new fn,e=new fn,i=new fn,n=new fn){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=t,this.v1=e,this.v2=i,this.v3=n}getPoint(t,e=new fn){const i=e,n=this.v0,r=this.v1,s=this.v2,a=this.v3;return i.set(mo(t,n.x,r.x,s.x,a.x),mo(t,n.y,r.y,s.y,a.y)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}}class bo extends ao{constructor(t=new fn,e=new fn){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=t,this.v2=e}getPoint(t,e=new fn){const i=e;return 1===t?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new fn){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class vo extends ao{constructor(t=new fn,e=new fn,i=new fn){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new fn){const i=e,n=this.v0,r=this.v1,s=this.v2;return i.set(go(t,n.x,r.x,s.x),go(t,n.y,r.y,s.y)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}}class yo extends ao{constructor(t=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=t}getPoint(t,e=new fn){const i=e,n=this.points,r=(n.length-1)*t,s=Math.floor(r),a=r-s,o=n[0===s?s:s-1],l=n[s],c=n[s>n.length-2?n.length-1:s+1],h=n[s>n.length-3?n.length-1:s+2];return i.set(Ao(a,o.x,l.x,c.x,h.x),Ao(a,o.y,l.y,c.y,h.y)),i}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push(i.clone())}return this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){const i=this.points[e];t.points.push(i.toArray())}return t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push((new fn).fromArray(i))}return this}}var xo=Object.freeze({__proto__:null,ArcCurve:class extends oo{constructor(t,e,i,n,r,s){super(t,e,i,i,n,r,s),this.isArcCurve=!0,this.type="ArcCurve"}},CatmullRomCurve3:class extends ao{constructor(t=[],e=!1,i="centripetal",n=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=t,this.closed=e,this.curveType=i,this.tension=n}getPoint(t,e=new vn){const i=e,n=this.points,r=n.length,s=(r-(this.closed?0:1))*t;let a,o,l=Math.floor(s),c=s-l;this.closed?l+=l>0?0:(Math.floor(Math.abs(l)/r)+1)*r:0===c&&l===r-1&&(l=r-2,c=1),this.closed||l>0?a=n[(l-1)%r]:(co.subVectors(n[0],n[1]).add(n[0]),a=co);const h=n[l%r],u=n[(l+1)%r];if(this.closed||l+2<r?o=n[(l+2)%r]:(co.subVectors(n[r-1],n[r-2]).add(n[r-1]),o=co),"centripetal"===this.curveType||"chordal"===this.curveType){const t="chordal"===this.curveType?.5:.25;let e=Math.pow(a.distanceToSquared(h),t),i=Math.pow(h.distanceToSquared(u),t),n=Math.pow(u.distanceToSquared(o),t);i<1e-4&&(i=1),e<1e-4&&(e=i),n<1e-4&&(n=i),ho.initNonuniformCatmullRom(a.x,h.x,u.x,o.x,e,i,n),uo.initNonuniformCatmullRom(a.y,h.y,u.y,o.y,e,i,n),po.initNonuniformCatmullRom(a.z,h.z,u.z,o.z,e,i,n)}else"catmullrom"===this.curveType&&(ho.initCatmullRom(a.x,h.x,u.x,o.x,this.tension),uo.initCatmullRom(a.y,h.y,u.y,o.y,this.tension),po.initCatmullRom(a.z,h.z,u.z,o.z,this.tension));return i.set(ho.calc(c),uo.calc(c),po.calc(c)),i}copy(t){super.copy(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push(i.clone())}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}toJSON(){const t=super.toJSON();t.points=[];for(let e=0,i=this.points.length;e<i;e++){const i=this.points[e];t.points.push(i.toArray())}return t.closed=this.closed,t.curveType=this.curveType,t.tension=this.tension,t}fromJSON(t){super.fromJSON(t),this.points=[];for(let e=0,i=t.points.length;e<i;e++){const i=t.points[e];this.points.push((new vn).fromArray(i))}return this.closed=t.closed,this.curveType=t.curveType,this.tension=t.tension,this}},CubicBezierCurve:fo,CubicBezierCurve3:class extends ao{constructor(t=new vn,e=new vn,i=new vn,n=new vn){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=t,this.v1=e,this.v2=i,this.v3=n}getPoint(t,e=new vn){const i=e,n=this.v0,r=this.v1,s=this.v2,a=this.v3;return i.set(mo(t,n.x,r.x,s.x,a.x),mo(t,n.y,r.y,s.y,a.y),mo(t,n.z,r.z,s.z,a.z)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this.v3.copy(t.v3),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t.v3=this.v3.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this.v3.fromArray(t.v3),this}},EllipseCurve:oo,LineCurve:bo,LineCurve3:class extends ao{constructor(t=new vn,e=new vn){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=t,this.v2=e}getPoint(t,e=new vn){const i=e;return 1===t?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(t).add(this.v1)),i}getPointAt(t,e){return this.getPoint(t,e)}getTangent(t,e=new vn){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(t,e){return this.getTangent(t,e)}copy(t){return super.copy(t),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},QuadraticBezierCurve:vo,QuadraticBezierCurve3:class extends ao{constructor(t=new vn,e=new vn,i=new vn){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=t,this.v1=e,this.v2=i}getPoint(t,e=new vn){const i=e,n=this.v0,r=this.v1,s=this.v2;return i.set(go(t,n.x,r.x,s.x),go(t,n.y,r.y,s.y),go(t,n.z,r.z,s.z)),i}copy(t){return super.copy(t),this.v0.copy(t.v0),this.v1.copy(t.v1),this.v2.copy(t.v2),this}toJSON(){const t=super.toJSON();return t.v0=this.v0.toArray(),t.v1=this.v1.toArray(),t.v2=this.v2.toArray(),t}fromJSON(t){return super.fromJSON(t),this.v0.fromArray(t.v0),this.v1.fromArray(t.v1),this.v2.fromArray(t.v2),this}},SplineCurve:yo});class _o extends ao{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(t){this.curves.push(t)}closePath(){const t=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);if(!t.equals(e)){const i=!0===t.isVector2?"LineCurve":"LineCurve3";this.curves.push(new xo[i](e,t))}return this}getPoint(t,e){const i=t*this.getLength(),n=this.getCurveLengths();let r=0;for(;r<n.length;){if(n[r]>=i){const t=n[r]-i,s=this.curves[r],a=s.getLength(),o=0===a?0:1-t/a;return s.getPointAt(o,e)}r++}return null}getLength(){const t=this.getCurveLengths();return t[t.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const t=[];let e=0;for(let i=0,n=this.curves.length;i<n;i++)e+=this.curves[i].getLength(),t.push(e);return this.cacheLengths=t,t}getSpacedPoints(t=40){const e=[];for(let i=0;i<=t;i++)e.push(this.getPoint(i/t));return this.autoClose&&e.push(e[0]),e}getPoints(t=12){const e=[];let i;for(let n=0,r=this.curves;n<r.length;n++){const s=r[n],a=s.isEllipseCurve?2*t:s.isLineCurve||s.isLineCurve3?1:s.isSplineCurve?t*s.points.length:t,o=s.getPoints(a);for(let t=0;t<o.length;t++){const n=o[t];i&&i.equals(n)||(e.push(n),i=n)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(t){super.copy(t),this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){const i=t.curves[e];this.curves.push(i.clone())}return this.autoClose=t.autoClose,this}toJSON(){const t=super.toJSON();t.autoClose=this.autoClose,t.curves=[];for(let e=0,i=this.curves.length;e<i;e++){const i=this.curves[e];t.curves.push(i.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.autoClose=t.autoClose,this.curves=[];for(let e=0,i=t.curves.length;e<i;e++){const i=t.curves[e];this.curves.push((new xo[i.type]).fromJSON(i))}return this}}class Eo extends _o{constructor(t){super(),this.type="Path",this.currentPoint=new fn,t&&this.setFromPoints(t)}setFromPoints(t){this.moveTo(t[0].x,t[0].y);for(let e=1,i=t.length;e<i;e++)this.lineTo(t[e].x,t[e].y);return this}moveTo(t,e){return this.currentPoint.set(t,e),this}lineTo(t,e){const i=new bo(this.currentPoint.clone(),new fn(t,e));return this.curves.push(i),this.currentPoint.set(t,e),this}quadraticCurveTo(t,e,i,n){const r=new vo(this.currentPoint.clone(),new fn(t,e),new fn(i,n));return this.curves.push(r),this.currentPoint.set(i,n),this}bezierCurveTo(t,e,i,n,r,s){const a=new fo(this.currentPoint.clone(),new fn(t,e),new fn(i,n),new fn(r,s));return this.curves.push(a),this.currentPoint.set(r,s),this}splineThru(t){const e=[this.currentPoint.clone()].concat(t),i=new yo(e);return this.curves.push(i),this.currentPoint.copy(t[t.length-1]),this}arc(t,e,i,n,r,s){const a=this.currentPoint.x,o=this.currentPoint.y;return this.absarc(t+a,e+o,i,n,r,s),this}absarc(t,e,i,n,r,s){return this.absellipse(t,e,i,i,n,r,s),this}ellipse(t,e,i,n,r,s,a,o){const l=this.currentPoint.x,c=this.currentPoint.y;return this.absellipse(t+l,e+c,i,n,r,s,a,o),this}absellipse(t,e,i,n,r,s,a,o){const l=new oo(t,e,i,n,r,s,a,o);if(this.curves.length>0){const t=l.getPoint(0);t.equals(this.currentPoint)||this.lineTo(t.x,t.y)}this.curves.push(l);const c=l.getPoint(1);return this.currentPoint.copy(c),this}copy(t){return super.copy(t),this.currentPoint.copy(t.currentPoint),this}toJSON(){const t=super.toJSON();return t.currentPoint=this.currentPoint.toArray(),t}fromJSON(t){return super.fromJSON(t),this.currentPoint.fromArray(t.currentPoint),this}}class So extends Eo{constructor(t){super(t),this.uuid=hn(),this.type="Shape",this.holes=[]}getPointsHoles(t){const e=[];for(let i=0,n=this.holes.length;i<n;i++)e[i]=this.holes[i].getPoints(t);return e}extractPoints(t){return{shape:this.getPoints(t),holes:this.getPointsHoles(t)}}copy(t){super.copy(t),this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){const i=t.holes[e];this.holes.push(i.clone())}return this}toJSON(){const t=super.toJSON();t.uuid=this.uuid,t.holes=[];for(let e=0,i=this.holes.length;e<i;e++){const i=this.holes[e];t.holes.push(i.toJSON())}return t}fromJSON(t){super.fromJSON(t),this.uuid=t.uuid,this.holes=[];for(let e=0,i=t.holes.length;e<i;e++){const i=t.holes[e];this.holes.push((new Eo).fromJSON(i))}return this}}function Co(t,e,i=2){const n=e&&e.length,r=n?e[0]*i:t.length;let s=wo(t,0,r,i,!0);const a=[];if(!s||s.next===s.prev)return a;let o,l,c;if(n&&(s=function(t,e,i,n){const r=[];for(let i=0,s=e.length;i<s;i++){const a=wo(t,e[i]*n,i<s-1?e[i+1]*n:t.length,n,!1);a===a.next&&(a.steiner=!0),r.push(No(a))}r.sort(Lo);for(let t=0;t<r.length;t++)i=Po(r[t],i);return i}(t,e,s,i)),t.length>80*i){o=t[0],l=t[1];let e=o,n=l;for(let s=i;s<r;s+=i){const i=t[s],r=t[s+1];i<o&&(o=i),r<l&&(l=r),i>e&&(e=i),r>n&&(n=r)}c=Math.max(e-o,n-l),c=0!==c?32767/c:0}return Io(s,a,i,o,l,c,0),a}function wo(t,e,i,n,r){let s;if(r===function(t,e,i,n){let r=0;for(let s=e,a=i-n;s<i;s+=n)r+=(t[a]-t[s])*(t[s+1]+t[a+1]),a=s;return r}(t,e,i,n)>0)for(let r=e;r<i;r+=n)s=Xo(r/n|0,t[r],t[r+1],s);else for(let r=i-n;r>=e;r-=n)s=Xo(r/n|0,t[r],t[r+1],s);return s&&zo(s,s.next)&&(Ko(s),s=s.next),s}function Mo(t,e){if(!t)return t;e||(e=t);let i,n=t;do{if(i=!1,n.steiner||!zo(n,n.next)&&0!==Go(n.prev,n,n.next))n=n.next;else{if(Ko(n),n=e=n.prev,n===n.next)break;i=!0}}while(i||n!==e);return e}function Io(t,e,i,n,r,s,a){if(!t)return;!a&&s&&function(t,e,i,n){let r=t;do{0===r.z&&(r.z=Uo(r.x,r.y,e,i,n)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next}while(r!==t);r.prevZ.nextZ=null,r.prevZ=null,function(t){let e,i=1;do{let n,r=t;t=null;let s=null;for(e=0;r;){e++;let a=r,o=0;for(let t=0;t<i&&(o++,a=a.nextZ,a);t++);let l=i;for(;o>0||l>0&&a;)0!==o&&(0===l||!a||r.z<=a.z)?(n=r,r=r.nextZ,o--):(n=a,a=a.nextZ,l--),s?s.nextZ=n:t=n,n.prevZ=s,s=n;r=a}s.nextZ=null,i*=2}while(e>1)}(r)}(t,n,r,s);let o=t;for(;t.prev!==t.next;){const l=t.prev,c=t.next;if(s?Bo(t,n,r,s):To(t))e.push(l.i,t.i,c.i),Ko(t),t=c.next,o=c.next;else if((t=c)===o){a?1===a?Io(t=Ro(Mo(t),e),e,i,n,r,s,2):2===a&&Do(t,e,i,n,r,s):Io(Mo(t),e,i,n,r,s,1);break}}}function To(t){const e=t.prev,i=t,n=t.next;if(Go(e,i,n)>=0)return!1;const r=e.x,s=i.x,a=n.x,o=e.y,l=i.y,c=n.y,h=Math.min(r,s,a),u=Math.min(o,l,c),d=Math.max(r,s,a),p=Math.max(o,l,c);let A=n.next;for(;A!==e;){if(A.x>=h&&A.x<=d&&A.y>=u&&A.y<=p&&ko(r,o,s,l,a,c,A.x,A.y)&&Go(A.prev,A,A.next)>=0)return!1;A=A.next}return!0}function Bo(t,e,i,n){const r=t.prev,s=t,a=t.next;if(Go(r,s,a)>=0)return!1;const o=r.x,l=s.x,c=a.x,h=r.y,u=s.y,d=a.y,p=Math.min(o,l,c),A=Math.min(h,u,d),g=Math.max(o,l,c),m=Math.max(h,u,d),f=Uo(p,A,e,i,n),b=Uo(g,m,e,i,n);let v=t.prevZ,y=t.nextZ;for(;v&&v.z>=f&&y&&y.z<=b;){if(v.x>=p&&v.x<=g&&v.y>=A&&v.y<=m&&v!==r&&v!==a&&ko(o,h,l,u,c,d,v.x,v.y)&&Go(v.prev,v,v.next)>=0)return!1;if(v=v.prevZ,y.x>=p&&y.x<=g&&y.y>=A&&y.y<=m&&y!==r&&y!==a&&ko(o,h,l,u,c,d,y.x,y.y)&&Go(y.prev,y,y.next)>=0)return!1;y=y.nextZ}for(;v&&v.z>=f;){if(v.x>=p&&v.x<=g&&v.y>=A&&v.y<=m&&v!==r&&v!==a&&ko(o,h,l,u,c,d,v.x,v.y)&&Go(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;y&&y.z<=b;){if(y.x>=p&&y.x<=g&&y.y>=A&&y.y<=m&&y!==r&&y!==a&&ko(o,h,l,u,c,d,y.x,y.y)&&Go(y.prev,y,y.next)>=0)return!1;y=y.nextZ}return!0}function Ro(t,e){let i=t;do{const n=i.prev,r=i.next.next;!zo(n,r)&&Ho(n,i,i.next,r)&&jo(n,r)&&jo(r,n)&&(e.push(n.i,i.i,r.i),Ko(i),Ko(i.next),i=t=r),i=i.next}while(i!==t);return Mo(i)}function Do(t,e,i,n,r,s){let a=t;do{let t=a.next.next;for(;t!==a.prev;){if(a.i!==t.i&&Qo(a,t)){let o=Wo(a,t);return a=Mo(a,a.next),o=Mo(o,o.next),Io(a,e,i,n,r,s,0),void Io(o,e,i,n,r,s,0)}t=t.next}a=a.next}while(a!==t)}function Lo(t,e){let i=t.x-e.x;if(0===i&&(i=t.y-e.y,0===i)){i=(t.next.y-t.y)/(t.next.x-t.x)-(e.next.y-e.y)/(e.next.x-e.x)}return i}function Po(t,e){const i=function(t,e){let i=e;const n=t.x,r=t.y;let s,a=-1/0;if(zo(t,i))return i;do{if(zo(t,i.next))return i.next;if(r<=i.y&&r>=i.next.y&&i.next.y!==i.y){const t=i.x+(r-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(t<=n&&t>a&&(a=t,s=i.x<i.next.x?i:i.next,t===n))return s}i=i.next}while(i!==e);if(!s)return null;const o=s,l=s.x,c=s.y;let h=1/0;i=s;do{if(n>=i.x&&i.x>=l&&n!==i.x&&Oo(r<c?n:a,r,l,c,r<c?a:n,r,i.x,i.y)){const e=Math.abs(r-i.y)/(n-i.x);jo(i,t)&&(e<h||e===h&&(i.x>s.x||i.x===s.x&&Fo(s,i)))&&(s=i,h=e)}i=i.next}while(i!==o);return s}(t,e);if(!i)return e;const n=Wo(i,t);return Mo(n,n.next),Mo(i,i.next)}function Fo(t,e){return Go(t.prev,t,e.prev)<0&&Go(e.next,t,t.next)<0}function Uo(t,e,i,n,r){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*r|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*r|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function No(t){let e=t,i=t;do{(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next}while(e!==t);return i}function Oo(t,e,i,n,r,s,a,o){return(r-a)*(e-o)>=(t-a)*(s-o)&&(t-a)*(n-o)>=(i-a)*(e-o)&&(i-a)*(s-o)>=(r-a)*(n-o)}function ko(t,e,i,n,r,s,a,o){return!(t===a&&e===o)&&Oo(t,e,i,n,r,s,a,o)}function Qo(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){let i=t;do{if(i.i!==t.i&&i.next.i!==t.i&&i.i!==e.i&&i.next.i!==e.i&&Ho(i,i.next,t,e))return!0;i=i.next}while(i!==t);return!1}(t,e)&&(jo(t,e)&&jo(e,t)&&function(t,e){let i=t,n=!1;const r=(t.x+e.x)/2,s=(t.y+e.y)/2;do{i.y>s!=i.next.y>s&&i.next.y!==i.y&&r<(i.next.x-i.x)*(s-i.y)/(i.next.y-i.y)+i.x&&(n=!n),i=i.next}while(i!==t);return n}(t,e)&&(Go(t.prev,t,e.prev)||Go(t,e.prev,e))||zo(t,e)&&Go(t.prev,t,t.next)>0&&Go(e.prev,e,e.next)>0)}function Go(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function zo(t,e){return t.x===e.x&&t.y===e.y}function Ho(t,e,i,n){const r=qo(Go(t,e,i)),s=qo(Go(t,e,n)),a=qo(Go(i,n,t)),o=qo(Go(i,n,e));return r!==s&&a!==o||(!(0!==r||!Vo(t,i,e))||(!(0!==s||!Vo(t,n,e))||(!(0!==a||!Vo(i,t,n))||!(0!==o||!Vo(i,e,n)))))}function Vo(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function qo(t){return t>0?1:t<0?-1:0}function jo(t,e){return Go(t.prev,t,t.next)<0?Go(t,e,t.next)>=0&&Go(t,t.prev,e)>=0:Go(t,e,t.prev)<0||Go(t,t.next,e)<0}function Wo(t,e){const i=Jo(t.i,t.x,t.y),n=Jo(e.i,e.x,e.y),r=t.next,s=e.prev;return t.next=e,e.prev=t,i.next=r,r.prev=i,n.next=i,i.prev=n,s.next=n,n.prev=s,n}function Xo(t,e,i,n){const r=Jo(t,e,i);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function Ko(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Jo(t,e,i){return{i:t,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class Yo{static triangulate(t,e,i=2){return Co(t,e,i)}}class $o{static area(t){const e=t.length;let i=0;for(let n=e-1,r=0;r<e;n=r++)i+=t[n].x*t[r].y-t[r].x*t[n].y;return.5*i}static isClockWise(t){return $o.area(t)<0}static triangulateShape(t,e){const i=[],n=[],r=[];Zo(t),tl(i,t);let s=t.length;e.forEach(Zo);for(let t=0;t<e.length;t++)n.push(s),s+=e[t].length,tl(i,e[t]);const a=Yo.triangulate(i,n);for(let t=0;t<a.length;t+=3)r.push(a.slice(t,t+3));return r}}function Zo(t){const e=t.length;e>2&&t[e-1].equals(t[0])&&t.pop()}function tl(t,e){for(let i=0;i<e.length;i++)t.push(e[i].x),t.push(e[i].y)}class el extends Es{constructor(t=1,e=1,i=1,n=1){super(),this.type="PlaneGeometry",this.parameters={width:t,height:e,widthSegments:i,heightSegments:n};const r=t/2,s=e/2,a=Math.floor(i),o=Math.floor(n),l=a+1,c=o+1,h=t/a,u=e/o,d=[],p=[],A=[],g=[];for(let t=0;t<c;t++){const e=t*u-s;for(let i=0;i<l;i++){const n=i*h-r;p.push(n,-e,0),A.push(0,0,1),g.push(i/a),g.push(1-t/o)}}for(let t=0;t<o;t++)for(let e=0;e<a;e++){const i=e+l*t,n=e+l*(t+1),r=e+1+l*(t+1),s=e+1+l*t;d.push(i,n,s),d.push(n,r,s)}this.setIndex(d),this.setAttribute("position",new us(p,3)),this.setAttribute("normal",new us(A,3)),this.setAttribute("uv",new us(g,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new el(t.width,t.height,t.widthSegments,t.heightSegments)}}class il extends Es{constructor(t=new So([new fn(0,.5),new fn(-.5,-.5),new fn(.5,-.5)]),e=12){super(),this.type="ShapeGeometry",this.parameters={shapes:t,curveSegments:e};const i=[],n=[],r=[],s=[];let a=0,o=0;if(!1===Array.isArray(t))l(t);else for(let e=0;e<t.length;e++)l(t[e]),this.addGroup(a,o,e),a+=o,o=0;function l(t){const a=n.length/3,l=t.extractPoints(e);let c=l.shape;const h=l.holes;!1===$o.isClockWise(c)&&(c=c.reverse());for(let t=0,e=h.length;t<e;t++){const e=h[t];!0===$o.isClockWise(e)&&(h[t]=e.reverse())}const u=$o.triangulateShape(c,h);for(let t=0,e=h.length;t<e;t++){const e=h[t];c=c.concat(e)}for(let t=0,e=c.length;t<e;t++){const e=c[t];n.push(e.x,e.y,0),r.push(0,0,1),s.push(e.x,e.y)}for(let t=0,e=u.length;t<e;t++){const e=u[t],n=e[0]+a,r=e[1]+a,s=e[2]+a;i.push(n,r,s),o+=3}}this.setIndex(i),this.setAttribute("position",new us(n,3)),this.setAttribute("normal",new us(r,3)),this.setAttribute("uv",new us(s,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}toJSON(){const t=super.toJSON();return function(t,e){if(e.shapes=[],Array.isArray(t))for(let i=0,n=t.length;i<n;i++){const n=t[i];e.shapes.push(n.uuid)}else e.shapes.push(t.uuid);return e}(this.parameters.shapes,t)}static fromJSON(t,e){const i=[];for(let n=0,r=t.shapes.length;n<r;n++){const r=e[t.shapes[n]];i.push(r)}return new il(i,t.curveSegments)}}class nl extends Es{constructor(t=1,e=32,i=16,n=0,r=2*Math.PI,s=0,a=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:t,widthSegments:e,heightSegments:i,phiStart:n,phiLength:r,thetaStart:s,thetaLength:a},e=Math.max(3,Math.floor(e)),i=Math.max(2,Math.floor(i));const o=Math.min(s+a,Math.PI);let l=0;const c=[],h=new vn,u=new vn,d=[],p=[],A=[],g=[];for(let d=0;d<=i;d++){const m=[],f=d/i;let b=0;0===d&&0===s?b=.5/e:d===i&&o===Math.PI&&(b=-.5/e);for(let i=0;i<=e;i++){const o=i/e;h.x=-t*Math.cos(n+o*r)*Math.sin(s+f*a),h.y=t*Math.cos(s+f*a),h.z=t*Math.sin(n+o*r)*Math.sin(s+f*a),p.push(h.x,h.y,h.z),u.copy(h).normalize(),A.push(u.x,u.y,u.z),g.push(o+b,1-f),m.push(l++)}c.push(m)}for(let t=0;t<i;t++)for(let n=0;n<e;n++){const e=c[t][n+1],r=c[t][n],a=c[t+1][n],l=c[t+1][n+1];(0!==t||s>0)&&d.push(e,r,l),(t!==i-1||o<Math.PI)&&d.push(r,a,l)}this.setIndex(d),this.setAttribute("position",new us(p,3)),this.setAttribute("normal",new us(A,3)),this.setAttribute("uv",new us(g,2))}copy(t){return super.copy(t),this.parameters=Object.assign({},t.parameters),this}static fromJSON(t){return new nl(t.radius,t.widthSegments,t.heightSegments,t.phiStart,t.phiLength,t.thetaStart,t.thetaLength)}}function rl(t){const e={};for(const i in t){e[i]={};for(const n in t[i]){const r=t[i][n];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(tn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[i][n]=null):e[i][n]=r.clone():Array.isArray(r)?e[i][n]=r.slice():e[i][n]=r}}return e}function sl(t){const e={};for(let i=0;i<t.length;i++){const n=rl(t[i]);for(const t in n)e[t]=n[t]}return e}function al(t){const e=t.getRenderTarget();return null===e?t.outputColorSpace:!0===e.isXRRenderTarget?e.texture.colorSpace:Mn.workingColorSpace}const ol={clone:rl,merge:sl};class ll extends Is{constructor(t){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader="void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}",this.fragmentShader="void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );\n}",this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,void 0!==t&&this.setValues(t)}copy(t){return super.copy(t),this.fragmentShader=t.fragmentShader,this.vertexShader=t.vertexShader,this.uniforms=rl(t.uniforms),this.uniformsGroups=function(t){const e=[];for(let i=0;i<t.length;i++)e.push(t[i].clone());return e}(t.uniformsGroups),this.defines=Object.assign({},t.defines),this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.fog=t.fog,this.lights=t.lights,this.clipping=t.clipping,this.extensions=Object.assign({},t.extensions),this.glslVersion=t.glslVersion,this.defaultAttributeValues=Object.assign({},t.defaultAttributeValues),this.index0AttributeName=t.index0AttributeName,this.uniformsNeedUpdate=t.uniformsNeedUpdate,this}toJSON(t){const e=super.toJSON(t);e.glslVersion=this.glslVersion,e.uniforms={};for(const i in this.uniforms){const n=this.uniforms[i].value;n&&n.isTexture?e.uniforms[i]={type:"t",value:n.toJSON(t).uuid}:n&&n.isColor?e.uniforms[i]={type:"c",value:n.getHex()}:n&&n.isVector2?e.uniforms[i]={type:"v2",value:n.toArray()}:n&&n.isVector3?e.uniforms[i]={type:"v3",value:n.toArray()}:n&&n.isVector4?e.uniforms[i]={type:"v4",value:n.toArray()}:n&&n.isMatrix3?e.uniforms[i]={type:"m3",value:n.toArray()}:n&&n.isMatrix4?e.uniforms[i]={type:"m4",value:n.toArray()}:e.uniforms[i]={value:n}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;const i={};for(const t in this.extensions)!0===this.extensions[t]&&(i[t]=!0);return Object.keys(i).length>0&&(e.extensions=i),e}}class cl extends ll{constructor(t){super(t),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class hl extends Is{constructor(t){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Sr(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Sr(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new fn(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Zn,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(t)}copy(t){return super.copy(t),this.defines={STANDARD:""},this.color.copy(t.color),this.roughness=t.roughness,this.metalness=t.metalness,this.map=t.map,this.lightMap=t.lightMap,this.lightMapIntensity=t.lightMapIntensity,this.aoMap=t.aoMap,this.aoMapIntensity=t.aoMapIntensity,this.emissive.copy(t.emissive),this.emissiveMap=t.emissiveMap,this.emissiveIntensity=t.emissiveIntensity,this.bumpMap=t.bumpMap,this.bumpScale=t.bumpScale,this.normalMap=t.normalMap,this.normalMapType=t.normalMapType,this.normalScale.copy(t.normalScale),this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.roughnessMap=t.roughnessMap,this.metalnessMap=t.metalnessMap,this.alphaMap=t.alphaMap,this.envMap=t.envMap,this.envMapRotation.copy(t.envMapRotation),this.envMapIntensity=t.envMapIntensity,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this.wireframeLinecap=t.wireframeLinecap,this.wireframeLinejoin=t.wireframeLinejoin,this.flatShading=t.flatShading,this.fog=t.fog,this}}class ul extends hl{constructor(t){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new fn(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return un(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Sr(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Sr(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Sr(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(t)}get anisotropy(){return this._anisotropy}set anisotropy(t){this._anisotropy>0!=t>0&&this.version++,this._anisotropy=t}get clearcoat(){return this._clearcoat}set clearcoat(t){this._clearcoat>0!=t>0&&this.version++,this._clearcoat=t}get iridescence(){return this._iridescence}set iridescence(t){this._iridescence>0!=t>0&&this.version++,this._iridescence=t}get dispersion(){return this._dispersion}set dispersion(t){this._dispersion>0!=t>0&&this.version++,this._dispersion=t}get sheen(){return this._sheen}set sheen(t){this._sheen>0!=t>0&&this.version++,this._sheen=t}get transmission(){return this._transmission}set transmission(t){this._transmission>0!=t>0&&this.version++,this._transmission=t}copy(t){return super.copy(t),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=t.anisotropy,this.anisotropyRotation=t.anisotropyRotation,this.anisotropyMap=t.anisotropyMap,this.clearcoat=t.clearcoat,this.clearcoatMap=t.clearcoatMap,this.clearcoatRoughness=t.clearcoatRoughness,this.clearcoatRoughnessMap=t.clearcoatRoughnessMap,this.clearcoatNormalMap=t.clearcoatNormalMap,this.clearcoatNormalScale.copy(t.clearcoatNormalScale),this.dispersion=t.dispersion,this.ior=t.ior,this.iridescence=t.iridescence,this.iridescenceMap=t.iridescenceMap,this.iridescenceIOR=t.iridescenceIOR,this.iridescenceThicknessRange=[...t.iridescenceThicknessRange],this.iridescenceThicknessMap=t.iridescenceThicknessMap,this.sheen=t.sheen,this.sheenColor.copy(t.sheenColor),this.sheenColorMap=t.sheenColorMap,this.sheenRoughness=t.sheenRoughness,this.sheenRoughnessMap=t.sheenRoughnessMap,this.transmission=t.transmission,this.transmissionMap=t.transmissionMap,this.thickness=t.thickness,this.thicknessMap=t.thicknessMap,this.attenuationDistance=t.attenuationDistance,this.attenuationColor.copy(t.attenuationColor),this.specularIntensity=t.specularIntensity,this.specularIntensityMap=t.specularIntensityMap,this.specularColor.copy(t.specularColor),this.specularColorMap=t.specularColorMap,this}}class dl extends Is{constructor(t){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=3200,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(t)}copy(t){return super.copy(t),this.depthPacking=t.depthPacking,this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this.wireframe=t.wireframe,this.wireframeLinewidth=t.wireframeLinewidth,this}}class pl extends Is{constructor(t){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(t)}copy(t){return super.copy(t),this.map=t.map,this.alphaMap=t.alphaMap,this.displacementMap=t.displacementMap,this.displacementScale=t.displacementScale,this.displacementBias=t.displacementBias,this}}function Al(t,e){return t&&t.constructor!==e?"number"==typeof e.BYTES_PER_ELEMENT?new e(t):Array.prototype.slice.call(t):t}function gl(t){const e=t.length,i=new Array(e);for(let t=0;t!==e;++t)i[t]=t;return i.sort(function(e,i){return t[e]-t[i]}),i}function ml(t,e,i){const n=t.length,r=new t.constructor(n);for(let s=0,a=0;a!==n;++s){const n=i[s]*e;for(let i=0;i!==e;++i)r[a++]=t[n+i]}return r}function fl(t,e,i,n){let r=1,s=t[0];for(;void 0!==s&&void 0===s[n];)s=t[r++];if(void 0===s)return;let a=s[n];if(void 0!==a)if(Array.isArray(a))do{a=s[n],void 0!==a&&(e.push(s.time),i.push(...a)),s=t[r++]}while(void 0!==s);else if(void 0!==a.toArray)do{a=s[n],void 0!==a&&(e.push(s.time),a.toArray(i,i.length)),s=t[r++]}while(void 0!==s);else do{a=s[n],void 0!==a&&(e.push(s.time),i.push(a)),s=t[r++]}while(void 0!==s)}class bl{constructor(t,e,i,n){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=void 0!==n?n:new e.constructor(i),this.sampleValues=e,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(t){const e=this.parameterPositions;let i=this._cachedIndex,n=e[i],r=e[i-1];t:{e:{let s;i:{n:if(!(t<n)){for(let s=i+2;;){if(void 0===n){if(t<r)break n;return i=e.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===s)break;if(r=n,n=e[++i],t<n)break e}s=e.length;break i}if(!(t>=r)){const a=e[1];t<a&&(i=2,r=a);for(let s=i-2;;){if(void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(i===s)break;if(n=r,r=e[--i-1],t>=r)break e}s=i,i=0;break i}break t}for(;i<s;){const n=i+s>>>1;t<e[n]?s=n:i=n+1}if(n=e[i],r=e[i-1],void 0===r)return this._cachedIndex=0,this.copySampleValue_(0);if(void 0===n)return i=e.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,r,n)}return this.interpolate_(i,r,t,n)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){const e=this.resultBuffer,i=this.sampleValues,n=this.valueSize,r=t*n;for(let t=0;t!==n;++t)e[t]=i[r+t];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class vl extends bl{constructor(t,e,i,n){super(t,e,i,n),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Mi,endingEnd:Mi}}intervalChanged_(t,e,i){const n=this.parameterPositions;let r=t-2,s=t+1,a=n[r],o=n[s];if(void 0===a)switch(this.getSettings_().endingStart){case Ii:r=t,a=2*e-i;break;case Ti:r=n.length-2,a=e+n[r]-n[r+1];break;default:r=t,a=i}if(void 0===o)switch(this.getSettings_().endingEnd){case Ii:s=t,o=2*i-e;break;case Ti:s=1,o=i+n[1]-n[0];break;default:s=t-1,o=e}const l=.5*(i-e),c=this.valueSize;this._weightPrev=l/(e-a),this._weightNext=l/(o-i),this._offsetPrev=r*c,this._offsetNext=s*c}interpolate_(t,e,i,n){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=t*a,l=o-a,c=this._offsetPrev,h=this._offsetNext,u=this._weightPrev,d=this._weightNext,p=(i-e)/(n-e),A=p*p,g=A*p,m=-u*g+2*u*A-u*p,f=(1+u)*g+(-1.5-2*u)*A+(-.5+u)*p+1,b=(-1-d)*g+(1.5+d)*A+.5*p,v=d*g-d*A;for(let t=0;t!==a;++t)r[t]=m*s[c+t]+f*s[l+t]+b*s[o+t]+v*s[h+t];return r}}class yl extends bl{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t,e,i,n){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=t*a,l=o-a,c=(i-e)/(n-e),h=1-c;for(let t=0;t!==a;++t)r[t]=s[l+t]*h+s[o+t]*c;return r}}class xl extends bl{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t){return this.copySampleValue_(t-1)}}class _l extends bl{interpolate_(t,e,i,n){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=t*a,l=o-a,c=this.settings||this.DefaultSettings_,h=c.inTangents,u=c.outTangents;if(!h||!u){const t=(i-e)/(n-e),c=1-t;for(let e=0;e!==a;++e)r[e]=s[l+e]*c+s[o+e]*t;return r}const d=2*a,p=t-1;for(let c=0;c!==a;++c){const a=s[l+c],A=s[o+c],g=p*d+2*c,m=u[g],f=u[g+1],b=t*d+2*c,v=h[b],y=h[b+1];let x,_,E,S,C,w=(i-e)/(n-e);for(let t=0;t<8;t++){x=w*w,_=x*w,E=1-w,S=E*E,C=S*E;const t=C*e+3*S*w*m+3*E*x*v+_*n-i;if(Math.abs(t)<1e-10)break;const r=3*S*(m-e)+6*E*w*(v-m)+3*x*(n-v);if(Math.abs(r)<1e-10)break;w-=t/r,w=Math.max(0,Math.min(1,w))}r[c]=C*a+3*S*w*f+3*E*x*y+_*A}return r}}class El{constructor(t,e,i,n){if(void 0===t)throw new Error("THREE.KeyframeTrack: track name is undefined");if(void 0===e||0===e.length)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=Al(e,this.TimeBufferType),this.values=Al(i,this.ValueBufferType),this.setInterpolation(n||this.DefaultInterpolation)}static toJSON(t){const e=t.constructor;let i;if(e.toJSON!==this.toJSON)i=e.toJSON(t);else{i={name:t.name,times:Al(t.times,Array),values:Al(t.values,Array)};const e=t.getInterpolation();e!==t.DefaultInterpolation&&(i.interpolation=e)}return i.type=t.ValueTypeName,i}InterpolantFactoryMethodDiscrete(t){return new xl(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new yl(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new vl(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodBezier(t){const e=new _l(this.times,this.values,this.getValueSize(),t);return this.settings&&(e.settings=this.settings),e}setInterpolation(t){let e;switch(t){case Si:e=this.InterpolantFactoryMethodDiscrete;break;case Ci:e=this.InterpolantFactoryMethodLinear;break;case wi:e=this.InterpolantFactoryMethodSmooth;break;case 2303:e=this.InterpolantFactoryMethodBezier}if(void 0===e){const e="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(void 0===this.createInterpolant){if(t===this.DefaultInterpolation)throw new Error(e);this.setInterpolation(this.DefaultInterpolation)}return tn("KeyframeTrack:",e),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Si;case this.InterpolantFactoryMethodLinear:return Ci;case this.InterpolantFactoryMethodSmooth:return wi;case this.InterpolantFactoryMethodBezier:return 2303}}getValueSize(){return this.values.length/this.times.length}shift(t){if(0!==t){const e=this.times;for(let i=0,n=e.length;i!==n;++i)e[i]+=t}return this}scale(t){if(1!==t){const e=this.times;for(let i=0,n=e.length;i!==n;++i)e[i]*=t}return this}trim(t,e){const i=this.times,n=i.length;let r=0,s=n-1;for(;r!==n&&i[r]<t;)++r;for(;-1!==s&&i[s]>e;)--s;if(++s,0!==r||s!==n){r>=s&&(s=Math.max(s,1),r=s-1);const t=this.getValueSize();this.times=i.slice(r,s),this.values=this.values.slice(r*t,s*t)}return this}validate(){let t=!0;const e=this.getValueSize();e-Math.floor(e)!==0&&(en("KeyframeTrack: Invalid value size in track.",this),t=!1);const i=this.times,n=this.values,r=i.length;0===r&&(en("KeyframeTrack: Track is empty.",this),t=!1);let s=null;for(let e=0;e!==r;e++){const n=i[e];if("number"==typeof n&&isNaN(n)){en("KeyframeTrack: Time is not a valid number.",this,e,n),t=!1;break}if(null!==s&&s>n){en("KeyframeTrack: Out of order keys.",this,e,n,s),t=!1;break}s=n}if(void 0!==n&&(a=n,ArrayBuffer.isView(a)&&!(a instanceof DataView)))for(let e=0,i=n.length;e!==i;++e){const i=n[e];if(isNaN(i)){en("KeyframeTrack: Value is not a valid number.",this,e,i),t=!1;break}}var a;return t}optimize(){const t=this.times.slice(),e=this.values.slice(),i=this.getValueSize(),n=this.getInterpolation()===wi,r=t.length-1;let s=1;for(let a=1;a<r;++a){let r=!1;const o=t[a];if(o!==t[a+1]&&(1!==a||o!==t[0]))if(n)r=!0;else{const t=a*i,n=t-i,s=t+i;for(let a=0;a!==i;++a){const i=e[t+a];if(i!==e[n+a]||i!==e[s+a]){r=!0;break}}}if(r){if(a!==s){t[s]=t[a];const n=a*i,r=s*i;for(let t=0;t!==i;++t)e[r+t]=e[n+t]}++s}}if(r>0){t[s]=t[r];for(let t=r*i,n=s*i,a=0;a!==i;++a)e[n+a]=e[t+a];++s}return s!==t.length?(this.times=t.slice(0,s),this.values=e.slice(0,s*i)):(this.times=t,this.values=e),this}clone(){const t=this.times.slice(),e=this.values.slice(),i=new(0,this.constructor)(this.name,t,e);return i.createInterpolant=this.createInterpolant,i}}El.prototype.ValueTypeName="",El.prototype.TimeBufferType=Float32Array,El.prototype.ValueBufferType=Float32Array,El.prototype.DefaultInterpolation=Ci;class Sl extends El{constructor(t,e,i){super(t,e,i)}}Sl.prototype.ValueTypeName="bool",Sl.prototype.ValueBufferType=Array,Sl.prototype.DefaultInterpolation=Si,Sl.prototype.InterpolantFactoryMethodLinear=void 0,Sl.prototype.InterpolantFactoryMethodSmooth=void 0;class Cl extends El{constructor(t,e,i,n){super(t,e,i,n)}}Cl.prototype.ValueTypeName="color";class wl extends El{constructor(t,e,i,n){super(t,e,i,n)}}wl.prototype.ValueTypeName="number";class Ml extends bl{constructor(t,e,i,n){super(t,e,i,n)}interpolate_(t,e,i,n){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=(i-e)/(n-e);let l=t*a;for(let t=l+a;l!==t;l+=4)bn.slerpFlat(r,0,s,l-a,s,l,o);return r}}class Il extends El{constructor(t,e,i,n){super(t,e,i,n)}InterpolantFactoryMethodLinear(t){return new Ml(this.times,this.values,this.getValueSize(),t)}}Il.prototype.ValueTypeName="quaternion",Il.prototype.InterpolantFactoryMethodSmooth=void 0;class Tl extends El{constructor(t,e,i){super(t,e,i)}}Tl.prototype.ValueTypeName="string",Tl.prototype.ValueBufferType=Array,Tl.prototype.DefaultInterpolation=Si,Tl.prototype.InterpolantFactoryMethodLinear=void 0,Tl.prototype.InterpolantFactoryMethodSmooth=void 0;class Bl extends El{constructor(t,e,i,n){super(t,e,i,n)}}Bl.prototype.ValueTypeName="vector";class Rl{constructor(t="",e=-1,i=[],n=2500){this.name=t,this.tracks=i,this.duration=e,this.blendMode=n,this.uuid=hn(),this.userData={},this.duration<0&&this.resetDuration()}static parse(t){const e=[],i=t.tracks,n=1/(t.fps||1);for(let t=0,r=i.length;t!==r;++t)e.push(Dl(i[t]).scale(n));const r=new this(t.name,t.duration,e,t.blendMode);return r.uuid=t.uuid,r.userData=JSON.parse(t.userData||"{}"),r}static toJSON(t){const e=[],i=t.tracks,n={name:t.name,duration:t.duration,tracks:e,uuid:t.uuid,blendMode:t.blendMode,userData:JSON.stringify(t.userData)};for(let t=0,n=i.length;t!==n;++t)e.push(El.toJSON(i[t]));return n}static CreateFromMorphTargetSequence(t,e,i,n){const r=e.length,s=[];for(let t=0;t<r;t++){let a=[],o=[];a.push((t+r-1)%r,t,(t+1)%r),o.push(0,1,0);const l=gl(a);a=ml(a,1,l),o=ml(o,1,l),n||0!==a[0]||(a.push(r),o.push(o[0])),s.push(new wl(".morphTargetInfluences["+e[t].name+"]",a,o).scale(1/i))}return new this(t,-1,s)}static findByName(t,e){let i=t;if(!Array.isArray(t)){const e=t;i=e.geometry&&e.geometry.animations||e.animations}for(let t=0;t<i.length;t++)if(i[t].name===e)return i[t];return null}static CreateClipsFromMorphTargetSequences(t,e,i){const n={},r=/^([\w-]*?)([\d]+)$/;for(let e=0,i=t.length;e<i;e++){const i=t[e],s=i.name.match(r);if(s&&s.length>1){const t=s[1];let e=n[t];e||(n[t]=e=[]),e.push(i)}}const s=[];for(const t in n)s.push(this.CreateFromMorphTargetSequence(t,n[t],e,i));return s}static parseAnimation(t,e){if(tn("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!t)return en("AnimationClip: No animation in JSONLoader data."),null;const i=function(t,e,i,n,r){if(0!==i.length){const s=[],a=[];fl(i,s,a,n),0!==s.length&&r.push(new t(e,s,a))}},n=[],r=t.name||"default",s=t.fps||30,a=t.blendMode;let o=t.length||-1;const l=t.hierarchy||[];for(let t=0;t<l.length;t++){const r=l[t].keys;if(r&&0!==r.length)if(r[0].morphTargets){const t={};let e;for(e=0;e<r.length;e++)if(r[e].morphTargets)for(let i=0;i<r[e].morphTargets.length;i++)t[r[e].morphTargets[i]]=-1;for(const i in t){const t=[],s=[];for(let n=0;n!==r[e].morphTargets.length;++n){const n=r[e];t.push(n.time),s.push(n.morphTarget===i?1:0)}n.push(new wl(".morphTargetInfluence["+i+"]",t,s))}o=t.length*s}else{const s=".bones["+e[t].name+"]";i(Bl,s+".position",r,"pos",n),i(Il,s+".quaternion",r,"rot",n),i(Bl,s+".scale",r,"scl",n)}}if(0===n.length)return null;return new this(r,o,n,a)}resetDuration(){let t=0;for(let e=0,i=this.tracks.length;e!==i;++e){const i=this.tracks[e];t=Math.max(t,i.times[i.times.length-1])}return this.duration=t,this}trim(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].trim(0,this.duration);return this}validate(){let t=!0;for(let e=0;e<this.tracks.length;e++)t=t&&this.tracks[e].validate();return t}optimize(){for(let t=0;t<this.tracks.length;t++)this.tracks[t].optimize();return this}clone(){const t=[];for(let e=0;e<this.tracks.length;e++)t.push(this.tracks[e].clone());const e=new this.constructor(this.name,this.duration,t,this.blendMode);return e.userData=JSON.parse(JSON.stringify(this.userData)),e}toJSON(){return this.constructor.toJSON(this)}}function Dl(t){if(void 0===t.type)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=function(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return wl;case"vector":case"vector2":case"vector3":case"vector4":return Bl;case"color":return Cl;case"quaternion":return Il;case"bool":case"boolean":return Sl;case"string":return Tl}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}(t.type);if(void 0===t.times){const e=[],i=[];fl(t.keys,e,i,"value"),t.times=e,t.values=i}return void 0!==e.parse?e.parse(t):new e(t.name,t.times,t.values,t.interpolation)}const Ll={enabled:!1,files:{},add:function(t,e){!1!==this.enabled&&(Pl(t)||(this.files[t]=e))},get:function(t){if(!1!==this.enabled&&!Pl(t))return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};function Pl(t){try{const e=t.slice(t.indexOf(":")+1);return"blob:"===new URL(e).protocol}catch(t){return!1}}class Fl{constructor(t,e,i){const n=this;let r,s=!1,a=0,o=0;const l=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=i,this._abortController=null,this.itemStart=function(t){o++,!1===s&&void 0!==n.onStart&&n.onStart(t,a,o),s=!0},this.itemEnd=function(t){a++,void 0!==n.onProgress&&n.onProgress(t,a,o),a===o&&(s=!1,void 0!==n.onLoad&&n.onLoad())},this.itemError=function(t){void 0!==n.onError&&n.onError(t)},this.resolveURL=function(t){return r?r(t):t},this.setURLModifier=function(t){return r=t,this},this.addHandler=function(t,e){return l.push(t,e),this},this.removeHandler=function(t){const e=l.indexOf(t);return-1!==e&&l.splice(e,2),this},this.getHandler=function(t){for(let e=0,i=l.length;e<i;e+=2){const i=l[e],n=l[e+1];if(i.global&&(i.lastIndex=0),i.test(t))return n}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}}const Ul=new Fl;class Nl{constructor(t){this.manager=void 0!==t?t:Ul,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(t,e){const i=this;return new Promise(function(n,r){i.load(t,n,e,r)})}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}abort(){return this}}Nl.DEFAULT_MATERIAL_NAME="__DEFAULT";const Ol={};class kl extends Error{constructor(t,e){super(t),this.response=e}}class Ql extends Nl{constructor(t){super(t),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(t,e,i,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=Ll.get(`file:${t}`);if(void 0!==r)return this.manager.itemStart(t),setTimeout(()=>{e&&e(r),this.manager.itemEnd(t)},0),r;if(void 0!==Ol[t])return void Ol[t].push({onLoad:e,onProgress:i,onError:n});Ol[t]=[],Ol[t].push({onLoad:e,onProgress:i,onError:n});const s=new Request(t,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:"function"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),a=this.mimeType,o=this.responseType;fetch(s).then(e=>{if(200===e.status||0===e.status){if(0===e.status&&tn("FileLoader: HTTP Status 0 received."),"undefined"==typeof ReadableStream||void 0===e.body||void 0===e.body.getReader)return e;const i=Ol[t],n=e.body.getReader(),r=e.headers.get("X-File-Size")||e.headers.get("Content-Length"),s=r?parseInt(r):0,a=0!==s;let o=0;const l=new ReadableStream({start(t){!function e(){n.read().then(({done:n,value:r})=>{if(n)t.close();else{o+=r.byteLength;const n=new ProgressEvent("progress",{lengthComputable:a,loaded:o,total:s});for(let t=0,e=i.length;t<e;t++){const e=i[t];e.onProgress&&e.onProgress(n)}t.enqueue(r),e()}},e=>{t.error(e)})}()}});return new Response(l)}throw new kl(`fetch for "${e.url}" responded with ${e.status}: ${e.statusText}`,e)}).then(t=>{switch(o){case"arraybuffer":return t.arrayBuffer();case"blob":return t.blob();case"document":return t.text().then(t=>(new DOMParser).parseFromString(t,a));case"json":return t.json();default:if(""===a)return t.text();{const e=/charset="?([^;"\s]*)"?/i.exec(a),i=e&&e[1]?e[1].toLowerCase():void 0,n=new TextDecoder(i);return t.arrayBuffer().then(t=>n.decode(t))}}}).then(e=>{Ll.add(`file:${t}`,e);const i=Ol[t];delete Ol[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onLoad&&n.onLoad(e)}}).catch(e=>{const i=Ol[t];if(void 0===i)throw this.manager.itemError(t),e;delete Ol[t];for(let t=0,n=i.length;t<n;t++){const n=i[t];n.onError&&n.onError(e)}this.manager.itemError(t)}).finally(()=>{this.manager.itemEnd(t)}),this.manager.itemStart(t)}setResponseType(t){return this.responseType=t,this}setMimeType(t){return this.mimeType=t,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}const Gl=new WeakMap;class zl extends Nl{constructor(t){super(t)}load(t,e,i,n){void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,s=Ll.get(`image:${t}`);if(void 0!==s){if(!0===s.complete)r.manager.itemStart(t),setTimeout(function(){e&&e(s),r.manager.itemEnd(t)},0);else{let t=Gl.get(s);void 0===t&&(t=[],Gl.set(s,t)),t.push({onLoad:e,onError:n})}return s}const a=Ki("img");function o(){c(),e&&e(this);const i=Gl.get(this)||[];for(let t=0;t<i.length;t++){const e=i[t];e.onLoad&&e.onLoad(this)}Gl.delete(this),r.manager.itemEnd(t)}function l(e){c(),n&&n(e),Ll.remove(`image:${t}`);const i=Gl.get(this)||[];for(let t=0;t<i.length;t++){const n=i[t];n.onError&&n.onError(e)}Gl.delete(this),r.manager.itemError(t),r.manager.itemEnd(t)}function c(){a.removeEventListener("load",o,!1),a.removeEventListener("error",l,!1)}return a.addEventListener("load",o,!1),a.addEventListener("error",l,!1),"data:"!==t.slice(0,5)&&void 0!==this.crossOrigin&&(a.crossOrigin=this.crossOrigin),Ll.add(`image:${t}`,a),r.manager.itemStart(t),a.src=t,a}}class Hl extends Nl{constructor(t){super(t)}load(t,e,i,n){const r=this,s=new la,a=new Ql(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(r.withCredentials),a.load(t,function(t){let i;try{i=r.parse(t)}catch(t){if(void 0===n)return void t(t);n(t)}void 0!==i.image?s.image=i.image:void 0!==i.data&&(s.image.width=i.width,s.image.height=i.height,s.image.data=i.data),s.wrapS=void 0!==i.wrapS?i.wrapS:ce,s.wrapT=void 0!==i.wrapT?i.wrapT:ce,s.magFilter=void 0!==i.magFilter?i.magFilter:Ae,s.minFilter=void 0!==i.minFilter?i.minFilter:Ae,s.anisotropy=void 0!==i.anisotropy?i.anisotropy:1,void 0!==i.colorSpace&&(s.colorSpace=i.colorSpace),void 0!==i.flipY&&(s.flipY=i.flipY),void 0!==i.format&&(s.format=i.format),void 0!==i.type&&(s.type=i.type),void 0!==i.mipmaps&&(s.mipmaps=i.mipmaps,s.minFilter=me),1===i.mipmapCount&&(s.minFilter=Ae),void 0!==i.generateMipmaps&&(s.generateMipmaps=i.generateMipmaps),s.needsUpdate=!0,e&&e(s,i)},i,n),s}}class Vl extends Nl{constructor(t){super(t)}load(t,e,i,n){const r=new Nn,s=new zl(this.manager);return s.setCrossOrigin(this.crossOrigin),s.setPath(this.path),s.load(t,function(t){r.image=t,r.needsUpdate=!0,void 0!==e&&e(r)},i,n),r}}class ql extends mr{constructor(t,e=1){super(),this.isLight=!0,this.type="Light",this.color=new Sr(t),this.intensity=e}dispose(){this.dispatchEvent({type:"dispose"})}copy(t,e){return super.copy(t,e),this.color.copy(t.color),this.intensity=t.intensity,this}toJSON(t){const e=super.toJSON(t);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,e}}const jl=new Hn,Wl=new vn,Xl=new vn;class Kl{constructor(t){this.camera=t,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new fn(512,512),this.mapType=fe,this.map=null,this.mapPass=null,this.matrix=new Hn,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Ia,this._frameExtents=new fn(1,1),this._viewportCount=1,this._viewports=[new On(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(t){const e=this.camera,i=this.matrix;Wl.setFromMatrixPosition(t.matrixWorld),e.position.copy(Wl),Xl.setFromMatrixPosition(t.target.matrixWorld),e.lookAt(Xl),e.updateMatrixWorld(),jl.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(jl,e.coordinateSystem,e.reversedDepth),e.coordinateSystem===Xi||e.reversedDepth?i.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(jl)}getViewport(t){return this._viewports[t]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(t){return this.camera=t.camera.clone(),this.intensity=t.intensity,this.bias=t.bias,this.radius=t.radius,this.autoUpdate=t.autoUpdate,this.needsUpdate=t.needsUpdate,this.normalBias=t.normalBias,this.blurSamples=t.blurSamples,this.mapSize.copy(t.mapSize),this.biasNode=t.biasNode,this}clone(){return(new this.constructor).copy(this)}toJSON(){const t={};return 1!==this.intensity&&(t.intensity=this.intensity),0!==this.bias&&(t.bias=this.bias),0!==this.normalBias&&(t.normalBias=this.normalBias),1!==this.radius&&(t.radius=this.radius),512===this.mapSize.x&&512===this.mapSize.y||(t.mapSize=this.mapSize.toArray()),t.camera=this.camera.toJSON(!1).object,delete t.camera.matrix,t}}const Jl=new vn,Yl=new bn,$l=new vn;class Zl extends mr{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Hn,this.projectionMatrix=new Hn,this.projectionMatrixInverse=new Hn,this.coordinateSystem=Wi,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(t,e){return super.copy(t,e),this.matrixWorldInverse.copy(t.matrixWorldInverse),this.projectionMatrix.copy(t.projectionMatrix),this.projectionMatrixInverse.copy(t.projectionMatrixInverse),this.coordinateSystem=t.coordinateSystem,this}getWorldDirection(t){return super.getWorldDirection(t).negate()}updateMatrixWorld(t){super.updateMatrixWorld(t),this.matrixWorld.decompose(Jl,Yl,$l),1===$l.x&&1===$l.y&&1===$l.z?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(Jl,Yl,$l.set(1,1,1)).invert()}updateWorldMatrix(t,e){super.updateWorldMatrix(t,e),this.matrixWorld.decompose(Jl,Yl,$l),1===$l.x&&1===$l.y&&1===$l.z?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(Jl,Yl,$l.set(1,1,1)).invert()}clone(){return(new this.constructor).copy(this)}}const tc=new vn,ec=new fn,ic=new fn;class nc extends Zl{constructor(t=50,e=1,i=.1,n=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=t,this.zoom=1,this.near=i,this.far=n,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.fov=t.fov,this.zoom=t.zoom,this.near=t.near,this.far=t.far,this.focus=t.focus,this.aspect=t.aspect,this.view=null===t.view?null:Object.assign({},t.view),this.filmGauge=t.filmGauge,this.filmOffset=t.filmOffset,this}setFocalLength(t){const e=.5*this.getFilmHeight()/t;this.fov=2*cn*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const t=Math.tan(.5*ln*this.fov);return.5*this.getFilmHeight()/t}getEffectiveFOV(){return 2*cn*Math.atan(Math.tan(.5*ln*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(t,e,i){tc.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),e.set(tc.x,tc.y).multiplyScalar(-t/tc.z),tc.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(tc.x,tc.y).multiplyScalar(-t/tc.z)}getViewSize(t,e){return this.getViewBounds(t,ec,ic),e.subVectors(ic,ec)}setViewOffset(t,e,i,n,r,s){this.aspect=t/e,null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=this.near;let e=t*Math.tan(.5*ln*this.fov)/this.zoom,i=2*e,n=this.aspect*i,r=-.5*n;const s=this.view;if(null!==this.view&&this.view.enabled){const t=s.fullWidth,a=s.fullHeight;r+=s.offsetX*n/t,e-=s.offsetY*i/a,n*=s.width/t,i*=s.height/a}const a=this.filmOffset;0!==a&&(r+=t*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+n,e,e-i,t,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,null!==this.view&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}class rc extends Kl{constructor(){super(new nc(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(t){const e=this.camera,i=2*cn*t.angle*this.focus,n=this.mapSize.width/this.mapSize.height*this.aspect,r=t.distance||e.far;i===e.fov&&n===e.aspect&&r===e.far||(e.fov=i,e.aspect=n,e.far=r,e.updateProjectionMatrix()),super.updateMatrices(t)}copy(t){return super.copy(t),this.focus=t.focus,this}}class sc extends ql{constructor(t,e,i=0,n=Math.PI/3,r=0,s=2){super(t,e),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(mr.DEFAULT_UP),this.updateMatrix(),this.target=new mr,this.distance=i,this.angle=n,this.penumbra=r,this.decay=s,this.map=null,this.shadow=new rc}get power(){return this.intensity*Math.PI}set power(t){this.intensity=t/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.angle=t.angle,this.penumbra=t.penumbra,this.decay=t.decay,this.target=t.target.clone(),this.map=t.map,this.shadow=t.shadow.clone(),this}toJSON(t){const e=super.toJSON(t);return e.object.distance=this.distance,e.object.angle=this.angle,e.object.decay=this.decay,e.object.penumbra=this.penumbra,e.object.target=this.target.uuid,this.map&&this.map.isTexture&&(e.object.map=this.map.toJSON(t).uuid),e.object.shadow=this.shadow.toJSON(),e}}class ac extends Kl{constructor(){super(new nc(90,1,.5,500)),this.isPointLightShadow=!0}}class oc extends ql{constructor(t,e,i=0,n=2){super(t,e),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=n,this.shadow=new ac}get power(){return 4*this.intensity*Math.PI}set power(t){this.intensity=t/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(t,e){return super.copy(t,e),this.distance=t.distance,this.decay=t.decay,this.shadow=t.shadow.clone(),this}toJSON(t){const e=super.toJSON(t);return e.object.distance=this.distance,e.object.decay=this.decay,e.object.shadow=this.shadow.toJSON(),e}}class lc extends Zl{constructor(t=-1,e=1,i=1,n=-1,r=.1,s=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=t,this.right=e,this.top=i,this.bottom=n,this.near=r,this.far=s,this.updateProjectionMatrix()}copy(t,e){return super.copy(t,e),this.left=t.left,this.right=t.right,this.top=t.top,this.bottom=t.bottom,this.near=t.near,this.far=t.far,this.zoom=t.zoom,this.view=null===t.view?null:Object.assign({},t.view),this}setViewOffset(t,e,i,n,r,s){null===this.view&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=t,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=n,this.view.width=r,this.view.height=s,this.updateProjectionMatrix()}clearViewOffset(){null!==this.view&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const t=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,n=(this.top+this.bottom)/2;let r=i-t,s=i+t,a=n+e,o=n-e;if(null!==this.view&&this.view.enabled){const t=(this.right-this.left)/this.view.fullWidth/this.zoom,e=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=t*this.view.offsetX,s=r+t*this.view.width,a-=e*this.view.offsetY,o=a-e*this.view.height}this.projectionMatrix.makeOrthographic(r,s,a,o,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(t){const e=super.toJSON(t);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,null!==this.view&&(e.object.view=Object.assign({},this.view)),e}}class cc extends Kl{constructor(){super(new lc(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class hc extends ql{constructor(t,e){super(t,e),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(mr.DEFAULT_UP),this.updateMatrix(),this.target=new mr,this.shadow=new cc}dispose(){super.dispose(),this.shadow.dispose()}copy(t){return super.copy(t),this.target=t.target.clone(),this.shadow=t.shadow.clone(),this}toJSON(t){const e=super.toJSON(t);return e.object.shadow=this.shadow.toJSON(),e.object.target=this.target.uuid,e}}class uc{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let t=0;t<9;t++)this.coefficients.push(new vn)}set(t){for(let e=0;e<9;e++)this.coefficients[e].copy(t[e]);return this}zero(){for(let t=0;t<9;t++)this.coefficients[t].set(0,0,0);return this}getAt(t,e){const i=t.x,n=t.y,r=t.z,s=this.coefficients;return e.copy(s[0]).multiplyScalar(.282095),e.addScaledVector(s[1],.488603*n),e.addScaledVector(s[2],.488603*r),e.addScaledVector(s[3],.488603*i),e.addScaledVector(s[4],i*n*1.092548),e.addScaledVector(s[5],n*r*1.092548),e.addScaledVector(s[6],.315392*(3*r*r-1)),e.addScaledVector(s[7],i*r*1.092548),e.addScaledVector(s[8],.546274*(i*i-n*n)),e}getIrradianceAt(t,e){const i=t.x,n=t.y,r=t.z,s=this.coefficients;return e.copy(s[0]).multiplyScalar(.886227),e.addScaledVector(s[1],1.023328*n),e.addScaledVector(s[2],1.023328*r),e.addScaledVector(s[3],1.023328*i),e.addScaledVector(s[4],.858086*i*n),e.addScaledVector(s[5],.858086*n*r),e.addScaledVector(s[6],.743125*r*r-.247708),e.addScaledVector(s[7],.858086*i*r),e.addScaledVector(s[8],.429043*(i*i-n*n)),e}add(t){for(let e=0;e<9;e++)this.coefficients[e].add(t.coefficients[e]);return this}addScaledSH(t,e){for(let i=0;i<9;i++)this.coefficients[i].addScaledVector(t.coefficients[i],e);return this}scale(t){for(let e=0;e<9;e++)this.coefficients[e].multiplyScalar(t);return this}lerp(t,e){for(let i=0;i<9;i++)this.coefficients[i].lerp(t.coefficients[i],e);return this}equals(t){for(let e=0;e<9;e++)if(!this.coefficients[e].equals(t.coefficients[e]))return!1;return!0}copy(t){return this.set(t.coefficients)}clone(){return(new this.constructor).copy(this)}fromArray(t,e=0){const i=this.coefficients;for(let n=0;n<9;n++)i[n].fromArray(t,e+3*n);return this}toArray(t=[],e=0){const i=this.coefficients;for(let n=0;n<9;n++)i[n].toArray(t,e+3*n);return t}static getBasisAt(t,e){const i=t.x,n=t.y,r=t.z;e[0]=.282095,e[1]=.488603*n,e[2]=.488603*r,e[3]=.488603*i,e[4]=1.092548*i*n,e[5]=1.092548*n*r,e[6]=.315392*(3*r*r-1),e[7]=1.092548*i*r,e[8]=.546274*(i*i-n*n)}}class dc extends ql{constructor(t=new uc,e=1){super(void 0,e),this.isLightProbe=!0,this.sh=t}copy(t){return super.copy(t),this.sh.copy(t.sh),this}toJSON(t){const e=super.toJSON(t);return e.object.sh=this.sh.toArray(),e}}class pc{static extractUrlBase(t){const e=t.lastIndexOf("/");return-1===e?"./":t.slice(0,e+1)}static resolveURL(t,e){return"string"!=typeof t||""===t?"":(/^https?:\/\//i.test(e)&&/^\//.test(t)&&(e=e.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(t)||/^data:.*,.*$/i.test(t)||/^blob:.*$/i.test(t)?t:e+t)}}const Ac=new WeakMap;class gc extends Nl{constructor(t){super(t),this.isImageBitmapLoader=!0,"undefined"==typeof createImageBitmap&&tn("ImageBitmapLoader: createImageBitmap() not supported."),"undefined"==typeof fetch&&tn("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(t){return this.options=t,this}load(t,e,i,n){void 0===t&&(t=""),void 0!==this.path&&(t=this.path+t),t=this.manager.resolveURL(t);const r=this,s=Ll.get(`image-bitmap:${t}`);if(void 0!==s)return r.manager.itemStart(t),s.then?void s.then(i=>{if(!0!==Ac.has(s))return e&&e(i),r.manager.itemEnd(t),i;n&&n(Ac.get(s)),r.manager.itemError(t),r.manager.itemEnd(t)}):(setTimeout(function(){e&&e(s),r.manager.itemEnd(t)},0),s);const a={};a.credentials="anonymous"===this.crossOrigin?"same-origin":"include",a.headers=this.requestHeader,a.signal="function"==typeof AbortSignal.any?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const o=fetch(t,a).then(function(t){return t.blob()}).then(function(t){return createImageBitmap(t,Object.assign(r.options,{colorSpaceConversion:"none"}))}).then(function(i){return Ll.add(`image-bitmap:${t}`,i),e&&e(i),r.manager.itemEnd(t),i}).catch(function(e){n&&n(e),Ac.set(o,e),Ll.remove(`image-bitmap:${t}`),r.manager.itemError(t),r.manager.itemEnd(t)});Ll.add(`image-bitmap:${t}`,o),r.manager.itemStart(t)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}const mc=-90;class fc extends mr{constructor(t,e,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const n=new nc(mc,1,t,e);n.layers=this.layers,this.add(n);const r=new nc(mc,1,t,e);r.layers=this.layers,this.add(r);const s=new nc(mc,1,t,e);s.layers=this.layers,this.add(s);const a=new nc(mc,1,t,e);a.layers=this.layers,this.add(a);const o=new nc(mc,1,t,e);o.layers=this.layers,this.add(o);const l=new nc(mc,1,t,e);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const t=this.coordinateSystem,e=this.children.concat(),[i,n,r,s,a,o]=e;for(const t of e)this.remove(t);if(t===Wi)i.up.set(0,1,0),i.lookAt(1,0,0),n.up.set(0,1,0),n.lookAt(-1,0,0),r.up.set(0,0,-1),r.lookAt(0,1,0),s.up.set(0,0,1),s.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),o.up.set(0,1,0),o.lookAt(0,0,-1);else{if(t!==Xi)throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+t);i.up.set(0,-1,0),i.lookAt(-1,0,0),n.up.set(0,-1,0),n.lookAt(1,0,0),r.up.set(0,0,1),r.lookAt(0,1,0),s.up.set(0,0,-1),s.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),o.up.set(0,-1,0),o.lookAt(0,0,-1)}for(const t of e)this.add(t),t.updateMatrixWorld()}update(t,e){null===this.parent&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:n}=this;this.coordinateSystem!==t.coordinateSystem&&(this.coordinateSystem=t.coordinateSystem,this.updateCoordinateSystem());const[r,s,a,o,l,c]=this.children,h=t.getRenderTarget(),u=t.getActiveCubeFace(),d=t.getActiveMipmapLevel(),p=t.xr.enabled;t.xr.enabled=!1;const A=i.texture.generateMipmaps;i.texture.generateMipmaps=!1;let g=!1;g=!0===t.isWebGLRenderer?t.state.buffers.depth.getReversed():t.reversedDepthBuffer,t.setRenderTarget(i,0,n),g&&!1===t.autoClear&&t.clearDepth(),t.render(e,r),t.setRenderTarget(i,1,n),g&&!1===t.autoClear&&t.clearDepth(),t.render(e,s),t.setRenderTarget(i,2,n),g&&!1===t.autoClear&&t.clearDepth(),t.render(e,a),t.setRenderTarget(i,3,n),g&&!1===t.autoClear&&t.clearDepth(),t.render(e,o),t.setRenderTarget(i,4,n),g&&!1===t.autoClear&&t.clearDepth(),t.render(e,l),i.texture.generateMipmaps=A,t.setRenderTarget(i,5,n),g&&!1===t.autoClear&&t.clearDepth(),t.render(e,c),t.setRenderTarget(h,u,d),t.xr.enabled=p,i.texture.needsPMREMUpdate=!0}}class bc extends nc{constructor(t=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=t}}class vc{constructor(t,e,i){let n,r,s;switch(this.binding=t,this.valueSize=i,e){case"quaternion":n=this._slerp,r=this._slerpAdditive,s=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(6*i),this._workIndex=5;break;case"string":case"bool":n=this._select,r=this._select,s=this._setAdditiveIdentityOther,this.buffer=new Array(5*i);break;default:n=this._lerp,r=this._lerpAdditive,s=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(5*i)}this._mixBufferRegion=n,this._mixBufferRegionAdditive=r,this._setIdentity=s,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(t,e){const i=this.buffer,n=this.valueSize,r=t*n+n;let s=this.cumulativeWeight;if(0===s){for(let t=0;t!==n;++t)i[r+t]=i[t];s=e}else{s+=e;const t=e/s;this._mixBufferRegion(i,r,0,t,n)}this.cumulativeWeight=s}accumulateAdditive(t){const e=this.buffer,i=this.valueSize,n=i*this._addIndex;0===this.cumulativeWeightAdditive&&this._setIdentity(),this._mixBufferRegionAdditive(e,n,0,t,i),this.cumulativeWeightAdditive+=t}apply(t){const e=this.valueSize,i=this.buffer,n=t*e+e,r=this.cumulativeWeight,s=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,r<1){const t=e*this._origIndex;this._mixBufferRegion(i,n,t,1-r,e)}s>0&&this._mixBufferRegionAdditive(i,n,this._addIndex*e,1,e);for(let t=e,r=e+e;t!==r;++t)if(i[t]!==i[t+e]){a.setValue(i,n);break}}saveOriginalState(){const t=this.binding,e=this.buffer,i=this.valueSize,n=i*this._origIndex;t.getValue(e,n);for(let t=i,r=n;t!==r;++t)e[t]=e[n+t%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const t=3*this.valueSize;this.binding.setValue(this.buffer,t)}_setAdditiveIdentityNumeric(){const t=this._addIndex*this.valueSize,e=t+this.valueSize;for(let i=t;i<e;i++)this.buffer[i]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const t=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize;for(let i=0;i<this.valueSize;i++)this.buffer[e+i]=this.buffer[t+i]}_select(t,e,i,n,r){if(n>=.5)for(let n=0;n!==r;++n)t[e+n]=t[i+n]}_slerp(t,e,i,n){bn.slerpFlat(t,e,t,e,t,i,n)}_slerpAdditive(t,e,i,n,r){const s=this._workIndex*r;bn.multiplyQuaternionsFlat(t,s,t,e,t,i),bn.slerpFlat(t,e,t,e,t,s,n)}_lerp(t,e,i,n,r){const s=1-n;for(let a=0;a!==r;++a){const r=e+a;t[r]=t[r]*s+t[i+a]*n}}_lerpAdditive(t,e,i,n,r){for(let s=0;s!==r;++s){const r=e+s;t[r]=t[r]+t[i+s]*n}}}const yc="\\[\\]\\.:\\/",xc=new RegExp("["+yc+"]","g"),_c="[^"+yc+"]",Ec="[^"+yc.replace("\\.","")+"]",Sc=new RegExp("^"+/((?:WC+[\/:])*)/.source.replace("WC",_c)+/(WCOD+)?/.source.replace("WCOD",Ec)+/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",_c)+/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",_c)+"$"),Cc=["material","materials","bones","map"];class wc{constructor(t,e,i){this.path=e,this.parsedPath=i||wc.parseTrackName(e),this.node=wc.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,i){return t&&t.isAnimationObjectGroup?new wc.Composite(t,e,i):new wc(t,e,i)}static sanitizeNodeName(t){return t.replace(/\s/g,"_").replace(xc,"")}static parseTrackName(t){const e=Sc.exec(t);if(null===e)throw new Error("PropertyBinding: Cannot parse trackName: "+t);const i={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},n=i.nodeName&&i.nodeName.lastIndexOf(".");if(void 0!==n&&-1!==n){const t=i.nodeName.substring(n+1);-1!==Cc.indexOf(t)&&(i.nodeName=i.nodeName.substring(0,n),i.objectName=t)}if(null===i.propertyName||0===i.propertyName.length)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return i}static findNode(t,e){if(void 0===e||""===e||"."===e||-1===e||e===t.name||e===t.uuid)return t;if(t.skeleton){const i=t.skeleton.getBoneByName(e);if(void 0!==i)return i}if(t.children){const i=function(t){for(let n=0;n<t.length;n++){const r=t[n];if(r.name===e||r.uuid===e)return r;const s=i(r.children);if(s)return s}return null},n=i(t.children);if(n)return n}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){const i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)t[e++]=i[n]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){const i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=t[e++]}_setValue_array_setNeedsUpdate(t,e){const i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){const i=this.resolvedProperty;for(let n=0,r=i.length;n!==r;++n)i[n]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node;const e=this.parsedPath,i=e.objectName,n=e.propertyName;let r=e.propertyIndex;if(t||(t=wc.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t)return void tn("PropertyBinding: No target node found for track: "+this.path+".");if(i){let n=e.objectIndex;switch(i){case"materials":if(!t.material)return void en("PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.materials)return void en("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);t=t.material.materials;break;case"bones":if(!t.skeleton)return void en("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);t=t.skeleton.bones;for(let e=0;e<t.length;e++)if(t[e].name===n){n=e;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material)return void en("PropertyBinding: Can not bind to material as node does not have a material.",this);if(!t.material.map)return void en("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);t=t.material.map;break;default:if(void 0===t[i])return void en("PropertyBinding: Can not bind to objectName of node undefined.",this);t=t[i]}if(void 0!==n){if(void 0===t[n])return void en("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);t=t[n]}}const s=t[n];if(void 0===s){return void en("PropertyBinding: Trying to update property for track: "+e.nodeName+"."+n+" but it wasn't found.",t)}let a=this.Versioning.None;this.targetObject=t,!0===t.isMaterial?a=this.Versioning.NeedsUpdate:!0===t.isObject3D&&(a=this.Versioning.MatrixWorldNeedsUpdate);let o=this.BindingType.Direct;if(void 0!==r){if("morphTargetInfluences"===n){if(!t.geometry)return void en("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);if(!t.geometry.morphAttributes)return void en("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);void 0!==t.morphTargetDictionary[r]&&(r=t.morphTargetDictionary[r])}o=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=r}else void 0!==s.fromArray&&void 0!==s.toArray?(o=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(o=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=n;this.getValue=this.GetterByBindingType[o],this.setValue=this.SetterByBindingTypeAndVersioning[o][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}wc.Composite=class{constructor(t,e,i){const n=i||wc.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,n)}getValue(t,e){this.bind();const i=this._targetGroup.nCachedObjects_,n=this._bindings[i];void 0!==n&&n.getValue(t,e)}setValue(t,e){const i=this._bindings;for(let n=this._targetGroup.nCachedObjects_,r=i.length;n!==r;++n)i[n].setValue(t,e)}bind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].bind()}unbind(){const t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=t.length;e!==i;++e)t[e].unbind()}},wc.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},wc.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},wc.prototype.GetterByBindingType=[wc.prototype._getValue_direct,wc.prototype._getValue_array,wc.prototype._getValue_arrayElement,wc.prototype._getValue_toArray],wc.prototype.SetterByBindingTypeAndVersioning=[[wc.prototype._setValue_direct,wc.prototype._setValue_direct_setNeedsUpdate,wc.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[wc.prototype._setValue_array,wc.prototype._setValue_array_setNeedsUpdate,wc.prototype._setValue_array_setMatrixWorldNeedsUpdate],[wc.prototype._setValue_arrayElement,wc.prototype._setValue_arrayElement_setNeedsUpdate,wc.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[wc.prototype._setValue_fromArray,wc.prototype._setValue_fromArray_setNeedsUpdate,wc.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class Mc{constructor(t,e,i=null,n=e.blendMode){this._mixer=t,this._clip=e,this._localRoot=i,this.blendMode=n;const r=e.tracks,s=r.length,a=new Array(s),o={endingStart:Mi,endingEnd:Mi};for(let t=0;t!==s;++t){const e=r[t].createInterpolant(null);a[t]=e,e.settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(s),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=_i,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&0!==this.timeScale&&null===this._startTime&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(t){return this._startTime=t,this}setLoop(t,e){return this.loop=t,this.repetitions=e,this}setEffectiveWeight(t){return this.weight=t,this._effectiveWeight=this.enabled?t:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(t){return this._scheduleFading(t,0,1)}fadeOut(t){return this._scheduleFading(t,1,0)}crossFadeFrom(t,e,i=!1){if(t.fadeOut(e),this.fadeIn(e),!0===i){const i=this._clip.duration,n=t._clip.duration,r=n/i,s=i/n;t.warp(1,r,e),this.warp(s,1,e)}return this}crossFadeTo(t,e,i=!1){return t.crossFadeFrom(this,e,i)}stopFading(){const t=this._weightInterpolant;return null!==t&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}setEffectiveTimeScale(t){return this.timeScale=t,this._effectiveTimeScale=this.paused?0:t,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(t){return this.timeScale=this._clip.duration/t,this.stopWarping()}syncWith(t){return this.time=t.time,this.timeScale=t.timeScale,this.stopWarping()}halt(t){return this.warp(this._effectiveTimeScale,0,t)}warp(t,e,i){const n=this._mixer,r=n.time,s=this.timeScale;let a=this._timeScaleInterpolant;null===a&&(a=n._lendControlInterpolant(),this._timeScaleInterpolant=a);const o=a.parameterPositions,l=a.sampleValues;return o[0]=r,o[1]=r+i,l[0]=t/s,l[1]=e/s,this}stopWarping(){const t=this._timeScaleInterpolant;return null!==t&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(t)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(t,e,i,n){if(!this.enabled)return void this._updateWeight(t);const r=this._startTime;if(null!==r){const n=(t-r)*i;n<0||0===i?e=0:(this._startTime=null,e=i*n)}e*=this._updateTimeScale(t);const s=this._updateTime(e),a=this._updateWeight(t);if(a>0){const t=this._interpolants,e=this._propertyBindings;if(2501===this.blendMode)for(let i=0,n=t.length;i!==n;++i)t[i].evaluate(s),e[i].accumulateAdditive(a);else for(let i=0,r=t.length;i!==r;++i)t[i].evaluate(s),e[i].accumulate(n,a)}}_updateWeight(t){let e=0;if(this.enabled){e=this.weight;const i=this._weightInterpolant;if(null!==i){const n=i.evaluate(t)[0];e*=n,t>i.parameterPositions[1]&&(this.stopFading(),0===n&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(t){let e=0;if(!this.paused){e=this.timeScale;const i=this._timeScaleInterpolant;if(null!==i){e*=i.evaluate(t)[0],t>i.parameterPositions[1]&&(this.stopWarping(),0===e?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e}_updateTime(t){const e=this._clip.duration,i=this.loop;let n=this.time+t,r=this._loopCount;const s=i===Ei;if(0===t)return-1===r||!s||1&~r?n:e-n;if(i===xi){-1===r&&(this._loopCount=0,this._setEndings(!0,!0,!1));t:{if(n>=e)n=e;else{if(!(n<0)){this.time=n;break t}n=0}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=n,this._mixer.dispatchEvent({type:"finished",action:this,direction:t<0?-1:1})}}else{if(-1===r&&(t>=0?(r=0,this._setEndings(!0,0===this.repetitions,s)):this._setEndings(0===this.repetitions,!0,s)),n>=e||n<0){const i=Math.floor(n/e);n-=e*i,r+=Math.abs(i);const a=this.repetitions-r;if(a<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,n=t>0?e:0,this.time=n,this._mixer.dispatchEvent({type:"finished",action:this,direction:t>0?1:-1});else{if(1===a){const e=t<0;this._setEndings(e,!e,s)}else this._setEndings(!1,!1,s);this._loopCount=r,this.time=n,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:i})}}else this.time=n;if(s&&!(1&~r))return e-n}return n}_setEndings(t,e,i){const n=this._interpolantSettings;i?(n.endingStart=Ii,n.endingEnd=Ii):(n.endingStart=t?this.zeroSlopeAtStart?Ii:Mi:Ti,n.endingEnd=e?this.zeroSlopeAtEnd?Ii:Mi:Ti)}_scheduleFading(t,e,i){const n=this._mixer,r=n.time;let s=this._weightInterpolant;null===s&&(s=n._lendControlInterpolant(),this._weightInterpolant=s);const a=s.parameterPositions,o=s.sampleValues;return a[0]=r,o[0]=e,a[1]=r+t,o[1]=i,this}}const Ic=new Float32Array(1);class Tc extends sn{constructor(t){super(),this._root=t,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1,"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}_bindAction(t,e){const i=t._localRoot||this._root,n=t._clip.tracks,r=n.length,s=t._propertyBindings,a=t._interpolants,o=i.uuid,l=this._bindingsByRootAndName;let c=l[o];void 0===c&&(c={},l[o]=c);for(let t=0;t!==r;++t){const r=n[t],l=r.name;let h=c[l];if(void 0!==h)++h.referenceCount,s[t]=h;else{if(h=s[t],void 0!==h){null===h._cacheIndex&&(++h.referenceCount,this._addInactiveBinding(h,o,l));continue}const n=e&&e._propertyBindings[t].binding.parsedPath;h=new vc(wc.create(i,l,n),r.ValueTypeName,r.getValueSize()),++h.referenceCount,this._addInactiveBinding(h,o,l),s[t]=h}a[t].resultBuffer=h.buffer}}_activateAction(t){if(!this._isActiveAction(t)){if(null===t._cacheIndex){const e=(t._localRoot||this._root).uuid,i=t._clip.uuid,n=this._actionsByClip[i];this._bindAction(t,n&&n.knownActions[0]),this._addInactiveAction(t,i,e)}const e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){const i=e[t];0===i.useCount++&&(this._lendBinding(i),i.saveOriginalState())}this._lendAction(t)}}_deactivateAction(t){if(this._isActiveAction(t)){const e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){const i=e[t];0===--i.useCount&&(i.restoreOriginalState(),this._takeBackBinding(i))}this._takeBackAction(t)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const t=this;this.stats={actions:{get total(){return t._actions.length},get inUse(){return t._nActiveActions}},bindings:{get total(){return t._bindings.length},get inUse(){return t._nActiveBindings}},controlInterpolants:{get total(){return t._controlInterpolants.length},get inUse(){return t._nActiveControlInterpolants}}}}_isActiveAction(t){const e=t._cacheIndex;return null!==e&&e<this._nActiveActions}_addInactiveAction(t,e,i){const n=this._actions,r=this._actionsByClip;let s=r[e];if(void 0===s)s={knownActions:[t],actionByRoot:{}},t._byClipCacheIndex=0,r[e]=s;else{const e=s.knownActions;t._byClipCacheIndex=e.length,e.push(t)}t._cacheIndex=n.length,n.push(t),s.actionByRoot[i]=t}_removeInactiveAction(t){const e=this._actions,i=e[e.length-1],n=t._cacheIndex;i._cacheIndex=n,e[n]=i,e.pop(),t._cacheIndex=null;const r=t._clip.uuid,s=this._actionsByClip,a=s[r],o=a.knownActions,l=o[o.length-1],c=t._byClipCacheIndex;l._byClipCacheIndex=c,o[c]=l,o.pop(),t._byClipCacheIndex=null;delete a.actionByRoot[(t._localRoot||this._root).uuid],0===o.length&&delete s[r],this._removeInactiveBindingsForAction(t)}_removeInactiveBindingsForAction(t){const e=t._propertyBindings;for(let t=0,i=e.length;t!==i;++t){const i=e[t];0===--i.referenceCount&&this._removeInactiveBinding(i)}}_lendAction(t){const e=this._actions,i=t._cacheIndex,n=this._nActiveActions++,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r}_takeBackAction(t){const e=this._actions,i=t._cacheIndex,n=--this._nActiveActions,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r}_addInactiveBinding(t,e,i){const n=this._bindingsByRootAndName,r=this._bindings;let s=n[e];void 0===s&&(s={},n[e]=s),s[i]=t,t._cacheIndex=r.length,r.push(t)}_removeInactiveBinding(t){const e=this._bindings,i=t.binding,n=i.rootNode.uuid,r=i.path,s=this._bindingsByRootAndName,a=s[n],o=e[e.length-1],l=t._cacheIndex;o._cacheIndex=l,e[l]=o,e.pop(),delete a[r],0===Object.keys(a).length&&delete s[n]}_lendBinding(t){const e=this._bindings,i=t._cacheIndex,n=this._nActiveBindings++,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r}_takeBackBinding(t){const e=this._bindings,i=t._cacheIndex,n=--this._nActiveBindings,r=e[n];t._cacheIndex=n,e[n]=t,r._cacheIndex=i,e[i]=r}_lendControlInterpolant(){const t=this._controlInterpolants,e=this._nActiveControlInterpolants++;let i=t[e];return void 0===i&&(i=new yl(new Float32Array(2),new Float32Array(2),1,Ic),i.__cacheIndex=e,t[e]=i),i}_takeBackControlInterpolant(t){const e=this._controlInterpolants,i=t.__cacheIndex,n=--this._nActiveControlInterpolants,r=e[n];t.__cacheIndex=n,e[n]=t,r.__cacheIndex=i,e[i]=r}clipAction(t,e,i){const n=e||this._root,r=n.uuid;let s="string"==typeof t?Rl.findByName(n,t):t;const a=null!==s?s.uuid:t,o=this._actionsByClip[a];let l=null;if(void 0===i&&(i=null!==s?s.blendMode:Bi),void 0!==o){const t=o.actionByRoot[r];if(void 0!==t&&t.blendMode===i)return t;l=o.knownActions[0],null===s&&(s=l._clip)}if(null===s)return null;const c=new Mc(this,s,e,i);return this._bindAction(c,l),this._addInactiveAction(c,a,r),c}existingAction(t,e){const i=e||this._root,n=i.uuid,r="string"==typeof t?Rl.findByName(i,t):t,s=r?r.uuid:t,a=this._actionsByClip[s];return void 0!==a&&a.actionByRoot[n]||null}stopAllAction(){const t=this._actions;for(let e=this._nActiveActions-1;e>=0;--e)t[e].stop();return this}update(t){t*=this.timeScale;const e=this._actions,i=this._nActiveActions,n=this.time+=t,r=Math.sign(t),s=this._accuIndex^=1;for(let a=0;a!==i;++a){e[a]._update(n,t,r,s)}const a=this._bindings,o=this._nActiveBindings;for(let t=0;t!==o;++t)a[t].apply(s);return this}setTime(t){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(t)}getRoot(){return this._root}uncacheClip(t){const e=this._actions,i=t.uuid,n=this._actionsByClip,r=n[i];if(void 0!==r){const t=r.knownActions;for(let i=0,n=t.length;i!==n;++i){const n=t[i];this._deactivateAction(n);const r=n._cacheIndex,s=e[e.length-1];n._cacheIndex=null,n._byClipCacheIndex=null,s._cacheIndex=r,e[r]=s,e.pop(),this._removeInactiveBindingsForAction(n)}delete n[i]}}uncacheRoot(t){const e=t.uuid,i=this._actionsByClip;for(const t in i){const n=i[t].actionByRoot[e];void 0!==n&&(this._deactivateAction(n),this._removeInactiveAction(n))}const n=this._bindingsByRootAndName[e];if(void 0!==n)for(const t in n){const e=n[t];e.restoreOriginalState(),this._removeInactiveBinding(e)}}uncacheAction(t,e){const i=this.existingAction(t,e);null!==i&&(this._deactivateAction(i),this._removeInactiveAction(i))}}class Bc{constructor(t){this.value=t}clone(){return new Bc(void 0===this.value.clone?this.value:this.value.clone())}}const Rc=new Hn;function Dc(t,e){return t.distance-e.distance}function Lc(t,e,i,n){let r=!0;if(t.layers.test(e.layers)){!1===t.raycast(e,i)&&(r=!1)}if(!0===r&&!0===n){const n=t.children;for(let t=0,r=n.length;t<r;t++)Lc(n[t],e,i,!0)}}class Pc{constructor(t=1,e=0,i=0){this.radius=t,this.phi=e,this.theta=i}set(t,e,i){return this.radius=t,this.phi=e,this.theta=i,this}copy(t){return this.radius=t.radius,this.phi=t.phi,this.theta=t.theta,this}makeSafe(){const t=1e-6;return this.phi=un(this.phi,t,Math.PI-t),this}setFromVector3(t){return this.setFromCartesianCoords(t.x,t.y,t.z)}setFromCartesianCoords(t,e,i){return this.radius=Math.sqrt(t*t+e*e+i*i),0===this.radius?(this.theta=0,this.phi=0):(this.theta=Math.atan2(t,i),this.phi=Math.acos(un(e/this.radius,-1,1))),this}clone(){return(new this.constructor).copy(this)}}function Fc(t,e,i,n){const r=function(t){switch(t){case fe:case be:return{byteLength:1,components:1};case ye:case ve:case Se:return{byteLength:2,components:1};case Ce:case we:return{byteLength:2,components:4};case _e:case xe:case Ee:return{byteLength:4,components:1};case Ie:case Te:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${t}.`)}(n);switch(i){case 1021:return t*e;case Pe:case Fe:return t*e/r.components*r.byteLength;case Ue:case Ne:return t*e*2/r.components*r.byteLength;case Be:return t*e*3/r.components*r.byteLength;case Re:case Oe:return t*e*4/r.components*r.byteLength;case ke:case Qe:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case Ge:case ze:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case Ve:case je:return Math.max(t,16)*Math.max(e,8)/4;case He:case qe:return Math.max(t,8)*Math.max(e,8)/2;case We:case Xe:case Je:case Ye:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*8;case Ke:case $e:case Ze:case ti:return Math.floor((t+3)/4)*Math.floor((e+3)/4)*16;case ei:return Math.floor((t+4)/5)*Math.floor((e+3)/4)*16;case ii:return Math.floor((t+4)/5)*Math.floor((e+4)/5)*16;case ni:return Math.floor((t+5)/6)*Math.floor((e+4)/5)*16;case ri:return Math.floor((t+5)/6)*Math.floor((e+5)/6)*16;case si:return Math.floor((t+7)/8)*Math.floor((e+4)/5)*16;case ai:return Math.floor((t+7)/8)*Math.floor((e+5)/6)*16;case oi:return Math.floor((t+7)/8)*Math.floor((e+7)/8)*16;case li:return Math.floor((t+9)/10)*Math.floor((e+4)/5)*16;case ci:return Math.floor((t+9)/10)*Math.floor((e+5)/6)*16;case hi:return Math.floor((t+9)/10)*Math.floor((e+7)/8)*16;case ui:return Math.floor((t+9)/10)*Math.floor((e+9)/10)*16;case di:return Math.floor((t+11)/12)*Math.floor((e+9)/10)*16;case pi:return Math.floor((t+11)/12)*Math.floor((e+11)/12)*16;case Ai:case gi:case mi:return Math.ceil(t/4)*Math.ceil(e/4)*16;case fi:case bi:return Math.ceil(t/4)*Math.ceil(e/4)*8;case vi:case yi:return Math.ceil(t/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${i} format.`)}
|
|
/**
|
|
* @license
|
|
* Copyright 2010-2026 Three.js Authors
|
|
* SPDX-License-Identifier: MIT
|
|
*/
|
|
function Uc(){let t=null,e=!1,i=null,n=null;function r(e,s){i(e,s),n=t.requestAnimationFrame(r)}return{start:function(){!0!==e&&null!==i&&(n=t.requestAnimationFrame(r),e=!0)},stop:function(){t.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(t){i=t},setContext:function(e){t=e}}}function Nc(t){const e=new WeakMap;return{get:function(t){return t.isInterleavedBufferAttribute&&(t=t.data),e.get(t)},remove:function(i){i.isInterleavedBufferAttribute&&(i=i.data);const n=e.get(i);n&&(t.deleteBuffer(n.buffer),e.delete(i))},update:function(i,n){if(i.isInterleavedBufferAttribute&&(i=i.data),i.isGLBufferAttribute){const t=e.get(i);return void((!t||t.version<i.version)&&e.set(i,{buffer:i.buffer,type:i.type,bytesPerElement:i.elementSize,version:i.version}))}const r=e.get(i);if(void 0===r)e.set(i,function(e,i){const n=e.array,r=e.usage,s=n.byteLength,a=t.createBuffer();let o;if(t.bindBuffer(i,a),t.bufferData(i,n,r),e.onUploadCallback(),n instanceof Float32Array)o=t.FLOAT;else if("undefined"!=typeof Float16Array&&n instanceof Float16Array)o=t.HALF_FLOAT;else if(n instanceof Uint16Array)o=e.isFloat16BufferAttribute?t.HALF_FLOAT:t.UNSIGNED_SHORT;else if(n instanceof Int16Array)o=t.SHORT;else if(n instanceof Uint32Array)o=t.UNSIGNED_INT;else if(n instanceof Int32Array)o=t.INT;else if(n instanceof Int8Array)o=t.BYTE;else if(n instanceof Uint8Array)o=t.UNSIGNED_BYTE;else{if(!(n instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+n);o=t.UNSIGNED_BYTE}return{buffer:a,type:o,bytesPerElement:n.BYTES_PER_ELEMENT,version:e.version,size:s}}(i,n));else if(r.version<i.version){if(r.size!==i.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");!function(e,i,n){const r=i.array,s=i.updateRanges;if(t.bindBuffer(n,e),0===s.length)t.bufferSubData(n,0,r);else{s.sort((t,e)=>t.start-e.start);let e=0;for(let t=1;t<s.length;t++){const i=s[e],n=s[t];n.start<=i.start+i.count+1?i.count=Math.max(i.count,n.start+n.count-i.start):(++e,s[e]=n)}s.length=e+1;for(let e=0,i=s.length;e<i;e++){const i=s[e];t.bufferSubData(n,i.start*r.BYTES_PER_ELEMENT,r,i.start,i.count)}i.clearUpdateRanges()}i.onUploadCallback()}(r.buffer,i,n),r.version=i.version}}}}"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:pt}})),"undefined"!=typeof window&&(window.__THREE__?tn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=pt);const Oc={alphahash_fragment:"#ifdef USE_ALPHAHASH\n\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#ifdef USE_ALPHAHASH\n\tconst float ALPHA_HASH_SCALE = 0.05;\n\tfloat hash2D( vec2 value ) {\n\t\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n\t}\n\tfloat hash3D( vec3 value ) {\n\t\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\n\t}\n\tfloat getAlphaHashThreshold( vec3 position ) {\n\t\tfloat maxDeriv = max(\n\t\t\tlength( dFdx( position.xyz ) ),\n\t\t\tlength( dFdy( position.xyz ) )\n\t\t);\n\t\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n\t\tvec2 pixScales = vec2(\n\t\t\texp2( floor( log2( pixScale ) ) ),\n\t\t\texp2( ceil( log2( pixScale ) ) )\n\t\t);\n\t\tvec2 alpha = vec2(\n\t\t\thash3D( floor( pixScales.x * position.xyz ) ),\n\t\t\thash3D( floor( pixScales.y * position.xyz ) )\n\t\t);\n\t\tfloat lerpFactor = fract( log2( pixScale ) );\n\t\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n\t\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\n\t\tvec3 cases = vec3(\n\t\t\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\n\t\t\t( x - 0.5 * a ) / ( 1.0 - a ),\n\t\t\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n\t\t);\n\t\tfloat threshold = ( x < ( 1.0 - a ) )\n\t\t\t? ( ( x < a ) ? cases.x : cases.y )\n\t\t\t: cases.z;\n\t\treturn clamp( threshold , 1.0e-6, 1.0 );\n\t}\n#endif",alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n\t#ifdef ALPHA_TO_COVERAGE\n\tdiffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\tif ( diffuseColor.a < alphaTest ) discard;\n\t#endif\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_CLEARCOAT ) \n\t\tclearcoatSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_SHEEN ) \n\t\tsheenSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",batching_pars_vertex:"#ifdef USE_BATCHING\n\t#if ! defined( GL_ANGLE_multi_draw )\n\t#define gl_DrawID _gl_DrawID\n\tuniform int _gl_DrawID;\n\t#endif\n\tuniform highp sampler2D batchingTexture;\n\tuniform highp usampler2D batchingIdTexture;\n\tmat4 getBatchingMatrix( const in float i ) {\n\t\tint size = textureSize( batchingTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n\tfloat getIndirectIndex( const in int i ) {\n\t\tint size = textureSize( batchingIdTexture, 0 ).x;\n\t\tint x = i % size;\n\t\tint y = i / size;\n\t\treturn float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n\t}\n#endif\n#ifdef USE_BATCHING_COLOR\n\tuniform sampler2D batchingColorTexture;\n\tvec4 getBatchingColor( const in float i ) {\n\t\tint size = textureSize( batchingColorTexture, 0 ).x;\n\t\tint j = int( i );\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\treturn texelFetch( batchingColorTexture, ivec2( x, y ), 0 );\n\t}\n#endif",batching_vertex:"#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\treturn vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n\t\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#ifdef ALPHA_TO_COVERAGE\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tfloat unionClipOpacity = 1.0;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\t\t#endif\n\t\tdiffuseColor.a *= clipOpacity;\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tbool clipped = true;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tif ( clipped ) discard;\n\t\t#endif\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvarying vec4 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvColor = vec4( 1.0 );\n#endif\n#ifdef USE_COLOR_ALPHA\n\tvColor *= color;\n#elif defined( USE_COLOR )\n\tvColor.rgb *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.rgb *= instanceColor.rgb;\n#endif\n#ifdef USE_BATCHING_COLOR\n\tvColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE\n\t\temissiveColor = sRGBTransferEOTF( emissiveColor );\n\t#endif\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"vec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferEOTF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t\t#endif\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif ( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nmaterial.metalness = metalnessFactor;\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;\n\tmaterial.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = vec3( 0.04 );\n\tmaterial.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n\tmaterial.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"uniform sampler2D dfgLUT;\nstruct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tvec3 diffuseContribution;\n\tvec3 specularColor;\n\tvec3 specularColorBlended;\n\tfloat roughness;\n\tfloat metalness;\n\tfloat specularF90;\n\tfloat dispersion;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t\tvec3 iridescenceFresnelDielectric;\n\t\tvec3 iridescenceFresnelMetallic;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn v;\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColorBlended;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transpose( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat rInv = 1.0 / ( roughness + 0.1 );\n\tfloat a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;\n\tfloat b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;\n\tfloat DG = exp( a * dotNV + b );\n\treturn saturate( DG );\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\nvec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tvec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;\n\tvec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;\n\tvec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;\n\tvec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;\n\tfloat Ess_V = dfgV.x + dfgV.y;\n\tfloat Ess_L = dfgL.x + dfgL.y;\n\tfloat Ems_V = 1.0 - Ess_V;\n\tfloat Ems_L = 1.0 - Ess_L;\n\tvec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;\n\tvec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );\n\tfloat compensationFactor = Ems_V * Ems_L;\n\tvec3 multiScatter = Fms * compensationFactor;\n\treturn singleScatter + multiScatter;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t\t#ifdef USE_CLEARCOAT\n\t\t\tvec3 Ncc = geometryClearcoatNormal;\n\t\t\tvec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );\n\t\t\tvec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );\n\t\t\tvec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );\n\t\t\tmat3 mInvClearcoat = mat3(\n\t\t\t\tvec3( t1Clearcoat.x, 0, t1Clearcoat.y ),\n\t\t\t\tvec3( 0, 1, 0 ),\n\t\t\t\tvec3( t1Clearcoat.z, 0, t1Clearcoat.w )\n\t\t\t);\n\t\t\tvec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;\n\t\t\tclearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );\n\t\t#endif\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n \n \t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n \n \t\tfloat sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n \t\tfloat sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );\n \n \t\tfloat sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );\n \n \t\tirradiance *= sheenEnergyComp;\n \n \t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );\n\t#ifdef USE_SHEEN\n\t\tfloat sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t\tfloat sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n\t\tdiffuse *= sheenEnergyComp;\n\t#endif\n\treflectedLight.indirectDiffuse += diffuse;\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;\n \t#endif\n\tvec3 singleScatteringDielectric = vec3( 0.0 );\n\tvec3 multiScatteringDielectric = vec3( 0.0 );\n\tvec3 singleScatteringMetallic = vec3( 0.0 );\n\tvec3 multiScatteringMetallic = vec3( 0.0 );\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );\n\t#endif\n\tvec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );\n\tvec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );\n\tvec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;\n\tvec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tvec3 indirectSpecular = radiance * singleScattering;\n\tindirectSpecular += multiScattering * cosineWeightedIrradiance;\n\tvec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t\tfloat sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;\n\t\tindirectSpecular *= sheenEnergyComp;\n\t\tindirectDiffuse *= sheenEnergyComp;\n\t#endif\n\treflectedLight.indirectSpecular += indirectSpecular;\n\treflectedLight.indirectDiffuse += indirectDiffuse;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );\n\t\tmaterial.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\t#if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )\n\t\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t\t#endif\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\t#if defined( LAMBERT ) || defined( PHONG )\n\t\tirradiance += iblIrradiance;\n\t#endif\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGARITHMIC_DEPTH_BUFFER\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\t}\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING_MORPH\n\t\tuniform float morphTargetBaseInfluence;\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t#endif\n\tuniform sampler2DArray morphTargetsTexture;\n\tuniform ivec2 morphTargetsTextureSize;\n\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t}\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec4( 0., 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec4( 1., 1., 1., 1. );\n\tfloat vuf;\n\tfloat af = modf( v * PackFactors.a, vuf );\n\tfloat bf = modf( vuf * ShiftRight8, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec3( 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec3( 1., 1., 1. );\n\tfloat vuf;\n\tfloat bf = modf( v * PackFactors.b, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec2( 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec2( 1., 1. );\n\tfloat vuf;\n\tfloat gf = modf( v * 256., vuf );\n\treturn vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n\treturn dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n\treturn v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( const in vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\n\t\treturn depth * ( far - near ) - far;\n\t#else\n\t\treturn depth * ( near - far ) - near;\n\t#endif\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\t\n\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\treturn ( near * far ) / ( ( near - far ) * depth - near );\n\t#else\n\t\treturn ( near * far ) / ( ( far - near ) * depth - far );\n\t#endif\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n\tmvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tuniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\t#else\n\t\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\t#endif\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tuniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\t#else\n\t\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\t#endif\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tuniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\t#elif defined( SHADOWMAP_TYPE_BASIC )\n\t\t\tuniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\t#endif\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\tfloat interleavedGradientNoise( vec2 position ) {\n\t\t\treturn fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );\n\t\t}\n\t\tvec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {\n\t\t\tconst float goldenAngle = 2.399963229728653;\n\t\t\tfloat r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );\n\t\t\tfloat theta = float( sampleIndex ) * goldenAngle + phi;\n\t\t\treturn vec2( cos( theta ), sin( theta ) ) * r;\n\t\t}\n\t#endif\n\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\tfloat getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\t\tfloat shadow = 1.0;\n\t\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\t\tshadowCoord.z += shadowBias;\n\t\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\t\tif ( frustumTest ) {\n\t\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\t\tfloat radius = shadowRadius * texelSize.x;\n\t\t\t\tfloat phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +\n\t\t\t\t\ttexture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )\n\t\t\t\t) * 0.2;\n\t\t\t}\n\t\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t\t}\n\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\t\tfloat shadow = 1.0;\n\t\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\t\tshadowCoord.z -= shadowBias;\n\t\t\t#else\n\t\t\t\tshadowCoord.z += shadowBias;\n\t\t\t#endif\n\t\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\t\tif ( frustumTest ) {\n\t\t\t\tvec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;\n\t\t\t\tfloat mean = distribution.x;\n\t\t\t\tfloat variance = distribution.y * distribution.y;\n\t\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\t\t\tfloat hard_shadow = step( mean, shadowCoord.z );\n\t\t\t\t#else\n\t\t\t\t\tfloat hard_shadow = step( shadowCoord.z, mean );\n\t\t\t\t#endif\n\t\t\t\t\n\t\t\t\tif ( hard_shadow == 1.0 ) {\n\t\t\t\t\tshadow = 1.0;\n\t\t\t\t} else {\n\t\t\t\t\tvariance = max( variance, 0.0000001 );\n\t\t\t\t\tfloat d = shadowCoord.z - mean;\n\t\t\t\t\tfloat p_max = variance / ( variance + d * d );\n\t\t\t\t\tp_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );\n\t\t\t\t\tshadow = max( hard_shadow, p_max );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t\t}\n\t#else\n\t\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\t\tfloat shadow = 1.0;\n\t\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\t\tshadowCoord.z -= shadowBias;\n\t\t\t#else\n\t\t\t\tshadowCoord.z += shadowBias;\n\t\t\t#endif\n\t\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\t\tif ( frustumTest ) {\n\t\t\t\tfloat depth = texture2D( shadowMap, shadowCoord.xy ).r;\n\t\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\t\t\tshadow = step( depth, shadowCoord.z );\n\t\t\t\t#else\n\t\t\t\t\tshadow = step( shadowCoord.z, depth );\n\t\t\t\t#endif\n\t\t\t}\n\t\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t\t}\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#if defined( SHADOWMAP_TYPE_PCF )\n\tfloat getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\tvec3 absVec = abs( lightToPosition );\n\t\tfloat viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n\t\tif ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\t\tfloat dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n\t\t\t\tdp -= shadowBias;\n\t\t\t#else\n\t\t\t\tfloat dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n\t\t\t\tdp += shadowBias;\n\t\t\t#endif\n\t\t\tfloat texelSize = shadowRadius / shadowMapSize.x;\n\t\t\tvec3 absDir = abs( bd3D );\n\t\t\tvec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );\n\t\t\ttangent = normalize( cross( bd3D, tangent ) );\n\t\t\tvec3 bitangent = cross( bd3D, tangent );\n\t\t\tfloat phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;\n\t\t\tvec2 sample0 = vogelDiskSample( 0, 5, phi );\n\t\t\tvec2 sample1 = vogelDiskSample( 1, 5, phi );\n\t\t\tvec2 sample2 = vogelDiskSample( 2, 5, phi );\n\t\t\tvec2 sample3 = vogelDiskSample( 3, 5, phi );\n\t\t\tvec2 sample4 = vogelDiskSample( 4, 5, phi );\n\t\t\tshadow = (\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) +\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) +\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) +\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) +\n\t\t\t\ttexture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) )\n\t\t\t) * 0.2;\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n\t#elif defined( SHADOWMAP_TYPE_BASIC )\n\tfloat getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tvec3 absVec = abs( lightToPosition );\n\t\tfloat viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );\n\t\tif ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );\n\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tfloat depth = textureCube( shadowMap, bd3D ).r;\n\t\t\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\t\t\tdepth = 1.0 - depth;\n\t\t\t#endif\n\t\t\tshadow = step( dp, depth );\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n\t#endif\n\t#endif\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 CineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tconst float StartCompression = 0.8 - 0.04;\n\tconst float Desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min( color.r, min( color.g, color.b ) );\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max( color.r, max( color.g, color.b ) );\n\tif ( peak < StartCompression ) return color;\n\tfloat d = 1. - StartCompression;\n\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n\treturn mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\t\t\t}\n\t\t\ttransmittedLight.a /= 3.0;\n\t\t#else\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\t#endif\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",depth_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\t#ifdef USE_REVERSED_DEPTH_BUFFER\n\t\tfloat fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];\n\t#else\n\t\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;\n\t#endif\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#elif DEPTH_PACKING == 3202\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\t#elif DEPTH_PACKING == 3203\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n\t#endif\n}",distance_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",distance_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n \n\t\toutgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;\n \n \t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix[ 3 ];\n\tvec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}"},kc={common:{diffuse:{value:new Sr(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new _n},alphaMap:{value:null},alphaMapTransform:{value:new _n},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new _n}},envmap:{envMap:{value:null},envMapRotation:{value:new _n},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new _n}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new _n}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new _n},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new _n},normalScale:{value:new fn(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new _n},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new _n}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new _n}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new _n}},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:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Sr(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new _n},alphaTest:{value:0},uvTransform:{value:new _n}},sprite:{diffuse:{value:new Sr(16777215)},opacity:{value:1},center:{value:new fn(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new _n},alphaMap:{value:null},alphaMapTransform:{value:new _n},alphaTest:{value:0}}},Qc={basic:{uniforms:sl([kc.common,kc.specularmap,kc.envmap,kc.aomap,kc.lightmap,kc.fog]),vertexShader:Oc.meshbasic_vert,fragmentShader:Oc.meshbasic_frag},lambert:{uniforms:sl([kc.common,kc.specularmap,kc.envmap,kc.aomap,kc.lightmap,kc.emissivemap,kc.bumpmap,kc.normalmap,kc.displacementmap,kc.fog,kc.lights,{emissive:{value:new Sr(0)},envMapIntensity:{value:1}}]),vertexShader:Oc.meshlambert_vert,fragmentShader:Oc.meshlambert_frag},phong:{uniforms:sl([kc.common,kc.specularmap,kc.envmap,kc.aomap,kc.lightmap,kc.emissivemap,kc.bumpmap,kc.normalmap,kc.displacementmap,kc.fog,kc.lights,{emissive:{value:new Sr(0)},specular:{value:new Sr(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:Oc.meshphong_vert,fragmentShader:Oc.meshphong_frag},standard:{uniforms:sl([kc.common,kc.envmap,kc.aomap,kc.lightmap,kc.emissivemap,kc.bumpmap,kc.normalmap,kc.displacementmap,kc.roughnessmap,kc.metalnessmap,kc.fog,kc.lights,{emissive:{value:new Sr(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Oc.meshphysical_vert,fragmentShader:Oc.meshphysical_frag},toon:{uniforms:sl([kc.common,kc.aomap,kc.lightmap,kc.emissivemap,kc.bumpmap,kc.normalmap,kc.displacementmap,kc.gradientmap,kc.fog,kc.lights,{emissive:{value:new Sr(0)}}]),vertexShader:Oc.meshtoon_vert,fragmentShader:Oc.meshtoon_frag},matcap:{uniforms:sl([kc.common,kc.bumpmap,kc.normalmap,kc.displacementmap,kc.fog,{matcap:{value:null}}]),vertexShader:Oc.meshmatcap_vert,fragmentShader:Oc.meshmatcap_frag},points:{uniforms:sl([kc.points,kc.fog]),vertexShader:Oc.points_vert,fragmentShader:Oc.points_frag},dashed:{uniforms:sl([kc.common,kc.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Oc.linedashed_vert,fragmentShader:Oc.linedashed_frag},depth:{uniforms:sl([kc.common,kc.displacementmap]),vertexShader:Oc.depth_vert,fragmentShader:Oc.depth_frag},normal:{uniforms:sl([kc.common,kc.bumpmap,kc.normalmap,kc.displacementmap,{opacity:{value:1}}]),vertexShader:Oc.meshnormal_vert,fragmentShader:Oc.meshnormal_frag},sprite:{uniforms:sl([kc.sprite,kc.fog]),vertexShader:Oc.sprite_vert,fragmentShader:Oc.sprite_frag},background:{uniforms:{uvTransform:{value:new _n},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Oc.background_vert,fragmentShader:Oc.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new _n}},vertexShader:Oc.backgroundCube_vert,fragmentShader:Oc.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Oc.cube_vert,fragmentShader:Oc.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Oc.equirect_vert,fragmentShader:Oc.equirect_frag},distance:{uniforms:sl([kc.common,kc.displacementmap,{referencePosition:{value:new vn},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Oc.distance_vert,fragmentShader:Oc.distance_frag},shadow:{uniforms:sl([kc.lights,kc.fog,{color:{value:new Sr(0)},opacity:{value:1}}]),vertexShader:Oc.shadow_vert,fragmentShader:Oc.shadow_frag}};Qc.physical={uniforms:sl([Qc.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new _n},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new _n},clearcoatNormalScale:{value:new fn(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new _n},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new _n},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new _n},sheen:{value:0},sheenColor:{value:new Sr(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new _n},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new _n},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new _n},transmissionSamplerSize:{value:new fn},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new _n},attenuationDistance:{value:0},attenuationColor:{value:new Sr(0)},specularColor:{value:new Sr(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new _n},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new _n},anisotropyVector:{value:new fn},anisotropyMap:{value:null},anisotropyMapTransform:{value:new _n}}]),vertexShader:Oc.meshphysical_vert,fragmentShader:Oc.meshphysical_frag};const Gc={r:0,b:0,g:0},zc=new Zn,Hc=new Hn;function Vc(t,e,i,n,r,s){const a=new Sr(0);let o,l,c=!0===r?0:1,h=null,u=0,d=null;function p(t){let i=!0===t.isScene?t.background:null;if(i&&i.isTexture){const n=t.backgroundBlurriness>0;i=e.get(i,n)}return i}function A(e,n){e.getRGB(Gc,al(t)),i.buffers.color.setClear(Gc.r,Gc.g,Gc.b,n,s)}return{getClearColor:function(){return a},setClearColor:function(t,e=1){a.set(t),c=e,A(a,c)},getClearAlpha:function(){return c},setClearAlpha:function(t){c=t,A(a,c)},render:function(e){let n=!1;const r=p(e);null===r?A(a,c):r&&r.isColor&&(A(r,1),n=!0);const o=t.xr.getEnvironmentBlendMode();"additive"===o?i.buffers.color.setClear(0,0,0,1,s):"alpha-blend"===o&&i.buffers.color.setClear(0,0,0,0,s),(t.autoClear||n)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil))},addToRenderList:function(e,i){const r=p(i);r&&(r.isCubeTexture||r.mapping===oe)?(void 0===l&&(l=new Ks(new so(1,1,1),new ll({name:"BackgroundCubeMaterial",uniforms:rl(Qc.backgroundCube.uniforms),vertexShader:Qc.backgroundCube.vertexShader,fragmentShader:Qc.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(t,e,i){this.matrixWorld.copyPosition(i.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(l)),zc.copy(i.backgroundRotation),zc.x*=-1,zc.y*=-1,zc.z*=-1,r.isCubeTexture&&!1===r.isRenderTargetTexture&&(zc.y*=-1,zc.z*=-1),l.material.uniforms.envMap.value=r,l.material.uniforms.flipEnvMap.value=r.isCubeTexture&&!1===r.isRenderTargetTexture?-1:1,l.material.uniforms.backgroundBlurriness.value=i.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=i.backgroundIntensity,l.material.uniforms.backgroundRotation.value.setFromMatrix4(Hc.makeRotationFromEuler(zc)),l.material.toneMapped=Mn.getTransfer(r.colorSpace)!==Fi,h===r&&u===r.version&&d===t.toneMapping||(l.material.needsUpdate=!0,h=r,u=r.version,d=t.toneMapping),l.layers.enableAll(),e.unshift(l,l.geometry,l.material,0,0,null)):r&&r.isTexture&&(void 0===o&&(o=new Ks(new el(2,2),new ll({name:"BackgroundMaterial",uniforms:rl(Qc.background.uniforms),vertexShader:Qc.background.vertexShader,fragmentShader:Qc.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),o.geometry.deleteAttribute("normal"),Object.defineProperty(o.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(o)),o.material.uniforms.t2D.value=r,o.material.uniforms.backgroundIntensity.value=i.backgroundIntensity,o.material.toneMapped=Mn.getTransfer(r.colorSpace)!==Fi,!0===r.matrixAutoUpdate&&r.updateMatrix(),o.material.uniforms.uvTransform.value.copy(r.matrix),h===r&&u===r.version&&d===t.toneMapping||(o.material.needsUpdate=!0,h=r,u=r.version,d=t.toneMapping),o.layers.enableAll(),e.unshift(o,o.geometry,o.material,0,0,null))},dispose:function(){void 0!==l&&(l.geometry.dispose(),l.material.dispose(),l=void 0),void 0!==o&&(o.geometry.dispose(),o.material.dispose(),o=void 0)}}}function qc(t,e){const i=t.getParameter(t.MAX_VERTEX_ATTRIBS),n={},r=c(null);let s=r,a=!1;function o(e){return t.bindVertexArray(e)}function l(e){return t.deleteVertexArray(e)}function c(t){const e=[],n=[],r=[];for(let t=0;t<i;t++)e[t]=0,n[t]=0,r[t]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:e,enabledAttributes:n,attributeDivisors:r,object:t,attributes:{},index:null}}function h(){const t=s.newAttributes;for(let e=0,i=t.length;e<i;e++)t[e]=0}function u(t){d(t,0)}function d(e,i){const n=s.newAttributes,r=s.enabledAttributes,a=s.attributeDivisors;n[e]=1,0===r[e]&&(t.enableVertexAttribArray(e),r[e]=1),a[e]!==i&&(t.vertexAttribDivisor(e,i),a[e]=i)}function p(){const e=s.newAttributes,i=s.enabledAttributes;for(let n=0,r=i.length;n<r;n++)i[n]!==e[n]&&(t.disableVertexAttribArray(n),i[n]=0)}function A(e,i,n,r,s,a,o){!0===o?t.vertexAttribIPointer(e,i,n,s,a):t.vertexAttribPointer(e,i,n,r,s,a)}function g(){m(),a=!0,s!==r&&(s=r,o(s.object))}function m(){r.geometry=null,r.program=null,r.wireframe=!1}return{setup:function(i,r,l,g,m){let f=!1;const b=function(e,i,r,s){const a=!0===s.wireframe;let o=n[i.id];void 0===o&&(o={},n[i.id]=o);const l=!0===e.isInstancedMesh?e.id:0;let h=o[l];void 0===h&&(h={},o[l]=h);let u=h[r.id];void 0===u&&(u={},h[r.id]=u);let d=u[a];void 0===d&&(d=c(t.createVertexArray()),u[a]=d);return d}(i,g,l,r);s!==b&&(s=b,o(s.object)),f=function(t,e,i,n){const r=s.attributes,a=e.attributes;let o=0;const l=i.getAttributes();for(const e in l){if(l[e].location>=0){const i=r[e];let n=a[e];if(void 0===n&&("instanceMatrix"===e&&t.instanceMatrix&&(n=t.instanceMatrix),"instanceColor"===e&&t.instanceColor&&(n=t.instanceColor)),void 0===i)return!0;if(i.attribute!==n)return!0;if(n&&i.data!==n.data)return!0;o++}}return s.attributesNum!==o||s.index!==n}(i,g,l,m),f&&function(t,e,i,n){const r={},a=e.attributes;let o=0;const l=i.getAttributes();for(const e in l){if(l[e].location>=0){let i=a[e];void 0===i&&("instanceMatrix"===e&&t.instanceMatrix&&(i=t.instanceMatrix),"instanceColor"===e&&t.instanceColor&&(i=t.instanceColor));const n={};n.attribute=i,i&&i.data&&(n.data=i.data),r[e]=n,o++}}s.attributes=r,s.attributesNum=o,s.index=n}(i,g,l,m),null!==m&&e.update(m,t.ELEMENT_ARRAY_BUFFER),(f||a)&&(a=!1,function(i,n,r,s){h();const a=s.attributes,o=r.getAttributes(),l=n.defaultAttributeValues;for(const n in o){const r=o[n];if(r.location>=0){let o=a[n];if(void 0===o&&("instanceMatrix"===n&&i.instanceMatrix&&(o=i.instanceMatrix),"instanceColor"===n&&i.instanceColor&&(o=i.instanceColor)),void 0!==o){const n=o.normalized,a=o.itemSize,l=e.get(o);if(void 0===l)continue;const c=l.buffer,h=l.type,p=l.bytesPerElement,g=h===t.INT||h===t.UNSIGNED_INT||o.gpuType===xe;if(o.isInterleavedBufferAttribute){const e=o.data,l=e.stride,m=o.offset;if(e.isInstancedInterleavedBuffer){for(let t=0;t<r.locationSize;t++)d(r.location+t,e.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=e.meshPerAttribute*e.count)}else for(let t=0;t<r.locationSize;t++)u(r.location+t);t.bindBuffer(t.ARRAY_BUFFER,c);for(let t=0;t<r.locationSize;t++)A(r.location+t,a/r.locationSize,h,n,l*p,(m+a/r.locationSize*t)*p,g)}else{if(o.isInstancedBufferAttribute){for(let t=0;t<r.locationSize;t++)d(r.location+t,o.meshPerAttribute);!0!==i.isInstancedMesh&&void 0===s._maxInstanceCount&&(s._maxInstanceCount=o.meshPerAttribute*o.count)}else for(let t=0;t<r.locationSize;t++)u(r.location+t);t.bindBuffer(t.ARRAY_BUFFER,c);for(let t=0;t<r.locationSize;t++)A(r.location+t,a/r.locationSize,h,n,a*p,a/r.locationSize*t*p,g)}}else if(void 0!==l){const e=l[n];if(void 0!==e)switch(e.length){case 2:t.vertexAttrib2fv(r.location,e);break;case 3:t.vertexAttrib3fv(r.location,e);break;case 4:t.vertexAttrib4fv(r.location,e);break;default:t.vertexAttrib1fv(r.location,e)}}}}p()}(i,r,l,g),null!==m&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,e.get(m).buffer))},reset:g,resetDefaultState:m,dispose:function(){g();for(const t in n){const e=n[t];for(const t in e){const i=e[t];for(const t in i){const e=i[t];for(const t in e)l(e[t].object),delete e[t];delete i[t]}}delete n[t]}},releaseStatesOfGeometry:function(t){if(void 0===n[t.id])return;const e=n[t.id];for(const t in e){const i=e[t];for(const t in i){const e=i[t];for(const t in e)l(e[t].object),delete e[t];delete i[t]}}delete n[t.id]},releaseStatesOfObject:function(t){for(const e in n){const i=n[e],r=!0===t.isInstancedMesh?t.id:0,s=i[r];if(void 0!==s){for(const t in s){const e=s[t];for(const t in e)l(e[t].object),delete e[t];delete s[t]}delete i[r],0===Object.keys(i).length&&delete n[e]}}},releaseStatesOfProgram:function(t){for(const e in n){const i=n[e];for(const e in i){const n=i[e];if(void 0===n[t.id])continue;const r=n[t.id];for(const t in r)l(r[t].object),delete r[t];delete n[t.id]}}},initAttributes:h,enableAttribute:u,disableUnusedAttributes:p}}function jc(t,e,i){let n;function r(e,r,s){0!==s&&(t.drawArraysInstanced(n,e,r,s),i.update(r,n,s))}this.setMode=function(t){n=t},this.render=function(e,r){t.drawArrays(n,e,r),i.update(r,n,1)},this.renderInstances=r,this.renderMultiDraw=function(t,r,s){if(0===s)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,t,0,r,0,s);let a=0;for(let t=0;t<s;t++)a+=r[t];i.update(a,n,1)},this.renderMultiDrawInstances=function(t,s,a,o){if(0===a)return;const l=e.get("WEBGL_multi_draw");if(null===l)for(let e=0;e<t.length;e++)r(t[e],s[e],o[e]);else{l.multiDrawArraysInstancedWEBGL(n,t,0,s,0,o,0,a);let e=0;for(let t=0;t<a;t++)e+=s[t]*o[t];i.update(e,n,1)}}}function Wc(t,e,i,n){let r;function s(e){if("highp"===e){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";e="mediump"}return"mediump"===e&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let a=void 0!==i.precision?i.precision:"highp";const o=s(a);o!==a&&(tn("WebGLRenderer:",a,"not supported, using",o,"instead."),a=o);return{isWebGL2:!0,getMaxAnisotropy:function(){if(void 0!==r)return r;if(!0===e.has("EXT_texture_filter_anisotropic")){const i=e.get("EXT_texture_filter_anisotropic");r=t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else r=0;return r},getMaxPrecision:s,textureFormatReadable:function(e){return e===Re||n.convert(e)===t.getParameter(t.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function(i){const r=i===Se&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(i!==fe&&n.convert(i)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_TYPE)&&i!==Ee&&!r)},precision:a,logarithmicDepthBuffer:!0===i.logarithmicDepthBuffer,reversedDepthBuffer:!0===i.reversedDepthBuffer&&e.has("EXT_clip_control"),maxTextures:t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),maxVertexTextures:t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),maxTextureSize:t.getParameter(t.MAX_TEXTURE_SIZE),maxCubemapSize:t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:t.getParameter(t.MAX_VERTEX_ATTRIBS),maxVertexUniforms:t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:t.getParameter(t.MAX_VARYING_VECTORS),maxFragmentUniforms:t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),maxSamples:t.getParameter(t.MAX_SAMPLES),samples:t.getParameter(t.SAMPLES)}}function Xc(t){const e=this;let i=null,n=0,r=!1,s=!1;const a=new Sa,o=new _n,l={value:null,needsUpdate:!1};function c(t,i,n,r){const s=null!==t?t.length:0;let c=null;if(0!==s){if(c=l.value,!0!==r||null===c){const e=n+4*s,r=i.matrixWorldInverse;o.getNormalMatrix(r),(null===c||c.length<e)&&(c=new Float32Array(e));for(let e=0,i=n;e!==s;++e,i+=4)a.copy(t[e]).applyMatrix4(r,o),a.normal.toArray(c,i),c[i+3]=a.constant}l.value=c,l.needsUpdate=!0}return e.numPlanes=s,e.numIntersection=0,c}this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(t,e){const i=0!==t.length||e||0!==n||r;return r=e,n=t.length,i},this.beginShadows=function(){s=!0,c(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(t,e){i=c(t,e,0)},this.setState=function(a,o,h){const u=a.clippingPlanes,d=a.clipIntersection,p=a.clipShadows,A=t.get(a);if(!r||null===u||0===u.length||s&&!p)s?c(null):function(){l.value!==i&&(l.value=i,l.needsUpdate=n>0);e.numPlanes=n,e.numIntersection=0}();else{const t=s?0:n,e=4*t;let r=A.clippingState||null;l.value=r,r=c(u,o,e,h);for(let t=0;t!==e;++t)r[t]=i[t];A.clippingState=r,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=t}}}const Kc=[.125,.215,.35,.446,.526,.582],Jc=20,Yc=new lc,$c=new Sr;let Zc=null,th=0,eh=0,ih=!1;const nh=new vn;class rh{constructor(t){this._renderer=t,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(t,e=0,i=.1,n=100,r={}){const{size:s=256,position:a=nh}=r;Zc=this._renderer.getRenderTarget(),th=this._renderer.getActiveCubeFace(),eh=this._renderer.getActiveMipmapLevel(),ih=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(s);const o=this._allocateTargets();return o.depthBuffer=!0,this._sceneToCubeUV(t,i,n,o,a),e>0&&this._blur(o,0,0,e),this._applyPMREM(o),this._cleanup(o),o}fromEquirectangular(t,e=null){return this._fromTexture(t,e)}fromCubemap(t,e=null){return this._fromTexture(t,e)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=lh(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=oh(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose(),null!==this._backgroundBox&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(t){this._lodMax=Math.floor(Math.log2(t)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._ggxMaterial&&this._ggxMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let t=0;t<this._lodMeshes.length;t++)this._lodMeshes[t].geometry.dispose()}_cleanup(t){this._renderer.setRenderTarget(Zc,th,eh),this._renderer.xr.enabled=ih,t.scissorTest=!1,ah(t,0,0,t.width,t.height)}_fromTexture(t,e){t.mapping===ne||t.mapping===re?this._setSize(0===t.image.length?16:t.image[0].width||t.image[0].image.width):this._setSize(t.image.width/4),Zc=this._renderer.getRenderTarget(),th=this._renderer.getActiveCubeFace(),eh=this._renderer.getActiveMipmapLevel(),ih=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const i=e||this._allocateTargets();return this._textureToCubeUV(t,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const t=3*Math.max(this._cubeSize,112),e=4*this._cubeSize,i={magFilter:Ae,minFilter:Ae,generateMipmaps:!1,type:Se,format:Re,colorSpace:Li,depthBuffer:!1},n=sh(t,e,i);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==t||this._pingPongRenderTarget.height!==e){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=sh(t,e,i);const{_lodMax:n}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=function(t){const e=[],i=[],n=[];let r=t;const s=t-4+1+Kc.length;for(let a=0;a<s;a++){const s=Math.pow(2,r);e.push(s);let o=1/s;a>t-4?o=Kc[a-t+4-1]:0===a&&(o=0),i.push(o);const l=1/(s-2),c=-l,h=1+l,u=[c,c,h,c,h,h,c,c,h,h,c,h],d=6,p=6,A=3,g=2,m=1,f=new Float32Array(A*p*d),b=new Float32Array(g*p*d),v=new Float32Array(m*p*d);for(let t=0;t<d;t++){const e=t%3*2/3-1,i=t>2?0:-1,n=[e,i,0,e+2/3,i,0,e+2/3,i+1,0,e,i,0,e+2/3,i+1,0,e,i+1,0];f.set(n,A*p*t),b.set(u,g*p*t);const r=[t,t,t,t,t,t];v.set(r,m*p*t)}const y=new Es;y.setAttribute("position",new ls(f,A)),y.setAttribute("uv",new ls(b,g)),y.setAttribute("faceIndex",new ls(v,m)),n.push(new Ks(y,null)),r>4&&r--}return{lodMeshes:n,sizeLods:e,sigmas:i}}(n)),this._blurMaterial=function(t,e,i){const n=new Float32Array(Jc),r=new vn(0,1,0),s=new ll({name:"SphericalGaussianBlur",defines:{n:Jc,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/i,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:r}},vertexShader:ch(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform int samples;\n\t\t\tuniform float weights[ n ];\n\t\t\tuniform bool latitudinal;\n\t\t\tuniform float dTheta;\n\t\t\tuniform float mipInt;\n\t\t\tuniform vec3 poleAxis;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\tvec3 getSample( float theta, vec3 axis ) {\n\n\t\t\t\tfloat cosTheta = cos( theta );\n\t\t\t\t// Rodrigues' axis-angle rotation\n\t\t\t\tvec3 sampleDirection = vOutputDirection * cosTheta\n\t\t\t\t\t+ cross( axis, vOutputDirection ) * sin( theta )\n\t\t\t\t\t+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n\n\t\t\t\treturn bilinearCubeUV( envMap, sampleDirection, mipInt );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n\n\t\t\t\tif ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n\n\t\t\t\t\taxis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n\n\t\t\t\t}\n\n\t\t\t\taxis = normalize( axis );\n\n\t\t\t\tgl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t\t\t\tgl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n\n\t\t\t\tfor ( int i = 1; i < n; i++ ) {\n\n\t\t\t\t\tif ( i >= samples ) {\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t}\n\n\t\t\t\t\tfloat theta = dTheta * float( i );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n\t\t\t\t\tgl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n\n\t\t\t\t}\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1});return s}(n,t,e),this._ggxMaterial=function(t,e,i){const n=new ll({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:256,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/i,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:ch(),fragmentShader:'\n\n\t\t\tprecision highp float;\n\t\t\tprecision highp int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\t\t\tuniform float roughness;\n\t\t\tuniform float mipInt;\n\n\t\t\t#define ENVMAP_TYPE_CUBE_UV\n\t\t\t#include <cube_uv_reflection_fragment>\n\n\t\t\t#define PI 3.14159265359\n\n\t\t\t// Van der Corput radical inverse\n\t\t\tfloat radicalInverse_VdC(uint bits) {\n\t\t\t\tbits = (bits << 16u) | (bits >> 16u);\n\t\t\t\tbits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);\n\t\t\t\tbits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);\n\t\t\t\tbits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);\n\t\t\t\tbits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);\n\t\t\t\treturn float(bits) * 2.3283064365386963e-10; // / 0x100000000\n\t\t\t}\n\n\t\t\t// Hammersley sequence\n\t\t\tvec2 hammersley(uint i, uint N) {\n\t\t\t\treturn vec2(float(i) / float(N), radicalInverse_VdC(i));\n\t\t\t}\n\n\t\t\t// GGX VNDF importance sampling (Eric Heitz 2018)\n\t\t\t// "Sampling the GGX Distribution of Visible Normals"\n\t\t\t// https://jcgt.org/published/0007/04/01/\n\t\t\tvec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {\n\t\t\t\tfloat alpha = roughness * roughness;\n\n\t\t\t\t// Section 4.1: Orthonormal basis\n\t\t\t\tvec3 T1 = vec3(1.0, 0.0, 0.0);\n\t\t\t\tvec3 T2 = cross(V, T1);\n\n\t\t\t\t// Section 4.2: Parameterization of projected area\n\t\t\t\tfloat r = sqrt(Xi.x);\n\t\t\t\tfloat phi = 2.0 * PI * Xi.y;\n\t\t\t\tfloat t1 = r * cos(phi);\n\t\t\t\tfloat t2 = r * sin(phi);\n\t\t\t\tfloat s = 0.5 * (1.0 + V.z);\n\t\t\t\tt2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;\n\n\t\t\t\t// Section 4.3: Reprojection onto hemisphere\n\t\t\t\tvec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V;\n\n\t\t\t\t// Section 3.4: Transform back to ellipsoid configuration\n\t\t\t\treturn normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));\n\t\t\t}\n\n\t\t\tvoid main() {\n\t\t\t\tvec3 N = normalize(vOutputDirection);\n\t\t\t\tvec3 V = N; // Assume view direction equals normal for pre-filtering\n\n\t\t\t\tvec3 prefilteredColor = vec3(0.0);\n\t\t\t\tfloat totalWeight = 0.0;\n\n\t\t\t\t// For very low roughness, just sample the environment directly\n\t\t\t\tif (roughness < 0.001) {\n\t\t\t\t\tgl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Tangent space basis for VNDF sampling\n\t\t\t\tvec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);\n\t\t\t\tvec3 tangent = normalize(cross(up, N));\n\t\t\t\tvec3 bitangent = cross(N, tangent);\n\n\t\t\t\tfor(uint i = 0u; i < uint(GGX_SAMPLES); i++) {\n\t\t\t\t\tvec2 Xi = hammersley(i, uint(GGX_SAMPLES));\n\n\t\t\t\t\t// For PMREM, V = N, so in tangent space V is always (0, 0, 1)\n\t\t\t\t\tvec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness);\n\n\t\t\t\t\t// Transform H back to world space\n\t\t\t\t\tvec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z);\n\t\t\t\t\tvec3 L = normalize(2.0 * dot(V, H) * H - V);\n\n\t\t\t\t\tfloat NdotL = max(dot(N, L), 0.0);\n\n\t\t\t\t\tif(NdotL > 0.0) {\n\t\t\t\t\t\t// Sample environment at fixed mip level\n\t\t\t\t\t\t// VNDF importance sampling handles the distribution filtering\n\t\t\t\t\t\tvec3 sampleColor = bilinearCubeUV(envMap, L, mipInt);\n\n\t\t\t\t\t\t// Weight by NdotL for the split-sum approximation\n\t\t\t\t\t\t// VNDF PDF naturally accounts for the visible microfacet distribution\n\t\t\t\t\t\tprefilteredColor += sampleColor * NdotL;\n\t\t\t\t\t\ttotalWeight += NdotL;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (totalWeight > 0.0) {\n\t\t\t\t\tprefilteredColor = prefilteredColor / totalWeight;\n\t\t\t\t}\n\n\t\t\t\tgl_FragColor = vec4(prefilteredColor, 1.0);\n\t\t\t}\n\t\t',blending:0,depthTest:!1,depthWrite:!1});return n}(n,t,e)}return n}_compileMaterial(t){const e=new Ks(new Es,t);this._renderer.compile(e,Yc)}_sceneToCubeUV(t,e,i,n,r){const s=new nc(90,1,e,i),a=[1,-1,1,1,1,1],o=[1,1,1,-1,-1,-1],l=this._renderer,c=l.autoClear,h=l.toneMapping;l.getClearColor($c),l.toneMapping=0,l.autoClear=!1;l.state.buffers.depth.getReversed()&&(l.setRenderTarget(n),l.clearDepth(),l.setRenderTarget(null)),null===this._backgroundBox&&(this._backgroundBox=new Ks(new so,new Ns({name:"PMREM.Background",side:1,depthWrite:!1,depthTest:!1})));const u=this._backgroundBox,d=u.material;let p=!1;const A=t.background;A?A.isColor&&(d.color.copy(A),t.background=null,p=!0):(d.color.copy($c),p=!0);for(let e=0;e<6;e++){const i=e%3;0===i?(s.up.set(0,a[e],0),s.position.set(r.x,r.y,r.z),s.lookAt(r.x+o[e],r.y,r.z)):1===i?(s.up.set(0,0,a[e]),s.position.set(r.x,r.y,r.z),s.lookAt(r.x,r.y+o[e],r.z)):(s.up.set(0,a[e],0),s.position.set(r.x,r.y,r.z),s.lookAt(r.x,r.y,r.z+o[e]));const c=this._cubeSize;ah(n,i*c,e>2?c:0,c,c),l.setRenderTarget(n),p&&l.render(u,s),l.render(t,s)}l.toneMapping=h,l.autoClear=c,t.background=A}_textureToCubeUV(t,e){const i=this._renderer,n=t.mapping===ne||t.mapping===re;n?(null===this._cubemapMaterial&&(this._cubemapMaterial=lh()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===t.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=oh());const r=n?this._cubemapMaterial:this._equirectMaterial,s=this._lodMeshes[0];s.material=r;r.uniforms.envMap.value=t;const a=this._cubeSize;ah(e,0,0,3*a,2*a),i.setRenderTarget(e),i.render(s,Yc)}_applyPMREM(t){const e=this._renderer,i=e.autoClear;e.autoClear=!1;const n=this._lodMeshes.length;for(let e=1;e<n;e++)this._applyGGXFilter(t,e-1,e);e.autoClear=i}_applyGGXFilter(t,e,i){const n=this._renderer,r=this._pingPongRenderTarget,s=this._ggxMaterial,a=this._lodMeshes[i];a.material=s;const o=s.uniforms,l=i/(this._lodMeshes.length-1),c=e/(this._lodMeshes.length-1),h=Math.sqrt(l*l-c*c)*(0+1.25*l),{_lodMax:u}=this,d=this._sizeLods[i],p=3*d*(i>u-4?i-u+4:0),A=4*(this._cubeSize-d);o.envMap.value=t.texture,o.roughness.value=h,o.mipInt.value=u-e,ah(r,p,A,3*d,2*d),n.setRenderTarget(r),n.render(a,Yc),o.envMap.value=r.texture,o.roughness.value=0,o.mipInt.value=u-i,ah(t,p,A,3*d,2*d),n.setRenderTarget(t),n.render(a,Yc)}_blur(t,e,i,n,r){const s=this._pingPongRenderTarget;this._halfBlur(t,s,e,i,n,"latitudinal",r),this._halfBlur(s,t,i,i,n,"longitudinal",r)}_halfBlur(t,e,i,n,r,s,a){const o=this._renderer,l=this._blurMaterial;"latitudinal"!==s&&"longitudinal"!==s&&en("blur direction must be either latitudinal or longitudinal!");const c=this._lodMeshes[n];c.material=l;const h=l.uniforms,u=this._sizeLods[i]-1,d=isFinite(r)?Math.PI/(2*u):2*Math.PI/39,p=r/d,A=isFinite(r)?1+Math.floor(3*p):Jc;A>Jc&&tn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${A} samples when the maximum is set to 20`);const g=[];let m=0;for(let t=0;t<Jc;++t){const e=t/p,i=Math.exp(-e*e/2);g.push(i),0===t?m+=i:t<A&&(m+=2*i)}for(let t=0;t<g.length;t++)g[t]=g[t]/m;h.envMap.value=t.texture,h.samples.value=A,h.weights.value=g,h.latitudinal.value="latitudinal"===s,a&&(h.poleAxis.value=a);const{_lodMax:f}=this;h.dTheta.value=d,h.mipInt.value=f-i;const b=this._sizeLods[n];ah(e,3*b*(n>f-4?n-f+4:0),4*(this._cubeSize-b),3*b,2*b),o.setRenderTarget(e),o.render(c,Yc)}}function sh(t,e,i){const n=new Qn(t,e,i);return n.texture.mapping=oe,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function ah(t,e,i,n,r){t.viewport.set(e,i,n,r),t.scissor.set(e,i,n,r)}function oh(){return new ll({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:ch(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform sampler2D envMap;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 outputDirection = normalize( vOutputDirection );\n\t\t\t\tvec2 uv = equirectUv( outputDirection );\n\n\t\t\t\tgl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function lh(){return new ll({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:ch(),fragmentShader:"\n\n\t\t\tprecision mediump float;\n\t\t\tprecision mediump int;\n\n\t\t\tuniform float flipEnvMap;\n\n\t\t\tvarying vec3 vOutputDirection;\n\n\t\t\tuniform samplerCube envMap;\n\n\t\t\tvoid main() {\n\n\t\t\t\tgl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );\n\n\t\t\t}\n\t\t",blending:0,depthTest:!1,depthWrite:!1})}function ch(){return"\n\n\t\tprecision mediump float;\n\t\tprecision mediump int;\n\n\t\tattribute float faceIndex;\n\n\t\tvarying vec3 vOutputDirection;\n\n\t\t// RH coordinate system; PMREM face-indexing convention\n\t\tvec3 getDirection( vec2 uv, float face ) {\n\n\t\t\tuv = 2.0 * uv - 1.0;\n\n\t\t\tvec3 direction = vec3( uv, 1.0 );\n\n\t\t\tif ( face == 0.0 ) {\n\n\t\t\t\tdirection = direction.zyx; // ( 1, v, u ) pos x\n\n\t\t\t} else if ( face == 1.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xz *= -1.0; // ( -u, 1, -v ) pos y\n\n\t\t\t} else if ( face == 2.0 ) {\n\n\t\t\t\tdirection.x *= -1.0; // ( -u, v, 1 ) pos z\n\n\t\t\t} else if ( face == 3.0 ) {\n\n\t\t\t\tdirection = direction.zyx;\n\t\t\t\tdirection.xz *= -1.0; // ( -1, v, -u ) neg x\n\n\t\t\t} else if ( face == 4.0 ) {\n\n\t\t\t\tdirection = direction.xzy;\n\t\t\t\tdirection.xy *= -1.0; // ( -u, -1, v ) neg y\n\n\t\t\t} else if ( face == 5.0 ) {\n\n\t\t\t\tdirection.z *= -1.0; // ( u, v, -1 ) neg z\n\n\t\t\t}\n\n\t\t\treturn direction;\n\n\t\t}\n\n\t\tvoid main() {\n\n\t\t\tvOutputDirection = getDirection( uv, faceIndex );\n\t\t\tgl_Position = vec4( position, 1.0 );\n\n\t\t}\n\t"}class hh extends Qn{constructor(t=1,e={}){super(t,t,e),this.isWebGLCubeRenderTarget=!0;const i={width:t,height:t,depth:1},n=[i,i,i,i,i,i];this.texture=new to(n),this._setTextureOptions(e),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(t,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",fragmentShader:"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"},n=new so(5,5,5),r=new ll({name:"CubemapFromEquirect",uniforms:rl(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:1,blending:0});r.uniforms.tEquirect.value=e;const s=new Ks(n,r),a=e.minFilter;e.minFilter===me&&(e.minFilter=Ae);return new fc(1,10,this).update(t,s),e.minFilter=a,s.geometry.dispose(),s.material.dispose(),this}clear(t,e=!0,i=!0,n=!0){const r=t.getRenderTarget();for(let r=0;r<6;r++)t.setRenderTarget(this,r),t.clear(e,i,n);t.setRenderTarget(r)}}function uh(t){let e=new WeakMap,i=new WeakMap,n=null;function r(t,e){return e===se?t.mapping=ne:e===ae&&(t.mapping=re),t}function s(t){const i=t.target;i.removeEventListener("dispose",s);const n=e.get(i);void 0!==n&&(e.delete(i),n.dispose())}function a(t){const e=t.target;e.removeEventListener("dispose",a);const n=i.get(e);void 0!==n&&(i.delete(e),n.dispose())}return{get:function(o,l=!1){return null==o?null:l?function(e){if(e&&e.isTexture){const r=e.mapping,s=r===se||r===ae,o=r===ne||r===re;if(s||o){let r=i.get(e);const l=void 0!==r?r.texture.pmremVersion:0;if(e.isRenderTargetTexture&&e.pmremVersion!==l)return null===n&&(n=new rh(t)),r=s?n.fromEquirectangular(e,r):n.fromCubemap(e,r),r.texture.pmremVersion=e.pmremVersion,i.set(e,r),r.texture;if(void 0!==r)return r.texture;{const l=e.image;return s&&l&&l.height>0||o&&l&&function(t){let e=0;const i=6;for(let n=0;n<i;n++)void 0!==t[n]&&e++;return e===i}(l)?(null===n&&(n=new rh(t)),r=s?n.fromEquirectangular(e):n.fromCubemap(e),r.texture.pmremVersion=e.pmremVersion,i.set(e,r),e.addEventListener("dispose",a),r.texture):null}}}return e}(o):function(i){if(i&&i.isTexture){const n=i.mapping;if(n===se||n===ae){if(e.has(i)){return r(e.get(i).texture,i.mapping)}{const n=i.image;if(n&&n.height>0){const a=new hh(n.height);return a.fromEquirectangularTexture(t,i),e.set(i,a),i.addEventListener("dispose",s),r(a.texture,i.mapping)}return null}}}return i}(o)},dispose:function(){e=new WeakMap,i=new WeakMap,null!==n&&(n.dispose(),n=null)}}}function dh(t){const e={};function i(i){if(void 0!==e[i])return e[i];const n=t.getExtension(i);return e[i]=n,n}return{has:function(t){return null!==i(t)},init:function(){i("EXT_color_buffer_float"),i("WEBGL_clip_cull_distance"),i("OES_texture_float_linear"),i("EXT_color_buffer_half_float"),i("WEBGL_multisampled_render_to_texture"),i("WEBGL_render_shared_exponent")},get:function(t){const e=i(t);return null===e&&nn("WebGLRenderer: "+t+" extension not supported."),e}}}function ph(t,e,i,n){const r={},s=new WeakMap;function a(t){const o=t.target;null!==o.index&&e.remove(o.index);for(const t in o.attributes)e.remove(o.attributes[t]);o.removeEventListener("dispose",a),delete r[o.id];const l=s.get(o);l&&(e.remove(l),s.delete(o)),n.releaseStatesOfGeometry(o),!0===o.isInstancedBufferGeometry&&delete o._maxInstanceCount,i.memory.geometries--}function o(t){const i=[],n=t.index,r=t.attributes.position;let a=0;if(void 0===r)return;if(null!==n){const t=n.array;a=n.version;for(let e=0,n=t.length;e<n;e+=3){const n=t[e+0],r=t[e+1],s=t[e+2];i.push(n,r,r,s,s,n)}}else{const t=r.array;a=r.version;for(let e=0,n=t.length/3-1;e<n;e+=3){const t=e+0,n=e+1,r=e+2;i.push(t,n,n,r,r,t)}}const o=new(r.count>=65535?hs:cs)(i,1);o.version=a;const l=s.get(t);l&&e.remove(l),s.set(t,o)}return{get:function(t,e){return!0===r[e.id]||(e.addEventListener("dispose",a),r[e.id]=!0,i.memory.geometries++),e},update:function(i){const n=i.attributes;for(const i in n)e.update(n[i],t.ARRAY_BUFFER)},getWireframeAttribute:function(t){const e=s.get(t);if(e){const i=t.index;null!==i&&e.version<i.version&&o(t)}else o(t);return s.get(t)}}}function Ah(t,e,i){let n,r,s;function a(e,a,o){0!==o&&(t.drawElementsInstanced(n,a,r,e*s,o),i.update(a,n,o))}this.setMode=function(t){n=t},this.setIndex=function(t){r=t.type,s=t.bytesPerElement},this.render=function(e,a){t.drawElements(n,a,r,e*s),i.update(a,n,1)},this.renderInstances=a,this.renderMultiDraw=function(t,s,a){if(0===a)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,s,0,r,t,0,a);let o=0;for(let t=0;t<a;t++)o+=s[t];i.update(o,n,1)},this.renderMultiDrawInstances=function(t,o,l,c){if(0===l)return;const h=e.get("WEBGL_multi_draw");if(null===h)for(let e=0;e<t.length;e++)a(t[e]/s,o[e],c[e]);else{h.multiDrawElementsInstancedWEBGL(n,o,0,r,t,0,c,0,l);let e=0;for(let t=0;t<l;t++)e+=o[t]*c[t];i.update(e,n,1)}}}function gh(t){const e={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:e,programs:null,autoReset:!0,reset:function(){e.calls=0,e.triangles=0,e.points=0,e.lines=0},update:function(i,n,r){switch(e.calls++,n){case t.TRIANGLES:e.triangles+=r*(i/3);break;case t.LINES:e.lines+=r*(i/2);break;case t.LINE_STRIP:e.lines+=r*(i-1);break;case t.LINE_LOOP:e.lines+=r*i;break;case t.POINTS:e.points+=r*i;break;default:en("WebGLInfo: Unknown draw mode:",n)}}}}function mh(t,e,i){const n=new WeakMap,r=new On;return{update:function(s,a,o){const l=s.morphTargetInfluences,c=a.morphAttributes.position||a.morphAttributes.normal||a.morphAttributes.color,h=void 0!==c?c.length:0;let u=n.get(a);if(void 0===u||u.count!==h){void 0!==u&&u.texture.dispose();const d=void 0!==a.morphAttributes.position,p=void 0!==a.morphAttributes.normal,A=void 0!==a.morphAttributes.color,g=a.morphAttributes.position||[],m=a.morphAttributes.normal||[],f=a.morphAttributes.color||[];let b=0;!0===d&&(b=1),!0===p&&(b=2),!0===A&&(b=3);let v=a.attributes.position.count*b,y=1;v>e.maxTextureSize&&(y=Math.ceil(v/e.maxTextureSize),v=e.maxTextureSize);const x=new Float32Array(v*y*4*h),_=new Gn(x,v,y,h);_.type=Ee,_.needsUpdate=!0;const E=4*b;for(let C=0;C<h;C++){const w=g[C],M=m[C],I=f[C],T=v*y*4*C;for(let B=0;B<w.count;B++){const R=B*E;!0===d&&(r.fromBufferAttribute(w,B),x[T+R+0]=r.x,x[T+R+1]=r.y,x[T+R+2]=r.z,x[T+R+3]=0),!0===p&&(r.fromBufferAttribute(M,B),x[T+R+4]=r.x,x[T+R+5]=r.y,x[T+R+6]=r.z,x[T+R+7]=0),!0===A&&(r.fromBufferAttribute(I,B),x[T+R+8]=r.x,x[T+R+9]=r.y,x[T+R+10]=r.z,x[T+R+11]=4===I.itemSize?r.w:1)}}function S(){_.dispose(),n.delete(a),a.removeEventListener("dispose",S)}u={count:h,texture:_,size:new fn(v,y)},n.set(a,u),a.addEventListener("dispose",S)}if(!0===s.isInstancedMesh&&null!==s.morphTexture)o.getUniforms().setValue(t,"morphTexture",s.morphTexture,i);else{let D=0;for(let P=0;P<l.length;P++)D+=l[P];const L=a.morphTargetsRelative?1:1-D;o.getUniforms().setValue(t,"morphTargetBaseInfluence",L),o.getUniforms().setValue(t,"morphTargetInfluences",l)}o.getUniforms().setValue(t,"morphTargetsTexture",u.texture,i),o.getUniforms().setValue(t,"morphTargetsTextureSize",u.size)}}}function fh(t,e,i,n,r){let s=new WeakMap;function a(t){const e=t.target;e.removeEventListener("dispose",a),n.releaseStatesOfObject(e),i.remove(e.instanceMatrix),null!==e.instanceColor&&i.remove(e.instanceColor)}return{update:function(n){const o=r.render.frame,l=n.geometry,c=e.get(n,l);if(s.get(c)!==o&&(e.update(c),s.set(c,o)),n.isInstancedMesh&&(!1===n.hasEventListener("dispose",a)&&n.addEventListener("dispose",a),s.get(n)!==o&&(i.update(n.instanceMatrix,t.ARRAY_BUFFER),null!==n.instanceColor&&i.update(n.instanceColor,t.ARRAY_BUFFER),s.set(n,o))),n.isSkinnedMesh){const t=n.skeleton;s.get(t)!==o&&(t.update(),s.set(t,o))}return c},dispose:function(){s=new WeakMap}}}const bh={[Xt]:"LINEAR_TONE_MAPPING",[Kt]:"REINHARD_TONE_MAPPING",[Jt]:"CINEON_TONE_MAPPING",[Yt]:"ACES_FILMIC_TONE_MAPPING",[Zt]:"AGX_TONE_MAPPING",[te]:"NEUTRAL_TONE_MAPPING",[$t]:"CUSTOM_TONE_MAPPING"};function vh(t,e,i,n,r){const s=new Qn(e,i,{type:t,depthBuffer:n,stencilBuffer:r}),a=new Qn(e,i,{type:Se,depthBuffer:!1,stencilBuffer:!1}),o=new Es;o.setAttribute("position",new us([-1,3,0,-1,-1,0,3,-1,0],3)),o.setAttribute("uv",new us([0,2,0,0,2,0],2));const l=new cl({uniforms:{tDiffuse:{value:null}},vertexShader:"\n\t\t\tprecision highp float;\n\n\t\t\tuniform mat4 modelViewMatrix;\n\t\t\tuniform mat4 projectionMatrix;\n\n\t\t\tattribute vec3 position;\n\t\t\tattribute vec2 uv;\n\n\t\t\tvarying vec2 vUv;\n\n\t\t\tvoid main() {\n\t\t\t\tvUv = uv;\n\t\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\t\t\t}",fragmentShader:"\n\t\t\tprecision highp float;\n\n\t\t\tuniform sampler2D tDiffuse;\n\n\t\t\tvarying vec2 vUv;\n\n\t\t\t#include <tonemapping_pars_fragment>\n\t\t\t#include <colorspace_pars_fragment>\n\n\t\t\tvoid main() {\n\t\t\t\tgl_FragColor = texture2D( tDiffuse, vUv );\n\n\t\t\t\t#ifdef LINEAR_TONE_MAPPING\n\t\t\t\t\tgl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( REINHARD_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( CINEON_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( ACES_FILMIC_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( AGX_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( NEUTRAL_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );\n\t\t\t\t#elif defined( CUSTOM_TONE_MAPPING )\n\t\t\t\t\tgl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );\n\t\t\t\t#endif\n\n\t\t\t\t#ifdef SRGB_TRANSFER\n\t\t\t\t\tgl_FragColor = sRGBTransferOETF( gl_FragColor );\n\t\t\t\t#endif\n\t\t\t}",depthTest:!1,depthWrite:!1}),c=new Ks(o,l),h=new lc(-1,1,1,-1,0,1);let u,d=null,p=null,A=!1,g=null,m=[],f=!1;this.setSize=function(t,e){s.setSize(t,e),a.setSize(t,e);for(let i=0;i<m.length;i++){const n=m[i];n.setSize&&n.setSize(t,e)}},this.setEffects=function(t){m=t,f=m.length>0&&!0===m[0].isRenderPass;const e=s.width,i=s.height;for(let t=0;t<m.length;t++){const n=m[t];n.setSize&&n.setSize(e,i)}},this.begin=function(t,e){if(A)return!1;if(0===t.toneMapping&&0===m.length)return!1;if(g=e,null!==e){const t=e.width,i=e.height;s.width===t&&s.height===i||this.setSize(t,i)}return!1===f&&t.setRenderTarget(s),u=t.toneMapping,t.toneMapping=0,!0},this.hasRenderPass=function(){return f},this.end=function(t,e){t.toneMapping=u,A=!0;let i=s,n=a;for(let r=0;r<m.length;r++){const s=m[r];if(!1!==s.enabled&&(s.render(t,n,i,e),!1!==s.needsSwap)){const t=i;i=n,n=t}}if(d!==t.outputColorSpace||p!==t.toneMapping){d=t.outputColorSpace,p=t.toneMapping,l.defines={},Mn.getTransfer(d)===Fi&&(l.defines.SRGB_TRANSFER="");const e=bh[p];e&&(l.defines[e]=""),l.needsUpdate=!0}l.uniforms.tDiffuse.value=i.texture,t.setRenderTarget(g),t.render(c,h),g=null,A=!1},this.isCompositing=function(){return A},this.dispose=function(){s.dispose(),a.dispose(),o.dispose(),l.dispose()}}const yh=new Nn,xh=new io(1,1),_h=new Gn,Eh=new zn,Sh=new to,Ch=[],wh=[],Mh=new Float32Array(16),Ih=new Float32Array(9),Th=new Float32Array(4);function Bh(t,e,i){const n=t[0];if(n<=0||n>0)return t;const r=e*i;let s=Ch[r];if(void 0===s&&(s=new Float32Array(r),Ch[r]=s),0!==e){n.toArray(s,0);for(let n=1,r=0;n!==e;++n)r+=i,t[n].toArray(s,r)}return s}function Rh(t,e){if(t.length!==e.length)return!1;for(let i=0,n=t.length;i<n;i++)if(t[i]!==e[i])return!1;return!0}function Dh(t,e){for(let i=0,n=e.length;i<n;i++)t[i]=e[i]}function Lh(t,e){let i=wh[e];void 0===i&&(i=new Int32Array(e),wh[e]=i);for(let n=0;n!==e;++n)i[n]=t.allocateTextureUnit();return i}function Ph(t,e){const i=this.cache;i[0]!==e&&(t.uniform1f(this.addr,e),i[0]=e)}function Fh(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y||(t.uniform2f(this.addr,e.x,e.y),i[0]=e.x,i[1]=e.y);else{if(Rh(i,e))return;t.uniform2fv(this.addr,e),Dh(i,e)}}function Uh(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z||(t.uniform3f(this.addr,e.x,e.y,e.z),i[0]=e.x,i[1]=e.y,i[2]=e.z);else if(void 0!==e.r)i[0]===e.r&&i[1]===e.g&&i[2]===e.b||(t.uniform3f(this.addr,e.r,e.g,e.b),i[0]=e.r,i[1]=e.g,i[2]=e.b);else{if(Rh(i,e))return;t.uniform3fv(this.addr,e),Dh(i,e)}}function Nh(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z&&i[3]===e.w||(t.uniform4f(this.addr,e.x,e.y,e.z,e.w),i[0]=e.x,i[1]=e.y,i[2]=e.z,i[3]=e.w);else{if(Rh(i,e))return;t.uniform4fv(this.addr,e),Dh(i,e)}}function Oh(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(Rh(i,e))return;t.uniformMatrix2fv(this.addr,!1,e),Dh(i,e)}else{if(Rh(i,n))return;Th.set(n),t.uniformMatrix2fv(this.addr,!1,Th),Dh(i,n)}}function kh(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(Rh(i,e))return;t.uniformMatrix3fv(this.addr,!1,e),Dh(i,e)}else{if(Rh(i,n))return;Ih.set(n),t.uniformMatrix3fv(this.addr,!1,Ih),Dh(i,n)}}function Qh(t,e){const i=this.cache,n=e.elements;if(void 0===n){if(Rh(i,e))return;t.uniformMatrix4fv(this.addr,!1,e),Dh(i,e)}else{if(Rh(i,n))return;Mh.set(n),t.uniformMatrix4fv(this.addr,!1,Mh),Dh(i,n)}}function Gh(t,e){const i=this.cache;i[0]!==e&&(t.uniform1i(this.addr,e),i[0]=e)}function zh(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y||(t.uniform2i(this.addr,e.x,e.y),i[0]=e.x,i[1]=e.y);else{if(Rh(i,e))return;t.uniform2iv(this.addr,e),Dh(i,e)}}function Hh(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z||(t.uniform3i(this.addr,e.x,e.y,e.z),i[0]=e.x,i[1]=e.y,i[2]=e.z);else{if(Rh(i,e))return;t.uniform3iv(this.addr,e),Dh(i,e)}}function Vh(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z&&i[3]===e.w||(t.uniform4i(this.addr,e.x,e.y,e.z,e.w),i[0]=e.x,i[1]=e.y,i[2]=e.z,i[3]=e.w);else{if(Rh(i,e))return;t.uniform4iv(this.addr,e),Dh(i,e)}}function qh(t,e){const i=this.cache;i[0]!==e&&(t.uniform1ui(this.addr,e),i[0]=e)}function jh(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y||(t.uniform2ui(this.addr,e.x,e.y),i[0]=e.x,i[1]=e.y);else{if(Rh(i,e))return;t.uniform2uiv(this.addr,e),Dh(i,e)}}function Wh(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z||(t.uniform3ui(this.addr,e.x,e.y,e.z),i[0]=e.x,i[1]=e.y,i[2]=e.z);else{if(Rh(i,e))return;t.uniform3uiv(this.addr,e),Dh(i,e)}}function Xh(t,e){const i=this.cache;if(void 0!==e.x)i[0]===e.x&&i[1]===e.y&&i[2]===e.z&&i[3]===e.w||(t.uniform4ui(this.addr,e.x,e.y,e.z,e.w),i[0]=e.x,i[1]=e.y,i[2]=e.z,i[3]=e.w);else{if(Rh(i,e))return;t.uniform4uiv(this.addr,e),Dh(i,e)}}function Kh(t,e,i){const n=this.cache,r=i.allocateTextureUnit();let s;n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),this.type===t.SAMPLER_2D_SHADOW?(xh.compareFunction=i.isReversedDepthBuffer()?518:515,s=xh):s=yh,i.setTexture2D(e||s,r)}function Jh(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTexture3D(e||Eh,r)}function Yh(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTextureCube(e||Sh,r)}function $h(t,e,i){const n=this.cache,r=i.allocateTextureUnit();n[0]!==r&&(t.uniform1i(this.addr,r),n[0]=r),i.setTexture2DArray(e||_h,r)}function Zh(t,e){t.uniform1fv(this.addr,e)}function tu(t,e){const i=Bh(e,this.size,2);t.uniform2fv(this.addr,i)}function eu(t,e){const i=Bh(e,this.size,3);t.uniform3fv(this.addr,i)}function iu(t,e){const i=Bh(e,this.size,4);t.uniform4fv(this.addr,i)}function nu(t,e){const i=Bh(e,this.size,4);t.uniformMatrix2fv(this.addr,!1,i)}function ru(t,e){const i=Bh(e,this.size,9);t.uniformMatrix3fv(this.addr,!1,i)}function su(t,e){const i=Bh(e,this.size,16);t.uniformMatrix4fv(this.addr,!1,i)}function au(t,e){t.uniform1iv(this.addr,e)}function ou(t,e){t.uniform2iv(this.addr,e)}function lu(t,e){t.uniform3iv(this.addr,e)}function cu(t,e){t.uniform4iv(this.addr,e)}function hu(t,e){t.uniform1uiv(this.addr,e)}function uu(t,e){t.uniform2uiv(this.addr,e)}function du(t,e){t.uniform3uiv(this.addr,e)}function pu(t,e){t.uniform4uiv(this.addr,e)}function Au(t,e,i){const n=this.cache,r=e.length,s=Lh(i,r);let a;Rh(n,s)||(t.uniform1iv(this.addr,s),Dh(n,s)),a=this.type===t.SAMPLER_2D_SHADOW?xh:yh;for(let t=0;t!==r;++t)i.setTexture2D(e[t]||a,s[t])}function gu(t,e,i){const n=this.cache,r=e.length,s=Lh(i,r);Rh(n,s)||(t.uniform1iv(this.addr,s),Dh(n,s));for(let t=0;t!==r;++t)i.setTexture3D(e[t]||Eh,s[t])}function mu(t,e,i){const n=this.cache,r=e.length,s=Lh(i,r);Rh(n,s)||(t.uniform1iv(this.addr,s),Dh(n,s));for(let t=0;t!==r;++t)i.setTextureCube(e[t]||Sh,s[t])}function fu(t,e,i){const n=this.cache,r=e.length,s=Lh(i,r);Rh(n,s)||(t.uniform1iv(this.addr,s),Dh(n,s));for(let t=0;t!==r;++t)i.setTexture2DArray(e[t]||_h,s[t])}class bu{constructor(t,e,i){this.id=t,this.addr=i,this.cache=[],this.type=e.type,this.setValue=function(t){switch(t){case 5126:return Ph;case 35664:return Fh;case 35665:return Uh;case 35666:return Nh;case 35674:return Oh;case 35675:return kh;case 35676:return Qh;case 5124:case 35670:return Gh;case 35667:case 35671:return zh;case 35668:case 35672:return Hh;case 35669:case 35673:return Vh;case 5125:return qh;case 36294:return jh;case 36295:return Wh;case 36296:return Xh;case 35678:case 36198:case 36298:case 36306:case 35682:return Kh;case 35679:case 36299:case 36307:return Jh;case 35680:case 36300:case 36308:case 36293:return Yh;case 36289:case 36303:case 36311:case 36292:return $h}}(e.type)}}class vu{constructor(t,e,i){this.id=t,this.addr=i,this.cache=[],this.type=e.type,this.size=e.size,this.setValue=function(t){switch(t){case 5126:return Zh;case 35664:return tu;case 35665:return eu;case 35666:return iu;case 35674:return nu;case 35675:return ru;case 35676:return su;case 5124:case 35670:return au;case 35667:case 35671:return ou;case 35668:case 35672:return lu;case 35669:case 35673:return cu;case 5125:return hu;case 36294:return uu;case 36295:return du;case 36296:return pu;case 35678:case 36198:case 36298:case 36306:case 35682:return Au;case 35679:case 36299:case 36307:return gu;case 35680:case 36300:case 36308:case 36293:return mu;case 36289:case 36303:case 36311:case 36292:return fu}}(e.type)}}class yu{constructor(t){this.id=t,this.seq=[],this.map={}}setValue(t,e,i){const n=this.seq;for(let r=0,s=n.length;r!==s;++r){const s=n[r];s.setValue(t,e[s.id],i)}}}const xu=/(\w+)(\])?(\[|\.)?/g;function _u(t,e){t.seq.push(e),t.map[e.id]=e}function Eu(t,e,i){const n=t.name,r=n.length;for(xu.lastIndex=0;;){const s=xu.exec(n),a=xu.lastIndex;let o=s[1];const l="]"===s[2],c=s[3];if(l&&(o|=0),void 0===c||"["===c&&a+2===r){_u(i,void 0===c?new bu(o,t,e):new vu(o,t,e));break}{let t=i.map[o];void 0===t&&(t=new yu(o),_u(i,t)),i=t}}}class Su{constructor(t,e){this.seq=[],this.map={};const i=t.getProgramParameter(e,t.ACTIVE_UNIFORMS);for(let n=0;n<i;++n){const i=t.getActiveUniform(e,n);Eu(i,t.getUniformLocation(e,i.name),this)}const n=[],r=[];for(const e of this.seq)e.type===t.SAMPLER_2D_SHADOW||e.type===t.SAMPLER_CUBE_SHADOW||e.type===t.SAMPLER_2D_ARRAY_SHADOW?n.push(e):r.push(e);n.length>0&&(this.seq=n.concat(r))}setValue(t,e,i,n){const r=this.map[e];void 0!==r&&r.setValue(t,i,n)}setOptional(t,e,i){const n=e[i];void 0!==n&&this.setValue(t,i,n)}static upload(t,e,i,n){for(let r=0,s=e.length;r!==s;++r){const s=e[r],a=i[s.id];!1!==a.needsUpdate&&s.setValue(t,a.value,n)}}static seqWithValue(t,e){const i=[];for(let n=0,r=t.length;n!==r;++n){const r=t[n];r.id in e&&i.push(r)}return i}}function Cu(t,e,i){const n=t.createShader(e);return t.shaderSource(n,i),t.compileShader(n),n}let wu=0;const Mu=new _n;function Iu(t,e,i){const n=t.getShaderParameter(e,t.COMPILE_STATUS),r=(t.getShaderInfoLog(e)||"").trim();if(n&&""===r)return"";const s=/ERROR: 0:(\d+)/.exec(r);if(s){const n=parseInt(s[1]);return i.toUpperCase()+"\n\n"+r+"\n\n"+function(t,e){const i=t.split("\n"),n=[],r=Math.max(e-6,0),s=Math.min(e+6,i.length);for(let t=r;t<s;t++){const r=t+1;n.push(`${r===e?">":" "} ${r}: ${i[t]}`)}return n.join("\n")}(t.getShaderSource(e),n)}return r}function Tu(t,e){const i=function(t){Mn._getMatrix(Mu,Mn.workingColorSpace,t);const e=`mat3( ${Mu.elements.map(t=>t.toFixed(4))} )`;switch(Mn.getTransfer(t)){case Pi:return[e,"LinearTransferOETF"];case Fi:return[e,"sRGBTransferOETF"];default:return tn("WebGLProgram: Unsupported color space: ",t),[e,"LinearTransferOETF"]}}(e);return[`vec4 ${t}( vec4 value ) {`,`\treturn ${i[1]}( vec4( value.rgb * ${i[0]}, value.a ) );`,"}"].join("\n")}const Bu={[Xt]:"Linear",[Kt]:"Reinhard",[Jt]:"Cineon",[Yt]:"ACESFilmic",[Zt]:"AgX",[te]:"Neutral",[$t]:"Custom"};function Ru(t,e){const i=Bu[e];return void 0===i?(tn("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+t+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+t+"( vec3 color ) { return "+i+"ToneMapping( color ); }"}const Du=new vn;function Lu(){Mn.getLuminanceCoefficients(Du);return["float luminance( const in vec3 rgb ) {",`\tconst vec3 weights = vec3( ${Du.x.toFixed(4)}, ${Du.y.toFixed(4)}, ${Du.z.toFixed(4)} );`,"\treturn dot( weights, rgb );","}"].join("\n")}function Pu(t){return""!==t}function Fu(t,e){const i=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return t.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,i).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function Uu(t,e){return t.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const Nu=/^[ \t]*#include +<([\w\d./]+)>/gm;function Ou(t){return t.replace(Nu,Qu)}const ku=new Map;function Qu(t,e){let i=Oc[e];if(void 0===i){const t=ku.get(e);if(void 0===t)throw new Error("Can not resolve #include <"+e+">");i=Oc[t],tn('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,t)}return Ou(i)}const Gu=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function zu(t){return t.replace(Gu,Hu)}function Hu(t,e,i,n){let r="";for(let t=parseInt(e);t<parseInt(i);t++)r+=n.replace(/\[\s*i\s*\]/g,"[ "+t+" ]").replace(/UNROLLED_LOOP_INDEX/g,t);return r}function Vu(t){let e=`precision ${t.precision} float;\n\tprecision ${t.precision} int;\n\tprecision ${t.precision} sampler2D;\n\tprecision ${t.precision} samplerCube;\n\tprecision ${t.precision} sampler3D;\n\tprecision ${t.precision} sampler2DArray;\n\tprecision ${t.precision} sampler2DShadow;\n\tprecision ${t.precision} samplerCubeShadow;\n\tprecision ${t.precision} sampler2DArrayShadow;\n\tprecision ${t.precision} isampler2D;\n\tprecision ${t.precision} isampler3D;\n\tprecision ${t.precision} isamplerCube;\n\tprecision ${t.precision} isampler2DArray;\n\tprecision ${t.precision} usampler2D;\n\tprecision ${t.precision} usampler3D;\n\tprecision ${t.precision} usamplerCube;\n\tprecision ${t.precision} usampler2DArray;\n\t`;return"highp"===t.precision?e+="\n#define HIGH_PRECISION":"mediump"===t.precision?e+="\n#define MEDIUM_PRECISION":"lowp"===t.precision&&(e+="\n#define LOW_PRECISION"),e}const qu={[At]:"SHADOWMAP_TYPE_PCF",[gt]:"SHADOWMAP_TYPE_VSM"};const ju={[ne]:"ENVMAP_TYPE_CUBE",[re]:"ENVMAP_TYPE_CUBE",[oe]:"ENVMAP_TYPE_CUBE_UV"};const Wu={[re]:"ENVMAP_MODE_REFRACTION"};const Xu={[qt]:"ENVMAP_BLENDING_MULTIPLY",[jt]:"ENVMAP_BLENDING_MIX",[Wt]:"ENVMAP_BLENDING_ADD"};function Ku(t,e,i,n){const r=t.getContext(),s=i.defines;let a=i.vertexShader,o=i.fragmentShader;const l=function(t){return qu[t.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}(i),c=function(t){return!1===t.envMap?"ENVMAP_TYPE_CUBE":ju[t.envMapMode]||"ENVMAP_TYPE_CUBE"}(i),h=function(t){return!1===t.envMap?"ENVMAP_MODE_REFLECTION":Wu[t.envMapMode]||"ENVMAP_MODE_REFLECTION"}(i),u=function(t){return!1===t.envMap?"ENVMAP_BLENDING_NONE":Xu[t.combine]||"ENVMAP_BLENDING_NONE"}(i),d=function(t){const e=t.envMapCubeUVHeight;if(null===e)return null;const i=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,i),112)),texelHeight:n,maxMip:i}}(i),p=function(t){return[t.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",t.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(Pu).join("\n")}(i),A=function(t){const e=[];for(const i in t){const n=t[i];!1!==n&&e.push("#define "+i+" "+n)}return e.join("\n")}(s),g=r.createProgram();let m,f,b=i.glslVersion?"#version "+i.glslVersion+"\n":"";i.isRawShaderMaterial?(m=["#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,A].filter(Pu).join("\n"),m.length>0&&(m+="\n"),f=["#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,A].filter(Pu).join("\n"),f.length>0&&(f+="\n")):(m=[Vu(i),"#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,A,i.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",i.batching?"#define USE_BATCHING":"",i.batchingColor?"#define USE_BATCHING_COLOR":"",i.instancing?"#define USE_INSTANCING":"",i.instancingColor?"#define USE_INSTANCING_COLOR":"",i.instancingMorph?"#define USE_INSTANCING_MORPH":"",i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.map?"#define USE_MAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+h:"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",i.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",i.displacementMap?"#define USE_DISPLACEMENTMAP":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.anisotropy?"#define USE_ANISOTROPY":"",i.anisotropyMap?"#define USE_ANISOTROPYMAP":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",i.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.alphaHash?"#define USE_ALPHAHASH":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",i.mapUv?"#define MAP_UV "+i.mapUv:"",i.alphaMapUv?"#define ALPHAMAP_UV "+i.alphaMapUv:"",i.lightMapUv?"#define LIGHTMAP_UV "+i.lightMapUv:"",i.aoMapUv?"#define AOMAP_UV "+i.aoMapUv:"",i.emissiveMapUv?"#define EMISSIVEMAP_UV "+i.emissiveMapUv:"",i.bumpMapUv?"#define BUMPMAP_UV "+i.bumpMapUv:"",i.normalMapUv?"#define NORMALMAP_UV "+i.normalMapUv:"",i.displacementMapUv?"#define DISPLACEMENTMAP_UV "+i.displacementMapUv:"",i.metalnessMapUv?"#define METALNESSMAP_UV "+i.metalnessMapUv:"",i.roughnessMapUv?"#define ROUGHNESSMAP_UV "+i.roughnessMapUv:"",i.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+i.anisotropyMapUv:"",i.clearcoatMapUv?"#define CLEARCOATMAP_UV "+i.clearcoatMapUv:"",i.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+i.clearcoatNormalMapUv:"",i.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+i.clearcoatRoughnessMapUv:"",i.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+i.iridescenceMapUv:"",i.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+i.iridescenceThicknessMapUv:"",i.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+i.sheenColorMapUv:"",i.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+i.sheenRoughnessMapUv:"",i.specularMapUv?"#define SPECULARMAP_UV "+i.specularMapUv:"",i.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+i.specularColorMapUv:"",i.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+i.specularIntensityMapUv:"",i.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+i.transmissionMapUv:"",i.thicknessMapUv?"#define THICKNESSMAP_UV "+i.thicknessMapUv:"",i.vertexTangents&&!1===i.flatShading?"#define USE_TANGENT":"",i.vertexColors?"#define USE_COLOR":"",i.vertexAlphas?"#define USE_COLOR_ALPHA":"",i.vertexUv1s?"#define USE_UV1":"",i.vertexUv2s?"#define USE_UV2":"",i.vertexUv3s?"#define USE_UV3":"",i.pointsUvs?"#define USE_POINTS_UV":"",i.flatShading?"#define FLAT_SHADED":"",i.skinning?"#define USE_SKINNING":"",i.morphTargets?"#define USE_MORPHTARGETS":"",i.morphNormals&&!1===i.flatShading?"#define USE_MORPHNORMALS":"",i.morphColors?"#define USE_MORPHCOLORS":"",i.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+i.morphTextureStride:"",i.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+i.morphTargetsCount:"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+l:"",i.sizeAttenuation?"#define USE_SIZEATTENUATION":"",i.numLightProbes>0?"#define USE_LIGHT_PROBES":"",i.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",i.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","\tuniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(Pu).join("\n"),f=[Vu(i),"#define SHADER_TYPE "+i.shaderType,"#define SHADER_NAME "+i.shaderName,A,i.useFog&&i.fog?"#define USE_FOG":"",i.useFog&&i.fogExp2?"#define FOG_EXP2":"",i.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",i.map?"#define USE_MAP":"",i.matcap?"#define USE_MATCAP":"",i.envMap?"#define USE_ENVMAP":"",i.envMap?"#define "+c:"",i.envMap?"#define "+h:"",i.envMap?"#define "+u:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",i.lightMap?"#define USE_LIGHTMAP":"",i.aoMap?"#define USE_AOMAP":"",i.bumpMap?"#define USE_BUMPMAP":"",i.normalMap?"#define USE_NORMALMAP":"",i.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",i.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",i.emissiveMap?"#define USE_EMISSIVEMAP":"",i.anisotropy?"#define USE_ANISOTROPY":"",i.anisotropyMap?"#define USE_ANISOTROPYMAP":"",i.clearcoat?"#define USE_CLEARCOAT":"",i.clearcoatMap?"#define USE_CLEARCOATMAP":"",i.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",i.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",i.dispersion?"#define USE_DISPERSION":"",i.iridescence?"#define USE_IRIDESCENCE":"",i.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",i.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",i.specularMap?"#define USE_SPECULARMAP":"",i.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",i.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",i.roughnessMap?"#define USE_ROUGHNESSMAP":"",i.metalnessMap?"#define USE_METALNESSMAP":"",i.alphaMap?"#define USE_ALPHAMAP":"",i.alphaTest?"#define USE_ALPHATEST":"",i.alphaHash?"#define USE_ALPHAHASH":"",i.sheen?"#define USE_SHEEN":"",i.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",i.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",i.transmission?"#define USE_TRANSMISSION":"",i.transmissionMap?"#define USE_TRANSMISSIONMAP":"",i.thicknessMap?"#define USE_THICKNESSMAP":"",i.vertexTangents&&!1===i.flatShading?"#define USE_TANGENT":"",i.vertexColors||i.instancingColor?"#define USE_COLOR":"",i.vertexAlphas||i.batchingColor?"#define USE_COLOR_ALPHA":"",i.vertexUv1s?"#define USE_UV1":"",i.vertexUv2s?"#define USE_UV2":"",i.vertexUv3s?"#define USE_UV3":"",i.pointsUvs?"#define USE_POINTS_UV":"",i.gradientMap?"#define USE_GRADIENTMAP":"",i.flatShading?"#define FLAT_SHADED":"",i.doubleSided?"#define DOUBLE_SIDED":"",i.flipSided?"#define FLIP_SIDED":"",i.shadowMapEnabled?"#define USE_SHADOWMAP":"",i.shadowMapEnabled?"#define "+l:"",i.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",i.numLightProbes>0?"#define USE_LIGHT_PROBES":"",i.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",i.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",i.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",i.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",0!==i.toneMapping?"#define TONE_MAPPING":"",0!==i.toneMapping?Oc.tonemapping_pars_fragment:"",0!==i.toneMapping?Ru("toneMapping",i.toneMapping):"",i.dithering?"#define DITHERING":"",i.opaque?"#define OPAQUE":"",Oc.colorspace_pars_fragment,Tu("linearToOutputTexel",i.outputColorSpace),Lu(),i.useDepthPacking?"#define DEPTH_PACKING "+i.depthPacking:"","\n"].filter(Pu).join("\n")),a=Ou(a),a=Fu(a,i),a=Uu(a,i),o=Ou(o),o=Fu(o,i),o=Uu(o,i),a=zu(a),o=zu(o),!0!==i.isRawShaderMaterial&&(b="#version 300 es\n",m=[p,"#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+m,f=["#define varying in",i.glslVersion===ji?"":"layout(location = 0) out highp vec4 pc_fragColor;",i.glslVersion===ji?"":"#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"+f);const v=b+m+a,y=b+f+o,x=Cu(r,r.VERTEX_SHADER,v),_=Cu(r,r.FRAGMENT_SHADER,y);function E(e){if(t.debug.checkShaderErrors){const i=r.getProgramInfoLog(g)||"",n=r.getShaderInfoLog(x)||"",s=r.getShaderInfoLog(_)||"",a=i.trim(),o=n.trim(),l=s.trim();let c=!0,h=!0;if(!1===r.getProgramParameter(g,r.LINK_STATUS))if(c=!1,"function"==typeof t.debug.onShaderError)t.debug.onShaderError(r,g,x,_);else{const t=Iu(r,x,"vertex"),i=Iu(r,_,"fragment");en("THREE.WebGLProgram: Shader Error "+r.getError()+" - VALIDATE_STATUS "+r.getProgramParameter(g,r.VALIDATE_STATUS)+"\n\nMaterial Name: "+e.name+"\nMaterial Type: "+e.type+"\n\nProgram Info Log: "+a+"\n"+t+"\n"+i)}else""!==a?tn("WebGLProgram: Program Info Log:",a):""!==o&&""!==l||(h=!1);h&&(e.diagnostics={runnable:c,programLog:a,vertexShader:{log:o,prefix:m},fragmentShader:{log:l,prefix:f}})}r.deleteShader(x),r.deleteShader(_),S=new Su(r,g),C=function(t,e){const i={},n=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let r=0;r<n;r++){const n=t.getActiveAttrib(e,r),s=n.name;let a=1;n.type===t.FLOAT_MAT2&&(a=2),n.type===t.FLOAT_MAT3&&(a=3),n.type===t.FLOAT_MAT4&&(a=4),i[s]={type:n.type,location:t.getAttribLocation(e,s),locationSize:a}}return i}(r,g)}let S,C;r.attachShader(g,x),r.attachShader(g,_),void 0!==i.index0AttributeName?r.bindAttribLocation(g,0,i.index0AttributeName):!0===i.morphTargets&&r.bindAttribLocation(g,0,"position"),r.linkProgram(g),this.getUniforms=function(){return void 0===S&&E(this),S},this.getAttributes=function(){return void 0===C&&E(this),C};let w=!1===i.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===w&&(w=r.getProgramParameter(g,37297)),w},this.destroy=function(){n.releaseStatesOfProgram(this),r.deleteProgram(g),this.program=void 0},this.type=i.shaderType,this.name=i.shaderName,this.id=wu++,this.cacheKey=e,this.usedTimes=1,this.program=g,this.vertexShader=x,this.fragmentShader=_,this}let Ju=0;class Yu{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(t){const e=t.vertexShader,i=t.fragmentShader,n=this._getShaderStage(e),r=this._getShaderStage(i),s=this._getShaderCacheForMaterial(t);return!1===s.has(n)&&(s.add(n),n.usedTimes++),!1===s.has(r)&&(s.add(r),r.usedTimes++),this}remove(t){const e=this.materialCache.get(t);for(const t of e)t.usedTimes--,0===t.usedTimes&&this.shaderCache.delete(t.code);return this.materialCache.delete(t),this}getVertexShaderID(t){return this._getShaderStage(t.vertexShader).id}getFragmentShaderID(t){return this._getShaderStage(t.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(t){const e=this.materialCache;let i=e.get(t);return void 0===i&&(i=new Set,e.set(t,i)),i}_getShaderStage(t){const e=this.shaderCache;let i=e.get(t);return void 0===i&&(i=new $u(t),e.set(t,i)),i}}class $u{constructor(t){this.id=Ju++,this.code=t,this.usedTimes=0}}function Zu(t,e,i,n,r,s){const a=new tr,o=new Yu,l=new Set,c=[],h=new Map,u=n.logarithmicDepthBuffer;let d=n.precision;const p={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function A(t){return l.add(t),0===t?"uv":`uv${t}`}return{getParameters:function(r,a,c,h,g){const m=h.fog,f=g.geometry,b=r.isMeshStandardMaterial||r.isMeshLambertMaterial||r.isMeshPhongMaterial?h.environment:null,v=r.isMeshStandardMaterial||r.isMeshLambertMaterial&&!r.envMap||r.isMeshPhongMaterial&&!r.envMap,y=e.get(r.envMap||b,v),x=y&&y.mapping===oe?y.image.height:null,_=p[r.type];null!==r.precision&&(d=n.getMaxPrecision(r.precision),d!==r.precision&&tn("WebGLProgram.getParameters:",r.precision,"not supported, using",d,"instead."));const E=f.morphAttributes.position||f.morphAttributes.normal||f.morphAttributes.color,S=void 0!==E?E.length:0;let C,w,M,I,T=0;if(void 0!==f.morphAttributes.position&&(T=1),void 0!==f.morphAttributes.normal&&(T=2),void 0!==f.morphAttributes.color&&(T=3),_){const t=Qc[_];C=t.vertexShader,w=t.fragmentShader}else C=r.vertexShader,w=r.fragmentShader,o.update(r),M=o.getVertexShaderID(r),I=o.getFragmentShaderID(r);const B=t.getRenderTarget(),R=t.state.buffers.depth.getReversed(),D=!0===g.isInstancedMesh,L=!0===g.isBatchedMesh,P=!!r.map,F=!!r.matcap,U=!!y,N=!!r.aoMap,O=!!r.lightMap,k=!!r.bumpMap,Q=!!r.normalMap,G=!!r.displacementMap,z=!!r.emissiveMap,H=!!r.metalnessMap,V=!!r.roughnessMap,q=r.anisotropy>0,j=r.clearcoat>0,W=r.dispersion>0,X=r.iridescence>0,K=r.sheen>0,J=r.transmission>0,Y=q&&!!r.anisotropyMap,$=j&&!!r.clearcoatMap,Z=j&&!!r.clearcoatNormalMap,tt=j&&!!r.clearcoatRoughnessMap,et=X&&!!r.iridescenceMap,it=X&&!!r.iridescenceThicknessMap,nt=K&&!!r.sheenColorMap,rt=K&&!!r.sheenRoughnessMap,st=!!r.specularMap,at=!!r.specularColorMap,ot=!!r.specularIntensityMap,lt=J&&!!r.transmissionMap,ct=J&&!!r.thicknessMap,ht=!!r.gradientMap,ut=!!r.alphaMap,dt=r.alphaTest>0,pt=!!r.alphaHash,At=!!r.extensions;let gt=0;r.toneMapped&&(null!==B&&!0!==B.isXRRenderTarget||(gt=t.toneMapping));const mt={shaderID:_,shaderType:r.type,shaderName:r.name,vertexShader:C,fragmentShader:w,defines:r.defines,customVertexShaderID:M,customFragmentShaderID:I,isRawShaderMaterial:!0===r.isRawShaderMaterial,glslVersion:r.glslVersion,precision:d,batching:L,batchingColor:L&&null!==g._colorsTexture,instancing:D,instancingColor:D&&null!==g.instanceColor,instancingMorph:D&&null!==g.morphTexture,outputColorSpace:null===B?t.outputColorSpace:!0===B.isXRRenderTarget?B.texture.colorSpace:Li,alphaToCoverage:!!r.alphaToCoverage,map:P,matcap:F,envMap:U,envMapMode:U&&y.mapping,envMapCubeUVHeight:x,aoMap:N,lightMap:O,bumpMap:k,normalMap:Q,displacementMap:G,emissiveMap:z,normalMapObjectSpace:Q&&1===r.normalMapType,normalMapTangentSpace:Q&&0===r.normalMapType,metalnessMap:H,roughnessMap:V,anisotropy:q,anisotropyMap:Y,clearcoat:j,clearcoatMap:$,clearcoatNormalMap:Z,clearcoatRoughnessMap:tt,dispersion:W,iridescence:X,iridescenceMap:et,iridescenceThicknessMap:it,sheen:K,sheenColorMap:nt,sheenRoughnessMap:rt,specularMap:st,specularColorMap:at,specularIntensityMap:ot,transmission:J,transmissionMap:lt,thicknessMap:ct,gradientMap:ht,opaque:!1===r.transparent&&1===r.blending&&!1===r.alphaToCoverage,alphaMap:ut,alphaTest:dt,alphaHash:pt,combine:r.combine,mapUv:P&&A(r.map.channel),aoMapUv:N&&A(r.aoMap.channel),lightMapUv:O&&A(r.lightMap.channel),bumpMapUv:k&&A(r.bumpMap.channel),normalMapUv:Q&&A(r.normalMap.channel),displacementMapUv:G&&A(r.displacementMap.channel),emissiveMapUv:z&&A(r.emissiveMap.channel),metalnessMapUv:H&&A(r.metalnessMap.channel),roughnessMapUv:V&&A(r.roughnessMap.channel),anisotropyMapUv:Y&&A(r.anisotropyMap.channel),clearcoatMapUv:$&&A(r.clearcoatMap.channel),clearcoatNormalMapUv:Z&&A(r.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:tt&&A(r.clearcoatRoughnessMap.channel),iridescenceMapUv:et&&A(r.iridescenceMap.channel),iridescenceThicknessMapUv:it&&A(r.iridescenceThicknessMap.channel),sheenColorMapUv:nt&&A(r.sheenColorMap.channel),sheenRoughnessMapUv:rt&&A(r.sheenRoughnessMap.channel),specularMapUv:st&&A(r.specularMap.channel),specularColorMapUv:at&&A(r.specularColorMap.channel),specularIntensityMapUv:ot&&A(r.specularIntensityMap.channel),transmissionMapUv:lt&&A(r.transmissionMap.channel),thicknessMapUv:ct&&A(r.thicknessMap.channel),alphaMapUv:ut&&A(r.alphaMap.channel),vertexTangents:!!f.attributes.tangent&&(Q||q),vertexColors:r.vertexColors,vertexAlphas:!0===r.vertexColors&&!!f.attributes.color&&4===f.attributes.color.itemSize,pointsUvs:!0===g.isPoints&&!!f.attributes.uv&&(P||ut),fog:!!m,useFog:!0===r.fog,fogExp2:!!m&&m.isFogExp2,flatShading:!1===r.wireframe&&(!0===r.flatShading||void 0===f.attributes.normal&&!1===Q&&(r.isMeshLambertMaterial||r.isMeshPhongMaterial||r.isMeshStandardMaterial||r.isMeshPhysicalMaterial)),sizeAttenuation:!0===r.sizeAttenuation,logarithmicDepthBuffer:u,reversedDepthBuffer:R,skinning:!0===g.isSkinnedMesh,morphTargets:void 0!==f.morphAttributes.position,morphNormals:void 0!==f.morphAttributes.normal,morphColors:void 0!==f.morphAttributes.color,morphTargetsCount:S,morphTextureStride:T,numDirLights:a.directional.length,numPointLights:a.point.length,numSpotLights:a.spot.length,numSpotLightMaps:a.spotLightMap.length,numRectAreaLights:a.rectArea.length,numHemiLights:a.hemi.length,numDirLightShadows:a.directionalShadowMap.length,numPointLightShadows:a.pointShadowMap.length,numSpotLightShadows:a.spotShadowMap.length,numSpotLightShadowsWithMaps:a.numSpotLightShadowsWithMaps,numLightProbes:a.numLightProbes,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:r.dithering,shadowMapEnabled:t.shadowMap.enabled&&c.length>0,shadowMapType:t.shadowMap.type,toneMapping:gt,decodeVideoTexture:P&&!0===r.map.isVideoTexture&&Mn.getTransfer(r.map.colorSpace)===Fi,decodeVideoTextureEmissive:z&&!0===r.emissiveMap.isVideoTexture&&Mn.getTransfer(r.emissiveMap.colorSpace)===Fi,premultipliedAlpha:r.premultipliedAlpha,doubleSided:2===r.side,flipSided:1===r.side,useDepthPacking:r.depthPacking>=0,depthPacking:r.depthPacking||0,index0AttributeName:r.index0AttributeName,extensionClipCullDistance:At&&!0===r.extensions.clipCullDistance&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(At&&!0===r.extensions.multiDraw||L)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:r.customProgramCacheKey()};return mt.vertexUv1s=l.has(1),mt.vertexUv2s=l.has(2),mt.vertexUv3s=l.has(3),l.clear(),mt},getProgramCacheKey:function(e){const i=[];if(e.shaderID?i.push(e.shaderID):(i.push(e.customVertexShaderID),i.push(e.customFragmentShaderID)),void 0!==e.defines)for(const t in e.defines)i.push(t),i.push(e.defines[t]);return!1===e.isRawShaderMaterial&&(!function(t,e){t.push(e.precision),t.push(e.outputColorSpace),t.push(e.envMapMode),t.push(e.envMapCubeUVHeight),t.push(e.mapUv),t.push(e.alphaMapUv),t.push(e.lightMapUv),t.push(e.aoMapUv),t.push(e.bumpMapUv),t.push(e.normalMapUv),t.push(e.displacementMapUv),t.push(e.emissiveMapUv),t.push(e.metalnessMapUv),t.push(e.roughnessMapUv),t.push(e.anisotropyMapUv),t.push(e.clearcoatMapUv),t.push(e.clearcoatNormalMapUv),t.push(e.clearcoatRoughnessMapUv),t.push(e.iridescenceMapUv),t.push(e.iridescenceThicknessMapUv),t.push(e.sheenColorMapUv),t.push(e.sheenRoughnessMapUv),t.push(e.specularMapUv),t.push(e.specularColorMapUv),t.push(e.specularIntensityMapUv),t.push(e.transmissionMapUv),t.push(e.thicknessMapUv),t.push(e.combine),t.push(e.fogExp2),t.push(e.sizeAttenuation),t.push(e.morphTargetsCount),t.push(e.morphAttributeCount),t.push(e.numDirLights),t.push(e.numPointLights),t.push(e.numSpotLights),t.push(e.numSpotLightMaps),t.push(e.numHemiLights),t.push(e.numRectAreaLights),t.push(e.numDirLightShadows),t.push(e.numPointLightShadows),t.push(e.numSpotLightShadows),t.push(e.numSpotLightShadowsWithMaps),t.push(e.numLightProbes),t.push(e.shadowMapType),t.push(e.toneMapping),t.push(e.numClippingPlanes),t.push(e.numClipIntersection),t.push(e.depthPacking)}(i,e),function(t,e){a.disableAll(),e.instancing&&a.enable(0);e.instancingColor&&a.enable(1);e.instancingMorph&&a.enable(2);e.matcap&&a.enable(3);e.envMap&&a.enable(4);e.normalMapObjectSpace&&a.enable(5);e.normalMapTangentSpace&&a.enable(6);e.clearcoat&&a.enable(7);e.iridescence&&a.enable(8);e.alphaTest&&a.enable(9);e.vertexColors&&a.enable(10);e.vertexAlphas&&a.enable(11);e.vertexUv1s&&a.enable(12);e.vertexUv2s&&a.enable(13);e.vertexUv3s&&a.enable(14);e.vertexTangents&&a.enable(15);e.anisotropy&&a.enable(16);e.alphaHash&&a.enable(17);e.batching&&a.enable(18);e.dispersion&&a.enable(19);e.batchingColor&&a.enable(20);e.gradientMap&&a.enable(21);t.push(a.mask),a.disableAll(),e.fog&&a.enable(0);e.useFog&&a.enable(1);e.flatShading&&a.enable(2);e.logarithmicDepthBuffer&&a.enable(3);e.reversedDepthBuffer&&a.enable(4);e.skinning&&a.enable(5);e.morphTargets&&a.enable(6);e.morphNormals&&a.enable(7);e.morphColors&&a.enable(8);e.premultipliedAlpha&&a.enable(9);e.shadowMapEnabled&&a.enable(10);e.doubleSided&&a.enable(11);e.flipSided&&a.enable(12);e.useDepthPacking&&a.enable(13);e.dithering&&a.enable(14);e.transmission&&a.enable(15);e.sheen&&a.enable(16);e.opaque&&a.enable(17);e.pointsUvs&&a.enable(18);e.decodeVideoTexture&&a.enable(19);e.decodeVideoTextureEmissive&&a.enable(20);e.alphaToCoverage&&a.enable(21);t.push(a.mask)}(i,e),i.push(t.outputColorSpace)),i.push(e.customProgramCacheKey),i.join()},getUniforms:function(t){const e=p[t.type];let i;if(e){const t=Qc[e];i=ol.clone(t.uniforms)}else i=t.uniforms;return i},acquireProgram:function(e,i){let n=h.get(i);return void 0!==n?++n.usedTimes:(n=new Ku(t,i,e,r),c.push(n),h.set(i,n)),n},releaseProgram:function(t){if(0===--t.usedTimes){const e=c.indexOf(t);c[e]=c[c.length-1],c.pop(),h.delete(t.cacheKey),t.destroy()}},releaseShaderCache:function(t){o.remove(t)},programs:c,dispose:function(){o.dispose()}}}function td(){let t=new WeakMap;return{has:function(e){return t.has(e)},get:function(e){let i=t.get(e);return void 0===i&&(i={},t.set(e,i)),i},remove:function(e){t.delete(e)},update:function(e,i,n){t.get(e)[i]=n},dispose:function(){t=new WeakMap}}}function ed(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.material.id!==e.material.id?t.material.id-e.material.id:t.materialVariant!==e.materialVariant?t.materialVariant-e.materialVariant:t.z!==e.z?t.z-e.z:t.id-e.id}function id(t,e){return t.groupOrder!==e.groupOrder?t.groupOrder-e.groupOrder:t.renderOrder!==e.renderOrder?t.renderOrder-e.renderOrder:t.z!==e.z?e.z-t.z:t.id-e.id}function nd(){const t=[];let e=0;const i=[],n=[],r=[];function s(t){let e=0;return t.isInstancedMesh&&(e+=2),t.isSkinnedMesh&&(e+=1),e}function a(i,n,r,a,o,l){let c=t[e];return void 0===c?(c={id:i.id,object:i,geometry:n,material:r,materialVariant:s(i),groupOrder:a,renderOrder:i.renderOrder,z:o,group:l},t[e]=c):(c.id=i.id,c.object=i,c.geometry=n,c.material=r,c.materialVariant=s(i),c.groupOrder=a,c.renderOrder=i.renderOrder,c.z=o,c.group=l),e++,c}return{opaque:i,transmissive:n,transparent:r,init:function(){e=0,i.length=0,n.length=0,r.length=0},push:function(t,e,s,o,l,c){const h=a(t,e,s,o,l,c);s.transmission>0?n.push(h):!0===s.transparent?r.push(h):i.push(h)},unshift:function(t,e,s,o,l,c){const h=a(t,e,s,o,l,c);s.transmission>0?n.unshift(h):!0===s.transparent?r.unshift(h):i.unshift(h)},finish:function(){for(let i=e,n=t.length;i<n;i++){const e=t[i];if(null===e.id)break;e.id=null,e.object=null,e.geometry=null,e.material=null,e.group=null}},sort:function(t,e){i.length>1&&i.sort(t||ed),n.length>1&&n.sort(e||id),r.length>1&&r.sort(e||id)}}}function rd(){let t=new WeakMap;return{get:function(e,i){const n=t.get(e);let r;return void 0===n?(r=new nd,t.set(e,[r])):i>=n.length?(r=new nd,n.push(r)):r=n[i],r},dispose:function(){t=new WeakMap}}}function sd(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let i;switch(e.type){case"DirectionalLight":i={direction:new vn,color:new Sr};break;case"SpotLight":i={position:new vn,direction:new vn,color:new Sr,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":i={position:new vn,color:new Sr,distance:0,decay:0};break;case"HemisphereLight":i={direction:new vn,skyColor:new Sr,groundColor:new Sr};break;case"RectAreaLight":i={color:new Sr,position:new vn,halfWidth:new vn,halfHeight:new vn}}return t[e.id]=i,i}}}let ad=0;function od(t,e){return(e.castShadow?2:0)-(t.castShadow?2:0)+(e.map?1:0)-(t.map?1:0)}function ld(t){const e=new sd,i=function(){const t={};return{get:function(e){if(void 0!==t[e.id])return t[e.id];let i;switch(e.type){case"DirectionalLight":case"SpotLight":i={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new fn};break;case"PointLight":i={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new fn,shadowCameraNear:1,shadowCameraFar:1e3}}return t[e.id]=i,i}}}(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let t=0;t<9;t++)n.probe.push(new vn);const r=new vn,s=new Hn,a=new Hn;return{setup:function(r){let s=0,a=0,o=0;for(let t=0;t<9;t++)n.probe[t].set(0,0,0);let l=0,c=0,h=0,u=0,d=0,p=0,A=0,g=0,m=0,f=0,b=0;r.sort(od);for(let t=0,v=r.length;t<v;t++){const v=r[t],y=v.color,x=v.intensity,_=v.distance;let E=null;if(v.shadow&&v.shadow.map&&(E=v.shadow.map.texture.format===Ue?v.shadow.map.texture:v.shadow.map.depthTexture||v.shadow.map.texture),v.isAmbientLight)s+=y.r*x,a+=y.g*x,o+=y.b*x;else if(v.isLightProbe){for(let t=0;t<9;t++)n.probe[t].addScaledVector(v.sh.coefficients[t],x);b++}else if(v.isDirectionalLight){const t=e.get(v);if(t.color.copy(v.color).multiplyScalar(v.intensity),v.castShadow){const t=v.shadow,e=i.get(v);e.shadowIntensity=t.intensity,e.shadowBias=t.bias,e.shadowNormalBias=t.normalBias,e.shadowRadius=t.radius,e.shadowMapSize=t.mapSize,n.directionalShadow[l]=e,n.directionalShadowMap[l]=E,n.directionalShadowMatrix[l]=v.shadow.matrix,p++}n.directional[l]=t,l++}else if(v.isSpotLight){const t=e.get(v);t.position.setFromMatrixPosition(v.matrixWorld),t.color.copy(y).multiplyScalar(x),t.distance=_,t.coneCos=Math.cos(v.angle),t.penumbraCos=Math.cos(v.angle*(1-v.penumbra)),t.decay=v.decay,n.spot[h]=t;const r=v.shadow;if(v.map&&(n.spotLightMap[m]=v.map,m++,r.updateMatrices(v),v.castShadow&&f++),n.spotLightMatrix[h]=r.matrix,v.castShadow){const t=i.get(v);t.shadowIntensity=r.intensity,t.shadowBias=r.bias,t.shadowNormalBias=r.normalBias,t.shadowRadius=r.radius,t.shadowMapSize=r.mapSize,n.spotShadow[h]=t,n.spotShadowMap[h]=E,g++}h++}else if(v.isRectAreaLight){const t=e.get(v);t.color.copy(y).multiplyScalar(x),t.halfWidth.set(.5*v.width,0,0),t.halfHeight.set(0,.5*v.height,0),n.rectArea[u]=t,u++}else if(v.isPointLight){const t=e.get(v);if(t.color.copy(v.color).multiplyScalar(v.intensity),t.distance=v.distance,t.decay=v.decay,v.castShadow){const t=v.shadow,e=i.get(v);e.shadowIntensity=t.intensity,e.shadowBias=t.bias,e.shadowNormalBias=t.normalBias,e.shadowRadius=t.radius,e.shadowMapSize=t.mapSize,e.shadowCameraNear=t.camera.near,e.shadowCameraFar=t.camera.far,n.pointShadow[c]=e,n.pointShadowMap[c]=E,n.pointShadowMatrix[c]=v.shadow.matrix,A++}n.point[c]=t,c++}else if(v.isHemisphereLight){const t=e.get(v);t.skyColor.copy(v.color).multiplyScalar(x),t.groundColor.copy(v.groundColor).multiplyScalar(x),n.hemi[d]=t,d++}}u>0&&(!0===t.has("OES_texture_float_linear")?(n.rectAreaLTC1=kc.LTC_FLOAT_1,n.rectAreaLTC2=kc.LTC_FLOAT_2):(n.rectAreaLTC1=kc.LTC_HALF_1,n.rectAreaLTC2=kc.LTC_HALF_2)),n.ambient[0]=s,n.ambient[1]=a,n.ambient[2]=o;const v=n.hash;v.directionalLength===l&&v.pointLength===c&&v.spotLength===h&&v.rectAreaLength===u&&v.hemiLength===d&&v.numDirectionalShadows===p&&v.numPointShadows===A&&v.numSpotShadows===g&&v.numSpotMaps===m&&v.numLightProbes===b||(n.directional.length=l,n.spot.length=h,n.rectArea.length=u,n.point.length=c,n.hemi.length=d,n.directionalShadow.length=p,n.directionalShadowMap.length=p,n.pointShadow.length=A,n.pointShadowMap.length=A,n.spotShadow.length=g,n.spotShadowMap.length=g,n.directionalShadowMatrix.length=p,n.pointShadowMatrix.length=A,n.spotLightMatrix.length=g+m-f,n.spotLightMap.length=m,n.numSpotLightShadowsWithMaps=f,n.numLightProbes=b,v.directionalLength=l,v.pointLength=c,v.spotLength=h,v.rectAreaLength=u,v.hemiLength=d,v.numDirectionalShadows=p,v.numPointShadows=A,v.numSpotShadows=g,v.numSpotMaps=m,v.numLightProbes=b,n.version=ad++)},setupView:function(t,e){let i=0,o=0,l=0,c=0,h=0;const u=e.matrixWorldInverse;for(let e=0,d=t.length;e<d;e++){const d=t[e];if(d.isDirectionalLight){const t=n.directional[i];t.direction.setFromMatrixPosition(d.matrixWorld),r.setFromMatrixPosition(d.target.matrixWorld),t.direction.sub(r),t.direction.transformDirection(u),i++}else if(d.isSpotLight){const t=n.spot[l];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(u),t.direction.setFromMatrixPosition(d.matrixWorld),r.setFromMatrixPosition(d.target.matrixWorld),t.direction.sub(r),t.direction.transformDirection(u),l++}else if(d.isRectAreaLight){const t=n.rectArea[c];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(u),a.identity(),s.copy(d.matrixWorld),s.premultiply(u),a.extractRotation(s),t.halfWidth.set(.5*d.width,0,0),t.halfHeight.set(0,.5*d.height,0),t.halfWidth.applyMatrix4(a),t.halfHeight.applyMatrix4(a),c++}else if(d.isPointLight){const t=n.point[o];t.position.setFromMatrixPosition(d.matrixWorld),t.position.applyMatrix4(u),o++}else if(d.isHemisphereLight){const t=n.hemi[h];t.direction.setFromMatrixPosition(d.matrixWorld),t.direction.transformDirection(u),h++}}},state:n}}function cd(t){const e=new ld(t),i=[],n=[];const r={lightsArray:i,shadowsArray:n,camera:null,lights:e,transmissionRenderTarget:{}};return{init:function(t){r.camera=t,i.length=0,n.length=0},state:r,setupLights:function(){e.setup(i)},setupLightsView:function(t){e.setupView(i,t)},pushLight:function(t){i.push(t)},pushShadow:function(t){n.push(t)}}}function hd(t){let e=new WeakMap;return{get:function(i,n=0){const r=e.get(i);let s;return void 0===r?(s=new cd(t),e.set(i,[s])):n>=r.length?(s=new cd(t),r.push(s)):s=r[n],s},dispose:function(){e=new WeakMap}}}const ud=[new vn(1,0,0),new vn(-1,0,0),new vn(0,1,0),new vn(0,-1,0),new vn(0,0,1),new vn(0,0,-1)],dd=[new vn(0,-1,0),new vn(0,-1,0),new vn(0,0,1),new vn(0,0,-1),new vn(0,-1,0),new vn(0,-1,0)],pd=new Hn,Ad=new vn,gd=new vn;function md(t,e,i){let n=new Ia;const r=new fn,s=new fn,a=new On,o=new dl,l=new pl,c={},h=i.maxTextureSize,u={[mt]:1,[ft]:0,[bt]:2},d=new ll({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new fn},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );\n\tgl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );\n}"}),p=d.clone();p.defines.HORIZONTAL_PASS=1;const A=new Es;A.setAttribute("position",new ls(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const g=new Ks(A,d),m=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;let f=this.type;function b(i,n){const s=e.update(g);d.defines.VSM_SAMPLES!==i.blurSamples&&(d.defines.VSM_SAMPLES=i.blurSamples,p.defines.VSM_SAMPLES=i.blurSamples,d.needsUpdate=!0,p.needsUpdate=!0),null===i.mapPass&&(i.mapPass=new Qn(r.x,r.y,{format:Ue,type:Se})),d.uniforms.shadow_pass.value=i.map.depthTexture,d.uniforms.resolution.value=i.mapSize,d.uniforms.radius.value=i.radius,t.setRenderTarget(i.mapPass),t.clear(),t.renderBufferDirect(n,null,s,d,g,null),p.uniforms.shadow_pass.value=i.mapPass.texture,p.uniforms.resolution.value=i.mapSize,p.uniforms.radius.value=i.radius,t.setRenderTarget(i.map),t.clear(),t.renderBufferDirect(n,null,s,p,g,null)}function v(e,i,n,r){let s=null;const a=!0===n.isPointLight?e.customDistanceMaterial:e.customDepthMaterial;if(void 0!==a)s=a;else if(s=!0===n.isPointLight?l:o,t.localClippingEnabled&&!0===i.clipShadows&&Array.isArray(i.clippingPlanes)&&0!==i.clippingPlanes.length||i.displacementMap&&0!==i.displacementScale||i.alphaMap&&i.alphaTest>0||i.map&&i.alphaTest>0||!0===i.alphaToCoverage){const t=s.uuid,e=i.uuid;let n=c[t];void 0===n&&(n={},c[t]=n);let r=n[e];void 0===r&&(r=s.clone(),n[e]=r,i.addEventListener("dispose",x)),s=r}if(s.visible=i.visible,s.wireframe=i.wireframe,s.side=3===r?null!==i.shadowSide?i.shadowSide:i.side:null!==i.shadowSide?i.shadowSide:u[i.side],s.alphaMap=i.alphaMap,s.alphaTest=!0===i.alphaToCoverage?.5:i.alphaTest,s.map=i.map,s.clipShadows=i.clipShadows,s.clippingPlanes=i.clippingPlanes,s.clipIntersection=i.clipIntersection,s.displacementMap=i.displacementMap,s.displacementScale=i.displacementScale,s.displacementBias=i.displacementBias,s.wireframeLinewidth=i.wireframeLinewidth,s.linewidth=i.linewidth,!0===n.isPointLight&&!0===s.isMeshDistanceMaterial){t.properties.get(s).light=n}return s}function y(i,r,s,a,o){if(!1===i.visible)return;if(i.layers.test(r.layers)&&(i.isMesh||i.isLine||i.isPoints)&&(i.castShadow||i.receiveShadow&&3===o)&&(!i.frustumCulled||n.intersectsObject(i))){i.modelViewMatrix.multiplyMatrices(s.matrixWorldInverse,i.matrixWorld);const n=e.update(i),l=i.material;if(Array.isArray(l)){const e=n.groups;for(let c=0,h=e.length;c<h;c++){const h=e[c],u=l[h.materialIndex];if(u&&u.visible){const e=v(i,u,a,o);i.onBeforeShadow(t,i,r,s,n,e,h),t.renderBufferDirect(s,null,n,e,i,h),i.onAfterShadow(t,i,r,s,n,e,h)}}}else if(l.visible){const e=v(i,l,a,o);i.onBeforeShadow(t,i,r,s,n,e,null),t.renderBufferDirect(s,null,n,e,i,null),i.onAfterShadow(t,i,r,s,n,e,null)}}const l=i.children;for(let t=0,e=l.length;t<e;t++)y(l[t],r,s,a,o)}function x(t){t.target.removeEventListener("dispose",x);for(const e in c){const i=c[e],n=t.target.uuid;if(n in i){i[n].dispose(),delete i[n]}}}this.render=function(e,i,o){if(!1===m.enabled)return;if(!1===m.autoUpdate&&!1===m.needsUpdate)return;if(0===e.length)return;2===this.type&&(tn("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=1);const l=t.getRenderTarget(),c=t.getActiveCubeFace(),u=t.getActiveMipmapLevel(),d=t.state;d.setBlending(0),!0===d.buffers.depth.getReversed()?d.buffers.color.setClear(0,0,0,0):d.buffers.color.setClear(1,1,1,1),d.buffers.depth.setTest(!0),d.setScissorTest(!1);const p=f!==this.type;p&&i.traverse(function(t){t.material&&(Array.isArray(t.material)?t.material.forEach(t=>t.needsUpdate=!0):t.material.needsUpdate=!0)});for(let l=0,c=e.length;l<c;l++){const c=e[l],u=c.shadow;if(void 0===u){tn("WebGLShadowMap:",c,"has no shadow.");continue}if(!1===u.autoUpdate&&!1===u.needsUpdate)continue;r.copy(u.mapSize);const A=u.getFrameExtents();r.multiply(A),s.copy(u.mapSize),(r.x>h||r.y>h)&&(r.x>h&&(s.x=Math.floor(h/A.x),r.x=s.x*A.x,u.mapSize.x=s.x),r.y>h&&(s.y=Math.floor(h/A.y),r.y=s.y*A.y,u.mapSize.y=s.y));const g=t.state.buffers.depth.getReversed();if(u.camera._reversedDepth=g,null===u.map||!0===p){if(null!==u.map&&(null!==u.map.depthTexture&&(u.map.depthTexture.dispose(),u.map.depthTexture=null),u.map.dispose()),3===this.type){if(c.isPointLight){tn("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}u.map=new Qn(r.x,r.y,{format:Ue,type:Se,minFilter:Ae,magFilter:Ae,generateMipmaps:!1}),u.map.texture.name=c.name+".shadowMap",u.map.depthTexture=new io(r.x,r.y,Ee),u.map.depthTexture.name=c.name+".shadowMapDepth",u.map.depthTexture.format=De,u.map.depthTexture.compareFunction=null,u.map.depthTexture.minFilter=ue,u.map.depthTexture.magFilter=ue}else c.isPointLight?(u.map=new hh(r.x),u.map.depthTexture=new no(r.x,_e)):(u.map=new Qn(r.x,r.y),u.map.depthTexture=new io(r.x,r.y,_e)),u.map.depthTexture.name=c.name+".shadowMap",u.map.depthTexture.format=De,1===this.type?(u.map.depthTexture.compareFunction=g?518:515,u.map.depthTexture.minFilter=Ae,u.map.depthTexture.magFilter=Ae):(u.map.depthTexture.compareFunction=null,u.map.depthTexture.minFilter=ue,u.map.depthTexture.magFilter=ue);u.camera.updateProjectionMatrix()}const m=u.map.isWebGLCubeRenderTarget?6:1;for(let e=0;e<m;e++){if(u.map.isWebGLCubeRenderTarget)t.setRenderTarget(u.map,e),t.clear();else{0===e&&(t.setRenderTarget(u.map),t.clear());const i=u.getViewport(e);a.set(s.x*i.x,s.y*i.y,s.x*i.z,s.y*i.w),d.viewport(a)}if(c.isPointLight){const t=u.camera,i=u.matrix,n=c.distance||t.far;n!==t.far&&(t.far=n,t.updateProjectionMatrix()),Ad.setFromMatrixPosition(c.matrixWorld),t.position.copy(Ad),gd.copy(t.position),gd.add(ud[e]),t.up.copy(dd[e]),t.lookAt(gd),t.updateMatrixWorld(),i.makeTranslation(-Ad.x,-Ad.y,-Ad.z),pd.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),u._frustum.setFromProjectionMatrix(pd,t.coordinateSystem,t.reversedDepth)}else u.updateMatrices(c);n=u.getFrustum(),y(i,o,u.camera,c,this.type)}!0!==u.isPointLightShadow&&3===this.type&&b(u,o),u.needsUpdate=!1}f=this.type,m.needsUpdate=!1,t.setRenderTarget(l,c,u)}}function fd(t,e){const i=new function(){let e=!1;const i=new On;let n=null;const r=new On(0,0,0,0);return{setMask:function(i){n===i||e||(t.colorMask(i,i,i,i),n=i)},setLocked:function(t){e=t},setClear:function(e,n,s,a,o){!0===o&&(e*=a,n*=a,s*=a),i.set(e,n,s,a),!1===r.equals(i)&&(t.clearColor(e,n,s,a),r.copy(i))},reset:function(){e=!1,n=null,r.set(-1,0,0,0)}}},n=new function(){let i=!1,n=!1,r=null,s=null,a=null;return{setReversed:function(t){if(n!==t){const i=e.get("EXT_clip_control");t?i.clipControlEXT(i.LOWER_LEFT_EXT,i.ZERO_TO_ONE_EXT):i.clipControlEXT(i.LOWER_LEFT_EXT,i.NEGATIVE_ONE_TO_ONE_EXT),n=t;const r=a;a=null,this.setClear(r)}},getReversed:function(){return n},setTest:function(e){e?Q(t.DEPTH_TEST):G(t.DEPTH_TEST)},setMask:function(e){r===e||i||(t.depthMask(e),r=e)},setFunc:function(e){if(n&&(e=rn[e]),s!==e){switch(e){case 0:t.depthFunc(t.NEVER);break;case 1:t.depthFunc(t.ALWAYS);break;case 2:t.depthFunc(t.LESS);break;case 3:default:t.depthFunc(t.LEQUAL);break;case 4:t.depthFunc(t.EQUAL);break;case 5:t.depthFunc(t.GEQUAL);break;case 6:t.depthFunc(t.GREATER);break;case 7:t.depthFunc(t.NOTEQUAL)}s=e}},setLocked:function(t){i=t},setClear:function(e){a!==e&&(a=e,n&&(e=1-e),t.clearDepth(e))},reset:function(){i=!1,r=null,s=null,a=null,n=!1}}},r=new function(){let e=!1,i=null,n=null,r=null,s=null,a=null,o=null,l=null,c=null;return{setTest:function(i){e||(i?Q(t.STENCIL_TEST):G(t.STENCIL_TEST))},setMask:function(n){i===n||e||(t.stencilMask(n),i=n)},setFunc:function(e,i,a){n===e&&r===i&&s===a||(t.stencilFunc(e,i,a),n=e,r=i,s=a)},setOp:function(e,i,n){a===e&&o===i&&l===n||(t.stencilOp(e,i,n),a=e,o=i,l=n)},setLocked:function(t){e=t},setClear:function(e){c!==e&&(t.clearStencil(e),c=e)},reset:function(){e=!1,i=null,n=null,r=null,s=null,a=null,o=null,l=null,c=null}}},s=new WeakMap,a=new WeakMap;let o={},l={},c=new WeakMap,h=[],u=null,d=!1,p=null,A=null,g=null,m=null,f=null,b=null,v=null,y=new Sr(0,0,0),x=0,_=!1,E=null,S=null,C=null,w=null,M=null;const I=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let T=!1,B=0;const R=t.getParameter(t.VERSION);-1!==R.indexOf("WebGL")?(B=parseFloat(/^WebGL (\d)/.exec(R)[1]),T=B>=1):-1!==R.indexOf("OpenGL ES")&&(B=parseFloat(/^OpenGL ES (\d)/.exec(R)[1]),T=B>=2);let D=null,L={};const P=t.getParameter(t.SCISSOR_BOX),F=t.getParameter(t.VIEWPORT),U=(new On).fromArray(P),N=(new On).fromArray(F);function O(e,i,n,r){const s=new Uint8Array(4),a=t.createTexture();t.bindTexture(e,a),t.texParameteri(e,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(e,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let a=0;a<n;a++)e===t.TEXTURE_3D||e===t.TEXTURE_2D_ARRAY?t.texImage3D(i,0,t.RGBA,1,1,r,0,t.RGBA,t.UNSIGNED_BYTE,s):t.texImage2D(i+a,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,s);return a}const k={};function Q(e){!0!==o[e]&&(t.enable(e),o[e]=!0)}function G(e){!1!==o[e]&&(t.disable(e),o[e]=!1)}k[t.TEXTURE_2D]=O(t.TEXTURE_2D,t.TEXTURE_2D,1),k[t.TEXTURE_CUBE_MAP]=O(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),k[t.TEXTURE_2D_ARRAY]=O(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),k[t.TEXTURE_3D]=O(t.TEXTURE_3D,t.TEXTURE_3D,1,1),i.setClear(0,0,0,1),n.setClear(1),r.setClear(0),Q(t.DEPTH_TEST),n.setFunc(3),q(!1),j(1),Q(t.CULL_FACE),V(0);const z={[vt]:t.FUNC_ADD,[yt]:t.FUNC_SUBTRACT,[xt]:t.FUNC_REVERSE_SUBTRACT};z[103]=t.MIN,z[104]=t.MAX;const H={[_t]:t.ZERO,[Et]:t.ONE,[St]:t.SRC_COLOR,[wt]:t.SRC_ALPHA,[Dt]:t.SRC_ALPHA_SATURATE,[Bt]:t.DST_COLOR,[It]:t.DST_ALPHA,[Ct]:t.ONE_MINUS_SRC_COLOR,[Mt]:t.ONE_MINUS_SRC_ALPHA,[Rt]:t.ONE_MINUS_DST_COLOR,[Tt]:t.ONE_MINUS_DST_ALPHA,[Lt]:t.CONSTANT_COLOR,[Pt]:t.ONE_MINUS_CONSTANT_COLOR,[Ft]:t.CONSTANT_ALPHA,[Ut]:t.ONE_MINUS_CONSTANT_ALPHA};function V(e,i,n,r,s,a,o,l,c,h){if(0!==e){if(!1===d&&(Q(t.BLEND),d=!0),5===e)s=s||i,a=a||n,o=o||r,i===A&&s===f||(t.blendEquationSeparate(z[i],z[s]),A=i,f=s),n===g&&r===m&&a===b&&o===v||(t.blendFuncSeparate(H[n],H[r],H[a],H[o]),g=n,m=r,b=a,v=o),!1!==l.equals(y)&&c===x||(t.blendColor(l.r,l.g,l.b,c),y.copy(l),x=c),p=e,_=!1;else if(e!==p||h!==_){if(A===vt&&f===vt||(t.blendEquation(t.FUNC_ADD),A=vt,f=vt),h)switch(e){case 1:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case 2:t.blendFunc(t.ONE,t.ONE);break;case 3:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case 4:t.blendFuncSeparate(t.DST_COLOR,t.ONE_MINUS_SRC_ALPHA,t.ZERO,t.ONE);break;default:en("WebGLState: Invalid blending: ",e)}else switch(e){case 1:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case 2:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE,t.ONE,t.ONE);break;case 3:en("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case 4:en("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:en("WebGLState: Invalid blending: ",e)}g=null,m=null,b=null,v=null,y.set(0,0,0),x=0,p=e,_=h}}else!0===d&&(G(t.BLEND),d=!1)}function q(e){E!==e&&(e?t.frontFace(t.CW):t.frontFace(t.CCW),E=e)}function j(e){0!==e?(Q(t.CULL_FACE),e!==S&&(1===e?t.cullFace(t.BACK):2===e?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):G(t.CULL_FACE),S=e}function W(e,i,r){e?(Q(t.POLYGON_OFFSET_FILL),w===i&&M===r||(w=i,M=r,n.getReversed()&&(i=-i),t.polygonOffset(i,r))):G(t.POLYGON_OFFSET_FILL)}return{buffers:{color:i,depth:n,stencil:r},enable:Q,disable:G,bindFramebuffer:function(e,i){return l[e]!==i&&(t.bindFramebuffer(e,i),l[e]=i,e===t.DRAW_FRAMEBUFFER&&(l[t.FRAMEBUFFER]=i),e===t.FRAMEBUFFER&&(l[t.DRAW_FRAMEBUFFER]=i),!0)},drawBuffers:function(e,i){let n=h,r=!1;if(e){n=c.get(i),void 0===n&&(n=[],c.set(i,n));const s=e.textures;if(n.length!==s.length||n[0]!==t.COLOR_ATTACHMENT0){for(let e=0,i=s.length;e<i;e++)n[e]=t.COLOR_ATTACHMENT0+e;n.length=s.length,r=!0}}else n[0]!==t.BACK&&(n[0]=t.BACK,r=!0);r&&t.drawBuffers(n)},useProgram:function(e){return u!==e&&(t.useProgram(e),u=e,!0)},setBlending:V,setMaterial:function(e,s){2===e.side?G(t.CULL_FACE):Q(t.CULL_FACE);let a=1===e.side;s&&(a=!a),q(a),1===e.blending&&!1===e.transparent?V(0):V(e.blending,e.blendEquation,e.blendSrc,e.blendDst,e.blendEquationAlpha,e.blendSrcAlpha,e.blendDstAlpha,e.blendColor,e.blendAlpha,e.premultipliedAlpha),n.setFunc(e.depthFunc),n.setTest(e.depthTest),n.setMask(e.depthWrite),i.setMask(e.colorWrite);const o=e.stencilWrite;r.setTest(o),o&&(r.setMask(e.stencilWriteMask),r.setFunc(e.stencilFunc,e.stencilRef,e.stencilFuncMask),r.setOp(e.stencilFail,e.stencilZFail,e.stencilZPass)),W(e.polygonOffset,e.polygonOffsetFactor,e.polygonOffsetUnits),!0===e.alphaToCoverage?Q(t.SAMPLE_ALPHA_TO_COVERAGE):G(t.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided:q,setCullFace:j,setLineWidth:function(e){e!==C&&(T&&t.lineWidth(e),C=e)},setPolygonOffset:W,setScissorTest:function(e){e?Q(t.SCISSOR_TEST):G(t.SCISSOR_TEST)},activeTexture:function(e){void 0===e&&(e=t.TEXTURE0+I-1),D!==e&&(t.activeTexture(e),D=e)},bindTexture:function(e,i,n){void 0===n&&(n=null===D?t.TEXTURE0+I-1:D);let r=L[n];void 0===r&&(r={type:void 0,texture:void 0},L[n]=r),r.type===e&&r.texture===i||(D!==n&&(t.activeTexture(n),D=n),t.bindTexture(e,i||k[e]),r.type=e,r.texture=i)},unbindTexture:function(){const e=L[D];void 0!==e&&void 0!==e.type&&(t.bindTexture(e.type,null),e.type=void 0,e.texture=void 0)},compressedTexImage2D:function(){try{t.compressedTexImage2D(...arguments)}catch(t){en("WebGLState:",t)}},compressedTexImage3D:function(){try{t.compressedTexImage3D(...arguments)}catch(t){en("WebGLState:",t)}},texImage2D:function(){try{t.texImage2D(...arguments)}catch(t){en("WebGLState:",t)}},texImage3D:function(){try{t.texImage3D(...arguments)}catch(t){en("WebGLState:",t)}},updateUBOMapping:function(e,i){let n=a.get(i);void 0===n&&(n=new WeakMap,a.set(i,n));let r=n.get(e);void 0===r&&(r=t.getUniformBlockIndex(i,e.name),n.set(e,r))},uniformBlockBinding:function(e,i){const n=a.get(i).get(e);s.get(i)!==n&&(t.uniformBlockBinding(i,n,e.__bindingPointIndex),s.set(i,n))},texStorage2D:function(){try{t.texStorage2D(...arguments)}catch(t){en("WebGLState:",t)}},texStorage3D:function(){try{t.texStorage3D(...arguments)}catch(t){en("WebGLState:",t)}},texSubImage2D:function(){try{t.texSubImage2D(...arguments)}catch(t){en("WebGLState:",t)}},texSubImage3D:function(){try{t.texSubImage3D(...arguments)}catch(t){en("WebGLState:",t)}},compressedTexSubImage2D:function(){try{t.compressedTexSubImage2D(...arguments)}catch(t){en("WebGLState:",t)}},compressedTexSubImage3D:function(){try{t.compressedTexSubImage3D(...arguments)}catch(t){en("WebGLState:",t)}},scissor:function(e){!1===U.equals(e)&&(t.scissor(e.x,e.y,e.z,e.w),U.copy(e))},viewport:function(e){!1===N.equals(e)&&(t.viewport(e.x,e.y,e.z,e.w),N.copy(e))},reset:function(){t.disable(t.BLEND),t.disable(t.CULL_FACE),t.disable(t.DEPTH_TEST),t.disable(t.POLYGON_OFFSET_FILL),t.disable(t.SCISSOR_TEST),t.disable(t.STENCIL_TEST),t.disable(t.SAMPLE_ALPHA_TO_COVERAGE),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ONE,t.ZERO),t.blendFuncSeparate(t.ONE,t.ZERO,t.ONE,t.ZERO),t.blendColor(0,0,0,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(t.LESS),n.setReversed(!1),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(t.ALWAYS,0,4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.clearStencil(0),t.cullFace(t.BACK),t.frontFace(t.CCW),t.polygonOffset(0,0),t.activeTexture(t.TEXTURE0),t.bindFramebuffer(t.FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),o={},D=null,L={},l={},c=new WeakMap,h=[],u=null,d=!1,p=null,A=null,g=null,m=null,f=null,b=null,v=null,y=new Sr(0,0,0),x=0,_=!1,E=null,S=null,C=null,w=null,M=null,U.set(0,0,t.canvas.width,t.canvas.height),N.set(0,0,t.canvas.width,t.canvas.height),i.reset(),n.reset(),r.reset()}}}function bd(t,e,i,n,r,s,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,l="undefined"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),c=new fn,h=new WeakMap;let u;const d=new WeakMap;let p=!1;try{p="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(t){}function A(t,e){return p?new OffscreenCanvas(t,e):Ki("canvas")}function g(t,e,i){let n=1;const r=H(t);if((r.width>i||r.height>i)&&(n=i/Math.max(r.width,r.height)),n<1){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap||"undefined"!=typeof VideoFrame&&t instanceof VideoFrame){const i=Math.floor(n*r.width),s=Math.floor(n*r.height);void 0===u&&(u=A(i,s));const a=e?A(i,s):u;a.width=i,a.height=s;return a.getContext("2d").drawImage(t,0,0,i,s),tn("WebGLRenderer: Texture has been resized from ("+r.width+"x"+r.height+") to ("+i+"x"+s+")."),a}return"data"in t&&tn("WebGLRenderer: Image in DataTexture is too big ("+r.width+"x"+r.height+")."),t}return t}function m(t){return t.generateMipmaps}function f(e){t.generateMipmap(e)}function b(e){return e.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:e.isWebGL3DRenderTarget?t.TEXTURE_3D:e.isWebGLArrayRenderTarget||e.isCompressedArrayTexture?t.TEXTURE_2D_ARRAY:t.TEXTURE_2D}function v(i,n,r,s,a=!1){if(null!==i){if(void 0!==t[i])return t[i];tn("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+i+"'")}let o=n;if(n===t.RED&&(r===t.FLOAT&&(o=t.R32F),r===t.HALF_FLOAT&&(o=t.R16F),r===t.UNSIGNED_BYTE&&(o=t.R8)),n===t.RED_INTEGER&&(r===t.UNSIGNED_BYTE&&(o=t.R8UI),r===t.UNSIGNED_SHORT&&(o=t.R16UI),r===t.UNSIGNED_INT&&(o=t.R32UI),r===t.BYTE&&(o=t.R8I),r===t.SHORT&&(o=t.R16I),r===t.INT&&(o=t.R32I)),n===t.RG&&(r===t.FLOAT&&(o=t.RG32F),r===t.HALF_FLOAT&&(o=t.RG16F),r===t.UNSIGNED_BYTE&&(o=t.RG8)),n===t.RG_INTEGER&&(r===t.UNSIGNED_BYTE&&(o=t.RG8UI),r===t.UNSIGNED_SHORT&&(o=t.RG16UI),r===t.UNSIGNED_INT&&(o=t.RG32UI),r===t.BYTE&&(o=t.RG8I),r===t.SHORT&&(o=t.RG16I),r===t.INT&&(o=t.RG32I)),n===t.RGB_INTEGER&&(r===t.UNSIGNED_BYTE&&(o=t.RGB8UI),r===t.UNSIGNED_SHORT&&(o=t.RGB16UI),r===t.UNSIGNED_INT&&(o=t.RGB32UI),r===t.BYTE&&(o=t.RGB8I),r===t.SHORT&&(o=t.RGB16I),r===t.INT&&(o=t.RGB32I)),n===t.RGBA_INTEGER&&(r===t.UNSIGNED_BYTE&&(o=t.RGBA8UI),r===t.UNSIGNED_SHORT&&(o=t.RGBA16UI),r===t.UNSIGNED_INT&&(o=t.RGBA32UI),r===t.BYTE&&(o=t.RGBA8I),r===t.SHORT&&(o=t.RGBA16I),r===t.INT&&(o=t.RGBA32I)),n===t.RGB&&(r===t.UNSIGNED_INT_5_9_9_9_REV&&(o=t.RGB9_E5),r===t.UNSIGNED_INT_10F_11F_11F_REV&&(o=t.R11F_G11F_B10F)),n===t.RGBA){const e=a?Pi:Mn.getTransfer(s);r===t.FLOAT&&(o=t.RGBA32F),r===t.HALF_FLOAT&&(o=t.RGBA16F),r===t.UNSIGNED_BYTE&&(o=e===Fi?t.SRGB8_ALPHA8:t.RGBA8),r===t.UNSIGNED_SHORT_4_4_4_4&&(o=t.RGBA4),r===t.UNSIGNED_SHORT_5_5_5_1&&(o=t.RGB5_A1)}return o!==t.R16F&&o!==t.R32F&&o!==t.RG16F&&o!==t.RG32F&&o!==t.RGBA16F&&o!==t.RGBA32F||e.get("EXT_color_buffer_float"),o}function y(e,i){let n;return e?null===i||i===_e||i===Me?n=t.DEPTH24_STENCIL8:i===Ee?n=t.DEPTH32F_STENCIL8:i===ye&&(n=t.DEPTH24_STENCIL8,tn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===i||i===_e||i===Me?n=t.DEPTH_COMPONENT24:i===Ee?n=t.DEPTH_COMPONENT32F:i===ye&&(n=t.DEPTH_COMPONENT16),n}function x(t,e){return!0===m(t)||t.isFramebufferTexture&&t.minFilter!==ue&&t.minFilter!==Ae?Math.log2(Math.max(e.width,e.height))+1:void 0!==t.mipmaps&&t.mipmaps.length>0?t.mipmaps.length:t.isCompressedTexture&&Array.isArray(t.image)?e.mipmaps.length:1}function _(t){const e=t.target;e.removeEventListener("dispose",_),function(t){const e=n.get(t);if(void 0===e.__webglInit)return;const i=t.source,r=d.get(i);if(r){const n=r[e.__cacheKey];n.usedTimes--,0===n.usedTimes&&S(t),0===Object.keys(r).length&&d.delete(i)}n.remove(t)}(e),e.isVideoTexture&&h.delete(e)}function E(e){const i=e.target;i.removeEventListener("dispose",E),function(e){const i=n.get(e);e.depthTexture&&(e.depthTexture.dispose(),n.remove(e.depthTexture));if(e.isWebGLCubeRenderTarget)for(let e=0;e<6;e++){if(Array.isArray(i.__webglFramebuffer[e]))for(let n=0;n<i.__webglFramebuffer[e].length;n++)t.deleteFramebuffer(i.__webglFramebuffer[e][n]);else t.deleteFramebuffer(i.__webglFramebuffer[e]);i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer[e])}else{if(Array.isArray(i.__webglFramebuffer))for(let e=0;e<i.__webglFramebuffer.length;e++)t.deleteFramebuffer(i.__webglFramebuffer[e]);else t.deleteFramebuffer(i.__webglFramebuffer);if(i.__webglDepthbuffer&&t.deleteRenderbuffer(i.__webglDepthbuffer),i.__webglMultisampledFramebuffer&&t.deleteFramebuffer(i.__webglMultisampledFramebuffer),i.__webglColorRenderbuffer)for(let e=0;e<i.__webglColorRenderbuffer.length;e++)i.__webglColorRenderbuffer[e]&&t.deleteRenderbuffer(i.__webglColorRenderbuffer[e]);i.__webglDepthRenderbuffer&&t.deleteRenderbuffer(i.__webglDepthRenderbuffer)}const r=e.textures;for(let e=0,i=r.length;e<i;e++){const i=n.get(r[e]);i.__webglTexture&&(t.deleteTexture(i.__webglTexture),a.memory.textures--),n.remove(r[e])}n.remove(e)}(i)}function S(e){const i=n.get(e);t.deleteTexture(i.__webglTexture);const r=e.source;delete d.get(r)[i.__cacheKey],a.memory.textures--}let C=0;function w(e,r){const s=n.get(e);if(e.isVideoTexture&&function(t){const e=a.render.frame;h.get(t)!==e&&(h.set(t,e),t.update())}(e),!1===e.isRenderTargetTexture&&!0!==e.isExternalTexture&&e.version>0&&s.__version!==e.version){const t=e.image;if(null===t)tn("WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==t.complete)return void L(s,e,r);tn("WebGLRenderer: Texture marked for update but image is incomplete")}}else e.isExternalTexture&&(s.__webglTexture=e.sourceTexture?e.sourceTexture:null);i.bindTexture(t.TEXTURE_2D,s.__webglTexture,t.TEXTURE0+r)}const M={[le]:t.REPEAT,[ce]:t.CLAMP_TO_EDGE,[he]:t.MIRRORED_REPEAT},I={[ue]:t.NEAREST,[de]:t.NEAREST_MIPMAP_NEAREST,[pe]:t.NEAREST_MIPMAP_LINEAR,[Ae]:t.LINEAR,[ge]:t.LINEAR_MIPMAP_NEAREST,[me]:t.LINEAR_MIPMAP_LINEAR},T={[Ni]:t.NEVER,[Vi]:t.ALWAYS,[Oi]:t.LESS,[Qi]:t.LEQUAL,[ki]:t.EQUAL,[Hi]:t.GEQUAL,[Gi]:t.GREATER,[zi]:t.NOTEQUAL};function B(i,s){if(s.type!==Ee||!1!==e.has("OES_texture_float_linear")||s.magFilter!==Ae&&s.magFilter!==ge&&s.magFilter!==pe&&s.magFilter!==me&&s.minFilter!==Ae&&s.minFilter!==ge&&s.minFilter!==pe&&s.minFilter!==me||tn("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),t.texParameteri(i,t.TEXTURE_WRAP_S,M[s.wrapS]),t.texParameteri(i,t.TEXTURE_WRAP_T,M[s.wrapT]),i!==t.TEXTURE_3D&&i!==t.TEXTURE_2D_ARRAY||t.texParameteri(i,t.TEXTURE_WRAP_R,M[s.wrapR]),t.texParameteri(i,t.TEXTURE_MAG_FILTER,I[s.magFilter]),t.texParameteri(i,t.TEXTURE_MIN_FILTER,I[s.minFilter]),s.compareFunction&&(t.texParameteri(i,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(i,t.TEXTURE_COMPARE_FUNC,T[s.compareFunction])),!0===e.has("EXT_texture_filter_anisotropic")){if(s.magFilter===ue)return;if(s.minFilter!==pe&&s.minFilter!==me)return;if(s.type===Ee&&!1===e.has("OES_texture_float_linear"))return;if(s.anisotropy>1||n.get(s).__currentAnisotropy){const a=e.get("EXT_texture_filter_anisotropic");t.texParameterf(i,a.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(s.anisotropy,r.getMaxAnisotropy())),n.get(s).__currentAnisotropy=s.anisotropy}}}function R(e,i){let n=!1;void 0===e.__webglInit&&(e.__webglInit=!0,i.addEventListener("dispose",_));const r=i.source;let s=d.get(r);void 0===s&&(s={},d.set(r,s));const o=function(t){const e=[];return e.push(t.wrapS),e.push(t.wrapT),e.push(t.wrapR||0),e.push(t.magFilter),e.push(t.minFilter),e.push(t.anisotropy),e.push(t.internalFormat),e.push(t.format),e.push(t.type),e.push(t.generateMipmaps),e.push(t.premultiplyAlpha),e.push(t.flipY),e.push(t.unpackAlignment),e.push(t.colorSpace),e.join()}(i);if(o!==e.__cacheKey){void 0===s[o]&&(s[o]={texture:t.createTexture(),usedTimes:0},a.memory.textures++,n=!0),s[o].usedTimes++;const r=s[e.__cacheKey];void 0!==r&&(s[e.__cacheKey].usedTimes--,0===r.usedTimes&&S(i)),e.__cacheKey=o,e.__webglTexture=s[o].texture}return n}function D(t,e,i){return Math.floor(Math.floor(t/i)/e)}function L(e,a,o){let l=t.TEXTURE_2D;(a.isDataArrayTexture||a.isCompressedArrayTexture)&&(l=t.TEXTURE_2D_ARRAY),a.isData3DTexture&&(l=t.TEXTURE_3D);const c=R(e,a),h=a.source;i.bindTexture(l,e.__webglTexture,t.TEXTURE0+o);const u=n.get(h);if(h.version!==u.__version||!0===c){i.activeTexture(t.TEXTURE0+o);const e=Mn.getPrimaries(Mn.workingColorSpace),n=a.colorSpace===Ri?null:Mn.getPrimaries(a.colorSpace),d=a.colorSpace===Ri||e===n?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,a.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,a.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,d);let p=g(a.image,!1,r.maxTextureSize);p=z(a,p);const A=s.convert(a.format,a.colorSpace),b=s.convert(a.type);let _,E=v(a.internalFormat,A,b,a.colorSpace,a.isVideoTexture);B(l,a);const S=a.mipmaps,C=!0!==a.isVideoTexture,w=void 0===u.__version||!0===c,M=h.dataReady,I=x(a,p);if(a.isDepthTexture)E=y(a.format===Le,a.type),w&&(C?i.texStorage2D(t.TEXTURE_2D,1,E,p.width,p.height):i.texImage2D(t.TEXTURE_2D,0,E,p.width,p.height,0,A,b,null));else if(a.isDataTexture)if(S.length>0){C&&w&&i.texStorage2D(t.TEXTURE_2D,I,E,S[0].width,S[0].height);for(let e=0,n=S.length;e<n;e++)_=S[e],C?M&&i.texSubImage2D(t.TEXTURE_2D,e,0,0,_.width,_.height,A,b,_.data):i.texImage2D(t.TEXTURE_2D,e,E,_.width,_.height,0,A,b,_.data);a.generateMipmaps=!1}else C?(w&&i.texStorage2D(t.TEXTURE_2D,I,E,p.width,p.height),M&&function(e,n,r,s){const a=e.updateRanges;if(0===a.length)i.texSubImage2D(t.TEXTURE_2D,0,0,0,n.width,n.height,r,s,n.data);else{a.sort((t,e)=>t.start-e.start);let o=0;for(let t=1;t<a.length;t++){const e=a[o],i=a[t],r=e.start+e.count,s=D(i.start,n.width,4),l=D(e.start,n.width,4);i.start<=r+1&&s===l&&D(i.start+i.count-1,n.width,4)===s?e.count=Math.max(e.count,i.start+i.count-e.start):(++o,a[o]=i)}a.length=o+1;const l=t.getParameter(t.UNPACK_ROW_LENGTH),c=t.getParameter(t.UNPACK_SKIP_PIXELS),h=t.getParameter(t.UNPACK_SKIP_ROWS);t.pixelStorei(t.UNPACK_ROW_LENGTH,n.width);for(let e=0,o=a.length;e<o;e++){const o=a[e],l=Math.floor(o.start/4),c=Math.ceil(o.count/4),h=l%n.width,u=Math.floor(l/n.width),d=c,p=1;t.pixelStorei(t.UNPACK_SKIP_PIXELS,h),t.pixelStorei(t.UNPACK_SKIP_ROWS,u),i.texSubImage2D(t.TEXTURE_2D,0,h,u,d,p,r,s,n.data)}e.clearUpdateRanges(),t.pixelStorei(t.UNPACK_ROW_LENGTH,l),t.pixelStorei(t.UNPACK_SKIP_PIXELS,c),t.pixelStorei(t.UNPACK_SKIP_ROWS,h)}}(a,p,A,b)):i.texImage2D(t.TEXTURE_2D,0,E,p.width,p.height,0,A,b,p.data);else if(a.isCompressedTexture)if(a.isCompressedArrayTexture){C&&w&&i.texStorage3D(t.TEXTURE_2D_ARRAY,I,E,S[0].width,S[0].height,p.depth);for(let e=0,n=S.length;e<n;e++)if(_=S[e],a.format!==Re)if(null!==A)if(C){if(M)if(a.layerUpdates.size>0){const n=Fc(_.width,_.height,a.format,a.type);for(const r of a.layerUpdates){const s=_.data.subarray(r*n/_.data.BYTES_PER_ELEMENT,(r+1)*n/_.data.BYTES_PER_ELEMENT);i.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,e,0,0,r,_.width,_.height,1,A,s)}a.clearLayerUpdates()}else i.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,e,0,0,0,_.width,_.height,p.depth,A,_.data)}else i.compressedTexImage3D(t.TEXTURE_2D_ARRAY,e,E,_.width,_.height,p.depth,0,_.data,0,0);else tn("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else C?M&&i.texSubImage3D(t.TEXTURE_2D_ARRAY,e,0,0,0,_.width,_.height,p.depth,A,b,_.data):i.texImage3D(t.TEXTURE_2D_ARRAY,e,E,_.width,_.height,p.depth,0,A,b,_.data)}else{C&&w&&i.texStorage2D(t.TEXTURE_2D,I,E,S[0].width,S[0].height);for(let e=0,n=S.length;e<n;e++)_=S[e],a.format!==Re?null!==A?C?M&&i.compressedTexSubImage2D(t.TEXTURE_2D,e,0,0,_.width,_.height,A,_.data):i.compressedTexImage2D(t.TEXTURE_2D,e,E,_.width,_.height,0,_.data):tn("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):C?M&&i.texSubImage2D(t.TEXTURE_2D,e,0,0,_.width,_.height,A,b,_.data):i.texImage2D(t.TEXTURE_2D,e,E,_.width,_.height,0,A,b,_.data)}else if(a.isDataArrayTexture)if(C){if(w&&i.texStorage3D(t.TEXTURE_2D_ARRAY,I,E,p.width,p.height,p.depth),M)if(a.layerUpdates.size>0){const e=Fc(p.width,p.height,a.format,a.type);for(const n of a.layerUpdates){const r=p.data.subarray(n*e/p.data.BYTES_PER_ELEMENT,(n+1)*e/p.data.BYTES_PER_ELEMENT);i.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,n,p.width,p.height,1,A,b,r)}a.clearLayerUpdates()}else i.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,p.width,p.height,p.depth,A,b,p.data)}else i.texImage3D(t.TEXTURE_2D_ARRAY,0,E,p.width,p.height,p.depth,0,A,b,p.data);else if(a.isData3DTexture)C?(w&&i.texStorage3D(t.TEXTURE_3D,I,E,p.width,p.height,p.depth),M&&i.texSubImage3D(t.TEXTURE_3D,0,0,0,0,p.width,p.height,p.depth,A,b,p.data)):i.texImage3D(t.TEXTURE_3D,0,E,p.width,p.height,p.depth,0,A,b,p.data);else if(a.isFramebufferTexture){if(w)if(C)i.texStorage2D(t.TEXTURE_2D,I,E,p.width,p.height);else{let e=p.width,n=p.height;for(let r=0;r<I;r++)i.texImage2D(t.TEXTURE_2D,r,E,e,n,0,A,b,null),e>>=1,n>>=1}}else if(S.length>0){if(C&&w){const e=H(S[0]);i.texStorage2D(t.TEXTURE_2D,I,E,e.width,e.height)}for(let e=0,n=S.length;e<n;e++)_=S[e],C?M&&i.texSubImage2D(t.TEXTURE_2D,e,0,0,A,b,_):i.texImage2D(t.TEXTURE_2D,e,E,A,b,_);a.generateMipmaps=!1}else if(C){if(w){const e=H(p);i.texStorage2D(t.TEXTURE_2D,I,E,e.width,e.height)}M&&i.texSubImage2D(t.TEXTURE_2D,0,0,0,A,b,p)}else i.texImage2D(t.TEXTURE_2D,0,E,A,b,p);m(a)&&f(l),u.__version=h.version,a.onUpdate&&a.onUpdate(a)}e.__version=a.version}function P(e,r,a,l,c,h){const u=s.convert(a.format,a.colorSpace),d=s.convert(a.type),p=v(a.internalFormat,u,d,a.colorSpace),A=n.get(r),g=n.get(a);if(g.__renderTarget=r,!A.__hasExternalTextures){const e=Math.max(1,r.width>>h),n=Math.max(1,r.height>>h);c===t.TEXTURE_3D||c===t.TEXTURE_2D_ARRAY?i.texImage3D(c,h,p,e,n,r.depth,0,u,d,null):i.texImage2D(c,h,p,e,n,0,u,d,null)}i.bindFramebuffer(t.FRAMEBUFFER,e),G(r)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,l,c,g.__webglTexture,0,Q(r)):(c===t.TEXTURE_2D||c>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&c<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,l,c,g.__webglTexture,h),i.bindFramebuffer(t.FRAMEBUFFER,null)}function F(e,i,n){if(t.bindRenderbuffer(t.RENDERBUFFER,e),i.depthBuffer){const r=i.depthTexture,s=r&&r.isDepthTexture?r.type:null,a=y(i.stencilBuffer,s),l=i.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;G(i)?o.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,Q(i),a,i.width,i.height):n?t.renderbufferStorageMultisample(t.RENDERBUFFER,Q(i),a,i.width,i.height):t.renderbufferStorage(t.RENDERBUFFER,a,i.width,i.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,l,t.RENDERBUFFER,e)}else{const e=i.textures;for(let r=0;r<e.length;r++){const a=e[r],l=s.convert(a.format,a.colorSpace),c=s.convert(a.type),h=v(a.internalFormat,l,c,a.colorSpace);G(i)?o.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,Q(i),h,i.width,i.height):n?t.renderbufferStorageMultisample(t.RENDERBUFFER,Q(i),h,i.width,i.height):t.renderbufferStorage(t.RENDERBUFFER,h,i.width,i.height)}}t.bindRenderbuffer(t.RENDERBUFFER,null)}function U(e,r,a){const l=!0===r.isWebGLCubeRenderTarget;if(i.bindFramebuffer(t.FRAMEBUFFER,e),!r.depthTexture||!r.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const c=n.get(r.depthTexture);if(c.__renderTarget=r,c.__webglTexture&&r.depthTexture.image.width===r.width&&r.depthTexture.image.height===r.height||(r.depthTexture.image.width=r.width,r.depthTexture.image.height=r.height,r.depthTexture.needsUpdate=!0),l){if(void 0===c.__webglInit&&(c.__webglInit=!0,r.depthTexture.addEventListener("dispose",_)),void 0===c.__webglTexture){c.__webglTexture=t.createTexture(),i.bindTexture(t.TEXTURE_CUBE_MAP,c.__webglTexture),B(t.TEXTURE_CUBE_MAP,r.depthTexture);const e=s.convert(r.depthTexture.format),n=s.convert(r.depthTexture.type);let a;r.depthTexture.format===De?a=t.DEPTH_COMPONENT24:r.depthTexture.format===Le&&(a=t.DEPTH24_STENCIL8);for(let i=0;i<6;i++)t.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+i,0,a,r.width,r.height,0,e,n,null)}}else w(r.depthTexture,0);const h=c.__webglTexture,u=Q(r),d=l?t.TEXTURE_CUBE_MAP_POSITIVE_X+a:t.TEXTURE_2D,p=r.depthTexture.format===Le?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;if(r.depthTexture.format===De)G(r)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,p,d,h,0,u):t.framebufferTexture2D(t.FRAMEBUFFER,p,d,h,0);else{if(r.depthTexture.format!==Le)throw new Error("Unknown depthTexture format");G(r)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,p,d,h,0,u):t.framebufferTexture2D(t.FRAMEBUFFER,p,d,h,0)}}function N(e){const r=n.get(e),s=!0===e.isWebGLCubeRenderTarget;if(r.__boundDepthTexture!==e.depthTexture){const t=e.depthTexture;if(r.__depthDisposeCallback&&r.__depthDisposeCallback(),t){const e=()=>{delete r.__boundDepthTexture,delete r.__depthDisposeCallback,t.removeEventListener("dispose",e)};t.addEventListener("dispose",e),r.__depthDisposeCallback=e}r.__boundDepthTexture=t}if(e.depthTexture&&!r.__autoAllocateDepthBuffer)if(s)for(let t=0;t<6;t++)U(r.__webglFramebuffer[t],e,t);else{const t=e.texture.mipmaps;t&&t.length>0?U(r.__webglFramebuffer[0],e,0):U(r.__webglFramebuffer,e,0)}else if(s){r.__webglDepthbuffer=[];for(let n=0;n<6;n++)if(i.bindFramebuffer(t.FRAMEBUFFER,r.__webglFramebuffer[n]),void 0===r.__webglDepthbuffer[n])r.__webglDepthbuffer[n]=t.createRenderbuffer(),F(r.__webglDepthbuffer[n],e,!1);else{const i=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,s=r.__webglDepthbuffer[n];t.bindRenderbuffer(t.RENDERBUFFER,s),t.framebufferRenderbuffer(t.FRAMEBUFFER,i,t.RENDERBUFFER,s)}}else{const n=e.texture.mipmaps;if(n&&n.length>0?i.bindFramebuffer(t.FRAMEBUFFER,r.__webglFramebuffer[0]):i.bindFramebuffer(t.FRAMEBUFFER,r.__webglFramebuffer),void 0===r.__webglDepthbuffer)r.__webglDepthbuffer=t.createRenderbuffer(),F(r.__webglDepthbuffer,e,!1);else{const i=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,n=r.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,n),t.framebufferRenderbuffer(t.FRAMEBUFFER,i,t.RENDERBUFFER,n)}}i.bindFramebuffer(t.FRAMEBUFFER,null)}const O=[],k=[];function Q(t){return Math.min(r.maxSamples,t.samples)}function G(t){const i=n.get(t);return t.samples>0&&!0===e.has("WEBGL_multisampled_render_to_texture")&&!1!==i.__useRenderToTexture}function z(t,e){const i=t.colorSpace,n=t.format,r=t.type;return!0===t.isCompressedTexture||!0===t.isVideoTexture||i!==Li&&i!==Ri&&(Mn.getTransfer(i)===Fi?n===Re&&r===fe||tn("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):en("WebGLTextures: Unsupported texture color space:",i)),e}function H(t){return"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement?(c.width=t.naturalWidth||t.width,c.height=t.naturalHeight||t.height):"undefined"!=typeof VideoFrame&&t instanceof VideoFrame?(c.width=t.displayWidth,c.height=t.displayHeight):(c.width=t.width,c.height=t.height),c}this.allocateTextureUnit=function(){const t=C;return t>=r.maxTextures&&tn("WebGLTextures: Trying to use "+t+" texture units while this GPU supports only "+r.maxTextures),C+=1,t},this.resetTextureUnits=function(){C=0},this.setTexture2D=w,this.setTexture2DArray=function(e,r){const s=n.get(e);!1===e.isRenderTargetTexture&&e.version>0&&s.__version!==e.version?L(s,e,r):(e.isExternalTexture&&(s.__webglTexture=e.sourceTexture?e.sourceTexture:null),i.bindTexture(t.TEXTURE_2D_ARRAY,s.__webglTexture,t.TEXTURE0+r))},this.setTexture3D=function(e,r){const s=n.get(e);!1===e.isRenderTargetTexture&&e.version>0&&s.__version!==e.version?L(s,e,r):i.bindTexture(t.TEXTURE_3D,s.__webglTexture,t.TEXTURE0+r)},this.setTextureCube=function(e,a){const o=n.get(e);!0!==e.isCubeDepthTexture&&e.version>0&&o.__version!==e.version?function(e,a,o){if(6!==a.image.length)return;const l=R(e,a),c=a.source;i.bindTexture(t.TEXTURE_CUBE_MAP,e.__webglTexture,t.TEXTURE0+o);const h=n.get(c);if(c.version!==h.__version||!0===l){i.activeTexture(t.TEXTURE0+o);const e=Mn.getPrimaries(Mn.workingColorSpace),n=a.colorSpace===Ri?null:Mn.getPrimaries(a.colorSpace),u=a.colorSpace===Ri||e===n?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,a.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,a.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,a.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,u);const d=a.isCompressedTexture||a.image[0].isCompressedTexture,p=a.image[0]&&a.image[0].isDataTexture,A=[];for(let t=0;t<6;t++)A[t]=d||p?p?a.image[t].image:a.image[t]:g(a.image[t],!0,r.maxCubemapSize),A[t]=z(a,A[t]);const b=A[0],y=s.convert(a.format,a.colorSpace),_=s.convert(a.type),E=v(a.internalFormat,y,_,a.colorSpace),S=!0!==a.isVideoTexture,C=void 0===h.__version||!0===l,w=c.dataReady;let M,I=x(a,b);if(B(t.TEXTURE_CUBE_MAP,a),d){S&&C&&i.texStorage2D(t.TEXTURE_CUBE_MAP,I,E,b.width,b.height);for(let e=0;e<6;e++){M=A[e].mipmaps;for(let n=0;n<M.length;n++){const r=M[n];a.format!==Re?null!==y?S?w&&i.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,0,0,r.width,r.height,y,r.data):i.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,E,r.width,r.height,0,r.data):tn("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):S?w&&i.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,0,0,r.width,r.height,y,_,r.data):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n,E,r.width,r.height,0,y,_,r.data)}}}else{if(M=a.mipmaps,S&&C){M.length>0&&I++;const e=H(A[0]);i.texStorage2D(t.TEXTURE_CUBE_MAP,I,E,e.width,e.height)}for(let e=0;e<6;e++)if(p){S?w&&i.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,A[e].width,A[e].height,y,_,A[e].data):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,E,A[e].width,A[e].height,0,y,_,A[e].data);for(let n=0;n<M.length;n++){const r=M[n].image[e].image;S?w&&i.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n+1,0,0,r.width,r.height,y,_,r.data):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n+1,E,r.width,r.height,0,y,_,r.data)}}else{S?w&&i.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,0,0,y,_,A[e]):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,0,E,y,_,A[e]);for(let n=0;n<M.length;n++){const r=M[n];S?w&&i.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n+1,0,0,y,_,r.image[e]):i.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+e,n+1,E,y,_,r.image[e])}}}m(a)&&f(t.TEXTURE_CUBE_MAP),h.__version=c.version,a.onUpdate&&a.onUpdate(a)}e.__version=a.version}(o,e,a):i.bindTexture(t.TEXTURE_CUBE_MAP,o.__webglTexture,t.TEXTURE0+a)},this.rebindTextures=function(e,i,r){const s=n.get(e);void 0!==i&&P(s.__webglFramebuffer,e,e.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),void 0!==r&&N(e)},this.setupRenderTarget=function(e){const r=e.texture,o=n.get(e),l=n.get(r);e.addEventListener("dispose",E);const c=e.textures,h=!0===e.isWebGLCubeRenderTarget,u=c.length>1;if(u||(void 0===l.__webglTexture&&(l.__webglTexture=t.createTexture()),l.__version=r.version,a.memory.textures++),h){o.__webglFramebuffer=[];for(let e=0;e<6;e++)if(r.mipmaps&&r.mipmaps.length>0){o.__webglFramebuffer[e]=[];for(let i=0;i<r.mipmaps.length;i++)o.__webglFramebuffer[e][i]=t.createFramebuffer()}else o.__webglFramebuffer[e]=t.createFramebuffer()}else{if(r.mipmaps&&r.mipmaps.length>0){o.__webglFramebuffer=[];for(let e=0;e<r.mipmaps.length;e++)o.__webglFramebuffer[e]=t.createFramebuffer()}else o.__webglFramebuffer=t.createFramebuffer();if(u)for(let e=0,i=c.length;e<i;e++){const i=n.get(c[e]);void 0===i.__webglTexture&&(i.__webglTexture=t.createTexture(),a.memory.textures++)}if(e.samples>0&&!1===G(e)){o.__webglMultisampledFramebuffer=t.createFramebuffer(),o.__webglColorRenderbuffer=[],i.bindFramebuffer(t.FRAMEBUFFER,o.__webglMultisampledFramebuffer);for(let i=0;i<c.length;i++){const n=c[i];o.__webglColorRenderbuffer[i]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,o.__webglColorRenderbuffer[i]);const r=s.convert(n.format,n.colorSpace),a=s.convert(n.type),l=v(n.internalFormat,r,a,n.colorSpace,!0===e.isXRRenderTarget),h=Q(e);t.renderbufferStorageMultisample(t.RENDERBUFFER,h,l,e.width,e.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+i,t.RENDERBUFFER,o.__webglColorRenderbuffer[i])}t.bindRenderbuffer(t.RENDERBUFFER,null),e.depthBuffer&&(o.__webglDepthRenderbuffer=t.createRenderbuffer(),F(o.__webglDepthRenderbuffer,e,!0)),i.bindFramebuffer(t.FRAMEBUFFER,null)}}if(h){i.bindTexture(t.TEXTURE_CUBE_MAP,l.__webglTexture),B(t.TEXTURE_CUBE_MAP,r);for(let i=0;i<6;i++)if(r.mipmaps&&r.mipmaps.length>0)for(let n=0;n<r.mipmaps.length;n++)P(o.__webglFramebuffer[i][n],e,r,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+i,n);else P(o.__webglFramebuffer[i],e,r,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+i,0);m(r)&&f(t.TEXTURE_CUBE_MAP),i.unbindTexture()}else if(u){for(let r=0,s=c.length;r<s;r++){const s=c[r],a=n.get(s);let l=t.TEXTURE_2D;(e.isWebGL3DRenderTarget||e.isWebGLArrayRenderTarget)&&(l=e.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),i.bindTexture(l,a.__webglTexture),B(l,s),P(o.__webglFramebuffer,e,s,t.COLOR_ATTACHMENT0+r,l,0),m(s)&&f(l)}i.unbindTexture()}else{let n=t.TEXTURE_2D;if((e.isWebGL3DRenderTarget||e.isWebGLArrayRenderTarget)&&(n=e.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),i.bindTexture(n,l.__webglTexture),B(n,r),r.mipmaps&&r.mipmaps.length>0)for(let i=0;i<r.mipmaps.length;i++)P(o.__webglFramebuffer[i],e,r,t.COLOR_ATTACHMENT0,n,i);else P(o.__webglFramebuffer,e,r,t.COLOR_ATTACHMENT0,n,0);m(r)&&f(n),i.unbindTexture()}e.depthBuffer&&N(e)},this.updateRenderTargetMipmap=function(t){const e=t.textures;for(let r=0,s=e.length;r<s;r++){const s=e[r];if(m(s)){const e=b(t),r=n.get(s).__webglTexture;i.bindTexture(e,r),f(e),i.unbindTexture()}}},this.updateMultisampleRenderTarget=function(e){if(e.samples>0)if(!1===G(e)){const r=e.textures,s=e.width,a=e.height;let o=t.COLOR_BUFFER_BIT;const c=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,h=n.get(e),u=r.length>1;if(u)for(let e=0;e<r.length;e++)i.bindFramebuffer(t.FRAMEBUFFER,h.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.RENDERBUFFER,null),i.bindFramebuffer(t.FRAMEBUFFER,h.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.TEXTURE_2D,null,0);i.bindFramebuffer(t.READ_FRAMEBUFFER,h.__webglMultisampledFramebuffer);const d=e.texture.mipmaps;d&&d.length>0?i.bindFramebuffer(t.DRAW_FRAMEBUFFER,h.__webglFramebuffer[0]):i.bindFramebuffer(t.DRAW_FRAMEBUFFER,h.__webglFramebuffer);for(let i=0;i<r.length;i++){if(e.resolveDepthBuffer&&(e.depthBuffer&&(o|=t.DEPTH_BUFFER_BIT),e.stencilBuffer&&e.resolveStencilBuffer&&(o|=t.STENCIL_BUFFER_BIT)),u){t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,h.__webglColorRenderbuffer[i]);const e=n.get(r[i]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e,0)}t.blitFramebuffer(0,0,s,a,0,0,s,a,o,t.NEAREST),!0===l&&(O.length=0,k.length=0,O.push(t.COLOR_ATTACHMENT0+i),e.depthBuffer&&!1===e.resolveDepthBuffer&&(O.push(c),k.push(c),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,k)),t.invalidateFramebuffer(t.READ_FRAMEBUFFER,O))}if(i.bindFramebuffer(t.READ_FRAMEBUFFER,null),i.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),u)for(let e=0;e<r.length;e++){i.bindFramebuffer(t.FRAMEBUFFER,h.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.RENDERBUFFER,h.__webglColorRenderbuffer[e]);const s=n.get(r[e]).__webglTexture;i.bindFramebuffer(t.FRAMEBUFFER,h.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+e,t.TEXTURE_2D,s,0)}i.bindFramebuffer(t.DRAW_FRAMEBUFFER,h.__webglMultisampledFramebuffer)}else if(e.depthBuffer&&!1===e.resolveDepthBuffer&&l){const i=e.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[i])}},this.setupDepthRenderbuffer=N,this.setupFrameBufferTexture=P,this.useMultisampledRTT=G,this.isReversedDepthBuffer=function(){return i.buffers.depth.getReversed()}}function vd(t,e){return{convert:function(i,n=""){let r;const s=Mn.getTransfer(n);if(i===fe)return t.UNSIGNED_BYTE;if(i===Ce)return t.UNSIGNED_SHORT_4_4_4_4;if(i===we)return t.UNSIGNED_SHORT_5_5_5_1;if(i===Ie)return t.UNSIGNED_INT_5_9_9_9_REV;if(i===Te)return t.UNSIGNED_INT_10F_11F_11F_REV;if(i===be)return t.BYTE;if(i===ve)return t.SHORT;if(i===ye)return t.UNSIGNED_SHORT;if(i===xe)return t.INT;if(i===_e)return t.UNSIGNED_INT;if(i===Ee)return t.FLOAT;if(i===Se)return t.HALF_FLOAT;if(1021===i)return t.ALPHA;if(i===Be)return t.RGB;if(i===Re)return t.RGBA;if(i===De)return t.DEPTH_COMPONENT;if(i===Le)return t.DEPTH_STENCIL;if(i===Pe)return t.RED;if(i===Fe)return t.RED_INTEGER;if(i===Ue)return t.RG;if(i===Ne)return t.RG_INTEGER;if(i===Oe)return t.RGBA_INTEGER;if(i===ke||i===Qe||i===Ge||i===ze)if(s===Fi){if(r=e.get("WEBGL_compressed_texture_s3tc_srgb"),null===r)return null;if(i===ke)return r.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===Qe)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===Ge)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===ze)return r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(r=e.get("WEBGL_compressed_texture_s3tc"),null===r)return null;if(i===ke)return r.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===Qe)return r.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===Ge)return r.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===ze)return r.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(i===He||i===Ve||i===qe||i===je){if(r=e.get("WEBGL_compressed_texture_pvrtc"),null===r)return null;if(i===He)return r.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===Ve)return r.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===qe)return r.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===je)return r.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(i===We||i===Xe||i===Ke||i===Je||i===Ye||i===$e||i===Ze){if(r=e.get("WEBGL_compressed_texture_etc"),null===r)return null;if(i===We||i===Xe)return s===Fi?r.COMPRESSED_SRGB8_ETC2:r.COMPRESSED_RGB8_ETC2;if(i===Ke)return s===Fi?r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:r.COMPRESSED_RGBA8_ETC2_EAC;if(i===Je)return r.COMPRESSED_R11_EAC;if(i===Ye)return r.COMPRESSED_SIGNED_R11_EAC;if(i===$e)return r.COMPRESSED_RG11_EAC;if(i===Ze)return r.COMPRESSED_SIGNED_RG11_EAC}if(i===ti||i===ei||i===ii||i===ni||i===ri||i===si||i===ai||i===oi||i===li||i===ci||i===hi||i===ui||i===di||i===pi){if(r=e.get("WEBGL_compressed_texture_astc"),null===r)return null;if(i===ti)return s===Fi?r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:r.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===ei)return s===Fi?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:r.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===ii)return s===Fi?r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:r.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===ni)return s===Fi?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:r.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===ri)return s===Fi?r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:r.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===si)return s===Fi?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:r.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===ai)return s===Fi?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:r.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===oi)return s===Fi?r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:r.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===li)return s===Fi?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:r.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===ci)return s===Fi?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:r.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===hi)return s===Fi?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:r.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===ui)return s===Fi?r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:r.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===di)return s===Fi?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:r.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===pi)return s===Fi?r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:r.COMPRESSED_RGBA_ASTC_12x12_KHR}if(i===Ai||i===gi||i===mi){if(r=e.get("EXT_texture_compression_bptc"),null===r)return null;if(i===Ai)return s===Fi?r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:r.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===gi)return r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===mi)return r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(i===fi||i===bi||i===vi||i===yi){if(r=e.get("EXT_texture_compression_rgtc"),null===r)return null;if(i===fi)return r.COMPRESSED_RED_RGTC1_EXT;if(i===bi)return r.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===vi)return r.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===yi)return r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return i===Me?t.UNSIGNED_INT_24_8:void 0!==t[i]?t[i]:null}}}class yd{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e){if(null===this.texture){const i=new ro(t.texture);t.depthNear===e.depthNear&&t.depthFar===e.depthFar||(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=i}}getMesh(t){if(null!==this.texture&&null===this.mesh){const e=t.cameras[0].viewport,i=new ll({vertexShader:"\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}",fragmentShader:"\nuniform sampler2DArray depthColor;\nuniform float depthWidth;\nuniform float depthHeight;\n\nvoid main() {\n\n\tvec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\n\n\tif ( coord.x >= 1.0 ) {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n\t} else {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n\t}\n\n}",uniforms:{depthColor:{value:this.texture},depthWidth:{value:e.z},depthHeight:{value:e.w}}});this.mesh=new Ks(new el(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class xd extends sn{constructor(t,e){super();const i=this;let n=null,r=1,s=null,a="local-floor",o=1,l=null,c=null,h=null,u=null,d=null,p=null;const A="undefined"!=typeof XRWebGLBinding,g=new yd,m={},f=e.getContextAttributes();let b=null,v=null;const y=[],x=[],_=new fn;let E=null;const S=new nc;S.viewport=new On;const C=new nc;C.viewport=new On;const w=[S,C],M=new bc;let I=null,T=null;function B(t){const e=x.indexOf(t.inputSource);if(-1===e)return;const i=y[e];void 0!==i&&(i.update(t.inputSource,t.frame,l||s),i.dispatchEvent({type:t.type,data:t.inputSource}))}function R(){n.removeEventListener("select",B),n.removeEventListener("selectstart",B),n.removeEventListener("selectend",B),n.removeEventListener("squeeze",B),n.removeEventListener("squeezestart",B),n.removeEventListener("squeezeend",B),n.removeEventListener("end",R),n.removeEventListener("inputsourceschange",D);for(let t=0;t<y.length;t++){const e=x[t];null!==e&&(x[t]=null,y[t].disconnect(e))}I=null,T=null,g.reset();for(const t in m)delete m[t];t.setRenderTarget(b),d=null,u=null,h=null,n=null,v=null,N.stop(),i.isPresenting=!1,t.setPixelRatio(E),t.setSize(_.width,_.height,!1),i.dispatchEvent({type:"sessionend"})}function D(t){for(let e=0;e<t.removed.length;e++){const i=t.removed[e],n=x.indexOf(i);n>=0&&(x[n]=null,y[n].disconnect(i))}for(let e=0;e<t.added.length;e++){const i=t.added[e];let n=x.indexOf(i);if(-1===n){for(let t=0;t<y.length;t++){if(t>=x.length){x.push(i),n=t;break}if(null===x[t]){x[t]=i,n=t;break}}if(-1===n)break}const r=y[n];r&&r.connect(i)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(t){let e=y[t];return void 0===e&&(e=new vr,y[t]=e),e.getTargetRaySpace()},this.getControllerGrip=function(t){let e=y[t];return void 0===e&&(e=new vr,y[t]=e),e.getGripSpace()},this.getHand=function(t){let e=y[t];return void 0===e&&(e=new vr,y[t]=e),e.getHandSpace()},this.setFramebufferScaleFactor=function(t){r=t,!0===i.isPresenting&&tn("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(t){a=t,!0===i.isPresenting&&tn("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||s},this.setReferenceSpace=function(t){l=t},this.getBaseLayer=function(){return null!==u?u:d},this.getBinding=function(){return null===h&&A&&(h=new XRWebGLBinding(n,e)),h},this.getFrame=function(){return p},this.getSession=function(){return n},this.setSession=async function(c){if(n=c,null!==n){b=t.getRenderTarget(),n.addEventListener("select",B),n.addEventListener("selectstart",B),n.addEventListener("selectend",B),n.addEventListener("squeeze",B),n.addEventListener("squeezestart",B),n.addEventListener("squeezeend",B),n.addEventListener("end",R),n.addEventListener("inputsourceschange",D),!0!==f.xrCompatible&&await e.makeXRCompatible(),E=t.getPixelRatio(),t.getSize(_);if(A&&"createProjectionLayer"in XRWebGLBinding.prototype){let i=null,s=null,a=null;f.depth&&(a=f.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,i=f.stencil?Le:De,s=f.stencil?Me:_e);const o={colorFormat:e.RGBA8,depthFormat:a,scaleFactor:r};h=this.getBinding(),u=h.createProjectionLayer(o),n.updateRenderState({layers:[u]}),t.setPixelRatio(1),t.setSize(u.textureWidth,u.textureHeight,!1),v=new Qn(u.textureWidth,u.textureHeight,{format:Re,type:fe,depthTexture:new io(u.textureWidth,u.textureHeight,s,void 0,void 0,void 0,void 0,void 0,void 0,i),stencilBuffer:f.stencil,colorSpace:t.outputColorSpace,samples:f.antialias?4:0,resolveDepthBuffer:!1===u.ignoreDepthValues,resolveStencilBuffer:!1===u.ignoreDepthValues})}else{const i={antialias:f.antialias,alpha:!0,depth:f.depth,stencil:f.stencil,framebufferScaleFactor:r};d=new XRWebGLLayer(n,e,i),n.updateRenderState({baseLayer:d}),t.setPixelRatio(1),t.setSize(d.framebufferWidth,d.framebufferHeight,!1),v=new Qn(d.framebufferWidth,d.framebufferHeight,{format:Re,type:fe,colorSpace:t.outputColorSpace,stencilBuffer:f.stencil,resolveDepthBuffer:!1===d.ignoreDepthValues,resolveStencilBuffer:!1===d.ignoreDepthValues})}v.isXRRenderTarget=!0,this.setFoveation(o),l=null,s=await n.requestReferenceSpace(a),N.setContext(n),N.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==n)return n.environmentBlendMode},this.getDepthTexture=function(){return g.getDepthTexture()};const L=new vn,P=new vn;function F(t,e){null===e?t.matrixWorld.copy(t.matrix):t.matrixWorld.multiplyMatrices(e.matrixWorld,t.matrix),t.matrixWorldInverse.copy(t.matrixWorld).invert()}this.updateCamera=function(t){if(null===n)return;let e=t.near,i=t.far;null!==g.texture&&(g.depthNear>0&&(e=g.depthNear),g.depthFar>0&&(i=g.depthFar)),M.near=C.near=S.near=e,M.far=C.far=S.far=i,I===M.near&&T===M.far||(n.updateRenderState({depthNear:M.near,depthFar:M.far}),I=M.near,T=M.far),M.layers.mask=6|t.layers.mask,S.layers.mask=-5&M.layers.mask,C.layers.mask=-3&M.layers.mask;const r=t.parent,s=M.cameras;F(M,r);for(let t=0;t<s.length;t++)F(s[t],r);2===s.length?function(t,e,i){L.setFromMatrixPosition(e.matrixWorld),P.setFromMatrixPosition(i.matrixWorld);const n=L.distanceTo(P),r=e.projectionMatrix.elements,s=i.projectionMatrix.elements,a=r[14]/(r[10]-1),o=r[14]/(r[10]+1),l=(r[9]+1)/r[5],c=(r[9]-1)/r[5],h=(r[8]-1)/r[0],u=(s[8]+1)/s[0],d=a*h,p=a*u,A=n/(-h+u),g=A*-h;if(e.matrixWorld.decompose(t.position,t.quaternion,t.scale),t.translateX(g),t.translateZ(A),t.matrixWorld.compose(t.position,t.quaternion,t.scale),t.matrixWorldInverse.copy(t.matrixWorld).invert(),-1===r[10])t.projectionMatrix.copy(e.projectionMatrix),t.projectionMatrixInverse.copy(e.projectionMatrixInverse);else{const e=a+A,i=o+A,r=d-g,s=p+(n-g),h=l*o/i*e,u=c*o/i*e;t.projectionMatrix.makePerspective(r,s,h,u,e,i),t.projectionMatrixInverse.copy(t.projectionMatrix).invert()}}(M,S,C):M.projectionMatrix.copy(S.projectionMatrix),function(t,e,i){null===i?t.matrix.copy(e.matrixWorld):(t.matrix.copy(i.matrixWorld),t.matrix.invert(),t.matrix.multiply(e.matrixWorld));t.matrix.decompose(t.position,t.quaternion,t.scale),t.updateMatrixWorld(!0),t.projectionMatrix.copy(e.projectionMatrix),t.projectionMatrixInverse.copy(e.projectionMatrixInverse),t.isPerspectiveCamera&&(t.fov=2*cn*Math.atan(1/t.projectionMatrix.elements[5]),t.zoom=1)}(t,M,r)},this.getCamera=function(){return M},this.getFoveation=function(){if(null!==u||null!==d)return o},this.setFoveation=function(t){o=t,null!==u&&(u.fixedFoveation=t),null!==d&&void 0!==d.fixedFoveation&&(d.fixedFoveation=t)},this.hasDepthSensing=function(){return null!==g.texture},this.getDepthSensingMesh=function(){return g.getMesh(M)},this.getCameraTexture=function(t){return m[t]};let U=null;const N=new Uc;N.setAnimationLoop(function(e,r){if(c=r.getViewerPose(l||s),p=r,null!==c){const e=c.views;null!==d&&(t.setRenderTargetFramebuffer(v,d.framebuffer),t.setRenderTarget(v));let r=!1;e.length!==M.cameras.length&&(M.cameras.length=0,r=!0);for(let i=0;i<e.length;i++){const n=e[i];let s=null;if(null!==d)s=d.getViewport(n);else{const e=h.getViewSubImage(u,n);s=e.viewport,0===i&&(t.setRenderTargetTextures(v,e.colorTexture,e.depthStencilTexture),t.setRenderTarget(v))}let a=w[i];void 0===a&&(a=new nc,a.layers.enable(i),a.viewport=new On,w[i]=a),a.matrix.fromArray(n.transform.matrix),a.matrix.decompose(a.position,a.quaternion,a.scale),a.projectionMatrix.fromArray(n.projectionMatrix),a.projectionMatrixInverse.copy(a.projectionMatrix).invert(),a.viewport.set(s.x,s.y,s.width,s.height),0===i&&(M.matrix.copy(a.matrix),M.matrix.decompose(M.position,M.quaternion,M.scale)),!0===r&&M.cameras.push(a)}const s=n.enabledFeatures;if(s&&s.includes("depth-sensing")&&"gpu-optimized"==n.depthUsage&&A){h=i.getBinding();const t=h.getDepthInformation(e[0]);t&&t.isValid&&t.texture&&g.init(t,n.renderState)}if(s&&s.includes("camera-access")&&A){t.state.unbindTexture(),h=i.getBinding();for(let t=0;t<e.length;t++){const i=e[t].camera;if(i){let t=m[i];t||(t=new ro,m[i]=t);const e=h.getCameraImage(i);t.sourceTexture=e}}}}for(let t=0;t<y.length;t++){const e=x[t],i=y[t];null!==e&&void 0!==i&&i.update(e,r,l||s)}U&&U(e,r),r.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:r}),p=null}),this.setAnimationLoop=function(t){U=t},this.dispose=function(){}}}const _d=new Zn,Ed=new Hn;function Sd(t,e){function i(t,e){!0===t.matrixAutoUpdate&&t.updateMatrix(),e.value.copy(t.matrix)}function n(t,n){t.opacity.value=n.opacity,n.color&&t.diffuse.value.copy(n.color),n.emissive&&t.emissive.value.copy(n.emissive).multiplyScalar(n.emissiveIntensity),n.map&&(t.map.value=n.map,i(n.map,t.mapTransform)),n.alphaMap&&(t.alphaMap.value=n.alphaMap,i(n.alphaMap,t.alphaMapTransform)),n.bumpMap&&(t.bumpMap.value=n.bumpMap,i(n.bumpMap,t.bumpMapTransform),t.bumpScale.value=n.bumpScale,1===n.side&&(t.bumpScale.value*=-1)),n.normalMap&&(t.normalMap.value=n.normalMap,i(n.normalMap,t.normalMapTransform),t.normalScale.value.copy(n.normalScale),1===n.side&&t.normalScale.value.negate()),n.displacementMap&&(t.displacementMap.value=n.displacementMap,i(n.displacementMap,t.displacementMapTransform),t.displacementScale.value=n.displacementScale,t.displacementBias.value=n.displacementBias),n.emissiveMap&&(t.emissiveMap.value=n.emissiveMap,i(n.emissiveMap,t.emissiveMapTransform)),n.specularMap&&(t.specularMap.value=n.specularMap,i(n.specularMap,t.specularMapTransform)),n.alphaTest>0&&(t.alphaTest.value=n.alphaTest);const r=e.get(n),s=r.envMap,a=r.envMapRotation;s&&(t.envMap.value=s,_d.copy(a),_d.x*=-1,_d.y*=-1,_d.z*=-1,s.isCubeTexture&&!1===s.isRenderTargetTexture&&(_d.y*=-1,_d.z*=-1),t.envMapRotation.value.setFromMatrix4(Ed.makeRotationFromEuler(_d)),t.flipEnvMap.value=s.isCubeTexture&&!1===s.isRenderTargetTexture?-1:1,t.reflectivity.value=n.reflectivity,t.ior.value=n.ior,t.refractionRatio.value=n.refractionRatio),n.lightMap&&(t.lightMap.value=n.lightMap,t.lightMapIntensity.value=n.lightMapIntensity,i(n.lightMap,t.lightMapTransform)),n.aoMap&&(t.aoMap.value=n.aoMap,t.aoMapIntensity.value=n.aoMapIntensity,i(n.aoMap,t.aoMapTransform))}return{refreshFogUniforms:function(e,i){i.color.getRGB(e.fogColor.value,al(t)),i.isFog?(e.fogNear.value=i.near,e.fogFar.value=i.far):i.isFogExp2&&(e.fogDensity.value=i.density)},refreshMaterialUniforms:function(t,r,s,a,o){r.isMeshBasicMaterial?n(t,r):r.isMeshLambertMaterial?(n(t,r),r.envMap&&(t.envMapIntensity.value=r.envMapIntensity)):r.isMeshToonMaterial?(n(t,r),function(t,e){e.gradientMap&&(t.gradientMap.value=e.gradientMap)}(t,r)):r.isMeshPhongMaterial?(n(t,r),function(t,e){t.specular.value.copy(e.specular),t.shininess.value=Math.max(e.shininess,1e-4)}(t,r),r.envMap&&(t.envMapIntensity.value=r.envMapIntensity)):r.isMeshStandardMaterial?(n(t,r),function(t,e){t.metalness.value=e.metalness,e.metalnessMap&&(t.metalnessMap.value=e.metalnessMap,i(e.metalnessMap,t.metalnessMapTransform));t.roughness.value=e.roughness,e.roughnessMap&&(t.roughnessMap.value=e.roughnessMap,i(e.roughnessMap,t.roughnessMapTransform));e.envMap&&(t.envMapIntensity.value=e.envMapIntensity)}(t,r),r.isMeshPhysicalMaterial&&function(t,e,n){t.ior.value=e.ior,e.sheen>0&&(t.sheenColor.value.copy(e.sheenColor).multiplyScalar(e.sheen),t.sheenRoughness.value=e.sheenRoughness,e.sheenColorMap&&(t.sheenColorMap.value=e.sheenColorMap,i(e.sheenColorMap,t.sheenColorMapTransform)),e.sheenRoughnessMap&&(t.sheenRoughnessMap.value=e.sheenRoughnessMap,i(e.sheenRoughnessMap,t.sheenRoughnessMapTransform)));e.clearcoat>0&&(t.clearcoat.value=e.clearcoat,t.clearcoatRoughness.value=e.clearcoatRoughness,e.clearcoatMap&&(t.clearcoatMap.value=e.clearcoatMap,i(e.clearcoatMap,t.clearcoatMapTransform)),e.clearcoatRoughnessMap&&(t.clearcoatRoughnessMap.value=e.clearcoatRoughnessMap,i(e.clearcoatRoughnessMap,t.clearcoatRoughnessMapTransform)),e.clearcoatNormalMap&&(t.clearcoatNormalMap.value=e.clearcoatNormalMap,i(e.clearcoatNormalMap,t.clearcoatNormalMapTransform),t.clearcoatNormalScale.value.copy(e.clearcoatNormalScale),1===e.side&&t.clearcoatNormalScale.value.negate()));e.dispersion>0&&(t.dispersion.value=e.dispersion);e.iridescence>0&&(t.iridescence.value=e.iridescence,t.iridescenceIOR.value=e.iridescenceIOR,t.iridescenceThicknessMinimum.value=e.iridescenceThicknessRange[0],t.iridescenceThicknessMaximum.value=e.iridescenceThicknessRange[1],e.iridescenceMap&&(t.iridescenceMap.value=e.iridescenceMap,i(e.iridescenceMap,t.iridescenceMapTransform)),e.iridescenceThicknessMap&&(t.iridescenceThicknessMap.value=e.iridescenceThicknessMap,i(e.iridescenceThicknessMap,t.iridescenceThicknessMapTransform)));e.transmission>0&&(t.transmission.value=e.transmission,t.transmissionSamplerMap.value=n.texture,t.transmissionSamplerSize.value.set(n.width,n.height),e.transmissionMap&&(t.transmissionMap.value=e.transmissionMap,i(e.transmissionMap,t.transmissionMapTransform)),t.thickness.value=e.thickness,e.thicknessMap&&(t.thicknessMap.value=e.thicknessMap,i(e.thicknessMap,t.thicknessMapTransform)),t.attenuationDistance.value=e.attenuationDistance,t.attenuationColor.value.copy(e.attenuationColor));e.anisotropy>0&&(t.anisotropyVector.value.set(e.anisotropy*Math.cos(e.anisotropyRotation),e.anisotropy*Math.sin(e.anisotropyRotation)),e.anisotropyMap&&(t.anisotropyMap.value=e.anisotropyMap,i(e.anisotropyMap,t.anisotropyMapTransform)));t.specularIntensity.value=e.specularIntensity,t.specularColor.value.copy(e.specularColor),e.specularColorMap&&(t.specularColorMap.value=e.specularColorMap,i(e.specularColorMap,t.specularColorMapTransform));e.specularIntensityMap&&(t.specularIntensityMap.value=e.specularIntensityMap,i(e.specularIntensityMap,t.specularIntensityMapTransform))}(t,r,o)):r.isMeshMatcapMaterial?(n(t,r),function(t,e){e.matcap&&(t.matcap.value=e.matcap)}(t,r)):r.isMeshDepthMaterial?n(t,r):r.isMeshDistanceMaterial?(n(t,r),function(t,i){const n=e.get(i).light;t.referencePosition.value.setFromMatrixPosition(n.matrixWorld),t.nearDistance.value=n.shadow.camera.near,t.farDistance.value=n.shadow.camera.far}(t,r)):r.isMeshNormalMaterial?n(t,r):r.isLineBasicMaterial?(function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,e.map&&(t.map.value=e.map,i(e.map,t.mapTransform))}(t,r),r.isLineDashedMaterial&&function(t,e){t.dashSize.value=e.dashSize,t.totalSize.value=e.dashSize+e.gapSize,t.scale.value=e.scale}(t,r)):r.isPointsMaterial?function(t,e,n,r){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.size.value=e.size*n,t.scale.value=.5*r,e.map&&(t.map.value=e.map,i(e.map,t.uvTransform));e.alphaMap&&(t.alphaMap.value=e.alphaMap,i(e.alphaMap,t.alphaMapTransform));e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}(t,r,s,a):r.isSpriteMaterial?function(t,e){t.diffuse.value.copy(e.color),t.opacity.value=e.opacity,t.rotation.value=e.rotation,e.map&&(t.map.value=e.map,i(e.map,t.mapTransform));e.alphaMap&&(t.alphaMap.value=e.alphaMap,i(e.alphaMap,t.alphaMapTransform));e.alphaTest>0&&(t.alphaTest.value=e.alphaTest)}(t,r):r.isShadowMaterial?(t.color.value.copy(r.color),t.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function Cd(t,e,i,n){let r={},s={},a=[];const o=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function l(t,e,i,n){const r=t.value,s=e+"_"+i;if(void 0===n[s])return n[s]="number"==typeof r||"boolean"==typeof r?r:r.clone(),!0;{const t=n[s];if("number"==typeof r||"boolean"==typeof r){if(t!==r)return n[s]=r,!0}else if(!1===t.equals(r))return t.copy(r),!0}return!1}function c(t){const e={boundary:0,storage:0};return"number"==typeof t||"boolean"==typeof t?(e.boundary=4,e.storage=4):t.isVector2?(e.boundary=8,e.storage=8):t.isVector3||t.isColor?(e.boundary=16,e.storage=12):t.isVector4?(e.boundary=16,e.storage=16):t.isMatrix3?(e.boundary=48,e.storage=48):t.isMatrix4?(e.boundary=64,e.storage=64):t.isTexture?tn("WebGLRenderer: Texture samplers can not be part of an uniforms group."):tn("WebGLRenderer: Unsupported uniform value type.",t),e}function h(e){const i=e.target;i.removeEventListener("dispose",h);const n=a.indexOf(i.__bindingPointIndex);a.splice(n,1),t.deleteBuffer(r[i.id]),delete r[i.id],delete s[i.id]}return{bind:function(t,e){const i=e.program;n.uniformBlockBinding(t,i)},update:function(i,u){let d=r[i.id];void 0===d&&(!function(t){const e=t.uniforms;let i=0;const n=16;for(let t=0,r=e.length;t<r;t++){const r=Array.isArray(e[t])?e[t]:[e[t]];for(let t=0,e=r.length;t<e;t++){const e=r[t],s=Array.isArray(e.value)?e.value:[e.value];for(let t=0,r=s.length;t<r;t++){const r=c(s[t]),a=i%n,o=a%r.boundary,l=a+o;i+=o,0!==l&&n-l<r.storage&&(i+=n-l),e.__data=new Float32Array(r.storage/Float32Array.BYTES_PER_ELEMENT),e.__offset=i,i+=r.storage}}}const r=i%n;r>0&&(i+=n-r);t.__size=i,t.__cache={}}(i),d=function(e){const i=function(){for(let t=0;t<o;t++)if(-1===a.indexOf(t))return a.push(t),t;return en("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();e.__bindingPointIndex=i;const n=t.createBuffer(),r=e.__size,s=e.usage;return t.bindBuffer(t.UNIFORM_BUFFER,n),t.bufferData(t.UNIFORM_BUFFER,r,s),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,i,n),n}(i),r[i.id]=d,i.addEventListener("dispose",h));const p=u.program;n.updateUBOMapping(i,p);const A=e.render.frame;s[i.id]!==A&&(!function(e){const i=r[e.id],n=e.uniforms,s=e.__cache;t.bindBuffer(t.UNIFORM_BUFFER,i);for(let e=0,i=n.length;e<i;e++){const i=Array.isArray(n[e])?n[e]:[n[e]];for(let n=0,r=i.length;n<r;n++){const r=i[n];if(!0===l(r,e,n,s)){const e=r.__offset,i=Array.isArray(r.value)?r.value:[r.value];let n=0;for(let s=0;s<i.length;s++){const a=i[s],o=c(a);"number"==typeof a||"boolean"==typeof a?(r.__data[0]=a,t.bufferSubData(t.UNIFORM_BUFFER,e+n,r.__data)):a.isMatrix3?(r.__data[0]=a.elements[0],r.__data[1]=a.elements[1],r.__data[2]=a.elements[2],r.__data[3]=0,r.__data[4]=a.elements[3],r.__data[5]=a.elements[4],r.__data[6]=a.elements[5],r.__data[7]=0,r.__data[8]=a.elements[6],r.__data[9]=a.elements[7],r.__data[10]=a.elements[8],r.__data[11]=0):(a.toArray(r.__data,n),n+=o.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,e,r.__data)}}}t.bindBuffer(t.UNIFORM_BUFFER,null)}(i),s[i.id]=A)},dispose:function(){for(const e in r)t.deleteBuffer(r[e]);a=[],r={},s={}}}}const wd=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let Md=null;class Id{constructor(t={}){const{canvas:e=Ji(),context:i=null,depth:n=!0,stencil:r=!1,alpha:s=!1,antialias:a=!1,premultipliedAlpha:o=!0,preserveDrawingBuffer:l=!1,powerPreference:c="default",failIfMajorPerformanceCaveat:h=!1,reversedDepthBuffer:u=!1,outputBufferType:d=fe}=t;let p;if(this.isWebGLRenderer=!0,null!==i){if("undefined"!=typeof WebGLRenderingContext&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");p=i.getContextAttributes().alpha}else p=s;const A=d,g=new Set([Oe,Ne,Fe]),m=new Set([fe,_e,ye,Me,Ce,we]),f=new Uint32Array(4),b=new Int32Array(4);let v=null,y=null;const x=[],_=[];let E=null;this.domElement=e,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=0,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const S=this;let C=!1;this._outputColorSpace=Di;let w=0,M=0,I=null,T=-1,B=null;const R=new On,D=new On;let L=null;const P=new Sr(0);let F=0,U=e.width,N=e.height,O=1,k=null,Q=null;const G=new On(0,0,U,N),z=new On(0,0,U,N);let H=!1;const V=new Ia;let q=!1,j=!1;const W=new Hn,X=new vn,K=new On,J={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Y=!1;function $(){return null===I?O:1}let Z,tt,et,it,nt,rt,st,at,ot,lt,ct,ht,ut,dt,At,gt,mt,ft,bt,vt,yt,xt,_t,Et=i;function St(t,i){return e.getContext(t,i)}try{const t={alpha:!0,depth:n,stencil:r,antialias:a,premultipliedAlpha:o,preserveDrawingBuffer:l,powerPreference:c,failIfMajorPerformanceCaveat:h};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${pt}`),e.addEventListener("webglcontextlost",Mt,!1),e.addEventListener("webglcontextrestored",It,!1),e.addEventListener("webglcontextcreationerror",Tt,!1),null===Et){const e="webgl2";if(Et=St(e,t),null===Et)throw St(e)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(t){throw en("WebGLRenderer: "+t.message),t}function Ct(){Z=new dh(Et),Z.init(),yt=new vd(Et,Z),tt=new Wc(Et,Z,t,yt),et=new fd(Et,Z),tt.reversedDepthBuffer&&u&&et.buffers.depth.setReversed(!0),it=new gh(Et),nt=new td,rt=new bd(Et,Z,et,nt,tt,yt,it),st=new uh(S),at=new Nc(Et),xt=new qc(Et,at),ot=new ph(Et,at,it,xt),lt=new fh(Et,ot,at,xt,it),ft=new mh(Et,tt,rt),At=new Xc(nt),ct=new Zu(S,st,Z,tt,xt,At),ht=new Sd(S,nt),ut=new rd,dt=new hd(Z),mt=new Vc(S,st,et,lt,p,o),gt=new md(S,lt,tt),_t=new Cd(Et,it,tt,et),bt=new jc(Et,Z,it),vt=new Ah(Et,Z,it),it.programs=ct.programs,S.capabilities=tt,S.extensions=Z,S.properties=nt,S.renderLists=ut,S.shadowMap=gt,S.state=et,S.info=it}Ct(),A!==fe&&(E=new vh(A,e.width,e.height,n,r));const wt=new xd(S,Et);function Mt(t){t.preventDefault(),$i("WebGLRenderer: Context Lost."),C=!0}function It(){$i("WebGLRenderer: Context Restored."),C=!1;const t=it.autoReset,e=gt.enabled,i=gt.autoUpdate,n=gt.needsUpdate,r=gt.type;Ct(),it.autoReset=t,gt.enabled=e,gt.autoUpdate=i,gt.needsUpdate=n,gt.type=r}function Tt(t){en("WebGLRenderer: A WebGL context could not be created. Reason: ",t.statusMessage)}function Bt(t){const e=t.target;e.removeEventListener("dispose",Bt),function(t){(function(t){const e=nt.get(t).programs;void 0!==e&&(e.forEach(function(t){ct.releaseProgram(t)}),t.isShaderMaterial&&ct.releaseShaderCache(t))})(t),nt.remove(t)}(e)}function Rt(t,e,i){!0===t.transparent&&2===t.side&&!1===t.forceSinglePass?(t.side=1,t.needsUpdate=!0,Gt(t,e,i),t.side=0,t.needsUpdate=!0,Gt(t,e,i),t.side=2):Gt(t,e,i)}this.xr=wt,this.getContext=function(){return Et},this.getContextAttributes=function(){return Et.getContextAttributes()},this.forceContextLoss=function(){const t=Z.get("WEBGL_lose_context");t&&t.loseContext()},this.forceContextRestore=function(){const t=Z.get("WEBGL_lose_context");t&&t.restoreContext()},this.getPixelRatio=function(){return O},this.setPixelRatio=function(t){void 0!==t&&(O=t,this.setSize(U,N,!1))},this.getSize=function(t){return t.set(U,N)},this.setSize=function(t,i,n=!0){wt.isPresenting?tn("WebGLRenderer: Can't change size while VR device is presenting."):(U=t,N=i,e.width=Math.floor(t*O),e.height=Math.floor(i*O),!0===n&&(e.style.width=t+"px",e.style.height=i+"px"),null!==E&&E.setSize(e.width,e.height),this.setViewport(0,0,t,i))},this.getDrawingBufferSize=function(t){return t.set(U*O,N*O).floor()},this.setDrawingBufferSize=function(t,i,n){U=t,N=i,O=n,e.width=Math.floor(t*n),e.height=Math.floor(i*n),this.setViewport(0,0,t,i)},this.setEffects=function(t){if(A!==fe){if(t)for(let e=0;e<t.length;e++)if(!0===t[e].isOutputPass){console.warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}E.setEffects(t||[])}else console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.")},this.getCurrentViewport=function(t){return t.copy(R)},this.getViewport=function(t){return t.copy(G)},this.setViewport=function(t,e,i,n){t.isVector4?G.set(t.x,t.y,t.z,t.w):G.set(t,e,i,n),et.viewport(R.copy(G).multiplyScalar(O).round())},this.getScissor=function(t){return t.copy(z)},this.setScissor=function(t,e,i,n){t.isVector4?z.set(t.x,t.y,t.z,t.w):z.set(t,e,i,n),et.scissor(D.copy(z).multiplyScalar(O).round())},this.getScissorTest=function(){return H},this.setScissorTest=function(t){et.setScissorTest(H=t)},this.setOpaqueSort=function(t){k=t},this.setTransparentSort=function(t){Q=t},this.getClearColor=function(t){return t.copy(mt.getClearColor())},this.setClearColor=function(){mt.setClearColor(...arguments)},this.getClearAlpha=function(){return mt.getClearAlpha()},this.setClearAlpha=function(){mt.setClearAlpha(...arguments)},this.clear=function(t=!0,e=!0,i=!0){let n=0;if(t){let t=!1;if(null!==I){const e=I.texture.format;t=g.has(e)}if(t){const t=I.texture.type,e=m.has(t),i=mt.getClearColor(),n=mt.getClearAlpha(),r=i.r,s=i.g,a=i.b;e?(f[0]=r,f[1]=s,f[2]=a,f[3]=n,Et.clearBufferuiv(Et.COLOR,0,f)):(b[0]=r,b[1]=s,b[2]=a,b[3]=n,Et.clearBufferiv(Et.COLOR,0,b))}else n|=Et.COLOR_BUFFER_BIT}e&&(n|=Et.DEPTH_BUFFER_BIT),i&&(n|=Et.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),0!==n&&Et.clear(n)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",Mt,!1),e.removeEventListener("webglcontextrestored",It,!1),e.removeEventListener("webglcontextcreationerror",Tt,!1),mt.dispose(),ut.dispose(),dt.dispose(),nt.dispose(),st.dispose(),lt.dispose(),xt.dispose(),_t.dispose(),ct.dispose(),wt.dispose(),wt.removeEventListener("sessionstart",Lt),wt.removeEventListener("sessionend",Pt),Ft.stop()},this.renderBufferDirect=function(t,e,i,n,r,s){null===e&&(e=J);const a=r.isMesh&&r.matrixWorld.determinant()<0,o=function(t,e,i,n,r){!0!==e.isScene&&(e=J);rt.resetTextureUnits();const s=e.fog,a=n.isMeshStandardMaterial||n.isMeshLambertMaterial||n.isMeshPhongMaterial?e.environment:null,o=null===I?S.outputColorSpace:!0===I.isXRRenderTarget?I.texture.colorSpace:Li,l=n.isMeshStandardMaterial||n.isMeshLambertMaterial&&!n.envMap||n.isMeshPhongMaterial&&!n.envMap,c=st.get(n.envMap||a,l),h=!0===n.vertexColors&&!!i.attributes.color&&4===i.attributes.color.itemSize,u=!!i.attributes.tangent&&(!!n.normalMap||n.anisotropy>0),d=!!i.morphAttributes.position,p=!!i.morphAttributes.normal,A=!!i.morphAttributes.color;let g=0;n.toneMapped&&(null!==I&&!0!==I.isXRRenderTarget||(g=S.toneMapping));const m=i.morphAttributes.position||i.morphAttributes.normal||i.morphAttributes.color,f=void 0!==m?m.length:0,b=nt.get(n),v=y.state.lights;if(!0===q&&(!0===j||t!==B)){const e=t===B&&n.id===T;At.setState(n,t,e)}let x=!1;n.version===b.__version?b.needsLights&&b.lightsStateVersion!==v.state.version||b.outputColorSpace!==o||r.isBatchedMesh&&!1===b.batching?x=!0:r.isBatchedMesh||!0!==b.batching?r.isBatchedMesh&&!0===b.batchingColor&&null===r.colorTexture||r.isBatchedMesh&&!1===b.batchingColor&&null!==r.colorTexture||r.isInstancedMesh&&!1===b.instancing?x=!0:r.isInstancedMesh||!0!==b.instancing?r.isSkinnedMesh&&!1===b.skinning?x=!0:r.isSkinnedMesh||!0!==b.skinning?r.isInstancedMesh&&!0===b.instancingColor&&null===r.instanceColor||r.isInstancedMesh&&!1===b.instancingColor&&null!==r.instanceColor||r.isInstancedMesh&&!0===b.instancingMorph&&null===r.morphTexture||r.isInstancedMesh&&!1===b.instancingMorph&&null!==r.morphTexture||b.envMap!==c||!0===n.fog&&b.fog!==s?x=!0:void 0===b.numClippingPlanes||b.numClippingPlanes===At.numPlanes&&b.numIntersection===At.numIntersection?(b.vertexAlphas!==h||b.vertexTangents!==u||b.morphTargets!==d||b.morphNormals!==p||b.morphColors!==A||b.toneMapping!==g||b.morphTargetsCount!==f)&&(x=!0):x=!0:x=!0:x=!0:x=!0:(x=!0,b.__version=n.version);let _=b.currentProgram;!0===x&&(_=Gt(n,e,r));let E=!1,C=!1,w=!1;const M=_.getUniforms(),R=b.uniforms;et.useProgram(_.program)&&(E=!0,C=!0,w=!0);n.id!==T&&(T=n.id,C=!0);if(E||B!==t){et.buffers.depth.getReversed()&&!0!==t.reversedDepth&&(t._reversedDepth=!0,t.updateProjectionMatrix()),M.setValue(Et,"projectionMatrix",t.projectionMatrix),M.setValue(Et,"viewMatrix",t.matrixWorldInverse);const e=M.map.cameraPosition;void 0!==e&&e.setValue(Et,X.setFromMatrixPosition(t.matrixWorld)),tt.logarithmicDepthBuffer&&M.setValue(Et,"logDepthBufFC",2/(Math.log(t.far+1)/Math.LN2)),(n.isMeshPhongMaterial||n.isMeshToonMaterial||n.isMeshLambertMaterial||n.isMeshBasicMaterial||n.isMeshStandardMaterial||n.isShaderMaterial)&&M.setValue(Et,"isOrthographic",!0===t.isOrthographicCamera),B!==t&&(B=t,C=!0,w=!0)}b.needsLights&&(v.state.directionalShadowMap.length>0&&M.setValue(Et,"directionalShadowMap",v.state.directionalShadowMap,rt),v.state.spotShadowMap.length>0&&M.setValue(Et,"spotShadowMap",v.state.spotShadowMap,rt),v.state.pointShadowMap.length>0&&M.setValue(Et,"pointShadowMap",v.state.pointShadowMap,rt));if(r.isSkinnedMesh){M.setOptional(Et,r,"bindMatrix"),M.setOptional(Et,r,"bindMatrixInverse");const t=r.skeleton;t&&(null===t.boneTexture&&t.computeBoneTexture(),M.setValue(Et,"boneTexture",t.boneTexture,rt))}r.isBatchedMesh&&(M.setOptional(Et,r,"batchingTexture"),M.setValue(Et,"batchingTexture",r._matricesTexture,rt),M.setOptional(Et,r,"batchingIdTexture"),M.setValue(Et,"batchingIdTexture",r._indirectTexture,rt),M.setOptional(Et,r,"batchingColorTexture"),null!==r._colorsTexture&&M.setValue(Et,"batchingColorTexture",r._colorsTexture,rt));const D=i.morphAttributes;void 0===D.position&&void 0===D.normal&&void 0===D.color||ft.update(r,i,_);(C||b.receiveShadow!==r.receiveShadow)&&(b.receiveShadow=r.receiveShadow,M.setValue(Et,"receiveShadow",r.receiveShadow));(n.isMeshStandardMaterial||n.isMeshLambertMaterial||n.isMeshPhongMaterial)&&null===n.envMap&&null!==e.environment&&(R.envMapIntensity.value=e.environmentIntensity);void 0!==R.dfgLUT&&(R.dfgLUT.value=(null===Md&&(Md=new la(wd,16,16,Ue,Se),Md.name="DFG_LUT",Md.minFilter=Ae,Md.magFilter=Ae,Md.wrapS=ce,Md.wrapT=ce,Md.generateMipmaps=!1,Md.needsUpdate=!0),Md));C&&(M.setValue(Et,"toneMappingExposure",S.toneMappingExposure),b.needsLights&&(P=w,(L=R).ambientLightColor.needsUpdate=P,L.lightProbe.needsUpdate=P,L.directionalLights.needsUpdate=P,L.directionalLightShadows.needsUpdate=P,L.pointLights.needsUpdate=P,L.pointLightShadows.needsUpdate=P,L.spotLights.needsUpdate=P,L.spotLightShadows.needsUpdate=P,L.rectAreaLights.needsUpdate=P,L.hemisphereLights.needsUpdate=P),s&&!0===n.fog&&ht.refreshFogUniforms(R,s),ht.refreshMaterialUniforms(R,n,O,N,y.state.transmissionRenderTarget[t.id]),Su.upload(Et,zt(b),R,rt));var L,P;n.isShaderMaterial&&!0===n.uniformsNeedUpdate&&(Su.upload(Et,zt(b),R,rt),n.uniformsNeedUpdate=!1);n.isSpriteMaterial&&M.setValue(Et,"center",r.center);if(M.setValue(Et,"modelViewMatrix",r.modelViewMatrix),M.setValue(Et,"normalMatrix",r.normalMatrix),M.setValue(Et,"modelMatrix",r.matrixWorld),n.isShaderMaterial||n.isRawShaderMaterial){const t=n.uniformsGroups;for(let e=0,i=t.length;e<i;e++){const i=t[e];_t.update(i,_),_t.bind(i,_)}}return _}(t,e,i,n,r);et.setMaterial(n,a);let l=i.index,c=1;if(!0===n.wireframe){if(l=ot.getWireframeAttribute(i),void 0===l)return;c=2}const h=i.drawRange,u=i.attributes.position;let d=h.start*c,p=(h.start+h.count)*c;null!==s&&(d=Math.max(d,s.start*c),p=Math.min(p,(s.start+s.count)*c)),null!==l?(d=Math.max(d,0),p=Math.min(p,l.count)):null!=u&&(d=Math.max(d,0),p=Math.min(p,u.count));const A=p-d;if(A<0||A===1/0)return;let g;xt.setup(r,n,o,i,l);let m=bt;if(null!==l&&(g=at.get(l),m=vt,m.setIndex(g)),r.isMesh)!0===n.wireframe?(et.setLineWidth(n.wireframeLinewidth*$()),m.setMode(Et.LINES)):m.setMode(Et.TRIANGLES);else if(r.isLine){let t=n.linewidth;void 0===t&&(t=1),et.setLineWidth(t*$()),r.isLineSegments?m.setMode(Et.LINES):r.isLineLoop?m.setMode(Et.LINE_LOOP):m.setMode(Et.LINE_STRIP)}else r.isPoints?m.setMode(Et.POINTS):r.isSprite&&m.setMode(Et.TRIANGLES);if(r.isBatchedMesh)if(null!==r._multiDrawInstances)nn("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),m.renderMultiDrawInstances(r._multiDrawStarts,r._multiDrawCounts,r._multiDrawCount,r._multiDrawInstances);else if(Z.get("WEBGL_multi_draw"))m.renderMultiDraw(r._multiDrawStarts,r._multiDrawCounts,r._multiDrawCount);else{const t=r._multiDrawStarts,e=r._multiDrawCounts,i=r._multiDrawCount,s=l?at.get(l).bytesPerElement:1,a=nt.get(n).currentProgram.getUniforms();for(let n=0;n<i;n++)a.setValue(Et,"_gl_DrawID",n),m.render(t[n]/s,e[n])}else if(r.isInstancedMesh)m.renderInstances(d,A,r.count);else if(i.isInstancedBufferGeometry){const t=void 0!==i._maxInstanceCount?i._maxInstanceCount:1/0,e=Math.min(i.instanceCount,t);m.renderInstances(d,A,e)}else m.render(d,A)},this.compile=function(t,e,i=null){null===i&&(i=t),y=dt.get(i),y.init(e),_.push(y),i.traverseVisible(function(t){t.isLight&&t.layers.test(e.layers)&&(y.pushLight(t),t.castShadow&&y.pushShadow(t))}),t!==i&&t.traverseVisible(function(t){t.isLight&&t.layers.test(e.layers)&&(y.pushLight(t),t.castShadow&&y.pushShadow(t))}),y.setupLights();const n=new Set;return t.traverse(function(t){if(!(t.isMesh||t.isPoints||t.isLine||t.isSprite))return;const e=t.material;if(e)if(Array.isArray(e))for(let r=0;r<e.length;r++){const s=e[r];Rt(s,i,t),n.add(s)}else Rt(e,i,t),n.add(e)}),y=_.pop(),n},this.compileAsync=function(t,e,i=null){const n=this.compile(t,e,i);return new Promise(e=>{function i(){n.forEach(function(t){nt.get(t).currentProgram.isReady()&&n.delete(t)}),0!==n.size?setTimeout(i,10):e(t)}null!==Z.get("KHR_parallel_shader_compile")?i():setTimeout(i,10)})};let Dt=null;function Lt(){Ft.stop()}function Pt(){Ft.start()}const Ft=new Uc;function Ut(t,e,i,n){if(!1===t.visible)return;if(t.layers.test(e.layers))if(t.isGroup)i=t.renderOrder;else if(t.isLOD)!0===t.autoUpdate&&t.update(e);else if(t.isLight)y.pushLight(t),t.castShadow&&y.pushShadow(t);else if(t.isSprite){if(!t.frustumCulled||V.intersectsSprite(t)){n&&K.setFromMatrixPosition(t.matrixWorld).applyMatrix4(W);const e=lt.update(t),r=t.material;r.visible&&v.push(t,e,r,i,K.z,null)}}else if((t.isMesh||t.isLine||t.isPoints)&&(!t.frustumCulled||V.intersectsObject(t))){const e=lt.update(t),r=t.material;if(n&&(void 0!==t.boundingSphere?(null===t.boundingSphere&&t.computeBoundingSphere(),K.copy(t.boundingSphere.center)):(null===e.boundingSphere&&e.computeBoundingSphere(),K.copy(e.boundingSphere.center)),K.applyMatrix4(t.matrixWorld).applyMatrix4(W)),Array.isArray(r)){const n=e.groups;for(let s=0,a=n.length;s<a;s++){const a=n[s],o=r[a.materialIndex];o&&o.visible&&v.push(t,e,o,i,K.z,a)}}else r.visible&&v.push(t,e,r,i,K.z,null)}const r=t.children;for(let t=0,s=r.length;t<s;t++)Ut(r[t],e,i,n)}function Nt(t,e,i,n){const{opaque:r,transmissive:s,transparent:a}=t;y.setupLightsView(i),!0===q&&At.setGlobalState(S.clippingPlanes,i),n&&et.viewport(R.copy(n)),r.length>0&&kt(r,e,i),s.length>0&&kt(s,e,i),a.length>0&&kt(a,e,i),et.buffers.depth.setTest(!0),et.buffers.depth.setMask(!0),et.buffers.color.setMask(!0),et.setPolygonOffset(!1)}function Ot(t,e,i,n){if(null!==(!0===i.isScene?i.overrideMaterial:null))return;if(void 0===y.state.transmissionRenderTarget[n.id]){const t=Z.has("EXT_color_buffer_half_float")||Z.has("EXT_color_buffer_float");y.state.transmissionRenderTarget[n.id]=new Qn(1,1,{generateMipmaps:!0,type:t?Se:fe,minFilter:me,samples:Math.max(4,tt.samples),stencilBuffer:r,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Mn.workingColorSpace})}const s=y.state.transmissionRenderTarget[n.id],a=n.viewport||R;s.setSize(a.z*S.transmissionResolutionScale,a.w*S.transmissionResolutionScale);const o=S.getRenderTarget(),l=S.getActiveCubeFace(),c=S.getActiveMipmapLevel();S.setRenderTarget(s),S.getClearColor(P),F=S.getClearAlpha(),F<1&&S.setClearColor(16777215,.5),S.clear(),Y&&mt.render(i);const h=S.toneMapping;S.toneMapping=0;const u=n.viewport;if(void 0!==n.viewport&&(n.viewport=void 0),y.setupLightsView(n),!0===q&&At.setGlobalState(S.clippingPlanes,n),kt(t,i,n),rt.updateMultisampleRenderTarget(s),rt.updateRenderTargetMipmap(s),!1===Z.has("WEBGL_multisampled_render_to_texture")){let t=!1;for(let r=0,s=e.length;r<s;r++){const s=e[r],{object:a,geometry:o,material:l,group:c}=s;if(2===l.side&&a.layers.test(n.layers)){const e=l.side;l.side=1,l.needsUpdate=!0,Qt(a,i,n,o,l,c),l.side=e,l.needsUpdate=!0,t=!0}}!0===t&&(rt.updateMultisampleRenderTarget(s),rt.updateRenderTargetMipmap(s))}S.setRenderTarget(o,l,c),S.setClearColor(P,F),void 0!==u&&(n.viewport=u),S.toneMapping=h}function kt(t,e,i){const n=!0===e.isScene?e.overrideMaterial:null;for(let r=0,s=t.length;r<s;r++){const s=t[r],{object:a,geometry:o,group:l}=s;let c=s.material;!0===c.allowOverride&&null!==n&&(c=n),a.layers.test(i.layers)&&Qt(a,e,i,o,c,l)}}function Qt(t,e,i,n,r,s){t.onBeforeRender(S,e,i,n,r,s),t.modelViewMatrix.multiplyMatrices(i.matrixWorldInverse,t.matrixWorld),t.normalMatrix.getNormalMatrix(t.modelViewMatrix),r.onBeforeRender(S,e,i,n,t,s),!0===r.transparent&&2===r.side&&!1===r.forceSinglePass?(r.side=1,r.needsUpdate=!0,S.renderBufferDirect(i,e,n,r,t,s),r.side=0,r.needsUpdate=!0,S.renderBufferDirect(i,e,n,r,t,s),r.side=2):S.renderBufferDirect(i,e,n,r,t,s),t.onAfterRender(S,e,i,n,r,s)}function Gt(t,e,i){!0!==e.isScene&&(e=J);const n=nt.get(t),r=y.state.lights,s=y.state.shadowsArray,a=r.state.version,o=ct.getParameters(t,r.state,s,e,i),l=ct.getProgramCacheKey(o);let c=n.programs;n.environment=t.isMeshStandardMaterial||t.isMeshLambertMaterial||t.isMeshPhongMaterial?e.environment:null,n.fog=e.fog;const h=t.isMeshStandardMaterial||t.isMeshLambertMaterial&&!t.envMap||t.isMeshPhongMaterial&&!t.envMap;n.envMap=st.get(t.envMap||n.environment,h),n.envMapRotation=null!==n.environment&&null===t.envMap?e.environmentRotation:t.envMapRotation,void 0===c&&(t.addEventListener("dispose",Bt),c=new Map,n.programs=c);let u=c.get(l);if(void 0!==u){if(n.currentProgram===u&&n.lightsStateVersion===a)return Ht(t,o),u}else o.uniforms=ct.getUniforms(t),t.onBeforeCompile(o,S),u=ct.acquireProgram(o,l),c.set(l,u),n.uniforms=o.uniforms;const d=n.uniforms;return(t.isShaderMaterial||t.isRawShaderMaterial)&&!0!==t.clipping||(d.clippingPlanes=At.uniform),Ht(t,o),n.needsLights=function(t){return t.isMeshLambertMaterial||t.isMeshToonMaterial||t.isMeshPhongMaterial||t.isMeshStandardMaterial||t.isShadowMaterial||t.isShaderMaterial&&!0===t.lights}(t),n.lightsStateVersion=a,n.needsLights&&(d.ambientLightColor.value=r.state.ambient,d.lightProbe.value=r.state.probe,d.directionalLights.value=r.state.directional,d.directionalLightShadows.value=r.state.directionalShadow,d.spotLights.value=r.state.spot,d.spotLightShadows.value=r.state.spotShadow,d.rectAreaLights.value=r.state.rectArea,d.ltc_1.value=r.state.rectAreaLTC1,d.ltc_2.value=r.state.rectAreaLTC2,d.pointLights.value=r.state.point,d.pointLightShadows.value=r.state.pointShadow,d.hemisphereLights.value=r.state.hemi,d.directionalShadowMatrix.value=r.state.directionalShadowMatrix,d.spotLightMatrix.value=r.state.spotLightMatrix,d.spotLightMap.value=r.state.spotLightMap,d.pointShadowMatrix.value=r.state.pointShadowMatrix),n.currentProgram=u,n.uniformsList=null,u}function zt(t){if(null===t.uniformsList){const e=t.currentProgram.getUniforms();t.uniformsList=Su.seqWithValue(e.seq,t.uniforms)}return t.uniformsList}function Ht(t,e){const i=nt.get(t);i.outputColorSpace=e.outputColorSpace,i.batching=e.batching,i.batchingColor=e.batchingColor,i.instancing=e.instancing,i.instancingColor=e.instancingColor,i.instancingMorph=e.instancingMorph,i.skinning=e.skinning,i.morphTargets=e.morphTargets,i.morphNormals=e.morphNormals,i.morphColors=e.morphColors,i.morphTargetsCount=e.morphTargetsCount,i.numClippingPlanes=e.numClippingPlanes,i.numIntersection=e.numClipIntersection,i.vertexAlphas=e.vertexAlphas,i.vertexTangents=e.vertexTangents,i.toneMapping=e.toneMapping}Ft.setAnimationLoop(function(t){Dt&&Dt(t)}),"undefined"!=typeof self&&Ft.setContext(self),this.setAnimationLoop=function(t){Dt=t,wt.setAnimationLoop(t),null===t?Ft.stop():Ft.start()},wt.addEventListener("sessionstart",Lt),wt.addEventListener("sessionend",Pt),this.render=function(t,e){if(void 0!==e&&!0!==e.isCamera)return void en("WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===C)return;const i=!0===wt.enabled&&!0===wt.isPresenting,n=null!==E&&(null===I||i)&&E.begin(S,I);if(!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),null===e.parent&&!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),!0!==wt.enabled||!0!==wt.isPresenting||null!==E&&!1!==E.isCompositing()||(!0===wt.cameraAutoUpdate&&wt.updateCamera(e),e=wt.getCamera()),!0===t.isScene&&t.onBeforeRender(S,t,e,I),y=dt.get(t,_.length),y.init(e),_.push(y),W.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),V.setFromProjectionMatrix(W,Wi,e.reversedDepth),j=this.localClippingEnabled,q=At.init(this.clippingPlanes,j),v=ut.get(t,x.length),v.init(),x.push(v),!0===wt.enabled&&!0===wt.isPresenting){const t=S.xr.getDepthSensingMesh();null!==t&&Ut(t,e,-1/0,S.sortObjects)}Ut(t,e,0,S.sortObjects),v.finish(),!0===S.sortObjects&&v.sort(k,Q),Y=!1===wt.enabled||!1===wt.isPresenting||!1===wt.hasDepthSensing(),Y&&mt.addToRenderList(v,t),this.info.render.frame++,!0===q&&At.beginShadows();const r=y.state.shadowsArray;gt.render(r,t,e),!0===q&&At.endShadows(),!0===this.info.autoReset&&this.info.reset();if(!1===(n&&E.hasRenderPass())){const i=v.opaque,n=v.transmissive;if(y.setupLights(),e.isArrayCamera){const r=e.cameras;if(n.length>0)for(let e=0,s=r.length;e<s;e++){Ot(i,n,t,r[e])}Y&&mt.render(t);for(let e=0,i=r.length;e<i;e++){const i=r[e];Nt(v,t,i,i.viewport)}}else n.length>0&&Ot(i,n,t,e),Y&&mt.render(t),Nt(v,t,e)}null!==I&&0===M&&(rt.updateMultisampleRenderTarget(I),rt.updateRenderTargetMipmap(I)),n&&E.end(S),!0===t.isScene&&t.onAfterRender(S,t,e),xt.resetDefaultState(),T=-1,B=null,_.pop(),_.length>0?(y=_[_.length-1],!0===q&&At.setGlobalState(S.clippingPlanes,y.state.camera)):y=null,x.pop(),v=x.length>0?x[x.length-1]:null},this.getActiveCubeFace=function(){return w},this.getActiveMipmapLevel=function(){return M},this.getRenderTarget=function(){return I},this.setRenderTargetTextures=function(t,e,i){const n=nt.get(t);n.__autoAllocateDepthBuffer=!1===t.resolveDepthBuffer,!1===n.__autoAllocateDepthBuffer&&(n.__useRenderToTexture=!1),nt.get(t.texture).__webglTexture=e,nt.get(t.depthTexture).__webglTexture=n.__autoAllocateDepthBuffer?void 0:i,n.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(t,e){const i=nt.get(t);i.__webglFramebuffer=e,i.__useDefaultFramebuffer=void 0===e};const Vt=Et.createFramebuffer();this.setRenderTarget=function(t,e=0,i=0){I=t,w=e,M=i;let n=null,r=!1,s=!1;if(t){const a=nt.get(t);if(void 0!==a.__useDefaultFramebuffer)return et.bindFramebuffer(Et.FRAMEBUFFER,a.__webglFramebuffer),R.copy(t.viewport),D.copy(t.scissor),L=t.scissorTest,et.viewport(R),et.scissor(D),et.setScissorTest(L),void(T=-1);if(void 0===a.__webglFramebuffer)rt.setupRenderTarget(t);else if(a.__hasExternalTextures)rt.rebindTextures(t,nt.get(t.texture).__webglTexture,nt.get(t.depthTexture).__webglTexture);else if(t.depthBuffer){const e=t.depthTexture;if(a.__boundDepthTexture!==e){if(null!==e&&nt.has(e)&&(t.width!==e.image.width||t.height!==e.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");rt.setupDepthRenderbuffer(t)}}const o=t.texture;(o.isData3DTexture||o.isDataArrayTexture||o.isCompressedArrayTexture)&&(s=!0);const l=nt.get(t).__webglFramebuffer;t.isWebGLCubeRenderTarget?(n=Array.isArray(l[e])?l[e][i]:l[e],r=!0):n=t.samples>0&&!1===rt.useMultisampledRTT(t)?nt.get(t).__webglMultisampledFramebuffer:Array.isArray(l)?l[i]:l,R.copy(t.viewport),D.copy(t.scissor),L=t.scissorTest}else R.copy(G).multiplyScalar(O).floor(),D.copy(z).multiplyScalar(O).floor(),L=H;0!==i&&(n=Vt);if(et.bindFramebuffer(Et.FRAMEBUFFER,n)&&et.drawBuffers(t,n),et.viewport(R),et.scissor(D),et.setScissorTest(L),r){const n=nt.get(t.texture);Et.framebufferTexture2D(Et.FRAMEBUFFER,Et.COLOR_ATTACHMENT0,Et.TEXTURE_CUBE_MAP_POSITIVE_X+e,n.__webglTexture,i)}else if(s){const n=e;for(let e=0;e<t.textures.length;e++){const r=nt.get(t.textures[e]);Et.framebufferTextureLayer(Et.FRAMEBUFFER,Et.COLOR_ATTACHMENT0+e,r.__webglTexture,i,n)}}else if(null!==t&&0!==i){const e=nt.get(t.texture);Et.framebufferTexture2D(Et.FRAMEBUFFER,Et.COLOR_ATTACHMENT0,Et.TEXTURE_2D,e.__webglTexture,i)}T=-1},this.readRenderTargetPixels=function(t,e,i,n,r,s,a,o=0){if(!t||!t.isWebGLRenderTarget)return void en("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let l=nt.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==a&&(l=l[a]),l){et.bindFramebuffer(Et.FRAMEBUFFER,l);try{const a=t.textures[o],l=a.format,c=a.type;if(t.textures.length>1&&Et.readBuffer(Et.COLOR_ATTACHMENT0+o),!tt.textureFormatReadable(l))return void en("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!tt.textureTypeReadable(c))return void en("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");e>=0&&e<=t.width-n&&i>=0&&i<=t.height-r&&Et.readPixels(e,i,n,r,yt.convert(l),yt.convert(c),s)}finally{const t=null!==I?nt.get(I).__webglFramebuffer:null;et.bindFramebuffer(Et.FRAMEBUFFER,t)}}},this.readRenderTargetPixelsAsync=async function(t,e,i,n,r,s,a,o=0){if(!t||!t.isWebGLRenderTarget)throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let l=nt.get(t).__webglFramebuffer;if(t.isWebGLCubeRenderTarget&&void 0!==a&&(l=l[a]),l){if(e>=0&&e<=t.width-n&&i>=0&&i<=t.height-r){et.bindFramebuffer(Et.FRAMEBUFFER,l);const a=t.textures[o],c=a.format,h=a.type;if(t.textures.length>1&&Et.readBuffer(Et.COLOR_ATTACHMENT0+o),!tt.textureFormatReadable(c))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!tt.textureTypeReadable(h))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const u=Et.createBuffer();Et.bindBuffer(Et.PIXEL_PACK_BUFFER,u),Et.bufferData(Et.PIXEL_PACK_BUFFER,s.byteLength,Et.STREAM_READ),Et.readPixels(e,i,n,r,yt.convert(c),yt.convert(h),0);const d=null!==I?nt.get(I).__webglFramebuffer:null;et.bindFramebuffer(Et.FRAMEBUFFER,d);const p=Et.fenceSync(Et.SYNC_GPU_COMMANDS_COMPLETE,0);return Et.flush(),await function(t,e,i){return new Promise(function(n,r){setTimeout(function s(){switch(t.clientWaitSync(e,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:r();break;case t.TIMEOUT_EXPIRED:setTimeout(s,i);break;default:n()}},i)})}(Et,p,4),Et.bindBuffer(Et.PIXEL_PACK_BUFFER,u),Et.getBufferSubData(Et.PIXEL_PACK_BUFFER,0,s),Et.deleteBuffer(u),Et.deleteSync(p),s}throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(t,e=null,i=0){const n=Math.pow(2,-i),r=Math.floor(t.image.width*n),s=Math.floor(t.image.height*n),a=null!==e?e.x:0,o=null!==e?e.y:0;rt.setTexture2D(t,0),Et.copyTexSubImage2D(Et.TEXTURE_2D,i,0,0,a,o,r,s),et.unbindTexture()};const qt=Et.createFramebuffer(),jt=Et.createFramebuffer();this.copyTextureToTexture=function(t,e,i=null,n=null,r=0,s=0){let a,o,l,c,h,u,d,p,A;const g=t.isCompressedTexture?t.mipmaps[s]:t.image;if(null!==i)a=i.max.x-i.min.x,o=i.max.y-i.min.y,l=i.isBox3?i.max.z-i.min.z:1,c=i.min.x,h=i.min.y,u=i.isBox3?i.min.z:0;else{const e=Math.pow(2,-r);a=Math.floor(g.width*e),o=Math.floor(g.height*e),l=t.isDataArrayTexture?g.depth:t.isData3DTexture?Math.floor(g.depth*e):1,c=0,h=0,u=0}null!==n?(d=n.x,p=n.y,A=n.z):(d=0,p=0,A=0);const m=yt.convert(e.format),f=yt.convert(e.type);let b;e.isData3DTexture?(rt.setTexture3D(e,0),b=Et.TEXTURE_3D):e.isDataArrayTexture||e.isCompressedArrayTexture?(rt.setTexture2DArray(e,0),b=Et.TEXTURE_2D_ARRAY):(rt.setTexture2D(e,0),b=Et.TEXTURE_2D),Et.pixelStorei(Et.UNPACK_FLIP_Y_WEBGL,e.flipY),Et.pixelStorei(Et.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.premultiplyAlpha),Et.pixelStorei(Et.UNPACK_ALIGNMENT,e.unpackAlignment);const v=Et.getParameter(Et.UNPACK_ROW_LENGTH),y=Et.getParameter(Et.UNPACK_IMAGE_HEIGHT),x=Et.getParameter(Et.UNPACK_SKIP_PIXELS),_=Et.getParameter(Et.UNPACK_SKIP_ROWS),E=Et.getParameter(Et.UNPACK_SKIP_IMAGES);Et.pixelStorei(Et.UNPACK_ROW_LENGTH,g.width),Et.pixelStorei(Et.UNPACK_IMAGE_HEIGHT,g.height),Et.pixelStorei(Et.UNPACK_SKIP_PIXELS,c),Et.pixelStorei(Et.UNPACK_SKIP_ROWS,h),Et.pixelStorei(Et.UNPACK_SKIP_IMAGES,u);const S=t.isDataArrayTexture||t.isData3DTexture,C=e.isDataArrayTexture||e.isData3DTexture;if(t.isDepthTexture){const i=nt.get(t),n=nt.get(e),g=nt.get(i.__renderTarget),m=nt.get(n.__renderTarget);et.bindFramebuffer(Et.READ_FRAMEBUFFER,g.__webglFramebuffer),et.bindFramebuffer(Et.DRAW_FRAMEBUFFER,m.__webglFramebuffer);for(let i=0;i<l;i++)S&&(Et.framebufferTextureLayer(Et.READ_FRAMEBUFFER,Et.COLOR_ATTACHMENT0,nt.get(t).__webglTexture,r,u+i),Et.framebufferTextureLayer(Et.DRAW_FRAMEBUFFER,Et.COLOR_ATTACHMENT0,nt.get(e).__webglTexture,s,A+i)),Et.blitFramebuffer(c,h,a,o,d,p,a,o,Et.DEPTH_BUFFER_BIT,Et.NEAREST);et.bindFramebuffer(Et.READ_FRAMEBUFFER,null),et.bindFramebuffer(Et.DRAW_FRAMEBUFFER,null)}else if(0!==r||t.isRenderTargetTexture||nt.has(t)){const i=nt.get(t),n=nt.get(e);et.bindFramebuffer(Et.READ_FRAMEBUFFER,qt),et.bindFramebuffer(Et.DRAW_FRAMEBUFFER,jt);for(let t=0;t<l;t++)S?Et.framebufferTextureLayer(Et.READ_FRAMEBUFFER,Et.COLOR_ATTACHMENT0,i.__webglTexture,r,u+t):Et.framebufferTexture2D(Et.READ_FRAMEBUFFER,Et.COLOR_ATTACHMENT0,Et.TEXTURE_2D,i.__webglTexture,r),C?Et.framebufferTextureLayer(Et.DRAW_FRAMEBUFFER,Et.COLOR_ATTACHMENT0,n.__webglTexture,s,A+t):Et.framebufferTexture2D(Et.DRAW_FRAMEBUFFER,Et.COLOR_ATTACHMENT0,Et.TEXTURE_2D,n.__webglTexture,s),0!==r?Et.blitFramebuffer(c,h,a,o,d,p,a,o,Et.COLOR_BUFFER_BIT,Et.NEAREST):C?Et.copyTexSubImage3D(b,s,d,p,A+t,c,h,a,o):Et.copyTexSubImage2D(b,s,d,p,c,h,a,o);et.bindFramebuffer(Et.READ_FRAMEBUFFER,null),et.bindFramebuffer(Et.DRAW_FRAMEBUFFER,null)}else C?t.isDataTexture||t.isData3DTexture?Et.texSubImage3D(b,s,d,p,A,a,o,l,m,f,g.data):e.isCompressedArrayTexture?Et.compressedTexSubImage3D(b,s,d,p,A,a,o,l,m,g.data):Et.texSubImage3D(b,s,d,p,A,a,o,l,m,f,g):t.isDataTexture?Et.texSubImage2D(Et.TEXTURE_2D,s,d,p,a,o,m,f,g.data):t.isCompressedTexture?Et.compressedTexSubImage2D(Et.TEXTURE_2D,s,d,p,g.width,g.height,m,g.data):Et.texSubImage2D(Et.TEXTURE_2D,s,d,p,a,o,m,f,g);Et.pixelStorei(Et.UNPACK_ROW_LENGTH,v),Et.pixelStorei(Et.UNPACK_IMAGE_HEIGHT,y),Et.pixelStorei(Et.UNPACK_SKIP_PIXELS,x),Et.pixelStorei(Et.UNPACK_SKIP_ROWS,_),Et.pixelStorei(Et.UNPACK_SKIP_IMAGES,E),0===s&&e.generateMipmaps&&Et.generateMipmap(b),et.unbindTexture()},this.initRenderTarget=function(t){void 0===nt.get(t).__webglFramebuffer&&rt.setupRenderTarget(t)},this.initTexture=function(t){t.isCubeTexture?rt.setTextureCube(t,0):t.isData3DTexture?rt.setTexture3D(t,0):t.isDataArrayTexture||t.isCompressedArrayTexture?rt.setTexture2DArray(t,0):rt.setTexture2D(t,0),et.unbindTexture()},this.resetState=function(){w=0,M=0,I=null,et.reset(),xt.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Wi}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;const e=this.getContext();e.drawingBufferColorSpace=Mn._getDrawingBufferColorSpace(t),e.unpackColorSpace=Mn._getUnpackColorSpace()}}
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/const Td=null!=navigator.xr&&null!=self.XRSession&&null!=navigator.xr.isSessionSupported,Bd=Td&&null!=self.XRSession.prototype.requestHitTestSource,Rd=null!=self.ResizeObserver,Dd=null!=self.IntersectionObserver,Ld=Bd;(()=>{const t=navigator.userAgent||navigator.vendor||self.opera;let e=!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(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4)))&&(e=!0)})();const Pd=/android/i.test(navigator.userAgent),Fd=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!self.MSStream||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1,Ud=/firefox/i.test(navigator.userAgent),Nd=/OculusBrowser/.test(navigator.userAgent),Od=Fd&&/CriOS\/|EdgiOS\/|FxiOS\/|GSA\/|DuckDuckGo\//.test(navigator.userAgent),kd=Fd&&/GSA\//.test(navigator.userAgent),Qd=Pd&&!Ud&&!Nd;Boolean(window.webkit&&window.webkit.messageHandlers);const Gd=(()=>{if(Fd){if(Od)return!0;const t=document.createElement("a");return Boolean(t.relList&&t.relList.supports&&t.relList.supports("ar"))}return!1})(),zd=t=>t&&"null"!==t?Vd(t):null,Hd=()=>{if(Ld)return;const t=[];throw Td||t.push("WebXR Device API"),Bd||t.push("WebXR Hit Test API"),new Error(`The following APIs are required for AR, but are missing in this browser: ${t.join(", ")}`)},Vd=t=>new URL(t,window.location.toString()).toString(),qd=(t,e)=>{let i=null;return(...n)=>{null!=i&&self.clearTimeout(i),i=self.setTimeout(()=>{i=null,t(...n)},e)}},jd=(t,e,i)=>Math.max(e,Math.min(i,t)),Wd=(()=>{const t=new RegExp("[?&]model-viewer-debug-mode(&|$)");return()=>self.ModelViewerElement&&self.ModelViewerElement.debugMode||self.location&&self.location.search&&self.location.search.match(t)})();
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
var Xd=function(t,e,i,n){for(var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n,o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};const Kd=Symbol("currentEnvironmentMap"),Jd=Symbol("currentBackground"),Yd=Symbol("updateEnvironment"),$d=Symbol("cancelEnvironmentUpdate");
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
const Zd=G`
|
|
<style>
|
|
:host {
|
|
display: block;
|
|
position: relative;
|
|
contain: strict;
|
|
width: 300px;
|
|
height: 150px;
|
|
}
|
|
|
|
.container {
|
|
position: relative;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.userInput {
|
|
width: 100%;
|
|
height: 100%;
|
|
display: none;
|
|
position: relative;
|
|
outline-offset: -1px;
|
|
outline-width: 1px;
|
|
}
|
|
|
|
canvas {
|
|
position: absolute;
|
|
display: none;
|
|
pointer-events: none;
|
|
/* NOTE(cdata): Chrome 76 and below apparently have a bug
|
|
* that causes our canvas not to display pixels unless it is
|
|
* on its own render layer
|
|
* @see https://github.com/google/model-viewer/pull/755#issuecomment-536597893
|
|
*/
|
|
transform: translateZ(0);
|
|
}
|
|
|
|
.show {
|
|
display: block;
|
|
}
|
|
|
|
/* Adapted from HTML5 Boilerplate
|
|
*
|
|
* @see https://github.com/h5bp/html5-boilerplate/blob/ceb4620c78fc82e13534fc44202a3f168754873f/dist/css/main.css#L122-L133 */
|
|
.screen-reader-only {
|
|
border: 0;
|
|
left: 0;
|
|
top: 0;
|
|
clip: rect(0, 0, 0, 0);
|
|
height: 1px;
|
|
margin: -1px;
|
|
overflow: hidden;
|
|
padding: 0;
|
|
position: absolute;
|
|
white-space: nowrap;
|
|
width: 1px;
|
|
pointer-events: none;
|
|
}
|
|
|
|
.slot {
|
|
position: absolute;
|
|
pointer-events: none;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
}
|
|
|
|
.slot > * {
|
|
pointer-events: initial;
|
|
}
|
|
|
|
.annotation-wrapper ::slotted(*) {
|
|
opacity: var(--max-hotspot-opacity, 1);
|
|
transition: opacity 0.3s;
|
|
}
|
|
|
|
.pointer-tumbling .annotation-wrapper ::slotted(*) {
|
|
pointer-events: none;
|
|
}
|
|
|
|
.annotation-wrapper ::slotted(*) {
|
|
pointer-events: initial;
|
|
}
|
|
|
|
.annotation-wrapper.hide ::slotted(*) {
|
|
opacity: var(--min-hotspot-opacity, 0.25);
|
|
}
|
|
|
|
.slot.poster {
|
|
display: none;
|
|
background-color: inherit;
|
|
}
|
|
|
|
.slot.poster.show {
|
|
display: inherit;
|
|
}
|
|
|
|
.slot.poster > * {
|
|
pointer-events: initial;
|
|
}
|
|
|
|
.slot.poster:not(.show) > * {
|
|
pointer-events: none;
|
|
}
|
|
|
|
#default-poster {
|
|
width: 100%;
|
|
height: 100%;
|
|
/* The default poster is a <button> so we need to set display
|
|
* to prevent it from being affected by text-align: */
|
|
display: block;
|
|
position: absolute;
|
|
border: none;
|
|
padding: 0;
|
|
background-size: contain;
|
|
background-repeat: no-repeat;
|
|
background-position: center;
|
|
background-color: #fff0;
|
|
}
|
|
|
|
#default-progress-bar {
|
|
display: block;
|
|
position: relative;
|
|
width: 100%;
|
|
height: 100%;
|
|
pointer-events: none;
|
|
overflow: hidden;
|
|
}
|
|
|
|
#default-progress-bar > .bar {
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: var(--progress-bar-height, 5px);
|
|
background-color: var(--progress-bar-color, rgba(0, 0, 0, 0.4));
|
|
transition: transform 0.09s;
|
|
transform-origin: top left;
|
|
transform: scaleX(0);
|
|
overflow: hidden;
|
|
}
|
|
|
|
#default-progress-bar > .bar.hide {
|
|
transition: opacity 0.3s 1s;
|
|
opacity: 0;
|
|
}
|
|
|
|
.centered {
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
.cover {
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
pointer-events: none;
|
|
}
|
|
|
|
.slot.interaction-prompt {
|
|
display: var(--interaction-prompt-display, flex);
|
|
overflow: hidden;
|
|
opacity: 0;
|
|
will-change: opacity;
|
|
transition: opacity 0.3s;
|
|
}
|
|
|
|
.slot.interaction-prompt.visible {
|
|
opacity: 1;
|
|
}
|
|
|
|
.animated-container {
|
|
will-change: transform, opacity;
|
|
opacity: 0;
|
|
transition: opacity 0.3s;
|
|
}
|
|
|
|
.slot.interaction-prompt > * {
|
|
pointer-events: none;
|
|
}
|
|
|
|
.slot.ar-button {
|
|
-moz-user-select: none;
|
|
-webkit-tap-highlight-color: transparent;
|
|
user-select: none;
|
|
|
|
display: var(--ar-button-display, block);
|
|
}
|
|
|
|
.slot.ar-button:not(.enabled) {
|
|
display: none;
|
|
}
|
|
|
|
.fab {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
box-sizing: border-box;
|
|
width: 40px;
|
|
height: 40px;
|
|
cursor: pointer;
|
|
background-color: #fff;
|
|
box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.15);
|
|
border-radius: 100px;
|
|
}
|
|
|
|
.fab > * {
|
|
opacity: 0.87;
|
|
}
|
|
|
|
#default-ar-button {
|
|
position: absolute;
|
|
bottom: 16px;
|
|
right: 16px;
|
|
transform: scale(var(--ar-button-scale, 1));
|
|
transform-origin: bottom right;
|
|
}
|
|
|
|
.slot.pan-target {
|
|
display: block;
|
|
position: absolute;
|
|
width: 0;
|
|
height: 0;
|
|
left: 50%;
|
|
top: 50%;
|
|
transform: translate3d(-50%, -50%, 0);
|
|
background-color: transparent;
|
|
opacity: 0;
|
|
transition: opacity 0.3s;
|
|
}
|
|
|
|
#default-pan-target {
|
|
width: 6px;
|
|
height: 6px;
|
|
border-radius: 6px;
|
|
border: 1px solid white;
|
|
box-shadow: 0px 0px 2px 1px rgba(0, 0, 0, 0.8);
|
|
}
|
|
|
|
.slot.default {
|
|
pointer-events: none;
|
|
}
|
|
|
|
.slot.progress-bar {
|
|
pointer-events: none;
|
|
}
|
|
|
|
.slot.exit-webxr-ar-button {
|
|
pointer-events: none;
|
|
}
|
|
|
|
.slot.exit-webxr-ar-button > slot,
|
|
.slot.exit-webxr-ar-button ::slotted(*) {
|
|
pointer-events: auto;
|
|
}
|
|
|
|
.slot.exit-webxr-ar-button:not(.enabled) {
|
|
display: none;
|
|
}
|
|
|
|
#default-exit-webxr-ar-button {
|
|
pointer-events: auto;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
position: absolute;
|
|
top: env(safe-area-inset-top, 16px);
|
|
right: 16px;
|
|
width: 40px;
|
|
height: 40px;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
#default-exit-webxr-ar-button > svg {
|
|
fill: #fff;
|
|
}
|
|
</style>
|
|
<div class="container">
|
|
<div class="userInput" tabindex="0" role="img"
|
|
aria-label="3D model">
|
|
<div class="slot canvas">
|
|
<slot name="canvas">
|
|
<canvas></canvas>
|
|
</slot>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- NOTE(cdata): We need to wrap slots because browsers without ShadowDOM
|
|
will have their <slot> elements removed by ShadyCSS -->
|
|
<div class="slot poster">
|
|
<slot name="poster">
|
|
<button type="button" id="default-poster" aria-hidden="true" aria-label="Loading 3D model"></button>
|
|
</slot>
|
|
</div>
|
|
|
|
<div class="slot ar-button">
|
|
<slot name="ar-button">
|
|
<a id="default-ar-button" part="default-ar-button" class="fab"
|
|
tabindex="2"
|
|
role="button"
|
|
href="javascript:void(0);"
|
|
aria-label="View in your space">
|
|
${G`
|
|
<svg version="1.1" id="view_x5F_in_x5F_AR_x5F_icon"
|
|
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px"
|
|
viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve">
|
|
<rect id="Bounding_Box" x="0" y="0" fill="none" width="24" height="24"/>
|
|
<g id="Art_layer">
|
|
<path d="M3,4c0-0.55,0.45-1,1-1h2V1H4C2.35,1,1,2.35,1,4v2h2V4z"/>
|
|
<path d="M20,3c0.55,0,1,0.45,1,1v2h2V4c0-1.65-1.35-3-3-3h-2v2H20z"/>
|
|
<path d="M4,21c-0.55,0-1-0.45-1-1v-2H1v2c0,1.65,1.35,3,3,3h2v-2H4z"/>
|
|
<path d="M20,21c0.55,0,1-0.45,1-1v-2h2v2c0,1.65-1.35,3-3,3h-2v-2H20z"/>
|
|
<g>
|
|
<path d="M18.25,7.6l-5.5-3.18c-0.46-0.27-1.04-0.27-1.5,0L5.75,7.6C5.29,7.87,5,8.36,5,8.9v6.35c0,0.54,0.29,1.03,0.75,1.3
|
|
l5.5,3.18c0.46,0.27,1.04,0.27,1.5,0l5.5-3.18c0.46-0.27,0.75-0.76,0.75-1.3V8.9C19,8.36,18.71,7.87,18.25,7.6z M7,14.96v-4.62
|
|
l4,2.32v4.61L7,14.96z M12,10.93L8,8.61l4-2.31l4,2.31L12,10.93z M13,17.27v-4.61l4-2.32v4.62L13,17.27z"/>
|
|
</g>
|
|
</g>
|
|
</svg>`}
|
|
</a>
|
|
</slot>
|
|
</div>
|
|
|
|
<div class="slot pan-target">
|
|
<slot name="pan-target">
|
|
<div id="default-pan-target">
|
|
</div>
|
|
</slot>
|
|
</div>
|
|
|
|
<div class="slot interaction-prompt cover centered">
|
|
<div id="prompt" class="animated-container">
|
|
<slot name="interaction-prompt" aria-hidden="true">
|
|
${G`
|
|
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="25" height="36">
|
|
<defs>
|
|
<path id="A" d="M.001.232h24.997V36H.001z" />
|
|
</defs>
|
|
<g transform="translate(-11 -4)" fill="none" fill-rule="evenodd">
|
|
<path fill-opacity="0" fill="#fff" d="M0 0h44v44H0z" />
|
|
<g transform="translate(11 3)">
|
|
<path d="M8.733 11.165c.04-1.108.766-2.027 1.743-2.307a2.54 2.54 0 0 1 .628-.089c.16 0 .314.017.463.044 1.088.2 1.9 1.092 1.9 2.16v8.88h1.26c2.943-1.39 5-4.45 5-8.025a9.01 9.01 0 0 0-1.9-5.56l-.43-.5c-.765-.838-1.683-1.522-2.712-2-1.057-.49-2.226-.77-3.46-.77s-2.4.278-3.46.77c-1.03.478-1.947 1.162-2.71 2l-.43.5a9.01 9.01 0 0 0-1.9 5.56 9.04 9.04 0 0 0 .094 1.305c.03.21.088.41.13.617l.136.624c.083.286.196.56.305.832l.124.333a8.78 8.78 0 0 0 .509.953l.065.122a8.69 8.69 0 0 0 3.521 3.191l1.11.537v-9.178z" fill-opacity=".5" fill="#e4e4e4" />
|
|
<path d="M22.94 26.218l-2.76 7.74c-.172.485-.676.8-1.253.8H12.24c-1.606 0-3.092-.68-3.98-1.82-1.592-2.048-3.647-3.822-6.11-5.27-.095-.055-.15-.137-.152-.23-.004-.1.046-.196.193-.297.56-.393 1.234-.6 1.926-.6a3.43 3.43 0 0 1 .691.069l4.922.994V10.972c0-.663.615-1.203 1.37-1.203s1.373.54 1.373 1.203v9.882h2.953c.273 0 .533.073.757.21l6.257 3.874c.027.017.045.042.07.06.41.296.586.77.426 1.22M4.1 16.614c-.024-.04-.042-.083-.065-.122a8.69 8.69 0 0 1-.509-.953c-.048-.107-.08-.223-.124-.333l-.305-.832c-.058-.202-.09-.416-.136-.624l-.13-.617a9.03 9.03 0 0 1-.094-1.305c0-2.107.714-4.04 1.9-5.56l.43-.5c.764-.84 1.682-1.523 2.71-2 1.058-.49 2.226-.77 3.46-.77s2.402.28 3.46.77c1.03.477 1.947 1.16 2.712 2l.428.5a9 9 0 0 1 1.901 5.559c0 3.577-2.056 6.636-5 8.026h-1.26v-8.882c0-1.067-.822-1.96-1.9-2.16-.15-.028-.304-.044-.463-.044-.22 0-.427.037-.628.09-.977.28-1.703 1.198-1.743 2.306v9.178l-1.11-.537C6.18 19.098 4.96 18 4.1 16.614M22.97 24.09l-6.256-3.874c-.102-.063-.218-.098-.33-.144 2.683-1.8 4.354-4.855 4.354-8.243 0-.486-.037-.964-.104-1.43a9.97 9.97 0 0 0-1.57-4.128l-.295-.408-.066-.092a10.05 10.05 0 0 0-.949-1.078c-.342-.334-.708-.643-1.094-.922-1.155-.834-2.492-1.412-3.94-1.65l-.732-.088-.748-.03a9.29 9.29 0 0 0-1.482.119c-1.447.238-2.786.816-3.94 1.65a9.33 9.33 0 0 0-.813.686 9.59 9.59 0 0 0-.845.877l-.385.437-.36.5-.288.468-.418.778-.04.09c-.593 1.28-.93 2.71-.93 4.222 0 3.832 2.182 7.342 5.56 8.938l1.437.68v4.946L5 25.64a4.44 4.44 0 0 0-.888-.086c-.017 0-.034.003-.05.003-.252.004-.503.033-.75.08a5.08 5.08 0 0 0-.237.056c-.193.046-.382.107-.568.18-.075.03-.15.057-.225.1-.25.114-.494.244-.723.405a1.31 1.31 0 0 0-.566 1.122 1.28 1.28 0 0 0 .645 1.051C4 29.925 5.96 31.614 7.473 33.563a5.06 5.06 0 0 0 .434.491c1.086 1.082 2.656 1.713 4.326 1.715h6.697c.748-.001 1.43-.333 1.858-.872.142-.18.256-.38.336-.602l2.757-7.74c.094-.26.13-.53.112-.794s-.088-.52-.203-.76a2.19 2.19 0 0 0-.821-.91" fill-opacity=".6" fill="#000" />
|
|
<path d="M22.444 24.94l-6.257-3.874a1.45 1.45 0 0 0-.757-.211h-2.953v-9.88c0-.663-.616-1.203-1.373-1.203s-1.37.54-1.37 1.203v16.643l-4.922-.994a3.44 3.44 0 0 0-.692-.069 3.35 3.35 0 0 0-1.925.598c-.147.102-.198.198-.194.298.004.094.058.176.153.23 2.462 1.448 4.517 3.22 6.11 5.27.887 1.14 2.373 1.82 3.98 1.82h6.686c.577 0 1.08-.326 1.253-.8l2.76-7.74c.16-.448-.017-.923-.426-1.22-.025-.02-.043-.043-.07-.06z" fill="#fff" />
|
|
<g transform="translate(0 .769)">
|
|
<mask id="B" fill="#fff">
|
|
<use xlink:href="#A" />
|
|
</mask>
|
|
<path d="M23.993 24.992a1.96 1.96 0 0 1-.111.794l-2.758 7.74c-.08.22-.194.423-.336.602-.427.54-1.11.87-1.857.872h-6.698c-1.67-.002-3.24-.633-4.326-1.715-.154-.154-.3-.318-.434-.49C5.96 30.846 4 29.157 1.646 27.773c-.385-.225-.626-.618-.645-1.05a1.31 1.31 0 0 1 .566-1.122 4.56 4.56 0 0 1 .723-.405l.225-.1a4.3 4.3 0 0 1 .568-.18l.237-.056c.248-.046.5-.075.75-.08.018 0 .034-.003.05-.003.303-.001.597.027.89.086l3.722.752V20.68l-1.436-.68c-3.377-1.596-5.56-5.106-5.56-8.938 0-1.51.336-2.94.93-4.222.015-.03.025-.06.04-.09.127-.267.268-.525.418-.778.093-.16.186-.316.288-.468.063-.095.133-.186.2-.277L3.773 5c.118-.155.26-.29.385-.437.266-.3.544-.604.845-.877a9.33 9.33 0 0 1 .813-.686C6.97 2.167 8.31 1.59 9.757 1.35a9.27 9.27 0 0 1 1.481-.119 8.82 8.82 0 0 1 .748.031c.247.02.49.05.733.088 1.448.238 2.786.816 3.94 1.65.387.28.752.588 1.094.922a9.94 9.94 0 0 1 .949 1.078l.066.092c.102.133.203.268.295.408a9.97 9.97 0 0 1 1.571 4.128c.066.467.103.945.103 1.43 0 3.388-1.67 6.453-4.353 8.243.11.046.227.08.33.144l6.256 3.874c.37.23.645.55.82.9.115.24.185.498.203.76m.697-1.195c-.265-.55-.677-1.007-1.194-1.326l-5.323-3.297c2.255-2.037 3.564-4.97 3.564-8.114 0-2.19-.637-4.304-1.84-6.114-.126-.188-.26-.37-.4-.552-.645-.848-1.402-1.6-2.252-2.204C15.472.91 13.393.232 11.238.232A10.21 10.21 0 0 0 5.23 2.19c-.848.614-1.606 1.356-2.253 2.205-.136.18-.272.363-.398.55C1.374 6.756.737 8.87.737 11.06c0 4.218 2.407 8.08 6.133 9.842l.863.41v3.092l-2.525-.51c-.356-.07-.717-.106-1.076-.106a5.45 5.45 0 0 0-3.14.996c-.653.46-1.022 1.202-.99 1.983a2.28 2.28 0 0 0 1.138 1.872c2.24 1.318 4.106 2.923 5.543 4.772 1.26 1.62 3.333 2.59 5.55 2.592h6.698c1.42-.001 2.68-.86 3.134-2.138l2.76-7.74c.272-.757.224-1.584-.134-2.325" fill-opacity=".05" fill="#000" mask="url(#B)" />
|
|
</g>
|
|
</g>
|
|
</g>
|
|
</svg>`
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/}
|
|
</slot>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="finger0" class="animated-container cover">
|
|
<slot name="finger0" aria-hidden="true">
|
|
</slot>
|
|
</div>
|
|
<div id="finger1" class="animated-container cover">
|
|
<slot name="finger1" aria-hidden="true">
|
|
</slot>
|
|
</div>
|
|
|
|
<div class="slot default">
|
|
<slot></slot>
|
|
|
|
<div class="slot progress-bar">
|
|
<slot name="progress-bar">
|
|
<div id="default-progress-bar" aria-hidden="true">
|
|
<div class="bar" part="default-progress-bar"></div>
|
|
</div>
|
|
</slot>
|
|
</div>
|
|
|
|
<div class="slot exit-webxr-ar-button">
|
|
<slot name="exit-webxr-ar-button">
|
|
<a id="default-exit-webxr-ar-button" part="default-exit-webxr-ar-button"
|
|
tabindex="3"
|
|
aria-label="Exit AR"
|
|
aria-hidden="true">
|
|
${G`
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="#000000">
|
|
<!-- NOTE(cdata): This SVG filter is a stop-gap until we can implement
|
|
support for dynamic re-coloring of UI components -->
|
|
<defs>
|
|
<filter id="drop-shadow" x="-100%" y="-100%" width="300%" height="300%">
|
|
<feGaussianBlur in="SourceAlpha" stdDeviation="1"/>
|
|
<feOffset dx="0" dy="0" result="offsetblur"/>
|
|
<feFlood flood-color="#000000"/>
|
|
<feComposite in2="offsetblur" operator="in"/>
|
|
<feMerge>
|
|
<feMergeNode/>
|
|
<feMergeNode in="SourceGraphic"/>
|
|
</feMerge>
|
|
</filter>
|
|
</defs>
|
|
<path filter="url(#drop-shadow)" d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/>
|
|
<path d="M0 0h24v24H0z" fill="none"/>
|
|
</svg>`
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/}
|
|
</a>
|
|
</slot>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="screen-reader-only" role="region" aria-label="Live announcements">
|
|
<span id="status" role="status"></span>
|
|
</div>`;var tp=function(){var t=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),e=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if("object"!=typeof WebAssembly)return{supported:!1};var i,n=WebAssembly.validate(t)?s("b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuixkbbebeeddddilve9Weeeviebeoweuec:q:6dkr;Neqo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949WbwY9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVJ9V29VVbDl79IV9Rbqq:Ctklbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk:183lYud97dur978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnalTmbcuhoaiRbbgrc;WeGc:Ge9hmbarcsGgwce0mbc9:hoalcufadcd4cbawEgDadfgrcKcaawEgqaraq0Egk6mbaicefhxavaialfgmar9Rgoad;8qbbcj;abad9Uc;WFbGcjdadca0EhPdndndnadTmbaoadfhscbhzinaeaz9nmdamax9RaD6miabazad2fhHaxaDfhOaPaeaz9RazaPfae6EgAcsfgocl4cifcd4hCavcj;cbfaoc9WGgXcetfhQavcj;cbfaXci2fhLavcj;cbfaXfhKcbhYaoc;ab6h8AincbhodnawTmbaxaYcd4fRbbhokaocFeGhEcbh3avcj;cbfh5indndndndnaEa3cet4ciGgoc9:fPdebdkamaO9RaX6mwavcj;cbfa3aX2faOaX;8qbbaOaAfhOxdkavcj;cbfa3aX2fcbaX;8kbxekamaO9RaC6moaoclVcbawEhraOaCfhocbhidna8Ambamao9Rc;Gb6mbcbhlina5alfhidndndndndndnaOalco4fRbbgqciGarfPDbedibledibkaipxbbbbbbbbbbbbbbbbpklbxlkaiaopbblaopbbbg8Eclp:mea8EpmbzeHdOiAlCvXoQrLg8Ecdp:mea8EpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9og8Fpxiiiiiiiiiiiiiiiip8Jg8Ep5b9cjF;8;4;W;G;ab9:9cU1:Ngacitc:q1jjbfpbibaac:q:yjjbfRbbgapsa8Ep5e9cjF;8;4;W;G;ab9:9cU1:Nghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPa8Fa8Ep9spklbaaaoclffahc:q:yjjbfRbbfhoxikaiaopbbwaopbbbg8Eclp:mea8EpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9og8Fpxssssssssssssssssp8Jg8Ep5b9cjF;8;4;W;G;ab9:9cU1:Ngacitc:q1jjbfpbibaac:q:yjjbfRbbgapsa8Ep5e9cjF;8;4;W;G;ab9:9cU1:Nghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPa8Fa8Ep9spklbaaaocwffahc:q:yjjbfRbbfhoxdkaiaopbbbpklbaoczfhoxekaiaopbbdaoRbbgacitc:q1jjbfpbibaac:q:yjjbfRbbgapsaoRbeghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPpklbaaaocdffahc:q:yjjbfRbbfhokdndndndndndnaqcd4ciGarfPDbedibledibkaiczfpxbbbbbbbbbbbbbbbbpklbxlkaiczfaopbblaopbbbg8Eclp:mea8EpmbzeHdOiAlCvXoQrLg8Ecdp:mea8EpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9og8Fpxiiiiiiiiiiiiiiiip8Jg8Ep5b9cjF;8;4;W;G;ab9:9cU1:Ngacitc:q1jjbfpbibaac:q:yjjbfRbbgapsa8Ep5e9cjF;8;4;W;G;ab9:9cU1:Nghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPa8Fa8Ep9spklbaaaoclffahc:q:yjjbfRbbfhoxikaiczfaopbbwaopbbbg8Eclp:mea8EpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9og8Fpxssssssssssssssssp8Jg8Ep5b9cjF;8;4;W;G;ab9:9cU1:Ngacitc:q1jjbfpbibaac:q:yjjbfRbbgapsa8Ep5e9cjF;8;4;W;G;ab9:9cU1:Nghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPa8Fa8Ep9spklbaaaocwffahc:q:yjjbfRbbfhoxdkaiczfaopbbbpklbaoczfhoxekaiczfaopbbdaoRbbgacitc:q1jjbfpbibaac:q:yjjbfRbbgapsaoRbeghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPpklbaaaocdffahc:q:yjjbfRbbfhokdndndndndndnaqcl4ciGarfPDbedibledibkaicafpxbbbbbbbbbbbbbbbbpklbxlkaicafaopbblaopbbbg8Eclp:mea8EpmbzeHdOiAlCvXoQrLg8Ecdp:mea8EpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9og8Fpxiiiiiiiiiiiiiiiip8Jg8Ep5b9cjF;8;4;W;G;ab9:9cU1:Ngacitc:q1jjbfpbibaac:q:yjjbfRbbgapsa8Ep5e9cjF;8;4;W;G;ab9:9cU1:Nghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPa8Fa8Ep9spklbaaaoclffahc:q:yjjbfRbbfhoxikaicafaopbbwaopbbbg8Eclp:mea8EpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9og8Fpxssssssssssssssssp8Jg8Ep5b9cjF;8;4;W;G;ab9:9cU1:Ngacitc:q1jjbfpbibaac:q:yjjbfRbbgapsa8Ep5e9cjF;8;4;W;G;ab9:9cU1:Nghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPa8Fa8Ep9spklbaaaocwffahc:q:yjjbfRbbfhoxdkaicafaopbbbpklbaoczfhoxekaicafaopbbdaoRbbgacitc:q1jjbfpbibaac:q:yjjbfRbbgapsaoRbeghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPpklbaaaocdffahc:q:yjjbfRbbfhokdndndndndndnaqco4arfPDbedibledibkaic8Wfpxbbbbbbbbbbbbbbbbpklbxlkaic8Wfaopbblaopbbbg8Eclp:mea8EpmbzeHdOiAlCvXoQrLg8Ecdp:mea8EpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9og8Fpxiiiiiiiiiiiiiiiip8Jg8Ep5b9cjF;8;4;W;G;ab9:9cU1:Ngicitc:q1jjbfpbibaic:q:yjjbfRbbgipsa8Ep5e9cjF;8;4;W;G;ab9:9cU1:Ngqcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPa8Fa8Ep9spklbaiaoclffaqc:q:yjjbfRbbfhoxikaic8Wfaopbbwaopbbbg8Eclp:mea8EpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9og8Fpxssssssssssssssssp8Jg8Ep5b9cjF;8;4;W;G;ab9:9cU1:Ngicitc:q1jjbfpbibaic:q:yjjbfRbbgipsa8Ep5e9cjF;8;4;W;G;ab9:9cU1:Ngqcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPa8Fa8Ep9spklbaiaocwffaqc:q:yjjbfRbbfhoxdkaic8Wfaopbbbpklbaoczfhoxekaic8WfaopbbdaoRbbgicitc:q1jjbfpbibaic:q:yjjbfRbbgipsaoRbegqcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPpklbaiaocdffaqc:q:yjjbfRbbfhokalc;abfhialcjefaX0meaihlamao9Rc;Fb0mbkkdnaiaX9pmbaici4hlinamao9RcK6mwa5aifhqdndndndndndnaOaico4fRbbalcoG4ciGarfPDbedibledibkaqpxbbbbbbbbbbbbbbbbpkbbxlkaqaopbblaopbbbg8Eclp:mea8EpmbzeHdOiAlCvXoQrLg8Ecdp:mea8EpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9og8Fpxiiiiiiiiiiiiiiiip8Jg8Ep5b9cjF;8;4;W;G;ab9:9cU1:Ngacitc:q1jjbfpbibaac:q:yjjbfRbbgapsa8Ep5e9cjF;8;4;W;G;ab9:9cU1:Nghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPa8Fa8Ep9spkbbaaaoclffahc:q:yjjbfRbbfhoxikaqaopbbwaopbbbg8Eclp:mea8EpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9og8Fpxssssssssssssssssp8Jg8Ep5b9cjF;8;4;W;G;ab9:9cU1:Ngacitc:q1jjbfpbibaac:q:yjjbfRbbgapsa8Ep5e9cjF;8;4;W;G;ab9:9cU1:Nghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPa8Fa8Ep9spkbbaaaocwffahc:q:yjjbfRbbfhoxdkaqaopbbbpkbbaoczfhoxekaqaopbbdaoRbbgacitc:q1jjbfpbibaac:q:yjjbfRbbgapsaoRbeghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPpkbbaaaocdffahc:q:yjjbfRbbfhokalcdfhlaiczfgiaX6mbkkaohOaoTmoka5aXfh5a3cefg3cl9hmbkdndndndnawTmbasaYcd4fRbbglciGPlbedwbkaXTmdavcjdfaYfhlavaYfpbdbhgcbhoinalavcj;cbfaofpblbg8JaKaofpblbg8KpmbzeHdOiAlCvXoQrLg8LaQaofpblbg8MaLaofpblbg8NpmbzeHdOiAlCvXoQrLgypmbezHdiOAlvCXorQLg8Ecep9Ta8Epxeeeeeeeeeeeeeeeeg8Fp9op9Hp9rg8Eagp9Uggp9Abbbaladfglaga8Ea8Epmlvorlvorlvorlvorp9Uggp9Abbbaladfglaga8Ea8EpmwDqkwDqkwDqkwDqkp9Uggp9Abbbaladfglaga8Ea8EpmxmPsxmPsxmPsxmPsp9Uggp9Abbbaladfglaga8LaypmwDKYqk8AExm35Ps8E8Fg8Ecep9Ta8Ea8Fp9op9Hp9rg8Ep9Uggp9Abbbaladfglaga8Ea8Epmlvorlvorlvorlvorp9Uggp9Abbbaladfglaga8Ea8EpmwDqkwDqkwDqkwDqkp9Uggp9Abbbaladfglaga8Ea8EpmxmPsxmPsxmPsxmPsp9Uggp9Abbbaladfglaga8Ja8KpmwKDYq8AkEx3m5P8Es8Fg8Ja8Ma8NpmwKDYq8AkEx3m5P8Es8Fg8KpmbezHdiOAlvCXorQLg8Ecep9Ta8Ea8Fp9op9Hp9rg8Ep9Uggp9Abbbaladfglaga8Ea8Epmlvorlvorlvorlvorp9Uggp9Abbbaladfglaga8Ea8EpmwDqkwDqkwDqkwDqkp9Uggp9Abbbaladfglaga8Ea8EpmxmPsxmPsxmPsxmPsp9Uggp9Abbbaladfglaga8Ja8KpmwDKYqk8AExm35Ps8E8Fg8Ecep9Ta8Ea8Fp9op9Hp9rg8Ep9Ug8Fp9Abbbaladfgla8Fa8Ea8Epmlvorlvorlvorlvorp9Ug8Fp9Abbbaladfgla8Fa8Ea8EpmwDqkwDqkwDqkwDqkp9Ug8Fp9Abbbaladfgla8Fa8Ea8EpmxmPsxmPsxmPsxmPsp9Uggp9AbbbaladfhlaoczfgoaX6mbxikkaXTmeavcjdfaYfhlavaYfpbdbhgcbhoinalavcj;cbfaofpblbg8JaKaofpblbg8KpmbzeHdOiAlCvXoQrLg8LaQaofpblbg8MaLaofpblbg8NpmbzeHdOiAlCvXoQrLgypmbezHdiOAlvCXorQLg8Ecep:nea8Epxebebebebebebebebg8Fp9op:bep9rg8Eagp:oeggp9Abbbaladfglaga8Ea8Epmlvorlvorlvorlvorp:oeggp9Abbbaladfglaga8Ea8EpmwDqkwDqkwDqkwDqkp:oeggp9Abbbaladfglaga8Ea8EpmxmPsxmPsxmPsxmPsp:oeggp9Abbbaladfglaga8LaypmwDKYqk8AExm35Ps8E8Fg8Ecep:nea8Ea8Fp9op:bep9rg8Ep:oeggp9Abbbaladfglaga8Ea8Epmlvorlvorlvorlvorp:oeggp9Abbbaladfglaga8Ea8EpmwDqkwDqkwDqkwDqkp:oeggp9Abbbaladfglaga8Ea8EpmxmPsxmPsxmPsxmPsp:oeggp9Abbbaladfglaga8Ja8KpmwKDYq8AkEx3m5P8Es8Fg8Ja8Ma8NpmwKDYq8AkEx3m5P8Es8Fg8KpmbezHdiOAlvCXorQLg8Ecep:nea8Ea8Fp9op:bep9rg8Ep:oeggp9Abbbaladfglaga8Ea8Epmlvorlvorlvorlvorp:oeggp9Abbbaladfglaga8Ea8EpmwDqkwDqkwDqkwDqkp:oeggp9Abbbaladfglaga8Ea8EpmxmPsxmPsxmPsxmPsp:oeggp9Abbbaladfglaga8Ja8KpmwDKYqk8AExm35Ps8E8Fg8Ecep:nea8Ea8Fp9op:bep9rg8Ep:oeg8Fp9Abbbaladfgla8Fa8Ea8Epmlvorlvorlvorlvorp:oeg8Fp9Abbbaladfgla8Fa8Ea8EpmwDqkwDqkwDqkwDqkp:oeg8Fp9Abbbaladfgla8Fa8Ea8EpmxmPsxmPsxmPsxmPsp:oeggp9AbbbaladfhlaoczfgoaX6mbxdkkaXTmbcbhocbalcl4gl9Rc8FGhiavcjdfaYfhravaYfpbdbh8Finaravcj;cbfaofpblbggaKaofpblbg8JpmbzeHdOiAlCvXoQrLg8KaQaofpblbg8LaLaofpblbg8MpmbzeHdOiAlCvXoQrLg8NpmbezHdiOAlvCXorQLg8Eaip:Rea8Ealp:Sep9qg8Ea8Fp9rg8Fp9Abbbaradfgra8Fa8Ea8Epmlvorlvorlvorlvorp9rg8Fp9Abbbaradfgra8Fa8Ea8EpmwDqkwDqkwDqkwDqkp9rg8Fp9Abbbaradfgra8Fa8Ea8EpmxmPsxmPsxmPsxmPsp9rg8Fp9Abbbaradfgra8Fa8Ka8NpmwDKYqk8AExm35Ps8E8Fg8Eaip:Rea8Ealp:Sep9qg8Ep9rg8Fp9Abbbaradfgra8Fa8Ea8Epmlvorlvorlvorlvorp9rg8Fp9Abbbaradfgra8Fa8Ea8EpmwDqkwDqkwDqkwDqkp9rg8Fp9Abbbaradfgra8Fa8Ea8EpmxmPsxmPsxmPsxmPsp9rg8Fp9Abbbaradfgra8Faga8JpmwKDYq8AkEx3m5P8Es8Fgga8La8MpmwKDYq8AkEx3m5P8Es8Fg8JpmbezHdiOAlvCXorQLg8Eaip:Rea8Ealp:Sep9qg8Ep9rg8Fp9Abbbaradfgra8Fa8Ea8Epmlvorlvorlvorlvorp9rg8Fp9Abbbaradfgra8Fa8Ea8EpmwDqkwDqkwDqkwDqkp9rg8Fp9Abbbaradfgra8Fa8Ea8EpmxmPsxmPsxmPsxmPsp9rg8Fp9Abbbaradfgra8Faga8JpmwDKYqk8AExm35Ps8E8Fg8Eaip:Rea8Ealp:Sep9qg8Ep9rg8Fp9Abbbaradfgra8Fa8Ea8Epmlvorlvorlvorlvorp9rg8Fp9Abbbaradfgra8Fa8Ea8EpmwDqkwDqkwDqkwDqkp9rg8Fp9Abbbaradfgra8Fa8Ea8EpmxmPsxmPsxmPsxmPsp9rg8Fp9AbbbaradfhraoczfgoaX6mbkkaYclfgYad6mbkaHavcjdfaAad2;8qbbavavcjdfaAcufad2fad;8qbbaAazfhzc9:hoaOhxaOmbxlkkaeTmbaDalfhrcbhocuhlinaralaD9RglfaD6mdaPaeao9RaoaPfae6Eaofgoae6mbkaial9Rhxkcbc99amax9RakSEhoxekc9:hokavcj;kbf8Kjjjjbaokwbz:bjjjbk:TseHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhldnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhoindnalaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfaoaDcu7gPcl4fcsGcitfgsydlhzasydbhHdndnaDcsGgsak9pmbavaiaPfcsGcdtfydbaxasEhDaxasTgOfhxxekdndnascsSmbcehOasc987asamffcefhDxekalcefhDal8SbbgscFeGhPdndnascu9mmbaDhlxekalcvfhlaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhlkcehOaPce4cbaPceG9R7amfhDkaDhmkavc;abfaocitfgsaDBdbasazBdlavaicdtfaDBdbavc;abfaocefcsGcitfgsaHBdbasaDBdlaocdfhoaOaifhidnadcd9hmbabarcetfgsaH87ebasclfaD87ebascdfaz87ebxdkabarcdtfgsaHBdbascwfaDBdbasclfazBdbxekdnaDcpe0mbaxcefgOavaiaqaDcsGfRbbgscl49RcsGcdtfydbascz6gPEhDavaias9RcsGcdtfydbaOaPfgzascsGgOEhsaOThOdndnadcd9hmbabarcetfgHax87ebaHclfas87ebaHcdfaD87ebxekabarcdtfgHaxBdbaHcwfasBdbaHclfaDBdbkavaicdtfaxBdbavc;abfaocitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfaocefcsGcitfgHasBdbaHaDBdlavaiaPfgicsGcdtfasBdbavc;abfaocdfcsGcitfgDaxBdbaDasBdlaocifhoaiaOfhiazaOfhxxekaxcbalRbbgHEgAaDc;:eSgDfhzaHcsGhCaHcl4hXdndnaHcs0mbazcefhOxekazhOavaiaX9RcsGcdtfydbhzkdndnaCmbaOcefhxxekaOhxavaiaH9RcsGcdtfydbhOkdndnaDTmbalcefhDxekalcdfhDal8SbegPcFeGhsdnaPcu9kmbalcofhAascFbGhscrhldninaD8SbbgPcFbGaltasVhsaPcu9kmeaDcefhDalcrfglc8J9hmbkaAhDxekaDcefhDkasce4cbasceG9R7amfgmhAkdndnaXcsSmbaDhsxekaDcefhsaD8SbbglcFeGhPdnalcu9kmbaDcvfhzaPcFbGhPcrhldninas8SbbgDcFbGaltaPVhPaDcu9kmeascefhsalcrfglc8J9hmbkazhsxekascefhskaPce4cbaPceG9R7amfgmhzkdndnaCcsSmbashlxekascefhlas8SbbgDcFeGhPdnaDcu9kmbascvfhOaPcFbGhPcrhDdninal8SbbgscFbGaDtaPVhPascu9kmealcefhlaDcrfgDc8J9hmbkaOhlxekalcefhlkaPce4cbaPceG9R7amfgmhOkdndnadcd9hmbabarcetfgDaA87ebaDclfaO87ebaDcdfaz87ebxekabarcdtfgDaABdbaDcwfaOBdbaDclfazBdbkavc;abfaocitfgDazBdbaDaABdlavaicdtfaABdbavc;abfaocefcsGcitfgDaOBdbaDazBdlavaicefgicsGcdtfazBdbavc;abfaocdfcsGcitfgDaABdbaDaOBdlavaiaHcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhiaocifhokawcefhwaocsGhoaicsGhiarcifgrae6mbkkcbc99alaqSEhokavc;aef8Kjjjjbaok:clevu8Jjjjjbcz9Rhvdnaecvfal9nmbc9:skdnaiRbbc;:eGc;qeSmbcuskav9cb83iwaicefhoaialfc98fhrdnaeTmbdnadcdSmbcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcdtfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgiBdbalaiBdbawcefgwae9hmbxdkkcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcetfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgi87ebalaiBdbawcefgwae9hmbkkcbc99aoarSEk:2Pliur97eue978Jjjjjbc8W9Rhiaec98Ghldndnadcl9hmbdnalTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalaeSmeaipxbbbbbbbbbbbbbbbbgqpklbaiabalcdtfgdaeciGglcdtgv;8qbbdnalTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDaqp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkadaiav;8qbbskaipxFubbFubbFubbFubbgxpklbdnalTmbcbhvabhdinadczfgmampbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmbediwDqkzHOAKY8AEgwczp:Reczp:Sep;6egraipblbaDaopmlvorxmPsCXQL358E8Fp9op;6eawczp:Sep;6egwp;Gearp;Gep;Kep;Legopxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgPp9op9rp;Kegrpxb;:FSb;:FSb;:FSb;:FSararp;Meaoaop;MeawaqawaPp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFFbbFFbbFFbbFFbbp9oaoawp;Meaqp;Keczp:Rep9qgoarawp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogrpmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oaoarpmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgval6mbkkalaeSmbaiczfpxbbbbbbbbbbbbbbbbgopklbaiaopklbaiabalcitfgdaeciGglcitgv;8qbbaiaxpkladnalTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmbediwDqkzHOAKY8AEgwczp:Reczp:Sep;6egraipblaaDaopmlvorxmPsCXQL358E8Fp9op;6eawczp:Sep;6egwp;Gearp;Gep;Kep;Legopxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgPp9op9rp;Kegrpxb;:FSb;:FSb;:FSb;:FSararp;Meaoaop;MeawaqawaPp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFFbbFFbbFFbbFFbbp9oaoawp;Meaqp;Keczp:Rep9qgoarawp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogrpmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oaoarpmbezHdiOAlvCXorQLp9qpklbkadaiav;8qbbkk:Iwllue97euo978Jjjjjbca9Rhidnaec98GglTmbcbhvabhoinaocKfpx:ji:1S:ji:1S:ji:1S:ji:1SaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkpxibbbibbbibbbibbbp9qgxp;6ep;Negmaxaxp:1ep;7egxaxp;KearaDpmbediwDqkzHOAKY8AEgxczp:Reczp:Sep;6egrarp;Meaxczp:Sep;6egDaDp;Meaqczp:Reczp:Sep;6egqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jep;Mepxbbn0bbn0bbn0bbn0gxp;KepxFFbbFFbbFFbbFFbbgPp9oamaDp;Meaxp;Keczp:Rep9qgDamarp;Meaxp;KeaPp9oamaqp;Meaxp;Keczp:Rep9qgxpmwDKYqk8AExm35Ps8E8Fgrp5eakclp:RegmpEi:T:j83ibawarp5bampEd:T:j83ibaocwfaDaxpmbezHdiOAlvCXorQLgxp5eampEe:T:j83ibaoaxp5bampEb:T:j83ibaocafhoavclfgval6mbkkdnalaeSmbaiczfpxbbbbbbbbbbbbbbbbgmpklbaiampklbaiabalcitfgoaeciGgvcitgw;8qbbdnavTmbaipx:ji:1S:ji:1S:ji:1S:ji:1SaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkpxibbbibbbibbbibbbp9qgxp;6ep;Negmaxaxp:1ep;7egxaxp;KearaDpmbediwDqkzHOAKY8AEgxczp:Reczp:Sep;6egrarp;Meaxczp:Sep;6egDaDp;Meaqczp:Reczp:Sep;6egqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jep;Mepxbbn0bbn0bbn0bbn0gxp;KepxFFbbFFbbFFbbFFbbgPp9oamaDp;Meaxp;Keczp:Rep9qgDamarp;Meaxp;KeaPp9oamaqp;Meaxp;Keczp:Rep9qgxpmwDKYqk8AExm35Ps8E8Fgrp5eakclp:RegmpEi:T:j83iKaiarp5bampEd:T:j83izaiaDaxpmbezHdiOAlvCXorQLgxp5eampEe:T:j83iwaiaxp5bampEb:T:j83ibkaoaiaw;8qbbkk;uddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbheabhdinadadpbbbgocwp:Recwp:Sep;6eaocep:SepxbbjFbbjFbbjFbbjFp9opxbbjZbbjZbbjZbbjZp:Uep;Mepkbbadczfhdaeclfgeav6mbkkdnavalSmbaic8WfpxbbbbbbbbbbbbbbbbgopklbaicafaopklbaiczfaopklbaiaopklbaiabavcdtfgdalciGgecdtgv;8qbbdnaeTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjFbbjFbbjFbbjFp9opxbbjZbbjZbbjZbbjZp:Uep;Mepklbkadaiav;8qbbkk:CPvdue97euw97eu8Jjjjjbc8W9Rhiaec98Ghldndnadcl9hmbaipxbbbbbbbbbbbbbbbbgvpklbdnalTmbcbhoabhdinadpbbbhradpxbbuJbbuJbbuJbbuJaipblbarcKp:Tep9qgwcep:Seawp9qgDcdp:SeaDp9qgDclp:SeaDp9qgqp;6ep;NegDarcwp:RecKp:SegkarpxFbbbFbbbFbbbFbbbgxp9ogmp:Uep;6ep;Mepxbbn0bbn0bbn0bbn0gPp;Kecwp:RepxbFbbbFbbbFbbbFbbp9oaDamakp:Xearczp:RecKp:Segrp:Uep;6ep;MeaPp;Keaxp9op9qaDamakarp:Uep:Xep;6ep;MeaPp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qaDaqawcep:Rep9oawpxebbbebbbebbbebbbp9op9qp;6ep;MeaPp;KecKp:Rep9qpkbbadczfhdaoclfgoal6mbkkalaeSmeaiavpklaaicafabalcdtfgdaeciGglcdtgo;8qbbaiavpklbdnalTmbaipblahraipxbbuJbbuJbbuJbbuJaipblbarcKp:Tep9qgwcep:Seawp9qgDcdp:SeaDp9qgDclp:SeaDp9qgqp;6ep;NegDarcwp:RecKp:SegkarpxFbbbFbbbFbbbFbbbgxp9ogmp:Uep;6ep;Mepxbbn0bbn0bbn0bbn0gPp;Kecwp:RepxbFbbbFbbbFbbbFbbp9oaDamakp:Xearczp:RecKp:Segrp:Uep;6ep;MeaPp;Keaxp9op9qaDamakarp:Uep:Xep;6ep;MeaPp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qaDaqawcep:Rep9oawpxebbbebbbebbbebbbp9op9qp;6ep;MeaPp;KecKp:Rep9qpklakadaicafao;8qbbskaipxbbbbbbbbbbbbbbbbgvpklbdnalTmbcbhoabhdinadczfgspxbFu9hbFu9hbFu9hbFu9hadpbbbgDaspbbbgPpmlvorxmPsCXQL358E8Fgmczp:Teaipblbp9qgrcep:Searp9qgwcdp:Seawp9qgwclp:Seawp9qgwcwp:Seawp9qgqp;6ep;NegwaDaPpmbediwDqkzHOAKY8AEgDpxFFbbFFbbFFbbFFbbgPp9ogkaDczp:Segxp:Ueamczp:Reczp:Segmp:Xep;6ep;Mepxbbn0bbn0bbn0bbn0gDp;KeaPp9oawakaxamp:Uep:Xep;6ep;MeaDp;Keczp:Rep9qgxawaqarcep:Rep9oarpxebbbebbbebbbebbbp9op9qp;6ep;MeaDp;Keczp:Reawamakp:Uep;6ep;MeaDp;KeaPp9op9qgrpmwDKYqk8AExm35Ps8E8FpkbbadaxarpmbezHdiOAlvCXorQLpkbbadcafhdaoclfgoal6mbkkalaeSmbaiczfpxbbbbbbbbbbbbbbbbgrpklbaiarpklbaiabalcitfgdaeciGglcitgo;8qbbaiavpkladnalTmbaipxbFu9hbFu9hbFu9hbFu9haipblbgDaipblzgPpmlvorxmPsCXQL358E8Fgmczp:Teaipblap9qgrcep:Searp9qgwcdp:Seawp9qgwclp:Seawp9qgwcwp:Seawp9qgqp;6ep;NegwaDaPpmbediwDqkzHOAKY8AEgDpxFFbbFFbbFFbbFFbbgPp9ogkaDczp:Segxp:Ueamczp:Reczp:Segmp:Xep;6ep;Mepxbbn0bbn0bbn0bbn0gDp;KeaPp9oawakaxamp:Uep:Xep;6ep;MeaDp;Keczp:Rep9qgxawaqarcep:Rep9oarpxebbbebbbebbbebbbp9op9qp;6ep;MeaDp;Keczp:Reawamakp:Uep;6ep;MeaDp;KeaPp9op9qgrpmwDKYqk8AExm35Ps8E8FpklzaiaxarpmbezHdiOAlvCXorQLpklbkadaiao;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz:Dbb"):s("b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuixkbeeeddddillviebeoweuec:W:Odkr;Neqo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949WboY9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVJ9V29VVbrl79IV9Rbwq;lZkdbk;jYi5ud9:du8Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnalTmbcuhoaiRbbgrc;WeGc:Ge9hmbarcsGgwce0mbc9:hoalcufadcd4cbawEgDadfgrcKcaawEgqaraq0Egk6mbaicefhxcj;abad9Uc;WFbGcjdadca0EhmaialfgPar9Rgoadfhsavaoadz:jjjjbgzceVhHcbhOdndninaeaO9nmeaPax9RaD6mdamaeaO9RaOamfgoae6EgAcsfglc9WGhCabaOad2fhXaAcethQaxaDfhiaOaeaoaeao6E9RhLalcl4cifcd4hKazcj;cbfaAfhYcbh8AazcjdfhEaHh3incbhodnawTmbaxa8Acd4fRbbhokaocFeGh5cbh8Eazcj;cbfhqinaih8Fdndndndna5a8Ecet4ciGgoc9:fPdebdkaPa8F9RaA6mrazcj;cbfa8EaA2fa8FaAz:jjjjb8Aa8FaAfhixdkazcj;cbfa8EaA2fcbaAz:kjjjb8Aa8FhixekaPa8F9RaK6mva8FaKfhidnaCTmbaPai9RcK6mbaocdtc:q1jjbfcj1jjbawEhaczhrcbhlinargoc9Wfghaqfhrdndndndndndnaaa8Fahco4fRbbalcoG4ciGcdtfydbPDbedvivvvlvkar9cb83bbarcwf9cb83bbxlkarcbaiRbdai8Xbb9c:c:qj:bw9:9c:q;c1:I1e:d9c:b:c:e1z9:gg9cjjjjjz:dg8J9qE86bbaqaofgrcGfag9c8F1:NghcKtc8F91aicdfa8J9c8N1:Nfg8KRbbG86bbarcVfcba8KahcjeGcr4fghRbbag9cjjjjjl:dg8J9qE86bbarc7fcbaha8J9c8L1:NfghRbbag9cjjjjjd:dg8J9qE86bbarctfcbaha8J9c8K1:NfghRbbag9cjjjjje:dg8J9qE86bbarc91fcbaha8J9c8J1:NfghRbbag9cjjjj;ab:dg8J9qE86bbarc4fcbaha8J9cg1:NfghRbbag9cjjjja:dg8J9qE86bbarc93fcbaha8J9ch1:NfghRbbag9cjjjjz:dgg9qE86bbarc94fcbahag9ca1:NfghRbbai8Xbe9c:c:qj:bw9:9c:q;c1:I1e:d9c:b:c:e1z9:gg9cjjjjjz:dg8J9qE86bbarc95fag9c8F1:NgicKtc8F91aha8J9c8N1:NfghRbbG86bbarc96fcbahaicjeGcr4fgiRbbag9cjjjjjl:dg8J9qE86bbarc97fcbaia8J9c8L1:NfgiRbbag9cjjjjjd:dg8J9qE86bbarc98fcbaia8J9c8K1:NfgiRbbag9cjjjjje:dg8J9qE86bbarc99fcbaia8J9c8J1:NfgiRbbag9cjjjj;ab:dg8J9qE86bbarc9:fcbaia8J9cg1:NfgiRbbag9cjjjja:dg8J9qE86bbarcufcbaia8J9ch1:NfgiRbbag9cjjjjz:dgg9qE86bbaiag9ca1:NfhixikaraiRblaiRbbghco4g8Ka8KciSg8KE86bbaqaofgrcGfaiclfa8Kfg8KRbbahcl4ciGg8La8LciSg8LE86bbarcVfa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc7fa8Ka8Lfg8KRbbahciGghahciSghE86bbarctfa8Kahfg8KRbbaiRbeghco4g8La8LciSg8LE86bbarc91fa8Ka8Lfg8KRbbahcl4ciGg8La8LciSg8LE86bbarc4fa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc93fa8Ka8Lfg8KRbbahciGghahciSghE86bbarc94fa8Kahfg8KRbbaiRbdghco4g8La8LciSg8LE86bbarc95fa8Ka8Lfg8KRbbahcl4ciGg8La8LciSg8LE86bbarc96fa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc97fa8Ka8Lfg8KRbbahciGghahciSghE86bbarc98fa8KahfghRbbaiRbigico4g8Ka8KciSg8KE86bbarc99faha8KfghRbbaicl4ciGg8Ka8KciSg8KE86bbarc9:faha8KfghRbbaicd4ciGg8Ka8KciSg8KE86bbarcufaha8KfgrRbbaiciGgiaiciSgiE86bbaraifhixdkaraiRbwaiRbbghcl4g8Ka8KcsSg8KE86bbaqaofgrcGfaicwfa8Kfg8KRbbahcsGghahcsSghE86bbarcVfa8KahfghRbbaiRbeg8Kcl4g8La8LcsSg8LE86bbarc7faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarctfaha8KfghRbbaiRbdg8Kcl4g8La8LcsSg8LE86bbarc91faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc4faha8KfghRbbaiRbig8Kcl4g8La8LcsSg8LE86bbarc93faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc94faha8KfghRbbaiRblg8Kcl4g8La8LcsSg8LE86bbarc95faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc96faha8KfghRbbaiRbvg8Kcl4g8La8LcsSg8LE86bbarc97faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc98faha8KfghRbbaiRbog8Kcl4g8La8LcsSg8LE86bbarc99faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc9:faha8KfghRbbaiRbrgicl4g8Ka8KcsSg8KE86bbarcufaha8KfgrRbbaicsGgiaicsSgiE86bbaraifhixekarai8Pbb83bbarcwfaicwf8Pbb83bbaiczfhikdnaoaC9pmbalcdfhlaoczfhraPai9RcL0mekkaoaC6moaimexokaCmva8FTmvkaqaAfhqa8Ecefg8Ecl9hmbkdndndndnawTmbasa8Acd4fRbbgociGPlbedrbkaATmdaza8Afh8Fazcj;cbfhhcbh8EaEhaina8FRbbhraahocbhlinaoahalfRbbgqce4cbaqceG9R7arfgr86bbaoadfhoaAalcefgl9hmbkaacefhaa8Fcefh8FahaAfhha8Ecefg8Ecl9hmbxikkaATmeaza8Afhaazcj;cbfhhcbhoceh8EaYh8FinaEaofhlaa8Vbbhrcbhoinala8FaofRbbcwtahaofRbbgqVc;:FiGce4cbaqceG9R7arfgr87bbaladfhlaLaocefgofmbka8FaQfh8FcdhoaacdfhaahaQfhha8EceGhlcbh8EalmbxdkkaATmbcbaocl49Rh8Eaza8AfRbbhqcwhoa3hlinalRbbaotaqVhqalcefhlaocwfgoca9hmbkcbhhaEh8FaYhainazcj;cbfahfRbbhrcwhoaahlinalRbbaotarVhralaAfhlaocwfgoca9hmbkara8E93aq7hqcbhoa8Fhlinalaqao486bbalcefhlaocwfgoca9hmbka8Fadfh8FaacefhaahcefghaA9hmbkkaEclfhEa3clfh3a8Aclfg8Aad6mbkaXazcjdfaAad2z:jjjjb8AazazcjdfaAcufad2fadz:jjjjb8AaAaOfhOaihxaimbkc9:hoxdkcbc99aPax9RakSEhoxekc9:hokavcj;kbf8Kjjjjbaok:XseHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:kjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhldnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhoindnalaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfaoaDcu7gPcl4fcsGcitfgsydlhzasydbhHdndnaDcsGgsak9pmbavaiaPfcsGcdtfydbaxasEhDaxasTgOfhxxekdndnascsSmbcehOasc987asamffcefhDxekalcefhDal8SbbgscFeGhPdndnascu9mmbaDhlxekalcvfhlaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhlkcehOaPce4cbaPceG9R7amfhDkaDhmkavc;abfaocitfgsaDBdbasazBdlavaicdtfaDBdbavc;abfaocefcsGcitfgsaHBdbasaDBdlaocdfhoaOaifhidnadcd9hmbabarcetfgsaH87ebasclfaD87ebascdfaz87ebxdkabarcdtfgsaHBdbascwfaDBdbasclfazBdbxekdnaDcpe0mbaxcefgOavaiaqaDcsGfRbbgscl49RcsGcdtfydbascz6gPEhDavaias9RcsGcdtfydbaOaPfgzascsGgOEhsaOThOdndnadcd9hmbabarcetfgHax87ebaHclfas87ebaHcdfaD87ebxekabarcdtfgHaxBdbaHcwfasBdbaHclfaDBdbkavaicdtfaxBdbavc;abfaocitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfaocefcsGcitfgHasBdbaHaDBdlavaiaPfgicsGcdtfasBdbavc;abfaocdfcsGcitfgDaxBdbaDasBdlaocifhoaiaOfhiazaOfhxxekaxcbalRbbgHEgAaDc;:eSgDfhzaHcsGhCaHcl4hXdndnaHcs0mbazcefhOxekazhOavaiaX9RcsGcdtfydbhzkdndnaCmbaOcefhxxekaOhxavaiaH9RcsGcdtfydbhOkdndnaDTmbalcefhDxekalcdfhDal8SbegPcFeGhsdnaPcu9kmbalcofhAascFbGhscrhldninaD8SbbgPcFbGaltasVhsaPcu9kmeaDcefhDalcrfglc8J9hmbkaAhDxekaDcefhDkasce4cbasceG9R7amfgmhAkdndnaXcsSmbaDhsxekaDcefhsaD8SbbglcFeGhPdnalcu9kmbaDcvfhzaPcFbGhPcrhldninas8SbbgDcFbGaltaPVhPaDcu9kmeascefhsalcrfglc8J9hmbkazhsxekascefhskaPce4cbaPceG9R7amfgmhzkdndnaCcsSmbashlxekascefhlas8SbbgDcFeGhPdnaDcu9kmbascvfhOaPcFbGhPcrhDdninal8SbbgscFbGaDtaPVhPascu9kmealcefhlaDcrfgDc8J9hmbkaOhlxekalcefhlkaPce4cbaPceG9R7amfgmhOkdndnadcd9hmbabarcetfgDaA87ebaDclfaO87ebaDcdfaz87ebxekabarcdtfgDaABdbaDcwfaOBdbaDclfazBdbkavc;abfaocitfgDazBdbaDaABdlavaicdtfaABdbavc;abfaocefcsGcitfgDaOBdbaDazBdlavaicefgicsGcdtfazBdbavc;abfaocdfcsGcitfgDaABdbaDaOBdlavaiaHcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhiaocifhokawcefhwaocsGhoaicsGhiarcifgrae6mbkkcbc99alaqSEhokavc;aef8Kjjjjbaok:clevu8Jjjjjbcz9Rhvdnaecvfal9nmbc9:skdnaiRbbc;:eGc;qeSmbcuskav9cb83iwaicefhoaialfc98fhrdnaeTmbdnadcdSmbcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcdtfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgiBdbalaiBdbawcefgwae9hmbxdkkcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcetfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgi87ebalaiBdbawcefgwae9hmbkkcbc99aoarSEk:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk::ioiue99dud99dud99dnaeTmbcbhiabhlindndnal8Uebgv:YgoJ:ji:1Salcof8UebgrciVgw:Y:vgDNJbbbZJbbb:;avcu9kEMgq:lJbbb9p9DTmbaq:Ohkxekcjjjj94hkkalclf8Uebhvalcdf8UebhxabaiarcefciGfcetfak87ebdndnax:YgqaDNJbbbZJbbb:;axcu9kEMgm:lJbbb9p9DTmbam:Ohxxekcjjjj94hxkabaiarciGfgkcd7cetfax87ebdndnav:YgmaDNJbbbZJbbb:;avcu9kEMgP:lJbbb9p9DTmbaP:Ohvxekcjjjj94hvkabaiarcufciGfcetfav87ebdndnawaw2:ZgPaPMaoaoN:taqaqN:tamamN:tgoJbbbbaoJbbbb9GE:raDNJbbbZMgD:lJbbb9p9DTmbaD:Ohrxekcjjjj94hrkabakcetfar87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2gdTmbinababydbgecwtcw91:Yaece91cjjj98Gcjjj;8if::NUdbabclfhbadcufgdmbkkk:Tvirud99eudndnadcl9hmbaeTmeindndnabRbbgiabcefgl8Sbbgvabcdfgo8Sbbgrf9R:YJbbuJabcifgwRbbgdce4adVgDcd4aDVgDcl4aDVgD:Z:vgqNJbbbZMgk:lJbbb9p9DTmbak:Ohxxekcjjjj94hxkaoax86bbdndnaraif:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohoxekcjjjj94hokalao86bbdndnavaifar9R:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohixekcjjjj94hikabai86bbdndnaDadcetGadceGV:ZaqNJbbbZMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkawad86bbabclfhbaecufgembxdkkaeTmbindndnab8Vebgiabcdfgl8Uebgvabclfgo8Uebgrf9R:YJbFu9habcofgw8Vebgdce4adVgDcd4aDVgDcl4aDVgDcw4aDVgD:Z:vgqNJbbbZMgk:lJbbb9p9DTmbak:Ohxxekcjjjj94hxkaoax87ebdndnaraif:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohoxekcjjjj94hokalao87ebdndnavaifar9R:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohixekcjjjj94hikabai87ebdndnaDadcetGadceGV:ZaqNJbbbZMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkawad87ebabcwfhbaecufgembkkk9teiucbcbyd:K1jjbgeabcifc98GfgbBd:K1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;teeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiaeydlBdlaiaeydwBdwaiaeydxBdxaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk:3eedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdxaialBdwaialBdlaialBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkk81dbcjwk8Kbbbbdbbblbbbwbbbbbbbebbbdbbblbbbwbbbbc:Kwkl8WNbb"),r=WebAssembly.instantiate(n,{}).then(function(t){(i=t.instance).exports.__wasm_call_ctors()});function s(t){for(var i=new Uint8Array(t.length),n=0;n<t.length;++n){var r=t.charCodeAt(n);i[n]=r>96?r-97:r>64?r-39:r+4}var s=0;for(n=0;n<t.length;++n)i[s++]=i[n]<60?e[i[n]]:64*(i[n]-60)+i[++n];return i.buffer.slice(0,s)}function a(t,e,i,n,r,s,a){var o=t.exports.sbrk,l=n+3&-4,c=o(l*r),h=o(s.length),u=new Uint8Array(t.exports.memory.buffer);u.set(s,h);var d=e(c,n,r,h,s.length);if(0==d&&a&&a(c,l,r),i.set(u.subarray(c,c+n*r)),o(c-o(0)),0!=d)throw new Error("Malformed buffer data: "+d)}var o={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp",COLOR:"meshopt_decodeFilterColor"},l={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},c=[],h=0;function u(t){var e={object:new Worker(t),pending:0,requests:{}};return e.object.onmessage=function(t){var i=t.data;e.pending-=i.count,e.requests[i.id][i.action](i.value),delete e.requests[i.id]},e}function d(t){var e=t.data;if(!e.id)return self.close();self.ready.then(function(t){try{var i=new Uint8Array(e.count*e.size);a(t,t.exports[e.mode],i,e.count,e.size,e.source,t.exports[e.filter]),self.postMessage({id:e.id,count:e.count,action:"resolve",value:i},[i.buffer])}catch(t){self.postMessage({id:e.id,count:e.count,action:"reject",value:t})}})}return{ready:r,supported:!0,useWorkers:function(t){!function(t){for(var e="self.ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(n)+"]), {}).then(function(result) { result.instance.exports.__wasm_call_ctors(); return result.instance; });self.onmessage = "+d.name+";"+a.toString()+d.toString(),i=new Blob([e],{type:"text/javascript"}),r=URL.createObjectURL(i),s=c.length;s<t;++s)c[s]=u(r);for(s=t;s<c.length;++s)c[s].object.postMessage({});c.length=t,URL.revokeObjectURL(r)}(t)},decodeVertexBuffer:function(t,e,n,r,s){a(i,i.exports.meshopt_decodeVertexBuffer,t,e,n,r,i.exports[o[s]])},decodeIndexBuffer:function(t,e,n,r){a(i,i.exports.meshopt_decodeIndexBuffer,t,e,n,r)},decodeIndexSequence:function(t,e,n,r){a(i,i.exports.meshopt_decodeIndexSequence,t,e,n,r)},decodeGltfBuffer:function(t,e,n,r,s,c){a(i,i.exports[l[s]],t,e,n,r,i.exports[o[c]])},decodeGltfBufferAsync:function(t,e,n,s,u){return c.length>0?function(t,e,i,n,r){for(var s=c[0],a=1;a<c.length;++a)c[a].pending<s.pending&&(s=c[a]);return new Promise(function(a,o){var l=new Uint8Array(i),c=++h;s.pending+=t,s.requests[c]={resolve:a,reject:o},s.object.postMessage({id:c,count:t,size:e,source:l,mode:n,filter:r},[l.buffer])})}(t,e,n,l[s],o[u]):r.then(function(){var r=new Uint8Array(t*e);return a(i,i.exports[l[s]],r,t,e,n,i.exports[o[u]]),r})}}}();const ep=new WeakMap;function ip(){let t,e;function i(t,e,i,n,r,s){const a=i.num_points(),o=s.num_components(),l=function(t,e){switch(e){case Float32Array:return t.DT_FLOAT32;case Int8Array:return t.DT_INT8;case Int16Array:return t.DT_INT16;case Int32Array:return t.DT_INT32;case Uint8Array:return t.DT_UINT8;case Uint16Array:return t.DT_UINT16;case Uint32Array:return t.DT_UINT32}}(t,r),c=o*r.BYTES_PER_ELEMENT,h=4*Math.ceil(c/4),u=h/r.BYTES_PER_ELEMENT,d=a*c,p=a*h,A=t._malloc(d);e.GetAttributeDataArrayForAllPoints(i,s,l,d,A);const g=new r(t.HEAPF32.buffer,A,d/r.BYTES_PER_ELEMENT);let m;if(c===h)m=g.slice();else{m=new r(p/r.BYTES_PER_ELEMENT);let t=0;for(let e=0,i=g.length;e<i;e++){for(let i=0;i<o;i++)m[t+i]=g[e*o+i];t+=u}}return t._free(A),{name:n,count:a,itemSize:o,array:m,stride:u}}onmessage=function(n){const r=n.data;switch(r.type){case"init":t=r.decoderConfig,e=new Promise(function(e){t.onModuleLoaded=function(t){e({draco:t})},DracoDecoderModule(t)});break;case"decode":const n=r.buffer,s=r.taskConfig;e.then(t=>{const e=t.draco,a=new e.Decoder;try{const t=function(t,e,n,r){const s=r.attributeIDs,a=r.attributeTypes;let o,l;const c=e.GetEncodedGeometryType(n);if(c===t.TRIANGULAR_MESH)o=new t.Mesh,l=e.DecodeArrayToMesh(n,n.byteLength,o);else{if(c!==t.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");o=new t.PointCloud,l=e.DecodeArrayToPointCloud(n,n.byteLength,o)}if(!l.ok()||0===o.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+l.error_msg());const h={index:null,attributes:[]};for(const n in s){const l=self[a[n]];let c,u;if(r.useUniqueIDs)u=s[n],c=e.GetAttributeByUniqueId(o,u);else{if(u=e.GetAttributeId(o,t[s[n]]),-1===u)continue;c=e.GetAttribute(o,u)}const d=i(t,e,o,n,l,c);"color"===n&&(d.vertexColorSpace=r.vertexColorSpace),h.attributes.push(d)}c===t.TRIANGULAR_MESH&&(h.index=function(t,e,i){const n=i.num_faces(),r=3*n,s=4*r,a=t._malloc(s);e.GetTrianglesUInt32Array(i,s,a);const o=new Uint32Array(t.HEAPF32.buffer,a,r).slice();return t._free(a),{array:o,itemSize:1}}(t,e,o));return t.destroy(o),h}(e,a,new Int8Array(n),s),o=t.attributes.map(t=>t.array.buffer);t.index&&o.push(t.index.array.buffer),self.postMessage({type:"decode",id:r.id,geometry:t},o)}catch(t){console.error(t),self.postMessage({type:"error",id:r.id,error:t.message})}finally{e.destroy(a)}})}}}function np(t,e){if(0===e)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),t;if(2===e||1===e){let i=t.getIndex();if(null===i){const e=[],n=t.getAttribute("position");if(void 0===n)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),t;for(let t=0;t<n.count;t++)e.push(t);t.setIndex(e),i=t.getIndex()}const n=i.count-2,r=[];if(2===e)for(let t=1;t<=n;t++)r.push(i.getX(0)),r.push(i.getX(t)),r.push(i.getX(t+1));else for(let t=0;t<n;t++)t%2==0?(r.push(i.getX(t)),r.push(i.getX(t+1)),r.push(i.getX(t+2))):(r.push(i.getX(t+2)),r.push(i.getX(t+1)),r.push(i.getX(t)));r.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=t.clone();return s.setIndex(r),s.clearGroups(),s}return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),t}function rp(t){const e=new Map,i=new Map,n=t.clone();return sp(t,n,function(t,n){e.set(n,t),i.set(t,n)}),n.traverse(function(t){if(!t.isSkinnedMesh)return;const n=t,r=e.get(t),s=r.skeleton.bones;n.skeleton=r.skeleton.clone(),n.bindMatrix.copy(r.bindMatrix),n.skeleton.bones=s.map(function(t){return i.get(t)}),n.bind(n.skeleton,n.bindMatrix)}),n}function sp(t,e,i){i(t,e);for(let n=0;n<t.children.length;n++)sp(t.children[n],e.children[n],i)}class ap extends Nl{constructor(t){super(t),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new pp(t)}),this.register(function(t){return new Ap(t)}),this.register(function(t){return new Ep(t)}),this.register(function(t){return new Sp(t)}),this.register(function(t){return new Cp(t)}),this.register(function(t){return new mp(t)}),this.register(function(t){return new fp(t)}),this.register(function(t){return new bp(t)}),this.register(function(t){return new vp(t)}),this.register(function(t){return new dp(t)}),this.register(function(t){return new yp(t)}),this.register(function(t){return new gp(t)}),this.register(function(t){return new _p(t)}),this.register(function(t){return new xp(t)}),this.register(function(t){return new hp(t)}),this.register(function(t){return new wp(t,cp.EXT_MESHOPT_COMPRESSION)}),this.register(function(t){return new wp(t,cp.KHR_MESHOPT_COMPRESSION)}),this.register(function(t){return new Mp(t)})}load(t,e,i,n){const r=this;let s;if(""!==this.resourcePath)s=this.resourcePath;else if(""!==this.path){const e=pc.extractUrlBase(t);s=pc.resolveURL(e,this.path)}else s=pc.extractUrlBase(t);this.manager.itemStart(t);const a=function(e){n?n(e):console.error(e),r.manager.itemError(t),r.manager.itemEnd(t)},o=new Ql(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,function(i){try{r.parse(i,s,function(i){e(i),r.manager.itemEnd(t)},a)}catch(t){a(t)}},i,a)}setDRACOLoader(t){return this.dracoLoader=t,this}setKTX2Loader(t){return this.ktx2Loader=t,this}setMeshoptDecoder(t){return this.meshoptDecoder=t,this}register(t){return-1===this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.push(t),this}unregister(t){return-1!==this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t),1),this}parse(t,e,i,n){let r;const s={},a={},o=new TextDecoder;if("string"==typeof t)r=JSON.parse(t);else if(t instanceof ArrayBuffer){if(o.decode(new Uint8Array(t,0,4))===Ip){try{s[cp.KHR_BINARY_GLTF]=new Rp(t)}catch(t){return void(n&&n(t))}r=JSON.parse(s[cp.KHR_BINARY_GLTF].content)}else r=JSON.parse(o.decode(t))}else r=t;if(void 0===r.asset||r.asset.version[0]<2)return void(n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")));const l=new nA(r,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let t=0;t<this.pluginCallbacks.length;t++){const e=this.pluginCallbacks[t](l);e.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),a[e.name]=e,s[e.name]=!0}if(r.extensionsUsed)for(let t=0;t<r.extensionsUsed.length;++t){const e=r.extensionsUsed[t],i=r.extensionsRequired||[];switch(e){case cp.KHR_MATERIALS_UNLIT:s[e]=new up;break;case cp.KHR_DRACO_MESH_COMPRESSION:s[e]=new Dp(r,this.dracoLoader);break;case cp.KHR_TEXTURE_TRANSFORM:s[e]=new Lp;break;case cp.KHR_MESH_QUANTIZATION:s[e]=new Pp;break;default:i.indexOf(e)>=0&&void 0===a[e]&&console.warn('THREE.GLTFLoader: Unknown extension "'+e+'".')}}l.setExtensions(s),l.setPlugins(a),l.parse(i,n)}parseAsync(t,e){const i=this;return new Promise(function(n,r){i.parse(t,e,n,r)})}}function op(){let t={};return{get:function(e){return t[e]},add:function(e,i){t[e]=i},remove:function(e){delete t[e]},removeAll:function(){t={}}}}function lp(t,e,i){const n=t.json.materials[e];return n.extensions&&n.extensions[i]?n.extensions[i]:null}const cp={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",KHR_MESHOPT_COMPRESSION:"KHR_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class hp{constructor(t){this.parser=t,this.name=cp.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const t=this.parser,e=this.parser.json.nodes||[];for(let i=0,n=e.length;i<n;i++){const n=e[i];n.extensions&&n.extensions[this.name]&&void 0!==n.extensions[this.name].light&&t._addNodeRef(this.cache,n.extensions[this.name].light)}}_loadLight(t){const e=this.parser,i="light:"+t;let n=e.cache.get(i);if(n)return n;const r=e.json,s=((r.extensions&&r.extensions[this.name]||{}).lights||[])[t];let a;const o=new Sr(16777215);void 0!==s.color&&o.setRGB(s.color[0],s.color[1],s.color[2],Li);const l=void 0!==s.range?s.range:0;switch(s.type){case"directional":a=new hc(o),a.target.position.set(0,0,-1),a.add(a.target);break;case"point":a=new oc(o),a.distance=l;break;case"spot":a=new sc(o),a.distance=l,s.spot=s.spot||{},s.spot.innerConeAngle=void 0!==s.spot.innerConeAngle?s.spot.innerConeAngle:0,s.spot.outerConeAngle=void 0!==s.spot.outerConeAngle?s.spot.outerConeAngle:Math.PI/4,a.angle=s.spot.outerConeAngle,a.penumbra=1-s.spot.innerConeAngle/s.spot.outerConeAngle,a.target.position.set(0,0,-1),a.add(a.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+s.type)}return a.position.set(0,0,0),Yp(a,s),void 0!==s.intensity&&(a.intensity=s.intensity),a.name=e.createUniqueName(s.name||"light_"+t),n=Promise.resolve(a),e.cache.add(i,n),n}getDependency(t,e){if("light"===t)return this._loadLight(e)}createNodeAttachment(t){const e=this,i=this.parser,n=i.json.nodes[t],r=(n.extensions&&n.extensions[this.name]||{}).light;return void 0===r?null:this._loadLight(r).then(function(t){return i._getNodeRef(e.cache,r,t)})}}let up=class{constructor(){this.name=cp.KHR_MATERIALS_UNLIT}getMaterialType(){return Ns}extendParams(t,e,i){const n=[];t.color=new Sr(1,1,1),t.opacity=1;const r=e.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){const e=r.baseColorFactor;t.color.setRGB(e[0],e[1],e[2],Li),t.opacity=e[3]}void 0!==r.baseColorTexture&&n.push(i.assignTexture(t,"map",r.baseColorTexture,Di))}return Promise.all(n)}},dp=class{constructor(t){this.parser=t,this.name=cp.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(t,e){const i=lp(this.parser,t,this.name);return null===i||void 0!==i.emissiveStrength&&(e.emissiveIntensity=i.emissiveStrength),Promise.resolve()}},pp=class{constructor(t){this.parser=t,this.name=cp.KHR_MATERIALS_CLEARCOAT}getMaterialType(t){return null!==lp(this.parser,t,this.name)?ul:null}extendMaterialParams(t,e){const i=lp(this.parser,t,this.name);if(null===i)return Promise.resolve();const n=[];if(void 0!==i.clearcoatFactor&&(e.clearcoat=i.clearcoatFactor),void 0!==i.clearcoatTexture&&n.push(this.parser.assignTexture(e,"clearcoatMap",i.clearcoatTexture)),void 0!==i.clearcoatRoughnessFactor&&(e.clearcoatRoughness=i.clearcoatRoughnessFactor),void 0!==i.clearcoatRoughnessTexture&&n.push(this.parser.assignTexture(e,"clearcoatRoughnessMap",i.clearcoatRoughnessTexture)),void 0!==i.clearcoatNormalTexture&&(n.push(this.parser.assignTexture(e,"clearcoatNormalMap",i.clearcoatNormalTexture)),void 0!==i.clearcoatNormalTexture.scale)){const t=i.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new fn(t,t)}return Promise.all(n)}},Ap=class{constructor(t){this.parser=t,this.name=cp.KHR_MATERIALS_DISPERSION}getMaterialType(t){return null!==lp(this.parser,t,this.name)?ul:null}extendMaterialParams(t,e){const i=lp(this.parser,t,this.name);return null===i||(e.dispersion=void 0!==i.dispersion?i.dispersion:0),Promise.resolve()}},gp=class{constructor(t){this.parser=t,this.name=cp.KHR_MATERIALS_IRIDESCENCE}getMaterialType(t){return null!==lp(this.parser,t,this.name)?ul:null}extendMaterialParams(t,e){const i=lp(this.parser,t,this.name);if(null===i)return Promise.resolve();const n=[];return void 0!==i.iridescenceFactor&&(e.iridescence=i.iridescenceFactor),void 0!==i.iridescenceTexture&&n.push(this.parser.assignTexture(e,"iridescenceMap",i.iridescenceTexture)),void 0!==i.iridescenceIor&&(e.iridescenceIOR=i.iridescenceIor),void 0===e.iridescenceThicknessRange&&(e.iridescenceThicknessRange=[100,400]),void 0!==i.iridescenceThicknessMinimum&&(e.iridescenceThicknessRange[0]=i.iridescenceThicknessMinimum),void 0!==i.iridescenceThicknessMaximum&&(e.iridescenceThicknessRange[1]=i.iridescenceThicknessMaximum),void 0!==i.iridescenceThicknessTexture&&n.push(this.parser.assignTexture(e,"iridescenceThicknessMap",i.iridescenceThicknessTexture)),Promise.all(n)}},mp=class{constructor(t){this.parser=t,this.name=cp.KHR_MATERIALS_SHEEN}getMaterialType(t){return null!==lp(this.parser,t,this.name)?ul:null}extendMaterialParams(t,e){const i=lp(this.parser,t,this.name);if(null===i)return Promise.resolve();const n=[];if(e.sheenColor=new Sr(0,0,0),e.sheenRoughness=0,e.sheen=1,void 0!==i.sheenColorFactor){const t=i.sheenColorFactor;e.sheenColor.setRGB(t[0],t[1],t[2],Li)}return void 0!==i.sheenRoughnessFactor&&(e.sheenRoughness=i.sheenRoughnessFactor),void 0!==i.sheenColorTexture&&n.push(this.parser.assignTexture(e,"sheenColorMap",i.sheenColorTexture,Di)),void 0!==i.sheenRoughnessTexture&&n.push(this.parser.assignTexture(e,"sheenRoughnessMap",i.sheenRoughnessTexture)),Promise.all(n)}},fp=class{constructor(t){this.parser=t,this.name=cp.KHR_MATERIALS_TRANSMISSION}getMaterialType(t){return null!==lp(this.parser,t,this.name)?ul:null}extendMaterialParams(t,e){const i=lp(this.parser,t,this.name);if(null===i)return Promise.resolve();const n=[];return void 0!==i.transmissionFactor&&(e.transmission=i.transmissionFactor),void 0!==i.transmissionTexture&&n.push(this.parser.assignTexture(e,"transmissionMap",i.transmissionTexture)),Promise.all(n)}},bp=class{constructor(t){this.parser=t,this.name=cp.KHR_MATERIALS_VOLUME}getMaterialType(t){return null!==lp(this.parser,t,this.name)?ul:null}extendMaterialParams(t,e){const i=lp(this.parser,t,this.name);if(null===i)return Promise.resolve();const n=[];e.thickness=void 0!==i.thicknessFactor?i.thicknessFactor:0,void 0!==i.thicknessTexture&&n.push(this.parser.assignTexture(e,"thicknessMap",i.thicknessTexture)),e.attenuationDistance=i.attenuationDistance||1/0;const r=i.attenuationColor||[1,1,1];return e.attenuationColor=(new Sr).setRGB(r[0],r[1],r[2],Li),Promise.all(n)}},vp=class{constructor(t){this.parser=t,this.name=cp.KHR_MATERIALS_IOR}getMaterialType(t){return null!==lp(this.parser,t,this.name)?ul:null}extendMaterialParams(t,e){const i=lp(this.parser,t,this.name);return null===i||(e.ior=void 0!==i.ior?i.ior:1.5),Promise.resolve()}},yp=class{constructor(t){this.parser=t,this.name=cp.KHR_MATERIALS_SPECULAR}getMaterialType(t){return null!==lp(this.parser,t,this.name)?ul:null}extendMaterialParams(t,e){const i=lp(this.parser,t,this.name);if(null===i)return Promise.resolve();const n=[];e.specularIntensity=void 0!==i.specularFactor?i.specularFactor:1,void 0!==i.specularTexture&&n.push(this.parser.assignTexture(e,"specularIntensityMap",i.specularTexture));const r=i.specularColorFactor||[1,1,1];return e.specularColor=(new Sr).setRGB(r[0],r[1],r[2],Li),void 0!==i.specularColorTexture&&n.push(this.parser.assignTexture(e,"specularColorMap",i.specularColorTexture,Di)),Promise.all(n)}},xp=class{constructor(t){this.parser=t,this.name=cp.EXT_MATERIALS_BUMP}getMaterialType(t){return null!==lp(this.parser,t,this.name)?ul:null}extendMaterialParams(t,e){const i=lp(this.parser,t,this.name);if(null===i)return Promise.resolve();const n=[];return e.bumpScale=void 0!==i.bumpFactor?i.bumpFactor:1,void 0!==i.bumpTexture&&n.push(this.parser.assignTexture(e,"bumpMap",i.bumpTexture)),Promise.all(n)}},_p=class{constructor(t){this.parser=t,this.name=cp.KHR_MATERIALS_ANISOTROPY}getMaterialType(t){return null!==lp(this.parser,t,this.name)?ul:null}extendMaterialParams(t,e){const i=lp(this.parser,t,this.name);if(null===i)return Promise.resolve();const n=[];return void 0!==i.anisotropyStrength&&(e.anisotropy=i.anisotropyStrength),void 0!==i.anisotropyRotation&&(e.anisotropyRotation=i.anisotropyRotation),void 0!==i.anisotropyTexture&&n.push(this.parser.assignTexture(e,"anisotropyMap",i.anisotropyTexture)),Promise.all(n)}};class Ep{constructor(t){this.parser=t,this.name=cp.KHR_TEXTURE_BASISU}loadTexture(t){const e=this.parser,i=e.json,n=i.textures[t];if(!n.extensions||!n.extensions[this.name])return null;const r=n.extensions[this.name],s=e.options.ktx2Loader;if(!s){if(i.extensionsRequired&&i.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(t,r.source,s)}}class Sp{constructor(t){this.parser=t,this.name=cp.EXT_TEXTURE_WEBP}loadTexture(t){const e=this.name,i=this.parser,n=i.json,r=n.textures[t];if(!r.extensions||!r.extensions[e])return null;const s=r.extensions[e],a=n.images[s.source];let o=i.textureLoader;if(a.uri){const t=i.options.manager.getHandler(a.uri);null!==t&&(o=t)}return i.loadTextureImage(t,s.source,o)}}class Cp{constructor(t){this.parser=t,this.name=cp.EXT_TEXTURE_AVIF}loadTexture(t){const e=this.name,i=this.parser,n=i.json,r=n.textures[t];if(!r.extensions||!r.extensions[e])return null;const s=r.extensions[e],a=n.images[s.source];let o=i.textureLoader;if(a.uri){const t=i.options.manager.getHandler(a.uri);null!==t&&(o=t)}return i.loadTextureImage(t,s.source,o)}}class wp{constructor(t,e){this.name=e,this.parser=t}loadBufferView(t){const e=this.parser.json,i=e.bufferViews[t];if(i.extensions&&i.extensions[this.name]){const t=i.extensions[this.name],n=this.parser.getDependency("buffer",t.buffer),r=this.parser.options.meshoptDecoder;if(!r||!r.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return n.then(function(e){const i=t.byteOffset||0,n=t.byteLength||0,s=t.count,a=t.byteStride,o=new Uint8Array(e,i,n);return r.decodeGltfBufferAsync?r.decodeGltfBufferAsync(s,a,o,t.mode,t.filter).then(function(t){return t.buffer}):r.ready.then(function(){const e=new ArrayBuffer(s*a);return r.decodeGltfBuffer(new Uint8Array(e),s,a,o,t.mode,t.filter),e})})}return null}}let Mp=class{constructor(t){this.name=cp.EXT_MESH_GPU_INSTANCING,this.parser=t}createNodeMesh(t){const e=this.parser.json,i=e.nodes[t];if(!i.extensions||!i.extensions[this.name]||void 0===i.mesh)return null;const n=e.meshes[i.mesh];for(const t of n.primitives)if(t.mode!==Op.TRIANGLES&&t.mode!==Op.TRIANGLE_STRIP&&t.mode!==Op.TRIANGLE_FAN&&void 0!==t.mode)return null;const r=i.extensions[this.name].attributes,s=[],a={};for(const t in r)s.push(this.parser.getDependency("accessor",r[t]).then(e=>(a[t]=e,a[t])));return s.length<1?null:(s.push(this.parser.createNodeMesh(t)),Promise.all(s).then(t=>{const e=t.pop(),i=e.isGroup?e.children:[e],n=t[0].count,r=[];for(const t of i){const e=new Hn,i=new vn,s=new bn,o=new vn(1,1,1),l=new ya(t.geometry,t.material,n);for(let t=0;t<n;t++)a.TRANSLATION&&i.fromBufferAttribute(a.TRANSLATION,t),a.ROTATION&&s.fromBufferAttribute(a.ROTATION,t),a.SCALE&&o.fromBufferAttribute(a.SCALE,t),l.setMatrixAt(t,e.compose(i,s,o));for(const e in a)if("_COLOR_0"===e){const t=a[e];l.instanceColor=new da(t.array,t.itemSize,t.normalized)}else"TRANSLATION"!==e&&"ROTATION"!==e&&"SCALE"!==e&&t.geometry.setAttribute(e,a[e]);mr.prototype.copy.call(l,t),this.parser.assignFinalMaterial(l),r.push(l)}return e.isGroup?(e.clear(),e.add(...r),e):r[0]}))}};const Ip="glTF",Tp=1313821514,Bp=5130562;class Rp{constructor(t){this.name=cp.KHR_BINARY_GLTF,this.content=null,this.body=null;const e=new DataView(t,0,12),i=new TextDecoder;if(this.header={magic:i.decode(new Uint8Array(t.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==Ip)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const n=this.header.length-12,r=new DataView(t,12);let s=0;for(;s<n;){const e=r.getUint32(s,!0);s+=4;const n=r.getUint32(s,!0);if(s+=4,n===Tp){const n=new Uint8Array(t,12+s,e);this.content=i.decode(n)}else if(n===Bp){const i=12+s;this.body=t.slice(i,i+e)}s+=e}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class Dp{constructor(t,e){if(!e)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=cp.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=e,this.dracoLoader.preload()}decodePrimitive(t,e){const i=this.json,n=this.dracoLoader,r=t.extensions[this.name].bufferView,s=t.extensions[this.name].attributes,a={},o={},l={};for(const t in s){const e=Hp[t]||t.toLowerCase();a[e]=s[t]}for(const e in t.attributes){const n=Hp[e]||e.toLowerCase();if(void 0!==s[e]){const r=i.accessors[t.attributes[e]],s=kp[r.componentType];l[n]=s.name,o[n]=!0===r.normalized}}return e.getDependency("bufferView",r).then(function(t){return new Promise(function(e,i){n.decodeDracoFile(t,function(t){for(const e in t.attributes){const i=t.attributes[e],n=o[e];void 0!==n&&(i.normalized=n)}e(t)},a,l,Li,i)})})}}class Lp{constructor(){this.name=cp.KHR_TEXTURE_TRANSFORM}extendTexture(t,e){return void 0!==e.texCoord&&e.texCoord!==t.channel||void 0!==e.offset||void 0!==e.rotation||void 0!==e.scale?(t=t.clone(),void 0!==e.texCoord&&(t.channel=e.texCoord),void 0!==e.offset&&t.offset.fromArray(e.offset),void 0!==e.rotation&&(t.rotation=e.rotation),void 0!==e.scale&&t.repeat.fromArray(e.scale),t.needsUpdate=!0,t):t}}class Pp{constructor(){this.name=cp.KHR_MESH_QUANTIZATION}}class Fp extends bl{constructor(t,e,i,n){super(t,e,i,n)}copySampleValue_(t){const e=this.resultBuffer,i=this.sampleValues,n=this.valueSize,r=t*n*3+n;for(let t=0;t!==n;t++)e[t]=i[r+t];return e}interpolate_(t,e,i,n){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=2*a,l=3*a,c=n-e,h=(i-e)/c,u=h*h,d=u*h,p=t*l,A=p-l,g=-2*d+3*u,m=d-u,f=1-g,b=m-u+h;for(let t=0;t!==a;t++){const e=s[A+t+a],i=s[A+t+o]*c,n=s[p+t+a],l=s[p+t]*c;r[t]=f*e+b*i+g*n+m*l}return r}}const Up=new bn;class Np extends Fp{interpolate_(t,e,i,n){const r=super.interpolate_(t,e,i,n);return Up.fromArray(r).normalize().toArray(r),r}}const Op={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},kp={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Qp={9728:ue,9729:Ae,9984:de,9985:ge,9986:pe,9987:me},Gp={33071:ce,33648:he,10497:le},zp={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Hp={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Vp={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},qp={CUBICSPLINE:void 0,LINEAR:Ci,STEP:Si},jp="OPAQUE",Wp="MASK",Xp="BLEND";function Kp(t){return void 0===t.DefaultMaterial&&(t.DefaultMaterial=new hl({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:0})),t.DefaultMaterial}function Jp(t,e,i){for(const n in i.extensions)void 0===t[n]&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[n]=i.extensions[n])}function Yp(t,e){void 0!==e.extras&&("object"==typeof e.extras?Object.assign(t.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function $p(t,e){if(t.updateMorphTargets(),void 0!==e.weights)for(let i=0,n=e.weights.length;i<n;i++)t.morphTargetInfluences[i]=e.weights[i];if(e.extras&&Array.isArray(e.extras.targetNames)){const i=e.extras.targetNames;if(t.morphTargetInfluences.length===i.length){t.morphTargetDictionary={};for(let e=0,n=i.length;e<n;e++)t.morphTargetDictionary[i[e]]=e}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Zp(t){let e;const i=t.extensions&&t.extensions[cp.KHR_DRACO_MESH_COMPRESSION];if(e=i?"draco:"+i.bufferView+":"+i.indices+":"+tA(i.attributes):t.indices+":"+tA(t.attributes)+":"+t.mode,void 0!==t.targets)for(let i=0,n=t.targets.length;i<n;i++)e+=":"+tA(t.targets[i]);return e}function tA(t){let e="";const i=Object.keys(t).sort();for(let n=0,r=i.length;n<r;n++)e+=i[n]+":"+t[i[n]]+";";return e}function eA(t){switch(t){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}const iA=new Hn;class nA{constructor(t={},e={}){this.json=t,this.extensions={},this.plugins={},this.options=e,this.cache=new op,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let i=!1,n=-1,r=!1,s=-1;if("undefined"!=typeof navigator&&void 0!==navigator.userAgent){const t=navigator.userAgent;i=!0===/^((?!chrome|android).)*safari/i.test(t);const e=t.match(/Version\/(\d+)/);n=i&&e?parseInt(e[1],10):-1,r=t.indexOf("Firefox")>-1,s=r?t.match(/Firefox\/([0-9]+)\./)[1]:-1}"undefined"==typeof createImageBitmap||i&&n<17||r&&s<98?this.textureLoader=new Vl(this.options.manager):this.textureLoader=new gc(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Ql(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(t){this.extensions=t}setPlugins(t){this.plugins=t}parse(t,e){const i=this,n=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(t){return t._markDefs&&t._markDefs()}),Promise.all(this._invokeAll(function(t){return t.beforeRoot&&t.beforeRoot()})).then(function(){return Promise.all([i.getDependencies("scene"),i.getDependencies("animation"),i.getDependencies("camera")])}).then(function(e){const s={scene:e[0][n.scene||0],scenes:e[0],animations:e[1],cameras:e[2],asset:n.asset,parser:i,userData:{}};return Jp(r,s,n),Yp(s,n),Promise.all(i._invokeAll(function(t){return t.afterRoot&&t.afterRoot(s)})).then(function(){for(const t of s.scenes)t.updateMatrixWorld();t(s)})}).catch(e)}_markDefs(){const t=this.json.nodes||[],e=this.json.skins||[],i=this.json.meshes||[];for(let i=0,n=e.length;i<n;i++){const n=e[i].joints;for(let e=0,i=n.length;e<i;e++)t[n[e]].isBone=!0}for(let e=0,n=t.length;e<n;e++){const n=t[e];void 0!==n.mesh&&(this._addNodeRef(this.meshCache,n.mesh),void 0!==n.skin&&(i[n.mesh].isSkinnedMesh=!0)),void 0!==n.camera&&this._addNodeRef(this.cameraCache,n.camera)}}_addNodeRef(t,e){void 0!==e&&(void 0===t.refs[e]&&(t.refs[e]=t.uses[e]=0),t.refs[e]++)}_getNodeRef(t,e,i){if(t.refs[e]<=1)return i;const n=i.clone(),r=(t,e)=>{const i=this.associations.get(t);null!=i&&this.associations.set(e,i);for(const[i,n]of t.children.entries())r(n,e.children[i])};return r(i,n),n.name+="_instance_"+t.uses[e]++,n}_invokeOne(t){const e=Object.values(this.plugins);e.push(this);for(let i=0;i<e.length;i++){const n=t(e[i]);if(n)return n}return null}_invokeAll(t){const e=Object.values(this.plugins);e.unshift(this);const i=[];for(let n=0;n<e.length;n++){const r=t(e[n]);r&&i.push(r)}return i}getDependency(t,e){const i=t+":"+e;let n=this.cache.get(i);if(!n){switch(t){case"scene":n=this.loadScene(e);break;case"node":n=this._invokeOne(function(t){return t.loadNode&&t.loadNode(e)});break;case"mesh":n=this._invokeOne(function(t){return t.loadMesh&&t.loadMesh(e)});break;case"accessor":n=this.loadAccessor(e);break;case"bufferView":n=this._invokeOne(function(t){return t.loadBufferView&&t.loadBufferView(e)});break;case"buffer":n=this.loadBuffer(e);break;case"material":n=this._invokeOne(function(t){return t.loadMaterial&&t.loadMaterial(e)});break;case"texture":n=this._invokeOne(function(t){return t.loadTexture&&t.loadTexture(e)});break;case"skin":n=this.loadSkin(e);break;case"animation":n=this._invokeOne(function(t){return t.loadAnimation&&t.loadAnimation(e)});break;case"camera":n=this.loadCamera(e);break;default:if(n=this._invokeOne(function(i){return i!=this&&i.getDependency&&i.getDependency(t,e)}),!n)throw new Error("Unknown type: "+t)}this.cache.add(i,n)}return n}getDependencies(t){let e=this.cache.get(t);if(!e){const i=this,n=this.json[t+("mesh"===t?"es":"s")]||[];e=Promise.all(n.map(function(e,n){return i.getDependency(t,n)})),this.cache.add(t,e)}return e}loadBuffer(t){const e=this.json.buffers[t],i=this.fileLoader;if(e.type&&"arraybuffer"!==e.type)throw new Error("THREE.GLTFLoader: "+e.type+" buffer type is not supported.");if(void 0===e.uri&&0===t)return Promise.resolve(this.extensions[cp.KHR_BINARY_GLTF].body);const n=this.options;return new Promise(function(t,r){i.load(pc.resolveURL(e.uri,n.path),t,void 0,function(){r(new Error('THREE.GLTFLoader: Failed to load buffer "'+e.uri+'".'))})})}loadBufferView(t){const e=this.json.bufferViews[t];return this.getDependency("buffer",e.buffer).then(function(t){const i=e.byteLength||0,n=e.byteOffset||0;return t.slice(n,n+i)})}loadAccessor(t){const e=this,i=this.json,n=this.json.accessors[t];if(void 0===n.bufferView&&void 0===n.sparse){const t=zp[n.type],e=kp[n.componentType],i=!0===n.normalized,r=new e(n.count*t);return Promise.resolve(new ls(r,t,i))}const r=[];return void 0!==n.bufferView?r.push(this.getDependency("bufferView",n.bufferView)):r.push(null),void 0!==n.sparse&&(r.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(r).then(function(t){const r=t[0],s=zp[n.type],a=kp[n.componentType],o=a.BYTES_PER_ELEMENT,l=o*s,c=n.byteOffset||0,h=void 0!==n.bufferView?i.bufferViews[n.bufferView].byteStride:void 0,u=!0===n.normalized;let d,p;if(h&&h!==l){const t=Math.floor(c/h),i="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+t+":"+n.count;let l=e.cache.get(i);l||(d=new a(r,t*h,n.count*h/o),l=new Ss(d,h/o),e.cache.add(i,l)),p=new ws(l,s,c%h/o,u)}else d=null===r?new a(n.count*s):new a(r,c,n.count*s),p=new ls(d,s,u);if(void 0!==n.sparse){const e=zp.SCALAR,i=kp[n.sparse.indices.componentType],o=n.sparse.indices.byteOffset||0,l=n.sparse.values.byteOffset||0,c=new i(t[1],o,n.sparse.count*e),h=new a(t[2],l,n.sparse.count*s);null!==r&&(p=new ls(p.array.slice(),p.itemSize,p.normalized)),p.normalized=!1;for(let t=0,e=c.length;t<e;t++){const e=c[t];if(p.setX(e,h[t*s]),s>=2&&p.setY(e,h[t*s+1]),s>=3&&p.setZ(e,h[t*s+2]),s>=4&&p.setW(e,h[t*s+3]),s>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}p.normalized=u}return p})}loadTexture(t){const e=this.json,i=this.options,n=e.textures[t].source,r=e.images[n];let s=this.textureLoader;if(r.uri){const t=i.manager.getHandler(r.uri);null!==t&&(s=t)}return this.loadTextureImage(t,n,s)}loadTextureImage(t,e,i){const n=this,r=this.json,s=r.textures[t],a=r.images[e],o=(a.uri||a.bufferView)+":"+s.sampler;if(this.textureCache[o])return this.textureCache[o];const l=this.loadImageSource(e,i).then(function(e){e.flipY=!1,e.name=s.name||a.name||"",""===e.name&&"string"==typeof a.uri&&!1===a.uri.startsWith("data:image/")&&(e.name=a.uri);const i=(r.samplers||{})[s.sampler]||{};return e.magFilter=Qp[i.magFilter]||Ae,e.minFilter=Qp[i.minFilter]||me,e.wrapS=Gp[i.wrapS]||le,e.wrapT=Gp[i.wrapT]||le,e.generateMipmaps=!e.isCompressedTexture&&e.minFilter!==ue&&e.minFilter!==Ae,n.associations.set(e,{textures:t}),e}).catch(function(){return null});return this.textureCache[o]=l,l}loadImageSource(t,e){const i=this,n=this.json,r=this.options;if(void 0!==this.sourceCache[t])return this.sourceCache[t].then(t=>t.clone());const s=n.images[t],a=self.URL||self.webkitURL;let o=s.uri||"",l=!1;if(void 0!==s.bufferView)o=i.getDependency("bufferView",s.bufferView).then(function(t){l=!0;const e=new Blob([t],{type:s.mimeType});return o=a.createObjectURL(e),o});else if(void 0===s.uri)throw new Error("THREE.GLTFLoader: Image "+t+" is missing URI and bufferView");const c=Promise.resolve(o).then(function(t){return new Promise(function(i,n){let s=i;!0===e.isImageBitmapLoader&&(s=function(t){const e=new Nn(t);e.needsUpdate=!0,i(e)}),e.load(pc.resolveURL(t,r.path),s,void 0,n)})}).then(function(t){var e;return!0===l&&a.revokeObjectURL(o),Yp(t,s),t.userData.mimeType=s.mimeType||((e=s.uri).search(/\.jpe?g($|\?)/i)>0||0===e.search(/^data\:image\/jpeg/)?"image/jpeg":e.search(/\.webp($|\?)/i)>0||0===e.search(/^data\:image\/webp/)?"image/webp":e.search(/\.ktx2($|\?)/i)>0||0===e.search(/^data\:image\/ktx2/)?"image/ktx2":"image/png"),t}).catch(function(t){throw console.error("THREE.GLTFLoader: Couldn't load texture",o),t});return this.sourceCache[t]=c,c}assignTexture(t,e,i,n){const r=this;return this.getDependency("texture",i.index).then(function(s){if(!s)return null;if(void 0!==i.texCoord&&i.texCoord>0&&((s=s.clone()).channel=i.texCoord),r.extensions[cp.KHR_TEXTURE_TRANSFORM]){const t=void 0!==i.extensions?i.extensions[cp.KHR_TEXTURE_TRANSFORM]:void 0;if(t){const e=r.associations.get(s);s=r.extensions[cp.KHR_TEXTURE_TRANSFORM].extendTexture(s,t),r.associations.set(s,e)}}return void 0!==n&&(s.colorSpace=n),t[e]=s,s})}assignFinalMaterial(t){const e=t.geometry;let i=t.material;const n=void 0===e.attributes.tangent,r=void 0!==e.attributes.color,s=void 0===e.attributes.normal;if(t.isPoints){const t="PointsMaterial:"+i.uuid;let e=this.cache.get(t);e||(e=new Ha,Is.prototype.copy.call(e,i),e.color.copy(i.color),e.map=i.map,e.sizeAttenuation=!1,this.cache.add(t,e)),i=e}else if(t.isLine){const t="LineBasicMaterial:"+i.uuid;let e=this.cache.get(t);e||(e=new Ta,Is.prototype.copy.call(e,i),e.color.copy(i.color),e.map=i.map,this.cache.add(t,e)),i=e}if(n||r||s){let t="ClonedMaterial:"+i.uuid+":";n&&(t+="derivative-tangents:"),r&&(t+="vertex-colors:"),s&&(t+="flat-shading:");let e=this.cache.get(t);e||(e=i.clone(),r&&(e.vertexColors=!0),s&&(e.flatShading=!0),n&&(e.normalScale&&(e.normalScale.y*=-1),e.clearcoatNormalScale&&(e.clearcoatNormalScale.y*=-1)),this.cache.add(t,e),this.associations.set(e,this.associations.get(i))),i=e}t.material=i}getMaterialType(){return hl}loadMaterial(t){const e=this,i=this.json,n=this.extensions,r=i.materials[t];let s;const a={},o=[];if((r.extensions||{})[cp.KHR_MATERIALS_UNLIT]){const t=n[cp.KHR_MATERIALS_UNLIT];s=t.getMaterialType(),o.push(t.extendParams(a,r,e))}else{const i=r.pbrMetallicRoughness||{};if(a.color=new Sr(1,1,1),a.opacity=1,Array.isArray(i.baseColorFactor)){const t=i.baseColorFactor;a.color.setRGB(t[0],t[1],t[2],Li),a.opacity=t[3]}void 0!==i.baseColorTexture&&o.push(e.assignTexture(a,"map",i.baseColorTexture,Di)),a.metalness=void 0!==i.metallicFactor?i.metallicFactor:1,a.roughness=void 0!==i.roughnessFactor?i.roughnessFactor:1,void 0!==i.metallicRoughnessTexture&&(o.push(e.assignTexture(a,"metalnessMap",i.metallicRoughnessTexture)),o.push(e.assignTexture(a,"roughnessMap",i.metallicRoughnessTexture))),s=this._invokeOne(function(e){return e.getMaterialType&&e.getMaterialType(t)}),o.push(Promise.all(this._invokeAll(function(e){return e.extendMaterialParams&&e.extendMaterialParams(t,a)})))}!0===r.doubleSided&&(a.side=2);const l=r.alphaMode||jp;if(l===Xp?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,l===Wp&&(a.alphaTest=void 0!==r.alphaCutoff?r.alphaCutoff:.5)),void 0!==r.normalTexture&&s!==Ns&&(o.push(e.assignTexture(a,"normalMap",r.normalTexture)),a.normalScale=new fn(1,1),void 0!==r.normalTexture.scale)){const t=r.normalTexture.scale;a.normalScale.set(t,t)}if(void 0!==r.occlusionTexture&&s!==Ns&&(o.push(e.assignTexture(a,"aoMap",r.occlusionTexture)),void 0!==r.occlusionTexture.strength&&(a.aoMapIntensity=r.occlusionTexture.strength)),void 0!==r.emissiveFactor&&s!==Ns){const t=r.emissiveFactor;a.emissive=(new Sr).setRGB(t[0],t[1],t[2],Li)}return void 0!==r.emissiveTexture&&s!==Ns&&o.push(e.assignTexture(a,"emissiveMap",r.emissiveTexture,Di)),Promise.all(o).then(function(){const i=new s(a);return r.name&&(i.name=r.name),Yp(i,r),e.associations.set(i,{materials:t}),r.extensions&&Jp(n,i,r),i})}createUniqueName(t){const e=wc.sanitizeNodeName(t||"");return e in this.nodeNamesUsed?e+"_"+ ++this.nodeNamesUsed[e]:(this.nodeNamesUsed[e]=0,e)}loadGeometries(t){const e=this,i=this.extensions,n=this.primitiveCache;function r(t){return i[cp.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(t,e).then(function(i){return rA(i,t,e)})}const s=[];for(let i=0,a=t.length;i<a;i++){const a=t[i],o=Zp(a),l=n[o];if(l)s.push(l.promise);else{let t;t=a.extensions&&a.extensions[cp.KHR_DRACO_MESH_COMPRESSION]?r(a):rA(new Es,a,e),n[o]={primitive:a,promise:t},s.push(t)}}return Promise.all(s)}loadMesh(t){const e=this,i=this.json,n=this.extensions,r=i.meshes[t],s=r.primitives,a=[];for(let t=0,e=s.length;t<e;t++){const e=void 0===s[t].material?Kp(this.cache):this.getDependency("material",s[t].material);a.push(e)}return a.push(e.loadGeometries(s)),Promise.all(a).then(function(i){const a=i.slice(0,i.length-1),o=i[i.length-1],l=[];for(let i=0,c=o.length;i<c;i++){const c=o[i],h=s[i];let u;const d=a[i];if(h.mode===Op.TRIANGLES||h.mode===Op.TRIANGLE_STRIP||h.mode===Op.TRIANGLE_FAN||void 0===h.mode)u=!0===r.isSkinnedMesh?new aa(c,d):new Ks(c,d),!0===u.isSkinnedMesh&&u.normalizeSkinWeights(),h.mode===Op.TRIANGLE_STRIP?u.geometry=np(u.geometry,1):h.mode===Op.TRIANGLE_FAN&&(u.geometry=np(u.geometry,2));else if(h.mode===Op.LINES)u=new Ga(c,d);else if(h.mode===Op.LINE_STRIP)u=new Na(c,d);else if(h.mode===Op.LINE_LOOP)u=new za(c,d);else{if(h.mode!==Op.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+h.mode);u=new Xa(c,d)}Object.keys(u.geometry.morphAttributes).length>0&&$p(u,r),u.name=e.createUniqueName(r.name||"mesh_"+t),Yp(u,r),h.extensions&&Jp(n,u,h),e.assignFinalMaterial(u),l.push(u)}for(let i=0,n=l.length;i<n;i++)e.associations.set(l[i],{meshes:t,primitives:i});if(1===l.length)return r.extensions&&Jp(n,l[0],r),l[0];const c=new fr;r.extensions&&Jp(n,c,r),e.associations.set(c,{meshes:t});for(let t=0,e=l.length;t<e;t++)c.add(l[t]);return c})}loadCamera(t){let e;const i=this.json.cameras[t],n=i[i.type];if(n)return"perspective"===i.type?e=new nc(mn.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):"orthographic"===i.type&&(e=new lc(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),i.name&&(e.name=this.createUniqueName(i.name)),Yp(e,i),Promise.resolve(e);console.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(t){const e=this.json.skins[t],i=[];for(let t=0,n=e.joints.length;t<n;t++)i.push(this._loadNodeShallow(e.joints[t]));return void 0!==e.inverseBindMatrices?i.push(this.getDependency("accessor",e.inverseBindMatrices)):i.push(null),Promise.all(i).then(function(t){const i=t.pop(),n=t,r=[],s=[];for(let t=0,a=n.length;t<a;t++){const a=n[t];if(a){r.push(a);const e=new Hn;null!==i&&e.fromArray(i.array,16*t),s.push(e)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',e.joints[t])}return new ua(r,s)})}loadAnimation(t){const e=this.json,i=this,n=e.animations[t],r=n.name?n.name:"animation_"+t,s=[],a=[],o=[],l=[],c=[];for(let t=0,e=n.channels.length;t<e;t++){const e=n.channels[t],i=n.samplers[e.sampler],r=e.target,h=r.node,u=void 0!==n.parameters?n.parameters[i.input]:i.input,d=void 0!==n.parameters?n.parameters[i.output]:i.output;void 0!==r.node&&(s.push(this.getDependency("node",h)),a.push(this.getDependency("accessor",u)),o.push(this.getDependency("accessor",d)),l.push(i),c.push(r))}return Promise.all([Promise.all(s),Promise.all(a),Promise.all(o),Promise.all(l),Promise.all(c)]).then(function(t){const e=t[0],s=t[1],a=t[2],o=t[3],l=t[4],c=[];for(let t=0,n=e.length;t<n;t++){const n=e[t],r=s[t],h=a[t],u=o[t],d=l[t];if(void 0===n)continue;n.updateMatrix&&n.updateMatrix();const p=i._createAnimationTracks(n,r,h,u,d);if(p)for(let t=0;t<p.length;t++)c.push(p[t])}const h=new Rl(r,void 0,c);return Yp(h,n),h})}createNodeMesh(t){const e=this.json,i=this,n=e.nodes[t];return void 0===n.mesh?null:i.getDependency("mesh",n.mesh).then(function(t){const e=i._getNodeRef(i.meshCache,n.mesh,t);return void 0!==n.weights&&e.traverse(function(t){if(t.isMesh)for(let e=0,i=n.weights.length;e<i;e++)t.morphTargetInfluences[e]=n.weights[e]}),e})}loadNode(t){const e=this,i=this.json.nodes[t],n=e._loadNodeShallow(t),r=[],s=i.children||[];for(let t=0,i=s.length;t<i;t++)r.push(e.getDependency("node",s[t]));const a=void 0===i.skin?Promise.resolve(null):e.getDependency("skin",i.skin);return Promise.all([n,Promise.all(r),a]).then(function(t){const e=t[0],i=t[1],n=t[2];null!==n&&e.traverse(function(t){t.isSkinnedMesh&&t.bind(n,iA)});for(let t=0,n=i.length;t<n;t++)e.add(i[t]);if(void 0!==e.userData.pivot&&i.length>0){const t=e.userData.pivot,n=i[0];e.pivot=(new vn).fromArray(t),e.position.x-=t[0],e.position.y-=t[1],e.position.z-=t[2],n.position.set(0,0,0),delete e.userData.pivot}return e})}_loadNodeShallow(t){const e=this.json,i=this.extensions,n=this;if(void 0!==this.nodeCache[t])return this.nodeCache[t];const r=e.nodes[t],s=r.name?n.createUniqueName(r.name):"",a=[],o=n._invokeOne(function(e){return e.createNodeMesh&&e.createNodeMesh(t)});return o&&a.push(o),void 0!==r.camera&&a.push(n.getDependency("camera",r.camera).then(function(t){return n._getNodeRef(n.cameraCache,r.camera,t)})),n._invokeAll(function(e){return e.createNodeAttachment&&e.createNodeAttachment(t)}).forEach(function(t){a.push(t)}),this.nodeCache[t]=Promise.all(a).then(function(e){let a;if(a=!0===r.isBone?new oa:e.length>1?new fr:1===e.length?e[0]:new mr,a!==e[0])for(let t=0,i=e.length;t<i;t++)a.add(e[t]);if(r.name&&(a.userData.name=r.name,a.name=s),Yp(a,r),r.extensions&&Jp(i,a,r),void 0!==r.matrix){const t=new Hn;t.fromArray(r.matrix),a.applyMatrix4(t)}else void 0!==r.translation&&a.position.fromArray(r.translation),void 0!==r.rotation&&a.quaternion.fromArray(r.rotation),void 0!==r.scale&&a.scale.fromArray(r.scale);if(n.associations.has(a)){if(void 0!==r.mesh&&n.meshCache.refs[r.mesh]>1){const t=n.associations.get(a);n.associations.set(a,{...t})}}else n.associations.set(a,{});return n.associations.get(a).nodes=t,a}),this.nodeCache[t]}loadScene(t){const e=this.extensions,i=this.json.scenes[t],n=this,r=new fr;i.name&&(r.name=n.createUniqueName(i.name)),Yp(r,i),i.extensions&&Jp(e,r,i);const s=i.nodes||[],a=[];for(let t=0,e=s.length;t<e;t++)a.push(n.getDependency("node",s[t]));return Promise.all(a).then(function(t){for(let e=0,i=t.length;e<i;e++){const i=t[e];null!==i.parent?r.add(rp(i)):r.add(i)}return n.associations=(t=>{const e=new Map;for(const[t,i]of n.associations)(t instanceof Is||t instanceof Nn)&&e.set(t,i);return t.traverse(t=>{const i=n.associations.get(t);null!=i&&e.set(t,i)}),e})(r),r})}_createAnimationTracks(t,e,i,n,r){const s=[],a=t.name?t.name:t.uuid,o=[];let l;switch(Vp[r.path]===Vp.weights?t.traverse(function(t){t.morphTargetInfluences&&o.push(t.name?t.name:t.uuid)}):o.push(a),Vp[r.path]){case Vp.weights:l=wl;break;case Vp.rotation:l=Il;break;case Vp.translation:case Vp.scale:l=Bl;break;default:if(1===i.itemSize)l=wl;else l=Bl}const c=void 0!==n.interpolation?qp[n.interpolation]:Ci,h=this._getArrayFromAccessor(i);for(let t=0,i=o.length;t<i;t++){const i=new l(o[t]+"."+Vp[r.path],e.array,h,c);"CUBICSPLINE"===n.interpolation&&this._createCubicSplineTrackInterpolant(i),s.push(i)}return s}_getArrayFromAccessor(t){let e=t.array;if(t.normalized){const t=eA(e.constructor),i=new Float32Array(e.length);for(let n=0,r=e.length;n<r;n++)i[n]=e[n]*t;e=i}return e}_createCubicSplineTrackInterpolant(t){t.createInterpolant=function(t){return new(this instanceof Il?Np:Fp)(this.times,this.values,this.getValueSize()/3,t)},t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function rA(t,e,i){const n=e.attributes,r=[];function s(e,n){return i.getDependency("accessor",e).then(function(e){t.setAttribute(n,e)})}for(const e in n){const i=Hp[e]||e.toLowerCase();i in t.attributes||r.push(s(n[e],i))}if(void 0!==e.indices&&!t.index){const n=i.getDependency("accessor",e.indices).then(function(e){t.setIndex(e)});r.push(n)}return Mn.workingColorSpace!==Li&&"COLOR_0"in n&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Mn.workingColorSpace}" not supported.`),Yp(t,e),function(t,e,i){const n=e.attributes,r=new Gr;if(void 0===n.POSITION)return;{const t=i.json.accessors[n.POSITION],e=t.min,s=t.max;if(void 0===e||void 0===s)return void console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(r.set(new vn(e[0],e[1],e[2]),new vn(s[0],s[1],s[2])),t.normalized){const e=eA(kp[t.componentType]);r.min.multiplyScalar(e),r.max.multiplyScalar(e)}}const s=e.targets;if(void 0!==s){const t=new vn,e=new vn;for(let n=0,r=s.length;n<r;n++){const r=s[n];if(void 0!==r.POSITION){const n=i.json.accessors[r.POSITION],s=n.min,a=n.max;if(void 0!==s&&void 0!==a){if(e.setX(Math.max(Math.abs(s[0]),Math.abs(a[0]))),e.setY(Math.max(Math.abs(s[1]),Math.abs(a[1]))),e.setZ(Math.max(Math.abs(s[2]),Math.abs(a[2]))),n.normalized){const t=eA(kp[n.componentType]);e.multiplyScalar(t)}t.max(e)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}r.expandByVector(t)}t.boundingBox=r;const a=new gs;r.getCenter(a.center),a.radius=r.min.distanceTo(r.max)/2,t.boundingSphere=a}(t,e,i),Promise.all(r).then(function(){return void 0!==e.targets?function(t,e,i){let n=!1,r=!1,s=!1;for(let t=0,i=e.length;t<i;t++){const i=e[t];if(void 0!==i.POSITION&&(n=!0),void 0!==i.NORMAL&&(r=!0),void 0!==i.COLOR_0&&(s=!0),n&&r&&s)break}if(!n&&!r&&!s)return Promise.resolve(t);const a=[],o=[],l=[];for(let c=0,h=e.length;c<h;c++){const h=e[c];if(n){const e=void 0!==h.POSITION?i.getDependency("accessor",h.POSITION):t.attributes.position;a.push(e)}if(r){const e=void 0!==h.NORMAL?i.getDependency("accessor",h.NORMAL):t.attributes.normal;o.push(e)}if(s){const e=void 0!==h.COLOR_0?i.getDependency("accessor",h.COLOR_0):t.attributes.color;l.push(e)}}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(l)]).then(function(e){const i=e[0],a=e[1],o=e[2];return n&&(t.morphAttributes.position=i),r&&(t.morphAttributes.normal=a),s&&(t.morphAttributes.color=o),t.morphTargetsRelative=!0,t})}(t,e.targets,i):t})}class sA{constructor(t=4){this.pool=t,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0,this.workerCreator=null}_initWorker(t){if(!this.workers[t]){const e=this.workerCreator();e.addEventListener("message",this._onMessage.bind(this,t)),this.workers[t]=e}}_getIdleWorker(){for(let t=0;t<this.pool;t++)if(!(this.workerStatus&1<<t))return t;return-1}_onMessage(t,e){const i=this.workersResolve[t];if(i&&i(e),this.queue.length){const{resolve:e,msg:i,transfer:n}=this.queue.shift();this.workersResolve[t]=e,this.workers[t].postMessage(i,n)}else this.workerStatus^=1<<t}setWorkerCreator(t){this.workerCreator=t}setWorkerLimit(t){this.pool=t}postMessage(t,e){return new Promise(i=>{const n=this._getIdleWorker();-1!==n?(this._initWorker(n),this.workerStatus|=1<<n,this.workersResolve[n]=i,this.workers[n].postMessage(t,e)):this.queue.push({resolve:i,msg:t,transfer:e})})}dispose(){this.workers.forEach(t=>t.terminate()),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}const aA=9,oA=15,lA=16,cA=22,hA=37,uA=43,dA=76,pA=83,AA=97,gA=100,mA=103,fA=109,bA=122,vA=123,yA=131,xA=132,_A=133,EA=134,SA=137,CA=138,wA=139,MA=140,IA=141,TA=142,BA=145,RA=146,DA=148,LA=152,PA=153,FA=154,UA=155,NA=156,OA=157,kA=158,QA=165,GA=166,zA=1000054e3,HA=1000054001,VA=1000054004,qA=1000054005,jA=1000066e3,WA=1000066004;class XA{constructor(t,e,i,n){this._dataView=void 0,this._littleEndian=void 0,this._offset=void 0,this._dataView=new DataView(t.buffer,t.byteOffset+e,i),this._littleEndian=n,this._offset=0}_nextUint8(){const t=this._dataView.getUint8(this._offset);return this._offset+=1,t}_nextUint16(){const t=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,t}_nextUint32(){const t=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,t}_nextUint64(){const t=this._dataView.getUint32(this._offset,this._littleEndian)+2**32*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,t}_nextInt32(){const t=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,t}_nextUint8Array(t){const e=new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+this._offset,t);return this._offset+=t,e}_skip(t){return this._offset+=t,this}_scan(t,e=0){const i=this._offset;let n=0;for(;this._dataView.getUint8(this._offset)!==e&&n<t;)n++,this._offset++;return n<t&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+i,n)}}const KA=[171,75,84,88,32,50,48,187,13,10,26,10];function JA(t){return(new TextDecoder).decode(t)}let YA,$A,ZA;const tg={env:{emscripten_notify_memory_growth:function(t){ZA=new Uint8Array($A.exports.memory.buffer)}}};class eg{init(){return YA||(YA="undefined"!=typeof fetch?fetch("data:application/wasm;base64,"+ig).then(t=>t.arrayBuffer()).then(t=>WebAssembly.instantiate(t,tg)).then(this._init):WebAssembly.instantiate(Buffer.from(ig,"base64"),tg).then(this._init),YA)}_init(t){$A=t.instance,tg.env.emscripten_notify_memory_growth(0)}decode(t,e=0){if(!$A)throw new Error("ZSTDDecoder: Await .init() before decoding.");const i=t.byteLength,n=$A.exports.malloc(i);ZA.set(t,n),e=e||Number($A.exports.ZSTD_findDecompressedSize(n,i));const r=$A.exports.malloc(e),s=$A.exports.ZSTD_decompress(r,e,n,i),a=ZA.slice(r,r+s);return $A.exports.free(n),$A.exports.free(r),a}}const ig="AGFzbQEAAAABpQEVYAF/AX9gAn9/AGADf39/AX9gBX9/f39/AX9gAX8AYAJ/fwF/YAR/f39/AX9gA39/fwBgBn9/f39/fwF/YAd/f39/f39/AX9gAn9/AX5gAn5+AX5gAABgBX9/f39/AGAGf39/f39/AGAIf39/f39/f38AYAl/f39/f39/f38AYAABf2AIf39/f39/f38Bf2ANf39/f39/f39/f39/fwF/YAF/AX4CJwEDZW52H2Vtc2NyaXB0ZW5fbm90aWZ5X21lbW9yeV9ncm93dGgABANpaAEFAAAFAgEFCwACAQABAgIFBQcAAwABDgsBAQcAEhMHAAUBDAQEAAANBwQCAgYCBAgDAwMDBgEACQkHBgICAAYGAgQUBwYGAwIGAAMCAQgBBwUGCgoEEQAEBAEIAwgDBQgDEA8IAAcABAUBcAECAgUEAQCAAgYJAX8BQaCgwAILB2AHBm1lbW9yeQIABm1hbGxvYwAoBGZyZWUAJgxaU1REX2lzRXJyb3IAaBlaU1REX2ZpbmREZWNvbXByZXNzZWRTaXplAFQPWlNURF9kZWNvbXByZXNzAEoGX3N0YXJ0ACQJBwEAQQELASQKussBaA8AIAAgACgCBCABajYCBAsZACAAKAIAIAAoAgRBH3F0QQAgAWtBH3F2CwgAIABBiH9LC34BBH9BAyEBIAAoAgQiA0EgTQRAIAAoAggiASAAKAIQTwRAIAAQDQ8LIAAoAgwiAiABRgRAQQFBAiADQSBJGw8LIAAgASABIAJrIANBA3YiBCABIARrIAJJIgEbIgJrIgQ2AgggACADIAJBA3RrNgIEIAAgBCgAADYCAAsgAQsUAQF/IAAgARACIQIgACABEAEgAgv3AQECfyACRQRAIABCADcCACAAQQA2AhAgAEIANwIIQbh/DwsgACABNgIMIAAgAUEEajYCECACQQRPBEAgACABIAJqIgFBfGoiAzYCCCAAIAMoAAA2AgAgAUF/ai0AACIBBEAgAEEIIAEQFGs2AgQgAg8LIABBADYCBEF/DwsgACABNgIIIAAgAS0AACIDNgIAIAJBfmoiBEEBTQRAIARBAWtFBEAgACABLQACQRB0IANyIgM2AgALIAAgAS0AAUEIdCADajYCAAsgASACakF/ai0AACIBRQRAIABBADYCBEFsDwsgAEEoIAEQFCACQQN0ams2AgQgAgsWACAAIAEpAAA3AAAgACABKQAINwAICy8BAX8gAUECdEGgHWooAgAgACgCAEEgIAEgACgCBGprQR9xdnEhAiAAIAEQASACCyEAIAFCz9bTvtLHq9lCfiAAfEIfiUKHla+vmLbem55/fgsdAQF/IAAoAgggACgCDEYEfyAAKAIEQSBGBUEACwuCBAEDfyACQYDAAE8EQCAAIAEgAhBnIAAPCyAAIAJqIQMCQCAAIAFzQQNxRQRAAkAgAkEBSARAIAAhAgwBCyAAQQNxRQRAIAAhAgwBCyAAIQIDQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADTw0BIAJBA3ENAAsLAkAgA0F8cSIEQcAASQ0AIAIgBEFAaiIFSw0AA0AgAiABKAIANgIAIAIgASgCBDYCBCACIAEoAgg2AgggAiABKAIMNgIMIAIgASgCEDYCECACIAEoAhQ2AhQgAiABKAIYNgIYIAIgASgCHDYCHCACIAEoAiA2AiAgAiABKAIkNgIkIAIgASgCKDYCKCACIAEoAiw2AiwgAiABKAIwNgIwIAIgASgCNDYCNCACIAEoAjg2AjggAiABKAI8NgI8IAFBQGshASACQUBrIgIgBU0NAAsLIAIgBE8NAQNAIAIgASgCADYCACABQQRqIQEgAkEEaiICIARJDQALDAELIANBBEkEQCAAIQIMAQsgA0F8aiIEIABJBEAgACECDAELIAAhAgNAIAIgAS0AADoAACACIAEtAAE6AAEgAiABLQACOgACIAIgAS0AAzoAAyABQQRqIQEgAkEEaiICIARNDQALCyACIANJBEADQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADRw0ACwsgAAsMACAAIAEpAAA3AAALQQECfyAAKAIIIgEgACgCEEkEQEEDDwsgACAAKAIEIgJBB3E2AgQgACABIAJBA3ZrIgE2AgggACABKAAANgIAQQALDAAgACABKAIANgAAC/cCAQJ/AkAgACABRg0AAkAgASACaiAASwRAIAAgAmoiBCABSw0BCyAAIAEgAhALDwsgACABc0EDcSEDAkACQCAAIAFJBEAgAwRAIAAhAwwDCyAAQQNxRQRAIAAhAwwCCyAAIQMDQCACRQ0EIAMgAS0AADoAACABQQFqIQEgAkF/aiECIANBAWoiA0EDcQ0ACwwBCwJAIAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQhBSAGQQR2IQRBICAAdCIAQQFyIQkgASgCACEPQQAhAiADIQYCQANAIAlBAkggAiAPS3JFBEAgAiEHAkAgCARAA0AgBEH//wNxQf//A0YEQCAHQRhqIQcgBiAQSQR/IAZBAmoiBigAACAFdgUgBUEQaiEFIARBEHYLIQQMAQsLA0AgBEEDcSIIQQNGBEAgBUECaiEFIARBAnYhBCAHQQNqIQcMAQsLIAcgCGoiByAPSw0EIAVBAmohBQNAIAIgB0kEQCANIAJBAXRqQQA7AQAgAkEBaiECDAELCyAGIA5LQQAgBiAFQQN1aiIHIAxLG0UEQCAHKAAAIAVBB3EiBXYhBAwCCyAEQQJ2IQQLIAYhBwsCfyALQX9qIAQgAEF/anEiBiAAQQF0QX9qIgggCWsiEUkNABogBCAIcSIEQQAgESAEIABIG2shBiALCyEIIA0gAkEBdGogBkF/aiIEOwEAIAlBASAGayAEIAZBAUgbayEJA0AgCSAASARAIABBAXUhACALQX9qIQsMAQsLAn8gByAOS0EAIAcgBSAIaiIFQQN1aiIGIAxLG0UEQCAFQQdxDAELIAUgDCIGIAdrQQN0awshBSACQQFqIQIgBEUhCCAGKAAAIAVBH3F2IQQMAQsLQWwgCUEBRyAFQSBKcg0BGiABIAJBf2o2AgAgBiAFQQdqQQN1aiADawwBC0FQCyEAIApBEGokACAACwkAQQFBBSAAGwsMACAAIAEoAAA2AAALqgMBCn8jAEHwAGsiCiQAIAJBAWohDiAAQQhqIQtBgIAEIAVBf2p0QRB1IQxBACECQQEhBkEBIAV0IglBf2oiDyEIA0AgAiAORkUEQAJAIAEgAkEBdCINai8BACIHQf//A0YEQCALIAhBA3RqIAI2AgQgCEF/aiEIQQEhBwwBCyAGQQAgDCAHQRB0QRB1ShshBgsgCiANaiAHOwEAIAJBAWohAgwBCwsgACAFNgIEIAAgBjYCACAJQQN2IAlBAXZqQQNqIQxBACEAQQAhBkEAIQIDQCAGIA5GBEADQAJAIAAgCUYNACAKIAsgAEEDdGoiASgCBCIGQQF0aiICIAIvAQAiAkEBajsBACABIAUgAhAUayIIOgADIAEgAiAIQf8BcXQgCWs7AQAgASAEIAZBAnQiAmooAgA6AAIgASACIANqKAIANgIEIABBAWohAAwBCwsFIAEgBkEBdGouAQAhDUEAIQcDQCAHIA1ORQRAIAsgAkEDdGogBjYCBANAIAIgDGogD3EiAiAISw0ACyAHQQFqIQcMAQsLIAZBAWohBgwBCwsgCkHwAGokAAsjAEIAIAEQCSAAhUKHla+vmLbem55/fkLj3MqV/M7y9YV/fAsQACAAQn43AwggACABNgIACyQBAX8gAARAIAEoAgQiAgRAIAEoAgggACACEQEADwsgABAmCwsfACAAIAEgAi8BABAINgIAIAEQBBogACACQQRqNgIEC0oBAX9BoCAoAgAiASAAaiIAQX9MBEBBiCBBMDYCAEF/DwsCQCAAPwBBEHRNDQAgABBmDQBBiCBBMDYCAEF/DwtBoCAgADYCACABC9cBAQh/Qbp/IQoCQCACKAIEIgggAigCACIJaiIOIAEgAGtLDQBBbCEKIAkgBCADKAIAIgtrSw0AIAAgCWoiBCACKAIIIgxrIQ0gACABQWBqIg8gCyAJQQAQKSADIAkgC2o2AgACQAJAIAwgBCAFa00EQCANIQUMAQsgDCAEIAZrSw0CIAcgDSAFayIAaiIBIAhqIAdNBEAgBCABIAgQDxoMAgsgBCABQQAgAGsQDyEBIAIgACAIaiIINgIEIAEgAGshBAsgBCAPIAUgCEEBECkLIA4hCgsgCgubAgEBfyMAQYABayINJAAgDSADNgJ8AkAgAkEDSwRAQX8hCQwBCwJAAkACQAJAIAJBAWsOAwADAgELIAZFBEBBuH8hCQwEC0FsIQkgBS0AACICIANLDQMgACAHIAJBAnQiAmooAgAgAiAIaigCABA7IAEgADYCAEEBIQkMAwsgASAJNgIAQQAhCQwCCyAKRQRAQWwhCQwCC0EAIQkgC0UgDEEZSHINAUEIIAR0QQhqIQBBACECA0AgAiAATw0CIAJBQGshAgwAAAsAC0FsIQkgDSANQfwAaiANQfgAaiAFIAYQFSICEAMNACANKAJ4IgMgBEsNACAAIA0gDSgCfCAHIAggAxAYIAEgADYCACACIQkLIA1BgAFqJAAgCQsLACAAIAEgAhALGgsQACAALwAAIAAtAAJBEHRyCy8AAn9BuH8gAUEISQ0AGkFyIAAoAAQiAEF3Sw0AGkG4fyAAQQhqIgAgACABSxsLCwkAIAAgATsAAAsDAAELigYBBX8gACAAKAIAIgVBfnE2AgBBACAAIAVBAXZqQYQgKAIAIgQgAEYbIQECQAJAIAAoAgQiAkUNACACKAIAIgNBAXENACACQQhqIgUgA0EBdkF4aiIDQQggA0EISxtnQR9zQQJ0QYAfaiIDKAIARgRAIAMgAigCDDYCAAsgAigCCCIDBEAgAyACKAIMNgIECyACKAIMIgMEQCADIAIoAgg2AgALIAIgAigCACAAKAIAQX5xajYCAEGEICEAAkACQCABRQ0AIAEgAjYCBCABKAIAIgNBAXENASADQQF2QXhqIgNBCCADQQhLG2dBH3NBAnRBgB9qIgMoAgAgAUEIakYEQCADIAEoAgw2AgALIAEoAggiAwRAIAMgASgCDDYCBAsgASgCDCIDBEAgAyABKAIINgIAQYQgKAIAIQQLIAIgAigCACABKAIAQX5xajYCACABIARGDQAgASABKAIAQQF2akEEaiEACyAAIAI2AgALIAIoAgBBAXZBeGoiAEEIIABBCEsbZ0Efc0ECdEGAH2oiASgCACEAIAEgBTYCACACIAA2AgwgAkEANgIIIABFDQEgACAFNgIADwsCQCABRQ0AIAEoAgAiAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAigCACABQQhqRgRAIAIgASgCDDYCAAsgASgCCCICBEAgAiABKAIMNgIECyABKAIMIgIEQCACIAEoAgg2AgBBhCAoAgAhBAsgACAAKAIAIAEoAgBBfnFqIgI2AgACQCABIARHBEAgASABKAIAQQF2aiAANgIEIAAoAgAhAgwBC0GEICAANgIACyACQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgIoAgAhASACIABBCGoiAjYCACAAIAE2AgwgAEEANgIIIAFFDQEgASACNgIADwsgBUEBdkF4aiIBQQggAUEISxtnQR9zQQJ0QYAfaiICKAIAIQEgAiAAQQhqIgI2AgAgACABNgIMIABBADYCCCABRQ0AIAEgAjYCAAsLDgAgAARAIABBeGoQJQsLgAIBA38CQCAAQQ9qQXhxQYQgKAIAKAIAQQF2ayICEB1Bf0YNAAJAQYQgKAIAIgAoAgAiAUEBcQ0AIAFBAXZBeGoiAUEIIAFBCEsbZ0Efc0ECdEGAH2oiASgCACAAQQhqRgRAIAEgACgCDDYCAAsgACgCCCIBBEAgASAAKAIMNgIECyAAKAIMIgFFDQAgASAAKAIINgIAC0EBIQEgACAAKAIAIAJBAXRqIgI2AgAgAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAygCACECIAMgAEEIaiIDNgIAIAAgAjYCDCAAQQA2AgggAkUNACACIAM2AgALIAELtwIBA38CQAJAIABBASAAGyICEDgiAA0AAkACQEGEICgCACIARQ0AIAAoAgAiA0EBcQ0AIAAgA0EBcjYCACADQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgAgAEEIakYEQCABIAAoAgw2AgALIAAoAggiAQRAIAEgACgCDDYCBAsgACgCDCIBBEAgASAAKAIINgIACyACECchAkEAIQFBhCAoAgAhACACDQEgACAAKAIAQX5xNgIAQQAPCyACQQ9qQXhxIgMQHSICQX9GDQIgAkEHakF4cSIAIAJHBEAgACACaxAdQX9GDQMLAkBBhCAoAgAiAUUEQEGAICAANgIADAELIAAgATYCBAtBhCAgADYCACAAIANBAXRBAXI2AgAMAQsgAEUNAQsgAEEIaiEBCyABC7kDAQJ/IAAgA2ohBQJAIANBB0wEQANAIAAgBU8NAiAAIAItAAA6AAAgAEEBaiEAIAJBAWohAgwAAAsACyAEQQFGBEACQCAAIAJrIgZBB00EQCAAIAItAAA6AAAgACACLQABOgABIAAgAi0AAjoAAiAAIAItAAM6AAMgAEEEaiACIAZBAnQiBkHAHmooAgBqIgIQFyACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohBAwCCyABIARqLwAAIQIgBEECaiEEDAELIAEgBGooAAAhAiAEQQRqIQQLIAVBAXEhBQJ+AkACQAJAIANBf2oiA0ECTQRAIANBAWsOAgIDAQtCfyAGRQ0DGiABIARqMQAADAMLIAEgBGovAACtQoACfAwCCyABIARqKAAArQwBCyABIARqKQAACyEHIAAgBTYCICAAIAI2AhwgACAHNwMAQQAhAyAAQQA2AhQgACAHIAggBhsiBzcDCCAAIAdCgIAIIAdCgIAIVBs+AhALIAMLWwEBf0G4fyEDIAIQFiICIAFNBH8gACACakF/ai0AACIAQQNxQQJ0QaAeaigCACACaiAAQQZ2IgFBAnRBsB5qKAIAaiAAQSBxIgBFaiABRSAAQQV2cWoFQbh/CwsdACAAKAKQ4gEQWiAAQQA2AqDiASAAQgA3A5DiAQu1AwEFfyMAQZACayIKJABBuH8hBgJAIAVFDQAgBCwAACIIQf8BcSEHAkAgCEF/TARAIAdBgn9qQQF2IgggBU8NAkFsIQYgB0GBf2oiBUGAAk8NAiAEQQFqIQdBACEGA0AgBiAFTwRAIAUhBiAIIQcMAwUgACAGaiAHIAZBAXZqIgQtAABBBHY6AAAgACAGQQFyaiAELQAAQQ9xOgAAIAZBAmohBgwBCwAACwALIAcgBU8NASAAIARBAWogByAKEFMiBhADDQELIAYhBEEAIQYgAUEAQTQQECEJQQAhBQNAIAQgBkcEQCAAIAZqIggtAAAiAUELSwRAQWwhBgwDBSAJIAFBAnRqIgEgASgCAEEBajYCACAGQQFqIQZBASAILQAAdEEBdSAFaiEFDAILAAsLQWwhBiAFRQ0AIAUQFEEBaiIBQQxLDQAgAyABNgIAQQFBASABdCAFayIDEBQiAXQgA0cNACAAIARqIAFBAWoiADoAACAJIABBAnRqIgAgACgCAEEBajYCACAJKAIEIgBBAkkgAEEBcXINACACIARBAWo2AgAgB0EBaiEGCyAKQZACaiQAIAYLxhEBDH8jAEHwAGsiBSQAQWwhCwJAIANBCkkNACACLwAAIQogAi8AAiEJIAIvAAQhByAFQQhqIAQQDgJAIAMgByAJIApqakEGaiIMSQ0AIAUtAAohCCAFQdgAaiACQQZqIgIgChAGIgsQAw0BIAVBQGsgAiAKaiICIAkQBiILEAMNASAFQShqIAIgCWoiAiAHEAYiCxADDQEgBUEQaiACIAdqIAMgDGsQBiILEAMNASAAIAFqIg9BfWohECAEQQRqIQZBASELIAAgAUEDakECdiIDaiIMIANqIgIgA2oiDiEDIAIhBCAMIQcDQCALIAMgEElxBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgCS0AAyELIAcgBiAFQUBrIAgQAkECdGoiCS8BADsAACAFQUBrIAktAAIQASAJLQADIQogBCAGIAVBKGogCBACQQJ0aiIJLwEAOwAAIAVBKGogCS0AAhABIAktAAMhCSADIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgDS0AAyENIAAgC2oiCyAGIAVB2ABqIAgQAkECdGoiAC8BADsAACAFQdgAaiAALQACEAEgAC0AAyEAIAcgCmoiCiAGIAVBQGsgCBACQQJ0aiIHLwEAOwAAIAVBQGsgBy0AAhABIActAAMhByAEIAlqIgkgBiAFQShqIAgQAkECdGoiBC8BADsAACAFQShqIAQtAAIQASAELQADIQQgAyANaiIDIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgACALaiEAIAcgCmohByAEIAlqIQQgAyANLQADaiEDIAVB2ABqEA0gBUFAaxANciAFQShqEA1yIAVBEGoQDXJFIQsMAQsLIAQgDksgByACS3INAEFsIQsgACAMSw0BIAxBfWohCQNAQQAgACAJSSAFQdgAahAEGwRAIAAgBiAFQdgAaiAIEAJBAnRqIgovAQA7AAAgBUHYAGogCi0AAhABIAAgCi0AA2oiACAGIAVB2ABqIAgQAkECdGoiCi8BADsAACAFQdgAaiAKLQACEAEgACAKLQADaiEADAEFIAxBfmohCgNAIAVB2ABqEAQgACAKS3JFBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgACAJLQADaiEADAELCwNAIAAgCk0EQCAAIAYgBUHYAGogCBACQQJ0aiIJLwEAOwAAIAVB2ABqIAktAAIQASAAIAktAANqIQAMAQsLAkAgACAMTw0AIAAgBiAFQdgAaiAIEAIiAEECdGoiDC0AADoAACAMLQADQQFGBEAgBUHYAGogDC0AAhABDAELIAUoAlxBH0sNACAFQdgAaiAGIABBAnRqLQACEAEgBSgCXEEhSQ0AIAVBIDYCXAsgAkF9aiEMA0BBACAHIAxJIAVBQGsQBBsEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiIAIAYgBUFAayAIEAJBAnRqIgcvAQA7AAAgBUFAayAHLQACEAEgACAHLQADaiEHDAEFIAJBfmohDANAIAVBQGsQBCAHIAxLckUEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwNAIAcgDE0EQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwJAIAcgAk8NACAHIAYgBUFAayAIEAIiAEECdGoiAi0AADoAACACLQADQQFGBEAgBUFAayACLQACEAEMAQsgBSgCREEfSw0AIAVBQGsgBiAAQQJ0ai0AAhABIAUoAkRBIUkNACAFQSA2AkQLIA5BfWohAgNAQQAgBCACSSAFQShqEAQbBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2oiACAGIAVBKGogCBACQQJ0aiIELwEAOwAAIAVBKGogBC0AAhABIAAgBC0AA2ohBAwBBSAOQX5qIQIDQCAFQShqEAQgBCACS3JFBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsDQCAEIAJNBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsCQCAEIA5PDQAgBCAGIAVBKGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBKGogAi0AAhABDAELIAUoAixBH0sNACAFQShqIAYgAEECdGotAAIQASAFKAIsQSFJDQAgBUEgNgIsCwNAQQAgAyAQSSAFQRBqEAQbBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2oiACAGIAVBEGogCBACQQJ0aiICLwEAOwAAIAVBEGogAi0AAhABIAAgAi0AA2ohAwwBBSAPQX5qIQIDQCAFQRBqEAQgAyACS3JFBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsDQCADIAJNBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsCQCADIA9PDQAgAyAGIAVBEGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBEGogAi0AAhABDAELIAUoAhRBH0sNACAFQRBqIAYgAEECdGotAAIQASAFKAIUQSFJDQAgBUEgNgIUCyABQWwgBUHYAGoQCiAFQUBrEApxIAVBKGoQCnEgBUEQahAKcRshCwwJCwAACwALAAALAAsAAAsACwAACwALQWwhCwsgBUHwAGokACALC7UEAQ5/IwBBEGsiBiQAIAZBBGogABAOQVQhBQJAIARB3AtJDQAgBi0ABCEHIANB8ARqQQBB7AAQECEIIAdBDEsNACADQdwJaiIJIAggBkEIaiAGQQxqIAEgAhAxIhAQA0UEQCAGKAIMIgQgB0sNASADQdwFaiEPIANBpAVqIREgAEEEaiESIANBqAVqIQEgBCEFA0AgBSICQX9qIQUgCCACQQJ0aigCAEUNAAsgAkEBaiEOQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgASALaiAKNgIAIAVBAWohBSAKIAxqIQoMAQsLIAEgCjYCAEEAIQUgBigCCCELA0AgBSALRkUEQCABIAUgCWotAAAiDEECdGoiDSANKAIAIg1BAWo2AgAgDyANQQF0aiINIAw6AAEgDSAFOgAAIAVBAWohBQwBCwtBACEBIANBADYCqAUgBEF/cyAHaiEJQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgAyALaiABNgIAIAwgBSAJanQgAWohASAFQQFqIQUMAQsLIAcgBEEBaiIBIAJrIgRrQQFqIQgDQEEBIQUgBCAIT0UEQANAIAUgDk9FBEAgBUECdCIJIAMgBEE0bGpqIAMgCWooAgAgBHY2AgAgBUEBaiEFDAELCyAEQQFqIQQMAQsLIBIgByAPIAogESADIAIgARBkIAZBAToABSAGIAc6AAYgACAGKAIENgIACyAQIQULIAZBEGokACAFC8ENAQt/IwBB8ABrIgUkAEFsIQkCQCADQQpJDQAgAi8AACEKIAIvAAIhDCACLwAEIQYgBUEIaiAEEA4CQCADIAYgCiAMampBBmoiDUkNACAFLQAKIQcgBUHYAGogAkEGaiICIAoQBiIJEAMNASAFQUBrIAIgCmoiAiAMEAYiCRADDQEgBUEoaiACIAxqIgIgBhAGIgkQAw0BIAVBEGogAiAGaiADIA1rEAYiCRADDQEgACABaiIOQX1qIQ8gBEEEaiEGQQEhCSAAIAFBA2pBAnYiAmoiCiACaiIMIAJqIg0hAyAMIQQgCiECA0AgCSADIA9JcQRAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAACAGIAVBQGsgBxACQQF0aiIILQAAIQsgBUFAayAILQABEAEgAiALOgAAIAYgBUEoaiAHEAJBAXRqIggtAAAhCyAFQShqIAgtAAEQASAEIAs6AAAgBiAFQRBqIAcQAkEBdGoiCC0AACELIAVBEGogCC0AARABIAMgCzoAACAGIAVB2ABqIAcQAkEBdGoiCC0AACELIAVB2ABqIAgtAAEQASAAIAs6AAEgBiAFQUBrIAcQAkEBdGoiCC0AACELIAVBQGsgCC0AARABIAIgCzoAASAGIAVBKGogBxACQQF0aiIILQAAIQsgBUEoaiAILQABEAEgBCALOgABIAYgBUEQaiAHEAJBAXRqIggtAAAhCyAFQRBqIAgtAAEQASADIAs6AAEgA0ECaiEDIARBAmohBCACQQJqIQIgAEECaiEAIAkgBUHYAGoQDUVxIAVBQGsQDUVxIAVBKGoQDUVxIAVBEGoQDUVxIQkMAQsLIAQgDUsgAiAMS3INAEFsIQkgACAKSw0BIApBfWohCQNAIAVB2ABqEAQgACAJT3JFBEAgBiAFQdgAaiAHEAJBAXRqIggtAAAhCyAFQdgAaiAILQABEAEgACALOgAAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAASAAQQJqIQAMAQsLA0AgBUHYAGoQBCAAIApPckUEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCwNAIAAgCkkEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCyAMQX1qIQADQCAFQUBrEAQgAiAAT3JFBEAgBiAFQUBrIAcQAkEBdGoiCi0AACEJIAVBQGsgCi0AARABIAIgCToAACAGIAVBQGsgBxACQQF0aiIKLQAAIQkgBUFAayAKLQABEAEgAiAJOgABIAJBAmohAgwBCwsDQCAFQUBrEAQgAiAMT3JFBEAgBiAFQUBrIAcQAkEBdGoiAC0AACEKIAVBQGsgAC0AARABIAIgCjoAACACQQFqIQIMAQsLA0AgAiAMSQRAIAYgBUFAayAHEAJBAXRqIgAtAAAhCiAFQUBrIAAtAAEQASACIAo6AAAgAkEBaiECDAELCyANQX1qIQADQCAFQShqEAQgBCAAT3JFBEAgBiAFQShqIAcQAkEBdGoiAi0AACEKIAVBKGogAi0AARABIAQgCjoAACAGIAVBKGogBxACQQF0aiICLQAAIQogBUEoaiACLQABEAEgBCAKOgABIARBAmohBAwBCwsDQCAFQShqEAQgBCANT3JFBEAgBiAFQShqIAcQAkEBdGoiAC0AACECIAVBKGogAC0AARABIAQgAjoAACAEQQFqIQQMAQsLA0AgBCANSQRAIAYgBUEoaiAHEAJBAXRqIgAtAAAhAiAFQShqIAAtAAEQASAEIAI6AAAgBEEBaiEEDAELCwNAIAVBEGoQBCADIA9PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIAYgBUEQaiAHEAJBAXRqIgAtAAAhAiAFQRBqIAAtAAEQASADIAI6AAEgA0ECaiEDDAELCwNAIAVBEGoQBCADIA5PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIANBAWohAwwBCwsDQCADIA5JBEAgBiAFQRBqIAcQAkEBdGoiAC0AACECIAVBEGogAC0AARABIAMgAjoAACADQQFqIQMMAQsLIAFBbCAFQdgAahAKIAVBQGsQCnEgBUEoahAKcSAFQRBqEApxGyEJDAELQWwhCQsgBUHwAGokACAJC8oCAQR/IwBBIGsiBSQAIAUgBBAOIAUtAAIhByAFQQhqIAIgAxAGIgIQA0UEQCAEQQRqIQIgACABaiIDQX1qIQQDQCAFQQhqEAQgACAET3JFBEAgAiAFQQhqIAcQAkEBdGoiBi0AACEIIAVBCGogBi0AARABIAAgCDoAACACIAVBCGogBxACQQF0aiIGLQAAIQggBUEIaiAGLQABEAEgACAIOgABIABBAmohAAwBCwsDQCAFQQhqEAQgACADT3JFBEAgAiAFQQhqIAcQAkEBdGoiBC0AACEGIAVBCGogBC0AARABIAAgBjoAACAAQQFqIQAMAQsLA0AgACADT0UEQCACIAVBCGogBxACQQF0aiIELQAAIQYgBUEIaiAELQABEAEgACAGOgAAIABBAWohAAwBCwsgAUFsIAVBCGoQChshAgsgBUEgaiQAIAILtgMBCX8jAEEQayIGJAAgBkEANgIMIAZBADYCCEFUIQQCQAJAIANBQGsiDCADIAZBCGogBkEMaiABIAIQMSICEAMNACAGQQRqIAAQDiAGKAIMIgcgBi0ABEEBaksNASAAQQRqIQogBkEAOgAFIAYgBzoABiAAIAYoAgQ2AgAgB0EBaiEJQQEhBANAIAQgCUkEQCADIARBAnRqIgEoAgAhACABIAU2AgAgACAEQX9qdCAFaiEFIARBAWohBAwBCwsgB0EBaiEHQQAhBSAGKAIIIQkDQCAFIAlGDQEgAyAFIAxqLQAAIgRBAnRqIgBBASAEdEEBdSILIAAoAgAiAWoiADYCACAHIARrIQhBACEEAkAgC0EDTQRAA0AgBCALRg0CIAogASAEakEBdGoiACAIOgABIAAgBToAACAEQQFqIQQMAAALAAsDQCABIABPDQEgCiABQQF0aiIEIAg6AAEgBCAFOgAAIAQgCDoAAyAEIAU6AAIgBCAIOgAFIAQgBToABCAEIAg6AAcgBCAFOgAGIAFBBGohAQwAAAsACyAFQQFqIQUMAAALAAsgAiEECyAGQRBqJAAgBAutAQECfwJAQYQgKAIAIABHIAAoAgBBAXYiAyABa0F4aiICQXhxQQhHcgR/IAIFIAMQJ0UNASACQQhqC0EQSQ0AIAAgACgCACICQQFxIAAgAWpBD2pBeHEiASAAa0EBdHI2AgAgASAANgIEIAEgASgCAEEBcSAAIAJBAXZqIAFrIgJBAXRyNgIAQYQgIAEgAkH/////B3FqQQRqQYQgKAIAIABGGyABNgIAIAEQJQsLygIBBX8CQAJAAkAgAEEIIABBCEsbZ0EfcyAAaUEBR2oiAUEESSAAIAF2cg0AIAFBAnRB/B5qKAIAIgJFDQADQCACQXhqIgMoAgBBAXZBeGoiBSAATwRAIAIgBUEIIAVBCEsbZ0Efc0ECdEGAH2oiASgCAEYEQCABIAIoAgQ2AgALDAMLIARBHksNASAEQQFqIQQgAigCBCICDQALC0EAIQMgAUEgTw0BA0AgAUECdEGAH2ooAgAiAkUEQCABQR5LIQIgAUEBaiEBIAJFDQEMAwsLIAIgAkF4aiIDKAIAQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgBGBEAgASACKAIENgIACwsgAigCACIBBEAgASACKAIENgIECyACKAIEIgEEQCABIAIoAgA2AgALIAMgAygCAEEBcjYCACADIAAQNwsgAwvhCwINfwV+IwBB8ABrIgckACAHIAAoAvDhASIINgJcIAEgAmohDSAIIAAoAoDiAWohDwJAAkAgBUUEQCABIQQMAQsgACgCxOABIRAgACgCwOABIREgACgCvOABIQ4gAEEBNgKM4QFBACEIA0AgCEEDRwRAIAcgCEECdCICaiAAIAJqQazQAWooAgA2AkQgCEEBaiEIDAELC0FsIQwgB0EYaiADIAQQBhADDQEgB0EsaiAHQRhqIAAoAgAQEyAHQTRqIAdBGGogACgCCBATIAdBPGogB0EYaiAAKAIEEBMgDUFgaiESIAEhBEEAIQwDQCAHKAIwIAcoAixBA3RqKQIAIhRCEIinQf8BcSEIIAcoAkAgBygCPEEDdGopAgAiFUIQiKdB/wFxIQsgBygCOCAHKAI0QQN0aikCACIWQiCIpyEJIBVCIIghFyAUQiCIpyECAkAgFkIQiKdB/wFxIgNBAk8EQAJAIAZFIANBGUlyRQRAIAkgB0EYaiADQSAgBygCHGsiCiAKIANLGyIKEAUgAyAKayIDdGohCSAHQRhqEAQaIANFDQEgB0EYaiADEAUgCWohCQwBCyAHQRhqIAMQBSAJaiEJIAdBGGoQBBoLIAcpAkQhGCAHIAk2AkQgByAYNwNIDAELAkAgA0UEQCACBEAgBygCRCEJDAMLIAcoAkghCQwBCwJAAkAgB0EYakEBEAUgCSACRWpqIgNBA0YEQCAHKAJEQX9qIgMgA0VqIQkMAQsgA0ECdCAHaigCRCIJIAlFaiEJIANBAUYNAQsgByAHKAJINgJMCwsgByAHKAJENgJIIAcgCTYCRAsgF6chAyALBEAgB0EYaiALEAUgA2ohAwsgCCALakEUTwRAIAdBGGoQBBoLIAgEQCAHQRhqIAgQBSACaiECCyAHQRhqEAQaIAcgB0EYaiAUQhiIp0H/AXEQCCAUp0H//wNxajYCLCAHIAdBGGogFUIYiKdB/wFxEAggFadB//8DcWo2AjwgB0EYahAEGiAHIAdBGGogFkIYiKdB/wFxEAggFqdB//8DcWo2AjQgByACNgJgIAcoAlwhCiAHIAk2AmggByADNgJkAkACQAJAIAQgAiADaiILaiASSw0AIAIgCmoiEyAPSw0AIA0gBGsgC0Egak8NAQsgByAHKQNoNwMQIAcgBykDYDcDCCAEIA0gB0EIaiAHQdwAaiAPIA4gESAQEB4hCwwBCyACIARqIQggBCAKEAcgAkERTwRAIARBEGohAgNAIAIgCkEQaiIKEAcgAkEQaiICIAhJDQALCyAIIAlrIQIgByATNgJcIAkgCCAOa0sEQCAJIAggEWtLBEBBbCELDAILIBAgAiAOayICaiIKIANqIBBNBEAgCCAKIAMQDxoMAgsgCCAKQQAgAmsQDyEIIAcgAiADaiIDNgJkIAggAmshCCAOIQILIAlBEE8EQCADIAhqIQMDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALDAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdBKGogACgCBBATQQAhBCAHQeAAaiEMIAdB5ABqIQoDQCAHQShqEARBAksgBCAXTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEJIAcoAkggBygCREEDdGopAgAiH0IgiKchCCAeQiCIISAgHUIgiKchAgJAIB9CEIinQf8BcSIDQQJPBEACQCAGRSADQRlJckUEQCAIIAdBKGogA0EgIAcoAixrIg0gDSADSxsiDRAFIAMgDWsiA3RqIQggB0EoahAEGiADRQ0BIAdBKGogAxAFIAhqIQgMAQsgB0EoaiADEAUgCGohCCAHQShqEAQaCyAHKQJUISEgByAINgJUIAcgITcDWAwBCwJAIANFBEAgAgRAIAcoAlQhCAwDCyAHKAJYIQgMAQsCQAJAIAdBKGpBARAFIAggAkVqaiIDQQNGBEAgBygCVEF/aiIDIANFaiEIDAELIANBAnQgB2ooAlQiCCAIRWohCCADQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAg2AlQLICCnIQMgCQRAIAdBKGogCRAFIANqIQMLIAkgC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgAmohAgsgB0EoahAEGiAHIAcoAmggAmoiCSADajYCaCAKIAwgCCAJSxsoAgAhDSAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogB0EoaiAfQhiIp0H/AXEQCCEOIAdB8ABqIARBBHRqIgsgCSANaiAIazYCDCALIAg2AgggCyADNgIEIAsgAjYCACAHIA4gH6dB//8DcWo2AkQgBEEBaiEEDAELCyAEIBdIDQEgEkFgaiEYIAdB4ABqIRogB0HkAGohGyABIQMDQCAHQShqEARBAksgBCAFTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEIIAcoAkggBygCREEDdGopAgAiH0IgiKchCSAeQiCIISAgHUIgiKchDAJAIB9CEIinQf8BcSICQQJPBEACQCAGRSACQRlJckUEQCAJIAdBKGogAkEgIAcoAixrIgogCiACSxsiChAFIAIgCmsiAnRqIQkgB0EoahAEGiACRQ0BIAdBKGogAhAFIAlqIQkMAQsgB0EoaiACEAUgCWohCSAHQShqEAQaCyAHKQJUISEgByAJNgJUIAcgITcDWAwBCwJAIAJFBEAgDARAIAcoAlQhCQwDCyAHKAJYIQkMAQsCQAJAIAdBKGpBARAFIAkgDEVqaiICQQNGBEAgBygCVEF/aiICIAJFaiEJDAELIAJBAnQgB2ooAlQiCSAJRWohCSACQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAk2AlQLICCnIRQgCARAIAdBKGogCBAFIBRqIRQLIAggC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgDGohDAsgB0EoahAEGiAHIAcoAmggDGoiGSAUajYCaCAbIBogCSAZSxsoAgAhHCAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogByAHQShqIB9CGIinQf8BcRAIIB+nQf//A3FqNgJEIAcgB0HwAGogBEEDcUEEdGoiDSkDCCIdNwPIASAHIA0pAwAiHjcDwAECQAJAAkAgBygCvAEiDiAepyICaiIWIBNLDQAgAyAHKALEASIKIAJqIgtqIBhLDQAgEiADayALQSBqTw0BCyAHIAcpA8gBNwMQIAcgBykDwAE3AwggAyASIAdBCGogB0G8AWogEyAPIBUgERAeIQsMAQsgAiADaiEIIAMgDhAHIAJBEU8EQCADQRBqIQIDQCACIA5BEGoiDhAHIAJBEGoiAiAISQ0ACwsgCCAdpyIOayECIAcgFjYCvAEgDiAIIA9rSwRAIA4gCCAVa0sEQEFsIQsMAgsgESACIA9rIgJqIhYgCmogEU0EQCAIIBYgChAPGgwCCyAIIBZBACACaxAPIQggByACIApqIgo2AsQBIAggAmshCCAPIQILIA5BEE8EQCAIIApqIQoDQCAIIAIQByACQRBqIQIgCEEQaiIIIApJDQALDAELAkAgDkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgDkECdCIKQcAeaigCAGoiAhAXIAIgCkHgHmooAgBrIQIgBygCxAEhCgwBCyAIIAIQDAsgCkEJSQ0AIAggCmohCiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAKSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAKSQ0ACwsgCxADBEAgCyEQDAQFIA0gDDYCACANIBkgHGogCWs2AgwgDSAJNgIIIA0gFDYCBCAEQQFqIQQgAyALaiEDDAILAAsLIAQgBUgNASAEIBdrIQtBACEEA0AgCyAFSARAIAcgB0HwAGogC0EDcUEEdGoiAikDCCIdNwPIASAHIAIpAwAiHjcDwAECQAJAAkAgBygCvAEiDCAepyICaiIKIBNLDQAgAyAHKALEASIJIAJqIhBqIBhLDQAgEiADayAQQSBqTw0BCyAHIAcpA8gBNwMgIAcgBykDwAE3AxggAyASIAdBGGogB0G8AWogEyAPIBUgERAeIRAMAQsgAiADaiEIIAMgDBAHIAJBEU8EQCADQRBqIQIDQCACIAxBEGoiDBAHIAJBEGoiAiAISQ0ACwsgCCAdpyIGayECIAcgCjYCvAEgBiAIIA9rSwRAIAYgCCAVa0sEQEFsIRAMAgsgESACIA9rIgJqIgwgCWogEU0EQCAIIAwgCRAPGgwCCyAIIAxBACACaxAPIQggByACIAlqIgk2AsQBIAggAmshCCAPIQILIAZBEE8EQCAIIAlqIQYDQCAIIAIQByACQRBqIQIgCEEQaiIIIAZJDQALDAELAkAgBkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgBkECdCIGQcAeaigCAGoiAhAXIAIgBkHgHmooAgBrIQIgBygCxAEhCQwBCyAIIAIQDAsgCUEJSQ0AIAggCWohBiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAGSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAGSQ0ACwsgEBADDQMgC0EBaiELIAMgEGohAwwBCwsDQCAEQQNHBEAgACAEQQJ0IgJqQazQAWogAiAHaigCVDYCACAEQQFqIQQMAQsLIAcoArwBIQgLQbp/IRAgEyAIayIAIBIgA2tLDQAgAwR/IAMgCCAAEAsgAGoFQQALIAFrIRALIAdB0AFqJAAgEAslACAAQgA3AgAgAEEAOwEIIABBADoACyAAIAE2AgwgACACOgAKC7QFAQN/IwBBMGsiBCQAIABB/wFqIgVBfWohBgJAIAMvAQIEQCAEQRhqIAEgAhAGIgIQAw0BIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahASOgAAIAMgBEEIaiAEQRhqEBI6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0FIAEgBEEQaiAEQRhqEBI6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWsiAyQAQWIhCAJAIAJBCUkNACAAQZjQAGogAUEIaiIEIAJBeGogAEGY0AAQMyIFEAMiBg0AIANBHzYCfCADIANB/ABqIANB+ABqIAQgBCAFaiAGGyIEIAEgAmoiAiAEaxAVIgUQAw0AIAMoAnwiBkEfSw0AIAMoAngiB0EJTw0AIABBiCBqIAMgBkGAC0GADCAHEBggA0E0NgJ8IAMgA0H8AGogA0H4AGogBCAFaiIEIAIgBGsQFSIFEAMNACADKAJ8IgZBNEsNACADKAJ4IgdBCk8NACAAQZAwaiADIAZBgA1B4A4gBxAYIANBIzYCfCADIANB/ABqIANB+ABqIAQgBWoiBCACIARrEBUiBRADDQAgAygCfCIGQSNLDQAgAygCeCIHQQpPDQAgACADIAZBwBBB0BEgBxAYIAQgBWoiBEEMaiIFIAJLDQAgAiAFayEFQQAhAgNAIAJBA0cEQCAEKAAAIgZBf2ogBU8NAiAAIAJBAnRqQZzQAWogBjYCACACQQFqIQIgBEEEaiEEDAELCyAEIAFrIQgLIANBgAFqJAAgCAtGAQN/IABBCGohAyAAKAIEIQJBACEAA0AgACACdkUEQCABIAMgAEEDdGotAAJBFktqIQEgAEEBaiEADAELCyABQQggAmt0C4YDAQV/Qbh/IQcCQCADRQ0AIAItAAAiBEUEQCABQQA2AgBBAUG4fyADQQFGGw8LAn8gAkEBaiIFIARBGHRBGHUiBkF/Sg0AGiAGQX9GBEAgA0EDSA0CIAUvAABBgP4BaiEEIAJBA2oMAQsgA0ECSA0BIAItAAEgBEEIdHJBgIB+aiEEIAJBAmoLIQUgASAENgIAIAVBAWoiASACIANqIgNLDQBBbCEHIABBEGogACAFLQAAIgVBBnZBI0EJIAEgAyABa0HAEEHQEUHwEiAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBmCBqIABBCGogBUEEdkEDcUEfQQggASABIAZqIAgbIgEgAyABa0GAC0GADEGAFyAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBoDBqIABBBGogBUECdkEDcUE0QQkgASABIAZqIAgbIgEgAyABa0GADUHgDkGQGSAAKAKM4QEgACgCnOIBIAQQHyIAEAMNACAAIAFqIAJrIQcLIAcLrQMBCn8jAEGABGsiCCQAAn9BUiACQf8BSw0AGkFUIANBDEsNABogAkEBaiELIABBBGohCUGAgAQgA0F/anRBEHUhCkEAIQJBASEEQQEgA3QiB0F/aiIMIQUDQCACIAtGRQRAAkAgASACQQF0Ig1qLwEAIgZB//8DRgRAIAkgBUECdGogAjoAAiAFQX9qIQVBASEGDAELIARBACAKIAZBEHRBEHVKGyEECyAIIA1qIAY7AQAgAkEBaiECDAELCyAAIAQ7AQIgACADOwEAIAdBA3YgB0EBdmpBA2ohBkEAIQRBACECA0AgBCALRkUEQCABIARBAXRqLgEAIQpBACEAA0AgACAKTkUEQCAJIAJBAnRqIAQ6AAIDQCACIAZqIAxxIgIgBUsNAAsgAEEBaiEADAELCyAEQQFqIQQMAQsLQX8gAg0AGkEAIQIDfyACIAdGBH9BAAUgCCAJIAJBAnRqIgAtAAJBAXRqIgEgAS8BACIBQQFqOwEAIAAgAyABEBRrIgU6AAMgACABIAVB/wFxdCAHazsBACACQQFqIQIMAQsLCyEFIAhBgARqJAAgBQvjBgEIf0FsIQcCQCACQQNJDQACQAJAAkACQCABLQAAIgNBA3EiCUEBaw4DAwEAAgsgACgCiOEBDQBBYg8LIAJBBUkNAkEDIQYgASgAACEFAn8CQAJAIANBAnZBA3EiCEF+aiIEQQFNBEAgBEEBaw0BDAILIAVBDnZB/wdxIQQgBUEEdkH/B3EhAyAIRQwCCyAFQRJ2IQRBBCEGIAVBBHZB//8AcSEDQQAMAQsgBUEEdkH//w9xIgNBgIAISw0DIAEtAARBCnQgBUEWdnIhBEEFIQZBAAshBSAEIAZqIgogAksNAgJAIANBgQZJDQAgACgCnOIBRQ0AQQAhAgNAIAJBg4ABSw0BIAJBQGshAgwAAAsACwJ/IAlBA0YEQCABIAZqIQEgAEHw4gFqIQIgACgCDCEGIAUEQCACIAMgASAEIAYQXwwCCyACIAMgASAEIAYQXQwBCyAAQbjQAWohAiABIAZqIQEgAEHw4gFqIQYgAEGo0ABqIQggBQRAIAggBiADIAEgBCACEF4MAQsgCCAGIAMgASAEIAIQXAsQAw0CIAAgAzYCgOIBIABBATYCiOEBIAAgAEHw4gFqNgLw4QEgCUECRgRAIAAgAEGo0ABqNgIMCyAAIANqIgBBiOMBakIANwAAIABBgOMBakIANwAAIABB+OIBakIANwAAIABB8OIBakIANwAAIAoPCwJ/AkACQAJAIANBAnZBA3FBf2oiBEECSw0AIARBAWsOAgACAQtBASEEIANBA3YMAgtBAiEEIAEvAABBBHYMAQtBAyEEIAEQIUEEdgsiAyAEaiIFQSBqIAJLBEAgBSACSw0CIABB8OIBaiABIARqIAMQCyEBIAAgAzYCgOIBIAAgATYC8OEBIAEgA2oiAEIANwAYIABCADcAECAAQgA3AAggAEIANwAAIAUPCyAAIAM2AoDiASAAIAEgBGo2AvDhASAFDwsCfwJAAkACQCADQQJ2QQNxQX9qIgRBAksNACAEQQFrDgIAAgELQQEhByADQQN2DAILQQIhByABLwAAQQR2DAELIAJBBEkgARAhIgJBj4CAAUtyDQFBAyEHIAJBBHYLIQIgAEHw4gFqIAEgB2otAAAgAkEgahAQIQEgACACNgKA4gEgACABNgLw4QEgB0EBaiEHCyAHC0sAIABC+erQ0OfJoeThADcDICAAQgA3AxggAELP1tO+0ser2UI3AxAgAELW64Lu6v2J9eAANwMIIABCADcDACAAQShqQQBBKBAQGgviAgICfwV+IABBKGoiASAAKAJIaiECAn4gACkDACIDQiBaBEAgACkDECIEQgeJIAApAwgiBUIBiXwgACkDGCIGQgyJfCAAKQMgIgdCEol8IAUQGSAEEBkgBhAZIAcQGQwBCyAAKQMYQsXP2bLx5brqJ3wLIAN8IQMDQCABQQhqIgAgAk0EQEIAIAEpAAAQCSADhUIbiUKHla+vmLbem55/fkLj3MqV/M7y9YV/fCEDIAAhAQwBCwsCQCABQQRqIgAgAksEQCABIQAMAQsgASgAAK1Ch5Wvr5i23puef34gA4VCF4lCz9bTvtLHq9lCfkL5893xmfaZqxZ8IQMLA0AgACACSQRAIAAxAABCxc/ZsvHluuonfiADhUILiUKHla+vmLbem55/fiEDIABBAWohAAwBCwsgA0IhiCADhULP1tO+0ser2UJ+IgNCHYggA4VC+fPd8Zn2masWfiIDQiCIIAOFC+8CAgJ/BH4gACAAKQMAIAKtfDcDAAJAAkAgACgCSCIDIAJqIgRBH00EQCABRQ0BIAAgA2pBKGogASACECAgACgCSCACaiEEDAELIAEgAmohAgJ/IAMEQCAAQShqIgQgA2ogAUEgIANrECAgACAAKQMIIAQpAAAQCTcDCCAAIAApAxAgACkAMBAJNwMQIAAgACkDGCAAKQA4EAk3AxggACAAKQMgIABBQGspAAAQCTcDICAAKAJIIQMgAEEANgJIIAEgA2tBIGohAQsgAUEgaiACTQsEQCACQWBqIQMgACkDICEFIAApAxghBiAAKQMQIQcgACkDCCEIA0AgCCABKQAAEAkhCCAHIAEpAAgQCSEHIAYgASkAEBAJIQYgBSABKQAYEAkhBSABQSBqIgEgA00NAAsgACAFNwMgIAAgBjcDGCAAIAc3AxAgACAINwMICyABIAJPDQEgAEEoaiABIAIgAWsiBBAgCyAAIAQ2AkgLCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQEBogAwVBun8LCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQCxogAwVBun8LC6gCAQZ/IwBBEGsiByQAIABB2OABaikDAEKAgIAQViEIQbh/IQUCQCAEQf//B0sNACAAIAMgBBBCIgUQAyIGDQAgACgCnOIBIQkgACAHQQxqIAMgAyAFaiAGGyIKIARBACAFIAYbayIGEEAiAxADBEAgAyEFDAELIAcoAgwhBCABRQRAQbp/IQUgBEEASg0BCyAGIANrIQUgAyAKaiEDAkAgCQRAIABBADYCnOIBDAELAkACQAJAIARBBUgNACAAQdjgAWopAwBCgICACFgNAAwBCyAAQQA2ApziAQwBCyAAKAIIED8hBiAAQQA2ApziASAGQRRPDQELIAAgASACIAMgBSAEIAgQOSEFDAELIAAgASACIAMgBSAEIAgQOiEFCyAHQRBqJAAgBQtnACAAQdDgAWogASACIAAoAuzhARAuIgEQAwRAIAEPC0G4fyECAkAgAQ0AIABB7OABaigCACIBBEBBYCECIAAoApjiASABRw0BC0EAIQIgAEHw4AFqKAIARQ0AIABBkOEBahBDCyACCycBAX8QVyIERQRAQUAPCyAEIAAgASACIAMgBBBLEE8hACAEEFYgAAs/AQF/AkACQAJAIAAoAqDiAUEBaiIBQQJLDQAgAUEBaw4CAAECCyAAEDBBAA8LIABBADYCoOIBCyAAKAKU4gELvAMCB38BfiMAQRBrIgkkAEG4fyEGAkAgBCgCACIIQQVBCSAAKALs4QEiBRtJDQAgAygCACIHQQFBBSAFGyAFEC8iBRADBEAgBSEGDAELIAggBUEDakkNACAAIAcgBRBJIgYQAw0AIAEgAmohCiAAQZDhAWohCyAIIAVrIQIgBSAHaiEHIAEhBQNAIAcgAiAJECwiBhADDQEgAkF9aiICIAZJBEBBuH8hBgwCCyAJKAIAIghBAksEQEFsIQYMAgsgB0EDaiEHAn8CQAJAAkAgCEEBaw4CAgABCyAAIAUgCiAFayAHIAYQSAwCCyAFIAogBWsgByAGEEcMAQsgBSAKIAVrIActAAAgCSgCCBBGCyIIEAMEQCAIIQYMAgsgACgC8OABBEAgCyAFIAgQRQsgAiAGayECIAYgB2ohByAFIAhqIQUgCSgCBEUNAAsgACkD0OABIgxCf1IEQEFsIQYgDCAFIAFrrFINAQsgACgC8OABBEBBaiEGIAJBBEkNASALEEQhDCAHKAAAIAynRw0BIAdBBGohByACQXxqIQILIAMgBzYCACAEIAI2AgAgBSABayEGCyAJQRBqJAAgBgsuACAAECsCf0EAQQAQAw0AGiABRSACRXJFBEBBYiAAIAEgAhA9EAMNARoLQQALCzcAIAEEQCAAIAAoAsTgASABKAIEIAEoAghqRzYCnOIBCyAAECtBABADIAFFckUEQCAAIAEQWwsL0QIBB38jAEEQayIGJAAgBiAENgIIIAYgAzYCDCAFBEAgBSgCBCEKIAUoAgghCQsgASEIAkACQANAIAAoAuzhARAWIQsCQANAIAQgC0kNASADKAAAQXBxQdDUtMIBRgRAIAMgBBAiIgcQAw0EIAQgB2shBCADIAdqIQMMAQsLIAYgAzYCDCAGIAQ2AggCQCAFBEAgACAFEE5BACEHQQAQA0UNAQwFCyAAIAogCRBNIgcQAw0ECyAAIAgQUCAMQQFHQQAgACAIIAIgBkEMaiAGQQhqEEwiByIDa0EAIAMQAxtBCkdyRQRAQbh/IQcMBAsgBxADDQMgAiAHayECIAcgCGohCEEBIQwgBigCDCEDIAYoAgghBAwBCwsgBiADNgIMIAYgBDYCCEG4fyEHIAQNASAIIAFrIQcMAQsgBiADNgIMIAYgBDYCCAsgBkEQaiQAIAcLRgECfyABIAAoArjgASICRwRAIAAgAjYCxOABIAAgATYCuOABIAAoArzgASEDIAAgATYCvOABIAAgASADIAJrajYCwOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACAFQQhqIAQQDgJ/IAUtAAkEQCAAIAEgAiADIAQQYgwBCyAAIAEgAiADIAQQNQshACAFQRBqJAAgAAtZAQF/QQ8hAiABIABJBEAgAUEEdCAAbiECCyAAQQh2IgEgAkEYbCIAQYwIaigCAGwgAEGICGooAgBqIgJBA3YgAmogAEGACGooAgAgAEGECGooAgAgAWxqSQs3ACAAIAMgBCAFQYAQEDMiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQMgVBuH8LC78DAQN/IwBBIGsiBSQAIAVBCGogAiADEAYiAhADRQRAIAAgAWoiB0F9aiEGIAUgBBAOIARBBGohAiAFLQACIQMDQEEAIAAgBkkgBUEIahAEGwRAIAAgAiAFQQhqIAMQAkECdGoiBC8BADsAACAFQQhqIAQtAAIQASAAIAQtAANqIgQgAiAFQQhqIAMQAkECdGoiAC8BADsAACAFQQhqIAAtAAIQASAEIAAtAANqIQAMAQUgB0F+aiEEA0AgBUEIahAEIAAgBEtyRQRAIAAgAiAFQQhqIAMQAkECdGoiBi8BADsAACAFQQhqIAYtAAIQASAAIAYtAANqIQAMAQsLA0AgACAES0UEQCAAIAIgBUEIaiADEAJBAnRqIgYvAQA7AAAgBUEIaiAGLQACEAEgACAGLQADaiEADAELCwJAIAAgB08NACAAIAIgBUEIaiADEAIiA0ECdGoiAC0AADoAACAALQADQQFGBEAgBUEIaiAALQACEAEMAQsgBSgCDEEfSw0AIAVBCGogAiADQQJ0ai0AAhABIAUoAgxBIUkNACAFQSA2AgwLIAFBbCAFQQhqEAobIQILCwsgBUEgaiQAIAILkgIBBH8jAEFAaiIJJAAgCSADQTQQCyEDAkAgBEECSA0AIAMgBEECdGooAgAhCSADQTxqIAgQIyADQQE6AD8gAyACOgA+QQAhBCADKAI8IQoDQCAEIAlGDQEgACAEQQJ0aiAKNgEAIARBAWohBAwAAAsAC0EAIQkDQCAGIAlGRQRAIAMgBSAJQQF0aiIKLQABIgtBAnRqIgwoAgAhBCADQTxqIAotAABBCHQgCGpB//8DcRAjIANBAjoAPyADIAcgC2siCiACajoAPiAEQQEgASAKa3RqIQogAygCPCELA0AgACAEQQJ0aiALNgEAIARBAWoiBCAKSQ0ACyAMIAo2AgAgCUEBaiEJDAELCyADQUBrJAALowIBCX8jAEHQAGsiCSQAIAlBEGogBUE0EAsaIAcgBmshDyAHIAFrIRADQAJAIAMgCkcEQEEBIAEgByACIApBAXRqIgYtAAEiDGsiCGsiC3QhDSAGLQAAIQ4gCUEQaiAMQQJ0aiIMKAIAIQYgCyAPTwRAIAAgBkECdGogCyAIIAUgCEE0bGogCCAQaiIIQQEgCEEBShsiCCACIAQgCEECdGooAgAiCEEBdGogAyAIayAHIA4QYyAGIA1qIQgMAgsgCUEMaiAOECMgCUEBOgAPIAkgCDoADiAGIA1qIQggCSgCDCELA0AgBiAITw0CIAAgBkECdGogCzYBACAGQQFqIQYMAAALAAsgCUHQAGokAA8LIAwgCDYCACAKQQFqIQoMAAALAAs0ACAAIAMgBCAFEDYiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQNAVBuH8LCyMAIAA/AEEQdGtB//8DakEQdkAAQX9GBEBBAA8LQQAQAEEBCzsBAX8gAgRAA0AgACABIAJBgCAgAkGAIEkbIgMQCyEAIAFBgCBqIQEgAEGAIGohACACIANrIgINAAsLCwYAIAAQAwsLqBUJAEGICAsNAQAAAAEAAAACAAAAAgBBoAgLswYBAAAAAQAAAAIAAAACAAAAJgAAAIIAAAAhBQAASgAAAGcIAAAmAAAAwAEAAIAAAABJBQAASgAAAL4IAAApAAAALAIAAIAAAABJBQAASgAAAL4IAAAvAAAAygIAAIAAAACKBQAASgAAAIQJAAA1AAAAcwMAAIAAAACdBQAASgAAAKAJAAA9AAAAgQMAAIAAAADrBQAASwAAAD4KAABEAAAAngMAAIAAAABNBgAASwAAAKoKAABLAAAAswMAAIAAAADBBgAATQAAAB8NAABNAAAAUwQAAIAAAAAjCAAAUQAAAKYPAABUAAAAmQQAAIAAAABLCQAAVwAAALESAABYAAAA2gQAAIAAAABvCQAAXQAAACMUAABUAAAARQUAAIAAAABUCgAAagAAAIwUAABqAAAArwUAAIAAAAB2CQAAfAAAAE4QAAB8AAAA0gIAAIAAAABjBwAAkQAAAJAHAACSAAAAAAAAAAEAAAABAAAABQAAAA0AAAAdAAAAPQAAAH0AAAD9AAAA/QEAAP0DAAD9BwAA/Q8AAP0fAAD9PwAA/X8AAP3/AAD9/wEA/f8DAP3/BwD9/w8A/f8fAP3/PwD9/38A/f//AP3//wH9//8D/f//B/3//w/9//8f/f//P/3//38AAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABEAAAASAAAAEwAAABQAAAAVAAAAFgAAABcAAAAYAAAAGQAAABoAAAAbAAAAHAAAAB0AAAAeAAAAHwAAAAMAAAAEAAAABQAAAAYAAAAHAAAACAAAAAkAAAAKAAAACwAAAAwAAAANAAAADgAAAA8AAAAQAAAAEQAAABIAAAATAAAAFAAAABUAAAAWAAAAFwAAABgAAAAZAAAAGgAAABsAAAAcAAAAHQAAAB4AAAAfAAAAIAAAACEAAAAiAAAAIwAAACUAAAAnAAAAKQAAACsAAAAvAAAAMwAAADsAAABDAAAAUwAAAGMAAACDAAAAAwEAAAMCAAADBAAAAwgAAAMQAAADIAAAA0AAAAOAAAADAAEAQeAPC1EBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAEAAAABQAAAAcAAAAIAAAACQAAAAoAAAALAAAADAAAAA0AAAAOAAAADwAAABAAQcQQC4sBAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABIAAAAUAAAAFgAAABgAAAAcAAAAIAAAACgAAAAwAAAAQAAAAIAAAAAAAQAAAAIAAAAEAAAACAAAABAAAAAgAAAAQAAAAIAAAAAAAQBBkBIL5gQBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAAAEAAAAEAAAACAAAAAAAAAABAAEBBgAAAAAAAAQAAAAAEAAABAAAAAAgAAAFAQAAAAAAAAUDAAAAAAAABQQAAAAAAAAFBgAAAAAAAAUHAAAAAAAABQkAAAAAAAAFCgAAAAAAAAUMAAAAAAAABg4AAAAAAAEFEAAAAAAAAQUUAAAAAAABBRYAAAAAAAIFHAAAAAAAAwUgAAAAAAAEBTAAAAAgAAYFQAAAAAAABwWAAAAAAAAIBgABAAAAAAoGAAQAAAAADAYAEAAAIAAABAAAAAAAAAAEAQAAAAAAAAUCAAAAIAAABQQAAAAAAAAFBQAAACAAAAUHAAAAAAAABQgAAAAgAAAFCgAAAAAAAAULAAAAAAAABg0AAAAgAAEFEAAAAAAAAQUSAAAAIAABBRYAAAAAAAIFGAAAACAAAwUgAAAAAAADBSgAAAAAAAYEQAAAABAABgRAAAAAIAAHBYAAAAAAAAkGAAIAAAAACwYACAAAMAAABAAAAAAQAAAEAQAAACAAAAUCAAAAIAAABQMAAAAgAAAFBQAAACAAAAUGAAAAIAAABQgAAAAgAAAFCQAAACAAAAULAAAAIAAABQwAAAAAAAAGDwAAACAAAQUSAAAAIAABBRQAAAAgAAIFGAAAACAAAgUcAAAAIAADBSgAAAAgAAQFMAAAAAAAEAYAAAEAAAAPBgCAAAAAAA4GAEAAAAAADQYAIABBgBcLhwIBAAEBBQAAAAAAAAUAAAAAAAAGBD0AAAAAAAkF/QEAAAAADwX9fwAAAAAVBf3/HwAAAAMFBQAAAAAABwR9AAAAAAAMBf0PAAAAABIF/f8DAAAAFwX9/38AAAAFBR0AAAAAAAgE/QAAAAAADgX9PwAAAAAUBf3/DwAAAAIFAQAAABAABwR9AAAAAAALBf0HAAAAABEF/f8BAAAAFgX9/z8AAAAEBQ0AAAAQAAgE/QAAAAAADQX9HwAAAAATBf3/BwAAAAEFAQAAABAABgQ9AAAAAAAKBf0DAAAAABAF/f8AAAAAHAX9//8PAAAbBf3//wcAABoF/f//AwAAGQX9//8BAAAYBf3//wBBkBkLhgQBAAEBBgAAAAAAAAYDAAAAAAAABAQAAAAgAAAFBQAAAAAAAAUGAAAAAAAABQgAAAAAAAAFCQAAAAAAAAULAAAAAAAABg0AAAAAAAAGEAAAAAAAAAYTAAAAAAAABhYAAAAAAAAGGQAAAAAAAAYcAAAAAAAABh8AAAAAAAAGIgAAAAAAAQYlAAAAAAABBikAAAAAAAIGLwAAAAAAAwY7AAAAAAAEBlMAAAAAAAcGgwAAAAAACQYDAgAAEAAABAQAAAAAAAAEBQAAACAAAAUGAAAAAAAABQcAAAAgAAAFCQAAAAAAAAUKAAAAAAAABgwAAAAAAAAGDwAAAAAAAAYSAAAAAAAABhUAAAAAAAAGGAAAAAAAAAYbAAAAAAAABh4AAAAAAAAGIQAAAAAAAQYjAAAAAAABBicAAAAAAAIGKwAAAAAAAwYzAAAAAAAEBkMAAAAAAAUGYwAAAAAACAYDAQAAIAAABAQAAAAwAAAEBAAAABAAAAQFAAAAIAAABQcAAAAgAAAFCAAAACAAAAUKAAAAIAAABQsAAAAAAAAGDgAAAAAAAAYRAAAAAAAABhQAAAAAAAAGFwAAAAAAAAYaAAAAAAAABh0AAAAAAAAGIAAAAAAAEAYDAAEAAAAPBgOAAAAAAA4GA0AAAAAADQYDIAAAAAAMBgMQAAAAAAsGAwgAAAAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/AAAA/wAAAP8BAAD/AwAA/wcAAP8PAAD/HwAA/z8AAP9/AAD//wAA//8BAP//AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ";Mn.spaces[Di];const ng=new WeakMap;let rg,sg=0;class ag extends Nl{constructor(t){super(t),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new sA,this.workerSourceURL="",this.workerConfig=null,"undefined"!=typeof MSC_TRANSCODER&&console.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.')}setTranscoderPath(t){return this.transcoderPath=t,this}setWorkerLimit(t){return this.workerPool.setWorkerLimit(t),this}async detectSupportAsync(t){return console.warn('KTX2Loader: "detectSupportAsync()" has been deprecated. Use "detectSupport()" and "await renderer.init();" when creating the renderer.'),await t.init(),this.detectSupport(t)}detectSupport(t){return!0===t.isWebGPURenderer?this.workerConfig={astcSupported:t.hasFeature("texture-compression-astc"),astcHDRSupported:!1,etc1Supported:t.hasFeature("texture-compression-etc1"),etc2Supported:t.hasFeature("texture-compression-etc2"),dxtSupported:t.hasFeature("texture-compression-s3tc"),bptcSupported:t.hasFeature("texture-compression-bc"),pvrtcSupported:t.hasFeature("texture-compression-pvrtc")}:(this.workerConfig={astcSupported:t.extensions.has("WEBGL_compressed_texture_astc"),astcHDRSupported:t.extensions.has("WEBGL_compressed_texture_astc")&&t.extensions.get("WEBGL_compressed_texture_astc").getSupportedProfiles().includes("hdr"),etc1Supported:t.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:t.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:t.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:t.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:t.extensions.has("WEBGL_compressed_texture_pvrtc")||t.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},"undefined"!=typeof navigator&&void 0!==navigator.platform&&void 0!==navigator.userAgent&&navigator.platform.indexOf("Linux")>=0&&navigator.userAgent.indexOf("Firefox")>=0&&this.workerConfig.astcSupported&&this.workerConfig.etc2Supported&&this.workerConfig.bptcSupported&&this.workerConfig.dxtSupported&&(this.workerConfig.astcSupported=!1,this.workerConfig.etc2Supported=!1)),this}init(){if(!this.transcoderPending){const t=new Ql(this.manager);t.setPath(this.transcoderPath),t.setWithCredentials(this.withCredentials);const e=t.loadAsync("basis_transcoder.js"),i=new Ql(this.manager);i.setPath(this.transcoderPath),i.setResponseType("arraybuffer"),i.setWithCredentials(this.withCredentials);const n=i.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([e,n]).then(([t,e])=>{const i=ag.BasisWorker.toString(),n=["/* constants */","let _EngineFormat = "+JSON.stringify(ag.EngineFormat),"let _EngineType = "+JSON.stringify(ag.EngineType),"let _TranscoderFormat = "+JSON.stringify(ag.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(ag.BasisFormat),"/* basis_transcoder.js */",t,"/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([n])),this.transcoderBinary=e,this.workerPool.setWorkerCreator(()=>{const t=new Worker(this.workerSourceURL),e=this.transcoderBinary.slice(0);return t.postMessage({type:"init",config:this.workerConfig,transcoderBinary:e},[e]),t})}),sg>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),sg++}return this.transcoderPending}load(t,e,i,n){if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");const r=new Ql(this.manager);r.setPath(this.path),r.setCrossOrigin(this.crossOrigin),r.setWithCredentials(this.withCredentials),r.setRequestHeader(this.requestHeader),r.setResponseType("arraybuffer"),r.load(t,t=>{this.parse(t,e,n)},i,n)}parse(t,e,i){if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");if(ng.has(t)){return ng.get(t).promise.then(e).catch(i)}this._createTexture(t).then(t=>e?e(t):null).catch(i)}_createTextureFrom(t,e){const{type:i,error:n,data:{faces:r,width:s,height:a,format:o,type:l,dfdFlags:c}}=t;if("error"===i)return Promise.reject(n);let h;if(6===e.faceCount)h=new Za(r,o,l);else{const t=r[0].mipmaps;h=e.layerCount>1?new $a(t,s,a,e.layerCount,o,l):new Ya(t,s,a,o,l)}return h.minFilter=1===r[0].mipmaps.length?Ae:me,h.magFilter=Ae,h.generateMipmaps=!1,h.needsUpdate=!0,h.colorSpace=hg(e),h.premultiplyAlpha=!!(1&c),h}async _createTexture(t,e={}){const i=function(t){const e=new Uint8Array(t.buffer,t.byteOffset,KA.length);if(e[0]!==KA[0]||e[1]!==KA[1]||e[2]!==KA[2]||e[3]!==KA[3]||e[4]!==KA[4]||e[5]!==KA[5]||e[6]!==KA[6]||e[7]!==KA[7]||e[8]!==KA[8]||e[9]!==KA[9]||e[10]!==KA[10]||e[11]!==KA[11])throw new Error("Missing KTX 2.0 identifier.");const i={vkFormat:0,typeSize:1,pixelWidth:0,pixelHeight:0,pixelDepth:0,layerCount:0,faceCount:1,levelCount:0,supercompressionScheme:0,levels:[],dataFormatDescriptor:[{vendorId:0,descriptorType:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],keyValue:{},globalData:null},n=17*Uint32Array.BYTES_PER_ELEMENT,r=new XA(t,KA.length,n,!0);i.vkFormat=r._nextUint32(),i.typeSize=r._nextUint32(),i.pixelWidth=r._nextUint32(),i.pixelHeight=r._nextUint32(),i.pixelDepth=r._nextUint32(),i.layerCount=r._nextUint32(),i.faceCount=r._nextUint32(),i.levelCount=r._nextUint32(),i.supercompressionScheme=r._nextUint32();const s=r._nextUint32(),a=r._nextUint32(),o=r._nextUint32(),l=r._nextUint32(),c=r._nextUint64(),h=r._nextUint64(),u=3*Math.max(i.levelCount,1)*8,d=new XA(t,KA.length+n,u,!0);for(let e=0,n=Math.max(i.levelCount,1);e<n;e++)i.levels.push({levelData:new Uint8Array(t.buffer,t.byteOffset+d._nextUint64(),d._nextUint64()),uncompressedByteLength:d._nextUint64()});const p=new XA(t,s,a,!0);p._skip(4);const A=p._nextUint16(),g=p._nextUint16(),m=p._nextUint16(),f=p._nextUint16(),b={vendorId:A,descriptorType:g,versionNumber:m,colorModel:p._nextUint8(),colorPrimaries:p._nextUint8(),transferFunction:p._nextUint8(),flags:p._nextUint8(),texelBlockDimension:[p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8()],bytesPlane:[p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8()],samples:[]},v=(f/4-6)/4;for(let t=0;t<v;t++){const e={bitOffset:p._nextUint16(),bitLength:p._nextUint8(),channelType:p._nextUint8(),samplePosition:[p._nextUint8(),p._nextUint8(),p._nextUint8(),p._nextUint8()],sampleLower:Number.NEGATIVE_INFINITY,sampleUpper:Number.POSITIVE_INFINITY};64&e.channelType?(e.sampleLower=p._nextInt32(),e.sampleUpper=p._nextInt32()):(e.sampleLower=p._nextUint32(),e.sampleUpper=p._nextUint32()),b.samples[t]=e}i.dataFormatDescriptor.length=0,i.dataFormatDescriptor.push(b);const y=new XA(t,o,l,!0);for(;y._offset<l;){const t=y._nextUint32(),e=y._scan(t),n=JA(e);if(i.keyValue[n]=y._nextUint8Array(t-e.byteLength-1),n.match(/^ktx/i)){const t=JA(i.keyValue[n]);i.keyValue[n]=t.substring(0,t.lastIndexOf("\0"))}y._skip(t%4?4-t%4:0)}if(h<=0)return i;const x=new XA(t,c,h,!0),_=x._nextUint16(),E=x._nextUint16(),S=x._nextUint32(),C=x._nextUint32(),w=x._nextUint32(),M=x._nextUint32(),I=[];for(let t=0,e=Math.max(i.levelCount,1);t<e;t++)I.push({imageFlags:x._nextUint32(),rgbSliceByteOffset:x._nextUint32(),rgbSliceByteLength:x._nextUint32(),alphaSliceByteOffset:x._nextUint32(),alphaSliceByteLength:x._nextUint32()});const T=c+x._offset,B=T+S,R=B+C,D=R+w,L=new Uint8Array(t.buffer,t.byteOffset+T,S),P=new Uint8Array(t.buffer,t.byteOffset+B,C),F=new Uint8Array(t.buffer,t.byteOffset+R,w),U=new Uint8Array(t.buffer,t.byteOffset+D,M);return i.globalData={endpointCount:_,selectorCount:E,imageDescs:I,endpointsData:L,selectorsData:P,tablesData:F,extendedData:U},i}(new Uint8Array(t)),n=i.vkFormat===jA&&167===i.dataFormatDescriptor[0].colorModel;if(!(0===i.vkFormat||n&&!this.workerConfig.astcHDRSupported))return async function(t){const{vkFormat:e}=t;if(void 0===lg[e])throw new Error("THREE.KTX2Loader: Unsupported vkFormat: "+e);void 0===cg[e]&&console.warn('THREE.KTX2Loader: Missing ".type" for vkFormat: '+e);let i;2===t.supercompressionScheme&&(rg||(rg=new Promise(async t=>{const e=new eg;await e.init(),t(e)})),i=await rg);const n=[];for(let r=0;r<t.levels.length;r++){const s=Math.max(1,t.pixelWidth>>r),a=Math.max(1,t.pixelHeight>>r),o=t.pixelDepth?Math.max(1,t.pixelDepth>>r):0,l=t.levels[r];let c,h;if(0===t.supercompressionScheme)c=l.levelData;else{if(2!==t.supercompressionScheme)throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");c=i.decode(l.levelData,l.uncompressedByteLength)}h=cg[e]===Ee?new Float32Array(c.buffer,c.byteOffset,c.byteLength/Float32Array.BYTES_PER_ELEMENT):cg[e]===Se?new Uint16Array(c.buffer,c.byteOffset,c.byteLength/Uint16Array.BYTES_PER_ELEMENT):cg[e]===Ie||cg[e]===Te?new Uint32Array(c.buffer,c.byteOffset,c.byteLength/Uint32Array.BYTES_PER_ELEMENT):c,n.push({data:h,width:s,height:a,depth:o})}const r=0===t.levelCount||n.length>1;let s;if(og.has(lg[e]))s=0===t.pixelDepth?new la(n[0].data,t.pixelWidth,t.pixelHeight):new zn(n[0].data,t.pixelWidth,t.pixelHeight,t.pixelDepth),s.minFilter=r?de:ue,s.magFilter=ue,s.generateMipmaps=0===t.levelCount;else{if(t.pixelDepth>0)throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");s=new Ya(n,t.pixelWidth,t.pixelHeight),s.minFilter=r?me:Ae,s.magFilter=Ae}return s.mipmaps=n,s.type=cg[e],s.format=lg[e],s.colorSpace=hg(t),s.needsUpdate=!0,Promise.resolve(s)}(i);const r=e,s=this.init().then(()=>this.workerPool.postMessage({type:"transcode",buffer:t,taskConfig:r},[t])).then(t=>this._createTextureFrom(t.data,i));return ng.set(t,{promise:s}),s}dispose(){this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),sg--}}ag.BasisFormat={ETC1S:0,UASTC:1,UASTC_HDR:2},ag.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16,BC6H:22,RGB_HALF:24,RGBA_HALF:25},ag.EngineFormat={RGBAFormat:Re,RGBA_ASTC_4x4_Format:ti,RGB_BPTC_UNSIGNED_Format:mi,RGBA_BPTC_Format:Ai,RGBA_ETC2_EAC_Format:Ke,RGBA_PVRTC_4BPPV1_Format:qe,RGBA_S3TC_DXT5_Format:ze,RGB_ETC1_Format:We,RGB_ETC2_Format:Xe,RGB_PVRTC_4BPPV1_Format:He,RGBA_S3TC_DXT1_Format:Qe},ag.EngineType={UnsignedByteType:fe,HalfFloatType:Se,FloatType:Ee},ag.BasisWorker=function(){let t,e,i;const n=_EngineFormat,r=_EngineType,s=_TranscoderFormat,a=_BasisFormat;self.addEventListener("message",function(n){const s=n.data;switch(s.type){case"init":t=s.config,o=s.transcoderBinary,e=new Promise(t=>{i={wasmBinary:o,onRuntimeInitialized:t},BASIS(i)}).then(()=>{i.initializeBasis(),void 0===i.KTX2File&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")});break;case"transcode":e.then(()=>{try{const{faces:e,buffers:n,width:o,height:u,hasAlpha:d,format:p,type:A,dfdFlags:g}=function(e){const n=new i.KTX2File(new Uint8Array(e));function s(){n.close(),n.delete()}if(!n.isValid())throw s(),new Error("THREE.KTX2Loader:\tInvalid or unsupported .ktx2 file");let o;if(n.isUASTC())o=a.UASTC;else if(n.isETC1S())o=a.ETC1S;else{if(!n.isHDR())throw new Error("THREE.KTX2Loader: Unknown Basis encoding");o=a.UASTC_HDR}const u=n.getWidth(),d=n.getHeight(),p=n.getLayers()||1,A=n.getLevels(),g=n.getFaces(),m=n.getHasAlpha(),f=n.getDFDFlags(),{transcoderFormat:b,engineFormat:v,engineType:y}=function(e,i,n,r){const s=l[e];for(let a=0;a<s.length;a++){const o=s[a];if(o.if&&!t[o.if])continue;if(!o.basisFormat.includes(e))continue;if(r&&o.transcoderFormat.length<2)continue;if(o.needsPowerOfTwo&&(!c(i)||!c(n)))continue;return{transcoderFormat:o.transcoderFormat[r?1:0],engineFormat:o.engineFormat[r?1:0],engineType:o.engineType[0]}}throw new Error("THREE.KTX2Loader: Failed to identify transcoding target.")}(o,u,d,m);if(!u||!d||!A)throw s(),new Error("THREE.KTX2Loader:\tInvalid texture");if(!n.startTranscoding())throw s(),new Error("THREE.KTX2Loader: .startTranscoding failed");const x=[],_=[];for(let t=0;t<g;t++){const e=[];for(let i=0;i<A;i++){const a=[];let o,l;for(let e=0;e<p;e++){const c=n.getImageLevelInfo(i,e,t);0!==t||0!==i||0!==e||c.origWidth%4==0&&c.origHeight%4==0||console.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."),A>1?(o=c.origWidth,l=c.origHeight):(o=c.width,l=c.height);let h=new Uint8Array(n.getImageTranscodedSizeInBytes(i,e,0,b));const u=n.transcodeImage(h,i,e,t,b,0,-1,-1);if(y===r.HalfFloatType&&(h=new Uint16Array(h.buffer,h.byteOffset,h.byteLength/Uint16Array.BYTES_PER_ELEMENT)),!u)throw s(),new Error("THREE.KTX2Loader: .transcodeImage failed.");a.push(h)}const c=h(a);e.push({data:c,width:o,height:l}),_.push(c.buffer)}x.push({mipmaps:e,width:u,height:d,format:v,type:y})}return s(),{faces:x,buffers:_,width:u,height:d,hasAlpha:m,dfdFlags:f,format:v,type:y}}(s.buffer);self.postMessage({type:"transcode",id:s.id,data:{faces:e,width:o,height:u,hasAlpha:d,format:p,type:A,dfdFlags:g}},n)}catch(t){console.error(t),self.postMessage({type:"error",id:s.id,error:t.message})}})}var o});const o=[{if:"astcSupported",basisFormat:[a.UASTC],transcoderFormat:[s.ASTC_4x4,s.ASTC_4x4],engineFormat:[n.RGBA_ASTC_4x4_Format,n.RGBA_ASTC_4x4_Format],engineType:[r.UnsignedByteType],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[a.ETC1S,a.UASTC],transcoderFormat:[s.BC7_M5,s.BC7_M5],engineFormat:[n.RGBA_BPTC_Format,n.RGBA_BPTC_Format],engineType:[r.UnsignedByteType],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[a.ETC1S,a.UASTC],transcoderFormat:[s.BC1,s.BC3],engineFormat:[n.RGBA_S3TC_DXT1_Format,n.RGBA_S3TC_DXT5_Format],engineType:[r.UnsignedByteType],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[a.ETC1S,a.UASTC],transcoderFormat:[s.ETC1,s.ETC2],engineFormat:[n.RGB_ETC2_Format,n.RGBA_ETC2_EAC_Format],engineType:[r.UnsignedByteType],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[a.ETC1S,a.UASTC],transcoderFormat:[s.ETC1],engineFormat:[n.RGB_ETC1_Format],engineType:[r.UnsignedByteType],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[a.ETC1S,a.UASTC],transcoderFormat:[s.PVRTC1_4_RGB,s.PVRTC1_4_RGBA],engineFormat:[n.RGB_PVRTC_4BPPV1_Format,n.RGBA_PVRTC_4BPPV1_Format],engineType:[r.UnsignedByteType],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0},{if:"bptcSupported",basisFormat:[a.UASTC_HDR],transcoderFormat:[s.BC6H],engineFormat:[n.RGB_BPTC_UNSIGNED_Format],engineType:[r.HalfFloatType],priorityHDR:1,needsPowerOfTwo:!1},{basisFormat:[a.ETC1S,a.UASTC],transcoderFormat:[s.RGBA32,s.RGBA32],engineFormat:[n.RGBAFormat,n.RGBAFormat],engineType:[r.UnsignedByteType,r.UnsignedByteType],priorityETC1S:100,priorityUASTC:100,needsPowerOfTwo:!1},{basisFormat:[a.UASTC_HDR],transcoderFormat:[s.RGBA_HALF],engineFormat:[n.RGBAFormat],engineType:[r.HalfFloatType],priorityHDR:100,needsPowerOfTwo:!1}],l={[a.ETC1S]:o.filter(t=>t.basisFormat.includes(a.ETC1S)).sort((t,e)=>t.priorityETC1S-e.priorityETC1S),[a.UASTC]:o.filter(t=>t.basisFormat.includes(a.UASTC)).sort((t,e)=>t.priorityUASTC-e.priorityUASTC),[a.UASTC_HDR]:o.filter(t=>t.basisFormat.includes(a.UASTC_HDR)).sort((t,e)=>t.priorityHDR-e.priorityHDR)};function c(t){return t<=2||!(t&t-1)&&0!==t}function h(t){if(1===t.length)return t[0];let e=0;for(let i=0;i<t.length;i++){e+=t[i].byteLength}const i=new Uint8Array(e);let n=0;for(let e=0;e<t.length;e++){const r=t[e];i.set(r,n),n+=r.byteLength}return i}};const og=new Set([Re,Be,Ue,Pe]),lg={[fA]:Re,[mA]:Ue,[gA]:Pe,[AA]:Re,[pA]:Ue,[dA]:Pe,[uA]:Re,[hA]:Re,[cA]:Ue,[lA]:Ue,[oA]:Pe,[aA]:Pe,[vA]:Be,[bA]:Be,[LA]:Ke,[DA]:Xe,[PA]:Je,[FA]:Ye,[UA]:$e,[NA]:Ze,[jA]:ti,[kA]:ti,[OA]:ti,[WA]:ri,[GA]:ri,[QA]:ri,[EA]:Qe,[_A]:Qe,[xA]:ke,[yA]:ke,[CA]:ze,[SA]:ze,[MA]:bi,[wA]:fi,[TA]:yi,[IA]:vi,[RA]:Ai,[BA]:Ai,[qA]:qe,[HA]:qe,[VA]:je,[zA]:je},cg={[fA]:Ee,[mA]:Ee,[gA]:Ee,[AA]:Se,[pA]:Se,[dA]:Se,[uA]:fe,[hA]:fe,[cA]:fe,[lA]:fe,[oA]:fe,[aA]:fe,[vA]:Ie,[bA]:Te,[LA]:fe,[DA]:fe,[PA]:fe,[FA]:fe,[UA]:fe,[NA]:fe,[jA]:Se,[kA]:fe,[OA]:fe,[WA]:Se,[GA]:fe,[QA]:fe,[EA]:fe,[_A]:fe,[xA]:fe,[yA]:fe,[CA]:fe,[SA]:fe,[MA]:fe,[wA]:fe,[TA]:fe,[IA]:fe,[RA]:fe,[BA]:fe,[qA]:fe,[HA]:fe,[VA]:fe,[zA]:fe};function hg(t){const e=t.dataFormatDescriptor[0];return 1===e.colorPrimaries?2===e.transferFunction?Di:Li:10===e.colorPrimaries?2===e.transferFunction?"display-p3":"display-p3-linear":(0===e.colorPrimaries||console.warn(`THREE.KTX2Loader: Unsupported color primaries, "${e.colorPrimaries}"`),Ri)}
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/var ug,dg;const pg=Symbol("retainerCount"),Ag=Symbol("recentlyUsed"),gg=Symbol("evict"),mg=Symbol("evictionThreshold"),fg=Symbol("cache");class bg{constructor(t,e=5){this[ug]=new Map,this[dg]=[],this[fg]=t,this[mg]=e}set evictionThreshold(t){this[mg]=t,this[gg]()}get evictionThreshold(){return this[mg]}get cache(){return this[fg]}retainerCount(t){return this[pg].get(t)||0}reset(){this[pg].clear(),this[Ag]=[]}retain(t){this[pg].has(t)||this[pg].set(t,0),this[pg].set(t,this[pg].get(t)+1);const e=this[Ag].indexOf(t);-1!==e&&this[Ag].splice(e,1),this[Ag].unshift(t),this[gg]()}release(t){this[pg].has(t)&&this[pg].set(t,Math.max(this[pg].get(t)-1,0)),this[gg]()}[(ug=pg,dg=Ag,gg)](){if(!(this[Ag].length<this[mg]))for(let t=this[Ag].length-1;t>=this[mg];--t){const e=this[Ag][t];0===this[pg].get(e)&&(this[fg].delete(e),this[Ag].splice(t,1))}}}
|
|
/* @license
|
|
* Copyright 2021 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/const vg=t=>{const e=new Map;for(const i of t.mappings)for(const t of i.variants)e.set(t,{material:null,gltfMaterialIndex:i.material});return e};class yg{constructor(t){this.parser=t,this.name="KHR_materials_variants"}afterRoot(t){const e=this.parser,i=e.json;if(void 0===i.extensions||void 0===i.extensions[this.name])return null;const n=(t=>{const e=[],i=new Set;for(const n of t){let t=n,r=0;for(;i.has(t);)t=n+"."+ ++r;i.add(t),e.push(t)}return e})((i.extensions[this.name].variants||[]).map(t=>t.name));for(const n of t.scenes)n.traverse(t=>{const n=t;if(!n.material)return;const r=e.associations.get(n);if(null==r||null==r.meshes||null==r.primitives)return;const s=i.meshes[r.meshes].primitives[r.primitives].extensions;s&&s[this.name]&&(n.userData.variantMaterials=vg(s[this.name]))});return t.userData.variants=n,Promise.resolve()}}
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/var xg,_g;Nn.DEFAULT_ANISOTROPY=4;const Eg=new Map,Sg=new Map;let Cg;const wg=new class extends Nl{constructor(t){super(t),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(t){return this.decoderPath=t,this}setDecoderConfig(t){return this.decoderConfig=t,this}setWorkerLimit(t){return this.workerLimit=t,this}load(t,e,i,n){const r=new Ql(this.manager);r.setPath(this.path),r.setResponseType("arraybuffer"),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(t,t=>{this.parse(t,e,n)},i,n)}parse(t,e,i=()=>{}){this.decodeDracoFile(t,e,null,null,Di,i).catch(i)}decodeDracoFile(t,e,i,n,r=Li,s=()=>{}){const a={attributeIDs:i||this.defaultAttributeIDs,attributeTypes:n||this.defaultAttributeTypes,useUniqueIDs:!!i,vertexColorSpace:r};return this.decodeGeometry(t,a).then(e).catch(s)}decodeGeometry(t,e){const i=JSON.stringify(e);if(ep.has(t)){const e=ep.get(t);if(e.key===i)return e.promise;if(0===t.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let n;const r=this.workerNextTaskID++,s=t.byteLength,a=this._getWorker(r,s).then(i=>(n=i,new Promise((i,s)=>{n._callbacks[r]={resolve:i,reject:s},n.postMessage({type:"decode",id:r,taskConfig:e,buffer:t},[t])}))).then(t=>this._createGeometry(t.geometry));return a.catch(()=>!0).then(()=>{n&&r&&this._releaseTask(n,r)}),ep.set(t,{key:i,promise:a}),a}_createGeometry(t){const e=new Es;t.index&&e.setIndex(new ls(t.index.array,1));for(let i=0;i<t.attributes.length;i++){const{name:n,array:r,itemSize:s,stride:a,vertexColorSpace:o}=t.attributes[i];let l;if(s===a)l=new ls(r,s);else{const t=new Ss(r,a);l=new ws(t,s,0)}"color"===n&&(this._assignVertexColorSpace(l,o),l.normalized=r instanceof Float32Array==!1),e.setAttribute(n,l)}return e}_assignVertexColorSpace(t,e){if(e!==Di)return;const i=new Sr;for(let e=0,n=t.count;e<n;e++)i.fromBufferAttribute(t,e),Mn.colorSpaceToWorking(i,Di),t.setXYZ(e,i.r,i.g,i.b)}_loadLibrary(t,e){const i=new Ql(this.manager);return i.setPath(this.decoderPath),i.setResponseType(e),i.setWithCredentials(this.withCredentials),new Promise((e,n)=>{i.load(t,e,void 0,n)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const t="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,e=[];return t?e.push(this._loadLibrary("draco_decoder.js","text")):(e.push(this._loadLibrary("draco_wasm_wrapper.js","text")),e.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(e).then(e=>{const i=e[0];t||(this.decoderConfig.wasmBinary=e[1]);const n=ip.toString(),r=["/* draco decoder */",i,"","/* worker */",n.substring(n.indexOf("{")+1,n.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([r]))}),this.decoderPending}_getWorker(t,e){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const t=new Worker(this.workerSourceURL);t._callbacks={},t._taskCosts={},t._taskLoad=0,t.postMessage({type:"init",decoderConfig:this.decoderConfig}),t.onmessage=function(e){const i=e.data;switch(i.type){case"decode":t._callbacks[i.id].resolve(i);break;case"error":t._callbacks[i.id].reject(i);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+i.type+'"')}},this.workerPool.push(t)}else this.workerPool.sort(function(t,e){return t._taskLoad>e._taskLoad?-1:1});const i=this.workerPool[this.workerPool.length-1];return i._taskCosts[t]=e,i._taskLoad+=e,i})}_releaseTask(t,e){t._taskLoad-=t._taskCosts[e],delete t._callbacks[e],delete t._taskCosts[e]}debug(){console.log("Task load: ",this.workerPool.map(t=>t._taskLoad))}dispose(){for(let t=0;t<this.workerPool.length;++t)this.workerPool[t].terminate();return this.workerPool.length=0,""!==this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),this}};let Mg;const Ig=new ag;let Tg,Bg;const Rg=Symbol("loader"),Dg=Symbol("evictionPolicy"),Lg=Symbol("GLTFInstance");class Pg extends sn{static setDRACODecoderLocation(t){Cg=t,wg.setDecoderPath(t)}static getDRACODecoderLocation(){return Cg}static setKTX2TranscoderLocation(t){Mg=t,Ig.setTranscoderPath(t)}static getKTX2TranscoderLocation(){return Mg}static setMeshoptDecoderLocation(t){var e;Tg!==t&&(Tg=t,Bg=(e=t,new Promise((t,i)=>{const n=document.createElement("script");document.body.appendChild(n),n.onload=t,n.onerror=i,n.async=!0,n.src=e})).then(()=>tp.ready).then(()=>tp))}static getMeshoptDecoderLocation(){return Tg}static initializeKTX2Loader(t){Ig.detectSupport(t)}static get cache(){return Eg}static clearCache(){Eg.forEach((t,e)=>{this.delete(e)}),this[Dg].reset()}static has(t){return Eg.has(t)}static async delete(t){if(!this.has(t))return;const e=Eg.get(t);Sg.delete(t),Eg.delete(t);(await e).dispose()}static hasFinishedLoading(t){return!!Sg.get(t)}constructor(t){super(),this[_g]=(new ap).register(t=>new yg(t)),this[Lg]=t,this[Rg].setDRACOLoader(wg),this[Rg].setKTX2Loader(Ig)}get[(xg=Dg,_g=Rg,Dg)](){return this.constructor[Dg]}async preload(t,e,i=()=>{}){if(this[Rg].setWithCredentials(e.withCredentials),this.dispatchEvent({type:"preload",element:e,src:t}),!Eg.has(t)){null!=Bg&&this[Rg].setMeshoptDecoder(await Bg);const e=((t,e,i=()=>{})=>{const n=t=>{const e=t.loaded/t.total;i(Math.max(0,Math.min(1,isFinite(e)?e:1)))};return new Promise((i,r)=>{e.load(t,i,n,r)})})(t,this[Rg],t=>{i(.8*t)}),n=this[Lg],r=e.then(t=>n.prepare(t)).then(t=>(i(.9),new n(t))).catch(t=>(console.error(t),new n));Eg.set(t,r)}await Eg.get(t),Sg.set(t,!0),i&&i(1)}async load(t,e,i=()=>{}){await this.preload(t,e,i);const n=await Eg.get(t),r=await n.clone();return this[Dg].retain(t),r.dispose=()=>{this[Dg].release(t)},r}}Pg[xg]=new bg(Pg);class Fg extends mr{constructor(t=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=t,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new fn(.5,.5),this.addEventListener("removed",function(){this.traverse(function(t){t.element&&t.element instanceof t.element.ownerDocument.defaultView.Element&&null!==t.element.parentNode&&t.element.remove()})})}copy(t,e){return super.copy(t,e),this.element=t.element.cloneNode(!0),this.center=t.center,this}}const Ug=new vn,Ng=new Hn,Og=new Hn,kg=new vn,Qg=new vn;class Gg{constructor(t={}){const e=this;let i,n,r,s;const a={objects:new WeakMap},o=void 0!==t.element?t.element:document.createElement("div");function l(t){t.isCSS2DObject&&(t.element.style.display="none");for(let e=0,i=t.children.length;e<i;e++)l(t.children[e])}function c(t,i,n){if(!1!==t.visible){if(t.isCSS2DObject){Ug.setFromMatrixPosition(t.matrixWorld),Ug.applyMatrix4(Og);const l=Ug.z>=-1&&Ug.z<=1&&!0===t.layers.test(n.layers),c=t.element;c.style.display=!0===l?"":"none",!0===l&&(t.onBeforeRender(e,i,n),c.style.transform="translate("+-100*t.center.x+"%,"+-100*t.center.y+"%)translate("+(Ug.x*r+r)+"px,"+(-Ug.y*s+s)+"px)",c.parentNode!==o&&o.appendChild(c),t.onAfterRender(e,i,n));const u={distanceToCameraSquared:h(n,t)};a.objects.set(t,u)}for(let e=0,r=t.children.length;e<r;e++)c(t.children[e],i,n)}else l(t)}function h(t,e){return kg.setFromMatrixPosition(t.matrixWorld),Qg.setFromMatrixPosition(e.matrixWorld),kg.distanceToSquared(Qg)}o.style.overflow="hidden",this.domElement=o,this.sortObjects=!0,this.getSize=function(){return{width:i,height:n}},this.render=function(t,e){!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),null===e.parent&&!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),Ng.copy(e.matrixWorldInverse),Og.multiplyMatrices(e.projectionMatrix,Ng),c(t,t,e),this.sortObjects&&function(t){const e=function(t){const e=[];return t.traverseVisible(function(t){t.isCSS2DObject&&e.push(t)}),e}(t).sort(function(t,e){if(t.renderOrder!==e.renderOrder)return e.renderOrder-t.renderOrder;return a.objects.get(t).distanceToCameraSquared-a.objects.get(e).distanceToCameraSquared}),i=e.length;for(let t=0,n=e.length;t<n;t++)e[t].element.style.zIndex=i-t}(t)},this.setSize=function(t,e){i=t,n=e,r=i/2,s=n/2,o.style.width=t+"px",o.style.height=e+"px"}}}function zg(t,e,i){let n=i;const r=new vn;return t.updateWorldMatrix(!0,!0),t.traverseVisible(t=>{const{geometry:i}=t;if(void 0!==i){const{position:s}=i.attributes;if(void 0!==s)for(let i=0,a=s.count;i<a;i++)t.isMesh?t.getVertexPosition(i,r):r.fromBufferAttribute(s,i),t.isSkinnedMesh||r.applyMatrix4(t.matrixWorld),n=e(n,r)}}),n}const Hg={POSITION:["byte","byte normalized","unsigned byte","unsigned byte normalized","short","short normalized","unsigned short","unsigned short normalized"],NORMAL:["byte normalized","short normalized"],TANGENT:["byte normalized","short normalized"],TEXCOORD:["byte","byte normalized","unsigned byte","short","short normalized","unsigned short"]};class Vg{constructor(){this.textureUtils=null,this.pluginCallbacks=[],this.register(function(t){return new Em(t)}),this.register(function(t){return new Sm(t)}),this.register(function(t){return new Im(t)}),this.register(function(t){return new Tm(t)}),this.register(function(t){return new Bm(t)}),this.register(function(t){return new Rm(t)}),this.register(function(t){return new Cm(t)}),this.register(function(t){return new wm(t)}),this.register(function(t){return new Mm(t)}),this.register(function(t){return new Dm(t)}),this.register(function(t){return new Lm(t)}),this.register(function(t){return new Pm(t)}),this.register(function(t){return new Fm(t)}),this.register(function(t){return new Um(t)})}register(t){return-1===this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.push(t),this}unregister(t){return-1!==this.pluginCallbacks.indexOf(t)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t),1),this}setTextureUtils(t){return this.textureUtils=t,this}parse(t,e,i,n){const r=new _m,s=[];for(let t=0,e=this.pluginCallbacks.length;t<e;t++)s.push(this.pluginCallbacks[t](r));r.setPlugins(s),r.setTextureUtils(this.textureUtils),r.writeAsync(t,e,n).catch(i)}parseAsync(t,e){const i=this;return new Promise(function(n,r){i.parse(t,n,r,e)})}}const qg=0,jg=1,Wg=2,Xg=3,Kg=4,Jg=5120,Yg=5121,$g=5122,Zg=5123,tm=5124,em=5125,im=5126,nm=34962,rm=34963,sm=9728,am=9729,om=9984,lm=9985,cm=9986,hm=9987,um=33071,dm=33648,pm=10497,Am="KHR_mesh_quantization",gm={};gm[1003]=sm,gm[1004]=om,gm[1005]=cm,gm[1006]=am,gm[1007]=lm,gm[1008]=hm,gm[1001]=um,gm[1e3]=pm,gm[1002]=dm;const mm={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"},fm=new Sr;function bm(t,e){return t.length===e.length&&t.every(function(t,i){return t===e[i]})}function vm(t){return 4*Math.ceil(t/4)}function ym(t,e=0){const i=vm(t.byteLength);if(i!==t.byteLength){const n=new Uint8Array(i);if(n.set(new Uint8Array(t)),0!==e)for(let r=t.byteLength;r<i;r++)n[r]=e;return n.buffer}return t}function xm(){return"undefined"==typeof document&&"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas")}class _m{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter r"+pt}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map},this.textureUtils=null}setPlugins(t){this.plugins=t}setTextureUtils(t){this.textureUtils=t}async writeAsync(t,e,i={}){this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},i),this.options.animations.length>0&&(this.options.trs=!0),await this.processInputAsync(t),await Promise.all(this.pending);const n=this,r=n.buffers,s=n.json;i=n.options;const a=n.extensionsUsed,o=n.extensionsRequired,l=new Blob(r,{type:"application/octet-stream"}),c=Object.keys(a),h=Object.keys(o);if(c.length>0&&(s.extensionsUsed=c),h.length>0&&(s.extensionsRequired=h),s.buffers&&s.buffers.length>0&&(s.buffers[0].byteLength=l.size),!0===i.binary){const t=new FileReader;t.readAsArrayBuffer(l),t.onloadend=function(){const i=ym(t.result),n=new DataView(new ArrayBuffer(8));n.setUint32(0,i.byteLength,!0),n.setUint32(4,5130562,!0);const r=ym((a=JSON.stringify(s),(new TextEncoder).encode(a).buffer),32);var a;const o=new DataView(new ArrayBuffer(8));o.setUint32(0,r.byteLength,!0),o.setUint32(4,1313821514,!0);const l=new ArrayBuffer(12),c=new DataView(l);c.setUint32(0,1179937895,!0),c.setUint32(4,2,!0);const h=12+o.byteLength+r.byteLength+n.byteLength+i.byteLength;c.setUint32(8,h,!0);const u=new Blob([l,o,r,n,i],{type:"application/octet-stream"}),d=new FileReader;d.readAsArrayBuffer(u),d.onloadend=function(){e(d.result)}}}else if(s.buffers&&s.buffers.length>0){const t=new FileReader;t.readAsDataURL(l),t.onloadend=function(){const i=t.result;s.buffers[0].uri=i,e(s)}}else e(s)}serializeUserData(t,e){if(0===Object.keys(t.userData).length)return;const i=this.options,n=this.extensionsUsed;try{const r=JSON.parse(JSON.stringify(t.userData));if(i.includeCustomExtensions&&r.gltfExtensions){void 0===e.extensions&&(e.extensions={});for(const t in r.gltfExtensions)e.extensions[t]=r.gltfExtensions[t],n[t]=!0;delete r.gltfExtensions}Object.keys(r).length>0&&(e.extras=r)}catch(e){console.warn("THREE.GLTFExporter: userData of '"+t.name+"' won't be serialized because of JSON.stringify error - "+e.message)}}getUID(t,e=!1){if(!1===this.uids.has(t)){const e=new Map;e.set(!0,this.uid++),e.set(!1,this.uid++),this.uids.set(t,e)}return this.uids.get(t).get(e)}isNormalizedNormalAttribute(t){if(this.cache.attributesNormalized.has(t))return!1;const e=new vn;for(let i=0,n=t.count;i<n;i++)if(Math.abs(e.fromBufferAttribute(t,i).length()-1)>5e-4)return!1;return!0}createNormalizedNormalAttribute(t){const e=this.cache;if(e.attributesNormalized.has(t))return e.attributesNormalized.get(t);const i=t.clone(),n=new vn;for(let t=0,e=i.count;t<e;t++)n.fromBufferAttribute(i,t),0===n.x&&0===n.y&&0===n.z?n.setX(1):n.normalize(),i.setXYZ(t,n.x,n.y,n.z);return e.attributesNormalized.set(t,i),i}applyTextureTransform(t,e){let i=!1;const n={};0===e.offset.x&&0===e.offset.y||(n.offset=e.offset.toArray(),i=!0),0!==e.rotation&&(n.rotation=e.rotation,i=!0),1===e.repeat.x&&1===e.repeat.y||(n.scale=e.repeat.toArray(),i=!0),i&&(t.extensions=t.extensions||{},t.extensions.KHR_texture_transform=n,this.extensionsUsed.KHR_texture_transform=!0)}async buildMetalRoughTextureAsync(t,e){if(t===e)return t;function i(t){return t.colorSpace===Di?function(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}:function(t){return t}}t instanceof Ya&&(t=await this.decompressTextureAsync(t)),e instanceof Ya&&(e=await this.decompressTextureAsync(e));const n=t?t.image:null,r=e?e.image:null,s=Math.max(n?n.width:0,r?r.width:0),a=Math.max(n?n.height:0,r?r.height:0),o=xm();o.width=s,o.height=a;const l=o.getContext("2d",{willReadFrequently:!0});l.fillStyle="#00ffff",l.fillRect(0,0,s,a);const c=l.getImageData(0,0,s,a);if(n){l.drawImage(n,0,0,s,a);const e=i(t),r=l.getImageData(0,0,s,a).data;for(let t=2;t<r.length;t+=4)c.data[t]=256*e(r[t]/256)}if(r){l.drawImage(r,0,0,s,a);const t=i(e),n=l.getImageData(0,0,s,a).data;for(let e=1;e<n.length;e+=4)c.data[e]=256*t(n[e]/256)}l.putImageData(c,0,0);const h=(t||e).clone();return h.source=new Ln(o),h.colorSpace=Ri,h.channel=(t||e).channel,t&&e&&t.channel!==e.channel&&console.warn("THREE.GLTFExporter: UV channels for metalnessMap and roughnessMap textures must match."),console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures."),h}async decompressTextureAsync(t,e=1/0){if(null===this.textureUtils)throw new Error("THREE.GLTFExporter: setTextureUtils() must be called to process compressed textures.");return await this.textureUtils.decompress(t,e)}processBuffer(t){const e=this.json,i=this.buffers;return e.buffers||(e.buffers=[{byteLength:0}]),i.push(t),0}processBufferView(t,e,i,n,r){const s=this.json;let a;switch(s.bufferViews||(s.bufferViews=[]),e){case Jg:case Yg:a=1;break;case $g:case Zg:a=2;break;default:a=4}let o=t.itemSize*a;r===nm&&(o=4*Math.ceil(o/4));const l=vm(n*o),c=new DataView(new ArrayBuffer(l));let h=0;for(let r=i;r<i+n;r++){for(let i=0;i<t.itemSize;i++){let n;t.itemSize>4?n=t.array[r*t.itemSize+i]:(0===i?n=t.getX(r):1===i?n=t.getY(r):2===i?n=t.getZ(r):3===i&&(n=t.getW(r)),!0===t.normalized&&(n=mn.normalize(n,t.array))),e===im?c.setFloat32(h,n,!0):e===tm?c.setInt32(h,n,!0):e===em?c.setUint32(h,n,!0):e===$g?c.setInt16(h,n,!0):e===Zg?c.setUint16(h,n,!0):e===Jg?c.setInt8(h,n):e===Yg&&c.setUint8(h,n),h+=a}h%o!==0&&(h+=o-h%o)}const u={buffer:this.processBuffer(c.buffer),byteOffset:this.byteOffset,byteLength:l};void 0!==r&&(u.target=r),r===nm&&(u.byteStride=o),this.byteOffset+=l,s.bufferViews.push(u);return{id:s.bufferViews.length-1,byteLength:0}}processBufferViewImage(t){const e=this,i=e.json;return i.bufferViews||(i.bufferViews=[]),new Promise(function(n){const r=new FileReader;r.readAsArrayBuffer(t),r.onloadend=function(){const t=ym(r.result),s={buffer:e.processBuffer(t),byteOffset:e.byteOffset,byteLength:t.byteLength};e.byteOffset+=t.byteLength,n(i.bufferViews.push(s)-1)}})}processAccessor(t,e,i,n){const r=this.json;let s;if(t.array.constructor===Float32Array)s=im;else if(t.array.constructor===Int32Array)s=tm;else if(t.array.constructor===Uint32Array)s=em;else if(t.array.constructor===Int16Array)s=$g;else if(t.array.constructor===Uint16Array)s=Zg;else if(t.array.constructor===Int8Array)s=Jg;else{if(t.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: "+t.array.constructor.name);s=Yg}if(void 0===i&&(i=0),void 0!==n&&n!==1/0||(n=t.count),0===n)return null;const a=function(t,e,i){const n={min:new Array(t.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(t.itemSize).fill(Number.NEGATIVE_INFINITY)};for(let r=e;r<e+i;r++)for(let e=0;e<t.itemSize;e++){let i;t.itemSize>4?i=t.array[r*t.itemSize+e]:(0===e?i=t.getX(r):1===e?i=t.getY(r):2===e?i=t.getZ(r):3===e&&(i=t.getW(r)),!0===t.normalized&&(i=mn.normalize(i,t.array))),n.min[e]=Math.min(n.min[e],i),n.max[e]=Math.max(n.max[e],i)}return n}(t,i,n);let o;void 0!==e&&(o=t===e.index?rm:nm);const l=this.processBufferView(t,s,i,n,o),c={bufferView:l.id,byteOffset:l.byteOffset,componentType:s,count:n,max:a.max,min:a.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",9:"MAT3",16:"MAT4"}[t.itemSize]};return!0===t.normalized&&(c.normalized=!0),r.accessors||(r.accessors=[]),r.accessors.push(c)-1}processImage(t,e,i,n="image/png"){if(null!==t){const r=this,s=r.cache,a=r.json,o=r.options,l=r.pending;s.images.has(t)||s.images.set(t,{});const c=s.images.get(t),h=n+":flipY/"+i.toString();if(void 0!==c[h])return c[h];a.images||(a.images=[]);const u={mimeType:n},d=xm();d.width=Math.min(t.width,o.maxTextureSize),d.height=Math.min(t.height,o.maxTextureSize);const p=d.getContext("2d",{willReadFrequently:!0});if(!0===i&&(p.translate(0,d.height),p.scale(1,-1)),void 0!==t.data){e!==Re&&console.error("GLTFExporter: Only RGBAFormat is supported.",e),(t.width>o.maxTextureSize||t.height>o.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",t);const i=new Uint8ClampedArray(t.height*t.width*4);for(let e=0;e<i.length;e+=4)i[e+0]=t.data[e+0],i[e+1]=t.data[e+1],i[e+2]=t.data[e+2],i[e+3]=t.data[e+3];p.putImageData(new ImageData(i,t.width,t.height),0,0)}else{if(!("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas))throw new Error("THREE.GLTFExporter: Invalid image type. Use HTMLImageElement, HTMLCanvasElement, ImageBitmap or OffscreenCanvas.");p.drawImage(t,0,0,d.width,d.height)}!0===o.binary?l.push(function(t,e){if("undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas){let i;return"image/jpeg"===e?i=.92:"image/webp"===e&&(i=.8),t.convertToBlob({type:e,quality:i})}return new Promise(i=>t.toBlob(i,e))}(d,n).then(t=>r.processBufferViewImage(t)).then(t=>{u.bufferView=t})):u.uri=Rn.getDataURL(d,n);const A=a.images.push(u)-1;return c[h]=A,A}throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.")}processSampler(t){const e=this.json;e.samplers||(e.samplers=[]);const i={magFilter:gm[t.magFilter],minFilter:gm[t.minFilter],wrapS:gm[t.wrapS],wrapT:gm[t.wrapT]};return e.samplers.push(i)-1}async processTextureAsync(t){const e=this.options,i=this.cache,n=this.json;if(i.textures.has(t))return i.textures.get(t);n.textures||(n.textures=[]),t instanceof Ya&&(t=await this.decompressTextureAsync(t,e.maxTextureSize));let r=t.userData.mimeType;"image/webp"===r&&(r="image/png");const s={sampler:this.processSampler(t),source:this.processImage(t.image,t.format,t.flipY,r)};t.name&&(s.name=t.name),await this._invokeAllAsync(async function(e){e.writeTexture&&await e.writeTexture(t,s)});const a=n.textures.push(s)-1;return i.textures.set(t,a),a}async processMaterialAsync(t){const e=this.cache,i=this.json;if(e.materials.has(t))return e.materials.get(t);if(t.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;i.materials||(i.materials=[]);const n={pbrMetallicRoughness:{}};!0!==t.isMeshStandardMaterial&&!0!==t.isMeshBasicMaterial&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");const r=t.color.toArray().concat([t.opacity]);if(bm(r,[1,1,1,1])||(n.pbrMetallicRoughness.baseColorFactor=r),t.isMeshStandardMaterial?(n.pbrMetallicRoughness.metallicFactor=t.metalness,n.pbrMetallicRoughness.roughnessFactor=t.roughness):(n.pbrMetallicRoughness.metallicFactor=0,n.pbrMetallicRoughness.roughnessFactor=1),t.metalnessMap||t.roughnessMap){const e=await this.buildMetalRoughTextureAsync(t.metalnessMap,t.roughnessMap),i={index:await this.processTextureAsync(e),texCoord:e.channel};this.applyTextureTransform(i,e),n.pbrMetallicRoughness.metallicRoughnessTexture=i}if(t.map){const e={index:await this.processTextureAsync(t.map),texCoord:t.map.channel};this.applyTextureTransform(e,t.map),n.pbrMetallicRoughness.baseColorTexture=e}if(t.emissive){const e=t.emissive;if(Math.max(e.r,e.g,e.b)>0&&(n.emissiveFactor=t.emissive.toArray()),t.emissiveMap){const e={index:await this.processTextureAsync(t.emissiveMap),texCoord:t.emissiveMap.channel};this.applyTextureTransform(e,t.emissiveMap),n.emissiveTexture=e}}if(t.normalMap){const e={index:await this.processTextureAsync(t.normalMap),texCoord:t.normalMap.channel};t.normalScale&&1!==t.normalScale.x&&(e.scale=t.normalScale.x),this.applyTextureTransform(e,t.normalMap),n.normalTexture=e}if(t.aoMap){const e={index:await this.processTextureAsync(t.aoMap),texCoord:t.aoMap.channel};1!==t.aoMapIntensity&&(e.strength=t.aoMapIntensity),this.applyTextureTransform(e,t.aoMap),n.occlusionTexture=e}t.transparent?n.alphaMode="BLEND":t.alphaTest>0&&(n.alphaMode="MASK",n.alphaCutoff=t.alphaTest),2===t.side&&(n.doubleSided=!0),""!==t.name&&(n.name=t.name),this.serializeUserData(t,n),await this._invokeAllAsync(async function(e){e.writeMaterialAsync&&await e.writeMaterialAsync(t,n)});const s=i.materials.push(n)-1;return e.materials.set(t,s),s}async processMeshAsync(t){const e=this.cache,i=this.json,n=[t.geometry.uuid];if(Array.isArray(t.material))for(let e=0,i=t.material.length;e<i;e++)n.push(t.material[e].uuid);else n.push(t.material.uuid);const r=n.join(":");if(e.meshes.has(r))return e.meshes.get(r);const s=t.geometry;let a;a=t.isLineSegments?jg:t.isLineLoop?Wg:t.isLine?Xg:t.isPoints?qg:t.material.wireframe?jg:Kg;const o={},l={},c=[],h=[],u={uv:"TEXCOORD_0",uv1:"TEXCOORD_1",uv2:"TEXCOORD_2",uv3:"TEXCOORD_3",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},d=s.getAttribute("normal");void 0===d||this.isNormalizedNormalAttribute(d)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),s.setAttribute("normal",this.createNormalizedNormalAttribute(d)));let p=null;for(let t in s.attributes){if("morph"===t.slice(0,5))continue;const i=s.attributes[t];t=u[t]||t.toUpperCase();if(/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(t)||(t="_"+t),e.attributes.has(this.getUID(i))){l[t]=e.attributes.get(this.getUID(i));continue}p=null;const n=i.array;"JOINTS_0"!==t||n instanceof Uint16Array||n instanceof Uint8Array?(n instanceof Uint32Array||n instanceof Int32Array)&&!t.startsWith("_")&&(console.warn(`GLTFExporter: Attribute "${t}" converted to type FLOAT.`),p=Vg.Utils.toTypedBufferAttribute(i,Float32Array)):(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),p=Vg.Utils.toTypedBufferAttribute(i,Uint16Array));const r=this.processAccessor(p||i,s);null!==r&&(t.startsWith("_")||this.detectMeshQuantization(t,i),l[t]=r,e.attributes.set(this.getUID(i),r))}if(void 0!==d&&s.setAttribute("normal",d),0===Object.keys(l).length)return null;if(void 0!==t.morphTargetInfluences&&t.morphTargetInfluences.length>0){const i=[],n=[],r={};if(void 0!==t.morphTargetDictionary)for(const e in t.morphTargetDictionary)r[t.morphTargetDictionary[e]]=e;for(let a=0;a<t.morphTargetInfluences.length;++a){const o={};let l=!1;for(const t in s.morphAttributes){if("position"!==t&&"normal"!==t){l||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),l=!0);continue}const i=s.morphAttributes[t][a],n=t.toUpperCase(),r=s.attributes[t];if(e.attributes.has(this.getUID(i,!0))){o[n]=e.attributes.get(this.getUID(i,!0));continue}const c=i.clone();if(!s.morphTargetsRelative)for(let t=0,e=i.count;t<e;t++)for(let e=0;e<i.itemSize;e++)0===e&&c.setX(t,i.getX(t)-r.getX(t)),1===e&&c.setY(t,i.getY(t)-r.getY(t)),2===e&&c.setZ(t,i.getZ(t)-r.getZ(t)),3===e&&c.setW(t,i.getW(t)-r.getW(t));o[n]=this.processAccessor(c,s),e.attributes.set(this.getUID(r,!0),o[n])}h.push(o),i.push(t.morphTargetInfluences[a]),void 0!==t.morphTargetDictionary&&n.push(r[a])}o.weights=i,n.length>0&&(o.extras={},o.extras.targetNames=n)}const A=Array.isArray(t.material);if(A&&0===s.groups.length)return null;let g=!1;if(A&&null===s.index){const t=[];for(let e=0,i=s.attributes.position.count;e<i;e++)t[e]=e;s.setIndex(t),g=!0}const m=A?t.material:[t.material],f=A?s.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let t=0,i=f.length;t<i;t++){const i={mode:a,attributes:l};if(this.serializeUserData(s,i),h.length>0&&(i.targets=h),null!==s.index){let n=this.getUID(s.index);void 0===f[t].start&&void 0===f[t].count||(n+=":"+f[t].start+":"+f[t].count),e.attributes.has(n)?i.indices=e.attributes.get(n):(i.indices=this.processAccessor(s.index,s,f[t].start,f[t].count),e.attributes.set(n,i.indices)),null===i.indices&&delete i.indices}const n=await this.processMaterialAsync(m[f[t].materialIndex]);null!==n&&(i.material=n),c.push(i)}!0===g&&s.setIndex(null),o.primitives=c,i.meshes||(i.meshes=[]),await this._invokeAllAsync(function(e){e.writeMesh&&e.writeMesh(t,o)});const b=i.meshes.push(o)-1;return e.meshes.set(r,b),b}detectMeshQuantization(t,e){if(this.extensionsUsed[Am])return;let i;switch(e.array.constructor){case Int8Array:i="byte";break;case Uint8Array:i="unsigned byte";break;case Int16Array:i="short";break;case Uint16Array:i="unsigned short";break;default:return}e.normalized&&(i+=" normalized");const n=t.split("_",1)[0];Hg[n]&&Hg[n].includes(i)&&(this.extensionsUsed[Am]=!0,this.extensionsRequired[Am]=!0)}processCamera(t){const e=this.json;e.cameras||(e.cameras=[]);const i=t.isOrthographicCamera,n={type:i?"orthographic":"perspective"};return i?n.orthographic={xmag:2*t.right,ymag:2*t.top,zfar:t.far<=0?.001:t.far,znear:t.near<0?0:t.near}:n.perspective={aspectRatio:t.aspect,yfov:mn.degToRad(t.fov),zfar:t.far<=0?.001:t.far,znear:t.near<0?0:t.near},""!==t.name&&(n.name=t.type),e.cameras.push(n)-1}processAnimation(t,e){const i=this.json,n=this.nodeMap;i.animations||(i.animations=[]);const r=(t=Vg.Utils.mergeMorphTargetTracks(t.clone(),e)).tracks,s=[],a=[];for(let t=0;t<r.length;++t){const i=r[t],o=wc.parseTrackName(i.name);let l=wc.findNode(e,o.nodeName);const c=mm[o.propertyName];if("bones"===o.objectName&&(l=!0===l.isSkinnedMesh?l.skeleton.getBoneByName(o.objectIndex):void 0),!l||!c){console.warn('THREE.GLTFExporter: Could not export animation track "%s".',i.name);continue}const h=1;let u,d=i.values.length/i.times.length;c===mm.morphTargetInfluences&&(d/=l.morphTargetInfluences.length),!0===i.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(u="CUBICSPLINE",d/=3):u=i.getInterpolation()===Si?"STEP":"LINEAR",a.push({input:this.processAccessor(new ls(i.times,h)),output:this.processAccessor(new ls(i.values,d)),interpolation:u}),s.push({sampler:a.length-1,target:{node:n.get(l),path:c}})}const o={name:t.name||"clip_"+i.animations.length,samplers:a,channels:s};return this.serializeUserData(t,o),i.animations.push(o),i.animations.length-1}processSkin(t){const e=this.json,i=this.nodeMap,n=e.nodes[i.get(t)],r=t.skeleton;if(void 0===r)return null;const s=t.skeleton.bones[0];if(void 0===s)return null;const a=[],o=new Float32Array(16*r.bones.length),l=new Hn;for(let e=0;e<r.bones.length;++e)a.push(i.get(r.bones[e])),l.copy(r.boneInverses[e]),l.multiply(t.bindMatrix).toArray(o,16*e);void 0===e.skins&&(e.skins=[]),e.skins.push({inverseBindMatrices:this.processAccessor(new ls(o,16)),joints:a,skeleton:i.get(s)});return n.skin=e.skins.length-1}async processNodeAsync(t){const e=this.json,i=this.options,n=this.nodeMap;if(e.nodes||(e.nodes=[]),null!==t.pivot)return await this._processNodeWithPivotAsync(t);const r={};if(i.trs){const e=t.quaternion.toArray(),i=t.position.toArray(),n=t.scale.toArray();bm(e,[0,0,0,1])||(r.rotation=e),bm(i,[0,0,0])||(r.translation=i),bm(n,[1,1,1])||(r.scale=n)}else t.matrixAutoUpdate&&t.updateMatrix(),!1===bm(t.matrix.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])&&(r.matrix=t.matrix.elements);if(""!==t.name&&(r.name=String(t.name)),this.serializeUserData(t,r),t.isMesh||t.isLine||t.isPoints){const e=await this.processMeshAsync(t);null!==e&&(r.mesh=e)}else t.isCamera&&(r.camera=this.processCamera(t));t.isSkinnedMesh&&this.skins.push(t);const s=e.nodes.push(r)-1;if(n.set(t,s),t.children.length>0){const e=[];for(let n=0,r=t.children.length;n<r;n++){const r=t.children[n];if(r.visible||!1===i.onlyVisible){const t=await this.processNodeAsync(r);null!==t&&e.push(t)}}e.length>0&&(r.children=e)}return await this._invokeAllAsync(function(e){e.writeNode&&e.writeNode(t,r)}),s}async _processNodeWithPivotAsync(t){const e=this.json,i=this.options,n=this.nodeMap,r=t.pivot,s={},a=t.quaternion.toArray(),o=[t.position.x+r.x,t.position.y+r.y,t.position.z+r.z],l=t.scale.toArray();bm(a,[0,0,0,1])||(s.rotation=a),bm(o,[0,0,0])||(s.translation=o),bm(l,[1,1,1])||(s.scale=l),s.extras={pivot:r.toArray()},""!==t.name&&(s.name=String(t.name)),this.serializeUserData(t,s);const c=e.nodes.push(s)-1;n.set(t,c);const h={},u=[-r.x,-r.y,-r.z];if(bm(u,[0,0,0])||(h.translation=u),t.isMesh||t.isLine||t.isPoints){const e=await this.processMeshAsync(t);null!==e&&(h.mesh=e)}else t.isCamera&&(h.camera=this.processCamera(t));t.isSkinnedMesh&&this.skins.push(t);const d=[e.nodes.push(h)-1];if(t.children.length>0){const e=[];for(let n=0,r=t.children.length;n<r;n++){const r=t.children[n];if(r.visible||!1===i.onlyVisible){const t=await this.processNodeAsync(r);null!==t&&e.push(t)}}e.length>0&&(h.children=e)}return s.children=d,await this._invokeAllAsync(function(e){e.writeNode&&e.writeNode(t,s)}),c}async processSceneAsync(t){const e=this.json,i=this.options;e.scenes||(e.scenes=[],e.scene=0);const n={};""!==t.name&&(n.name=t.name),e.scenes.push(n);const r=[];for(let e=0,n=t.children.length;e<n;e++){const n=t.children[e];if(n.visible||!1===i.onlyVisible){const t=await this.processNodeAsync(n);null!==t&&r.push(t)}}r.length>0&&(n.nodes=r),this.serializeUserData(t,n)}async processObjectsAsync(t){const e=new wr;e.name="AuxScene";for(let i=0;i<t.length;i++)e.children.push(t[i]);await this.processSceneAsync(e)}async processInputAsync(t){const e=this.options;t=t instanceof Array?t:[t],await this._invokeAllAsync(function(e){e.beforeParse&&e.beforeParse(t)});const i=[];for(let e=0;e<t.length;e++)t[e]instanceof wr?await this.processSceneAsync(t[e]):i.push(t[e]);i.length>0&&await this.processObjectsAsync(i);for(let t=0;t<this.skins.length;++t)this.processSkin(this.skins[t]);for(let i=0;i<e.animations.length;++i)this.processAnimation(e.animations[i],t[0]);await this._invokeAllAsync(function(e){e.afterParse&&e.afterParse(t)})}async _invokeAllAsync(t){for(let e=0,i=this.plugins.length;e<i;e++)await t(this.plugins[e])}}class Em{constructor(t){this.writer=t,this.name="KHR_lights_punctual"}writeNode(t,e){if(!t.isLight)return;if(!t.isDirectionalLight&&!t.isPointLight&&!t.isSpotLight)return void console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",t);const i=this.writer,n=i.json,r=i.extensionsUsed,s={};t.name&&(s.name=t.name),s.color=t.color.toArray(),s.intensity=t.intensity,t.isDirectionalLight?s.type="directional":t.isPointLight?(s.type="point",t.distance>0&&(s.range=t.distance)):t.isSpotLight&&(s.type="spot",t.distance>0&&(s.range=t.distance),s.spot={},s.spot.innerConeAngle=(1-t.penumbra)*t.angle,s.spot.outerConeAngle=t.angle),void 0!==t.decay&&2!==t.decay&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),!t.target||t.target.parent===t&&0===t.target.position.x&&0===t.target.position.y&&-1===t.target.position.z||console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),r[this.name]||(n.extensions=n.extensions||{},n.extensions[this.name]={lights:[]},r[this.name]=!0);const a=n.extensions[this.name].lights;a.push(s),e.extensions=e.extensions||{},e.extensions[this.name]={light:a.length-1}}}class Sm{constructor(t){this.writer=t,this.name="KHR_materials_unlit"}async writeMaterialAsync(t,e){if(!t.isMeshBasicMaterial)return;const i=this.writer.extensionsUsed;e.extensions=e.extensions||{},e.extensions[this.name]={},i[this.name]=!0,e.pbrMetallicRoughness.metallicFactor=0,e.pbrMetallicRoughness.roughnessFactor=.9}}class Cm{constructor(t){this.writer=t,this.name="KHR_materials_clearcoat"}async writeMaterialAsync(t,e){if(!t.isMeshPhysicalMaterial||0===t.clearcoat)return;const i=this.writer,n=i.extensionsUsed,r={};if(r.clearcoatFactor=t.clearcoat,t.clearcoatMap){const e={index:await i.processTextureAsync(t.clearcoatMap),texCoord:t.clearcoatMap.channel};i.applyTextureTransform(e,t.clearcoatMap),r.clearcoatTexture=e}if(r.clearcoatRoughnessFactor=t.clearcoatRoughness,t.clearcoatRoughnessMap){const e={index:await i.processTextureAsync(t.clearcoatRoughnessMap),texCoord:t.clearcoatRoughnessMap.channel};i.applyTextureTransform(e,t.clearcoatRoughnessMap),r.clearcoatRoughnessTexture=e}if(t.clearcoatNormalMap){const e={index:await i.processTextureAsync(t.clearcoatNormalMap),texCoord:t.clearcoatNormalMap.channel};1!==t.clearcoatNormalScale.x&&(e.scale=t.clearcoatNormalScale.x),i.applyTextureTransform(e,t.clearcoatNormalMap),r.clearcoatNormalTexture=e}e.extensions=e.extensions||{},e.extensions[this.name]=r,n[this.name]=!0}}class wm{constructor(t){this.writer=t,this.name="KHR_materials_dispersion"}async writeMaterialAsync(t,e){if(!t.isMeshPhysicalMaterial||0===t.dispersion)return;const i=this.writer.extensionsUsed,n={};n.dispersion=t.dispersion,e.extensions=e.extensions||{},e.extensions[this.name]=n,i[this.name]=!0}}class Mm{constructor(t){this.writer=t,this.name="KHR_materials_iridescence"}async writeMaterialAsync(t,e){if(!t.isMeshPhysicalMaterial||0===t.iridescence)return;const i=this.writer,n=i.extensionsUsed,r={};if(r.iridescenceFactor=t.iridescence,t.iridescenceMap){const e={index:await i.processTextureAsync(t.iridescenceMap),texCoord:t.iridescenceMap.channel};i.applyTextureTransform(e,t.iridescenceMap),r.iridescenceTexture=e}if(r.iridescenceIor=t.iridescenceIOR,r.iridescenceThicknessMinimum=t.iridescenceThicknessRange[0],r.iridescenceThicknessMaximum=t.iridescenceThicknessRange[1],t.iridescenceThicknessMap){const e={index:await i.processTextureAsync(t.iridescenceThicknessMap),texCoord:t.iridescenceThicknessMap.channel};i.applyTextureTransform(e,t.iridescenceThicknessMap),r.iridescenceThicknessTexture=e}e.extensions=e.extensions||{},e.extensions[this.name]=r,n[this.name]=!0}}class Im{constructor(t){this.writer=t,this.name="KHR_materials_transmission"}async writeMaterialAsync(t,e){if(!t.isMeshPhysicalMaterial||0===t.transmission)return;const i=this.writer,n=i.extensionsUsed,r={};if(r.transmissionFactor=t.transmission,t.transmissionMap){const e={index:await i.processTextureAsync(t.transmissionMap),texCoord:t.transmissionMap.channel};i.applyTextureTransform(e,t.transmissionMap),r.transmissionTexture=e}e.extensions=e.extensions||{},e.extensions[this.name]=r,n[this.name]=!0}}class Tm{constructor(t){this.writer=t,this.name="KHR_materials_volume"}async writeMaterialAsync(t,e){if(!t.isMeshPhysicalMaterial||0===t.transmission)return;const i=this.writer,n=i.extensionsUsed,r={};if(r.thicknessFactor=t.thickness,t.thicknessMap){const e={index:await i.processTextureAsync(t.thicknessMap),texCoord:t.thicknessMap.channel};i.applyTextureTransform(e,t.thicknessMap),r.thicknessTexture=e}t.attenuationDistance!==1/0&&(r.attenuationDistance=t.attenuationDistance),r.attenuationColor=t.attenuationColor.toArray(),e.extensions=e.extensions||{},e.extensions[this.name]=r,n[this.name]=!0}}class Bm{constructor(t){this.writer=t,this.name="KHR_materials_ior"}async writeMaterialAsync(t,e){if(!t.isMeshPhysicalMaterial||1.5===t.ior)return;const i=this.writer.extensionsUsed,n={};n.ior=t.ior,e.extensions=e.extensions||{},e.extensions[this.name]=n,i[this.name]=!0}}class Rm{constructor(t){this.writer=t,this.name="KHR_materials_specular"}async writeMaterialAsync(t,e){if(!t.isMeshPhysicalMaterial||1===t.specularIntensity&&t.specularColor.equals(fm)&&!t.specularIntensityMap&&!t.specularColorMap)return;const i=this.writer,n=i.extensionsUsed,r={};if(t.specularIntensityMap){const e={index:await i.processTextureAsync(t.specularIntensityMap),texCoord:t.specularIntensityMap.channel};i.applyTextureTransform(e,t.specularIntensityMap),r.specularTexture=e}if(t.specularColorMap){const e={index:await i.processTextureAsync(t.specularColorMap),texCoord:t.specularColorMap.channel};i.applyTextureTransform(e,t.specularColorMap),r.specularColorTexture=e}r.specularFactor=t.specularIntensity,r.specularColorFactor=t.specularColor.toArray(),e.extensions=e.extensions||{},e.extensions[this.name]=r,n[this.name]=!0}}class Dm{constructor(t){this.writer=t,this.name="KHR_materials_sheen"}async writeMaterialAsync(t,e){if(!t.isMeshPhysicalMaterial||0==t.sheen)return;const i=this.writer,n=i.extensionsUsed,r={};if(t.sheenRoughnessMap){const e={index:await i.processTextureAsync(t.sheenRoughnessMap),texCoord:t.sheenRoughnessMap.channel};i.applyTextureTransform(e,t.sheenRoughnessMap),r.sheenRoughnessTexture=e}if(t.sheenColorMap){const e={index:await i.processTextureAsync(t.sheenColorMap),texCoord:t.sheenColorMap.channel};i.applyTextureTransform(e,t.sheenColorMap),r.sheenColorTexture=e}r.sheenRoughnessFactor=t.sheenRoughness,r.sheenColorFactor=t.sheenColor.toArray(),e.extensions=e.extensions||{},e.extensions[this.name]=r,n[this.name]=!0}}class Lm{constructor(t){this.writer=t,this.name="KHR_materials_anisotropy"}async writeMaterialAsync(t,e){if(!t.isMeshPhysicalMaterial||0==t.anisotropy)return;const i=this.writer,n=i.extensionsUsed,r={};if(t.anisotropyMap){const e={index:await i.processTextureAsync(t.anisotropyMap)};i.applyTextureTransform(e,t.anisotropyMap),r.anisotropyTexture=e}r.anisotropyStrength=t.anisotropy,r.anisotropyRotation=t.anisotropyRotation,e.extensions=e.extensions||{},e.extensions[this.name]=r,n[this.name]=!0}}class Pm{constructor(t){this.writer=t,this.name="KHR_materials_emissive_strength"}async writeMaterialAsync(t,e){if(!t.isMeshStandardMaterial||1===t.emissiveIntensity)return;const i=this.writer.extensionsUsed,n={};n.emissiveStrength=t.emissiveIntensity,e.extensions=e.extensions||{},e.extensions[this.name]=n,i[this.name]=!0}}class Fm{constructor(t){this.writer=t,this.name="EXT_materials_bump"}async writeMaterialAsync(t,e){if(!t.isMeshStandardMaterial||1===t.bumpScale&&!t.bumpMap)return;const i=this.writer,n=i.extensionsUsed,r={};if(t.bumpMap){const e={index:await i.processTextureAsync(t.bumpMap),texCoord:t.bumpMap.channel};i.applyTextureTransform(e,t.bumpMap),r.bumpTexture=e}r.bumpFactor=t.bumpScale,e.extensions=e.extensions||{},e.extensions[this.name]=r,n[this.name]=!0}}class Um{constructor(t){this.writer=t,this.name="EXT_mesh_gpu_instancing"}writeNode(t,e){if(!t.isInstancedMesh)return;const i=this.writer,n=t,r=new Float32Array(3*n.count),s=new Float32Array(4*n.count),a=new Float32Array(3*n.count),o=new Hn,l=new vn,c=new bn,h=new vn;for(let t=0;t<n.count;t++)n.getMatrixAt(t,o),o.decompose(l,c,h),l.toArray(r,3*t),c.toArray(s,4*t),h.toArray(a,3*t);const u={TRANSLATION:i.processAccessor(new ls(r,3)),ROTATION:i.processAccessor(new ls(s,4)),SCALE:i.processAccessor(new ls(a,3))};n.instanceColor&&(u._COLOR_0=i.processAccessor(n.instanceColor)),e.extensions=e.extensions||{},e.extensions[this.name]={attributes:u},i.extensionsUsed[this.name]=!0,i.extensionsRequired[this.name]=!0}}let Nm,Om,km,Qm;Vg.Utils={insertKeyframe:function(t,e){const i=.001,n=t.getValueSize(),r=new t.TimeBufferType(t.times.length+1),s=new t.ValueBufferType(t.values.length+n),a=t.createInterpolant(new t.ValueBufferType(n));let o;if(0===t.times.length){r[0]=e;for(let t=0;t<n;t++)s[t]=0;o=0}else if(e<t.times[0]){if(Math.abs(t.times[0]-e)<i)return 0;r[0]=e,r.set(t.times,1),s.set(a.evaluate(e),0),s.set(t.values,n),o=0}else if(e>t.times[t.times.length-1]){if(Math.abs(t.times[t.times.length-1]-e)<i)return t.times.length-1;r[r.length-1]=e,r.set(t.times,0),s.set(t.values,0),s.set(a.evaluate(e),t.values.length),o=r.length-1}else for(let l=0;l<t.times.length;l++){if(Math.abs(t.times[l]-e)<i)return l;if(t.times[l]<e&&t.times[l+1]>e){r.set(t.times.slice(0,l+1),0),r[l+1]=e,r.set(t.times.slice(l+1),l+2),s.set(t.values.slice(0,(l+1)*n),0),s.set(a.evaluate(e),(l+1)*n),s.set(t.values.slice((l+1)*n),(l+2)*n),o=l+1;break}}return t.times=r,t.values=s,o},mergeMorphTargetTracks:function(t,e){const i=[],n={},r=t.tracks;for(let t=0;t<r.length;++t){let s=r[t];const a=wc.parseTrackName(s.name),o=wc.findNode(e,a.nodeName);if("morphTargetInfluences"!==a.propertyName||void 0===a.propertyIndex){i.push(s);continue}if(s.createInterpolant!==s.InterpolantFactoryMethodDiscrete&&s.createInterpolant!==s.InterpolantFactoryMethodLinear){if(s.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),s=s.clone(),s.setInterpolation(Ci)}const l=o.morphTargetInfluences.length,c=o.morphTargetDictionary[a.propertyIndex];if(void 0===c)throw new Error("THREE.GLTFExporter: Morph target name not found: "+a.propertyIndex);let h;if(void 0===n[o.uuid]){h=s.clone();const t=new h.ValueBufferType(l*h.times.length);for(let e=0;e<h.times.length;e++)t[e*l+c]=h.values[e];h.name=(a.nodeName||"")+".morphTargetInfluences",h.values=t,n[o.uuid]=h,i.push(h);continue}const u=s.createInterpolant(new s.ValueBufferType(1));h=n[o.uuid];for(let t=0;t<h.times.length;t++)h.values[t*l+c]=u.evaluate(h.times[t]);for(let t=0;t<s.times.length;t++){const e=this.insertKeyframe(h,s.times[t]);h.values[e*l+c]=s.values[t]}}return t.tracks=i,t},toTypedBufferAttribute:function(t,e){const i=new ls(new e(t.count*t.itemSize),t.itemSize,!1);if(!t.normalized&&!t.isInterleavedBufferAttribute)return i.array.set(t.array),i;for(let e=0,n=t.count;e<n;e++)for(let n=0;n<t.itemSize;n++)i.setComponent(e,n,t.getComponent(e,n));return i}};
|
|
/* @license
|
|
* Copyright 2021 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
const Gm=t=>void 0!==t.material&&t.userData&&t.userData.variantMaterials&&!!Array.from(t.userData.variantMaterials.values()).filter(t=>zm(t.material)),zm=t=>t&&t.isMaterial&&!Array.isArray(t);class Hm{constructor(t){this.writer=t,this.name="KHR_materials_variants",this.variantNames=[]}beforeParse(t){const e=new Set,i=t=>{if(!Gm(t))return;const i=t.userData.variantMaterials,n=t.userData.variantData;for(const[t,r]of n){const n=i.get(r.index);n&&zm(n.material)&&e.add(t)}};if(Array.isArray(t))for(const e of t)e.traverse(i);else t.traverse(i);e.forEach(t=>this.variantNames.push(t))}async writeMesh(t,e){if(!Gm(t))return;const i=t.userData,n=i.variantMaterials,r=i.variantData,s=new Map,a=new Map,o=Array.from(r.values()).sort((t,e)=>t.index-e.index);for(const[t,e]of o.entries())a.set(e.index,t);for(const t of r.values()){const e=n.get(t.index);if(!e||!zm(e.material))continue;const i=await this.writer.processMaterialAsync(e.material);s.has(i)||s.set(i,{material:i,variants:[]}),s.get(i).variants.push(a.get(t.index))}const l=Array.from(s.values()).map(t=>t.variants.sort((t,e)=>t-e)&&t).sort((t,e)=>t.material-e.material);if(0===l.length)return;const c=zm(i.originalMaterial)?await this.writer.processMaterialAsync(i.originalMaterial):-1;for(const t of e.primitives)c>=0&&(t.material=c),t.extensions=t.extensions||{},t.extensions[this.name]={mappings:l}}afterParse(){if(0===this.variantNames.length)return;const t=this.writer.json;t.extensions=t.extensions||{};const e=this.variantNames.map(t=>({name:t}));t.extensions[this.name]={variants:e},this.writer.extensionsUsed[this.name]=!0}}class Vm{constructor(t,e,i,n,r){this.xrLight=t,this.renderer=e,this.lightProbe=i,this.xrWebGLBinding=null,this.estimationStartCallback=r,this.frameCallback=this.onXRFrame.bind(this);const s=e.xr.getSession();if(n&&"XRWebGLBinding"in window){const i=new hh(16);t.environment=i.texture;const n=e.getContext();switch(s.preferredReflectionFormat){case"srgba8":n.getExtension("EXT_sRGB");break;case"rgba16f":n.getExtension("OES_texture_half_float")}this.xrWebGLBinding=new XRWebGLBinding(s,n),this.lightProbe.addEventListener("reflectionchange",()=>{this.updateReflection()})}s.requestAnimationFrame(this.frameCallback)}updateReflection(){const t=this.renderer.properties.get(this.xrLight.environment);if(t){const e=this.xrWebGLBinding.getReflectionCubeMap(this.lightProbe);e&&(t.__webglTexture=e,this.xrLight.environment.needsPMREMUpdate=!0)}}onXRFrame(t,e){if(!this.xrLight)return;e.session.requestAnimationFrame(this.frameCallback);const i=e.getLightEstimate(this.lightProbe);if(i){this.xrLight.lightProbe.sh.fromArray(i.sphericalHarmonicsCoefficients),this.xrLight.lightProbe.intensity=1;const t=Math.max(1,Math.max(i.primaryLightIntensity.x,Math.max(i.primaryLightIntensity.y,i.primaryLightIntensity.z)));this.xrLight.directionalLight.color.setRGB(i.primaryLightIntensity.x/t,i.primaryLightIntensity.y/t,i.primaryLightIntensity.z/t),this.xrLight.directionalLight.intensity=t,this.xrLight.directionalLight.position.copy(i.primaryLightDirection),this.estimationStartCallback&&(this.estimationStartCallback(),this.estimationStartCallback=null)}}dispose(){this.xrLight=null,this.renderer=null,this.lightProbe=null,this.xrWebGLBinding=null}}class qm extends fr{constructor(t,e=!0){super(),this.lightProbe=new dc,this.lightProbe.intensity=0,this.add(this.lightProbe),this.directionalLight=new hc,this.directionalLight.intensity=0,this.add(this.directionalLight),this.environment=null;let i=null,n=!1;t.xr.addEventListener("sessionstart",()=>{const r=t.xr.getSession();"requestLightProbe"in r&&r.requestLightProbe({reflectionFormat:r.preferredReflectionFormat}).then(r=>{i=new Vm(this,t,r,e,()=>{n=!0,this.dispatchEvent({type:"estimationstart"})})})}),t.xr.addEventListener("sessionend",()=>{i&&(i.dispose(),i=null),n&&this.dispatchEvent({type:"estimationend"})}),this.dispose=()=>{i&&(i.dispose(),i=null),this.remove(this.lightProbe),this.lightProbe=null,this.remove(this.directionalLight),this.directionalLight=null,this.environment=null}}}
|
|
/* @license
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/class jm{constructor(t=50){this.velocity=0,this.naturalFrequency=0,this.setDecayTime(t)}setDecayTime(t){this.naturalFrequency=1/Math.max(.001,t)}update(t,e,i,n){const r=2e-4*this.naturalFrequency;if(null==t||0===n)return e;if(t===e&&0===this.velocity)return e;if(i<0)return t;const s=t-e,a=this.velocity+this.naturalFrequency*s,o=s+i*a,l=Math.exp(-this.naturalFrequency*i),c=(a-this.naturalFrequency*o)*l,h=-this.naturalFrequency*(c+a*l);return Math.abs(c)<r*Math.abs(n)&&h*s>=0?(this.velocity=0,e):(this.velocity=c,e+o*l)}}
|
|
/* @license
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/const Wm={MIN_TOUCH_AREA:.05,BASE_RADIUS:.15,LINE_WIDTH:.02,SEGMENTS:16,DELTA_PHI:Math.PI/32,COLORS:{EDGE_FALLOFF:new Sr(.98,.98,.98),EDGE_CUTOFF:new Sr(.8,.8,.8),FILL_FALLOFF:new Sr(.4,.4,.4),FILL_CUTOFF:new Sr(.4,.4,.4),ACTIVE_EDGE:new Sr(1,1,1),ACTIVE_FILL:new Sr(.6,.6,.6)},MAX_OPACITY:.75,FILL_OPACITY_MULTIPLIER:.5,INTERACTIVE_OPACITY_MULTIPLIER:1.2,MIN_DISTANCE:.5,MAX_DISTANCE:10,BASE_SCALE:1,DISTANCE_SCALE_FACTOR:.3,COLOR_LERP_FACTOR:.15,SCREEN_SPACE_SCALE:1.2,SIZE_UPDATE_THRESHOLD:.001,GEOMETRY_UPDATE_DEBOUNCE:100},Xm=new fn,Km=(t,e,i,n,r)=>{let s=e>0?i>0?0:-Math.PI/2:i>0?Math.PI/2:Math.PI;for(let a=0;a<=Wm.SEGMENTS;++a)t.push(e+(n-r)*Math.cos(s),i+(n-r)*Math.sin(s),0,e+n*Math.cos(s),i+n*Math.sin(s),0),s+=Wm.DELTA_PHI};class Jm extends Ks{constructor(t,e){super(new Es),this.shadowHeight=0,this.isActive=!1,this.isHovered=!1,this.lastGeometryUpdateTime=0,this.needsGeometryUpdate=!1,this.scene=t,this.side=e,this.currentSize=new vn,this.goalSize=new vn,this.sizeDamper=new jm,this.updateSizeFromScene(),this.edgeMaterial=new Ns({color:Wm.COLORS.EDGE_FALLOFF,transparent:!0,opacity:0,side:2,depthWrite:!1,blending:2}),this.fillMaterial=new Ns({color:Wm.COLORS.FILL_FALLOFF,transparent:!0,opacity:0,side:2,depthWrite:!1,blending:1}),this.material=this.edgeMaterial,this.goalOpacity=0,this.opacityDamper=new jm,this.createHitMeshes(),this.updatePositionFromScene(),t.target.add(this),t.target.add(this.hitBox),this.offsetHeight=0}updateSizeFromScene(){const{size:t}=this.scene;this.goalSize.copy(t);const e=Math.sqrt(t.x*t.x+t.z*t.z),i=Math.max(Wm.MIN_TOUCH_AREA,.4*e);this.goalSize.x<i&&(this.goalSize.x=i),this.goalSize.z<i&&(this.goalSize.z=i),this.updateGeometry()}updateGeometry(){const t=this.geometry,e=[],i=[],n=this.goalSize.x/2,r=("back"===this.side?this.goalSize.y:this.goalSize.z)/2,s=Math.min(n,r),a=Math.max(.7*Wm.BASE_RADIUS,.2*s),o=Math.max(.7*Wm.LINE_WIDTH,.025*s);Km(i,n,r,a,o),Km(i,-n,r,a,o),Km(i,-n,-r,a,o),Km(i,n,-r,a,o);const l=i.length/3;for(let t=0;t<l-2;t+=2)e.push(t,t+1,t+3,t,t+3,t+2);const c=l-2;e.push(c,c+1,1,c,1,0),t.setAttribute("position",new us(i,3)),t.setIndex(e),t.computeBoundingSphere()}createHitMeshes(){const t=this.goalSize.x/2,e=("back"===this.side?this.goalSize.y:this.goalSize.z)/2,i=Math.min(t,e),n=Math.max(.7*Wm.BASE_RADIUS,.2*i);this.hitPlane=new Ks(new el(2*(t+n),2*(e+n))),this.hitPlane.visible=!1,this.hitPlane.material.side=2,this.add(this.hitPlane),this.hitBox=new Ks(new so(this.goalSize.x+2*n,this.goalSize.y+n,this.goalSize.z+2*n)),this.hitBox.visible=!1,this.hitBox.material.side=2,this.add(this.hitBox)}updatePositionFromScene(){const{boundingBox:t}=this.scene;switch(t.getCenter(this.position),this.rotation.set(0,0,0),this.side){case"bottom":this.rotateX(-Math.PI/2),this.shadowHeight=t.min.y,this.position.y=this.shadowHeight;break;case"back":this.shadowHeight=t.min.z,this.position.z=this.shadowHeight}if(this.hitBox){const e=(this.side,(this.goalSize.y+Wm.BASE_RADIUS)/2);this.hitBox.position.y=e+t.min.y}}updateFromModelChanges(){this.updateSizeFromScene(),this.updatePositionFromScene(),this.updateGeometry(),this.updateHitMeshes(),this.ensureProperOrientation(),this.needsGeometryUpdate=!1,this.lastGeometryUpdateTime=performance.now()}ensureProperOrientation(){"bottom"===this.side?(this.rotation.x=-Math.PI/2,this.rotation.y=0,this.rotation.z=0):"back"===this.side&&(this.rotation.x=0,this.rotation.y=0,this.rotation.z=0)}setScreenSpaceMode(t){t?this.scale.set(Wm.SCREEN_SPACE_SCALE,Wm.SCREEN_SPACE_SCALE,Wm.SCREEN_SPACE_SCALE):this.scale.set(1,1,1)}updateHitMeshes(){if(this.hitPlane&&this.hitBox){const t=this.goalSize.x/2,e=("back"===this.side?this.goalSize.y:this.goalSize.z)/2,i=Math.min(t,e),n=Math.max(.7*Wm.BASE_RADIUS,.2*i),r=new el(2*(t+n),2*(e+n));this.hitPlane.geometry.dispose(),this.hitPlane.geometry=r;const s=new so(this.goalSize.x+2*n,this.goalSize.y+n,this.goalSize.z+2*n);this.hitBox.geometry.dispose(),this.hitBox.geometry=s}}setInteractionState(t,e=!1){this.isActive=t,this.isHovered=e,this.updateVisualState()}updateVisualState(){let t,e;this.isActive?(t=Wm.COLORS.ACTIVE_EDGE,e=Wm.COLORS.ACTIVE_FILL):this.isHovered?(t=Wm.COLORS.EDGE_FALLOFF,e=Wm.COLORS.FILL_FALLOFF):(t=Wm.COLORS.EDGE_CUTOFF,e=Wm.COLORS.FILL_CUTOFF),this.edgeMaterial.color.lerp(t,Wm.COLOR_LERP_FACTOR),this.fillMaterial.color.lerp(e,Wm.COLOR_LERP_FACTOR)}applyDistanceScaling(t){const e=t.distanceTo(this.position),i=Math.max(Wm.MIN_DISTANCE,Math.min(Wm.MAX_DISTANCE,e)),n=Wm.BASE_SCALE+(i-Wm.MIN_DISTANCE)*Wm.DISTANCE_SCALE_FACTOR;this.scale.set(n,n,n)}getHit(t,e,i){Xm.set(e,-i),this.hitPlane.visible=!0;const n=t.positionAndNormalFromPoint(Xm,this.hitPlane);return this.hitPlane.visible=!1,null==n?null:n.position}getExpandedHit(t,e,i){this.hitPlane.scale.set(1e3,1e3,1e3),this.hitPlane.updateMatrixWorld();const n=this.getHit(t,e,i);return this.hitPlane.scale.set(1,1,1),n}controllerIntersection(t,e){this.hitBox.visible=!0;const i=t.hitFromController(e,this.hitBox);return this.hitBox.visible=!1,i}set offsetHeight(t){t-=.001,"back"===this.side?this.position.z=this.shadowHeight+t:this.position.y=this.shadowHeight+t}get offsetHeight(){return"back"===this.side?this.position.z-this.shadowHeight:this.position.y-this.shadowHeight}set show(t){this.goalOpacity=t?Wm.MAX_OPACITY:0}updateOpacity(t){const e=this.material,i=this.opacityDamper.update(e.opacity,this.goalOpacity,t,1);this.edgeMaterial.opacity=i,this.fillMaterial.opacity=i*Wm.FILL_OPACITY_MULTIPLIER,(this.isActive||this.isHovered)&&(this.edgeMaterial.opacity=i*Wm.INTERACTIVE_OPACITY_MULTIPLIER),this.visible=i>0}update(t,e){if(this.updateOpacity(t),!this.currentSize.equals(this.goalSize)){const e=new vn;e.x=this.sizeDamper.update(this.currentSize.x,this.goalSize.x,t,1),e.y=this.sizeDamper.update(this.currentSize.y,this.goalSize.y,t,1),e.z=this.sizeDamper.update(this.currentSize.z,this.goalSize.z,t,1);e.distanceTo(this.currentSize)>Wm.SIZE_UPDATE_THRESHOLD&&(this.currentSize.copy(e),this.needsGeometryUpdate=!0)}const i=performance.now();this.needsGeometryUpdate&&i-this.lastGeometryUpdateTime>Wm.GEOMETRY_UPDATE_DEBOUNCE&&(this.updateGeometry(),this.updateHitMeshes(),this.needsGeometryUpdate=!1,this.lastGeometryUpdateTime=i),e&&this.applyDistanceScaling(e),this.updateVisualState()}getSize(){return this.goalSize.clone()}dispose(){const{geometry:t,material:e}=this.hitPlane;t.dispose(),e.dispose(),this.hitBox.geometry.dispose(),this.hitBox.material.dispose(),this.geometry.dispose(),this.edgeMaterial.dispose(),this.fillMaterial.dispose(),this.hitBox.removeFromParent(),this.removeFromParent()}}
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/const Ym=(t,e)=>({type:"number",number:t,unit:e}),$m=(()=>{const t={};return e=>{const i=e;if(i in t)return t[i];const n=[];let r=0;for(;e;){if(++r>1e3){e="";break}const t=Zm(e),i=t.nodes[0];if(null==i||0===i.terms.length)break;n.push(i),e=t.remainingInput}return t[i]=n}})(),Zm=(()=>{const t=/^(\-\-|[a-z\u0240-\uffff])/i,e=/^([\*\+\/]|[\-]\s)/i,i=/^[\),]/;return n=>{const r=[];for(;n.length&&(n=n.trim(),!i.test(n));)if("("===n[0]){const{nodes:t,remainingInput:e}=rf(n);n=e,r.push({type:"function",name:{type:"ident",value:"calc"},arguments:t})}else if(t.test(n)){const t=tf(n),e=t.nodes[0];if("("===(n=t.remainingInput)[0]){const{nodes:t,remainingInput:i}=rf(n);r.push({type:"function",name:e,arguments:t}),n=i}else r.push(e)}else if(e.test(n))r.push({type:"operator",value:n[0]}),n=n.slice(1);else{const{nodes:t,remainingInput:e}="#"===n[0]?nf(n):ef(n);if(0===t.length)break;r.push(t[0]),n=e}return{nodes:[{type:"expression",terms:r}],remainingInput:n}}})(),tf=(()=>{const t=/[^a-z0-9_\-\u0240-\uffff]/i;return e=>{const i=e.match(t);return{nodes:[{type:"ident",value:null==i?e:e.substr(0,i.index)}],remainingInput:null==i?"":e.substr(i.index)}}})(),ef=(()=>{const t=/[\+\-]?(\d+[\.]\d+|\d+|[\.]\d+)([eE][\+\-]?\d+)?/,e=/^[a-z%]+/i,i=/^(m|mm|cm|rad|deg|[%])$/;return n=>{const r=n.match(t),s=null==r?"0":r[0],a=(n=null==s?n:n.slice(s.length)).match(e);let o=null!=a&&""!==a[0]?a[0]:null;const l=null==a?n:n.slice(o.length);return null==o||i.test(o)||(o=null),{nodes:[{type:"number",number:parseFloat(s)||0,unit:o}],remainingInput:l}}})(),nf=(()=>{const t=/^[a-f0-9]*/i;return e=>{const i=(e=e.slice(1).trim()).match(t);return{nodes:null==i?[]:[{type:"hex",value:i[0]}],remainingInput:null==i?e:e.slice(i[0].length)}}})(),rf=t=>{const e=[];for(t=t.slice(1).trim();t.length;){const i=Zm(t);if(e.push(i.nodes[0]),","===(t=i.remainingInput.trim())[0])t=t.slice(1).trim();else if(")"===t[0]){t=t.slice(1);break}}return{nodes:e,remainingInput:t}},sf=Symbol("visitedTypes");class af{constructor(t){this[sf]=t}walk(t,e){const i=t.slice();for(;i.length;){const t=i.shift();switch(this[sf].indexOf(t.type)>-1&&e(t),t.type){case"expression":i.unshift(...t.terms);break;case"function":i.unshift(t.name,...t.arguments)}}}}const of=Object.freeze({type:"number",number:0,unit:null}),lf=(t,e=0)=>{let{number:i,unit:n}=t;if(isFinite(i)){if("rad"===t.unit||null==t.unit)return t}else i=e,n="rad";return{type:"number",number:("deg"===n&&null!=i?i:0)*Math.PI/180,unit:"rad"}},cf=(t,e=0)=>{let i,{number:n,unit:r}=t;if(isFinite(n)){if("m"===t.unit)return t}else n=e,r="m";switch(r){default:i=1;break;case"cm":i=.01;break;case"mm":i=.001}return{type:"number",number:i*n,unit:"m"}},hf=(()=>{const t=t=>t,e={rad:t,deg:lf,m:t,mm:cf,cm:cf};return(t,i=of)=>{isFinite(t.number)||(t.number=i.number,t.unit=i.unit);const{unit:n}=t;if(null==n)return t;const r=e[n];return null==r?i:r(t)}})();
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
var uf,df,pf;const Af=Symbol("evaluate"),gf=Symbol("lastValue");class mf{constructor(){this[uf]=null}static evaluatableFor(t,e=of){if(t instanceof mf)return t;if("number"===t.type)return"%"===t.unit?new vf(t,e):t;switch(t.name.value){case"calc":return new Sf(t,e);case"env":return new xf(t)}return of}static evaluate(t){return t instanceof mf?t.evaluate():t}static isConstant(t){return!(t instanceof mf)||t.isConstant}static applyIntrinsics(t,e){const{basis:i,keywords:n}=e,{auto:r}=n;return i.map((e,i)=>{const s=null==r[i]?e:r[i];let a=t[i]?t[i]:s;if("ident"===a.type){const t=a.value;t in n&&(a=n[t][i])}return null!=a&&"ident"!==a.type||(a=s),"%"===a.unit?Ym(a.number/100*e.number,e.unit):(a=hf(a,e),a.unit!==e.unit?e:a)})}get isConstant(){return!1}evaluate(){return this.isConstant&&null!=this[gf]||(this[gf]=this[Af]()),this[gf]}}uf=gf;const ff=Symbol("percentage"),bf=Symbol("basis");class vf extends mf{constructor(t,e){super(),this[ff]=t,this[bf]=e}get isConstant(){return!0}[Af](){return Ym(this[ff].number/100*this[bf].number,this[bf].unit)}}const yf=Symbol("identNode");class xf extends mf{constructor(t){super(),this[df]=null;const e=t.arguments.length?t.arguments[0].terms[0]:null;null!=e&&"ident"===e.type&&(this[yf]=e)}get isConstant(){return!1}[(df=yf,Af)](){if(null!=this[yf]&&"window-scroll-y"===this[yf].value){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 of}}const _f=/[\*\/]/,Ef=Symbol("evaluator");class Sf extends mf{constructor(t,e=of){if(super(),this[pf]=null,1!==t.arguments.length)return;const i=t.arguments[0].terms.slice(),n=[];for(;i.length;){const t=i.shift();if(n.length>0){const i=n[n.length-1];if("operator"===i.type&&_f.test(i.value)){const i=n.pop(),r=n.pop();if(null==r)return;n.push(new If(i,mf.evaluatableFor(r,e),mf.evaluatableFor(t,e)));continue}}n.push("operator"===t.type?t:mf.evaluatableFor(t,e))}for(;n.length>2;){const[t,i,r]=n.splice(0,3);if("operator"!==i.type)return;n.unshift(new If(i,mf.evaluatableFor(t,e),mf.evaluatableFor(r,e)))}1===n.length&&(this[Ef]=n[0])}get isConstant(){return null==this[Ef]||mf.isConstant(this[Ef])}[(pf=Ef,Af)](){return null!=this[Ef]?mf.evaluate(this[Ef]):of}}const Cf=Symbol("operator"),wf=Symbol("left"),Mf=Symbol("right");class If extends mf{constructor(t,e,i){super(),this[Cf]=t,this[wf]=e,this[Mf]=i}get isConstant(){return mf.isConstant(this[wf])&&mf.isConstant(this[Mf])}[Af](){const t=hf(mf.evaluate(this[wf])),e=hf(mf.evaluate(this[Mf])),{number:i,unit:n}=t,{number:r,unit:s}=e;if(null!=s&&null!=n&&s!=n)return of;const a=n||s;let o;switch(this[Cf].value){case"+":o=i+r;break;case"-":o=i-r;break;case"/":o=i/r;break;case"*":o=i*r;break;default:return of}return{type:"number",number:o,unit:a}}}const Tf=Symbol("evaluatables"),Bf=Symbol("intrinsics");class Rf extends mf{constructor(t,e){super(),this[Bf]=e;const i=t[0],n=null!=i?i.terms:[];this[Tf]=e.basis.map((t,e)=>{const i=n[e];return null==i?{type:"ident",value:"auto"}:"ident"===i.type?i:mf.evaluatableFor(i,t)})}get isConstant(){for(const t of this[Tf])if(!mf.isConstant(t))return!1;return!0}[Af](){const t=this[Tf].map(t=>mf.evaluate(t));return mf.applyIntrinsics(t,this[Bf]).map(t=>t.number)}}
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/var Df,Lf,Pf,Ff;const Uf=Symbol("instances"),Nf=Symbol("activateListener"),Of=Symbol("deactivateListener"),kf=Symbol("notifyInstances"),Qf=Symbol("notify"),Gf=Symbol("callback");class zf{static[kf](){for(const t of zf[Uf])t[Qf]()}static[(Df=Uf,Nf)](){window.addEventListener("scroll",this[kf],{passive:!0})}static[Of](){window.removeEventListener("scroll",this[kf])}constructor(t){this[Gf]=t}observe(){0===zf[Uf].size&&zf[Nf](),zf[Uf].add(this)}disconnect(){zf[Uf].delete(this),0===zf[Uf].size&&zf[Of]()}[Qf](){this[Gf]()}}zf[Df]=new Set;const Hf=Symbol("computeStyleCallback"),Vf=Symbol("astWalker"),qf=Symbol("dependencies"),jf=Symbol("onScroll");class Wf{constructor(t){this[Lf]={},this[Pf]=new af(["function"]),this[Ff]=()=>{this[Hf]({relatedState:"window-scroll"})},this[Hf]=t}observeEffectsFor(t){const e={},i=this[qf];this[Vf].walk(t,t=>{const{name:n}=t,r=t.arguments[0].terms[0];if("env"===n.value&&null!=r&&"ident"===r.type&&"window-scroll-y"===r.value)if(null==e["window-scroll"]){const t="window-scroll"in i?i["window-scroll"]:new zf(this[jf]);t.observe(),delete i["window-scroll"],e["window-scroll"]=t}});for(const t in i){i[t].disconnect()}this[qf]=e}dispose(){for(const t in this[qf]){this[qf][t].disconnect()}}}Lf=qf,Pf=Vf,Ff=jf;
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
const Xf=t=>{const e=t.observeEffects||!1,i=t.intrinsics instanceof Function?t.intrinsics:()=>t.intrinsics;return(n,r)=>{const s=n.updated,a=n.connectedCallback,o=n.disconnectedCallback,l=Symbol(`${r}StyleEffector`),c=Symbol(`${r}StyleEvaluator`),h=Symbol(`${r}UpdateEvaluator`),u=Symbol(`${r}EvaluateAndSync`);Object.defineProperties(n,{[l]:{value:null,writable:!0},[c]:{value:null,writable:!0},[h]:{value:function(){const t=$m(this[r]);this[c]=new Rf(t,i(this)),null==this[l]&&e&&(this[l]=new Wf(()=>this[u]())),null!=this[l]&&this[l].observeEffectsFor(t)}},[u]:{value:function(){if(null==this[c])return;const e=this[c].evaluate();this[t.updateHandler](e)}},updated:{value:function(t){t.has(r)&&(this[h](),this[u]()),s.call(this,t)}},connectedCallback:{value:function(){a.call(this),this.requestUpdate(r,this[r])}},disconnectedCallback:{value:function(){o.call(this),null!=this[l]&&(this[l].dispose(),this[l]=null)}}})}},Kf=t=>t<.5?2*t*t:(4-2*t)*t-1,Jf=(t,e,i=Kf)=>n=>t+(e-t)*i(n),Yf=t=>{const e=[],i=[];let n=t.initialValue;for(let r=0;r<t.keyframes.length;++r){const s=t.keyframes[r],{value:a,frames:o}=s,l=s.ease||Kf,c=Jf(n,a,l);e.push(c),i.push(o),n=a}return((t,e)=>{const i=e.map((n=0,t=>n+=t));var n;return e=>{e=jd(e,0,1),e*=i[i.length-1];const n=i.findIndex(t=>t>=e),r=n<1?0:i[n-1],s=i[n];return t[n]((e-r)/(s-r))}})(e,i)};
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
var $f=function(t,e,i,n){for(var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n,o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};const Zf=Yf({initialValue:0,keyframes:[{frames:5,value:-1},{frames:1,value:-1},{frames:8,value:1},{frames:1,value:1},{frames:5,value:0},{frames:18,value:0}]}),tb=Yf({initialValue:0,keyframes:[{frames:1,value:1},{frames:5,value:1},{frames:1,value:0},{frames:6,value:0}]}),eb="0deg 75deg 105%",ib=["front","right","back","left"],nb=["upper-","","lower-"],rb="auto",sb="basic",ab="wiggle",ob="none",lb=()=>({basis:[lf(Ym(30,"deg"))],keywords:{auto:[null]}}),cb=()=>({basis:[lf(Ym(12,"deg"))],keywords:{auto:[null]}}),hb=(()=>{const t=$m(eb)[0].terms,e=hf(t[0]),i=hf(t[1]);return t=>{const n=t[pE].idealCameraDistance();return{basis:[e,i,Ym(n,"m")],keywords:{auto:[null,null,Ym(105,"%")]}}}})(),ub=t=>{const e=2.2*t[pE].boundingSphere.radius;return{basis:[Ym(-1/0,"rad"),Ym(0,"rad"),Ym(e,"m")],keywords:{auto:[null,null,null]}}},db=t=>{const e=hb(t),i=new Rf([],e).evaluate()[2];return{basis:[Ym(1/0,"rad"),Ym(Math.PI,"rad"),Ym(i,"m")],keywords:{auto:[null,null,null]}}},pb=t=>{t[pE].updateBoundingBoxAndShadowIfDirty();const e=t[pE].boundingBox.getCenter(new vn);return{basis:[Ym(e.x,"m"),Ym(e.y,"m"),Ym(e.z,"m")],keywords:{auto:[null,null,null]}}},Ab=Math.PI/2,gb=Math.PI/3,mb=Ab/2,fb=2*Math.PI,bb=Symbol("controls"),vb=Symbol("panElement"),yb=Symbol("promptElement"),xb=Symbol("promptAnimatedContainer"),_b=Symbol("fingerAnimatedContainers"),Eb=Symbol("deferInteractionPrompt"),Sb=Symbol("updateAria"),Cb=Symbol("a11y"),wb=Symbol("updateA11y"),Mb=Symbol("updateCameraForRadius"),Ib=Symbol("cancelPrompts"),Tb=Symbol("onChange"),Bb=Symbol("onPointerChange"),Rb=Symbol("waitingToPromptUser"),Db=Symbol("userHasInteracted"),Lb=Symbol("promptElementVisibleTime"),Pb=Symbol("lastPromptOffset"),Fb=Symbol("cancellationSource"),Ub=Symbol("lastSpherical"),Nb=Symbol("jumpCamera"),Ob=Symbol("initialized"),kb=Symbol("maintainThetaPhi"),Qb=Symbol("syncCameraOrbit"),Gb=Symbol("syncFieldOfView"),zb=Symbol("syncCameraTarget"),Hb=Symbol("syncMinCameraOrbit"),Vb=Symbol("syncMaxCameraOrbit"),qb=Symbol("syncMinFieldOfView"),jb=Symbol("syncMaxFieldOfView"),Wb=new fn,Xb=new vn,Kb=Object.freeze({minimumRadius:0,maximumRadius:1/0,minimumPolarAngle:0,maximumPolarAngle:Math.PI,minimumAzimuthalAngle:-1/0,maximumAzimuthalAngle:1/0,minimumFieldOfView:10,maximumFieldOfView:45,touchAction:"none"}),Jb=Math.PI/8,Yb=.04,$b={USER_INTERACTION:"user-interaction",NONE:"none",AUTOMATIC:"automatic"};class Zb extends sn{constructor(t,e,i){super(),this.camera=t,this.element=e,this.scene=i,this.orbitSensitivity=1,this.zoomSensitivity=1,this.panSensitivity=1,this.inputSensitivity=1,this.changeSource=$b.NONE,this._interactionEnabled=!1,this._disableZoom=!1,this.isUserPointing=!1,this.enablePan=!0,this.enableTap=!0,this.panProjection=new _n,this.panPerPixel=0,this.spherical=new Pc,this.goalSpherical=new Pc,this.thetaDamper=new jm,this.phiDamper=new jm,this.radiusDamper=new jm,this.logFov=Math.log(Kb.maximumFieldOfView),this.goalLogFov=this.logFov,this.fovDamper=new jm,this.touchMode=null,this.pointers=[],this.startTime=0,this.startPointerPosition={clientX:0,clientY:0},this.lastSeparation=0,this.touchDecided=!1,this.onContext=t=>{if(this.enablePan)t.preventDefault();else for(const t of this.pointers)this.onPointerUp(new PointerEvent("pointercancel",Object.assign(Object.assign({},this.startPointerPosition),{pointerId:t.id})))},this.touchModeZoom=(t,e)=>{if(!this._disableZoom){const t=this.twoTouchDistance(this.pointers[0],this.pointers[1]),e=Yb*this.zoomSensitivity*(this.lastSeparation-t)*50/this.scene.height;this.lastSeparation=t,this.userAdjustOrbit(0,0,e)}this.panPerPixel>0&&this.movePan(t,e)},this.disableScroll=t=>{t.preventDefault()},this.touchModeRotate=(t,e)=>{const{touchAction:i}=this._options;if(!this.touchDecided&&"none"!==i){this.touchDecided=!0;const n=Math.abs(t),r=Math.abs(e);if(this.changeSource===$b.USER_INTERACTION&&("pan-y"===i&&r>n||"pan-x"===i&&n>r))return void(this.touchMode=null);this.element.addEventListener("touchmove",this.disableScroll,{passive:!1})}this.handleSinglePointerMove(t,e)},this.onPointerDown=t=>{if(this.pointers.length>2)return;const{element:e}=this;0===this.pointers.length&&(e.addEventListener("pointermove",this.onPointerMove),e.addEventListener("pointerup",this.onPointerUp),this.touchMode=null,this.touchDecided=!1,this.startPointerPosition.clientX=t.clientX,this.startPointerPosition.clientY=t.clientY,this.startTime=performance.now());try{e.setPointerCapture(t.pointerId)}catch(t){}this.pointers.push({clientX:t.clientX,clientY:t.clientY,id:t.pointerId}),this.isUserPointing=!1,"touch"===t.pointerType?(this.changeSource=t.altKey?$b.AUTOMATIC:$b.USER_INTERACTION,this.onTouchChange(t)):(this.changeSource=$b.USER_INTERACTION,this.onMouseDown(t)),this.changeSource===$b.USER_INTERACTION&&this.dispatchEvent({type:"user-interaction"})},this.onPointerMove=t=>{const e=this.pointers.find(e=>e.id===t.pointerId);if(null==e)return;if("mouse"===t.pointerType&&0===t.buttons)return void this.onPointerUp(t);const i=this.pointers.length,n=(t.clientX-e.clientX)/i,r=(t.clientY-e.clientY)/i;0===n&&0===r||(e.clientX=t.clientX,e.clientY=t.clientY,"touch"===t.pointerType?(this.changeSource=t.altKey?$b.AUTOMATIC:$b.USER_INTERACTION,null!==this.touchMode&&this.touchMode(n,r)):(this.changeSource=$b.USER_INTERACTION,this.panPerPixel>0?this.movePan(n,r):this.handleSinglePointerMove(n,r)))},this.onPointerUp=t=>{const{element:e}=this,i=this.pointers.findIndex(e=>e.id===t.pointerId);-1!==i&&this.pointers.splice(i,1),this.panPerPixel>0&&!t.altKey&&this.resetRadius(),0===this.pointers.length?(e.removeEventListener("pointermove",this.onPointerMove),e.removeEventListener("pointerup",this.onPointerUp),e.removeEventListener("touchmove",this.disableScroll),this.enablePan&&this.enableTap&&this.recenter(t)):null!==this.touchMode&&this.onTouchChange(t),this.scene.element[vb].style.opacity=0,e.style.cursor="grab",this.panPerPixel=0,this.isUserPointing&&this.dispatchEvent({type:"pointer-change-end"})},this.onWheel=t=>{this.changeSource=$b.USER_INTERACTION;const e=t.deltaY*(1==t.deltaMode?18:1)*Yb*this.zoomSensitivity/30;this.userAdjustOrbit(0,0,e),t.preventDefault(),this.dispatchEvent({type:"user-interaction"})},this.onKeyDown=t=>{const{changeSource:e}=this;this.changeSource=$b.USER_INTERACTION;(t.shiftKey&&this.enablePan?this.panKeyCodeHandler(t):this.orbitZoomKeyCodeHandler(t))?(t.preventDefault(),this.dispatchEvent({type:"user-interaction"})):this.changeSource=e},this._options=Object.assign({},Kb),this.setOrbit(0,Math.PI/2,1),this.setFieldOfView(100),this.jumpToGoal()}get interactionEnabled(){return this._interactionEnabled}enableInteraction(){if(!1===this._interactionEnabled){const{element:t}=this;t.addEventListener("pointerdown",this.onPointerDown),t.addEventListener("pointercancel",this.onPointerUp),this._disableZoom||t.addEventListener("wheel",this.onWheel),t.addEventListener("keydown",this.onKeyDown),t.addEventListener("touchmove",()=>{},{passive:!1}),t.addEventListener("contextmenu",this.onContext),this.element.style.cursor="grab",this._interactionEnabled=!0,this.updateTouchActionStyle()}}disableInteraction(){if(!0===this._interactionEnabled){const{element:t}=this;t.removeEventListener("pointerdown",this.onPointerDown),t.removeEventListener("pointermove",this.onPointerMove),t.removeEventListener("pointerup",this.onPointerUp),t.removeEventListener("pointercancel",this.onPointerUp),t.removeEventListener("wheel",this.onWheel),t.removeEventListener("keydown",this.onKeyDown),t.removeEventListener("contextmenu",this.onContext),t.style.cursor="",this.touchMode=null,this._interactionEnabled=!1,this.updateTouchActionStyle()}}get options(){return this._options}set disableZoom(t){this._disableZoom!=t&&(this._disableZoom=t,!0===t?this.element.removeEventListener("wheel",this.onWheel):this.element.addEventListener("wheel",this.onWheel),this.updateTouchActionStyle())}getCameraSpherical(t=new Pc){return t.copy(this.spherical)}getFieldOfView(){return this.camera.fov}applyOptions(t){Object.assign(this._options,t),this.setOrbit(),this.setFieldOfView(Math.exp(this.goalLogFov))}updateNearFar(t,e){this.camera.far=0===e?2:e,this.camera.near=Math.max(t,this.camera.far/1e3),this.camera.updateProjectionMatrix()}updateAspect(t){this.camera.aspect=t,this.camera.updateProjectionMatrix()}setOrbit(t=this.goalSpherical.theta,e=this.goalSpherical.phi,i=this.goalSpherical.radius){const{minimumAzimuthalAngle:n,maximumAzimuthalAngle:r,minimumPolarAngle:s,maximumPolarAngle:a,minimumRadius:o,maximumRadius:l}=this._options,{theta:c,phi:h,radius:u}=this.goalSpherical,d=jd(t,n,r);isFinite(n)||isFinite(r)||(this.spherical.theta=this.wrapAngle(this.spherical.theta-d)+d);const p=jd(e,s,a),A=jd(i,o,l);return(d!==c||p!==h||A!==u)&&(!!(isFinite(d)&&isFinite(p)&&isFinite(A))&&(this.goalSpherical.theta=d,this.goalSpherical.phi=p,this.goalSpherical.radius=A,this.goalSpherical.makeSafe(),!0))}setRadius(t){this.goalSpherical.radius=t,this.setOrbit()}setFieldOfView(t){const{minimumFieldOfView:e,maximumFieldOfView:i}=this._options;t=jd(t,e,i),this.goalLogFov=Math.log(t)}setDamperDecayTime(t){this.thetaDamper.setDecayTime(t),this.phiDamper.setDecayTime(t),this.radiusDamper.setDecayTime(t),this.fovDamper.setDecayTime(t)}adjustOrbit(t,e,i){const{theta:n,phi:r,radius:s}=this.goalSpherical,{minimumRadius:a,maximumRadius:o,minimumFieldOfView:l,maximumFieldOfView:c}=this._options,h=this.spherical.theta-n,u=Math.PI-.001,d=n-jd(t,-u-h,u-h),p=r-e,A=0===i?0:((i>0?o:a)-s)/(Math.log(i>0?c:l)-this.goalLogFov),g=s+i*(isFinite(A)?A:2*(o-a));if(this.setOrbit(d,p,g),0!==i){const t=this.goalLogFov+i;this.setFieldOfView(Math.exp(t))}}jumpToGoal(){this.update(0,1e4)}update(t,e){if(this.isStationary())return!1;const{maximumPolarAngle:i,maximumRadius:n}=this._options,r=this.spherical.theta-this.goalSpherical.theta;return Math.abs(r)>Math.PI&&!isFinite(this._options.minimumAzimuthalAngle)&&!isFinite(this._options.maximumAzimuthalAngle)&&(this.spherical.theta-=2*Math.sign(r)*Math.PI),this.spherical.theta=this.thetaDamper.update(this.spherical.theta,this.goalSpherical.theta,e,Math.PI),this.spherical.phi=this.phiDamper.update(this.spherical.phi,this.goalSpherical.phi,e,i),this.spherical.radius=this.radiusDamper.update(this.spherical.radius,this.goalSpherical.radius,e,n),this.logFov=this.fovDamper.update(this.logFov,this.goalLogFov,e,1),this.moveCamera(),!0}updateTouchActionStyle(){const{style:t}=this.element;if(this._interactionEnabled){const{touchAction:e}=this._options;this._disableZoom&&"none"!==e?t.touchAction="manipulation":t.touchAction=e}else t.touchAction=""}isStationary(){return this.goalSpherical.theta===this.spherical.theta&&this.goalSpherical.phi===this.spherical.phi&&this.goalSpherical.radius===this.spherical.radius&&this.goalLogFov===this.logFov}moveCamera(){this.spherical.makeSafe(),this.camera.position.setFromSpherical(this.spherical),this.camera.setRotationFromEuler(new Zn(this.spherical.phi-Math.PI/2,this.spherical.theta,0,"YXZ")),this.camera.fov!==Math.exp(this.logFov)&&(this.camera.fov=Math.exp(this.logFov),this.camera.updateProjectionMatrix())}userAdjustOrbit(t,e,i){this.adjustOrbit(t*this.orbitSensitivity*this.inputSensitivity,e*this.orbitSensitivity*this.inputSensitivity,i*this.inputSensitivity)}wrapAngle(t){const e=(t+Math.PI)/(2*Math.PI);return 2*(e-Math.floor(e))*Math.PI-Math.PI}pixelLengthToSphericalAngle(t){return 2*Math.PI*t/this.scene.height}twoTouchDistance(t,e){const{clientX:i,clientY:n}=t,{clientX:r,clientY:s}=e,a=r-i,o=s-n;return Math.sqrt(a*a+o*o)}handleSinglePointerMove(t,e){const i=this.pixelLengthToSphericalAngle(t),n=this.pixelLengthToSphericalAngle(e);!1===this.isUserPointing&&(this.isUserPointing=!0,this.dispatchEvent({type:"pointer-change-start"})),this.userAdjustOrbit(i,n,0)}initializePan(){const{theta:t,phi:e}=this.spherical,i=t-this.scene.yaw;this.panPerPixel=.018*this.panSensitivity/this.scene.height,this.panProjection.set(-Math.cos(i),-Math.cos(e)*Math.sin(i),0,0,Math.sin(e),0,Math.sin(i),-Math.cos(e)*Math.cos(i),0)}movePan(t,e){const{scene:i}=this,n=Xb.set(t,e,0).multiplyScalar(this.inputSensitivity),r=this.spherical.radius*Math.exp(this.logFov)*this.panPerPixel;n.multiplyScalar(r);const s=i.getTarget();s.add(n.applyMatrix3(this.panProjection)),i.boundingSphere.clampPoint(s,s),i.setTarget(s.x,s.y,s.z)}recenter(t){if(performance.now()>this.startTime+300||Math.abs(t.clientX-this.startPointerPosition.clientX)>2||Math.abs(t.clientY-this.startPointerPosition.clientY)>2)return;const{scene:e}=this,i=e.positionAndNormalFromPoint(e.getNDC(t.clientX,t.clientY));if(null==i){const{cameraTarget:t}=e.element;e.element.cameraTarget="",e.element.cameraTarget=t,this.userAdjustOrbit(0,0,1)}else e.target.worldToLocal(i.position),e.setTarget(i.position.x,i.position.y,i.position.z)}resetRadius(){const{scene:t}=this,e=t.positionAndNormalFromPoint(Wb.set(0,0));if(null==e)return;t.target.worldToLocal(e.position);const i=t.getTarget(),{theta:n,phi:r}=this.spherical,s=n-t.yaw,a=Xb.set(Math.sin(r)*Math.sin(s),Math.cos(r),Math.sin(r)*Math.cos(s)),o=a.dot(e.position.sub(i));i.add(a.multiplyScalar(o)),t.setTarget(i.x,i.y,i.z),this.setOrbit(void 0,void 0,this.goalSpherical.radius-o)}onTouchChange(t){if(1===this.pointers.length)this.touchMode=this.touchModeRotate;else{if(this._disableZoom)return this.touchMode=null,void this.element.removeEventListener("touchmove",this.disableScroll);this.touchMode=this.touchDecided&&null===this.touchMode?null:this.touchModeZoom,this.touchDecided=!0,this.element.addEventListener("touchmove",this.disableScroll,{passive:!1}),this.lastSeparation=this.twoTouchDistance(this.pointers[0],this.pointers[1]),this.enablePan&&null!=this.touchMode&&(this.initializePan(),t.altKey||(this.scene.element[vb].style.opacity=1))}}onMouseDown(t){this.panPerPixel=0,this.enablePan&&(2===t.button||t.ctrlKey||t.metaKey||t.shiftKey)&&(this.initializePan(),this.scene.element[vb].style.opacity=1),this.element.style.cursor="grabbing"}orbitZoomKeyCodeHandler(t){let e=!0;switch(t.key){case"PageUp":this.userAdjustOrbit(0,0,Yb*this.zoomSensitivity);break;case"PageDown":this.userAdjustOrbit(0,0,-.04*this.zoomSensitivity);break;case"ArrowUp":this.userAdjustOrbit(0,-Jb,0);break;case"ArrowDown":this.userAdjustOrbit(0,Jb,0);break;case"ArrowLeft":this.userAdjustOrbit(-Jb,0,0);break;case"ArrowRight":this.userAdjustOrbit(Jb,0,0);break;default:e=!1}return e}panKeyCodeHandler(t){this.initializePan();let e=!0;switch(t.key){case"ArrowUp":this.movePan(0,-10);break;case"ArrowDown":this.movePan(0,10);break;case"ArrowLeft":this.movePan(-10,0);break;case"ArrowRight":this.movePan(10,0);break;default:e=!1}return e}}const tv='<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="#e8eaed">\n <path d="M6.4,19L5,17.6L10.6,12L5,6.4L6.4,5L12,10.6L17.6,5L19,6.4L13.4,12L19,17.6L17.6,19L12,13.4L6.4,19Z"/>\n</svg>',ev='<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="#e8eaed">\n <path d="M7,17V9H5V7H9V17H7ZM11,17V15H13V17H11ZM16,17V9H14V7H18V17H16ZM11,13V11H13V13H11Z"/>\n</svg>',iv='<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="#E1E2E8">\n <defs>\n <clipPath id="clip0">\n <path d="M0,0h24v24h-24z"/>\n </clipPath>\n </defs>\n <g clip-path="url(#clip0)">\n <path d="M12,22C10.75,22 9.575,21.767 8.475,21.3C7.392,20.817 6.442,20.175 5.625,19.375C4.825,18.558 4.183,17.608 3.7,16.525C3.233,15.425 3,14.25 3,13H5C5,14.95 5.675,16.608 7.025,17.975C8.392,19.325 10.05,20 12,20C13.95,20 15.6,19.325 16.95,17.975C18.317,16.608 19,14.95 19,13C19,11.05 18.317,9.4 16.95,8.05C15.6,6.683 13.95,6 12,6H11.85L13.4,7.55L12,9L8,5L12,1L13.4,2.45L11.85,4H12C13.25,4 14.417,4.242 15.5,4.725C16.6,5.192 17.55,5.833 18.35,6.65C19.167,7.45 19.808,8.4 20.275,9.5C20.758,10.583 21,11.75 21,13C21,14.25 20.758,15.425 20.275,16.525C19.808,17.608 19.167,18.558 18.35,19.375C17.55,20.175 16.6,20.817 15.5,21.3C14.417,21.767 13.25,22 12,22Z"/>\n </g>\n</svg>',nv={width:.16,height:.07,cornerRadius:.03,opacity:1,color:0,minDistance:.5,maxDistance:10,baseScale:1,distanceScaleFactor:.3},rv=.05,sv=.01,av=.07,ov=128,lv=Ae;class cv extends mr{constructor(){super(),this.isActualSize=!1,this.preRenderIcons(),this.createPanel(),this.createButtons(),this.opacityDamper=new jm,this.goalOpacity=nv.opacity}createPanel(){const t=this.createPanelShape(),e=new il(t),i=new Ns({color:nv.color,opacity:nv.opacity,transparent:!0});this.panelMesh=new Ks(e,i),this.panelMesh.name="MenuPanel",this.add(this.panelMesh)}createButtons(){this.exitButton=this.createButton("close"),this.exitButton.name="ExitButton",this.exitButton.position.set(av/2,0,sv),this.add(this.exitButton),this.toggleButton=this.createButton("view-real-size"),this.toggleButton.name="ToggleButton",this.toggleButton.position.set(-.035,0,sv),this.add(this.toggleButton)}createPanelShape(){const t=new So,{width:e,height:i,cornerRadius:n}=nv;return t.moveTo(-e/2+n,-i/2),t.lineTo(e/2-n,-i/2),t.quadraticCurveTo(e/2,-i/2,e/2,-i/2+n),t.lineTo(e/2,i/2-n),t.quadraticCurveTo(e/2,i/2,e/2-n,i/2),t.lineTo(-e/2+n,i/2),t.quadraticCurveTo(-e/2,i/2,-e/2,i/2-n),t.lineTo(-e/2,-i/2+n),t.quadraticCurveTo(-e/2,-i/2,-e/2+n,-i/2),t}preRenderIcons(){[{key:"close",svg:tv},{key:"view-real-size",svg:ev},{key:"replay",svg:iv}].forEach(({key:t,svg:e})=>{cv.iconTextures.has(t)||this.createTextureFromSvg(e,t)})}createTextureFromSvg(t,e){const i=document.createElement("canvas");i.width=ov,i.height=ov;const n=i.getContext("2d"),r=new Image,s=new Blob([t],{type:"image/svg+xml"}),a=URL.createObjectURL(s);r.onload=()=>{n.drawImage(r,0,0,ov,ov);const t=new eo(i);t.needsUpdate=!0,t.minFilter=lv,cv.iconTextures.set(e,t),URL.revokeObjectURL(a)},r.src=a}createButton(t){const e=new Ns({transparent:!0}),i=new el(rv,rv),n=new Ks(i,e),r=cv.iconTextures.get(t);if(r)n.material.map=r,n.material.needsUpdate=!0;else{this.createTextureFromSvg("close"===t?tv:"view-real-size"===t?ev:iv,t);const e=()=>{const i=cv.iconTextures.get(t);i?(n.material.map=i,n.material.needsUpdate=!0):setTimeout(e,10)};e()}return n}exitButtonControllerIntersection(t,e){return t.hitFromController(e,this.exitButton)}scaleModeButtonControllerIntersection(t,e){return t.hitFromController(e,this.toggleButton)}handleScaleToggle(t,e,i,n){if(!t)return null;this.isActualSize=!this.isActualSize;const r=this.isActualSize?"replay":"view-real-size";this.updateScaleModeButtonLabel(r);const s=this.isActualSize?1:e;return Math.max(i,Math.min(n,s))}updateScaleModeButtonLabel(t){const e=cv.iconTextures.get(t);e&&(this.toggleButton.material.map=e,this.toggleButton.material.needsUpdate=!0)}updatePosition(t,e){if(!e)return;const i=new vn;e.getWorldPosition(i);const n=e.getSize(),r=Math.min(n.x,n.z),s=Math.max(.5,Math.min(2,r/1)),a=-.2*s,o=.9*s,l=(new vn).copy(t.position).sub(i);l.y=0,l.normalize();const c=(new vn).copy(i).add(new vn(0,a,0)).add(l.multiplyScalar(o));this.position.copy(c);const h=t.position.distanceTo(c),u=Math.max(nv.minDistance,Math.min(nv.maxDistance,h)),d=nv.baseScale+(u-nv.minDistance)*nv.distanceScaleFactor;this.scale.set(d,d,d),this.lookAt(t.position)}set show(t){this.goalOpacity=t?nv.opacity:0}updateOpacity(t){const e=this.panelMesh.material.opacity,i=this.opacityDamper.update(e,this.goalOpacity,t,1);this.traverse(t=>{if(t instanceof Ks){const e=t.material;e.transparent&&(e.opacity=i)}}),this.visible=i>0}dispose(){var t;this.children.forEach(t=>{if(t instanceof Ks){t.geometry&&t.geometry.dispose();(Array.isArray(t.material)?t.material:[t.material]).forEach(t=>{t&&("map"in t&&t.map instanceof eo&&t.map.dispose(),t.dispose())})}}),null===(t=this.parent)||void 0===t||t.remove(this)}}cv.iconTextures=new Map;
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
const hv=.8,uv=150,dv=new vn(0,1,0),pv=.01,Av=.001,gv="not-presenting",mv="session-started",fv="object-placed",bv="failed",vv="tracking",yv="not-tracking",xv=new vn,_v=new bn,Ev=new Hn,Sv=new vn,Cv=new nc(45,1,.1,100),wv=(new Es).setFromPoints([new vn(0,0,0),new vn(0,0,-1)]),Mv="screen-space",Iv="world-space";class Tv extends sn{isWorldSpaceReady(){return this.xrMode===Iv&&this.worldSpaceInitialPlacementDone}constructor(t){super(),this.renderer=t,this.currentSession=null,this.placeOnWall=!1,this.placementBox=null,this.menuPanel=null,this.lastTick=null,this.turntableRotation=null,this.oldShadowIntensity=null,this.frame=null,this.initialHitSource=null,this.transientHitTestSource=null,this.inputSource=null,this._presentedScene=null,this.resolveCleanup=null,this.exitWebXRButtonContainer=null,this.overlay=null,this.xrLight=null,this.xrMode=null,this.xrController1=null,this.xrController2=null,this.selectedXRController=null,this.tracking=!0,this.frames=0,this.initialized=!1,this.oldTarget=new vn,this.placementComplete=!1,this.isTranslating=!1,this.isRotating=!1,this.isTwoHandInteraction=!1,this.lastDragPosition=new vn,this.deltaRotation=new bn,this.scaleLine=new Na(wv),this.firstRatio=0,this.lastAngle=0,this.goalPosition=new vn,this.goalYaw=0,this.goalScale=1,this.xDamper=new jm,this.yDamper=new jm,this.zDamper=new jm,this.yawDamper=new jm,this.pitchDamper=new jm,this.rollDamper=new jm,this.scaleDamper=new jm,this.wasTwoFingering=!1,this.worldSpaceInitialPlacementDone=!1,this.initialModelScale=1,this.minScale=1,this.maxScale=1,this.onExitWebXRButtonContainerClick=()=>this.stopPresenting(),this.onControllerSelectStart=t=>{var e,i,n;const r=this.presentedScene,s=t.target,a=this.menuPanel;if(null!=this.menuPanel.exitButtonControllerIntersection(r,s))return null===(e=this.menuPanel)||void 0===e||e.dispose(),void this.stopPresenting();if(null!=this.menuPanel.scaleModeButtonControllerIntersection(r,s)){const t=this.menuPanel.handleScaleToggle(this.worldSpaceInitialPlacementDone,this.initialModelScale,this.minScale,this.maxScale);return void(null!==t&&(this.goalScale=t))}a&&(a.show=!1);const o=this.placementBox.controllerIntersection(r,s);if(null!=o){const t=(new Gr).setFromObject(r.scenePivot).min.y+.2;if(o.point.y<=t)null!=this.selectedXRController?(this.selectedXRController.userData.line.visible=!1,r.canScale&&this.isWorldSpaceReady()&&(this.isTwoHandInteraction=!0,this.firstRatio=this.controllerSeparation()/r.scenePivot.scale.x,this.scaleLine.visible=!0)):s.attach(r.scenePivot),this.selectedXRController=s,r.setShadowIntensity(.01);else if(s==this.xrController1?this.xrController1.userData.isSelected=!0:s==this.xrController2&&(this.xrController2.userData.isSelected=!0),(null===(i=this.xrController1)||void 0===i?void 0:i.userData.isSelected)&&(null===(n=this.xrController2)||void 0===n?void 0:n.userData.isSelected))r.canScale&&this.isWorldSpaceReady()&&(this.isTwoHandInteraction=!0,this.firstRatio=this.controllerSeparation()/r.scenePivot.scale.x,this.scaleLine.visible=!0);else{const t=s===this.xrController1?this.xrController2:this.xrController1;s.userData.initialX=s.position.x,t.userData.turning=!1,s.userData.turning=!0,s.userData.line.visible=!1}}},this.onControllerSelectEnd=t=>{const e=t.target;if(e.userData.turning=!1,e.userData.line.visible=!0,this.isTwoHandInteraction=!1,this.scaleLine.visible=!1,e==this.xrController1?this.xrController1.userData.isSelected=!1:e==this.xrController2&&(this.xrController2.userData.isSelected=!1),null!=this.selectedXRController&&this.selectedXRController!=e)return;const i=this.presentedScene;i.attach(i.scenePivot),this.selectedXRController=null,this.goalYaw=Math.atan2(i.scenePivot.matrix.elements[8],i.scenePivot.matrix.elements[10]),this.goalPosition.x=i.scenePivot.position.x,this.goalPosition.z=i.scenePivot.position.z,this.isWorldSpaceReady()&&(this.goalPosition.y=i.scenePivot.position.y);this.menuPanel.show=!0},this.onUpdateScene=()=>{null!=this.placementBox&&this.isPresenting&&(this.placementBox.updateFromModelChanges(),this.placementBox.setScreenSpaceMode(this.xrMode===Mv)),this.xrMode!==Mv&&(this.menuPanel&&(this.menuPanel.dispose(),this.menuPanel=null),this.menuPanel=new cv,this.presentedScene.add(this.menuPanel),this.menuPanel.updatePosition(this.presentedScene.getCamera(),this.placementBox))},this.onSelectStart=t=>{const e=this.transientHitTestSource;if(null==e)return;const i=this.frame.getHitTestResultsForTransientInput(e),n=this.presentedScene,r=this.placementBox;if(1===i.length){this.inputSource=t.inputSource;const{axes:e}=this.inputSource.gamepad,i=r.getHit(this.presentedScene,e[0],e[1]);r.show=!0,null!=i?(this.isTranslating=!0,this.lastDragPosition.copy(i)):!1===this.placeOnWall&&(this.isRotating=!0,this.lastAngle=1.5*e[0])}else if(2===i.length){r.show=!0,this.isTwoHandInteraction=!0;const{separation:t,angle:e}=this.fingerPolar(i);return this.lastAngle=e,0===this.firstRatio&&(this.firstRatio=t/n.scenePivot.scale.x),void(n.canScale&&this.setScale(t))}},this.onSelectEnd=()=>{this.isTranslating=!1,this.isRotating=!1,this.isTwoHandInteraction=!1,this.inputSource=null,this.goalPosition.y+=this.placementBox.offsetHeight*this.presentedScene.scale.x,this.placementBox.show=!1},this.onBeforeXRSelect=t=>{const e=t.composedPath();for(const i of e)if(i instanceof HTMLElement){const e=i.tagName.toLowerCase();if("input"===e||"button"===e||"select"===e||"textarea"===e||"a"===e||i.hasAttribute("data-pointer-coalesce")||i.classList.contains("interactive")){t.preventDefault();break}}},this.threeRenderer=t.threeRenderer,this.threeRenderer.xr.enabled=!0}async resolveARSession(){Hd();const t=await navigator.xr.requestSession("immersive-ar",{requiredFeatures:[],optionalFeatures:["hit-test","dom-overlay","light-estimation"],domOverlay:this.overlay?{root:this.overlay}:void 0});return this.threeRenderer.xr.setReferenceSpaceType("local"),await this.threeRenderer.xr.setSession(t),this.threeRenderer.xr.cameraAutoUpdate=!1,t}get presentedScene(){return this._presentedScene}async supportsPresentation(){try{return Hd(),await navigator.xr.isSessionSupported("immersive-ar")}catch(t){return console.warn("Request to present in WebXR denied:"),console.warn(t),console.warn("Falling back to next ar-mode"),!1}}async present(t,e=!1){this.isPresenting&&console.warn("Cannot present while a model is already presenting");let i=new Promise((t,e)=>{requestAnimationFrame(()=>t())});t.setHotspotsVisibility(!1),t.queueRender(),await i,this._presentedScene=t,this.overlay=t.element.shadowRoot.querySelector("div.default"),null!=this.overlay&&this.overlay.addEventListener("beforexrselect",this.onBeforeXRSelect),!0===e&&(this.xrLight=new qm(this.threeRenderer),this.xrLight.addEventListener("estimationstart",()=>{if(!this.isPresenting||null==this.xrLight)return;const t=this.presentedScene;t.add(this.xrLight),t.environment=this.xrLight.environment}));const n=await this.resolveARSession();n.addEventListener("end",()=>{this.postSessionCleanup()},{once:!0});const r=t.element.shadowRoot.querySelector(".slot.exit-webxr-ar-button");r.classList.add("enabled"),r.addEventListener("click",this.onExitWebXRButtonContainerClick),this.exitWebXRButtonContainer=r;const s=await n.requestReferenceSpace("viewer");this.xrMode=n.interactionMode,this.tracking=!0,this.frames=0,this.initialized=!1,this.turntableRotation=t.yaw,this.goalYaw=t.yaw,this.goalScale=1,t.setBackground(null),this.oldShadowIntensity=t.shadowIntensity,t.setShadowIntensity(.01),this.oldTarget.copy(t.getTarget()),t.element.addEventListener("load",this.onUpdateScene);const a=20*Math.PI/180,o=!0===this.placeOnWall?void 0:new XRRay(new DOMPoint(0,0,0),{x:0,y:-Math.sin(a),z:-Math.cos(a)});n.requestHitTestSource({space:s,offsetRay:o}).then(t=>{this.initialHitSource=t}),this.xrMode!==Mv&&(this.setupXRControllers(),this.xDamper.setDecayTime(uv),this.yDamper.setDecayTime(uv),this.zDamper.setDecayTime(uv),this.yawDamper.setDecayTime(uv),this.pitchDamper.setDecayTime(uv),this.rollDamper.setDecayTime(uv),this.scaleDamper.setDecayTime(uv)),this.currentSession=n,this.placementBox=new Jm(t,this.placeOnWall?"back":"bottom"),this.placementBox&&this.placementBox.setScreenSpaceMode(this.xrMode===Mv),this.placementComplete=!1,this.xrMode!==Mv&&(this.menuPanel=new cv,t.add(this.menuPanel),this.menuPanel.updatePosition(t.getCamera(),this.placementBox)),this.lastTick=performance.now(),this.dispatchEvent({type:"status",status:mv})}setupXRControllerLine(t){if(!t.userData.line){const e=new Na(wv);e.name="line",e.scale.z=5,t.userData.turning=!1,t.userData.line=e,t.add(e)}}setupController(t){this.setupXRControllerLine(t),t.addEventListener("selectstart",this.onControllerSelectStart),t.addEventListener("selectend",this.onControllerSelectEnd)}setupXRControllers(){this.xrController1=this.threeRenderer.xr.getController(0),this.xrController2=this.threeRenderer.xr.getController(1),this.setupController(this.xrController1),this.setupController(this.xrController2),this.scaleLine.name="scale line",this.scaleLine.visible=!1,this.xrController1.add(this.scaleLine);const t=this.presentedScene;t.add(this.xrController1),t.add(this.xrController2)}hover(t){if(this.xrMode===Mv||this.selectedXRController==t)return!1;const e=this.presentedScene,i=this.placementBox.controllerIntersection(e,t);return t.userData.line.scale.z=null==i?5:i.distance,null!=i}controllerSeparation(){return this.xrController1.position.distanceTo(this.xrController2.position)}async stopPresenting(){if(!this.isPresenting)return;const t=new Promise(t=>{this.resolveCleanup=t});try{await this.currentSession.end(),await t}catch(t){console.warn("Error while trying to end WebXR AR session"),console.warn(t),this.postSessionCleanup()}}get isPresenting(){return null!=this.presentedScene}get target(){return this.oldTarget}updateTarget(){const t=this.presentedScene;if(null!=t){const e=t.getTarget();this.oldTarget.copy(e),this.placeOnWall?e.z=t.boundingBox.min.z:e.y=t.boundingBox.min.y,t.setTarget(e.x,e.y,e.z)}}cleanupXRController(t){t.userData.turning=!1,t.userData.line.visible=!0,t.removeEventListener("selectstart",this.onControllerSelectStart),t.removeEventListener("selectend",this.onControllerSelectEnd),t.removeFromParent()}postSessionCleanup(){const t=this.currentSession;null!=t&&(t.removeEventListener("selectstart",this.onSelectStart),t.removeEventListener("selectend",this.onSelectEnd),this.currentSession=null);const e=this.presentedScene;if(this._presentedScene=null,null!=e){const{element:t}=e;null!=this.xrLight&&(e.remove(this.xrLight),this.xrLight.dispose(),this.xrLight=null),null!=this.menuPanel&&(this.menuPanel.dispose(),this.menuPanel=null),e.add(e.scenePivot),e.scenePivot.quaternion.set(0,0,0,1),e.scenePivot.position.set(0,0,0),e.scenePivot.scale.set(1,1,1),e.setShadowOffset(0);const i=this.turntableRotation;null!=i&&(e.yaw=i);const n=this.oldShadowIntensity;null!=n&&e.setShadowIntensity(n),e.setEnvironmentAndSkybox(t[Kd],t[Jd]);const r=this.oldTarget;e.setTarget(r.x,r.y,r.z),e.xrCamera=null,e.element.removeEventListener("load",this.onUpdateScene),e.orientHotspots(0);const{width:s,height:a}=t.getBoundingClientRect();e.setSize(s,a),requestAnimationFrame(()=>{e.element.dispatchEvent(new CustomEvent("camera-change",{detail:{source:$b.NONE}}))})}this.renderer.height=0;const i=this.exitWebXRButtonContainer;null!=i&&(i.classList.remove("enabled"),i.removeEventListener("click",this.onExitWebXRButtonContainerClick),this.exitWebXRButtonContainer=null);const n=this.transientHitTestSource;null!=n&&(n.cancel(),this.transientHitTestSource=null);const r=this.initialHitSource;null!=r&&(r.cancel(),this.initialHitSource=null),null!=this.placementBox&&(this.placementBox.dispose(),this.placementBox=null),this.xrMode!==Mv&&(null!=this.xrController1&&(this.cleanupXRController(this.xrController1),this.xrController1=null),null!=this.xrController2&&(this.cleanupXRController(this.xrController2),this.xrController2=null),this.selectedXRController=null,this.scaleLine.visible=!1),this.isTranslating=!1,this.isRotating=!1,this.isTwoHandInteraction=!1,this.lastTick=null,this.turntableRotation=null,this.oldShadowIntensity=null,this.frame=null,this.inputSource=null,null!=this.overlay&&(this.overlay.removeEventListener("beforexrselect",this.onBeforeXRSelect),this.overlay=null),this.worldSpaceInitialPlacementDone=!1,null!=this.resolveCleanup&&this.resolveCleanup(),this.dispatchEvent({type:"status",status:gv})}updateView(t){const e=this.presentedScene,i=this.threeRenderer.xr;i.updateCamera(Cv),e.xrCamera=i.getCamera();const{elements:n}=e.getCamera().matrixWorld;if(e.orientHotspots(Math.atan2(n[1],n[5])),this.initialized||(this.placeInitially(),this.initialized=!0),t.requestViewportScale&&t.recommendedViewportScale){const e=t.recommendedViewportScale;t.requestViewportScale(Math.max(e,.25))}const r=i.getBaseLayer();if(null!=r){const e=r instanceof XRWebGLLayer?r.getViewport(t):i.getBinding().getViewSubImage(r,t).viewport;this.threeRenderer.setViewport(e.x,e.y,e.width,e.height)}}placeInitially(){const t=this.presentedScene,{scenePivot:e,element:i}=t,{position:n}=e,r=t.getCamera(),{width:s,height:a}=this.overlay.getBoundingClientRect();t.setSize(s,a),r.projectionMatrixInverse.copy(r.projectionMatrix).invert();const{theta:o}=i.getCameraOrbit(),l=r.getWorldDirection(xv);if(t.yaw=Math.atan2(-l.x,-l.z)-o,this.goalYaw=t.yaw,this.xrMode!==Iv||this.worldSpaceInitialPlacementDone){if(this.xrMode===Mv){const e=Math.max(1,2*t.boundingSphere.radius);n.copy(r.position).add(l.multiplyScalar(e)),this.updateTarget();const i=t.getTarget();n.add(i).sub(this.oldTarget),this.goalPosition.copy(n)}}else{const{position:i,scale:s}=this.calculateWorldSpaceOptimalPlacement(t,r);this.goalPosition.copy(i),this.goalScale=s,this.initialModelScale=s,n.copy(i),e.scale.set(s,s,s),this.worldSpaceInitialPlacementDone=!0,this.calculateWorldSpaceScaleLimits(t),this.enableWorldSpaceUserInteraction()}if(t.setHotspotsVisibility(!0),this.xrMode===Mv){const{session:t}=this.frame;t.addEventListener("selectstart",this.onSelectStart),t.addEventListener("selectend",this.onSelectEnd),t.requestHitTestSourceForTransientInput({profile:"generic-touchscreen"}).then(t=>{this.transientHitTestSource=t})}}getTouchLocation(){const{axes:t}=this.inputSource.gamepad;let e=this.placementBox.getExpandedHit(this.presentedScene,t[0],t[1]);return null!=e&&(xv.copy(e).sub(this.presentedScene.getCamera().position),xv.length()>10)?null:e}getHitPoint(t){const e=this.threeRenderer.xr.getReferenceSpace(),i=t.getPose(e);if(null==i)return null;const n=Ev.fromArray(i.transform.matrix);return!0===this.placeOnWall&&(this.goalYaw=Math.atan2(n.elements[4],n.elements[6])),n.elements[5]>.75!==this.placeOnWall?Sv.setFromMatrixPosition(n):null}moveToFloor(t){if(this.xrMode===Iv&&!this.worldSpaceInitialPlacementDone)return this.placementBox.show=!1,void this.dispatchEvent({type:"status",status:fv});const e=this.initialHitSource;if(null==e)return;const i=t.getHitTestResults(e);if(0==i.length)return;const n=i[0],r=this.getHitPoint(n);null!=r&&(this.placementBox.show=!0,this.isTranslating||(this.placeOnWall?this.goalPosition.copy(r):this.goalPosition.y=r.y),e.cancel(),this.initialHitSource=null,this.dispatchEvent({type:"status",status:fv}))}fingerPolar(t){const e=t[0].inputSource.gamepad.axes,i=t[1].inputSource.gamepad.axes,n=i[0]-e[0],r=i[1]-e[1],s=Math.atan2(r,n);let a=this.lastAngle-s;return a>Math.PI?a-=2*Math.PI:a<-Math.PI&&(a+=2*Math.PI),{separation:Math.sqrt(n*n+r*r),deltaYaw:a,angle:s}}setScale(t){let e=t/this.firstRatio;e=Math.abs(e-1)<.2?1:e,this.isWorldSpaceReady()&&(e=Math.max(this.minScale,Math.min(this.maxScale,e))),this.goalScale=e}processInput(t){const e=this.transientHitTestSource;if(null==e)return;const i=t.getHitTestResultsForTransientInput(e),n=this.presentedScene,r=n.scenePivot.scale.x;if(2===i.length){if(!this.wasTwoFingering){const{separation:t,angle:e}=this.fingerPolar(i);return this.firstRatio=t/r,this.lastAngle=e,this.wasTwoFingering=!0,void(this.isTwoHandInteraction=!0)}const{separation:t,deltaYaw:e,angle:s}=this.fingerPolar(i);return this.goalYaw+=e,this.lastAngle=s,n.canScale&&this.setScale(t),void(this.isTwoHandInteraction=!0)}if(this.wasTwoFingering&&(this.wasTwoFingering=!1,this.isTwoHandInteraction=!1,this.firstRatio=0),this.isTranslating||this.isTwoHandInteraction||this.isRotating)if(this.isRotating){const t=1.5*this.inputSource.gamepad.axes[0];this.goalYaw+=t-this.lastAngle,this.lastAngle=t}else this.isTranslating&&i.forEach(t=>{if(t.inputSource!==this.inputSource)return;let e=null;if(t.results.length>0&&(e=this.getHitPoint(t.results[0])),null==e&&(e=this.getTouchLocation()),null!=e){if(this.goalPosition.sub(this.lastDragPosition),this.isWorldSpaceReady())console.log("[processInput] Setting goalPosition.y to hit.y:",e.y),this.goalPosition.add(e);else if(!1===this.placeOnWall){const t=e.y-this.lastDragPosition.y;if(t<0){this.placementBox.offsetHeight=t/r,this.presentedScene.setShadowOffset(t);const i=xv.copy(n.getCamera().position),s=-t/(i.y-e.y);i.multiplyScalar(s),e.multiplyScalar(1-s).add(i)}this.goalPosition.add(e)}else this.goalPosition.add(e);this.lastDragPosition.copy(e)}})}applyXRControllerRotation(t,e){if(!t.userData.turning)return;const i=.3*(t.position.x-t.userData.initialX);this.deltaRotation.setFromAxisAngle(dv,i),e.quaternion.multiplyQuaternions(this.deltaRotation,e.quaternion)}handleScalingInXR(t,e){if(this.xrMode===Iv&&!this.worldSpaceInitialPlacementDone)return;if(this.xrController1&&this.xrController2&&this.isTwoHandInteraction){const t=this.controllerSeparation();this.setScale(t),this.scaleLine.scale.z=-t,this.scaleLine.lookAt(this.xrController2.position)}const i=t.scenePivot.scale.x;if(this.goalScale!==i){const n=this.scaleDamper.update(i,this.goalScale,e,1);t.scenePivot.scale.set(n,n,n)}}updatePivotPosition(t,e){const{scenePivot:i}=t,n=this.placementBox,r=t.boundingSphere.radius,s=this.goalPosition,a=i.position;let o=$b.NONE;if(!s.equals(a)){o=$b.USER_INTERACTION;let{x:i,y:l,z:c}=a;if(i=this.xDamper.update(i,s.x,e,r),l=this.yDamper.update(l,s.y,e,r),c=this.zDamper.update(c,s.z,e,r),a.set(i,l,c),this.xrMode===Mv&&!this.isTranslating){const e=s.y-l;this.placementComplete&&!1===this.placeOnWall?(n.offsetHeight=e/t.scenePivot.scale.x,t.setShadowOffset(e)):0===e&&(this.placementComplete=!0,n.show=!1,t.setShadowIntensity(hv))}this.xrMode!==Mv&&s.equals(a)&&t.setShadowIntensity(hv),this.isWorldSpaceReady()&&t.setShadowIntensity(hv)}if(this.xrMode===Iv&&!this.worldSpaceInitialPlacementDone&&this.goalScale!==i.scale.x){const t=this.scaleDamper.update(i.scale.x,this.goalScale,e,1);i.scale.set(t,t,t)}return t.updateTarget(e),o}updateYaw(t,e){_v.setFromAxisAngle(xv.set(0,1,0),this.goalYaw);const i=t.scenePivot.quaternion.angleTo(_v),n=i-this.yawDamper.update(i,0,e,Math.PI);t.scenePivot.quaternion.rotateTowards(_v,n)}updateMenuPanel(t,e,i){this.menuPanel&&(this.menuPanel.updateOpacity(i),this.menuPanel.updatePosition(t.getCamera(),e))}applyXRInputToScene(t){const e=this.presentedScene,i=e.scenePivot,n=this.placementBox;if(this.updatePlacementBoxOpacity(n,t),this.updateTwoHandInteractionState(),this.applyXRControllerRotations(i),this.handleScalingInXR(e,t),i.parent!==e)return void this.updateMenuPanel(e,n,t);const r=this.updatePivotPosition(e,t);this.updateYaw(e,t),this.dispatchCameraChangeEvent(e,r),this.updateMenuPanel(e,n,t)}updatePlacementBoxOpacity(t,e){const i=this.presentedScene.getCamera();t.update(e,i.position);const n=this.hover(this.xrController1),r=this.hover(this.xrController2),s=(n||r)&&!this.isTwoHandInteraction;t.setInteractionState(this.isTranslating||this.isRotating,s)}updateTwoHandInteractionState(){var t,e;const i=(null===(t=this.xrController1)||void 0===t?void 0:t.userData.isSelected)&&(null===(e=this.xrController2)||void 0===e?void 0:e.userData.isSelected);this.isTwoHandInteraction=!!i}applyXRControllerRotations(t){this.isTwoHandInteraction||(this.xrController1&&this.applyXRControllerRotation(this.xrController1,t),this.xrController2&&this.applyXRControllerRotation(this.xrController2,t))}dispatchCameraChangeEvent(t,e){t.element.dispatchEvent(new CustomEvent("camera-change",{detail:{source:e}}))}updateXRControllerHover(){const t=this.hover(this.xrController1),e=this.hover(this.xrController2),i=(t||e)&&!this.isTwoHandInteraction;this.placementBox&&(this.placementBox.setInteractionState(this.isTranslating||this.isRotating,i),this.placementBox.show=i)}enableWorldSpaceUserInteraction(){this.placementBox&&(this.placementBox.show=!0),this.presentedScene&&this.presentedScene.setShadowIntensity(hv)}handleFirstView(t,e){this.xrMode===Iv&&this.worldSpaceInitialPlacementDone||this.moveToFloor(t),this.processInput(t);const i=e-this.lastTick;this.applyXRInputToScene(i),this.renderer.preRender(this.presentedScene,e,i),this.lastTick=e,this.presentedScene.renderShadow(this.threeRenderer)}onWebXRFrame(t,e){this.xrMode!==Mv&&this.updateXRControllerHover(),this.frame=e,++this.frames;const i=this.threeRenderer.xr.getReferenceSpace(),n=e.getViewerPose(i);null==n&&!0===this.tracking&&this.frames>30&&(this.tracking=!1,this.dispatchEvent({type:"tracking",status:yv}));const r=this.presentedScene;if(null==n||null==r||!r.element.loaded)return void this.threeRenderer.clear();!1===this.tracking&&(this.tracking=!0,this.dispatchEvent({type:"tracking",status:vv}));let s=!0;for(const i of n.views)this.updateView(i),s&&(this.handleFirstView(e,t),s=!1),this.threeRenderer.render(r,r.getCamera())}calculateWorldSpaceOptimalPlacement(t,e){const i=t.boundingBox,n={x:(i.max.x-i.min.x)/2,y:(i.max.y-i.min.y)/2,z:(i.max.z-i.min.z)/2},r=.15,s=Math.max(1.65,2*Math.max(n.x,n.z)+r),a=15*Math.PI/180,o=new vn(0,-s*Math.sin(a),-s*Math.cos(a)),l=e.matrixWorld,c=o.clone().applyMatrix4(l),h=Math.max(n.x,n.z)+r,u=n.y,d=.3*s,p=.3*s/Math.max(u,pv),A=d/Math.max(h,pv),g=Math.min(p,A);return{position:c.clone().sub(new vn(0,g*n.y,0)),scale:g}}calculateWorldSpaceScaleLimits(t){const e=t.size,i=Math.max(e.x,e.y,e.z),n=Math.max(Math.min(e.x,e.y,e.z),Av),r=pv/Math.max(i,Av),s=70/Math.max(n,Av);this.minScale=Math.min(r,s,this.goalScale),this.maxScale=Math.max(r,s,this.goalScale)}}
|
|
/* @license
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/const Bv=Symbol("prepared"),Rv=Symbol("prepare"),Dv=Symbol("preparedGLTF"),Lv=Symbol("clone");class Pv{static prepare(t){if(null==t.scene)throw new Error("Model does not have a scene");if(t[Bv])return t;const e=this[Rv](t);return e[Bv]=!0,e}static[Rv](t){const{scene:e}=t,i=[e];return Object.assign(Object.assign({},t),{scene:e,scenes:i})}get parser(){return this[Dv].parser}get animations(){return this[Dv].animations}get scene(){return this[Dv].scene}get scenes(){return this[Dv].scenes}get cameras(){return this[Dv].cameras}get asset(){return this[Dv].asset}get userData(){return this[Dv].userData}constructor(t){this[Dv]=t}clone(){return new(0,this.constructor)(this[Lv]())}dispose(){this.scenes.forEach(t=>{t.traverse(t=>{const e=t;if(!e.material)return;(Array.isArray(e.material)?e.material:[e.material]).forEach(t=>{for(const e in t){const i=t[e];if(i instanceof Nn){const t=i.source.data;null!=t.close&&t.close(),i.dispose()}}t.dispose()}),e.geometry.dispose()})})}[Lv](){const t=this[Dv],e=rp(this.scene);Fv(e,this.scene);const i=[e],n=t.userData?Object.assign({},t.userData):{};return Object.assign(Object.assign({},t),{scene:e,scenes:i,userData:n})}}const Fv=(t,e)=>{Uv(t,e,(t,e)=>{void 0!==e.userData.variantMaterials&&(t.userData.variantMaterials=new Map(e.userData.variantMaterials)),void 0!==e.userData.variantData&&(t.userData.variantData=e.userData.variantData),void 0!==e.userData.originalMaterial&&(t.userData.originalMaterial=e.userData.originalMaterial)})},Uv=(t,e,i)=>{i(t,e);for(let n=0;n<t.children.length;n++)Uv(t.children[n],e.children[n],i)},Nv=Symbol("threeGLTF"),Ov=Symbol("gltf"),kv=Symbol("gltfElementMap"),Qv=Symbol("threeObjectMap"),Gv=Symbol("parallelTraverseThreeScene"),zv=Symbol("correlateOriginalThreeGLTF"),Hv=Symbol("correlateCloneThreeGLTF");class Vv{static from(t,e){return null!=e?this[Hv](t,e):this[zv](t)}static[zv](t){const e=t.parser.json,i=t.parser.associations,n=new Map,r={name:"Default"},s={index:-1};for(const t of i.keys())t instanceof Is&&null==i.get(t)&&(s.index<0&&(null==e.materials&&(e.materials=[]),s.index=e.materials.length,e.materials.push(r)),t.name=r.name,i.set(t,{materials:s.index}));for(const[t,r]of i){r&&(t.userData=t.userData||{},t.userData.associations=r);for(const i in r)if(null!=i&&"primitives"!==i){const s=i,a=(e[s]||[])[r[s]];if(null==a)continue;let o=n.get(a);null==o&&(o=new Set,n.set(a,o)),o.add(t)}}return new Vv(t,e,i,n)}static[Hv](t,e){const i=e.threeGLTF,n=e.gltf,r=JSON.parse(JSON.stringify(n)),s=new Map,a=new Map;for(let n=0;n<i.scenes.length;n++)this[Gv](i.scenes[n],t.scenes[n],(t,i)=>{const n=e.threeObjectMap.get(t);if(null!=n)for(const t in n)if(null!=t&&"primitives"!==t){const e=t,o=n[e],l=r[e][o],c=s.get(i)||{};c[e]=o,s.set(i,c);const h=a.get(l)||new Set;h.add(i),a.set(l,h)}});return new Vv(t,r,s,a)}static[Gv](t,e,i){const n=(t,e)=>{if(i(t,e),t.isObject3D){const r=t,s=e;if(r.material)if(Array.isArray(r.material))for(let t=0;t<r.material.length;++t)i(r.material[t],s.material[t]);else i(r.material,s.material);for(let i=0;i<t.children.length;++i)n(t.children[i],e.children[i])}};n(t,e)}get threeGLTF(){return this[Nv]}get gltf(){return this[Ov]}get gltfElementMap(){return this[kv]}get threeObjectMap(){return this[Qv]}constructor(t,e,i,n){this[Nv]=t,this[Ov]=e,this[kv]=n,this[Qv]=i}}
|
|
/* @license
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/const qv=Symbol("correlatedSceneGraph");class jv extends Pv{static[Rv](t){const e=super[Rv](t);null==e[qv]&&(e[qv]=Vv.from(e));const{scene:i}=e,n=new gs(void 0,1/0);return i.traverse(t=>{t.renderOrder=1e3,t.frustumCulled=!1,t.name||(t.name=t.uuid);const i=t;if(i.material){const{geometry:t}=i;i.castShadow=!0,i.isSkinnedMesh&&(t.boundingSphere=n,t.boundingBox=null);const r=i.material;if(!0===r.isMeshBasicMaterial&&(r.toneMapped=!1),r.shadowSide=0,r.aoMap){const{gltf:i,threeObjectMap:n}=e[qv],s=n.get(r);if(null!=i.materials&&null!=s&&null!=s.materials){const e=i.materials[s.materials];e.occlusionTexture&&0===e.occlusionTexture.texCoord&&null!=t.attributes.uv&&t.setAttribute("uv2",t.attributes.uv)}}}}),e}get correlatedSceneGraph(){return this[Dv][qv]}[Lv](){const t=super[Lv](),e=new Map;return t.scene.traverse(t=>{const i=t;if(i.material){const t=i.material;if(null!=t){if(e.has(t.uuid))return void(i.material=e.get(t.uuid));i.material=t.clone(),e.set(t.uuid,i.material)}}const n=t;void 0!==n.target&&n.add(n.target)}),t[qv]=Vv.from(t,this.correlatedSceneGraph),t}}const Wv=(t,e,i)=>{let n;switch(t){case fe:n=new Uint8ClampedArray(e*i*4);break;case Se:n=new Uint16Array(e*i*4);break;case _e:n=new Uint32Array(e*i*4);break;case be:n=new Int8Array(e*i*4);break;case ve:n=new Int16Array(e*i*4);break;case xe:n=new Int32Array(e*i*4);break;case Ee:n=new Float32Array(e*i*4);break;default:throw new Error("Unsupported data type")}return n};let Xv;class Kv{_renderer;_rendererIsDisposable=!1;_material;_scene;_camera;_quad;_renderTarget;_width;_height;_type;_colorSpace;_supportsReadPixels=!0;constructor(t){this._width=t.width,this._height=t.height,this._type=t.type,this._colorSpace=t.colorSpace;const e={format:Re,depthBuffer:!1,stencilBuffer:!1,type:this._type,colorSpace:this._colorSpace,anisotropy:void 0!==t.renderTargetOptions?.anisotropy?t.renderTargetOptions?.anisotropy:1,generateMipmaps:void 0!==t.renderTargetOptions?.generateMipmaps&&t.renderTargetOptions?.generateMipmaps,magFilter:void 0!==t.renderTargetOptions?.magFilter?t.renderTargetOptions?.magFilter:Ae,minFilter:void 0!==t.renderTargetOptions?.minFilter?t.renderTargetOptions?.minFilter:Ae,samples:void 0!==t.renderTargetOptions?.samples?t.renderTargetOptions?.samples:void 0,wrapS:void 0!==t.renderTargetOptions?.wrapS?t.renderTargetOptions?.wrapS:ce,wrapT:void 0!==t.renderTargetOptions?.wrapT?t.renderTargetOptions?.wrapT:ce};if(this._material=t.material,t.renderer?this._renderer=t.renderer:(this._renderer=Kv.instantiateRenderer(),this._rendererIsDisposable=!0),this._scene=new wr,this._camera=new lc,this._camera.position.set(0,0,10),this._camera.left=-.5,this._camera.right=.5,this._camera.top=.5,this._camera.bottom=-.5,this._camera.updateProjectionMatrix(),!((t,e,i,n)=>{if(void 0!==Xv)return Xv;const r=new Qn(1,1,n);e.setRenderTarget(r);const s=new Ks(new el,new Ns({color:16777215}));e.render(s,i),e.setRenderTarget(null);const a=Wv(t,r.width,r.height);return e.readRenderTargetPixels(r,0,0,r.width,r.height,a),r.dispose(),s.geometry.dispose(),s.material.dispose(),Xv=0!==a[0],Xv})(this._type,this._renderer,this._camera,e)){let t;if(this._type===Se)t=this._renderer.extensions.has("EXT_color_buffer_float")?Ee:void 0;void 0!==t?(console.warn(`This browser does not support reading pixels from ${this._type} RenderTargets, switching to 1015`),this._type=t):(this._supportsReadPixels=!1,console.warn("This browser dos not support toArray or toDataTexture, calls to those methods will result in an error thrown"))}this._quad=new Ks(new el,this._material),this._quad.geometry.computeBoundingBox(),this._scene.add(this._quad),this._renderTarget=new Qn(this.width,this.height,e),this._renderTarget.texture.mapping=void 0!==t.renderTargetOptions?.mapping?t.renderTargetOptions?.mapping:ie}static instantiateRenderer(){const t=new Id;return t.setSize(128,128),t}render=()=>{this._renderer.setRenderTarget(this._renderTarget);try{this._renderer.render(this._scene,this._camera)}catch(t){throw this._renderer.setRenderTarget(null),t}this._renderer.setRenderTarget(null)};toArray(){if(!this._supportsReadPixels)throw new Error("Can't read pixels in this browser");const t=Wv(this._type,this._width,this._height);return this._renderer.readRenderTargetPixels(this._renderTarget,0,0,this._width,this._height,t),t}toDataTexture(t){const e=new la(this.toArray(),this.width,this.height,Re,this._type,t?.mapping||ie,t?.wrapS||ce,t?.wrapT||ce,t?.magFilter||Ae,t?.minFilter||Ae,t?.anisotropy||1,Li);return e.generateMipmaps=void 0!==t?.generateMipmaps&&t?.generateMipmaps,e}disposeOnDemandRenderer(){this._renderer.setRenderTarget(null),this._rendererIsDisposable&&(this._renderer.dispose(),this._renderer.forceContextLoss())}dispose(t){this.disposeOnDemandRenderer(),t&&this.renderTarget.dispose(),this.material instanceof ll&&Object.values(this.material.uniforms).forEach(t=>{t.value instanceof Nn&&t.value.dispose()}),Object.values(this.material).forEach(t=>{t instanceof Nn&&t.dispose()}),this.material.dispose(),this._quad.geometry.dispose()}get width(){return this._width}set width(t){this._width=t,this._renderTarget.setSize(this._width,this._height)}get height(){return this._height}set height(t){this._height=t,this._renderTarget.setSize(this._width,this._height)}get renderer(){return this._renderer}get renderTarget(){return this._renderTarget}set renderTarget(t){this._renderTarget=t,this._width=t.width,this._height=t.height}get material(){return this._material}get type(){return this._type}get colorSpace(){return this._colorSpace}}class Jv extends Error{}class Yv extends Error{}const $v=(t,e,i)=>{const n=new RegExp(`${e}="([^"]*)"`,"i").exec(t);if(n)return n[1];const r=new RegExp(`<${e}[^>]*>([\\s\\S]*?)</${e}>`,"i").exec(t);if(r){const t=r[1].match(/<rdf:li>([^<]*)<\/rdf:li>/g);return t&&3===t.length?t.map(t=>t.replace(/<\/?rdf:li>/g,"")):r[1].trim()}if(void 0!==i)return i;throw new Error(`Can't find ${e} in gainmap metadata`)};class Zv{options;constructor(t){this.options={debug:!(!t||void 0===t.debug)&&t.debug,extractFII:!t||void 0===t.extractFII||t.extractFII,extractNonFII:!t||void 0===t.extractNonFII||t.extractNonFII}}extract(t){return new Promise((e,i)=>{const n=this.options.debug,r=new DataView(t.buffer);if(65496!==r.getUint16(0))return void i(new Error("Not a valid jpeg"));const s=r.byteLength;let a,o=2,l=0;for(;o<s;){if(++l>250)return void i(new Error(`Found no marker after ${l} loops 😵`));if(255!==r.getUint8(o))return void i(new Error(`Not a valid marker at offset 0x${o.toString(16)}, found: 0x${r.getUint8(o).toString(16)}`));if(a=r.getUint8(o+1),n&&console.log(`Marker: ${a.toString(16)}`),226===a){n&&console.log("Found APP2 marker (0xffe2)");const t=o+4;if(1297106432===r.getUint32(t)){const n=t+4;let s;if(18761===r.getUint16(n))s=!1;else{if(19789!==r.getUint16(n))return void i(new Error("No valid endianness marker found in TIFF header"));s=!0}if(42!==r.getUint16(n+2,!s))return void i(new Error("Not valid TIFF data! (no 0x002A marker)"));const a=r.getUint32(n+4,!s);if(a<8)return void i(new Error("Not valid TIFF data! (First offset less than 8)"));const o=n+a,l=r.getUint16(o,!s),c=o+2;let h=0;for(let t=c;t<c+12*l;t+=12)45057===r.getUint16(t,!s)&&(h=r.getUint32(t+8,!s));const u=o+2+12*l+4,d=[];for(let t=u;t<u+16*h;t+=16){const e={MPType:r.getUint32(t,!s),size:r.getUint32(t+4,!s),dataOffset:r.getUint32(t+8,!s),dependantImages:r.getUint32(t+12,!s),start:-1,end:-1,isFII:!1};e.dataOffset?(e.start=n+e.dataOffset,e.isFII=!1):(e.start=0,e.isFII=!0),e.end=e.start+e.size,d.push(e)}if(this.options.extractNonFII&&d.length){const t=new Blob([r]),i=[];for(const e of d){if(e.isFII&&!this.options.extractFII)continue;const n=t.slice(e.start,e.end+1,"image/jpeg");i.push(n)}e(i)}}}o+=2+r.getUint16(o+2)}})}}const ty=async t=>{const e=(t=>{let e;e="undefined"!=typeof TextDecoder?(new TextDecoder).decode(t):t.toString();let i=e.indexOf("<x:xmpmeta");for(;-1!==i;){const t=e.indexOf("x:xmpmeta>",i),n=e.slice(i,t+10);try{const t=$v(n,"hdrgm:GainMapMin","0"),e=$v(n,"hdrgm:GainMapMax"),i=$v(n,"hdrgm:Gamma","1"),r=$v(n,"hdrgm:OffsetSDR","0.015625"),s=$v(n,"hdrgm:OffsetHDR","0.015625"),a=/hdrgm:HDRCapacityMin="([^"]*)"/.exec(n),o=a?a[1]:"0",l=/hdrgm:HDRCapacityMax="([^"]*)"/.exec(n);if(!l)throw new Error("Incomplete gainmap metadata");const c=l[1];return{gainMapMin:Array.isArray(t)?t.map(t=>parseFloat(t)):[parseFloat(t),parseFloat(t),parseFloat(t)],gainMapMax:Array.isArray(e)?e.map(t=>parseFloat(t)):[parseFloat(e),parseFloat(e),parseFloat(e)],gamma:Array.isArray(i)?i.map(t=>parseFloat(t)):[parseFloat(i),parseFloat(i),parseFloat(i)],offsetSdr:Array.isArray(r)?r.map(t=>parseFloat(t)):[parseFloat(r),parseFloat(r),parseFloat(r)],offsetHdr:Array.isArray(s)?s.map(t=>parseFloat(t)):[parseFloat(s),parseFloat(s),parseFloat(s)],hdrCapacityMin:parseFloat(o),hdrCapacityMax:parseFloat(c)}}catch(t){}i=e.indexOf("<x:xmpmeta",t)}})(t);if(!e)throw new Yv("Gain map XMP metadata not found");const i=new Zv({extractFII:!0,extractNonFII:!0}),n=await i.extract(t);if(2!==n.length)throw new Jv("Gain map recovery image not found");return{sdr:new Uint8Array(await n[0].arrayBuffer()),gainMap:new Uint8Array(await n[1].arrayBuffer()),metadata:e}},ey=t=>new Promise((e,i)=>{const n=document.createElement("img");n.onload=()=>{e(n)},n.onerror=t=>{i(t)},n.src=URL.createObjectURL(t)});class iy extends Nl{_renderer;_renderTargetOptions;_internalLoadingManager;_config;constructor(t,e){super(e),this._config=t,t.renderer&&(this._renderer=t.renderer),this._internalLoadingManager=new Fl}setRenderer(t){return this._renderer=t,this}setRenderTargetOptions(t){return this._renderTargetOptions=t,this}prepareQuadRenderer(){this._renderer||console.warn("WARNING: A Renderer was not passed to this Loader constructor or in setRenderer, the result of this Loader will need to be converted to a Data Texture with toDataTexture() before you can use it in your renderer.");const t=this._config.createMaterial({gainMapMax:[1,1,1],gainMapMin:[0,0,0],gamma:[1,1,1],offsetHdr:[1,1,1],offsetSdr:[1,1,1],hdrCapacityMax:1,hdrCapacityMin:0,maxDisplayBoost:1,gainMap:new Nn,sdr:new Nn});return this._config.createQuadRenderer({width:16,height:16,type:Se,colorSpace:Li,material:t,renderer:this._renderer,renderTargetOptions:this._renderTargetOptions})}async processImages(t,e,i){const n=e?new Blob([e],{type:"image/jpeg"}):void 0,r=new Blob([t],{type:"image/jpeg"});let s,a,o=!1;if("undefined"==typeof createImageBitmap){const t=await Promise.all([n?ey(n):Promise.resolve(void 0),ey(r)]);a=t[0],s=t[1],o="flipY"===i}else{const t=await Promise.all([n?createImageBitmap(n,{imageOrientation:i||"flipY"}):Promise.resolve(void 0),createImageBitmap(r,{imageOrientation:i||"flipY"})]);a=t[0],s=t[1]}return{sdrImage:s,gainMapImage:a,needsFlip:o}}createTextures(t,e,i){const n=new Nn(e||new ImageData(2,2),ie,ce,ce,Ae,1008,Re,fe,1,Li);n.flipY=i,n.needsUpdate=!0;const r=new Nn(t,ie,ce,ce,Ae,1008,Re,fe,1,Di);return r.flipY=i,r.needsUpdate=!0,{gainMap:n,sdr:r}}updateQuadRenderer(t,e,i,n,r){t.width=e.width,t.height=e.height,t.material.gainMap=i,t.material.sdr=n,t.material.gainMapMin=r.gainMapMin,t.material.gainMapMax=r.gainMapMax,t.material.offsetHdr=r.offsetHdr,t.material.offsetSdr=r.offsetSdr,t.material.gamma=r.gamma,t.material.hdrCapacityMin=r.hdrCapacityMin,t.material.hdrCapacityMax=r.hdrCapacityMax,t.material.maxDisplayBoost=Math.pow(2,r.hdrCapacityMax),t.material.needsUpdate=!0}}class ny extends ll{_maxDisplayBoost;_hdrCapacityMin;_hdrCapacityMax;constructor({gamma:t,offsetHdr:e,offsetSdr:i,gainMapMin:n,gainMapMax:r,maxDisplayBoost:s,hdrCapacityMin:a,hdrCapacityMax:o,sdr:l,gainMap:c}){super({name:"GainMapDecoderMaterial",vertexShader:"\nvarying vec2 vUv;\n\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",fragmentShader:"\n// min half float value\n#define HALF_FLOAT_MIN vec3( -65504, -65504, -65504 )\n// max half float value\n#define HALF_FLOAT_MAX vec3( 65504, 65504, 65504 )\n\nuniform sampler2D sdr;\nuniform sampler2D gainMap;\nuniform vec3 gamma;\nuniform vec3 offsetHdr;\nuniform vec3 offsetSdr;\nuniform vec3 gainMapMin;\nuniform vec3 gainMapMax;\nuniform float weightFactor;\n\nvarying vec2 vUv;\n\nvoid main() {\n vec3 rgb = texture2D( sdr, vUv ).rgb;\n vec3 recovery = texture2D( gainMap, vUv ).rgb;\n vec3 logRecovery = pow( recovery, gamma );\n vec3 logBoost = gainMapMin * ( 1.0 - logRecovery ) + gainMapMax * logRecovery;\n vec3 hdrColor = (rgb + offsetSdr) * exp2( logBoost * weightFactor ) - offsetHdr;\n vec3 clampedHdrColor = max( HALF_FLOAT_MIN, min( HALF_FLOAT_MAX, hdrColor ));\n gl_FragColor = vec4( clampedHdrColor , 1.0 );\n}\n",uniforms:{sdr:{value:l},gainMap:{value:c},gamma:{value:new vn(1/t[0],1/t[1],1/t[2])},offsetHdr:{value:(new vn).fromArray(e)},offsetSdr:{value:(new vn).fromArray(i)},gainMapMin:{value:(new vn).fromArray(n)},gainMapMax:{value:(new vn).fromArray(r)},weightFactor:{value:(Math.log2(s)-a)/(o-a)}},blending:0,depthTest:!1,depthWrite:!1}),this._maxDisplayBoost=s,this._hdrCapacityMin=a,this._hdrCapacityMax=o,this.needsUpdate=!0,this.uniformsNeedUpdate=!0}get sdr(){return this.uniforms.sdr.value}set sdr(t){this.uniforms.sdr.value=t}get gainMap(){return this.uniforms.gainMap.value}set gainMap(t){this.uniforms.gainMap.value=t}get offsetHdr(){return this.uniforms.offsetHdr.value.toArray()}set offsetHdr(t){this.uniforms.offsetHdr.value.fromArray(t)}get offsetSdr(){return this.uniforms.offsetSdr.value.toArray()}set offsetSdr(t){this.uniforms.offsetSdr.value.fromArray(t)}get gainMapMin(){return this.uniforms.gainMapMin.value.toArray()}set gainMapMin(t){this.uniforms.gainMapMin.value.fromArray(t)}get gainMapMax(){return this.uniforms.gainMapMax.value.toArray()}set gainMapMax(t){this.uniforms.gainMapMax.value.fromArray(t)}get gamma(){const t=this.uniforms.gamma.value;return[1/t.x,1/t.y,1/t.z]}set gamma(t){const e=this.uniforms.gamma.value;e.x=1/t[0],e.y=1/t[1],e.z=1/t[2]}get hdrCapacityMin(){return this._hdrCapacityMin}set hdrCapacityMin(t){this._hdrCapacityMin=t,this.calculateWeight()}get hdrCapacityMax(){return this._hdrCapacityMax}set hdrCapacityMax(t){this._hdrCapacityMax=t,this.calculateWeight()}get maxDisplayBoost(){return this._maxDisplayBoost}set maxDisplayBoost(t){this._maxDisplayBoost=Math.max(1,Math.min(65504,t)),this.calculateWeight()}calculateWeight(){const t=(Math.log2(this._maxDisplayBoost)-this._hdrCapacityMin)/(this._hdrCapacityMax-this._hdrCapacityMin);this.uniforms.weightFactor.value=Math.max(0,Math.min(1,t))}}class ry extends iy{constructor(t,e){super({renderer:t,createMaterial:t=>new ny(t),createQuadRenderer:t=>new Kv(t)},e)}async render(t,e,i,n){const{sdrImage:r,gainMapImage:s,needsFlip:a}=await this.processImages(i,n,"flipY"),{gainMap:o,sdr:l}=this.createTextures(r,s,a);this.updateQuadRenderer(t,r,o,l,e),t.render()}}class sy extends ry{load(t,e,i,n){const r=this.prepareQuadRenderer(),s=new Ql(this._internalLoadingManager);return s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setPath(this.path),s.setWithCredentials(this.withCredentials),this.manager.itemStart(t),s.load(t,async i=>{if("string"==typeof i)throw new Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");const s=new Uint8Array(i);let a,o,l;try{const t=await ty(s);a=t.sdr,o=t.gainMap,l=t.metadata}catch(e){if(!(e instanceof Yv||e instanceof Jv))throw e;console.warn(`Failure to reconstruct an HDR image from ${t}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),l={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},a=s}try{await this.render(r,l,a.buffer,o?.buffer)}catch(e){return this.manager.itemError(t),"function"==typeof n&&n(e),void r.disposeOnDemandRenderer()}"function"==typeof e&&e(r),this.manager.itemEnd(t),r.disposeOnDemandRenderer()},i,e=>{this.manager.itemError(t),"function"==typeof n&&n(e)}),r}}class ay extends Hl{constructor(t){super(t),this.type=Se}parse(t){const e=function(t,e){switch(t){case 1:throw new Error("THREE.HDRLoader: Read Error: "+(e||""));case 2:throw new Error("THREE.HDRLoader: Write Error: "+(e||""));case 3:throw new Error("THREE.HDRLoader: Bad File Format: "+(e||""));default:throw new Error("THREE.HDRLoader: Memory Error: "+(e||""))}},i=function(t,e,i){e=e||1024;let n=t.pos,r=-1,s=0,a="",o=String.fromCharCode.apply(null,new Uint16Array(t.subarray(n,n+128)));for(;0>(r=o.indexOf("\n"))&&s<e&&n<t.byteLength;)a+=o,s+=o.length,n+=128,o+=String.fromCharCode.apply(null,new Uint16Array(t.subarray(n,n+128)));return-1<r&&(t.pos+=s+r+1,a+o.slice(0,r))},n=function(t,e,i,n){const r=t[e+3],s=Math.pow(2,r-128)/255;i[n+0]=t[e+0]*s,i[n+1]=t[e+1]*s,i[n+2]=t[e+2]*s,i[n+3]=1},r=function(t,e,i,n){const r=t[e+3],s=Math.pow(2,r-128)/255;i[n+0]=rs.toHalfFloat(Math.min(t[e+0]*s,65504)),i[n+1]=rs.toHalfFloat(Math.min(t[e+1]*s,65504)),i[n+2]=rs.toHalfFloat(Math.min(t[e+2]*s,65504)),i[n+3]=rs.toHalfFloat(1)},s=new Uint8Array(t);s.pos=0;const a=function(t){const n=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,r=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,s=/^\s*FORMAT=(\S+)\s*$/,a=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,o={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let l,c;for((t.pos>=t.byteLength||!(l=i(t)))&&e(1,"no header found"),(c=l.match(/^#\?(\S+)/))||e(3,"bad initial token"),o.valid|=1,o.programtype=c[1],o.string+=l+"\n";l=i(t),!1!==l;)if(o.string+=l+"\n","#"!==l.charAt(0)){if((c=l.match(n))&&(o.gamma=parseFloat(c[1])),(c=l.match(r))&&(o.exposure=parseFloat(c[1])),(c=l.match(s))&&(o.valid|=2,o.format=c[1]),(c=l.match(a))&&(o.valid|=4,o.height=parseInt(c[1],10),o.width=parseInt(c[2],10)),2&o.valid&&4&o.valid)break}else o.comments+=l+"\n";return 2&o.valid||e(3,"missing format specifier"),4&o.valid||e(3,"missing image size specifier"),o}(s),o=a.width,l=a.height,c=function(t,i,n){const r=i;if(r<8||r>32767||2!==t[0]||2!==t[1]||128&t[2])return new Uint8Array(t);r!==(t[2]<<8|t[3])&&e(3,"wrong scanline width");const s=new Uint8Array(4*i*n);s.length||e(4,"unable to allocate buffer space");let a=0,o=0;const l=4*r,c=new Uint8Array(4),h=new Uint8Array(l);let u=n;for(;u>0&&o<t.byteLength;){o+4>t.byteLength&&e(1),c[0]=t[o++],c[1]=t[o++],c[2]=t[o++],c[3]=t[o++],2==c[0]&&2==c[1]&&(c[2]<<8|c[3])==r||e(3,"bad rgbe scanline format");let i,n=0;for(;n<l&&o<t.byteLength;){i=t[o++];const r=i>128;if(r&&(i-=128),(0===i||n+i>l)&&e(3,"bad scanline data"),r){const e=t[o++];for(let t=0;t<i;t++)h[n++]=e}else h.set(t.subarray(o,o+i),n),n+=i,o+=i}const d=r;for(let t=0;t<d;t++){let e=0;s[a]=h[t+e],e+=r,s[a+1]=h[t+e],e+=r,s[a+2]=h[t+e],e+=r,s[a+3]=h[t+e],a+=4}u--}return s}(s.subarray(s.pos),o,l);let h,u,d;switch(this.type){case Ee:d=c.length/4;const t=new Float32Array(4*d);for(let e=0;e<d;e++)n(c,4*e,t,4*e);h=t,u=Ee;break;case Se:d=c.length/4;const e=new Uint16Array(4*d);for(let t=0;t<d;t++)r(c,4*t,e,4*t);h=e,u=Se;break;default:throw new Error("THREE.HDRLoader: Unsupported type: "+this.type)}return{width:o,height:l,data:h,header:a.string,gamma:a.gamma,exposure:a.exposure,type:u}}setDataType(t){return this.type=t,this}load(t,e,i,n){return super.load(t,function(t,i){switch(t.type){case Ee:case Se:t.colorSpace=Li,t.minFilter=Ae,t.magFilter=Ae,t.generateMipmaps=!1,t.flipY=!0}e&&e(t,i)},i,n)}}class oy extends ay{constructor(t){console.warn("RGBELoader has been deprecated. Please use HDRLoader instead."),super(t)}}
|
|
/* @license
|
|
* Copyright 2021 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/const ly={topLight:{intensity:500,position:[.418,16.199,.3]},room:{position:[-.757,13.219,.717],scale:[31.713,28.305,28.591]},boxes:[{position:[-10.906,2.009,1.846],rotation:-.195,scale:[2.328,7.905,4.651]},{position:[-5.607,-.754,-.758],rotation:.994,scale:[1.97,1.534,3.955]},{position:[6.167,.857,7.803],rotation:.561,scale:[3.927,6.285,3.687]},{position:[-2.017,.018,6.124],rotation:.333,scale:[2.002,4.566,2.064]},{position:[2.291,-.756,-2.621],rotation:-.286,scale:[1.546,1.552,1.496]},{position:[-2.193,-.369,-5.547],rotation:.516,scale:[3.875,3.487,2.986]}],lights:[{intensity:50,position:[-16.116,14.37,8.208],scale:[.1,2.428,2.739]},{intensity:50,position:[-16.109,18.021,-8.207],scale:[.1,2.425,2.751]},{intensity:17,position:[14.904,12.198,-1.832],scale:[.15,4.265,6.331]},{intensity:43,position:[-.462,8.89,14.52],scale:[4.38,5.441,.088]},{intensity:20,position:[3.235,11.486,-12.541],scale:[2.5,2,.1]},{intensity:100,position:[0,20,0],scale:[1,.1,1]}]},cy={topLight:{intensity:400,position:[.5,14,.5]},room:{position:[0,13.2,0],scale:[31.5,28.5,31.5]},boxes:[{position:[-10.906,-1,1.846],rotation:-.195,scale:[2.328,7.905,4.651]},{position:[-5.607,-.754,-.758],rotation:.994,scale:[1.97,1.534,3.955]},{position:[6.167,-.16,7.803],rotation:.561,scale:[3.927,6.285,3.687]},{position:[-2.017,.018,6.124],rotation:.333,scale:[2.002,4.566,2.064]},{position:[2.291,-.756,-2.621],rotation:-.286,scale:[1.546,1.552,1.496]},{position:[-2.193,-.369,-5.547],rotation:.516,scale:[3.875,3.487,2.986]}],lights:[{intensity:80,position:[-14,10,8],scale:[.1,2.5,2.5]},{intensity:80,position:[-14,14,-4],scale:[.1,2.5,2.5]},{intensity:23,position:[14,12,0],scale:[.1,5,5]},{intensity:16,position:[0,9,14],scale:[5,5,.1]},{intensity:80,position:[7,8,-14],scale:[2.5,2.5,.1]},{intensity:80,position:[-7,16,-14],scale:[2.5,2.5,.1]},{intensity:1,position:[0,20,0],scale:[.1,.1,.1]}]};class hy extends wr{constructor(t){super(),this.position.y=-3.5;const e=new so;e.deleteAttribute("uv");const i=new hl({metalness:0,side:1}),n=new hl({metalness:0}),r="legacy"==t?ly:cy,s=new oc(16777215,r.topLight.intensity,28,2);s.position.set(...r.topLight.position),this.add(s);const a=new Ks(e,i);a.position.set(...r.room.position),a.scale.set(...r.room.scale),this.add(a);for(const t of r.boxes){const i=new Ks(e,n);i.position.set(...t.position),i.rotation.set(0,t.rotation,0),i.scale.set(...t.scale),this.add(i)}for(const t of r.lights){const i=new Ks(e,this.createAreaLightMaterial(t.intensity));i.position.set(...t.position),i.scale.set(...t.scale),this.add(i)}}createAreaLightMaterial(t){const e=new Ns;return e.color.setScalar(t),e}}
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/const uy=20,dy=/\.hdr(\.js)?$/,py=/\.ktx2(\?|#|$)/;class Ay{constructor(t){this.threeRenderer=t,this.lottieLoaderUrl="",this._ldrLoader=null,this._imageLoader=null,this._hdrLoader=null,this._lottieLoader=null,this.generatedEnvironmentMap=null,this.generatedEnvironmentMapAlt=null,this.skyboxCache=new Map,this.blurMaterial=null,this.blurScene=null}ldrLoader(t){return null==this._ldrLoader&&(this._ldrLoader=new Vl),this._ldrLoader.setWithCredentials(t),this._ldrLoader}imageLoader(t){return null==this._imageLoader&&(this._imageLoader=new sy(this.threeRenderer)),this._imageLoader.setWithCredentials(t),this._imageLoader}hdrLoader(t){return null==this._hdrLoader&&(this._hdrLoader=new oy,this._hdrLoader.setDataType(Se)),this._hdrLoader.setWithCredentials(t),this._hdrLoader}async getLottieLoader(t){if(null==this._lottieLoader){const{LottieLoader:t}=await import(this.lottieLoaderUrl);this._lottieLoader=new t}return this._lottieLoader.setWithCredentials(t),this._lottieLoader}async loadImage(t,e,i){if("image/ktx2"===i||py.test(t))return this.loadKTX2(t,e);const n=await new Promise((i,n)=>this.ldrLoader(e).load(t,i,()=>{},n));return n.name=t,n.flipY=!1,n}async loadKTX2(t,e){Ig.setWithCredentials(e);const i=await new Promise((e,i)=>Ig.load(t,e,()=>{},i));return i.name=t,i.flipY=!1,i}async loadLottie(t,e,i){const n=await this.getLottieLoader(i);n.setQuality(e);const r=await new Promise((e,i)=>n.load(t,e,()=>{},i));return r.name=t,r}async loadEquirect(t,e=!1,i=()=>{}){try{const n=dy.test(t),r=n?this.hdrLoader(e):this.imageLoader(e),s=await new Promise((e,n)=>r.load(t,t=>{const{renderTarget:i}=t;if(null!=i){let n;try{const e=t.toDataTexture();e.needsUpdate=!0;const r=e.image.data;let s=!1;const a=r.length;for(let t=0;t<a;t++)if(0!==r[t]){s=!0;break}s?(n=e,t.dispose(!0)):(console.warn("Decoded DataTexture is completely black, falling back to render target texture."),n=i.texture,t.dispose(!1))}catch(e){console.warn("Failed to convert gainmap to DataTexture, falling back to render target texture:",e),n=i.texture,t.dispose(!1)}e(n)}else e(t)},t=>{i(t.loaded/t.total*.9)},n));return i(1),s.name=t,s.mapping=se,n||s.type===Se||(s.colorSpace=Di),s}finally{i&&i(1)}}async generateEnvironmentMapAndSkybox(t=null,e=null,i=()=>{},n=!1){const r="legacy"!==e;"legacy"!==e&&"neutral"!==e||(e=null),e=zd(e);let s,a=Promise.resolve(null);t&&(a=this.loadEquirectFromUrl(t,n,i)),s=e?this.loadEquirectFromUrl(e,n,i):t?this.loadEquirectFromUrl(t,n,i):r?this.loadGeneratedEnvironmentMapAlt():this.loadGeneratedEnvironmentMap();const[o,l]=await Promise.all([s,a]);if(null==o)throw new Error("Failed to load environment map.");return{environmentMap:o,skybox:l}}async loadEquirectFromUrl(t,e,i){if(!this.skyboxCache.has(t)){const n=this.loadEquirect(t,e,i);this.skyboxCache.set(t,n)}return this.skyboxCache.get(t)}async GenerateEnvironmentMap(t,e){await((t=0)=>new Promise(e=>setTimeout(e,t)))();const i=this.threeRenderer,n=new hh(256,{generateMipmaps:!1,type:Se,format:Re,colorSpace:Li,depthBuffer:!0}),r=new fc(.1,100,n),s=r.renderTarget.texture;s.name=e;const a=i.outputColorSpace,o=i.toneMapping;return i.toneMapping=0,i.outputColorSpace=Li,r.update(i,t),this.blurCubemap(n,.04),i.toneMapping=o,i.outputColorSpace=a,s}async loadGeneratedEnvironmentMap(){return null==this.generatedEnvironmentMap&&(this.generatedEnvironmentMap=this.GenerateEnvironmentMap(new hy("legacy"),"legacy")),this.generatedEnvironmentMap}async loadGeneratedEnvironmentMapAlt(){return null==this.generatedEnvironmentMapAlt&&(this.generatedEnvironmentMapAlt=this.GenerateEnvironmentMap(new hy("neutral"),"neutral")),this.generatedEnvironmentMapAlt}blurCubemap(t,e){if(null==this.blurMaterial){this.blurMaterial=this.getBlurShader(uy);const t=new so,e=new Ks(t,this.blurMaterial);this.blurScene=new wr,this.blurScene.add(e)}const i=t.clone();this.halfblur(t,i,e,"latitudinal"),this.halfblur(i,t,e,"longitudinal")}halfblur(t,e,i,n){const r=t.width,s=isFinite(i)?Math.PI/(2*r):2*Math.PI/39,a=i/s,o=isFinite(i)?1+Math.floor(3*a):uy;o>uy&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${o} samples when the maximum is set to 20`);const l=[];let c=0;for(let t=0;t<uy;++t){const e=t/a,i=Math.exp(-e*e/2);l.push(i),0==t?c+=i:t<o&&(c+=2*i)}for(let t=0;t<l.length;t++)l[t]=l[t]/c;const h=this.blurMaterial.uniforms;h.envMap.value=t.texture,h.samples.value=o,h.weights.value=l,h.latitudinal.value="latitudinal"===n,h.dTheta.value=s;new fc(.1,100,e).update(this.threeRenderer,this.blurScene)}getBlurShader(t){const e=new Float32Array(t),i=new vn(0,1,0);return new ll({name:"SphericalGaussianBlur",defines:{n:t},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:e},latitudinal:{value:!1},dTheta:{value:0},poleAxis:{value:i}},vertexShader:"\n \n varying vec3 vOutputDirection;\n \n void main() {\n \n vOutputDirection = vec3( position );\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n \n }\n ",fragmentShader:"\n varying vec3 vOutputDirection;\n \n uniform samplerCube envMap;\n uniform int samples;\n uniform float weights[ n ];\n uniform bool latitudinal;\n uniform float dTheta;\n uniform vec3 poleAxis;\n \n vec3 getSample( float theta, vec3 axis ) {\n \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 \n return vec3( textureCube( envMap, sampleDirection ) );\n \n }\n \n void main() {\n \n vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n \n if ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n \n axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n \n }\n \n axis = normalize( axis );\n \n gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n \n for ( int i = 1; i < n; i++ ) {\n \n if ( i >= samples ) {\n \n break;\n \n }\n \n float theta = dTheta * float( i );\n gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n \n }\n }\n ",blending:0,depthTest:!1,depthWrite:!1,side:1})}async dispose(){for(const[,t]of this.skyboxCache){(await t).dispose()}null!=this.generatedEnvironmentMap&&((await this.generatedEnvironmentMap).dispose(),this.generatedEnvironmentMap=null),null!=this.generatedEnvironmentMapAlt&&((await this.generatedEnvironmentMapAlt).dispose(),this.generatedEnvironmentMapAlt=null),null!=this.blurMaterial&&this.blurMaterial.dispose()}}
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/const gy=[1,.79,.62,.5,.4,.31,.25],my="high-performance";class fy extends sn{static get singleton(){return this._singleton||(this._singleton=new fy({powerPreference:(self.ModelViewerElement||{}).powerPreference||my,debug:Wd()})),this._singleton}static resetSingleton(){const t=this._singleton.dispose();for(const e of t)e.disconnectedCallback();this._singleton=new fy({powerPreference:(self.ModelViewerElement||{}).powerPreference||my,debug:Wd()});for(const e of t)e.connectedCallback()}get canRender(){return null!=this.threeRenderer}get scaleFactor(){return gy[this.scaleStep]}set minScale(t){let e=1;for(;e<gy.length&&!(gy[e]<t);)++e;this.lastStep=e-1}constructor(t){super(),this.loader=new Pg(jv),this.width=0,this.height=0,this.dpr=1,this.scenes=new Set,this.multipleScenesVisible=!1,this.lastTick=performance.now(),this.renderedLastFrame=!1,this.scaleStep=0,this.lastStep=3,this.avgFrameDuration=50,this.onWebGLContextLost=t=>{this.dispatchEvent({type:"contextlost",sourceEvent:t})},this.onWebGLContextRestored=()=>{var t;null===(t=this.textureUtils)||void 0===t||t.dispose(),this.textureUtils=this.canRender?new Ay(this.threeRenderer):null;for(const t of this.scenes)t.element[Yd]()},this.dpr=window.devicePixelRatio,this.canvas3D=document.createElement("canvas"),this.canvas3D.id="webgl-canvas",this.canvas3D.classList.add("show");try{this.threeRenderer=new Id({canvas:this.canvas3D,alpha:!0,antialias:!0,powerPreference:t.powerPreference,preserveDrawingBuffer:!0}),this.threeRenderer.autoClear=!0,this.threeRenderer.setPixelRatio(1),this.threeRenderer.debug={checkShaderErrors:!!t.debug,onShaderError:null},this.threeRenderer.toneMapping=7}catch(t){console.warn(t)}this.arRenderer=this.canRender?new Tv(this):null,this.textureUtils=this.canRender?new Ay(this.threeRenderer):null,this.canRender&&Pg.initializeKTX2Loader(this.threeRenderer),this.canvas3D.addEventListener("webglcontextlost",this.onWebGLContextLost),this.canvas3D.addEventListener("webglcontextrestored",this.onWebGLContextRestored),this.updateRendererSize()}registerScene(t){if(this.scenes.add(t),t.forceRescale(),this.canRender){const e=new fn;this.threeRenderer.getSize(e),t.canvas.width=e.x,t.canvas.height=e.y,this.scenes.size>0&&this.threeRenderer.setAnimationLoop((t,e)=>this.render(t,e))}}unregisterScene(t){this.scenes.delete(t),this.canvas3D.parentElement===t.canvas.parentElement&&t.canvas.parentElement.removeChild(this.canvas3D),this.canRender&&0===this.scenes.size&&this.threeRenderer.setAnimationLoop(null)}displayCanvas(t){return t.element.modelIsVisible&&!this.multipleScenesVisible?this.canvas3D:t.element[dE]}countVisibleScenes(){const{canvas3D:t}=this;let e=0,i=null;for(const n of this.scenes){const{element:r}=n;r.modelIsVisible&&null==n.externalRenderer&&++e,t.parentElement===n.canvas.parentElement&&(i=n)}const n=e>1;if(null!=i){const e=n&&!this.multipleScenesVisible,r=!i.element.modelIsVisible;if(e||r){const{width:e,height:n}=this.sceneSize(i);this.copyPixels(i,e,n),t.parentElement.removeChild(t)}}this.multipleScenesVisible=n}updateRendererSize(){var t;const e=window.devicePixelRatio;if(e!==this.dpr)for(const t of this.scenes){const{element:e}=t;e[Z_](e.getBoundingClientRect())}let i=0,n=0;for(const t of this.scenes)i=Math.max(i,t.width),n=Math.max(n,t.height);if(i!==this.width||n!==this.height||e!==this.dpr){this.width=i,this.height=n,this.dpr=e,i=Math.ceil(i*e),n=Math.ceil(n*e),this.canRender&&this.threeRenderer.setSize(i,n,!1);for(const e of this.scenes){const{canvas:r}=e;r.width=i,r.height=n,e.forceRescale(),null===(t=e.effectRenderer)||void 0===t||t.setSize(i,n)}}}updateRendererScale(t){const e=this.scaleStep;this.avgFrameDuration+=jd(.2*(t-this.avgFrameDuration),-5,5),this.avgFrameDuration>60?++this.scaleStep:this.avgFrameDuration<40&&this.scaleStep>0&&--this.scaleStep,this.scaleStep=Math.min(this.scaleStep,this.lastStep),e!==this.scaleStep&&(this.avgFrameDuration=50)}shouldRender(t){if(t.shouldRender())t.scaleStep!=this.scaleStep&&(t.scaleStep=this.scaleStep,this.rescaleCanvas(t));else{if(0==t.scaleStep)return!1;t.scaleStep=0,this.rescaleCanvas(t)}return!0}rescaleCanvas(t){const e=gy[t.scaleStep],i=Math.ceil(this.width/e),n=Math.ceil(this.height/e),{style:r}=t.canvas;r.width=`${i}px`,r.height=`${n}px`,this.canvas3D.style.width=`${i}px`,this.canvas3D.style.height=`${n}px`;const s=this.dpr*e,a=e<1?"GPU throttling":this.dpr!==window.devicePixelRatio?"No meta viewport tag":"";t.element.dispatchEvent(new CustomEvent("render-scale",{detail:{reportedDpr:window.devicePixelRatio,renderedDpr:s,minimumDpr:this.dpr*gy[this.lastStep],pixelWidth:Math.ceil(t.width*s),pixelHeight:Math.ceil(t.height*s),reason:a}}))}sceneSize(t){const{dpr:e}=this,i=gy[t.scaleStep];return{width:Math.min(Math.ceil(t.width*i*e),this.canvas3D.width),height:Math.min(Math.ceil(t.height*i*e),this.canvas3D.height)}}copyPixels(t,e,i){const n=t.context;null!=n?(n.clearRect(0,0,e,i),n.drawImage(this.canvas3D,0,0,e,i,0,0,e,i),t.canvas.classList.add("show")):console.log("could not acquire 2d context")}orderedScenes(){const t=[];for(const e of[!1,!0])for(const i of this.scenes)i.element.modelIsVisible===e&&t.push(i);return t}get isPresenting(){var t;return!0===(null===(t=this.arRenderer)||void 0===t?void 0:t.isPresenting)}preRender(t,e,i){const{element:n,exposure:r,toneMapping:s}=t;n[gE](e,i);const a="number"==typeof r&&!Number.isNaN(r),o=n.environmentImage,l=n.skyboxImage,c=7===s&&("neutral"===o||"legacy"===o||!o&&!l);this.threeRenderer.toneMappingExposure=(a?r:1)*(c?1.3:1)}render(t,e){if(null!=e)return void(null!=this.arRenderer&&this.arRenderer.onWebXRFrame(t,e));const i=t-this.lastTick;if(this.lastTick=t,!this.canRender||this.isPresenting)return;this.countVisibleScenes(),this.updateRendererSize(),this.renderedLastFrame&&(this.updateRendererScale(i),this.renderedLastFrame=!1);const{canvas3D:n}=this;for(const e of this.orderedScenes()){const{element:r}=e;if(!r.loaded||!r.modelIsVisible&&e.renderCount>0)continue;if(this.preRender(e,t,i),!this.shouldRender(e))continue;if(null!=e.externalRenderer){const t=e.getCamera();t.updateMatrix();const{matrix:i,projectionMatrix:n}=t,r=i.elements.slice(),s=e.getTarget();r[12]+=s.x,r[13]+=s.y,r[14]+=s.z,e.externalRenderer.render({viewMatrix:r,projectionMatrix:n.elements});continue}if(!r.modelIsVisible&&!this.multipleScenesVisible)for(const t of this.scenes)t.element.modelIsVisible&&t.queueRender();const{width:s,height:a}=this.sceneSize(e);e.renderShadow(this.threeRenderer),this.threeRenderer.setRenderTarget(null),this.threeRenderer.setViewport(0,Math.ceil(this.height*this.dpr)-a,s,a),null!=e.effectRenderer?e.effectRenderer.render(i):(this.threeRenderer.autoClear=!0,this.threeRenderer.toneMapping=e.toneMapping,this.threeRenderer.render(e,e.camera)),this.multipleScenesVisible||!e.element.modelIsVisible&&0===e.renderCount?this.copyPixels(e,s,a):n.parentElement!==e.canvas.parentElement&&(e.canvas.parentElement.appendChild(n),e.canvas.classList.remove("show")),e.hasRendered(),++e.renderCount,this.renderedLastFrame=!0}}dispose(){null!=this.textureUtils&&this.textureUtils.dispose(),null!=this.threeRenderer&&this.threeRenderer.dispose(),this.textureUtils=null,this.threeRenderer=null;const t=[];for(const e of this.scenes)t.push(e.element);return this.canvas3D.removeEventListener("webglcontextlost",this.onWebGLContextLost),this.canvas3D.removeEventListener("webglcontextrestored",this.onWebGLContextRestored),t}}
|
|
/* @license
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/const by=Symbol("correlatedObjects"),vy=Symbol("onUpdate");class yy{constructor(t,e){this[vy]=t,this[by]=e}}
|
|
/* @license
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/const xy=new Ns,_y=new el(2,2);let Ey=0;const Sy=Symbol("threeTexture"),Cy=Symbol("threeTextures");let wy=class extends yy{get[Sy](){var t;return null===(t=this[by])||void 0===t?void 0:t.values().next().value}get[Cy](){return this[by]}constructor(t,e){super(t,new Set(e?[e]:[]));const i=this[Sy].image;i.src||(i.src=e.name?e.name:"adhoc_image"+Ey++),i.name||(i.name=e&&i&&i.src?i.src.split("/").pop():"adhoc_image")}get name(){return this[Sy].image.name||""}get uri(){return this[Sy].image.src}get bufferView(){return this[Sy].image.bufferView}get element(){const t=this[Sy];if(t&&(t.isCanvasTexture||t.isVideoTexture))return t.image}get animation(){const t=this[Sy];if(t&&t.isCanvasTexture&&t.animation)return t.animation}get type(){return null!=this.uri?"external":"embedded"}set name(t){for(const e of this[Cy])e.image.name=t}update(){const t=this[Sy];t&&t.isCanvasTexture&&!t.animation&&(this[Sy].needsUpdate=!0,this[vy]())}async createThumbnail(t,e){const i=new wr;xy.map=this[Sy];const n=new Ks(_y,xy);i.add(n);const r=new lc(-1,1,1,-1,0,1),{threeRenderer:s}=fy.singleton,a=new Qn(t,e);s.setRenderTarget(a),s.render(i,r),s.setRenderTarget(null);const o=new Uint8Array(t*e*4);s.readRenderTargetPixels(a,0,0,t,e,o),G_.width=t,G_.height=e;const l=G_.getContext("2d"),c=l.createImageData(t,e);return c.data.set(o),l.putImageData(c,0,0),new Promise(async(t,e)=>{G_.toBlob(i=>{if(!i)return e("Failed to capture thumbnail.");t(URL.createObjectURL(i))},"image/png")})}};var My,Iy;!function(t){t[t.Nearest=9728]="Nearest",t[t.Linear=9729]="Linear",t[t.NearestMipmapNearest=9984]="NearestMipmapNearest",t[t.LinearMipmapNearest=9985]="LinearMipmapNearest",t[t.NearestMipmapLinear=9986]="NearestMipmapLinear",t[t.LinearMipmapLinear=9987]="LinearMipmapLinear"}(My||(My={})),function(t){t[t.ClampToEdge=33071]="ClampToEdge",t[t.MirroredRepeat=33648]="MirroredRepeat",t[t.Repeat=10497]="Repeat"}(Iy||(Iy={}));
|
|
/* @license
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
const Ty=new Map([[Iy.Repeat,le],[Iy.ClampToEdge,ce],[Iy.MirroredRepeat,he]]),By=new Map([[le,Iy.Repeat],[ce,Iy.ClampToEdge],[he,Iy.MirroredRepeat]]),Ry=new Map([[My.Nearest,ue],[My.Linear,Ae],[My.NearestMipmapNearest,de],[My.LinearMipmapNearest,ge],[My.NearestMipmapLinear,pe],[My.LinearMipmapLinear,me]]),Dy=new Map([[ue,My.Nearest],[Ae,My.Linear],[de,My.NearestMipmapNearest],[ge,My.LinearMipmapNearest],[pe,My.NearestMipmapLinear],[me,My.LinearMipmapLinear]]),Ly=new Map([[My.Nearest,ue],[My.Linear,Ae]]),Py=new Map([[ue,My.Nearest],[Ae,My.Linear]]),Fy=t=>Dy.has(t),Uy=t=>Py.has(t),Ny=t=>By.has(t),Oy=Symbol("threeTexture"),ky=Symbol("threeTextures"),Qy=Symbol("setProperty");class Gy extends yy{get[Oy](){var t;return null===(t=this[by])||void 0===t?void 0:t.values().next().value}get[ky](){return this[by]}constructor(t,e){super(t,new Set(e?[e]:[]))}get name(){return this[Oy].name||""}get minFilter(){return Dy.get(this[Oy].minFilter)}get magFilter(){return Py.get(this[Oy].magFilter)}get wrapS(){return By.get(this[Oy].wrapS)}get wrapT(){return By.get(this[Oy].wrapT)}get rotation(){return this[Oy].rotation}get scale(){return SE(this[Oy].repeat)}get offset(){return SE(this[Oy].offset)}setMinFilter(t){this[Qy]("minFilter",Ry.get(t))}setMagFilter(t){this[Qy]("magFilter",Ly.get(t))}setWrapS(t){this[Qy]("wrapS",Ty.get(t))}setWrapT(t){this[Qy]("wrapT",Ty.get(t))}setRotation(t){null==t&&(t=0),this[Qy]("rotation",t)}setScale(t){null==t&&(t={u:1,v:1}),this[Qy]("repeat",new fn(t.u,t.v))}setOffset(t){null==t&&(t={u:0,v:0}),this[Qy]("offset",new fn(t.u,t.v))}[Qy](t,e){if(((t,e)=>{switch(t){case"minFilter":return Fy(e);case"magFilter":return Uy(e);case"wrapS":case"wrapT":return Ny(e);case"rotation":case"repeat":case"offset":return!0;default:throw new Error(`Cannot configure property "${t}" on Sampler`)}})(t,e))for(const i of this[ky])i[t]=e,i.needsUpdate=!0;this[vy]()}}
|
|
/* @license
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/const zy=Symbol("image"),Hy=Symbol("sampler"),Vy=Symbol("threeTexture");class qy extends yy{get[Vy](){var t;return null===(t=this[by])||void 0===t?void 0:t.values().next().value}constructor(t,e){super(t,new Set(e?[e]:[])),this[Hy]=new Gy(t,e),this[zy]=new wy(t,e)}get name(){return this[Vy].name||""}set name(t){for(const e of this[by])e.name=t}get sampler(){return this[Hy]}get source(){return this[zy]}}
|
|
/* @license
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/var jy,Wy,Xy;const Ky=Symbol("texture"),Jy=Symbol("transform"),Yy=Symbol("materials"),$y=Symbol("usage"),Zy=Symbol("onUpdate"),tx=Symbol("activeVideo");var ex;!function(t){t[t.Base=0]="Base",t[t.MetallicRoughness=1]="MetallicRoughness",t[t.Normal=2]="Normal",t[t.Occlusion=3]="Occlusion",t[t.Emissive=4]="Emissive",t[t.Clearcoat=5]="Clearcoat",t[t.ClearcoatRoughness=6]="ClearcoatRoughness",t[t.ClearcoatNormal=7]="ClearcoatNormal",t[t.SheenColor=8]="SheenColor",t[t.SheenRoughness=9]="SheenRoughness",t[t.Transmission=10]="Transmission",t[t.Thickness=11]="Thickness",t[t.Specular=12]="Specular",t[t.SpecularColor=13]="SpecularColor",t[t.Iridescence=14]="Iridescence",t[t.IridescenceThickness=15]="IridescenceThickness",t[t.Anisotropy=16]="Anisotropy"}(ex||(ex={}));class ix{constructor(t,e,i,n){this[jy]=null,this[Wy]={rotation:0,scale:new fn(1,1),offset:new fn(0,0)},this[Xy]=!1,i&&(this[Jy].rotation=i.rotation,this[Jy].scale.copy(i.repeat),this[Jy].offset.copy(i.offset),this[Ky]=new qy(t,i)),this[Zy]=t,this[Yy]=n,this[$y]=e}get texture(){return this[Ky]}setTexture(t){var e,i;const n=null!=t?t.source[Sy]:null,r=null===(e=this[Ky])||void 0===e?void 0:e.source[Sy];if(null!=r&&r.isVideoTexture?this[tx]=!1:(null===(i=this[Ky])||void 0===i?void 0:i.source.animation)&&this[Ky].source.animation.removeEventListener("enterFrame",this[Zy]),this[Ky]=t,null!=n&&n.isVideoTexture){const t=n.image;if(this[tx]=!0,null!=t.requestVideoFrameCallback){const e=()=>{this[tx]&&(this[Zy](),t.requestVideoFrameCallback(e))};t.requestVideoFrameCallback(e)}else{const t=()=>{this[tx]&&(this[Zy](),requestAnimationFrame(t))};requestAnimationFrame(t)}}else null!=(null==t?void 0:t.source.animation)&&t.source.animation.addEventListener("enterFrame",this[Zy]);let s=Di;if(this[Yy])for(const t of this[Yy]){switch(this[$y]){case ex.Base:t.map=n;break;case ex.MetallicRoughness:s=Li,t.metalnessMap=n,t.roughnessMap=n;break;case ex.Normal:s=Li,t.normalMap=n;break;case ex.Occlusion:s=Li,t.aoMap=n;break;case ex.Emissive:t.emissiveMap=n;break;case ex.Clearcoat:t.clearcoatMap=n;break;case ex.ClearcoatRoughness:t.clearcoatRoughnessMap=n;break;case ex.ClearcoatNormal:t.clearcoatNormalMap=n;break;case ex.SheenColor:t.sheenColorMap=n;break;case ex.SheenRoughness:t.sheenRoughnessMap=n;break;case ex.Transmission:t.transmissionMap=n;break;case ex.Thickness:t.thicknessMap=n;break;case ex.Specular:t.specularIntensityMap=n;break;case ex.SpecularColor:t.specularColorMap=n;break;case ex.Iridescence:t.iridescenceMap=n;break;case ex.IridescenceThickness:t.iridescenceThicknessMap=n;break;case ex.Anisotropy:t.anisotropyMap=n}t.needsUpdate=!0}n&&(n.colorSpace=s,n.rotation=this[Jy].rotation,n.repeat=this[Jy].scale,n.offset=this[Jy].offset),this[Zy]()}}jy=Ky,Wy=Jy,Xy=tx;
|
|
/* @license
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
const nx=Symbol("threeMaterial"),rx=Symbol("threeMaterials"),sx=Symbol("baseColorTexture"),ax=Symbol("metallicRoughnessTexture");class ox extends yy{get[rx](){return this[by]}get[nx](){var t;return null===(t=this[by])||void 0===t?void 0:t.values().next().value}constructor(t,e){super(t,e);const{map:i,metalnessMap:n}=e.values().next().value;this[sx]=new ix(t,ex.Base,i,e),this[ax]=new ix(t,ex.MetallicRoughness,n,e)}get baseColorFactor(){const t=[0,0,0,this[nx].opacity];return this[nx].color.toArray(t),t}get metallicFactor(){return this[nx].metalness}get roughnessFactor(){return this[nx].roughness}get baseColorTexture(){return this[sx]}get metallicRoughnessTexture(){return this[ax]}setBaseColorFactor(t){const e=new Sr;t instanceof Array?e.fromArray(t):e.set(t);for(const i of this[rx])i.color.set(e),t instanceof Array&&t.length>3?i.opacity=t[3]:(t=[0,0,0,i.opacity],e.toArray(t));this[vy]()}setMetallicFactor(t){for(const e of this[rx])e.metalness=t;this[vy]()}setRoughnessFactor(t){for(const e of this[rx])e.roughness=t;this[vy]()}}
|
|
/* @license
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/var lx,cx;const hx=Symbol("pbrMetallicRoughness"),ux=Symbol("normalTexture"),dx=Symbol("occlusionTexture"),px=Symbol("emissiveTexture"),Ax=Symbol("backingThreeMaterial"),gx=Symbol("applyAlphaCutoff"),mx=Symbol("getAlphaMode"),fx=Symbol("lazyLoadGLTFInfo"),bx=Symbol("initialize"),vx=Symbol("getLoadedMaterial"),yx=Symbol("ensureMaterialIsLoaded"),xx=Symbol("gltfIndex"),_x=Symbol("setActive"),Ex=Symbol("variantIndices"),Sx=Symbol("isActive"),Cx=Symbol("modelVariants"),wx=Symbol("name"),Mx=Symbol("pbrTextures");class Ix extends yy{get[(lx=Ex,cx=Mx,Ax)](){return this[by].values().next().value}constructor(t,e,i,n,r,s,a=void 0){super(t,r),this[lx]=new Set,this[cx]=new Map,this[xx]=e,this[Sx]=i,this[Cx]=n,this[wx]=s,null==a?this[bx]():this[fx]=a}[bx](){const t=this[vy],e=this[by];this[hx]=new ox(t,e);const{normalMap:i,aoMap:n,emissiveMap:r}=e.values().next().value;this[ux]=new ix(t,ex.Normal,i,e),this[dx]=new ix(t,ex.Occlusion,n,e),this[px]=new ix(t,ex.Emissive,r,e);const s=i=>{this[Mx].set(i,new ix(t,i,null,e))};s(ex.Clearcoat),s(ex.ClearcoatRoughness),s(ex.ClearcoatNormal),s(ex.SheenColor),s(ex.SheenRoughness),s(ex.Transmission),s(ex.Thickness),s(ex.Specular),s(ex.SpecularColor),s(ex.Iridescence),s(ex.IridescenceThickness),s(ex.Anisotropy)}async[vx](){if(null!=this[fx]){const t=await this[fx].doLazyLoad();return this[bx](),this[fx]=void 0,this.ensureLoaded=async()=>{},t}return null}colorFromRgb(t){const e=new Sr;return t instanceof Array?e.fromArray(t):e.set(t),e}[yx](){if(null!=this[fx])throw new Error(`Material "${this.name}" has not been loaded, call 'await\n myMaterial.ensureLoaded()' before using an unloaded material.`)}async ensureLoaded(){await this[vx]()}get isLoaded(){return null==this[fx]}get isActive(){return this[Sx]}[_x](t){this[Sx]=t}get name(){return this[wx]||""}set name(t){if(this[wx]=t,null!=this[by])for(const e of this[by])e.name=t}get pbrMetallicRoughness(){return this[yx](),this[hx]}get normalTexture(){return this[yx](),this[ux]}get occlusionTexture(){return this[yx](),this[dx]}get emissiveTexture(){return this[yx](),this[px]}get emissiveFactor(){return this[yx](),this[Ax].emissive.toArray()}get index(){return this[xx]}hasVariant(t){const e=this[Cx].get(t);return null!=e&&this[Ex].has(e.index)}setEmissiveFactor(t){this[yx]();const e=this.colorFromRgb(t);for(const t of this[by])t.emissive.set(e);this[vy]()}[mx](){return this[Ax].transparent?"BLEND":this[Ax].alphaTest>0?"MASK":"OPAQUE"}[gx](){this[yx]();for(const t of this[by])"MASK"===this[mx]()?null==t.alphaTest&&(t.alphaTest=.5):t.alphaTest=void 0,t.needsUpdate=!0}setAlphaCutoff(t){this[yx]();for(const e of this[by])e.alphaTest=t,e.needsUpdate=!0;this[gx](),this[vy]()}getAlphaCutoff(){return this[yx](),this[Ax].alphaTest}setDoubleSided(t){this[yx]();for(const e of this[by])e.side=t?2:0,e.needsUpdate=!0;this[vy]()}getDoubleSided(){return this[yx](),2==this[Ax].side}setAlphaMode(t){this[yx]();const e=(t,e)=>{t.transparent=e,t.depthWrite=!e};for(const i of this[by])e(i,"BLEND"===t),i.alphaTest="MASK"===t?.5:void 0,i.needsUpdate=!0;this[vy]()}getAlphaMode(){return this[yx](),this[mx]()}get emissiveStrength(){return this[yx](),this[Ax].emissiveIntensity}setEmissiveStrength(t){this[yx]();for(const e of this[by])e.emissiveIntensity=t;this[vy]()}get clearcoatFactor(){return this[yx](),this[Ax].clearcoat}get clearcoatRoughnessFactor(){return this[yx](),this[Ax].clearcoatRoughness}get clearcoatTexture(){return this[yx](),this[Mx].get(ex.Clearcoat)}get clearcoatRoughnessTexture(){return this[yx](),this[Mx].get(ex.ClearcoatRoughness)}get clearcoatNormalTexture(){return this[yx](),this[Mx].get(ex.ClearcoatNormal)}get clearcoatNormalScale(){return this[yx](),this[Ax].clearcoatNormalScale.x}setClearcoatFactor(t){this[yx]();for(const e of this[by])e.clearcoat=t;this[vy]()}setClearcoatRoughnessFactor(t){this[yx]();for(const e of this[by])e.clearcoatRoughness=t;this[vy]()}setClearcoatNormalScale(t){this[yx]();for(const e of this[by])e.clearcoatNormalScale=new fn(t,t);this[vy]()}get ior(){return this[yx](),this[Ax].ior}setIor(t){this[yx]();for(const e of this[by])e.ior=t;this[vy]()}get sheenColorFactor(){return this[yx](),this[Ax].sheenColor.toArray()}get sheenColorTexture(){return this[yx](),this[Mx].get(ex.SheenColor)}get sheenRoughnessFactor(){return this[yx](),this[Ax].sheenRoughness}get sheenRoughnessTexture(){return this[yx](),this[Mx].get(ex.SheenRoughness)}setSheenColorFactor(t){this[yx]();const e=this.colorFromRgb(t);for(const t of this[by])t.sheenColor.set(e),t.sheen=1;this[vy]()}setSheenRoughnessFactor(t){this[yx]();for(const e of this[by])e.sheenRoughness=t,e.sheen=1;this[vy]()}get transmissionFactor(){return this[yx](),this[Ax].transmission}get transmissionTexture(){return this[yx](),this[Mx].get(ex.Transmission)}setTransmissionFactor(t){this[yx]();for(const e of this[by])e.transmission=t;this[vy]()}get thicknessFactor(){return this[yx](),this[Ax].thickness}get thicknessTexture(){return this[yx](),this[Mx].get(ex.Thickness)}get attenuationDistance(){return this[yx](),this[Ax].attenuationDistance}get attenuationColor(){return this[yx](),this[Ax].attenuationColor.toArray()}setThicknessFactor(t){this[yx]();for(const e of this[by])e.thickness=t;this[vy]()}setAttenuationDistance(t){this[yx]();for(const e of this[by])e.attenuationDistance=t;this[vy]()}setAttenuationColor(t){this[yx]();const e=this.colorFromRgb(t);for(const t of this[by])t.attenuationColor.set(e);this[vy]()}get specularFactor(){return this[yx](),this[Ax].specularIntensity}get specularTexture(){return this[yx](),this[Mx].get(ex.Specular)}get specularColorFactor(){return this[yx](),this[Ax].specularColor.toArray()}get specularColorTexture(){return this[yx](),this[Mx].get(ex.SheenColor)}setSpecularFactor(t){this[yx]();for(const e of this[by])e.specularIntensity=t;this[vy]()}setSpecularColorFactor(t){this[yx]();const e=this.colorFromRgb(t);for(const t of this[by])t.specularColor.set(e);this[vy]()}get iridescenceFactor(){return this[yx](),this[Ax].iridescence}get iridescenceTexture(){return this[yx](),this[Mx].get(ex.Iridescence)}get iridescenceIor(){return this[yx](),this[Ax].iridescenceIOR}get iridescenceThicknessMinimum(){return this[yx](),this[Ax].iridescenceThicknessRange[0]}get iridescenceThicknessMaximum(){return this[yx](),this[Ax].iridescenceThicknessRange[1]}get iridescenceThicknessTexture(){return this[yx](),this[Mx].get(ex.IridescenceThickness)}setIridescenceFactor(t){this[yx]();for(const e of this[by])e.iridescence=t;this[vy]()}setIridescenceIor(t){this[yx]();for(const e of this[by])e.iridescenceIOR=t;this[vy]()}setIridescenceThicknessMinimum(t){this[yx]();for(const e of this[by])e.iridescenceThicknessRange[0]=t;this[vy]()}setIridescenceThicknessMaximum(t){this[yx]();for(const e of this[by])e.iridescenceThicknessRange[1]=t;this[vy]()}get anisotropyStrength(){return this[yx](),this[Ax].anisotropy}get anisotropyRotation(){return this[yx](),this[Ax].anisotropyRotation}get anisotropyTexture(){return this[yx](),this[Mx].get(ex.Anisotropy)}setAnisotropyStrength(t){this[yx]();for(const e of this[by])e.anisotropy=t;this[vy]()}setAnisotropyRotation(t){this[yx]();for(const e of this[by])e.anisotropyRotation=t;this[vy]()}}let Tx=class{constructor(t){this.name="",this.children=new Array,this.name=t}};class Bx extends Tx{constructor(t,e,i,n){super(t.name),this.materials=new Map,this.variantToMaterialMap=new Map,this.initialMaterialIdx=0,this.activeMaterialIdx=0,this.mesh=t;const{gltf:r,threeGLTF:s,threeObjectMap:a}=n;this.parser=s.parser,this.modelVariants=i,this.mesh.userData.variantData=i;const o=a.get(t.material);null!=o.materials?this.initialMaterialIdx=this.activeMaterialIdx=o.materials:console.error(`Primitive (${t.name}) missing initial material reference.`);const l=t.userData.associations||{};if(null==l.meshes)return void console.error("Mesh is missing primitive index association");const c=((r.meshes||[])[l.meshes].primitives||[])[l.primitives];if(null!=c){if(null!=c.material)this.materials.set(c.material,e[c.material]);else{const t=e.findIndex(t=>"Default"===t.name);t>=0?this.materials.set(t,e[t]):console.warn("gltfPrimitive has no material!")}if(c.extensions&&c.extensions.KHR_materials_variants){const t=c.extensions.KHR_materials_variants,n=s.parser.json.extensions.KHR_materials_variants.variants;for(const r of t.mappings){const t=e[r.material];this.materials.set(r.material,t);for(const e of r.variants){const{name:r}=n[e];this.variantToMaterialMap.set(e,t),t[Ex].add(e),i.has(r)||i.set(r,{name:r,index:e})}}}}else console.error("Mesh primitive definition is missing.")}async setActiveMaterial(t){const e=this.materials.get(t);if(t!==this.activeMaterialIdx){const i=e[by],n=await e[vx]();this.mesh.material=null!=n?n:i.values().next().value,this.parser.assignFinalMaterial(this.mesh),i.add(this.mesh.material),this.activeMaterialIdx=t}return this.mesh.material}getActiveMaterial(){return this.materials.get(this.activeMaterialIdx)}getMaterial(t){return this.materials.get(t)}async enableVariant(t){if(null==t)return this.setActiveMaterial(this.initialMaterialIdx);if(null!=this.variantToMaterialMap&&this.modelVariants.has(t)){const e=this.modelVariants.get(t);return this.enableVariantHelper(e.index)}return null}async enableVariantHelper(t){if(null!=this.variantToMaterialMap&&null!=t){const e=this.variantToMaterialMap.get(t);if(null!=e)return this.setActiveMaterial(e.index)}return null}async instantiateVariants(){if(null!=this.variantToMaterialMap)for(const t of this.variantToMaterialMap.keys()){const e=this.mesh.userData.variantMaterials.get(t);if(null!=e.material)continue;const i=await this.enableVariantHelper(t);null!=i&&(e.material=i)}}get variantInfo(){return this.variantToMaterialMap}addVariant(t,e){if(!this.ensureVariantIsUnused(e))return!1;this.modelVariants.has(e)||this.modelVariants.set(e,{name:e,index:this.modelVariants.size});const i=this.modelVariants.get(e).index;return t[Ex].add(i),this.variantToMaterialMap.set(i,t),this.materials.set(t.index,t),this.updateVariantUserData(i,t),!0}deleteVariant(t){if(this.variantInfo.has(t)){this.variantInfo.delete(t);const e=this.mesh.userData.variantMaterials;null!=e&&e.delete(t)}}updateVariantUserData(t,e){e[Ex].add(t),this.mesh.userData.variantData=this.modelVariants,this.mesh.userData.variantMaterials=this.mesh.userData.variantMaterials||new Map;this.mesh.userData.variantMaterials.set(t,{material:e[by].values().next().value,gltfMaterialIndex:e.index})}ensureVariantIsUnused(t){const e=this.modelVariants.get(t);return null==e||!this.variantInfo.has(e.index)||(console.warn(`Primitive cannot add variant '${t}' for this material, it already exists.`),!1)}}
|
|
/* @license
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/var Rx,Dx,Lx,Px,Fx,Ux;const Nx=Symbol("materials"),Ox=Symbol("hierarchy"),kx=Symbol("roots"),Qx=Symbol("primitives"),Gx=Symbol("prepareVariantsForExport"),zx=Symbol("switchVariant"),Hx=Symbol("materialFromPoint"),Vx=Symbol("nodeFromPoint"),qx=Symbol("nodeFromIndex"),jx=Symbol("variantData"),Wx=Symbol("availableVariants"),Xx=Symbol("modelOnUpdate"),Kx=Symbol("cloneMaterial");class Jx{constructor(t,e,i,n){this.gltf=t,this.gltfElementMap=e,this.mapKey=i,this.doLazyLoad=n}}class Yx{constructor(t,e=()=>{}){this[Rx]=new Array,this[Dx]=new Array,this[Lx]=new Array,this[Px]=new Array,this[Fx]=()=>{},this[Ux]=new Map,this[Xx]=e;const{gltf:i,threeGLTF:n,gltfElementMap:r}=t;for(const[t,s]of i.materials.entries()){const a=r.get(s);if(null!=a)this[Nx].push(new Ix(e,t,!0,this[jx],a,s.name));else{const a=(i.materials||[])[t],o=new Set;r.set(a,o);const l=async()=>{const e=await n.parser.getDependency("material",t);return o.add(e),e};this[Nx].push(new Ix(e,t,!1,this[jx],o,s.name,new Jx(i,r,a,l)))}}const s=new Map,a=new Array;for(const t of n.scene.children)a.push(t);for(;a.length>0;){const e=a.pop();let i=null;e instanceof Ks?(i=new Bx(e,this.materials,this[jx],t),this[Qx].push(i)):i=new Tx(e.name);const n=s.get(e);null!=n?n.children.push(i):this[kx].push(i),this[Ox].push(i);for(const t of e.children)a.push(t),s.set(e,i)}}get materials(){return this[Nx]}[(Rx=Nx,Dx=Ox,Lx=kx,Px=Qx,Fx=Xx,Ux=jx,Wx)](){const t=Array.from(this[jx].values());return t.sort((t,e)=>t.index-e.index),t.map(t=>t.name)}getMaterialByName(t){const e=this[Nx].filter(e=>e.name===t);return e.length>0?e[0]:null}[qx](t,e){const i=this[Ox].find(i=>{if(i instanceof Bx){const{meshes:n,primitives:r}=i.mesh.userData.associations;if(n==t&&r==e)return!0}return!1});return null==i?null:i}[Vx](t){const e=this[Ox].find(e=>{if(e instanceof Bx){if(e.mesh===t.object)return!0}return!1});return e||null}[Hx](t){const e=this[Vx](t);return e?e.getActiveMaterial():null}async[zx](t){for(const e of this[Qx])await e.enableVariant(t);for(const t of this.materials)t[_x](!1);for(const t of this[Qx])this.materials[t.getActiveMaterial().index][_x](!0)}async[Gx](){const t=new Array;for(const e of this[Qx])t.push(e.instantiateVariants());await Promise.all(t)}[Kx](t,e){const i=this.materials[t];i.isLoaded||console.error("Cloning an unloaded material,\n call 'material.ensureLoaded() before cloning the material.");const n=i[by],r=new Set;for(const[t,i]of n.entries()){const s=i.clone();s.name=e+(n.size>1?"_inst"+t:""),r.add(s)}const s=new Ix(this[Xx],this[Nx].length,!1,this[jx],r,e);return this[Nx].push(s),s}createMaterialInstanceForVariant(t,e,i,n=!0){let r=null;for(const n of this[Qx]){const s=this[jx].get(i);null!=s&&n.variantInfo.has(s.index)||null!=n.getMaterial(t)&&(this.hasVariant(i)||this.createVariant(i),null==r&&(r=this[Kx](t,e)),n.addVariant(r,i))}if(n&&null!=r){r[_x](!0),this.materials[t][_x](!1);for(const t of this[Qx])t.enableVariant(i)}return r}createVariant(t){this[jx].has(t)?console.warn(`Variant '${t}'' already exists`):this[jx].set(t,{name:t,index:this[jx].size})}hasVariant(t){return this[jx].has(t)}setMaterialToVariant(t,e){if(null!=this[Wx]().find(t=>t===e))if(t<0||t>=this.materials.length)console.error("setMaterialToVariant(): materialIndex is out of bounds.");else for(const i of this[Qx]){const n=i.getMaterial(t);null!=n&&i.addVariant(n,e)}else console.warn(`Can't add material to '${e}', the variant does not exist.'`)}updateVariantName(t,e){const i=this[jx].get(t);null!=i&&(i.name=e,this[jx].set(e,i),this[jx].delete(t))}deleteVariant(t){const e=this[jx].get(t);if(null!=e){for(const i of this.materials)i.hasVariant(t)&&i[Ex].delete(e.index);for(const t of this[Qx])t.deleteVariant(e.index);this[jx].delete(t)}}}
|
|
/* @license
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/var $x=function(t,e,i,n){for(var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n,o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};const Zx=Symbol("currentGLTF"),t_=Symbol("originalGltfJson"),e_=Symbol("model"),i_=Symbol("extraModels"),n_=Symbol("getOnUpdateMethod"),r_=Symbol("buildTexture");
|
|
/* @license
|
|
* Copyright 2023 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
class s_ extends Ks{constructor(){super(void 0,new Ns({depthWrite:!1})),this.height=0,this.radius=0,this.resolution=0,this.userData.noHit=!0}get map(){return this.material.map}set map(t){this.material.map=t}isUsable(){return this.height>0&&this.radius>0&&null!=this.geometry&&null!=this.map}updateGeometry(t=this.height,e=this.radius,i=128){t==this.height&&e==this.radius&&i==this.resolution||(this.height=t,this.radius=e,this.resolution=i,t>0&&e>0&&(this.geometry.dispose(),this.geometry=function(t,e,i){const n=new nl(e,2*i,i);n.scale(1,1,-1);const r=n.getAttribute("position"),s=new vn;for(let e=0;e<r.count;++e)if(s.fromBufferAttribute(r,e),s.y<0){const i=3*-t/2,n=s.y<i?-t/s.y:1-s.y*s.y/(3*i*i);s.multiplyScalar(n),s.toArray(r.array,3*e)}return r.needsUpdate=!0,n}
|
|
/* @license
|
|
* Copyright 2020 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/(t,e,i)))}}const a_=new vn,o_=new vn,l_=new vn,c_=new _n,h_=new Qr,u_=new bn;class d_ extends Fg{constructor(t){super(document.createElement("div")),this.normal=new vn(0,1,0),this.initialized=!1,this.referenceCount=1,this.pivotEl=document.createElement("div"),this.slot=document.createElement("slot"),this.element.classList.add("annotation-wrapper"),this.slot.name=t.name,this.element.appendChild(this.pivotEl),this.pivotEl.appendChild(this.slot),this.updatePosition(t.position),this.updateNormal(t.normal),this.surface=t.surface,null!=t.modelIndex&&(this.modelIndex=t.modelIndex)}get facingCamera(){return!this.element.classList.contains("hide")}show(){this.facingCamera&&this.initialized||this.updateVisibility(!0)}hide(){!this.facingCamera&&this.initialized||this.updateVisibility(!1)}increment(){this.referenceCount++}decrement(){return this.referenceCount>0&&--this.referenceCount,0===this.referenceCount}updatePosition(t){if(null==t)return;const e=$m(t)[0].terms;for(let t=0;t<3;++t)this.position.setComponent(t,hf(e[t]).number);this.updateMatrixWorld()}updateNormal(t){if(null==t)return;const e=$m(t)[0].terms;for(let t=0;t<3;++t)this.normal.setComponent(t,e[t].number)}updateSurface(){const{mesh:t,tri:e,bary:i}=this;if(null==t||null==e||null==i)return;t.getVertexPosition(e.x,a_),t.getVertexPosition(e.y,o_),t.getVertexPosition(e.z,l_),a_.toArray(c_.elements,0),o_.toArray(c_.elements,3),l_.toArray(c_.elements,6),this.position.copy(i).applyMatrix3(c_);const n=this.parent;n.worldToLocal(t.localToWorld(this.position)),h_.set(a_,o_,l_),h_.getNormal(this.normal).transformDirection(t.matrixWorld);const r=n.parent;u_.setFromAxisAngle(a_.set(0,1,0),-r.rotation.y),this.normal.applyQuaternion(u_)}orient(t){this.pivotEl.style.transform=`rotate(${t}rad)`}updateVisibility(t){this.element.classList.toggle("hide",!t),this.slot.assignedNodes().forEach(e=>{if(e.nodeType!==Node.ELEMENT_NODE)return;const i=e,n=i.dataset.visibilityAttribute;if(null!=n){const e=`data-${n}`;i.toggleAttribute(e,t)}i.dispatchEvent(new CustomEvent("hotspot-visibility",{detail:{visible:t}}))}),this.initialized=!0}}const p_={name:"HorizontalBlurShader",uniforms:{tDiffuse:{value:null},h:{value:1/512}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float h;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 sum = vec4( 0.0 );\n\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;\n\n\t\t\tgl_FragColor = sum;\n\n\t\t}"},A_={name:"VerticalBlurShader",uniforms:{tDiffuse:{value:null},v:{value:1/512}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float v;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 sum = vec4( 0.0 );\n\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;\n\n\t\t\tgl_FragColor = sum;\n\n\t\t}"};function g_(t,e,i){return(1-i)*t+i*e}
|
|
/* @license
|
|
* Copyright 2022 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/class m_ extends mr{constructor(t,e,i){super(),this.camera=new lc,this.renderTarget=null,this.renderTargetBlur=null,this.depthMaterial=new dl,this.horizontalBlurMaterial=new ll(p_),this.verticalBlurMaterial=new ll(A_),this.intensity=0,this.softness=1,this.boundingBox=new Gr,this.size=new vn,this.maxDimension=0,this.isAnimated=!1,this.needsUpdate=!1;const{camera:n}=this;n.rotation.x=Math.PI/2,n.left=-.5,n.right=.5,n.bottom=-.5,n.top=.5,this.add(n);const r=new el,s=new Ns({opacity:1,transparent:!0,side:1});this.floor=new Ks(r,s),this.floor.userData.noHit=!0,n.add(this.floor),this.blurPlane=new Ks(r),this.blurPlane.visible=!1,n.add(this.blurPlane),t.target.add(this),this.depthMaterial.onBeforeCompile=function(t){t.fragmentShader=t.fragmentShader.replace(/gl_FragColor\s*=\s*vec4\(\s*vec3\(\s*1\.0\s*-\s*fragCoordZ\s*\),\s*opacity\s*\);/,"gl_FragColor = vec4( vec3( 0.0 ), ( 1.0 - fragCoordZ ) * opacity );")},this.depthMaterial.side=2,this.horizontalBlurMaterial.depthTest=!1,this.verticalBlurMaterial.depthTest=!1,this.setScene(t,e,i)}setScene(t,e,i){const{boundingBox:n,size:r,rotation:s,position:a}=this;if(this.isAnimated=t.animationNames.length>0,this.boundingBox.copy(t.boundingBox),this.size.copy(t.size),this.maxDimension=Math.max(r.x,r.y,r.z)*(this.isAnimated?2:1),this.boundingBox.getCenter(a),"back"===i){const{min:t,max:e}=n;[t.y,t.z]=[t.z,t.y],[e.y,e.z]=[e.z,e.y],[r.y,r.z]=[r.z,r.y],s.x=Math.PI/2,s.y=Math.PI}else s.x=0,s.y=0;if(this.isAnimated){const t=n.min.y,e=n.max.y;r.y=this.maxDimension,n.expandByVector(r.subScalar(this.maxDimension).multiplyScalar(-.5)),n.min.y=t,n.max.y=e,r.set(this.maxDimension,e-t,this.maxDimension)}"bottom"===i?a.y=n.min.y:a.z=n.min.y,this.setSoftness(e)}setSoftness(t){this.softness=t;const{size:e,camera:i}=this,n=this.isAnimated?2:1,r=n*Math.pow(2,9-3*t);this.setMapSize(r);const s=e.y/2,a=e.y*n;i.near=0,i.far=g_(a,s,t),this.depthMaterial.opacity=1/t,i.updateProjectionMatrix(),this.setIntensity(this.intensity),this.setOffset(0)}setMapSize(t){const{size:e}=this;this.isAnimated&&(t*=2);const i=Math.floor(e.x>e.z?t:t*e.x/e.z),n=Math.floor(e.x>e.z?t*e.z/e.x:t),r=10+i,s=10+n;if(null==this.renderTarget||this.renderTarget.width===r&&this.renderTarget.height===s||(this.renderTarget.dispose(),this.renderTarget=null,this.renderTargetBlur.dispose(),this.renderTargetBlur=null),null==this.renderTarget){const t={format:Re};this.renderTarget=new Qn(r,s,t),this.renderTargetBlur=new Qn(r,s,t),this.floor.material.map=this.renderTarget.texture}const a=e.x*(1+10/i),o=e.z*(1+10/n);this.camera.left=-a/2,this.camera.right=a/2,this.camera.bottom=-o/2,this.camera.top=o/2,this.camera.scale.set(1,1,1),this.floor.scale.set(a,o,1),this.blurPlane.scale.set(a,o,1),this.needsUpdate=!0}setIntensity(t){this.intensity=t,t>0?(this.visible=!0,this.floor.visible=!0,this.floor.material.opacity=t*g_(.3,1,this.softness*this.softness)):(this.visible=!1,this.floor.visible=!1)}getIntensity(){return this.intensity}setOffset(t){this.floor.position.z=-t+this.gap()}gap(){return.001*this.maxDimension}render(t,e){e.overrideMaterial=this.depthMaterial,this.floor.visible=!1;const i=t.xr.enabled;t.xr.enabled=!1;const n=t.getRenderTarget();t.setRenderTarget(this.renderTarget);const r=t.getClearAlpha();t.setClearAlpha(0);const s=t.state;null!=s&&(s.buffers.color.setMask(!0),s.buffers.depth.setMask(!0)),t.clear();const a=t.autoClear;t.autoClear=!1,t.render(e,this.camera),t.autoClear=a,e.overrideMaterial=null,this.floor.visible=!0,this.blurShadow(t),t.xr.enabled=i,t.setRenderTarget(n),t.setClearAlpha(r)}blurShadow(t){const{camera:e,horizontalBlurMaterial:i,verticalBlurMaterial:n,renderTarget:r,renderTargetBlur:s,blurPlane:a}=this;a.visible=!0,a.material=i,i.uniforms.h.value=1/this.renderTarget.width,i.uniforms.tDiffuse.value=this.renderTarget.texture,t.setRenderTarget(s),t.render(a,e),a.material=n,n.uniforms.v.value=1/this.renderTarget.height,n.uniforms.tDiffuse.value=this.renderTargetBlur.texture,t.setRenderTarget(r),t.render(a,e),a.visible=!1}dispose(){null!=this.renderTarget&&this.renderTarget.dispose(),null!=this.renderTargetBlur&&this.renderTargetBlur.dispose(),this.depthMaterial.dispose(),this.horizontalBlurMaterial.dispose(),this.verticalBlurMaterial.dispose(),this.floor.material.dispose(),this.floor.geometry.dispose(),this.blurPlane.geometry.dispose(),this.removeFromParent()}}
|
|
/* @license
|
|
* Copyright 2025 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/const f_=new vn,b_=new vn,v_=new vn,y_=new class{constructor(t,e,i=0,n=1/0){this.ray=new Us(t,e),this.near=i,this.far=n,this.camera=null,this.layers=new tr,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(t,e){this.ray.set(t,e)}setFromCamera(t,e){e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(t.x,t.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e.isOrthographicCamera?(this.ray.origin.set(t.x,t.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e):en("Raycaster: Unsupported camera type: "+e.type)}setFromXRController(t){return Rc.identity().extractRotation(t.matrixWorld),this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(Rc),this}intersectObject(t,e=!0,i=[]){return Lc(t,this,i,e),i.sort(Dc),i}intersectObjects(t,e=!0,i=[]){for(let n=0,r=t.length;n<r;n++)Lc(t[n],this,i,e);return i.sort(Dc),i}},x_=new vn,__=new fn;class E_ extends wr{constructor({canvas:t,element:e,width:i,height:n}){super(),this.annotationRenderer=new Gg,this.effectRenderer=null,this.schemaElement=document.createElement("script"),this.width=1,this.height=1,this.aspect=1,this.scaleStep=0,this.renderCount=0,this.externalRenderer=null,this.appendedAnimations=[],this.markedAnimations=[],this.camera=new nc(45,1,.1,100),this.xrCamera=null,this.url=null,this.extraUrls=[],this.scenePivot=new mr,this.target=new mr,this.animationNames=[],this.boundingBox=new Gr,this.boundingSphere=new gs,this.size=new vn,this.idealAspect=0,this.framedFoVDeg=0,this.shadow=null,this.shadowIntensity=0,this.shadowSoftness=1,this.bakedShadows=new Set,this.exposure=1,this.toneMapping=7,this.canScale=!0,this.isDirty=!1,this.goalTarget=new vn,this.targetDamperX=new jm,this.targetDamperY=new jm,this.targetDamperZ=new jm,this._currentGLTFs=[],this._models=[],this.boundsAndShadowDirty=!1,this.mixers=[],this.mixerPausedStates=[],this.cancelPendingSourceChange=null,this.animationsByName=new Map,this.currentAnimationActions=[],this.groundedSkybox=new s_,this.name="ModelScene",this.element=e,this.canvas=t,this.camera=new nc(45,1,.1,100),this.camera.name="MainCamera",this.add(this.scenePivot),this.scenePivot.name="Pivot",this.scenePivot.add(this.target),this.setSize(i,n),this.target.name="Target",this.mixers=[];const{domElement:r}=this.annotationRenderer,{style:s}=r;s.display="none",s.pointerEvents="none",s.position="absolute",s.top="0",this.element.shadowRoot.querySelector(".default").appendChild(r),this.schemaElement.setAttribute("type","application/ld+json")}get context(){return this.canvas.getContext("2d")}getCamera(){return null!=this.xrCamera?this.xrCamera:this.camera}queueRender(){this.isDirty=!0}shouldRender(){return this.isDirty}hasRendered(){this.isDirty=!1}forceRescale(){this.scaleStep=-1,this.queueRender()}async setObject(t){this.reset(),this._models=[t],this.target.add(t),await this.setupScene()}async setSource(t,e=[],i=()=>{}){if((!t||t===this.url)&&e.join(",")===this.extraUrls.join(","))return void i(1);if(this.reset(),this.url=t,this.extraUrls=e,null!=this.externalRenderer){const t=await this.externalRenderer.load(i);return this.boundingSphere.radius=t.framedRadius,void(this.idealAspect=t.fieldOfViewAspect)}null!=this.cancelPendingSourceChange&&(this.cancelPendingSourceChange(),this.cancelPendingSourceChange=null);let n=[];try{const r=[];t&&r.push(t),e&&r.push(...e),r.length>0&&(n=await new Promise((t,e)=>{this.cancelPendingSourceChange=()=>e(),(async()=>{try{const e=await Promise.all(r.map(t=>this.element[bE].loader.load(t,this.element,i)));t(e)}catch(t){e(t)}})()}))}catch(t){if(null==t)return;throw t}this.cancelPendingSourceChange=null,this.reset(),this.url=t,this.extraUrls=e,this._currentGLTFs=n;for(const t of n)null!=t?(this._models.push(t.scene),this.target.add(t.scene),this.mixers.push(new Tc(t.scene)),this.mixerPausedStates.push(!1),this.currentAnimationActions.push(null)):(this.mixers.push(new Tc(this.target)),this.mixerPausedStates.push(!1),this.currentAnimationActions.push(null));const r=new Map,s=[],a=[];for(const t of n)for(const e of t.animations||[])r.set(e.name,e),s.push(e.name),a.push(e);this.animations=a,this.animationsByName=r,this.animationNames=s,await this.setupScene()}async setupScene(){this.applyTransform(),this.updateBoundingBox(),await this.updateFraming(),this.updateShadow(),this.setShadowIntensity(this.shadowIntensity),this.setGroundedSkybox()}updateModelTransforms(t,e,i,n){const r=this._models[t];if(r){if(e){const t=e.split(" ").map(t=>t.trim()).filter(t=>t.length>0).map(Number);3!==t.length||t.some(isNaN)||r.position.set(t[0],t[1],t[2])}if(n){const t=n.split(" ").map(t=>t.trim()).filter(t=>t.length>0).map(Number);1!==t.length||isNaN(t[0])?3!==t.length||t.some(isNaN)||r.scale.set(t[0],t[1],t[2]):r.scale.setScalar(t[0])}r.updateMatrixWorld(!0),this.boundsAndShadowDirty=!0,this.queueRender()}}updateBoundingBoxAndShadowIfDirty(){this.boundsAndShadowDirty&&(this.boundsAndShadowDirty=!1,this.updateBoundingBox(),this.updateShadow())}reset(){this.url=null,this.renderCount=0,this.queueRender(),null!=this.shadow&&this.shadow.setIntensity(0),this.bakedShadows.clear();const{_models:t}=this;for(const e of t)null!=e&&e.removeFromParent();this._models=[];const e=this._currentGLTFs;for(const t of e)null!=t&&t.dispose();this._currentGLTFs=[];for(const t of this.currentAnimationActions)null!=t&&t.stop();this.currentAnimationActions=[];for(const t of this.mixers)t.stopAllAction(),t.uncacheRoot(this);this.mixers=[],this.mixerPausedStates=[]}dispose(){this.reset(),null!=this.shadow&&(this.shadow.dispose(),this.shadow=null),this.element[Zx]=null,this.element[t_]=null,this.element[e_]=null}get currentGLTF(){return this._currentGLTFs[0]||null}get currentGLTFs(){return this._currentGLTFs}setSize(t,e){if(this.width!==t||this.height!==e){if(this.width=Math.max(t,1),this.height=Math.max(e,1),this.annotationRenderer.setSize(t,e),this.aspect=this.width/this.height,null!=this.externalRenderer){const i=window.devicePixelRatio;this.externalRenderer.resize(t*i,e*i)}this.queueRender()}}markBakedShadow(t){t.userData.noHit=!0,this.bakedShadows.add(t)}unmarkBakedShadow(t){t.userData.noHit=!1,t.visible=!0,this.bakedShadows.delete(t),this.boundingBox.expandByObject(t)}findBakedShadows(t){const e=new Gr;t.traverse(t=>{const i=t;if(!i.material)return;if(!i.material.transparent)return;e.setFromObject(i);const n=e.getSize(x_),r=Math.min(n.x,n.y,n.z);Math.max(n.x,n.y,n.z)<100*r||this.markBakedShadow(i)})}checkBakedShadows(){const{min:t,max:e}=this.boundingBox,i=new Gr;this.boundingBox.getSize(this.size);for(const n of this.bakedShadows)i.setFromObject(n),i.min.y<t.y+this.size.y/100&&i.min.x<=t.x&&i.max.x>=e.x&&i.min.z<=t.z&&i.max.z>=e.z||i.min.z<t.z+this.size.z/100&&i.min.x<=t.x&&i.max.x>=e.x&&i.min.y<=t.y&&i.max.y>=e.y||this.unmarkBakedShadow(n)}applyTransform(){const{models:t}=this;if(0===t.length)return;const e=$m(this.element.orientation)[0].terms,i=hf(e[0]).number,n=hf(e[1]).number,r=hf(e[2]).number,s=$m(this.element.scale)[0].terms;for(const e of t)e.quaternion.setFromEuler(new Zn(n,r,i,"YXZ")),e.scale.set(s[0].number,s[1].number,s[2].number)}updateBoundingBox(){const{models:t}=this;if(0===t.length)return;for(const e of t)this.target.remove(e),this.findBakedShadows(e);const e=(t,e)=>t.expandByPoint(e);this.setBakedShadowVisibility(!1);let i=new Gr;for(const n of t)i=zg(n,e,i);if(this.boundingBox=i,this.boundingBox.isEmpty()){this.setBakedShadowVisibility(!0),this.bakedShadows.forEach(t=>this.unmarkBakedShadow(t)),i=new Gr;for(const n of t)i=zg(n,e,i);this.boundingBox=i}this.checkBakedShadows(),this.setBakedShadowVisibility(),this.boundingBox.getSize(this.size);for(const e of t)this.target.add(e)}async updateFraming(){const{models:t}=this;if(0===t.length)return;for(const e of t)this.target.remove(e);this.setBakedShadowVisibility(!1);const{center:e}=this.boundingSphere;this.element.requestUpdate("cameraTarget"),await this.element.updateComplete,e.copy(this.getTarget());const i=(t,i)=>Math.max(t,e.distanceToSquared(i));let n=0;for(const e of t)n=Math.max(n,zg(e,i,0));this.boundingSphere.radius=Math.sqrt(n);const r=(t,i)=>{i.sub(e);const n=Math.sqrt(i.x*i.x+i.z*i.z);return Math.max(t,n/(this.idealCameraDistance()-Math.abs(i.y)))};let s=0;for(const e of t)s=Math.max(s,zg(e,r,0));this.idealAspect=s/Math.tan(this.framedFoVDeg/2*Math.PI/180),this.setBakedShadowVisibility();for(const e of t)this.target.add(e)}setBakedShadowVisibility(t=this.shadowIntensity<=0){for(const e of this.bakedShadows)e.visible=t}idealCameraDistance(){const t=this.framedFoVDeg/2*Math.PI/180;return this.boundingSphere.radius/Math.sin(t)}adjustedFoV(t){const e=Math.tan(t/2*Math.PI/180)*Math.max(1,this.idealAspect/this.aspect);return 2*Math.atan(e)*180/Math.PI}getNDC(t,e){if(null!=this.xrCamera)__.set(t/window.screen.width,e/window.screen.height);else{const i=this.element.getBoundingClientRect();__.set((t-i.x)/this.width,(e-i.y)/this.height)}return __.multiplyScalar(2).subScalar(1),__.y*=-1,__}getSize(){return{width:this.width,height:this.height}}setEnvironmentAndSkybox(t,e){this.element[bE].arRenderer.presentedScene!==this&&(this.environment=t,this.setBackground(e),this.queueRender())}setBackground(t){this.groundedSkybox.map=t,this.groundedSkybox.isUsable()?(this.target.add(this.groundedSkybox),this.background=null):(this.target.remove(this.groundedSkybox),this.background=t)}farRadius(){return this.boundingSphere.radius*(null!=this.groundedSkybox.parent?10:1)}setGroundedSkybox(){const t=$m(this.element.skyboxHeight)[0].terms[0],e=hf(t).number,i=10*this.boundingSphere.radius;this.groundedSkybox.updateGeometry(e,i),this.groundedSkybox.position.y=e-(this.shadow?2*this.shadow.gap():0),this.setBackground(this.groundedSkybox.map)}setTarget(t,e,i){this.goalTarget.set(-t,-e,-i)}setTargetDamperDecayTime(t){this.targetDamperX.setDecayTime(t),this.targetDamperY.setDecayTime(t),this.targetDamperZ.setDecayTime(t)}getTarget(){return this.goalTarget.clone().multiplyScalar(-1)}getDynamicTarget(){return this.target.position.clone().multiplyScalar(-1)}jumpToGoal(){this.updateTarget(1e4)}updateTarget(t){const e=this.goalTarget,i=this.target.position;if(e.equals(i))return!1;{const n=this.boundingSphere.radius/10;let{x:r,y:s,z:a}=i;return r=this.targetDamperX.update(r,e.x,t,n),s=this.targetDamperY.update(s,e.y,t,n),a=this.targetDamperZ.update(a,e.z,t,n),this.groundedSkybox.position.x=-r,this.groundedSkybox.position.z=-a,this.target.position.set(r,s,a),this.target.updateMatrixWorld(),this.queueRender(),!0}}pointTowards(t,e){const{x:i,z:n}=this.position;this.yaw=Math.atan2(t-i,e-n)}get model(){return this._models[0]||null}get models(){return this._models}set yaw(t){this.scenePivot.rotation.y=t,this.groundedSkybox.rotation.y=-t,this.queueRender()}get yaw(){return this.scenePivot.rotation.y}set animationTime(t){for(const e of this.mixers)e.setTime(t);this.queueShadowRender()}get animationTime(){let t=0;for(const e of this.currentAnimationActions)if(null!=e){let i=e.time;const n=Math.max(e._loopCount,0);if(e.loop===Ei&&!(1&~n)){i=(e.getClip()?e.getClip().duration:0)-e.time}i>t&&(t=i)}return t}set animationTimeScale(t){for(const e of this.mixers)e.timeScale=t}get animationTimeScale(){return this.mixers.length>0?this.mixers[0].timeScale:1}get duration(){let t=0;for(const e of this.currentAnimationActions)if(null!=e&&e.getClip()){const i=e.getClip().duration;i>t&&(t=i)}return t}get hasActiveAnimation(){return this.currentAnimationActions.some(t=>null!=t)}playAnimation(t=null,e=0,i=2201,n=1/0,r=null){const s=null!=r?r:0,a=null!=r?r+1:this._models.length;for(let r=s;r<a;r++){const s=this._currentGLTFs[r];if(null==s)continue;const a=s.animations||[];if(0===a.length)continue;let o=null;if(null!=t){for(let e=a.length-1;e>=0;e--)if(a[e].name===t){o=a[e];break}if(null==o){const e=parseInt(t);!isNaN(e)&&e>=0&&e<a.length&&(o=a[e])}}null==o&&(o=a[0]);try{const t=this.currentAnimationActions[r],s=this.mixers[r],a=s.clipAction(o,this._models[r]);this.currentAnimationActions[r]=a,this.element.paused?(s.stopAllAction(),this.mixerPausedStates[r]=!0):(a.paused=!1,this.mixerPausedStates[r]=!1,null!=t&&a!==t?a.crossFadeFrom(t,e,!1):this.animationTimeScale>0&&this.animationTime==this.duration&&(this.animationTime=0)),a.setLoop(i,n),a.enabled=!0,a.clampWhenFinished=!0,a.play()}catch(t){console.error(t)}}}appendAnimation(t="",e=2201,i=1/0,n=1,r=1,s=!1,a=!1,o=!0,l=null,c=!1,h=null){if(null==this.currentGLTF||t===this.element.animationName)return;const{animations:u}=this;if(null==u||0===u.length)return;const d=t?this.animationsByName.get(t):null;if(null==d)return;if("string"==typeof i?isNaN(parseFloat(i))?(i=1/0,console.warn(`Invalid repetitionCount value: ${i}. Using default: Infinity`)):(parseInt(i)<1&&console.warn(`Invalid repetitionCount value: ${i}. Using 1 as minimum.`),i=Math.max(parseInt(i),1)):"number"==typeof i&&i<1?(i=1,console.warn(`Invalid repetitionCount value: ${i}. Using 1 value as minimum.`)):console.warn(`Invalid repetitionCount value: ${i}. Using default: Infinity`),1===i&&e!==xi&&(e=xi),"string"==typeof n){const t=parseFloat(n);isNaN(t)||t<0||t>1?(n=1,console.warn(`Invalid weight value: ${n}. Using default: 1`)):n=t}if("string"==typeof r){const t=parseFloat(r);isNaN(t)||t<0?(r=1,console.warn(`Invalid timeScale value: ${r}. Using default: 1`)):r=t}if("string"==typeof l){const t=parseFloat(l);isNaN(t)?(l=null,console.warn(`Invalid time value: ${l}. Using default: 0 or previous time`)):l=t}const{shouldFade:p,duration:A}=this.parseFadeValue(s,!1,1.25);let g=!1,m=0;"boolean"==typeof a?(g=a,m=a?1.25:0):"number"==typeof a?(g=a>0,m=Math.max(a,0),a<0&&console.warn(`Invalid warp value: ${a}. Using default: false`)):"string"==typeof a&&("true"===a.toLowerCase().trim()?(g=!0,m=1.25):"false"===a.toLowerCase().trim()?g=!1:isNaN(parseFloat(a))?console.warn(`Invalid warp value: ${a}. Using default: false`):(m=Math.max(parseFloat(a),0),g=m>0,m<=0&&console.warn(`Invalid warp value: ${a}. Using default: false`)));try{c&&this.appendedAnimations.includes(t)&&(this.markedAnimations.map(t=>t.name).includes(t)||this.markedAnimations.push({name:t,loopMode:e,repetitionCount:i}));const s=null!=h?h:0,a=null!=h?h+1:this.mixers.length;for(let t=s;t<a;t++){const s=this.mixers[t],a=s.existingAction(d)||s.clipAction(d,this._models[t]||this),c=a.timeScale;"number"==typeof l&&(a.time=Math.min(Math.max(l,0),d.duration)),p?a.fadeIn(A):n>=0&&(a.weight=Math.min(Math.max(n,0),1)),g?a.warp(o?c:0,r,m):a.timeScale=r,a.isRunning()||(a.time==d.duration&&a.stop(),a.setLoop(e,i),a.paused=!1,a.enabled=!0,a.clampWhenFinished=!0,a.play())}this.appendedAnimations.includes(t)||this.element[pE].appendedAnimations.push(t)}catch(t){console.error(t)}}parseFadeValue(t,e=!0,i=1.5){if("boolean"==typeof t)return{shouldFade:t,duration:t?i:0};if("number"==typeof t){const e=Math.max(t,0);return{shouldFade:e>0,duration:e}}if("string"==typeof t){const e=t.toLowerCase().trim();if("true"===e)return{shouldFade:!0,duration:i};if("false"===e)return{shouldFade:!1,duration:0};const n=parseFloat(e);if(!isNaN(n)){const t=Math.max(n,0);return{shouldFade:t>0,duration:t}}}return console.warn(`Invalid fade value: ${t}. Using default: ${e}`),{shouldFade:e,duration:e?i:0}}detachAnimation(t="",e=!0,i=null){if(null==this.currentGLTF||t===this.element.animationName)return;const{animations:n}=this;if(null==n||0===n.length)return;const r=t?this.animationsByName.get(t):null;if(null==r)return;const{shouldFade:s,duration:a}=this.parseFadeValue(e,!0,1.5);try{const e=null!=i?i:0,n=null!=i?i+1:this.mixers.length;for(let t=e;t<n;t++){const e=this.mixers[t],i=e.existingAction(r)||e.clipAction(r,this._models[t]||this);s?i.fadeOut(a):i.stop()}this.element[pE].appendedAnimations=this.element[pE].appendedAnimations.filter(e=>e!==t)}catch(t){console.error(t)}}updateAnimationLoop(t="",e=2201,i=1/0,n=null){if(null==this.currentGLTF||t===this.element.animationName)return;const{animations:r}=this;if(null==r||0===r.length)return;let s=null;if(t&&(s=this.animationsByName.get(t)),null!=s)try{const t=null!=n?n:0,r=null!=n?n+1:this.mixers.length;for(let n=t;n<r;n++){const t=this.mixers[n],r=t.existingAction(s)||t.clipAction(s,this._models[n]||this);r.stop(),r.setLoop(e,i),r.play()}}catch(t){console.error(t)}}stopAnimation(){this.currentAnimationActions.fill(null);for(const t of this.mixers)t.stopAllAction();this.mixerPausedStates.fill(!0)}isAllAnimationsPaused(){return this.mixerPausedStates.every(t=>t)}pauseAnimation(t=null){const e=null!=t?t:0,i=null!=t?t+1:this.mixers.length;for(let t=e;t<i;t++)this.mixerPausedStates[t]=!0}unpauseAnimation(t=null){const e=null!=t?t:0,i=null!=t?t+1:this.mixers.length;for(let t=e;t<i;t++)this.mixerPausedStates[t]=!1}updateAnimation(t){for(let e=0;e<this.mixers.length;e++)this.mixerPausedStates[e]||this.mixers[e].update(t);this.queueShadowRender()}subscribeMixerEvent(t,e){for(const i of this.mixers)i.addEventListener(t,e)}updateShadow(){const t=this.shadow;if(null!=t){const e="wall"===this.element.arPlacement?"back":"bottom";t.setScene(this,this.shadowSoftness,e),t.needsUpdate=!0}}renderShadow(t){this.updateBoundingBoxAndShadowIfDirty();const e=this.shadow;null!=e&&1==e.needsUpdate&&(e.render(t,this),e.needsUpdate=!1)}queueShadowRender(){null!=this.shadow&&(this.shadow.needsUpdate=!0)}setShadowIntensity(t){if(this.shadowIntensity=t,null!=this.currentGLTF&&(this.setBakedShadowVisibility(),!(t<=0&&null==this.shadow))){if(null==this.shadow){const t="wall"===this.element.arPlacement?"back":"bottom";this.shadow=new m_(this,this.shadowSoftness,t)}this.shadow.setIntensity(t)}}setShadowSoftness(t){this.shadowSoftness=t;const e=this.shadow;null!=e&&e.setSoftness(t)}setShadowOffset(t){const e=this.shadow;null!=e&&e.setOffset(t)}getHit(t=this){return y_.intersectObject(t,!0).find(t=>t.object.visible&&!t.object.userData.noHit)}hitFromController(t,e=this){return y_.setFromXRController(t),this.getHit(e)}hitFromPoint(t,e=this){return y_.setFromCamera(t,this.getCamera()),this.getHit(e)}getModelIndexFromHit(t){let e=t.object;for(;null!=e;){const t=this.models.indexOf(e);if(-1!==t)return t;e=e.parent}return 0}positionAndNormalFromPoint(t,e=this){var i;const n=this.hitFromPoint(t,e);if(null==n)return null;const r=n.point,s=null!=n.face?n.face.normal.clone().applyNormalMatrix((new _n).getNormalMatrix(n.object.matrixWorld)):y_.ray.direction.clone().multiplyScalar(-1),a=null!==(i=n.uv)&&void 0!==i?i:null,o=this.getModelIndexFromHit(n),l=this.models[o]||this.target;return{position:r,normal:s,uv:a,modelIndex:o,worldToModel:(new Hn).copy(l.matrixWorld).invert()}}surfaceFromPoint(t,e=this){var i;const n=this.hitFromPoint(t,e);if(null==n||null==n.face)return null;const r=this.getModelIndexFromHit(n),s=0===r?this.element.model:null===(i=this.element.extraModels)||void 0===i?void 0:i[r-1];if(null==s)return null;const a=s[Vx](n);if(null==a)return null;const{meshes:o,primitives:l}=a.mesh.userData.associations,c=new vn,h=new vn,u=new vn,{a:d,b:p,c:A}=n.face,g=n.object;g.getVertexPosition(d,c),g.getVertexPosition(p,h),g.getVertexPosition(A,u);const m=new Qr(c,h,u),f=new vn;m.getBarycoord(g.worldToLocal(n.point),f),m.getBarycoord(g.worldToLocal(n.point),f);const b=`${o} ${l} ${d} ${p} ${A} ${f.x.toFixed(3)} ${f.y.toFixed(3)} ${f.z.toFixed(3)}`;return 0===r?b:`${r} ${b}`}updateHotspotAttachment(t){const e=null!=t.modelIndex&&t.modelIndex>0&&this._models[t.modelIndex]?this._models[t.modelIndex]:this.target;t.parent!==e&&(e.add(t),t.updatePosition(t.position.toArray().join(" ")+"m"),t.updateMatrixWorld(!0))}addHotspot(t){this.updateHotspotAttachment(t),this.annotationRenderer.domElement.appendChild(t.element),this.updateSurfaceHotspot(t)}removeHotspot(t){t.parent&&t.parent.remove(t)}forHotspots(t){const e=[...this.target.children];for(let i=0,n=e.length;i<n;i++){const n=e[i];n instanceof d_&&t(n)}for(const e of this._models)if(e&&e!==this.target){const i=[...e.children];for(let e=0,n=i.length;e<n;e++){const n=i[e];n instanceof d_&&t(n)}}}updateSurfaceHotspot(t){var e,i;if(null==t.surface)return;const n=$m(t.surface)[0].terms;if(8!==n.length&&9!==n.length)return void console.warn(t.surface+" does not have exactly 8 or 9 numbers. Did you use an outdated string?");const r=8===n.length,s=r?0:n[0].number,a=r?0:1,o=null!==(e=t.modelIndex)&&void 0!==e?e:s;t.modelIndex=o,this.updateHotspotAttachment(t);const l=0===o?this.element.model:null===(i=this.element.extraModels)||void 0===i?void 0:i[o-1];if(null==l)return;const c=l[qx](n[0+a].number,n[1+a].number);if(null==c)return void console.warn(t.surface+" does not match a node/primitive in this glTF! Skipping this hotspot.");const h=c.mesh.geometry.attributes.position.count,u=new vn(n[2+a].number,n[3+a].number,n[4+a].number);if(u.x>=h||u.y>=h||u.z>=h)return void console.warn(t.surface+" vertex indices out of range in this glTF! Skipping this hotspot.");const d=new vn(n[5+a].number,n[6+a].number,n[7+a].number);t.mesh=c.mesh,t.tri=u,t.bary=d,t.updateSurface()}animateSurfaceHotspots(){this.element.paused||this.forHotspots(t=>{t.updateSurface()})}updateHotspotsVisibility(t){this.forHotspots(e=>{f_.copy(t),b_.setFromMatrixPosition(e.matrixWorld),f_.sub(b_),v_.copy(e.normal).transformDirection(this.target.matrixWorld),f_.dot(v_)<0?e.hide():e.show()})}orientHotspots(t){this.forHotspots(e=>{e.orient(t)})}setHotspotsVisibility(t){this.forHotspots(e=>{e.visible=t})}updateSchema(t){var e;const{schemaElement:i,element:n}=this,{alt:r,poster:s,iosSrc:a}=n;if(null!=t){const n=[{"@type":"MediaObject",contentUrl:t,encodingFormat:"gltf"===(null===(e=t.split(".").pop())||void 0===e?void 0:e.toLowerCase())?"model/gltf+json":"model/gltf-binary"}];a&&n.push({"@type":"MediaObject",contentUrl:a,encodingFormat:"model/vnd.usdz+zip"});const o={"@context":"http://schema.org/","@type":"3DModel",image:null!=s?s:void 0,name:null!=r?r:void 0,encoding:n};i.textContent=JSON.stringify(o),document.head.appendChild(i)}else null!=i.parentElement&&i.parentElement.removeChild(i)}}
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/class S_ extends EventTarget{constructor(){super(...arguments),this.ongoingActivities=new Set,this.totalProgress=0}get ongoingActivityCount(){return this.ongoingActivities.size}beginActivity(t){const e={progress:0,completed:!1};return this.ongoingActivities.add(e),1===this.ongoingActivityCount&&this.announceTotalProgress(e,0,t),i=>{let n;return n=Math.max(jd(i,0,1),e.progress),n!==e.progress&&this.announceTotalProgress(e,n,t),e.progress}}announceTotalProgress(t,e,i){let n=0,r=0;1==e&&(t.completed=!0);for(const t of this.ongoingActivities){const{progress:e}=t;n+=1-e,t.completed&&r++}const s=t.progress;t.progress=e,this.totalProgress+=(e-s)*(1-this.totalProgress)/n;const a=r===this.ongoingActivityCount?1:this.totalProgress;this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:a,reason:i}})),r===this.ongoingActivityCount&&(this.totalProgress=0,this.ongoingActivities.clear())}}
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/var C_,w_,M_,I_,T_,B_,R_,D_,L_,P_,F_,U_,N_,O_,k_,Q_=function(t,e,i,n){for(var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n,o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};const G_=document.createElement("canvas"),z_=Symbol("fallbackResizeHandler"),H_=Symbol("defaultAriaLabel"),V_=Symbol("resizeObserver"),q_=Symbol("clearModelTimeout"),j_=Symbol("onContextLost"),W_=Symbol("loaded"),X_=Symbol("status"),K_=Symbol("onFocus"),J_=Symbol("onBlur"),Y_=Symbol("onSlotChange"),$_=Symbol("onExtraModelChanged"),Z_=Symbol("updateSize"),tE=Symbol("intersectionObserver"),eE=Symbol("isElementInViewport"),iE=Symbol("announceModelVisibility"),nE=Symbol("ariaLabel"),rE=Symbol("altDefaulted"),sE=Symbol("statusElement"),aE=Symbol("updateStatus"),oE=Symbol("loadedTime"),lE=Symbol("updateSource"),cE=Symbol("markLoaded"),hE=Symbol("container"),uE=Symbol("input"),dE=Symbol("canvas"),pE=Symbol("scene"),AE=Symbol("needsRender"),gE=Symbol("tick"),mE=Symbol("onModelLoad"),fE=Symbol("onResize"),bE=Symbol("renderer"),vE=Symbol("progressTracker"),yE=Symbol("getLoaded"),xE=Symbol("getModelIsVisible"),_E=Symbol("shouldAttemptPreload"),EE=t=>({x:t.x,y:t.y,z:t.z,toString(){return`${this.x}m ${this.y}m ${this.z}m`}}),SE=t=>({u:t.x,v:t.y,toString(){return`${this.u} ${this.v}`}});class CE extends y{static get is(){return"model-viewer"}static set modelCacheSize(t){Pg[Dg].evictionThreshold=t}static get modelCacheSize(){return Pg[Dg].evictionThreshold}static set minimumRenderScale(t){t>1&&console.warn("<model-viewer> minimumRenderScale has been clamped to a maximum value of 1."),t<=0&&console.warn("<model-viewer> minimumRenderScale has been clamped to a minimum value of 0.25."),fy.singleton.minScale=t}static get minimumRenderScale(){return fy.singleton.minScale}get loaded(){return this[yE]()}get[(C_=eE,w_=W_,M_=oE,I_=X_,T_=q_,B_=Y_,R_=$_,D_=z_,L_=iE,P_=V_,F_=tE,U_=vE,bE)](){return fy.singleton}get modelIsVisible(){return this[xE]()}constructor(){super(),this.alt=null,this.src=null,this.withCredentials=!1,this.generateSchema=!1,this[C_]=!1,this[w_]=!1,this[M_]=0,this[I_]="",this[T_]=null,this[B_]=()=>{if(!this[pE])return;const t=Array.from(this.querySelectorAll("extra-model")),e=t.map(t=>t.src).filter(t=>null!=t),i=this[pE].extraUrls||[];e.join(",")===i.join(",")&&t.length===i.length||this[lE]()},this[R_]=t=>{const e=t,i=e.target,n=Array.from(this.querySelectorAll("extra-model")).indexOf(i);if(console.log(`[onExtraModelChanged] childIndex: ${n} srcChanged: ${e.detail.srcChanged} offset: ${e.detail.offset}`),-1===n)return;const r=this.src?n+1:n;e.detail.srcChanged?(this[W_]=!1,this[lE]()):this[pE]&&this[pE].updateModelTransforms(r,e.detail.offset,e.detail.orientation,e.detail.scale)},this[D_]=qd(()=>{const t=this.getBoundingClientRect();this[Z_](t)},50),this[L_]=qd(t=>{const e=this.modelIsVisible;e!==t&&this.dispatchEvent(new CustomEvent("model-visibility",{detail:{visible:e}}))},0),this[P_]=null,this[F_]=null,this[U_]=new S_,this[N_]=()=>{this[sE].textContent=this[X_]},this[O_]=()=>{this[sE].textContent=""},this[k_]=t=>{this.dispatchEvent(new CustomEvent("error",{detail:{type:"webglcontextlost",sourceError:t.sourceEvent}}))},this.attachShadow({mode:"open"});const t=this.shadowRoot;let e,i;if((t=>{rt(Zd,t)})(t),this[hE]=t.querySelector(".container"),this[uE]=t.querySelector(".userInput"),this[dE]=t.querySelector("canvas"),this[sE]=t.querySelector("#status"),this[H_]=this[uE].getAttribute("aria-label"),this.isConnected){const t=this.getBoundingClientRect();e=t.width,i=t.height}else e=300,i=150;this[pE]=new E_({canvas:this[dE],element:this,width:e,height:i}),Promise.resolve().then(()=>{this[Z_](this.getBoundingClientRect())}),Rd&&(this[V_]=new ResizeObserver(t=>{if(!this[bE].isPresenting)for(let e of t)e.target===this&&this[Z_](e.contentRect)})),Dd?this[tE]=new IntersectionObserver(t=>{for(let e of t)if(e.target===this){const t=this.modelIsVisible;this[eE]=e.isIntersecting,this[iE](t),console.log(`IntersectionObserver fired! isIntersecting: ${e.isIntersecting}`),this[eE]&&!this.loaded&&this[lE]()}},{root:null,rootMargin:"0px",threshold:1e-5}):this[eE]=!0}connectedCallback(){super.connectedCallback&&super.connectedCallback(),Rd?this[V_].observe(this):self.addEventListener("resize",this[z_]),Dd&&this[tE].observe(this),this.addEventListener("focus",this[K_]),this.addEventListener("blur",this[J_]),this.addEventListener("extra-model-changed",this[$_]);const t=this.shadowRoot.querySelector(".slot.default slot");t&&t.addEventListener("slotchange",this[Y_]);const e=this[bE];e.addEventListener("contextlost",this[j_]),e.registerScene(this[pE]),null!=this[q_]&&(self.clearTimeout(this[q_]),this[q_]=null,this.requestUpdate("src",null))}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback(),Rd?this[V_].unobserve(this):self.removeEventListener("resize",this[z_]),Dd&&this[tE].unobserve(this),this.removeEventListener("focus",this[K_]),this.removeEventListener("blur",this[J_]),this.removeEventListener("extra-model-changed",this[$_]);const t=this.shadowRoot.querySelector(".slot.default slot");t&&t.removeEventListener("slotchange",this[Y_]);const e=this[bE];e.removeEventListener("contextlost",this[j_]),e.unregisterScene(this[pE]),this[q_]=self.setTimeout(()=>{this[pE].dispose(),this[q_]=null},10)}updated(t){if(super.updated(t),t.has("src")){const t=Array.from(this.querySelectorAll("extra-model")),e=t.map(t=>t.src).filter(t=>null!=t),i=e.join(",")===(this[pE].extraUrls||[]).join(",");null==this.src&&0===t.length?(this[W_]=!1,this[oE]=0,this[pE].reset()):this.src===this[pE].url&&i||(this[W_]=!1,this[oE]=0,this[lE]())}if(t.has("alt")&&this[uE].setAttribute("aria-label",this[nE]),t.has("generateSchema"))if(this.generateSchema){const t=Array.from(this.querySelectorAll("extra-model")).map(t=>t.src).filter(t=>null!=t),e=this.src||t[0]||null;this[pE].updateSchema(e)}else this[pE].updateSchema(null)}toDataURL(t,e){return this[bE].displayCanvas(this[pE]).toDataURL(t,e)}async toBlob(t){const e=t?t.mimeType:void 0,i=t?t.qualityArgument:void 0,n=t?t.idealAspect:void 0,{width:r,height:s,idealAspect:a,aspect:o}=this[pE],{dpr:l,scaleFactor:c}=this[bE];let h=r*c*l,u=s*c*l,d=0,p=0;if(!0===n)if(a>o){const t=u;u=Math.round(h/a),p=(t-u)/2}else{const t=h;h=Math.round(u*a),d=(t-h)/2}G_.width=h,G_.height=u;try{return new Promise(async(t,n)=>{G_.getContext("2d").drawImage(this[bE].displayCanvas(this[pE]),d,p,h,u,0,0,h,u),G_.toBlob(e=>{if(!e)return n(new Error("Unable to retrieve canvas blob"));t(e)},e,i)})}finally{this[Z_]({width:r,height:s})}}registerEffectComposer(t){t.setRenderer(this[bE].threeRenderer),t.setMainCamera(this[pE].getCamera()),t.setMainScene(this[pE]),this[pE].effectRenderer=t}unregisterEffectComposer(){this[pE].effectRenderer=null}registerRenderer(t){this[pE].externalRenderer=t}unregisterRenderer(){this[pE].externalRenderer=null}get[nE](){return this[rE]}get[rE](){return null==this.alt||"null"===this.alt?this[H_]:this.alt}[yE](){return this[W_]}[xE](){return this.loaded&&this[eE]}[_E](){const t=Array.from(this.querySelectorAll("extra-model"));return!!(this.src||t.length>0)&&this[eE]}[Z_]({width:t,height:e}){0!==t&&0!==e&&(this[hE].style.width=`${t}px`,this[hE].style.height=`${e}px`,this[fE]({width:t,height:e}))}[gE](t,e){var i;null===(i=this[pE].effectRenderer)||void 0===i||i.beforeRender(t,e)}[cE](){this[W_]||(this[W_]=!0,this[oE]=performance.now())}[AE](){this[pE].queueRender()}[mE](){}[aE](t){this[X_]=t;const e=this.getRootNode();null!=e&&e.activeElement===this&&this[sE].textContent!=t&&(this[sE].textContent=t)}[(N_=K_,O_=J_,fE)](t){this[pE].setSize(t.width,t.height)}async[(k_=j_,lE)](){const t=this[pE],e=Array.from(this.querySelectorAll("extra-model")).map(t=>t.src).filter(t=>null!=t),i=e.join(",")===(t.extraUrls||[]).join(",");if(console.log(`[$updateSource] called! \nsrc: ${this.src}\nextraUrls: ${e.join(",")}\nloaded: ${this.loaded}`),this.loaded||!this[_E]()||this.src===t.url&&i)return void console.log("[$updateSource] BAILING OUT EARLY!");const n=this.src,r=n||e[0]||null;this.generateSchema&&t.updateSchema(r),this[aE]("Loading"),t.stopAnimation();const s=this[vE].beginActivity("model-load");try{const i=t.setSource(n,e,t=>s(.95*jd(t,0,1))),a=this[Yd]();await Promise.all([i,a]);Array.from(this.querySelectorAll("extra-model")).forEach((t,e)=>{const i=this.src?e+1:e;this[pE].updateModelTransforms(i,t.offset,t.orientation,t.scale)}),this[cE](),this[mE](),this.updateComplete.then(()=>{this.dispatchEvent(new CustomEvent("before-render"))}),await new Promise(t=>{const e=setTimeout(()=>{console.warn("rAF timed out in updateSource"),t()},500);requestAnimationFrame(()=>{requestAnimationFrame(()=>{clearTimeout(e),t()})})}),this.dispatchEvent(new CustomEvent("load",{detail:{url:r}}))}catch(t){this.dispatchEvent(new CustomEvent("error",{detail:{type:"loadfailure",sourceError:t}}))}finally{s(1)}}}Q_([ht({type:String})],CE.prototype,"alt",void 0),Q_([ht({type:String})],CE.prototype,"src",void 0),Q_([ht({type:Boolean,attribute:"with-credentials"})],CE.prototype,"withCredentials",void 0),Q_([ht({type:Boolean,attribute:"generate-schema"})],CE.prototype,"generateSchema",void 0);
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
var wE=function(t,e,i,n){for(var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n,o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};const ME=Symbol("changeAnimation"),IE=Symbol("appendAnimation"),TE=Symbol("detachAnimation"),BE=Symbol("paused"),RE={repetitions:1/0,pingpong:!1},DE={pingpong:!1,repetitions:null,weight:1,timeScale:1,fade:!1,warp:!1,relativeWarp:!0,time:null},LE={fade:!0},PE=Symbol("hotspotMap"),FE=Symbol("mutationCallback"),UE=Symbol("observer"),NE=Symbol("addHotspot"),OE=Symbol("removeHotspot");
|
|
/*!
|
|
fflate - fast JavaScript compression/decompression
|
|
<https://101arrowz.github.io/fflate>
|
|
Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE
|
|
version 0.8.2
|
|
*/
|
|
var kE=Uint8Array,QE=Uint16Array,GE=Int32Array,zE=new kE([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),HE=new kE([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),VE=new kE([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),qE=function(t,e){for(var i=new QE(31),n=0;n<31;++n)i[n]=e+=1<<t[n-1];var r=new GE(i[30]);for(n=1;n<30;++n)for(var s=i[n];s<i[n+1];++s)r[s]=s-i[n]<<5|n;return{b:i,r:r}},jE=qE(zE,2),WE=jE.b,XE=jE.r;WE[28]=258,XE[258]=28;for(var KE=qE(HE,0).r,JE=new QE(32768),YE=0;YE<32768;++YE){var $E=(43690&YE)>>1|(21845&YE)<<1;$E=(61680&($E=(52428&$E)>>2|(13107&$E)<<2))>>4|(3855&$E)<<4,JE[YE]=((65280&$E)>>8|(255&$E)<<8)>>1}var ZE=function(t,e,i){for(var n=t.length,r=0,s=new QE(e);r<n;++r)t[r]&&++s[t[r]-1];var a,o=new QE(e);for(r=1;r<e;++r)o[r]=o[r-1]+s[r-1]<<1;if(i){a=new QE(1<<e);var l=15-e;for(r=0;r<n;++r)if(t[r])for(var c=r<<4|t[r],h=e-t[r],u=o[t[r]-1]++<<h,d=u|(1<<h)-1;u<=d;++u)a[JE[u]>>l]=c}else for(a=new QE(n),r=0;r<n;++r)t[r]&&(a[r]=JE[o[t[r]-1]++]>>15-t[r]);return a},tS=new kE(288);for(YE=0;YE<144;++YE)tS[YE]=8;for(YE=144;YE<256;++YE)tS[YE]=9;for(YE=256;YE<280;++YE)tS[YE]=7;for(YE=280;YE<288;++YE)tS[YE]=8;var eS=new kE(32);for(YE=0;YE<32;++YE)eS[YE]=5;var iS=ZE(tS,9,0),nS=ZE(eS,5,0),rS=function(t){return(t+7)/8|0},sS=function(t,e,i){return(null==i||i>t.length)&&(i=t.length),new kE(t.subarray(e,i))},aS=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],oS=function(t,e,i){var n=new Error(e||aS[t]);if(n.code=t,Error.captureStackTrace&&Error.captureStackTrace(n,oS),!i)throw n;return n},lS=function(t,e,i){i<<=7&e;var n=e/8|0;t[n]|=i,t[n+1]|=i>>8},cS=function(t,e,i){i<<=7&e;var n=e/8|0;t[n]|=i,t[n+1]|=i>>8,t[n+2]|=i>>16},hS=function(t,e){for(var i=[],n=0;n<t.length;++n)t[n]&&i.push({s:n,f:t[n]});var r=i.length,s=i.slice();if(!r)return{t:fS,l:0};if(1==r){var a=new kE(i[0].s+1);return a[i[0].s]=1,{t:a,l:1}}i.sort(function(t,e){return t.f-e.f}),i.push({s:-1,f:25001});var o=i[0],l=i[1],c=0,h=1,u=2;for(i[0]={s:-1,f:o.f+l.f,l:o,r:l};h!=r-1;)o=i[i[c].f<i[u].f?c++:u++],l=i[c!=h&&i[c].f<i[u].f?c++:u++],i[h++]={s:-1,f:o.f+l.f,l:o,r:l};var d=s[0].s;for(n=1;n<r;++n)s[n].s>d&&(d=s[n].s);var p=new QE(d+1),A=uS(i[h-1],p,0);if(A>e){n=0;var g=0,m=A-e,f=1<<m;for(s.sort(function(t,e){return p[e.s]-p[t.s]||t.f-e.f});n<r;++n){var b=s[n].s;if(!(p[b]>e))break;g+=f-(1<<A-p[b]),p[b]=e}for(g>>=m;g>0;){var v=s[n].s;p[v]<e?g-=1<<e-p[v]++-1:++n}for(;n>=0&&g;--n){var y=s[n].s;p[y]==e&&(--p[y],++g)}A=e}return{t:new kE(p),l:A}},uS=function(t,e,i){return-1==t.s?Math.max(uS(t.l,e,i+1),uS(t.r,e,i+1)):e[t.s]=i},dS=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new QE(++e),n=0,r=t[0],s=1,a=function(t){i[n++]=t},o=1;o<=e;++o)if(t[o]==r&&o!=e)++s;else{if(!r&&s>2){for(;s>138;s-=138)a(32754);s>2&&(a(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(a(r),--s;s>6;s-=6)a(8304);s>2&&(a(s-3<<5|8208),s=0)}for(;s--;)a(r);s=1,r=t[o]}return{c:i.subarray(0,n),n:e}},pS=function(t,e){for(var i=0,n=0;n<e.length;++n)i+=t[n]*e[n];return i},AS=function(t,e,i){var n=i.length,r=rS(e+2);t[r]=255&n,t[r+1]=n>>8,t[r+2]=255^t[r],t[r+3]=255^t[r+1];for(var s=0;s<n;++s)t[r+s+4]=i[s];return 8*(r+4+n)},gS=function(t,e,i,n,r,s,a,o,l,c,h){lS(e,h++,i),++r[256];for(var u=hS(r,15),d=u.t,p=u.l,A=hS(s,15),g=A.t,m=A.l,f=dS(d),b=f.c,v=f.n,y=dS(g),x=y.c,_=y.n,E=new QE(19),S=0;S<b.length;++S)++E[31&b[S]];for(S=0;S<x.length;++S)++E[31&x[S]];for(var C=hS(E,7),w=C.t,M=C.l,I=19;I>4&&!w[VE[I-1]];--I);var T,B,R,D,L=c+5<<3,P=pS(r,tS)+pS(s,eS)+a,F=pS(r,d)+pS(s,g)+a+14+3*I+pS(E,w)+2*E[16]+3*E[17]+7*E[18];if(l>=0&&L<=P&&L<=F)return AS(e,h,t.subarray(l,l+c));if(lS(e,h,1+(F<P)),h+=2,F<P){T=ZE(d,p,0),B=d,R=ZE(g,m,0),D=g;var U=ZE(w,M,0);lS(e,h,v-257),lS(e,h+5,_-1),lS(e,h+10,I-4),h+=14;for(S=0;S<I;++S)lS(e,h+3*S,w[VE[S]]);h+=3*I;for(var N=[b,x],O=0;O<2;++O){var k=N[O];for(S=0;S<k.length;++S){var Q=31&k[S];lS(e,h,U[Q]),h+=w[Q],Q>15&&(lS(e,h,k[S]>>5&127),h+=k[S]>>12)}}}else T=iS,B=tS,R=nS,D=eS;for(S=0;S<o;++S){var G=n[S];if(G>255){cS(e,h,T[(Q=G>>18&31)+257]),h+=B[Q+257],Q>7&&(lS(e,h,G>>23&31),h+=zE[Q]);var z=31&G;cS(e,h,R[z]),h+=D[z],z>3&&(cS(e,h,G>>5&8191),h+=HE[z])}else cS(e,h,T[G]),h+=B[G]}return cS(e,h,T[256]),h+B[256]},mS=new GE([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),fS=new kE(0),bS=function(){for(var t=new Int32Array(256),e=0;e<256;++e){for(var i=e,n=9;--n;)i=(1&i&&-306674912)^i>>>1;t[e]=i}return t}(),vS=function(){var t=-1;return{p:function(e){for(var i=t,n=0;n<e.length;++n)i=bS[255&i^e[n]]^i>>>8;t=i},d:function(){return~t}}},yS=function(t,e,i,n,r){if(!r&&(r={l:1},e.dictionary)){var s=e.dictionary.subarray(-32768),a=new kE(s.length+t.length);a.set(s),a.set(t,s.length),t=a,r.w=s.length}return function(t,e,i,n,r,s){var a=s.z||t.length,o=new kE(n+a+5*(1+Math.ceil(a/7e3))+r),l=o.subarray(n,o.length-r),c=s.l,h=7&(s.r||0);if(e){h&&(l[0]=s.r>>3);for(var u=mS[e-1],d=u>>13,p=8191&u,A=(1<<i)-1,g=s.p||new QE(32768),m=s.h||new QE(A+1),f=Math.ceil(i/3),b=2*f,v=function(e){return(t[e]^t[e+1]<<f^t[e+2]<<b)&A},y=new GE(25e3),x=new QE(288),_=new QE(32),E=0,S=0,C=s.i||0,w=0,M=s.w||0,I=0;C+2<a;++C){var T=v(C),B=32767&C,R=m[T];if(g[B]=R,m[T]=B,M<=C){var D=a-C;if((E>7e3||w>24576)&&(D>423||!c)){h=gS(t,l,0,y,x,_,S,w,I,C-I,h),w=E=S=0,I=C;for(var L=0;L<286;++L)x[L]=0;for(L=0;L<30;++L)_[L]=0}var P=2,F=0,U=p,N=B-R&32767;if(D>2&&T==v(C-N))for(var O=Math.min(d,D)-1,k=Math.min(32767,C),Q=Math.min(258,D);N<=k&&--U&&B!=R;){if(t[C+P]==t[C+P-N]){for(var G=0;G<Q&&t[C+G]==t[C+G-N];++G);if(G>P){if(P=G,F=N,G>O)break;var z=Math.min(N,G-2),H=0;for(L=0;L<z;++L){var V=C-N+L&32767,q=V-g[V]&32767;q>H&&(H=q,R=V)}}}N+=(B=R)-(R=g[B])&32767}if(F){y[w++]=268435456|XE[P]<<18|KE[F];var j=31&XE[P],W=31&KE[F];S+=zE[j]+HE[W],++x[257+j],++_[W],M=C+P,++E}else y[w++]=t[C],++x[t[C]]}}for(C=Math.max(C,M);C<a;++C)y[w++]=t[C],++x[t[C]];h=gS(t,l,c,y,x,_,S,w,I,C-I,h),c||(s.r=7&h|l[h/8|0]<<3,h-=7,s.h=m,s.p=g,s.i=C,s.w=M)}else{for(C=s.w||0;C<a+c;C+=65535){var X=C+65535;X>=a&&(l[h/8|0]=c,X=a),h=AS(l,h+1,t.subarray(C,X))}s.i=a}return sS(o,0,n+rS(h)+r)}(t,null==e.level?6:e.level,null==e.mem?r.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):20:12+e.mem,i,n,r)},xS=function(t,e){var i={};for(var n in t)i[n]=t[n];for(var n in e)i[n]=e[n];return i},_S=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8};function ES(t,e){return yS(t,e||{},0,0)}var SS=function(t,e,i,n){for(var r in t){var s=t[r],a=e+r,o=n;Array.isArray(s)&&(o=xS(n,s[1]),s=s[0]),s instanceof kE?i[a]=[s,o]:(i[a+="/"]=[new kE(0),o],SS(s,a,i,n))}},CS="undefined"!=typeof TextEncoder&&new TextEncoder,wS="undefined"!=typeof TextDecoder&&new TextDecoder;try{wS.decode(fS,{stream:!0})}catch(S){}function MS(t,e){if(CS)return CS.encode(t);for(var i=t.length,n=new kE(t.length+(t.length>>1)),r=0,s=function(t){n[r++]=t},a=0;a<i;++a){if(r+5>n.length){var o=new kE(r+8+(i-a<<1));o.set(n),n=o}var l=t.charCodeAt(a);l<128||e?s(l):l<2048?(s(192|l>>6),s(128|63&l)):l>55295&&l<57344?(s(240|(l=65536+(1047552&l)|1023&t.charCodeAt(++a))>>18),s(128|l>>12&63),s(128|l>>6&63),s(128|63&l)):(s(224|l>>12),s(128|l>>6&63),s(128|63&l))}return sS(n,0,r)}var IS=function(t){var e=0;if(t)for(var i in t){var n=t[i].length;n>65535&&oS(9),e+=n+4}return e},TS=function(t,e,i,n,r,s,a,o){var l=n.length,c=i.extra,h=o&&o.length,u=IS(c);_S(t,e,null!=a?33639248:67324752),e+=4,null!=a&&(t[e++]=20,t[e++]=i.os),t[e]=20,e+=2,t[e++]=i.flag<<1|(s<0&&8),t[e++]=r&&8,t[e++]=255&i.compression,t[e++]=i.compression>>8;var d=new Date(null==i.mtime?Date.now():i.mtime),p=d.getFullYear()-1980;if((p<0||p>119)&&oS(10),_S(t,e,p<<25|d.getMonth()+1<<21|d.getDate()<<16|d.getHours()<<11|d.getMinutes()<<5|d.getSeconds()>>1),e+=4,-1!=s&&(_S(t,e,i.crc),_S(t,e+4,s<0?-s-2:s),_S(t,e+8,i.size)),_S(t,e+12,l),_S(t,e+14,u),e+=16,null!=a&&(_S(t,e,h),_S(t,e+6,i.attrs),_S(t,e+10,a),e+=14),t.set(n,e),e+=l,u)for(var A in c){var g=c[A],m=g.length;_S(t,e,+A),_S(t,e+2,m),t.set(g,e+4),e+=4+m}return h&&(t.set(o,e),e+=h),e};function BS(t,e){e||(e={});var i={},n=[];SS(t,"",i,e);var r=0,s=0;for(var a in i){var o=i[a],l=o[0],c=o[1],h=0==c.level?0:8,u=(E=MS(a)).length,d=c.comment,p=d&&MS(d),A=p&&p.length,g=IS(c.extra);u>65535&&oS(11);var m=h?ES(l,c):l,f=m.length,b=vS();b.p(l),n.push(xS(c,{size:l.length,crc:b.d(),c:m,f:E,m:p,u:u!=a.length||p&&d.length!=A,o:r,compression:h})),r+=30+u+g+f,s+=76+2*(u+g)+(A||0)+f}for(var v=new kE(s+22),y=r,x=s-r,_=0;_<n.length;++_){var E=n[_];TS(v,E.o,E,E.f,E.u,E.c.length);var S=30+E.f.length+IS(E.extra);v.set(E.c,E.o+S),TS(v,r,E,E.f,E.u,E.c.length,E.o,E.m),r+=16+S+(E.m?E.m.length:0)}return function(t,e,i,n,r){_S(t,e,101010256),_S(t,e+8,i),_S(t,e+10,i),_S(t,e+12,n),_S(t,e+16,r)}(v,r,n.length,x,y),v}class RS{constructor(t,e="",i=[],n=[]){this.name=t,this.type=e,this.metadata=i,this.properties=n,this.children=[]}addMetadata(t,e){this.metadata.push({key:t,value:e})}addProperty(t,e=[]){this.properties.push({property:t,metadata:e})}addChild(t){this.children.push(t)}toString(t=0){const e="\t".repeat(t),i=this.metadata.map(t=>{const i=t.key,n=t.value;if(Array.isArray(n)){const t=[];return t.push(`${i} = {`),n.forEach(i=>{t.push(`${e}\t\t${i}`)}),t.push(`${e}\t}`),t.join("\n")}return`${i} = ${n}`}),n=i.length?` (\n${i.map(t=>`${e}\t${t}`).join("\n")}\n${e})`:"",r=this.properties.map(t=>{const i=t.property,n=t.metadata.length?` (\n${t.metadata.map(t=>`${e}\t\t${t}`).join("\n")}\n${e}\t)`:"";return`${e}\t${i}${n}`}),s=this.children.map(e=>e.toString(t+1)),a=[];if(r.length>0&&a.push(...r),s.length>0){r.length>0&&a.push("");for(let t=0;t<s.length;t++)a.push(s[t]),t<s.length-1&&a.push("")}const o=a.join("\n"),l=this.type?this.type+" ":"";return`${e}def ${l}"${this.name}"${n}\n${e}{\n${o}\n${e}}`}}class DS{constructor(){this.textureUtils=null}setTextureUtils(t){this.textureUtils=t}parse(t,e,i,n){this.parseAsync(t,n).then(e).catch(i)}async parseAsync(t,e={}){e=Object.assign({ar:{anchoring:{type:"plane"},planeAnchoring:{alignment:"horizontal"}},includeAnchoringProperties:!0,onlyVisible:!0,quickLookCompatible:!1,maxTextureSize:1024},e);const i=new Set,n={},r="model.usda";n[r]=null;const s=new RS("Root","Xform"),a=new RS("Scenes","Scope");a.addMetadata("kind",'"sceneLibrary"'),s.addChild(a);const o="Scene",l=new RS(o,"Xform");let c;l.addMetadata("customData",["bool preliminary_collidesWithEnvironment = 0",`string sceneName = "${o}"`]),l.addMetadata("sceneName",`"${o}"`),e.includeAnchoringProperties&&(l.addProperty(`token preliminary:anchoring:type = "${e.ar.anchoring.type}"`),l.addProperty(`token preliminary:planeAnchoring:alignment = "${e.ar.planeAnchoring.alignment}"`)),a.addChild(l);const h={},u={};NS(t,l,h,i,n,e);const d=function(t,e,i=!1){const n=new RS("Materials");for(const r in t){const s=t[r];n.addChild(qS(s,e,i))}return n}(h,u,e.quickLookCompatible);c=US()+"\n"+s.toString()+"\n\n"+d.toString(),n[r]=MS(c),c=null;for(const t in u){let i=u[t];if(!0===i.isCompressedTexture){if(null===this.textureUtils)throw new Error("THREE.USDZExporter: setTextureUtils() must be called to process compressed textures.");i=await this.textureUtils.decompress(i)}const r=PS(i.image,i.flipY,e.maxTextureSize),s=await new Promise(t=>r.toBlob(t,"image/png",1));n[`textures/Texture_${t}.png`]=new Uint8Array(await s.arrayBuffer())}let p=0;for(const t in n){const e=n[t];p+=34+t.length;const i=63&p;if(4!==i){const r=new Uint8Array(64-i);n[t]=[e,{extra:{12345:r}}]}p=e.length}return BS(n,{level:0})}}function LS(t,e){let i=t.name;return i=i.replace(/[^A-Za-z0-9_]/g,""),/^[0-9]/.test(i)&&(i="_"+i),""===i&&(i=t.isCamera?"Camera":"Object"),e.has(i)&&(i=i+"_"+t.id),e.add(i),i}function PS(t,e,i){if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&t instanceof OffscreenCanvas||"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap){const n=i/Math.max(t.width,t.height),r=document.createElement("canvas");r.width=t.width*Math.min(1,n),r.height=t.height*Math.min(1,n);const s=r.getContext("2d");return!0===e&&(s.translate(0,r.height),s.scale(1,-1)),s.drawImage(t,0,0,r.width,r.height),r}throw new Error("THREE.USDZExporter: No valid image data found. Unable to process texture.")}const FS=7;function US(){return'#usda 1.0\n(\n\tcustomLayerData = {\n\t\tstring creator = "Three.js USDZExporter"\n\t}\n\tdefaultPrim = "Root"\n\tmetersPerUnit = 1\n\tupAxis = "Y"\n)\n'}function NS(t,e,i,n,r,s){for(let a=0,o=t.children.length;a<o;a++){const o=t.children[a];if(!1===o.visible&&!0===s.onlyVisible)continue;let l;if(o.isMesh){const t=o.geometry,e=o.material;if(e.isMeshStandardMaterial){const s="geometries/Geometry_"+t.id+".usda";if(!(s in r)){const e=zS(t);r[s]=MS(US()+"\n"+e.toString())}e.uuid in i||(i[e.uuid]=e),l=kS(o,t,i[e.uuid],n)}else console.warn("THREE.USDZExporter: Unsupported material type (USDZ only supports MeshStandardMaterial)",o)}else l=o.isCamera?XS(o,n):OS(o,n);l&&(e.addChild(l),NS(o,l,i,n,r,s))}}function OS(t,e){const i=LS(t,e);t.matrix.determinant()<0&&console.warn("THREE.USDZExporter: USDZ does not support negative scales",t);const n=new RS(i,"Xform");if(null!==t.pivot){const e=t.position,i=t.quaternion,r=t.scale,s=t.pivot;n.addProperty(`float3 xformOp:translate = (${e.x.toPrecision(FS)}, ${e.y.toPrecision(FS)}, ${e.z.toPrecision(FS)})`),n.addProperty(`float3 xformOp:translate:pivot = (${s.x.toPrecision(FS)}, ${s.y.toPrecision(FS)}, ${s.z.toPrecision(FS)})`),n.addProperty(`quatf xformOp:orient = (${i.w.toPrecision(FS)}, ${i.x.toPrecision(FS)}, ${i.y.toPrecision(FS)}, ${i.z.toPrecision(FS)})`),n.addProperty(`float3 xformOp:scale = (${r.x.toPrecision(FS)}, ${r.y.toPrecision(FS)}, ${r.z.toPrecision(FS)})`),n.addProperty('uniform token[] xformOpOrder = ["xformOp:translate", "xformOp:translate:pivot", "xformOp:orient", "xformOp:scale", "!invert!xformOp:translate:pivot"]')}else{const e=QS(t.matrix);n.addProperty(`matrix4d xformOp:transform = ${e}`),n.addProperty('uniform token[] xformOpOrder = ["xformOp:transform"]')}return n}function kS(t,e,i,n){const r=OS(t,n);return r.addMetadata("prepend references",`@./geometries/Geometry_${e.id}.usda@</Geometry>`),r.addMetadata("prepend apiSchemas",'["MaterialBindingAPI"]'),r.addProperty(`rel material:binding = </Materials/Material_${i.id}>`),r}function QS(t){const e=t.elements;return`( ${GS(e,0)}, ${GS(e,4)}, ${GS(e,8)}, ${GS(e,12)} )`}function GS(t,e){return`(${t[e+0]}, ${t[e+1]}, ${t[e+2]}, ${t[e+3]})`}function zS(t){const e=new RS("Geometry"),i=function(t){const e="Geometry",i=t.attributes,n=i.position.count,r=new RS(e,"Mesh");r.addProperty(`int[] faceVertexCounts = [${function(t){const e=null!==t.index?t.index.count:t.attributes.position.count;return Array(e/3).fill(3).join(", ")}(t)}]`),r.addProperty(`int[] faceVertexIndices = [${function(t){const e=t.index,i=[];if(null!==e)for(let t=0;t<e.count;t++)i.push(e.getX(t));else{const e=t.attributes.position.count;for(let t=0;t<e;t++)i.push(t)}return i.join(", ")}(t)}]`),r.addProperty(`normal3f[] normals = [${HS(i.normal,n)}]`,['interpolation = "vertex"']),r.addProperty(`point3f[] points = [${HS(i.position,n)}]`);for(let t=0;t<4;t++){const e=t>0?t:"",n=i["uv"+e];void 0!==n&&r.addProperty(`texCoord2f[] primvars:st${e} = [${VS(n)}]`,['interpolation = "vertex"'])}const s=i.color;void 0!==s&&r.addProperty(`color3f[] primvars:displayColor = [${HS(s,n)}]`,['interpolation = "vertex"']);return r.addProperty('uniform token subdivisionScheme = "none"'),r}(t);return e.addChild(i),e}function HS(t,e){if(void 0===t)return console.warn("USDZExporter: Normals missing."),Array(e).fill("(0, 0, 0)").join(", ");const i=[];for(let e=0;e<t.count;e++){const n=t.getX(e),r=t.getY(e),s=t.getZ(e);i.push(`(${n.toPrecision(FS)}, ${r.toPrecision(FS)}, ${s.toPrecision(FS)})`)}return i.join(", ")}function VS(t){const e=[];for(let i=0;i<t.count;i++){const n=t.getX(i),r=t.getY(i);e.push(`(${n.toPrecision(FS)}, ${1-r.toPrecision(FS)})`)}return e.join(", ")}function qS(t,e,i=!1){const n=new RS(`Material_${t.id}`,"Material");function r(n,r,s){const a=n.source.id+"_"+n.flipY;e[a]=n;const o=n.channel>0?"st"+n.channel:"st",l={1e3:"repeat",1001:"clamp",1002:"mirror"},c=n.repeat.clone(),h=n.offset.clone(),u=n.rotation,d=Math.sin(u),p=Math.cos(u);h.y=1-h.y-c.y,i?(h.x=h.x/c.x,h.y=h.y/c.y,h.x+=d/c.x,h.y+=p-1):(h.x+=d*c.x,h.y+=(1-p)*c.y);const A=new RS(`PrimvarReader_${r}`,"Shader");A.addProperty('uniform token info:id = "UsdPrimvarReader_float2"'),A.addProperty("float2 inputs:fallback = (0.0, 0.0)"),A.addProperty(`string inputs:varname = "${o}"`),A.addProperty("float2 outputs:result");const g=new RS(`Transform2d_${r}`,"Shader");g.addProperty('uniform token info:id = "UsdTransform2d"'),g.addProperty(`float2 inputs:in.connect = </Materials/Material_${t.id}/PrimvarReader_${r}.outputs:result>`),g.addProperty(`float inputs:rotation = ${(u*(180/Math.PI)).toFixed(FS)}`),g.addProperty(`float2 inputs:scale = ${WS(c)}`),g.addProperty(`float2 inputs:translation = ${WS(h)}`),g.addProperty("float2 outputs:result");const m=new RS(`Texture_${n.id}_${r}`,"Shader");return m.addProperty('uniform token info:id = "UsdUVTexture"'),m.addProperty(`asset inputs:file = @textures/Texture_${a}.png@`),m.addProperty(`float2 inputs:st.connect = </Materials/Material_${t.id}/Transform2d_${r}.outputs:result>`),void 0!==s&&m.addProperty(`float4 inputs:scale = ${function(t){return`(${t.r}, ${t.g}, ${t.b}, 1.0)`}(s)}`),"normal"===r&&(m.addProperty("float4 inputs:scale = (2, 2, 2, 1)"),m.addProperty("float4 inputs:bias = (-1, -1, -1, 0)")),m.addProperty(`token inputs:sourceColorSpace = "${n.colorSpace===Ri?"raw":"sRGB"}"`),m.addProperty(`token inputs:wrapS = "${l[n.wrapS]}"`),m.addProperty(`token inputs:wrapT = "${l[n.wrapT]}"`),m.addProperty("float outputs:r"),m.addProperty("float outputs:g"),m.addProperty("float outputs:b"),m.addProperty("float3 outputs:rgb"),(t.transparent||t.alphaTest>0)&&m.addProperty("float outputs:a"),[A,g,m]}2===t.side&&console.warn("THREE.USDZExporter: USDZ does not support double sided materials",t);const s=new RS("PreviewSurface","Shader");if(s.addProperty('uniform token info:id = "UsdPreviewSurface"'),null!==t.map){s.addProperty(`color3f inputs:diffuseColor.connect = </Materials/Material_${t.id}/Texture_${t.map.id}_diffuse.outputs:rgb>`),t.transparent?s.addProperty(`float inputs:opacity.connect = </Materials/Material_${t.id}/Texture_${t.map.id}_diffuse.outputs:a>`):t.alphaTest>0&&(s.addProperty(`float inputs:opacity.connect = </Materials/Material_${t.id}/Texture_${t.map.id}_diffuse.outputs:a>`),s.addProperty(`float inputs:opacityThreshold = ${t.alphaTest}`));r(t.map,"diffuse",t.color).forEach(t=>n.addChild(t))}else s.addProperty(`color3f inputs:diffuseColor = ${jS(t.color)}`);if(null!==t.emissiveMap){s.addProperty(`color3f inputs:emissiveColor.connect = </Materials/Material_${t.id}/Texture_${t.emissiveMap.id}_emissive.outputs:rgb>`);const e=new Sr(t.emissive.r*t.emissiveIntensity,t.emissive.g*t.emissiveIntensity,t.emissive.b*t.emissiveIntensity);r(t.emissiveMap,"emissive",e).forEach(t=>n.addChild(t))}else t.emissive.getHex()>0&&s.addProperty(`color3f inputs:emissiveColor = ${jS(t.emissive)}`);if(null!==t.normalMap){s.addProperty(`normal3f inputs:normal.connect = </Materials/Material_${t.id}/Texture_${t.normalMap.id}_normal.outputs:rgb>`);r(t.normalMap,"normal").forEach(t=>n.addChild(t))}if(null!==t.aoMap){s.addProperty(`float inputs:occlusion.connect = </Materials/Material_${t.id}/Texture_${t.aoMap.id}_occlusion.outputs:r>`);const e=new Sr(t.aoMapIntensity,t.aoMapIntensity,t.aoMapIntensity);r(t.aoMap,"occlusion",e).forEach(t=>n.addChild(t))}if(null!==t.roughnessMap){s.addProperty(`float inputs:roughness.connect = </Materials/Material_${t.id}/Texture_${t.roughnessMap.id}_roughness.outputs:g>`);const e=new Sr(t.roughness,t.roughness,t.roughness);r(t.roughnessMap,"roughness",e).forEach(t=>n.addChild(t))}else s.addProperty(`float inputs:roughness = ${t.roughness}`);if(null!==t.metalnessMap){s.addProperty(`float inputs:metallic.connect = </Materials/Material_${t.id}/Texture_${t.metalnessMap.id}_metallic.outputs:b>`);const e=new Sr(t.metalness,t.metalness,t.metalness);r(t.metalnessMap,"metallic",e).forEach(t=>n.addChild(t))}else s.addProperty(`float inputs:metallic = ${t.metalness}`);if(null!==t.alphaMap){s.addProperty(`float inputs:opacity.connect = </Materials/Material_${t.id}/Texture_${t.alphaMap.id}_opacity.outputs:r>`),s.addProperty("float inputs:opacityThreshold = 0.0001");r(t.alphaMap,"opacity").forEach(t=>n.addChild(t))}else s.addProperty(`float inputs:opacity = ${t.opacity}`);if(t.isMeshPhysicalMaterial){if(null!==t.clearcoatMap){s.addProperty(`float inputs:clearcoat.connect = </Materials/Material_${t.id}/Texture_${t.clearcoatMap.id}_clearcoat.outputs:r>`);const e=new Sr(t.clearcoat,t.clearcoat,t.clearcoat);r(t.clearcoatMap,"clearcoat",e).forEach(t=>n.addChild(t))}else s.addProperty(`float inputs:clearcoat = ${t.clearcoat}`);if(null!==t.clearcoatRoughnessMap){s.addProperty(`float inputs:clearcoatRoughness.connect = </Materials/Material_${t.id}/Texture_${t.clearcoatRoughnessMap.id}_clearcoatRoughness.outputs:g>`);const e=new Sr(t.clearcoatRoughness,t.clearcoatRoughness,t.clearcoatRoughness);r(t.clearcoatRoughnessMap,"clearcoatRoughness",e).forEach(t=>n.addChild(t))}else s.addProperty(`float inputs:clearcoatRoughness = ${t.clearcoatRoughness}`);s.addProperty(`float inputs:ior = ${t.ior}`)}return s.addProperty("int inputs:useSpecularWorkflow = 0"),s.addProperty("token outputs:surface"),n.addChild(s),n.addProperty(`token outputs:surface.connect = </Materials/Material_${t.id}/PreviewSurface.outputs:surface>`),n}function jS(t){return`(${t.r}, ${t.g}, ${t.b})`}function WS(t){return`(${t.x}, ${t.y})`}function XS(t,e){const i=LS(t,e),n=QS(t.matrix);t.matrix.determinant()<0&&console.warn("THREE.USDZExporter: USDZ does not support negative scales",t);const r=new RS(i,"Camera");r.addProperty(`matrix4d xformOp:transform = ${n}`),r.addProperty('uniform token[] xformOpOrder = ["xformOp:transform"]');const s=t.isOrthographicCamera?"orthographic":"perspective";r.addProperty(`token projection = "${s}"`);const a=`(${t.near.toPrecision(FS)}, ${t.far.toPrecision(FS)})`;let o,l;if(r.addProperty(`float2 clippingRange = ${a}`),o=t.isOrthographicCamera?(10*(Math.abs(t.left)+Math.abs(t.right))).toPrecision(FS):t.getFilmWidth().toPrecision(FS),r.addProperty(`float horizontalAperture = ${o}`),l=t.isOrthographicCamera?(10*(Math.abs(t.top)+Math.abs(t.bottom))).toPrecision(FS):t.getFilmHeight().toPrecision(FS),r.addProperty(`float verticalAperture = ${l}`),t.isPerspectiveCamera){const e=t.getFocalLength().toPrecision(FS);r.addProperty(`float focalLength = ${e}`);const i=t.focus.toPrecision(FS);r.addProperty(`float focusDistance = ${i}`)}return r}
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
var KS=function(t,e,i,n){for(var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n,o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};let JS=!1,YS=!1;const $S="#model-viewer-no-ar-fallback",ZS=(tC=["quick-look","scene-viewer","webxr","none"],t=>{try{const e=$m(t),i=(e.length?e[0].terms:[]).filter(t=>t&&"ident"===t.type).map(t=>t.value).filter(t=>tC.indexOf(t)>-1);return new Set(i)}catch(t){}return new Set});var tC;const eC="quick-look",iC="scene-viewer",nC="webxr",rC="none",sC=Symbol("arButtonContainer"),aC=Symbol("enterARWithWebXR"),oC=Symbol("openSceneViewer"),lC=Symbol("openIOSARQuickLook"),cC=Symbol("canActivateAR"),hC=Symbol("arMode"),uC=Symbol("arModes"),dC=Symbol("arAnchor"),pC=Symbol("preload"),AC=Symbol("onARButtonContainerClick"),gC=Symbol("onARStatus"),mC=Symbol("onARTracking"),fC=Symbol("onARTap"),bC=Symbol("selectARMode"),vC=Symbol("triggerLoad");
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
var yC=function(t,e,i,n){for(var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n,o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};const xC="auto",_C="auto",EC="eager",SC=Symbol("defaultProgressBarElement"),CC=Symbol("posterContainerElement"),wC=Symbol("defaultPosterElement"),MC=Symbol("shouldDismissPoster"),IC=Symbol("hidePoster"),TC=Symbol("modelIsRevealed"),BC=Symbol("updateProgressBar"),RC=Symbol("ariaLabelCallToAction"),DC=Symbol("onProgress");
|
|
/* @license
|
|
* Copyright 2019 Google LLC. All Rights Reserved.
|
|
* Licensed under the Apache License, Version 2.0 (the 'License');
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an 'AS IS' BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
var LC=function(t,e,i,n){for(var r,s=arguments.length,a=s<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n,o=t.length-1;o>=0;o--)(r=t[o])&&(a=(s<3?r(a):s>3?r(e,i,a):r(e,i))||a);return s>3&&a&&Object.defineProperty(e,i,a),a};const PC=Math.PI/32,FC={basis:[lf(Ym(PC,"rad"))],keywords:{auto:[null]}},UC=Symbol("autoRotateStartTime"),NC=Symbol("radiansPerSecond"),OC=Symbol("syncRotationRate"),kC=Symbol("onCameraChange"),QC=(t=>{var e,i,n;class r extends t{constructor(){super(...arguments),this[e]=new Map,this[i]=t=>{t.forEach(t=>{t instanceof MutationRecord&&"childList"!==t.type||(t.addedNodes.forEach(t=>{this[NE](t)}),t.removedNodes.forEach(t=>{this[OE](t)}),this[AE]())})},this[n]=new MutationObserver(this[FE])}connectedCallback(){super.connectedCallback();for(let t=0;t<this.children.length;++t)this[NE](this.children[t]);const{ShadyDOM:t}=self;null==t?this[UE].observe(this,{childList:!0}):this[UE]=t.observeChildren(this,this[FE])}disconnectedCallback(){super.disconnectedCallback();const{ShadyDOM:t}=self;null==t?this[UE].disconnect():t.unobserveChildren(this[UE])}[(e=PE,i=FE,n=UE,mE)](){super[mE]();const t=this[pE];t.forHotspots(e=>{t.updateHotspotAttachment(e),t.updateSurfaceHotspot(e)})}[gE](t,e){super[gE](t,e);const i=this[pE],{annotationRenderer:n}=i,r=i.getCamera();i.shouldRender()&&(i.animateSurfaceHotspots(),i.updateHotspotsVisibility(r.position),n.domElement.style.display="",n.render(i,r))}updateHotspot(t){const e=this[PE].get(t.name);null!=e&&(e.updatePosition(t.position),e.updateNormal(t.normal),e.surface=t.surface,void 0!==t.modelIndex&&null!==t.modelIndex&&(e.modelIndex=t.modelIndex),this[pE].updateSurfaceHotspot(e),this[AE]())}queryHotspot(t){const e=this[PE].get(t);if(null==e)return null;const i=EE(e.position),n=EE(e.normal),r=e.facingCamera,s=this[pE],a=s.getCamera(),o=new vn;o.setFromMatrixPosition(e.matrixWorld),o.project(a);const l=s.width/2,c=s.height/2;o.x=o.x*l+l,o.y=-o.y*c+c;const h=EE(new vn(o.x,o.y,o.z));return Number.isFinite(h.x)&&Number.isFinite(h.y)?{position:i,normal:n,canvasPosition:h,facingCamera:r}:null}positionAndNormalFromPoint(t,e){const i=this[pE],n=i.getNDC(t,e),r=i.positionAndNormalFromPoint(n);if(null==r)return null;const s=r.worldToModel,a=EE(r.position.applyMatrix4(s)),o=EE(r.normal.transformDirection(s));let l=null;return null!=r.uv&&(l=SE(r.uv)),{position:a,normal:o,uv:l,modelIndex:r.modelIndex}}surfaceFromPoint(t,e){const i=this[pE],n=i.getNDC(t,e);return i.surfaceFromPoint(n)}[NE](t){if(!(t instanceof HTMLElement&&0===t.slot.indexOf("hotspot")))return;let e=this[PE].get(t.slot);if(null!=e){e.increment();const i=t.dataset.visibilityAttribute;if(null!=i){const n=`data-${i}`;t.toggleAttribute(n,e.facingCamera)}t.dispatchEvent(new CustomEvent("hotspot-visibility",{detail:{visible:e.facingCamera}}))}else e=new d_({name:t.slot,position:t.dataset.position,normal:t.dataset.normal,surface:t.dataset.surface,modelIndex:null!=t.dataset.modelIndex?parseInt(t.dataset.modelIndex):null}),this[PE].set(t.slot,e),this[pE].addHotspot(e);this[pE].queueRender()}[OE](t){if(!(t instanceof HTMLElement))return;const e=this[PE].get(t.slot);e&&(e.decrement()&&(this[pE].removeHotspot(e),this[PE].delete(t.slot)),this[pE].queueRender())}}return r})((t=>{var e,i,n,r;class s extends t{constructor(){super(...arguments),this[e]=void 0,this[i]=[],this[n]=null,this[r]=null,this.variantName=null,this.orientation="0 0 0",this.scale="1 1 1"}get model(){return this[e_]}get extraModels(){return this[i_]}get availableVariants(){return this.model?this.model[Wx]():[]}get originalGltfJson(){return this[t_]}[(e=e_,i=i_,n=Zx,r=t_,n_)](){return()=>{this[AE]()}}[r_](t){return t.colorSpace=Di,t.wrapS=le,t.wrapT=le,new qy(this[n_](),t)}async createTexture(t,e="image/png"){const{textureUtils:i}=this[bE],n=await i.loadImage(t,this.withCredentials,e),r="image/ktx2"===e?"image/png":e;return n.userData.mimeType=r,this[r_](n)}async createLottieTexture(t,e=1){const{textureUtils:i}=this[bE],n=await i.loadLottie(t,e,this.withCredentials);return this[r_](n)}createVideoTexture(t){const e=document.createElement("video");e.crossOrigin=this.withCredentials?"use-credentials":"anonymous",e.src=t,e.muted=!0,e.playsInline=!0,e.loop=!0,e.play();const i=new Ja(e);return this[r_](i)}createCanvasTexture(){const t=document.createElement("canvas"),e=new eo(t);return this[r_](e)}async updated(t){if(super.updated(t),t.has("variantName")){const t=this[vE].beginActivity("variant-update");t(.1);const e=this[e_],{variantName:i}=this;null!=e&&(await e[zx](i),this[AE](),this.dispatchEvent(new CustomEvent("variant-applied"))),t(1)}if(t.has("orientation")||t.has("scale")){if(!this.loaded)return;const t=this[pE];t.applyTransform(),t.updateBoundingBox(),t.updateShadow(),this[bE].arRenderer.onUpdateScene(),this[AE]()}}[mE](){super[mE]();const{currentGLTFs:t}=this[pE],e=t.length>0?t[0]:null;if(null!=e){const{correlatedSceneGraph:t}=e;null!=t&&e!==this[Zx]&&(this[e_]=new Yx(t,this[n_]()),this[t_]=JSON.parse(JSON.stringify(t.gltf))),"variants"in e.userData&&this.requestUpdate("variantName")}this[i_]=[];const i=Array.from(this.querySelectorAll("extra-model"));for(let e=1;e<t.length;e++){const n=t[e];if(null!=n&&null!=n.correlatedSceneGraph){const t=new Yx(n.correlatedSceneGraph,this[n_]());this[i_].push(t),i[e-1]&&(i[e-1].model=t)}}this[Zx]=e}async exportScene(t){const e=this[pE];return new Promise(async(i,n)=>{const r={binary:!0,onlyVisible:!0,maxTextureSize:1/0,includeCustomExtensions:!1,forceIndices:!1};Object.assign(r,t),r.animations=e.animations,r.truncateDrawRange=!0;const s=e.shadow;let a=!1;null!=s&&(a=s.visible,s.visible=!1),await this[e_][Gx]();const o=(new Vg).register(t=>new Hm(t));let l;if(o.setTextureUtils({decompress:(t,e)=>function(t,e=1/0,i=null){Om||(Om=new el(2,2,1,1)),km||(km=new ll({uniforms:{blitTexture:new Bc(t)},vertexShader:"\n\t\t\tvarying vec2 vUv;\n\t\t\tvoid main(){\n\t\t\t\tvUv = uv;\n\t\t\t\tgl_Position = vec4(position.xy * 1.0,0.,.999999);\n\t\t\t}",fragmentShader:"\n\t\t\tuniform sampler2D blitTexture; \n\t\t\tvarying vec2 vUv;\n\n\t\t\tvoid main(){ \n\t\t\t\tgl_FragColor = vec4(vUv.xy, 0, 1);\n\t\t\t\t\n\t\t\t\t#ifdef IS_SRGB\n\t\t\t\tgl_FragColor = sRGBTransferOETF( texture2D( blitTexture, vUv) );\n\t\t\t\t#else\n\t\t\t\tgl_FragColor = texture2D( blitTexture, vUv);\n\t\t\t\t#endif\n\t\t\t}"})),km.uniforms.blitTexture.value=t,km.defines.IS_SRGB=t.colorSpace==Di,km.needsUpdate=!0,Qm||(Qm=new Ks(Om,km),Qm.frustumCulled=!1);const n=new nc,r=new wr;r.add(Qm),null===i&&(i=Nm=new Id({antialias:!1}));const s=Math.min(t.image.width,e),a=Math.min(t.image.height,e);i.setSize(s,a),i.clear(),i.render(r,n);const o=document.createElement("canvas"),l=o.getContext("2d");o.width=s,o.height=a,l.drawImage(i.domElement,0,0,s,a);const c=new eo(o);return c.minFilter=t.minFilter,c.magFilter=t.magFilter,c.wrapS=t.wrapS,c.wrapT=t.wrapT,c.colorSpace=t.colorSpace,c.name=t.name,Nm&&(Nm.forceContextLoss(),Nm.dispose(),Nm=null),c}(t,null!=e?e:1/0,void 0)}),e.models.length>1){l=new mr;for(const t of e.models)l.add(t)}else l=e.models[0];o.parse(l,t=>{if(e.models.length>1)for(const t of e.models)e.target.add(t);else e.target.add(e.models[0]);return i(new Blob([r.binary?t:JSON.stringify(t)],{type:r.binary?"application/octet-stream":"application/json"}))},()=>n("glTF export failed"),r),null!=s&&(s.visible=a)})}materialFromPoint(t,e){const i=this[pE],n=i.getNDC(t,e),r=i.hitFromPoint(n);if(null==r||null==r.face)return null;const s=this[e_];if(null!=s){const t=s[Hx](r);if(null!=t)return t}for(const t of this[i_]){const e=t[Hx](r);if(null!=e)return e}return null}}return $x([ht({type:String,attribute:"variant-name"})],s.prototype,"variantName",void 0),$x([ht({type:String,attribute:"orientation"})],s.prototype,"orientation",void 0),$x([ht({type:String,attribute:"scale"})],s.prototype,"scale",void 0),s})((t=>{var e,i,n;class r extends t{constructor(){super(...arguments),this.autoRotate=!1,this.autoRotateDelay=3e3,this.rotationPerSecond="auto",this[e]=performance.now(),this[i]=0,this[n]=t=>{this.autoRotate&&"user-interaction"===t.detail.source&&(this[UC]=performance.now())}}connectedCallback(){super.connectedCallback(),this.addEventListener("camera-change",this[kC]),this[UC]=performance.now()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("camera-change",this[kC]),this[UC]=performance.now()}updated(t){super.updated(t),t.has("autoRotate")&&(this[UC]=performance.now())}[(e=UC,i=NC,OC)](t){this[NC]=t[0]}[gE](t,e){if(super[gE](t,e),!this.autoRotate||!this[xE]()||this[bE].isPresenting)return;const i=Math.min(e,t-this[UC]-this.autoRotateDelay);i>0&&(this[pE].yaw=this.turntableRotation+this[NC]*i*.001)}get turntableRotation(){return this[pE].yaw}resetTurntableRotation(t=0){this[pE].yaw=t}}return n=kC,LC([ht({type:Boolean,attribute:"auto-rotate"})],r.prototype,"autoRotate",void 0),LC([ht({type:Number,attribute:"auto-rotate-delay"})],r.prototype,"autoRotateDelay",void 0),LC([Xf({intrinsics:FC,updateHandler:OC}),ht({type:String,attribute:"rotation-per-second"})],r.prototype,"rotationPerSecond",void 0),r})((t=>{var e,i,n;class r extends t{constructor(){super(...arguments),this.environmentImage=null,this.skyboxImage=null,this.shadowIntensity=0,this.shadowSoftness=1,this.exposure=1,this.toneMapping="auto",this.skyboxHeight="0",this[e]=null,this[i]=null,this[n]=null}updated(t){var e;if(super.updated(t),t.has("shadowIntensity")&&(this[pE].setShadowIntensity(.5*this.shadowIntensity),this[AE]()),t.has("shadowSoftness")&&(this[pE].setShadowSoftness(this.shadowSoftness),this[AE]()),t.has("exposure")&&(this[pE].exposure=this.exposure,this[AE]()),t.has("toneMapping")){const t=new Map([["aces",4],["agx",6],["reinhard",2],["cineon",3],["linear",1],["none",0]]);this[pE].toneMapping=null!==(e=t.get(this.toneMapping))&&void 0!==e?e:7,this[AE]()}(t.has("environmentImage")||t.has("skyboxImage"))&&this[_E]()&&this[Yd](),t.has("skyboxHeight")&&(this[pE].setGroundedSkybox(),this[AE]())}hasBakedShadow(){return this[pE].bakedShadows.size>0}async[(e=Kd,i=Jd,n=$d,Yd)](){const{skyboxImage:t,environmentImage:e}=this;null!=this[$d]&&(this[$d](),this[$d]=null);const{textureUtils:i}=this[bE];if(null==i)return;const n=this[vE].beginActivity("environment-update");try{const{environmentMap:r,skybox:s}=await i.generateEnvironmentMapAndSkybox(zd(t),e,t=>n(jd(t,0,1)),this.withCredentials);this[Kd]!==r&&(this[Kd]=r,this.dispatchEvent(new CustomEvent("environment-change"))),this[Jd]=null!=s?s.name===r.name?r:s:null,this[pE].setEnvironmentAndSkybox(this[Kd],this[Jd])}catch(t){if(t instanceof Error)throw this[pE].setEnvironmentAndSkybox(null,null),t}finally{n(1)}}}return Xd([ht({type:String,attribute:"environment-image"})],r.prototype,"environmentImage",void 0),Xd([ht({type:String,attribute:"skybox-image"})],r.prototype,"skyboxImage",void 0),Xd([ht({type:Number,attribute:"shadow-intensity"})],r.prototype,"shadowIntensity",void 0),Xd([ht({type:Number,attribute:"shadow-softness"})],r.prototype,"shadowSoftness",void 0),Xd([ht({type:Number})],r.prototype,"exposure",void 0),Xd([ht({type:String,attribute:"tone-mapping"})],r.prototype,"toneMapping",void 0),Xd([ht({type:String,attribute:"skybox-height"})],r.prototype,"skyboxHeight",void 0),r})((t=>{var e,i,n,r,s,a,o,l,c,h,u,d,p,A,g,m,f,b;class v extends t{constructor(){super(...arguments),this.cameraControls=!1,this.cameraOrbit=eb,this.cameraTarget="auto auto auto",this.fieldOfView="auto",this.minCameraOrbit="auto",this.maxCameraOrbit="auto",this.minFieldOfView="auto",this.maxFieldOfView="auto",this.interactionPromptThreshold=3e3,this.interactionPrompt=rb,this.interactionPromptStyle=ab,this.orbitSensitivity=1,this.zoomSensitivity=1,this.panSensitivity=1,this.touchAction=ob,this.disableZoom=!1,this.disablePan=!1,this.disableTap=!1,this.interpolationDecay=50,this.a11y=null,this[e]=this.shadowRoot.querySelector(".interaction-prompt"),this[i]=this.shadowRoot.querySelector("#prompt"),this[n]=[this.shadowRoot.querySelector("#finger0"),this.shadowRoot.querySelector("#finger1")],this[r]=this.shadowRoot.querySelector(".pan-target"),this[s]=0,this[a]=1/0,this[o]=!1,this[l]=!1,this[c]=$b.AUTOMATIC,this[h]=new Zb(this[pE].camera,this[uE],this[pE]),this[u]=new Pc,this[d]=!1,this[p]=!1,this[A]=!1,this[g]={},this[m]=()=>{const t=this[bb].changeSource;this[Fb]=t,t===$b.USER_INTERACTION&&(this[Db]=!0,this[Eb]())},this[f]=()=>{this[Sb](),this[AE]();const t=this[bb].changeSource;this.dispatchEvent(new CustomEvent("camera-change",{detail:{source:t}}))},this[b]=t=>{this[hE].classList.toggle("pointer-tumbling","pointer-change-start"===t.type)}}get inputSensitivity(){return this[bb].inputSensitivity}set inputSensitivity(t){this[bb].inputSensitivity=t}getCameraOrbit(){const{theta:t,phi:e,radius:i}=this[Ub];return{theta:t,phi:e,radius:i,toString(){return`${this.theta}rad ${this.phi}rad ${this.radius}m`}}}getCameraTarget(){return EE(this[bE].isPresenting?this[bE].arRenderer.target:this[pE].getDynamicTarget())}getFieldOfView(){return this[bb].getFieldOfView()}getMinimumFieldOfView(){return this[bb].options.minimumFieldOfView}getMaximumFieldOfView(){return this[bb].options.maximumFieldOfView}getIdealAspect(){return this[pE].idealAspect}jumpCameraToGoal(){this[Nb]=!0,this.requestUpdate(Nb,!1)}resetInteractionPrompt(){this[Pb]=0,this[Lb]=1/0,this[Db]=!1,this[Rb]=this.interactionPrompt===rb&&this.cameraControls}zoom(t){const e=new WheelEvent("wheel",{deltaY:-30*t});this[uE].dispatchEvent(e)}connectedCallback(){super.connectedCallback(),this[bb].addEventListener("user-interaction",this[Ib]),this[bb].addEventListener("pointer-change-start",this[Bb]),this[bb].addEventListener("pointer-change-end",this[Bb])}disconnectedCallback(){super.disconnectedCallback(),this[bb].removeEventListener("user-interaction",this[Ib]),this[bb].removeEventListener("pointer-change-start",this[Bb]),this[bb].removeEventListener("pointer-change-end",this[Bb])}updated(t){super.updated(t);const e=this[bb],i=this[pE];if(t.has("cameraControls")&&(this.cameraControls?(e.enableInteraction(),this.interactionPrompt===rb&&(this[Rb]=!0)):(e.disableInteraction(),this[Eb]()),this[uE].setAttribute("aria-label",this[nE])),t.has("disableZoom")&&(e.disableZoom=this.disableZoom),t.has("disablePan")&&(e.enablePan=!this.disablePan),t.has("disableTap")&&(e.enableTap=!this.disableTap),(t.has("interactionPrompt")||t.has("cameraControls")||t.has("src"))&&(this.interactionPrompt===rb&&this.cameraControls&&!this[Db]?this[Rb]=!0:this[Eb]()),t.has("interactionPromptStyle")&&(this[xb].style.opacity=this.interactionPromptStyle==sb?"1":"0"),t.has("touchAction")){const t=this.touchAction;e.applyOptions({touchAction:t}),e.updateTouchActionStyle()}t.has("orbitSensitivity")&&(e.orbitSensitivity=this.orbitSensitivity),t.has("zoomSensitivity")&&(e.zoomSensitivity=this.zoomSensitivity),t.has("panSensitivity")&&(e.panSensitivity=this.panSensitivity),t.has("interpolationDecay")&&(e.setDamperDecayTime(this.interpolationDecay),i.setTargetDamperDecayTime(this.interpolationDecay)),t.has("a11y")&&this[wb](),!0===this[Nb]&&Promise.resolve().then(()=>{e.jumpToGoal(),i.jumpToGoal(),this[Tb](),this[Nb]=!1})}async updateFraming(){const t=this[pE],e=t.adjustedFoV(t.framedFoVDeg);await t.updateFraming();const i=t.adjustedFoV(t.framedFoVDeg),n=this[bb].getFieldOfView()/e;this[bb].setFieldOfView(i*n),this[kb]=!0,this.requestUpdate("maxFieldOfView"),this.requestUpdate("fieldOfView"),this.requestUpdate("minCameraOrbit"),this.requestUpdate("maxCameraOrbit"),this.requestUpdate("cameraOrbit"),await this.updateComplete}interact(t,e,i){const n=this[uE],r=this[_b];if("1"===r[0].style.opacity)return void console.warn("interact() failed because an existing interaction is running.");const s=new Array;s.push({x:Yf(e.x),y:Yf(e.y)});const a=[{x:s[0].x(0),y:s[0].y(0)}];null!=i&&(s.push({x:Yf(i.x),y:Yf(i.y)}),a.push({x:s[1].x(0),y:s[1].y(0)}));let o=performance.now();const{width:l,height:c}=this[pE],h=this.getBoundingClientRect(),u=t=>{for(const[e,i]of a.entries()){const{style:s}=r[e];s.transform=`translateX(${l*i.x}px) translateY(${c*i.y}px)`,"pointerdown"===t?s.opacity="1":"pointerup"===t&&(s.opacity="0");const a={pointerId:e-5678,pointerType:"touch",target:n,clientX:l*i.x+h.x,clientY:c*i.y+h.y,altKey:!0};n.dispatchEvent(new PointerEvent(t,a))}},d=()=>{const e=this[Fb];if(e!==$b.AUTOMATIC||!n.isConnected){for(const t of this[_b])t.style.opacity="0";return u("pointercancel"),this.dispatchEvent(new CustomEvent("interact-stopped",{detail:{source:e}})),void document.removeEventListener("visibilitychange",p)}const i=Math.min(1,(performance.now()-o)/t);for(const[t,e]of a.entries())e.x=s[t].x(i),e.y=s[t].y(i);u("pointermove"),i<1?requestAnimationFrame(d):(u("pointerup"),this.dispatchEvent(new CustomEvent("interact-stopped",{detail:{source:$b.AUTOMATIC}})),document.removeEventListener("visibilitychange",p))},p=()=>{let t=0;"hidden"===document.visibilityState?t=performance.now()-o:o=performance.now()-t};document.addEventListener("visibilitychange",p),u("pointerdown"),this[Fb]=$b.AUTOMATIC,requestAnimationFrame(d)}[(e=yb,i=xb,n=_b,r=vb,s=Pb,a=Lb,o=Db,l=Rb,c=Fb,h=bb,u=Ub,d=Nb,p=Ob,A=kb,g=Cb,Gb)](t){const e=this[bb],i=this[pE];i.framedFoVDeg=180*t[0]/Math.PI,e.changeSource=$b.NONE,e.setFieldOfView(i.adjustedFoV(i.framedFoVDeg)),this[Ib]()}[Qb](t){const e=this[bb];if(this[kb]){const{theta:e,phi:i}=this.getCameraOrbit();t[0]=e,t[1]=i,this[kb]=!1}e.changeSource=$b.NONE,e.setOrbit(t[0],t[1],t[2]),this[Ib]()}[Hb](t){this[bb].applyOptions({minimumAzimuthalAngle:t[0],minimumPolarAngle:t[1],minimumRadius:t[2]}),this.jumpCameraToGoal()}[Vb](t){this[bb].applyOptions({maximumAzimuthalAngle:t[0],maximumPolarAngle:t[1],maximumRadius:t[2]}),this[Mb](t[2]),this.jumpCameraToGoal()}[qb](t){this[bb].applyOptions({minimumFieldOfView:180*t[0]/Math.PI}),this.jumpCameraToGoal()}[jb](t){const e=this[pE].adjustedFoV(180*t[0]/Math.PI);this[bb].applyOptions({maximumFieldOfView:e}),this.jumpCameraToGoal()}[zb](t){const[e,i,n]=t;this[bE].arRenderer.isPresenting||this[pE].setTarget(e,i,n),this[bb].changeSource=$b.NONE,this[bE].arRenderer.updateTarget(),this[Ib]()}[gE](t,e){if(super[gE](t,e),this[bE].isPresenting||!this[xE]())return;const i=this[bb],n=this[pE],r=performance.now();if(this[Rb]&&this.loaded&&r>this[oE]+this.interactionPromptThreshold&&(this[Rb]=!1,this[Lb]=r,this[yb].classList.add("visible")),isFinite(this[Lb])&&this.interactionPromptStyle===ab){const t=(r-this[Lb])/5e3%1,e=Zf(t),s=tb(t);if(this[xb].style.opacity=`${s}`,e!==this[Pb]){const t=e*n.width*.05,r=(e-this[Pb])*Math.PI/16;this[xb].style.transform=`translateX(${t}px)`,i.changeSource=$b.AUTOMATIC,i.adjustOrbit(r,0,0),this[Pb]=e}}const s=i.update(t,e),a=n.updateTarget(e);(s||a)&&this[Tb]()}[Eb](){this[Rb]=!1,this[yb].classList.remove("visible"),this[Lb]=1/0}[Mb](t){const e=Math.max(this[pE].farRadius(),t),i=Math.abs(2*e);this[bb].updateNearFar(0,i)}[Sb](){const{theta:t,phi:e}=this[bb].getCameraSpherical(this[Ub]),i=(4+Math.floor((t%fb+mb)/Ab))%4,n=Math.floor(e/gb),r=`${nb[n]}${ib[i]}`,s=r;s in this[Cb]?this[aE](this[Cb][s]):this[aE](`View from stage ${r}`)}get[nE](){let t=". Use mouse, touch or arrow keys to move.";return"interaction-prompt"in this[Cb]&&(t=`. ${this[Cb]["interaction-prompt"]}`),super[nE].replace(/\.$/,"")+(this.cameraControls?t:"")}async[fE](t){const e=this[bb],i=this[pE],n=i.adjustedFoV(i.framedFoVDeg);super[fE](t);const r=i.adjustedFoV(i.framedFoVDeg)/n,s=e.getFieldOfView()*(isFinite(r)?r:1);e.updateAspect(this[pE].aspect),this.requestUpdate("maxFieldOfView",this.maxFieldOfView),await this.updateComplete,this[bb].setFieldOfView(s),this.jumpCameraToGoal()}[mE](){super[mE](),this[Ob]?this[kb]=!0:this[Ob]=!0,this.requestUpdate("maxFieldOfView",this.maxFieldOfView),this.requestUpdate("fieldOfView",this.fieldOfView),this.requestUpdate("minCameraOrbit",this.minCameraOrbit),this.requestUpdate("maxCameraOrbit",this.maxCameraOrbit),this.requestUpdate("cameraOrbit",this.cameraOrbit),this.requestUpdate("cameraTarget",this.cameraTarget),this.jumpCameraToGoal()}[(m=Ib,f=Tb,b=Bb,wb)](){if("string"==typeof this.a11y)if(this.a11y.startsWith("{"))try{this[Cb]=JSON.parse(this.a11y)}catch(t){console.warn("Error parsing a11y JSON:",t)}else this.a11y.length>0?console.warn("Error not supported format, should be a JSON string:",this.a11y):this[Cb]={};else"object"==typeof this.a11y&&null!=this.a11y?this[Cb]=Object.assign({},this.a11y):this[Cb]={};this[uE].setAttribute("aria-label",this[nE])}}return $f([ht({type:Boolean,attribute:"camera-controls"})],v.prototype,"cameraControls",void 0),$f([Xf({intrinsics:hb,observeEffects:!0,updateHandler:Qb}),ht({type:String,attribute:"camera-orbit",hasChanged:()=>!0})],v.prototype,"cameraOrbit",void 0),$f([Xf({intrinsics:pb,observeEffects:!0,updateHandler:zb}),ht({type:String,attribute:"camera-target",hasChanged:()=>!0})],v.prototype,"cameraTarget",void 0),$f([Xf({intrinsics:lb,observeEffects:!0,updateHandler:Gb}),ht({type:String,attribute:"field-of-view",hasChanged:()=>!0})],v.prototype,"fieldOfView",void 0),$f([Xf({intrinsics:ub,updateHandler:Hb}),ht({type:String,attribute:"min-camera-orbit",hasChanged:()=>!0})],v.prototype,"minCameraOrbit",void 0),$f([Xf({intrinsics:db,updateHandler:Vb}),ht({type:String,attribute:"max-camera-orbit",hasChanged:()=>!0})],v.prototype,"maxCameraOrbit",void 0),$f([Xf({intrinsics:cb,updateHandler:qb}),ht({type:String,attribute:"min-field-of-view",hasChanged:()=>!0})],v.prototype,"minFieldOfView",void 0),$f([Xf({intrinsics:lb,updateHandler:jb}),ht({type:String,attribute:"max-field-of-view",hasChanged:()=>!0})],v.prototype,"maxFieldOfView",void 0),$f([ht({type:Number,attribute:"interaction-prompt-threshold"})],v.prototype,"interactionPromptThreshold",void 0),$f([ht({type:String,attribute:"interaction-prompt"})],v.prototype,"interactionPrompt",void 0),$f([ht({type:String,attribute:"interaction-prompt-style"})],v.prototype,"interactionPromptStyle",void 0),$f([ht({type:Number,attribute:"orbit-sensitivity"})],v.prototype,"orbitSensitivity",void 0),$f([ht({type:Number,attribute:"zoom-sensitivity"})],v.prototype,"zoomSensitivity",void 0),$f([ht({type:Number,attribute:"pan-sensitivity"})],v.prototype,"panSensitivity",void 0),$f([ht({type:String,attribute:"touch-action"})],v.prototype,"touchAction",void 0),$f([ht({type:Boolean,attribute:"disable-zoom"})],v.prototype,"disableZoom",void 0),$f([ht({type:Boolean,attribute:"disable-pan"})],v.prototype,"disablePan",void 0),$f([ht({type:Boolean,attribute:"disable-tap"})],v.prototype,"disableTap",void 0),$f([ht({type:Number,attribute:"interpolation-decay"})],v.prototype,"interpolationDecay",void 0),$f([ht()],v.prototype,"a11y",void 0),v})((t=>{var e,i,n,r,s,a,o,l,c,h;class u extends t{constructor(){super(...arguments),this.ar=!1,this.arScale="auto",this.arUsdzMaxTextureSize="auto",this.arPlacement="floor",this.arModes="webxr scene-viewer quick-look",this.iosSrc=null,this.xrEnvironment=!1,this[e]=!1,this[i]=this.shadowRoot.querySelector(".ar-button"),this[n]=document.createElement("a"),this[r]=new Set,this[s]=rC,this[a]=!1,this[o]=t=>{t.preventDefault(),this.activateAR()},this[l]=({status:t})=>{t!==gv&&this[bE].arRenderer.presentedScene!==this[pE]||(this.setAttribute("ar-status",t),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:t}})),t===gv?this.removeAttribute("ar-tracking"):t===mv&&this.setAttribute("ar-tracking",vv))},this[c]=({status:t})=>{this.setAttribute("ar-tracking",t),this.dispatchEvent(new CustomEvent("ar-tracking",{detail:{status:t}}))},this[h]=t=>{"_apple_ar_quicklook_button_tapped"==t.data&&this.dispatchEvent(new CustomEvent("quick-look-button-tapped"))}}get canActivateAR(){return this[hC]!==rC}connectedCallback(){super.connectedCallback(),null!=this[bE].arRenderer&&(this[bE].arRenderer.addEventListener("status",this[gC]),this.setAttribute("ar-status",gv),this[bE].arRenderer.addEventListener("tracking",this[mC])),this[dC].addEventListener("message",this[fC])}disconnectedCallback(){super.disconnectedCallback(),null!=this[bE].arRenderer&&(this[bE].arRenderer.removeEventListener("status",this[gC]),this[bE].arRenderer.removeEventListener("tracking",this[mC])),this[dC].removeEventListener("message",this[fC])}update(t){super.update(t),t.has("arScale")&&(this[pE].canScale="fixed"!==this.arScale),t.has("arPlacement")&&(this[pE].updateShadow(),this[AE]()),t.has("arModes")&&(this[uC]=ZS(this.arModes)),(t.has("ar")||t.has("arModes")||t.has("src")||t.has("iosSrc")||t.has("arUsdzMaxTextureSize"))&&this[bC]()}async activateAR(){switch(this[hC]){case eC:await this[lC]();break;case nC:await this[aC]();break;case iC:await this[oC]();break;default:console.warn("No AR Mode can be activated. This is probably due to missing configuration or device capabilities")}}async[(e=cC,i=sC,n=dC,r=uC,s=hC,a=pC,o=AC,l=gC,c=mC,h=fC,bC)](){var t;let e=rC;if(this.ar){if(null!=this.src)for(const i of this[uC]){if("webxr"===i&&Ld&&!JS&&await this[bE].arRenderer.supportsPresentation()){e=nC;break}if("scene-viewer"===i&&!YS&&(Qd||navigator.userAgentData&&navigator.userAgentData.getHighEntropyValues&&(null===(t=(await navigator.userAgentData.getHighEntropyValues(["formFactor"])).formFactor)||void 0===t?void 0:t.includes("XR")))){e=iC;break}if("quick-look"===i&&Gd&&!kd&&(!Od||null!=this.iosSrc)){e=eC;break}}e===rC&&null!=this.iosSrc&&Gd&&!kd&&(e=eC)}if(e!==rC)this[sC].classList.add("enabled"),this[sC].addEventListener("click",this[AC]);else if(this[sC].classList.contains("enabled")){this[sC].removeEventListener("click",this[AC]),this[sC].classList.remove("enabled");const t=bv;this.setAttribute("ar-status",t),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:t}}))}this[hC]=e}async[aC](){console.log("Attempting to present in AR with WebXR..."),await this[vC]();try{this[sC].removeEventListener("click",this[AC]);const{arRenderer:t}=this[bE];t.placeOnWall="wall"===this.arPlacement,await t.present(this[pE],this.xrEnvironment)}catch(t){console.warn("Error while trying to present in AR with WebXR"),console.error(t),await this[bE].arRenderer.stopPresenting(),JS=!0,console.warn("Falling back to next ar-mode"),await this[bC](),this.activateAR()}finally{this[bC]()}}async[vC](){this.loaded||(this[pC]=!0,this[lE](),await((t,e,i=null)=>new Promise(n=>{t.addEventListener(e,function r(s){i&&!i(s)||(n(s),t.removeEventListener(e,r))})}))(this,"load"),this[pC]=!1)}[_E](){return super[_E]()||this[pC]}async[oC](){const t=self.location.toString(),e=new URL(t),i=Array.from(this.querySelectorAll("extra-model")).map(t=>t.src).filter(t=>null!=t),n=this.src||i[0]||null;if(!n)return void console.warn("No src or extra-model provided for Scene Viewer fallback.");let r=new URL(n,t);r.hash&&(r.hash="");const s=new URLSearchParams(r.search);if(e.hash=$S,s.set("mode","ar_preferred"),s.has("disable_occlusion")||s.set("disable_occlusion","true"),"fixed"===this.arScale&&s.set("resizable","false"),"wall"===this.arPlacement&&s.set("enable_vertical_placement","true"),s.has("sound")){const e=new URL(s.get("sound"),t);s.set("sound",e.toString())}if(s.has("link")){const e=new URL(s.get("link"),t);s.set("link",e.toString())}const a=`intent://arvr.google.com/scene-viewer/1.2?${s.toString()+"&file="+encodeURIComponent(r.toString())}#Intent;scheme=https;package=com.google.android.googlequicksearchbox;action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(e.toString())};end;`;self.addEventListener("hashchange",()=>{self.location.hash===$S&&(YS=!0,self.history.back(),console.warn("Error while trying to present in AR with Scene Viewer"),console.warn("Falling back to next ar-mode"),this[bC]())},{once:!0}),this[dC].setAttribute("href",a),console.log("Attempting to present in AR with Scene Viewer..."),this[dC].click()}async[lC](){const t=!this.iosSrc;this[sC].classList.remove("enabled");const e=t?await this.prepareUSDZ():this.iosSrc,i=new URL(e,self.location.toString());if(t){const t=self.location.toString(),e=new URL(t),n=Array.from(this.querySelectorAll("extra-model")).map(t=>t.src).filter(t=>null!=t),r=this.src||n[0]||null;if(r){const t=new URL(r,e);t.hash&&(i.hash=t.hash)}}"fixed"===this.arScale&&(i.hash&&(i.hash+="&"),i.hash+="allowsContentScaling=0");const n=this[dC];n.setAttribute("rel","ar");const r=document.createElement("img");n.appendChild(r),n.setAttribute("href",i.toString()),t&&n.setAttribute("download","model.usdz"),n.style.display="none",n.isConnected||this.shadowRoot.appendChild(n),console.log("Attempting to present in AR with Quick Look..."),n.click(),n.removeChild(r),t&&URL.revokeObjectURL(e),this[sC].classList.add("enabled")}async prepareUSDZ(){const t=this[vE].beginActivity("usdz-conversion");await this[vC]();const{models:e,shadow:i,target:n}=this[pE];if(0===e.length||null==e[0])return"";let r=!1;null!=i&&(r=i.visible,i.visible=!1),t(.2);const s=new DS,a=new mr;a.position.copy(n.position);for(const t of e)n.remove(t),a.add(t);a.updateWorldMatrix(!1,!0);const o=await s.parseAsync(a,{maxTextureSize:isNaN(this.arUsdzMaxTextureSize)?1/0:Math.max(parseInt(this.arUsdzMaxTextureSize),16)});for(const t of e)a.remove(t),n.add(t);const l=new Blob([o],{type:"model/vnd.usdz+zip"}),c=URL.createObjectURL(l);return t(1),null!=i&&(i.visible=r),c}}return KS([ht({type:Boolean,attribute:"ar"})],u.prototype,"ar",void 0),KS([ht({type:String,attribute:"ar-scale"})],u.prototype,"arScale",void 0),KS([ht({type:String,attribute:"ar-usdz-max-texture-size"})],u.prototype,"arUsdzMaxTextureSize",void 0),KS([ht({type:String,attribute:"ar-placement"})],u.prototype,"arPlacement",void 0),KS([ht({type:String,attribute:"ar-modes"})],u.prototype,"arModes",void 0),KS([ht({type:String,attribute:"ios-src"})],u.prototype,"iosSrc",void 0),KS([ht({type:Boolean,attribute:"xr-environment"})],u.prototype,"xrEnvironment",void 0),u})((t=>{var e,i,n,r,s,a,o,l;class c extends t{static set dracoDecoderLocation(t){Pg.setDRACODecoderLocation(t)}static get dracoDecoderLocation(){return Pg.getDRACODecoderLocation()}static set ktx2TranscoderLocation(t){Pg.setKTX2TranscoderLocation(t)}static get ktx2TranscoderLocation(){return Pg.getKTX2TranscoderLocation()}static set meshoptDecoderLocation(t){Pg.setMeshoptDecoderLocation(t)}static get meshoptDecoderLocation(){return Pg.getMeshoptDecoderLocation()}static set lottieLoaderLocation(t){fy.singleton.textureUtils.lottieLoaderUrl=t}static get lottieLoaderLocation(){return fy.singleton.textureUtils.lottieLoaderUrl}static mapURLs(t){fy.singleton.loader[Rg].manager.setURLModifier(t)}dismissPoster(){this.loaded?this[IC]():(this[MC]=!0,this[lE]())}showPoster(){const t=this[CC];if(t.classList.contains("show"))return;t.classList.add("show"),this[uE].classList.remove("show");const e=this[wC];e.removeAttribute("tabindex"),e.removeAttribute("aria-hidden");const i=this.modelIsVisible;this[TC]=!1,this[iE](i)}getDimensions(){return this[pE].updateBoundingBoxAndShadowIfDirty(),EE(this[pE].size)}getBoundingBoxCenter(){return this[pE].updateBoundingBoxAndShadowIfDirty(),EE(this[pE].boundingBox.getCenter(new vn))}constructor(...t){super(...t),this.poster=null,this.reveal=xC,this.loading=_C,this[e]=!1,this[i]=!1,this[n]=this.shadowRoot.querySelector(".slot.poster"),this[r]=this.shadowRoot.querySelector("#default-poster"),this[s]=this.shadowRoot.querySelector("#default-progress-bar > .bar"),this[a]=this[wC].getAttribute("aria-label"),this[o]=((t,e)=>{let i=null;const n=(...n)=>{null==i&&(t(...n),i=self.setTimeout(()=>i=null,e))};return n.flush=()=>{null!=i&&(self.clearTimeout(i),i=null)},n})(t=>{const e=this[SC].parentNode;requestAnimationFrame(()=>{this[SC].style.transform=`scaleX(${t})`,0===t&&(e.removeChild(this[SC]),e.appendChild(this[SC])),this[SC].classList.toggle("hide",1===t)})},100),this[l]=t=>{const e=t.detail.totalProgress,i=t.detail.reason;1===e&&(this[BC].flush(),this.loaded&&(this[MC]||this.reveal===xC)&&this[IC]()),this[BC](e),this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:e,reason:i}}))};const c=self.ModelViewerElement||{},h=c.dracoDecoderLocation||"https://www.gstatic.com/draco/versioned/decoders/1.5.6/";Pg.setDRACODecoderLocation(h);const u=c.ktx2TranscoderLocation||"https://www.gstatic.com/basis-universal/versioned/2021-04-15-ba1c3e4/";Pg.setKTX2TranscoderLocation(u),c.meshoptDecoderLocation&&Pg.setMeshoptDecoderLocation(c.meshoptDecoderLocation);const d=c.lottieLoaderLocation||"https://cdn.jsdelivr.net/npm/three@0.149.0/examples/jsm/loaders/LottieLoader.js";null!=fy.singleton.textureUtils&&(fy.singleton.textureUtils.lottieLoaderUrl=d)}connectedCallback(){super.connectedCallback(),this.loaded||this.showPoster(),this[vE].addEventListener("progress",this[DC])}disconnectedCallback(){super.disconnectedCallback(),this[vE].removeEventListener("progress",this[DC])}async updated(t){super.updated(t),t.has("poster")&&null!=this.poster&&(this[wC].style.backgroundImage=`url(${this.poster})`),t.has("alt")&&this[wC].setAttribute("aria-label",this[rE]),(t.has("reveal")||t.has("loading"))&&this[lE]()}[(e=TC,i=MC,n=CC,r=wC,s=SC,a=RC,o=BC,l=DC,_E)](){const t=Array.from(this.querySelectorAll("extra-model"));return!!(this.src||t.length>0)&&(this[MC]||this.loading===EC||this.reveal===xC&&this[eE])}[IC](){this[MC]=!1;const t=this[CC];if(!t.classList.contains("show"))return;t.classList.remove("show"),this[uE].classList.add("show");const e=this.modelIsVisible;this[TC]=!0,this[iE](e);const i=this.getRootNode();i&&i.activeElement===this&&this[uE].focus();const n=this[wC];n.setAttribute("aria-hidden","true"),n.tabIndex=-1,this.dispatchEvent(new CustomEvent("poster-dismissed"))}[xE](){return super[xE]()&&this[TC]}}return yC([ht({type:String})],c.prototype,"poster",void 0),yC([ht({type:String})],c.prototype,"reveal",void 0),yC([ht({type:String})],c.prototype,"loading",void 0),c})((t=>{var e;class i extends t{constructor(...t){super(t),this.autoplay=!1,this.animationName=void 0,this.animationCrossfadeDuration=300,this[e]=!0,this[pE].subscribeMixerEvent("loop",t=>{const e=t.action._loopCount,i=t.action._clip.name,n=t.action._clip.uuid,r=this[pE].markedAnimations.find(t=>t.name===i);if(r){this[pE].updateAnimationLoop(r.name,r.loopMode,r.repetitionCount);const t=this[pE].markedAnimations.filter(t=>t.name!==i);this[pE].markedAnimations=t}this.dispatchEvent(new CustomEvent("loop",{detail:{count:e,name:i,uuid:n}}))}),this[pE].subscribeMixerEvent("finished",t=>{if(this[pE].appendedAnimations.includes(t.action._clip.name)){const e=this[pE].appendedAnimations.filter(e=>e!==t.action._clip.name);this[pE].appendedAnimations=e}else this[BE]=!0;this.dispatchEvent(new CustomEvent("finished"))})}get availableAnimations(){return this.loaded?this[pE].animationNames:[]}get duration(){return this[pE].duration}get paused(){return this[pE].isAllAnimationsPaused()}get currentTime(){return this[pE].animationTime}get appendedAnimations(){return this[pE].appendedAnimations}set currentTime(t){this[pE].animationTime=t,this[AE]()}get timeScale(){return this[pE].animationTimeScale}set timeScale(t){this[pE].animationTimeScale=t}pause(t){var e;if(null==(null==t?void 0:t.modelIndex)&&this.paused)return;const i=null!==(e=null==t?void 0:t.modelIndex)&&void 0!==e?e:null;this[pE].pauseAnimation(i),this.dispatchEvent(new CustomEvent("pause"))}play(t){var e;if(this.availableAnimations.length>0){const i=null!==(e=null==t?void 0:t.modelIndex)&&void 0!==e?e:null;this[pE].unpauseAnimation(i),this[ME](t),this.dispatchEvent(new CustomEvent("play"))}}appendAnimation(t,e){var i;this.availableAnimations.length>0&&(this[BE]=!1,this[pE].unpauseAnimation(null!==(i=null==e?void 0:e.modelIndex)&&void 0!==i?i:null),this[IE](t,e),this.dispatchEvent(new CustomEvent("append-animation")))}detachAnimation(t,e){var i;this.availableAnimations.length>0&&(this[BE]=!1,this[pE].unpauseAnimation(null!==(i=null==e?void 0:e.modelIndex)&&void 0!==i?i:null),this[TE](t,e),this.dispatchEvent(new CustomEvent("detach-animation")))}[(e=BE,mE)](){super[mE](),this[pE].pauseAnimation(),null!=this.animationName&&this[ME](),this.autoplay&&this.play()}[gE](t,e){super[gE](t,e),this.paused||!this[xE]()&&!this[bE].isPresenting||(this[pE].updateAnimation(e/1e3),this[AE]())}updated(t){super.updated(t),t.has("autoplay")&&this.autoplay&&this.play(),t.has("animationName")&&this[ME]()}[ME](t=RE){var e;const i=null!==(e=t.repetitions)&&void 0!==e?e:1/0,n=t.pingpong?Ei:1===i?xi:_i;this[pE].playAnimation(this.animationName,this.animationCrossfadeDuration/1e3,n,i,t.modelIndex),this[BE]&&(this[pE].updateAnimation(0),this[AE]())}[IE](t="",e={}){var i;const n=Object.assign(Object.assign({},DE),e),r=null!==(i=n.repetitions)&&void 0!==i?i:1/0,s=n.pingpong?Ei:1===r?xi:_i,a=!!e.repetitions||"pingpong"in e;this[pE].appendAnimation(t||this.animationName,s,r,n.weight,n.timeScale,n.fade,n.warp,n.relativeWarp,n.time,a,n.modelIndex),this[BE]&&(this[pE].updateAnimation(0),this[AE]())}[TE](t="",e={}){const i=Object.assign(Object.assign({},LE),e);this[pE].detachAnimation(t||this.animationName,i.fade,i.modelIndex),this[BE]&&(this[pE].updateAnimation(0),this[AE]())}}return wE([ht({type:Boolean})],i.prototype,"autoplay",void 0),wE([ht({type:String,attribute:"animation-name"})],i.prototype,"animationName",void 0),wE([ht({type:Number,attribute:"animation-crossfade-duration"})],i.prototype,"animationCrossfadeDuration",void 0),i})(CE))))))));customElements.define("model-viewer",QC);export{eo as CanvasTexture,Ql as FileLoader,Nl as Loader,QC as ModelViewerElement,ue as NearestFilter};
|
|
//# sourceMappingURL=model-viewer.min.js.map
|