@crystaldesign/quick-config 26.12.0-beta.12 → 26.12.0-beta.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,408 @@
1
+ /*! For license information please see 626.quick-config.umd.min.js.LICENSE.txt */
2
+ "use strict";(self.webpackChunkCrystaldesignQuickConfig=self.webpackChunkCrystaldesignQuickConfig||[]).push([[626],{5626:(e,t,r)=>{r.r(t),r.d(t,{CanvasTexture:()=>o.ROQ,FileLoader:()=>o.hH6,Loader:()=>o.aNw,ModelViewerElement:()=>nc,NearestFilter:()=>o.TyD});const i=(e,t)=>"method"===t.kind&&t.descriptor&&!("value"in t.descriptor)?{...t,finisher(r){r.createProperty(t.key,e)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:t.key,initializer(){"function"==typeof t.initializer&&(this[t.key]=t.initializer.call(this))},finisher(r){r.createProperty(t.key,e)}};function n(e){return(t,r)=>void 0!==r?((e,t,r)=>{t.constructor.createProperty(r,e)})(e,t,r):i(e,t)}var s;null===(s=window.HTMLSlotElement)||void 0===s||s.prototype.assignedElements;var o=r(6831);const l=window,c=l.ShadowRoot&&(void 0===l.ShadyCSS||l.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,A=Symbol(),d=new WeakMap;class css_tag_o{constructor(e,t,r){if(this._$cssResult$=!0,r!==A)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(c&&void 0===e){const r=void 0!==t&&1===t.length;r&&(e=d.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&d.set(t,e))}return e}toString(){return this.cssText}}const h=c?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const r of e.cssRules)t+=r.cssText;return(e=>new css_tag_o("string"==typeof e?e:e+"",void 0,A))(t)})(e):e;var p;const g=window,m=g.trustedTypes,f=m?m.emptyScript:"",E=g.reactiveElementPolyfillSupport,_={toAttribute(e,t){switch(t){case Boolean:e=e?f:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let r=e;switch(t){case Boolean:r=null!==e;break;case Number:r=null===e?null:Number(e);break;case Object:case Array:try{r=JSON.parse(e)}catch(e){r=null}}return r}},a=(e,t)=>t!==e&&(t==t||e==e),C={attribute:!0,type:String,converter:_,reflect:!1,hasChanged:a},I="finalized";class u extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var t;this.finalize(),(null!==(t=this.h)&&void 0!==t?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach(((t,r)=>{const s=this._$Ep(r,t);void 0!==s&&(this._$Ev.set(s,r),e.push(s))})),e}static createProperty(e,t=C){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const r="symbol"==typeof e?Symbol():"__"+e,s=this.getPropertyDescriptor(e,r,t);void 0!==s&&Object.defineProperty(this.prototype,e,s)}}static getPropertyDescriptor(e,t,r){return{get(){return this[t]},set(s){const o=this[e];this[t]=s,this.requestUpdate(e,o,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||C}static finalize(){if(this.hasOwnProperty(I))return!1;this[I]=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),void 0!==e.h&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const e=this.properties,t=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const r of t)this.createProperty(r,e[r])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const r=new Set(e.flat(1/0).reverse());for(const e of r)t.unshift(h(e))}else void 0!==e&&t.push(h(e));return t}static _$Ep(e,t){const r=t.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof e?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(e=this.constructor.h)||void 0===e||e.forEach((e=>e(this)))}addController(e){var t,r;(null!==(t=this._$ES)&&void 0!==t?t:this._$ES=[]).push(e),void 0!==this.renderRoot&&this.isConnected&&(null===(r=e.hostConnected)||void 0===r||r.call(e))}removeController(e){var t;null===(t=this._$ES)||void 0===t||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])}))}createRenderRoot(){var e;const t=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{c?e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):t.forEach((t=>{const r=document.createElement("style"),s=l.litNonce;void 0!==s&&r.setAttribute("nonce",s),r.textContent=t.cssText,e.appendChild(r)}))})(t,this.constructor.elementStyles),t}connectedCallback(){var e;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostConnected)||void 0===t?void 0:t.call(e)}))}enableUpdating(e){}disconnectedCallback(){var e;null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostDisconnected)||void 0===t?void 0:t.call(e)}))}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$EO(e,t,r=C){var s;const o=this.constructor._$Ep(e,r);if(void 0!==o&&!0===r.reflect){const l=(void 0!==(null===(s=r.converter)||void 0===s?void 0:s.toAttribute)?r.converter:_).toAttribute(t,r.type);this._$El=e,null==l?this.removeAttribute(o):this.setAttribute(o,l),this._$El=null}}_$AK(e,t){var r;const s=this.constructor,o=s._$Ev.get(e);if(void 0!==o&&this._$El!==o){const e=s.getPropertyOptions(o),l="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==(null===(r=e.converter)||void 0===r?void 0:r.fromAttribute)?e.converter:_;this._$El=o,this[o]=l.fromAttribute(t,e.type),this._$El=null}}requestUpdate(e,t,r){let s=!0;void 0!==e&&(((r=r||this.constructor.getPropertyOptions(e)).hasChanged||a)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),!0===r.reflect&&this._$El!==e&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(e,r))):s=!1),!this.isUpdatePending&&s&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((e,t)=>this[t]=e)),this._$Ei=void 0);let t=!1;const r=this._$AL;try{t=this.shouldUpdate(r),t?(this.willUpdate(r),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostUpdate)||void 0===t?void 0:t.call(e)})),this.update(r)):this._$Ek()}catch(e){throw t=!1,this._$Ek(),e}t&&this._$AE(r)}willUpdate(e){}_$AE(e){var t;null===(t=this._$ES)||void 0===t||t.forEach((e=>{var t;return null===(t=e.hostUpdated)||void 0===t?void 0:t.call(e)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){void 0!==this._$EC&&(this._$EC.forEach(((e,t)=>this._$EO(t,this[t],e))),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}}var S;u[I]=!0,u.elementProperties=new Map,u.elementStyles=[],u.shadowRootOptions={mode:"open"},null==E||E({ReactiveElement:u}),(null!==(p=g.reactiveElementVersions)&&void 0!==p?p:g.reactiveElementVersions=[]).push("1.6.3");const x=window,T=x.trustedTypes,y=T?T.createPolicy("lit-html",{createHTML:e=>e}):void 0,b="$lit$",B=`lit$${(Math.random()+"").slice(9)}$`,U="?"+B,F=`<${U}>`,Q=document,lit_html_u=()=>Q.createComment(""),lit_html_d=e=>null===e||"object"!=typeof e&&"function"!=typeof e,O=Array.isArray,v=e=>O(e)||"function"==typeof(null==e?void 0:e[Symbol.iterator]),G=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,W=/-->/g,q=/>/g,X=RegExp(">|[ \t\n\f\r](?:([^\\s\"'>=/]+)([ \t\n\f\r]*=[ \t\n\f\r]*(?:[^ \t\n\f\r\"'`<>=]|(\"|')|))|$)","g"),K=/'/g,j=/"/g,Y=/^(?:script|style|textarea|title)$/i,w=e=>(t,...r)=>({_$litType$:e,strings:t,values:r}),J=w(1),$=(w(2),Symbol.for("lit-noChange")),ee=Symbol.for("lit-nothing"),te=new WeakMap,ne=Q.createTreeWalker(Q,129,null,!1);function P(e,t){if(!Array.isArray(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==y?y.createHTML(t):t}const V=(e,t)=>{const r=e.length-1,s=[];let o,l=2===t?"<svg>":"",c=G;for(let t=0;t<r;t++){const r=e[t];let A,d,h=-1,p=0;for(;p<r.length&&(c.lastIndex=p,d=c.exec(r),null!==d);)p=c.lastIndex,c===G?"!--"===d[1]?c=W:void 0!==d[1]?c=q:void 0!==d[2]?(Y.test(d[2])&&(o=RegExp("</"+d[2],"g")),c=X):void 0!==d[3]&&(c=X):c===X?">"===d[0]?(c=null!=o?o:G,h=-1):void 0===d[1]?h=-2:(h=c.lastIndex-d[2].length,A=d[1],c=void 0===d[3]?X:'"'===d[3]?j:K):c===j||c===K?c=X:c===W||c===q?c=G:(c=X,o=void 0);const g=c===X&&e[t+1].startsWith("/>")?" ":"";l+=c===G?r+F:h>=0?(s.push(A),r.slice(0,h)+b+r.slice(h)+B+g):r+B+(-2===h?(s.push(void 0),t):g)}return[P(e,l+(e[r]||"<?>")+(2===t?"</svg>":"")),s]};class N{constructor({strings:e,_$litType$:t},r){let s;this.parts=[];let o=0,l=0;const c=e.length-1,A=this.parts,[d,h]=V(e,t);if(this.el=N.createElement(d,r),ne.currentNode=this.el.content,2===t){const e=this.el.content,t=e.firstChild;t.remove(),e.append(...t.childNodes)}for(;null!==(s=ne.nextNode())&&A.length<c;){if(1===s.nodeType){if(s.hasAttributes()){const e=[];for(const t of s.getAttributeNames())if(t.endsWith(b)||t.startsWith(B)){const r=h[l++];if(e.push(t),void 0!==r){const e=s.getAttribute(r.toLowerCase()+b).split(B),t=/([.?@])?(.*)/.exec(r);A.push({type:1,index:o,name:t[2],strings:e,ctor:"."===t[1]?H:"?"===t[1]?L:"@"===t[1]?z:k})}else A.push({type:6,index:o})}for(const t of e)s.removeAttribute(t)}if(Y.test(s.tagName)){const e=s.textContent.split(B),t=e.length-1;if(t>0){s.textContent=T?T.emptyScript:"";for(let r=0;r<t;r++)s.append(e[r],lit_html_u()),ne.nextNode(),A.push({type:2,index:++o});s.append(e[t],lit_html_u())}}}else if(8===s.nodeType)if(s.data===U)A.push({type:2,index:o});else{let e=-1;for(;-1!==(e=s.data.indexOf(B,e+1));)A.push({type:7,index:o}),e+=B.length-1}o++}}static createElement(e,t){const r=Q.createElement("template");return r.innerHTML=e,r}}function lit_html_S(e,t,r=e,s){var o,l,c,A;if(t===$)return t;let d=void 0!==s?null===(o=r._$Co)||void 0===o?void 0:o[s]:r._$Cl;const h=lit_html_d(t)?void 0:t._$litDirective$;return(null==d?void 0:d.constructor)!==h&&(null===(l=null==d?void 0:d._$AO)||void 0===l||l.call(d,!1),void 0===h?d=void 0:(d=new h(e),d._$AT(e,r,s)),void 0!==s?(null!==(c=(A=r)._$Co)&&void 0!==c?c:A._$Co=[])[s]=d:r._$Cl=d),void 0!==d&&(t=lit_html_S(e,d._$AS(e,t.values),d,s)),t}class M{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var t;const{el:{content:r},parts:s}=this._$AD,o=(null!==(t=null==e?void 0:e.creationScope)&&void 0!==t?t:Q).importNode(r,!0);ne.currentNode=o;let l=ne.nextNode(),c=0,A=0,d=s[0];for(;void 0!==d;){if(c===d.index){let t;2===d.type?t=new R(l,l.nextSibling,this,e):1===d.type?t=new d.ctor(l,d.name,d.strings,this,e):6===d.type&&(t=new Z(l,this,e)),this._$AV.push(t),d=s[++A]}c!==(null==d?void 0:d.index)&&(l=ne.nextNode(),c++)}return ne.currentNode=Q,o}v(e){let t=0;for(const r of this._$AV)void 0!==r&&(void 0!==r.strings?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}}class R{constructor(e,t,r,s){var o;this.type=2,this._$AH=ee,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=s,this._$Cp=null===(o=null==s?void 0:s.isConnected)||void 0===o||o}get _$AU(){var e,t;return null!==(t=null===(e=this._$AM)||void 0===e?void 0:e._$AU)&&void 0!==t?t:this._$Cp}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===(null==e?void 0:e.nodeType)&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=lit_html_S(this,e,t),lit_html_d(e)?e===ee||null==e||""===e?(this._$AH!==ee&&this._$AR(),this._$AH=ee):e!==this._$AH&&e!==$&&this._(e):void 0!==e._$litType$?this.g(e):void 0!==e.nodeType?this.$(e):v(e)?this.T(e):this._(e)}k(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}$(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}_(e){this._$AH!==ee&&lit_html_d(this._$AH)?this._$AA.nextSibling.data=e:this.$(Q.createTextNode(e)),this._$AH=e}g(e){var t;const{values:r,_$litType$:s}=e,o="number"==typeof s?this._$AC(e):(void 0===s.el&&(s.el=N.createElement(P(s.h,s.h[0]),this.options)),s);if((null===(t=this._$AH)||void 0===t?void 0:t._$AD)===o)this._$AH.v(r);else{const e=new M(o,this),t=e.u(this.options);e.v(r),this.$(t),this._$AH=e}}_$AC(e){let t=te.get(e.strings);return void 0===t&&te.set(e.strings,t=new N(e)),t}T(e){O(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let r,s=0;for(const o of e)s===t.length?t.push(r=new R(this.k(lit_html_u()),this.k(lit_html_u()),this,this.options)):r=t[s],r._$AI(o),s++;s<t.length&&(this._$AR(r&&r._$AB.nextSibling,s),t.length=s)}_$AR(e=this._$AA.nextSibling,t){var r;for(null===(r=this._$AP)||void 0===r||r.call(this,!1,!0,t);e&&e!==this._$AB;){const t=e.nextSibling;e.remove(),e=t}}setConnected(e){var t;void 0===this._$AM&&(this._$Cp=e,null===(t=this._$AP)||void 0===t||t.call(this,e))}}class k{constructor(e,t,r,s,o){this.type=1,this._$AH=ee,this._$AN=void 0,this.element=e,this.name=t,this._$AM=s,this.options=o,r.length>2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=ee}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,t=this,r,s){const o=this.strings;let l=!1;if(void 0===o)e=lit_html_S(this,e,t,0),l=!lit_html_d(e)||e!==this._$AH&&e!==$,l&&(this._$AH=e);else{const s=e;let c,A;for(e=o[0],c=0;c<o.length-1;c++)A=lit_html_S(this,s[r+c],t,c),A===$&&(A=this._$AH[c]),l||(l=!lit_html_d(A)||A!==this._$AH[c]),A===ee?e=ee:e!==ee&&(e+=(null!=A?A:"")+o[c+1]),this._$AH[c]=A}l&&!s&&this.j(e)}j(e){e===ee?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=e?e:"")}}class H extends k{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===ee?void 0:e}}const ie=T?T.emptyScript:"";class L extends k{constructor(){super(...arguments),this.type=4}j(e){e&&e!==ee?this.element.setAttribute(this.name,ie):this.element.removeAttribute(this.name)}}class z extends k{constructor(e,t,r,s,o){super(e,t,r,s,o),this.type=5}_$AI(e,t=this){var r;if((e=null!==(r=lit_html_S(this,e,t,0))&&void 0!==r?r:ee)===$)return;const s=this._$AH,o=e===ee&&s!==ee||e.capture!==s.capture||e.once!==s.once||e.passive!==s.passive,l=e!==ee&&(s===ee||o);o&&this.element.removeEventListener(this.name,this,s),l&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t,r;"function"==typeof this._$AH?this._$AH.call(null!==(r=null===(t=this.options)||void 0===t?void 0:t.host)&&void 0!==r?r:this.element,e):this._$AH.handleEvent(e)}}class Z{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){lit_html_S(this,e)}}const re=x.litHtmlPolyfillSupport;null==re||re(N,R),(null!==(S=x.litHtmlVersions)&&void 0!==S?S:x.litHtmlVersions=[]).push("2.8.0");const D=(e,t,r)=>{var s,o;const l=null!==(s=null==r?void 0:r.renderBefore)&&void 0!==s?s:t;let c=l._$litPart$;if(void 0===c){const e=null!==(o=null==r?void 0:r.renderBefore)&&void 0!==o?o:null;l._$litPart$=c=new R(t.insertBefore(lit_html_u(),e),e,void 0,null!=r?r:{})}return c._$AI(e),c};var ae,se;class lit_element_s extends u{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,t;const r=super.createRenderRoot();return null!==(e=(t=this.renderOptions).renderBefore)&&void 0!==e||(t.renderBefore=r.firstChild),r}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=D(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),null===(e=this._$Do)||void 0===e||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),null===(e=this._$Do)||void 0===e||e.setConnected(!1)}render(){return $}}lit_element_s.finalized=!0,lit_element_s._$litElement$=!0,null===(ae=globalThis.litElementHydrateSupport)||void 0===ae||ae.call(globalThis,{LitElement:lit_element_s});const oe=globalThis.litElementPolyfillSupport;null==oe||oe({LitElement:lit_element_s});(null!==(se=globalThis.litElementVersions)&&void 0!==se?se:globalThis.litElementVersions=[]).push("3.3.3");const le=null!=navigator.xr&&null!=self.XRSession&&null!=navigator.xr.isSessionSupported,ce=le&&null!=self.XRSession.prototype.requestHitTestSource,Ae=null!=self.ResizeObserver,de=null!=self.IntersectionObserver,ue=ce,he=((()=>{const e=navigator.userAgent||navigator.vendor||self.opera;let t=!1;(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4)))&&(t=!0)})(),/\bCrOS\b/.test(navigator.userAgent),/android/i.test(navigator.userAgent)),pe=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!self.MSStream||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1,ge=(/Safari\//.test(navigator.userAgent),/firefox/i.test(navigator.userAgent)),me=/OculusBrowser/.test(navigator.userAgent),fe=(pe&&/CriOS\//.test(navigator.userAgent),he&&!ge&&!me),Ee=Boolean(window.webkit&&window.webkit.messageHandlers),ve=(()=>{if(pe){if(Ee)return Boolean(/CriOS\/|EdgiOS\/|FxiOS\/|GSA\/|DuckDuckGo\//.test(navigator.userAgent));{const e=document.createElement("a");return Boolean(e.relList&&e.relList.supports&&e.relList.supports("ar"))}}return!1})();var _e=r(5108);const deserializeUrl=e=>e&&"null"!==e?toFullUrl(e):null,assertIsArCandidate=()=>{if(ue)return;const e=[];throw le||e.push("WebXR Device API"),ce||e.push("WebXR Hit Test API"),new Error(`The following APIs are required for AR, but are missing in this browser: ${e.join(", ")}`)},toFullUrl=e=>new URL(e,window.location.toString()).toString(),debounce=(e,t)=>{let r=null;return(...s)=>{null!=r&&self.clearTimeout(r),r=self.setTimeout((()=>{r=null,e(...s)}),t)}},clamp=(e,t,r)=>Math.max(t,Math.min(r,e)),Ce=(()=>{const e=(()=>{var e;if(null===(e=document.documentElement.getAttribute("itemtype"))||void 0===e?void 0:e.includes("schema.org/SearchResultsPage"))return!0;if(window.self!==window.top)return!0;const t=null!=document.head?Array.from(document.head.querySelectorAll("meta")):[];for(const e of t)if("viewport"===e.name)return!0;return!1})();return e||_e.warn('No <meta name="viewport"> detected; <model-viewer> will cap pixel density at 1.'),()=>e?window.devicePixelRatio:1})(),Ie=(()=>{const e=new RegExp("[?&]model-viewer-debug-mode(&|$)");return()=>self.ModelViewerElement&&self.ModelViewerElement.debugMode||self.location&&self.location.search&&self.location.search.match(e)})();var __decorate=function(e,t,r,s){var o,l=arguments.length,c=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var A=e.length-1;A>=0;A--)(o=e[A])&&(c=(l<3?o(c):l>3?o(t,r,c):o(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c};const Se=Symbol("currentEnvironmentMap"),xe=Symbol("currentBackground"),Te=Symbol("updateEnvironment"),ye=Symbol("cancelEnvironmentUpdate"),Me=J`
3
+ <style>
4
+ :host {
5
+ display: block;
6
+ position: relative;
7
+ contain: strict;
8
+ width: 300px;
9
+ height: 150px;
10
+ }
11
+
12
+ .container {
13
+ position: relative;
14
+ overflow: hidden;
15
+ }
16
+
17
+ .userInput {
18
+ width: 100%;
19
+ height: 100%;
20
+ display: none;
21
+ position: relative;
22
+ outline-offset: -1px;
23
+ outline-width: 1px;
24
+ }
25
+
26
+ canvas {
27
+ position: absolute;
28
+ display: none;
29
+ pointer-events: none;
30
+ /* NOTE(cdata): Chrome 76 and below apparently have a bug
31
+ * that causes our canvas not to display pixels unless it is
32
+ * on its own render layer
33
+ * @see https://github.com/google/model-viewer/pull/755#issuecomment-536597893
34
+ */
35
+ transform: translateZ(0);
36
+ }
37
+
38
+ .show {
39
+ display: block;
40
+ }
41
+
42
+ /* Adapted from HTML5 Boilerplate
43
+ *
44
+ * @see https://github.com/h5bp/html5-boilerplate/blob/ceb4620c78fc82e13534fc44202a3f168754873f/dist/css/main.css#L122-L133 */
45
+ .screen-reader-only {
46
+ border: 0;
47
+ left: 0;
48
+ top: 0;
49
+ clip: rect(0, 0, 0, 0);
50
+ height: 1px;
51
+ margin: -1px;
52
+ overflow: hidden;
53
+ padding: 0;
54
+ position: absolute;
55
+ white-space: nowrap;
56
+ width: 1px;
57
+ pointer-events: none;
58
+ }
59
+
60
+ .slot {
61
+ position: absolute;
62
+ pointer-events: none;
63
+ top: 0;
64
+ left: 0;
65
+ width: 100%;
66
+ height: 100%;
67
+ }
68
+
69
+ .slot > * {
70
+ pointer-events: initial;
71
+ }
72
+
73
+ .annotation-wrapper ::slotted(*) {
74
+ opacity: var(--max-hotspot-opacity, 1);
75
+ transition: opacity 0.3s;
76
+ }
77
+
78
+ .pointer-tumbling .annotation-wrapper ::slotted(*) {
79
+ pointer-events: none;
80
+ }
81
+
82
+ .annotation-wrapper ::slotted(*) {
83
+ pointer-events: initial;
84
+ }
85
+
86
+ .annotation-wrapper.hide ::slotted(*) {
87
+ opacity: var(--min-hotspot-opacity, 0.25);
88
+ }
89
+
90
+ .slot.poster {
91
+ display: none;
92
+ background-color: inherit;
93
+ }
94
+
95
+ .slot.poster.show {
96
+ display: inherit;
97
+ }
98
+
99
+ .slot.poster > * {
100
+ pointer-events: initial;
101
+ }
102
+
103
+ .slot.poster:not(.show) > * {
104
+ pointer-events: none;
105
+ }
106
+
107
+ #default-poster {
108
+ width: 100%;
109
+ height: 100%;
110
+ /* The default poster is a <button> so we need to set display
111
+ * to prevent it from being affected by text-align: */
112
+ display: block;
113
+ position: absolute;
114
+ border: none;
115
+ padding: 0;
116
+ background-size: contain;
117
+ background-repeat: no-repeat;
118
+ background-position: center;
119
+ background-color: #fff0;
120
+ }
121
+
122
+ #default-progress-bar {
123
+ display: block;
124
+ position: relative;
125
+ width: 100%;
126
+ height: 100%;
127
+ pointer-events: none;
128
+ overflow: hidden;
129
+ }
130
+
131
+ #default-progress-bar > .bar {
132
+ position: absolute;
133
+ top: 0;
134
+ left: 0;
135
+ width: 100%;
136
+ height: var(--progress-bar-height, 5px);
137
+ background-color: var(--progress-bar-color, rgba(0, 0, 0, 0.4));
138
+ transition: transform 0.09s;
139
+ transform-origin: top left;
140
+ transform: scaleX(0);
141
+ overflow: hidden;
142
+ }
143
+
144
+ #default-progress-bar > .bar.hide {
145
+ transition: opacity 0.3s 1s;
146
+ opacity: 0;
147
+ }
148
+
149
+ .centered {
150
+ align-items: center;
151
+ justify-content: center;
152
+ }
153
+
154
+ .cover {
155
+ position: absolute;
156
+ top: 0;
157
+ left: 0;
158
+ width: 100%;
159
+ height: 100%;
160
+ pointer-events: none;
161
+ }
162
+
163
+ .slot.interaction-prompt {
164
+ display: var(--interaction-prompt-display, flex);
165
+ overflow: hidden;
166
+ opacity: 0;
167
+ will-change: opacity;
168
+ transition: opacity 0.3s;
169
+ }
170
+
171
+ .slot.interaction-prompt.visible {
172
+ opacity: 1;
173
+ }
174
+
175
+ .animated-container {
176
+ will-change: transform, opacity;
177
+ opacity: 0;
178
+ transition: opacity 0.3s;
179
+ }
180
+
181
+ .slot.interaction-prompt > * {
182
+ pointer-events: none;
183
+ }
184
+
185
+ .slot.ar-button {
186
+ -moz-user-select: none;
187
+ -webkit-tap-highlight-color: transparent;
188
+ user-select: none;
189
+
190
+ display: var(--ar-button-display, block);
191
+ }
192
+
193
+ .slot.ar-button:not(.enabled) {
194
+ display: none;
195
+ }
196
+
197
+ .fab {
198
+ display: flex;
199
+ align-items: center;
200
+ justify-content: center;
201
+ box-sizing: border-box;
202
+ width: 40px;
203
+ height: 40px;
204
+ cursor: pointer;
205
+ background-color: #fff;
206
+ box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.15);
207
+ border-radius: 100px;
208
+ }
209
+
210
+ .fab > * {
211
+ opacity: 0.87;
212
+ }
213
+
214
+ #default-ar-button {
215
+ position: absolute;
216
+ bottom: 16px;
217
+ right: 16px;
218
+ transform: scale(var(--ar-button-scale, 1));
219
+ transform-origin: bottom right;
220
+ }
221
+
222
+ .slot.pan-target {
223
+ display: block;
224
+ position: absolute;
225
+ width: 0;
226
+ height: 0;
227
+ left: 50%;
228
+ top: 50%;
229
+ transform: translate3d(-50%, -50%, 0);
230
+ background-color: transparent;
231
+ opacity: 0;
232
+ transition: opacity 0.3s;
233
+ }
234
+
235
+ #default-pan-target {
236
+ width: 6px;
237
+ height: 6px;
238
+ border-radius: 6px;
239
+ border: 1px solid white;
240
+ box-shadow: 0px 0px 2px 1px rgba(0, 0, 0, 0.8);
241
+ }
242
+
243
+ .slot.default {
244
+ pointer-events: none;
245
+ }
246
+
247
+ .slot.progress-bar {
248
+ pointer-events: none;
249
+ }
250
+
251
+ .slot.exit-webxr-ar-button {
252
+ pointer-events: none;
253
+ }
254
+
255
+ .slot.exit-webxr-ar-button:not(.enabled) {
256
+ display: none;
257
+ }
258
+
259
+ #default-exit-webxr-ar-button {
260
+ display: flex;
261
+ align-items: center;
262
+ justify-content: center;
263
+ position: absolute;
264
+ top: env(safe-area-inset-top, 16px);
265
+ right: 16px;
266
+ width: 40px;
267
+ height: 40px;
268
+ box-sizing: border-box;
269
+ }
270
+
271
+ #default-exit-webxr-ar-button > svg {
272
+ fill: #fff;
273
+ }
274
+ </style>
275
+ <div class="container">
276
+ <div class="userInput" tabindex="0" role="img"
277
+ aria-label="3D model">
278
+ <div class="slot canvas">
279
+ <slot name="canvas">
280
+ <canvas></canvas>
281
+ </slot>
282
+ </div>
283
+
284
+ </div>
285
+
286
+ <!-- NOTE(cdata): We need to wrap slots because browsers without ShadowDOM
287
+ will have their <slot> elements removed by ShadyCSS -->
288
+ <div class="slot poster">
289
+ <slot name="poster">
290
+ <button type="button" id="default-poster" aria-hidden="true" aria-label="Loading 3D model"></button>
291
+ </slot>
292
+ </div>
293
+
294
+ <div class="slot ar-button">
295
+ <slot name="ar-button">
296
+ <a id="default-ar-button" part="default-ar-button" class="fab"
297
+ tabindex="2"
298
+ role="button"
299
+ href="javascript:void(0);"
300
+ aria-label="View in your space">
301
+ ${J`
302
+ <svg version="1.1" id="view_x5F_in_x5F_AR_x5F_icon"
303
+ xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px"
304
+ viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve">
305
+ <rect id="Bounding_Box" x="0" y="0" fill="none" width="24" height="24"/>
306
+ <g id="Art_layer">
307
+ <path d="M3,4c0-0.55,0.45-1,1-1h2V1H4C2.35,1,1,2.35,1,4v2h2V4z"/>
308
+ <path d="M20,3c0.55,0,1,0.45,1,1v2h2V4c0-1.65-1.35-3-3-3h-2v2H20z"/>
309
+ <path d="M4,21c-0.55,0-1-0.45-1-1v-2H1v2c0,1.65,1.35,3,3,3h2v-2H4z"/>
310
+ <path d="M20,21c0.55,0,1-0.45,1-1v-2h2v2c0,1.65-1.35,3-3,3h-2v-2H20z"/>
311
+ <g>
312
+ <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
313
+ 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
314
+ 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"/>
315
+ </g>
316
+ </g>
317
+ </svg>`}
318
+ </a>
319
+ </slot>
320
+ </div>
321
+
322
+ <div class="slot pan-target">
323
+ <slot name="pan-target">
324
+ <div id="default-pan-target">
325
+ </div>
326
+ </slot>
327
+ </div>
328
+
329
+ <div class="slot interaction-prompt cover centered">
330
+ <div id="prompt" class="animated-container">
331
+ <slot name="interaction-prompt" aria-hidden="true">
332
+ ${J`
333
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="25" height="36">
334
+ <defs>
335
+ <path id="A" d="M.001.232h24.997V36H.001z" />
336
+ </defs>
337
+ <g transform="translate(-11 -4)" fill="none" fill-rule="evenodd">
338
+ <path fill-opacity="0" fill="#fff" d="M0 0h44v44H0z" />
339
+ <g transform="translate(11 3)">
340
+ <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" />
341
+ <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" />
342
+ <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" />
343
+ <g transform="translate(0 .769)">
344
+ <mask id="B" fill="#fff">
345
+ <use xlink:href="#A" />
346
+ </mask>
347
+ <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)" />
348
+ </g>
349
+ </g>
350
+ </g>
351
+ </svg>`}
352
+ </slot>
353
+ </div>
354
+ </div>
355
+
356
+ <div id="finger0" class="animated-container cover">
357
+ <slot name="finger0" aria-hidden="true">
358
+ </slot>
359
+ </div>
360
+ <div id="finger1" class="animated-container cover">
361
+ <slot name="finger1" aria-hidden="true">
362
+ </slot>
363
+ </div>
364
+
365
+ <div class="slot default">
366
+ <slot></slot>
367
+
368
+ <div class="slot progress-bar">
369
+ <slot name="progress-bar">
370
+ <div id="default-progress-bar" aria-hidden="true">
371
+ <div class="bar" part="default-progress-bar"></div>
372
+ </div>
373
+ </slot>
374
+ </div>
375
+
376
+ <div class="slot exit-webxr-ar-button">
377
+ <slot name="exit-webxr-ar-button">
378
+ <a id="default-exit-webxr-ar-button" part="default-exit-webxr-ar-button"
379
+ tabindex="3"
380
+ aria-label="Exit AR"
381
+ aria-hidden="true">
382
+ ${J`
383
+ <svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="#000000">
384
+ <!-- NOTE(cdata): This SVG filter is a stop-gap until we can implement
385
+ support for dynamic re-coloring of UI components -->
386
+ <defs>
387
+ <filter id="drop-shadow" x="-100%" y="-100%" width="300%" height="300%">
388
+ <feGaussianBlur in="SourceAlpha" stdDeviation="1"/>
389
+ <feOffset dx="0" dy="0" result="offsetblur"/>
390
+ <feFlood flood-color="#000000"/>
391
+ <feComposite in2="offsetblur" operator="in"/>
392
+ <feMerge>
393
+ <feMergeNode/>
394
+ <feMergeNode in="SourceGraphic"/>
395
+ </feMerge>
396
+ </filter>
397
+ </defs>
398
+ <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"/>
399
+ <path d="M0 0h24v24H0z" fill="none"/>
400
+ </svg>`}
401
+ </a>
402
+ </slot>
403
+ </div>
404
+ </div>
405
+ </div>
406
+ <div class="screen-reader-only" role="region" aria-label="Live announcements">
407
+ <span id="status" role="status"></span>
408
+ </div>`;var we=r(5108);const be=new WeakMap;class DRACOLoader extends o.aNw{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,r,s){const l=new o.hH6(this.manager);l.setPath(this.path),l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setWithCredentials(this.withCredentials),l.load(e,(e=>{this.parse(e,t,s)}),r,s)}parse(e,t,r=(()=>{})){this.decodeDracoFile(e,t,null,null,o.KI_,r).catch(r)}decodeDracoFile(e,t,r,s,l=o.GUF,c=(()=>{})){const A={attributeIDs:r||this.defaultAttributeIDs,attributeTypes:s||this.defaultAttributeTypes,useUniqueIDs:!!r,vertexColorSpace:l};return this.decodeGeometry(e,A).then(t).catch(c)}decodeGeometry(e,t){const r=JSON.stringify(t);if(be.has(e)){const t=be.get(e);if(t.key===r)return t.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let s;const o=this.workerNextTaskID++,l=e.byteLength,c=this._getWorker(o,l).then((r=>(s=r,new Promise(((r,l)=>{s._callbacks[o]={resolve:r,reject:l},s.postMessage({type:"decode",id:o,taskConfig:t,buffer:e},[e])}))))).then((e=>this._createGeometry(e.geometry)));return c.catch((()=>!0)).then((()=>{s&&o&&this._releaseTask(s,o)})),be.set(e,{key:r,promise:c}),c}_createGeometry(e){const t=new o.u9r;e.index&&t.setIndex(new o.TlE(e.index.array,1));for(let r=0;r<e.attributes.length;r++){const s=e.attributes[r],l=s.name,c=s.array,A=s.itemSize,d=new o.TlE(c,A);"color"===l&&(this._assignVertexColorSpace(d,s.vertexColorSpace),d.normalized=c instanceof Float32Array==!1),t.setAttribute(l,d)}return t}_assignVertexColorSpace(e,t){if(t!==o.KI_)return;const r=new o.Ilk;for(let t=0,s=e.count;t<s;t++)r.fromBufferAttribute(e,t),o.epp.toWorkingColorSpace(r,o.KI_),e.setXYZ(t,r.r,r.g,r.b)}_loadLibrary(e,t){const r=new o.hH6(this.manager);return r.setPath(this.decoderPath),r.setResponseType(t),r.setWithCredentials(this.withCredentials),new Promise(((t,s)=>{r.load(e,t,void 0,s)}))}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then((t=>{const r=t[0];e||(this.decoderConfig.wasmBinary=t[1]);const s=DRACOWorker.toString(),o=["/* draco decoder */",r,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([o]))})),this.decoderPending}_getWorker(e,t){return this._initDecoder().then((()=>{if(this.workerPool.length<this.workerLimit){const e=new Worker(this.workerSourceURL);e._callbacks={},e._taskCosts={},e._taskLoad=0,e.postMessage({type:"init",decoderConfig:this.decoderConfig}),e.onmessage=function(t){const r=t.data;switch(r.type){case"decode":e._callbacks[r.id].resolve(r);break;case"error":e._callbacks[r.id].reject(r);break;default:we.error('THREE.DRACOLoader: Unexpected message, "'+r.type+'"')}},this.workerPool.push(e)}else this.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));const r=this.workerPool[this.workerPool.length-1];return r._taskCosts[e]=t,r._taskLoad+=t,r}))}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){we.log("Task load: ",this.workerPool.map((e=>e._taskLoad)))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,""!==this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),this}}function DRACOWorker(){let e,t;function decodeAttribute(e,t,r,s,o,l){const c=l.num_components(),A=r.num_points()*c,d=A*o.BYTES_PER_ELEMENT,h=function getDracoDataType(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(e,o),p=e._malloc(d);t.GetAttributeDataArrayForAllPoints(r,l,h,d,p);const g=new o(e.HEAPF32.buffer,p,A).slice();return e._free(p),{name:s,array:g,itemSize:c}}onmessage=function(r){const s=r.data;switch(s.type){case"init":e=s.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":const r=s.buffer,o=s.taskConfig;t.then((e=>{const t=e.draco,l=new t.Decoder;try{const e=function decodeGeometry(e,t,r,s){const o=s.attributeIDs,l=s.attributeTypes;let c,A;const d=t.GetEncodedGeometryType(r);if(d===e.TRIANGULAR_MESH)c=new e.Mesh,A=t.DecodeArrayToMesh(r,r.byteLength,c);else{if(d!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");c=new e.PointCloud,A=t.DecodeArrayToPointCloud(r,r.byteLength,c)}if(!A.ok()||0===c.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+A.error_msg());const h={index:null,attributes:[]};for(const r in o){const A=self[l[r]];let d,p;if(s.useUniqueIDs)p=o[r],d=t.GetAttributeByUniqueId(c,p);else{if(p=t.GetAttributeId(c,e[o[r]]),-1===p)continue;d=t.GetAttribute(c,p)}const g=decodeAttribute(e,t,c,r,A,d);"color"===r&&(g.vertexColorSpace=s.vertexColorSpace),h.attributes.push(g)}d===e.TRIANGULAR_MESH&&(h.index=function decodeIndex(e,t,r){const s=3*r.num_faces(),o=4*s,l=e._malloc(o);t.GetTrianglesUInt32Array(r,o,l);const c=new Uint32Array(e.HEAPF32.buffer,l,s).slice();return e._free(l),{array:c,itemSize:1}}(e,t,c));return e.destroy(c),h}(t,l,new Int8Array(r),o),c=e.attributes.map((e=>e.array.buffer));e.index&&c.push(e.index.array.buffer),self.postMessage({type:"decode",id:s.id,geometry:e},c)}catch(e){we.error(e),self.postMessage({type:"error",id:s.id,error:e.message})}finally{t.destroy(l)}}))}}}var Be=r(5108);function toTrianglesDrawMode(e,t){if(t===o.WwZ)return Be.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(t===o.z$h||t===o.UlW){let r=e.getIndex();if(null===r){const t=[],s=e.getAttribute("position");if(void 0===s)return Be.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e<s.count;e++)t.push(e);e.setIndex(t),r=e.getIndex()}const s=r.count-2,l=[];if(t===o.z$h)for(let e=1;e<=s;e++)l.push(r.getX(0)),l.push(r.getX(e)),l.push(r.getX(e+1));else for(let e=0;e<s;e++)e%2==0?(l.push(r.getX(e)),l.push(r.getX(e+1)),l.push(r.getX(e+2))):(l.push(r.getX(e+2)),l.push(r.getX(e+1)),l.push(r.getX(e)));l.length/3!==s&&Be.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const c=e.clone();return c.setIndex(l),c.clearGroups(),c}return Be.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e}var Re=r(5108);class GLTFLoader extends o.aNw{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register((function(e){return new GLTFMaterialsClearcoatExtension(e)})),this.register((function(e){return new GLTFMaterialsDispersionExtension(e)})),this.register((function(e){return new GLTFTextureBasisUExtension(e)})),this.register((function(e){return new GLTFTextureWebPExtension(e)})),this.register((function(e){return new GLTFTextureAVIFExtension(e)})),this.register((function(e){return new GLTFMaterialsSheenExtension(e)})),this.register((function(e){return new GLTFMaterialsTransmissionExtension(e)})),this.register((function(e){return new GLTFMaterialsVolumeExtension(e)})),this.register((function(e){return new GLTFMaterialsIorExtension(e)})),this.register((function(e){return new GLTFMaterialsEmissiveStrengthExtension(e)})),this.register((function(e){return new GLTFMaterialsSpecularExtension(e)})),this.register((function(e){return new GLTFMaterialsIridescenceExtension(e)})),this.register((function(e){return new GLTFMaterialsAnisotropyExtension(e)})),this.register((function(e){return new GLTFMaterialsBumpExtension(e)})),this.register((function(e){return new GLTFLightsExtension(e)})),this.register((function(e){return new GLTFMeshoptCompression(e)})),this.register((function(e){return new GLTFMeshGpuInstancing(e)}))}load(e,t,r,s){const l=this;let c;if(""!==this.resourcePath)c=this.resourcePath;else if(""!==this.path){const t=o.Zp0.extractUrlBase(e);c=o.Zp0.resolveURL(t,this.path)}else c=o.Zp0.extractUrlBase(e);this.manager.itemStart(e);const _onError=function(t){s?s(t):Re.error(t),l.manager.itemError(e),l.manager.itemEnd(e)},A=new o.hH6(this.manager);A.setPath(this.path),A.setResponseType("arraybuffer"),A.setRequestHeader(this.requestHeader),A.setWithCredentials(this.withCredentials),A.load(e,(function(r){try{l.parse(r,c,(function(r){t(r),l.manager.itemEnd(e)}),_onError)}catch(e){_onError(e)}}),r,_onError)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,r,s){let o;const l={},c={},A=new TextDecoder;if("string"==typeof e)o=JSON.parse(e);else if(e instanceof ArrayBuffer){if(A.decode(new Uint8Array(e,0,4))===De){try{l[Le.KHR_BINARY_GLTF]=new GLTFBinaryExtension(e)}catch(e){return void(s&&s(e))}o=JSON.parse(l[Le.KHR_BINARY_GLTF].content)}else o=JSON.parse(A.decode(e))}else o=e;if(void 0===o.asset||o.asset.version[0]<2)return void(s&&s(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")));const d=new GLTFParser(o,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});d.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e<this.pluginCallbacks.length;e++){const t=this.pluginCallbacks[e](d);t.name||Re.error("THREE.GLTFLoader: Invalid plugin found: missing name"),c[t.name]=t,l[t.name]=!0}if(o.extensionsUsed)for(let e=0;e<o.extensionsUsed.length;++e){const t=o.extensionsUsed[e],r=o.extensionsRequired||[];switch(t){case Le.KHR_MATERIALS_UNLIT:l[t]=new GLTFMaterialsUnlitExtension;break;case Le.KHR_DRACO_MESH_COMPRESSION:l[t]=new GLTFDracoMeshCompressionExtension(o,this.dracoLoader);break;case Le.KHR_TEXTURE_TRANSFORM:l[t]=new GLTFTextureTransformExtension;break;case Le.KHR_MESH_QUANTIZATION:l[t]=new GLTFMeshQuantizationExtension;break;default:r.indexOf(t)>=0&&void 0===c[t]&&Re.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}d.setExtensions(l),d.setPlugins(c),d.parse(r,s)}parseAsync(e,t){const r=this;return new Promise((function(s,o){r.parse(e,t,s,o)}))}}function GLTFRegistry(){let e={};return{get:function(t){return e[t]},add:function(t,r){e[t]=r},remove:function(t){delete e[t]},removeAll:function(){e={}}}}const Le={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",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class GLTFLightsExtension{constructor(e){this.parser=e,this.name=Le.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let r=0,s=t.length;r<s;r++){const s=t[r];s.extensions&&s.extensions[this.name]&&void 0!==s.extensions[this.name].light&&e._addNodeRef(this.cache,s.extensions[this.name].light)}}_loadLight(e){const t=this.parser,r="light:"+e;let s=t.cache.get(r);if(s)return s;const l=t.json,c=((l.extensions&&l.extensions[this.name]||{}).lights||[])[e];let A;const d=new o.Ilk(16777215);void 0!==c.color&&d.setRGB(c.color[0],c.color[1],c.color[2],o.GUF);const h=void 0!==c.range?c.range:0;switch(c.type){case"directional":A=new o.Ox3(d),A.target.position.set(0,0,-1),A.add(A.target);break;case"point":A=new o.cek(d),A.distance=h;break;case"spot":A=new o.PMe(d),A.distance=h,c.spot=c.spot||{},c.spot.innerConeAngle=void 0!==c.spot.innerConeAngle?c.spot.innerConeAngle:0,c.spot.outerConeAngle=void 0!==c.spot.outerConeAngle?c.spot.outerConeAngle:Math.PI/4,A.angle=c.spot.outerConeAngle,A.penumbra=1-c.spot.innerConeAngle/c.spot.outerConeAngle,A.target.position.set(0,0,-1),A.add(A.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+c.type)}return A.position.set(0,0,0),assignExtrasToUserData(A,c),void 0!==c.intensity&&(A.intensity=c.intensity),A.name=t.createUniqueName(c.name||"light_"+e),s=Promise.resolve(A),t.cache.add(r,s),s}getDependency(e,t){if("light"===e)return this._loadLight(t)}createNodeAttachment(e){const t=this,r=this.parser,s=r.json.nodes[e],o=(s.extensions&&s.extensions[this.name]||{}).light;return void 0===o?null:this._loadLight(o).then((function(e){return r._getNodeRef(t.cache,o,e)}))}}class GLTFMaterialsUnlitExtension{constructor(){this.name=Le.KHR_MATERIALS_UNLIT}getMaterialType(){return o.vBJ}extendParams(e,t,r){const s=[];e.color=new o.Ilk(1,1,1),e.opacity=1;const l=t.pbrMetallicRoughness;if(l){if(Array.isArray(l.baseColorFactor)){const t=l.baseColorFactor;e.color.setRGB(t[0],t[1],t[2],o.GUF),e.opacity=t[3]}void 0!==l.baseColorTexture&&s.push(r.assignTexture(e,"map",l.baseColorTexture,o.KI_))}return Promise.all(s)}}class GLTFMaterialsEmissiveStrengthExtension{constructor(e){this.parser=e,this.name=Le.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=r.extensions[this.name].emissiveStrength;return void 0!==s&&(t.emissiveIntensity=s),Promise.resolve()}}class GLTFMaterialsClearcoatExtension{constructor(e){this.parser=e,this.name=Le.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.EJi:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const l=[],c=s.extensions[this.name];if(void 0!==c.clearcoatFactor&&(t.clearcoat=c.clearcoatFactor),void 0!==c.clearcoatTexture&&l.push(r.assignTexture(t,"clearcoatMap",c.clearcoatTexture)),void 0!==c.clearcoatRoughnessFactor&&(t.clearcoatRoughness=c.clearcoatRoughnessFactor),void 0!==c.clearcoatRoughnessTexture&&l.push(r.assignTexture(t,"clearcoatRoughnessMap",c.clearcoatRoughnessTexture)),void 0!==c.clearcoatNormalTexture&&(l.push(r.assignTexture(t,"clearcoatNormalMap",c.clearcoatNormalTexture)),void 0!==c.clearcoatNormalTexture.scale)){const e=c.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new o.FM8(e,e)}return Promise.all(l)}}class GLTFMaterialsDispersionExtension{constructor(e){this.parser=e,this.name=Le.KHR_MATERIALS_DISPERSION}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.EJi:null}extendMaterialParams(e,t){const r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=r.extensions[this.name];return t.dispersion=void 0!==s.dispersion?s.dispersion:0,Promise.resolve()}}class GLTFMaterialsIridescenceExtension{constructor(e){this.parser=e,this.name=Le.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.EJi:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],l=s.extensions[this.name];return void 0!==l.iridescenceFactor&&(t.iridescence=l.iridescenceFactor),void 0!==l.iridescenceTexture&&o.push(r.assignTexture(t,"iridescenceMap",l.iridescenceTexture)),void 0!==l.iridescenceIor&&(t.iridescenceIOR=l.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==l.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=l.iridescenceThicknessMinimum),void 0!==l.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=l.iridescenceThicknessMaximum),void 0!==l.iridescenceThicknessTexture&&o.push(r.assignTexture(t,"iridescenceThicknessMap",l.iridescenceThicknessTexture)),Promise.all(o)}}class GLTFMaterialsSheenExtension{constructor(e){this.parser=e,this.name=Le.KHR_MATERIALS_SHEEN}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.EJi:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const l=[];t.sheenColor=new o.Ilk(0,0,0),t.sheenRoughness=0,t.sheen=1;const c=s.extensions[this.name];if(void 0!==c.sheenColorFactor){const e=c.sheenColorFactor;t.sheenColor.setRGB(e[0],e[1],e[2],o.GUF)}return void 0!==c.sheenRoughnessFactor&&(t.sheenRoughness=c.sheenRoughnessFactor),void 0!==c.sheenColorTexture&&l.push(r.assignTexture(t,"sheenColorMap",c.sheenColorTexture,o.KI_)),void 0!==c.sheenRoughnessTexture&&l.push(r.assignTexture(t,"sheenRoughnessMap",c.sheenRoughnessTexture)),Promise.all(l)}}class GLTFMaterialsTransmissionExtension{constructor(e){this.parser=e,this.name=Le.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.EJi:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],l=s.extensions[this.name];return void 0!==l.transmissionFactor&&(t.transmission=l.transmissionFactor),void 0!==l.transmissionTexture&&o.push(r.assignTexture(t,"transmissionMap",l.transmissionTexture)),Promise.all(o)}}class GLTFMaterialsVolumeExtension{constructor(e){this.parser=e,this.name=Le.KHR_MATERIALS_VOLUME}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.EJi:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const l=[],c=s.extensions[this.name];t.thickness=void 0!==c.thicknessFactor?c.thicknessFactor:0,void 0!==c.thicknessTexture&&l.push(r.assignTexture(t,"thicknessMap",c.thicknessTexture)),t.attenuationDistance=c.attenuationDistance||1/0;const A=c.attenuationColor||[1,1,1];return t.attenuationColor=(new o.Ilk).setRGB(A[0],A[1],A[2],o.GUF),Promise.all(l)}}class GLTFMaterialsIorExtension{constructor(e){this.parser=e,this.name=Le.KHR_MATERIALS_IOR}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.EJi:null}extendMaterialParams(e,t){const r=this.parser.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const s=r.extensions[this.name];return t.ior=void 0!==s.ior?s.ior:1.5,Promise.resolve()}}class GLTFMaterialsSpecularExtension{constructor(e){this.parser=e,this.name=Le.KHR_MATERIALS_SPECULAR}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.EJi:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const l=[],c=s.extensions[this.name];t.specularIntensity=void 0!==c.specularFactor?c.specularFactor:1,void 0!==c.specularTexture&&l.push(r.assignTexture(t,"specularIntensityMap",c.specularTexture));const A=c.specularColorFactor||[1,1,1];return t.specularColor=(new o.Ilk).setRGB(A[0],A[1],A[2],o.GUF),void 0!==c.specularColorTexture&&l.push(r.assignTexture(t,"specularColorMap",c.specularColorTexture,o.KI_)),Promise.all(l)}}class GLTFMaterialsBumpExtension{constructor(e){this.parser=e,this.name=Le.EXT_MATERIALS_BUMP}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.EJi:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],l=s.extensions[this.name];return t.bumpScale=void 0!==l.bumpFactor?l.bumpFactor:1,void 0!==l.bumpTexture&&o.push(r.assignTexture(t,"bumpMap",l.bumpTexture)),Promise.all(o)}}class GLTFMaterialsAnisotropyExtension{constructor(e){this.parser=e,this.name=Le.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.EJi:null}extendMaterialParams(e,t){const r=this.parser,s=r.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const o=[],l=s.extensions[this.name];return void 0!==l.anisotropyStrength&&(t.anisotropy=l.anisotropyStrength),void 0!==l.anisotropyRotation&&(t.anisotropyRotation=l.anisotropyRotation),void 0!==l.anisotropyTexture&&o.push(r.assignTexture(t,"anisotropyMap",l.anisotropyTexture)),Promise.all(o)}}class GLTFTextureBasisUExtension{constructor(e){this.parser=e,this.name=Le.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,r=t.json,s=r.textures[e];if(!s.extensions||!s.extensions[this.name])return null;const o=s.extensions[this.name],l=t.options.ktx2Loader;if(!l){if(r.extensionsRequired&&r.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,o.source,l)}}class GLTFTextureWebPExtension{constructor(e){this.parser=e,this.name=Le.EXT_TEXTURE_WEBP}loadTexture(e){const t=this.name,r=this.parser,s=r.json,o=s.textures[e];if(!o.extensions||!o.extensions[t])return null;const l=o.extensions[t],c=s.images[l.source];let A=r.textureLoader;if(c.uri){const e=r.options.manager.getHandler(c.uri);null!==e&&(A=e)}return r.loadTextureImage(e,l.source,A)}}class GLTFTextureAVIFExtension{constructor(e){this.parser=e,this.name=Le.EXT_TEXTURE_AVIF}loadTexture(e){const t=this.name,r=this.parser,s=r.json,o=s.textures[e];if(!o.extensions||!o.extensions[t])return null;const l=o.extensions[t],c=s.images[l.source];let A=r.textureLoader;if(c.uri){const e=r.options.manager.getHandler(c.uri);null!==e&&(A=e)}return r.loadTextureImage(e,l.source,A)}}class GLTFMeshoptCompression{constructor(e){this.name=Le.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,r=t.bufferViews[e];if(r.extensions&&r.extensions[this.name]){const e=r.extensions[this.name],s=this.parser.getDependency("buffer",e.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then((function(t){const r=e.byteOffset||0,s=e.byteLength||0,l=e.count,c=e.byteStride,A=new Uint8Array(t,r,s);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(l,c,A,e.mode,e.filter).then((function(e){return e.buffer})):o.ready.then((function(){const t=new ArrayBuffer(l*c);return o.decodeGltfBuffer(new Uint8Array(t),l,c,A,e.mode,e.filter),t}))}))}return null}}class GLTFMeshGpuInstancing{constructor(e){this.name=Le.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,r=t.nodes[e];if(!r.extensions||!r.extensions[this.name]||void 0===r.mesh)return null;const s=t.meshes[r.mesh];for(const e of s.primitives)if(e.mode!==Qe.TRIANGLES&&e.mode!==Qe.TRIANGLE_STRIP&&e.mode!==Qe.TRIANGLE_FAN&&void 0!==e.mode)return null;const l=r.extensions[this.name].attributes,c=[],A={};for(const e in l)c.push(this.parser.getDependency("accessor",l[e]).then((t=>(A[e]=t,A[e]))));return c.length<1?null:(c.push(this.parser.createNodeMesh(e)),Promise.all(c).then((e=>{const t=e.pop(),r=t.isGroup?t.children:[t],s=e[0].count,l=[];for(const e of r){const t=new o.yGw,r=new o.Pa4,c=new o._fP,d=new o.Pa4(1,1,1),h=new o.SPe(e.geometry,e.material,s);for(let e=0;e<s;e++)A.TRANSLATION&&r.fromBufferAttribute(A.TRANSLATION,e),A.ROTATION&&c.fromBufferAttribute(A.ROTATION,e),A.SCALE&&d.fromBufferAttribute(A.SCALE,e),h.setMatrixAt(e,t.compose(r,c,d));for(const t in A)if("_COLOR_0"===t){const e=A[t];h.instanceColor=new o.lb7(e.array,e.itemSize,e.normalized)}else"TRANSLATION"!==t&&"ROTATION"!==t&&"SCALE"!==t&&e.geometry.setAttribute(t,A[t]);o.Tme.prototype.copy.call(h,e),this.parser.assignFinalMaterial(h),l.push(h)}return t.isGroup?(t.clear(),t.add(...l),t):l[0]})))}}const De="glTF",Ue=1313821514,Pe=5130562;class GLTFBinaryExtension{constructor(e){this.name=Le.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,12),r=new TextDecoder;if(this.header={magic:r.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==De)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const s=this.header.length-12,o=new DataView(e,12);let l=0;for(;l<s;){const t=o.getUint32(l,!0);l+=4;const s=o.getUint32(l,!0);if(l+=4,s===Ue){const s=new Uint8Array(e,12+l,t);this.content=r.decode(s)}else if(s===Pe){const r=12+l;this.body=e.slice(r,r+t)}l+=t}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class GLTFDracoMeshCompressionExtension{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Le.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const r=this.json,s=this.dracoLoader,l=e.extensions[this.name].bufferView,c=e.extensions[this.name].attributes,A={},d={},h={};for(const e in c){const t=He[e]||e.toLowerCase();A[t]=c[e]}for(const t in e.attributes){const s=He[t]||t.toLowerCase();if(void 0!==c[t]){const o=r.accessors[e.attributes[t]],l=Ne[o.componentType];h[s]=l.name,d[s]=!0===o.normalized}}return t.getDependency("bufferView",l).then((function(e){return new Promise((function(t,r){s.decodeDracoFile(e,(function(e){for(const t in e.attributes){const r=e.attributes[t],s=d[t];void 0!==s&&(r.normalized=s)}t(e)}),A,h,o.GUF,r)}))}))}}class GLTFTextureTransformExtension{constructor(){this.name=Le.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return void 0!==t.texCoord&&t.texCoord!==e.channel||void 0!==t.offset||void 0!==t.rotation||void 0!==t.scale?(e=e.clone(),void 0!==t.texCoord&&(e.channel=t.texCoord),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),e.needsUpdate=!0,e):e}}class GLTFMeshQuantizationExtension{constructor(){this.name=Le.KHR_MESH_QUANTIZATION}}class GLTFCubicSplineInterpolant extends o._C8{constructor(e,t,r,s){super(e,t,r,s)}copySampleValue_(e){const t=this.resultBuffer,r=this.sampleValues,s=this.valueSize,o=e*s*3+s;for(let e=0;e!==s;e++)t[e]=r[o+e];return t}interpolate_(e,t,r,s){const o=this.resultBuffer,l=this.sampleValues,c=this.valueSize,A=2*c,d=3*c,h=s-t,p=(r-t)/h,g=p*p,m=g*p,f=e*d,E=f-d,_=-2*m+3*g,C=m-g,I=1-_,S=C-g+p;for(let e=0;e!==c;e++){const t=l[E+e+c],r=l[E+e+A]*h,s=l[f+e+c],d=l[f+e]*h;o[e]=I*t+S*r+_*s+C*d}return o}}const Fe=new o._fP;class GLTFCubicSplineQuaternionInterpolant extends GLTFCubicSplineInterpolant{interpolate_(e,t,r,s){const o=super.interpolate_(e,t,r,s);return Fe.fromArray(o).normalize().toArray(o),o}}const Qe={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},Ne={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Oe={9728:o.TyD,9729:o.wem,9984:o.YLQ,9985:o.qyh,9986:o.aH4,9987:o.D1R},Ge={33071:o.uWy,33648:o.OoA,10497:o.rpg},ke={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},He={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"},Ve={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},ze={CUBICSPLINE:void 0,LINEAR:o.NMF,STEP:o.Syv},We="OPAQUE",qe="MASK",Xe="BLEND";function createDefaultMaterial(e){return void 0===e.DefaultMaterial&&(e.DefaultMaterial=new o.Wid({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:o.Wl3})),e.DefaultMaterial}function addUnknownExtensionsToUserData(e,t,r){for(const s in r.extensions)void 0===e[s]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[s]=r.extensions[s])}function assignExtrasToUserData(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):Re.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function updateMorphTargets(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let r=0,s=t.weights.length;r<s;r++)e.morphTargetInfluences[r]=t.weights[r];if(t.extras&&Array.isArray(t.extras.targetNames)){const r=t.extras.targetNames;if(e.morphTargetInfluences.length===r.length){e.morphTargetDictionary={};for(let t=0,s=r.length;t<s;t++)e.morphTargetDictionary[r[t]]=t}else Re.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function createPrimitiveKey(e){let t;const r=e.extensions&&e.extensions[Le.KHR_DRACO_MESH_COMPRESSION];if(t=r?"draco:"+r.bufferView+":"+r.indices+":"+createAttributesKey(r.attributes):e.indices+":"+createAttributesKey(e.attributes)+":"+e.mode,void 0!==e.targets)for(let r=0,s=e.targets.length;r<s;r++)t+=":"+createAttributesKey(e.targets[r]);return t}function createAttributesKey(e){let t="";const r=Object.keys(e).sort();for(let s=0,o=r.length;s<o;s++)t+=r[s]+":"+e[r[s]]+";";return t}function getNormalizedComponentScale(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}const Ke=new o.yGw;class GLTFParser{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new GLTFRegistry,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 r=!1,s=-1,l=!1,c=-1;if("undefined"!=typeof navigator){const e=navigator.userAgent;r=!0===/^((?!chrome|android).)*safari/i.test(e);const t=e.match(/Version\/(\d+)/);s=r&&t?parseInt(t[1],10):-1,l=e.indexOf("Firefox")>-1,c=l?e.match(/Firefox\/([0-9]+)\./)[1]:-1}"undefined"==typeof createImageBitmap||r&&s<17||l&&c<98?this.textureLoader=new o.dpR(this.options.manager):this.textureLoader=new o.QRU(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new o.hH6(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const r=this,s=this.json,o=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll((function(e){return e._markDefs&&e._markDefs()})),Promise.all(this._invokeAll((function(e){return e.beforeRoot&&e.beforeRoot()}))).then((function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])})).then((function(t){const l={scene:t[0][s.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:s.asset,parser:r,userData:{}};return addUnknownExtensionsToUserData(o,l,s),assignExtrasToUserData(l,s),Promise.all(r._invokeAll((function(e){return e.afterRoot&&e.afterRoot(l)}))).then((function(){for(const e of l.scenes)e.updateMatrixWorld();e(l)}))})).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],r=this.json.meshes||[];for(let r=0,s=t.length;r<s;r++){const s=t[r].joints;for(let t=0,r=s.length;t<r;t++)e[s[t]].isBone=!0}for(let t=0,s=e.length;t<s;t++){const s=e[t];void 0!==s.mesh&&(this._addNodeRef(this.meshCache,s.mesh),void 0!==s.skin&&(r[s.mesh].isSkinnedMesh=!0)),void 0!==s.camera&&this._addNodeRef(this.cameraCache,s.camera)}}_addNodeRef(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,r){if(e.refs[t]<=1)return r;const s=r.clone(),updateMappings=(e,t)=>{const r=this.associations.get(e);null!=r&&this.associations.set(t,r);for(const[r,s]of e.children.entries())updateMappings(s,t.children[r])};return updateMappings(r,s),s.name+="_instance_"+e.uses[t]++,s}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let r=0;r<t.length;r++){const s=e(t[r]);if(s)return s}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const r=[];for(let s=0;s<t.length;s++){const o=e(t[s]);o&&r.push(o)}return r}getDependency(e,t){const r=e+":"+t;let s=this.cache.get(r);if(!s){switch(e){case"scene":s=this.loadScene(t);break;case"node":s=this._invokeOne((function(e){return e.loadNode&&e.loadNode(t)}));break;case"mesh":s=this._invokeOne((function(e){return e.loadMesh&&e.loadMesh(t)}));break;case"accessor":s=this.loadAccessor(t);break;case"bufferView":s=this._invokeOne((function(e){return e.loadBufferView&&e.loadBufferView(t)}));break;case"buffer":s=this.loadBuffer(t);break;case"material":s=this._invokeOne((function(e){return e.loadMaterial&&e.loadMaterial(t)}));break;case"texture":s=this._invokeOne((function(e){return e.loadTexture&&e.loadTexture(t)}));break;case"skin":s=this.loadSkin(t);break;case"animation":s=this._invokeOne((function(e){return e.loadAnimation&&e.loadAnimation(t)}));break;case"camera":s=this.loadCamera(t);break;default:if(s=this._invokeOne((function(r){return r!=this&&r.getDependency&&r.getDependency(e,t)})),!s)throw new Error("Unknown type: "+e)}this.cache.add(r,s)}return s}getDependencies(e){let t=this.cache.get(e);if(!t){const r=this,s=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(s.map((function(t,s){return r.getDependency(e,s)}))),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],r=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[Le.KHR_BINARY_GLTF].body);const s=this.options;return new Promise((function(e,l){r.load(o.Zp0.resolveURL(t.uri,s.path),e,void 0,(function(){l(new Error('THREE.GLTFLoader: Failed to load buffer "'+t.uri+'".'))}))}))}loadBufferView(e){const t=this.json.bufferViews[e];return this.getDependency("buffer",t.buffer).then((function(e){const r=t.byteLength||0,s=t.byteOffset||0;return e.slice(s,s+r)}))}loadAccessor(e){const t=this,r=this.json,s=this.json.accessors[e];if(void 0===s.bufferView&&void 0===s.sparse){const e=ke[s.type],t=Ne[s.componentType],r=!0===s.normalized,l=new t(s.count*e);return Promise.resolve(new o.TlE(l,e,r))}const l=[];return void 0!==s.bufferView?l.push(this.getDependency("bufferView",s.bufferView)):l.push(null),void 0!==s.sparse&&(l.push(this.getDependency("bufferView",s.sparse.indices.bufferView)),l.push(this.getDependency("bufferView",s.sparse.values.bufferView))),Promise.all(l).then((function(e){const l=e[0],c=ke[s.type],A=Ne[s.componentType],d=A.BYTES_PER_ELEMENT,h=d*c,p=s.byteOffset||0,g=void 0!==s.bufferView?r.bufferViews[s.bufferView].byteStride:void 0,m=!0===s.normalized;let f,E;if(g&&g!==h){const e=Math.floor(p/g),r="InterleavedBuffer:"+s.bufferView+":"+s.componentType+":"+e+":"+s.count;let h=t.cache.get(r);h||(f=new A(l,e*g,s.count*g/d),h=new o.vpT(f,g/d),t.cache.add(r,h)),E=new o.kB5(h,c,p%g/d,m)}else f=null===l?new A(s.count*c):new A(l,p,s.count*c),E=new o.TlE(f,c,m);if(void 0!==s.sparse){const t=ke.SCALAR,r=Ne[s.sparse.indices.componentType],d=s.sparse.indices.byteOffset||0,h=s.sparse.values.byteOffset||0,p=new r(e[1],d,s.sparse.count*t),g=new A(e[2],h,s.sparse.count*c);null!==l&&(E=new o.TlE(E.array.slice(),E.itemSize,E.normalized)),E.normalized=!1;for(let e=0,t=p.length;e<t;e++){const t=p[e];if(E.setX(t,g[e*c]),c>=2&&E.setY(t,g[e*c+1]),c>=3&&E.setZ(t,g[e*c+2]),c>=4&&E.setW(t,g[e*c+3]),c>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}E.normalized=m}return E}))}loadTexture(e){const t=this.json,r=this.options,s=t.textures[e].source,o=t.images[s];let l=this.textureLoader;if(o.uri){const e=r.manager.getHandler(o.uri);null!==e&&(l=e)}return this.loadTextureImage(e,s,l)}loadTextureImage(e,t,r){const s=this,l=this.json,c=l.textures[e],A=l.images[t],d=(A.uri||A.bufferView)+":"+c.sampler;if(this.textureCache[d])return this.textureCache[d];const h=this.loadImageSource(t,r).then((function(t){t.flipY=!1,t.name=c.name||A.name||"",""===t.name&&"string"==typeof A.uri&&!1===A.uri.startsWith("data:image/")&&(t.name=A.uri);const r=(l.samplers||{})[c.sampler]||{};return t.magFilter=Oe[r.magFilter]||o.wem,t.minFilter=Oe[r.minFilter]||o.D1R,t.wrapS=Ge[r.wrapS]||o.rpg,t.wrapT=Ge[r.wrapT]||o.rpg,t.generateMipmaps=!t.isCompressedTexture&&t.minFilter!==o.TyD&&t.minFilter!==o.wem,s.associations.set(t,{textures:e}),t})).catch((function(){return null}));return this.textureCache[d]=h,h}loadImageSource(e,t){const r=this,s=this.json,l=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then((e=>e.clone()));const c=s.images[e],A=self.URL||self.webkitURL;let d=c.uri||"",h=!1;if(void 0!==c.bufferView)d=r.getDependency("bufferView",c.bufferView).then((function(e){h=!0;const t=new Blob([e],{type:c.mimeType});return d=A.createObjectURL(t),d}));else if(void 0===c.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const p=Promise.resolve(d).then((function(e){return new Promise((function(r,s){let c=r;!0===t.isImageBitmapLoader&&(c=function(e){const t=new o.xEZ(e);t.needsUpdate=!0,r(t)}),t.load(o.Zp0.resolveURL(e,l.path),c,void 0,s)}))})).then((function(e){return!0===h&&A.revokeObjectURL(d),assignExtrasToUserData(e,c),e.userData.mimeType=c.mimeType||function getImageURIMimeType(e){return e.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"}(c.uri),e})).catch((function(e){throw Re.error("THREE.GLTFLoader: Couldn't load texture",d),e}));return this.sourceCache[e]=p,p}assignTexture(e,t,r,s){const o=this;return this.getDependency("texture",r.index).then((function(l){if(!l)return null;if(void 0!==r.texCoord&&r.texCoord>0&&((l=l.clone()).channel=r.texCoord),o.extensions[Le.KHR_TEXTURE_TRANSFORM]){const e=void 0!==r.extensions?r.extensions[Le.KHR_TEXTURE_TRANSFORM]:void 0;if(e){const t=o.associations.get(l);l=o.extensions[Le.KHR_TEXTURE_TRANSFORM].extendTexture(l,e),o.associations.set(l,t)}}return void 0!==s&&(l.colorSpace=s),e[t]=l,l}))}assignFinalMaterial(e){const t=e.geometry;let r=e.material;const s=void 0===t.attributes.tangent,l=void 0!==t.attributes.color,c=void 0===t.attributes.normal;if(e.isPoints){const e="PointsMaterial:"+r.uuid;let t=this.cache.get(e);t||(t=new o.UY4,o.F5T.prototype.copy.call(t,r),t.color.copy(r.color),t.map=r.map,t.sizeAttenuation=!1,this.cache.add(e,t)),r=t}else if(e.isLine){const e="LineBasicMaterial:"+r.uuid;let t=this.cache.get(e);t||(t=new o.nls,o.F5T.prototype.copy.call(t,r),t.color.copy(r.color),t.map=r.map,this.cache.add(e,t)),r=t}if(s||l||c){let e="ClonedMaterial:"+r.uuid+":";s&&(e+="derivative-tangents:"),l&&(e+="vertex-colors:"),c&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=r.clone(),l&&(t.vertexColors=!0),c&&(t.flatShading=!0),s&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(r))),r=t}e.material=r}getMaterialType(){return o.Wid}loadMaterial(e){const t=this,r=this.json,s=this.extensions,l=r.materials[e];let c;const A={},d=[];if((l.extensions||{})[Le.KHR_MATERIALS_UNLIT]){const e=s[Le.KHR_MATERIALS_UNLIT];c=e.getMaterialType(),d.push(e.extendParams(A,l,t))}else{const r=l.pbrMetallicRoughness||{};if(A.color=new o.Ilk(1,1,1),A.opacity=1,Array.isArray(r.baseColorFactor)){const e=r.baseColorFactor;A.color.setRGB(e[0],e[1],e[2],o.GUF),A.opacity=e[3]}void 0!==r.baseColorTexture&&d.push(t.assignTexture(A,"map",r.baseColorTexture,o.KI_)),A.metalness=void 0!==r.metallicFactor?r.metallicFactor:1,A.roughness=void 0!==r.roughnessFactor?r.roughnessFactor:1,void 0!==r.metallicRoughnessTexture&&(d.push(t.assignTexture(A,"metalnessMap",r.metallicRoughnessTexture)),d.push(t.assignTexture(A,"roughnessMap",r.metallicRoughnessTexture))),c=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),d.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,A)}))))}!0===l.doubleSided&&(A.side=o.ehD);const h=l.alphaMode||We;if(h===Xe?(A.transparent=!0,A.depthWrite=!1):(A.transparent=!1,h===qe&&(A.alphaTest=void 0!==l.alphaCutoff?l.alphaCutoff:.5)),void 0!==l.normalTexture&&c!==o.vBJ&&(d.push(t.assignTexture(A,"normalMap",l.normalTexture)),A.normalScale=new o.FM8(1,1),void 0!==l.normalTexture.scale)){const e=l.normalTexture.scale;A.normalScale.set(e,e)}if(void 0!==l.occlusionTexture&&c!==o.vBJ&&(d.push(t.assignTexture(A,"aoMap",l.occlusionTexture)),void 0!==l.occlusionTexture.strength&&(A.aoMapIntensity=l.occlusionTexture.strength)),void 0!==l.emissiveFactor&&c!==o.vBJ){const e=l.emissiveFactor;A.emissive=(new o.Ilk).setRGB(e[0],e[1],e[2],o.GUF)}return void 0!==l.emissiveTexture&&c!==o.vBJ&&d.push(t.assignTexture(A,"emissiveMap",l.emissiveTexture,o.KI_)),Promise.all(d).then((function(){const r=new c(A);return l.name&&(r.name=l.name),assignExtrasToUserData(r,l),t.associations.set(r,{materials:e}),l.extensions&&addUnknownExtensionsToUserData(s,r,l),r}))}createUniqueName(e){const t=o.iUV.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,r=this.extensions,s=this.primitiveCache;function createDracoPrimitive(e){return r[Le.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(r){return addPrimitiveAttributes(r,e,t)}))}const l=[];for(let r=0,c=e.length;r<c;r++){const c=e[r],A=createPrimitiveKey(c),d=s[A];if(d)l.push(d.promise);else{let e;e=c.extensions&&c.extensions[Le.KHR_DRACO_MESH_COMPRESSION]?createDracoPrimitive(c):addPrimitiveAttributes(new o.u9r,c,t),s[A]={primitive:c,promise:e},l.push(e)}}return Promise.all(l)}loadMesh(e){const t=this,r=this.json,s=this.extensions,l=r.meshes[e],c=l.primitives,A=[];for(let e=0,t=c.length;e<t;e++){const t=void 0===c[e].material?createDefaultMaterial(this.cache):this.getDependency("material",c[e].material);A.push(t)}return A.push(t.loadGeometries(c)),Promise.all(A).then((function(r){const A=r.slice(0,r.length-1),d=r[r.length-1],h=[];for(let r=0,p=d.length;r<p;r++){const p=d[r],g=c[r];let m;const f=A[r];if(g.mode===Qe.TRIANGLES||g.mode===Qe.TRIANGLE_STRIP||g.mode===Qe.TRIANGLE_FAN||void 0===g.mode)m=!0===l.isSkinnedMesh?new o.TUv(p,f):new o.Kj0(p,f),!0===m.isSkinnedMesh&&m.normalizeSkinWeights(),g.mode===Qe.TRIANGLE_STRIP?m.geometry=toTrianglesDrawMode(m.geometry,o.UlW):g.mode===Qe.TRIANGLE_FAN&&(m.geometry=toTrianglesDrawMode(m.geometry,o.z$h));else if(g.mode===Qe.LINES)m=new o.ejS(p,f);else if(g.mode===Qe.LINE_STRIP)m=new o.x12(p,f);else if(g.mode===Qe.LINE_LOOP)m=new o.blk(p,f);else{if(g.mode!==Qe.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+g.mode);m=new o.woe(p,f)}Object.keys(m.geometry.morphAttributes).length>0&&updateMorphTargets(m,l),m.name=t.createUniqueName(l.name||"mesh_"+e),assignExtrasToUserData(m,l),g.extensions&&addUnknownExtensionsToUserData(s,m,g),t.assignFinalMaterial(m),h.push(m)}for(let r=0,s=h.length;r<s;r++)t.associations.set(h[r],{meshes:e,primitives:r});if(1===h.length)return l.extensions&&addUnknownExtensionsToUserData(s,h[0],l),h[0];const p=new o.ZAu;l.extensions&&addUnknownExtensionsToUserData(s,p,l),t.associations.set(p,{meshes:e});for(let e=0,t=h.length;e<t;e++)p.add(h[e]);return p}))}loadCamera(e){let t;const r=this.json.cameras[e],s=r[r.type];if(s)return"perspective"===r.type?t=new o.cPb(o.M8C.radToDeg(s.yfov),s.aspectRatio||1,s.znear||1,s.zfar||2e6):"orthographic"===r.type&&(t=new o.iKG(-s.xmag,s.xmag,s.ymag,-s.ymag,s.znear,s.zfar)),r.name&&(t.name=this.createUniqueName(r.name)),assignExtrasToUserData(t,r),Promise.resolve(t);Re.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(e){const t=this.json.skins[e],r=[];for(let e=0,s=t.joints.length;e<s;e++)r.push(this._loadNodeShallow(t.joints[e]));return void 0!==t.inverseBindMatrices?r.push(this.getDependency("accessor",t.inverseBindMatrices)):r.push(null),Promise.all(r).then((function(e){const r=e.pop(),s=e,l=[],c=[];for(let e=0,A=s.length;e<A;e++){const A=s[e];if(A){l.push(A);const t=new o.yGw;null!==r&&t.fromArray(r.array,16*e),c.push(t)}else Re.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[e])}return new o.OdW(l,c)}))}loadAnimation(e){const t=this.json,r=this,s=t.animations[e],l=s.name?s.name:"animation_"+e,c=[],A=[],d=[],h=[],p=[];for(let e=0,t=s.channels.length;e<t;e++){const t=s.channels[e],r=s.samplers[t.sampler],o=t.target,l=o.node,g=void 0!==s.parameters?s.parameters[r.input]:r.input,m=void 0!==s.parameters?s.parameters[r.output]:r.output;void 0!==o.node&&(c.push(this.getDependency("node",l)),A.push(this.getDependency("accessor",g)),d.push(this.getDependency("accessor",m)),h.push(r),p.push(o))}return Promise.all([Promise.all(c),Promise.all(A),Promise.all(d),Promise.all(h),Promise.all(p)]).then((function(e){const t=e[0],s=e[1],c=e[2],A=e[3],d=e[4],h=[];for(let e=0,o=t.length;e<o;e++){const o=t[e],l=s[e],p=c[e],g=A[e],m=d[e];if(void 0===o)continue;o.updateMatrix&&o.updateMatrix();const f=r._createAnimationTracks(o,l,p,g,m);if(f)for(let e=0;e<f.length;e++)h.push(f[e])}return new o.m7l(l,void 0,h)}))}createNodeMesh(e){const t=this.json,r=this,s=t.nodes[e];return void 0===s.mesh?null:r.getDependency("mesh",s.mesh).then((function(e){const t=r._getNodeRef(r.meshCache,s.mesh,e);return void 0!==s.weights&&t.traverse((function(e){if(e.isMesh)for(let t=0,r=s.weights.length;t<r;t++)e.morphTargetInfluences[t]=s.weights[t]})),t}))}loadNode(e){const t=this,r=this.json.nodes[e],s=t._loadNodeShallow(e),o=[],l=r.children||[];for(let e=0,r=l.length;e<r;e++)o.push(t.getDependency("node",l[e]));const c=void 0===r.skin?Promise.resolve(null):t.getDependency("skin",r.skin);return Promise.all([s,Promise.all(o),c]).then((function(e){const t=e[0],r=e[1],s=e[2];null!==s&&t.traverse((function(e){e.isSkinnedMesh&&e.bind(s,Ke)}));for(let e=0,s=r.length;e<s;e++)t.add(r[e]);return t}))}_loadNodeShallow(e){const t=this.json,r=this.extensions,s=this;if(void 0!==this.nodeCache[e])return this.nodeCache[e];const l=t.nodes[e],c=l.name?s.createUniqueName(l.name):"",A=[],d=s._invokeOne((function(t){return t.createNodeMesh&&t.createNodeMesh(e)}));return d&&A.push(d),void 0!==l.camera&&A.push(s.getDependency("camera",l.camera).then((function(e){return s._getNodeRef(s.cameraCache,l.camera,e)}))),s._invokeAll((function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)})).forEach((function(e){A.push(e)})),this.nodeCache[e]=Promise.all(A).then((function(t){let A;if(A=!0===l.isBone?new o.N$j:t.length>1?new o.ZAu:1===t.length?t[0]:new o.Tme,A!==t[0])for(let e=0,r=t.length;e<r;e++)A.add(t[e]);if(l.name&&(A.userData.name=l.name,A.name=c),assignExtrasToUserData(A,l),l.extensions&&addUnknownExtensionsToUserData(r,A,l),void 0!==l.matrix){const e=new o.yGw;e.fromArray(l.matrix),A.applyMatrix4(e)}else void 0!==l.translation&&A.position.fromArray(l.translation),void 0!==l.rotation&&A.quaternion.fromArray(l.rotation),void 0!==l.scale&&A.scale.fromArray(l.scale);return s.associations.has(A)||s.associations.set(A,{}),s.associations.get(A).nodes=e,A})),this.nodeCache[e]}loadScene(e){const t=this.extensions,r=this.json.scenes[e],s=this,l=new o.ZAu;r.name&&(l.name=s.createUniqueName(r.name)),assignExtrasToUserData(l,r),r.extensions&&addUnknownExtensionsToUserData(t,l,r);const c=r.nodes||[],A=[];for(let e=0,t=c.length;e<t;e++)A.push(s.getDependency("node",c[e]));return Promise.all(A).then((function(e){for(let t=0,r=e.length;t<r;t++)l.add(e[t]);return s.associations=(e=>{const t=new Map;for(const[e,r]of s.associations)(e instanceof o.F5T||e instanceof o.xEZ)&&t.set(e,r);return e.traverse((e=>{const r=s.associations.get(e);null!=r&&t.set(e,r)})),t})(l),l}))}_createAnimationTracks(e,t,r,s,l){const c=[],A=e.name?e.name:e.uuid,d=[];let h;switch(Ve[l.path]===Ve.weights?e.traverse((function(e){e.morphTargetInfluences&&d.push(e.name?e.name:e.uuid)})):d.push(A),Ve[l.path]){case Ve.weights:h=o.dUE;break;case Ve.rotation:h=o.iLg;break;case Ve.translation:case Ve.scale:h=o.yC1;break;default:if(1===r.itemSize)h=o.dUE;else h=o.yC1}const p=void 0!==s.interpolation?ze[s.interpolation]:o.NMF,g=this._getArrayFromAccessor(r);for(let e=0,r=d.length;e<r;e++){const r=new h(d[e]+"."+Ve[l.path],t.array,g,p);"CUBICSPLINE"===s.interpolation&&this._createCubicSplineTrackInterpolant(r),c.push(r)}return c}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const e=getNormalizedComponentScale(t.constructor),r=new Float32Array(t.length);for(let s=0,o=t.length;s<o;s++)r[s]=t[s]*e;t=r}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function InterpolantFactoryMethodGLTFCubicSpline(e){return new(this instanceof o.iLg?GLTFCubicSplineQuaternionInterpolant:GLTFCubicSplineInterpolant)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function addPrimitiveAttributes(e,t,r){const s=t.attributes,l=[];function assignAttributeAccessor(t,s){return r.getDependency("accessor",t).then((function(t){e.setAttribute(s,t)}))}for(const t in s){const r=He[t]||t.toLowerCase();r in e.attributes||l.push(assignAttributeAccessor(s[t],r))}if(void 0!==t.indices&&!e.index){const s=r.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)}));l.push(s)}return o.epp.workingColorSpace!==o.GUF&&"COLOR_0"in s&&Re.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${o.epp.workingColorSpace}" not supported.`),assignExtrasToUserData(e,t),function computeBounds(e,t,r){const s=t.attributes,l=new o.ZzF;if(void 0===s.POSITION)return;{const e=r.json.accessors[s.POSITION],t=e.min,c=e.max;if(void 0===t||void 0===c)return void Re.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(l.set(new o.Pa4(t[0],t[1],t[2]),new o.Pa4(c[0],c[1],c[2])),e.normalized){const t=getNormalizedComponentScale(Ne[e.componentType]);l.min.multiplyScalar(t),l.max.multiplyScalar(t)}}const c=t.targets;if(void 0!==c){const e=new o.Pa4,t=new o.Pa4;for(let s=0,o=c.length;s<o;s++){const o=c[s];if(void 0!==o.POSITION){const s=r.json.accessors[o.POSITION],l=s.min,c=s.max;if(void 0!==l&&void 0!==c){if(t.setX(Math.max(Math.abs(l[0]),Math.abs(c[0]))),t.setY(Math.max(Math.abs(l[1]),Math.abs(c[1]))),t.setZ(Math.max(Math.abs(l[2]),Math.abs(c[2]))),s.normalized){const e=getNormalizedComponentScale(Ne[s.componentType]);t.multiplyScalar(e)}e.max(t)}else Re.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}l.expandByVector(e)}e.boundingBox=l;const A=new o.aLr;l.getCenter(A.center),A.radius=l.min.distanceTo(l.max)/2,e.boundingSphere=A}(e,t,r),Promise.all(l).then((function(){return void 0!==t.targets?function addMorphTargets(e,t,r){let s=!1,o=!1,l=!1;for(let e=0,r=t.length;e<r;e++){const r=t[e];if(void 0!==r.POSITION&&(s=!0),void 0!==r.NORMAL&&(o=!0),void 0!==r.COLOR_0&&(l=!0),s&&o&&l)break}if(!s&&!o&&!l)return Promise.resolve(e);const c=[],A=[],d=[];for(let h=0,p=t.length;h<p;h++){const p=t[h];if(s){const t=void 0!==p.POSITION?r.getDependency("accessor",p.POSITION):e.attributes.position;c.push(t)}if(o){const t=void 0!==p.NORMAL?r.getDependency("accessor",p.NORMAL):e.attributes.normal;A.push(t)}if(l){const t=void 0!==p.COLOR_0?r.getDependency("accessor",p.COLOR_0):e.attributes.color;d.push(t)}}return Promise.all([Promise.all(c),Promise.all(A),Promise.all(d)]).then((function(t){const r=t[0],c=t[1],A=t[2];return s&&(e.morphAttributes.position=r),o&&(e.morphAttributes.normal=c),l&&(e.morphAttributes.color=A),e.morphTargetsRelative=!0,e}))}(e,t.targets,r):e}))}class WorkerPool{constructor(e=4){this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0,this.workerCreator=null}_initWorker(e){if(!this.workers[e]){const t=this.workerCreator();t.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=t}}_getIdleWorker(){for(let e=0;e<this.pool;e++)if(!(this.workerStatus&1<<e))return e;return-1}_onMessage(e,t){const r=this.workersResolve[e];if(r&&r(t),this.queue.length){const{resolve:t,msg:r,transfer:s}=this.queue.shift();this.workersResolve[e]=t,this.workers[e].postMessage(r,s)}else this.workerStatus^=1<<e}setWorkerCreator(e){this.workerCreator=e}setWorkerLimit(e){this.pool=e}postMessage(e,t){return new Promise((r=>{const s=this._getIdleWorker();-1!==s?(this._initWorker(s),this.workerStatus|=1<<s,this.workersResolve[s]=r,this.workers[s].postMessage(e,t)):this.queue.push({resolve:r,msg:e,transfer:t})}))}dispose(){this.workers.forEach((e=>e.terminate())),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}const je=1000066e3;class Ii{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=0,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:0,descriptorBlockSize:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null}}class Si{constructor(e,t,r,s){this._dataView=void 0,this._littleEndian=void 0,this._offset=void 0,this._dataView=new DataView(e.buffer,e.byteOffset+t,r),this._littleEndian=s,this._offset=0}_nextUint8(){const e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){const e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){const e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){const e=this._dataView.getUint32(this._offset,this._littleEndian)+2**32*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,e}_nextInt32(){const e=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint8Array(e){const t=new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+this._offset,e);return this._offset+=e,t}_skip(e){return this._offset+=e,this}_scan(e,t){void 0===t&&(t=0);const r=this._offset;let s=0;for(;this._dataView.getUint8(this._offset)!==t&&s<e;)s++,this._offset++;return s<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+r,s)}}new Uint8Array([0]);const Ye=[171,75,84,88,32,50,48,187,13,10,26,10];function Ti(e){return(new TextDecoder).decode(e)}var Je=r(3085).Buffer;let $e,Ze,et;const tt={env:{emscripten_notify_memory_growth:function(e){et=new Uint8Array(Ze.exports.memory.buffer)}}};class zstddec_module_Q{init(){return $e||($e="undefined"!=typeof fetch?fetch("data:application/wasm;base64,"+nt).then((e=>e.arrayBuffer())).then((e=>WebAssembly.instantiate(e,tt))).then(this._init):WebAssembly.instantiate(Je.from(nt,"base64"),tt).then(this._init),$e)}_init(e){Ze=e.instance,tt.env.emscripten_notify_memory_growth(0)}decode(e,t=0){if(!Ze)throw new Error("ZSTDDecoder: Await .init() before decoding.");const r=e.byteLength,s=Ze.exports.malloc(r);et.set(e,s),t=t||Number(Ze.exports.ZSTD_findDecompressedSize(s,r));const o=Ze.exports.malloc(t),l=Ze.exports.ZSTD_decompress(o,t,s,r),c=et.slice(o,o+l);return Ze.exports.free(s),Ze.exports.free(o),c}}const nt="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IAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQh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ASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohBAwCCyABIARqLwAAIQIgBEECaiEEDAELIAEgBGooAAAhAiAEQQRqIQQLIAVBAXEhBQJ+AkACQAJAIANBf2oiA0ECTQRAIANBAWsOAgIDAQtCfyAGRQ0DGiABIARqMQAADAMLIAEgBGovAACtQoACfAwCCyABIARqKAAArQwBCyABIARqKQAACyEHIAAgBTYCICAAIAI2AhwgACAHNwMAQQAhAyAAQQA2AhQgACAHIAggBhsiBzcDCCAAIAdCgIAIIAdCgIAIVBs+AhALIAMLWwEBf0G4fyEDIAIQFiICIAFNBH8gACACakF/ai0AACIAQQNxQQJ0QaAeaigCACACaiAAQQZ2IgFBAnRBsB5qKAIAaiAAQSBxIgBFaiABRSAAQQV2cWoFQbh/CwsdACAAKAKQ4gEQWiAAQQA2AqDiASAAQgA3A5DiAQu1AwEFfyMAQZACayIKJABBuH8hBgJAIAVFDQAgBCwAACIIQf8BcSEHAkAgCEF/TARAIAdBgn9qQQF2IgggBU8NAkFsIQYgB0GBf2oiBUGAAk8NAiAEQQFqIQdBACEGA0AgBiAFTwRAIAUhBiAIIQcMAwUgACAGaiAHIAZBAXZqIgQtAABBBHY6AAAgACAGQQFyaiAELQAAQQ9xOgAAIAZBAmohBgwBCwAACwALIAcgBU8NASAAIARBAWogByAKEFMiBhADDQELIAYhBEEAIQYgAUEAQTQQECEJQQAhBQNAIAQgBkcEQCAAIAZqIggtAAAiAUELSwRAQWwhBgwDBSAJIAFBAnRqIgEgASgCAEEBajYCACAGQQFqIQZBASAILQAAdEEBdSAFaiEFDAILAAsLQWwhBiAFRQ0AIAUQFEEBaiIBQQxLDQAgAyABNgIAQQFBASABdCAFayIDEBQiAXQgA0cNACAAIARqIAFBAWoiADoAACAJIABBAnRqIgAgACgCAEEBajYCACAJKAIEIgBBAkkgAEEBcXINACACIARBAWo2AgAgB0EBaiEGCyAKQZACaiQAIAYLxhEBDH8jAEHwAGsiBSQAQWwhCwJAIANBCkkNACACLwAAIQogAi8AAiEJIAIvAAQhByAFQQhqIAQQDgJAIAMgByAJIApqakEGaiIMSQ0AIAUtAAohCCAFQdgAaiACQQZqIgIgChAGIgsQAw0BIAVBQGsgAiAKaiICIAkQBiILEAMNASAFQShqIAIgCWoiAiAHEAYiCxADDQEgBUEQaiACIAdqIAMgDGsQBiILEAMNASAAIAFqIg9BfWohECAEQQRqIQZBASELIAAgAUEDakECdiIDaiIMIANqIgIgA2oiDiEDIAIhBCAMIQcDQCALIAMgEElxBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgCS0AAyELIAcgBiAFQUBrIAgQAkECdGoiCS8BADsAACAFQUBrIAktAAIQASAJLQADIQogBCAGIAVBKGogCBACQQJ0aiIJLwEAOwAAIAVBKGogCS0AAhABIAktAAMhCSADIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgDS0AAyENIAAgC2oiCyAGIAVB2ABqIAgQAkECdGoiAC8BADsAACAFQdgAaiAALQACEAEgAC0AAyEAIAcgCmoiCiAGIAVBQGsgCBACQQJ0aiIHLwEAOwAAIAVBQGsgBy0AAhABIActAAMhByAEIAlqIgkgBiAFQShqIAgQAkECdGoiBC8BADsAACAFQShqIAQtAAIQASAELQADIQQgAyANaiIDIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgACALaiEAIAcgCmohByAEIAlqIQQgAyANLQADaiEDIAVB2ABqEA0gBUFAaxANciAFQShqEA1yIAVBEGoQDXJFIQsMAQsLIAQgDksgByACS3INAEFsIQsgACAMSw0BIAxBfWohCQNAQQAgACAJSSAFQdgAahAEGwRAIAAgBiAFQdgAaiAIEAJBAnRqIgovAQA7AAAgBUHYAGogCi0AAhABIAAgCi0AA2oiACAGIAVB2ABqIAgQAkECdGoiCi8BADsAACAFQdgAaiAKLQACEAEgACAKLQADaiEADAEFIAxBfmohCgNAIAVB2ABqEAQgACAKS3JFBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgACAJLQADaiEADAELCwNAIAAgCk0EQCAAIAYgBUHYAGogCBACQQJ0aiIJLwEAOwAAIAVB2ABqIAktAAIQASAAIAktAANqIQAMAQsLAkAgACAMTw0AIAAgBiAFQdgAaiAIEAIiAEECdGoiDC0AADoAACAMLQADQQFGBEAgBUHYAGogDC0AAhABDAELIAUoAlxBH0sNACAFQdgAaiAGIABBAnRqLQACEAEgBSgCXEEhSQ0AIAVBIDYCXAsgAkF9aiEMA0BBACAHIAxJIAVBQGsQBBsEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiIAIAYgBUFAayAIEAJBAnRqIgcvAQA7AAAgBUFAayAHLQACEAEgACAHLQADaiEHDAEFIAJBfmohDANAIAVBQGsQBCAHIAxLckUEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwNAIAcgDE0EQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwJAIAcgAk8NACAHIAYgBUFAayAIEAIiAEECdGoiAi0AADoAACACLQADQQFGBEAgBUFAayACLQACEAEMAQsgBSgCREEfSw0AIAVBQGsgBiAAQQJ0ai0AAhABIAUoAkRBIUkNACAFQSA2AkQLIA5BfWohAgNAQQAgBCACSSAFQShqEAQbBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2oiACAGIAVBKGogCBACQQJ0aiIELwEAOwAAIAVBKGogBC0AAhABIAAgBC0AA2ohBAwBBSAOQX5qIQIDQCAFQShqEAQgBCACS3JFBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsDQCAEIAJNBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsCQCAEIA5PDQAgBCAGIAVBKGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBKGogAi0AAhABDAELIAUoAixBH0sNACAFQShqIAYgAEECdGotAAIQASAFKAIsQSFJDQAgBUEgNgIsCwNAQQAgAyAQSSAFQRBqEAQbBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2oiACAGIAVBEGogCBACQQJ0aiICLwEAOwAAIAVBEGogAi0AAhABIAAgAi0AA2ohAwwBBSAPQX5qIQIDQCAFQRBqEAQgAyACS3JFBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsDQCADIAJNBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsCQCADIA9PDQAgAyAGIAVBEGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBEGogAi0AAhABDAELIAUoAhRBH0sNACAFQRBqIAYgAEECdGotAAIQASAFKAIUQSFJDQAgBUEgNgIUCyABQWwgBUHYAGoQCiAFQUBrEApxIAVBKGoQCnEgBUEQahAKcRshCwwJCwAACwALAAALAAsAAAsACwAACwALQWwhCwsgBUHwAGokACALC7UEAQ5/IwBBEGsiBiQAIAZBBGogABAOQVQhBQJAIARB3AtJDQAgBi0ABCEHIANB8ARqQQBB7AAQECEIIAdBDEsNACADQdwJaiIJIAggBkEIaiAGQQxqIAEgAhAxIhAQA0UEQCAGKAIMIgQgB0sNASADQdwFaiEPIANBpAVqIREgAEEEaiESIANBqAVqIQEgBCEFA0AgBSICQX9qIQUgCCACQQJ0aigCAEUNAAsgAkEBaiEOQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgASALaiAKNgIAIAVBAWohBSAKIAxqIQoMAQsLIAEgCjYCAEEAIQUgBigCCCELA0AgBSALRkUEQCABIAUgCWotAAAiDEECdGoiDSANKAIAIg1BAWo2AgAgDyANQQF0aiINIAw6AAEgDSAFOgAAIAVBAWohBQwBCwtBACEBIANBADYCqAUgBEF/cyAHaiEJQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgAyALaiABNgIAIAwgBSAJanQgAWohASAFQQFqIQUMAQsLIAcgBEEBaiIBIAJrIgRrQQFqIQgDQEEBIQUgBCAIT0UEQANAIAUgDk9FBEAgBUECdCIJIAMgBEE0bGpqIAMgCWooAgAgBHY2AgAgBUEBaiEFDAELCyAEQQFqIQQMAQsLIBIgByAPIAogESADIAIgARBkIAZBAToABSAGIAc6AAYgACAGKAIENgIACyAQIQULIAZBEGokACAFC8ENAQt/IwBB8ABrIgUkAEFsIQkCQCADQQpJDQAgAi8AACEKIAIvAAIhDCACLwAEIQYgBUEIaiAEEA4CQCADIAYgCiAMampBBmoiDUkNACAFLQAKIQcgBUHYAGogAkEGaiICIAoQBiIJEAMNASAFQUBrIAIgCmoiAiAMEAYiCRADDQEgBUEoaiACIAxqIgIgBhAGIgkQAw0BIAVBEGogAiAGaiADIA1rEAYiCRADDQEgACABaiIOQX1qIQ8gBEEEaiEGQQEhCSAAIAFBA2pBAnYiAmoiCiACaiIMIAJqIg0hAyAMIQQgCiECA0AgCSADIA9JcQRAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAACAGIAVBQGsgBxACQQF0aiIILQAAIQsgBUFAayAILQABEAEgAiALOgAAIAYgBUEoaiAHEAJBAXRqIggtAAAhCyAFQShqIAgtAAEQASAEIAs6AAAgBiAFQRBqIAcQAkEBdGoiCC0AACELIAVBEGogCC0AARABIAMgCzoAACAGIAVB2ABqIAcQAkEBdGoiCC0AACELIAVB2ABqIAgtAAEQASAAIAs6AAEgBiAFQUBrIAcQAkEBdGoiCC0AACELIAVBQGsgCC0AARABIAIgCzoAASAGIAVBKGogBxACQQF0aiIILQAAIQsgBUEoaiAILQABEAEgBCALOgABIAYgBUEQaiAHEAJBAXRqIggtAAAhCyAFQRBqIAgtAAEQASADIAs6AAEgA0ECaiEDIARBAmohBCACQQJqIQIgAEECaiEAIAkgBUHYAGoQDUVxIAVBQGsQDUVxIAVBKGoQDUVxIAVBEGoQDUVxIQkMAQsLIAQgDUsgAiAMS3INAEFsIQkgACAKSw0BIApBfWohCQNAIAVB2ABqEAQgACAJT3JFBEAgBiAFQdgAaiAHEAJBAXRqIggtAAAhCyAFQdgAaiAILQABEAEgACALOgAAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAASAAQQJqIQAMAQsLA0AgBUHYAGoQBCAAIApPckUEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCwNAIAAgCkkEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCyAMQX1qIQADQCAFQUBrEAQgAiAAT3JFBEAgBiAFQUBrIAcQAkEBdGoiCi0AACEJIAVBQGsgCi0AARABIAIgCToAACAGIAVBQGsgBxACQQF0aiIKLQAAIQkgBUFAayAKLQABEAEgAiAJOgABIAJBAmohAgwBCwsDQCAFQUBrEAQgAiAMT3JFBEAgBiAFQUBrIAcQAkEBdGoiAC0AACEKIAVBQGsgAC0AARABIAIgCjoAACACQQFqIQIMAQsLA0AgAiAMSQRAIAYgBUFAayAHEAJBAXRqIgAtAAAhCiAFQUBrIAAtAAEQASACIAo6AAAgAkEBaiECDAELCyANQX1qIQADQCAFQShqEAQgBCAAT3JFBEAgBiAFQShqIAcQAkEBdGoiAi0AACEKIAVBKGogAi0AARABIAQgCjoAACAGIAVBKGogBxACQQF0aiICLQAAIQogBUEoaiACLQABEAEgBCAKOgABIARBAmohBAwBCwsDQCAFQShqEAQgBCANT3JFBEAgBiAFQShqIAcQAkEBdGoiAC0AACECIAVBKGogAC0AARABIAQgAjoAACAEQQFqIQQMAQsLA0AgBCANSQRAIAYgBUEoaiAHEAJBAXRqIgAtAAAhAiAFQShqIAAtAAEQASAEIAI6AAAgBEEBaiEEDAELCwNAIAVBEGoQBCADIA9PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIAYgBUEQaiAHEAJBAXRqIgAtAAAhAiAFQRBqIAAtAAEQASADIAI6AAEgA0ECaiEDDAELCwNAIAVBEGoQBCADIA5PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIANBAWohAwwBCwsDQCADIA5JBEAgBiAFQRBqIAcQAkEBdGoiAC0AACECIAVBEGogAC0AARABIAMgAjoAACADQQFqIQMMAQsLIAFBbCAFQdgAahAKIAVBQGsQCnEgBUEoahAKcSAFQRBqEApxGyEJDAELQWwhCQsgBUHwAGokACAJC8oCAQR/IwBBIGsiBSQAIAUgBBAOIAUtAAIhByAFQQhqIAIgAxAGIgIQA0UEQCAEQQRqIQIgACABaiIDQX1qIQQDQCAFQQhqEAQgACAET3JFBEAgAiAFQQhqIAcQAkEBdGoiBi0AACEIIAVBCGogBi0AARABIAAgCDoAACACIAVBCGogBxACQQF0aiIGLQAAIQggBUEIaiAGLQABEAEgACAIOgABIABBAmohAAwBCwsDQCAFQQhqEAQgACADT3JFBEAgAiAFQQhqIAcQAkEBdGoiBC0AACEGIAVBCGogBC0AARABIAAgBjoAACAAQQFqIQAMAQsLA0AgACADT0UEQCACIAVBCGogBxACQQF0aiIELQAAIQYgBUEIaiAELQABEAEgACAGOgAAIABBAWohAAwBCwsgAUFsIAVBCGoQChshAgsgBUEgaiQAIAILtgMBCX8jAEEQayIGJAAgBkEANgIMIAZBADYCCEFUIQQCQAJAIANBQGsiDCADIAZBCGogBkEMaiABIAIQMSICEAMNACAGQQRqIAAQDiAGKAIMIgcgBi0ABEEBaksNASAAQQRqIQogBkEAOgAFIAYgBzoABiAAIAYoAgQ2AgAgB0EBaiEJQQEhBANAIAQgCUkEQCADIARBAnRqIgEoAgAhACABIAU2AgAgACAEQX9qdCAFaiEFIARBAWohBAwBCwsgB0EBaiEHQQAhBSAGKAIIIQkDQCAFIAlGDQEgAyAFIAxqLQAAIgRBAnRqIgBBASAEdEEBdSILIAAoAgAiAWoiADYCACAHIARrIQhBACEEAkAgC0EDTQRAA0AgBCALRg0CIAogASAEakEBdGoiACAIOgABIAAgBToAACAEQQFqIQQMAAALAAsDQCABIABPDQEgCiABQQF0aiIEIAg6AAEgBCAFOgAAIAQgCDoAAyAEIAU6AAIgBCAIOgAFIAQgBToABCAEIAg6AAcgBCAFOgAGIAFBBGohAQwAAAsACyAFQQFqIQUMAAALAAsgAiEECyAGQRBqJAAgBAutAQECfwJAQYQgKAIAIABHIAAoAgBBAXYiAyABa0F4aiICQXhxQQhHcgR/IAIFIAMQJ0UNASACQQhqC0EQSQ0AIAAgACgCACICQQFxIAAgAWpBD2pBeHEiASAAa0EBdHI2AgAgASAANgIEIAEgASgCAEEBcSAAIAJBAXZqIAFrIgJBAXRyNgIAQYQgIAEgAkH/////B3FqQQRqQYQgKAIAIABGGyABNgIAIAEQJQsLygIBBX8CQAJAAkAgAEEIIABBCEsbZ0EfcyAAaUEBR2oiAUEESSAAIAF2cg0AIAFBAnRB/B5qKAIAIgJFDQADQCACQXhqIgMoAgBBAXZBeGoiBSAATwRAIAIgBUEIIAVBCEsbZ0Efc0ECdEGAH2oiASgCAEYEQCABIAIoAgQ2AgALDAMLIARBHksNASAEQQFqIQQgAigCBCICDQALC0EAIQMgAUEgTw0BA0AgAUECdEGAH2ooAgAiAkUEQCABQR5LIQIgAUEBaiEBIAJFDQEMAwsLIAIgAkF4aiIDKAIAQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgBGBEAgASACKAIENgIACwsgAigCACIBBEAgASACKAIENgIECyACKAIEIgEEQCABIAIoAgA2AgALIAMgAygCAEEBcjYCACADIAAQNwsgAwvhCwINfwV+IwBB8ABrIgckACAHIAAoAvDhASIINgJcIAEgAmohDSAIIAAoAoDiAWohDwJAAkAgBUUEQCABIQQMAQsgACgCxOABIRAgACgCwOABIREgACgCvOABIQ4gAEEBNgKM4QFBACEIA0AgCEEDRwRAIAcgCEECdCICaiAAIAJqQazQAWooAgA2AkQgCEEBaiEIDAELC0FsIQwgB0EYaiADIAQQBhADDQEgB0EsaiAHQRhqIAAoAgAQEyAHQTRqIAdBGGogACgCCBATIAdBPGogB0EYaiAAKAIEEBMgDUFgaiESIAEhBEEAIQwDQCAHKAIwIAcoAixBA3RqKQIAIhRCEIinQf8BcSEIIAcoAkAgBygCPEEDdGopAgAiFUIQiKdB/wFxIQsgBygCOCAHKAI0QQN0aikCACIWQiCIpyEJIBVCIIghFyAUQiCIpyECAkAgFkIQiKdB/wFxIgNBAk8EQAJAIAZFIANBGUlyRQRAIAkgB0EYaiADQSAgBygCHGsiCiAKIANLGyIKEAUgAyAKayIDdGohCSAHQRhqEAQaIANFDQEgB0EYaiADEAUgCWohCQwBCyAHQRhqIAMQBSAJaiEJIAdBGGoQBBoLIAcpAkQhGCAHIAk2AkQgByAYNwNIDAELAkAgA0UEQCACBEAgBygCRCEJDAMLIAcoAkghCQwBCwJAAkAgB0EYakEBEAUgCSACRWpqIgNBA0YEQCAHKAJEQX9qIgMgA0VqIQkMAQsgA0ECdCAHaigCRCIJIAlFaiEJIANBAUYNAQsgByAHKAJINgJMCwsgByAHKAJENgJIIAcgCTYCRAsgF6chAyALBEAgB0EYaiALEAUgA2ohAwsgCCALakEUTwRAIAdBGGoQBBoLIAgEQCAHQRhqIAgQBSACaiECCyAHQRhqEAQaIAcgB0EYaiAUQhiIp0H/AXEQCCAUp0H//wNxajYCLCAHIAdBGGogFUIYiKdB/wFxEAggFadB//8DcWo2AjwgB0EYahAEGiAHIAdBGGogFkIYiKdB/wFxEAggFqdB//8DcWo2AjQgByACNgJgIAcoAlwhCiAHIAk2AmggByADNgJkAkACQAJAIAQgAiADaiILaiASSw0AIAIgCmoiEyAPSw0AIA0gBGsgC0Egak8NAQsgByAHKQNoNwMQIAcgBykDYDcDCCAEIA0gB0EIaiAHQdwAaiAPIA4gESAQEB4hCwwBCyACIARqIQggBCAKEAcgAkERTwRAIARBEGohAgNAIAIgCkEQaiIKEAcgAkEQaiICIAhJDQALCyAIIAlrIQIgByATNgJcIAkgCCAOa0sEQCAJIAggEWtLBEBBbCELDAILIBAgAiAOayICaiIKIANqIBBNBEAgCCAKIAMQDxoMAgsgCCAKQQAgAmsQDyEIIAcgAiADaiIDNgJkIAggAmshCCAOIQILIAlBEE8EQCADIAhqIQMDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALDAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdB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IAdB0AFqJAAgEAslACAAQgA3AgAgAEEAOwEIIABBADoACyAAIAE2AgwgACACOgAKC7QFAQN/IwBBMGsiBCQAIABB/wFqIgVBfWohBgJAIAMvAQIEQCAEQRhqIAEgAhAGIgIQAw0BIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahASOgAAIAMgBEEIaiAEQRhqEBI6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0FIAEgBEEQaiAEQRhqEBI6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWsiAyQAQWIhCAJAIAJBCUkNACAAQZjQAGogAUEIaiIEIAJBeGogAEGY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wOABCwutAgIEfwF+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",it="display-p3";o.j17,o.l6D,o.l6D;var rt=r(5108);const at=new WeakMap;let st,ot=0;class KTX2Loader extends o.aNw{constructor(e){super(e),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new WorkerPool,this.workerSourceURL="",this.workerConfig=null,"undefined"!=typeof MSC_TRANSCODER&&rt.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.')}setTranscoderPath(e){return this.transcoderPath=e,this}setWorkerLimit(e){return this.workerPool.setWorkerLimit(e),this}async detectSupportAsync(e){return this.workerConfig={astcSupported:await e.hasFeatureAsync("texture-compression-astc"),astcHDRSupported:!1,etc1Supported:await e.hasFeatureAsync("texture-compression-etc1"),etc2Supported:await e.hasFeatureAsync("texture-compression-etc2"),dxtSupported:await e.hasFeatureAsync("texture-compression-bc"),bptcSupported:await e.hasFeatureAsync("texture-compression-bptc"),pvrtcSupported:await e.hasFeatureAsync("texture-compression-pvrtc")},this}detectSupport(e){return!0===e.isWebGPURenderer?this.workerConfig={astcSupported:e.hasFeature("texture-compression-astc"),astcHDRSupported:!1,etc1Supported:e.hasFeature("texture-compression-etc1"),etc2Supported:e.hasFeature("texture-compression-etc2"),dxtSupported:e.hasFeature("texture-compression-bc"),bptcSupported:e.hasFeature("texture-compression-bptc"),pvrtcSupported:e.hasFeature("texture-compression-pvrtc")}:this.workerConfig={astcSupported:e.extensions.has("WEBGL_compressed_texture_astc"),astcHDRSupported:e.extensions.has("WEBGL_compressed_texture_astc")&&e.extensions.get("WEBGL_compressed_texture_astc").getSupportedProfiles().includes("hdr"),etc1Supported:e.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:e.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:e.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:e.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:e.extensions.has("WEBGL_compressed_texture_pvrtc")||e.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},this}init(){if(!this.transcoderPending){const e=new o.hH6(this.manager);e.setPath(this.transcoderPath),e.setWithCredentials(this.withCredentials);const t=e.loadAsync("basis_transcoder.js"),r=new o.hH6(this.manager);r.setPath(this.transcoderPath),r.setResponseType("arraybuffer"),r.setWithCredentials(this.withCredentials);const s=r.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([t,s]).then((([e,t])=>{const r=KTX2Loader.BasisWorker.toString(),s=["/* constants */","let _EngineFormat = "+JSON.stringify(KTX2Loader.EngineFormat),"let _EngineType = "+JSON.stringify(KTX2Loader.EngineType),"let _TranscoderFormat = "+JSON.stringify(KTX2Loader.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(KTX2Loader.BasisFormat),"/* basis_transcoder.js */",e,"/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([s])),this.transcoderBinary=t,this.workerPool.setWorkerCreator((()=>{const e=new Worker(this.workerSourceURL),t=this.transcoderBinary.slice(0);return e.postMessage({type:"init",config:this.workerConfig,transcoderBinary:t},[t]),e}))})),ot>0&&rt.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),ot++}return this.transcoderPending}load(e,t,r,s){if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");const l=new o.hH6(this.manager);l.setResponseType("arraybuffer"),l.setWithCredentials(this.withCredentials),l.load(e,(e=>{this.parse(e,t,s)}),r,s)}parse(e,t,r){if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");if(at.has(e)){return at.get(e).promise.then(t).catch(r)}this._createTexture(e).then((e=>t?t(e):null)).catch(r)}_createTextureFrom(e,t){const{type:r,error:s,data:{faces:l,width:c,height:A,format:d,type:h,dfdFlags:p}}=e;if("error"===r)return Promise.reject(s);let g;if(6===t.faceCount)g=new o.qVC(l,d,h);else{const e=l[0].mipmaps;g=t.layerCount>1?new o.Z_g(e,c,A,t.layerCount,d,h):new o.EB7(e,c,A,d,h)}return g.minFilter=1===l[0].mipmaps.length?o.wem:o.D1R,g.magFilter=o.wem,g.generateMipmaps=!1,g.needsUpdate=!0,g.colorSpace=parseColorSpace(t),g.premultiplyAlpha=!!(1&p),g}async _createTexture(e,t={}){const r=function Pi(e){const t=new Uint8Array(e.buffer,e.byteOffset,Ye.length);if(t[0]!==Ye[0]||t[1]!==Ye[1]||t[2]!==Ye[2]||t[3]!==Ye[3]||t[4]!==Ye[4]||t[5]!==Ye[5]||t[6]!==Ye[6]||t[7]!==Ye[7]||t[8]!==Ye[8]||t[9]!==Ye[9]||t[10]!==Ye[10]||t[11]!==Ye[11])throw new Error("Missing KTX 2.0 identifier.");const r=new Ii,s=17*Uint32Array.BYTES_PER_ELEMENT,o=new Si(e,Ye.length,s,!0);r.vkFormat=o._nextUint32(),r.typeSize=o._nextUint32(),r.pixelWidth=o._nextUint32(),r.pixelHeight=o._nextUint32(),r.pixelDepth=o._nextUint32(),r.layerCount=o._nextUint32(),r.faceCount=o._nextUint32();const l=o._nextUint32();r.supercompressionScheme=o._nextUint32();const c=o._nextUint32(),A=o._nextUint32(),d=o._nextUint32(),h=o._nextUint32(),p=o._nextUint64(),g=o._nextUint64(),m=new Si(e,Ye.length+s,3*l*8,!0);for(let t=0;t<l;t++)r.levels.push({levelData:new Uint8Array(e.buffer,e.byteOffset+m._nextUint64(),m._nextUint64()),uncompressedByteLength:m._nextUint64()});const f=new Si(e,c,A,!0),E={vendorId:f._skip(4)._nextUint16(),descriptorType:f._nextUint16(),versionNumber:f._nextUint16(),descriptorBlockSize:f._nextUint16(),colorModel:f._nextUint8(),colorPrimaries:f._nextUint8(),transferFunction:f._nextUint8(),flags:f._nextUint8(),texelBlockDimension:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],bytesPlane:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],samples:[]},_=(E.descriptorBlockSize/4-6)/4;for(let e=0;e<_;e++){const t={bitOffset:f._nextUint16(),bitLength:f._nextUint8(),channelType:f._nextUint8(),samplePosition:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};64&t.channelType?(t.sampleLower=f._nextInt32(),t.sampleUpper=f._nextInt32()):(t.sampleLower=f._nextUint32(),t.sampleUpper=f._nextUint32()),E.samples[e]=t}r.dataFormatDescriptor.length=0,r.dataFormatDescriptor.push(E);const C=new Si(e,d,h,!0);for(;C._offset<h;){const e=C._nextUint32(),t=C._scan(e),s=Ti(t);if(r.keyValue[s]=C._nextUint8Array(e-t.byteLength-1),s.match(/^ktx/i)){const e=Ti(r.keyValue[s]);r.keyValue[s]=e.substring(0,e.lastIndexOf("\0"))}C._skip(e%4?4-e%4:0)}if(g<=0)return r;const I=new Si(e,p,g,!0),S=I._nextUint16(),x=I._nextUint16(),T=I._nextUint32(),y=I._nextUint32(),b=I._nextUint32(),B=I._nextUint32(),U=[];for(let e=0;e<l;e++)U.push({imageFlags:I._nextUint32(),rgbSliceByteOffset:I._nextUint32(),rgbSliceByteLength:I._nextUint32(),alphaSliceByteOffset:I._nextUint32(),alphaSliceByteLength:I._nextUint32()});const F=p+I._offset,Q=F+T,O=Q+y,G=O+b,W=new Uint8Array(e.buffer,e.byteOffset+F,T),q=new Uint8Array(e.buffer,e.byteOffset+Q,y),X=new Uint8Array(e.buffer,e.byteOffset+O,b),K=new Uint8Array(e.buffer,e.byteOffset+G,B);return r.globalData={endpointCount:S,selectorCount:x,imageDescs:U,endpointsData:W,selectorsData:q,tablesData:X,extendedData:K},r}(new Uint8Array(e)),s=r.vkFormat===je&&167===r.dataFormatDescriptor[0].colorModel;if(!(0===r.vkFormat||s&&!this.workerConfig.astcHDRSupported))return async function createRawTexture(e){const{vkFormat:t}=e;if(void 0===ct[t])throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");let r;2===e.supercompressionScheme&&(st||(st=new Promise((async e=>{const t=new zstddec_module_Q;await t.init(),e(t)}))),r=await st);const s=[];for(let l=0;l<e.levels.length;l++){const c=Math.max(1,e.pixelWidth>>l),A=Math.max(1,e.pixelHeight>>l),d=e.pixelDepth?Math.max(1,e.pixelDepth>>l):0,h=e.levels[l];let p,g;if(0===e.supercompressionScheme)p=h.levelData;else{if(2!==e.supercompressionScheme)throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");p=r.decode(h.levelData,h.uncompressedByteLength)}g=At[t]===o.VzW?new Float32Array(p.buffer,p.byteOffset,p.byteLength/Float32Array.BYTES_PER_ELEMENT):At[t]===o.cLu?new Uint16Array(p.buffer,p.byteOffset,p.byteLength/Uint16Array.BYTES_PER_ELEMENT):p,s.push({data:g,width:c,height:A,depth:d})}let l;if(lt.has(ct[t]))l=0===e.pixelDepth?new o.IEO(s[0].data,e.pixelWidth,e.pixelHeight):new o.JUT(s[0].data,e.pixelWidth,e.pixelHeight,e.pixelDepth);else{if(e.pixelDepth>0)throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");l=new o.EB7(s,e.pixelWidth,e.pixelHeight),l.minFilter=1===s.length?o.wem:o.D1R,l.magFilter=o.wem}return l.mipmaps=s,l.type=At[t],l.format=ct[t],l.colorSpace=parseColorSpace(e),l.needsUpdate=!0,Promise.resolve(l)}(r);const l=t,c=this.init().then((()=>this.workerPool.postMessage({type:"transcode",buffer:e,taskConfig:l},[e]))).then((e=>this._createTextureFrom(e.data,r)));return at.set(e,{promise:c}),c}dispose(){this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),ot--}}KTX2Loader.BasisFormat={ETC1S:0,UASTC:1,UASTC_HDR:2},KTX2Loader.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},KTX2Loader.EngineFormat={RGBAFormat:o.wk1,RGBA_ASTC_4x4_Format:o.ptH,RGB_BPTC_UNSIGNED_Format:o.QO2,RGBA_BPTC_Format:o.bsb,RGBA_ETC2_EAC_Format:o.ekQ,RGBA_PVRTC_4BPPV1_Format:o.eaV,RGBA_S3TC_DXT5_Format:o.ILR,RGB_ETC1_Format:o.fto,RGB_ETC2_Format:o.l0P,RGB_PVRTC_4BPPV1_Format:o._AM,RGBA_S3TC_DXT1_Format:o.BFQ},KTX2Loader.EngineType={UnsignedByteType:o.ywz,HalfFloatType:o.cLu,FloatType:o.VzW},KTX2Loader.BasisWorker=function(){let e,t,r;const s=_EngineFormat,o=_EngineType,l=_TranscoderFormat,c=_BasisFormat;self.addEventListener("message",(function(s){const l=s.data;switch(l.type){case"init":e=l.config,function init(e){t=new Promise((t=>{r={wasmBinary:e,onRuntimeInitialized:t},BASIS(r)})).then((()=>{r.initializeBasis(),void 0===r.KTX2File&&rt.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")}))}(l.transcoderBinary);break;case"transcode":t.then((()=>{try{const{faces:t,buffers:s,width:A,height:h,hasAlpha:p,format:g,type:m,dfdFlags:f}=function transcode(t){const s=new r.KTX2File(new Uint8Array(t));function cleanup(){s.close(),s.delete()}if(!s.isValid())throw cleanup(),new Error("THREE.KTX2Loader:\tInvalid or unsupported .ktx2 file");let l;if(s.isUASTC())l=c.UASTC;else if(s.isETC1S())l=c.ETC1S;else{if(!s.isHDR())throw new Error("THREE.KTX2Loader: Unknown Basis encoding");l=c.UASTC_HDR}const A=s.getWidth(),h=s.getHeight(),p=s.getLayers()||1,g=s.getLevels(),m=s.getFaces(),f=s.getHasAlpha(),E=s.getDFDFlags(),{transcoderFormat:_,engineFormat:C,engineType:I}=function getTranscoderFormat(t,r,s,o){const l=d[t];for(let c=0;c<l.length;c++){const A=l[c];if(A.if&&!e[A.if])continue;if(!A.basisFormat.includes(t))continue;if(o&&A.transcoderFormat.length<2)continue;if(A.needsPowerOfTwo&&(!isPowerOfTwo(r)||!isPowerOfTwo(s)))continue;return{transcoderFormat:A.transcoderFormat[o?1:0],engineFormat:A.engineFormat[o?1:0],engineType:A.engineType[0]}}throw new Error("THREE.KTX2Loader: Failed to identify transcoding target.")}(l,A,h,f);if(!A||!h||!g)throw cleanup(),new Error("THREE.KTX2Loader:\tInvalid texture");if(!s.startTranscoding())throw cleanup(),new Error("THREE.KTX2Loader: .startTranscoding failed");const S=[],x=[];for(let e=0;e<m;e++){const t=[];for(let r=0;r<g;r++){const l=[];let c,A;for(let t=0;t<p;t++){const d=s.getImageLevelInfo(r,t,e);0!==e||0!==r||0!==t||d.origWidth%4==0&&d.origHeight%4==0||rt.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."),g>1?(c=d.origWidth,A=d.origHeight):(c=d.width,A=d.height);let h=new Uint8Array(s.getImageTranscodedSizeInBytes(r,t,0,_));const p=s.transcodeImage(h,r,t,e,_,0,-1,-1);if(I===o.HalfFloatType&&(h=new Uint16Array(h.buffer,h.byteOffset,h.byteLength/Uint16Array.BYTES_PER_ELEMENT)),!p)throw cleanup(),new Error("THREE.KTX2Loader: .transcodeImage failed.");l.push(h)}const d=concat(l);t.push({data:d,width:c,height:A}),x.push(d.buffer)}S.push({mipmaps:t,width:A,height:h,format:C,type:I})}return cleanup(),{faces:S,buffers:x,width:A,height:h,hasAlpha:f,dfdFlags:E,format:C,type:I}}(l.buffer);self.postMessage({type:"transcode",id:l.id,data:{faces:t,width:A,height:h,hasAlpha:p,format:g,type:m,dfdFlags:f}},s)}catch(e){rt.error(e),self.postMessage({type:"error",id:l.id,error:e.message})}}))}}));const A=[{if:"astcSupported",basisFormat:[c.UASTC],transcoderFormat:[l.ASTC_4x4,l.ASTC_4x4],engineFormat:[s.RGBA_ASTC_4x4_Format,s.RGBA_ASTC_4x4_Format],engineType:[o.UnsignedByteType],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[c.ETC1S,c.UASTC],transcoderFormat:[l.BC7_M5,l.BC7_M5],engineFormat:[s.RGBA_BPTC_Format,s.RGBA_BPTC_Format],engineType:[o.UnsignedByteType],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[c.ETC1S,c.UASTC],transcoderFormat:[l.BC1,l.BC3],engineFormat:[s.RGBA_S3TC_DXT1_Format,s.RGBA_S3TC_DXT5_Format],engineType:[o.UnsignedByteType],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[c.ETC1S,c.UASTC],transcoderFormat:[l.ETC1,l.ETC2],engineFormat:[s.RGB_ETC2_Format,s.RGBA_ETC2_EAC_Format],engineType:[o.UnsignedByteType],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[c.ETC1S,c.UASTC],transcoderFormat:[l.ETC1],engineFormat:[s.RGB_ETC1_Format],engineType:[o.UnsignedByteType],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[c.ETC1S,c.UASTC],transcoderFormat:[l.PVRTC1_4_RGB,l.PVRTC1_4_RGBA],engineFormat:[s.RGB_PVRTC_4BPPV1_Format,s.RGBA_PVRTC_4BPPV1_Format],engineType:[o.UnsignedByteType],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0},{if:"bptcSupported",basisFormat:[c.UASTC_HDR],transcoderFormat:[l.BC6H],engineFormat:[s.RGB_BPTC_UNSIGNED_Format],engineType:[o.HalfFloatType],priorityHDR:1,needsPowerOfTwo:!1},{basisFormat:[c.ETC1S,c.UASTC],transcoderFormat:[l.RGBA32,l.RGBA32],engineFormat:[s.RGBAFormat,s.RGBAFormat],engineType:[o.UnsignedByteType,o.UnsignedByteType],priorityETC1S:100,priorityUASTC:100,needsPowerOfTwo:!1},{basisFormat:[c.UASTC_HDR],transcoderFormat:[l.RGBA_HALF],engineFormat:[s.RGBAFormat],engineType:[o.HalfFloatType],priorityHDR:100,needsPowerOfTwo:!1}],d={[c.ETC1S]:A.filter((e=>e.basisFormat.includes(c.ETC1S))).sort(((e,t)=>e.priorityUASTC-t.priorityUASTC)),[c.UASTC]:A.filter((e=>e.basisFormat.includes(c.UASTC))).sort(((e,t)=>e.priorityUASTC-t.priorityUASTC)),[c.UASTC_HDR]:A.filter((e=>e.basisFormat.includes(c.UASTC_HDR))).sort(((e,t)=>e.priorityHDR-t.priorityHDR))};function isPowerOfTwo(e){return e<=2||0==(e&e-1)&&0!==e}function concat(e){if(1===e.length)return e[0];let t=0;for(let r=0;r<e.length;r++){t+=e[r].byteLength}const r=new Uint8Array(t);let s=0;for(let t=0;t<e.length;t++){const o=e[t];r.set(o,s),s+=o.byteLength}return r}};const lt=new Set([o.wk1,o.av9,o.hEm]),ct={109:o.wk1,97:o.wk1,37:o.wk1,43:o.wk1,103:o.av9,83:o.av9,16:o.av9,22:o.av9,100:o.hEm,76:o.hEm,15:o.hEm,9:o.hEm,[je]:o.ptH,166:o.Djp,165:o.Djp},At={109:o.VzW,97:o.cLu,37:o.ywz,43:o.ywz,103:o.VzW,83:o.cLu,16:o.ywz,22:o.ywz,100:o.VzW,76:o.cLu,15:o.ywz,9:o.ywz,[je]:o.cLu,166:o.ywz,165:o.ywz};function parseColorSpace(e){const t=e.dataFormatDescriptor[0];return 1===t.colorPrimaries?2===t.transferFunction?o.KI_:o.GUF:10===t.colorPrimaries?2===t.transferFunction?it:"display-p3-linear":(0===t.colorPrimaries||rt.warn(`THREE.KTX2Loader: Unsupported color primaries, "${t.colorPrimaries}"`),o.aCh)}var dt,ut;const ht=Symbol("retainerCount"),pt=Symbol("recentlyUsed"),gt=Symbol("evict"),mt=Symbol("evictionThreshold"),ft=Symbol("cache");class CacheEvictionPolicy{constructor(e,t=5){this[dt]=new Map,this[ut]=[],this[ft]=e,this[mt]=t}set evictionThreshold(e){this[mt]=e,this[gt]()}get evictionThreshold(){return this[mt]}get cache(){return this[ft]}retainerCount(e){return this[ht].get(e)||0}reset(){this[ht].clear(),this[pt]=[]}retain(e){this[ht].has(e)||this[ht].set(e,0),this[ht].set(e,this[ht].get(e)+1);const t=this[pt].indexOf(e);-1!==t&&this[pt].splice(t,1),this[pt].unshift(e),this[gt]()}release(e){this[ht].has(e)&&this[ht].set(e,Math.max(this[ht].get(e)-1,0)),this[gt]()}[(dt=ht,ut=pt,gt)](){if(!(this[pt].length<this[mt]))for(let e=this[pt].length-1;e>=this[mt];--e){const t=this[pt][e];0===this[ht].get(t)&&(this[ft].delete(t),this[pt].splice(e,1))}}}const mappingsArrayToTable=e=>{const t=new Map;for(const r of e.mappings)for(const e of r.variants)t.set(e,{material:null,gltfMaterialIndex:r.material});return t};class GLTFMaterialsVariantsExtension{constructor(e){this.parser=e,this.name="KHR_materials_variants"}afterRoot(e){const t=this.parser,r=t.json;if(void 0===r.extensions||void 0===r.extensions[this.name])return null;const s=(e=>{const t=[],r=new Set;for(const s of e){let e=s,o=0;for(;r.has(e);)e=s+"."+ ++o;r.add(e),t.push(e)}return t})((r.extensions[this.name].variants||[]).map((e=>e.name)));for(const s of e.scenes)s.traverse((e=>{const s=e;if(!s.material)return;const o=t.associations.get(s);if(null==o||null==o.meshes||null==o.primitives)return;const l=r.meshes[o.meshes].primitives[o.primitives].extensions;l&&l[this.name]&&(s.userData.variantMaterials=mappingsArrayToTable(l[this.name]))}));return e.userData.variants=s,Promise.resolve()}}var Et,vt,_t=r(5108);o.xEZ.DEFAULT_ANISOTROPY=4;const Ct=new Map,It=new Map;let St;const xt=new DRACOLoader;let Tt;const yt=new KTX2Loader;let Mt,wt;const bt=Symbol("loader"),Bt=Symbol("evictionPolicy"),Rt=Symbol("GLTFInstance");class CachingGLTFLoader extends o.pBf{constructor(e){super(),this[vt]=(new GLTFLoader).register((e=>new GLTFMaterialsVariantsExtension(e))),this[Rt]=e,this[bt].setDRACOLoader(xt),this[bt].setKTX2Loader(yt)}static setDRACODecoderLocation(e){St=e,xt.setDecoderPath(e)}static getDRACODecoderLocation(){return St}static setKTX2TranscoderLocation(e){Tt=e,yt.setTranscoderPath(e)}static getKTX2TranscoderLocation(){return Tt}static setMeshoptDecoderLocation(e){var t;Mt!==e&&(Mt=e,wt=(t=e,new Promise(((e,r)=>{const s=document.createElement("script");document.body.appendChild(s),s.onload=e,s.onerror=r,s.async=!0,s.src=t}))).then((()=>MeshoptDecoder.ready)).then((()=>MeshoptDecoder)))}static getMeshoptDecoderLocation(){return Mt}static initializeKTX2Loader(e){yt.detectSupport(e)}static get cache(){return Ct}static clearCache(){Ct.forEach(((e,t)=>{this.delete(t)})),this[Bt].reset()}static has(e){return Ct.has(e)}static async delete(e){if(!this.has(e))return;const t=Ct.get(e);It.delete(e),Ct.delete(e);(await t).dispose()}static hasFinishedLoading(e){return!!It.get(e)}get[(Et=Bt,vt=bt,Bt)](){return this.constructor[Bt]}async preload(e,t,r=(()=>{})){if(this[bt].setWithCredentials(CachingGLTFLoader.withCredentials),this.dispatchEvent({type:"preload",element:t,src:e}),!Ct.has(e)){null!=wt&&this[bt].setMeshoptDecoder(await wt);const t=((e,t,r=(()=>{}))=>{const onProgress=e=>{const t=e.loaded/e.total;r(Math.max(0,Math.min(1,isFinite(t)?t:1)))};return new Promise(((r,s)=>{t.load(e,r,onProgress,s)}))})(e,this[bt],(e=>{r(.8*e)})),s=this[Rt],o=t.then((e=>s.prepare(e))).then((e=>(r(.9),new s(e)))).catch((e=>(_t.error(e),new s)));Ct.set(e,o)}await Ct.get(e),It.set(e,!0),r&&r(1)}async load(e,t,r=(()=>{})){await this.preload(e,t,r);const s=await Ct.get(e),o=await s.clone();return this[Bt].retain(e),o.dispose=()=>{this[Bt].release(e)},o}}CachingGLTFLoader[Et]=new CacheEvictionPolicy(CachingGLTFLoader);class CSS2DObject extends o.Tme{constructor(e=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new o.FM8(.5,.5),this.addEventListener("removed",(function(){this.traverse((function(e){e.element instanceof e.element.ownerDocument.defaultView.Element&&null!==e.element.parentNode&&e.element.remove()}))}))}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this.center=e.center,this}}const Lt=new o.Pa4,Dt=new o.yGw,Ut=new o.yGw,Pt=new o.Pa4,Ft=new o.Pa4;class CSS2DRenderer{constructor(e={}){const t=this;let r,s,o,l;const c={objects:new WeakMap},A=void 0!==e.element?e.element:document.createElement("div");function hideObject(e){e.isCSS2DObject&&(e.element.style.display="none");for(let t=0,r=e.children.length;t<r;t++)hideObject(e.children[t])}function renderObject(e,r,s){if(!1!==e.visible){if(e.isCSS2DObject){Lt.setFromMatrixPosition(e.matrixWorld),Lt.applyMatrix4(Ut);const d=Lt.z>=-1&&Lt.z<=1&&!0===e.layers.test(s.layers),h=e.element;h.style.display=!0===d?"":"none",!0===d&&(e.onBeforeRender(t,r,s),h.style.transform="translate("+-100*e.center.x+"%,"+-100*e.center.y+"%)translate("+(Lt.x*o+o)+"px,"+(-Lt.y*l+l)+"px)",h.parentNode!==A&&A.appendChild(h),e.onAfterRender(t,r,s));const p={distanceToCameraSquared:getDistanceToSquared(s,e)};c.objects.set(e,p)}for(let t=0,o=e.children.length;t<o;t++)renderObject(e.children[t],r,s)}else hideObject(e)}function getDistanceToSquared(e,t){return Pt.setFromMatrixPosition(e.matrixWorld),Ft.setFromMatrixPosition(t.matrixWorld),Pt.distanceToSquared(Ft)}A.style.overflow="hidden",this.domElement=A,this.getSize=function(){return{width:r,height:s}},this.render=function(e,t){!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),Dt.copy(t.matrixWorldInverse),Ut.multiplyMatrices(t.projectionMatrix,Dt),renderObject(e,e,t),function zOrder(e){const t=function filterAndFlatten(e){const t=[];return e.traverseVisible((function(e){e.isCSS2DObject&&t.push(e)})),t}(e).sort((function(e,t){if(e.renderOrder!==t.renderOrder)return t.renderOrder-e.renderOrder;return c.objects.get(e).distanceToCameraSquared-c.objects.get(t).distanceToCameraSquared})),r=t.length;for(let e=0,s=t.length;e<s;e++)t[e].element.style.zIndex=r-e}(e)},this.setSize=function(e,t){r=e,s=t,o=r/2,l=s/2,A.style.width=e+"px",A.style.height=t+"px"}}}r(5108);function reduceVertices(e,t,r){let s=r;const l=new o.Pa4;return e.updateWorldMatrix(!0,!0),e.traverseVisible((e=>{const{geometry:r}=e;if(void 0!==r){const{position:o}=r.attributes;if(void 0!==o)for(let r=0,c=o.count;r<c;r++)e.isMesh?e.getVertexPosition(r,l):l.fromBufferAttribute(o,r),e.isSkinnedMesh||l.applyMatrix4(e.matrixWorld),s=t(s,l)}})),s}var Qt=r(5108);const Nt={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 GLTFExporter{constructor(){this.textureUtils=null,this.pluginCallbacks=[],this.register((function(e){return new GLTFLightExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsUnlitExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsTransmissionExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsVolumeExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsIorExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsSpecularExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsClearcoatExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsDispersionExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsIridescenceExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsSheenExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsAnisotropyExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsEmissiveStrengthExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsBumpExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMeshGpuInstancing(e)}))}register(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}setTextureUtils(e){return this.textureUtils=e,this}parse(e,t,r,s){const o=new GLTFWriter,l=[];for(let e=0,t=this.pluginCallbacks.length;e<t;e++)l.push(this.pluginCallbacks[e](o));o.setPlugins(l),o.setTextureUtils(this.textureUtils),o.writeAsync(e,t,s).catch(r)}parseAsync(e,t){const r=this;return new Promise((function(s,o){r.parse(e,s,o,t)}))}}const Ot=0,Gt=1,kt=2,Ht=3,Vt=4,zt=5120,Wt=5121,qt=5122,Xt=5123,Kt=5124,jt=5125,Yt=5126,Jt=34962,$t=34963,Zt=9728,en=9729,tn=9984,nn=9985,rn=9986,an=9987,sn=33071,on=33648,ln=10497,cn={};cn[o.TyD]=Zt,cn[o.YLQ]=tn,cn[o.aH4]=rn,cn[o.wem]=en,cn[o.qyh]=nn,cn[o.D1R]=an,cn[o.uWy]=sn,cn[o.rpg]=ln,cn[o.OoA]=on;const An={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"},dn=new o.Ilk;function equalArray(e,t){return e.length===t.length&&e.every((function(e,r){return e===t[r]}))}function getPaddedBufferSize(e){return 4*Math.ceil(e/4)}function getPaddedArrayBuffer(e,t=0){const r=getPaddedBufferSize(e.byteLength);if(r!==e.byteLength){const s=new Uint8Array(r);if(s.set(new Uint8Array(e)),0!==t)for(let o=e.byteLength;o<r;o++)s[o]=t;return s.buffer}return e}function getCanvas(){return"undefined"==typeof document&&"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas")}class GLTFWriter{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"+o.UZH}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map},this.textureUtils=null}setPlugins(e){this.plugins=e}setTextureUtils(e){this.textureUtils=e}async writeAsync(e,t,r={}){this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},r),this.options.animations.length>0&&(this.options.trs=!0),await this.processInputAsync(e),await Promise.all(this.pending);const s=this,o=s.buffers,l=s.json;r=s.options;const c=s.extensionsUsed,A=s.extensionsRequired,d=new Blob(o,{type:"application/octet-stream"}),h=Object.keys(c),p=Object.keys(A);if(h.length>0&&(l.extensionsUsed=h),p.length>0&&(l.extensionsRequired=p),l.buffers&&l.buffers.length>0&&(l.buffers[0].byteLength=d.size),!0===r.binary){const e=new FileReader;e.readAsArrayBuffer(d),e.onloadend=function(){const r=getPaddedArrayBuffer(e.result),s=new DataView(new ArrayBuffer(8));s.setUint32(0,r.byteLength,!0),s.setUint32(4,5130562,!0);const o=getPaddedArrayBuffer(function stringToArrayBuffer(e){return(new TextEncoder).encode(e).buffer}(JSON.stringify(l)),32),c=new DataView(new ArrayBuffer(8));c.setUint32(0,o.byteLength,!0),c.setUint32(4,1313821514,!0);const A=new ArrayBuffer(12),d=new DataView(A);d.setUint32(0,1179937895,!0),d.setUint32(4,2,!0);const h=12+c.byteLength+o.byteLength+s.byteLength+r.byteLength;d.setUint32(8,h,!0);const p=new Blob([A,c,o,s,r],{type:"application/octet-stream"}),g=new FileReader;g.readAsArrayBuffer(p),g.onloadend=function(){t(g.result)}}}else if(l.buffers&&l.buffers.length>0){const e=new FileReader;e.readAsDataURL(d),e.onloadend=function(){const r=e.result;l.buffers[0].uri=r,t(l)}}else t(l)}serializeUserData(e,t){if(0===Object.keys(e.userData).length)return;const r=this.options,s=this.extensionsUsed;try{const o=JSON.parse(JSON.stringify(e.userData));if(r.includeCustomExtensions&&o.gltfExtensions){void 0===t.extensions&&(t.extensions={});for(const e in o.gltfExtensions)t.extensions[e]=o.gltfExtensions[e],s[e]=!0;delete o.gltfExtensions}Object.keys(o).length>0&&(t.extras=o)}catch(t){Qt.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+t.message)}}getUID(e,t=!1){if(!1===this.uids.has(e)){const t=new Map;t.set(!0,this.uid++),t.set(!1,this.uid++),this.uids.set(e,t)}return this.uids.get(e).get(t)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;const t=new o.Pa4;for(let r=0,s=e.count;r<s;r++)if(Math.abs(t.fromBufferAttribute(e,r).length()-1)>5e-4)return!1;return!0}createNormalizedNormalAttribute(e){const t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);const r=e.clone(),s=new o.Pa4;for(let e=0,t=r.count;e<t;e++)s.fromBufferAttribute(r,e),0===s.x&&0===s.y&&0===s.z?s.setX(1):s.normalize(),r.setXYZ(e,s.x,s.y,s.z);return t.attributesNormalized.set(e,r),r}applyTextureTransform(e,t){let r=!1;const s={};0===t.offset.x&&0===t.offset.y||(s.offset=t.offset.toArray(),r=!0),0!==t.rotation&&(s.rotation=t.rotation,r=!0),1===t.repeat.x&&1===t.repeat.y||(s.scale=t.repeat.toArray(),r=!0),r&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=s,this.extensionsUsed.KHR_texture_transform=!0)}async buildMetalRoughTextureAsync(e,t){if(e===t)return e;function getEncodingConversion(e){return e.colorSpace===o.KI_?function SRGBToLinear(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}:function LinearToLinear(e){return e}}e instanceof o.EB7&&(e=await this.decompressTextureAsync(e)),t instanceof o.EB7&&(t=await this.decompressTextureAsync(t));const r=e?e.image:null,s=t?t.image:null,l=Math.max(r?r.width:0,s?s.width:0),c=Math.max(r?r.height:0,s?s.height:0),A=getCanvas();A.width=l,A.height=c;const d=A.getContext("2d",{willReadFrequently:!0});d.fillStyle="#00ffff",d.fillRect(0,0,l,c);const h=d.getImageData(0,0,l,c);if(r){d.drawImage(r,0,0,l,c);const t=getEncodingConversion(e),s=d.getImageData(0,0,l,c).data;for(let e=2;e<s.length;e+=4)h.data[e]=256*t(s[e]/256)}if(s){d.drawImage(s,0,0,l,c);const e=getEncodingConversion(t),r=d.getImageData(0,0,l,c).data;for(let t=1;t<r.length;t+=4)h.data[t]=256*e(r[t]/256)}d.putImageData(h,0,0);const p=(e||t).clone();return p.source=new o.Hw6(A),p.colorSpace=o.aCh,p.channel=(e||t).channel,e&&t&&e.channel!==t.channel&&Qt.warn("THREE.GLTFExporter: UV channels for metalnessMap and roughnessMap textures must match."),Qt.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures."),p}async decompressTextureAsync(e,t=1/0){if(null===this.textureUtils)throw new Error("THREE.GLTFExporter: setTextureUtils() must be called to process compressed textures.");return await this.textureUtils.decompress(e,t)}processBuffer(e){const t=this.json,r=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),r.push(e),0}processBufferView(e,t,r,s,l){const c=this.json;let A;switch(c.bufferViews||(c.bufferViews=[]),t){case zt:case Wt:A=1;break;case qt:case Xt:A=2;break;default:A=4}let d=e.itemSize*A;l===Jt&&(d=4*Math.ceil(d/4));const h=getPaddedBufferSize(s*d),p=new DataView(new ArrayBuffer(h));let g=0;for(let l=r;l<r+s;l++){for(let r=0;r<e.itemSize;r++){let s;e.itemSize>4?s=e.array[l*e.itemSize+r]:(0===r?s=e.getX(l):1===r?s=e.getY(l):2===r?s=e.getZ(l):3===r&&(s=e.getW(l)),!0===e.normalized&&(s=o.M8C.normalize(s,e.array))),t===Yt?p.setFloat32(g,s,!0):t===Kt?p.setInt32(g,s,!0):t===jt?p.setUint32(g,s,!0):t===qt?p.setInt16(g,s,!0):t===Xt?p.setUint16(g,s,!0):t===zt?p.setInt8(g,s):t===Wt&&p.setUint8(g,s),g+=A}g%d!=0&&(g+=d-g%d)}const m={buffer:this.processBuffer(p.buffer),byteOffset:this.byteOffset,byteLength:h};void 0!==l&&(m.target=l),l===Jt&&(m.byteStride=d),this.byteOffset+=h,c.bufferViews.push(m);return{id:c.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){const t=this,r=t.json;return r.bufferViews||(r.bufferViews=[]),new Promise((function(s){const o=new FileReader;o.readAsArrayBuffer(e),o.onloadend=function(){const e=getPaddedArrayBuffer(o.result),l={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,s(r.bufferViews.push(l)-1)}}))}processAccessor(e,t,r,s){const l=this.json;let c;if(e.array.constructor===Float32Array)c=Yt;else if(e.array.constructor===Int32Array)c=Kt;else if(e.array.constructor===Uint32Array)c=jt;else if(e.array.constructor===Int16Array)c=qt;else if(e.array.constructor===Uint16Array)c=Xt;else if(e.array.constructor===Int8Array)c=zt;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: "+e.array.constructor.name);c=Wt}if(void 0===r&&(r=0),void 0!==s&&s!==1/0||(s=e.count),0===s)return null;const A=function getMinMax(e,t,r){const s={min:new Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)};for(let l=t;l<t+r;l++)for(let t=0;t<e.itemSize;t++){let r;e.itemSize>4?r=e.array[l*e.itemSize+t]:(0===t?r=e.getX(l):1===t?r=e.getY(l):2===t?r=e.getZ(l):3===t&&(r=e.getW(l)),!0===e.normalized&&(r=o.M8C.normalize(r,e.array))),s.min[t]=Math.min(s.min[t],r),s.max[t]=Math.max(s.max[t],r)}return s}(e,r,s);let d;void 0!==t&&(d=e===t.index?$t:Jt);const h=this.processBufferView(e,c,r,s,d),p={bufferView:h.id,byteOffset:h.byteOffset,componentType:c,count:s,max:A.max,min:A.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",9:"MAT3",16:"MAT4"}[e.itemSize]};return!0===e.normalized&&(p.normalized=!0),l.accessors||(l.accessors=[]),l.accessors.push(p)-1}processImage(e,t,r,s="image/png"){if(null!==e){const l=this,c=l.cache,A=l.json,d=l.options,h=l.pending;c.images.has(e)||c.images.set(e,{});const p=c.images.get(e),g=s+":flipY/"+r.toString();if(void 0!==p[g])return p[g];A.images||(A.images=[]);const m={mimeType:s},f=getCanvas();f.width=Math.min(e.width,d.maxTextureSize),f.height=Math.min(e.height,d.maxTextureSize);const E=f.getContext("2d",{willReadFrequently:!0});if(!0===r&&(E.translate(0,f.height),E.scale(1,-1)),void 0!==e.data){t!==o.wk1&&Qt.error("GLTFExporter: Only RGBAFormat is supported.",t),(e.width>d.maxTextureSize||e.height>d.maxTextureSize)&&Qt.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);const r=new Uint8ClampedArray(e.height*e.width*4);for(let t=0;t<r.length;t+=4)r[t+0]=e.data[t+0],r[t+1]=e.data[t+1],r[t+2]=e.data[t+2],r[t+3]=e.data[t+3];E.putImageData(new ImageData(r,e.width,e.height),0,0)}else{if(!("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas))throw new Error("THREE.GLTFExporter: Invalid image type. Use HTMLImageElement, HTMLCanvasElement, ImageBitmap or OffscreenCanvas.");E.drawImage(e,0,0,f.width,f.height)}!0===d.binary?h.push(function getToBlobPromise(e,t){if(void 0!==e.toBlob)return new Promise((r=>e.toBlob(r,t)));let r;return"image/jpeg"===t?r=.92:"image/webp"===t&&(r=.8),e.convertToBlob({type:t,quality:r})}(f,s).then((e=>l.processBufferViewImage(e))).then((e=>{m.bufferView=e}))):m.uri=o.PpQ.getDataURL(f,s);const _=A.images.push(m)-1;return p[g]=_,_}throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.")}processSampler(e){const t=this.json;t.samplers||(t.samplers=[]);const r={magFilter:cn[e.magFilter],minFilter:cn[e.minFilter],wrapS:cn[e.wrapS],wrapT:cn[e.wrapT]};return t.samplers.push(r)-1}async processTextureAsync(e){const t=this.options,r=this.cache,s=this.json;if(r.textures.has(e))return r.textures.get(e);s.textures||(s.textures=[]),e instanceof o.EB7&&(e=await this.decompressTextureAsync(e,t.maxTextureSize));let l=e.userData.mimeType;"image/webp"===l&&(l="image/png");const c={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,l)};e.name&&(c.name=e.name),await this._invokeAllAsync((async function(t){t.writeTexture&&await t.writeTexture(e,c)}));const A=s.textures.push(c)-1;return r.textures.set(e,A),A}async processMaterialAsync(e){const t=this.cache,r=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return Qt.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;r.materials||(r.materials=[]);const s={pbrMetallicRoughness:{}};!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&Qt.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");const l=e.color.toArray().concat([e.opacity]);if(equalArray(l,[1,1,1,1])||(s.pbrMetallicRoughness.baseColorFactor=l),e.isMeshStandardMaterial?(s.pbrMetallicRoughness.metallicFactor=e.metalness,s.pbrMetallicRoughness.roughnessFactor=e.roughness):(s.pbrMetallicRoughness.metallicFactor=0,s.pbrMetallicRoughness.roughnessFactor=1),e.metalnessMap||e.roughnessMap){const t=await this.buildMetalRoughTextureAsync(e.metalnessMap,e.roughnessMap),r={index:await this.processTextureAsync(t),texCoord:t.channel};this.applyTextureTransform(r,t),s.pbrMetallicRoughness.metallicRoughnessTexture=r}if(e.map){const t={index:await this.processTextureAsync(e.map),texCoord:e.map.channel};this.applyTextureTransform(t,e.map),s.pbrMetallicRoughness.baseColorTexture=t}if(e.emissive){const t=e.emissive;if(Math.max(t.r,t.g,t.b)>0&&(s.emissiveFactor=e.emissive.toArray()),e.emissiveMap){const t={index:await this.processTextureAsync(e.emissiveMap),texCoord:e.emissiveMap.channel};this.applyTextureTransform(t,e.emissiveMap),s.emissiveTexture=t}}if(e.normalMap){const t={index:await this.processTextureAsync(e.normalMap),texCoord:e.normalMap.channel};e.normalScale&&1!==e.normalScale.x&&(t.scale=e.normalScale.x),this.applyTextureTransform(t,e.normalMap),s.normalTexture=t}if(e.aoMap){const t={index:await this.processTextureAsync(e.aoMap),texCoord:e.aoMap.channel};1!==e.aoMapIntensity&&(t.strength=e.aoMapIntensity),this.applyTextureTransform(t,e.aoMap),s.occlusionTexture=t}e.transparent?s.alphaMode="BLEND":e.alphaTest>0&&(s.alphaMode="MASK",s.alphaCutoff=e.alphaTest),e.side===o.ehD&&(s.doubleSided=!0),""!==e.name&&(s.name=e.name),this.serializeUserData(e,s),await this._invokeAllAsync((async function(t){t.writeMaterialAsync&&await t.writeMaterialAsync(e,s)}));const c=r.materials.push(s)-1;return t.materials.set(e,c),c}async processMeshAsync(e){const t=this.cache,r=this.json,s=[e.geometry.uuid];if(Array.isArray(e.material))for(let t=0,r=e.material.length;t<r;t++)s.push(e.material[t].uuid);else s.push(e.material.uuid);const l=s.join(":");if(t.meshes.has(l))return t.meshes.get(l);const c=e.geometry;let A;A=e.isLineSegments?Gt:e.isLineLoop?kt:e.isLine?Ht:e.isPoints?Ot:e.material.wireframe?Gt:Vt;const d={},h={},p=[],g=[],m={uv:"TEXCOORD_0",uv1:"TEXCOORD_1",uv2:"TEXCOORD_2",uv3:"TEXCOORD_3",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},f=c.getAttribute("normal");void 0===f||this.isNormalizedNormalAttribute(f)||(Qt.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),c.setAttribute("normal",this.createNormalizedNormalAttribute(f)));let E=null;for(let e in c.attributes){if("morph"===e.slice(0,5))continue;const r=c.attributes[e];e=m[e]||e.toUpperCase();if(/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(e)||(e="_"+e),t.attributes.has(this.getUID(r))){h[e]=t.attributes.get(this.getUID(r));continue}E=null;const s=r.array;"JOINTS_0"!==e||s instanceof Uint16Array||s instanceof Uint8Array?(s instanceof Uint32Array||s instanceof Int32Array)&&!e.startsWith("_")&&(Qt.warn(`GLTFExporter: Attribute "${e}" converted to type FLOAT.`),E=GLTFExporter.Utils.toFloat32BufferAttribute(r)):(Qt.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),E=new o.TlE(new Uint16Array(s),r.itemSize,r.normalized));const l=this.processAccessor(E||r,c);null!==l&&(e.startsWith("_")||this.detectMeshQuantization(e,r),h[e]=l,t.attributes.set(this.getUID(r),l))}if(void 0!==f&&c.setAttribute("normal",f),0===Object.keys(h).length)return null;if(void 0!==e.morphTargetInfluences&&e.morphTargetInfluences.length>0){const r=[],s=[],o={};if(void 0!==e.morphTargetDictionary)for(const t in e.morphTargetDictionary)o[e.morphTargetDictionary[t]]=t;for(let l=0;l<e.morphTargetInfluences.length;++l){const A={};let d=!1;for(const e in c.morphAttributes){if("position"!==e&&"normal"!==e){d||(Qt.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),d=!0);continue}const r=c.morphAttributes[e][l],s=e.toUpperCase(),o=c.attributes[e];if(t.attributes.has(this.getUID(r,!0))){A[s]=t.attributes.get(this.getUID(r,!0));continue}const h=r.clone();if(!c.morphTargetsRelative)for(let e=0,t=r.count;e<t;e++)for(let t=0;t<r.itemSize;t++)0===t&&h.setX(e,r.getX(e)-o.getX(e)),1===t&&h.setY(e,r.getY(e)-o.getY(e)),2===t&&h.setZ(e,r.getZ(e)-o.getZ(e)),3===t&&h.setW(e,r.getW(e)-o.getW(e));A[s]=this.processAccessor(h,c),t.attributes.set(this.getUID(o,!0),A[s])}g.push(A),r.push(e.morphTargetInfluences[l]),void 0!==e.morphTargetDictionary&&s.push(o[l])}d.weights=r,s.length>0&&(d.extras={},d.extras.targetNames=s)}const _=Array.isArray(e.material);if(_&&0===c.groups.length)return null;let C=!1;if(_&&null===c.index){const e=[];for(let t=0,r=c.attributes.position.count;t<r;t++)e[t]=t;c.setIndex(e),C=!0}const I=_?e.material:[e.material],S=_?c.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let e=0,r=S.length;e<r;e++){const r={mode:A,attributes:h};if(this.serializeUserData(c,r),g.length>0&&(r.targets=g),null!==c.index){let s=this.getUID(c.index);void 0===S[e].start&&void 0===S[e].count||(s+=":"+S[e].start+":"+S[e].count),t.attributes.has(s)?r.indices=t.attributes.get(s):(r.indices=this.processAccessor(c.index,c,S[e].start,S[e].count),t.attributes.set(s,r.indices)),null===r.indices&&delete r.indices}const s=await this.processMaterialAsync(I[S[e].materialIndex]);null!==s&&(r.material=s),p.push(r)}!0===C&&c.setIndex(null),d.primitives=p,r.meshes||(r.meshes=[]),await this._invokeAllAsync((function(t){t.writeMesh&&t.writeMesh(e,d)}));const x=r.meshes.push(d)-1;return t.meshes.set(l,x),x}detectMeshQuantization(e,t){if(this.extensionsUsed.KHR_mesh_quantization)return;let r;switch(t.array.constructor){case Int8Array:r="byte";break;case Uint8Array:r="unsigned byte";break;case Int16Array:r="short";break;case Uint16Array:r="unsigned short";break;default:return}t.normalized&&(r+=" normalized");const s=e.split("_",1)[0];Nt[s]&&Nt[s].includes(r)&&(this.extensionsUsed.KHR_mesh_quantization=!0,this.extensionsRequired.KHR_mesh_quantization=!0)}processCamera(e){const t=this.json;t.cameras||(t.cameras=[]);const r=e.isOrthographicCamera,s={type:r?"orthographic":"perspective"};return r?s.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:s.perspective={aspectRatio:e.aspect,yfov:o.M8C.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(s.name=e.type),t.cameras.push(s)-1}processAnimation(e,t){const r=this.json,s=this.nodeMap;r.animations||(r.animations=[]);const l=(e=GLTFExporter.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks,c=[],A=[];for(let e=0;e<l.length;++e){const r=l[e],d=o.iUV.parseTrackName(r.name);let h=o.iUV.findNode(t,d.nodeName);const p=An[d.propertyName];if("bones"===d.objectName&&(h=!0===h.isSkinnedMesh?h.skeleton.getBoneByName(d.objectIndex):void 0),!h||!p){Qt.warn('THREE.GLTFExporter: Could not export animation track "%s".',r.name);continue}const g=1;let m,f=r.values.length/r.times.length;p===An.morphTargetInfluences&&(f/=h.morphTargetInfluences.length),!0===r.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(m="CUBICSPLINE",f/=3):m=r.getInterpolation()===o.Syv?"STEP":"LINEAR",A.push({input:this.processAccessor(new o.TlE(r.times,g)),output:this.processAccessor(new o.TlE(r.values,f)),interpolation:m}),c.push({sampler:A.length-1,target:{node:s.get(h),path:p}})}return r.animations.push({name:e.name||"clip_"+r.animations.length,samplers:A,channels:c}),r.animations.length-1}processSkin(e){const t=this.json,r=this.nodeMap,s=t.nodes[r.get(e)],l=e.skeleton;if(void 0===l)return null;const c=e.skeleton.bones[0];if(void 0===c)return null;const A=[],d=new Float32Array(16*l.bones.length),h=new o.yGw;for(let t=0;t<l.bones.length;++t)A.push(r.get(l.bones[t])),h.copy(l.boneInverses[t]),h.multiply(e.bindMatrix).toArray(d,16*t);void 0===t.skins&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new o.TlE(d,16)),joints:A,skeleton:r.get(c)});return s.skin=t.skins.length-1}async processNodeAsync(e){const t=this.json,r=this.options,s=this.nodeMap;t.nodes||(t.nodes=[]);const o={};if(r.trs){const t=e.quaternion.toArray(),r=e.position.toArray(),s=e.scale.toArray();equalArray(t,[0,0,0,1])||(o.rotation=t),equalArray(r,[0,0,0])||(o.translation=r),equalArray(s,[1,1,1])||(o.scale=s)}else e.matrixAutoUpdate&&e.updateMatrix(),!1===function isIdentityMatrix(e){return equalArray(e.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}(e.matrix)&&(o.matrix=e.matrix.elements);if(""!==e.name&&(o.name=String(e.name)),this.serializeUserData(e,o),e.isMesh||e.isLine||e.isPoints){const t=await this.processMeshAsync(e);null!==t&&(o.mesh=t)}else e.isCamera&&(o.camera=this.processCamera(e));if(e.isSkinnedMesh&&this.skins.push(e),e.children.length>0){const t=[];for(let s=0,o=e.children.length;s<o;s++){const o=e.children[s];if(o.visible||!1===r.onlyVisible){const e=await this.processNodeAsync(o);null!==e&&t.push(e)}}t.length>0&&(o.children=t)}await this._invokeAllAsync((function(t){t.writeNode&&t.writeNode(e,o)}));const l=t.nodes.push(o)-1;return s.set(e,l),l}async processSceneAsync(e){const t=this.json,r=this.options;t.scenes||(t.scenes=[],t.scene=0);const s={};""!==e.name&&(s.name=e.name),t.scenes.push(s);const o=[];for(let t=0,s=e.children.length;t<s;t++){const s=e.children[t];if(s.visible||!1===r.onlyVisible){const e=await this.processNodeAsync(s);null!==e&&o.push(e)}}o.length>0&&(s.nodes=o),this.serializeUserData(e,s)}async processObjectsAsync(e){const t=new o.xsS;t.name="AuxScene";for(let r=0;r<e.length;r++)t.children.push(e[r]);await this.processSceneAsync(t)}async processInputAsync(e){const t=this.options;e=e instanceof Array?e:[e],await this._invokeAllAsync((function(t){t.beforeParse&&t.beforeParse(e)}));const r=[];for(let t=0;t<e.length;t++)e[t]instanceof o.xsS?await this.processSceneAsync(e[t]):r.push(e[t]);r.length>0&&await this.processObjectsAsync(r);for(let e=0;e<this.skins.length;++e)this.processSkin(this.skins[e]);for(let r=0;r<t.animations.length;++r)this.processAnimation(t.animations[r],e[0]);await this._invokeAllAsync((function(t){t.afterParse&&t.afterParse(e)}))}async _invokeAllAsync(e){for(let t=0,r=this.plugins.length;t<r;t++)await e(this.plugins[t])}}class GLTFLightExtension{constructor(e){this.writer=e,this.name="KHR_lights_punctual"}writeNode(e,t){if(!e.isLight)return;if(!e.isDirectionalLight&&!e.isPointLight&&!e.isSpotLight)return void Qt.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e);const r=this.writer,s=r.json,o=r.extensionsUsed,l={};e.name&&(l.name=e.name),l.color=e.color.toArray(),l.intensity=e.intensity,e.isDirectionalLight?l.type="directional":e.isPointLight?(l.type="point",e.distance>0&&(l.range=e.distance)):e.isSpotLight&&(l.type="spot",e.distance>0&&(l.range=e.distance),l.spot={},l.spot.innerConeAngle=(1-e.penumbra)*e.angle,l.spot.outerConeAngle=e.angle),void 0!==e.decay&&2!==e.decay&&Qt.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),!e.target||e.target.parent===e&&0===e.target.position.x&&0===e.target.position.y&&-1===e.target.position.z||Qt.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),o[this.name]||(s.extensions=s.extensions||{},s.extensions[this.name]={lights:[]},o[this.name]=!0);const c=s.extensions[this.name].lights;c.push(l),t.extensions=t.extensions||{},t.extensions[this.name]={light:c.length-1}}}class GLTFExporter_GLTFMaterialsUnlitExtension{constructor(e){this.writer=e,this.name="KHR_materials_unlit"}async writeMaterialAsync(e,t){if(!e.isMeshBasicMaterial)return;const r=this.writer.extensionsUsed;t.extensions=t.extensions||{},t.extensions[this.name]={},r[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9}}class GLTFExporter_GLTFMaterialsClearcoatExtension{constructor(e){this.writer=e,this.name="KHR_materials_clearcoat"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||0===e.clearcoat)return;const r=this.writer,s=r.extensionsUsed,o={};if(o.clearcoatFactor=e.clearcoat,e.clearcoatMap){const t={index:await r.processTextureAsync(e.clearcoatMap),texCoord:e.clearcoatMap.channel};r.applyTextureTransform(t,e.clearcoatMap),o.clearcoatTexture=t}if(o.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap){const t={index:await r.processTextureAsync(e.clearcoatRoughnessMap),texCoord:e.clearcoatRoughnessMap.channel};r.applyTextureTransform(t,e.clearcoatRoughnessMap),o.clearcoatRoughnessTexture=t}if(e.clearcoatNormalMap){const t={index:await r.processTextureAsync(e.clearcoatNormalMap),texCoord:e.clearcoatNormalMap.channel};1!==e.clearcoatNormalScale.x&&(t.scale=e.clearcoatNormalScale.x),r.applyTextureTransform(t,e.clearcoatNormalMap),o.clearcoatNormalTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsDispersionExtension{constructor(e){this.writer=e,this.name="KHR_materials_dispersion"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||0===e.dispersion)return;const r=this.writer.extensionsUsed,s={};s.dispersion=e.dispersion,t.extensions=t.extensions||{},t.extensions[this.name]=s,r[this.name]=!0}}class GLTFExporter_GLTFMaterialsIridescenceExtension{constructor(e){this.writer=e,this.name="KHR_materials_iridescence"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||0===e.iridescence)return;const r=this.writer,s=r.extensionsUsed,o={};if(o.iridescenceFactor=e.iridescence,e.iridescenceMap){const t={index:await r.processTextureAsync(e.iridescenceMap),texCoord:e.iridescenceMap.channel};r.applyTextureTransform(t,e.iridescenceMap),o.iridescenceTexture=t}if(o.iridescenceIor=e.iridescenceIOR,o.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],o.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap){const t={index:await r.processTextureAsync(e.iridescenceThicknessMap),texCoord:e.iridescenceThicknessMap.channel};r.applyTextureTransform(t,e.iridescenceThicknessMap),o.iridescenceThicknessTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsTransmissionExtension{constructor(e){this.writer=e,this.name="KHR_materials_transmission"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||0===e.transmission)return;const r=this.writer,s=r.extensionsUsed,o={};if(o.transmissionFactor=e.transmission,e.transmissionMap){const t={index:await r.processTextureAsync(e.transmissionMap),texCoord:e.transmissionMap.channel};r.applyTextureTransform(t,e.transmissionMap),o.transmissionTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsVolumeExtension{constructor(e){this.writer=e,this.name="KHR_materials_volume"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||0===e.transmission)return;const r=this.writer,s=r.extensionsUsed,o={};if(o.thicknessFactor=e.thickness,e.thicknessMap){const t={index:await r.processTextureAsync(e.thicknessMap),texCoord:e.thicknessMap.channel};r.applyTextureTransform(t,e.thicknessMap),o.thicknessTexture=t}e.attenuationDistance!==1/0&&(o.attenuationDistance=e.attenuationDistance),o.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsIorExtension{constructor(e){this.writer=e,this.name="KHR_materials_ior"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||1.5===e.ior)return;const r=this.writer.extensionsUsed,s={};s.ior=e.ior,t.extensions=t.extensions||{},t.extensions[this.name]=s,r[this.name]=!0}}class GLTFExporter_GLTFMaterialsSpecularExtension{constructor(e){this.writer=e,this.name="KHR_materials_specular"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||1===e.specularIntensity&&e.specularColor.equals(dn)&&!e.specularIntensityMap&&!e.specularColorMap)return;const r=this.writer,s=r.extensionsUsed,o={};if(e.specularIntensityMap){const t={index:await r.processTextureAsync(e.specularIntensityMap),texCoord:e.specularIntensityMap.channel};r.applyTextureTransform(t,e.specularIntensityMap),o.specularTexture=t}if(e.specularColorMap){const t={index:await r.processTextureAsync(e.specularColorMap),texCoord:e.specularColorMap.channel};r.applyTextureTransform(t,e.specularColorMap),o.specularColorTexture=t}o.specularFactor=e.specularIntensity,o.specularColorFactor=e.specularColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsSheenExtension{constructor(e){this.writer=e,this.name="KHR_materials_sheen"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||0==e.sheen)return;const r=this.writer,s=r.extensionsUsed,o={};if(e.sheenRoughnessMap){const t={index:await r.processTextureAsync(e.sheenRoughnessMap),texCoord:e.sheenRoughnessMap.channel};r.applyTextureTransform(t,e.sheenRoughnessMap),o.sheenRoughnessTexture=t}if(e.sheenColorMap){const t={index:await r.processTextureAsync(e.sheenColorMap),texCoord:e.sheenColorMap.channel};r.applyTextureTransform(t,e.sheenColorMap),o.sheenColorTexture=t}o.sheenRoughnessFactor=e.sheenRoughness,o.sheenColorFactor=e.sheenColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsAnisotropyExtension{constructor(e){this.writer=e,this.name="KHR_materials_anisotropy"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||0==e.anisotropy)return;const r=this.writer,s=r.extensionsUsed,o={};if(e.anisotropyMap){const t={index:await r.processTextureAsync(e.anisotropyMap)};r.applyTextureTransform(t,e.anisotropyMap),o.anisotropyTexture=t}o.anisotropyStrength=e.anisotropy,o.anisotropyRotation=e.anisotropyRotation,t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsEmissiveStrengthExtension{constructor(e){this.writer=e,this.name="KHR_materials_emissive_strength"}async writeMaterialAsync(e,t){if(!e.isMeshStandardMaterial||1===e.emissiveIntensity)return;const r=this.writer.extensionsUsed,s={};s.emissiveStrength=e.emissiveIntensity,t.extensions=t.extensions||{},t.extensions[this.name]=s,r[this.name]=!0}}class GLTFExporter_GLTFMaterialsBumpExtension{constructor(e){this.writer=e,this.name="EXT_materials_bump"}async writeMaterialAsync(e,t){if(!e.isMeshStandardMaterial||1===e.bumpScale&&!e.bumpMap)return;const r=this.writer,s=r.extensionsUsed,o={};if(e.bumpMap){const t={index:await r.processTextureAsync(e.bumpMap),texCoord:e.bumpMap.channel};r.applyTextureTransform(t,e.bumpMap),o.bumpTexture=t}o.bumpFactor=e.bumpScale,t.extensions=t.extensions||{},t.extensions[this.name]=o,s[this.name]=!0}}class GLTFExporter_GLTFMeshGpuInstancing{constructor(e){this.writer=e,this.name="EXT_mesh_gpu_instancing"}writeNode(e,t){if(!e.isInstancedMesh)return;const r=this.writer,s=e,l=new Float32Array(3*s.count),c=new Float32Array(4*s.count),A=new Float32Array(3*s.count),d=new o.yGw,h=new o.Pa4,p=new o._fP,g=new o.Pa4;for(let e=0;e<s.count;e++)s.getMatrixAt(e,d),d.decompose(h,p,g),h.toArray(l,3*e),p.toArray(c,4*e),g.toArray(A,3*e);const m={TRANSLATION:r.processAccessor(new o.TlE(l,3)),ROTATION:r.processAccessor(new o.TlE(c,4)),SCALE:r.processAccessor(new o.TlE(A,3))};s.instanceColor&&(m._COLOR_0=r.processAccessor(s.instanceColor)),t.extensions=t.extensions||{},t.extensions[this.name]={attributes:m},r.extensionsUsed[this.name]=!0,r.extensionsRequired[this.name]=!0}}GLTFExporter.Utils={insertKeyframe:function(e,t){const r=.001,s=e.getValueSize(),o=new e.TimeBufferType(e.times.length+1),l=new e.ValueBufferType(e.values.length+s),c=e.createInterpolant(new e.ValueBufferType(s));let A;if(0===e.times.length){o[0]=t;for(let e=0;e<s;e++)l[e]=0;A=0}else if(t<e.times[0]){if(Math.abs(e.times[0]-t)<r)return 0;o[0]=t,o.set(e.times,1),l.set(c.evaluate(t),0),l.set(e.values,s),A=0}else if(t>e.times[e.times.length-1]){if(Math.abs(e.times[e.times.length-1]-t)<r)return e.times.length-1;o[o.length-1]=t,o.set(e.times,0),l.set(e.values,0),l.set(c.evaluate(t),e.values.length),A=o.length-1}else for(let d=0;d<e.times.length;d++){if(Math.abs(e.times[d]-t)<r)return d;if(e.times[d]<t&&e.times[d+1]>t){o.set(e.times.slice(0,d+1),0),o[d+1]=t,o.set(e.times.slice(d+1),d+2),l.set(e.values.slice(0,(d+1)*s),0),l.set(c.evaluate(t),(d+1)*s),l.set(e.values.slice((d+1)*s),(d+2)*s),A=d+1;break}}return e.times=o,e.values=l,A},mergeMorphTargetTracks:function(e,t){const r=[],s={},l=e.tracks;for(let e=0;e<l.length;++e){let c=l[e];const A=o.iUV.parseTrackName(c.name),d=o.iUV.findNode(t,A.nodeName);if("morphTargetInfluences"!==A.propertyName||void 0===A.propertyIndex){r.push(c);continue}if(c.createInterpolant!==c.InterpolantFactoryMethodDiscrete&&c.createInterpolant!==c.InterpolantFactoryMethodLinear){if(c.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");Qt.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),c=c.clone(),c.setInterpolation(o.NMF)}const h=d.morphTargetInfluences.length,p=d.morphTargetDictionary[A.propertyIndex];if(void 0===p)throw new Error("THREE.GLTFExporter: Morph target name not found: "+A.propertyIndex);let g;if(void 0===s[d.uuid]){g=c.clone();const e=new g.ValueBufferType(h*g.times.length);for(let t=0;t<g.times.length;t++)e[t*h+p]=g.values[t];g.name=(A.nodeName||"")+".morphTargetInfluences",g.values=e,s[d.uuid]=g,r.push(g);continue}const m=c.createInterpolant(new c.ValueBufferType(1));g=s[d.uuid];for(let e=0;e<g.times.length;e++)g.values[e*h+p]=m.evaluate(g.times[e]);for(let e=0;e<c.times.length;e++){const t=this.insertKeyframe(g,c.times[e]);g.values[t*h+p]=c.values[e]}}return e.tracks=r,e},toFloat32BufferAttribute:function(e){const t=new o.TlE(new Float32Array(e.count*e.itemSize),e.itemSize,!1);if(!e.normalized&&!e.isInterleavedBufferAttribute)return t.array.set(e.array),t;for(let r=0,s=e.count;r<s;r++)for(let s=0;s<e.itemSize;s++)t.setComponent(r,s,e.getComponent(r,s));return t}};const compatibleObject=e=>void 0!==e.material&&e.userData&&e.userData.variantMaterials&&!!Array.from(e.userData.variantMaterials.values()).filter((e=>compatibleMaterial(e.material))),compatibleMaterial=e=>e&&e.isMaterial&&!Array.isArray(e);class GLTFExporterMaterialsVariantsExtension{constructor(e){this.writer=e,this.name="KHR_materials_variants",this.variantNames=[]}beforeParse(e){const t=new Set;for(const r of e)r.traverse((e=>{if(!compatibleObject(e))return;const r=e.userData.variantMaterials,s=e.userData.variantData;for(const[e,o]of s){const s=r.get(o.index);s&&compatibleMaterial(s.material)&&t.add(e)}}));t.forEach((e=>this.variantNames.push(e)))}writeMesh(e,t){if(!compatibleObject(e))return;const r=e.userData,s=r.variantMaterials,o=r.variantData,l=new Map,c=new Map,A=Array.from(o.values()).sort(((e,t)=>e.index-t.index));for(const[e,t]of A.entries())c.set(t.index,e);for(const e of o.values()){const t=s.get(e.index);if(!t||!compatibleMaterial(t.material))continue;const r=this.writer.processMaterial(t.material);l.has(r)||l.set(r,{material:r,variants:[]}),l.get(r).variants.push(c.get(e.index))}const d=Array.from(l.values()).map((e=>e.variants.sort(((e,t)=>e-t))&&e)).sort(((e,t)=>e.material-t.material));if(0===d.length)return;const h=compatibleMaterial(r.originalMaterial)?this.writer.processMaterial(r.originalMaterial):-1;for(const e of t.primitives)h>=0&&(e.material=h),e.extensions=e.extensions||{},e.extensions[this.name]={mappings:d}}afterParse(){if(0===this.variantNames.length)return;const e=this.writer.json;e.extensions=e.extensions||{};const t=this.variantNames.map((e=>({name:e})));e.extensions[this.name]={variants:t},this.writer.extensionsUsed[this.name]=!0}}var un=r(5108);function WebGLAnimation(){let e=null,t=!1,r=null,s=null;function onAnimationFrame(t,o){r(t,o),s=e.requestAnimationFrame(onAnimationFrame)}return{start:function(){!0!==t&&null!==r&&(s=e.requestAnimationFrame(onAnimationFrame),t=!0)},stop:function(){e.cancelAnimationFrame(s),t=!1},setAnimationLoop:function(e){r=e},setContext:function(t){e=t}}}function WebGLAttributes(e){const t=new WeakMap;return{get:function get(e){return e.isInterleavedBufferAttribute&&(e=e.data),t.get(e)},remove:function remove(r){r.isInterleavedBufferAttribute&&(r=r.data);const s=t.get(r);s&&(e.deleteBuffer(s.buffer),t.delete(r))},update:function update(r,s){if(r.isInterleavedBufferAttribute&&(r=r.data),r.isGLBufferAttribute){const e=t.get(r);return void((!e||e.version<r.version)&&t.set(r,{buffer:r.buffer,type:r.type,bytesPerElement:r.elementSize,version:r.version}))}const o=t.get(r);if(void 0===o)t.set(r,function createBuffer(t,r){const s=t.array,o=t.usage,l=s.byteLength,c=e.createBuffer();let A;if(e.bindBuffer(r,c),e.bufferData(r,s,o),t.onUploadCallback(),s instanceof Float32Array)A=e.FLOAT;else if(s instanceof Uint16Array)A=t.isFloat16BufferAttribute?e.HALF_FLOAT:e.UNSIGNED_SHORT;else if(s instanceof Int16Array)A=e.SHORT;else if(s instanceof Uint32Array)A=e.UNSIGNED_INT;else if(s instanceof Int32Array)A=e.INT;else if(s instanceof Int8Array)A=e.BYTE;else if(s instanceof Uint8Array)A=e.UNSIGNED_BYTE;else{if(!(s instanceof Uint8ClampedArray))throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+s);A=e.UNSIGNED_BYTE}return{buffer:c,type:A,bytesPerElement:s.BYTES_PER_ELEMENT,version:t.version,size:l}}(r,s));else if(o.version<r.version){if(o.size!==r.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 updateBuffer(t,r,s){const o=r.array,l=r.updateRanges;if(e.bindBuffer(s,t),0===l.length)e.bufferSubData(s,0,o);else{l.sort(((e,t)=>e.start-t.start));let t=0;for(let e=1;e<l.length;e++){const r=l[t],s=l[e];s.start<=r.start+r.count+1?r.count=Math.max(r.count,s.start+s.count-r.start):(++t,l[t]=s)}l.length=t+1;for(let t=0,r=l.length;t<r;t++){const r=l[t];e.bufferSubData(s,r.start*o.BYTES_PER_ELEMENT,o,r.start,r.count)}r.clearUpdateRanges()}r.onUploadCallback()}(o.buffer,r,s),o.version=r.version}}}}const hn={alphahash_fragment:"#ifdef USE_ALPHAHASH\n\tif ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;\n#endif",alphahash_pars_fragment:"#ifdef USE_ALPHAHASH\n\tconst float ALPHA_HASH_SCALE = 0.05;\n\tfloat hash2D( vec2 value ) {\n\t\treturn fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );\n\t}\n\tfloat hash3D( vec3 value ) {\n\t\treturn hash2D( vec2( hash2D( value.xy ), value.z ) );\n\t}\n\tfloat getAlphaHashThreshold( vec3 position ) {\n\t\tfloat maxDeriv = max(\n\t\t\tlength( dFdx( position.xyz ) ),\n\t\t\tlength( dFdy( position.xyz ) )\n\t\t);\n\t\tfloat pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );\n\t\tvec2 pixScales = vec2(\n\t\t\texp2( floor( log2( pixScale ) ) ),\n\t\t\texp2( ceil( log2( pixScale ) ) )\n\t\t);\n\t\tvec2 alpha = vec2(\n\t\t\thash3D( floor( pixScales.x * position.xyz ) ),\n\t\t\thash3D( floor( pixScales.y * position.xyz ) )\n\t\t);\n\t\tfloat lerpFactor = fract( log2( pixScale ) );\n\t\tfloat x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;\n\t\tfloat a = min( lerpFactor, 1.0 - lerpFactor );\n\t\tvec3 cases = vec3(\n\t\t\tx * x / ( 2.0 * a * ( 1.0 - a ) ),\n\t\t\t( x - 0.5 * a ) / ( 1.0 - a ),\n\t\t\t1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )\n\t\t);\n\t\tfloat threshold = ( x < ( 1.0 - a ) )\n\t\t\t? ( ( x < a ) ? cases.x : cases.y )\n\t\t\t: cases.z;\n\t\treturn clamp( threshold , 1.0e-6, 1.0 );\n\t}\n#endif",alphamap_fragment:"#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;\n#endif",alphamap_pars_fragment:"#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",alphatest_fragment:"#ifdef USE_ALPHATEST\n\t#ifdef ALPHA_TO_COVERAGE\n\tdiffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\tif ( diffuseColor.a < alphaTest ) discard;\n\t#endif\n#endif",alphatest_pars_fragment:"#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif",aomap_fragment:"#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_CLEARCOAT ) \n\t\tclearcoatSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_SHEEN ) \n\t\tsheenSpecularIndirect *= ambientOcclusion;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif",aomap_pars_fragment:"#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif",batching_pars_vertex:"#ifdef USE_BATCHING\n\t#if ! defined( GL_ANGLE_multi_draw )\n\t#define gl_DrawID _gl_DrawID\n\tuniform int _gl_DrawID;\n\t#endif\n\tuniform highp sampler2D batchingTexture;\n\tuniform highp usampler2D batchingIdTexture;\n\tmat4 getBatchingMatrix( const in float i ) {\n\t\tint size = textureSize( batchingTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n\tfloat getIndirectIndex( const in int i ) {\n\t\tint size = textureSize( batchingIdTexture, 0 ).x;\n\t\tint x = i % size;\n\t\tint y = i / size;\n\t\treturn float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );\n\t}\n#endif\n#ifdef USE_BATCHING_COLOR\n\tuniform sampler2D batchingColorTexture;\n\tvec3 getBatchingColor( const in float i ) {\n\t\tint size = textureSize( batchingColorTexture, 0 ).x;\n\t\tint j = int( i );\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\treturn texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;\n\t}\n#endif",batching_vertex:"#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );\n#endif",begin_vertex:"vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif",beginnormal_vertex:"vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif",bsdfs:"float G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\n} // validated",iridescence_fragment:"#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\treturn vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif",bumpmap_pars_fragment:"#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n\t\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif",clipping_planes_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#ifdef ALPHA_TO_COVERAGE\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tfloat unionClipOpacity = 1.0;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\t\t#endif\n\t\tdiffuseColor.a *= clipOpacity;\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tbool clipped = true;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tif ( clipped ) discard;\n\t\t#endif\n\t#endif\n#endif",clipping_planes_pars_fragment:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif",clipping_planes_pars_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n#endif",clipping_planes_vertex:"#if NUM_CLIPPING_PLANES > 0\n\tvClipPosition = - mvPosition.xyz;\n#endif",color_fragment:"#if defined( USE_COLOR_ALPHA )\n\tdiffuseColor *= vColor;\n#elif defined( USE_COLOR )\n\tdiffuseColor.rgb *= vColor;\n#endif",color_pars_fragment:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR )\n\tvarying vec3 vColor;\n#endif",color_pars_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvarying vec3 vColor;\n#endif",color_vertex:"#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif\n#ifdef USE_BATCHING_COLOR\n\tvec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );\n\tvColor.xyz *= batchingColor.xyz;\n#endif",common:"#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated",cube_uv_reflection_fragment:"#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif",defaultnormal_vertex:"vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif",displacementmap_pars_vertex:"#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif",displacementmap_vertex:"#ifdef USE_DISPLACEMENTMAP\n\ttransformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );\n#endif",emissivemap_fragment:"#ifdef USE_EMISSIVEMAP\n\tvec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE\n\t\temissiveColor = sRGBTransferEOTF( emissiveColor );\n\t#endif\n\ttotalEmissiveRadiance *= emissiveColor.rgb;\n#endif",emissivemap_pars_fragment:"#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emissiveMap;\n#endif",colorspace_fragment:"gl_FragColor = linearToOutputTexel( gl_FragColor );",colorspace_pars_fragment:"vec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferEOTF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}",envmap_fragment:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif",envmap_common_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif",envmap_pars_fragment:"#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif",envmap_pars_vertex:"#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif",envmap_physical_pars_fragment:"#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif",envmap_vertex:"#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif",fog_vertex:"#ifdef USE_FOG\n\tvFogDepth = - mvPosition.z;\n#endif",fog_pars_vertex:"#ifdef USE_FOG\n\tvarying float vFogDepth;\n#endif",fog_fragment:"#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );\n\t#else\n\t\tfloat fogFactor = smoothstep( fogNear, fogFar, vFogDepth );\n\t#endif\n\tgl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );\n#endif",fog_pars_fragment:"#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif",gradientmap_pars_fragment:"#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}",lightmap_pars_fragment:"#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif",lights_lambert_fragment:"LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;",lights_lambert_pars_fragment:"varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert",lights_pars_begin:"uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\tif ( cutoffDistance > 0.0 ) {\n\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t}\n\treturn distanceFalloff;\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif",lights_toon_fragment:"ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;",lights_toon_pars_fragment:"varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon",lights_phong_fragment:"BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;",lights_phong_pars_fragment:"varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong",lights_physical_fragment:"PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_DISPERSION\n\tmaterial.dispersion = dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif",lights_physical_pars_fragment:"struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\tfloat dispersion;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}",lights_fragment_begin:"\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal = vec3( 0.0 );\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometryPosition, directLight );\n\t\t#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif",lights_fragment_maps:"#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometryNormal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif",lights_fragment_end:"#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif",logdepthbuf_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif",logdepthbuf_pars_fragment:"#if defined( USE_LOGDEPTHBUF )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_pars_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif",logdepthbuf_vertex:"#ifdef USE_LOGDEPTHBUF\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif",map_fragment:"#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif",map_pars_fragment:"#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif",map_particle_fragment:"#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t#if defined( USE_POINTS_UV )\n\t\tvec2 uv = vUv;\n\t#else\n\t\tvec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, uv );\n#endif\n#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alphaMap, uv ).g;\n#endif",map_particle_pars_fragment:"#if defined( USE_POINTS_UV )\n\tvarying vec2 vUv;\n#else\n\t#if defined( USE_MAP ) || defined( USE_ALPHAMAP )\n\t\tuniform mat3 uvTransform;\n\t#endif\n#endif\n#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif",metalnessmap_fragment:"float metalnessFactor = metalness;\n#ifdef USE_METALNESSMAP\n\tvec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );\n\tmetalnessFactor *= texelMetalness.b;\n#endif",metalnessmap_pars_fragment:"#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif",morphinstance_vertex:"#ifdef USE_INSTANCING_MORPH\n\tfloat morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\t}\n#endif",morphcolor_vertex:"#if defined( USE_MORPHCOLORS )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif",morphnormal_vertex:"#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",morphtarget_pars_vertex:"#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING_MORPH\n\t\tuniform float morphTargetBaseInfluence;\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t#endif\n\tuniform sampler2DArray morphTargetsTexture;\n\tuniform ivec2 morphTargetsTextureSize;\n\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t}\n#endif",morphtarget_vertex:"#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t}\n#endif",normal_fragment_begin:"float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;",normal_fragment_maps:"#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif",normal_pars_fragment:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_pars_vertex:"#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef USE_TANGENT\n\t\tvarying vec3 vTangent;\n\t\tvarying vec3 vBitangent;\n\t#endif\n#endif",normal_vertex:"#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif",normalmap_pars_fragment:"#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif",clearcoat_normal_fragment_begin:"#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif",clearcoat_normal_fragment_maps:"#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif",clearcoat_pars_fragment:"#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clearcoatMap;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform sampler2D clearcoatNormalMap;\n\tuniform vec2 clearcoatNormalScale;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform sampler2D clearcoatRoughnessMap;\n#endif",iridescence_pars_fragment:"#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif",opaque_fragment:"#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );",packing:"vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;\nconst float Inv255 = 1. / 255.;\nconst vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );\nconst vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );\nconst vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );\nconst vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );\nvec4 packDepthToRGBA( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec4( 0., 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec4( 1., 1., 1., 1. );\n\tfloat vuf;\n\tfloat af = modf( v * PackFactors.a, vuf );\n\tfloat bf = modf( vuf * ShiftRight8, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );\n}\nvec3 packDepthToRGB( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec3( 0., 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec3( 1., 1., 1. );\n\tfloat vuf;\n\tfloat bf = modf( v * PackFactors.b, vuf );\n\tfloat gf = modf( vuf * ShiftRight8, vuf );\n\treturn vec3( vuf * Inv255, gf * PackUpscale, bf );\n}\nvec2 packDepthToRG( const in float v ) {\n\tif( v <= 0.0 )\n\t\treturn vec2( 0., 0. );\n\tif( v >= 1.0 )\n\t\treturn vec2( 1., 1. );\n\tfloat vuf;\n\tfloat gf = modf( v * 256., vuf );\n\treturn vec2( vuf * Inv255, gf );\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors4 );\n}\nfloat unpackRGBToDepth( const in vec3 v ) {\n\treturn dot( v, UnpackFactors3 );\n}\nfloat unpackRGToDepth( const in vec2 v ) {\n\treturn v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;\n}\nvec4 pack2HalfToRGBA( const in vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( const in vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn depth * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * depth - far );\n}",premultiplied_alpha_fragment:"#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif",project_vertex:"vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n\tmvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;",dithering_fragment:"#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif",dithering_pars_fragment:"#ifdef DITHERING\n\tvec3 dithering( vec3 color ) {\n\t\tfloat grid_position = rand( gl_FragCoord.xy );\n\t\tvec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );\n\t\tdither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );\n\t\treturn color + dither_shift_RGB;\n\t}\n#endif",roughnessmap_fragment:"float roughnessFactor = roughness;\n#ifdef USE_ROUGHNESSMAP\n\tvec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );\n\troughnessFactor *= texelRoughness.g;\n#endif",roughnessmap_pars_fragment:"#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif",shadowmap_pars_fragment:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\t\t\t#else\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t\t#endif\n\t\t}\n\t\treturn mix( 1.0, shadow, shadowIntensity );\n\t}\n#endif",shadowmap_pars_vertex:"#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowIntensity;\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif",shadowmap_vertex:"#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\tvec4 shadowWorldPosition;\n#endif\n#if defined( USE_SHADOWMAP )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n#endif",shadowmask_pars_fragment:"float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}",skinbase_vertex:"#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif",skinning_pars_vertex:"#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif",skinning_vertex:"#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif",skinnormal_vertex:"#ifdef USE_SKINNING\n\tmat4 skinMatrix = mat4( 0.0 );\n\tskinMatrix += skinWeight.x * boneMatX;\n\tskinMatrix += skinWeight.y * boneMatY;\n\tskinMatrix += skinWeight.z * boneMatZ;\n\tskinMatrix += skinWeight.w * boneMatW;\n\tskinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;\n\tobjectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;\n\t#ifdef USE_TANGENT\n\t\tobjectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#endif\n#endif",specularmap_fragment:"float specularStrength;\n#ifdef USE_SPECULARMAP\n\tvec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );\n\tspecularStrength = texelSpecular.r;\n#else\n\tspecularStrength = 1.0;\n#endif",specularmap_pars_fragment:"#ifdef USE_SPECULARMAP\n\tuniform sampler2D specularMap;\n#endif",tonemapping_fragment:"#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif",tonemapping_pars_fragment:"#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 CineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tconst float StartCompression = 0.8 - 0.04;\n\tconst float Desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min( color.r, min( color.g, color.b ) );\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max( color.r, max( color.g, color.b ) );\n\tif ( peak < StartCompression ) return color;\n\tfloat d = 1. - StartCompression;\n\tfloat newPeak = 1. - d * d / ( peak + d - StartCompression );\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );\n\treturn mix( color, vec3( newPeak ), g );\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }",transmission_fragment:"#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif",transmission_pars_fragment:"#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tfloat w0( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );\n\t}\n\tfloat w1( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 );\n\t}\n\tfloat w2( float a ){\n\t\treturn ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );\n\t}\n\tfloat w3( float a ) {\n\t\treturn ( 1.0 / 6.0 ) * ( a * a * a );\n\t}\n\tfloat g0( float a ) {\n\t\treturn w0( a ) + w1( a );\n\t}\n\tfloat g1( float a ) {\n\t\treturn w2( a ) + w3( a );\n\t}\n\tfloat h0( float a ) {\n\t\treturn - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );\n\t}\n\tfloat h1( float a ) {\n\t\treturn 1.0 + w3( a ) / ( w2( a ) + w3( a ) );\n\t}\n\tvec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {\n\t\tuv = uv * texelSize.zw + 0.5;\n\t\tvec2 iuv = floor( uv );\n\t\tvec2 fuv = fract( uv );\n\t\tfloat g0x = g0( fuv.x );\n\t\tfloat g1x = g1( fuv.x );\n\t\tfloat h0x = h0( fuv.x );\n\t\tfloat h1x = h1( fuv.x );\n\t\tfloat h0y = h0( fuv.y );\n\t\tfloat h1y = h1( fuv.y );\n\t\tvec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\tvec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;\n\t\treturn g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +\n\t\t\tg1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );\n\t}\n\tvec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {\n\t\tvec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );\n\t\tvec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );\n\t\tvec2 fLodSizeInv = 1.0 / fLodSize;\n\t\tvec2 cLodSizeInv = 1.0 / cLodSize;\n\t\tvec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );\n\t\tvec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );\n\t\treturn mix( fSample, cSample, fract( lod ) );\n\t}\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\treturn textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );\n\t}\n\tvec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn vec3( 1.0 );\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec4 transmittedLight;\n\t\tvec3 transmittance;\n\t\t#ifdef USE_DISPERSION\n\t\t\tfloat halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;\n\t\t\tvec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );\n\t\t\tfor ( int i = 0; i < 3; i ++ ) {\n\t\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );\n\t\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\t\trefractionCoords += 1.0;\n\t\t\t\trefractionCoords /= 2.0;\n\t\t\t\tvec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );\n\t\t\t\ttransmittedLight[ i ] = transmissionSample[ i ];\n\t\t\t\ttransmittedLight.a += transmissionSample.a;\n\t\t\t\ttransmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];\n\t\t\t}\n\t\t\ttransmittedLight.a /= 3.0;\n\t\t#else\n\t\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\t\trefractionCoords += 1.0;\n\t\t\trefractionCoords /= 2.0;\n\t\t\ttransmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\t\ttransmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\t#endif\n\t\tvec3 attenuatedColor = transmittance * transmittedLight.rgb;\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\tfloat transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );\n\t}\n#endif",uv_pars_fragment:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_pars_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvarying vec2 vUv;\n#endif\n#ifdef USE_MAP\n\tuniform mat3 mapTransform;\n\tvarying vec2 vMapUv;\n#endif\n#ifdef USE_ALPHAMAP\n\tuniform mat3 alphaMapTransform;\n\tvarying vec2 vAlphaMapUv;\n#endif\n#ifdef USE_LIGHTMAP\n\tuniform mat3 lightMapTransform;\n\tvarying vec2 vLightMapUv;\n#endif\n#ifdef USE_AOMAP\n\tuniform mat3 aoMapTransform;\n\tvarying vec2 vAoMapUv;\n#endif\n#ifdef USE_BUMPMAP\n\tuniform mat3 bumpMapTransform;\n\tvarying vec2 vBumpMapUv;\n#endif\n#ifdef USE_NORMALMAP\n\tuniform mat3 normalMapTransform;\n\tvarying vec2 vNormalMapUv;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tuniform mat3 displacementMapTransform;\n\tvarying vec2 vDisplacementMapUv;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tuniform mat3 emissiveMapTransform;\n\tvarying vec2 vEmissiveMapUv;\n#endif\n#ifdef USE_METALNESSMAP\n\tuniform mat3 metalnessMapTransform;\n\tvarying vec2 vMetalnessMapUv;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tuniform mat3 roughnessMapTransform;\n\tvarying vec2 vRoughnessMapUv;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tuniform mat3 anisotropyMapTransform;\n\tvarying vec2 vAnisotropyMapUv;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tuniform mat3 clearcoatMapTransform;\n\tvarying vec2 vClearcoatMapUv;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tuniform mat3 clearcoatNormalMapTransform;\n\tvarying vec2 vClearcoatNormalMapUv;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tuniform mat3 clearcoatRoughnessMapTransform;\n\tvarying vec2 vClearcoatRoughnessMapUv;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tuniform mat3 sheenColorMapTransform;\n\tvarying vec2 vSheenColorMapUv;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tuniform mat3 sheenRoughnessMapTransform;\n\tvarying vec2 vSheenRoughnessMapUv;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tuniform mat3 iridescenceMapTransform;\n\tvarying vec2 vIridescenceMapUv;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform mat3 iridescenceThicknessMapTransform;\n\tvarying vec2 vIridescenceThicknessMapUv;\n#endif\n#ifdef USE_SPECULARMAP\n\tuniform mat3 specularMapTransform;\n\tvarying vec2 vSpecularMapUv;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tuniform mat3 specularColorMapTransform;\n\tvarying vec2 vSpecularColorMapUv;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tuniform mat3 specularIntensityMapTransform;\n\tvarying vec2 vSpecularIntensityMapUv;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tuniform mat3 transmissionMapTransform;\n\tvarying vec2 vTransmissionMapUv;\n#endif\n#ifdef USE_THICKNESSMAP\n\tuniform mat3 thicknessMapTransform;\n\tvarying vec2 vThicknessMapUv;\n#endif",uv_vertex:"#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif",worldpos_vertex:"#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif",background_vert:"varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}",background_frag:"uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",backgroundCube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",backgroundCube_frag:"#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",cube_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}",cube_frag:"uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",depth_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}",depth_frag:"#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#elif DEPTH_PACKING == 3202\n\t\tgl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );\n\t#elif DEPTH_PACKING == 3203\n\t\tgl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );\n\t#endif\n}",distanceRGBA_vert:"#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}",distanceRGBA_frag:"#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}",equirect_vert:"varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}",equirect_frag:"uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}",linedashed_vert:"uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",linedashed_frag:"uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",meshbasic_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}",meshbasic_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshlambert_vert:"#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshlambert_frag:"#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshmatcap_vert:"#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}",meshmatcap_frag:"#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshnormal_vert:"#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}",meshnormal_frag:"#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}",meshphong_vert:"#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshphong_frag:"#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshphysical_vert:"#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}",meshphysical_frag:"#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_DISPERSION\n\tuniform float dispersion;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",meshtoon_vert:"#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",meshtoon_frag:"#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}",points_vert:"uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}",points_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}",shadow_vert:"#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}",shadow_frag:"uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}",sprite_vert:"uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix[ 3 ];\n\tvec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}",sprite_frag:"uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}"},pn={common:{diffuse:{value:new o.Ilk(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new o.Vkp},alphaMap:{value:null},alphaMapTransform:{value:new o.Vkp},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new o.Vkp}},envmap:{envMap:{value:null},envMapRotation:{value:new o.Vkp},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new o.Vkp}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new o.Vkp}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new o.Vkp},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new o.Vkp},normalScale:{value:new o.FM8(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new o.Vkp},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new o.Vkp}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new o.Vkp}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new o.Vkp}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new o.Ilk(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new o.Ilk(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new o.Vkp},alphaTest:{value:0},uvTransform:{value:new o.Vkp}},sprite:{diffuse:{value:new o.Ilk(16777215)},opacity:{value:1},center:{value:new o.FM8(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new o.Vkp},alphaMap:{value:null},alphaMapTransform:{value:new o.Vkp},alphaTest:{value:0}}},gn={basic:{uniforms:(0,o.Rhp)([pn.common,pn.specularmap,pn.envmap,pn.aomap,pn.lightmap,pn.fog]),vertexShader:hn.meshbasic_vert,fragmentShader:hn.meshbasic_frag},lambert:{uniforms:(0,o.Rhp)([pn.common,pn.specularmap,pn.envmap,pn.aomap,pn.lightmap,pn.emissivemap,pn.bumpmap,pn.normalmap,pn.displacementmap,pn.fog,pn.lights,{emissive:{value:new o.Ilk(0)}}]),vertexShader:hn.meshlambert_vert,fragmentShader:hn.meshlambert_frag},phong:{uniforms:(0,o.Rhp)([pn.common,pn.specularmap,pn.envmap,pn.aomap,pn.lightmap,pn.emissivemap,pn.bumpmap,pn.normalmap,pn.displacementmap,pn.fog,pn.lights,{emissive:{value:new o.Ilk(0)},specular:{value:new o.Ilk(1118481)},shininess:{value:30}}]),vertexShader:hn.meshphong_vert,fragmentShader:hn.meshphong_frag},standard:{uniforms:(0,o.Rhp)([pn.common,pn.envmap,pn.aomap,pn.lightmap,pn.emissivemap,pn.bumpmap,pn.normalmap,pn.displacementmap,pn.roughnessmap,pn.metalnessmap,pn.fog,pn.lights,{emissive:{value:new o.Ilk(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:hn.meshphysical_vert,fragmentShader:hn.meshphysical_frag},toon:{uniforms:(0,o.Rhp)([pn.common,pn.aomap,pn.lightmap,pn.emissivemap,pn.bumpmap,pn.normalmap,pn.displacementmap,pn.gradientmap,pn.fog,pn.lights,{emissive:{value:new o.Ilk(0)}}]),vertexShader:hn.meshtoon_vert,fragmentShader:hn.meshtoon_frag},matcap:{uniforms:(0,o.Rhp)([pn.common,pn.bumpmap,pn.normalmap,pn.displacementmap,pn.fog,{matcap:{value:null}}]),vertexShader:hn.meshmatcap_vert,fragmentShader:hn.meshmatcap_frag},points:{uniforms:(0,o.Rhp)([pn.points,pn.fog]),vertexShader:hn.points_vert,fragmentShader:hn.points_frag},dashed:{uniforms:(0,o.Rhp)([pn.common,pn.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:hn.linedashed_vert,fragmentShader:hn.linedashed_frag},depth:{uniforms:(0,o.Rhp)([pn.common,pn.displacementmap]),vertexShader:hn.depth_vert,fragmentShader:hn.depth_frag},normal:{uniforms:(0,o.Rhp)([pn.common,pn.bumpmap,pn.normalmap,pn.displacementmap,{opacity:{value:1}}]),vertexShader:hn.meshnormal_vert,fragmentShader:hn.meshnormal_frag},sprite:{uniforms:(0,o.Rhp)([pn.sprite,pn.fog]),vertexShader:hn.sprite_vert,fragmentShader:hn.sprite_frag},background:{uniforms:{uvTransform:{value:new o.Vkp},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:hn.background_vert,fragmentShader:hn.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new o.Vkp}},vertexShader:hn.backgroundCube_vert,fragmentShader:hn.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:hn.cube_vert,fragmentShader:hn.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:hn.equirect_vert,fragmentShader:hn.equirect_frag},distanceRGBA:{uniforms:(0,o.Rhp)([pn.common,pn.displacementmap,{referencePosition:{value:new o.Pa4},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:hn.distanceRGBA_vert,fragmentShader:hn.distanceRGBA_frag},shadow:{uniforms:(0,o.Rhp)([pn.lights,pn.fog,{color:{value:new o.Ilk(0)},opacity:{value:1}}]),vertexShader:hn.shadow_vert,fragmentShader:hn.shadow_frag}};gn.physical={uniforms:(0,o.Rhp)([gn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new o.Vkp},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new o.Vkp},clearcoatNormalScale:{value:new o.FM8(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new o.Vkp},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new o.Vkp},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new o.Vkp},sheen:{value:0},sheenColor:{value:new o.Ilk(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new o.Vkp},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new o.Vkp},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new o.Vkp},transmissionSamplerSize:{value:new o.FM8},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new o.Vkp},attenuationDistance:{value:0},attenuationColor:{value:new o.Ilk(0)},specularColor:{value:new o.Ilk(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new o.Vkp},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new o.Vkp},anisotropyVector:{value:new o.FM8},anisotropyMap:{value:null},anisotropyMapTransform:{value:new o.Vkp}}]),vertexShader:hn.meshphysical_vert,fragmentShader:hn.meshphysical_frag};const mn={r:0,b:0,g:0},fn=new o.USm,En=new o.yGw;function WebGLBackground(e,t,r,s,l,c,A){const d=new o.Ilk(0);let h,p,g=!0===c?0:1,m=null,f=0,E=null;function getBackground(e){let s=!0===e.isScene?e.background:null;if(s&&s.isTexture){s=(e.backgroundBlurriness>0?r:t).get(s)}return s}function setClear(t,r){t.getRGB(mn,(0,o.oDz)(e)),s.buffers.color.setClear(mn.r,mn.g,mn.b,r,A)}return{getClearColor:function(){return d},setClearColor:function(e,t=1){d.set(e),g=t,setClear(d,g)},getClearAlpha:function(){return g},setClearAlpha:function(e){g=e,setClear(d,g)},render:function render(t){let r=!1;const o=getBackground(t);null===o?setClear(d,g):o&&o.isColor&&(setClear(o,1),r=!0);const l=e.xr.getEnvironmentBlendMode();"additive"===l?s.buffers.color.setClear(0,0,0,1,A):"alpha-blend"===l&&s.buffers.color.setClear(0,0,0,0,A),(e.autoClear||r)&&(s.buffers.depth.setTest(!0),s.buffers.depth.setMask(!0),s.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))},addToRenderList:function addToRenderList(t,r){const s=getBackground(r);s&&(s.isCubeTexture||s.mapping===o.g8_)?(void 0===p&&(p=new o.Kj0(new o.DvJ(1,1,1),new o.jyz({name:"BackgroundCubeMaterial",uniforms:(0,o.dwf)(gn.backgroundCube.uniforms),vertexShader:gn.backgroundCube.vertexShader,fragmentShader:gn.backgroundCube.fragmentShader,side:o._Li,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),p.geometry.deleteAttribute("normal"),p.geometry.deleteAttribute("uv"),p.onBeforeRender=function(e,t,r){this.matrixWorld.copyPosition(r.matrixWorld)},Object.defineProperty(p.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),l.update(p)),fn.copy(r.backgroundRotation),fn.x*=-1,fn.y*=-1,fn.z*=-1,s.isCubeTexture&&!1===s.isRenderTargetTexture&&(fn.y*=-1,fn.z*=-1),p.material.uniforms.envMap.value=s,p.material.uniforms.flipEnvMap.value=s.isCubeTexture&&!1===s.isRenderTargetTexture?-1:1,p.material.uniforms.backgroundBlurriness.value=r.backgroundBlurriness,p.material.uniforms.backgroundIntensity.value=r.backgroundIntensity,p.material.uniforms.backgroundRotation.value.setFromMatrix4(En.makeRotationFromEuler(fn)),p.material.toneMapped=o.epp.getTransfer(s.colorSpace)!==o.j17,m===s&&f===s.version&&E===e.toneMapping||(p.material.needsUpdate=!0,m=s,f=s.version,E=e.toneMapping),p.layers.enableAll(),t.unshift(p,p.geometry,p.material,0,0,null)):s&&s.isTexture&&(void 0===h&&(h=new o.Kj0(new o._12(2,2),new o.jyz({name:"BackgroundMaterial",uniforms:(0,o.dwf)(gn.background.uniforms),vertexShader:gn.background.vertexShader,fragmentShader:gn.background.fragmentShader,side:o.Wl3,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),h.geometry.deleteAttribute("normal"),Object.defineProperty(h.material,"map",{get:function(){return this.uniforms.t2D.value}}),l.update(h)),h.material.uniforms.t2D.value=s,h.material.uniforms.backgroundIntensity.value=r.backgroundIntensity,h.material.toneMapped=o.epp.getTransfer(s.colorSpace)!==o.j17,!0===s.matrixAutoUpdate&&s.updateMatrix(),h.material.uniforms.uvTransform.value.copy(s.matrix),m===s&&f===s.version&&E===e.toneMapping||(h.material.needsUpdate=!0,m=s,f=s.version,E=e.toneMapping),h.layers.enableAll(),t.unshift(h,h.geometry,h.material,0,0,null))},dispose:function dispose(){void 0!==p&&(p.geometry.dispose(),p.material.dispose(),p=void 0),void 0!==h&&(h.geometry.dispose(),h.material.dispose(),h=void 0)}}}function WebGLBindingStates(e,t){const r=e.getParameter(e.MAX_VERTEX_ATTRIBS),s={},l=createBindingState(null);let c=l,A=!1;function bindVertexArrayObject(t){return e.bindVertexArray(t)}function deleteVertexArrayObject(t){return e.deleteVertexArray(t)}function createBindingState(e){const t=[],s=[],o=[];for(let e=0;e<r;e++)t[e]=0,s[e]=0,o[e]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:t,enabledAttributes:s,attributeDivisors:o,object:e,attributes:{},index:null}}function initAttributes(){const e=c.newAttributes;for(let t=0,r=e.length;t<r;t++)e[t]=0}function enableAttribute(e){enableAttributeAndDivisor(e,0)}function enableAttributeAndDivisor(t,r){const s=c.newAttributes,o=c.enabledAttributes,l=c.attributeDivisors;s[t]=1,0===o[t]&&(e.enableVertexAttribArray(t),o[t]=1),l[t]!==r&&(e.vertexAttribDivisor(t,r),l[t]=r)}function disableUnusedAttributes(){const t=c.newAttributes,r=c.enabledAttributes;for(let s=0,o=r.length;s<o;s++)r[s]!==t[s]&&(e.disableVertexAttribArray(s),r[s]=0)}function vertexAttribPointer(t,r,s,o,l,c,A){!0===A?e.vertexAttribIPointer(t,r,s,l,c):e.vertexAttribPointer(t,r,s,o,l,c)}function reset(){resetDefaultState(),A=!0,c!==l&&(c=l,bindVertexArrayObject(c.object))}function resetDefaultState(){l.geometry=null,l.program=null,l.wireframe=!1}return{setup:function setup(r,l,d,h,p){let g=!1;const m=function getBindingState(t,r,o){const l=!0===o.wireframe;let c=s[t.id];void 0===c&&(c={},s[t.id]=c);let A=c[r.id];void 0===A&&(A={},c[r.id]=A);let d=A[l];void 0===d&&(d=createBindingState(function createVertexArrayObject(){return e.createVertexArray()}()),A[l]=d);return d}(h,d,l);c!==m&&(c=m,bindVertexArrayObject(c.object)),g=function needsUpdate(e,t,r,s){const o=c.attributes,l=t.attributes;let A=0;const d=r.getAttributes();for(const t in d){if(d[t].location>=0){const r=o[t];let s=l[t];if(void 0===s&&("instanceMatrix"===t&&e.instanceMatrix&&(s=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(s=e.instanceColor)),void 0===r)return!0;if(r.attribute!==s)return!0;if(s&&r.data!==s.data)return!0;A++}}return c.attributesNum!==A||c.index!==s}(r,h,d,p),g&&function saveCache(e,t,r,s){const o={},l=t.attributes;let A=0;const d=r.getAttributes();for(const t in d){if(d[t].location>=0){let r=l[t];void 0===r&&("instanceMatrix"===t&&e.instanceMatrix&&(r=e.instanceMatrix),"instanceColor"===t&&e.instanceColor&&(r=e.instanceColor));const s={};s.attribute=r,r&&r.data&&(s.data=r.data),o[t]=s,A++}}c.attributes=o,c.attributesNum=A,c.index=s}(r,h,d,p),null!==p&&t.update(p,e.ELEMENT_ARRAY_BUFFER),(g||A)&&(A=!1,function setupVertexAttributes(r,s,l,c){initAttributes();const A=c.attributes,d=l.getAttributes(),h=s.defaultAttributeValues;for(const s in d){const l=d[s];if(l.location>=0){let d=A[s];if(void 0===d&&("instanceMatrix"===s&&r.instanceMatrix&&(d=r.instanceMatrix),"instanceColor"===s&&r.instanceColor&&(d=r.instanceColor)),void 0!==d){const s=d.normalized,A=d.itemSize,h=t.get(d);if(void 0===h)continue;const p=h.buffer,g=h.type,m=h.bytesPerElement,f=g===e.INT||g===e.UNSIGNED_INT||d.gpuType===o.Kz5;if(d.isInterleavedBufferAttribute){const t=d.data,o=t.stride,h=d.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e<l.locationSize;e++)enableAttributeAndDivisor(l.location+e,t.meshPerAttribute);!0!==r.isInstancedMesh&&void 0===c._maxInstanceCount&&(c._maxInstanceCount=t.meshPerAttribute*t.count)}else for(let e=0;e<l.locationSize;e++)enableAttribute(l.location+e);e.bindBuffer(e.ARRAY_BUFFER,p);for(let e=0;e<l.locationSize;e++)vertexAttribPointer(l.location+e,A/l.locationSize,g,s,o*m,(h+A/l.locationSize*e)*m,f)}else{if(d.isInstancedBufferAttribute){for(let e=0;e<l.locationSize;e++)enableAttributeAndDivisor(l.location+e,d.meshPerAttribute);!0!==r.isInstancedMesh&&void 0===c._maxInstanceCount&&(c._maxInstanceCount=d.meshPerAttribute*d.count)}else for(let e=0;e<l.locationSize;e++)enableAttribute(l.location+e);e.bindBuffer(e.ARRAY_BUFFER,p);for(let e=0;e<l.locationSize;e++)vertexAttribPointer(l.location+e,A/l.locationSize,g,s,A*m,A/l.locationSize*e*m,f)}}else if(void 0!==h){const t=h[s];if(void 0!==t)switch(t.length){case 2:e.vertexAttrib2fv(l.location,t);break;case 3:e.vertexAttrib3fv(l.location,t);break;case 4:e.vertexAttrib4fv(l.location,t);break;default:e.vertexAttrib1fv(l.location,t)}}}}disableUnusedAttributes()}(r,l,d,h),null!==p&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(p).buffer))},reset,resetDefaultState,dispose:function dispose(){reset();for(const e in s){const t=s[e];for(const e in t){const r=t[e];for(const e in r)deleteVertexArrayObject(r[e].object),delete r[e];delete t[e]}delete s[e]}},releaseStatesOfGeometry:function releaseStatesOfGeometry(e){if(void 0===s[e.id])return;const t=s[e.id];for(const e in t){const r=t[e];for(const e in r)deleteVertexArrayObject(r[e].object),delete r[e];delete t[e]}delete s[e.id]},releaseStatesOfProgram:function releaseStatesOfProgram(e){for(const t in s){const r=s[t];if(void 0===r[e.id])continue;const o=r[e.id];for(const e in o)deleteVertexArrayObject(o[e].object),delete o[e];delete r[e.id]}},initAttributes,enableAttribute,disableUnusedAttributes}}function WebGLBufferRenderer(e,t,r){let s;function renderInstances(t,o,l){0!==l&&(e.drawArraysInstanced(s,t,o,l),r.update(o,s,l))}this.setMode=function setMode(e){s=e},this.render=function render(t,o){e.drawArrays(s,t,o),r.update(o,s,1)},this.renderInstances=renderInstances,this.renderMultiDraw=function renderMultiDraw(e,o,l){if(0===l)return;t.get("WEBGL_multi_draw").multiDrawArraysWEBGL(s,e,0,o,0,l);let c=0;for(let e=0;e<l;e++)c+=o[e];r.update(c,s,1)},this.renderMultiDrawInstances=function renderMultiDrawInstances(e,o,l,c){if(0===l)return;const A=t.get("WEBGL_multi_draw");if(null===A)for(let t=0;t<e.length;t++)renderInstances(e[t],o[t],c[t]);else{A.multiDrawArraysInstancedWEBGL(s,e,0,o,0,c,0,l);let t=0;for(let e=0;e<l;e++)t+=o[e]*c[e];r.update(t,s,1)}}}function WebGLCapabilities(e,t,r,s){let l;function getMaxPrecision(t){if("highp"===t){if(e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return"highp";t="mediump"}return"mediump"===t&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=void 0!==r.precision?r.precision:"highp";const A=getMaxPrecision(c);A!==c&&(un.warn("THREE.WebGLRenderer:",c,"not supported, using",A,"instead."),c=A);const d=!0===r.logarithmicDepthBuffer,h=!0===r.reverseDepthBuffer&&t.has("EXT_clip_control"),p=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),g=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS);return{isWebGL2:!0,getMaxAnisotropy:function getMaxAnisotropy(){if(void 0!==l)return l;if(!0===t.has("EXT_texture_filter_anisotropic")){const r=t.get("EXT_texture_filter_anisotropic");l=e.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else l=0;return l},getMaxPrecision,textureFormatReadable:function textureFormatReadable(t){return t===o.wk1||s.convert(t)===e.getParameter(e.IMPLEMENTATION_COLOR_READ_FORMAT)},textureTypeReadable:function textureTypeReadable(r){const l=r===o.cLu&&(t.has("EXT_color_buffer_half_float")||t.has("EXT_color_buffer_float"));return!(r!==o.ywz&&s.convert(r)!==e.getParameter(e.IMPLEMENTATION_COLOR_READ_TYPE)&&r!==o.VzW&&!l)},precision:c,logarithmicDepthBuffer:d,reverseDepthBuffer:h,maxTextures:p,maxVertexTextures:g,maxTextureSize:e.getParameter(e.MAX_TEXTURE_SIZE),maxCubemapSize:e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),maxAttributes:e.getParameter(e.MAX_VERTEX_ATTRIBS),maxVertexUniforms:e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),maxVaryings:e.getParameter(e.MAX_VARYING_VECTORS),maxFragmentUniforms:e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),vertexTextures:g>0,maxSamples:e.getParameter(e.MAX_SAMPLES)}}function WebGLClipping(e){const t=this;let r=null,s=0,l=!1,c=!1;const A=new o.JOQ,d=new o.Vkp,h={value:null,needsUpdate:!1};function projectPlanes(e,r,s,o){const l=null!==e?e.length:0;let c=null;if(0!==l){if(c=h.value,!0!==o||null===c){const t=s+4*l,o=r.matrixWorldInverse;d.getNormalMatrix(o),(null===c||c.length<t)&&(c=new Float32Array(t));for(let t=0,r=s;t!==l;++t,r+=4)A.copy(e[t]).applyMatrix4(o,d),A.normal.toArray(c,r),c[r+3]=A.constant}h.value=c,h.needsUpdate=!0}return t.numPlanes=l,t.numIntersection=0,c}this.uniform=h,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t){const r=0!==e.length||t||0!==s||l;return l=t,s=e.length,r},this.beginShadows=function(){c=!0,projectPlanes(null)},this.endShadows=function(){c=!1},this.setGlobalState=function(e,t){r=projectPlanes(e,t,0)},this.setState=function(o,A,d){const p=o.clippingPlanes,g=o.clipIntersection,m=o.clipShadows,f=e.get(o);if(!l||null===p||0===p.length||c&&!m)c?projectPlanes(null):function resetGlobalState(){h.value!==r&&(h.value=r,h.needsUpdate=s>0);t.numPlanes=s,t.numIntersection=0}();else{const e=c?0:s,t=4*e;let o=f.clippingState||null;h.value=o,o=projectPlanes(p,A,t,d);for(let e=0;e!==t;++e)o[e]=r[e];f.clippingState=o,this.numIntersection=g?this.numPlanes:0,this.numPlanes+=e}}}function WebGLCubeMaps(e){let t=new WeakMap;function mapTextureMapping(e,t){return t===o.dSO?e.mapping=o.fY$:t===o.Bf4&&(e.mapping=o.vxC),e}function onTextureDispose(e){const r=e.target;r.removeEventListener("dispose",onTextureDispose);const s=t.get(r);void 0!==s&&(t.delete(r),s.dispose())}return{get:function get(r){if(r&&r.isTexture){const s=r.mapping;if(s===o.dSO||s===o.Bf4){if(t.has(r)){return mapTextureMapping(t.get(r).texture,r.mapping)}{const s=r.image;if(s&&s.height>0){const l=new o.oAp(s.height);return l.fromEquirectangularTexture(e,r),t.set(r,l),r.addEventListener("dispose",onTextureDispose),mapTextureMapping(l.texture,r.mapping)}return null}}}return r},dispose:function dispose(){t=new WeakMap}}}const vn=[.125,.215,.35,.446,.526,.582],_n=20,Cn=new o.iKG,In=new o.Ilk;let Sn=null,xn=0,Tn=0,yn=!1;const Mn=(1+Math.sqrt(5))/2,wn=1/Mn,bn=[new o.Pa4(-Mn,wn,0),new o.Pa4(Mn,wn,0),new o.Pa4(-wn,0,Mn),new o.Pa4(wn,0,Mn),new o.Pa4(0,Mn,-wn),new o.Pa4(0,Mn,wn),new o.Pa4(-1,1,-1),new o.Pa4(1,1,-1),new o.Pa4(-1,1,1),new o.Pa4(1,1,1)],Bn=new o.Pa4;class PMREMGenerator{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,r=.1,s=100,o={}){const{size:l=256,position:c=Bn}=o;Sn=this._renderer.getRenderTarget(),xn=this._renderer.getActiveCubeFace(),Tn=this._renderer.getActiveMipmapLevel(),yn=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(l);const A=this._allocateTargets();return A.depthBuffer=!0,this._sceneToCubeUV(e,r,s,A,c),t>0&&this._blur(A,0,0,t),this._applyPMREM(A),this._cleanup(A),A}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){null===this._cubemapMaterial&&(this._cubemapMaterial=_getCubemapMaterial(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){null===this._equirectMaterial&&(this._equirectMaterial=_getEquirectMaterial(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),null!==this._cubemapMaterial&&this._cubemapMaterial.dispose(),null!==this._equirectMaterial&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){null!==this._blurMaterial&&this._blurMaterial.dispose(),null!==this._pingPongRenderTarget&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodPlanes.length;e++)this._lodPlanes[e].dispose()}_cleanup(e){this._renderer.setRenderTarget(Sn,xn,Tn),this._renderer.xr.enabled=yn,e.scissorTest=!1,_setViewport(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===o.fY$||e.mapping===o.vxC?this._setSize(0===e.image.length?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Sn=this._renderer.getRenderTarget(),xn=this._renderer.getActiveCubeFace(),Tn=this._renderer.getActiveMipmapLevel(),yn=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const r=t||this._allocateTargets();return this._textureToCubeUV(e,r),this._applyPMREM(r),this._cleanup(r),r}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,r={magFilter:o.wem,minFilter:o.wem,generateMipmaps:!1,type:o.cLu,format:o.wk1,colorSpace:o.GUF,depthBuffer:!1},s=_createRenderTarget(e,t,r);if(null===this._pingPongRenderTarget||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){null!==this._pingPongRenderTarget&&this._dispose(),this._pingPongRenderTarget=_createRenderTarget(e,t,r);const{_lodMax:s}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=function _createPlanes(e){const t=[],r=[],s=[];let l=e;const c=e-4+1+vn.length;for(let A=0;A<c;A++){const c=Math.pow(2,l);r.push(c);let d=1/c;A>e-4?d=vn[A-e+4-1]:0===A&&(d=0),s.push(d);const h=1/(c-2),p=-h,g=1+h,m=[p,p,g,p,g,g,p,p,g,g,p,g],f=6,E=6,_=3,C=2,I=1,S=new Float32Array(_*E*f),x=new Float32Array(C*E*f),T=new Float32Array(I*E*f);for(let e=0;e<f;e++){const t=e%3*2/3-1,r=e>2?0:-1,s=[t,r,0,t+2/3,r,0,t+2/3,r+1,0,t,r,0,t+2/3,r+1,0,t,r+1,0];S.set(s,_*E*e),x.set(m,C*E*e);const o=[e,e,e,e,e,e];T.set(o,I*E*e)}const y=new o.u9r;y.setAttribute("position",new o.TlE(S,_)),y.setAttribute("uv",new o.TlE(x,C)),y.setAttribute("faceIndex",new o.TlE(T,I)),t.push(y),l>4&&l--}return{lodPlanes:t,sizeLods:r,sigmas:s}}(s)),this._blurMaterial=function _getBlurShader(e,t,r){const s=new Float32Array(_n),l=new o.Pa4(0,1,0);return new o.jyz({name:"SphericalGaussianBlur",defines:{n:_n,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/r,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:s},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:l}},vertexShader:_getCommonVertexShader(),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:o.jFi,depthTest:!1,depthWrite:!1})}(s,e,t)}return s}_compileMaterial(e){const t=new o.Kj0(this._lodPlanes[0],e);this._renderer.compile(t,Cn)}_sceneToCubeUV(e,t,r,s,l){const c=new o.cPb(90,1,t,r),A=[1,-1,1,1,1,1],d=[1,1,1,-1,-1,-1],h=this._renderer,p=h.autoClear,g=h.toneMapping;h.getClearColor(In),h.toneMapping=o.uL9,h.autoClear=!1;const m=new o.vBJ({name:"PMREM.Background",side:o._Li,depthWrite:!1,depthTest:!1}),f=new o.Kj0(new o.DvJ,m);let E=!1;const _=e.background;_?_.isColor&&(m.color.copy(_),e.background=null,E=!0):(m.color.copy(In),E=!0);for(let t=0;t<6;t++){const r=t%3;0===r?(c.up.set(0,A[t],0),c.position.set(l.x,l.y,l.z),c.lookAt(l.x+d[t],l.y,l.z)):1===r?(c.up.set(0,0,A[t]),c.position.set(l.x,l.y,l.z),c.lookAt(l.x,l.y+d[t],l.z)):(c.up.set(0,A[t],0),c.position.set(l.x,l.y,l.z),c.lookAt(l.x,l.y,l.z+d[t]));const o=this._cubeSize;_setViewport(s,r*o,t>2?o:0,o,o),h.setRenderTarget(s),E&&h.render(f,c),h.render(e,c)}f.geometry.dispose(),f.material.dispose(),h.toneMapping=g,h.autoClear=p,e.background=_}_textureToCubeUV(e,t){const r=this._renderer,s=e.mapping===o.fY$||e.mapping===o.vxC;s?(null===this._cubemapMaterial&&(this._cubemapMaterial=_getCubemapMaterial()),this._cubemapMaterial.uniforms.flipEnvMap.value=!1===e.isRenderTargetTexture?-1:1):null===this._equirectMaterial&&(this._equirectMaterial=_getEquirectMaterial());const l=s?this._cubemapMaterial:this._equirectMaterial,c=new o.Kj0(this._lodPlanes[0],l);l.uniforms.envMap.value=e;const A=this._cubeSize;_setViewport(t,0,0,3*A,2*A),r.setRenderTarget(t),r.render(c,Cn)}_applyPMREM(e){const t=this._renderer,r=t.autoClear;t.autoClear=!1;const s=this._lodPlanes.length;for(let t=1;t<s;t++){const r=Math.sqrt(this._sigmas[t]*this._sigmas[t]-this._sigmas[t-1]*this._sigmas[t-1]),o=bn[(s-t-1)%bn.length];this._blur(e,t-1,t,r,o)}t.autoClear=r}_blur(e,t,r,s,o){const l=this._pingPongRenderTarget;this._halfBlur(e,l,t,r,s,"latitudinal",o),this._halfBlur(l,e,r,r,s,"longitudinal",o)}_halfBlur(e,t,r,s,l,c,A){const d=this._renderer,h=this._blurMaterial;"latitudinal"!==c&&"longitudinal"!==c&&un.error("blur direction must be either latitudinal or longitudinal!");const p=new o.Kj0(this._lodPlanes[s],h),g=h.uniforms,m=this._sizeLods[r]-1,f=isFinite(l)?Math.PI/(2*m):2*Math.PI/39,E=l/f,_=isFinite(l)?1+Math.floor(3*E):_n;_>_n&&un.warn(`sigmaRadians, ${l}, is too large and will clip, as it requested ${_} samples when the maximum is set to 20`);const C=[];let I=0;for(let e=0;e<_n;++e){const t=e/E,r=Math.exp(-t*t/2);C.push(r),0===e?I+=r:e<_&&(I+=2*r)}for(let e=0;e<C.length;e++)C[e]=C[e]/I;g.envMap.value=e.texture,g.samples.value=_,g.weights.value=C,g.latitudinal.value="latitudinal"===c,A&&(g.poleAxis.value=A);const{_lodMax:S}=this;g.dTheta.value=f,g.mipInt.value=S-r;const x=this._sizeLods[s];_setViewport(t,3*x*(s>S-4?s-S+4:0),4*(this._cubeSize-x),3*x,2*x),d.setRenderTarget(t),d.render(p,Cn)}}function _createRenderTarget(e,t,r){const s=new o.dd2(e,t,r);return s.texture.mapping=o.g8_,s.texture.name="PMREM.cubeUv",s.scissorTest=!0,s}function _setViewport(e,t,r,s,o){e.viewport.set(t,r,s,o),e.scissor.set(t,r,s,o)}function _getEquirectMaterial(){return new o.jyz({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:_getCommonVertexShader(),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:o.jFi,depthTest:!1,depthWrite:!1})}function _getCubemapMaterial(){return new o.jyz({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:_getCommonVertexShader(),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:o.jFi,depthTest:!1,depthWrite:!1})}function _getCommonVertexShader(){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"}function WebGLCubeUVMaps(e){let t=new WeakMap,r=null;function onTextureDispose(e){const r=e.target;r.removeEventListener("dispose",onTextureDispose);const s=t.get(r);void 0!==s&&(t.delete(r),s.dispose())}return{get:function get(s){if(s&&s.isTexture){const l=s.mapping,c=l===o.dSO||l===o.Bf4,A=l===o.fY$||l===o.vxC;if(c||A){let o=t.get(s);const l=void 0!==o?o.texture.pmremVersion:0;if(s.isRenderTargetTexture&&s.pmremVersion!==l)return null===r&&(r=new PMREMGenerator(e)),o=c?r.fromEquirectangular(s,o):r.fromCubemap(s,o),o.texture.pmremVersion=s.pmremVersion,t.set(s,o),o.texture;if(void 0!==o)return o.texture;{const l=s.image;return c&&l&&l.height>0||A&&l&&function isCubeTextureComplete(e){let t=0;const r=6;for(let s=0;s<r;s++)void 0!==e[s]&&t++;return t===r}(l)?(null===r&&(r=new PMREMGenerator(e)),o=c?r.fromEquirectangular(s):r.fromCubemap(s),o.texture.pmremVersion=s.pmremVersion,t.set(s,o),s.addEventListener("dispose",onTextureDispose),o.texture):null}}}return s},dispose:function dispose(){t=new WeakMap,null!==r&&(r.dispose(),r=null)}}}function WebGLExtensions(e){const t={};function getExtension(r){if(void 0!==t[r])return t[r];let s;switch(r){case"WEBGL_depth_texture":s=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":s=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":s=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":s=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:s=e.getExtension(r)}return t[r]=s,s}return{has:function(e){return null!==getExtension(e)},init:function(){getExtension("EXT_color_buffer_float"),getExtension("WEBGL_clip_cull_distance"),getExtension("OES_texture_float_linear"),getExtension("EXT_color_buffer_half_float"),getExtension("WEBGL_multisampled_render_to_texture"),getExtension("WEBGL_render_shared_exponent")},get:function(e){const t=getExtension(e);return null===t&&(0,o.O4K)("THREE.WebGLRenderer: "+e+" extension not supported."),t}}}function WebGLGeometries(e,t,r,s){const l={},c=new WeakMap;function onGeometryDispose(e){const o=e.target;null!==o.index&&t.remove(o.index);for(const e in o.attributes)t.remove(o.attributes[e]);o.removeEventListener("dispose",onGeometryDispose),delete l[o.id];const A=c.get(o);A&&(t.remove(A),c.delete(o)),s.releaseStatesOfGeometry(o),!0===o.isInstancedBufferGeometry&&delete o._maxInstanceCount,r.memory.geometries--}function updateWireframeAttribute(e){const r=[],s=e.index,l=e.attributes.position;let A=0;if(null!==s){const e=s.array;A=s.version;for(let t=0,s=e.length;t<s;t+=3){const s=e[t+0],o=e[t+1],l=e[t+2];r.push(s,o,o,l,l,s)}}else{if(void 0===l)return;{const e=l.array;A=l.version;for(let t=0,s=e.length/3-1;t<s;t+=3){const e=t+0,s=t+1,o=t+2;r.push(e,s,s,o,o,e)}}}const d=new((0,o.H7L)(r)?o.lCJ:o.qlB)(r,1);d.version=A;const h=c.get(e);h&&t.remove(h),c.set(e,d)}return{get:function get(e,t){return!0===l[t.id]||(t.addEventListener("dispose",onGeometryDispose),l[t.id]=!0,r.memory.geometries++),t},update:function update(r){const s=r.attributes;for(const r in s)t.update(s[r],e.ARRAY_BUFFER)},getWireframeAttribute:function getWireframeAttribute(e){const t=c.get(e);if(t){const r=e.index;null!==r&&t.version<r.version&&updateWireframeAttribute(e)}else updateWireframeAttribute(e);return c.get(e)}}}function WebGLIndexedBufferRenderer(e,t,r){let s,o,l;function renderInstances(t,c,A){0!==A&&(e.drawElementsInstanced(s,c,o,t*l,A),r.update(c,s,A))}this.setMode=function setMode(e){s=e},this.setIndex=function setIndex(e){o=e.type,l=e.bytesPerElement},this.render=function render(t,c){e.drawElements(s,c,o,t*l),r.update(c,s,1)},this.renderInstances=renderInstances,this.renderMultiDraw=function renderMultiDraw(e,l,c){if(0===c)return;t.get("WEBGL_multi_draw").multiDrawElementsWEBGL(s,l,0,o,e,0,c);let A=0;for(let e=0;e<c;e++)A+=l[e];r.update(A,s,1)},this.renderMultiDrawInstances=function renderMultiDrawInstances(e,c,A,d){if(0===A)return;const h=t.get("WEBGL_multi_draw");if(null===h)for(let t=0;t<e.length;t++)renderInstances(e[t]/l,c[t],d[t]);else{h.multiDrawElementsInstancedWEBGL(s,c,0,o,e,0,d,0,A);let t=0;for(let e=0;e<A;e++)t+=c[e]*d[e];r.update(t,s,1)}}}function WebGLInfo(e){const t={frame:0,calls:0,triangles:0,points:0,lines:0};return{memory:{geometries:0,textures:0},render:t,programs:null,autoReset:!0,reset:function reset(){t.calls=0,t.triangles=0,t.points=0,t.lines=0},update:function update(r,s,o){switch(t.calls++,s){case e.TRIANGLES:t.triangles+=o*(r/3);break;case e.LINES:t.lines+=o*(r/2);break;case e.LINE_STRIP:t.lines+=o*(r-1);break;case e.LINE_LOOP:t.lines+=o*r;break;case e.POINTS:t.points+=o*r;break;default:un.error("THREE.WebGLInfo: Unknown draw mode:",s)}}}}function WebGLMorphtargets(e,t,r){const s=new WeakMap,l=new o.Ltg;return{update:function update(c,A,d){const h=c.morphTargetInfluences,p=A.morphAttributes.position||A.morphAttributes.normal||A.morphAttributes.color,g=void 0!==p?p.length:0;let m=s.get(A);if(void 0===m||m.count!==g){void 0!==m&&m.texture.dispose();const e=void 0!==A.morphAttributes.position,r=void 0!==A.morphAttributes.normal,c=void 0!==A.morphAttributes.color,d=A.morphAttributes.position||[],h=A.morphAttributes.normal||[],p=A.morphAttributes.color||[];let f=0;!0===e&&(f=1),!0===r&&(f=2),!0===c&&(f=3);let E=A.attributes.position.count*f,_=1;E>t.maxTextureSize&&(_=Math.ceil(E/t.maxTextureSize),E=t.maxTextureSize);const C=new Float32Array(E*_*4*g),I=new o.p3g(C,E,_,g);I.type=o.VzW,I.needsUpdate=!0;const S=4*f;for(let t=0;t<g;t++){const s=d[t],o=h[t],A=p[t],g=E*_*4*t;for(let t=0;t<s.count;t++){const d=t*S;!0===e&&(l.fromBufferAttribute(s,t),C[g+d+0]=l.x,C[g+d+1]=l.y,C[g+d+2]=l.z,C[g+d+3]=0),!0===r&&(l.fromBufferAttribute(o,t),C[g+d+4]=l.x,C[g+d+5]=l.y,C[g+d+6]=l.z,C[g+d+7]=0),!0===c&&(l.fromBufferAttribute(A,t),C[g+d+8]=l.x,C[g+d+9]=l.y,C[g+d+10]=l.z,C[g+d+11]=4===A.itemSize?l.w:1)}}function disposeTexture(){I.dispose(),s.delete(A),A.removeEventListener("dispose",disposeTexture)}m={count:g,texture:I,size:new o.FM8(E,_)},s.set(A,m),A.addEventListener("dispose",disposeTexture)}if(!0===c.isInstancedMesh&&null!==c.morphTexture)d.getUniforms().setValue(e,"morphTexture",c.morphTexture,r);else{let t=0;for(let e=0;e<h.length;e++)t+=h[e];const r=A.morphTargetsRelative?1:1-t;d.getUniforms().setValue(e,"morphTargetBaseInfluence",r),d.getUniforms().setValue(e,"morphTargetInfluences",h)}d.getUniforms().setValue(e,"morphTargetsTexture",m.texture,r),d.getUniforms().setValue(e,"morphTargetsTextureSize",m.size)}}}function WebGLObjects(e,t,r,s){let o=new WeakMap;function onInstancedMeshDispose(e){const t=e.target;t.removeEventListener("dispose",onInstancedMeshDispose),r.remove(t.instanceMatrix),null!==t.instanceColor&&r.remove(t.instanceColor)}return{update:function update(l){const c=s.render.frame,A=l.geometry,d=t.get(l,A);if(o.get(d)!==c&&(t.update(d),o.set(d,c)),l.isInstancedMesh&&(!1===l.hasEventListener("dispose",onInstancedMeshDispose)&&l.addEventListener("dispose",onInstancedMeshDispose),o.get(l)!==c&&(r.update(l.instanceMatrix,e.ARRAY_BUFFER),null!==l.instanceColor&&r.update(l.instanceColor,e.ARRAY_BUFFER),o.set(l,c))),l.isSkinnedMesh){const e=l.skeleton;o.get(e)!==c&&(e.update(),o.set(e,c))}return d},dispose:function dispose(){o=new WeakMap}}}const Rn=new o.xEZ,Ln=new o.$YQ(1,1),Dn=new o.p3g,Un=new o.JUT,Pn=new o.BtG,Fn=[],Qn=[],Nn=new Float32Array(16),On=new Float32Array(9),Gn=new Float32Array(4);function flatten(e,t,r){const s=e[0];if(s<=0||s>0)return e;const o=t*r;let l=Fn[o];if(void 0===l&&(l=new Float32Array(o),Fn[o]=l),0!==t){s.toArray(l,0);for(let s=1,o=0;s!==t;++s)o+=r,e[s].toArray(l,o)}return l}function arraysEqual(e,t){if(e.length!==t.length)return!1;for(let r=0,s=e.length;r<s;r++)if(e[r]!==t[r])return!1;return!0}function copyArray(e,t){for(let r=0,s=t.length;r<s;r++)e[r]=t[r]}function allocTexUnits(e,t){let r=Qn[t];void 0===r&&(r=new Int32Array(t),Qn[t]=r);for(let s=0;s!==t;++s)r[s]=e.allocateTextureUnit();return r}function setValueV1f(e,t){const r=this.cache;r[0]!==t&&(e.uniform1f(this.addr,t),r[0]=t)}function setValueV2f(e,t){const r=this.cache;if(void 0!==t.x)r[0]===t.x&&r[1]===t.y||(e.uniform2f(this.addr,t.x,t.y),r[0]=t.x,r[1]=t.y);else{if(arraysEqual(r,t))return;e.uniform2fv(this.addr,t),copyArray(r,t)}}function setValueV3f(e,t){const r=this.cache;if(void 0!==t.x)r[0]===t.x&&r[1]===t.y&&r[2]===t.z||(e.uniform3f(this.addr,t.x,t.y,t.z),r[0]=t.x,r[1]=t.y,r[2]=t.z);else if(void 0!==t.r)r[0]===t.r&&r[1]===t.g&&r[2]===t.b||(e.uniform3f(this.addr,t.r,t.g,t.b),r[0]=t.r,r[1]=t.g,r[2]=t.b);else{if(arraysEqual(r,t))return;e.uniform3fv(this.addr,t),copyArray(r,t)}}function setValueV4f(e,t){const r=this.cache;if(void 0!==t.x)r[0]===t.x&&r[1]===t.y&&r[2]===t.z&&r[3]===t.w||(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),r[0]=t.x,r[1]=t.y,r[2]=t.z,r[3]=t.w);else{if(arraysEqual(r,t))return;e.uniform4fv(this.addr,t),copyArray(r,t)}}function setValueM2(e,t){const r=this.cache,s=t.elements;if(void 0===s){if(arraysEqual(r,t))return;e.uniformMatrix2fv(this.addr,!1,t),copyArray(r,t)}else{if(arraysEqual(r,s))return;Gn.set(s),e.uniformMatrix2fv(this.addr,!1,Gn),copyArray(r,s)}}function setValueM3(e,t){const r=this.cache,s=t.elements;if(void 0===s){if(arraysEqual(r,t))return;e.uniformMatrix3fv(this.addr,!1,t),copyArray(r,t)}else{if(arraysEqual(r,s))return;On.set(s),e.uniformMatrix3fv(this.addr,!1,On),copyArray(r,s)}}function setValueM4(e,t){const r=this.cache,s=t.elements;if(void 0===s){if(arraysEqual(r,t))return;e.uniformMatrix4fv(this.addr,!1,t),copyArray(r,t)}else{if(arraysEqual(r,s))return;Nn.set(s),e.uniformMatrix4fv(this.addr,!1,Nn),copyArray(r,s)}}function setValueV1i(e,t){const r=this.cache;r[0]!==t&&(e.uniform1i(this.addr,t),r[0]=t)}function setValueV2i(e,t){const r=this.cache;if(void 0!==t.x)r[0]===t.x&&r[1]===t.y||(e.uniform2i(this.addr,t.x,t.y),r[0]=t.x,r[1]=t.y);else{if(arraysEqual(r,t))return;e.uniform2iv(this.addr,t),copyArray(r,t)}}function setValueV3i(e,t){const r=this.cache;if(void 0!==t.x)r[0]===t.x&&r[1]===t.y&&r[2]===t.z||(e.uniform3i(this.addr,t.x,t.y,t.z),r[0]=t.x,r[1]=t.y,r[2]=t.z);else{if(arraysEqual(r,t))return;e.uniform3iv(this.addr,t),copyArray(r,t)}}function setValueV4i(e,t){const r=this.cache;if(void 0!==t.x)r[0]===t.x&&r[1]===t.y&&r[2]===t.z&&r[3]===t.w||(e.uniform4i(this.addr,t.x,t.y,t.z,t.w),r[0]=t.x,r[1]=t.y,r[2]=t.z,r[3]=t.w);else{if(arraysEqual(r,t))return;e.uniform4iv(this.addr,t),copyArray(r,t)}}function setValueV1ui(e,t){const r=this.cache;r[0]!==t&&(e.uniform1ui(this.addr,t),r[0]=t)}function setValueV2ui(e,t){const r=this.cache;if(void 0!==t.x)r[0]===t.x&&r[1]===t.y||(e.uniform2ui(this.addr,t.x,t.y),r[0]=t.x,r[1]=t.y);else{if(arraysEqual(r,t))return;e.uniform2uiv(this.addr,t),copyArray(r,t)}}function setValueV3ui(e,t){const r=this.cache;if(void 0!==t.x)r[0]===t.x&&r[1]===t.y&&r[2]===t.z||(e.uniform3ui(this.addr,t.x,t.y,t.z),r[0]=t.x,r[1]=t.y,r[2]=t.z);else{if(arraysEqual(r,t))return;e.uniform3uiv(this.addr,t),copyArray(r,t)}}function setValueV4ui(e,t){const r=this.cache;if(void 0!==t.x)r[0]===t.x&&r[1]===t.y&&r[2]===t.z&&r[3]===t.w||(e.uniform4ui(this.addr,t.x,t.y,t.z,t.w),r[0]=t.x,r[1]=t.y,r[2]=t.z,r[3]=t.w);else{if(arraysEqual(r,t))return;e.uniform4uiv(this.addr,t),copyArray(r,t)}}function setValueT1(e,t,r){const s=this.cache,l=r.allocateTextureUnit();let c;s[0]!==l&&(e.uniform1i(this.addr,l),s[0]=l),this.type===e.SAMPLER_2D_SHADOW?(Ln.compareFunction=o.M$G,c=Ln):c=Rn,r.setTexture2D(t||c,l)}function setValueT3D1(e,t,r){const s=this.cache,o=r.allocateTextureUnit();s[0]!==o&&(e.uniform1i(this.addr,o),s[0]=o),r.setTexture3D(t||Un,o)}function setValueT6(e,t,r){const s=this.cache,o=r.allocateTextureUnit();s[0]!==o&&(e.uniform1i(this.addr,o),s[0]=o),r.setTextureCube(t||Pn,o)}function setValueT2DArray1(e,t,r){const s=this.cache,o=r.allocateTextureUnit();s[0]!==o&&(e.uniform1i(this.addr,o),s[0]=o),r.setTexture2DArray(t||Dn,o)}function setValueV1fArray(e,t){e.uniform1fv(this.addr,t)}function setValueV2fArray(e,t){const r=flatten(t,this.size,2);e.uniform2fv(this.addr,r)}function setValueV3fArray(e,t){const r=flatten(t,this.size,3);e.uniform3fv(this.addr,r)}function setValueV4fArray(e,t){const r=flatten(t,this.size,4);e.uniform4fv(this.addr,r)}function setValueM2Array(e,t){const r=flatten(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,r)}function setValueM3Array(e,t){const r=flatten(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,r)}function setValueM4Array(e,t){const r=flatten(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,r)}function setValueV1iArray(e,t){e.uniform1iv(this.addr,t)}function setValueV2iArray(e,t){e.uniform2iv(this.addr,t)}function setValueV3iArray(e,t){e.uniform3iv(this.addr,t)}function setValueV4iArray(e,t){e.uniform4iv(this.addr,t)}function setValueV1uiArray(e,t){e.uniform1uiv(this.addr,t)}function setValueV2uiArray(e,t){e.uniform2uiv(this.addr,t)}function setValueV3uiArray(e,t){e.uniform3uiv(this.addr,t)}function setValueV4uiArray(e,t){e.uniform4uiv(this.addr,t)}function setValueT1Array(e,t,r){const s=this.cache,o=t.length,l=allocTexUnits(r,o);arraysEqual(s,l)||(e.uniform1iv(this.addr,l),copyArray(s,l));for(let e=0;e!==o;++e)r.setTexture2D(t[e]||Rn,l[e])}function setValueT3DArray(e,t,r){const s=this.cache,o=t.length,l=allocTexUnits(r,o);arraysEqual(s,l)||(e.uniform1iv(this.addr,l),copyArray(s,l));for(let e=0;e!==o;++e)r.setTexture3D(t[e]||Un,l[e])}function setValueT6Array(e,t,r){const s=this.cache,o=t.length,l=allocTexUnits(r,o);arraysEqual(s,l)||(e.uniform1iv(this.addr,l),copyArray(s,l));for(let e=0;e!==o;++e)r.setTextureCube(t[e]||Pn,l[e])}function setValueT2DArrayArray(e,t,r){const s=this.cache,o=t.length,l=allocTexUnits(r,o);arraysEqual(s,l)||(e.uniform1iv(this.addr,l),copyArray(s,l));for(let e=0;e!==o;++e)r.setTexture2DArray(t[e]||Dn,l[e])}class SingleUniform{constructor(e,t,r){this.id=e,this.addr=r,this.cache=[],this.type=t.type,this.setValue=function getSingularSetter(e){switch(e){case 5126:return setValueV1f;case 35664:return setValueV2f;case 35665:return setValueV3f;case 35666:return setValueV4f;case 35674:return setValueM2;case 35675:return setValueM3;case 35676:return setValueM4;case 5124:case 35670:return setValueV1i;case 35667:case 35671:return setValueV2i;case 35668:case 35672:return setValueV3i;case 35669:case 35673:return setValueV4i;case 5125:return setValueV1ui;case 36294:return setValueV2ui;case 36295:return setValueV3ui;case 36296:return setValueV4ui;case 35678:case 36198:case 36298:case 36306:case 35682:return setValueT1;case 35679:case 36299:case 36307:return setValueT3D1;case 35680:case 36300:case 36308:case 36293:return setValueT6;case 36289:case 36303:case 36311:case 36292:return setValueT2DArray1}}(t.type)}}class PureArrayUniform{constructor(e,t,r){this.id=e,this.addr=r,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=function getPureArraySetter(e){switch(e){case 5126:return setValueV1fArray;case 35664:return setValueV2fArray;case 35665:return setValueV3fArray;case 35666:return setValueV4fArray;case 35674:return setValueM2Array;case 35675:return setValueM3Array;case 35676:return setValueM4Array;case 5124:case 35670:return setValueV1iArray;case 35667:case 35671:return setValueV2iArray;case 35668:case 35672:return setValueV3iArray;case 35669:case 35673:return setValueV4iArray;case 5125:return setValueV1uiArray;case 36294:return setValueV2uiArray;case 36295:return setValueV3uiArray;case 36296:return setValueV4uiArray;case 35678:case 36198:case 36298:case 36306:case 35682:return setValueT1Array;case 35679:case 36299:case 36307:return setValueT3DArray;case 35680:case 36300:case 36308:case 36293:return setValueT6Array;case 36289:case 36303:case 36311:case 36292:return setValueT2DArrayArray}}(t.type)}}class StructuredUniform{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,r){const s=this.seq;for(let o=0,l=s.length;o!==l;++o){const l=s[o];l.setValue(e,t[l.id],r)}}}const kn=/(\w+)(\])?(\[|\.)?/g;function addUniform(e,t){e.seq.push(t),e.map[t.id]=t}function parseUniform(e,t,r){const s=e.name,o=s.length;for(kn.lastIndex=0;;){const l=kn.exec(s),c=kn.lastIndex;let A=l[1];const d="]"===l[2],h=l[3];if(d&&(A|=0),void 0===h||"["===h&&c+2===o){addUniform(r,void 0===h?new SingleUniform(A,e,t):new PureArrayUniform(A,e,t));break}{let e=r.map[A];void 0===e&&(e=new StructuredUniform(A),addUniform(r,e)),r=e}}}class WebGLUniforms{constructor(e,t){this.seq=[],this.map={};const r=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let s=0;s<r;++s){const r=e.getActiveUniform(t,s);parseUniform(r,e.getUniformLocation(t,r.name),this)}}setValue(e,t,r,s){const o=this.map[t];void 0!==o&&o.setValue(e,r,s)}setOptional(e,t,r){const s=t[r];void 0!==s&&this.setValue(e,r,s)}static upload(e,t,r,s){for(let o=0,l=t.length;o!==l;++o){const l=t[o],c=r[l.id];!1!==c.needsUpdate&&l.setValue(e,c.value,s)}}static seqWithValue(e,t){const r=[];for(let s=0,o=e.length;s!==o;++s){const o=e[s];o.id in t&&r.push(o)}return r}}function WebGLShader(e,t,r){const s=e.createShader(t);return e.shaderSource(s,r),e.compileShader(s),s}let Hn=0;const Vn=new o.Vkp;function getShaderErrors(e,t,r){const s=e.getShaderParameter(t,e.COMPILE_STATUS),o=e.getShaderInfoLog(t).trim();if(s&&""===o)return"";const l=/ERROR: 0:(\d+)/.exec(o);if(l){const s=parseInt(l[1]);return r.toUpperCase()+"\n\n"+o+"\n\n"+function handleSource(e,t){const r=e.split("\n"),s=[],o=Math.max(t-6,0),l=Math.min(t+6,r.length);for(let e=o;e<l;e++){const o=e+1;s.push(`${o===t?">":" "} ${o}: ${r[e]}`)}return s.join("\n")}(e.getShaderSource(t),s)}return o}function getTexelEncodingFunction(e,t){const r=function getEncodingComponents(e){o.epp._getMatrix(Vn,o.epp.workingColorSpace,e);const t=`mat3( ${Vn.elements.map((e=>e.toFixed(4)))} )`;switch(o.epp.getTransfer(e)){case o.l6D:return[t,"LinearTransferOETF"];case o.j17:return[t,"sRGBTransferOETF"];default:return un.warn("THREE.WebGLProgram: Unsupported color space: ",e),[t,"LinearTransferOETF"]}}(t);return[`vec4 ${e}( vec4 value ) {`,`\treturn ${r[1]}( vec4( value.rgb * ${r[0]}, value.a ) );`,"}"].join("\n")}function getToneMappingFunction(e,t){let r;switch(t){case o.EoG:r="Linear";break;case o.CdI:r="Reinhard";break;case o.YGz:r="Cineon";break;case o.LY2:r="ACESFilmic";break;case o.Bgp:r="AgX";break;case o.ORg:r="Neutral";break;case o.dZ3:r="Custom";break;default:un.warn("THREE.WebGLProgram: Unsupported toneMapping:",t),r="Linear"}return"vec3 "+e+"( vec3 color ) { return "+r+"ToneMapping( color ); }"}const zn=new o.Pa4;function getLuminanceFunction(){o.epp.getLuminanceCoefficients(zn);return["float luminance( const in vec3 rgb ) {",`\tconst vec3 weights = vec3( ${zn.x.toFixed(4)}, ${zn.y.toFixed(4)}, ${zn.z.toFixed(4)} );`,"\treturn dot( weights, rgb );","}"].join("\n")}function filterEmptyLine(e){return""!==e}function replaceLightNums(e,t){const r=t.numSpotLightShadows+t.numSpotLightMaps-t.numSpotLightShadowsWithMaps;return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,t.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,r).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,t.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,t.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,t.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,t.numPointLightShadows)}function replaceClippingPlaneNums(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}const Wn=/^[ \t]*#include +<([\w\d./]+)>/gm;function resolveIncludes(e){return e.replace(Wn,includeReplacer)}const qn=new Map;function includeReplacer(e,t){let r=hn[t];if(void 0===r){const e=qn.get(t);if(void 0===e)throw new Error("Can not resolve #include <"+t+">");r=hn[e],un.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',t,e)}return resolveIncludes(r)}const Xn=/#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 unrollLoops(e){return e.replace(Xn,loopReplacer)}function loopReplacer(e,t,r,s){let o="";for(let e=parseInt(t);e<parseInt(r);e++)o+=s.replace(/\[\s*i\s*\]/g,"[ "+e+" ]").replace(/UNROLLED_LOOP_INDEX/g,e);return o}function generatePrecision(e){let t=`precision ${e.precision} float;\n\tprecision ${e.precision} int;\n\tprecision ${e.precision} sampler2D;\n\tprecision ${e.precision} samplerCube;\n\tprecision ${e.precision} sampler3D;\n\tprecision ${e.precision} sampler2DArray;\n\tprecision ${e.precision} sampler2DShadow;\n\tprecision ${e.precision} samplerCubeShadow;\n\tprecision ${e.precision} sampler2DArrayShadow;\n\tprecision ${e.precision} isampler2D;\n\tprecision ${e.precision} isampler3D;\n\tprecision ${e.precision} isamplerCube;\n\tprecision ${e.precision} isampler2DArray;\n\tprecision ${e.precision} usampler2D;\n\tprecision ${e.precision} usampler3D;\n\tprecision ${e.precision} usamplerCube;\n\tprecision ${e.precision} usampler2DArray;\n\t`;return"highp"===e.precision?t+="\n#define HIGH_PRECISION":"mediump"===e.precision?t+="\n#define MEDIUM_PRECISION":"lowp"===e.precision&&(t+="\n#define LOW_PRECISION"),t}function WebGLProgram(e,t,r,s){const l=e.getContext(),c=r.defines;let A=r.vertexShader,d=r.fragmentShader;const h=function generateShadowMapTypeDefine(e){let t="SHADOWMAP_TYPE_BASIC";return e.shadowMapType===o._iA?t="SHADOWMAP_TYPE_PCF":e.shadowMapType===o.ntZ?t="SHADOWMAP_TYPE_PCF_SOFT":e.shadowMapType===o.dwk&&(t="SHADOWMAP_TYPE_VSM"),t}(r),p=function generateEnvMapTypeDefine(e){let t="ENVMAP_TYPE_CUBE";if(e.envMap)switch(e.envMapMode){case o.fY$:case o.vxC:t="ENVMAP_TYPE_CUBE";break;case o.g8_:t="ENVMAP_TYPE_CUBE_UV"}return t}(r),g=function generateEnvMapModeDefine(e){let t="ENVMAP_MODE_REFLECTION";e.envMap&&e.envMapMode===o.vxC&&(t="ENVMAP_MODE_REFRACTION");return t}(r),m=function generateEnvMapBlendingDefine(e){let t="ENVMAP_BLENDING_NONE";if(e.envMap)switch(e.combine){case o.Ns1:t="ENVMAP_BLENDING_MULTIPLY";break;case o.qhX:t="ENVMAP_BLENDING_MIX";break;case o.NDo:t="ENVMAP_BLENDING_ADD"}return t}(r),f=function generateCubeUVSize(e){const t=e.envMapCubeUVHeight;if(null===t)return null;const r=Math.log2(t)-2,s=1/t;return{texelWidth:1/(3*Math.max(Math.pow(2,r),112)),texelHeight:s,maxMip:r}}(r),E=function generateVertexExtensions(e){return[e.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",e.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(filterEmptyLine).join("\n")}(r),_=function generateDefines(e){const t=[];for(const r in e){const s=e[r];!1!==s&&t.push("#define "+r+" "+s)}return t.join("\n")}(c),C=l.createProgram();let I,S,x=r.glslVersion?"#version "+r.glslVersion+"\n":"";r.isRawShaderMaterial?(I=["#define SHADER_TYPE "+r.shaderType,"#define SHADER_NAME "+r.shaderName,_].filter(filterEmptyLine).join("\n"),I.length>0&&(I+="\n"),S=["#define SHADER_TYPE "+r.shaderType,"#define SHADER_NAME "+r.shaderName,_].filter(filterEmptyLine).join("\n"),S.length>0&&(S+="\n")):(I=[generatePrecision(r),"#define SHADER_TYPE "+r.shaderType,"#define SHADER_NAME "+r.shaderName,_,r.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",r.batching?"#define USE_BATCHING":"",r.batchingColor?"#define USE_BATCHING_COLOR":"",r.instancing?"#define USE_INSTANCING":"",r.instancingColor?"#define USE_INSTANCING_COLOR":"",r.instancingMorph?"#define USE_INSTANCING_MORPH":"",r.useFog&&r.fog?"#define USE_FOG":"",r.useFog&&r.fogExp2?"#define FOG_EXP2":"",r.map?"#define USE_MAP":"",r.envMap?"#define USE_ENVMAP":"",r.envMap?"#define "+g:"",r.lightMap?"#define USE_LIGHTMAP":"",r.aoMap?"#define USE_AOMAP":"",r.bumpMap?"#define USE_BUMPMAP":"",r.normalMap?"#define USE_NORMALMAP":"",r.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",r.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",r.displacementMap?"#define USE_DISPLACEMENTMAP":"",r.emissiveMap?"#define USE_EMISSIVEMAP":"",r.anisotropy?"#define USE_ANISOTROPY":"",r.anisotropyMap?"#define USE_ANISOTROPYMAP":"",r.clearcoatMap?"#define USE_CLEARCOATMAP":"",r.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",r.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",r.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",r.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",r.specularMap?"#define USE_SPECULARMAP":"",r.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",r.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",r.roughnessMap?"#define USE_ROUGHNESSMAP":"",r.metalnessMap?"#define USE_METALNESSMAP":"",r.alphaMap?"#define USE_ALPHAMAP":"",r.alphaHash?"#define USE_ALPHAHASH":"",r.transmission?"#define USE_TRANSMISSION":"",r.transmissionMap?"#define USE_TRANSMISSIONMAP":"",r.thicknessMap?"#define USE_THICKNESSMAP":"",r.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",r.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",r.mapUv?"#define MAP_UV "+r.mapUv:"",r.alphaMapUv?"#define ALPHAMAP_UV "+r.alphaMapUv:"",r.lightMapUv?"#define LIGHTMAP_UV "+r.lightMapUv:"",r.aoMapUv?"#define AOMAP_UV "+r.aoMapUv:"",r.emissiveMapUv?"#define EMISSIVEMAP_UV "+r.emissiveMapUv:"",r.bumpMapUv?"#define BUMPMAP_UV "+r.bumpMapUv:"",r.normalMapUv?"#define NORMALMAP_UV "+r.normalMapUv:"",r.displacementMapUv?"#define DISPLACEMENTMAP_UV "+r.displacementMapUv:"",r.metalnessMapUv?"#define METALNESSMAP_UV "+r.metalnessMapUv:"",r.roughnessMapUv?"#define ROUGHNESSMAP_UV "+r.roughnessMapUv:"",r.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+r.anisotropyMapUv:"",r.clearcoatMapUv?"#define CLEARCOATMAP_UV "+r.clearcoatMapUv:"",r.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+r.clearcoatNormalMapUv:"",r.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+r.clearcoatRoughnessMapUv:"",r.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+r.iridescenceMapUv:"",r.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+r.iridescenceThicknessMapUv:"",r.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+r.sheenColorMapUv:"",r.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+r.sheenRoughnessMapUv:"",r.specularMapUv?"#define SPECULARMAP_UV "+r.specularMapUv:"",r.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+r.specularColorMapUv:"",r.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+r.specularIntensityMapUv:"",r.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+r.transmissionMapUv:"",r.thicknessMapUv?"#define THICKNESSMAP_UV "+r.thicknessMapUv:"",r.vertexTangents&&!1===r.flatShading?"#define USE_TANGENT":"",r.vertexColors?"#define USE_COLOR":"",r.vertexAlphas?"#define USE_COLOR_ALPHA":"",r.vertexUv1s?"#define USE_UV1":"",r.vertexUv2s?"#define USE_UV2":"",r.vertexUv3s?"#define USE_UV3":"",r.pointsUvs?"#define USE_POINTS_UV":"",r.flatShading?"#define FLAT_SHADED":"",r.skinning?"#define USE_SKINNING":"",r.morphTargets?"#define USE_MORPHTARGETS":"",r.morphNormals&&!1===r.flatShading?"#define USE_MORPHNORMALS":"",r.morphColors?"#define USE_MORPHCOLORS":"",r.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+r.morphTextureStride:"",r.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+r.morphTargetsCount:"",r.doubleSided?"#define DOUBLE_SIDED":"",r.flipSided?"#define FLIP_SIDED":"",r.shadowMapEnabled?"#define USE_SHADOWMAP":"",r.shadowMapEnabled?"#define "+h:"",r.sizeAttenuation?"#define USE_SIZEATTENUATION":"",r.numLightProbes>0?"#define USE_LIGHT_PROBES":"",r.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",r.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","\tattribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","\tattribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","\tuniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","\tattribute vec2 uv1;","#endif","#ifdef USE_UV2","\tattribute vec2 uv2;","#endif","#ifdef USE_UV3","\tattribute vec2 uv3;","#endif","#ifdef USE_TANGENT","\tattribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","\tattribute vec4 color;","#elif defined( USE_COLOR )","\tattribute vec3 color;","#endif","#ifdef USE_SKINNING","\tattribute vec4 skinIndex;","\tattribute vec4 skinWeight;","#endif","\n"].filter(filterEmptyLine).join("\n"),S=[generatePrecision(r),"#define SHADER_TYPE "+r.shaderType,"#define SHADER_NAME "+r.shaderName,_,r.useFog&&r.fog?"#define USE_FOG":"",r.useFog&&r.fogExp2?"#define FOG_EXP2":"",r.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",r.map?"#define USE_MAP":"",r.matcap?"#define USE_MATCAP":"",r.envMap?"#define USE_ENVMAP":"",r.envMap?"#define "+p:"",r.envMap?"#define "+g:"",r.envMap?"#define "+m:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.maxMip+".0":"",r.lightMap?"#define USE_LIGHTMAP":"",r.aoMap?"#define USE_AOMAP":"",r.bumpMap?"#define USE_BUMPMAP":"",r.normalMap?"#define USE_NORMALMAP":"",r.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",r.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",r.emissiveMap?"#define USE_EMISSIVEMAP":"",r.anisotropy?"#define USE_ANISOTROPY":"",r.anisotropyMap?"#define USE_ANISOTROPYMAP":"",r.clearcoat?"#define USE_CLEARCOAT":"",r.clearcoatMap?"#define USE_CLEARCOATMAP":"",r.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",r.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",r.dispersion?"#define USE_DISPERSION":"",r.iridescence?"#define USE_IRIDESCENCE":"",r.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",r.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",r.specularMap?"#define USE_SPECULARMAP":"",r.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",r.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",r.roughnessMap?"#define USE_ROUGHNESSMAP":"",r.metalnessMap?"#define USE_METALNESSMAP":"",r.alphaMap?"#define USE_ALPHAMAP":"",r.alphaTest?"#define USE_ALPHATEST":"",r.alphaHash?"#define USE_ALPHAHASH":"",r.sheen?"#define USE_SHEEN":"",r.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",r.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",r.transmission?"#define USE_TRANSMISSION":"",r.transmissionMap?"#define USE_TRANSMISSIONMAP":"",r.thicknessMap?"#define USE_THICKNESSMAP":"",r.vertexTangents&&!1===r.flatShading?"#define USE_TANGENT":"",r.vertexColors||r.instancingColor||r.batchingColor?"#define USE_COLOR":"",r.vertexAlphas?"#define USE_COLOR_ALPHA":"",r.vertexUv1s?"#define USE_UV1":"",r.vertexUv2s?"#define USE_UV2":"",r.vertexUv3s?"#define USE_UV3":"",r.pointsUvs?"#define USE_POINTS_UV":"",r.gradientMap?"#define USE_GRADIENTMAP":"",r.flatShading?"#define FLAT_SHADED":"",r.doubleSided?"#define DOUBLE_SIDED":"",r.flipSided?"#define FLIP_SIDED":"",r.shadowMapEnabled?"#define USE_SHADOWMAP":"",r.shadowMapEnabled?"#define "+h:"",r.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",r.numLightProbes>0?"#define USE_LIGHT_PROBES":"",r.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",r.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",r.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",r.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",r.toneMapping!==o.uL9?"#define TONE_MAPPING":"",r.toneMapping!==o.uL9?hn.tonemapping_pars_fragment:"",r.toneMapping!==o.uL9?getToneMappingFunction("toneMapping",r.toneMapping):"",r.dithering?"#define DITHERING":"",r.opaque?"#define OPAQUE":"",hn.colorspace_pars_fragment,getTexelEncodingFunction("linearToOutputTexel",r.outputColorSpace),getLuminanceFunction(),r.useDepthPacking?"#define DEPTH_PACKING "+r.depthPacking:"","\n"].filter(filterEmptyLine).join("\n")),A=resolveIncludes(A),A=replaceLightNums(A,r),A=replaceClippingPlaneNums(A,r),d=resolveIncludes(d),d=replaceLightNums(d,r),d=replaceClippingPlaneNums(d,r),A=unrollLoops(A),d=unrollLoops(d),!0!==r.isRawShaderMaterial&&(x="#version 300 es\n",I=[E,"#define attribute in","#define varying out","#define texture2D texture"].join("\n")+"\n"+I,S=["#define varying in",r.glslVersion===o.LSk?"":"layout(location = 0) out highp vec4 pc_fragColor;",r.glslVersion===o.LSk?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join("\n")+"\n"+S);const T=x+I+A,y=x+S+d,b=WebGLShader(l,l.VERTEX_SHADER,T),B=WebGLShader(l,l.FRAGMENT_SHADER,y);function onFirstUse(t){if(e.debug.checkShaderErrors){const r=l.getProgramInfoLog(C).trim(),s=l.getShaderInfoLog(b).trim(),o=l.getShaderInfoLog(B).trim();let c=!0,A=!0;if(!1===l.getProgramParameter(C,l.LINK_STATUS))if(c=!1,"function"==typeof e.debug.onShaderError)e.debug.onShaderError(l,C,b,B);else{const e=getShaderErrors(l,b,"vertex"),s=getShaderErrors(l,B,"fragment");un.error("THREE.WebGLProgram: Shader Error "+l.getError()+" - VALIDATE_STATUS "+l.getProgramParameter(C,l.VALIDATE_STATUS)+"\n\nMaterial Name: "+t.name+"\nMaterial Type: "+t.type+"\n\nProgram Info Log: "+r+"\n"+e+"\n"+s)}else""!==r?un.warn("THREE.WebGLProgram: Program Info Log:",r):""!==s&&""!==o||(A=!1);A&&(t.diagnostics={runnable:c,programLog:r,vertexShader:{log:s,prefix:I},fragmentShader:{log:o,prefix:S}})}l.deleteShader(b),l.deleteShader(B),U=new WebGLUniforms(l,C),F=function fetchAttributeLocations(e,t){const r={},s=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let o=0;o<s;o++){const s=e.getActiveAttrib(t,o),l=s.name;let c=1;s.type===e.FLOAT_MAT2&&(c=2),s.type===e.FLOAT_MAT3&&(c=3),s.type===e.FLOAT_MAT4&&(c=4),r[l]={type:s.type,location:e.getAttribLocation(t,l),locationSize:c}}return r}(l,C)}let U,F;l.attachShader(C,b),l.attachShader(C,B),void 0!==r.index0AttributeName?l.bindAttribLocation(C,0,r.index0AttributeName):!0===r.morphTargets&&l.bindAttribLocation(C,0,"position"),l.linkProgram(C),this.getUniforms=function(){return void 0===U&&onFirstUse(this),U},this.getAttributes=function(){return void 0===F&&onFirstUse(this),F};let Q=!1===r.rendererExtensionParallelShaderCompile;return this.isReady=function(){return!1===Q&&(Q=l.getProgramParameter(C,37297)),Q},this.destroy=function(){s.releaseStatesOfProgram(this),l.deleteProgram(C),this.program=void 0},this.type=r.shaderType,this.name=r.shaderName,this.id=Hn++,this.cacheKey=t,this.usedTimes=1,this.program=C,this.vertexShader=b,this.fragmentShader=B,this}let Kn=0;class WebGLShaderCache{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,r=e.fragmentShader,s=this._getShaderStage(t),o=this._getShaderStage(r),l=this._getShaderCacheForMaterial(e);return!1===l.has(s)&&(l.add(s),s.usedTimes++),!1===l.has(o)&&(l.add(o),o.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const e of t)e.usedTimes--,0===e.usedTimes&&this.shaderCache.delete(e.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let r=t.get(e);return void 0===r&&(r=new Set,t.set(e,r)),r}_getShaderStage(e){const t=this.shaderCache;let r=t.get(e);return void 0===r&&(r=new WebGLShaderStage(e),t.set(e,r)),r}}class WebGLShaderStage{constructor(e){this.id=Kn++,this.code=e,this.usedTimes=0}}function WebGLPrograms(e,t,r,s,l,c,A){const d=new o.S9g,h=new WebGLShaderCache,p=new Set,g=[],m=l.logarithmicDepthBuffer,f=l.vertexTextures;let E=l.precision;const _={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function getChannel(e){return p.add(e),0===e?"uv":`uv${e}`}return{getParameters:function getParameters(c,d,g,C,I){const S=C.fog,x=I.geometry,T=c.isMeshStandardMaterial?C.environment:null,y=(c.isMeshStandardMaterial?r:t).get(c.envMap||T),b=y&&y.mapping===o.g8_?y.image.height:null,B=_[c.type];null!==c.precision&&(E=l.getMaxPrecision(c.precision),E!==c.precision&&un.warn("THREE.WebGLProgram.getParameters:",c.precision,"not supported, using",E,"instead."));const U=x.morphAttributes.position||x.morphAttributes.normal||x.morphAttributes.color,F=void 0!==U?U.length:0;let Q,O,G,W,q=0;if(void 0!==x.morphAttributes.position&&(q=1),void 0!==x.morphAttributes.normal&&(q=2),void 0!==x.morphAttributes.color&&(q=3),B){const e=gn[B];Q=e.vertexShader,O=e.fragmentShader}else Q=c.vertexShader,O=c.fragmentShader,h.update(c),G=h.getVertexShaderID(c),W=h.getFragmentShaderID(c);const X=e.getRenderTarget(),K=e.state.buffers.depth.getReversed(),j=!0===I.isInstancedMesh,Y=!0===I.isBatchedMesh,J=!!c.map,$=!!c.matcap,ee=!!y,te=!!c.aoMap,ne=!!c.lightMap,ie=!!c.bumpMap,re=!!c.normalMap,ae=!!c.displacementMap,se=!!c.emissiveMap,oe=!!c.metalnessMap,le=!!c.roughnessMap,ce=c.anisotropy>0,Ae=c.clearcoat>0,de=c.dispersion>0,ue=c.iridescence>0,he=c.sheen>0,pe=c.transmission>0,ge=ce&&!!c.anisotropyMap,me=Ae&&!!c.clearcoatMap,fe=Ae&&!!c.clearcoatNormalMap,Ee=Ae&&!!c.clearcoatRoughnessMap,ve=ue&&!!c.iridescenceMap,_e=ue&&!!c.iridescenceThicknessMap,Ce=he&&!!c.sheenColorMap,Ie=he&&!!c.sheenRoughnessMap,Se=!!c.specularMap,xe=!!c.specularColorMap,Te=!!c.specularIntensityMap,ye=pe&&!!c.transmissionMap,Me=pe&&!!c.thicknessMap,we=!!c.gradientMap,be=!!c.alphaMap,Be=c.alphaTest>0,Re=!!c.alphaHash,Le=!!c.extensions;let De=o.uL9;c.toneMapped&&(null!==X&&!0!==X.isXRRenderTarget||(De=e.toneMapping));const Ue={shaderID:B,shaderType:c.type,shaderName:c.name,vertexShader:Q,fragmentShader:O,defines:c.defines,customVertexShaderID:G,customFragmentShaderID:W,isRawShaderMaterial:!0===c.isRawShaderMaterial,glslVersion:c.glslVersion,precision:E,batching:Y,batchingColor:Y&&null!==I._colorsTexture,instancing:j,instancingColor:j&&null!==I.instanceColor,instancingMorph:j&&null!==I.morphTexture,supportsVertexTextures:f,outputColorSpace:null===X?e.outputColorSpace:!0===X.isXRRenderTarget?X.texture.colorSpace:o.GUF,alphaToCoverage:!!c.alphaToCoverage,map:J,matcap:$,envMap:ee,envMapMode:ee&&y.mapping,envMapCubeUVHeight:b,aoMap:te,lightMap:ne,bumpMap:ie,normalMap:re,displacementMap:f&&ae,emissiveMap:se,normalMapObjectSpace:re&&c.normalMapType===o.PA7,normalMapTangentSpace:re&&c.normalMapType===o.IOt,metalnessMap:oe,roughnessMap:le,anisotropy:ce,anisotropyMap:ge,clearcoat:Ae,clearcoatMap:me,clearcoatNormalMap:fe,clearcoatRoughnessMap:Ee,dispersion:de,iridescence:ue,iridescenceMap:ve,iridescenceThicknessMap:_e,sheen:he,sheenColorMap:Ce,sheenRoughnessMap:Ie,specularMap:Se,specularColorMap:xe,specularIntensityMap:Te,transmission:pe,transmissionMap:ye,thicknessMap:Me,gradientMap:we,opaque:!1===c.transparent&&c.blending===o.bdR&&!1===c.alphaToCoverage,alphaMap:be,alphaTest:Be,alphaHash:Re,combine:c.combine,mapUv:J&&getChannel(c.map.channel),aoMapUv:te&&getChannel(c.aoMap.channel),lightMapUv:ne&&getChannel(c.lightMap.channel),bumpMapUv:ie&&getChannel(c.bumpMap.channel),normalMapUv:re&&getChannel(c.normalMap.channel),displacementMapUv:ae&&getChannel(c.displacementMap.channel),emissiveMapUv:se&&getChannel(c.emissiveMap.channel),metalnessMapUv:oe&&getChannel(c.metalnessMap.channel),roughnessMapUv:le&&getChannel(c.roughnessMap.channel),anisotropyMapUv:ge&&getChannel(c.anisotropyMap.channel),clearcoatMapUv:me&&getChannel(c.clearcoatMap.channel),clearcoatNormalMapUv:fe&&getChannel(c.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Ee&&getChannel(c.clearcoatRoughnessMap.channel),iridescenceMapUv:ve&&getChannel(c.iridescenceMap.channel),iridescenceThicknessMapUv:_e&&getChannel(c.iridescenceThicknessMap.channel),sheenColorMapUv:Ce&&getChannel(c.sheenColorMap.channel),sheenRoughnessMapUv:Ie&&getChannel(c.sheenRoughnessMap.channel),specularMapUv:Se&&getChannel(c.specularMap.channel),specularColorMapUv:xe&&getChannel(c.specularColorMap.channel),specularIntensityMapUv:Te&&getChannel(c.specularIntensityMap.channel),transmissionMapUv:ye&&getChannel(c.transmissionMap.channel),thicknessMapUv:Me&&getChannel(c.thicknessMap.channel),alphaMapUv:be&&getChannel(c.alphaMap.channel),vertexTangents:!!x.attributes.tangent&&(re||ce),vertexColors:c.vertexColors,vertexAlphas:!0===c.vertexColors&&!!x.attributes.color&&4===x.attributes.color.itemSize,pointsUvs:!0===I.isPoints&&!!x.attributes.uv&&(J||be),fog:!!S,useFog:!0===c.fog,fogExp2:!!S&&S.isFogExp2,flatShading:!0===c.flatShading,sizeAttenuation:!0===c.sizeAttenuation,logarithmicDepthBuffer:m,reverseDepthBuffer:K,skinning:!0===I.isSkinnedMesh,morphTargets:void 0!==x.morphAttributes.position,morphNormals:void 0!==x.morphAttributes.normal,morphColors:void 0!==x.morphAttributes.color,morphTargetsCount:F,morphTextureStride:q,numDirLights:d.directional.length,numPointLights:d.point.length,numSpotLights:d.spot.length,numSpotLightMaps:d.spotLightMap.length,numRectAreaLights:d.rectArea.length,numHemiLights:d.hemi.length,numDirLightShadows:d.directionalShadowMap.length,numPointLightShadows:d.pointShadowMap.length,numSpotLightShadows:d.spotShadowMap.length,numSpotLightShadowsWithMaps:d.numSpotLightShadowsWithMaps,numLightProbes:d.numLightProbes,numClippingPlanes:A.numPlanes,numClipIntersection:A.numIntersection,dithering:c.dithering,shadowMapEnabled:e.shadowMap.enabled&&g.length>0,shadowMapType:e.shadowMap.type,toneMapping:De,decodeVideoTexture:J&&!0===c.map.isVideoTexture&&o.epp.getTransfer(c.map.colorSpace)===o.j17,decodeVideoTextureEmissive:se&&!0===c.emissiveMap.isVideoTexture&&o.epp.getTransfer(c.emissiveMap.colorSpace)===o.j17,premultipliedAlpha:c.premultipliedAlpha,doubleSided:c.side===o.ehD,flipSided:c.side===o._Li,useDepthPacking:c.depthPacking>=0,depthPacking:c.depthPacking||0,index0AttributeName:c.index0AttributeName,extensionClipCullDistance:Le&&!0===c.extensions.clipCullDistance&&s.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(Le&&!0===c.extensions.multiDraw||Y)&&s.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:s.has("KHR_parallel_shader_compile"),customProgramCacheKey:c.customProgramCacheKey()};return Ue.vertexUv1s=p.has(1),Ue.vertexUv2s=p.has(2),Ue.vertexUv3s=p.has(3),p.clear(),Ue},getProgramCacheKey:function getProgramCacheKey(t){const r=[];if(t.shaderID?r.push(t.shaderID):(r.push(t.customVertexShaderID),r.push(t.customFragmentShaderID)),void 0!==t.defines)for(const e in t.defines)r.push(e),r.push(t.defines[e]);return!1===t.isRawShaderMaterial&&(!function getProgramCacheKeyParameters(e,t){e.push(t.precision),e.push(t.outputColorSpace),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.mapUv),e.push(t.alphaMapUv),e.push(t.lightMapUv),e.push(t.aoMapUv),e.push(t.bumpMapUv),e.push(t.normalMapUv),e.push(t.displacementMapUv),e.push(t.emissiveMapUv),e.push(t.metalnessMapUv),e.push(t.roughnessMapUv),e.push(t.anisotropyMapUv),e.push(t.clearcoatMapUv),e.push(t.clearcoatNormalMapUv),e.push(t.clearcoatRoughnessMapUv),e.push(t.iridescenceMapUv),e.push(t.iridescenceThicknessMapUv),e.push(t.sheenColorMapUv),e.push(t.sheenRoughnessMapUv),e.push(t.specularMapUv),e.push(t.specularColorMapUv),e.push(t.specularIntensityMapUv),e.push(t.transmissionMapUv),e.push(t.thicknessMapUv),e.push(t.combine),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numSpotLightMaps),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.numSpotLightShadowsWithMaps),e.push(t.numLightProbes),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}(r,t),function getProgramCacheKeyBooleans(e,t){d.disableAll(),t.supportsVertexTextures&&d.enable(0);t.instancing&&d.enable(1);t.instancingColor&&d.enable(2);t.instancingMorph&&d.enable(3);t.matcap&&d.enable(4);t.envMap&&d.enable(5);t.normalMapObjectSpace&&d.enable(6);t.normalMapTangentSpace&&d.enable(7);t.clearcoat&&d.enable(8);t.iridescence&&d.enable(9);t.alphaTest&&d.enable(10);t.vertexColors&&d.enable(11);t.vertexAlphas&&d.enable(12);t.vertexUv1s&&d.enable(13);t.vertexUv2s&&d.enable(14);t.vertexUv3s&&d.enable(15);t.vertexTangents&&d.enable(16);t.anisotropy&&d.enable(17);t.alphaHash&&d.enable(18);t.batching&&d.enable(19);t.dispersion&&d.enable(20);t.batchingColor&&d.enable(21);e.push(d.mask),d.disableAll(),t.fog&&d.enable(0);t.useFog&&d.enable(1);t.flatShading&&d.enable(2);t.logarithmicDepthBuffer&&d.enable(3);t.reverseDepthBuffer&&d.enable(4);t.skinning&&d.enable(5);t.morphTargets&&d.enable(6);t.morphNormals&&d.enable(7);t.morphColors&&d.enable(8);t.premultipliedAlpha&&d.enable(9);t.shadowMapEnabled&&d.enable(10);t.doubleSided&&d.enable(11);t.flipSided&&d.enable(12);t.useDepthPacking&&d.enable(13);t.dithering&&d.enable(14);t.transmission&&d.enable(15);t.sheen&&d.enable(16);t.opaque&&d.enable(17);t.pointsUvs&&d.enable(18);t.decodeVideoTexture&&d.enable(19);t.decodeVideoTextureEmissive&&d.enable(20);t.alphaToCoverage&&d.enable(21);e.push(d.mask)}(r,t),r.push(e.outputColorSpace)),r.push(t.customProgramCacheKey),r.join()},getUniforms:function getUniforms(e){const t=_[e.type];let r;if(t){const e=gn[t];r=o.rDY.clone(e.uniforms)}else r=e.uniforms;return r},acquireProgram:function acquireProgram(t,r){let s;for(let e=0,t=g.length;e<t;e++){const t=g[e];if(t.cacheKey===r){s=t,++s.usedTimes;break}}return void 0===s&&(s=new WebGLProgram(e,r,t,c),g.push(s)),s},releaseProgram:function releaseProgram(e){if(0==--e.usedTimes){const t=g.indexOf(e);g[t]=g[g.length-1],g.pop(),e.destroy()}},releaseShaderCache:function releaseShaderCache(e){h.remove(e)},programs:g,dispose:function dispose(){h.dispose()}}}function WebGLProperties(){let e=new WeakMap;return{has:function has(t){return e.has(t)},get:function get(t){let r=e.get(t);return void 0===r&&(r={},e.set(t,r)),r},remove:function remove(t){e.delete(t)},update:function update(t,r,s){e.get(t)[r]=s},dispose:function dispose(){e=new WeakMap}}}function painterSortStable(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function reversePainterSortStable(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function WebGLRenderList(){const e=[];let t=0;const r=[],s=[],o=[];function getNextRenderItem(r,s,o,l,c,A){let d=e[t];return void 0===d?(d={id:r.id,object:r,geometry:s,material:o,groupOrder:l,renderOrder:r.renderOrder,z:c,group:A},e[t]=d):(d.id=r.id,d.object=r,d.geometry=s,d.material=o,d.groupOrder=l,d.renderOrder=r.renderOrder,d.z=c,d.group=A),t++,d}return{opaque:r,transmissive:s,transparent:o,init:function init(){t=0,r.length=0,s.length=0,o.length=0},push:function push(e,t,l,c,A,d){const h=getNextRenderItem(e,t,l,c,A,d);l.transmission>0?s.push(h):!0===l.transparent?o.push(h):r.push(h)},unshift:function unshift(e,t,l,c,A,d){const h=getNextRenderItem(e,t,l,c,A,d);l.transmission>0?s.unshift(h):!0===l.transparent?o.unshift(h):r.unshift(h)},finish:function finish(){for(let r=t,s=e.length;r<s;r++){const t=e[r];if(null===t.id)break;t.id=null,t.object=null,t.geometry=null,t.material=null,t.group=null}},sort:function sort(e,t){r.length>1&&r.sort(e||painterSortStable),s.length>1&&s.sort(t||reversePainterSortStable),o.length>1&&o.sort(t||reversePainterSortStable)}}}function WebGLRenderLists(){let e=new WeakMap;return{get:function get(t,r){const s=e.get(t);let o;return void 0===s?(o=new WebGLRenderList,e.set(t,[o])):r>=s.length?(o=new WebGLRenderList,s.push(o)):o=s[r],o},dispose:function dispose(){e=new WeakMap}}}function UniformsCache(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let r;switch(t.type){case"DirectionalLight":r={direction:new o.Pa4,color:new o.Ilk};break;case"SpotLight":r={position:new o.Pa4,direction:new o.Pa4,color:new o.Ilk,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":r={position:new o.Pa4,color:new o.Ilk,distance:0,decay:0};break;case"HemisphereLight":r={direction:new o.Pa4,skyColor:new o.Ilk,groundColor:new o.Ilk};break;case"RectAreaLight":r={color:new o.Ilk,position:new o.Pa4,halfWidth:new o.Pa4,halfHeight:new o.Pa4}}return e[t.id]=r,r}}}let jn=0;function shadowCastingAndTexturingLightsFirst(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+(t.map?1:0)-(e.map?1:0)}function WebGLLights(e){const t=new UniformsCache,r=function ShadowUniformsCache(){const e={};return{get:function(t){if(void 0!==e[t.id])return e[t.id];let r;switch(t.type){case"DirectionalLight":case"SpotLight":r={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new o.FM8};break;case"PointLight":r={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new o.FM8,shadowCameraNear:1,shadowCameraFar:1e3}}return e[t.id]=r,r}}}(),s={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let e=0;e<9;e++)s.probe.push(new o.Pa4);const l=new o.Pa4,c=new o.yGw,A=new o.yGw;return{setup:function setup(o){let l=0,c=0,A=0;for(let e=0;e<9;e++)s.probe[e].set(0,0,0);let d=0,h=0,p=0,g=0,m=0,f=0,E=0,_=0,C=0,I=0,S=0;o.sort(shadowCastingAndTexturingLightsFirst);for(let e=0,x=o.length;e<x;e++){const x=o[e],T=x.color,y=x.intensity,b=x.distance,B=x.shadow&&x.shadow.map?x.shadow.map.texture:null;if(x.isAmbientLight)l+=T.r*y,c+=T.g*y,A+=T.b*y;else if(x.isLightProbe){for(let e=0;e<9;e++)s.probe[e].addScaledVector(x.sh.coefficients[e],y);S++}else if(x.isDirectionalLight){const e=t.get(x);if(e.color.copy(x.color).multiplyScalar(x.intensity),x.castShadow){const e=x.shadow,t=r.get(x);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,s.directionalShadow[d]=t,s.directionalShadowMap[d]=B,s.directionalShadowMatrix[d]=x.shadow.matrix,f++}s.directional[d]=e,d++}else if(x.isSpotLight){const e=t.get(x);e.position.setFromMatrixPosition(x.matrixWorld),e.color.copy(T).multiplyScalar(y),e.distance=b,e.coneCos=Math.cos(x.angle),e.penumbraCos=Math.cos(x.angle*(1-x.penumbra)),e.decay=x.decay,s.spot[p]=e;const o=x.shadow;if(x.map&&(s.spotLightMap[C]=x.map,C++,o.updateMatrices(x),x.castShadow&&I++),s.spotLightMatrix[p]=o.matrix,x.castShadow){const e=r.get(x);e.shadowIntensity=o.intensity,e.shadowBias=o.bias,e.shadowNormalBias=o.normalBias,e.shadowRadius=o.radius,e.shadowMapSize=o.mapSize,s.spotShadow[p]=e,s.spotShadowMap[p]=B,_++}p++}else if(x.isRectAreaLight){const e=t.get(x);e.color.copy(T).multiplyScalar(y),e.halfWidth.set(.5*x.width,0,0),e.halfHeight.set(0,.5*x.height,0),s.rectArea[g]=e,g++}else if(x.isPointLight){const e=t.get(x);if(e.color.copy(x.color).multiplyScalar(x.intensity),e.distance=x.distance,e.decay=x.decay,x.castShadow){const e=x.shadow,t=r.get(x);t.shadowIntensity=e.intensity,t.shadowBias=e.bias,t.shadowNormalBias=e.normalBias,t.shadowRadius=e.radius,t.shadowMapSize=e.mapSize,t.shadowCameraNear=e.camera.near,t.shadowCameraFar=e.camera.far,s.pointShadow[h]=t,s.pointShadowMap[h]=B,s.pointShadowMatrix[h]=x.shadow.matrix,E++}s.point[h]=e,h++}else if(x.isHemisphereLight){const e=t.get(x);e.skyColor.copy(x.color).multiplyScalar(y),e.groundColor.copy(x.groundColor).multiplyScalar(y),s.hemi[m]=e,m++}}g>0&&(!0===e.has("OES_texture_float_linear")?(s.rectAreaLTC1=pn.LTC_FLOAT_1,s.rectAreaLTC2=pn.LTC_FLOAT_2):(s.rectAreaLTC1=pn.LTC_HALF_1,s.rectAreaLTC2=pn.LTC_HALF_2)),s.ambient[0]=l,s.ambient[1]=c,s.ambient[2]=A;const x=s.hash;x.directionalLength===d&&x.pointLength===h&&x.spotLength===p&&x.rectAreaLength===g&&x.hemiLength===m&&x.numDirectionalShadows===f&&x.numPointShadows===E&&x.numSpotShadows===_&&x.numSpotMaps===C&&x.numLightProbes===S||(s.directional.length=d,s.spot.length=p,s.rectArea.length=g,s.point.length=h,s.hemi.length=m,s.directionalShadow.length=f,s.directionalShadowMap.length=f,s.pointShadow.length=E,s.pointShadowMap.length=E,s.spotShadow.length=_,s.spotShadowMap.length=_,s.directionalShadowMatrix.length=f,s.pointShadowMatrix.length=E,s.spotLightMatrix.length=_+C-I,s.spotLightMap.length=C,s.numSpotLightShadowsWithMaps=I,s.numLightProbes=S,x.directionalLength=d,x.pointLength=h,x.spotLength=p,x.rectAreaLength=g,x.hemiLength=m,x.numDirectionalShadows=f,x.numPointShadows=E,x.numSpotShadows=_,x.numSpotMaps=C,x.numLightProbes=S,s.version=jn++)},setupView:function setupView(e,t){let r=0,o=0,d=0,h=0,p=0;const g=t.matrixWorldInverse;for(let t=0,m=e.length;t<m;t++){const m=e[t];if(m.isDirectionalLight){const e=s.directional[r];e.direction.setFromMatrixPosition(m.matrixWorld),l.setFromMatrixPosition(m.target.matrixWorld),e.direction.sub(l),e.direction.transformDirection(g),r++}else if(m.isSpotLight){const e=s.spot[d];e.position.setFromMatrixPosition(m.matrixWorld),e.position.applyMatrix4(g),e.direction.setFromMatrixPosition(m.matrixWorld),l.setFromMatrixPosition(m.target.matrixWorld),e.direction.sub(l),e.direction.transformDirection(g),d++}else if(m.isRectAreaLight){const e=s.rectArea[h];e.position.setFromMatrixPosition(m.matrixWorld),e.position.applyMatrix4(g),A.identity(),c.copy(m.matrixWorld),c.premultiply(g),A.extractRotation(c),e.halfWidth.set(.5*m.width,0,0),e.halfHeight.set(0,.5*m.height,0),e.halfWidth.applyMatrix4(A),e.halfHeight.applyMatrix4(A),h++}else if(m.isPointLight){const e=s.point[o];e.position.setFromMatrixPosition(m.matrixWorld),e.position.applyMatrix4(g),o++}else if(m.isHemisphereLight){const e=s.hemi[p];e.direction.setFromMatrixPosition(m.matrixWorld),e.direction.transformDirection(g),p++}}},state:s}}function WebGLRenderState(e){const t=new WebGLLights(e),r=[],s=[];const o={lightsArray:r,shadowsArray:s,camera:null,lights:t,transmissionRenderTarget:{}};return{init:function init(e){o.camera=e,r.length=0,s.length=0},state:o,setupLights:function setupLights(){t.setup(r)},setupLightsView:function setupLightsView(e){t.setupView(r,e)},pushLight:function pushLight(e){r.push(e)},pushShadow:function pushShadow(e){s.push(e)}}}function WebGLRenderStates(e){let t=new WeakMap;return{get:function get(r,s=0){const o=t.get(r);let l;return void 0===o?(l=new WebGLRenderState(e),t.set(r,[l])):s>=o.length?(l=new WebGLRenderState(e),o.push(l)):l=o[s],l},dispose:function dispose(){t=new WeakMap}}}function WebGLShadowMap(e,t,r){let s=new o.iWj;const l=new o.FM8,c=new o.FM8,A=new o.Ltg,d=new o.lRF({depthPacking:o.mSO}),h=new o.Lun,p={},g=r.maxTextureSize,m={[o.Wl3]:o._Li,[o._Li]:o.Wl3,[o.ehD]:o.ehD},f=new o.jyz({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new o.FM8},radius:{value:4}},vertexShader:"void main() {\n\tgl_Position = vec4( position, 1.0 );\n}",fragmentShader:"uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}"}),E=f.clone();E.defines.HORIZONTAL_PASS=1;const _=new o.u9r;_.setAttribute("position",new o.TlE(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const C=new o.Kj0(_,f),I=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=o._iA;let S=this.type;function VSMPass(r,s){const c=t.update(C);f.defines.VSM_SAMPLES!==r.blurSamples&&(f.defines.VSM_SAMPLES=r.blurSamples,E.defines.VSM_SAMPLES=r.blurSamples,f.needsUpdate=!0,E.needsUpdate=!0),null===r.mapPass&&(r.mapPass=new o.dd2(l.x,l.y)),f.uniforms.shadow_pass.value=r.map.texture,f.uniforms.resolution.value=r.mapSize,f.uniforms.radius.value=r.radius,e.setRenderTarget(r.mapPass),e.clear(),e.renderBufferDirect(s,null,c,f,C,null),E.uniforms.shadow_pass.value=r.mapPass.texture,E.uniforms.resolution.value=r.mapSize,E.uniforms.radius.value=r.radius,e.setRenderTarget(r.map),e.clear(),e.renderBufferDirect(s,null,c,E,C,null)}function getDepthMaterial(t,r,s,l){let c=null;const A=!0===s.isPointLight?t.customDistanceMaterial:t.customDepthMaterial;if(void 0!==A)c=A;else if(c=!0===s.isPointLight?h:d,e.localClippingEnabled&&!0===r.clipShadows&&Array.isArray(r.clippingPlanes)&&0!==r.clippingPlanes.length||r.displacementMap&&0!==r.displacementScale||r.alphaMap&&r.alphaTest>0||r.map&&r.alphaTest>0||!0===r.alphaToCoverage){const e=c.uuid,t=r.uuid;let s=p[e];void 0===s&&(s={},p[e]=s);let o=s[t];void 0===o&&(o=c.clone(),s[t]=o,r.addEventListener("dispose",onMaterialDispose)),c=o}if(c.visible=r.visible,c.wireframe=r.wireframe,l===o.dwk?c.side=null!==r.shadowSide?r.shadowSide:r.side:c.side=null!==r.shadowSide?r.shadowSide:m[r.side],c.alphaMap=r.alphaMap,c.alphaTest=!0===r.alphaToCoverage?.5:r.alphaTest,c.map=r.map,c.clipShadows=r.clipShadows,c.clippingPlanes=r.clippingPlanes,c.clipIntersection=r.clipIntersection,c.displacementMap=r.displacementMap,c.displacementScale=r.displacementScale,c.displacementBias=r.displacementBias,c.wireframeLinewidth=r.wireframeLinewidth,c.linewidth=r.linewidth,!0===s.isPointLight&&!0===c.isMeshDistanceMaterial){e.properties.get(c).light=s}return c}function renderObject(r,l,c,A,d){if(!1===r.visible)return;if(r.layers.test(l.layers)&&(r.isMesh||r.isLine||r.isPoints)&&(r.castShadow||r.receiveShadow&&d===o.dwk)&&(!r.frustumCulled||s.intersectsObject(r))){r.modelViewMatrix.multiplyMatrices(c.matrixWorldInverse,r.matrixWorld);const s=t.update(r),o=r.material;if(Array.isArray(o)){const t=s.groups;for(let h=0,p=t.length;h<p;h++){const p=t[h],g=o[p.materialIndex];if(g&&g.visible){const t=getDepthMaterial(r,g,A,d);r.onBeforeShadow(e,r,l,c,s,t,p),e.renderBufferDirect(c,null,s,t,r,p),r.onAfterShadow(e,r,l,c,s,t,p)}}}else if(o.visible){const t=getDepthMaterial(r,o,A,d);r.onBeforeShadow(e,r,l,c,s,t,null),e.renderBufferDirect(c,null,s,t,r,null),r.onAfterShadow(e,r,l,c,s,t,null)}}const h=r.children;for(let e=0,t=h.length;e<t;e++)renderObject(h[e],l,c,A,d)}function onMaterialDispose(e){e.target.removeEventListener("dispose",onMaterialDispose);for(const t in p){const r=p[t],s=e.target.uuid;if(s in r){r[s].dispose(),delete r[s]}}}this.render=function(t,r,d){if(!1===I.enabled)return;if(!1===I.autoUpdate&&!1===I.needsUpdate)return;if(0===t.length)return;const h=e.getRenderTarget(),p=e.getActiveCubeFace(),m=e.getActiveMipmapLevel(),f=e.state;f.setBlending(o.jFi),f.buffers.color.setClear(1,1,1,1),f.buffers.depth.setTest(!0),f.setScissorTest(!1);const E=S!==o.dwk&&this.type===o.dwk,_=S===o.dwk&&this.type!==o.dwk;for(let h=0,p=t.length;h<p;h++){const p=t[h],m=p.shadow;if(void 0===m){un.warn("THREE.WebGLShadowMap:",p,"has no shadow.");continue}if(!1===m.autoUpdate&&!1===m.needsUpdate)continue;l.copy(m.mapSize);const C=m.getFrameExtents();if(l.multiply(C),c.copy(m.mapSize),(l.x>g||l.y>g)&&(l.x>g&&(c.x=Math.floor(g/C.x),l.x=c.x*C.x,m.mapSize.x=c.x),l.y>g&&(c.y=Math.floor(g/C.y),l.y=c.y*C.y,m.mapSize.y=c.y)),null===m.map||!0===E||!0===_){const e=this.type!==o.dwk?{minFilter:o.TyD,magFilter:o.TyD}:{};null!==m.map&&m.map.dispose(),m.map=new o.dd2(l.x,l.y,e),m.map.texture.name=p.name+".shadowMap",m.camera.updateProjectionMatrix()}e.setRenderTarget(m.map),e.clear();const I=m.getViewportCount();for(let e=0;e<I;e++){const t=m.getViewport(e);A.set(c.x*t.x,c.y*t.y,c.x*t.z,c.y*t.w),f.viewport(A),m.updateMatrices(p,e),s=m.getFrustum(),renderObject(r,d,m.camera,p,this.type)}!0!==m.isPointLightShadow&&this.type===o.dwk&&VSMPass(m,d),m.needsUpdate=!1}S=this.type,I.needsUpdate=!1,e.setRenderTarget(h,p,m)}}const Yn={[o.BVF]:o.Se2,[o.Zr5]:o.w$m,[o.eD]:o.M6v,[o.vCF]:o.ksN,[o.Se2]:o.BVF,[o.w$m]:o.Zr5,[o.M6v]:o.eD,[o.ksN]:o.vCF};function WebGLState(e,t){const r=new function ColorBuffer(){let t=!1;const r=new o.Ltg;let s=null;const l=new o.Ltg(0,0,0,0);return{setMask:function(r){s===r||t||(e.colorMask(r,r,r,r),s=r)},setLocked:function(e){t=e},setClear:function(t,s,o,c,A){!0===A&&(t*=c,s*=c,o*=c),r.set(t,s,o,c),!1===l.equals(r)&&(e.clearColor(t,s,o,c),l.copy(r))},reset:function(){t=!1,s=null,l.set(-1,0,0,0)}}},s=new function DepthBuffer(){let r=!1,s=!1,l=null,c=null,A=null;return{setReversed:function(e){if(s!==e){const r=t.get("EXT_clip_control");e?r.clipControlEXT(r.LOWER_LEFT_EXT,r.ZERO_TO_ONE_EXT):r.clipControlEXT(r.LOWER_LEFT_EXT,r.NEGATIVE_ONE_TO_ONE_EXT),s=e;const o=A;A=null,this.setClear(o)}},getReversed:function(){return s},setTest:function(t){t?enable(e.DEPTH_TEST):disable(e.DEPTH_TEST)},setMask:function(t){l===t||r||(e.depthMask(t),l=t)},setFunc:function(t){if(s&&(t=Yn[t]),c!==t){switch(t){case o.BVF:e.depthFunc(e.NEVER);break;case o.Se2:e.depthFunc(e.ALWAYS);break;case o.Zr5:e.depthFunc(e.LESS);break;case o.vCF:e.depthFunc(e.LEQUAL);break;case o.eD:e.depthFunc(e.EQUAL);break;case o.ksN:e.depthFunc(e.GEQUAL);break;case o.w$m:e.depthFunc(e.GREATER);break;case o.M6v:e.depthFunc(e.NOTEQUAL);break;default:e.depthFunc(e.LEQUAL)}c=t}},setLocked:function(e){r=e},setClear:function(t){A!==t&&(s&&(t=1-t),e.clearDepth(t),A=t)},reset:function(){r=!1,l=null,c=null,A=null,s=!1}}},l=new function StencilBuffer(){let t=!1,r=null,s=null,o=null,l=null,c=null,A=null,d=null,h=null;return{setTest:function(r){t||(r?enable(e.STENCIL_TEST):disable(e.STENCIL_TEST))},setMask:function(s){r===s||t||(e.stencilMask(s),r=s)},setFunc:function(t,r,c){s===t&&o===r&&l===c||(e.stencilFunc(t,r,c),s=t,o=r,l=c)},setOp:function(t,r,s){c===t&&A===r&&d===s||(e.stencilOp(t,r,s),c=t,A=r,d=s)},setLocked:function(e){t=e},setClear:function(t){h!==t&&(e.clearStencil(t),h=t)},reset:function(){t=!1,r=null,s=null,o=null,l=null,c=null,A=null,d=null,h=null}}},c=new WeakMap,A=new WeakMap;let d={},h={},p=new WeakMap,g=[],m=null,f=!1,E=null,_=null,C=null,I=null,S=null,x=null,T=null,y=new o.Ilk(0,0,0),b=0,B=!1,U=null,F=null,Q=null,O=null,G=null;const W=e.getParameter(e.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let q=!1,X=0;const K=e.getParameter(e.VERSION);-1!==K.indexOf("WebGL")?(X=parseFloat(/^WebGL (\d)/.exec(K)[1]),q=X>=1):-1!==K.indexOf("OpenGL ES")&&(X=parseFloat(/^OpenGL ES (\d)/.exec(K)[1]),q=X>=2);let j=null,Y={};const J=e.getParameter(e.SCISSOR_BOX),$=e.getParameter(e.VIEWPORT),ee=(new o.Ltg).fromArray(J),te=(new o.Ltg).fromArray($);function createTexture(t,r,s,o){const l=new Uint8Array(4),c=e.createTexture();e.bindTexture(t,c),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let c=0;c<s;c++)t===e.TEXTURE_3D||t===e.TEXTURE_2D_ARRAY?e.texImage3D(r,0,e.RGBA,1,1,o,0,e.RGBA,e.UNSIGNED_BYTE,l):e.texImage2D(r+c,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,l);return c}const ne={};function enable(t){!0!==d[t]&&(e.enable(t),d[t]=!0)}function disable(t){!1!==d[t]&&(e.disable(t),d[t]=!1)}ne[e.TEXTURE_2D]=createTexture(e.TEXTURE_2D,e.TEXTURE_2D,1),ne[e.TEXTURE_CUBE_MAP]=createTexture(e.TEXTURE_CUBE_MAP,e.TEXTURE_CUBE_MAP_POSITIVE_X,6),ne[e.TEXTURE_2D_ARRAY]=createTexture(e.TEXTURE_2D_ARRAY,e.TEXTURE_2D_ARRAY,1,1),ne[e.TEXTURE_3D]=createTexture(e.TEXTURE_3D,e.TEXTURE_3D,1,1),r.setClear(0,0,0,1),s.setClear(1),l.setClear(0),enable(e.DEPTH_TEST),s.setFunc(o.vCF),setFlipSided(!1),setCullFace(o.tm_),enable(e.CULL_FACE),setBlending(o.jFi);const ie={[o.bGH]:e.FUNC_ADD,[o.Wbm]:e.FUNC_SUBTRACT,[o.rOj]:e.FUNC_REVERSE_SUBTRACT};ie[o.r_]=e.MIN,ie[o.Sm8]=e.MAX;const re={[o.c8b]:e.ZERO,[o.ghN]:e.ONE,[o.KhW]:e.SRC_COLOR,[o.k74]:e.SRC_ALPHA,[o.RlZ]:e.SRC_ALPHA_SATURATE,[o.Vdb]:e.DST_COLOR,[o.fSK]:e.DST_ALPHA,[o.iWC]:e.ONE_MINUS_SRC_COLOR,[o.LgZ]:e.ONE_MINUS_SRC_ALPHA,[o.Wpd]:e.ONE_MINUS_DST_COLOR,[o.Hy8]:e.ONE_MINUS_DST_ALPHA,[o._wr]:e.CONSTANT_COLOR,[o.Cy]:e.ONE_MINUS_CONSTANT_COLOR,[o.jes]:e.CONSTANT_ALPHA,[o.NKc]:e.ONE_MINUS_CONSTANT_ALPHA};function setBlending(t,r,s,l,c,A,d,h,p,g){if(t!==o.jFi){if(!1===f&&(enable(e.BLEND),f=!0),t===o.Xaj)c=c||r,A=A||s,d=d||l,r===_&&c===S||(e.blendEquationSeparate(ie[r],ie[c]),_=r,S=c),s===C&&l===I&&A===x&&d===T||(e.blendFuncSeparate(re[s],re[l],re[A],re[d]),C=s,I=l,x=A,T=d),!1!==h.equals(y)&&p===b||(e.blendColor(h.r,h.g,h.b,p),y.copy(h),b=p),E=t,B=!1;else if(t!==E||g!==B){if(_===o.bGH&&S===o.bGH||(e.blendEquation(e.FUNC_ADD),_=o.bGH,S=o.bGH),g)switch(t){case o.bdR:e.blendFuncSeparate(e.ONE,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case o.WMw:e.blendFunc(e.ONE,e.ONE);break;case o.N4l:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case o.M5h:e.blendFuncSeparate(e.ZERO,e.SRC_COLOR,e.ZERO,e.SRC_ALPHA);break;default:un.error("THREE.WebGLState: Invalid blending: ",t)}else switch(t){case o.bdR:e.blendFuncSeparate(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA);break;case o.WMw:e.blendFunc(e.SRC_ALPHA,e.ONE);break;case o.N4l:e.blendFuncSeparate(e.ZERO,e.ONE_MINUS_SRC_COLOR,e.ZERO,e.ONE);break;case o.M5h:e.blendFunc(e.ZERO,e.SRC_COLOR);break;default:un.error("THREE.WebGLState: Invalid blending: ",t)}C=null,I=null,x=null,T=null,y.set(0,0,0),b=0,E=t,B=g}}else!0===f&&(disable(e.BLEND),f=!1)}function setFlipSided(t){U!==t&&(t?e.frontFace(e.CW):e.frontFace(e.CCW),U=t)}function setCullFace(t){t!==o.PeU?(enable(e.CULL_FACE),t!==F&&(t===o.tm_?e.cullFace(e.BACK):t===o.S2y?e.cullFace(e.FRONT):e.cullFace(e.FRONT_AND_BACK))):disable(e.CULL_FACE),F=t}function setPolygonOffset(t,r,s){t?(enable(e.POLYGON_OFFSET_FILL),O===r&&G===s||(e.polygonOffset(r,s),O=r,G=s)):disable(e.POLYGON_OFFSET_FILL)}return{buffers:{color:r,depth:s,stencil:l},enable,disable,bindFramebuffer:function bindFramebuffer(t,r){return h[t]!==r&&(e.bindFramebuffer(t,r),h[t]=r,t===e.DRAW_FRAMEBUFFER&&(h[e.FRAMEBUFFER]=r),t===e.FRAMEBUFFER&&(h[e.DRAW_FRAMEBUFFER]=r),!0)},drawBuffers:function drawBuffers(t,r){let s=g,o=!1;if(t){s=p.get(r),void 0===s&&(s=[],p.set(r,s));const l=t.textures;if(s.length!==l.length||s[0]!==e.COLOR_ATTACHMENT0){for(let t=0,r=l.length;t<r;t++)s[t]=e.COLOR_ATTACHMENT0+t;s.length=l.length,o=!0}}else s[0]!==e.BACK&&(s[0]=e.BACK,o=!0);o&&e.drawBuffers(s)},useProgram:function useProgram(t){return m!==t&&(e.useProgram(t),m=t,!0)},setBlending,setMaterial:function setMaterial(t,c){t.side===o.ehD?disable(e.CULL_FACE):enable(e.CULL_FACE);let A=t.side===o._Li;c&&(A=!A),setFlipSided(A),t.blending===o.bdR&&!1===t.transparent?setBlending(o.jFi):setBlending(t.blending,t.blendEquation,t.blendSrc,t.blendDst,t.blendEquationAlpha,t.blendSrcAlpha,t.blendDstAlpha,t.blendColor,t.blendAlpha,t.premultipliedAlpha),s.setFunc(t.depthFunc),s.setTest(t.depthTest),s.setMask(t.depthWrite),r.setMask(t.colorWrite);const d=t.stencilWrite;l.setTest(d),d&&(l.setMask(t.stencilWriteMask),l.setFunc(t.stencilFunc,t.stencilRef,t.stencilFuncMask),l.setOp(t.stencilFail,t.stencilZFail,t.stencilZPass)),setPolygonOffset(t.polygonOffset,t.polygonOffsetFactor,t.polygonOffsetUnits),!0===t.alphaToCoverage?enable(e.SAMPLE_ALPHA_TO_COVERAGE):disable(e.SAMPLE_ALPHA_TO_COVERAGE)},setFlipSided,setCullFace,setLineWidth:function setLineWidth(t){t!==Q&&(q&&e.lineWidth(t),Q=t)},setPolygonOffset,setScissorTest:function setScissorTest(t){t?enable(e.SCISSOR_TEST):disable(e.SCISSOR_TEST)},activeTexture:function activeTexture(t){void 0===t&&(t=e.TEXTURE0+W-1),j!==t&&(e.activeTexture(t),j=t)},bindTexture:function bindTexture(t,r,s){void 0===s&&(s=null===j?e.TEXTURE0+W-1:j);let o=Y[s];void 0===o&&(o={type:void 0,texture:void 0},Y[s]=o),o.type===t&&o.texture===r||(j!==s&&(e.activeTexture(s),j=s),e.bindTexture(t,r||ne[t]),o.type=t,o.texture=r)},unbindTexture:function unbindTexture(){const t=Y[j];void 0!==t&&void 0!==t.type&&(e.bindTexture(t.type,null),t.type=void 0,t.texture=void 0)},compressedTexImage2D:function compressedTexImage2D(){try{e.compressedTexImage2D(...arguments)}catch(e){un.error("THREE.WebGLState:",e)}},compressedTexImage3D:function compressedTexImage3D(){try{e.compressedTexImage3D(...arguments)}catch(e){un.error("THREE.WebGLState:",e)}},texImage2D:function texImage2D(){try{e.texImage2D(...arguments)}catch(e){un.error("THREE.WebGLState:",e)}},texImage3D:function texImage3D(){try{e.texImage3D(...arguments)}catch(e){un.error("THREE.WebGLState:",e)}},updateUBOMapping:function updateUBOMapping(t,r){let s=A.get(r);void 0===s&&(s=new WeakMap,A.set(r,s));let o=s.get(t);void 0===o&&(o=e.getUniformBlockIndex(r,t.name),s.set(t,o))},uniformBlockBinding:function uniformBlockBinding(t,r){const s=A.get(r).get(t);c.get(r)!==s&&(e.uniformBlockBinding(r,s,t.__bindingPointIndex),c.set(r,s))},texStorage2D:function texStorage2D(){try{e.texStorage2D(...arguments)}catch(e){un.error("THREE.WebGLState:",e)}},texStorage3D:function texStorage3D(){try{e.texStorage3D(...arguments)}catch(e){un.error("THREE.WebGLState:",e)}},texSubImage2D:function texSubImage2D(){try{e.texSubImage2D(...arguments)}catch(e){un.error("THREE.WebGLState:",e)}},texSubImage3D:function texSubImage3D(){try{e.texSubImage3D(...arguments)}catch(e){un.error("THREE.WebGLState:",e)}},compressedTexSubImage2D:function compressedTexSubImage2D(){try{e.compressedTexSubImage2D(...arguments)}catch(e){un.error("THREE.WebGLState:",e)}},compressedTexSubImage3D:function compressedTexSubImage3D(){try{e.compressedTexSubImage3D(...arguments)}catch(e){un.error("THREE.WebGLState:",e)}},scissor:function scissor(t){!1===ee.equals(t)&&(e.scissor(t.x,t.y,t.z,t.w),ee.copy(t))},viewport:function viewport(t){!1===te.equals(t)&&(e.viewport(t.x,t.y,t.z,t.w),te.copy(t))},reset:function reset(){e.disable(e.BLEND),e.disable(e.CULL_FACE),e.disable(e.DEPTH_TEST),e.disable(e.POLYGON_OFFSET_FILL),e.disable(e.SCISSOR_TEST),e.disable(e.STENCIL_TEST),e.disable(e.SAMPLE_ALPHA_TO_COVERAGE),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO),e.blendFuncSeparate(e.ONE,e.ZERO,e.ONE,e.ZERO),e.blendColor(0,0,0,0),e.colorMask(!0,!0,!0,!0),e.clearColor(0,0,0,0),e.depthMask(!0),e.depthFunc(e.LESS),s.setReversed(!1),e.clearDepth(1),e.stencilMask(4294967295),e.stencilFunc(e.ALWAYS,0,4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP),e.clearStencil(0),e.cullFace(e.BACK),e.frontFace(e.CCW),e.polygonOffset(0,0),e.activeTexture(e.TEXTURE0),e.bindFramebuffer(e.FRAMEBUFFER,null),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),e.bindFramebuffer(e.READ_FRAMEBUFFER,null),e.useProgram(null),e.lineWidth(1),e.scissor(0,0,e.canvas.width,e.canvas.height),e.viewport(0,0,e.canvas.width,e.canvas.height),d={},j=null,Y={},h={},p=new WeakMap,g=[],m=null,f=!1,E=null,_=null,C=null,I=null,S=null,x=null,T=null,y=new o.Ilk(0,0,0),b=0,B=!1,U=null,F=null,Q=null,O=null,G=null,ee.set(0,0,e.canvas.width,e.canvas.height),te.set(0,0,e.canvas.width,e.canvas.height),r.reset(),s.reset(),l.reset()}}}function WebGLTextures(e,t,r,s,l,c,A){const d=t.has("WEBGL_multisampled_render_to_texture")?t.get("WEBGL_multisampled_render_to_texture"):null,h="undefined"!=typeof navigator&&/OculusBrowser/g.test(navigator.userAgent),p=new o.FM8,g=new WeakMap;let m;const f=new WeakMap;let E=!1;try{E="undefined"!=typeof OffscreenCanvas&&null!==new OffscreenCanvas(1,1).getContext("2d")}catch(e){}function createCanvas(e,t){return E?new OffscreenCanvas(e,t):(0,o.cac)("canvas")}function resizeImage(e,t,r){let s=1;const o=getDimensions(e);if((o.width>r||o.height>r)&&(s=r/Math.max(o.width,o.height)),s<1){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof VideoFrame&&e instanceof VideoFrame){const r=Math.floor(s*o.width),l=Math.floor(s*o.height);void 0===m&&(m=createCanvas(r,l));const c=t?createCanvas(r,l):m;c.width=r,c.height=l;return c.getContext("2d").drawImage(e,0,0,r,l),un.warn("THREE.WebGLRenderer: Texture has been resized from ("+o.width+"x"+o.height+") to ("+r+"x"+l+")."),c}return"data"in e&&un.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+o.width+"x"+o.height+")."),e}return e}function textureNeedsGenerateMipmaps(e){return e.generateMipmaps}function generateMipmap(t){e.generateMipmap(t)}function getTargetType(t){return t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:t.isWebGL3DRenderTarget?e.TEXTURE_3D:t.isWebGLArrayRenderTarget||t.isCompressedArrayTexture?e.TEXTURE_2D_ARRAY:e.TEXTURE_2D}function getInternalFormat(r,s,l,c,A=!1){if(null!==r){if(void 0!==e[r])return e[r];un.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+r+"'")}let d=s;if(s===e.RED&&(l===e.FLOAT&&(d=e.R32F),l===e.HALF_FLOAT&&(d=e.R16F),l===e.UNSIGNED_BYTE&&(d=e.R8)),s===e.RED_INTEGER&&(l===e.UNSIGNED_BYTE&&(d=e.R8UI),l===e.UNSIGNED_SHORT&&(d=e.R16UI),l===e.UNSIGNED_INT&&(d=e.R32UI),l===e.BYTE&&(d=e.R8I),l===e.SHORT&&(d=e.R16I),l===e.INT&&(d=e.R32I)),s===e.RG&&(l===e.FLOAT&&(d=e.RG32F),l===e.HALF_FLOAT&&(d=e.RG16F),l===e.UNSIGNED_BYTE&&(d=e.RG8)),s===e.RG_INTEGER&&(l===e.UNSIGNED_BYTE&&(d=e.RG8UI),l===e.UNSIGNED_SHORT&&(d=e.RG16UI),l===e.UNSIGNED_INT&&(d=e.RG32UI),l===e.BYTE&&(d=e.RG8I),l===e.SHORT&&(d=e.RG16I),l===e.INT&&(d=e.RG32I)),s===e.RGB_INTEGER&&(l===e.UNSIGNED_BYTE&&(d=e.RGB8UI),l===e.UNSIGNED_SHORT&&(d=e.RGB16UI),l===e.UNSIGNED_INT&&(d=e.RGB32UI),l===e.BYTE&&(d=e.RGB8I),l===e.SHORT&&(d=e.RGB16I),l===e.INT&&(d=e.RGB32I)),s===e.RGBA_INTEGER&&(l===e.UNSIGNED_BYTE&&(d=e.RGBA8UI),l===e.UNSIGNED_SHORT&&(d=e.RGBA16UI),l===e.UNSIGNED_INT&&(d=e.RGBA32UI),l===e.BYTE&&(d=e.RGBA8I),l===e.SHORT&&(d=e.RGBA16I),l===e.INT&&(d=e.RGBA32I)),s===e.RGB&&l===e.UNSIGNED_INT_5_9_9_9_REV&&(d=e.RGB9_E5),s===e.RGBA){const t=A?o.l6D:o.epp.getTransfer(c);l===e.FLOAT&&(d=e.RGBA32F),l===e.HALF_FLOAT&&(d=e.RGBA16F),l===e.UNSIGNED_BYTE&&(d=t===o.j17?e.SRGB8_ALPHA8:e.RGBA8),l===e.UNSIGNED_SHORT_4_4_4_4&&(d=e.RGBA4),l===e.UNSIGNED_SHORT_5_5_5_1&&(d=e.RGB5_A1)}return d!==e.R16F&&d!==e.R32F&&d!==e.RG16F&&d!==e.RG32F&&d!==e.RGBA16F&&d!==e.RGBA32F||t.get("EXT_color_buffer_float"),d}function getInternalDepthFormat(t,r){let s;return t?null===r||r===o.JQ4||r===o.wJv?s=e.DEPTH24_STENCIL8:r===o.VzW?s=e.DEPTH32F_STENCIL8:r===o.LsT&&(s=e.DEPTH24_STENCIL8,un.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):null===r||r===o.JQ4||r===o.wJv?s=e.DEPTH_COMPONENT24:r===o.VzW?s=e.DEPTH_COMPONENT32F:r===o.LsT&&(s=e.DEPTH_COMPONENT16),s}function getMipLevels(e,t){return!0===textureNeedsGenerateMipmaps(e)||e.isFramebufferTexture&&e.minFilter!==o.TyD&&e.minFilter!==o.wem?Math.log2(Math.max(t.width,t.height))+1:void 0!==e.mipmaps&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function onTextureDispose(e){const t=e.target;t.removeEventListener("dispose",onTextureDispose),function deallocateTexture(e){const t=s.get(e);if(void 0===t.__webglInit)return;const r=e.source,o=f.get(r);if(o){const s=o[t.__cacheKey];s.usedTimes--,0===s.usedTimes&&deleteTexture(e),0===Object.keys(o).length&&f.delete(r)}s.remove(e)}(t),t.isVideoTexture&&g.delete(t)}function onRenderTargetDispose(t){const r=t.target;r.removeEventListener("dispose",onRenderTargetDispose),function deallocateRenderTarget(t){const r=s.get(t);t.depthTexture&&(t.depthTexture.dispose(),s.remove(t.depthTexture));if(t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(r.__webglFramebuffer[t]))for(let s=0;s<r.__webglFramebuffer[t].length;s++)e.deleteFramebuffer(r.__webglFramebuffer[t][s]);else e.deleteFramebuffer(r.__webglFramebuffer[t]);r.__webglDepthbuffer&&e.deleteRenderbuffer(r.__webglDepthbuffer[t])}else{if(Array.isArray(r.__webglFramebuffer))for(let t=0;t<r.__webglFramebuffer.length;t++)e.deleteFramebuffer(r.__webglFramebuffer[t]);else e.deleteFramebuffer(r.__webglFramebuffer);if(r.__webglDepthbuffer&&e.deleteRenderbuffer(r.__webglDepthbuffer),r.__webglMultisampledFramebuffer&&e.deleteFramebuffer(r.__webglMultisampledFramebuffer),r.__webglColorRenderbuffer)for(let t=0;t<r.__webglColorRenderbuffer.length;t++)r.__webglColorRenderbuffer[t]&&e.deleteRenderbuffer(r.__webglColorRenderbuffer[t]);r.__webglDepthRenderbuffer&&e.deleteRenderbuffer(r.__webglDepthRenderbuffer)}const o=t.textures;for(let t=0,r=o.length;t<r;t++){const r=s.get(o[t]);r.__webglTexture&&(e.deleteTexture(r.__webglTexture),A.memory.textures--),s.remove(o[t])}s.remove(t)}(r)}function deleteTexture(t){const r=s.get(t);e.deleteTexture(r.__webglTexture);const o=t.source;delete f.get(o)[r.__cacheKey],A.memory.textures--}let _=0;function setTexture2D(t,o){const l=s.get(t);if(t.isVideoTexture&&function updateVideoTexture(e){const t=A.render.frame;g.get(e)!==t&&(g.set(e,t),e.update())}(t),!1===t.isRenderTargetTexture&&t.version>0&&l.__version!==t.version){const e=t.image;if(null===e)un.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else{if(!1!==e.complete)return void uploadTexture(l,t,o);un.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete")}}r.bindTexture(e.TEXTURE_2D,l.__webglTexture,e.TEXTURE0+o)}const C={[o.rpg]:e.REPEAT,[o.uWy]:e.CLAMP_TO_EDGE,[o.OoA]:e.MIRRORED_REPEAT},I={[o.TyD]:e.NEAREST,[o.YLQ]:e.NEAREST_MIPMAP_NEAREST,[o.aH4]:e.NEAREST_MIPMAP_LINEAR,[o.wem]:e.LINEAR,[o.qyh]:e.LINEAR_MIPMAP_NEAREST,[o.D1R]:e.LINEAR_MIPMAP_LINEAR},S={[o.xoQ]:e.NEVER,[o.T6w]:e.ALWAYS,[o.D67]:e.LESS,[o.M$G]:e.LEQUAL,[o.F1y]:e.EQUAL,[o.Jjb]:e.GEQUAL,[o.Zen]:e.GREATER,[o.O78]:e.NOTEQUAL};function setTextureParameters(r,c){if(c.type!==o.VzW||!1!==t.has("OES_texture_float_linear")||c.magFilter!==o.wem&&c.magFilter!==o.qyh&&c.magFilter!==o.aH4&&c.magFilter!==o.D1R&&c.minFilter!==o.wem&&c.minFilter!==o.qyh&&c.minFilter!==o.aH4&&c.minFilter!==o.D1R||un.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),e.texParameteri(r,e.TEXTURE_WRAP_S,C[c.wrapS]),e.texParameteri(r,e.TEXTURE_WRAP_T,C[c.wrapT]),r!==e.TEXTURE_3D&&r!==e.TEXTURE_2D_ARRAY||e.texParameteri(r,e.TEXTURE_WRAP_R,C[c.wrapR]),e.texParameteri(r,e.TEXTURE_MAG_FILTER,I[c.magFilter]),e.texParameteri(r,e.TEXTURE_MIN_FILTER,I[c.minFilter]),c.compareFunction&&(e.texParameteri(r,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(r,e.TEXTURE_COMPARE_FUNC,S[c.compareFunction])),!0===t.has("EXT_texture_filter_anisotropic")){if(c.magFilter===o.TyD)return;if(c.minFilter!==o.aH4&&c.minFilter!==o.D1R)return;if(c.type===o.VzW&&!1===t.has("OES_texture_float_linear"))return;if(c.anisotropy>1||s.get(c).__currentAnisotropy){const o=t.get("EXT_texture_filter_anisotropic");e.texParameterf(r,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(c.anisotropy,l.getMaxAnisotropy())),s.get(c).__currentAnisotropy=c.anisotropy}}}function initTexture(t,r){let s=!1;void 0===t.__webglInit&&(t.__webglInit=!0,r.addEventListener("dispose",onTextureDispose));const o=r.source;let l=f.get(o);void 0===l&&(l={},f.set(o,l));const c=function getTextureCacheKey(e){const t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.colorSpace),t.join()}(r);if(c!==t.__cacheKey){void 0===l[c]&&(l[c]={texture:e.createTexture(),usedTimes:0},A.memory.textures++,s=!0),l[c].usedTimes++;const o=l[t.__cacheKey];void 0!==o&&(l[t.__cacheKey].usedTimes--,0===o.usedTimes&&deleteTexture(r)),t.__cacheKey=c,t.__webglTexture=l[c].texture}return s}function uploadTexture(t,A,d){let h=e.TEXTURE_2D;(A.isDataArrayTexture||A.isCompressedArrayTexture)&&(h=e.TEXTURE_2D_ARRAY),A.isData3DTexture&&(h=e.TEXTURE_3D);const p=initTexture(t,A),g=A.source;r.bindTexture(h,t.__webglTexture,e.TEXTURE0+d);const m=s.get(g);if(g.version!==m.__version||!0===p){r.activeTexture(e.TEXTURE0+d);const t=o.epp.getPrimaries(o.epp.workingColorSpace),s=A.colorSpace===o.aCh?null:o.epp.getPrimaries(A.colorSpace),f=A.colorSpace===o.aCh||t===s?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,A.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,A.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,A.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,f);let E=resizeImage(A.image,!1,l.maxTextureSize);E=verifyColorSpace(A,E);const _=c.convert(A.format,A.colorSpace),C=c.convert(A.type);let I,S=getInternalFormat(A.internalFormat,_,C,A.colorSpace,A.isVideoTexture);setTextureParameters(h,A);const x=A.mipmaps,T=!0!==A.isVideoTexture,y=void 0===m.__version||!0===p,b=g.dataReady,B=getMipLevels(A,E);if(A.isDepthTexture)S=getInternalDepthFormat(A.format===o.brP,A.type),y&&(T?r.texStorage2D(e.TEXTURE_2D,1,S,E.width,E.height):r.texImage2D(e.TEXTURE_2D,0,S,E.width,E.height,0,_,C,null));else if(A.isDataTexture)if(x.length>0){T&&y&&r.texStorage2D(e.TEXTURE_2D,B,S,x[0].width,x[0].height);for(let t=0,s=x.length;t<s;t++)I=x[t],T?b&&r.texSubImage2D(e.TEXTURE_2D,t,0,0,I.width,I.height,_,C,I.data):r.texImage2D(e.TEXTURE_2D,t,S,I.width,I.height,0,_,C,I.data);A.generateMipmaps=!1}else T?(y&&r.texStorage2D(e.TEXTURE_2D,B,S,E.width,E.height),b&&r.texSubImage2D(e.TEXTURE_2D,0,0,0,E.width,E.height,_,C,E.data)):r.texImage2D(e.TEXTURE_2D,0,S,E.width,E.height,0,_,C,E.data);else if(A.isCompressedTexture)if(A.isCompressedArrayTexture){T&&y&&r.texStorage3D(e.TEXTURE_2D_ARRAY,B,S,x[0].width,x[0].height,E.depth);for(let t=0,s=x.length;t<s;t++)if(I=x[t],A.format!==o.wk1)if(null!==_)if(T){if(b)if(A.layerUpdates.size>0){const s=(0,o.EcG)(I.width,I.height,A.format,A.type);for(const o of A.layerUpdates){const l=I.data.subarray(o*s/I.data.BYTES_PER_ELEMENT,(o+1)*s/I.data.BYTES_PER_ELEMENT);r.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,o,I.width,I.height,1,_,l)}A.clearLayerUpdates()}else r.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,I.width,I.height,E.depth,_,I.data)}else r.compressedTexImage3D(e.TEXTURE_2D_ARRAY,t,S,I.width,I.height,E.depth,0,I.data,0,0);else un.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else T?b&&r.texSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,I.width,I.height,E.depth,_,C,I.data):r.texImage3D(e.TEXTURE_2D_ARRAY,t,S,I.width,I.height,E.depth,0,_,C,I.data)}else{T&&y&&r.texStorage2D(e.TEXTURE_2D,B,S,x[0].width,x[0].height);for(let t=0,s=x.length;t<s;t++)I=x[t],A.format!==o.wk1?null!==_?T?b&&r.compressedTexSubImage2D(e.TEXTURE_2D,t,0,0,I.width,I.height,_,I.data):r.compressedTexImage2D(e.TEXTURE_2D,t,S,I.width,I.height,0,I.data):un.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):T?b&&r.texSubImage2D(e.TEXTURE_2D,t,0,0,I.width,I.height,_,C,I.data):r.texImage2D(e.TEXTURE_2D,t,S,I.width,I.height,0,_,C,I.data)}else if(A.isDataArrayTexture)if(T){if(y&&r.texStorage3D(e.TEXTURE_2D_ARRAY,B,S,E.width,E.height,E.depth),b)if(A.layerUpdates.size>0){const t=(0,o.EcG)(E.width,E.height,A.format,A.type);for(const s of A.layerUpdates){const o=E.data.subarray(s*t/E.data.BYTES_PER_ELEMENT,(s+1)*t/E.data.BYTES_PER_ELEMENT);r.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,s,E.width,E.height,1,_,C,o)}A.clearLayerUpdates()}else r.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,E.width,E.height,E.depth,_,C,E.data)}else r.texImage3D(e.TEXTURE_2D_ARRAY,0,S,E.width,E.height,E.depth,0,_,C,E.data);else if(A.isData3DTexture)T?(y&&r.texStorage3D(e.TEXTURE_3D,B,S,E.width,E.height,E.depth),b&&r.texSubImage3D(e.TEXTURE_3D,0,0,0,0,E.width,E.height,E.depth,_,C,E.data)):r.texImage3D(e.TEXTURE_3D,0,S,E.width,E.height,E.depth,0,_,C,E.data);else if(A.isFramebufferTexture){if(y)if(T)r.texStorage2D(e.TEXTURE_2D,B,S,E.width,E.height);else{let t=E.width,s=E.height;for(let o=0;o<B;o++)r.texImage2D(e.TEXTURE_2D,o,S,t,s,0,_,C,null),t>>=1,s>>=1}}else if(x.length>0){if(T&&y){const t=getDimensions(x[0]);r.texStorage2D(e.TEXTURE_2D,B,S,t.width,t.height)}for(let t=0,s=x.length;t<s;t++)I=x[t],T?b&&r.texSubImage2D(e.TEXTURE_2D,t,0,0,_,C,I):r.texImage2D(e.TEXTURE_2D,t,S,_,C,I);A.generateMipmaps=!1}else if(T){if(y){const t=getDimensions(E);r.texStorage2D(e.TEXTURE_2D,B,S,t.width,t.height)}b&&r.texSubImage2D(e.TEXTURE_2D,0,0,0,_,C,E)}else r.texImage2D(e.TEXTURE_2D,0,S,_,C,E);textureNeedsGenerateMipmaps(A)&&generateMipmap(h),m.__version=g.version,A.onUpdate&&A.onUpdate(A)}t.__version=A.version}function setupFrameBufferTexture(t,o,l,A,h,p){const g=c.convert(l.format,l.colorSpace),m=c.convert(l.type),f=getInternalFormat(l.internalFormat,g,m,l.colorSpace),E=s.get(o),_=s.get(l);if(_.__renderTarget=o,!E.__hasExternalTextures){const t=Math.max(1,o.width>>p),s=Math.max(1,o.height>>p);h===e.TEXTURE_3D||h===e.TEXTURE_2D_ARRAY?r.texImage3D(h,p,f,t,s,o.depth,0,g,m,null):r.texImage2D(h,p,f,t,s,0,g,m,null)}r.bindFramebuffer(e.FRAMEBUFFER,t),useMultisampledRTT(o)?d.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,A,h,_.__webglTexture,0,getRenderTargetSamples(o)):(h===e.TEXTURE_2D||h>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&h<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,A,h,_.__webglTexture,p),r.bindFramebuffer(e.FRAMEBUFFER,null)}function setupRenderBufferStorage(t,r,s){if(e.bindRenderbuffer(e.RENDERBUFFER,t),r.depthBuffer){const o=r.depthTexture,l=o&&o.isDepthTexture?o.type:null,c=getInternalDepthFormat(r.stencilBuffer,l),A=r.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,h=getRenderTargetSamples(r);useMultisampledRTT(r)?d.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,h,c,r.width,r.height):s?e.renderbufferStorageMultisample(e.RENDERBUFFER,h,c,r.width,r.height):e.renderbufferStorage(e.RENDERBUFFER,c,r.width,r.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,A,e.RENDERBUFFER,t)}else{const t=r.textures;for(let o=0;o<t.length;o++){const l=t[o],A=c.convert(l.format,l.colorSpace),h=c.convert(l.type),p=getInternalFormat(l.internalFormat,A,h,l.colorSpace),g=getRenderTargetSamples(r);s&&!1===useMultisampledRTT(r)?e.renderbufferStorageMultisample(e.RENDERBUFFER,g,p,r.width,r.height):useMultisampledRTT(r)?d.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,g,p,r.width,r.height):e.renderbufferStorage(e.RENDERBUFFER,p,r.width,r.height)}}e.bindRenderbuffer(e.RENDERBUFFER,null)}function setupDepthTexture(t,l){if(l&&l.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(r.bindFramebuffer(e.FRAMEBUFFER,t),!l.depthTexture||!l.depthTexture.isDepthTexture)throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const c=s.get(l.depthTexture);c.__renderTarget=l,c.__webglTexture&&l.depthTexture.image.width===l.width&&l.depthTexture.image.height===l.height||(l.depthTexture.image.width=l.width,l.depthTexture.image.height=l.height,l.depthTexture.needsUpdate=!0),setTexture2D(l.depthTexture,0);const A=c.__webglTexture,h=getRenderTargetSamples(l);if(l.depthTexture.format===o.qkB)useMultisampledRTT(l)?d.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,A,0,h):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.TEXTURE_2D,A,0);else{if(l.depthTexture.format!==o.brP)throw new Error("Unknown depthTexture format");useMultisampledRTT(l)?d.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,A,0,h):e.framebufferTexture2D(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.TEXTURE_2D,A,0)}}function setupDepthRenderbuffer(t){const o=s.get(t),l=!0===t.isWebGLCubeRenderTarget;if(o.__boundDepthTexture!==t.depthTexture){const e=t.depthTexture;if(o.__depthDisposeCallback&&o.__depthDisposeCallback(),e){const disposeEvent=()=>{delete o.__boundDepthTexture,delete o.__depthDisposeCallback,e.removeEventListener("dispose",disposeEvent)};e.addEventListener("dispose",disposeEvent),o.__depthDisposeCallback=disposeEvent}o.__boundDepthTexture=e}if(t.depthTexture&&!o.__autoAllocateDepthBuffer){if(l)throw new Error("target.depthTexture not supported in Cube render targets");const e=t.texture.mipmaps;e&&e.length>0?setupDepthTexture(o.__webglFramebuffer[0],t):setupDepthTexture(o.__webglFramebuffer,t)}else if(l){o.__webglDepthbuffer=[];for(let s=0;s<6;s++)if(r.bindFramebuffer(e.FRAMEBUFFER,o.__webglFramebuffer[s]),void 0===o.__webglDepthbuffer[s])o.__webglDepthbuffer[s]=e.createRenderbuffer(),setupRenderBufferStorage(o.__webglDepthbuffer[s],t,!1);else{const r=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,l=o.__webglDepthbuffer[s];e.bindRenderbuffer(e.RENDERBUFFER,l),e.framebufferRenderbuffer(e.FRAMEBUFFER,r,e.RENDERBUFFER,l)}}else{const s=t.texture.mipmaps;if(s&&s.length>0?r.bindFramebuffer(e.FRAMEBUFFER,o.__webglFramebuffer[0]):r.bindFramebuffer(e.FRAMEBUFFER,o.__webglFramebuffer),void 0===o.__webglDepthbuffer)o.__webglDepthbuffer=e.createRenderbuffer(),setupRenderBufferStorage(o.__webglDepthbuffer,t,!1);else{const r=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,s=o.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,s),e.framebufferRenderbuffer(e.FRAMEBUFFER,r,e.RENDERBUFFER,s)}}r.bindFramebuffer(e.FRAMEBUFFER,null)}const x=[],T=[];function getRenderTargetSamples(e){return Math.min(l.maxSamples,e.samples)}function useMultisampledRTT(e){const r=s.get(e);return e.samples>0&&!0===t.has("WEBGL_multisampled_render_to_texture")&&!1!==r.__useRenderToTexture}function verifyColorSpace(e,t){const r=e.colorSpace,s=e.format,l=e.type;return!0===e.isCompressedTexture||!0===e.isVideoTexture||r!==o.GUF&&r!==o.aCh&&(o.epp.getTransfer(r)===o.j17?s===o.wk1&&l===o.ywz||un.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):un.error("THREE.WebGLTextures: Unsupported texture color space:",r)),t}function getDimensions(e){return"undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement?(p.width=e.naturalWidth||e.width,p.height=e.naturalHeight||e.height):"undefined"!=typeof VideoFrame&&e instanceof VideoFrame?(p.width=e.displayWidth,p.height=e.displayHeight):(p.width=e.width,p.height=e.height),p}this.allocateTextureUnit=function allocateTextureUnit(){const e=_;return e>=l.maxTextures&&un.warn("THREE.WebGLTextures: Trying to use "+e+" texture units while this GPU supports only "+l.maxTextures),_+=1,e},this.resetTextureUnits=function resetTextureUnits(){_=0},this.setTexture2D=setTexture2D,this.setTexture2DArray=function setTexture2DArray(t,o){const l=s.get(t);t.version>0&&l.__version!==t.version?uploadTexture(l,t,o):r.bindTexture(e.TEXTURE_2D_ARRAY,l.__webglTexture,e.TEXTURE0+o)},this.setTexture3D=function setTexture3D(t,o){const l=s.get(t);t.version>0&&l.__version!==t.version?uploadTexture(l,t,o):r.bindTexture(e.TEXTURE_3D,l.__webglTexture,e.TEXTURE0+o)},this.setTextureCube=function setTextureCube(t,A){const d=s.get(t);t.version>0&&d.__version!==t.version?function uploadCubeTexture(t,A,d){if(6!==A.image.length)return;const h=initTexture(t,A),p=A.source;r.bindTexture(e.TEXTURE_CUBE_MAP,t.__webglTexture,e.TEXTURE0+d);const g=s.get(p);if(p.version!==g.__version||!0===h){r.activeTexture(e.TEXTURE0+d);const t=o.epp.getPrimaries(o.epp.workingColorSpace),s=A.colorSpace===o.aCh?null:o.epp.getPrimaries(A.colorSpace),m=A.colorSpace===o.aCh||t===s?e.NONE:e.BROWSER_DEFAULT_WEBGL;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,A.flipY),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,A.premultiplyAlpha),e.pixelStorei(e.UNPACK_ALIGNMENT,A.unpackAlignment),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,m);const f=A.isCompressedTexture||A.image[0].isCompressedTexture,E=A.image[0]&&A.image[0].isDataTexture,_=[];for(let e=0;e<6;e++)_[e]=f||E?E?A.image[e].image:A.image[e]:resizeImage(A.image[e],!0,l.maxCubemapSize),_[e]=verifyColorSpace(A,_[e]);const C=_[0],I=c.convert(A.format,A.colorSpace),S=c.convert(A.type),x=getInternalFormat(A.internalFormat,I,S,A.colorSpace),T=!0!==A.isVideoTexture,y=void 0===g.__version||!0===h,b=p.dataReady;let B,U=getMipLevels(A,C);if(setTextureParameters(e.TEXTURE_CUBE_MAP,A),f){T&&y&&r.texStorage2D(e.TEXTURE_CUBE_MAP,U,x,C.width,C.height);for(let t=0;t<6;t++){B=_[t].mipmaps;for(let s=0;s<B.length;s++){const l=B[s];A.format!==o.wk1?null!==I?T?b&&r.compressedTexSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,s,0,0,l.width,l.height,I,l.data):r.compressedTexImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,s,x,l.width,l.height,0,l.data):un.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):T?b&&r.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,s,0,0,l.width,l.height,I,S,l.data):r.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,s,x,l.width,l.height,0,I,S,l.data)}}}else{if(B=A.mipmaps,T&&y){B.length>0&&U++;const t=getDimensions(_[0]);r.texStorage2D(e.TEXTURE_CUBE_MAP,U,x,t.width,t.height)}for(let t=0;t<6;t++)if(E){T?b&&r.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,_[t].width,_[t].height,I,S,_[t].data):r.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,x,_[t].width,_[t].height,0,I,S,_[t].data);for(let s=0;s<B.length;s++){const o=B[s].image[t].image;T?b&&r.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,s+1,0,0,o.width,o.height,I,S,o.data):r.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,s+1,x,o.width,o.height,0,I,S,o.data)}}else{T?b&&r.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,I,S,_[t]):r.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,x,I,S,_[t]);for(let s=0;s<B.length;s++){const o=B[s];T?b&&r.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,s+1,0,0,I,S,o.image[t]):r.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,s+1,x,I,S,o.image[t])}}}textureNeedsGenerateMipmaps(A)&&generateMipmap(e.TEXTURE_CUBE_MAP),g.__version=p.version,A.onUpdate&&A.onUpdate(A)}t.__version=A.version}(d,t,A):r.bindTexture(e.TEXTURE_CUBE_MAP,d.__webglTexture,e.TEXTURE0+A)},this.rebindTextures=function rebindTextures(t,r,o){const l=s.get(t);void 0!==r&&setupFrameBufferTexture(l.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),void 0!==o&&setupDepthRenderbuffer(t)},this.setupRenderTarget=function setupRenderTarget(t){const o=t.texture,l=s.get(t),d=s.get(o);t.addEventListener("dispose",onRenderTargetDispose);const h=t.textures,p=!0===t.isWebGLCubeRenderTarget,g=h.length>1;if(g||(void 0===d.__webglTexture&&(d.__webglTexture=e.createTexture()),d.__version=o.version,A.memory.textures++),p){l.__webglFramebuffer=[];for(let t=0;t<6;t++)if(o.mipmaps&&o.mipmaps.length>0){l.__webglFramebuffer[t]=[];for(let r=0;r<o.mipmaps.length;r++)l.__webglFramebuffer[t][r]=e.createFramebuffer()}else l.__webglFramebuffer[t]=e.createFramebuffer()}else{if(o.mipmaps&&o.mipmaps.length>0){l.__webglFramebuffer=[];for(let t=0;t<o.mipmaps.length;t++)l.__webglFramebuffer[t]=e.createFramebuffer()}else l.__webglFramebuffer=e.createFramebuffer();if(g)for(let t=0,r=h.length;t<r;t++){const r=s.get(h[t]);void 0===r.__webglTexture&&(r.__webglTexture=e.createTexture(),A.memory.textures++)}if(t.samples>0&&!1===useMultisampledRTT(t)){l.__webglMultisampledFramebuffer=e.createFramebuffer(),l.__webglColorRenderbuffer=[],r.bindFramebuffer(e.FRAMEBUFFER,l.__webglMultisampledFramebuffer);for(let r=0;r<h.length;r++){const s=h[r];l.__webglColorRenderbuffer[r]=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,l.__webglColorRenderbuffer[r]);const o=c.convert(s.format,s.colorSpace),A=c.convert(s.type),d=getInternalFormat(s.internalFormat,o,A,s.colorSpace,!0===t.isXRRenderTarget),p=getRenderTargetSamples(t);e.renderbufferStorageMultisample(e.RENDERBUFFER,p,d,t.width,t.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+r,e.RENDERBUFFER,l.__webglColorRenderbuffer[r])}e.bindRenderbuffer(e.RENDERBUFFER,null),t.depthBuffer&&(l.__webglDepthRenderbuffer=e.createRenderbuffer(),setupRenderBufferStorage(l.__webglDepthRenderbuffer,t,!0)),r.bindFramebuffer(e.FRAMEBUFFER,null)}}if(p){r.bindTexture(e.TEXTURE_CUBE_MAP,d.__webglTexture),setTextureParameters(e.TEXTURE_CUBE_MAP,o);for(let r=0;r<6;r++)if(o.mipmaps&&o.mipmaps.length>0)for(let s=0;s<o.mipmaps.length;s++)setupFrameBufferTexture(l.__webglFramebuffer[r][s],t,o,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+r,s);else setupFrameBufferTexture(l.__webglFramebuffer[r],t,o,e.COLOR_ATTACHMENT0,e.TEXTURE_CUBE_MAP_POSITIVE_X+r,0);textureNeedsGenerateMipmaps(o)&&generateMipmap(e.TEXTURE_CUBE_MAP),r.unbindTexture()}else if(g){for(let o=0,c=h.length;o<c;o++){const c=h[o],A=s.get(c);r.bindTexture(e.TEXTURE_2D,A.__webglTexture),setTextureParameters(e.TEXTURE_2D,c),setupFrameBufferTexture(l.__webglFramebuffer,t,c,e.COLOR_ATTACHMENT0+o,e.TEXTURE_2D,0),textureNeedsGenerateMipmaps(c)&&generateMipmap(e.TEXTURE_2D)}r.unbindTexture()}else{let s=e.TEXTURE_2D;if((t.isWebGL3DRenderTarget||t.isWebGLArrayRenderTarget)&&(s=t.isWebGL3DRenderTarget?e.TEXTURE_3D:e.TEXTURE_2D_ARRAY),r.bindTexture(s,d.__webglTexture),setTextureParameters(s,o),o.mipmaps&&o.mipmaps.length>0)for(let r=0;r<o.mipmaps.length;r++)setupFrameBufferTexture(l.__webglFramebuffer[r],t,o,e.COLOR_ATTACHMENT0,s,r);else setupFrameBufferTexture(l.__webglFramebuffer,t,o,e.COLOR_ATTACHMENT0,s,0);textureNeedsGenerateMipmaps(o)&&generateMipmap(s),r.unbindTexture()}t.depthBuffer&&setupDepthRenderbuffer(t)},this.updateRenderTargetMipmap=function updateRenderTargetMipmap(e){const t=e.textures;for(let o=0,l=t.length;o<l;o++){const l=t[o];if(textureNeedsGenerateMipmaps(l)){const t=getTargetType(e),o=s.get(l).__webglTexture;r.bindTexture(t,o),generateMipmap(t),r.unbindTexture()}}},this.updateMultisampleRenderTarget=function updateMultisampleRenderTarget(t){if(t.samples>0)if(!1===useMultisampledRTT(t)){const o=t.textures,l=t.width,c=t.height;let A=e.COLOR_BUFFER_BIT;const d=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,p=s.get(t),g=o.length>1;if(g)for(let t=0;t<o.length;t++)r.bindFramebuffer(e.FRAMEBUFFER,p.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,null),r.bindFramebuffer(e.FRAMEBUFFER,p.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,null,0);r.bindFramebuffer(e.READ_FRAMEBUFFER,p.__webglMultisampledFramebuffer);const m=t.texture.mipmaps;m&&m.length>0?r.bindFramebuffer(e.DRAW_FRAMEBUFFER,p.__webglFramebuffer[0]):r.bindFramebuffer(e.DRAW_FRAMEBUFFER,p.__webglFramebuffer);for(let r=0;r<o.length;r++){if(t.resolveDepthBuffer&&(t.depthBuffer&&(A|=e.DEPTH_BUFFER_BIT),t.stencilBuffer&&t.resolveStencilBuffer&&(A|=e.STENCIL_BUFFER_BIT)),g){e.framebufferRenderbuffer(e.READ_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.RENDERBUFFER,p.__webglColorRenderbuffer[r]);const t=s.get(o[r]).__webglTexture;e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0)}e.blitFramebuffer(0,0,l,c,0,0,l,c,A,e.NEAREST),!0===h&&(x.length=0,T.length=0,x.push(e.COLOR_ATTACHMENT0+r),t.depthBuffer&&!1===t.resolveDepthBuffer&&(x.push(d),T.push(d),e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,T)),e.invalidateFramebuffer(e.READ_FRAMEBUFFER,x))}if(r.bindFramebuffer(e.READ_FRAMEBUFFER,null),r.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),g)for(let t=0;t<o.length;t++){r.bindFramebuffer(e.FRAMEBUFFER,p.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.RENDERBUFFER,p.__webglColorRenderbuffer[t]);const l=s.get(o[t]).__webglTexture;r.bindFramebuffer(e.FRAMEBUFFER,p.__webglFramebuffer),e.framebufferTexture2D(e.DRAW_FRAMEBUFFER,e.COLOR_ATTACHMENT0+t,e.TEXTURE_2D,l,0)}r.bindFramebuffer(e.DRAW_FRAMEBUFFER,p.__webglMultisampledFramebuffer)}else if(t.depthBuffer&&!1===t.resolveDepthBuffer&&h){const r=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT;e.invalidateFramebuffer(e.DRAW_FRAMEBUFFER,[r])}},this.setupDepthRenderbuffer=setupDepthRenderbuffer,this.setupFrameBufferTexture=setupFrameBufferTexture,this.useMultisampledRTT=useMultisampledRTT}function WebGLUtils(e,t){return{convert:function convert(r,s=o.aCh){let l;const c=o.epp.getTransfer(s);if(r===o.ywz)return e.UNSIGNED_BYTE;if(r===o.k0A)return e.UNSIGNED_SHORT_4_4_4_4;if(r===o.irR)return e.UNSIGNED_SHORT_5_5_5_1;if(r===o.tQZ)return e.UNSIGNED_INT_5_9_9_9_REV;if(r===o.T95)return e.BYTE;if(r===o.iAb)return e.SHORT;if(r===o.LsT)return e.UNSIGNED_SHORT;if(r===o.Kz5)return e.INT;if(r===o.JQ4)return e.UNSIGNED_INT;if(r===o.VzW)return e.FLOAT;if(r===o.cLu)return e.HALF_FLOAT;if(r===o.OTo)return e.ALPHA;if(r===o.UCm)return e.RGB;if(r===o.wk1)return e.RGBA;if(r===o.qkB)return e.DEPTH_COMPONENT;if(r===o.brP)return e.DEPTH_STENCIL;if(r===o.hEm)return e.RED;if(r===o.D9w)return e.RED_INTEGER;if(r===o.av9)return e.RG;if(r===o.CtA)return e.RG_INTEGER;if(r===o.E2K)return e.RGBA_INTEGER;if(r===o.wuA||r===o.BFQ||r===o.v3W||r===o.ILR)if(c===o.j17){if(l=t.get("WEBGL_compressed_texture_s3tc_srgb"),null===l)return null;if(r===o.wuA)return l.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===o.BFQ)return l.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===o.v3W)return l.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===o.ILR)return l.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else{if(l=t.get("WEBGL_compressed_texture_s3tc"),null===l)return null;if(r===o.wuA)return l.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===o.BFQ)return l.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===o.v3W)return l.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===o.ILR)return l.COMPRESSED_RGBA_S3TC_DXT5_EXT}if(r===o._AM||r===o.vCx||r===o.eaV||r===o.CaW){if(l=t.get("WEBGL_compressed_texture_pvrtc"),null===l)return null;if(r===o._AM)return l.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===o.vCx)return l.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===o.eaV)return l.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===o.CaW)return l.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(r===o.fto||r===o.l0P||r===o.ekQ){if(l=t.get("WEBGL_compressed_texture_etc"),null===l)return null;if(r===o.fto||r===o.l0P)return c===o.j17?l.COMPRESSED_SRGB8_ETC2:l.COMPRESSED_RGB8_ETC2;if(r===o.ekQ)return c===o.j17?l.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:l.COMPRESSED_RGBA8_ETC2_EAC}if(r===o.ptH||r===o.jZA||r===o.y2t||r===o.gi4||r===o.Djp||r===o.BG$||r===o.NYV||r===o.xJs||r===o.pKu||r===o.GG6||r===o.Gih||r===o.FUD||r===o.iiP||r===o.SvJ){if(l=t.get("WEBGL_compressed_texture_astc"),null===l)return null;if(r===o.ptH)return c===o.j17?l.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:l.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===o.jZA)return c===o.j17?l.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:l.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===o.y2t)return c===o.j17?l.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:l.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===o.gi4)return c===o.j17?l.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:l.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===o.Djp)return c===o.j17?l.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:l.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===o.BG$)return c===o.j17?l.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:l.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===o.NYV)return c===o.j17?l.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:l.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===o.xJs)return c===o.j17?l.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:l.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===o.pKu)return c===o.j17?l.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:l.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===o.GG6)return c===o.j17?l.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:l.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===o.Gih)return c===o.j17?l.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:l.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===o.FUD)return c===o.j17?l.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:l.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===o.iiP)return c===o.j17?l.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:l.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===o.SvJ)return c===o.j17?l.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:l.COMPRESSED_RGBA_ASTC_12x12_KHR}if(r===o.bsb||r===o.f2y||r===o.QO2){if(l=t.get("EXT_texture_compression_bptc"),null===l)return null;if(r===o.bsb)return c===o.j17?l.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:l.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(r===o.f2y)return l.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(r===o.QO2)return l.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}if(r===o.HdW||r===o.vuL||r===o.ZTh||r===o.lGU){if(l=t.get("EXT_texture_compression_rgtc"),null===l)return null;if(r===o.bsb)return l.COMPRESSED_RED_RGTC1_EXT;if(r===o.vuL)return l.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===o.ZTh)return l.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===o.lGU)return l.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}return r===o.wJv?e.UNSIGNED_INT_24_8:void 0!==e[r]?e[r]:null}}}class WebXRDepthSensing{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,r){if(null===this.texture){const s=new o.xEZ;e.properties.get(s).__webglTexture=t.texture,t.depthNear===r.depthNear&&t.depthFar===r.depthFar||(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=s}}getMesh(e){if(null!==this.texture&&null===this.mesh){const t=e.cameras[0].viewport,r=new o.jyz({vertexShader:"\nvoid main() {\n\n\tgl_Position = vec4( position, 1.0 );\n\n}",fragmentShader:"\nuniform sampler2DArray depthColor;\nuniform float depthWidth;\nuniform float depthHeight;\n\nvoid main() {\n\n\tvec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );\n\n\tif ( coord.x >= 1.0 ) {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;\n\n\t} else {\n\n\t\tgl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;\n\n\t}\n\n}",uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new o.Kj0(new o._12(20,20),r)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class WebXRManager extends o.pBf{constructor(e,t){super();const r=this;let s=null,l=1,c=null,A="local-floor",d=1,h=null,p=null,g=null,m=null,f=null,E=null;const _=new WebXRDepthSensing,C=t.getContextAttributes();let I=null,S=null;const x=[],T=[],y=new o.FM8;let b=null;const B=new o.cPb;B.viewport=new o.Ltg;const U=new o.cPb;U.viewport=new o.Ltg;const F=[B,U],Q=new o.HkE;let O=null,G=null;function onSessionEvent(e){const t=T.indexOf(e.inputSource);if(-1===t)return;const r=x[t];void 0!==r&&(r.update(e.inputSource,e.frame,h||c),r.dispatchEvent({type:e.type,data:e.inputSource}))}function onSessionEnd(){s.removeEventListener("select",onSessionEvent),s.removeEventListener("selectstart",onSessionEvent),s.removeEventListener("selectend",onSessionEvent),s.removeEventListener("squeeze",onSessionEvent),s.removeEventListener("squeezestart",onSessionEvent),s.removeEventListener("squeezeend",onSessionEvent),s.removeEventListener("end",onSessionEnd),s.removeEventListener("inputsourceschange",onInputSourcesChange);for(let e=0;e<x.length;e++){const t=T[e];null!==t&&(T[e]=null,x[e].disconnect(t))}O=null,G=null,_.reset(),e.setRenderTarget(I),f=null,m=null,g=null,s=null,S=null,K.stop(),r.isPresenting=!1,e.setPixelRatio(b),e.setSize(y.width,y.height,!1),r.dispatchEvent({type:"sessionend"})}function onInputSourcesChange(e){for(let t=0;t<e.removed.length;t++){const r=e.removed[t],s=T.indexOf(r);s>=0&&(T[s]=null,x[s].disconnect(r))}for(let t=0;t<e.added.length;t++){const r=e.added[t];let s=T.indexOf(r);if(-1===s){for(let e=0;e<x.length;e++){if(e>=T.length){T.push(r),s=e;break}if(null===T[e]){T[e]=r,s=e;break}}if(-1===s)break}const o=x[s];o&&o.connect(r)}}this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=x[e];return void 0===t&&(t=new o.NiX,x[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=x[e];return void 0===t&&(t=new o.NiX,x[e]=t),t.getGripSpace()},this.getHand=function(e){let t=x[e];return void 0===t&&(t=new o.NiX,x[e]=t),t.getHandSpace()},this.setFramebufferScaleFactor=function(e){l=e,!0===r.isPresenting&&un.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(e){A=e,!0===r.isPresenting&&un.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return h||c},this.setReferenceSpace=function(e){h=e},this.getBaseLayer=function(){return null!==m?m:f},this.getBinding=function(){return g},this.getFrame=function(){return E},this.getSession=function(){return s},this.setSession=async function(p){if(s=p,null!==s){I=e.getRenderTarget(),s.addEventListener("select",onSessionEvent),s.addEventListener("selectstart",onSessionEvent),s.addEventListener("selectend",onSessionEvent),s.addEventListener("squeeze",onSessionEvent),s.addEventListener("squeezestart",onSessionEvent),s.addEventListener("squeezeend",onSessionEvent),s.addEventListener("end",onSessionEnd),s.addEventListener("inputsourceschange",onInputSourcesChange),!0!==C.xrCompatible&&await t.makeXRCompatible(),b=e.getPixelRatio(),e.getSize(y);if("undefined"!=typeof XRWebGLBinding&&"createProjectionLayer"in XRWebGLBinding.prototype){let r=null,c=null,A=null;C.depth&&(A=C.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,r=C.stencil?o.brP:o.qkB,c=C.stencil?o.wJv:o.JQ4);const d={colorFormat:t.RGBA8,depthFormat:A,scaleFactor:l};g=new XRWebGLBinding(s,t),m=g.createProjectionLayer(d),s.updateRenderState({layers:[m]}),e.setPixelRatio(1),e.setSize(m.textureWidth,m.textureHeight,!1),S=new o.dd2(m.textureWidth,m.textureHeight,{format:o.wk1,type:o.ywz,depthTexture:new o.$YQ(m.textureWidth,m.textureHeight,c,void 0,void 0,void 0,void 0,void 0,void 0,r),stencilBuffer:C.stencil,colorSpace:e.outputColorSpace,samples:C.antialias?4:0,resolveDepthBuffer:!1===m.ignoreDepthValues,resolveStencilBuffer:!1===m.ignoreDepthValues})}else{const r={antialias:C.antialias,alpha:!0,depth:C.depth,stencil:C.stencil,framebufferScaleFactor:l};f=new XRWebGLLayer(s,t,r),s.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),S=new o.dd2(f.framebufferWidth,f.framebufferHeight,{format:o.wk1,type:o.ywz,colorSpace:e.outputColorSpace,stencilBuffer:C.stencil,resolveDepthBuffer:!1===f.ignoreDepthValues,resolveStencilBuffer:!1===f.ignoreDepthValues})}S.isXRRenderTarget=!0,this.setFoveation(d),h=null,c=await s.requestReferenceSpace(A),K.setContext(s),K.start(),r.isPresenting=!0,r.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(null!==s)return s.environmentBlendMode},this.getDepthTexture=function(){return _.getDepthTexture()};const W=new o.Pa4,q=new o.Pa4;function updateCamera(e,t){null===t?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){if(null===s)return;let t=e.near,r=e.far;null!==_.texture&&(_.depthNear>0&&(t=_.depthNear),_.depthFar>0&&(r=_.depthFar)),Q.near=U.near=B.near=t,Q.far=U.far=B.far=r,O===Q.near&&G===Q.far||(s.updateRenderState({depthNear:Q.near,depthFar:Q.far}),O=Q.near,G=Q.far),B.layers.mask=2|e.layers.mask,U.layers.mask=4|e.layers.mask,Q.layers.mask=B.layers.mask|U.layers.mask;const l=e.parent,c=Q.cameras;updateCamera(Q,l);for(let e=0;e<c.length;e++)updateCamera(c[e],l);2===c.length?function setProjectionFromUnion(e,t,r){W.setFromMatrixPosition(t.matrixWorld),q.setFromMatrixPosition(r.matrixWorld);const s=W.distanceTo(q),o=t.projectionMatrix.elements,l=r.projectionMatrix.elements,c=o[14]/(o[10]-1),A=o[14]/(o[10]+1),d=(o[9]+1)/o[5],h=(o[9]-1)/o[5],p=(o[8]-1)/o[0],g=(l[8]+1)/l[0],m=c*p,f=c*g,E=s/(-p+g),_=E*-p;if(t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(_),e.translateZ(E),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert(),-1===o[10])e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse);else{const t=c+E,r=A+E,o=m-_,l=f+(s-_),p=d*A/r*t,g=h*A/r*t;e.projectionMatrix.makePerspective(o,l,p,g,t,r),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}}(Q,B,U):Q.projectionMatrix.copy(B.projectionMatrix),function updateUserCamera(e,t,r){null===r?e.matrix.copy(t.matrixWorld):(e.matrix.copy(r.matrixWorld),e.matrix.invert(),e.matrix.multiply(t.matrixWorld));e.matrix.decompose(e.position,e.quaternion,e.scale),e.updateMatrixWorld(!0),e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse),e.isPerspectiveCamera&&(e.fov=2*o.I3e*Math.atan(1/e.projectionMatrix.elements[5]),e.zoom=1)}(e,Q,l)},this.getCamera=function(){return Q},this.getFoveation=function(){if(null!==m||null!==f)return d},this.setFoveation=function(e){d=e,null!==m&&(m.fixedFoveation=e),null!==f&&void 0!==f.fixedFoveation&&(f.fixedFoveation=e)},this.hasDepthSensing=function(){return null!==_.texture},this.getDepthSensingMesh=function(){return _.getMesh(Q)};let X=null;const K=new WebGLAnimation;K.setAnimationLoop((function onAnimationFrame(t,l){if(p=l.getViewerPose(h||c),E=l,null!==p){const t=p.views;null!==f&&(e.setRenderTargetFramebuffer(S,f.framebuffer),e.setRenderTarget(S));let r=!1;t.length!==Q.cameras.length&&(Q.cameras.length=0,r=!0);for(let s=0;s<t.length;s++){const l=t[s];let c=null;if(null!==f)c=f.getViewport(l);else{const t=g.getViewSubImage(m,l);c=t.viewport,0===s&&(e.setRenderTargetTextures(S,t.colorTexture,t.depthStencilTexture),e.setRenderTarget(S))}let A=F[s];void 0===A&&(A=new o.cPb,A.layers.enable(s),A.viewport=new o.Ltg,F[s]=A),A.matrix.fromArray(l.transform.matrix),A.matrix.decompose(A.position,A.quaternion,A.scale),A.projectionMatrix.fromArray(l.projectionMatrix),A.projectionMatrixInverse.copy(A.projectionMatrix).invert(),A.viewport.set(c.x,c.y,c.width,c.height),0===s&&(Q.matrix.copy(A.matrix),Q.matrix.decompose(Q.position,Q.quaternion,Q.scale)),!0===r&&Q.cameras.push(A)}const l=s.enabledFeatures;if(l&&l.includes("depth-sensing")&&"gpu-optimized"==s.depthUsage&&g){const r=g.getDepthInformation(t[0]);r&&r.isValid&&r.texture&&_.init(e,r,s.renderState)}}for(let e=0;e<x.length;e++){const t=T[e],r=x[e];null!==t&&void 0!==r&&r.update(t,l,h||c)}X&&X(t,l),l.detectedPlanes&&r.dispatchEvent({type:"planesdetected",data:l}),E=null})),this.setAnimationLoop=function(e){X=e},this.dispose=function(){}}}const Jn=new o.USm,$n=new o.yGw;function WebGLMaterials(e,t){function refreshTransformUniform(e,t){!0===e.matrixAutoUpdate&&e.updateMatrix(),t.value.copy(e.matrix)}function refreshUniformsCommon(e,r){e.opacity.value=r.opacity,r.color&&e.diffuse.value.copy(r.color),r.emissive&&e.emissive.value.copy(r.emissive).multiplyScalar(r.emissiveIntensity),r.map&&(e.map.value=r.map,refreshTransformUniform(r.map,e.mapTransform)),r.alphaMap&&(e.alphaMap.value=r.alphaMap,refreshTransformUniform(r.alphaMap,e.alphaMapTransform)),r.bumpMap&&(e.bumpMap.value=r.bumpMap,refreshTransformUniform(r.bumpMap,e.bumpMapTransform),e.bumpScale.value=r.bumpScale,r.side===o._Li&&(e.bumpScale.value*=-1)),r.normalMap&&(e.normalMap.value=r.normalMap,refreshTransformUniform(r.normalMap,e.normalMapTransform),e.normalScale.value.copy(r.normalScale),r.side===o._Li&&e.normalScale.value.negate()),r.displacementMap&&(e.displacementMap.value=r.displacementMap,refreshTransformUniform(r.displacementMap,e.displacementMapTransform),e.displacementScale.value=r.displacementScale,e.displacementBias.value=r.displacementBias),r.emissiveMap&&(e.emissiveMap.value=r.emissiveMap,refreshTransformUniform(r.emissiveMap,e.emissiveMapTransform)),r.specularMap&&(e.specularMap.value=r.specularMap,refreshTransformUniform(r.specularMap,e.specularMapTransform)),r.alphaTest>0&&(e.alphaTest.value=r.alphaTest);const s=t.get(r),l=s.envMap,c=s.envMapRotation;l&&(e.envMap.value=l,Jn.copy(c),Jn.x*=-1,Jn.y*=-1,Jn.z*=-1,l.isCubeTexture&&!1===l.isRenderTargetTexture&&(Jn.y*=-1,Jn.z*=-1),e.envMapRotation.value.setFromMatrix4($n.makeRotationFromEuler(Jn)),e.flipEnvMap.value=l.isCubeTexture&&!1===l.isRenderTargetTexture?-1:1,e.reflectivity.value=r.reflectivity,e.ior.value=r.ior,e.refractionRatio.value=r.refractionRatio),r.lightMap&&(e.lightMap.value=r.lightMap,e.lightMapIntensity.value=r.lightMapIntensity,refreshTransformUniform(r.lightMap,e.lightMapTransform)),r.aoMap&&(e.aoMap.value=r.aoMap,e.aoMapIntensity.value=r.aoMapIntensity,refreshTransformUniform(r.aoMap,e.aoMapTransform))}return{refreshFogUniforms:function refreshFogUniforms(t,r){r.color.getRGB(t.fogColor.value,(0,o.oDz)(e)),r.isFog?(t.fogNear.value=r.near,t.fogFar.value=r.far):r.isFogExp2&&(t.fogDensity.value=r.density)},refreshMaterialUniforms:function refreshMaterialUniforms(e,r,s,l,c){r.isMeshBasicMaterial||r.isMeshLambertMaterial?refreshUniformsCommon(e,r):r.isMeshToonMaterial?(refreshUniformsCommon(e,r),function refreshUniformsToon(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}(e,r)):r.isMeshPhongMaterial?(refreshUniformsCommon(e,r),function refreshUniformsPhong(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}(e,r)):r.isMeshStandardMaterial?(refreshUniformsCommon(e,r),function refreshUniformsStandard(e,t){e.metalness.value=t.metalness,t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap,refreshTransformUniform(t.metalnessMap,e.metalnessMapTransform));e.roughness.value=t.roughness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap,refreshTransformUniform(t.roughnessMap,e.roughnessMapTransform));t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}(e,r),r.isMeshPhysicalMaterial&&function refreshUniformsPhysical(e,t,r){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap,refreshTransformUniform(t.sheenColorMap,e.sheenColorMapTransform)),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap,refreshTransformUniform(t.sheenRoughnessMap,e.sheenRoughnessMapTransform)));t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap,refreshTransformUniform(t.clearcoatMap,e.clearcoatMapTransform)),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap,refreshTransformUniform(t.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),t.clearcoatNormalMap&&(e.clearcoatNormalMap.value=t.clearcoatNormalMap,refreshTransformUniform(t.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),t.side===o._Li&&e.clearcoatNormalScale.value.negate()));t.dispersion>0&&(e.dispersion.value=t.dispersion);t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap,refreshTransformUniform(t.iridescenceMap,e.iridescenceMapTransform)),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap,refreshTransformUniform(t.iridescenceThicknessMap,e.iridescenceThicknessMapTransform)));t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=r.texture,e.transmissionSamplerSize.value.set(r.width,r.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap,refreshTransformUniform(t.transmissionMap,e.transmissionMapTransform)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap,refreshTransformUniform(t.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor));t.anisotropy>0&&(e.anisotropyVector.value.set(t.anisotropy*Math.cos(t.anisotropyRotation),t.anisotropy*Math.sin(t.anisotropyRotation)),t.anisotropyMap&&(e.anisotropyMap.value=t.anisotropyMap,refreshTransformUniform(t.anisotropyMap,e.anisotropyMapTransform)));e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap,refreshTransformUniform(t.specularColorMap,e.specularColorMapTransform));t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap,refreshTransformUniform(t.specularIntensityMap,e.specularIntensityMapTransform))}(e,r,c)):r.isMeshMatcapMaterial?(refreshUniformsCommon(e,r),function refreshUniformsMatcap(e,t){t.matcap&&(e.matcap.value=t.matcap)}(e,r)):r.isMeshDepthMaterial?refreshUniformsCommon(e,r):r.isMeshDistanceMaterial?(refreshUniformsCommon(e,r),function refreshUniformsDistance(e,r){const s=t.get(r).light;e.referencePosition.value.setFromMatrixPosition(s.matrixWorld),e.nearDistance.value=s.shadow.camera.near,e.farDistance.value=s.shadow.camera.far}(e,r)):r.isMeshNormalMaterial?refreshUniformsCommon(e,r):r.isLineBasicMaterial?(!function refreshUniformsLine(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,t.map&&(e.map.value=t.map,refreshTransformUniform(t.map,e.mapTransform))}(e,r),r.isLineDashedMaterial&&function refreshUniformsDash(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}(e,r)):r.isPointsMaterial?function refreshUniformsPoints(e,t,r,s){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*r,e.scale.value=.5*s,t.map&&(e.map.value=t.map,refreshTransformUniform(t.map,e.uvTransform));t.alphaMap&&(e.alphaMap.value=t.alphaMap,refreshTransformUniform(t.alphaMap,e.alphaMapTransform));t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,r,s,l):r.isSpriteMaterial?function refreshUniformsSprites(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map,refreshTransformUniform(t.map,e.mapTransform));t.alphaMap&&(e.alphaMap.value=t.alphaMap,refreshTransformUniform(t.alphaMap,e.alphaMapTransform));t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}(e,r):r.isShadowMaterial?(e.color.value.copy(r.color),e.opacity.value=r.opacity):r.isShaderMaterial&&(r.uniformsNeedUpdate=!1)}}}function WebGLUniformsGroups(e,t,r,s){let o={},l={},c=[];const A=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function hasUniformChanged(e,t,r,s){const o=e.value,l=t+"_"+r;if(void 0===s[l])return s[l]="number"==typeof o||"boolean"==typeof o?o:o.clone(),!0;{const e=s[l];if("number"==typeof o||"boolean"==typeof o){if(e!==o)return s[l]=o,!0}else if(!1===e.equals(o))return e.copy(o),!0}return!1}function getUniformSize(e){const t={boundary:0,storage:0};return"number"==typeof e||"boolean"==typeof e?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?un.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):un.warn("THREE.WebGLRenderer: Unsupported uniform value type.",e),t}function onUniformsGroupsDispose(t){const r=t.target;r.removeEventListener("dispose",onUniformsGroupsDispose);const s=c.indexOf(r.__bindingPointIndex);c.splice(s,1),e.deleteBuffer(o[r.id]),delete o[r.id],delete l[r.id]}return{bind:function bind(e,t){const r=t.program;s.uniformBlockBinding(e,r)},update:function update(r,d){let h=o[r.id];void 0===h&&(!function prepareUniformsGroup(e){const t=e.uniforms;let r=0;const s=16;for(let e=0,o=t.length;e<o;e++){const o=Array.isArray(t[e])?t[e]:[t[e]];for(let e=0,t=o.length;e<t;e++){const t=o[e],l=Array.isArray(t.value)?t.value:[t.value];for(let e=0,o=l.length;e<o;e++){const o=getUniformSize(l[e]),c=r%s,A=c%o.boundary,d=c+A;r+=A,0!==d&&s-d<o.storage&&(r+=s-d),t.__data=new Float32Array(o.storage/Float32Array.BYTES_PER_ELEMENT),t.__offset=r,r+=o.storage}}}const o=r%s;o>0&&(r+=s-o);return e.__size=r,e.__cache={},this}(r),h=function createBuffer(t){const r=function allocateBindingPointIndex(){for(let e=0;e<A;e++)if(-1===c.indexOf(e))return c.push(e),e;return un.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}();t.__bindingPointIndex=r;const s=e.createBuffer(),o=t.__size,l=t.usage;return e.bindBuffer(e.UNIFORM_BUFFER,s),e.bufferData(e.UNIFORM_BUFFER,o,l),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,r,s),s}(r),o[r.id]=h,r.addEventListener("dispose",onUniformsGroupsDispose));const p=d.program;s.updateUBOMapping(r,p);const g=t.render.frame;l[r.id]!==g&&(!function updateBufferData(t){const r=o[t.id],s=t.uniforms,l=t.__cache;e.bindBuffer(e.UNIFORM_BUFFER,r);for(let t=0,r=s.length;t<r;t++){const r=Array.isArray(s[t])?s[t]:[s[t]];for(let s=0,o=r.length;s<o;s++){const o=r[s];if(!0===hasUniformChanged(o,t,s,l)){const t=o.__offset,r=Array.isArray(o.value)?o.value:[o.value];let s=0;for(let l=0;l<r.length;l++){const c=r[l],A=getUniformSize(c);"number"==typeof c||"boolean"==typeof c?(o.__data[0]=c,e.bufferSubData(e.UNIFORM_BUFFER,t+s,o.__data)):c.isMatrix3?(o.__data[0]=c.elements[0],o.__data[1]=c.elements[1],o.__data[2]=c.elements[2],o.__data[3]=0,o.__data[4]=c.elements[3],o.__data[5]=c.elements[4],o.__data[6]=c.elements[5],o.__data[7]=0,o.__data[8]=c.elements[6],o.__data[9]=c.elements[7],o.__data[10]=c.elements[8],o.__data[11]=0):(c.toArray(o.__data,s),s+=A.storage/Float32Array.BYTES_PER_ELEMENT)}e.bufferSubData(e.UNIFORM_BUFFER,t,o.__data)}}}e.bindBuffer(e.UNIFORM_BUFFER,null)}(r),l[r.id]=g)},dispose:function dispose(){for(const t in o)e.deleteBuffer(o[t]);c=[],o={},l={}}}}class WebGLRenderer{constructor(e={}){const{canvas:t=(0,o.O5A)(),context:r=null,depth:s=!0,stencil:l=!1,alpha:c=!1,antialias:A=!1,premultipliedAlpha:d=!0,preserveDrawingBuffer:h=!1,powerPreference:p="default",failIfMajorPerformanceCaveat:g=!1,reverseDepthBuffer:m=!1}=e;let f;if(this.isWebGLRenderer=!0,null!==r){if("undefined"!=typeof WebGLRenderingContext&&r instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");f=r.getContextAttributes().alpha}else f=c;const E=new Uint32Array(4),_=new Int32Array(4);let C=null,I=null;const S=[],x=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=o.uL9,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const T=this;let y=!1;this._outputColorSpace=o.KI_;let b=0,B=0,U=null,F=-1,Q=null;const O=new o.Ltg,G=new o.Ltg;let W=null;const q=new o.Ilk(0);let X=0,K=t.width,j=t.height,Y=1,J=null,$=null;const ee=new o.Ltg(0,0,K,j),te=new o.Ltg(0,0,K,j);let ne=!1;const ie=new o.iWj;let re=!1,ae=!1;const se=new o.yGw,oe=new o.yGw,le=new o.Pa4,ce=new o.Ltg,Ae={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let de=!1;function getTargetPixelRatio(){return null===U?Y:1}let ue,he,pe,ge,me,fe,Ee,ve,_e,Ce,Ie,Se,xe,Te,ye,Me,we,be,Be,Re,Le,De,Ue,Pe,Fe=r;function getContext(e,r){return t.getContext(e,r)}try{const e={alpha:!0,depth:s,stencil:l,antialias:A,premultipliedAlpha:d,preserveDrawingBuffer:h,powerPreference:p,failIfMajorPerformanceCaveat:g};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${o.UZH}`),t.addEventListener("webglcontextlost",onContextLost,!1),t.addEventListener("webglcontextrestored",onContextRestore,!1),t.addEventListener("webglcontextcreationerror",onContextCreationError,!1),null===Fe){const t="webgl2";if(Fe=getContext(t,e),null===Fe)throw getContext(t)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(e){throw un.error("THREE.WebGLRenderer: "+e.message),e}function initGLContext(){ue=new WebGLExtensions(Fe),ue.init(),De=new WebGLUtils(Fe,ue),he=new WebGLCapabilities(Fe,ue,e,De),pe=new WebGLState(Fe,ue),he.reverseDepthBuffer&&m&&pe.buffers.depth.setReversed(!0),ge=new WebGLInfo(Fe),me=new WebGLProperties,fe=new WebGLTextures(Fe,ue,pe,me,he,De,ge),Ee=new WebGLCubeMaps(T),ve=new WebGLCubeUVMaps(T),_e=new WebGLAttributes(Fe),Ue=new WebGLBindingStates(Fe,_e),Ce=new WebGLGeometries(Fe,_e,ge,Ue),Ie=new WebGLObjects(Fe,Ce,_e,ge),Be=new WebGLMorphtargets(Fe,he,fe),Me=new WebGLClipping(me),Se=new WebGLPrograms(T,Ee,ve,ue,he,Ue,Me),xe=new WebGLMaterials(T,me),Te=new WebGLRenderLists,ye=new WebGLRenderStates(ue),be=new WebGLBackground(T,Ee,ve,pe,Ie,f,d),we=new WebGLShadowMap(T,Ie,he),Pe=new WebGLUniformsGroups(Fe,ge,he,pe),Re=new WebGLBufferRenderer(Fe,ue,ge),Le=new WebGLIndexedBufferRenderer(Fe,ue,ge),ge.programs=Se.programs,T.capabilities=he,T.extensions=ue,T.properties=me,T.renderLists=Te,T.shadowMap=we,T.state=pe,T.info=ge}initGLContext();const Qe=new WebXRManager(T,Fe);function onContextLost(e){e.preventDefault(),un.log("THREE.WebGLRenderer: Context Lost."),y=!0}function onContextRestore(){un.log("THREE.WebGLRenderer: Context Restored."),y=!1;const e=ge.autoReset,t=we.enabled,r=we.autoUpdate,s=we.needsUpdate,o=we.type;initGLContext(),ge.autoReset=e,we.enabled=t,we.autoUpdate=r,we.needsUpdate=s,we.type=o}function onContextCreationError(e){un.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",e.statusMessage)}function onMaterialDispose(e){const t=e.target;t.removeEventListener("dispose",onMaterialDispose),function deallocateMaterial(e){(function releaseMaterialProgramReferences(e){const t=me.get(e).programs;void 0!==t&&(t.forEach((function(e){Se.releaseProgram(e)})),e.isShaderMaterial&&Se.releaseShaderCache(e))})(e),me.remove(e)}(t)}function prepareMaterial(e,t,r){!0===e.transparent&&e.side===o.ehD&&!1===e.forceSinglePass?(e.side=o._Li,e.needsUpdate=!0,getProgram(e,t,r),e.side=o.Wl3,e.needsUpdate=!0,getProgram(e,t,r),e.side=o.ehD):getProgram(e,t,r)}this.xr=Qe,this.getContext=function(){return Fe},this.getContextAttributes=function(){return Fe.getContextAttributes()},this.forceContextLoss=function(){const e=ue.get("WEBGL_lose_context");e&&e.loseContext()},this.forceContextRestore=function(){const e=ue.get("WEBGL_lose_context");e&&e.restoreContext()},this.getPixelRatio=function(){return Y},this.setPixelRatio=function(e){void 0!==e&&(Y=e,this.setSize(K,j,!1))},this.getSize=function(e){return e.set(K,j)},this.setSize=function(e,r,s=!0){Qe.isPresenting?un.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting."):(K=e,j=r,t.width=Math.floor(e*Y),t.height=Math.floor(r*Y),!0===s&&(t.style.width=e+"px",t.style.height=r+"px"),this.setViewport(0,0,e,r))},this.getDrawingBufferSize=function(e){return e.set(K*Y,j*Y).floor()},this.setDrawingBufferSize=function(e,r,s){K=e,j=r,Y=s,t.width=Math.floor(e*s),t.height=Math.floor(r*s),this.setViewport(0,0,e,r)},this.getCurrentViewport=function(e){return e.copy(O)},this.getViewport=function(e){return e.copy(ee)},this.setViewport=function(e,t,r,s){e.isVector4?ee.set(e.x,e.y,e.z,e.w):ee.set(e,t,r,s),pe.viewport(O.copy(ee).multiplyScalar(Y).round())},this.getScissor=function(e){return e.copy(te)},this.setScissor=function(e,t,r,s){e.isVector4?te.set(e.x,e.y,e.z,e.w):te.set(e,t,r,s),pe.scissor(G.copy(te).multiplyScalar(Y).round())},this.getScissorTest=function(){return ne},this.setScissorTest=function(e){pe.setScissorTest(ne=e)},this.setOpaqueSort=function(e){J=e},this.setTransparentSort=function(e){$=e},this.getClearColor=function(e){return e.copy(be.getClearColor())},this.setClearColor=function(){be.setClearColor(...arguments)},this.getClearAlpha=function(){return be.getClearAlpha()},this.setClearAlpha=function(){be.setClearAlpha(...arguments)},this.clear=function(e=!0,t=!0,r=!0){let s=0;if(e){let e=!1;if(null!==U){const t=U.texture.format;e=t===o.E2K||t===o.CtA||t===o.D9w}if(e){const e=U.texture.type,t=e===o.ywz||e===o.JQ4||e===o.LsT||e===o.wJv||e===o.k0A||e===o.irR,r=be.getClearColor(),s=be.getClearAlpha(),l=r.r,c=r.g,A=r.b;t?(E[0]=l,E[1]=c,E[2]=A,E[3]=s,Fe.clearBufferuiv(Fe.COLOR,0,E)):(_[0]=l,_[1]=c,_[2]=A,_[3]=s,Fe.clearBufferiv(Fe.COLOR,0,_))}else s|=Fe.COLOR_BUFFER_BIT}t&&(s|=Fe.DEPTH_BUFFER_BIT),r&&(s|=Fe.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),Fe.clear(s)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",onContextLost,!1),t.removeEventListener("webglcontextrestored",onContextRestore,!1),t.removeEventListener("webglcontextcreationerror",onContextCreationError,!1),be.dispose(),Te.dispose(),ye.dispose(),me.dispose(),Ee.dispose(),ve.dispose(),Ie.dispose(),Ue.dispose(),Pe.dispose(),Se.dispose(),Qe.dispose(),Qe.removeEventListener("sessionstart",onXRSessionStart),Qe.removeEventListener("sessionend",onXRSessionEnd),Oe.stop()},this.renderBufferDirect=function(e,t,r,s,l,c){null===t&&(t=Ae);const A=l.isMesh&&l.matrixWorld.determinant()<0,d=function setProgram(e,t,r,s,l){!0!==t.isScene&&(t=Ae);fe.resetTextureUnits();const c=t.fog,A=s.isMeshStandardMaterial?t.environment:null,d=null===U?T.outputColorSpace:!0===U.isXRRenderTarget?U.texture.colorSpace:o.GUF,h=(s.isMeshStandardMaterial?ve:Ee).get(s.envMap||A),p=!0===s.vertexColors&&!!r.attributes.color&&4===r.attributes.color.itemSize,g=!!r.attributes.tangent&&(!!s.normalMap||s.anisotropy>0),m=!!r.morphAttributes.position,f=!!r.morphAttributes.normal,E=!!r.morphAttributes.color;let _=o.uL9;s.toneMapped&&(null!==U&&!0!==U.isXRRenderTarget||(_=T.toneMapping));const C=r.morphAttributes.position||r.morphAttributes.normal||r.morphAttributes.color,S=void 0!==C?C.length:0,x=me.get(s),y=I.state.lights;if(!0===re&&(!0===ae||e!==Q)){const t=e===Q&&s.id===F;Me.setState(s,e,t)}let b=!1;s.version===x.__version?x.needsLights&&x.lightsStateVersion!==y.state.version||x.outputColorSpace!==d||l.isBatchedMesh&&!1===x.batching?b=!0:l.isBatchedMesh||!0!==x.batching?l.isBatchedMesh&&!0===x.batchingColor&&null===l.colorTexture||l.isBatchedMesh&&!1===x.batchingColor&&null!==l.colorTexture||l.isInstancedMesh&&!1===x.instancing?b=!0:l.isInstancedMesh||!0!==x.instancing?l.isSkinnedMesh&&!1===x.skinning?b=!0:l.isSkinnedMesh||!0!==x.skinning?l.isInstancedMesh&&!0===x.instancingColor&&null===l.instanceColor||l.isInstancedMesh&&!1===x.instancingColor&&null!==l.instanceColor||l.isInstancedMesh&&!0===x.instancingMorph&&null===l.morphTexture||l.isInstancedMesh&&!1===x.instancingMorph&&null!==l.morphTexture||x.envMap!==h||!0===s.fog&&x.fog!==c?b=!0:void 0===x.numClippingPlanes||x.numClippingPlanes===Me.numPlanes&&x.numIntersection===Me.numIntersection?(x.vertexAlphas!==p||x.vertexTangents!==g||x.morphTargets!==m||x.morphNormals!==f||x.morphColors!==E||x.toneMapping!==_||x.morphTargetsCount!==S)&&(b=!0):b=!0:b=!0:b=!0:b=!0:(b=!0,x.__version=s.version);let B=x.currentProgram;!0===b&&(B=getProgram(s,t,l));let O=!1,G=!1,W=!1;const q=B.getUniforms(),X=x.uniforms;pe.useProgram(B.program)&&(O=!0,G=!0,W=!0);s.id!==F&&(F=s.id,G=!0);if(O||Q!==e){pe.buffers.depth.getReversed()?(se.copy(e.projectionMatrix),(0,o.tNt)(se),(0,o.yHo)(se),q.setValue(Fe,"projectionMatrix",se)):q.setValue(Fe,"projectionMatrix",e.projectionMatrix),q.setValue(Fe,"viewMatrix",e.matrixWorldInverse);const t=q.map.cameraPosition;void 0!==t&&t.setValue(Fe,le.setFromMatrixPosition(e.matrixWorld)),he.logarithmicDepthBuffer&&q.setValue(Fe,"logDepthBufFC",2/(Math.log(e.far+1)/Math.LN2)),(s.isMeshPhongMaterial||s.isMeshToonMaterial||s.isMeshLambertMaterial||s.isMeshBasicMaterial||s.isMeshStandardMaterial||s.isShaderMaterial)&&q.setValue(Fe,"isOrthographic",!0===e.isOrthographicCamera),Q!==e&&(Q=e,G=!0,W=!0)}if(l.isSkinnedMesh){q.setOptional(Fe,l,"bindMatrix"),q.setOptional(Fe,l,"bindMatrixInverse");const e=l.skeleton;e&&(null===e.boneTexture&&e.computeBoneTexture(),q.setValue(Fe,"boneTexture",e.boneTexture,fe))}l.isBatchedMesh&&(q.setOptional(Fe,l,"batchingTexture"),q.setValue(Fe,"batchingTexture",l._matricesTexture,fe),q.setOptional(Fe,l,"batchingIdTexture"),q.setValue(Fe,"batchingIdTexture",l._indirectTexture,fe),q.setOptional(Fe,l,"batchingColorTexture"),null!==l._colorsTexture&&q.setValue(Fe,"batchingColorTexture",l._colorsTexture,fe));const K=r.morphAttributes;void 0===K.position&&void 0===K.normal&&void 0===K.color||Be.update(l,r,B);(G||x.receiveShadow!==l.receiveShadow)&&(x.receiveShadow=l.receiveShadow,q.setValue(Fe,"receiveShadow",l.receiveShadow));s.isMeshGouraudMaterial&&null!==s.envMap&&(X.envMap.value=h,X.flipEnvMap.value=h.isCubeTexture&&!1===h.isRenderTargetTexture?-1:1);s.isMeshStandardMaterial&&null===s.envMap&&null!==t.environment&&(X.envMapIntensity.value=t.environmentIntensity);G&&(q.setValue(Fe,"toneMappingExposure",T.toneMappingExposure),x.needsLights&&function markUniformsLightsNeedsUpdate(e,t){e.ambientLightColor.needsUpdate=t,e.lightProbe.needsUpdate=t,e.directionalLights.needsUpdate=t,e.directionalLightShadows.needsUpdate=t,e.pointLights.needsUpdate=t,e.pointLightShadows.needsUpdate=t,e.spotLights.needsUpdate=t,e.spotLightShadows.needsUpdate=t,e.rectAreaLights.needsUpdate=t,e.hemisphereLights.needsUpdate=t}(X,W),c&&!0===s.fog&&xe.refreshFogUniforms(X,c),xe.refreshMaterialUniforms(X,s,Y,j,I.state.transmissionRenderTarget[e.id]),WebGLUniforms.upload(Fe,getUniformList(x),X,fe));s.isShaderMaterial&&!0===s.uniformsNeedUpdate&&(WebGLUniforms.upload(Fe,getUniformList(x),X,fe),s.uniformsNeedUpdate=!1);s.isSpriteMaterial&&q.setValue(Fe,"center",l.center);if(q.setValue(Fe,"modelViewMatrix",l.modelViewMatrix),q.setValue(Fe,"normalMatrix",l.normalMatrix),q.setValue(Fe,"modelMatrix",l.matrixWorld),s.isShaderMaterial||s.isRawShaderMaterial){const e=s.uniformsGroups;for(let t=0,r=e.length;t<r;t++){const r=e[t];Pe.update(r,B),Pe.bind(r,B)}}return B}(e,t,r,s,l);pe.setMaterial(s,A);let h=r.index,p=1;if(!0===s.wireframe){if(h=Ce.getWireframeAttribute(r),void 0===h)return;p=2}const g=r.drawRange,m=r.attributes.position;let f=g.start*p,E=(g.start+g.count)*p;null!==c&&(f=Math.max(f,c.start*p),E=Math.min(E,(c.start+c.count)*p)),null!==h?(f=Math.max(f,0),E=Math.min(E,h.count)):null!=m&&(f=Math.max(f,0),E=Math.min(E,m.count));const _=E-f;if(_<0||_===1/0)return;let C;Ue.setup(l,s,d,r,h);let S=Re;if(null!==h&&(C=_e.get(h),S=Le,S.setIndex(C)),l.isMesh)!0===s.wireframe?(pe.setLineWidth(s.wireframeLinewidth*getTargetPixelRatio()),S.setMode(Fe.LINES)):S.setMode(Fe.TRIANGLES);else if(l.isLine){let e=s.linewidth;void 0===e&&(e=1),pe.setLineWidth(e*getTargetPixelRatio()),l.isLineSegments?S.setMode(Fe.LINES):l.isLineLoop?S.setMode(Fe.LINE_LOOP):S.setMode(Fe.LINE_STRIP)}else l.isPoints?S.setMode(Fe.POINTS):l.isSprite&&S.setMode(Fe.TRIANGLES);if(l.isBatchedMesh)if(null!==l._multiDrawInstances)(0,o.O4K)("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),S.renderMultiDrawInstances(l._multiDrawStarts,l._multiDrawCounts,l._multiDrawCount,l._multiDrawInstances);else if(ue.get("WEBGL_multi_draw"))S.renderMultiDraw(l._multiDrawStarts,l._multiDrawCounts,l._multiDrawCount);else{const e=l._multiDrawStarts,t=l._multiDrawCounts,r=l._multiDrawCount,o=h?_e.get(h).bytesPerElement:1,c=me.get(s).currentProgram.getUniforms();for(let s=0;s<r;s++)c.setValue(Fe,"_gl_DrawID",s),S.render(e[s]/o,t[s])}else if(l.isInstancedMesh)S.renderInstances(f,_,l.count);else if(r.isInstancedBufferGeometry){const e=void 0!==r._maxInstanceCount?r._maxInstanceCount:1/0,t=Math.min(r.instanceCount,e);S.renderInstances(f,_,t)}else S.render(f,_)},this.compile=function(e,t,r=null){null===r&&(r=e),I=ye.get(r),I.init(t),x.push(I),r.traverseVisible((function(e){e.isLight&&e.layers.test(t.layers)&&(I.pushLight(e),e.castShadow&&I.pushShadow(e))})),e!==r&&e.traverseVisible((function(e){e.isLight&&e.layers.test(t.layers)&&(I.pushLight(e),e.castShadow&&I.pushShadow(e))})),I.setupLights();const s=new Set;return e.traverse((function(e){if(!(e.isMesh||e.isPoints||e.isLine||e.isSprite))return;const t=e.material;if(t)if(Array.isArray(t))for(let o=0;o<t.length;o++){const l=t[o];prepareMaterial(l,r,e),s.add(l)}else prepareMaterial(t,r,e),s.add(t)})),I=x.pop(),s},this.compileAsync=function(e,t,r=null){const s=this.compile(e,t,r);return new Promise((t=>{function checkMaterialsReady(){s.forEach((function(e){me.get(e).currentProgram.isReady()&&s.delete(e)})),0!==s.size?setTimeout(checkMaterialsReady,10):t(e)}null!==ue.get("KHR_parallel_shader_compile")?checkMaterialsReady():setTimeout(checkMaterialsReady,10)}))};let Ne=null;function onXRSessionStart(){Oe.stop()}function onXRSessionEnd(){Oe.start()}const Oe=new WebGLAnimation;function projectObject(e,t,r,s){if(!1===e.visible)return;if(e.layers.test(t.layers))if(e.isGroup)r=e.renderOrder;else if(e.isLOD)!0===e.autoUpdate&&e.update(t);else if(e.isLight)I.pushLight(e),e.castShadow&&I.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||ie.intersectsSprite(e)){s&&ce.setFromMatrixPosition(e.matrixWorld).applyMatrix4(oe);const t=Ie.update(e),o=e.material;o.visible&&C.push(e,t,o,r,ce.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||ie.intersectsObject(e))){const t=Ie.update(e),o=e.material;if(s&&(void 0!==e.boundingSphere?(null===e.boundingSphere&&e.computeBoundingSphere(),ce.copy(e.boundingSphere.center)):(null===t.boundingSphere&&t.computeBoundingSphere(),ce.copy(t.boundingSphere.center)),ce.applyMatrix4(e.matrixWorld).applyMatrix4(oe)),Array.isArray(o)){const s=t.groups;for(let l=0,c=s.length;l<c;l++){const c=s[l],A=o[c.materialIndex];A&&A.visible&&C.push(e,t,A,r,ce.z,c)}}else o.visible&&C.push(e,t,o,r,ce.z,null)}const o=e.children;for(let e=0,l=o.length;e<l;e++)projectObject(o[e],t,r,s)}function renderScene(e,t,r,s){const o=e.opaque,l=e.transmissive,c=e.transparent;I.setupLightsView(r),!0===re&&Me.setGlobalState(T.clippingPlanes,r),s&&pe.viewport(O.copy(s)),o.length>0&&renderObjects(o,t,r),l.length>0&&renderObjects(l,t,r),c.length>0&&renderObjects(c,t,r),pe.buffers.depth.setTest(!0),pe.buffers.depth.setMask(!0),pe.buffers.color.setMask(!0),pe.setPolygonOffset(!1)}function renderTransmissionPass(e,t,r,s){if(null!==(!0===r.isScene?r.overrideMaterial:null))return;void 0===I.state.transmissionRenderTarget[s.id]&&(I.state.transmissionRenderTarget[s.id]=new o.dd2(1,1,{generateMipmaps:!0,type:ue.has("EXT_color_buffer_half_float")||ue.has("EXT_color_buffer_float")?o.cLu:o.ywz,minFilter:o.D1R,samples:4,stencilBuffer:l,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:o.epp.workingColorSpace}));const c=I.state.transmissionRenderTarget[s.id],A=s.viewport||O;c.setSize(A.z*T.transmissionResolutionScale,A.w*T.transmissionResolutionScale);const d=T.getRenderTarget();T.setRenderTarget(c),T.getClearColor(q),X=T.getClearAlpha(),X<1&&T.setClearColor(16777215,.5),T.clear(),de&&be.render(r);const h=T.toneMapping;T.toneMapping=o.uL9;const p=s.viewport;if(void 0!==s.viewport&&(s.viewport=void 0),I.setupLightsView(s),!0===re&&Me.setGlobalState(T.clippingPlanes,s),renderObjects(e,r,s),fe.updateMultisampleRenderTarget(c),fe.updateRenderTargetMipmap(c),!1===ue.has("WEBGL_multisampled_render_to_texture")){let e=!1;for(let l=0,c=t.length;l<c;l++){const c=t[l],A=c.object,d=c.geometry,h=c.material,p=c.group;if(h.side===o.ehD&&A.layers.test(s.layers)){const t=h.side;h.side=o._Li,h.needsUpdate=!0,renderObject(A,r,s,d,h,p),h.side=t,h.needsUpdate=!0,e=!0}}!0===e&&(fe.updateMultisampleRenderTarget(c),fe.updateRenderTargetMipmap(c))}T.setRenderTarget(d),T.setClearColor(q,X),void 0!==p&&(s.viewport=p),T.toneMapping=h}function renderObjects(e,t,r){const s=!0===t.isScene?t.overrideMaterial:null;for(let o=0,l=e.length;o<l;o++){const l=e[o],c=l.object,A=l.geometry,d=l.group;let h=l.material;!0===h.allowOverride&&null!==s&&(h=s),c.layers.test(r.layers)&&renderObject(c,t,r,A,h,d)}}function renderObject(e,t,r,s,l,c){e.onBeforeRender(T,t,r,s,l,c),e.modelViewMatrix.multiplyMatrices(r.matrixWorldInverse,e.matrixWorld),e.normalMatrix.getNormalMatrix(e.modelViewMatrix),l.onBeforeRender(T,t,r,s,e,c),!0===l.transparent&&l.side===o.ehD&&!1===l.forceSinglePass?(l.side=o._Li,l.needsUpdate=!0,T.renderBufferDirect(r,t,s,l,e,c),l.side=o.Wl3,l.needsUpdate=!0,T.renderBufferDirect(r,t,s,l,e,c),l.side=o.ehD):T.renderBufferDirect(r,t,s,l,e,c),e.onAfterRender(T,t,r,s,l,c)}function getProgram(e,t,r){!0!==t.isScene&&(t=Ae);const s=me.get(e),o=I.state.lights,l=I.state.shadowsArray,c=o.state.version,A=Se.getParameters(e,o.state,l,t,r),d=Se.getProgramCacheKey(A);let h=s.programs;s.environment=e.isMeshStandardMaterial?t.environment:null,s.fog=t.fog,s.envMap=(e.isMeshStandardMaterial?ve:Ee).get(e.envMap||s.environment),s.envMapRotation=null!==s.environment&&null===e.envMap?t.environmentRotation:e.envMapRotation,void 0===h&&(e.addEventListener("dispose",onMaterialDispose),h=new Map,s.programs=h);let p=h.get(d);if(void 0!==p){if(s.currentProgram===p&&s.lightsStateVersion===c)return updateCommonMaterialProperties(e,A),p}else A.uniforms=Se.getUniforms(e),e.onBeforeCompile(A,T),p=Se.acquireProgram(A,d),h.set(d,p),s.uniforms=A.uniforms;const g=s.uniforms;return(e.isShaderMaterial||e.isRawShaderMaterial)&&!0!==e.clipping||(g.clippingPlanes=Me.uniform),updateCommonMaterialProperties(e,A),s.needsLights=function materialNeedsLights(e){return e.isMeshLambertMaterial||e.isMeshToonMaterial||e.isMeshPhongMaterial||e.isMeshStandardMaterial||e.isShadowMaterial||e.isShaderMaterial&&!0===e.lights}(e),s.lightsStateVersion=c,s.needsLights&&(g.ambientLightColor.value=o.state.ambient,g.lightProbe.value=o.state.probe,g.directionalLights.value=o.state.directional,g.directionalLightShadows.value=o.state.directionalShadow,g.spotLights.value=o.state.spot,g.spotLightShadows.value=o.state.spotShadow,g.rectAreaLights.value=o.state.rectArea,g.ltc_1.value=o.state.rectAreaLTC1,g.ltc_2.value=o.state.rectAreaLTC2,g.pointLights.value=o.state.point,g.pointLightShadows.value=o.state.pointShadow,g.hemisphereLights.value=o.state.hemi,g.directionalShadowMap.value=o.state.directionalShadowMap,g.directionalShadowMatrix.value=o.state.directionalShadowMatrix,g.spotShadowMap.value=o.state.spotShadowMap,g.spotLightMatrix.value=o.state.spotLightMatrix,g.spotLightMap.value=o.state.spotLightMap,g.pointShadowMap.value=o.state.pointShadowMap,g.pointShadowMatrix.value=o.state.pointShadowMatrix),s.currentProgram=p,s.uniformsList=null,p}function getUniformList(e){if(null===e.uniformsList){const t=e.currentProgram.getUniforms();e.uniformsList=WebGLUniforms.seqWithValue(t.seq,e.uniforms)}return e.uniformsList}function updateCommonMaterialProperties(e,t){const r=me.get(e);r.outputColorSpace=t.outputColorSpace,r.batching=t.batching,r.batchingColor=t.batchingColor,r.instancing=t.instancing,r.instancingColor=t.instancingColor,r.instancingMorph=t.instancingMorph,r.skinning=t.skinning,r.morphTargets=t.morphTargets,r.morphNormals=t.morphNormals,r.morphColors=t.morphColors,r.morphTargetsCount=t.morphTargetsCount,r.numClippingPlanes=t.numClippingPlanes,r.numIntersection=t.numClipIntersection,r.vertexAlphas=t.vertexAlphas,r.vertexTangents=t.vertexTangents,r.toneMapping=t.toneMapping}Oe.setAnimationLoop((function onAnimationFrame(e){Ne&&Ne(e)})),"undefined"!=typeof self&&Oe.setContext(self),this.setAnimationLoop=function(e){Ne=e,Qe.setAnimationLoop(e),null===e?Oe.stop():Oe.start()},Qe.addEventListener("sessionstart",onXRSessionStart),Qe.addEventListener("sessionend",onXRSessionEnd),this.render=function(e,t){if(void 0!==t&&!0!==t.isCamera)return void un.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");if(!0===y)return;if(!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),!0===Qe.enabled&&!0===Qe.isPresenting&&(!0===Qe.cameraAutoUpdate&&Qe.updateCamera(t),t=Qe.getCamera()),!0===e.isScene&&e.onBeforeRender(T,e,t,U),I=ye.get(e,x.length),I.init(t),x.push(I),oe.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),ie.setFromProjectionMatrix(oe),ae=this.localClippingEnabled,re=Me.init(this.clippingPlanes,ae),C=Te.get(e,S.length),C.init(),S.push(C),!0===Qe.enabled&&!0===Qe.isPresenting){const e=T.xr.getDepthSensingMesh();null!==e&&projectObject(e,t,-1/0,T.sortObjects)}projectObject(e,t,0,T.sortObjects),C.finish(),!0===T.sortObjects&&C.sort(J,$),de=!1===Qe.enabled||!1===Qe.isPresenting||!1===Qe.hasDepthSensing(),de&&be.addToRenderList(C,e),this.info.render.frame++,!0===re&&Me.beginShadows();const r=I.state.shadowsArray;we.render(r,e,t),!0===re&&Me.endShadows(),!0===this.info.autoReset&&this.info.reset();const s=C.opaque,o=C.transmissive;if(I.setupLights(),t.isArrayCamera){const r=t.cameras;if(o.length>0)for(let t=0,l=r.length;t<l;t++){renderTransmissionPass(s,o,e,r[t])}de&&be.render(e);for(let t=0,s=r.length;t<s;t++){const s=r[t];renderScene(C,e,s,s.viewport)}}else o.length>0&&renderTransmissionPass(s,o,e,t),de&&be.render(e),renderScene(C,e,t);null!==U&&0===B&&(fe.updateMultisampleRenderTarget(U),fe.updateRenderTargetMipmap(U)),!0===e.isScene&&e.onAfterRender(T,e,t),Ue.resetDefaultState(),F=-1,Q=null,x.pop(),x.length>0?(I=x[x.length-1],!0===re&&Me.setGlobalState(T.clippingPlanes,I.state.camera)):I=null,S.pop(),C=S.length>0?S[S.length-1]:null},this.getActiveCubeFace=function(){return b},this.getActiveMipmapLevel=function(){return B},this.getRenderTarget=function(){return U},this.setRenderTargetTextures=function(e,t,r){const s=me.get(e);s.__autoAllocateDepthBuffer=!1===e.resolveDepthBuffer,!1===s.__autoAllocateDepthBuffer&&(s.__useRenderToTexture=!1),me.get(e.texture).__webglTexture=t,me.get(e.depthTexture).__webglTexture=s.__autoAllocateDepthBuffer?void 0:r,s.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(e,t){const r=me.get(e);r.__webglFramebuffer=t,r.__useDefaultFramebuffer=void 0===t};const Ge=Fe.createFramebuffer();this.setRenderTarget=function(e,t=0,r=0){U=e,b=t,B=r;let s=!0,o=null,l=!1,c=!1;if(e){const A=me.get(e);if(void 0!==A.__useDefaultFramebuffer)pe.bindFramebuffer(Fe.FRAMEBUFFER,null),s=!1;else if(void 0===A.__webglFramebuffer)fe.setupRenderTarget(e);else if(A.__hasExternalTextures)fe.rebindTextures(e,me.get(e.texture).__webglTexture,me.get(e.depthTexture).__webglTexture);else if(e.depthBuffer){const t=e.depthTexture;if(A.__boundDepthTexture!==t){if(null!==t&&me.has(t)&&(e.width!==t.image.width||e.height!==t.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");fe.setupDepthRenderbuffer(e)}}const d=e.texture;(d.isData3DTexture||d.isDataArrayTexture||d.isCompressedArrayTexture)&&(c=!0);const h=me.get(e).__webglFramebuffer;e.isWebGLCubeRenderTarget?(o=Array.isArray(h[t])?h[t][r]:h[t],l=!0):o=e.samples>0&&!1===fe.useMultisampledRTT(e)?me.get(e).__webglMultisampledFramebuffer:Array.isArray(h)?h[r]:h,O.copy(e.viewport),G.copy(e.scissor),W=e.scissorTest}else O.copy(ee).multiplyScalar(Y).floor(),G.copy(te).multiplyScalar(Y).floor(),W=ne;0!==r&&(o=Ge);if(pe.bindFramebuffer(Fe.FRAMEBUFFER,o)&&s&&pe.drawBuffers(e,o),pe.viewport(O),pe.scissor(G),pe.setScissorTest(W),l){const s=me.get(e.texture);Fe.framebufferTexture2D(Fe.FRAMEBUFFER,Fe.COLOR_ATTACHMENT0,Fe.TEXTURE_CUBE_MAP_POSITIVE_X+t,s.__webglTexture,r)}else if(c){const s=me.get(e.texture),o=t;Fe.framebufferTextureLayer(Fe.FRAMEBUFFER,Fe.COLOR_ATTACHMENT0,s.__webglTexture,r,o)}else if(null!==e&&0!==r){const t=me.get(e.texture);Fe.framebufferTexture2D(Fe.FRAMEBUFFER,Fe.COLOR_ATTACHMENT0,Fe.TEXTURE_2D,t.__webglTexture,r)}F=-1},this.readRenderTargetPixels=function(e,t,r,s,o,l,c){if(!e||!e.isWebGLRenderTarget)return void un.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let A=me.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==c&&(A=A[c]),A){pe.bindFramebuffer(Fe.FRAMEBUFFER,A);try{const c=e.texture,A=c.format,d=c.type;if(!he.textureFormatReadable(A))return void un.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");if(!he.textureTypeReadable(d))return void un.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");t>=0&&t<=e.width-s&&r>=0&&r<=e.height-o&&Fe.readPixels(t,r,s,o,De.convert(A),De.convert(d),l)}finally{const e=null!==U?me.get(U).__webglFramebuffer:null;pe.bindFramebuffer(Fe.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,r,s,l,c,A){if(!e||!e.isWebGLRenderTarget)throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let d=me.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&void 0!==A&&(d=d[A]),d){if(t>=0&&t<=e.width-s&&r>=0&&r<=e.height-l){pe.bindFramebuffer(Fe.FRAMEBUFFER,d);const A=e.texture,h=A.format,p=A.type;if(!he.textureFormatReadable(h))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!he.textureTypeReadable(p))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const g=Fe.createBuffer();Fe.bindBuffer(Fe.PIXEL_PACK_BUFFER,g),Fe.bufferData(Fe.PIXEL_PACK_BUFFER,c.byteLength,Fe.STREAM_READ),Fe.readPixels(t,r,s,l,De.convert(h),De.convert(p),0);const m=null!==U?me.get(U).__webglFramebuffer:null;pe.bindFramebuffer(Fe.FRAMEBUFFER,m);const f=Fe.fenceSync(Fe.SYNC_GPU_COMMANDS_COMPLETE,0);return Fe.flush(),await(0,o.Qey)(Fe,f,4),Fe.bindBuffer(Fe.PIXEL_PACK_BUFFER,g),Fe.getBufferSubData(Fe.PIXEL_PACK_BUFFER,0,c),Fe.deleteBuffer(g),Fe.deleteSync(f),c}throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(e,t=null,r=0){const s=Math.pow(2,-r),o=Math.floor(e.image.width*s),l=Math.floor(e.image.height*s),c=null!==t?t.x:0,A=null!==t?t.y:0;fe.setTexture2D(e,0),Fe.copyTexSubImage2D(Fe.TEXTURE_2D,r,0,0,c,A,o,l),pe.unbindTexture()};const ke=Fe.createFramebuffer(),He=Fe.createFramebuffer();this.copyTextureToTexture=function(e,t,r=null,s=null,l=0,c=null){let A,d,h,p,g,m,f,E,_;null===c&&(0!==l?((0,o.O4K)("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),c=l,l=0):c=0);const C=e.isCompressedTexture?e.mipmaps[c]:e.image;if(null!==r)A=r.max.x-r.min.x,d=r.max.y-r.min.y,h=r.isBox3?r.max.z-r.min.z:1,p=r.min.x,g=r.min.y,m=r.isBox3?r.min.z:0;else{const t=Math.pow(2,-l);A=Math.floor(C.width*t),d=Math.floor(C.height*t),h=e.isDataArrayTexture?C.depth:e.isData3DTexture?Math.floor(C.depth*t):1,p=0,g=0,m=0}null!==s?(f=s.x,E=s.y,_=s.z):(f=0,E=0,_=0);const I=De.convert(t.format),S=De.convert(t.type);let x;t.isData3DTexture?(fe.setTexture3D(t,0),x=Fe.TEXTURE_3D):t.isDataArrayTexture||t.isCompressedArrayTexture?(fe.setTexture2DArray(t,0),x=Fe.TEXTURE_2D_ARRAY):(fe.setTexture2D(t,0),x=Fe.TEXTURE_2D),Fe.pixelStorei(Fe.UNPACK_FLIP_Y_WEBGL,t.flipY),Fe.pixelStorei(Fe.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),Fe.pixelStorei(Fe.UNPACK_ALIGNMENT,t.unpackAlignment);const T=Fe.getParameter(Fe.UNPACK_ROW_LENGTH),y=Fe.getParameter(Fe.UNPACK_IMAGE_HEIGHT),b=Fe.getParameter(Fe.UNPACK_SKIP_PIXELS),B=Fe.getParameter(Fe.UNPACK_SKIP_ROWS),U=Fe.getParameter(Fe.UNPACK_SKIP_IMAGES);Fe.pixelStorei(Fe.UNPACK_ROW_LENGTH,C.width),Fe.pixelStorei(Fe.UNPACK_IMAGE_HEIGHT,C.height),Fe.pixelStorei(Fe.UNPACK_SKIP_PIXELS,p),Fe.pixelStorei(Fe.UNPACK_SKIP_ROWS,g),Fe.pixelStorei(Fe.UNPACK_SKIP_IMAGES,m);const F=e.isDataArrayTexture||e.isData3DTexture,Q=t.isDataArrayTexture||t.isData3DTexture;if(e.isDepthTexture){const r=me.get(e),s=me.get(t),o=me.get(r.__renderTarget),C=me.get(s.__renderTarget);pe.bindFramebuffer(Fe.READ_FRAMEBUFFER,o.__webglFramebuffer),pe.bindFramebuffer(Fe.DRAW_FRAMEBUFFER,C.__webglFramebuffer);for(let r=0;r<h;r++)F&&(Fe.framebufferTextureLayer(Fe.READ_FRAMEBUFFER,Fe.COLOR_ATTACHMENT0,me.get(e).__webglTexture,l,m+r),Fe.framebufferTextureLayer(Fe.DRAW_FRAMEBUFFER,Fe.COLOR_ATTACHMENT0,me.get(t).__webglTexture,c,_+r)),Fe.blitFramebuffer(p,g,A,d,f,E,A,d,Fe.DEPTH_BUFFER_BIT,Fe.NEAREST);pe.bindFramebuffer(Fe.READ_FRAMEBUFFER,null),pe.bindFramebuffer(Fe.DRAW_FRAMEBUFFER,null)}else if(0!==l||e.isRenderTargetTexture||me.has(e)){const r=me.get(e),s=me.get(t);pe.bindFramebuffer(Fe.READ_FRAMEBUFFER,ke),pe.bindFramebuffer(Fe.DRAW_FRAMEBUFFER,He);for(let e=0;e<h;e++)F?Fe.framebufferTextureLayer(Fe.READ_FRAMEBUFFER,Fe.COLOR_ATTACHMENT0,r.__webglTexture,l,m+e):Fe.framebufferTexture2D(Fe.READ_FRAMEBUFFER,Fe.COLOR_ATTACHMENT0,Fe.TEXTURE_2D,r.__webglTexture,l),Q?Fe.framebufferTextureLayer(Fe.DRAW_FRAMEBUFFER,Fe.COLOR_ATTACHMENT0,s.__webglTexture,c,_+e):Fe.framebufferTexture2D(Fe.DRAW_FRAMEBUFFER,Fe.COLOR_ATTACHMENT0,Fe.TEXTURE_2D,s.__webglTexture,c),0!==l?Fe.blitFramebuffer(p,g,A,d,f,E,A,d,Fe.COLOR_BUFFER_BIT,Fe.NEAREST):Q?Fe.copyTexSubImage3D(x,c,f,E,_+e,p,g,A,d):Fe.copyTexSubImage2D(x,c,f,E,p,g,A,d);pe.bindFramebuffer(Fe.READ_FRAMEBUFFER,null),pe.bindFramebuffer(Fe.DRAW_FRAMEBUFFER,null)}else Q?e.isDataTexture||e.isData3DTexture?Fe.texSubImage3D(x,c,f,E,_,A,d,h,I,S,C.data):t.isCompressedArrayTexture?Fe.compressedTexSubImage3D(x,c,f,E,_,A,d,h,I,C.data):Fe.texSubImage3D(x,c,f,E,_,A,d,h,I,S,C):e.isDataTexture?Fe.texSubImage2D(Fe.TEXTURE_2D,c,f,E,A,d,I,S,C.data):e.isCompressedTexture?Fe.compressedTexSubImage2D(Fe.TEXTURE_2D,c,f,E,C.width,C.height,I,C.data):Fe.texSubImage2D(Fe.TEXTURE_2D,c,f,E,A,d,I,S,C);Fe.pixelStorei(Fe.UNPACK_ROW_LENGTH,T),Fe.pixelStorei(Fe.UNPACK_IMAGE_HEIGHT,y),Fe.pixelStorei(Fe.UNPACK_SKIP_PIXELS,b),Fe.pixelStorei(Fe.UNPACK_SKIP_ROWS,B),Fe.pixelStorei(Fe.UNPACK_SKIP_IMAGES,U),0===c&&t.generateMipmaps&&Fe.generateMipmap(x),pe.unbindTexture()},this.copyTextureToTexture3D=function(e,t,r=null,s=null,l=0){return(0,o.O4K)('WebGLRenderer: copyTextureToTexture3D function has been deprecated. Use "copyTextureToTexture" instead.'),this.copyTextureToTexture(e,t,r,s,l)},this.initRenderTarget=function(e){void 0===me.get(e).__webglFramebuffer&&fe.setupRenderTarget(e)},this.initTexture=function(e){e.isCubeTexture?fe.setTextureCube(e,0):e.isData3DTexture?fe.setTexture3D(e,0):e.isDataArrayTexture||e.isCompressedArrayTexture?fe.setTexture2DArray(e,0):fe.setTexture2D(e,0),pe.unbindTexture()},this.resetState=function(){b=0,B=0,U=null,pe.reset(),Ue.reset()},"undefined"!=typeof __THREE_DEVTOOLS__&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return o._RZ}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=o.epp._getDrawingBufferColorSpace(e),t.unpackColorSpace=o.epp._getUnpackColorSpace()}}class SessionLightProbe{constructor(e,t,r,s,l){this.xrLight=e,this.renderer=t,this.lightProbe=r,this.xrWebGLBinding=null,this.estimationStartCallback=l,this.frameCallback=this.onXRFrame.bind(this);const c=t.xr.getSession();if(s&&"XRWebGLBinding"in window){const r=new o.oAp(16);e.environment=r.texture;const s=t.getContext();switch(c.preferredReflectionFormat){case"srgba8":s.getExtension("EXT_sRGB");break;case"rgba16f":s.getExtension("OES_texture_half_float")}this.xrWebGLBinding=new XRWebGLBinding(c,s),this.lightProbe.addEventListener("reflectionchange",(()=>{this.updateReflection()}))}c.requestAnimationFrame(this.frameCallback)}updateReflection(){const e=this.renderer.properties.get(this.xrLight.environment);if(e){const t=this.xrWebGLBinding.getReflectionCubeMap(this.lightProbe);t&&(e.__webglTexture=t,this.xrLight.environment.needsPMREMUpdate=!0)}}onXRFrame(e,t){if(!this.xrLight)return;t.session.requestAnimationFrame(this.frameCallback);const r=t.getLightEstimate(this.lightProbe);if(r){this.xrLight.lightProbe.sh.fromArray(r.sphericalHarmonicsCoefficients),this.xrLight.lightProbe.intensity=1;const e=Math.max(1,Math.max(r.primaryLightIntensity.x,Math.max(r.primaryLightIntensity.y,r.primaryLightIntensity.z)));this.xrLight.directionalLight.color.setRGB(r.primaryLightIntensity.x/e,r.primaryLightIntensity.y/e,r.primaryLightIntensity.z/e),this.xrLight.directionalLight.intensity=e,this.xrLight.directionalLight.position.copy(r.primaryLightDirection),this.estimationStartCallback&&(this.estimationStartCallback(),this.estimationStartCallback=null)}}dispose(){this.xrLight=null,this.renderer=null,this.lightProbe=null,this.xrWebGLBinding=null}}class XREstimatedLight extends o.ZAu{constructor(e,t=!0){super(),this.lightProbe=new o.lk7,this.lightProbe.intensity=0,this.add(this.lightProbe),this.directionalLight=new o.Ox3,this.directionalLight.intensity=0,this.add(this.directionalLight),this.environment=null;let r=null,s=!1;e.xr.addEventListener("sessionstart",(()=>{const o=e.xr.getSession();"requestLightProbe"in o&&o.requestLightProbe({reflectionFormat:o.preferredReflectionFormat}).then((o=>{r=new SessionLightProbe(this,e,o,t,(()=>{s=!0,this.dispatchEvent({type:"estimationstart"})}))}))})),e.xr.addEventListener("sessionend",(()=>{r&&(r.dispose(),r=null),s&&this.dispatchEvent({type:"estimationend"})})),this.dispose=()=>{r&&(r.dispose(),r=null),this.remove(this.lightProbe),this.lightProbe=null,this.remove(this.directionalLight),this.directionalLight=null,this.environment=null}}}class Damper{constructor(e=50){this.velocity=0,this.naturalFrequency=0,this.setDecayTime(e)}setDecayTime(e){this.naturalFrequency=1/Math.max(.001,e)}update(e,t,r,s){const o=2e-4*this.naturalFrequency;if(null==e||0===s)return t;if(e===t&&0===this.velocity)return t;if(r<0)return e;const l=e-t,c=this.velocity+this.naturalFrequency*l,A=l+r*c,d=Math.exp(-this.naturalFrequency*r),h=(c-this.naturalFrequency*A)*d,p=-this.naturalFrequency*(h+c*d);return Math.abs(h)<o*Math.abs(s)&&p*l>=0?(this.velocity=0,t):(this.velocity=h,t+A*d)}}const Zn=.2,ei=Math.PI/24,ti=new o.FM8,addCorner=(e,t,r)=>{let s=t>0?r>0?0:-Math.PI/2:r>0?Math.PI/2:Math.PI;for(let o=0;o<=12;++o)e.push(t+.17*Math.cos(s),r+.17*Math.sin(s),0,t+Zn*Math.cos(s),r+Zn*Math.sin(s),0),s+=ei};class PlacementBox extends o.Kj0{constructor(e,t){const r=new o.u9r,s=[],l=[],{size:c,boundingBox:A}=e,d=c.x/2,h=("back"===t?c.y:c.z)/2;addCorner(l,d,h),addCorner(l,-d,h),addCorner(l,-d,-h),addCorner(l,d,-h);const p=l.length/3;for(let e=0;e<p-2;e+=2)s.push(e,e+1,e+3,e,e+3,e+2);const g=p-2;s.push(g,g+1,1,g,1,0),r.setAttribute("position",new o.a$l(l,3)),r.setIndex(s),super(r),this.side=t;const m=this.material;switch(m.side=o.ehD,m.transparent=!0,m.opacity=0,this.goalOpacity=0,this.opacityDamper=new Damper,this.hitPlane=new o.Kj0(new o._12(2*(d+Zn),2*(h+Zn))),this.hitPlane.visible=!1,this.hitPlane.material.side=o.ehD,this.add(this.hitPlane),A.getCenter(this.position),t){case"bottom":this.rotateX(-Math.PI/2),this.shadowHeight=A.min.y,this.position.y=this.shadowHeight;break;case"back":this.shadowHeight=A.min.z,this.position.z=this.shadowHeight}e.target.add(this),this.offsetHeight=0}getHit(e,t,r){ti.set(t,-r),this.hitPlane.visible=!0;const s=e.positionAndNormalFromPoint(ti,this.hitPlane);return this.hitPlane.visible=!1,null==s?null:s.position}getExpandedHit(e,t,r){this.hitPlane.scale.set(1e3,1e3,1e3),this.hitPlane.updateMatrixWorld();const s=this.getHit(e,t,r);return this.hitPlane.scale.set(1,1,1),s}set offsetHeight(e){e-=.001,"back"===this.side?this.position.z=this.shadowHeight+e:this.position.y=this.shadowHeight+e}get offsetHeight(){return"back"===this.side?this.position.z-this.shadowHeight:this.position.y-this.shadowHeight}set show(e){this.goalOpacity=e?.75:0}updateOpacity(e){const t=this.material;t.opacity=this.opacityDamper.update(t.opacity,this.goalOpacity,e,1),this.visible=t.opacity>0}dispose(){var e;const{geometry:t,material:r}=this.hitPlane;t.dispose(),r.dispose(),this.geometry.dispose(),this.material.dispose(),null===(e=this.parent)||void 0===e||e.remove(this)}}const numberNode=(e,t)=>({type:"number",number:e,unit:t}),ni=(()=>{const e={};return t=>{const r=t;if(r in e)return e[r];const s=[];let o=0;for(;t;){if(++o>1e3){t="";break}const e=ii(t),r=e.nodes[0];if(null==r||0===r.terms.length)break;s.push(r),t=e.remainingInput}return e[r]=s}})(),ii=(()=>{const e=/^(\-\-|[a-z\u0240-\uffff])/i,t=/^([\*\+\/]|[\-]\s)/i,r=/^[\),]/;return s=>{const o=[];for(;s.length&&(s=s.trim(),!r.test(s));)if("("===s[0]){const{nodes:e,remainingInput:t}=parseFunctionArguments(s);s=t,o.push({type:"function",name:{type:"ident",value:"calc"},arguments:e})}else if(e.test(s)){const e=ri(s),t=e.nodes[0];if("("===(s=e.remainingInput)[0]){const{nodes:e,remainingInput:r}=parseFunctionArguments(s);o.push({type:"function",name:t,arguments:e}),s=r}else o.push(t)}else if(t.test(s))o.push({type:"operator",value:s[0]}),s=s.slice(1);else{const{nodes:e,remainingInput:t}="#"===s[0]?si(s):ai(s);if(0===e.length)break;o.push(e[0]),s=t}return{nodes:[{type:"expression",terms:o}],remainingInput:s}}})(),ri=(()=>{const e=/[^a-z0-9_\-\u0240-\uffff]/i;return t=>{const r=t.match(e);return{nodes:[{type:"ident",value:null==r?t:t.substr(0,r.index)}],remainingInput:null==r?"":t.substr(r.index)}}})(),ai=(()=>{const e=/[\+\-]?(\d+[\.]\d+|\d+|[\.]\d+)([eE][\+\-]?\d+)?/,t=/^[a-z%]+/i,r=/^(m|mm|cm|rad|deg|[%])$/;return s=>{const o=s.match(e),l=null==o?"0":o[0],c=(s=null==l?s:s.slice(l.length)).match(t);let A=null!=c&&""!==c[0]?c[0]:null;const d=null==c?s:s.slice(A.length);return null==A||r.test(A)||(A=null),{nodes:[{type:"number",number:parseFloat(l)||0,unit:A}],remainingInput:d}}})(),si=(()=>{const e=/^[a-f0-9]*/i;return t=>{const r=(t=t.slice(1).trim()).match(e);return{nodes:null==r?[]:[{type:"hex",value:r[0]}],remainingInput:null==r?t:t.slice(r[0].length)}}})(),parseFunctionArguments=e=>{const t=[];for(e=e.slice(1).trim();e.length;){const r=ii(e);if(t.push(r.nodes[0]),","===(e=r.remainingInput.trim())[0])e=e.slice(1).trim();else if(")"===e[0]){e=e.slice(1);break}}return{nodes:t,remainingInput:e}},oi=Symbol("visitedTypes");class ASTWalker{constructor(e){this[oi]=e}walk(e,t){const r=e.slice();for(;r.length;){const e=r.shift();switch(this[oi].indexOf(e.type)>-1&&t(e),e.type){case"expression":r.unshift(...e.terms);break;case"function":r.unshift(e.name,...e.arguments)}}}}const li=Object.freeze({type:"number",number:0,unit:null}),degreesToRadians=(e,t=0)=>{let{number:r,unit:s}=e;if(isFinite(r)){if("rad"===e.unit||null==e.unit)return e}else r=t,s="rad";return{type:"number",number:("deg"===s&&null!=r?r:0)*Math.PI/180,unit:"rad"}},lengthToBaseMeters=(e,t=0)=>{let r,{number:s,unit:o}=e;if(isFinite(s)){if("m"===e.unit)return e}else s=t,o="m";switch(o){default:r=1;break;case"cm":r=.01;break;case"mm":r=.001}return{type:"number",number:r*s,unit:"m"}},ci=(()=>{const identity=e=>e,e={rad:identity,deg:degreesToRadians,m:identity,mm:lengthToBaseMeters,cm:lengthToBaseMeters};return(t,r=li)=>{isFinite(t.number)||(t.number=r.number,t.unit=r.unit);const{unit:s}=t;if(null==s)return t;const o=e[s];return null==o?r:o(t)}})();var Ai,di,ui;const hi=Symbol("evaluate"),pi=Symbol("lastValue");class Evaluator{constructor(){this[Ai]=null}static evaluatableFor(e,t=li){if(e instanceof Evaluator)return e;if("number"===e.type)return"%"===e.unit?new PercentageEvaluator(e,t):e;switch(e.name.value){case"calc":return new CalcEvaluator(e,t);case"env":return new EnvEvaluator(e)}return li}static evaluate(e){return e instanceof Evaluator?e.evaluate():e}static isConstant(e){return!(e instanceof Evaluator)||e.isConstant}static applyIntrinsics(e,t){const{basis:r,keywords:s}=t,{auto:o}=s;return r.map(((t,r)=>{const l=null==o[r]?t:o[r];let c=e[r]?e[r]:l;if("ident"===c.type){const e=c.value;e in s&&(c=s[e][r])}return null!=c&&"ident"!==c.type||(c=l),"%"===c.unit?numberNode(c.number/100*t.number,t.unit):(c=ci(c,t),c.unit!==t.unit?t:c)}))}get isConstant(){return!1}evaluate(){return this.isConstant&&null!=this[pi]||(this[pi]=this[hi]()),this[pi]}}Ai=pi;const gi=Symbol("percentage"),mi=Symbol("basis");class PercentageEvaluator extends Evaluator{constructor(e,t){super(),this[gi]=e,this[mi]=t}get isConstant(){return!0}[hi](){return numberNode(this[gi].number/100*this[mi].number,this[mi].unit)}}const fi=Symbol("identNode");class EnvEvaluator extends Evaluator{constructor(e){super(),this[di]=null;const t=e.arguments.length?e.arguments[0].terms[0]:null;null!=t&&"ident"===t.type&&(this[fi]=t)}get isConstant(){return!1}[(di=fi,hi)](){if(null!=this[fi]&&"window-scroll-y"===this[fi].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 li}}const Ei=/[\*\/]/,vi=Symbol("evaluator");class CalcEvaluator extends Evaluator{constructor(e,t=li){if(super(),this[ui]=null,1!==e.arguments.length)return;const r=e.arguments[0].terms.slice(),s=[];for(;r.length;){const e=r.shift();if(s.length>0){const r=s[s.length-1];if("operator"===r.type&&Ei.test(r.value)){const r=s.pop(),o=s.pop();if(null==o)return;s.push(new OperatorEvaluator(r,Evaluator.evaluatableFor(o,t),Evaluator.evaluatableFor(e,t)));continue}}s.push("operator"===e.type?e:Evaluator.evaluatableFor(e,t))}for(;s.length>2;){const[e,r,o]=s.splice(0,3);if("operator"!==r.type)return;s.unshift(new OperatorEvaluator(r,Evaluator.evaluatableFor(e,t),Evaluator.evaluatableFor(o,t)))}1===s.length&&(this[vi]=s[0])}get isConstant(){return null==this[vi]||Evaluator.isConstant(this[vi])}[(ui=vi,hi)](){return null!=this[vi]?Evaluator.evaluate(this[vi]):li}}const _i=Symbol("operator"),Ci=Symbol("left"),xi=Symbol("right");class OperatorEvaluator extends Evaluator{constructor(e,t,r){super(),this[_i]=e,this[Ci]=t,this[xi]=r}get isConstant(){return Evaluator.isConstant(this[Ci])&&Evaluator.isConstant(this[xi])}[hi](){const e=ci(Evaluator.evaluate(this[Ci])),t=ci(Evaluator.evaluate(this[xi])),{number:r,unit:s}=e,{number:o,unit:l}=t;if(null!=l&&null!=s&&l!=s)return li;const c=s||l;let A;switch(this[_i].value){case"+":A=r+o;break;case"-":A=r-o;break;case"/":A=r/o;break;case"*":A=r*o;break;default:return li}return{type:"number",number:A,unit:c}}}const yi=Symbol("evaluatables"),Mi=Symbol("intrinsics");class StyleEvaluator extends Evaluator{constructor(e,t){super(),this[Mi]=t;const r=e[0],s=null!=r?r.terms:[];this[yi]=t.basis.map(((e,t)=>{const r=s[t];return null==r?{type:"ident",value:"auto"}:"ident"===r.type?r:Evaluator.evaluatableFor(r,e)}))}get isConstant(){for(const e of this[yi])if(!Evaluator.isConstant(e))return!1;return!0}[hi](){const e=this[yi].map((e=>Evaluator.evaluate(e)));return Evaluator.applyIntrinsics(e,this[Mi]).map((e=>e.number))}}var wi,bi,Bi,Ri;const Li=Symbol("instances"),Di=Symbol("activateListener"),Ui=Symbol("deactivateListener"),Fi=Symbol("notifyInstances"),Qi=Symbol("notify"),Ni=Symbol("callback");class ScrollObserver{constructor(e){this[Ni]=e}static[Fi](){for(const e of ScrollObserver[Li])e[Qi]()}static[(wi=Li,Di)](){window.addEventListener("scroll",this[Fi],{passive:!0})}static[Ui](){window.removeEventListener("scroll",this[Fi])}observe(){0===ScrollObserver[Li].size&&ScrollObserver[Di](),ScrollObserver[Li].add(this)}disconnect(){ScrollObserver[Li].delete(this),0===ScrollObserver[Li].size&&ScrollObserver[Ui]()}[Qi](){this[Ni]()}}ScrollObserver[wi]=new Set;const Oi=Symbol("computeStyleCallback"),Gi=Symbol("astWalker"),ki=Symbol("dependencies"),Hi=Symbol("onScroll");class StyleEffector{constructor(e){this[bi]={},this[Bi]=new ASTWalker(["function"]),this[Ri]=()=>{this[Oi]({relatedState:"window-scroll"})},this[Oi]=e}observeEffectsFor(e){const t={},r=this[ki];this[Gi].walk(e,(e=>{const{name:s}=e,o=e.arguments[0].terms[0];if("env"===s.value&&null!=o&&"ident"===o.type&&"window-scroll-y"===o.value)if(null==t["window-scroll"]){const e="window-scroll"in r?r["window-scroll"]:new ScrollObserver(this[Hi]);e.observe(),delete r["window-scroll"],t["window-scroll"]=e}}));for(const e in r){r[e].disconnect()}this[ki]=t}dispose(){for(const e in this[ki]){this[ki][e].disconnect()}}}bi=ki,Bi=Gi,Ri=Hi;const style=e=>{const t=e.observeEffects||!1,r=e.intrinsics instanceof Function?e.intrinsics:()=>e.intrinsics;return(s,o)=>{const l=s.updated,c=s.connectedCallback,A=s.disconnectedCallback,d=Symbol(`${o}StyleEffector`),h=Symbol(`${o}StyleEvaluator`),p=Symbol(`${o}UpdateEvaluator`),g=Symbol(`${o}EvaluateAndSync`);Object.defineProperties(s,{[d]:{value:null,writable:!0},[h]:{value:null,writable:!0},[p]:{value:function(){const e=ni(this[o]);this[h]=new StyleEvaluator(e,r(this)),null==this[d]&&t&&(this[d]=new StyleEffector((()=>this[g]()))),null!=this[d]&&this[d].observeEffectsFor(e)}},[g]:{value:function(){if(null==this[h])return;const t=this[h].evaluate();this[e.updateHandler](t)}},updated:{value:function(e){e.has(o)&&(this[p](),this[g]()),l.call(this,e)}},connectedCallback:{value:function(){c.call(this),this.requestUpdate(o,this[o])}},disconnectedCallback:{value:function(){A.call(this),null!=this[d]&&(this[d].dispose(),this[d]=null)}}})}},easeInOutQuad=e=>e<.5?2*e*e:(4-2*e)*e-1,interpolate=(e,t,r=easeInOutQuad)=>s=>e+(t-e)*r(s),timeline=e=>{const t=[],r=[];let s=e.initialValue;for(let o=0;o<e.keyframes.length;++o){const l=e.keyframes[o],{value:c,frames:A}=l,d=l.ease||easeInOutQuad,h=interpolate(s,c,d);t.push(h),r.push(A),s=c}return((e,t)=>{const r=t.map((s=0,e=>s+=e));var s;return t=>{t=clamp(t,0,1),t*=r[r.length-1];const s=r.findIndex((e=>e>=t)),o=s<1?0:r[s-1],l=r[s];return e[s]((t-o)/(l-o))}})(t,r)};var Vi=r(5108),controls_decorate=function(e,t,r,s){var o,l=arguments.length,c=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var A=e.length-1;A>=0;A--)(o=e[A])&&(c=(l<3?o(c):l>3?o(t,r,c):o(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c};const zi=timeline({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}]}),Wi=timeline({initialValue:0,keyframes:[{frames:1,value:1},{frames:5,value:1},{frames:1,value:0},{frames:6,value:0}]}),qi="0deg 75deg 105%",Xi=["front","right","back","left"],Ki=["upper-","","lower-"],ji="auto",Yi="basic",Ji="wiggle",$i="none",fieldOfViewIntrinsics=()=>({basis:[degreesToRadians(numberNode(30,"deg"))],keywords:{auto:[null]}}),minFieldOfViewIntrinsics=()=>({basis:[degreesToRadians(numberNode(12,"deg"))],keywords:{auto:[null]}}),Zi=(()=>{const e=ni(qi)[0].terms,t=ci(e[0]),r=ci(e[1]);return e=>{const s=e[Xo].idealCameraDistance();return{basis:[t,r,numberNode(s,"m")],keywords:{auto:[null,null,numberNode(105,"%")]}}}})(),minCameraOrbitIntrinsics=e=>{const t=2.2*e[Xo].boundingSphere.radius;return{basis:[numberNode(-1/0,"rad"),numberNode(Math.PI/8,"rad"),numberNode(t,"m")],keywords:{auto:[null,null,null]}}},maxCameraOrbitIntrinsics=e=>{const t=Zi(e),r=new StyleEvaluator([],t).evaluate()[2];return{basis:[numberNode(1/0,"rad"),numberNode(Math.PI-Math.PI/8,"rad"),numberNode(r,"m")],keywords:{auto:[null,null,null]}}},cameraTargetIntrinsics=e=>{const t=e[Xo].boundingBox.getCenter(new o.Pa4);return{basis:[numberNode(t.x,"m"),numberNode(t.y,"m"),numberNode(t.z,"m")],keywords:{auto:[null,null,null]}}},er=Math.PI/2,tr=Math.PI/3,nr=er/2,ir=2*Math.PI,rr=Symbol("controls"),ar=Symbol("panElement"),sr=Symbol("promptElement"),or=Symbol("promptAnimatedContainer"),lr=Symbol("fingerAnimatedContainers"),cr=Symbol("deferInteractionPrompt"),Ar=Symbol("updateAria"),dr=Symbol("a11y"),ur=Symbol("updateA11y"),hr=Symbol("updateCameraForRadius"),pr=Symbol("cancelPrompts"),gr=Symbol("onChange"),mr=Symbol("onPointerChange"),fr=Symbol("waitingToPromptUser"),Er=Symbol("userHasInteracted"),vr=Symbol("promptElementVisibleTime"),_r=Symbol("lastPromptOffset"),Cr=Symbol("cancellationSource"),Ir=Symbol("lastSpherical"),Sr=Symbol("jumpCamera"),xr=Symbol("initialized"),Tr=Symbol("maintainThetaPhi"),yr=Symbol("syncCameraOrbit"),Mr=Symbol("syncFieldOfView"),wr=Symbol("syncCameraTarget"),br=Symbol("syncMinCameraOrbit"),Br=Symbol("syncMaxCameraOrbit"),Rr=Symbol("syncMinFieldOfView"),Lr=Symbol("syncMaxFieldOfView"),Dr=new o.FM8,Ur=new o.Pa4,Pr=Object.freeze({minimumRadius:0,maximumRadius:1/0,minimumPolarAngle:Math.PI/8,maximumPolarAngle:Math.PI-Math.PI/8,minimumAzimuthalAngle:-1/0,maximumAzimuthalAngle:1/0,minimumFieldOfView:10,maximumFieldOfView:45,touchAction:"none"}),Fr=Math.PI/8,Qr=.04,Nr={USER_INTERACTION:"user-interaction",NONE:"none",AUTOMATIC:"automatic"};class SmoothControls extends o.pBf{constructor(e,t,r){super(),this.camera=e,this.element=t,this.scene=r,this.orbitSensitivity=1,this.zoomSensitivity=1,this.panSensitivity=1,this.inputSensitivity=1,this.changeSource=Nr.NONE,this._interactionEnabled=!1,this._disableZoom=!1,this.isUserPointing=!1,this.enablePan=!0,this.enableTap=!0,this.panProjection=new o.Vkp,this.panPerPixel=0,this.spherical=new o.$V,this.goalSpherical=new o.$V,this.thetaDamper=new Damper,this.phiDamper=new Damper,this.radiusDamper=new Damper,this.logFov=Math.log(Pr.maximumFieldOfView),this.goalLogFov=this.logFov,this.fovDamper=new Damper,this.touchMode=null,this.pointers=[],this.startTime=0,this.startPointerPosition={clientX:0,clientY:0},this.lastSeparation=0,this.touchDecided=!1,this.onContext=e=>{if(this.enablePan)e.preventDefault();else for(const e of this.pointers)this.onPointerUp(new PointerEvent("pointercancel",Object.assign(Object.assign({},this.startPointerPosition),{pointerId:e.id})))},this.touchModeZoom=(e,t)=>{if(!this._disableZoom){const e=this.twoTouchDistance(this.pointers[0],this.pointers[1]),t=Qr*this.zoomSensitivity*(this.lastSeparation-e)*50/this.scene.height;this.lastSeparation=e,this.userAdjustOrbit(0,0,t)}this.panPerPixel>0&&this.movePan(e,t)},this.disableScroll=e=>{e.preventDefault()},this.touchModeRotate=(e,t)=>{const{touchAction:r}=this._options;if(!this.touchDecided&&"none"!==r){this.touchDecided=!0;const s=Math.abs(e),o=Math.abs(t);if(this.changeSource===Nr.USER_INTERACTION&&("pan-y"===r&&o>s||"pan-x"===r&&s>o))return void(this.touchMode=null);this.element.addEventListener("touchmove",this.disableScroll,{passive:!1})}this.handleSinglePointerMove(e,t)},this.onPointerDown=e=>{if(this.pointers.length>2)return;const{element:t}=this;0===this.pointers.length&&(t.addEventListener("pointermove",this.onPointerMove),t.addEventListener("pointerup",this.onPointerUp),this.touchMode=null,this.touchDecided=!1,this.startPointerPosition.clientX=e.clientX,this.startPointerPosition.clientY=e.clientY,this.startTime=performance.now());try{t.setPointerCapture(e.pointerId)}catch(e){}this.pointers.push({clientX:e.clientX,clientY:e.clientY,id:e.pointerId}),this.isUserPointing=!1,"touch"===e.pointerType?(this.changeSource=e.altKey?Nr.AUTOMATIC:Nr.USER_INTERACTION,this.onTouchChange(e)):(this.changeSource=Nr.USER_INTERACTION,this.onMouseDown(e)),this.changeSource===Nr.USER_INTERACTION&&this.dispatchEvent({type:"user-interaction"})},this.onPointerMove=e=>{const t=this.pointers.find((t=>t.id===e.pointerId));if(null==t)return;if("mouse"===e.pointerType&&0===e.buttons)return void this.onPointerUp(e);const r=this.pointers.length,s=(e.clientX-t.clientX)/r,o=(e.clientY-t.clientY)/r;0===s&&0===o||(t.clientX=e.clientX,t.clientY=e.clientY,"touch"===e.pointerType?(this.changeSource=e.altKey?Nr.AUTOMATIC:Nr.USER_INTERACTION,null!==this.touchMode&&this.touchMode(s,o)):(this.changeSource=Nr.USER_INTERACTION,this.panPerPixel>0?this.movePan(s,o):this.handleSinglePointerMove(s,o)))},this.onPointerUp=e=>{const{element:t}=this,r=this.pointers.findIndex((t=>t.id===e.pointerId));-1!==r&&this.pointers.splice(r,1),this.panPerPixel>0&&!e.altKey&&this.resetRadius(),0===this.pointers.length?(t.removeEventListener("pointermove",this.onPointerMove),t.removeEventListener("pointerup",this.onPointerUp),t.removeEventListener("touchmove",this.disableScroll),this.enablePan&&this.enableTap&&this.recenter(e)):null!==this.touchMode&&this.onTouchChange(e),this.scene.element[ar].style.opacity=0,t.style.cursor="grab",this.panPerPixel=0,this.isUserPointing&&this.dispatchEvent({type:"pointer-change-end"})},this.onWheel=e=>{this.changeSource=Nr.USER_INTERACTION;const t=e.deltaY*(1==e.deltaMode?18:1)*Qr*this.zoomSensitivity/30;this.userAdjustOrbit(0,0,t),e.preventDefault(),this.dispatchEvent({type:"user-interaction"})},this.onKeyDown=e=>{const{changeSource:t}=this;this.changeSource=Nr.USER_INTERACTION;(e.shiftKey&&this.enablePan?this.panKeyCodeHandler(e):this.orbitZoomKeyCodeHandler(e))?(e.preventDefault(),this.dispatchEvent({type:"user-interaction"})):this.changeSource=t},this._options=Object.assign({},Pr),this.setOrbit(0,Math.PI/2,1),this.setFieldOfView(100),this.jumpToGoal()}get interactionEnabled(){return this._interactionEnabled}enableInteraction(){if(!1===this._interactionEnabled){const{element:e}=this;e.addEventListener("pointerdown",this.onPointerDown),e.addEventListener("pointercancel",this.onPointerUp),this._disableZoom||e.addEventListener("wheel",this.onWheel),e.addEventListener("keydown",this.onKeyDown),e.addEventListener("touchmove",(()=>{}),{passive:!1}),e.addEventListener("contextmenu",this.onContext),this.element.style.cursor="grab",this._interactionEnabled=!0,this.updateTouchActionStyle()}}disableInteraction(){if(!0===this._interactionEnabled){const{element:e}=this;e.removeEventListener("pointerdown",this.onPointerDown),e.removeEventListener("pointermove",this.onPointerMove),e.removeEventListener("pointerup",this.onPointerUp),e.removeEventListener("pointercancel",this.onPointerUp),e.removeEventListener("wheel",this.onWheel),e.removeEventListener("keydown",this.onKeyDown),e.removeEventListener("contextmenu",this.onContext),e.style.cursor="",this.touchMode=null,this._interactionEnabled=!1,this.updateTouchActionStyle()}}get options(){return this._options}set disableZoom(e){this._disableZoom!=e&&(this._disableZoom=e,!0===e?this.element.removeEventListener("wheel",this.onWheel):this.element.addEventListener("wheel",this.onWheel),this.updateTouchActionStyle())}getCameraSpherical(e=new o.$V){return e.copy(this.spherical)}getFieldOfView(){return this.camera.fov}applyOptions(e){Object.assign(this._options,e),this.setOrbit(),this.setFieldOfView(Math.exp(this.goalLogFov))}updateNearFar(e,t){this.camera.far=0===t?2:t,this.camera.near=Math.max(e,this.camera.far/1e3),this.camera.updateProjectionMatrix()}updateAspect(e){this.camera.aspect=e,this.camera.updateProjectionMatrix()}setOrbit(e=this.goalSpherical.theta,t=this.goalSpherical.phi,r=this.goalSpherical.radius){const{minimumAzimuthalAngle:s,maximumAzimuthalAngle:o,minimumPolarAngle:l,maximumPolarAngle:c,minimumRadius:A,maximumRadius:d}=this._options,{theta:h,phi:p,radius:g}=this.goalSpherical,m=clamp(e,s,o);isFinite(s)||isFinite(o)||(this.spherical.theta=this.wrapAngle(this.spherical.theta-m)+m);const f=clamp(t,l,c),E=clamp(r,A,d);return(m!==h||f!==p||E!==g)&&(!!(isFinite(m)&&isFinite(f)&&isFinite(E))&&(this.goalSpherical.theta=m,this.goalSpherical.phi=f,this.goalSpherical.radius=E,this.goalSpherical.makeSafe(),!0))}setRadius(e){this.goalSpherical.radius=e,this.setOrbit()}setFieldOfView(e){const{minimumFieldOfView:t,maximumFieldOfView:r}=this._options;e=clamp(e,t,r),this.goalLogFov=Math.log(e)}setDamperDecayTime(e){this.thetaDamper.setDecayTime(e),this.phiDamper.setDecayTime(e),this.radiusDamper.setDecayTime(e),this.fovDamper.setDecayTime(e)}adjustOrbit(e,t,r){const{theta:s,phi:o,radius:l}=this.goalSpherical,{minimumRadius:c,maximumRadius:A,minimumFieldOfView:d,maximumFieldOfView:h}=this._options,p=this.spherical.theta-s,g=Math.PI-.001,m=s-clamp(e,-g-p,g-p),f=o-t,E=0===r?0:((r>0?A:c)-l)/(Math.log(r>0?h:d)-this.goalLogFov),_=l+r*(isFinite(E)?E:2*(A-c));if(this.setOrbit(m,f,_),0!==r){const e=this.goalLogFov+r;this.setFieldOfView(Math.exp(e))}}jumpToGoal(){this.update(0,1e4)}update(e,t){if(this.isStationary())return!1;const{maximumPolarAngle:r,maximumRadius:s}=this._options,o=this.spherical.theta-this.goalSpherical.theta;return Math.abs(o)>Math.PI&&!isFinite(this._options.minimumAzimuthalAngle)&&!isFinite(this._options.maximumAzimuthalAngle)&&(this.spherical.theta-=2*Math.sign(o)*Math.PI),this.spherical.theta=this.thetaDamper.update(this.spherical.theta,this.goalSpherical.theta,t,Math.PI),this.spherical.phi=this.phiDamper.update(this.spherical.phi,this.goalSpherical.phi,t,r),this.spherical.radius=this.radiusDamper.update(this.spherical.radius,this.goalSpherical.radius,t,s),this.logFov=this.fovDamper.update(this.logFov,this.goalLogFov,t,1),this.moveCamera(),!0}updateTouchActionStyle(){const{style:e}=this.element;if(this._interactionEnabled){const{touchAction:t}=this._options;this._disableZoom&&"none"!==t?e.touchAction="manipulation":e.touchAction=t}else e.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 o.USm(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(e,t,r){this.adjustOrbit(e*this.orbitSensitivity*this.inputSensitivity,t*this.orbitSensitivity*this.inputSensitivity,r*this.inputSensitivity)}wrapAngle(e){const t=(e+Math.PI)/(2*Math.PI);return 2*(t-Math.floor(t))*Math.PI-Math.PI}pixelLengthToSphericalAngle(e){return 2*Math.PI*e/this.scene.height}twoTouchDistance(e,t){const{clientX:r,clientY:s}=e,{clientX:o,clientY:l}=t,c=o-r,A=l-s;return Math.sqrt(c*c+A*A)}handleSinglePointerMove(e,t){const r=this.pixelLengthToSphericalAngle(e),s=this.pixelLengthToSphericalAngle(t);!1===this.isUserPointing&&(this.isUserPointing=!0,this.dispatchEvent({type:"pointer-change-start"})),this.userAdjustOrbit(r,s,0)}initializePan(){const{theta:e,phi:t}=this.spherical,r=e-this.scene.yaw;this.panPerPixel=.018*this.panSensitivity/this.scene.height,this.panProjection.set(-Math.cos(r),-Math.cos(t)*Math.sin(r),0,0,Math.sin(t),0,Math.sin(r),-Math.cos(t)*Math.cos(r),0)}movePan(e,t){const{scene:r}=this,s=Ur.set(e,t,0).multiplyScalar(this.inputSensitivity),o=this.spherical.radius*Math.exp(this.logFov)*this.panPerPixel;s.multiplyScalar(o);const l=r.getTarget();l.add(s.applyMatrix3(this.panProjection)),r.boundingSphere.clampPoint(l,l),r.setTarget(l.x,l.y,l.z)}recenter(e){if(performance.now()>this.startTime+300||Math.abs(e.clientX-this.startPointerPosition.clientX)>2||Math.abs(e.clientY-this.startPointerPosition.clientY)>2)return;const{scene:t}=this,r=t.positionAndNormalFromPoint(t.getNDC(e.clientX,e.clientY));if(null==r){const{cameraTarget:e}=t.element;t.element.cameraTarget="",t.element.cameraTarget=e,this.userAdjustOrbit(0,0,1)}else t.target.worldToLocal(r.position),t.setTarget(r.position.x,r.position.y,r.position.z)}resetRadius(){const{scene:e}=this,t=e.positionAndNormalFromPoint(Dr.set(0,0));if(null==t)return;e.target.worldToLocal(t.position);const r=e.getTarget(),{theta:s,phi:o}=this.spherical,l=s-e.yaw,c=Ur.set(Math.sin(o)*Math.sin(l),Math.cos(o),Math.sin(o)*Math.cos(l)),A=c.dot(t.position.sub(r));r.add(c.multiplyScalar(A)),e.setTarget(r.x,r.y,r.z),this.setOrbit(void 0,void 0,this.goalSpherical.radius-A)}onTouchChange(e){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(),e.altKey||(this.scene.element[ar].style.opacity=1))}}onMouseDown(e){this.panPerPixel=0,this.enablePan&&(2===e.button||e.ctrlKey||e.metaKey||e.shiftKey)&&(this.initializePan(),this.scene.element[ar].style.opacity=1),this.element.style.cursor="grabbing"}orbitZoomKeyCodeHandler(e){let t=!0;switch(e.key){case"PageUp":this.userAdjustOrbit(0,0,Qr*this.zoomSensitivity);break;case"PageDown":this.userAdjustOrbit(0,0,-.04*this.zoomSensitivity);break;case"ArrowUp":this.userAdjustOrbit(0,-Fr,0);break;case"ArrowDown":this.userAdjustOrbit(0,Fr,0);break;case"ArrowLeft":this.userAdjustOrbit(-Fr,0,0);break;case"ArrowRight":this.userAdjustOrbit(Fr,0,0);break;default:t=!1}return t}panKeyCodeHandler(e){this.initializePan();let t=!0;switch(e.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:t=!1}return t}}var Or=r(5108);const Gr="not-presenting",kr="session-started",Hr="object-placed",Vr="failed",zr="tracking",Wr="not-tracking",qr=new o.Pa4,Xr=new o.yGw,Kr=new o.Pa4,jr=new o.cPb(45,1,.1,100);class ARRenderer extends o.pBf{constructor(e){super(),this.renderer=e,this.currentSession=null,this.placeOnWall=!1,this.placementBox=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.tracking=!0,this.frames=0,this.initialized=!1,this.oldTarget=new o.Pa4,this.placementComplete=!1,this.isTranslating=!1,this.isRotating=!1,this.isTwoFingering=!1,this.lastDragPosition=new o.Pa4,this.firstRatio=0,this.lastAngle=0,this.goalPosition=new o.Pa4,this.goalYaw=0,this.goalScale=1,this.xDamper=new Damper,this.yDamper=new Damper,this.zDamper=new Damper,this.yawDamper=new Damper,this.scaleDamper=new Damper,this.onExitWebXRButtonContainerClick=()=>this.stopPresenting(),this.onUpdateScene=()=>{null!=this.placementBox&&this.isPresenting&&(this.placementBox.dispose(),this.placementBox=new PlacementBox(this.presentedScene,this.placeOnWall?"back":"bottom"))},this.onSelectStart=e=>{const t=this.transientHitTestSource;if(null==t)return;const r=this.frame.getHitTestResultsForTransientInput(t),s=this.presentedScene,o=this.placementBox;if(1===r.length){this.inputSource=e.inputSource;const{axes:t}=this.inputSource.gamepad,r=o.getHit(this.presentedScene,t[0],t[1]);o.show=!0,null!=r?(this.isTranslating=!0,this.lastDragPosition.copy(r)):!1===this.placeOnWall&&(this.isRotating=!0,this.lastAngle=1.5*t[0])}else if(2===r.length){o.show=!0,this.isTwoFingering=!0;const{separation:e}=this.fingerPolar(r);this.firstRatio=e/s.scale.x}},this.onSelectEnd=()=>{this.isTranslating=!1,this.isRotating=!1,this.isTwoFingering=!1,this.inputSource=null,this.goalPosition.y+=this.placementBox.offsetHeight*this.presentedScene.scale.x,this.placementBox.show=!1},this.threeRenderer=e.threeRenderer,this.threeRenderer.xr.enabled=!0}async resolveARSession(){assertIsArCandidate();const e=await navigator.xr.requestSession("immersive-ar",{requiredFeatures:["hit-test"],optionalFeatures:["dom-overlay","light-estimation"],domOverlay:this.overlay?{root:this.overlay}:void 0});return this.threeRenderer.xr.setReferenceSpaceType("local"),await this.threeRenderer.xr.setSession(e),this.threeRenderer.xr.cameraAutoUpdate=!1,e}get presentedScene(){return this._presentedScene}async supportsPresentation(){try{return assertIsArCandidate(),await navigator.xr.isSessionSupported("immersive-ar")}catch(e){return Or.warn("Request to present in WebXR denied:"),Or.warn(e),Or.warn("Falling back to next ar-mode"),!1}}async present(e,t=!1){this.isPresenting&&Or.warn("Cannot present while a model is already presenting");let r=new Promise(((e,t)=>{requestAnimationFrame((()=>e()))}));e.setHotspotsVisibility(!1),e.queueRender(),await r,this._presentedScene=e,this.overlay=e.element.shadowRoot.querySelector("div.default"),!0===t&&(this.xrLight=new XREstimatedLight(this.threeRenderer),this.xrLight.addEventListener("estimationstart",(()=>{if(!this.isPresenting||null==this.xrLight)return;const e=this.presentedScene;e.add(this.xrLight),e.environment=this.xrLight.environment})));const s=await this.resolveARSession();s.addEventListener("end",(()=>{this.postSessionCleanup()}),{once:!0});const o=e.element.shadowRoot.querySelector(".slot.exit-webxr-ar-button");o.classList.add("enabled"),o.addEventListener("click",this.onExitWebXRButtonContainerClick),this.exitWebXRButtonContainer=o;const l=await s.requestReferenceSpace("viewer");this.tracking=!0,this.frames=0,this.initialized=!1,this.turntableRotation=e.yaw,this.goalYaw=e.yaw,this.goalScale=1,e.setBackground(null),this.oldShadowIntensity=e.shadowIntensity,e.setShadowIntensity(.01),this.oldTarget.copy(e.getTarget()),e.element.addEventListener("load",this.onUpdateScene);const c=20*Math.PI/180,A=!0===this.placeOnWall?void 0:new XRRay(new DOMPoint(0,0,0),{x:0,y:-Math.sin(c),z:-Math.cos(c)});s.requestHitTestSource({space:l,offsetRay:A}).then((e=>{this.initialHitSource=e})),this.currentSession=s,this.placementBox=new PlacementBox(e,this.placeOnWall?"back":"bottom"),this.placementComplete=!1,this.lastTick=performance.now(),this.dispatchEvent({type:"status",status:kr})}async stopPresenting(){if(!this.isPresenting)return;const e=new Promise((e=>{this.resolveCleanup=e}));try{await this.currentSession.end(),await e}catch(e){Or.warn("Error while trying to end WebXR AR session"),Or.warn(e),this.postSessionCleanup()}}get isPresenting(){return null!=this.presentedScene}get target(){return this.oldTarget}updateTarget(){const e=this.presentedScene;if(null!=e){const t=e.getTarget();this.oldTarget.copy(t),this.placeOnWall?t.z=e.boundingBox.min.z:t.y=e.boundingBox.min.y,e.setTarget(t.x,t.y,t.z)}}postSessionCleanup(){const e=this.currentSession;null!=e&&(e.removeEventListener("selectstart",this.onSelectStart),e.removeEventListener("selectend",this.onSelectEnd),this.currentSession=null);const t=this.presentedScene;if(this._presentedScene=null,null!=t){const{element:e}=t;null!=this.xrLight&&(t.remove(this.xrLight),this.xrLight.dispose(),this.xrLight=null),t.position.set(0,0,0),t.scale.set(1,1,1),t.setShadowOffset(0);const r=this.turntableRotation;null!=r&&(t.yaw=r);const s=this.oldShadowIntensity;null!=s&&t.setShadowIntensity(s),t.setEnvironmentAndSkybox(e[Se],e[xe]);const o=this.oldTarget;t.setTarget(o.x,o.y,o.z),t.xrCamera=null,t.element.removeEventListener("load",this.onUpdateScene),t.orientHotspots(0),e.requestUpdate("cameraTarget"),e.requestUpdate("maxCameraOrbit"),e[Jo](e.getBoundingClientRect()),requestAnimationFrame((()=>{t.element.dispatchEvent(new CustomEvent("camera-change",{detail:{source:Nr.NONE}}))}))}this.renderer.height=0;const r=this.exitWebXRButtonContainer;null!=r&&(r.classList.remove("enabled"),r.removeEventListener("click",this.onExitWebXRButtonContainerClick),this.exitWebXRButtonContainer=null);const s=this.transientHitTestSource;null!=s&&(s.cancel(),this.transientHitTestSource=null);const o=this.initialHitSource;null!=o&&(o.cancel(),this.initialHitSource=null),null!=this.placementBox&&(this.placementBox.dispose(),this.placementBox=null),this.lastTick=null,this.turntableRotation=null,this.oldShadowIntensity=null,this.frame=null,this.inputSource=null,this.overlay=null,null!=this.resolveCleanup&&this.resolveCleanup(),this.dispatchEvent({type:"status",status:Gr})}updateView(e){const t=this.presentedScene,r=this.threeRenderer.xr;r.updateCamera(jr),t.xrCamera=r.getCamera();const{elements:s}=t.getCamera().matrixWorld;if(t.orientHotspots(Math.atan2(s[1],s[5])),this.initialized||(this.placeInitially(),this.initialized=!0),e.requestViewportScale&&e.recommendedViewportScale){const t=e.recommendedViewportScale;e.requestViewportScale(Math.max(t,.25))}const o=r.getBaseLayer();if(null!=o){const t=o instanceof XRWebGLLayer?o.getViewport(e):r.getBinding().getViewSubImage(o,e).viewport;this.threeRenderer.setViewport(t.x,t.y,t.width,t.height)}}placeInitially(){const e=this.presentedScene,{position:t,element:r}=e,s=e.getCamera(),{width:o,height:l}=this.overlay.getBoundingClientRect();e.setSize(o,l),s.projectionMatrixInverse.copy(s.projectionMatrix).invert();const{theta:c,radius:A}=r.getCameraOrbit(),d=s.getWorldDirection(qr);e.yaw=Math.atan2(-d.x,-d.z)-c,this.goalYaw=e.yaw,t.copy(s.position).add(d.multiplyScalar(A)),this.updateTarget();const h=e.getTarget();t.add(h).sub(this.oldTarget),this.goalPosition.copy(t),e.setHotspotsVisibility(!0);const{session:p}=this.frame;p.addEventListener("selectstart",this.onSelectStart),p.addEventListener("selectend",this.onSelectEnd),p.requestHitTestSourceForTransientInput({profile:"generic-touchscreen"}).then((e=>{this.transientHitTestSource=e}))}getTouchLocation(){const{axes:e}=this.inputSource.gamepad;let t=this.placementBox.getExpandedHit(this.presentedScene,e[0],e[1]);return null!=t&&(qr.copy(t).sub(this.presentedScene.getCamera().position),qr.length()>10)?null:t}getHitPoint(e){const t=this.threeRenderer.xr.getReferenceSpace(),r=e.getPose(t);if(null==r)return null;const s=Xr.fromArray(r.transform.matrix);return!0===this.placeOnWall&&(this.goalYaw=Math.atan2(s.elements[4],s.elements[6])),s.elements[5]>.75!==this.placeOnWall?Kr.setFromMatrixPosition(s):null}moveToFloor(e){const t=this.initialHitSource;if(null==t)return;const r=e.getHitTestResults(t);if(0==r.length)return;const s=r[0],o=this.getHitPoint(s);null!=o&&(this.placementBox.show=!0,this.isTranslating||(this.placeOnWall?this.goalPosition.copy(o):this.goalPosition.y=o.y),t.cancel(),this.initialHitSource=null,this.dispatchEvent({type:"status",status:Hr}))}fingerPolar(e){const t=e[0].inputSource.gamepad.axes,r=e[1].inputSource.gamepad.axes,s=r[0]-t[0],o=r[1]-t[1],l=Math.atan2(o,s);let c=this.lastAngle-l;return c>Math.PI?c-=2*Math.PI:c<-Math.PI&&(c+=2*Math.PI),this.lastAngle=l,{separation:Math.sqrt(s*s+o*o),deltaYaw:c}}processInput(e){const t=this.transientHitTestSource;if(null==t)return;if(!this.isTranslating&&!this.isTwoFingering&&!this.isRotating)return;const r=e.getHitTestResultsForTransientInput(t),s=this.presentedScene,o=s.scale.x;if(this.isTwoFingering)if(r.length<2)this.isTwoFingering=!1;else{const{separation:e,deltaYaw:t}=this.fingerPolar(r);if(!1===this.placeOnWall&&(this.goalYaw+=t),s.canScale){const t=e/this.firstRatio;this.goalScale=t<1.3&&t>.7692307692307692?1:t}}else if(2!==r.length)if(this.isRotating){const e=1.5*this.inputSource.gamepad.axes[0];this.goalYaw+=e-this.lastAngle,this.lastAngle=e}else this.isTranslating&&r.forEach((e=>{if(e.inputSource!==this.inputSource)return;let t=null;if(e.results.length>0&&(t=this.getHitPoint(e.results[0])),null==t&&(t=this.getTouchLocation()),null!=t){if(this.goalPosition.sub(this.lastDragPosition),!1===this.placeOnWall){const e=t.y-this.lastDragPosition.y;if(e<0){this.placementBox.offsetHeight=e/o,this.presentedScene.setShadowOffset(e);const r=qr.copy(s.getCamera().position),l=-e/(r.y-t.y);r.multiplyScalar(l),t.multiplyScalar(1-l).add(r)}}this.goalPosition.add(t),this.lastDragPosition.copy(t)}}));else{this.isTranslating=!1,this.isRotating=!1,this.isTwoFingering=!0;const{separation:e}=this.fingerPolar(r);this.firstRatio=e/o}}moveScene(e){const t=this.presentedScene,{position:r,yaw:s}=t,o=t.boundingSphere.radius,l=this.goalPosition,c=t.scale.x,A=this.placementBox;let d=Nr.NONE;if(!l.equals(r)||this.goalScale!==c){d=Nr.USER_INTERACTION;let{x:s,y:h,z:p}=r;s=this.xDamper.update(s,l.x,e,o),h=this.yDamper.update(h,l.y,e,o),p=this.zDamper.update(p,l.z,e,o),r.set(s,h,p);const g=this.scaleDamper.update(c,this.goalScale,e,1);if(t.scale.set(g,g,g),!this.isTranslating){const e=l.y-h;this.placementComplete&&!1===this.placeOnWall?(A.offsetHeight=e/g,t.setShadowOffset(e)):0===e&&(this.placementComplete=!0,A.show=!1,t.setShadowIntensity(.8))}}A.updateOpacity(e),t.updateTarget(e),t.yaw=this.yawDamper.update(s,this.goalYaw,e,Math.PI),t.element.dispatchEvent(new CustomEvent("camera-change",{detail:{source:d}}))}onWebXRFrame(e,t){this.frame=t,++this.frames;const r=this.threeRenderer.xr.getReferenceSpace(),s=t.getViewerPose(r);null==s&&!0===this.tracking&&this.frames>30&&(this.tracking=!1,this.dispatchEvent({type:"tracking",status:Wr}));const o=this.presentedScene;if(null==s||null==o||!o.element.loaded)return void this.threeRenderer.clear();!1===this.tracking&&(this.tracking=!0,this.dispatchEvent({type:"tracking",status:zr}));let l=!0;for(const r of s.views){if(this.updateView(r),l){this.moveToFloor(t),this.processInput(t);const r=e-this.lastTick;this.moveScene(r),this.renderer.preRender(o,e,r),this.lastTick=e,o.renderShadow(this.threeRenderer)}this.threeRenderer.render(o,o.getCamera()),l=!1}}}function clone(e){const t=new Map,r=new Map,s=e.clone();return parallelTraverse(e,s,(function(e,s){t.set(s,e),r.set(e,s)})),s.traverse((function(e){if(!e.isSkinnedMesh)return;const s=e,o=t.get(e),l=o.skeleton.bones;s.skeleton=o.skeleton.clone(),s.bindMatrix.copy(o.bindMatrix),s.skeleton.bones=l.map((function(e){return r.get(e)})),s.bind(s.skeleton,s.bindMatrix)})),s}function parallelTraverse(e,t,r){r(e,t);for(let s=0;s<e.children.length;s++)parallelTraverse(e.children[s],t.children[s],r)}const Yr=Symbol("prepared"),Jr=Symbol("prepare"),$r=Symbol("preparedGLTF"),Zr=Symbol("clone");class GLTFInstance{constructor(e){this[$r]=e}static prepare(e){if(null==e.scene)throw new Error("Model does not have a scene");if(e[Yr])return e;const t=this[Jr](e);return t[Yr]=!0,t}static[Jr](e){const{scene:t}=e,r=[t];return Object.assign(Object.assign({},e),{scene:t,scenes:r})}get parser(){return this[$r].parser}get animations(){return this[$r].animations}get scene(){return this[$r].scene}get scenes(){return this[$r].scenes}get cameras(){return this[$r].cameras}get asset(){return this[$r].asset}get userData(){return this[$r].userData}clone(){return new(0,this.constructor)(this[Zr]())}dispose(){this.scenes.forEach((e=>{e.traverse((e=>{const t=e;if(!t.material)return;(Array.isArray(t.material)?t.material:[t.material]).forEach((e=>{for(const t in e){const r=e[t];if(r instanceof o.xEZ){const e=r.source.data;null!=e.close&&e.close(),r.dispose()}}e.dispose()})),t.geometry.dispose()}))}))}[Zr](){const e=this[$r],t=clone(this.scene);cloneVariantMaterials(t,this.scene);const r=[t],s=e.userData?Object.assign({},e.userData):{};return Object.assign(Object.assign({},e),{scene:t,scenes:r,userData:s})}}const cloneVariantMaterials=(e,t)=>{traversePair(e,t,((e,t)=>{void 0!==t.userData.variantMaterials&&(e.userData.variantMaterials=new Map(t.userData.variantMaterials)),void 0!==t.userData.variantData&&(e.userData.variantData=t.userData.variantData),void 0!==t.userData.originalMaterial&&(e.userData.originalMaterial=t.userData.originalMaterial)}))},traversePair=(e,t,r)=>{r(e,t);for(let s=0;s<e.children.length;s++)traversePair(e.children[s],t.children[s],r)},ea=Symbol("threeGLTF"),ta=Symbol("gltf"),na=Symbol("gltfElementMap"),ia=Symbol("threeObjectMap"),ra=Symbol("parallelTraverseThreeScene"),aa=Symbol("correlateOriginalThreeGLTF"),sa=Symbol("correlateCloneThreeGLTF");class CorrelatedSceneGraph{constructor(e,t,r,s){this[ea]=e,this[ta]=t,this[na]=s,this[ia]=r}static from(e,t){return null!=t?this[sa](e,t):this[aa](e)}static[aa](e){const t=e.parser.json,r=e.parser.associations,s=new Map,l={name:"Default"},c={type:"materials",index:-1};for(const e of r.keys())e instanceof o.F5T&&null==r.get(e)&&(c.index<0&&(null==t.materials&&(t.materials=[]),c.index=t.materials.length,t.materials.push(l)),e.name=l.name,r.set(e,{materials:c.index}));for(const[e,o]of r){o&&(e.userData=e.userData||{},e.userData.associations=o);for(const r in o)if(null!=r&&"primitives"!==r){const l=r,c=(t[l]||[])[o[l]];if(null==c)continue;let A=s.get(c);null==A&&(A=new Set,s.set(c,A)),A.add(e)}}return new CorrelatedSceneGraph(e,t,r,s)}static[sa](e,t){const r=t.threeGLTF,s=t.gltf,o=JSON.parse(JSON.stringify(s)),l=new Map,c=new Map;for(let s=0;s<r.scenes.length;s++)this[ra](r.scenes[s],e.scenes[s],((e,r)=>{const s=t.threeObjectMap.get(e);if(null!=s)for(const e in s)if(null!=e&&"primitives"!==e){const t=e,A=s[t],d=o[t][A],h=l.get(r)||{};h[t]=A,l.set(r,h);const p=c.get(d)||new Set;p.add(r),c.set(d,p)}}));return new CorrelatedSceneGraph(e,o,l,c)}static[ra](e,t,r){const traverse=(e,t)=>{if(r(e,t),e.isObject3D){const s=e,o=t;if(s.material)if(Array.isArray(s.material))for(let e=0;e<s.material.length;++e)r(s.material[e],o.material[e]);else r(s.material,o.material);for(let r=0;r<e.children.length;++r)traverse(e.children[r],t.children[r])}};traverse(e,t)}get threeGLTF(){return this[ea]}get gltf(){return this[ta]}get gltfElementMap(){return this[na]}get threeObjectMap(){return this[ia]}}const oa=Symbol("correlatedSceneGraph");class ModelViewerGLTFInstance extends GLTFInstance{static[Jr](e){const t=super[Jr](e);null==t[oa]&&(t[oa]=CorrelatedSceneGraph.from(t));const{scene:r}=t,s=new o.aLr(void 0,1/0);return r.traverse((e=>{e.renderOrder=1e3,e.frustumCulled=!1,e.name||(e.name=e.uuid);const r=e;if(r.material){const{geometry:e}=r;r.castShadow=!0,r.isSkinnedMesh&&(e.boundingSphere=s,e.boundingBox=null);const l=r.material;if(!0===l.isMeshBasicMaterial&&(l.toneMapped=!1),l.shadowSide=o.Wl3,l.aoMap){const{gltf:r,threeObjectMap:s}=t[oa],o=s.get(l);if(null!=r.materials&&null!=o&&null!=o.materials){const t=r.materials[o.materials];t.occlusionTexture&&0===t.occlusionTexture.texCoord&&null!=e.attributes.uv&&e.setAttribute("uv2",e.attributes.uv)}}}})),t}get correlatedSceneGraph(){return this[$r][oa]}[Zr](){const e=super[Zr](),t=new Map;return e.scene.traverse((e=>{const r=e;if(r.material){const e=r.material;if(null!=e){if(t.has(e.uuid))return void(r.material=t.get(e.uuid));r.material=e.clone(),t.set(e.uuid,r.material)}}const s=e;void 0!==s.target&&s.add(s.target)})),e[oa]=CorrelatedSceneGraph.from(e,this.correlatedSceneGraph),e}}var la=r(5108);const getBufferForType=(e,t,r)=>{let s;switch(e){case o.ywz:s=new Uint8ClampedArray(t*r*4);break;case o.cLu:s=new Uint16Array(t*r*4);break;case o.JQ4:s=new Uint32Array(t*r*4);break;case o.T95:s=new Int8Array(t*r*4);break;case o.iAb:s=new Int16Array(t*r*4);break;case o.Kz5:s=new Int32Array(t*r*4);break;case o.VzW:s=new Float32Array(t*r*4);break;default:throw new Error("Unsupported data type")}return s};let ca;class QuadRenderer_vDmOC3x_QuadRenderer{constructor(e){var t,r,s,l,c,A,d,h,p,g,m,f,E,_,C,I;this._rendererIsDisposable=!1,this._supportsReadPixels=!0,this.render=()=>{this._renderer.setRenderTarget(this._renderTarget);try{this._renderer.render(this._scene,this._camera)}catch(e){throw this._renderer.setRenderTarget(null),e}this._renderer.setRenderTarget(null)},this._width=e.width,this._height=e.height,this._type=e.type,this._colorSpace=e.colorSpace;const S={format:o.wk1,depthBuffer:!1,stencilBuffer:!1,type:this._type,colorSpace:this._colorSpace,anisotropy:void 0!==(null===(t=e.renderTargetOptions)||void 0===t?void 0:t.anisotropy)?null===(r=e.renderTargetOptions)||void 0===r?void 0:r.anisotropy:1,generateMipmaps:void 0!==(null===(s=e.renderTargetOptions)||void 0===s?void 0:s.generateMipmaps)&&(null===(l=e.renderTargetOptions)||void 0===l?void 0:l.generateMipmaps),magFilter:void 0!==(null===(c=e.renderTargetOptions)||void 0===c?void 0:c.magFilter)?null===(A=e.renderTargetOptions)||void 0===A?void 0:A.magFilter:o.wem,minFilter:void 0!==(null===(d=e.renderTargetOptions)||void 0===d?void 0:d.minFilter)?null===(h=e.renderTargetOptions)||void 0===h?void 0:h.minFilter:o.wem,samples:void 0!==(null===(p=e.renderTargetOptions)||void 0===p?void 0:p.samples)?null===(g=e.renderTargetOptions)||void 0===g?void 0:g.samples:void 0,wrapS:void 0!==(null===(m=e.renderTargetOptions)||void 0===m?void 0:m.wrapS)?null===(f=e.renderTargetOptions)||void 0===f?void 0:f.wrapS:o.uWy,wrapT:void 0!==(null===(E=e.renderTargetOptions)||void 0===E?void 0:E.wrapT)?null===(_=e.renderTargetOptions)||void 0===_?void 0:_.wrapT:o.uWy};if(this._material=e.material,e.renderer?this._renderer=e.renderer:(this._renderer=QuadRenderer_vDmOC3x_QuadRenderer.instantiateRenderer(),this._rendererIsDisposable=!0),this._scene=new o.xsS,this._camera=new o.iKG,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(),!((e,t,r,s)=>{if(void 0!==ca)return ca;const l=new o.dd2(1,1,s);t.setRenderTarget(l);const c=new o.Kj0(new o._12,new o.vBJ({color:16777215}));t.render(c,r),t.setRenderTarget(null);const A=getBufferForType(e,l.width,l.height);return t.readRenderTargetPixels(l,0,0,l.width,l.height,A),l.dispose(),c.geometry.dispose(),c.material.dispose(),ca=0!==A[0],ca})(this._type,this._renderer,this._camera,S)){let e;if(this._type===o.cLu)e=this._renderer.extensions.has("EXT_color_buffer_float")?o.VzW:void 0;void 0!==e?(la.warn(`This browser does not support reading pixels from ${this._type} RenderTargets, switching to ${o.VzW}`),this._type=e):(this._supportsReadPixels=!1,la.warn("This browser dos not support toArray or toDataTexture, calls to those methods will result in an error thrown"))}this._quad=new o.Kj0(new o._12,this._material),this._quad.geometry.computeBoundingBox(),this._scene.add(this._quad),this._renderTarget=new o.dd2(this.width,this.height,S),this._renderTarget.texture.mapping=void 0!==(null===(C=e.renderTargetOptions)||void 0===C?void 0:C.mapping)?null===(I=e.renderTargetOptions)||void 0===I?void 0:I.mapping:o.xfE}static instantiateRenderer(){const e=new WebGLRenderer;return e.setSize(128,128),e}toArray(){if(!this._supportsReadPixels)throw new Error("Can't read pixels in this browser");const e=getBufferForType(this._type,this._width,this._height);return this._renderer.readRenderTargetPixels(this._renderTarget,0,0,this._width,this._height,e),e}toDataTexture(e){const t=new o.IEO(this.toArray(),this.width,this.height,o.wk1,this._type,(null==e?void 0:e.mapping)||o.xfE,(null==e?void 0:e.wrapS)||o.uWy,(null==e?void 0:e.wrapT)||o.uWy,(null==e?void 0:e.magFilter)||o.wem,(null==e?void 0:e.minFilter)||o.wem,(null==e?void 0:e.anisotropy)||1,o.GUF);return t.generateMipmaps=void 0!==(null==e?void 0:e.generateMipmaps)&&(null==e?void 0:e.generateMipmaps),t}disposeOnDemandRenderer(){this._renderer.setRenderTarget(null),this._rendererIsDisposable&&(this._renderer.dispose(),this._renderer.forceContextLoss())}dispose(e){this.disposeOnDemandRenderer(),e&&this.renderTarget.dispose(),this.material instanceof o.jyz&&Object.values(this.material.uniforms).forEach((e=>{e.value instanceof o.xEZ&&e.value.dispose()})),Object.values(this.material).forEach((e=>{e instanceof o.xEZ&&e.dispose()})),this.material.dispose(),this._quad.geometry.dispose()}get width(){return this._width}set width(e){this._width=e,this._renderTarget.setSize(this._width,this._height)}get height(){return this._height}set height(e){this._height=e,this._renderTarget.setSize(this._width,this._height)}get renderer(){return this._renderer}get renderTarget(){return this._renderTarget}set renderTarget(e){this._renderTarget=e,this._width=e.width,this._height=e.height}get material(){return this._material}get type(){return this._type}get colorSpace(){return this._colorSpace}}var Aa=r(5108);class GainMapDecoderMaterial extends o.jyz{constructor({gamma:e,offsetHdr:t,offsetSdr:r,gainMapMin:s,gainMapMax:l,maxDisplayBoost:c,hdrCapacityMin:A,hdrCapacityMax:d,sdr:h,gainMap:p}){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:h},gainMap:{value:p},gamma:{value:new o.Pa4(1/e[0],1/e[1],1/e[2])},offsetHdr:{value:(new o.Pa4).fromArray(t)},offsetSdr:{value:(new o.Pa4).fromArray(r)},gainMapMin:{value:(new o.Pa4).fromArray(s)},gainMapMax:{value:(new o.Pa4).fromArray(l)},weightFactor:{value:(Math.log2(c)-A)/(d-A)}},blending:o.jFi,depthTest:!1,depthWrite:!1}),this._maxDisplayBoost=c,this._hdrCapacityMin=A,this._hdrCapacityMax=d,this.needsUpdate=!0,this.uniformsNeedUpdate=!0}get sdr(){return this.uniforms.sdr.value}set sdr(e){this.uniforms.sdr.value=e}get gainMap(){return this.uniforms.gainMap.value}set gainMap(e){this.uniforms.gainMap.value=e}get offsetHdr(){return this.uniforms.offsetHdr.value.toArray()}set offsetHdr(e){this.uniforms.offsetHdr.value.fromArray(e)}get offsetSdr(){return this.uniforms.offsetSdr.value.toArray()}set offsetSdr(e){this.uniforms.offsetSdr.value.fromArray(e)}get gainMapMin(){return this.uniforms.gainMapMin.value.toArray()}set gainMapMin(e){this.uniforms.gainMapMin.value.fromArray(e)}get gainMapMax(){return this.uniforms.gainMapMax.value.toArray()}set gainMapMax(e){this.uniforms.gainMapMax.value.fromArray(e)}get gamma(){const e=this.uniforms.gamma.value;return[1/e.x,1/e.y,1/e.z]}set gamma(e){const t=this.uniforms.gamma.value;t.x=1/e[0],t.y=1/e[1],t.z=1/e[2]}get hdrCapacityMin(){return this._hdrCapacityMin}set hdrCapacityMin(e){this._hdrCapacityMin=e,this.calculateWeight()}get hdrCapacityMax(){return this._hdrCapacityMax}set hdrCapacityMax(e){this._hdrCapacityMax=e,this.calculateWeight()}get maxDisplayBoost(){return this._maxDisplayBoost}set maxDisplayBoost(e){this._maxDisplayBoost=Math.max(1,Math.min(65504,e)),this.calculateWeight()}calculateWeight(){const e=(Math.log2(this._maxDisplayBoost)-this._hdrCapacityMin)/(this._hdrCapacityMax-this._hdrCapacityMin);this.uniforms.weightFactor.value=Math.max(0,Math.min(1,e))}}class GainMapNotFoundError extends Error{}class XMPMetadataNotFoundError extends Error{}const getAttribute=(e,t,r)=>{var s;let o;const l=null===(s=e.attributes.getNamedItem(t))||void 0===s?void 0:s.nodeValue;if(l)o=l;else{const s=e.getElementsByTagName(t)[0];if(!s){if(r)return r;throw new Error(`Can't find ${t} in gainmap metadata`)}{const e=s.getElementsByTagName("rdf:li");if(3!==e.length)throw new Error(`Gainmap metadata contains an array of items for ${t} but its length is not 3`);o=Array.from(e).map((e=>e.innerHTML))}}return o};class MPFExtractor{constructor(e){this.options={debug:!(!e||void 0===e.debug)&&e.debug,extractFII:!e||void 0===e.extractFII||e.extractFII,extractNonFII:!e||void 0===e.extractNonFII||e.extractNonFII}}extract(e){return new Promise(((t,r)=>{const s=this.options.debug,o=new DataView(e.buffer);if(65496!==o.getUint16(0))return void r(new Error("Not a valid jpeg"));const l=o.byteLength;let c,A=2,d=0;for(;A<l;){if(++d>250)return void r(new Error(`Found no marker after ${d} loops 😵`));if(255!==o.getUint8(A))return void r(new Error(`Not a valid marker at offset 0x${A.toString(16)}, found: 0x${o.getUint8(A).toString(16)}`));if(c=o.getUint8(A+1),s&&Aa.log(`Marker: ${c.toString(16)}`),226===c){s&&Aa.log("Found APP2 marker (0xffe2)");const e=A+4;if(1297106432===o.getUint32(e)){const s=e+4;let l;if(18761===o.getUint16(s))l=!1;else{if(19789!==o.getUint16(s))return void r(new Error("No valid endianness marker found in TIFF header"));l=!0}if(42!==o.getUint16(s+2,!l))return void r(new Error("Not valid TIFF data! (no 0x002A marker)"));const c=o.getUint32(s+4,!l);if(c<8)return void r(new Error("Not valid TIFF data! (First offset less than 8)"));const A=s+c,d=o.getUint16(A,!l),h=A+2;let p=0;for(let e=h;e<h+12*d;e+=12)45057===o.getUint16(e,!l)&&(p=o.getUint32(e+8,!l));const g=A+2+12*d+4,m=[];for(let e=g;e<g+16*p;e+=16){const t={MPType:o.getUint32(e,!l),size:o.getUint32(e+4,!l),dataOffset:o.getUint32(e+8,!l),dependantImages:o.getUint32(e+12,!l),start:-1,end:-1,isFII:!1};t.dataOffset?(t.start=s+t.dataOffset,t.isFII=!1):(t.start=0,t.isFII=!0),t.end=t.start+t.size,m.push(t)}if(this.options.extractNonFII&&m.length){const e=new Blob([o]),r=[];for(const t of m){if(t.isFII&&!this.options.extractFII)continue;const s=e.slice(t.start,t.end+1,"image/jpeg");r.push(s)}t(r)}}}A+=2+o.getUint16(A+2)}}))}}const extractGainmapFromJPEG=async e=>{const t=(e=>{var t,r;let s;s="undefined"!=typeof TextDecoder?(new TextDecoder).decode(e):e.toString();let o=s.indexOf("<x:xmpmeta");const l=new DOMParser;for(;-1!==o;){const e=s.indexOf("x:xmpmeta>",o);s.slice(o,e+10);const c=s.slice(o,e+10);try{const e=l.parseFromString(c,"text/xml").getElementsByTagName("rdf:Description")[0],s=getAttribute(e,"hdrgm:GainMapMin","0"),o=getAttribute(e,"hdrgm:GainMapMax"),A=getAttribute(e,"hdrgm:Gamma","1"),d=getAttribute(e,"hdrgm:OffsetSDR","0.015625"),h=getAttribute(e,"hdrgm:OffsetHDR","0.015625");let p=null===(t=e.attributes.getNamedItem("hdrgm:HDRCapacityMin"))||void 0===t?void 0:t.nodeValue;p||(p="0");const g=null===(r=e.attributes.getNamedItem("hdrgm:HDRCapacityMax"))||void 0===r?void 0:r.nodeValue;if(!g)throw new Error("Incomplete gainmap metadata");return{gainMapMin:Array.isArray(s)?s.map((e=>parseFloat(e))):[parseFloat(s),parseFloat(s),parseFloat(s)],gainMapMax:Array.isArray(o)?o.map((e=>parseFloat(e))):[parseFloat(o),parseFloat(o),parseFloat(o)],gamma:Array.isArray(A)?A.map((e=>parseFloat(e))):[parseFloat(A),parseFloat(A),parseFloat(A)],offsetSdr:Array.isArray(d)?d.map((e=>parseFloat(e))):[parseFloat(d),parseFloat(d),parseFloat(d)],offsetHdr:Array.isArray(h)?h.map((e=>parseFloat(e))):[parseFloat(h),parseFloat(h),parseFloat(h)],hdrCapacityMin:parseFloat(p),hdrCapacityMax:parseFloat(g)}}catch(e){}o=s.indexOf("<x:xmpmeta",e)}})(e);if(!t)throw new XMPMetadataNotFoundError("Gain map XMP metadata not found");const r=new MPFExtractor({extractFII:!0,extractNonFII:!0}),s=await r.extract(e);if(2!==s.length)throw new GainMapNotFoundError("Gain map recovery image not found");return{sdr:new Uint8Array(await s[0].arrayBuffer()),gainMap:new Uint8Array(await s[1].arrayBuffer()),metadata:t}},getHTMLImageFromBlob=e=>new Promise(((t,r)=>{const s=document.createElement("img");s.onload=()=>{t(s)},s.onerror=e=>{r(e)},s.src=URL.createObjectURL(e)}));class LoaderBase extends o.aNw{constructor(e,t){super(t),this._renderer=e,this._internalLoadingManager=new o.lLk}setRenderTargetOptions(e){return this._renderTargetOptions=e,this}prepareQuadRenderer(){const e=new GainMapDecoderMaterial({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 o.xEZ,sdr:new o.xEZ});return new QuadRenderer_vDmOC3x_QuadRenderer({width:16,height:16,type:o.cLu,colorSpace:o.GUF,material:e,renderer:this._renderer,renderTargetOptions:this._renderTargetOptions})}async render(e,t,r,s){const l=s?new Blob([s],{type:"image/jpeg"}):void 0,c=new Blob([r],{type:"image/jpeg"});let A,d,h=!1;if("undefined"==typeof createImageBitmap){const e=await Promise.all([l?getHTMLImageFromBlob(l):Promise.resolve(void 0),getHTMLImageFromBlob(c)]);d=e[0],A=e[1],h=!0}else{const e=await Promise.all([l?createImageBitmap(l,{imageOrientation:"flipY"}):Promise.resolve(void 0),createImageBitmap(c,{imageOrientation:"flipY"})]);d=e[0],A=e[1]}const p=new o.xEZ(d||new ImageData(2,2),o.xfE,o.uWy,o.uWy,o.wem,o.FDw,o.wk1,o.ywz,1,o.GUF);p.flipY=h,p.needsUpdate=!0;const g=new o.xEZ(A,o.xfE,o.uWy,o.uWy,o.wem,o.FDw,o.wk1,o.ywz,1,o.KI_);g.flipY=h,g.needsUpdate=!0,e.width=A.width,e.height=A.height,e.material.gainMap=p,e.material.sdr=g,e.material.gainMapMin=t.gainMapMin,e.material.gainMapMax=t.gainMapMax,e.material.offsetHdr=t.offsetHdr,e.material.offsetSdr=t.offsetSdr,e.material.gamma=t.gamma,e.material.hdrCapacityMin=t.hdrCapacityMin,e.material.hdrCapacityMax=t.hdrCapacityMax,e.material.maxDisplayBoost=Math.pow(2,t.hdrCapacityMax),e.material.needsUpdate=!0,e.render()}}class HDRJPGLoader extends LoaderBase{load(e,t,r,s){const l=this.prepareQuadRenderer(),c=new o.hH6(this._internalLoadingManager);return c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setPath(this.path),c.setWithCredentials(this.withCredentials),this.manager.itemStart(e),c.load(e,(async r=>{if("string"==typeof r)throw new Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");const o=new Uint8Array(r);let c,A,d;try{const e=await extractGainmapFromJPEG(o);c=e.sdr,A=e.gainMap,d=e.metadata}catch(t){if(!(t instanceof XMPMetadataNotFoundError||t instanceof GainMapNotFoundError))throw t;Aa.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),d={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},c=o}try{await this.render(l,d,c,A)}catch(t){return this.manager.itemError(e),"function"==typeof s&&s(t),void l.disposeOnDemandRenderer()}"function"==typeof t&&t(l),this.manager.itemEnd(e),l.disposeOnDemandRenderer()}),r,(t=>{this.manager.itemError(e),"function"==typeof s&&s(t)})),l}}class RGBELoader extends o.yxD{constructor(e){super(e),this.type=o.cLu}parse(e){const rgbe_error=function(e,t){switch(e){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(t||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(t||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(t||""));default:throw new Error("THREE.RGBELoader: Memory Error: "+(t||""))}},fgets=function(e,t,r){t=t||1024;let s=e.pos,o=-1,l=0,c="",A=String.fromCharCode.apply(null,new Uint16Array(e.subarray(s,s+128)));for(;0>(o=A.indexOf("\n"))&&l<t&&s<e.byteLength;)c+=A,l+=A.length,s+=128,A+=String.fromCharCode.apply(null,new Uint16Array(e.subarray(s,s+128)));return-1<o&&(!1!==r&&(e.pos+=l+o+1),c+A.slice(0,o))},RGBEByteToRGBFloat=function(e,t,r,s){const o=e[t+3],l=Math.pow(2,o-128)/255;r[s+0]=e[t+0]*l,r[s+1]=e[t+1]*l,r[s+2]=e[t+2]*l,r[s+3]=1},RGBEByteToRGBHalf=function(e,t,r,s){const l=e[t+3],c=Math.pow(2,l-128)/255;r[s+0]=o.A5E.toHalfFloat(Math.min(e[t+0]*c,65504)),r[s+1]=o.A5E.toHalfFloat(Math.min(e[t+1]*c,65504)),r[s+2]=o.A5E.toHalfFloat(Math.min(e[t+2]*c,65504)),r[s+3]=o.A5E.toHalfFloat(1)},t=new Uint8Array(e);t.pos=0;const r=function(e){const t=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,r=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,s=/^\s*FORMAT=(\S+)\s*$/,o=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,l={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let c,A;for((e.pos>=e.byteLength||!(c=fgets(e)))&&rgbe_error(1,"no header found"),(A=c.match(/^#\?(\S+)/))||rgbe_error(3,"bad initial token"),l.valid|=1,l.programtype=A[1],l.string+=c+"\n";c=fgets(e),!1!==c;)if(l.string+=c+"\n","#"!==c.charAt(0)){if((A=c.match(t))&&(l.gamma=parseFloat(A[1])),(A=c.match(r))&&(l.exposure=parseFloat(A[1])),(A=c.match(s))&&(l.valid|=2,l.format=A[1]),(A=c.match(o))&&(l.valid|=4,l.height=parseInt(A[1],10),l.width=parseInt(A[2],10)),2&l.valid&&4&l.valid)break}else l.comments+=c+"\n";return 2&l.valid||rgbe_error(3,"missing format specifier"),4&l.valid||rgbe_error(3,"missing image size specifier"),l}(t),s=r.width,l=r.height,c=function(e,t,r){const s=t;if(s<8||s>32767||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);s!==(e[2]<<8|e[3])&&rgbe_error(3,"wrong scanline width");const o=new Uint8Array(4*t*r);o.length||rgbe_error(4,"unable to allocate buffer space");let l=0,c=0;const A=4*s,d=new Uint8Array(4),h=new Uint8Array(A);let p=r;for(;p>0&&c<e.byteLength;){c+4>e.byteLength&&rgbe_error(1),d[0]=e[c++],d[1]=e[c++],d[2]=e[c++],d[3]=e[c++],2==d[0]&&2==d[1]&&(d[2]<<8|d[3])==s||rgbe_error(3,"bad rgbe scanline format");let t,r=0;for(;r<A&&c<e.byteLength;){t=e[c++];const s=t>128;if(s&&(t-=128),(0===t||r+t>A)&&rgbe_error(3,"bad scanline data"),s){const s=e[c++];for(let e=0;e<t;e++)h[r++]=s}else h.set(e.subarray(c,c+t),r),r+=t,c+=t}const g=s;for(let e=0;e<g;e++){let t=0;o[l]=h[e+t],t+=s,o[l+1]=h[e+t],t+=s,o[l+2]=h[e+t],t+=s,o[l+3]=h[e+t],l+=4}p--}return o}(t.subarray(t.pos),s,l);let A,d,h;switch(this.type){case o.VzW:h=c.length/4;const e=new Float32Array(4*h);for(let t=0;t<h;t++)RGBEByteToRGBFloat(c,4*t,e,4*t);A=e,d=o.VzW;break;case o.cLu:h=c.length/4;const t=new Uint16Array(4*h);for(let e=0;e<h;e++)RGBEByteToRGBHalf(c,4*e,t,4*e);A=t,d=o.cLu;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:s,height:l,data:A,header:r.string,gamma:r.gamma,exposure:r.exposure,type:d}}setDataType(e){return this.type=e,this}load(e,t,r,s){return super.load(e,(function onLoadCallback(e,r){switch(e.type){case o.VzW:case o.cLu:e.colorSpace=o.GUF,e.minFilter=o.wem,e.magFilter=o.wem,e.generateMipmaps=!1,e.flipY=!0}t&&t(e,r)}),r,s)}}const da={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]}]},ua={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 EnvironmentScene extends o.xsS{constructor(e){super(),this.position.y=-3.5;const t=new o.DvJ;t.deleteAttribute("uv");const r=new o.Wid({metalness:0,side:o._Li}),s=new o.Wid({metalness:0}),l="legacy"==e?da:ua,c=new o.cek(16777215,l.topLight.intensity,28,2);c.position.set(...l.topLight.position),this.add(c);const A=new o.Kj0(t,r);A.position.set(...l.room.position),A.scale.set(...l.room.scale),this.add(A);for(const e of l.boxes){const r=new o.Kj0(t,s);r.position.set(...e.position),r.rotation.set(0,e.rotation,0),r.scale.set(...e.scale),this.add(r)}for(const e of l.lights){const r=new o.Kj0(t,this.createAreaLightMaterial(e.intensity));r.position.set(...e.position),r.scale.set(...e.scale),this.add(r)}}createAreaLightMaterial(e){const t=new o.vBJ;return t.color.setScalar(e),t}}var ha=r(5108);const pa=20,ga=/\.hdr(\.js)?$/;class TextureUtils{constructor(e){this.threeRenderer=e,this.lottieLoaderUrl="",this.withCredentials=!1,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}get ldrLoader(){return null==this._ldrLoader&&(this._ldrLoader=new o.dpR),this._ldrLoader.setWithCredentials(this.withCredentials),this._ldrLoader}get imageLoader(){return null==this._imageLoader&&(this._imageLoader=new HDRJPGLoader(this.threeRenderer)),this._imageLoader.setWithCredentials(this.withCredentials),this._imageLoader}get hdrLoader(){return null==this._hdrLoader&&(this._hdrLoader=new RGBELoader,this._hdrLoader.setDataType(o.cLu)),this._hdrLoader.setWithCredentials(this.withCredentials),this._hdrLoader}async getLottieLoader(){if(null==this._lottieLoader){const{LottieLoader:e}=await import(this.lottieLoaderUrl);this._lottieLoader=new e}return this._lottieLoader.setWithCredentials(this.withCredentials),this._lottieLoader}async loadImage(e){const t=await new Promise(((t,r)=>this.ldrLoader.load(e,t,(()=>{}),r)));return t.name=e,t.flipY=!1,t}async loadLottie(e,t){const r=await this.getLottieLoader();r.setQuality(t);const s=await new Promise(((t,s)=>r.load(e,t,(()=>{}),s)));return s.name=e,s}async loadEquirect(e,t=(()=>{})){try{const r=ga.test(e),s=r?this.hdrLoader:this.imageLoader,l=await new Promise(((r,o)=>s.load(e,(e=>{const{renderTarget:t}=e;if(null!=t){const{texture:s}=t;e.dispose(!1),r(s)}else r(e)}),(e=>{t(e.loaded/e.total*.9)}),o)));return t(1),l.name=e,l.mapping=o.dSO,r||(l.colorSpace=o.KI_),l}finally{t&&t(1)}}async generateEnvironmentMapAndSkybox(e=null,t=null,r=(()=>{})){const s="legacy"!==t;"legacy"!==t&&"neutral"!==t||(t=null),t=deserializeUrl(t);let o,l=Promise.resolve(null);e&&(l=this.loadEquirectFromUrl(e,r)),o=t?this.loadEquirectFromUrl(t,r):e?this.loadEquirectFromUrl(e,r):s?this.loadGeneratedEnvironmentMapAlt():this.loadGeneratedEnvironmentMap();const[c,A]=await Promise.all([o,l]);if(null==c)throw new Error("Failed to load environment map.");return{environmentMap:c,skybox:A}}async loadEquirectFromUrl(e,t){if(!this.skyboxCache.has(e)){const r=this.loadEquirect(e,t);this.skyboxCache.set(e,r)}return this.skyboxCache.get(e)}async GenerateEnvironmentMap(e,t){await((e=0)=>new Promise((t=>setTimeout(t,e))))();const r=this.threeRenderer,s=new o.oAp(256,{generateMipmaps:!1,type:o.cLu,format:o.wk1,colorSpace:o.GUF,depthBuffer:!0}),l=new o._am(.1,100,s),c=l.renderTarget.texture;c.name=t;const A=r.outputColorSpace,d=r.toneMapping;return r.toneMapping=o.uL9,r.outputColorSpace=o.GUF,l.update(r,e),this.blurCubemap(s,.04),r.toneMapping=d,r.outputColorSpace=A,c}async loadGeneratedEnvironmentMap(){return null==this.generatedEnvironmentMap&&(this.generatedEnvironmentMap=this.GenerateEnvironmentMap(new EnvironmentScene("legacy"),"legacy")),this.generatedEnvironmentMap}async loadGeneratedEnvironmentMapAlt(){return null==this.generatedEnvironmentMapAlt&&(this.generatedEnvironmentMapAlt=this.GenerateEnvironmentMap(new EnvironmentScene("neutral"),"neutral")),this.generatedEnvironmentMapAlt}blurCubemap(e,t){if(null==this.blurMaterial){this.blurMaterial=this.getBlurShader(pa);const e=new o.DvJ,t=new o.Kj0(e,this.blurMaterial);this.blurScene=new o.xsS,this.blurScene.add(t)}const r=e.clone();this.halfblur(e,r,t,"latitudinal"),this.halfblur(r,e,t,"longitudinal")}halfblur(e,t,r,s){const l=e.width,c=isFinite(r)?Math.PI/(2*l):2*Math.PI/39,A=r/c,d=isFinite(r)?1+Math.floor(3*A):pa;d>pa&&ha.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${d} samples when the maximum is set to 20`);const h=[];let p=0;for(let e=0;e<pa;++e){const t=e/A,r=Math.exp(-t*t/2);h.push(r),0==e?p+=r:e<d&&(p+=2*r)}for(let e=0;e<h.length;e++)h[e]=h[e]/p;const g=this.blurMaterial.uniforms;g.envMap.value=e.texture,g.samples.value=d,g.weights.value=h,g.latitudinal.value="latitudinal"===s,g.dTheta.value=c;new o._am(.1,100,t).update(this.threeRenderer,this.blurScene)}getBlurShader(e){const t=new Float32Array(e),r=new o.Pa4(0,1,0);return new o.jyz({name:"SphericalGaussianBlur",defines:{n:e},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:t},latitudinal:{value:!1},dTheta:{value:0},poleAxis:{value:r}},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:o.jFi,depthTest:!1,depthWrite:!1,side:o._Li})}async dispose(){for(const[,e]of this.skyboxCache){(await e).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()}}var ma=r(5108);const fa=[1,.79,.62,.5,.4,.31,.25],Ea="high-performance";class Renderer extends o.pBf{constructor(e){super(),this.loader=new CachingGLTFLoader(ModelViewerGLTFInstance),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=e=>{this.dispatchEvent({type:"contextlost",sourceEvent:e})},this.onWebGLContextRestored=()=>{var e;null===(e=this.textureUtils)||void 0===e||e.dispose(),this.textureUtils=new TextureUtils(this.threeRenderer);for(const e of this.scenes)e.element[Te]()},this.dpr=Ce(),this.canvas3D=document.createElement("canvas"),this.canvas3D.id="webgl-canvas",this.canvas3D.classList.add("show");try{this.threeRenderer=new WebGLRenderer({canvas:this.canvas3D,alpha:!0,antialias:!0,powerPreference:e.powerPreference,preserveDrawingBuffer:!0}),this.threeRenderer.autoClear=!0,this.threeRenderer.setPixelRatio(1),this.threeRenderer.debug={checkShaderErrors:!!e.debug,onShaderError:null},this.threeRenderer.toneMapping=o.LY2}catch(e){ma.warn(e)}this.arRenderer=new ARRenderer(this),this.textureUtils=this.canRender?new TextureUtils(this.threeRenderer):null,CachingGLTFLoader.initializeKTX2Loader(this.threeRenderer),this.canvas3D.addEventListener("webglcontextlost",this.onWebGLContextLost),this.canvas3D.addEventListener("webglcontextrestored",this.onWebGLContextRestored),this.updateRendererSize()}static get singleton(){return this._singleton||(this._singleton=new Renderer({powerPreference:(self.ModelViewerElement||{}).powerPreference||Ea,debug:Ie()})),this._singleton}static resetSingleton(){const e=this._singleton.dispose();for(const t of e)t.disconnectedCallback();this._singleton=new Renderer({powerPreference:(self.ModelViewerElement||{}).powerPreference||Ea,debug:Ie()});for(const t of e)t.connectedCallback()}get canRender(){return null!=this.threeRenderer}get scaleFactor(){return fa[this.scaleStep]}set minScale(e){let t=1;for(;t<fa.length&&!(fa[t]<e);)++t;this.lastStep=t-1}registerScene(e){this.scenes.add(e),e.forceRescale();const t=new o.FM8;this.threeRenderer.getSize(t),e.canvas.width=t.x,e.canvas.height=t.y,this.canRender&&this.scenes.size>0&&this.threeRenderer.setAnimationLoop(((e,t)=>this.render(e,t)))}unregisterScene(e){this.scenes.delete(e),this.canvas3D.parentElement===e.canvas.parentElement&&e.canvas.parentElement.removeChild(this.canvas3D),this.canRender&&0===this.scenes.size&&this.threeRenderer.setAnimationLoop(null)}displayCanvas(e){return e.element.modelIsVisible&&!this.multipleScenesVisible?this.canvas3D:e.element[qo]}countVisibleScenes(){const{canvas3D:e}=this;let t=0,r=null;for(const s of this.scenes){const{element:o}=s;o.modelIsVisible&&null==s.externalRenderer&&++t,e.parentElement===s.canvas.parentElement&&(r=s)}const s=t>1;if(null!=r){const t=s&&!this.multipleScenesVisible,o=!r.element.modelIsVisible;if(t||o){const{width:t,height:s}=this.sceneSize(r);this.copyPixels(r,t,s),e.parentElement.removeChild(e)}}this.multipleScenesVisible=s}updateRendererSize(){var e;const t=Ce();if(t!==this.dpr)for(const e of this.scenes){const{element:t}=e;t[Do](t.getBoundingClientRect())}let r=0,s=0;for(const e of this.scenes)r=Math.max(r,e.width),s=Math.max(s,e.height);if(r!==this.width||s!==this.height||t!==this.dpr){this.width=r,this.height=s,this.dpr=t,r=Math.ceil(r*t),s=Math.ceil(s*t),this.canRender&&this.threeRenderer.setSize(r,s,!1);for(const t of this.scenes){const{canvas:o}=t;o.width=r,o.height=s,t.forceRescale(),null===(e=t.effectRenderer)||void 0===e||e.setSize(r,s)}}}updateRendererScale(e){const t=this.scaleStep;this.avgFrameDuration+=clamp(.2*(e-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),t!==this.scaleStep&&(this.avgFrameDuration=50)}shouldRender(e){if(e.shouldRender())e.scaleStep!=this.scaleStep&&(e.scaleStep=this.scaleStep,this.rescaleCanvas(e));else{if(0==e.scaleStep)return!1;e.scaleStep=0,this.rescaleCanvas(e)}return!0}rescaleCanvas(e){const t=fa[e.scaleStep],r=Math.ceil(this.width/t),s=Math.ceil(this.height/t),{style:o}=e.canvas;o.width=`${r}px`,o.height=`${s}px`,this.canvas3D.style.width=`${r}px`,this.canvas3D.style.height=`${s}px`;const l=this.dpr*t,c=t<1?"GPU throttling":this.dpr!==window.devicePixelRatio?"No meta viewport tag":"";e.element.dispatchEvent(new CustomEvent("render-scale",{detail:{reportedDpr:window.devicePixelRatio,renderedDpr:l,minimumDpr:this.dpr*fa[this.lastStep],pixelWidth:Math.ceil(e.width*l),pixelHeight:Math.ceil(e.height*l),reason:c}}))}sceneSize(e){const{dpr:t}=this,r=fa[e.scaleStep];return{width:Math.min(Math.ceil(e.width*r*t),this.canvas3D.width),height:Math.min(Math.ceil(e.height*r*t),this.canvas3D.height)}}copyPixels(e,t,r){const s=e.context;null!=s?(s.clearRect(0,0,t,r),s.drawImage(this.canvas3D,0,0,t,r,0,0,t,r),e.canvas.classList.add("show")):ma.log("could not acquire 2d context")}orderedScenes(){const e=[];for(const t of[!1,!0])for(const r of this.scenes)r.element.modelIsVisible===t&&e.push(r);return e}get isPresenting(){return this.arRenderer.isPresenting}preRender(e,t,r){const{element:s,exposure:l,toneMapping:c}=e;s[jo](t,r);const A="number"==typeof l&&!Number.isNaN(l),d=s.environmentImage,h=s.skyboxImage,p=c===o.ORg&&("neutral"===d||"legacy"===d||!d&&!h);this.threeRenderer.toneMappingExposure=(A?l:1)*(p?1.3:1)}render(e,t){if(null!=t)return void this.arRenderer.onWebXRFrame(e,t);const r=e-this.lastTick;if(this.lastTick=e,!this.canRender||this.isPresenting)return;this.countVisibleScenes(),this.updateRendererSize(),this.renderedLastFrame&&(this.updateRendererScale(r),this.renderedLastFrame=!1);const{canvas3D:s}=this;for(const t of this.orderedScenes()){const{element:o}=t;if(!o.loaded||!o.modelIsVisible&&t.renderCount>0)continue;if(this.preRender(t,e,r),!this.shouldRender(t))continue;if(null!=t.externalRenderer){const e=t.getCamera();e.updateMatrix();const{matrix:r,projectionMatrix:s}=e,o=r.elements.slice(),l=t.getTarget();o[12]+=l.x,o[13]+=l.y,o[14]+=l.z,t.externalRenderer.render({viewMatrix:o,projectionMatrix:s.elements});continue}if(!o.modelIsVisible&&!this.multipleScenesVisible)for(const e of this.scenes)e.element.modelIsVisible&&e.queueRender();const{width:l,height:c}=this.sceneSize(t);t.renderShadow(this.threeRenderer),this.threeRenderer.setRenderTarget(null),this.threeRenderer.setViewport(0,Math.ceil(this.height*this.dpr)-c,l,c),null!=t.effectRenderer?t.effectRenderer.render(r):(this.threeRenderer.autoClear=!0,this.threeRenderer.toneMapping=t.toneMapping,this.threeRenderer.render(t,t.camera)),this.multipleScenesVisible||!t.element.modelIsVisible&&0===t.renderCount?this.copyPixels(t,l,c):s.parentElement!==t.canvas.parentElement&&(t.canvas.parentElement.appendChild(s),t.canvas.classList.remove("show")),t.hasRendered(),++t.renderCount,this.renderedLastFrame=!0}}dispose(){null!=this.textureUtils&&this.textureUtils.dispose(),null!=this.threeRenderer&&this.threeRenderer.dispose(),this.textureUtils=null,this.threeRenderer=null;const e=[];for(const t of this.scenes)e.push(t.element);return this.canvas3D.removeEventListener("webglcontextlost",this.onWebGLContextLost),this.canvas3D.removeEventListener("webglcontextrestored",this.onWebGLContextRestored),e}}const va=Symbol("correlatedObjects"),_a=Symbol("onUpdate");class ThreeDOMElement{constructor(e,t=null){this[_a]=e,this[va]=t}}const Ca=new o.vBJ,Ia=new o._12(2,2);let Sa=0;const xa=Symbol("threeTexture"),Ta=Symbol("threeTextures");Symbol("applyTexture");class Image extends ThreeDOMElement{get[xa](){var e;return null===(e=this[va])||void 0===e?void 0:e.values().next().value}get[Ta](){return this[va]}constructor(e,t){super(e,new Set(t?[t]:[])),this[xa].image.src||(this[xa].image.src=t.name?t.name:"adhoc_image"+Sa++),this[xa].image.name||(this[xa].image.name=t&&t.image&&t.image.src?t.image.src.split("/").pop():"adhoc_image")}get name(){return this[xa].image.name||""}get uri(){return this[xa].image.src}get bufferView(){return this[xa].image.bufferView}get element(){const e=this[xa];if(e&&(e.isCanvasTexture||e.isVideoTexture))return e.image}get animation(){const e=this[xa];if(e&&e.isCanvasTexture&&e.animation)return e.animation}get type(){return null!=this.uri?"external":"embedded"}set name(e){for(const t of this[Ta])t.image.name=e}update(){const e=this[xa];e&&e.isCanvasTexture&&!e.animation&&(this[xa].needsUpdate=!0,this[_a]())}async createThumbnail(e,t){const r=new o.xsS;Ca.map=this[xa];const s=new o.Kj0(Ia,Ca);r.add(s);const l=new o.iKG(-1,1,1,-1,0,1),{threeRenderer:c}=Renderer.singleton,A=new o.dd2(e,t);c.setRenderTarget(A),c.render(r,l),c.setRenderTarget(null);const d=new Uint8Array(e*t*4);c.readRenderTargetPixels(A,0,0,e,t,d),So.width=e,So.height=t;const h=So.getContext("2d"),p=h.createImageData(e,t);return p.data.set(d),h.putImageData(p,0,0),new Promise((async(e,t)=>{So.toBlob((r=>{if(!r)return t("Failed to capture thumbnail.");e(URL.createObjectURL(r))}),"image/png")}))}}var ya,Ma;!function(e){e[e.Nearest=9728]="Nearest",e[e.Linear=9729]="Linear",e[e.NearestMipmapNearest=9984]="NearestMipmapNearest",e[e.LinearMipmapNearest=9985]="LinearMipmapNearest",e[e.NearestMipmapLinear=9986]="NearestMipmapLinear",e[e.LinearMipmapLinear=9987]="LinearMipmapLinear"}(ya||(ya={})),function(e){e[e.ClampToEdge=33071]="ClampToEdge",e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.Repeat=10497]="Repeat"}(Ma||(Ma={}));const wa=new Map([[Ma.Repeat,o.rpg],[Ma.ClampToEdge,o.uWy],[Ma.MirroredRepeat,o.OoA]]),ba=new Map([[o.rpg,Ma.Repeat],[o.uWy,Ma.ClampToEdge],[o.OoA,Ma.MirroredRepeat]]),Ba=new Map([[ya.Nearest,o.TyD],[ya.Linear,o.wem],[ya.NearestMipmapNearest,o.YLQ],[ya.LinearMipmapNearest,o.qyh],[ya.NearestMipmapLinear,o.aH4],[ya.LinearMipmapLinear,o.D1R]]),Ra=new Map([[o.TyD,ya.Nearest],[o.wem,ya.Linear],[o.YLQ,ya.NearestMipmapNearest],[o.qyh,ya.LinearMipmapNearest],[o.aH4,ya.NearestMipmapLinear],[o.D1R,ya.LinearMipmapLinear]]),La=new Map([[ya.Nearest,o.TyD],[ya.Linear,o.wem]]),Da=new Map([[o.TyD,ya.Nearest],[o.wem,ya.Linear]]),isMinFilter=e=>Ra.has(e),isMagFilter=e=>Da.has(e),isWrapping=e=>ba.has(e),Ua=Symbol("threeTexture"),Pa=Symbol("threeTextures"),Fa=Symbol("setProperty");class Sampler extends ThreeDOMElement{get[Ua](){var e;return null===(e=this[va])||void 0===e?void 0:e.values().next().value}get[Pa](){return this[va]}constructor(e,t){super(e,new Set(t?[t]:[]))}get name(){return this[Ua].name||""}get minFilter(){return Ra.get(this[Ua].minFilter)}get magFilter(){return Da.get(this[Ua].magFilter)}get wrapS(){return ba.get(this[Ua].wrapS)}get wrapT(){return ba.get(this[Ua].wrapT)}get rotation(){return this[Ua].rotation}get scale(){return toVector2D(this[Ua].repeat)}get offset(){return toVector2D(this[Ua].offset)}setMinFilter(e){this[Fa]("minFilter",Ba.get(e))}setMagFilter(e){this[Fa]("magFilter",La.get(e))}setWrapS(e){this[Fa]("wrapS",wa.get(e))}setWrapT(e){this[Fa]("wrapT",wa.get(e))}setRotation(e){null==e&&(e=0),this[Fa]("rotation",e)}setScale(e){null==e&&(e={u:1,v:1}),this[Fa]("repeat",new o.FM8(e.u,e.v))}setOffset(e){null==e&&(e={u:0,v:0}),this[Fa]("offset",new o.FM8(e.u,e.v))}[Fa](e,t){if(((e,t)=>{switch(e){case"minFilter":return isMinFilter(t);case"magFilter":return isMagFilter(t);case"wrapS":case"wrapT":return isWrapping(t);case"rotation":case"repeat":case"offset":return!0;default:throw new Error(`Cannot configure property "${e}" on Sampler`)}})(e,t))for(const r of this[Pa])r[e]=t,r.needsUpdate=!0;this[_a]()}}const Qa=Symbol("image"),Na=Symbol("sampler"),Oa=Symbol("threeTexture");class Texture extends ThreeDOMElement{constructor(e,t){super(e,new Set(t?[t]:[])),this[Na]=new Sampler(e,t),this[Qa]=new Image(e,t)}get[Oa](){var e;return null===(e=this[va])||void 0===e?void 0:e.values().next().value}get name(){return this[Oa].name||""}set name(e){for(const t of this[va])t.name=e}get sampler(){return this[Na]}get source(){return this[Qa]}}var Ga,ka,Ha;const Va=Symbol("texture"),za=Symbol("transform"),Wa=Symbol("materials"),qa=Symbol("usage"),Xa=Symbol("onUpdate"),Ka=Symbol("activeVideo");var ja;!function(e){e[e.Base=0]="Base",e[e.MetallicRoughness=1]="MetallicRoughness",e[e.Normal=2]="Normal",e[e.Occlusion=3]="Occlusion",e[e.Emissive=4]="Emissive",e[e.Clearcoat=5]="Clearcoat",e[e.ClearcoatRoughness=6]="ClearcoatRoughness",e[e.ClearcoatNormal=7]="ClearcoatNormal",e[e.SheenColor=8]="SheenColor",e[e.SheenRoughness=9]="SheenRoughness",e[e.Transmission=10]="Transmission",e[e.Thickness=11]="Thickness",e[e.Specular=12]="Specular",e[e.SpecularColor=13]="SpecularColor",e[e.Iridescence=14]="Iridescence",e[e.IridescenceThickness=15]="IridescenceThickness",e[e.Anisotropy=16]="Anisotropy"}(ja||(ja={}));class TextureInfo{constructor(e,t,r,s){this[Ga]=null,this[ka]={rotation:0,scale:new o.FM8(1,1),offset:new o.FM8(0,0)},this[Ha]=!1,r&&(this[za].rotation=r.rotation,this[za].scale.copy(r.repeat),this[za].offset.copy(r.offset),this[Va]=new Texture(e,r)),this[Xa]=e,this[Wa]=s,this[qa]=t}get texture(){return this[Va]}setTexture(e){var t,r;const s=null!=e?e.source[xa]:null,l=null===(t=this[Va])||void 0===t?void 0:t.source[xa];if(null!=l&&l.isVideoTexture?this[Ka]=!1:(null===(r=this[Va])||void 0===r?void 0:r.source.animation)&&this[Va].source.animation.removeEventListener("enterFrame",this[Xa]),this[Va]=e,null!=s&&s.isVideoTexture){const e=s.image;if(this[Ka]=!0,null!=e.requestVideoFrameCallback){const update=()=>{this[Ka]&&(this[Xa](),e.requestVideoFrameCallback(update))};e.requestVideoFrameCallback(update)}else{const update=()=>{this[Ka]&&(this[Xa](),requestAnimationFrame(update))};requestAnimationFrame(update)}}else null!=(null==e?void 0:e.source.animation)&&e.source.animation.addEventListener("enterFrame",this[Xa]);let c=o.KI_;if(this[Wa])for(const e of this[Wa]){switch(this[qa]){case ja.Base:e.map=s;break;case ja.MetallicRoughness:c=o.GUF,e.metalnessMap=s,e.roughnessMap=s;break;case ja.Normal:c=o.GUF,e.normalMap=s;break;case ja.Occlusion:c=o.GUF,e.aoMap=s;break;case ja.Emissive:e.emissiveMap=s;break;case ja.Clearcoat:e.clearcoatMap=s;break;case ja.ClearcoatRoughness:e.clearcoatRoughnessMap=s;break;case ja.ClearcoatNormal:e.clearcoatNormalMap=s;break;case ja.SheenColor:e.sheenColorMap=s;break;case ja.SheenRoughness:e.sheenRoughnessMap=s;break;case ja.Transmission:e.transmissionMap=s;break;case ja.Thickness:e.thicknessMap=s;break;case ja.Specular:e.specularIntensityMap=s;break;case ja.SpecularColor:e.specularColorMap=s;break;case ja.Iridescence:e.iridescenceMap=s;break;case ja.IridescenceThickness:e.iridescenceThicknessMap=s;break;case ja.Anisotropy:e.anisotropyMap=s}e.needsUpdate=!0}s&&(s.colorSpace=c,s.rotation=this[za].rotation,s.repeat=this[za].scale,s.offset=this[za].offset),this[Xa]()}}Ga=Va,ka=za,Ha=Ka;const Ya=Symbol("threeMaterial"),Ja=Symbol("threeMaterials"),$a=Symbol("baseColorTexture"),Za=Symbol("metallicRoughnessTexture");class PBRMetallicRoughness extends ThreeDOMElement{constructor(e,t){super(e,t);const{map:r,metalnessMap:s}=t.values().next().value;this[$a]=new TextureInfo(e,ja.Base,r,t),this[Za]=new TextureInfo(e,ja.MetallicRoughness,s,t)}get[Ja](){return this[va]}get[Ya](){var e;return null===(e=this[va])||void 0===e?void 0:e.values().next().value}get baseColorFactor(){const e=[0,0,0,this[Ya].opacity];return this[Ya].color.toArray(e),e}get metallicFactor(){return this[Ya].metalness}get roughnessFactor(){return this[Ya].roughness}get baseColorTexture(){return this[$a]}get metallicRoughnessTexture(){return this[Za]}setBaseColorFactor(e){const t=new o.Ilk;e instanceof Array?t.fromArray(e):t.set(e);for(const r of this[Ja])r.color.set(t),e instanceof Array&&e.length>3?r.opacity=e[3]:(e=[0,0,0,r.opacity],t.toArray(e));this[_a]()}setMetallicFactor(e){for(const t of this[Ja])t.metalness=e;this[_a]()}setRoughnessFactor(e){for(const t of this[Ja])t.roughness=e;this[_a]()}}var es,ts;const ns=Symbol("pbrMetallicRoughness"),is=Symbol("normalTexture"),rs=Symbol("occlusionTexture"),as=Symbol("emissiveTexture"),ss=Symbol("backingThreeMaterial"),os=Symbol("applyAlphaCutoff"),ls=Symbol("getAlphaMode"),cs=Symbol("lazyLoadGLTFInfo"),As=Symbol("initialize"),ds=Symbol("getLoadedMaterial"),us=Symbol("ensureMaterialIsLoaded"),hs=Symbol("gltfIndex"),ps=Symbol("setActive"),gs=Symbol("variantIndices"),ms=Symbol("isActive"),fs=Symbol("variantSet"),Es=Symbol("modelVariants"),vs=Symbol("name"),_s=Symbol("pbrTextures");class Material extends ThreeDOMElement{constructor(e,t,r,s,o,l,c){super(e,o),this[es]=new Set,this[ts]=new Map,this[hs]=t,this[ms]=r,this[Es]=s,this[vs]=l,null==c?this[As]():this[cs]=c}get[(es=fs,ts=_s,ss)](){return this[va].values().next().value}[As](){const e=this[_a],t=this[va];this[ns]=new PBRMetallicRoughness(e,t);const{normalMap:r,aoMap:s,emissiveMap:o}=t.values().next().value;this[is]=new TextureInfo(e,ja.Normal,r,t),this[rs]=new TextureInfo(e,ja.Occlusion,s,t),this[as]=new TextureInfo(e,ja.Emissive,o,t);const createTextureInfo=r=>{this[_s].set(r,new TextureInfo(e,r,null,t))};createTextureInfo(ja.Clearcoat),createTextureInfo(ja.ClearcoatRoughness),createTextureInfo(ja.ClearcoatNormal),createTextureInfo(ja.SheenColor),createTextureInfo(ja.SheenRoughness),createTextureInfo(ja.Transmission),createTextureInfo(ja.Thickness),createTextureInfo(ja.Specular),createTextureInfo(ja.SpecularColor),createTextureInfo(ja.Iridescence),createTextureInfo(ja.IridescenceThickness),createTextureInfo(ja.Anisotropy)}async[ds](){if(null!=this[cs]){const{set:e,material:t}=await this[cs].doLazyLoad();return this[va]=e,this[As](),this[cs]=void 0,this.ensureLoaded=async()=>{},t}return this[va].values().next().value}colorFromRgb(e){const t=new o.Ilk;return e instanceof Array?t.fromArray(e):t.set(e),t}[us](){if(null!=this[cs])throw new Error(`Material "${this.name}" has not been loaded, call 'await\n myMaterial.ensureLoaded()' before using an unloaded material.`)}async ensureLoaded(){await this[ds]()}get isLoaded(){return null==this[cs]}get isActive(){return this[ms]}[ps](e){this[ms]=e}get name(){return this[vs]||""}set name(e){if(this[vs]=e,null!=this[va])for(const t of this[va])t.name=e}get pbrMetallicRoughness(){return this[us](),this[ns]}get normalTexture(){return this[us](),this[is]}get occlusionTexture(){return this[us](),this[rs]}get emissiveTexture(){return this[us](),this[as]}get emissiveFactor(){return this[us](),this[ss].emissive.toArray()}get index(){return this[hs]}[gs](){return this[fs]}hasVariant(e){const t=this[Es].get(e);return null!=t&&this[fs].has(t.index)}setEmissiveFactor(e){this[us]();const t=this.colorFromRgb(e);for(const e of this[va])e.emissive.set(t);this[_a]()}[ls](){return this[ss].transparent?"BLEND":this[ss].alphaTest>0?"MASK":"OPAQUE"}[os](){this[us]();for(const e of this[va])"MASK"===this[ls]()?null==e.alphaTest&&(e.alphaTest=.5):e.alphaTest=void 0,e.needsUpdate=!0}setAlphaCutoff(e){this[us]();for(const t of this[va])t.alphaTest=e,t.needsUpdate=!0;this[os](),this[_a]()}getAlphaCutoff(){return this[us](),this[ss].alphaTest}setDoubleSided(e){this[us]();for(const t of this[va])t.side=e?o.ehD:o.Wl3,t.needsUpdate=!0;this[_a]()}getDoubleSided(){return this[us](),this[ss].side==o.ehD}setAlphaMode(e){this[us]();const enableTransparency=(e,t)=>{e.transparent=t,e.depthWrite=!t};for(const t of this[va])enableTransparency(t,"BLEND"===e),t.alphaTest="MASK"===e?.5:void 0,t.needsUpdate=!0;this[_a]()}getAlphaMode(){return this[us](),this[ls]()}get emissiveStrength(){return this[us](),this[ss].emissiveIntensity}setEmissiveStrength(e){this[us]();for(const t of this[va])t.emissiveIntensity=e;this[_a]()}get clearcoatFactor(){return this[us](),this[ss].clearcoat}get clearcoatRoughnessFactor(){return this[us](),this[ss].clearcoatRoughness}get clearcoatTexture(){return this[us](),this[_s].get(ja.Clearcoat)}get clearcoatRoughnessTexture(){return this[us](),this[_s].get(ja.ClearcoatRoughness)}get clearcoatNormalTexture(){return this[us](),this[_s].get(ja.ClearcoatNormal)}get clearcoatNormalScale(){return this[us](),this[ss].clearcoatNormalScale.x}setClearcoatFactor(e){this[us]();for(const t of this[va])t.clearcoat=e;this[_a]()}setClearcoatRoughnessFactor(e){this[us]();for(const t of this[va])t.clearcoatRoughness=e;this[_a]()}setClearcoatNormalScale(e){this[us]();for(const t of this[va])t.clearcoatNormalScale=new o.FM8(e,e);this[_a]()}get ior(){return this[us](),this[ss].ior}setIor(e){this[us]();for(const t of this[va])t.ior=e;this[_a]()}get sheenColorFactor(){return this[us](),this[ss].sheenColor.toArray()}get sheenColorTexture(){return this[us](),this[_s].get(ja.SheenColor)}get sheenRoughnessFactor(){return this[us](),this[ss].sheenRoughness}get sheenRoughnessTexture(){return this[us](),this[_s].get(ja.SheenRoughness)}setSheenColorFactor(e){this[us]();const t=this.colorFromRgb(e);for(const e of this[va])e.sheenColor.set(t),e.sheen=1;this[_a]()}setSheenRoughnessFactor(e){this[us]();for(const t of this[va])t.sheenRoughness=e,t.sheen=1;this[_a]()}get transmissionFactor(){return this[us](),this[ss].transmission}get transmissionTexture(){return this[us](),this[_s].get(ja.Transmission)}setTransmissionFactor(e){this[us]();for(const t of this[va])t.transmission=e;this[_a]()}get thicknessFactor(){return this[us](),this[ss].thickness}get thicknessTexture(){return this[us](),this[_s].get(ja.Thickness)}get attenuationDistance(){return this[us](),this[ss].attenuationDistance}get attenuationColor(){return this[us](),this[ss].attenuationColor.toArray()}setThicknessFactor(e){this[us]();for(const t of this[va])t.thickness=e;this[_a]()}setAttenuationDistance(e){this[us]();for(const t of this[va])t.attenuationDistance=e;this[_a]()}setAttenuationColor(e){this[us]();const t=this.colorFromRgb(e);for(const e of this[va])e.attenuationColor.set(t);this[_a]()}get specularFactor(){return this[us](),this[ss].specularIntensity}get specularTexture(){return this[us](),this[_s].get(ja.Specular)}get specularColorFactor(){return this[us](),this[ss].specularColor.toArray()}get specularColorTexture(){return this[us](),this[_s].get(ja.SheenColor)}setSpecularFactor(e){this[us]();for(const t of this[va])t.specularIntensity=e;this[_a]()}setSpecularColorFactor(e){this[us]();const t=this.colorFromRgb(e);for(const e of this[va])e.specularColor.set(t);this[_a]()}get iridescenceFactor(){return this[us](),this[ss].iridescence}get iridescenceTexture(){return this[us](),this[_s].get(ja.Iridescence)}get iridescenceIor(){return this[us](),this[ss].iridescenceIOR}get iridescenceThicknessMinimum(){return this[us](),this[ss].iridescenceThicknessRange[0]}get iridescenceThicknessMaximum(){return this[us](),this[ss].iridescenceThicknessRange[1]}get iridescenceThicknessTexture(){return this[us](),this[_s].get(ja.IridescenceThickness)}setIridescenceFactor(e){this[us]();for(const t of this[va])t.iridescence=e;this[_a]()}setIridescenceIor(e){this[us]();for(const t of this[va])t.iridescenceIOR=e;this[_a]()}setIridescenceThicknessMinimum(e){this[us]();for(const t of this[va])t.iridescenceThicknessRange[0]=e;this[_a]()}setIridescenceThicknessMaximum(e){this[us]();for(const t of this[va])t.iridescenceThicknessRange[1]=e;this[_a]()}get anisotropyStrength(){return this[us](),this[ss].anisotropy}get anisotropyRotation(){return this[us](),this[ss].anisotropyRotation}get anisotropyTexture(){return this[us](),this[_s].get(ja.Anisotropy)}setAnisotropyStrength(e){this[us]();for(const t of this[va])t.anisotropy=e;this[_a]()}setAnisotropyRotation(e){this[us]();for(const t of this[va])t.anisotropyRotation=e;this[_a]()}}var Cs=r(5108);class primitive_node_Node{constructor(e){this.name="",this.children=new Array,this.name=e}}class PrimitiveNode extends primitive_node_Node{constructor(e,t,r,s){super(e.name),this.materials=new Map,this.variantToMaterialMap=new Map,this.initialMaterialIdx=0,this.activeMaterialIdx=0,this.mesh=e;const{gltf:o,threeGLTF:l,threeObjectMap:c}=s;this.parser=l.parser,this.modelVariants=r,this.mesh.userData.variantData=r;const A=c.get(e.material);null!=A.materials?this.initialMaterialIdx=this.activeMaterialIdx=A.materials:Cs.error(`Primitive (${e.name}) missing initial material reference.`);const d=e.userData.associations||{};if(null==d.meshes)return void Cs.error("Mesh is missing primitive index association");const h=((o.meshes||[])[d.meshes].primitives||[])[d.primitives];if(null!=h){if(null!=h.material)this.materials.set(h.material,t[h.material]);else{const e=t.findIndex((e=>"Default"===e.name));e>=0?this.materials.set(e,t[e]):Cs.warn("gltfPrimitive has no material!")}if(h.extensions&&h.extensions.KHR_materials_variants){const e=h.extensions.KHR_materials_variants,s=l.parser.json.extensions.KHR_materials_variants.variants;for(const o of e.mappings){const e=t[o.material];this.materials.set(o.material,e);for(const t of o.variants){const{name:o}=s[t];this.variantToMaterialMap.set(t,e),e[gs]().add(t),r.has(o)||r.set(o,{name:o,index:t})}}}}else Cs.error("Mesh primitive definition is missing.")}async setActiveMaterial(e){const t=this.materials.get(e);if(null!=t&&e!==this.activeMaterialIdx){this.mesh.material=await t[ds]();const{normalScale:r}=this.mesh.material;null!=r&&r.y*r.x<0!=(null==this.mesh.geometry.attributes.tangent)&&this.parser.assignFinalMaterial(this.mesh),this.activeMaterialIdx=e}return this.mesh.material}getActiveMaterial(){return this.materials.get(this.activeMaterialIdx)}getMaterial(e){return this.materials.get(e)}async enableVariant(e){if(null==e)return this.setActiveMaterial(this.initialMaterialIdx);if(null!=this.variantToMaterialMap&&this.modelVariants.has(e)){const t=this.modelVariants.get(e);return this.enableVariantHelper(t.index)}return null}async enableVariantHelper(e){if(null!=this.variantToMaterialMap&&null!=e){const t=this.variantToMaterialMap.get(e);if(null!=t)return this.setActiveMaterial(t.index)}return null}async instantiateVariants(){if(null!=this.variantToMaterialMap)for(const e of this.variantToMaterialMap.keys()){const t=this.mesh.userData.variantMaterials.get(e);if(null!=t.material)continue;const r=await this.enableVariantHelper(e);null!=r&&(t.material=r)}}get variantInfo(){return this.variantToMaterialMap}addVariant(e,t){if(!this.ensureVariantIsUnused(t))return!1;this.modelVariants.has(t)||this.modelVariants.set(t,{name:t,index:this.modelVariants.size});const r=this.modelVariants.get(t).index;return e[gs]().add(r),this.variantToMaterialMap.set(r,e),this.materials.set(e.index,e),this.updateVariantUserData(r,e),!0}deleteVariant(e){if(this.variantInfo.has(e)){this.variantInfo.delete(e);const t=this.mesh.userData.variantMaterials;null!=t&&t.delete(e)}}updateVariantUserData(e,t){t[gs]().add(e),this.mesh.userData.variantData=this.modelVariants,this.mesh.userData.variantMaterials=this.mesh.userData.variantMaterials||new Map;this.mesh.userData.variantMaterials.set(e,{material:t[va].values().next().value,gltfMaterialIndex:t.index})}ensureVariantIsUnused(e){const t=this.modelVariants.get(e);return null==t||!this.variantInfo.has(t.index)||(Cs.warn(`Primitive cannot add variant '${e}' for this material, it already exists.`),!1)}}var Is,Ss,xs,Ts,ys,Ms,ws=r(5108);const bs=Symbol("materials"),Bs=Symbol("hierarchy"),Rs=Symbol("roots"),Ls=Symbol("primitives"),Ds=(Symbol("loadVariant"),Symbol("prepareVariantsForExport")),Us=Symbol("switchVariant"),Ps=Symbol("materialFromPoint"),Fs=Symbol("nodeFromPoint"),Qs=Symbol("nodeFromIndex"),Ns=Symbol("variantData"),Os=Symbol("availableVariants"),Gs=Symbol("modelOnUpdate"),ks=Symbol("cloneMaterial");class LazyLoader{constructor(e,t,r,s){this.gltf=e,this.gltfElementMap=t,this.mapKey=r,this.doLazyLoad=s}}class Model{constructor(e,t=(()=>{})){this[Is]=new Array,this[Ss]=new Array,this[xs]=new Array,this[Ts]=new Array,this[ys]=()=>{},this[Ms]=new Map,this[Gs]=t;const{gltf:r,threeGLTF:s,gltfElementMap:l}=e;for(const[e,o]of r.materials.entries()){const c=l.get(o);if(null!=c)this[bs].push(new Material(t,e,!0,this[Ns],c,o.name));else{const A=(r.materials||[])[e],d=e,materialLoadCallback=async()=>{const e=await s.parser.getDependency("material",d),t=new Set;return l.set(A,t),t.add(e),{set:t,material:e}};this[bs].push(new Material(t,e,!1,this[Ns],c,o.name,new LazyLoader(r,l,A,materialLoadCallback)))}}const c=new Map,A=new Array;for(const e of s.scene.children)A.push(e);for(;A.length>0;){const t=A.pop();let r=null;t instanceof o.Kj0?(r=new PrimitiveNode(t,this.materials,this[Ns],e),this[Ls].push(r)):r=new primitive_node_Node(t.name);const s=c.get(t);null!=s?s.children.push(r):this[Rs].push(r),this[Bs].push(r);for(const e of t.children)A.push(e),c.set(t,r)}}get materials(){return this[bs]}[(Is=bs,Ss=Bs,xs=Rs,Ts=Ls,ys=Gs,Ms=Ns,Os)](){const e=Array.from(this[Ns].values());return e.sort(((e,t)=>e.index-t.index)),e.map((e=>e.name))}getMaterialByName(e){const t=this[bs].filter((t=>t.name===e));return t.length>0?t[0]:null}[Qs](e,t){const r=this[Bs].find((r=>{if(r instanceof PrimitiveNode){const{meshes:s,primitives:o}=r.mesh.userData.associations;if(s==e&&o==t)return!0}return!1}));return null==r?null:r}[Fs](e){return this[Bs].find((t=>{if(t instanceof PrimitiveNode){if(t.mesh===e.object)return!0}return!1}))}[Ps](e){return this[Fs](e).getActiveMaterial()}async[Us](e){for(const t of this[Ls])await t.enableVariant(e);for(const e of this.materials)e[ps](!1);for(const e of this[Ls])this.materials[e.getActiveMaterial().index][ps](!0)}async[Ds](){const e=new Array;for(const t of this[Ls])e.push(t.instantiateVariants());await Promise.all(e)}[ks](e,t){const r=this.materials[e];r.isLoaded||ws.error("Cloning an unloaded material,\n call 'material.ensureLoaded() before cloning the material.");const s=r[va],o=new Set;for(const[e,r]of s.entries()){const l=r.clone();l.name=t+(s.size>1?"_inst"+e:""),o.add(l)}const l=new Material(this[Gs],this[bs].length,!1,this[Ns],o,t);return this[bs].push(l),l}createMaterialInstanceForVariant(e,t,r,s=!0){let o=null;for(const s of this[Ls]){const l=this[Ns].get(r);null!=l&&s.variantInfo.has(l.index)||null!=s.getMaterial(e)&&(this.hasVariant(r)||this.createVariant(r),null==o&&(o=this[ks](e,t)),s.addVariant(o,r))}if(s&&null!=o){o[ps](!0),this.materials[e][ps](!1);for(const e of this[Ls])e.enableVariant(r)}return o}createVariant(e){this[Ns].has(e)?ws.warn(`Variant '${e}'' already exists`):this[Ns].set(e,{name:e,index:this[Ns].size})}hasVariant(e){return this[Ns].has(e)}setMaterialToVariant(e,t){if(null!=this[Os]().find((e=>e===t)))if(e<0||e>=this.materials.length)ws.error("setMaterialToVariant(): materialIndex is out of bounds.");else for(const r of this[Ls]){const s=r.getMaterial(e);null!=s&&r.addVariant(s,t)}else ws.warn(`Can't add material to '${t}', the variant does not exist.'`)}updateVariantName(e,t){const r=this[Ns].get(e);null!=r&&(r.name=t,this[Ns].set(t,r),this[Ns].delete(e))}deleteVariant(e){const t=this[Ns].get(e);if(null!=t){for(const r of this.materials)r.hasVariant(e)&&r[fs].delete(t.index);for(const e of this[Ls])e.deleteVariant(t.index);this[Ns].delete(e)}}}var scene_graph_decorate=function(e,t,r,s){var o,l=arguments.length,c=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var A=e.length-1;A>=0;A--)(o=e[A])&&(c=(l<3?o(c):l>3?o(t,r,c):o(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c};const Hs=Symbol("currentGLTF"),Vs=Symbol("originalGltfJson"),zs=Symbol("model"),Ws=Symbol("getOnUpdateMethod"),qs=Symbol("buildTexture");class GroundedSkybox extends o.Kj0{constructor(){super(void 0,new o.vBJ({depthWrite:!1})),this.height=0,this.radius=0,this.resolution=0,this.userData.noHit=!0}get map(){return this.material.map}set map(e){this.material.map=e}isUsable(){return this.height>0&&this.radius>0&&null!=this.geometry&&null!=this.map}updateGeometry(e=this.height,t=this.radius,r=128){e==this.height&&t==this.radius&&r==this.resolution||(this.height=e,this.radius=t,this.resolution=r,e>0&&t>0&&(this.geometry.dispose(),this.geometry=function makeGeometry(e,t,r){const s=new o.xo$(t,2*r,r);s.scale(1,1,-1);const l=s.getAttribute("position"),c=new o.Pa4;for(let t=0;t<l.count;++t)if(c.fromBufferAttribute(l,t),c.y<0){const r=3*-e/2,s=c.y<r?-e/c.y:1-c.y*c.y/(3*r*r);c.multiplyScalar(s),c.toArray(l.array,3*t)}return l.needsUpdate=!0,s}(e,t,r)))}}const Xs=new o.Pa4,Ks=new o.Pa4,js=new o.Pa4,Ys=new o.Vkp,Js=new o.CJI,$s=new o._fP;class Hotspot extends CSS2DObject{constructor(e){super(document.createElement("div")),this.normal=new o.Pa4(0,1,0),this.initialized=!1,this.referenceCount=1,this.pivot=document.createElement("div"),this.slot=document.createElement("slot"),this.element.classList.add("annotation-wrapper"),this.slot.name=e.name,this.element.appendChild(this.pivot),this.pivot.appendChild(this.slot),this.updatePosition(e.position),this.updateNormal(e.normal),this.surface=e.surface}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(e){if(null==e)return;const t=ni(e)[0].terms;for(let e=0;e<3;++e)this.position.setComponent(e,ci(t[e]).number);this.updateMatrixWorld()}updateNormal(e){if(null==e)return;const t=ni(e)[0].terms;for(let e=0;e<3;++e)this.normal.setComponent(e,t[e].number)}updateSurface(e){if(!e&&this.initialized)return;const{mesh:t,tri:r,bary:s}=this;if(null==t||null==r||null==s)return;t.getVertexPosition(r.x,Xs),t.getVertexPosition(r.y,Ks),t.getVertexPosition(r.z,js),Xs.toArray(Ys.elements,0),Ks.toArray(Ys.elements,3),js.toArray(Ys.elements,6),this.position.copy(s).applyMatrix3(Ys);const o=this.parent;o.worldToLocal(t.localToWorld(this.position)),Js.set(Xs,Ks,js),Js.getNormal(this.normal).transformDirection(t.matrixWorld);const l=o.parent;$s.setFromAxisAngle(Xs.set(0,1,0),-l.yaw),this.normal.applyQuaternion($s)}orient(e){this.pivot.style.transform=`rotate(${e}rad)`}updateVisibility(e){this.element.classList.toggle("hide",!e),this.slot.assignedNodes().forEach((t=>{if(t.nodeType!==Node.ELEMENT_NODE)return;const r=t,s=r.dataset.visibilityAttribute;if(null!=s){const t=`data-${s}`;r.toggleAttribute(t,e)}r.dispatchEvent(new CustomEvent("hotspot-visibility",{detail:{visible:e}}))})),this.initialized=!0}}const Zs={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}"},eo={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}"};r(5108);Math.PI,Math.PI;function lerp(e,t,r){return(1-r)*e+r*t}class Shadow extends o.Tme{constructor(e,t,r){super(),this.camera=new o.iKG,this.renderTarget=null,this.renderTargetBlur=null,this.depthMaterial=new o.lRF,this.horizontalBlurMaterial=new o.jyz(Zs),this.verticalBlurMaterial=new o.jyz(eo),this.intensity=0,this.softness=1,this.boundingBox=new o.ZzF,this.size=new o.Pa4,this.maxDimension=0,this.isAnimated=!1,this.needsUpdate=!1;const{camera:s}=this;s.rotation.x=Math.PI/2,s.left=-.5,s.right=.5,s.bottom=-.5,s.top=.5,this.add(s);const l=new o._12,c=new o.vBJ({opacity:1,transparent:!0,side:o._Li});this.floor=new o.Kj0(l,c),this.floor.userData.noHit=!0,s.add(this.floor),this.blurPlane=new o.Kj0(l),this.blurPlane.visible=!1,s.add(this.blurPlane),e.target.add(this),this.depthMaterial.onBeforeCompile=function(e){e.fragmentShader=e.fragmentShader.replace("gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );","gl_FragColor = vec4( vec3( 0.0 ), ( 1.0 - fragCoordZ ) * opacity );")},this.horizontalBlurMaterial.depthTest=!1,this.verticalBlurMaterial.depthTest=!1,this.setScene(e,t,r)}setScene(e,t,r){const{boundingBox:s,size:o,rotation:l,position:c}=this;if(this.isAnimated=e.animationNames.length>0,this.boundingBox.copy(e.boundingBox),this.size.copy(e.size),this.maxDimension=Math.max(o.x,o.y,o.z)*(this.isAnimated?2:1),this.boundingBox.getCenter(c),"back"===r){const{min:e,max:t}=s;[e.y,e.z]=[e.z,e.y],[t.y,t.z]=[t.z,t.y],[o.y,o.z]=[o.z,o.y],l.x=Math.PI/2,l.y=Math.PI}else l.x=0,l.y=0;if(this.isAnimated){const e=s.min.y,t=s.max.y;o.y=this.maxDimension,s.expandByVector(o.subScalar(this.maxDimension).multiplyScalar(-.5)),s.min.y=e,s.max.y=t,o.set(this.maxDimension,t-e,this.maxDimension)}"bottom"===r?c.y=s.min.y:c.z=s.min.y,this.setSoftness(t)}setSoftness(e){this.softness=e;const{size:t,camera:r}=this,s=this.isAnimated?2:1,o=s*Math.pow(2,9-3*e);this.setMapSize(o);const l=t.y/2,c=t.y*s;r.near=0,r.far=lerp(c,l,e),this.depthMaterial.opacity=1/e,r.updateProjectionMatrix(),this.setIntensity(this.intensity),this.setOffset(0)}setMapSize(e){const{size:t}=this;this.isAnimated&&(e*=2);const r=Math.floor(t.x>t.z?e:e*t.x/t.z),s=Math.floor(t.x>t.z?e*t.z/t.x:e),l=10+r,c=10+s;if(null==this.renderTarget||this.renderTarget.width===l&&this.renderTarget.height===c||(this.renderTarget.dispose(),this.renderTarget=null,this.renderTargetBlur.dispose(),this.renderTargetBlur=null),null==this.renderTarget){const e={format:o.wk1};this.renderTarget=new o.dd2(l,c,e),this.renderTargetBlur=new o.dd2(l,c,e),this.floor.material.map=this.renderTarget.texture}this.camera.scale.set(t.x*(1+10/r),t.z*(1+10/s),1),this.needsUpdate=!0}setIntensity(e){this.intensity=e,e>0?(this.visible=!0,this.floor.visible=!0,this.floor.material.opacity=e*lerp(.3,1,this.softness*this.softness)):(this.visible=!1,this.floor.visible=!1)}getIntensity(){return this.intensity}setOffset(e){this.floor.position.z=-e+this.gap()}gap(){return.001*this.maxDimension}render(e,t){t.overrideMaterial=this.depthMaterial;const r=e.getClearAlpha();e.setClearAlpha(0),this.floor.visible=!1;const s=e.xr.enabled;e.xr.enabled=!1;const o=e.getRenderTarget();e.setRenderTarget(this.renderTarget),e.render(t,this.camera),t.overrideMaterial=null,this.floor.visible=!0,this.blurShadow(e),e.xr.enabled=s,e.setRenderTarget(o),e.setClearAlpha(r)}blurShadow(e){const{camera:t,horizontalBlurMaterial:r,verticalBlurMaterial:s,renderTarget:o,renderTargetBlur:l,blurPlane:c}=this;c.visible=!0,c.material=r,r.uniforms.h.value=1/this.renderTarget.width,r.uniforms.tDiffuse.value=this.renderTarget.texture,e.setRenderTarget(l),e.render(c,t),c.material=s,s.uniforms.v.value=1/this.renderTarget.height,s.uniforms.tDiffuse.value=this.renderTargetBlur.texture,e.setRenderTarget(o),e.render(c,t),c.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()}}var to=r(5108);const no=new o.Pa4,io=new o.Pa4,ro=new o.Pa4,ao=new o.iMs,so=new o.Pa4,oo=new o.FM8;class ModelScene extends o.xsS{constructor({canvas:e,element:t,width:r,height:s}){super(),this.annotationRenderer=new CSS2DRenderer,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.camera=new o.cPb(45,1,.1,100),this.xrCamera=null,this.url=null,this.target=new o.Tme,this.animationNames=[],this.boundingBox=new o.ZzF,this.boundingSphere=new o.aLr,this.size=new o.Pa4,this.idealAspect=0,this.framedFoVDeg=0,this.shadow=null,this.shadowIntensity=0,this.shadowSoftness=1,this.bakedShadows=new Set,this.exposure=1,this.toneMapping=o.LY2,this.canScale=!0,this.isDirty=!1,this.goalTarget=new o.Pa4,this.targetDamperX=new Damper,this.targetDamperY=new Damper,this.targetDamperZ=new Damper,this._currentGLTF=null,this._model=null,this.cancelPendingSourceChange=null,this.animationsByName=new Map,this.currentAnimationAction=null,this.groundedSkybox=new GroundedSkybox,this.name="ModelScene",this.element=t,this.canvas=e,this.camera=new o.cPb(45,1,.1,100),this.camera.name="MainCamera",this.add(this.target),this.setSize(r,s),this.target.name="Target",this.mixer=new o.Xcj(this.target);const{domElement:l}=this.annotationRenderer,{style:c}=l;c.display="none",c.pointerEvents="none",c.position="absolute",c.top="0",this.element.shadowRoot.querySelector(".default").appendChild(l),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(e){this.reset(),this._model=e,this.target.add(e),await this.setupScene()}async setSource(e,t=(()=>{})){if(!e||e===this.url)return void t(1);if(this.reset(),this.url=e,null!=this.externalRenderer){const e=await this.externalRenderer.load(t);return this.boundingSphere.radius=e.framedRadius,void(this.idealAspect=e.fieldOfViewAspect)}let r;null!=this.cancelPendingSourceChange&&(this.cancelPendingSourceChange(),this.cancelPendingSourceChange=null);try{r=await new Promise((async(r,s)=>{this.cancelPendingSourceChange=()=>s();try{r(await this.element[$o].loader.load(e,this.element,t))}catch(e){s(e)}}))}catch(e){if(null==e)return;throw e}this.cancelPendingSourceChange=null,this.reset(),this.url=e,this._currentGLTF=r,null!=r&&(this._model=r.scene,this.target.add(r.scene));const{animations:s}=r,o=new Map,l=[];for(const e of s)o.set(e.name,e),l.push(e.name);this.animations=s,this.animationsByName=o,this.animationNames=l,await this.setupScene()}async setupScene(){this.applyTransform(),this.updateBoundingBox(),await this.updateFraming(),this.updateShadow(),this.setShadowIntensity(this.shadowIntensity),this.setGroundedSkybox()}reset(){this.url=null,this.renderCount=0,this.queueRender(),null!=this.shadow&&this.shadow.setIntensity(0),this.bakedShadows.clear();const{_model:e}=this;null!=e&&(e.removeFromParent(),this._model=null);const t=this._currentGLTF;null!=t&&(t.dispose(),this._currentGLTF=null),null!=this.currentAnimationAction&&(this.currentAnimationAction.stop(),this.currentAnimationAction=null),this.mixer.stopAllAction(),this.mixer.uncacheRoot(this)}dispose(){this.reset(),null!=this.shadow&&(this.shadow.dispose(),this.shadow=null),this.element[Hs]=null,this.element[Vs]=null,this.element[zs]=null}get currentGLTF(){return this._currentGLTF}setSize(e,t){if(this.width!==e||this.height!==t){if(this.width=Math.max(e,1),this.height=Math.max(t,1),this.annotationRenderer.setSize(e,t),this.aspect=this.width/this.height,null!=this.externalRenderer){const r=Ce();this.externalRenderer.resize(e*r,t*r)}this.queueRender()}}markBakedShadow(e){e.userData.noHit=!0,this.bakedShadows.add(e)}unmarkBakedShadow(e){e.userData.noHit=!1,e.visible=!0,this.bakedShadows.delete(e),this.boundingBox.expandByObject(e)}findBakedShadows(e){const t=new o.ZzF;e.traverse((e=>{const r=e;if(!r.material)return;if(!r.material.transparent)return;t.setFromObject(r);const s=t.getSize(so),o=Math.min(s.x,s.y,s.z);Math.max(s.x,s.y,s.z)<100*o||this.markBakedShadow(r)}))}checkBakedShadows(){const{min:e,max:t}=this.boundingBox,r=new o.ZzF;this.boundingBox.getSize(this.size);for(const s of this.bakedShadows)r.setFromObject(s),r.min.y<e.y+this.size.y/100&&r.min.x<=e.x&&r.max.x>=t.x&&r.min.z<=e.z&&r.max.z>=t.z||r.min.z<e.z+this.size.z/100&&r.min.x<=e.x&&r.max.x>=t.x&&r.min.y<=e.y&&r.max.y>=t.y||this.unmarkBakedShadow(s)}applyTransform(){const{model:e}=this;if(null==e)return;const t=ni(this.element.orientation)[0].terms,r=ci(t[0]).number,s=ci(t[1]).number,l=ci(t[2]).number;e.quaternion.setFromEuler(new o.USm(s,l,r,"YXZ"));const c=ni(this.element.scale)[0].terms;e.scale.set(c[0].number,c[1].number,c[2].number)}updateBoundingBox(){const{model:e}=this;if(null==e)return;this.target.remove(e),this.findBakedShadows(e);const bound=(e,t)=>e.expandByPoint(t);this.setBakedShadowVisibility(!1),this.boundingBox=reduceVertices(e,bound,new o.ZzF),this.boundingBox.isEmpty()&&(this.setBakedShadowVisibility(!0),this.bakedShadows.forEach((e=>this.unmarkBakedShadow(e))),this.boundingBox=reduceVertices(e,bound,new o.ZzF)),this.checkBakedShadows(),this.setBakedShadowVisibility(),this.boundingBox.getSize(this.size),this.target.add(e)}async updateFraming(){const{model:e}=this;if(null==e)return;this.target.remove(e),this.setBakedShadowVisibility(!1);const{center:t}=this.boundingSphere;this.element.requestUpdate("cameraTarget"),await this.element.updateComplete,t.copy(this.getTarget());this.boundingSphere.radius=Math.sqrt(reduceVertices(e,((e,r)=>Math.max(e,t.distanceToSquared(r))),0));this.idealAspect=reduceVertices(e,((e,r)=>{r.sub(t);const s=Math.sqrt(r.x*r.x+r.z*r.z);return Math.max(e,s/(this.idealCameraDistance()-Math.abs(r.y)))}),0)/Math.tan(this.framedFoVDeg/2*Math.PI/180),this.setBakedShadowVisibility(),this.target.add(e)}setBakedShadowVisibility(e=this.shadowIntensity<=0){for(const t of this.bakedShadows)t.visible=e}idealCameraDistance(){const e=this.framedFoVDeg/2*Math.PI/180;return this.boundingSphere.radius/Math.sin(e)}adjustedFoV(e){const t=Math.tan(e/2*Math.PI/180)*Math.max(1,this.idealAspect/this.aspect);return 2*Math.atan(t)*180/Math.PI}getNDC(e,t){if(null!=this.xrCamera)oo.set(e/window.screen.width,t/window.screen.height);else{const r=this.element.getBoundingClientRect();oo.set((e-r.x)/this.width,(t-r.y)/this.height)}return oo.multiplyScalar(2).subScalar(1),oo.y*=-1,oo}getSize(){return{width:this.width,height:this.height}}setEnvironmentAndSkybox(e,t){this.element[$o].arRenderer.presentedScene!==this&&(this.environment=e,this.setBackground(t),this.queueRender())}setBackground(e){this.groundedSkybox.map=e,this.groundedSkybox.isUsable()?(this.target.add(this.groundedSkybox),this.background=null):(this.target.remove(this.groundedSkybox),this.background=e)}farRadius(){return this.boundingSphere.radius*(null!=this.groundedSkybox.parent?10:1)}setGroundedSkybox(){const e=ni(this.element.skyboxHeight)[0].terms[0],t=ci(e).number,r=10*this.boundingSphere.radius;this.groundedSkybox.updateGeometry(t,r),this.groundedSkybox.position.y=t-(this.shadow?2*this.shadow.gap():0),this.setBackground(this.groundedSkybox.map)}setTarget(e,t,r){this.goalTarget.set(-e,-t,-r)}setTargetDamperDecayTime(e){this.targetDamperX.setDecayTime(e),this.targetDamperY.setDecayTime(e),this.targetDamperZ.setDecayTime(e)}getTarget(){return this.goalTarget.clone().multiplyScalar(-1)}jumpToGoal(){this.updateTarget(1e4)}updateTarget(e){const t=this.goalTarget,r=this.target.position;if(t.equals(r))return!1;{const s=this.boundingSphere.radius/10;let{x:o,y:l,z:c}=r;return o=this.targetDamperX.update(o,t.x,e,s),l=this.targetDamperY.update(l,t.y,e,s),c=this.targetDamperZ.update(c,t.z,e,s),this.groundedSkybox.position.x=-o,this.groundedSkybox.position.z=-c,this.target.position.set(o,l,c),this.target.updateMatrixWorld(),this.queueRender(),!0}}pointTowards(e,t){const{x:r,z:s}=this.position;this.yaw=Math.atan2(e-r,t-s)}get model(){return this._model}set yaw(e){this.rotation.y=e,this.groundedSkybox.rotation.y=-e,this.queueRender()}get yaw(){return this.rotation.y}set animationTime(e){this.mixer.setTime(e),this.queueShadowRender()}get animationTime(){if(null!=this.currentAnimationAction){const e=Math.max(this.currentAnimationAction._loopCount,0);return this.currentAnimationAction.loop===o.uEv&&1==(1&e)?this.duration-this.currentAnimationAction.time:this.currentAnimationAction.time}return 0}set animationTimeScale(e){this.mixer.timeScale=e}get animationTimeScale(){return this.mixer.timeScale}get duration(){return null!=this.currentAnimationAction&&this.currentAnimationAction.getClip()?this.currentAnimationAction.getClip().duration:0}get hasActiveAnimation(){return null!=this.currentAnimationAction}playAnimation(e=null,t=0,r=o.YKA,s=1/0){if(null==this._currentGLTF)return;const{animations:l}=this;if(null==l||0===l.length)return;let c=null;if(null!=e&&(c=this.animationsByName.get(e),null==c)){const t=parseInt(e);!isNaN(t)&&t>=0&&t<l.length&&(c=l[t])}null==c&&(c=l[0]);try{const{currentAnimationAction:e}=this,o=this.mixer.clipAction(c,this);this.currentAnimationAction=o,this.element.paused?this.mixer.stopAllAction():(o.paused=!1,null!=e&&o!==e?o.crossFadeFrom(e,t,!1):this.animationTimeScale>0&&this.animationTime==this.duration&&(this.animationTime=0)),o.setLoop(r,s),o.enabled=!0,o.clampWhenFinished=!0,o.play()}catch(e){to.error(e)}}stopAnimation(){this.currentAnimationAction=null,this.mixer.stopAllAction()}updateAnimation(e){this.mixer.update(e),this.queueShadowRender()}subscribeMixerEvent(e,t){this.mixer.addEventListener(e,t)}updateShadow(){const e=this.shadow;if(null!=e){const t="wall"===this.element.arPlacement?"back":"bottom";e.setScene(this,this.shadowSoftness,t),e.needsUpdate=!0}}renderShadow(e){const t=this.shadow;null!=t&&1==t.needsUpdate&&(t.render(e,this),t.needsUpdate=!1)}queueShadowRender(){null!=this.shadow&&(this.shadow.needsUpdate=!0)}setShadowIntensity(e){if(this.shadowIntensity=e,null!=this._currentGLTF&&(this.setBakedShadowVisibility(),!(e<=0&&null==this.shadow))){if(null==this.shadow){const e="wall"===this.element.arPlacement?"back":"bottom";this.shadow=new Shadow(this,this.shadowSoftness,e)}this.shadow.setIntensity(e)}}setShadowSoftness(e){this.shadowSoftness=e;const t=this.shadow;null!=t&&t.setSoftness(e)}setShadowOffset(e){const t=this.shadow;null!=t&&t.setOffset(e)}hitFromPoint(e,t=this){ao.setFromCamera(e,this.getCamera());return ao.intersectObject(t,!0).find((e=>e.object.visible&&!e.object.userData.noHit))}positionAndNormalFromPoint(e,t=this){var r;const s=this.hitFromPoint(e,t);if(null==s)return null;return{position:s.point,normal:null!=s.face?s.face.normal.clone().applyNormalMatrix((new o.Vkp).getNormalMatrix(s.object.matrixWorld)):ao.ray.direction.clone().multiplyScalar(-1),uv:null!==(r=s.uv)&&void 0!==r?r:null}}surfaceFromPoint(e,t=this){const r=this.element.model;if(null==r)return null;const s=this.hitFromPoint(e,t);if(null==s||null==s.face)return null;const l=r[Fs](s),{meshes:c,primitives:A}=l.mesh.userData.associations,d=new o.Pa4,h=new o.Pa4,p=new o.Pa4,{a:g,b:m,c:f}=s.face,E=s.object;E.getVertexPosition(g,d),E.getVertexPosition(m,h),E.getVertexPosition(f,p);const _=new o.CJI(d,h,p),C=new o.Pa4;return _.getBarycoord(E.worldToLocal(s.point),C),`${c} ${A} ${g} ${m} ${f} ${C.x.toFixed(3)} ${C.y.toFixed(3)} ${C.z.toFixed(3)}`}addHotspot(e){this.target.add(e),this.annotationRenderer.domElement.appendChild(e.element)}removeHotspot(e){this.target.remove(e)}forHotspots(e){const{children:t}=this.target;for(let r=0,s=t.length;r<s;r++){const s=t[r];s instanceof Hotspot&&e(s)}}initializeSurface(e){if(null!=e.surface&&null==e.mesh){const t=ni(e.surface)[0].terms;if(8!=t.length)return void to.warn(e.surface+" does not have exactly 8 numbers.");const r=this.element.model[Qs](t[0].number,t[1].number),s=new o.Pa4(t[2].number,t[3].number,t[4].number);if(null==r)return void to.warn(e.surface+" does not match a node/primitive in this glTF! Skipping this hotspot.");const l=r.mesh.geometry.attributes.position.count;if(s.x>=l||s.y>=l||s.z>=l)return void to.warn(e.surface+" vertex indices out of range in this glTF! Skipping this hotspot.");const c=new o.Pa4(t[5].number,t[6].number,t[7].number);e.mesh=r.mesh,e.tri=s,e.bary=c}}updateSurfaceHotspots(){const e=!this.element.paused;this.forHotspots((t=>{this.initializeSurface(t),t.updateSurface(e)}))}updateHotspotsVisibility(e){this.forHotspots((t=>{no.copy(e),io.setFromMatrixPosition(t.matrixWorld),no.sub(io),ro.copy(t.normal).transformDirection(this.target.matrixWorld),no.dot(ro)<0?t.hide():t.show()}))}orientHotspots(e){this.forHotspots((t=>{t.orient(e)}))}setHotspotsVisibility(e){this.forHotspots((t=>{t.visible=e}))}updateSchema(e){var t;const{schemaElement:r,element:s}=this,{alt:o,poster:l,iosSrc:c}=s;if(null!=e){const s=[{"@type":"MediaObject",contentUrl:e,encodingFormat:"gltf"===(null===(t=e.split(".").pop())||void 0===t?void 0:t.toLowerCase())?"model/gltf+json":"model/gltf-binary"}];c&&s.push({"@type":"MediaObject",contentUrl:c,encodingFormat:"model/vnd.usdz+zip"});const A={"@context":"http://schema.org/","@type":"3DModel",image:null!=l?l:void 0,name:null!=o?o:void 0,encoding:s};r.textContent=JSON.stringify(A),document.head.appendChild(r)}else null!=r.parentElement&&r.parentElement.removeChild(r)}}class ProgressTracker extends EventTarget{constructor(){super(...arguments),this.ongoingActivities=new Set,this.totalProgress=0}get ongoingActivityCount(){return this.ongoingActivities.size}beginActivity(e){const t={progress:0,completed:!1};return this.ongoingActivities.add(t),1===this.ongoingActivityCount&&this.announceTotalProgress(t,0,e),r=>{let s;return s=Math.max(clamp(r,0,1),t.progress),s!==t.progress&&this.announceTotalProgress(t,s,e),t.progress}}announceTotalProgress(e,t,r){let s=0,o=0;1==t&&(e.completed=!0);for(const e of this.ongoingActivities){const{progress:t}=e;s+=1-t,e.completed&&o++}const l=e.progress;e.progress=t,this.totalProgress+=(t-l)*(1-this.totalProgress)/s;const c=o===this.ongoingActivityCount?1:this.totalProgress;this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:c,reason:r}})),o===this.ongoingActivityCount&&(this.totalProgress=0,this.ongoingActivities.clear())}}var lo,co,Ao,uo,ho,po,go,mo,fo,Eo,vo,_o,Co,Io=r(5108),model_viewer_base_decorate=function(e,t,r,s){var o,l=arguments.length,c=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var A=e.length-1;A>=0;A--)(o=e[A])&&(c=(l<3?o(c):l>3?o(t,r,c):o(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c};const So=document.createElement("canvas"),xo=Symbol("fallbackResizeHandler"),To=Symbol("defaultAriaLabel"),yo=Symbol("resizeObserver"),Mo=Symbol("clearModelTimeout"),wo=Symbol("onContextLost"),bo=Symbol("loaded"),Bo=Symbol("status"),Ro=Symbol("onFocus"),Lo=Symbol("onBlur"),Do=Symbol("updateSize"),Uo=Symbol("intersectionObserver"),Po=Symbol("isElementInViewport"),Fo=Symbol("announceModelVisibility"),Qo=Symbol("ariaLabel"),No=Symbol("altDefaulted"),Oo=Symbol("statusElement"),Go=Symbol("updateStatus"),ko=Symbol("loadedTime"),Ho=Symbol("updateSource"),Vo=Symbol("markLoaded"),zo=Symbol("container"),Wo=Symbol("input"),qo=Symbol("canvas"),Xo=Symbol("scene"),Ko=Symbol("needsRender"),jo=Symbol("tick"),Yo=Symbol("onModelLoad"),Jo=Symbol("onResize"),$o=Symbol("renderer"),Zo=Symbol("progressTracker"),el=Symbol("getLoaded"),tl=Symbol("getModelIsVisible"),nl=Symbol("shouldAttemptPreload"),toVector3D=e=>({x:e.x,y:e.y,z:e.z,toString(){return`${this.x}m ${this.y}m ${this.z}m`}}),toVector2D=e=>({u:e.x,v:e.y,toString(){return`${this.u} ${this.v}`}});class ModelViewerElementBase extends u{constructor(){super(),this.alt=null,this.src=null,this.withCredentials=!1,this.generateSchema=!1,this[lo]=!1,this[co]=!1,this[Ao]=0,this[uo]="",this[ho]=null,this[po]=debounce((()=>{const e=this.getBoundingClientRect();this[Do](e)}),50),this[go]=debounce((e=>{const t=this.modelIsVisible;t!==e&&this.dispatchEvent(new CustomEvent("model-visibility",{detail:{visible:t}}))}),0),this[mo]=null,this[fo]=null,this[Eo]=new ProgressTracker,this[vo]=()=>{this[Oo].textContent=this[Bo]},this[_o]=()=>{this[Oo].textContent=""},this[Co]=e=>{this.dispatchEvent(new CustomEvent("error",{detail:{type:"webglcontextlost",sourceError:e.sourceEvent}}))},this.attachShadow({mode:"open"});const e=this.shadowRoot;let t,r;if((e=>{D(Me,e)})(e),this[zo]=e.querySelector(".container"),this[Wo]=e.querySelector(".userInput"),this[qo]=e.querySelector("canvas"),this[Oo]=e.querySelector("#status"),this[To]=this[Wo].getAttribute("aria-label"),this.isConnected){const e=this.getBoundingClientRect();t=e.width,r=e.height}else t=300,r=150;this[Xo]=new ModelScene({canvas:this[qo],element:this,width:t,height:r}),Promise.resolve().then((()=>{this[Do](this.getBoundingClientRect())})),Ae&&(this[yo]=new ResizeObserver((e=>{if(!this[$o].isPresenting)for(let t of e)t.target===this&&this[Do](t.contentRect)}))),de?this[Uo]=new IntersectionObserver((e=>{for(let t of e)if(t.target===this){const e=this.modelIsVisible;this[Po]=t.isIntersecting,this[Fo](e),this[Po]&&!this.loaded&&this[Ho]()}}),{root:null,rootMargin:"0px",threshold:1e-5}):this[Po]=!0}static get is(){return"model-viewer"}static set modelCacheSize(e){CachingGLTFLoader[Bt].evictionThreshold=e}static get modelCacheSize(){return CachingGLTFLoader[Bt].evictionThreshold}static set minimumRenderScale(e){e>1&&Io.warn("<model-viewer> minimumRenderScale has been clamped to a maximum value of 1."),e<=0&&Io.warn("<model-viewer> minimumRenderScale has been clamped to a minimum value of 0.25."),Renderer.singleton.minScale=e}static get minimumRenderScale(){return Renderer.singleton.minScale}get loaded(){return this[el]()}get[(lo=Po,co=bo,Ao=ko,uo=Bo,ho=Mo,po=xo,go=Fo,mo=yo,fo=Uo,Eo=Zo,$o)](){return Renderer.singleton}get modelIsVisible(){return this[tl]()}connectedCallback(){super.connectedCallback&&super.connectedCallback(),Ae?this[yo].observe(this):self.addEventListener("resize",this[xo]),de&&this[Uo].observe(this),this.addEventListener("focus",this[Ro]),this.addEventListener("blur",this[Lo]);const e=this[$o];e.addEventListener("contextlost",this[wo]),e.registerScene(this[Xo]),null!=this[Mo]&&(self.clearTimeout(this[Mo]),this[Mo]=null,this.requestUpdate("src",null))}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback(),Ae?this[yo].unobserve(this):self.removeEventListener("resize",this[xo]),de&&this[Uo].unobserve(this),this.removeEventListener("focus",this[Ro]),this.removeEventListener("blur",this[Lo]);const e=this[$o];e.removeEventListener("contextlost",this[wo]),e.unregisterScene(this[Xo]),this[Mo]=self.setTimeout((()=>{this[Xo].dispose(),this[Mo]=null}),10)}updated(e){super.updated(e),e.has("src")&&(null==this.src?(this[bo]=!1,this[ko]=0,this[Xo].reset()):this.src!==this[Xo].url&&(this[bo]=!1,this[ko]=0,this[Ho]())),e.has("alt")&&this[Wo].setAttribute("aria-label",this[Qo]),e.has("withCredentials")&&(CachingGLTFLoader.withCredentials=this.withCredentials,this[$o].textureUtils.withCredentials=this.withCredentials),e.has("generateSchema")&&(this.generateSchema?this[Xo].updateSchema(this.src):this[Xo].updateSchema(null))}toDataURL(e,t){return this[$o].displayCanvas(this[Xo]).toDataURL(e,t)}async toBlob(e){const t=e?e.mimeType:void 0,r=e?e.qualityArgument:void 0,s=e?e.idealAspect:void 0,{width:o,height:l,idealAspect:c,aspect:A}=this[Xo],{dpr:d,scaleFactor:h}=this[$o];let p=o*h*d,g=l*h*d,m=0,f=0;if(!0===s)if(c>A){const e=g;g=Math.round(p/c),f=(e-g)/2}else{const e=p;p=Math.round(g*c),m=(e-p)/2}So.width=p,So.height=g;try{return new Promise((async(e,s)=>{So.getContext("2d").drawImage(this[$o].displayCanvas(this[Xo]),m,f,p,g,0,0,p,g),So.toBlob((t=>{if(!t)return s(new Error("Unable to retrieve canvas blob"));e(t)}),t,r)}))}finally{this[Do]({width:o,height:l})}}registerEffectComposer(e){e.setRenderer(this[$o].threeRenderer),e.setMainCamera(this[Xo].getCamera()),e.setMainScene(this[Xo]),this[Xo].effectRenderer=e}unregisterEffectComposer(){this[Xo].effectRenderer=null}registerRenderer(e){this[Xo].externalRenderer=e}unregisterRenderer(){this[Xo].externalRenderer=null}get[Qo](){return this[No]}get[No](){return null==this.alt||"null"===this.alt?this[To]:this.alt}[el](){return this[bo]}[tl](){return this.loaded&&this[Po]}[nl](){return!!this.src&&this[Po]}[Do]({width:e,height:t}){0!==e&&0!==t&&(this[zo].style.width=`${e}px`,this[zo].style.height=`${t}px`,this[Jo]({width:e,height:t}))}[jo](e,t){var r;null===(r=this[Xo].effectRenderer)||void 0===r||r.beforeRender(e,t)}[Vo](){this[bo]||(this[bo]=!0,this[ko]=performance.now())}[Ko](){this[Xo].queueRender()}[Yo](){}[Go](e){this[Bo]=e;const t=this.getRootNode();null!=t&&t.activeElement===this&&this[Oo].textContent!=e&&(this[Oo].textContent=e)}[(vo=Ro,_o=Lo,Jo)](e){this[Xo].setSize(e.width,e.height)}async[(Co=wo,Ho)](){const e=this[Xo];if(this.loaded||!this[nl]()||this.src===e.url)return;this.generateSchema&&e.updateSchema(this.src),this[Go]("Loading"),e.stopAnimation();const t=this[Zo].beginActivity("model-load"),r=this.src;try{const s=e.setSource(r,(e=>t(.95*clamp(e,0,1)))),o=this[Te]();await Promise.all([s,o]),this[Vo](),this[Yo](),this.updateComplete.then((()=>{this.dispatchEvent(new CustomEvent("before-render"))})),await new Promise((e=>{requestAnimationFrame((()=>{requestAnimationFrame((()=>{this.dispatchEvent(new CustomEvent("load",{detail:{url:r}})),e()}))}))}))}catch(e){this.dispatchEvent(new CustomEvent("error",{detail:{type:"loadfailure",sourceError:e}}))}finally{t(1)}}}model_viewer_base_decorate([n({type:String})],ModelViewerElementBase.prototype,"alt",void 0),model_viewer_base_decorate([n({type:String})],ModelViewerElementBase.prototype,"src",void 0),model_viewer_base_decorate([n({type:Boolean,attribute:"with-credentials"})],ModelViewerElementBase.prototype,"withCredentials",void 0),model_viewer_base_decorate([n({type:Boolean,attribute:"generate-schema"})],ModelViewerElementBase.prototype,"generateSchema",void 0);var animation_decorate=function(e,t,r,s){var o,l=arguments.length,c=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var A=e.length-1;A>=0;A--)(o=e[A])&&(c=(l<3?o(c):l>3?o(t,r,c):o(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c};const il=Symbol("changeAnimation"),rl=Symbol("paused"),al={repetitions:1/0,pingpong:!1},sl=Symbol("hotspotMap"),ol=Symbol("mutationCallback"),ll=Symbol("observer"),cl=Symbol("addHotspot"),Al=Symbol("removeHotspot"),dl=new o.yGw;var ul=r(5089);var hl=r(5108),ar_decorate=function(e,t,r,s){var o,l=arguments.length,c=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var A=e.length-1;A>=0;A--)(o=e[A])&&(c=(l<3?o(c):l>3?o(t,r,c):o(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c};let pl=!1,gl=!1;const ml="#model-viewer-no-ar-fallback",fl=(El=["quick-look","scene-viewer","webxr","none"],e=>{try{const t=ni(e),r=(t.length?t[0].terms:[]).filter((e=>e&&"ident"===e.type)).map((e=>e.value)).filter((e=>El.indexOf(e)>-1));return new Set(r)}catch(e){}return new Set});var El;const vl="quick-look",_l="scene-viewer",Cl="webxr",Il="none",Sl=Symbol("arButtonContainer"),xl=Symbol("enterARWithWebXR"),Tl=Symbol("openSceneViewer"),yl=Symbol("openIOSARQuickLook"),Ml=Symbol("canActivateAR"),wl=Symbol("arMode"),bl=Symbol("arModes"),Bl=Symbol("arAnchor"),Rl=Symbol("preload"),Ll=Symbol("onARButtonContainerClick"),Dl=Symbol("onARStatus"),Ul=Symbol("onARTracking"),Pl=Symbol("onARTap"),Fl=Symbol("selectARMode"),Ql=Symbol("triggerLoad");var loading_decorate=function(e,t,r,s){var o,l=arguments.length,c=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var A=e.length-1;A>=0;A--)(o=e[A])&&(c=(l<3?o(c):l>3?o(t,r,c):o(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c};const Nl="auto",Ol="auto",Gl="eager",kl=Symbol("defaultProgressBarElement"),Hl=Symbol("posterContainerElement"),Vl=Symbol("defaultPosterElement"),zl=Symbol("shouldDismissPoster"),Wl=Symbol("hidePoster"),ql=Symbol("modelIsRevealed"),Xl=Symbol("updateProgressBar"),Kl=Symbol("ariaLabelCallToAction"),jl=Symbol("onProgress");var staging_decorate=function(e,t,r,s){var o,l=arguments.length,c=l<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)c=Reflect.decorate(e,t,r,s);else for(var A=e.length-1;A>=0;A--)(o=e[A])&&(c=(l<3?o(c):l>3?o(t,r,c):o(t,r))||c);return l>3&&c&&Object.defineProperty(t,r,c),c};const Yl=Math.PI/32,Jl={basis:[degreesToRadians(numberNode(Yl,"rad"))],keywords:{auto:[null]}},$l=Symbol("autoRotateStartTime"),Zl=Symbol("radiansPerSecond"),ec=Symbol("syncRotationRate"),tc=Symbol("onCameraChange"),nc=(e=>{var t,r,s;class AnnotationModelViewerElement extends e{constructor(){super(...arguments),this[t]=new Map,this[r]=e=>{e.forEach((e=>{e instanceof MutationRecord&&"childList"!==e.type||(e.addedNodes.forEach((e=>{this[cl](e)})),e.removedNodes.forEach((e=>{this[Al](e)})),this[Ko]())}))},this[s]=new MutationObserver(this[ol])}connectedCallback(){super.connectedCallback();for(let e=0;e<this.children.length;++e)this[cl](this.children[e]);const{ShadyDOM:e}=self;null==e?this[ll].observe(this,{childList:!0}):this[ll]=e.observeChildren(this,this[ol])}disconnectedCallback(){super.disconnectedCallback();const{ShadyDOM:e}=self;null==e?this[ll].disconnect():e.unobserveChildren(this[ll])}[(t=sl,r=ol,s=ll,jo)](e,t){super[jo](e,t);const r=this[Xo],{annotationRenderer:s}=r,o=r.getCamera();r.shouldRender()&&(r.updateSurfaceHotspots(),r.updateHotspotsVisibility(o.position),s.domElement.style.display="",s.render(r,o))}updateHotspot(e){const t=this[sl].get(e.name);null!=t&&(t.updatePosition(e.position),t.updateNormal(e.normal),t.surface=e.surface,this[Ko]())}queryHotspot(e){const t=this[sl].get(e);if(null==t)return null;const r=toVector3D(t.position),s=toVector3D(t.normal),l=t.facingCamera,c=this[Xo],A=c.getCamera(),d=new o.Pa4;d.setFromMatrixPosition(t.matrixWorld),d.project(A);const h=c.width/2,p=c.height/2;d.x=d.x*h+h,d.y=-d.y*p+p;const g=toVector3D(new o.Pa4(d.x,d.y,d.z));return Number.isFinite(g.x)&&Number.isFinite(g.y)?{position:r,normal:s,canvasPosition:g,facingCamera:l}:null}positionAndNormalFromPoint(e,t){const r=this[Xo],s=r.getNDC(e,t),o=r.positionAndNormalFromPoint(s);if(null==o)return null;dl.copy(r.target.matrixWorld).invert();const l=toVector3D(o.position.applyMatrix4(dl)),c=toVector3D(o.normal.transformDirection(dl));let A=null;return null!=o.uv&&(A=toVector2D(o.uv)),{position:l,normal:c,uv:A}}surfaceFromPoint(e,t){const r=this[Xo],s=r.getNDC(e,t);return r.surfaceFromPoint(s)}[cl](e){if(!(e instanceof HTMLElement&&0===e.slot.indexOf("hotspot")))return;let t=this[sl].get(e.slot);null!=t?t.increment():(t=new Hotspot({name:e.slot,position:e.dataset.position,normal:e.dataset.normal,surface:e.dataset.surface}),this[sl].set(e.slot,t),this[Xo].addHotspot(t)),this[Xo].queueRender()}[Al](e){if(!(e instanceof HTMLElement))return;const t=this[sl].get(e.slot);t&&(t.decrement()&&(this[Xo].removeHotspot(t),this[sl].delete(e.slot)),this[Xo].queueRender())}}return AnnotationModelViewerElement})((e=>{var t,r,s;class SceneGraphModelViewerElement extends e{constructor(){super(...arguments),this[t]=void 0,this[r]=null,this[s]=null,this.variantName=null,this.orientation="0 0 0",this.scale="1 1 1"}get model(){return this[zs]}get availableVariants(){return this.model?this.model[Os]():[]}get originalGltfJson(){return this[Vs]}[(t=zs,r=Hs,s=Vs,Ws)](){return()=>{this[Ko]()}}[qs](e){return e.colorSpace=o.KI_,e.wrapS=o.rpg,e.wrapT=o.rpg,new Texture(this[Ws](),e)}async createTexture(e,t="image/png"){const{textureUtils:r}=this[$o],s=await r.loadImage(e);return s.userData.mimeType=t,this[qs](s)}async createLottieTexture(e,t=1){const{textureUtils:r}=this[$o],s=await r.loadLottie(e,t);return this[qs](s)}createVideoTexture(e){const t=document.createElement("video");t.crossOrigin=this.withCredentials?"use-credentials":"anonymous",t.src=e,t.muted=!0,t.playsInline=!0,t.loop=!0,t.play();const r=new o.fO1(t);return this[qs](r)}createCanvasTexture(){const e=document.createElement("canvas"),t=new o.ROQ(e);return this[qs](t)}async updated(e){if(super.updated(e),e.has("variantName")){const e=this[Zo].beginActivity("variant-update");e(.1);const t=this[zs],{variantName:r}=this;null!=t&&(await t[Us](r),this[Ko](),this.dispatchEvent(new CustomEvent("variant-applied"))),e(1)}if(e.has("orientation")||e.has("scale")){if(!this.loaded)return;const e=this[Xo];e.applyTransform(),e.updateBoundingBox(),e.updateShadow(),this[$o].arRenderer.onUpdateScene(),this[Ko]()}}[Yo](){super[Yo]();const{currentGLTF:e}=this[Xo];if(null!=e){const{correlatedSceneGraph:t}=e;null!=t&&e!==this[Hs]&&(this[zs]=new Model(t,this[Ws]()),this[Vs]=JSON.parse(JSON.stringify(t.gltf))),"variants"in e.userData&&this.requestUpdate("variantName")}this[Hs]=e}async exportScene(e){const t=this[Xo];return new Promise((async(r,s)=>{const o={binary:!0,onlyVisible:!0,maxTextureSize:1/0,includeCustomExtensions:!1,forceIndices:!1};Object.assign(o,e),o.animations=t.animations,o.truncateDrawRange=!0;const l=t.shadow;let c=!1;null!=l&&(c=l.visible,l.visible=!1),await this[zs][Ds]();(new GLTFExporter).register((e=>new GLTFExporterMaterialsVariantsExtension(e))).parse(t.model,(e=>r(new Blob([o.binary?e:JSON.stringify(e)],{type:o.binary?"application/octet-stream":"application/json"}))),(()=>s("glTF export failed")),o),null!=l&&(l.visible=c)}))}materialFromPoint(e,t){const r=this[zs];if(null==r)return null;const s=this[Xo],o=s.getNDC(e,t),l=s.hitFromPoint(o);return null==l||null==l.face?null:r[Ps](l)}}return scene_graph_decorate([n({type:String,attribute:"variant-name"})],SceneGraphModelViewerElement.prototype,"variantName",void 0),scene_graph_decorate([n({type:String,attribute:"orientation"})],SceneGraphModelViewerElement.prototype,"orientation",void 0),scene_graph_decorate([n({type:String,attribute:"scale"})],SceneGraphModelViewerElement.prototype,"scale",void 0),SceneGraphModelViewerElement})((e=>{var t,r,s;class StagingModelViewerElement extends e{constructor(){super(...arguments),this.autoRotate=!1,this.autoRotateDelay=3e3,this.rotationPerSecond="auto",this[t]=performance.now(),this[r]=0,this[s]=e=>{this.autoRotate&&"user-interaction"===e.detail.source&&(this[$l]=performance.now())}}connectedCallback(){super.connectedCallback(),this.addEventListener("camera-change",this[tc]),this[$l]=performance.now()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("camera-change",this[tc]),this[$l]=performance.now()}updated(e){super.updated(e),e.has("autoRotate")&&(this[$l]=performance.now())}[(t=$l,r=Zl,ec)](e){this[Zl]=e[0]}[jo](e,t){if(super[jo](e,t),!this.autoRotate||!this[tl]()||this[$o].isPresenting)return;const r=Math.min(t,e-this[$l]-this.autoRotateDelay);r>0&&(this[Xo].yaw=this.turntableRotation+this[Zl]*r*.001)}get turntableRotation(){return this[Xo].yaw}resetTurntableRotation(e=0){this[Xo].yaw=e}}return s=tc,staging_decorate([n({type:Boolean,attribute:"auto-rotate"})],StagingModelViewerElement.prototype,"autoRotate",void 0),staging_decorate([n({type:Number,attribute:"auto-rotate-delay"})],StagingModelViewerElement.prototype,"autoRotateDelay",void 0),staging_decorate([style({intrinsics:Jl,updateHandler:ec}),n({type:String,attribute:"rotation-per-second"})],StagingModelViewerElement.prototype,"rotationPerSecond",void 0),StagingModelViewerElement})((e=>{var t,r,s;class EnvironmentModelViewerElement extends e{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[t]=null,this[r]=null,this[s]=null}updated(e){super.updated(e),e.has("shadowIntensity")&&(this[Xo].setShadowIntensity(.5*this.shadowIntensity),this[Ko]()),e.has("shadowSoftness")&&(this[Xo].setShadowSoftness(this.shadowSoftness),this[Ko]()),e.has("exposure")&&(this[Xo].exposure=this.exposure,this[Ko]()),e.has("toneMapping")&&(this[Xo].toneMapping="commerce"===this.toneMapping||"neutral"===this.toneMapping?o.ORg:"agx"===this.toneMapping?o.Bgp:o.LY2,this[Ko]()),(e.has("environmentImage")||e.has("skyboxImage"))&&this[nl]()&&this[Te](),e.has("skyboxHeight")&&(this[Xo].setGroundedSkybox(),this[Ko]())}hasBakedShadow(){return this[Xo].bakedShadows.size>0}async[(t=Se,r=xe,s=ye,Te)](){const{skyboxImage:e,environmentImage:t}=this;null!=this[ye]&&(this[ye](),this[ye]=null);const{textureUtils:r}=this[$o];if(null==r)return;const s=this[Zo].beginActivity("environment-update");try{const{environmentMap:o,skybox:l}=await r.generateEnvironmentMapAndSkybox(deserializeUrl(e),t,(e=>s(clamp(e,0,1))));this[Se]!==o&&(this[Se]=o,this.dispatchEvent(new CustomEvent("environment-change"))),this[xe]=null!=l?l.name===o.name?o:l:null,this[Xo].setEnvironmentAndSkybox(this[Se],this[xe])}catch(e){if(e instanceof Error)throw this[Xo].setEnvironmentAndSkybox(null,null),e}finally{s(1)}}}return __decorate([n({type:String,attribute:"environment-image"})],EnvironmentModelViewerElement.prototype,"environmentImage",void 0),__decorate([n({type:String,attribute:"skybox-image"})],EnvironmentModelViewerElement.prototype,"skyboxImage",void 0),__decorate([n({type:Number,attribute:"shadow-intensity"})],EnvironmentModelViewerElement.prototype,"shadowIntensity",void 0),__decorate([n({type:Number,attribute:"shadow-softness"})],EnvironmentModelViewerElement.prototype,"shadowSoftness",void 0),__decorate([n({type:Number})],EnvironmentModelViewerElement.prototype,"exposure",void 0),__decorate([n({type:String,attribute:"tone-mapping"})],EnvironmentModelViewerElement.prototype,"toneMapping",void 0),__decorate([n({type:String,attribute:"skybox-height"})],EnvironmentModelViewerElement.prototype,"skyboxHeight",void 0),EnvironmentModelViewerElement})((e=>{var t,r,s,l,c,A,d,h,p,g,m,f,E,_,C,I,S,x;class ControlsModelViewerElement extends e{constructor(){super(...arguments),this.cameraControls=!1,this.cameraOrbit=qi,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=ji,this.interactionPromptStyle=Ji,this.orbitSensitivity=1,this.zoomSensitivity=1,this.panSensitivity=1,this.touchAction=$i,this.disableZoom=!1,this.disablePan=!1,this.disableTap=!1,this.interpolationDecay=50,this.a11y=null,this[t]=this.shadowRoot.querySelector(".interaction-prompt"),this[r]=this.shadowRoot.querySelector("#prompt"),this[s]=[this.shadowRoot.querySelector("#finger0"),this.shadowRoot.querySelector("#finger1")],this[l]=this.shadowRoot.querySelector(".pan-target"),this[c]=0,this[A]=1/0,this[d]=!1,this[h]=!1,this[p]=Nr.AUTOMATIC,this[g]=new SmoothControls(this[Xo].camera,this[Wo],this[Xo]),this[m]=new o.$V,this[f]=!1,this[E]=!1,this[_]=!1,this[C]={},this[I]=()=>{const e=this[rr].changeSource;this[Cr]=e,e===Nr.USER_INTERACTION&&(this[Er]=!0,this[cr]())},this[S]=()=>{this[Ar](),this[Ko]();const e=this[rr].changeSource;this.dispatchEvent(new CustomEvent("camera-change",{detail:{source:e}}))},this[x]=e=>{this[zo].classList.toggle("pointer-tumbling","pointer-change-start"===e.type)}}get inputSensitivity(){return this[rr].inputSensitivity}set inputSensitivity(e){this[rr].inputSensitivity=e}getCameraOrbit(){const{theta:e,phi:t,radius:r}=this[Ir];return{theta:e,phi:t,radius:r,toString(){return`${this.theta}rad ${this.phi}rad ${this.radius}m`}}}getCameraTarget(){return toVector3D(this[$o].isPresenting?this[$o].arRenderer.target:this[Xo].getTarget())}getFieldOfView(){return this[rr].getFieldOfView()}getMinimumFieldOfView(){return this[rr].options.minimumFieldOfView}getMaximumFieldOfView(){return this[rr].options.maximumFieldOfView}getIdealAspect(){return this[Xo].idealAspect}jumpCameraToGoal(){this[Sr]=!0,this.requestUpdate(Sr,!1)}resetInteractionPrompt(){this[_r]=0,this[vr]=1/0,this[Er]=!1,this[fr]=this.interactionPrompt===ji&&this.cameraControls}zoom(e){const t=new WheelEvent("wheel",{deltaY:-30*e});this[Wo].dispatchEvent(t)}connectedCallback(){super.connectedCallback(),this[rr].addEventListener("user-interaction",this[pr]),this[rr].addEventListener("pointer-change-start",this[mr]),this[rr].addEventListener("pointer-change-end",this[mr])}disconnectedCallback(){super.disconnectedCallback(),this[rr].removeEventListener("user-interaction",this[pr]),this[rr].removeEventListener("pointer-change-start",this[mr]),this[rr].removeEventListener("pointer-change-end",this[mr])}updated(e){super.updated(e);const t=this[rr],r=this[Xo];if(e.has("cameraControls")&&(this.cameraControls?(t.enableInteraction(),this.interactionPrompt===ji&&(this[fr]=!0)):(t.disableInteraction(),this[cr]()),this[Wo].setAttribute("aria-label",this[Qo])),e.has("disableZoom")&&(t.disableZoom=this.disableZoom),e.has("disablePan")&&(t.enablePan=!this.disablePan),e.has("disableTap")&&(t.enableTap=!this.disableTap),(e.has("interactionPrompt")||e.has("cameraControls")||e.has("src"))&&(this.interactionPrompt===ji&&this.cameraControls&&!this[Er]?this[fr]=!0:this[cr]()),e.has("interactionPromptStyle")&&(this[or].style.opacity=this.interactionPromptStyle==Yi?"1":"0"),e.has("touchAction")){const e=this.touchAction;t.applyOptions({touchAction:e}),t.updateTouchActionStyle()}e.has("orbitSensitivity")&&(t.orbitSensitivity=this.orbitSensitivity),e.has("zoomSensitivity")&&(t.zoomSensitivity=this.zoomSensitivity),e.has("panSensitivity")&&(t.panSensitivity=this.panSensitivity),e.has("interpolationDecay")&&(t.setDamperDecayTime(this.interpolationDecay),r.setTargetDamperDecayTime(this.interpolationDecay)),e.has("a11y")&&this[ur](),!0===this[Sr]&&Promise.resolve().then((()=>{t.jumpToGoal(),r.jumpToGoal(),this[gr](),this[Sr]=!1}))}async updateFraming(){const e=this[Xo],t=e.adjustedFoV(e.framedFoVDeg);await e.updateFraming();const r=e.adjustedFoV(e.framedFoVDeg),s=this[rr].getFieldOfView()/t;this[rr].setFieldOfView(r*s),this[Tr]=!0,this.requestUpdate("maxFieldOfView"),this.requestUpdate("fieldOfView"),this.requestUpdate("minCameraOrbit"),this.requestUpdate("maxCameraOrbit"),this.requestUpdate("cameraOrbit"),await this.updateComplete}interact(e,t,r){const s=this[Wo],o=this[lr];if("1"===o[0].style.opacity)return void Vi.warn("interact() failed because an existing interaction is running.");const l=new Array;l.push({x:timeline(t.x),y:timeline(t.y)});const c=[{x:l[0].x(0),y:l[0].y(0)}];null!=r&&(l.push({x:timeline(r.x),y:timeline(r.y)}),c.push({x:l[1].x(0),y:l[1].y(0)}));let A=performance.now();const{width:d,height:h}=this[Xo],p=this.getBoundingClientRect(),dispatchTouches=e=>{for(const[t,r]of c.entries()){const{style:l}=o[t];l.transform=`translateX(${d*r.x}px) translateY(${h*r.y}px)`,"pointerdown"===e?l.opacity="1":"pointerup"===e&&(l.opacity="0");const c={pointerId:t-5678,pointerType:"touch",target:s,clientX:d*r.x+p.x,clientY:h*r.y+p.y,altKey:!0};s.dispatchEvent(new PointerEvent(e,c))}},moveTouches=()=>{const t=this[Cr];if(t!==Nr.AUTOMATIC||!s.isConnected){for(const e of this[lr])e.style.opacity="0";return dispatchTouches("pointercancel"),this.dispatchEvent(new CustomEvent("interact-stopped",{detail:{source:t}})),void document.removeEventListener("visibilitychange",onVisibilityChange)}const r=Math.min(1,(performance.now()-A)/e);for(const[e,t]of c.entries())t.x=l[e].x(r),t.y=l[e].y(r);dispatchTouches("pointermove"),r<1?requestAnimationFrame(moveTouches):(dispatchTouches("pointerup"),this.dispatchEvent(new CustomEvent("interact-stopped",{detail:{source:Nr.AUTOMATIC}})),document.removeEventListener("visibilitychange",onVisibilityChange))},onVisibilityChange=()=>{let e=0;"hidden"===document.visibilityState?e=performance.now()-A:A=performance.now()-e};document.addEventListener("visibilitychange",onVisibilityChange),dispatchTouches("pointerdown"),this[Cr]=Nr.AUTOMATIC,requestAnimationFrame(moveTouches)}[(t=sr,r=or,s=lr,l=ar,c=_r,A=vr,d=Er,h=fr,p=Cr,g=rr,m=Ir,f=Sr,E=xr,_=Tr,C=dr,Mr)](e){const t=this[rr],r=this[Xo];r.framedFoVDeg=180*e[0]/Math.PI,t.changeSource=Nr.NONE,t.setFieldOfView(r.adjustedFoV(r.framedFoVDeg)),this[pr]()}[yr](e){const t=this[rr];if(this[Tr]){const{theta:t,phi:r}=this.getCameraOrbit();e[0]=t,e[1]=r,this[Tr]=!1}t.changeSource=Nr.NONE,t.setOrbit(e[0],e[1],e[2]),this[pr]()}[br](e){this[rr].applyOptions({minimumAzimuthalAngle:e[0],minimumPolarAngle:e[1],minimumRadius:e[2]}),this.jumpCameraToGoal()}[Br](e){this[rr].applyOptions({maximumAzimuthalAngle:e[0],maximumPolarAngle:e[1],maximumRadius:e[2]}),this[hr](e[2]),this.jumpCameraToGoal()}[Rr](e){this[rr].applyOptions({minimumFieldOfView:180*e[0]/Math.PI}),this.jumpCameraToGoal()}[Lr](e){const t=this[Xo].adjustedFoV(180*e[0]/Math.PI);this[rr].applyOptions({maximumFieldOfView:t}),this.jumpCameraToGoal()}[wr](e){const[t,r,s]=e;this[$o].arRenderer.isPresenting||this[Xo].setTarget(t,r,s),this[rr].changeSource=Nr.NONE,this[$o].arRenderer.updateTarget(),this[pr]()}[jo](e,t){if(super[jo](e,t),this[$o].isPresenting||!this[tl]())return;const r=this[rr],s=this[Xo],o=performance.now();if(this[fr]&&this.loaded&&o>this[ko]+this.interactionPromptThreshold&&(this[fr]=!1,this[vr]=o,this[sr].classList.add("visible")),isFinite(this[vr])&&this.interactionPromptStyle===Ji){const e=(o-this[vr])/5e3%1,t=zi(e),l=Wi(e);if(this[or].style.opacity=`${l}`,t!==this[_r]){const e=t*s.width*.05,o=(t-this[_r])*Math.PI/16;this[or].style.transform=`translateX(${e}px)`,r.changeSource=Nr.AUTOMATIC,r.adjustOrbit(o,0,0),this[_r]=t}}const l=r.update(e,t),c=s.updateTarget(t);(l||c)&&this[gr]()}[cr](){this[fr]=!1,this[sr].classList.remove("visible"),this[vr]=1/0}[hr](e){const t=Math.max(this[Xo].farRadius(),e),r=Math.abs(2*t);this[rr].updateNearFar(0,r)}[Ar](){const{theta:e,phi:t}=this[rr].getCameraSpherical(this[Ir]),r=(4+Math.floor((e%ir+nr)/er))%4,s=Math.floor(t/tr),o=`${Ki[s]}${Xi[r]}`,l=o;l in this[dr]?this[Go](this[dr][l]):this[Go](`View from stage ${o}`)}get[Qo](){let e=". Use mouse, touch or arrow keys to move.";return"interaction-prompt"in this[dr]&&(e=`. ${this[dr]["interaction-prompt"]}`),super[Qo].replace(/\.$/,"")+(this.cameraControls?e:"")}async[Jo](e){const t=this[rr],r=this[Xo],s=r.adjustedFoV(r.framedFoVDeg);super[Jo](e);const o=r.adjustedFoV(r.framedFoVDeg)/s,l=t.getFieldOfView()*(isFinite(o)?o:1);t.updateAspect(this[Xo].aspect),this.requestUpdate("maxFieldOfView",this.maxFieldOfView),await this.updateComplete,this[rr].setFieldOfView(l),this.jumpCameraToGoal()}[Yo](){super[Yo](),this[xr]?this[Tr]=!0:this[xr]=!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()}[(I=pr,S=gr,x=mr,ur)](){if("string"==typeof this.a11y)if(this.a11y.startsWith("{"))try{this[dr]=JSON.parse(this.a11y)}catch(e){Vi.warn("Error parsing a11y JSON:",e)}else this.a11y.length>0?Vi.warn("Error not supported format, should be a JSON string:",this.a11y):this[dr]={};else"object"==typeof this.a11y&&null!=this.a11y?this[dr]=Object.assign({},this.a11y):this[dr]={};this[Wo].setAttribute("aria-label",this[Qo])}}return controls_decorate([n({type:Boolean,attribute:"camera-controls"})],ControlsModelViewerElement.prototype,"cameraControls",void 0),controls_decorate([style({intrinsics:Zi,observeEffects:!0,updateHandler:yr}),n({type:String,attribute:"camera-orbit",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"cameraOrbit",void 0),controls_decorate([style({intrinsics:cameraTargetIntrinsics,observeEffects:!0,updateHandler:wr}),n({type:String,attribute:"camera-target",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"cameraTarget",void 0),controls_decorate([style({intrinsics:fieldOfViewIntrinsics,observeEffects:!0,updateHandler:Mr}),n({type:String,attribute:"field-of-view",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"fieldOfView",void 0),controls_decorate([style({intrinsics:minCameraOrbitIntrinsics,updateHandler:br}),n({type:String,attribute:"min-camera-orbit",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"minCameraOrbit",void 0),controls_decorate([style({intrinsics:maxCameraOrbitIntrinsics,updateHandler:Br}),n({type:String,attribute:"max-camera-orbit",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"maxCameraOrbit",void 0),controls_decorate([style({intrinsics:minFieldOfViewIntrinsics,updateHandler:Rr}),n({type:String,attribute:"min-field-of-view",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"minFieldOfView",void 0),controls_decorate([style({intrinsics:fieldOfViewIntrinsics,updateHandler:Lr}),n({type:String,attribute:"max-field-of-view",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"maxFieldOfView",void 0),controls_decorate([n({type:Number,attribute:"interaction-prompt-threshold"})],ControlsModelViewerElement.prototype,"interactionPromptThreshold",void 0),controls_decorate([n({type:String,attribute:"interaction-prompt"})],ControlsModelViewerElement.prototype,"interactionPrompt",void 0),controls_decorate([n({type:String,attribute:"interaction-prompt-style"})],ControlsModelViewerElement.prototype,"interactionPromptStyle",void 0),controls_decorate([n({type:Number,attribute:"orbit-sensitivity"})],ControlsModelViewerElement.prototype,"orbitSensitivity",void 0),controls_decorate([n({type:Number,attribute:"zoom-sensitivity"})],ControlsModelViewerElement.prototype,"zoomSensitivity",void 0),controls_decorate([n({type:Number,attribute:"pan-sensitivity"})],ControlsModelViewerElement.prototype,"panSensitivity",void 0),controls_decorate([n({type:String,attribute:"touch-action"})],ControlsModelViewerElement.prototype,"touchAction",void 0),controls_decorate([n({type:Boolean,attribute:"disable-zoom"})],ControlsModelViewerElement.prototype,"disableZoom",void 0),controls_decorate([n({type:Boolean,attribute:"disable-pan"})],ControlsModelViewerElement.prototype,"disablePan",void 0),controls_decorate([n({type:Boolean,attribute:"disable-tap"})],ControlsModelViewerElement.prototype,"disableTap",void 0),controls_decorate([n({type:Number,attribute:"interpolation-decay"})],ControlsModelViewerElement.prototype,"interpolationDecay",void 0),controls_decorate([n()],ControlsModelViewerElement.prototype,"a11y",void 0),ControlsModelViewerElement})((e=>{var t,r,s,o,l,c,A,d,h,p;class ARModelViewerElement extends e{constructor(){super(...arguments),this.ar=!1,this.arScale="auto",this.arPlacement="floor",this.arModes="webxr scene-viewer quick-look",this.iosSrc=null,this.xrEnvironment=!1,this[t]=!1,this[r]=this.shadowRoot.querySelector(".ar-button"),this[s]=document.createElement("a"),this[o]=new Set,this[l]=Il,this[c]=!1,this[A]=e=>{e.preventDefault(),this.activateAR()},this[d]=({status:e})=>{e!==Gr&&this[$o].arRenderer.presentedScene!==this[Xo]||(this.setAttribute("ar-status",e),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:e}})),e===Gr?this.removeAttribute("ar-tracking"):e===kr&&this.setAttribute("ar-tracking",zr))},this[h]=({status:e})=>{this.setAttribute("ar-tracking",e),this.dispatchEvent(new CustomEvent("ar-tracking",{detail:{status:e}}))},this[p]=e=>{"_apple_ar_quicklook_button_tapped"==e.data&&this.dispatchEvent(new CustomEvent("quick-look-button-tapped"))}}get canActivateAR(){return this[wl]!==Il}connectedCallback(){super.connectedCallback(),this[$o].arRenderer.addEventListener("status",this[Dl]),this.setAttribute("ar-status",Gr),this[$o].arRenderer.addEventListener("tracking",this[Ul]),this[Bl].addEventListener("message",this[Pl])}disconnectedCallback(){super.disconnectedCallback(),this[$o].arRenderer.removeEventListener("status",this[Dl]),this[$o].arRenderer.removeEventListener("tracking",this[Ul]),this[Bl].removeEventListener("message",this[Pl])}update(e){super.update(e),e.has("arScale")&&(this[Xo].canScale="fixed"!==this.arScale),e.has("arPlacement")&&(this[Xo].updateShadow(),this[Ko]()),e.has("arModes")&&(this[bl]=fl(this.arModes)),(e.has("ar")||e.has("arModes")||e.has("src")||e.has("iosSrc"))&&this[Fl]()}async activateAR(){switch(this[wl]){case vl:await this[yl]();break;case Cl:await this[xl]();break;case _l:this[Tl]();break;default:hl.warn("No AR Mode can be activated. This is probably due to missing configuration or device capabilities")}}async[(t=Ml,r=Sl,s=Bl,o=bl,l=wl,c=Rl,A=Ll,d=Dl,h=Ul,p=Pl,Fl)](){var e;let t=Il;if(this.ar){if(null!=this.src)for(const r of this[bl]){if("webxr"===r&&ue&&!pl&&await this[$o].arRenderer.supportsPresentation()){t=Cl;break}if("scene-viewer"===r&&!gl&&(fe||navigator.userAgentData&&navigator.userAgentData.getHighEntropyValues&&(null===(e=(await navigator.userAgentData.getHighEntropyValues(["formFactor"])).formFactor)||void 0===e?void 0:e.includes("XR")))){t=_l;break}if("quick-look"===r&&ve){t=vl;break}}t===Il&&null!=this.iosSrc&&ve&&(t=vl)}if(t!==Il)this[Sl].classList.add("enabled"),this[Sl].addEventListener("click",this[Ll]);else if(this[Sl].classList.contains("enabled")){this[Sl].removeEventListener("click",this[Ll]),this[Sl].classList.remove("enabled");const e=Vr;this.setAttribute("ar-status",e),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:e}}))}this[wl]=t}async[xl](){hl.log("Attempting to present in AR with WebXR..."),await this[Ql]();try{this[Sl].removeEventListener("click",this[Ll]);const{arRenderer:e}=this[$o];e.placeOnWall="wall"===this.arPlacement,await e.present(this[Xo],this.xrEnvironment)}catch(e){hl.warn("Error while trying to present in AR with WebXR"),hl.error(e),await this[$o].arRenderer.stopPresenting(),pl=!0,hl.warn("Falling back to next ar-mode"),await this[Fl](),this.activateAR()}finally{this[Fl]()}}async[Ql](){this.loaded||(this[Rl]=!0,this[Ho](),await((e,t,r=null)=>new Promise((s=>{e.addEventListener(t,(function handler(o){r&&!r(o)||(s(o),e.removeEventListener(t,handler))}))})))(this,"load"),this[Rl]=!1)}[nl](){return super[nl]()||this[Rl]}[Tl](){const e=self.location.toString(),t=new URL(e),r=new URL(this.src,e);r.hash&&(r.hash="");const s=new URLSearchParams(r.search);if(t.hash=ml,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 t=new URL(s.get("sound"),e);s.set("sound",t.toString())}if(s.has("link")){const t=new URL(s.get("link"),e);s.set("link",t.toString())}const o=`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(t.toString())};end;`;self.addEventListener("hashchange",(()=>{self.location.hash===ml&&(gl=!0,self.history.back(),hl.warn("Error while trying to present in AR with Scene Viewer"),hl.warn("Falling back to next ar-mode"),this[Fl]())}),{once:!0}),this[Bl].setAttribute("href",o),hl.log("Attempting to present in AR with Scene Viewer..."),this[Bl].click()}async[yl](){const e=!this.iosSrc;this[Sl].classList.remove("enabled");const t=e?await this.prepareUSDZ():this.iosSrc,r=new URL(t,self.location.toString());if(e){const e=self.location.toString(),t=new URL(e),s=new URL(this.src,t);s.hash&&(r.hash=s.hash)}"fixed"===this.arScale&&(r.hash&&(r.hash+="&"),r.hash+="allowsContentScaling=0");const s=this[Bl];s.setAttribute("rel","ar");const o=document.createElement("img");s.appendChild(o),s.setAttribute("href",r.toString()),e&&s.setAttribute("download","model.usdz"),s.style.display="none",s.isConnected||this.shadowRoot.appendChild(s),hl.log("Attempting to present in AR with Quick Look..."),s.click(),s.removeChild(o),e&&URL.revokeObjectURL(t),this[Sl].classList.add("enabled")}async prepareUSDZ(){const e=this[Zo].beginActivity("usdz-conversion");await this[Ql]();const{model:t,shadow:r,target:s}=this[Xo];if(null==t)return"";let o=!1;null!=r&&(o=r.visible,r.visible=!1),e(.2);const l=new ul.USDZExporter;s.remove(t),t.position.copy(s.position),t.updateWorldMatrix(!1,!0);const c=await l.parse(t);t.position.set(0,0,0),s.add(t);const A=new Blob([c],{type:"model/vnd.usdz+zip"}),d=URL.createObjectURL(A);return e(1),null!=r&&(r.visible=o),d}}return ar_decorate([n({type:Boolean,attribute:"ar"})],ARModelViewerElement.prototype,"ar",void 0),ar_decorate([n({type:String,attribute:"ar-scale"})],ARModelViewerElement.prototype,"arScale",void 0),ar_decorate([n({type:String,attribute:"ar-placement"})],ARModelViewerElement.prototype,"arPlacement",void 0),ar_decorate([n({type:String,attribute:"ar-modes"})],ARModelViewerElement.prototype,"arModes",void 0),ar_decorate([n({type:String,attribute:"ios-src"})],ARModelViewerElement.prototype,"iosSrc",void 0),ar_decorate([n({type:Boolean,attribute:"xr-environment"})],ARModelViewerElement.prototype,"xrEnvironment",void 0),ARModelViewerElement})((e=>{var t,r,s,l,c,A,d,h;class LoadingModelViewerElement extends e{constructor(...e){super(...e),this.poster=null,this.reveal=Nl,this.loading=Ol,this[t]=!1,this[r]=!1,this[s]=this.shadowRoot.querySelector(".slot.poster"),this[l]=this.shadowRoot.querySelector("#default-poster"),this[c]=this.shadowRoot.querySelector("#default-progress-bar > .bar"),this[A]=this[Vl].getAttribute("aria-label"),this[d]=((e,t)=>{let r=null;const throttled=(...s)=>{null==r&&(e(...s),r=self.setTimeout((()=>r=null),t))};return throttled.flush=()=>{null!=r&&(self.clearTimeout(r),r=null)},throttled})((e=>{const t=this[kl].parentNode;requestAnimationFrame((()=>{this[kl].style.transform=`scaleX(${e})`,0===e&&(t.removeChild(this[kl]),t.appendChild(this[kl])),this[kl].classList.toggle("hide",1===e)}))}),100),this[h]=e=>{const t=e.detail.totalProgress,r=e.detail.reason;1===t&&(this[Xl].flush(),this.loaded&&(this[zl]||this.reveal===Nl)&&this[Wl]()),this[Xl](t),this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:t,reason:r}}))};const o=self.ModelViewerElement||{},p=o.dracoDecoderLocation||"https://www.gstatic.com/draco/versioned/decoders/1.5.6/";CachingGLTFLoader.setDRACODecoderLocation(p);const g=o.ktx2TranscoderLocation||"https://www.gstatic.com/basis-universal/versioned/2021-04-15-ba1c3e4/";CachingGLTFLoader.setKTX2TranscoderLocation(g),o.meshoptDecoderLocation&&CachingGLTFLoader.setMeshoptDecoderLocation(o.meshoptDecoderLocation);const m=o.lottieLoaderLocation||"https://cdn.jsdelivr.net/npm/three@0.149.0/examples/jsm/loaders/LottieLoader.js";Renderer.singleton.textureUtils.lottieLoaderUrl=m}static set dracoDecoderLocation(e){CachingGLTFLoader.setDRACODecoderLocation(e)}static get dracoDecoderLocation(){return CachingGLTFLoader.getDRACODecoderLocation()}static set ktx2TranscoderLocation(e){CachingGLTFLoader.setKTX2TranscoderLocation(e)}static get ktx2TranscoderLocation(){return CachingGLTFLoader.getKTX2TranscoderLocation()}static set meshoptDecoderLocation(e){CachingGLTFLoader.setMeshoptDecoderLocation(e)}static get meshoptDecoderLocation(){return CachingGLTFLoader.getMeshoptDecoderLocation()}static set lottieLoaderLocation(e){Renderer.singleton.textureUtils.lottieLoaderUrl=e}static get lottieLoaderLocation(){return Renderer.singleton.textureUtils.lottieLoaderUrl}static mapURLs(e){Renderer.singleton.loader[bt].manager.setURLModifier(e)}dismissPoster(){this.loaded?this[Wl]():(this[zl]=!0,this[Ho]())}showPoster(){const e=this[Hl];if(e.classList.contains("show"))return;e.classList.add("show"),this[Wo].classList.remove("show");const t=this[Vl];t.removeAttribute("tabindex"),t.removeAttribute("aria-hidden");const r=this.modelIsVisible;this[ql]=!1,this[Fo](r)}getDimensions(){return toVector3D(this[Xo].size)}getBoundingBoxCenter(){return toVector3D(this[Xo].boundingBox.getCenter(new o.Pa4))}connectedCallback(){super.connectedCallback(),this.loaded||this.showPoster(),this[Zo].addEventListener("progress",this[jl])}disconnectedCallback(){super.disconnectedCallback(),this[Zo].removeEventListener("progress",this[jl])}async updated(e){super.updated(e),e.has("poster")&&null!=this.poster&&(this[Vl].style.backgroundImage=`url(${this.poster})`),e.has("alt")&&this[Vl].setAttribute("aria-label",this[No]),(e.has("reveal")||e.has("loading"))&&this[Ho]()}[(t=ql,r=zl,s=Hl,l=Vl,c=kl,A=Kl,d=Xl,h=jl,nl)](){return!!this.src&&(this[zl]||this.loading===Gl||this.reveal===Nl&&this[Po])}[Wl](){this[zl]=!1;const e=this[Hl];if(!e.classList.contains("show"))return;e.classList.remove("show"),this[Wo].classList.add("show");const t=this.modelIsVisible;this[ql]=!0,this[Fo](t);const r=this.getRootNode();r&&r.activeElement===this&&this[Wo].focus();const s=this[Vl];s.setAttribute("aria-hidden","true"),s.tabIndex=-1,this.dispatchEvent(new CustomEvent("poster-dismissed"))}[tl](){return super[tl]()&&this[ql]}}return loading_decorate([n({type:String})],LoadingModelViewerElement.prototype,"poster",void 0),loading_decorate([n({type:String})],LoadingModelViewerElement.prototype,"reveal",void 0),loading_decorate([n({type:String})],LoadingModelViewerElement.prototype,"loading",void 0),LoadingModelViewerElement})((e=>{var t;class AnimationModelViewerElement extends e{constructor(...e){super(e),this.autoplay=!1,this.animationName=void 0,this.animationCrossfadeDuration=300,this[t]=!0,this[Xo].subscribeMixerEvent("loop",(e=>{const t=e.action._loopCount;this.dispatchEvent(new CustomEvent("loop",{detail:{count:t}}))})),this[Xo].subscribeMixerEvent("finished",(()=>{this[rl]=!0,this.dispatchEvent(new CustomEvent("finished"))}))}get availableAnimations(){return this.loaded?this[Xo].animationNames:[]}get duration(){return this[Xo].duration}get paused(){return this[rl]}get currentTime(){return this[Xo].animationTime}set currentTime(e){this[Xo].animationTime=e,this[Ko]()}get timeScale(){return this[Xo].animationTimeScale}set timeScale(e){this[Xo].animationTimeScale=e}pause(){this[rl]||(this[rl]=!0,this.dispatchEvent(new CustomEvent("pause")))}play(e){this.availableAnimations.length>0&&(this[rl]=!1,this[il](e),this.dispatchEvent(new CustomEvent("play")))}[(t=rl,Yo)](){super[Yo](),this[rl]=!0,null!=this.animationName&&this[il](),this.autoplay&&this.play()}[jo](e,t){super[jo](e,t),this[rl]||!this[tl]()&&!this[$o].isPresenting||(this[Xo].updateAnimation(t/1e3),this[Ko]())}updated(e){super.updated(e),e.has("autoplay")&&this.autoplay&&this.play(),e.has("animationName")&&this[il]()}[il](e=al){var t;const r=null!==(t=e.repetitions)&&void 0!==t?t:1/0,s=e.pingpong?o.uEv:1===r?o.jAl:o.YKA;this[Xo].playAnimation(this.animationName,this.animationCrossfadeDuration/1e3,s,r),this[rl]&&(this[Xo].updateAnimation(0),this[Ko]())}}return animation_decorate([n({type:Boolean})],AnimationModelViewerElement.prototype,"autoplay",void 0),animation_decorate([n({type:String,attribute:"animation-name"})],AnimationModelViewerElement.prototype,"animationName",void 0),animation_decorate([n({type:Number,attribute:"animation-crossfade-duration"})],AnimationModelViewerElement.prototype,"animationCrossfadeDuration",void 0),AnimationModelViewerElement})(ModelViewerElementBase))))))));customElements.define("model-viewer",nc)}}]);