PageSourceSearch

https://bbcc.ai/build/assets/model-viewer-BNdxy5m2.js

js bbcc.ai collected 2026-10-05 12:12:20 UTC 1,072,335 bytes, 5,368 lines download raw bytes

vendor: 4,344 bytes, lines 1-9
1var BE=Object.defineProperty;var DE=(r,e,t)=>e in r?BE(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var Ot=(r,e,t)=>DE(r,typeof e!="symbol"?e+"":e,t);/**
2 * @license
3 * Copyright 2019 Google LLC
4 * SPDX-License-Identifier: BSD-3-Clause
5 */const rl=globalThis,vf=rl.ShadowRoot&&(rl.ShadyCSS===void 0||rl.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,H0=Symbol(),pp=new WeakMap;let LE=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==H0)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(vf&&e===void 0){const n=t!==void 0&&t.length===1;n&&(e=pp.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&pp.set(t,e))}return e}toString(){return this.cssText}};const PE=r=>new LE(typeof r=="string"?r:r+"",void 0,H0),FE=(r,e)=>{if(vf)r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const n=document.createElement("style"),i=rl.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)}},Ap=vf?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return PE(t)})(r):r;/**
6 * @license
7 * Copyright 2017 Google LLC
8 * SPDX-License-Identifier: BSD-3-Clause
9 */const{is:NE,defineProperty:UE,getOwnPropertyDescriptor:OE,getOwnPropertyNames:kE,getOwnPropertySymbols:QE,getPrototypeOf:GE}=Object,gs=globalThis,gp=gs.trustedTypes,HE=gp?gp.emptyScript:"",fh=gs.reactiveElementPolyfillSupport,Ao=(r,e)=>r,xl={toAttribute(r,e){switch(e){case Boolean:r=r?HE:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},yf=(r,e)=>!NE(r,e),mp={attribute:!0,type:String,converter:xl,reflect:!1,useDefault:!1,hasChanged:yf};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),gs.litPropertyMetadata??(gs.litPropertyMetadata=new WeakMap);let os=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=mp){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),i=this.getPropertyDescriptor(e,n,t);i!==void 0&&UE(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){const{get:i,set:s}=OE(this.prototype,e)??{get(){return this[t]},set(a){this[t]=a}};return{get:i,set(a){const o=i==null?void 0:i.call(this);s==null||s.call(this,a),this.requestUpdate(e,o,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??mp}static _$Ei(){if(this.hasOwnProperty(Ao("elementProperties")))return;const e=GE(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(Ao("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(Ao("properties"))){const t=this.properties,n=[...kE(t),...QE(t)];for(const i of n)this.createProperty(i,t[i])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[n,i]of t)this.elementProperties.set(n,i)}this._$Eh=new Map;for(const[t,n]of this.elementProperties){const i=this._$Eu(t,n);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const i of n)t.unshift(Ap(i))}else e!==void 0&&t.push(Ap(e));return t}static _$Eu(e,t){const n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),(e=this.constructor.l)==null||e.forEach(t=>t(this))}addController(e){var t;(this._$EO??(this._$EO=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&((t=e.hostConnected)==null||t.call(e))}
vendor: 4,122 bytes, lines 9-14
9removeController(e){var t;(t=this._$EO)==null||t.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return FE(e,this.constructor.elementStyles),e}connectedCallback(){var e;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$EO)==null||e.forEach(t=>{var n;return(n=t.hostConnected)==null?void 0:n.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$EO)==null||e.forEach(t=>{var n;return(n=t.hostDisconnected)==null?void 0:n.call(t)})}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){var s;const n=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,n);if(i!==void 0&&n.reflect===!0){const a=(((s=n.converter)==null?void 0:s.toAttribute)!==void 0?n.converter:xl).toAttribute(t,n.type);this._$Em=e,a==null?this.removeAttribute(i):this.setAttribute(i,a),this._$Em=null}}_$AK(e,t){var s,a;const n=this.constructor,i=n._$Eh.get(e);if(i!==void 0&&this._$Em!==i){const o=n.getPropertyOptions(i),c=typeof o.converter=="function"?{fromAttribute:o.converter}:((s=o.converter)==null?void 0:s.fromAttribute)!==void 0?o.converter:xl;this._$Em=i;const l=c.fromAttribute(t,o.type);this[i]=l??((a=this._$Ej)==null?void 0:a.get(i))??l,this._$Em=null}}requestUpdate(e,t,n,i=!1,s){var a;if(e!==void 0){const o=this.constructor;if(i===!1&&(s=this[e]),n??(n=o.getPropertyOptions(e)),!((n.hasChanged??yf)(s,t)||n.useDefault&&n.reflect&&s===((a=this._$Ej)==null?void 0:a.get(e))&&!this.hasAttribute(o._$Eu(e,n))))return;this.C(e,t,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:i,wrapped:s},a){n&&!(this._$Ej??(this._$Ej=new Map)).has(e)&&(this._$Ej.set(e,a??t??this[e]),s!==!0||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),i===!0&&this._$Em!==e&&(this._$Eq??(this._$Eq=new Set)).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var n;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[s,a]of this._$Ep)this[s]=a;this._$Ep=void 0}const i=this.constructor.elementProperties;if(i.size>0)for(const[s,a]of i){const{wrapped:o}=a,c=this[s];o!==!0||this._$AL.has(s)||c===void 0||this.C(s,void 0,a,c)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),(n=this._$EO)==null||n.forEach(i=>{var s;return(s=i.hostUpdate)==null?void 0:s.call(i)}),this.update(t)):this._$EM()}catch(i){throw e=!1,this._$EM(),i}e&&this._$AE(t)}willUpdate(e){}_$AE(e){var t;(t=this._$EO)==null||t.forEach(n=>{var i;return(i=n.hostUpdated)==null?void 0:i.call(n)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&(this._$Eq=this._$Eq.forEach(t=>this._$ET(t,this[t]))),this._$EM()}updated(e){}firstUpdated(e){}};os.elementStyles=[],os.shadowRootOptions={mode:"open"},os[Ao("elementProperties")]=new Map,os[Ao("finalized")]=new Map,fh==null||fh({ReactiveElement:os}),(gs.reactiveElementVersions??(gs.reactiveElementVersions=[])).push("2.1.2");/**
10 * @license
11 * Copyright 2017 Google LLC
12 * SPDX-License-Identifier: BSD-3-Clause
13 */const go=globalThis,bp=r=>r,El=go.trustedTypes,xp=El?El.createPolicy("lit-html",{createHTML:r=>r}):void 0,z0="$lit$",cs=`lit$${Math.random().toFixed(9).slice(2)}$`,V0="?"+cs,zE=`<${V0}>`,nr=document,Mo=()=>nr.createComment(""),Io=r=>r===null||typeof r!="object"&&typeof r!="function",Sf=Array.isArray,VE=r=>Sf(r)||typeof(r==null?void 0:r[Symbol.iterator])=="function",ph=`[ 	
14\f\r]`,Ma=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ep=/-->/g,_p=/>/g,ys=RegExp(`>
vendor: 4,901 bytes, lines 14-15
14|${ph}(?:([^\\s"'>=/]+)(${ph}*=${ph}*(?:[^ 	
15\f\r"'\`<>=]|("|')|))|$)`,"g"),vp=/'/g,yp=/"/g,W0=/^(?:script|style|textarea|title)$/i,WE=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),Kl=WE(1),ta=Symbol.for("lit-noChange"),Jt=Symbol.for("lit-nothing"),Sp=new WeakMap,js=nr.createTreeWalker(nr,129);function q0(r,e){if(!Sf(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return xp!==void 0?xp.createHTML(e):e}const qE=(r,e)=>{const t=r.length-1,n=[];let i,s=e===2?"<svg>":e===3?"<math>":"",a=Ma;for(let o=0;o<t;o++){const c=r[o];let l,h,u=-1,d=0;for(;d<c.length&&(a.lastIndex=d,h=a.exec(c),h!==null);)d=a.lastIndex,a===Ma?h[1]==="!--"?a=Ep:h[1]!==void 0?a=_p:h[2]!==void 0?(W0.test(h[2])&&(i=RegExp("</"+h[2],"g")),a=ys):h[3]!==void 0&&(a=ys):a===ys?h[0]===">"?(a=i??Ma,u=-1):h[1]===void 0?u=-2:(u=a.lastIndex-h[2].length,l=h[1],a=h[3]===void 0?ys:h[3]==='"'?yp:vp):a===yp||a===vp?a=ys:a===Ep||a===_p?a=Ma:(a=ys,i=void 0);const f=a===ys&&r[o+1].startsWith("/>")?" ":"";s+=a===Ma?c+zE:u>=0?(n.push(l),c.slice(0,u)+z0+c.slice(u)+cs+f):c+cs+(u===-2?o:f)}return[q0(r,s+(r[t]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]};let vd=class j0{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let s=0,a=0;const o=e.length-1,c=this.parts,[l,h]=qE(e,t);if(this.el=j0.createElement(l,n),js.currentNode=this.el.content,t===2||t===3){const u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(i=js.nextNode())!==null&&c.length<o;){if(i.nodeType===1){if(i.hasAttributes())for(const u of i.getAttributeNames())if(u.endsWith(z0)){const d=h[a++],f=i.getAttribute(u).split(cs),p=/([.?@])?(.*)/.exec(d);c.push({type:1,index:s,name:p[2],strings:f,ctor:p[1]==="."?XE:p[1]==="?"?KE:p[1]==="@"?$E:$l}),i.removeAttribute(u)}else u.startsWith(cs)&&(c.push({type:6,index:s}),i.removeAttribute(u));if(W0.test(i.tagName)){const u=i.textContent.split(cs),d=u.length-1;if(d>0){i.textContent=El?El.emptyScript:"";for(let f=0;f<d;f++)i.append(u[f],Mo()),js.nextNode(),c.push({type:2,index:++s});i.append(u[d],Mo())}}}else if(i.nodeType===8)if(i.data===V0)c.push({type:2,index:s});else{let u=-1;for(;(u=i.data.indexOf(cs,u+1))!==-1;)c.push({type:7,index:s}),u+=cs.length-1}s++}}static createElement(e,t){const n=nr.createElement("template");return n.innerHTML=e,n}};function na(r,e,t=r,n){var a,o;if(e===ta)return e;let i=n!==void 0?(a=t._$Co)==null?void 0:a[n]:t._$Cl;const s=Io(e)?void 0:e._$litDirective$;return(i==null?void 0:i.constructor)!==s&&((o=i==null?void 0:i._$AO)==null||o.call(i,!1),s===void 0?i=void 0:(i=new s(r),i._$AT(r,t,n)),n!==void 0?(t._$Co??(t._$Co=[]))[n]=i:t._$Cl=i),i!==void 0&&(e=na(r,i._$AS(r,e.values),i,n)),e}class jE{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){const{el:{content:t},parts:n}=this._$AD,i=((e==null?void 0:e.creationScope)??nr).importNode(t,!0);js.currentNode=i;let s=js.nextNode(),a=0,o=0,c=n[0];for(;c!==void 0;){if(a===c.index){let l;c.type===2?l=new Vo(s,s.nextSibling,this,e):c.type===1?l=new c.ctor(s,c.name,c.strings,this,e):c.type===6&&(l=new YE(s,this,e)),this._$AV.push(l),c=n[++o]}a!==(c==null?void 0:c.index)&&(s=js.nextNode(),a++)}return js.currentNode=nr,i}p(e){let t=0;for(const n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}}class Vo{get _$AU(){var e;return((e=this._$AM)==null?void 0:e._$AU)??this._$Cv}constructor(e,t,n,i){this.type=2,this._$AH=Jt,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=i,this._$Cv=(i==null?void 0:i.isConnected)??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(e==null?void 0:e.nodeType)===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=na(this,e,t),Io(e)?e===Jt||e==null||e===""?(this._$AH!==Jt&&this._$AR(),this._$AH=Jt):e!==this._$AH&&e!==ta&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):VE(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==Jt&&Io(this._$AH)?this._$AA.nextSibling.data=e:this.T(nr.createTextNode(e)),this._$AH=e}$(e){var s;const{values:t,_$litType$:n}=e,i=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=vd.createElement(q0(n.h,n.h[0]),this.options)),n);if(((s=this._$AH)==null?void 0:s._$AD)===i)this._$AH.p(t);else{const a=new jE(i,this),o=a.u(this.options);a.p(t),this.T(o),this._$AH=a}}_$AC(e){let t=Sp.get(e.strings);return t===void 0&&Sp.set(e.strings,t=new vd(e)),t}k(e){Sf(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let n,i=0;for(const s of e)i===t.length?t.push(n=new Vo(this.O(Mo()),this.O(Mo()),this,this.options)):n=t[i],n._$AI(s),i++;i<t.length&&(this._$AR(n&&n._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){var n;
vendor: 1,262 bytes, line 15
15for((n=this._$AP)==null?void 0:n.call(this,!1,!0,t);e!==this._$AB;){const i=bp(e).nextSibling;bp(e).remove(),e=i}}setConnected(e){var t;this._$AM===void 0&&(this._$Cv=e,(t=this._$AP)==null||t.call(this,e))}}class $l{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,i,s){this.type=1,this._$AH=Jt,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=s,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=Jt}_$AI(e,t=this,n,i){const s=this.strings;let a=!1;if(s===void 0)e=na(this,e,t,0),a=!Io(e)||e!==this._$AH&&e!==ta,a&&(this._$AH=e);else{const o=e;let c,l;for(e=s[0],c=0;c<s.length-1;c++)l=na(this,o[n+c],t,c),l===ta&&(l=this._$AH[c]),a||(a=!Io(l)||l!==this._$AH[c]),l===Jt?e=Jt:e!==Jt&&(e+=(l??"")+s[c+1]),this._$AH[c]=l}a&&!i&&this.j(e)}j(e){e===Jt?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}let XE=class extends $l{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Jt?void 0:e}};class KE extends $l{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==Jt)}}class $E extends $l{constructor(e,t,n,i,s){super(e,t,n,i,s),this.type=5}
15_$AI(e,t=this){if((e=na(this,e,t,0)??Jt)===ta)return;const n=this._$AH,i=e===Jt&&n!==Jt||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,s=e!==Jt&&(n===Jt||i);i&&this.element.removeEventListener(this.name,this,n),s&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t;typeof this._$AH=="function"?this._$AH.call(((t=this.options)==null?void 0:t.host)??this.element,e):this._$AH.handleEvent(e)}}class YE{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){na(this,e)}}const Ah=go.litHtmlPolyfillSupport;Ah==null||Ah(vd,Vo),(go.litHtmlVersions??(go.litHtmlVersions=[])).push("3.3.3");const X0=(r,e,t)=>{const n=(t==null?void 0:t.renderBefore)??e;let i=n._$litPart$;if(i===void 0){const s=(t==null?void 0:t.renderBefore)??null;n._$litPart$=i=new Vo(e.insertBefore(Mo(),s),s,void 0,t??{})}return i._$AI(r),i};/**
16 * @license
17 * Copyright 2017 Google LLC
18 * SPDX-License-Identifier: BSD-3-Clause
19 */const Ks=globalThis;let al=class extends os{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;const e=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=e.firstChild),e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=X0(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)==null||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)==null||e.setConnected(!1)}render(){return ta}};var G0;al._$litElement$=!0,al.finalized=!0,(G0=Ks.litElementHydrateSupport)==null||G0.call(Ks,{LitElement:al});const gh=Ks.litElementPolyfillSupport;gh==null||gh({LitElement:al});(Ks.litElementVersions??(Ks.litElementVersions=[])).push("4.2.2");/**
20 * @license
21 * Copyright 2017 Google LLC
22 * SPDX-License-Identifier: BSD-3-Clause
23 */const JE={attribute:!0,type:String,converter:xl,reflect:!1,hasChanged:yf},ZE=(r=JE,e,t)=>{const{kind:n,metadata:i}=t;let s=globalThis.litPropertyMetadata.get(i);if(s===void 0&&globalThis.litPropertyMetadata.set(i,s=new Map),n==="setter"&&((r=Object.create(r)).wrapped=!0),s.set(t.name,r),n==="accessor"){const{name:a}=t;return{set(o){const c=e.get.call(this);e.set.call(this,o),this.requestUpdate(a,c,r,!0,o)},init(o){return o!==void 0&&this.C(a,void 0,r,o),o}}}if(n==="setter"){const{name:a}=t;return function(o){const c=this[a];e.call(this,o),this.requestUpdate(a,c,r,!0,o)}}throw Error("Unsupported decorator location: "+n)};function Re(r){return(e,t)=>typeof t=="object"?ZE(r,e,t):((n,i,s)=>{const a=i.hasOwnProperty(s);return i.constructor.createProperty(s,n),a?Object.getOwnPropertyDescriptor(i,s):void 0})(r,e,t)}/* @license
24 * Copyright 2026 Google LLC. All Rights Reserved.
25 * Licensed under the Apache License, Version 2.0 (the 'License');
26 * you may not use this file except in compliance with the License.
27 * You may obtain a copy of the License at
28 *
29 *     http://www.apache.org/licenses/LICENSE-2.0
30 *
31 * Unless required by applicable law or agreed to in writing, software
32 * distributed under the License is distributed on an 'AS IS' BASIS,
33 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34 * See the License for the specific language governing permissions and
35 * limitations under the License.
36 */var Wo=function(r,e,t,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var o=r.length-1;o>=0;o--)(a=r[o])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s};class ba extends os{constructor(){super(...arguments),this.src=null,this.offset=null,this.orientation=null,this.scale=null,this.background=!1}static get is(){return"extra-model"}updated(e){if(super.updated(e),e.has("src")||e.has("offset")||e.has("orientation")||e.has("scale")||e.has("background")){const t=e.has("src");this.dispatchEvent(new CustomEvent("extra-model-changed",{bubbles:!0,composed:!0,detail:{srcChanged:t,src:this.src,offset:this.offset,orientation:this.orientation,scale:this.scale,background:this.background}}))}}}Wo([Re({type:String})],ba.prototype,"src",void 0);Wo([Re({type:String})],ba.prototype,"offset",void 0);Wo([Re({type:String})],ba.prototype,"orientation",void 0);Wo([Re({type:String})],ba.prototype,"scale",void 0);Wo([Re({type:Boolean})],ba.prototype,"background",void 0);customElements.define("extra-model",ba);/**
37 * @license
38 * Copyright 2010-2026 Three.js Authors
39 * SPDX-License-Identifier: MIT
40 */const Yl="183",e_=0,Cp=1,t_=2,ol=1,n_=2,ro=3,ti=0,on=1,qt=2,Zn=0,$s=1,yd=2,Mp=3,Ip=4,i_=5,Ws=100,s_=101,r_=102,a_=103,o_=104,c_=200,l_=201,h_=202,u_=203,Sd=204,Cd=205,d_=206,f_=207,p_=208,A_=209,g_=210,m_=211,b_=212,x_=213,E_=214,Md=0,Id=1,wd=2,ia=3,Td=4,Rd=5,Bd=6,Dd=7,K0=0,__=1,v_=2,Qn=0,Cf=1,Mf=2,If=3,wf=4,$0=5,Tf=6,sa=7,wp="attached",y_="detached",ra=300,bs=301,aa=302,cl=303,mh=304,Jl=306,ni=1e3,Dt=1001,ir=1002,St=1003,xa=1004,us=1005,qe=1006,Ys=1007,yn=1008,Tp=1008,Le=1009,Rf=1010,Bf=1011,wo=1012,Zl=1013,ii=1014,Nt=1015,yt=1016,Df=1017,Lf=1018,To=1020,eh=35902,th=35899,Y0=1021,Ro=1022,Tt=1023,qi=1026,Xs=1027,ds=1028,Pf=1029,Jn=1030,Ff=1031,Nf=1033,Kr=33776,Js=33777,ll=33778,Zs=33779,_l=35840,Ld=35841,oa=35842,Bo=35843,vl=36196,Do=37492,Lo=37496,yl=37488,Sl=37489,Cl=37490,Ml=37491,er=37808,Pd=37809,Fd=37810,Nd=37811,$r=37812,Ud=37813,Od=37814,kd=37815,Qd=37816,Gd=37817,Hd=37818,zd=37819,Vd=37820,Wd=37821,ca=36492,qd=36494,Il=36495,wl=36283,Tl=36284,Rl=36285,Bl=36286,Po=2200,Yr=2201,Dl=2202,la=2300,ha=2301,bh=2302,Rp=2303,Vr=2400,Wr=2401,Ll=2402,Uf=2500,S_=2501,C_=0,J0=1,jd=2,M_=3200,Z0=0,I_=1,Un="",mt="srgb",Ct="srgb-linear",Pl="linear",ft="srgb",ur=7680,Bp=519,w_=512,T_=513,R_=514,Of=515,B_=516,D_=517,kf=518,L_=519,Xd=35044,Dp="300 es",Ai=2e3,Fo=2001;function P_(r){for(let e=r.length-1;e>=0;--e)if(r[e]>=65535)return!0;return!1}function F_(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}function No(r){return document.createElementNS("http://www.w3.org/1999/xhtml",r)}function N_(){const r=No("canvas");return r.style.display="block",r}const Lp={};function Fl(...r){const e="THREE."+r.shift();console.log(e,...r)}function eb(r){const e=r[0];if(typeof e=="string"&&e.startsWith("TSL:")){const t=r[1];t&&t.isStackTrace?r[0]+=" "+t.getLocation():r[1]='Stack trace not available. Enable "THREE.Node.captureStackTrace" to capture stack traces.'}return r}function Ie(...r){r=eb(r);const e="THREE."+r.shift();{const t=r[0];t&&t.isStackTrace?console.warn(t.getError(e)):console.warn(e,...r)}}function Pe(...r){r=eb(r);const e="THREE."+r.shift();{const t=r[0];t&&t.isStackTrace?console.error(t.getError(e)):console.error(e,...r)}}function Nl(...r){const e=r.join(" ");e in Lp||(Lp[e]=!0,Ie(...r))}function U_(r,e,t){return new Promise(function(n,i){function s(){switch(r.clientWaitSync(e,r.SYNC_FLUSH_COMMANDS_BIT,0)){case r.WAIT_FAILED:i();break;case r.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:n()}}setTimeout(s,t)})}const O_={[Md]:Id,[wd]:Bd,[Td]:Dd,[ia]:Rd,[Id]:Md,[Bd]:wd,[Dd]:Td,[Rd]:ia};class si{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){const n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){const n=this._listeners;if(n===void 0)return;const i=n[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){const t=this._listeners;if(t===void 0)return;const n=t[e.type];if(n!==void 0){e.target=this;const i=n.slice(0);for(let s=0,a=i.length;s<a;s++)i[s].call(this,e);e.target=null}}}const hn=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","5
405","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let Pp=1234567;const mo=Math.PI/180,ua=180/Math.PI;function Gn(){const r=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,n=Math.random()*4294967295|0;return(hn[r&255]+hn[r>>8&255]+hn[r>>16&255]+hn[r>>24&255]+"-"+hn[e&255]+hn[e>>8&255]+"-"+hn[e>>16&15|64]+hn[e>>24&255]+"-"+hn[t&63|128]+hn[t>>8&255]+"-"+hn[t>>16&255]+hn[t>>24&255]+hn[n&255]+hn[n>>8&255]+hn[n>>16&255]+hn[n>>24&255]).toLowerCase()}function We(r,e,t){return Math.max(e,Math.min(t,r))}function Qf(r,e){return(r%e+e)%e}function k_(r,e,t,n,i){return n+(r-e)*(i-n)/(t-e)}function Q_(r,e,t){return r!==e?(t-r)/(e-r):0}function bo(r,e,t){return(1-t)*r+t*e}function G_(r,e,t,n){return bo(r,e,1-Math.exp(-t*n))}function H_(r,e=1){return e-Math.abs(Qf(r,e*2)-e)}function z_(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*(3-2*r))}function V_(r,e,t){return r<=e?0:r>=t?1:(r=(r-e)/(t-e),r*r*r*(r*(r*6-15)+10))}function W_(r,e){return r+Math.floor(Math.random()*(e-r+1))}function q_(r,e){return r+Math.random()*(e-r)}function j_(r){return r*(.5-Math.random())}function X_(r){r!==void 0&&(Pp=r);let e=Pp+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function K_(r){return r*mo}function $_(r){return r*ua}function Y_(r){return(r&r-1)===0&&r!==0}function J_(r){return Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function Z_(r){return Math.pow(2,Math.floor(Math.log(r)/Math.LN2))}function ev(r,e,t,n,i){const s=Math.cos,a=Math.sin,o=s(t/2),c=a(t/2),l=s((e+n)/2),h=a((e+n)/2),u=s((e-n)/2),d=a((e-n)/2),f=s((n-e)/2),p=a((n-e)/2);switch(i){case"XYX":r.set(o*h,c*u,c*d,o*l);break;case"YZY":r.set(c*d,o*h,c*u,o*l);break;case"ZXZ":r.set(c*u,c*d,o*h,o*l);break;case"XZX":r.set(o*h,c*p,c*f,o*l);break;case"YXY":r.set(c*f,o*h,c*p,o*l);break;case"ZYZ":r.set(c*p,c*f,o*h,o*l);break;default:Ie("MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function $n(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return r/4294967295;case Uint16Array:return r/65535;case Uint8Array:return r/255;case Int32Array:return Math.max(r/2147483647,-1);case Int16Array:return Math.max(r/32767,-1);case Int8Array:return Math.max(r/127,-1);default:throw new Error("Invalid component type.")}}function pt(r,e){switch(e.constructor){case Float32Array:return r;case Uint32Array:return Math.round(r*4294967295);case Uint16Array:return Math.round(r*65535);case Uint8Array:return Math.round(r*255);case Int32Array:return Math.round(r*2147483647);case Int16Array:return Math.round(r*32767);case Int8Array:return Math.round(r*127);default:throw new Error("Invalid component type.")}}const Ul={DEG2RAD:mo,RAD2DEG:ua,generateUUID:Gn,clamp:We,euclideanModulo:Qf,mapLinear:k_,inverseLerp:Q_,lerp:bo,damp:G_,pingpong:H_,smoothstep:z_,smootherstep:V_,randInt:W_,randFloat:q_,randFloatSpread:j_,seededRandom:X_,degToRad:K_,radToDeg:$_,isPowerOfTwo:Y_,ceilPowerOfTwo:J_,floorPowerOfTwo:Z_,setQuaternionFromProperEuler:ev,normalize:pt,denormalize:$n};class pe{constructor(e=0,t=0){pe.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}
vendor: 39,113 bytes, line 40
40sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=We(this.x,e.x,t.x),this.y=We(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=We(this.x,e,t),this.y=We(this.y,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(We(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(We(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const n=Math.cos(t),i=Math.sin(t),s=this.x-e.x,a=this.y-e.y;return this.x=s*n-a*i+e.x,this.y=s*i+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class An{constructor(e=0,t=0,n=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=i}static slerpFlat(e,t,n,i,s,a,o){let c=n[i+0],l=n[i+1],h=n[i+2],u=n[i+3],d=s[a+0],f=s[a+1],p=s[a+2],m=s[a+3];if(u!==m||c!==d||l!==f||h!==p){let A=c*d+l*f+h*p+u*m;A<0&&(d=-d,f=-f,p=-p,m=-m,A=-A);let g=1-o;if(A<.9995){const b=Math.acos(A),x=Math.sin(b);g=Math.sin(g*b)/x,o=Math.sin(o*b)/x,c=c*g+d*o,l=l*g+f*o,h=h*g+p*o,u=u*g+m*o}else{c=c*g+d*o,l=l*g+f*o,h=h*g+p*o,u=u*g+m*o;const b=1/Math.sqrt(c*c+l*l+h*h+u*u);c*=b,l*=b,h*=b,u*=b}}e[t]=c,e[t+1]=l,e[t+2]=h,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,i,s,a){const o=n[i],c=n[i+1],l=n[i+2],h=n[i+3],u=s[a],d=s[a+1],f=s[a+2],p=s[a+3];return e[t]=o*p+h*u+c*f-l*d,e[t+1]=c*p+h*d+l*u-o*f,e[t+2]=l*p+h*f+o*d-c*u,e[t+3]=h*p-o*u-c*d-l*f,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const n=e._x,i=e._y,s=e._z,a=e._order,o=Math.cos,c=Math.sin,l=o(n/2),h=o(i/2),u=o(s/2),d=c(n/2),f=c(i/2),p=c(s/2);switch(a){case"XYZ":this._x=d*h*u+l*f*p,this._y=l*f*u-d*h*p,this._z=l*h*p+d*f*u,this._w=l*h*u-d*f*p;break;case"YXZ":this._x=d*h*u+l*f*p,this._y=l*f*u-d*h*p,this._z=l*h*p-d*f*u,this._w=l*h*u+d*f*p;break;case"ZXY":this._x=d*h*u-l*f*p,this._y=l*f*u+d*h*p,this._z=l*h*p+d*f*u,this._w=l*h*u-d*f*p;break;case"ZYX":this._x=d*h*u-l*f*p,this._y=l*f*u+d*h*p,this._z=l*h*p-d*f*u,this._w=l*h*u+d*f*p;break;case"YZX":this._x=d*h*u+l*f*p,this._y=l*f*u+d*h*p,this._z=l*h*p-d*f*u,this._w=l*h*u-d*f*p;break;case"XZY":this._x=d*h*u-l*f*p,this._y=l*f*u-d*h*p,this._z=l*h*p+d*f*u,this._w=l*h*u+d*f*p;break;default:Ie("Quaternion: .setFromEuler() encountered an unknown order: "+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,n=t[0],i=t[4],s=t[8],a=t[1],o=t[5],c=t[9],l=t[2],h=t[6],u=t[10],d=n+o+u;if(d>0){const f=.5/Math.sqrt(d+1);this._w=.25/f,this._x=(h-c)*f,this._y=(s-l)*f,this._z=(a-i)*f}else if(n>o&&n>u){const f=2*Math.sqrt(1+n-o-u);this._w=(h-c)/f,this._x=.25*f,this._y=(i+a)/f,this._z=(s+l)/f}else if(o>u){const f=2*Math.sqrt(1+o-n-u);this._w=(s-l)/f,this._x=(i+a)/f,this._y=.25*f,this._z=(c+h)/f}else{const f=2*Math.sqrt(1+u-n-o);this._w=(a-i)/f,this._x=(s+l)/f,this._y=(c+h)/f,this._z=.25*f}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<1e-8?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(We(this.dot(e),-1,1)))}rotateTowards(e,t){const n=this.angleTo(e);if(n===0)return this;const i=Math.min(1,t/n);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const n=e._x,i=e._y,s=e._z,a=e._w,o=t._x,c=t._y,l=t._z,h=t._w;return this._x=n*h+a*o+i*l-s*c,this._y=i*h+a*c+s*o-n*l,this._z=s*h+a*l+n*c-i*o,this._w=a*h-n*o-i*c-s*l,this._onChangeCallback(),this}slerp(e,t){let n=e._x,i=e._y,s=e._z,a=e._w,o=this.dot(e);o<0&&(n=-n,i=-i,s=-s,a=-a,o=-o);let c=1-t;if(o<.9995){const l=Math.acos(o),h=Math.sin(l);c=Math.sin(c*l)/h,t=Math.sin(t*l)/h,this._x=this._x*c+n*t,this._y=this._y*c+i*t,this._z=this._z*c+s*t,this._w=this._w*c+a*t,this._onChangeCallback()}else this._x=this._x*c+n*t,this._y=this._y*c+i*t,this._z=this._z*c+s*t,this._w=this._w*c+a*t,this.normalize();return this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),i=Math.sqrt(1-n),s=Math.sqrt(n);return this.set(i*Math.sin(e),i*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class R{constructor(e=0,t=0,n=0){R.prototype.isVector3=!0,this.x=e,this.y=t,this.z=n}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Fp.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Fp.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*n+s[6]*i,this.y=s[1]*t+s[4]*n+s[7]*i,this.z=s[2]*t+s[5]*n+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=e.elements,a=1/(s[3]*t+s[7]*n+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*n+s[8]*i+s[12])*a,this.y=(s[1]*t+s[5]*n+s[9]*i+s[13])*a,this.z=(s[2]*t+s[6]*n+s[10]*i+s[14])*a,this}applyQuaternion(e){const t=this.x,n=this.y,i=this.z,s=e.x,a=e.y,o=e.z,c=e.w,l=2*(a*i-o*n),h=2*(o*t-s*i),u=2*(s*n-a*t);return this.x=t+c*l+a*u-o*h,this.y=n+c*h+o*l-s*u,this.z=i+c*u+s*h-a*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,n=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*n+s[8]*i,this.y=s[1]*t+s[5]*n+s[9]*i,this.z=s[2]*t+s[6]*n+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=We(this.x,e.x,t.x),this.y=We(this.y,e.y,t.y),this.z=We(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=We(this.x,e,t),this.y=We(this.y,e,t),this.z=We(this.z,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(We(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const n=e.x,i=e.y,s=e.z,a=t.x,o=t.y,c=t.z;return this.x=i*c-s*o,this.y=s*a-n*c,this.z=n*o-i*a,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return xh.copy(this).projectOnVector(e),this.sub(xh)}reflect(e){return this.sub(xh.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const n=this.dot(e)/t;return Math.acos(We(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){const i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const xh=new R,Fp=new An;class Qe{constructor(e,t,n,i,s,a,o,c,l){Qe.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,a,o,c,l)}set(e,t,n,i,s,a,o,c,l){const h=this.elements;return h[0]=e,h[1]=i,h[2]=o,h[3]=t,h[4]=s,h[5]=c,h[6]=n,h[7]=a,h[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,a=n[0],o=n[3],c=n[6],l=n[1],h=n[4],u=n[7],d=n[2],f=n[5],p=n[8],m=i[0],A=i[3],g=i[6],b=i[1],x=i[4],_=i[7],v=i[2],C=i[5],I=i[8];return s[0]=a*m+o*b+c*v,s[3]=a*A+o*x+c*C,s[6]=a*g+o*_+c*I,s[1]=l*m+h*b+u*v,s[4]=l*A+h*x+u*C,s[7]=l*g+h*_+u*I,s[2]=d*m+f*b+p*v,s[5]=d*A+f*x+p*C,s[8]=d*g+f*_+p*I,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],c=e[6],l=e[7],h=e[8];return t*a*h-t*o*l-n*s*h+n*o*c+i*s*l-i*a*c}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],c=e[6],l=e[7],h=e[8],u=h*a-o*l,d=o*c-h*s,f=l*s-a*c,p=t*u+n*d+i*f;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);const m=1/p;return e[0]=u*m,e[1]=(i*l-h*n)*m,e[2]=(o*n-i*a)*m,e[3]=d*m,e[4]=(h*t-i*c)*m,e[5]=(i*s-o*t)*m,e[6]=f*m,e[7]=(n*c-l*t)*m,e[8]=(a*t-n*s)*m,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,i,s,a,o){const c=Math.cos(s),l=Math.sin(s);return this.set(n*c,n*l,-n*(c*a+l*o)+a+e,-i*l,i*c,-i*(-l*a+c*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(Eh.makeScale(e,t)),this}rotate(e){return this.premultiply(Eh.makeRotation(-e)),this}translate(e,t){return this.premultiply(Eh.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const Eh=new Qe,Np=new Qe().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Up=new Qe().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function tv(){const r={enabled:!0,workingColorSpace:Ct,spaces:{},convert:function(i,s,a){return this.enabled===!1||s===a||!s||!a||(this.spaces[s].transfer===ft&&(i.r=Vi(i.r),i.g=Vi(i.g),i.b=Vi(i.b)),this.spaces[s].primaries!==this.spaces[a].primaries&&(i.applyMatrix3(this.spaces[s].toXYZ),i.applyMatrix3(this.spaces[a].fromXYZ)),this.spaces[a].transfer===ft&&(i.r=Jr(i.r),i.g=Jr(i.g),i.b=Jr(i.b))),i},workingToColorSpace:function(i,s){return this.convert(i,this.workingColorSpace,s)},colorSpaceToWorking:function(i,s){return this.convert(i,s,this.workingColorSpace)},getPrimaries:function(i){return this.spaces[i].primaries},getTransfer:function(i){return i===Un?Pl:this.spaces[i].transfer},getToneMappingMode:function(i){return this.spaces[i].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(i,s=this.workingColorSpace){return i.fromArray(this.spaces[s].luminanceCoefficients)},define:function(i){Object.assign(this.spaces,i)},_getMatrix:function(i,s,a){return i.copy(this.spaces[s].toXYZ).multiply(this.spaces[a].fromXYZ)},_getDrawingBufferColorSpace:function(i){return this.spaces[i].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(i=this.workingColorSpace){return this.spaces[i].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(i,s){return Nl("ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),r.workingToColorSpace(i,s)},toWorkingColorSpace:function(i,s){return Nl("ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),r.colorSpaceToWorking(i,s)}},e=[.64,.33,.3,.6,.15,.06],t=[.2126,.7152,.0722],n=[.3127,.329];return r.define({[Ct]:{primaries:e,whitePoint:n,transfer:Pl,toXYZ:Np,fromXYZ:Up,luminanceCoefficients:t,workingColorSpaceConfig:{unpackColorSpace:mt},outputColorSpaceConfig:{drawingBufferColorSpace:mt}},[mt]:{primaries:e,whitePoint:n,transfer:ft,toXYZ:Np,fromXYZ:Up,luminanceCoefficients:t,outputColorSpaceConfig:{drawingBufferColorSpace:mt}}}),r}const tt=tv();function Vi(r){return r<.04045?r*.0773993808:Math.pow(r*.9478672986+.0521327014,2.4)}function Jr(r){return r<.0031308?r*12.92:1.055*Math.pow(r,.41666)-.055}let dr;class tb{static getDataURL(e,t="image/png"){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{dr===void 0&&(dr=No("canvas")),dr.width=e.width,dr.height=e.height;const i=dr.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),n=dr}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=No("canvas");t.width=e.width,t.height=e.height;const n=t.getContext("2d");n.drawImage(e,0,0,e.width,e.height);const i=n.getImageData(0,0,e.width,e.height),s=i.data;for(let a=0;a<s.length;a++)s[a]=Vi(s[a]/255)*255;return n.putImageData(i,0,0),t}else if(e.data){const t=e.data.slice(0);for(let n=0;n<t.length;n++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[n]=Math.floor(Vi(t[n]/255)*255):t[n]=Vi(t[n]);return{data:t,width:e.width,height:e.height}}else return Ie("ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}}let nv=0;class nh{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:nv++}),this.uuid=Gn(),this.data=e,this.dataReady=!0,this.version=0}getSize(e){const t=this.data;return typeof HTMLVideoElement<"u"&&t instanceof HTMLVideoElement?e.set(t.videoWidth,t.videoHeight,0):typeof VideoFrame<"u"&&t instanceof VideoFrame?e.set(t.displayHeight,t.displayWidth,0):t!==null?e.set(t.width,t.height,t.depth||0):e.set(0,0,0),e}set needsUpdate(e){e===!0&&this.version++}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];const n={uuid:this.uuid,url:""},i=this.data;if(i!==null){let s;if(Array.isArray(i)){s=[];for(let a=0,o=i.length;a<o;a++)i[a].isDataTexture?s.push(_h(i[a].image)):s.push(_h(i[a]))}else s=_h(i);n.url=s}return t||(e.images[this.uuid]=n),n}}function _h(r){return typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&r instanceof ImageBitmap?tb.getDataURL(r):r.data?{data:Array.from(r.data),width:r.width,height:r.height,type:r.data.constructor.name}:(Ie("Texture: Unable to serialize Texture."),{})}let iv=0;const vh=new R;let Rt=class hl extends si{constructor(e=hl.DEFAULT_IMAGE,t=hl.DEFAULT_MAPPING,n=Dt,i=Dt,s=qe,a=yn,o=Tt,c=Le,l=hl.DEFAULT_ANISOTROPY,h=Un){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:iv++}),this.uuid=Gn(),this.name="",this.source=new nh(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=n,this.wrapT=i,this.magFilter=s,this.minFilter=a,this.anisotropy=l,this.format=o,this.internalFormat=null,this.type=c,this.offset=new pe(0,0),this.repeat=new pe(1,1),this.center=new pe(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Qe,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=h,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(e&&e.depth&&e.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(vh).x}get height(){return this.source.getSize(vh).y}get depth(){return this.source.getSize(vh).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(const t in e){const n=e[t];if(n===void 0){Ie(`Texture.setValues(): parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){Ie(`Texture.setValues(): property '${t}' does not exist.`);continue}i&&n&&i.isVector2&&n.isVector2||i&&n&&i.isVector3&&n.isVector3||i&&n&&i.isMatrix3&&n.isMatrix3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];const n={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==ra)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case ni:e.x=e.x-Math.floor(e.x);break;case Dt:e.x=e.x<0?0:1;break;case ir:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case ni:e.y=e.y-Math.floor(e.y);break;case Dt:e.y=e.y<0?0:1;break;case ir:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}};Rt.DEFAULT_IMAGE=null;Rt.DEFAULT_MAPPING=ra;Rt.DEFAULT_ANISOTROPY=1;class It{constructor(e=0,t=0,n=0,i=1){It.prototype.isVector4=!0,this.x=e,this.y=t,this.z=n,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,n=this.y,i=this.z,s=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*s,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*s,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*s,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*s,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,i,s;const c=e.elements,l=c[0],h=c[4],u=c[8],d=c[1],f=c[5],p=c[9],m=c[2],A=c[6],g=c[10];if(Math.abs(h-d)<.01&&Math.abs(u-m)<.01&&Math.abs(p-A)<.01){if(Math.abs(h+d)<.1&&Math.abs(u+m)<.1&&Math.abs(p+A)<.1&&Math.abs(l+f+g-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const x=(l+1)/2,_=(f+1)/2,v=(g+1)/2,C=(h+d)/4,I=(u+m)/4,E=(p+A)/4;return x>_&&x>v?x<.01?(n=0,i=.707106781,s=.707106781):(n=Math.sqrt(x),i=C/n,s=I/n):_>v?_<.01?(n=.707106781,i=0,s=.707106781):(i=Math.sqrt(_),n=C/i,s=E/i):v<.01?(n=.707106781,i=.707106781,s=0):(s=Math.sqrt(v),n=I/s,i=E/s),this.set(n,i,s,t),this}let b=Math.sqrt((A-p)*(A-p)+(u-m)*(u-m)+(d-h)*(d-h));return Math.abs(b)<.001&&(b=1),this.x=(A-p)/b,this.y=(u-m)/b,this.z=(d-h)/b,this.w=Math.acos((l+f+g-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=We(this.x,e.x,t.x),this.y=We(this.y,e.y,t.y),this.z=We(this.z,e.z,t.z),this.w=We(this.w,e.w,t.w),this}clampScalar(e,t){return this.x=We(this.x,e,t),this.y=We(this.y,e,t),this.z=We(this.z,e,t),this.w=We(this.w,e,t),this}clampLength(e,t){const n=this.length();return this.divideScalar(n||1).multiplyScalar(We(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this.w=e.w+(t.w-e.w)*n,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class sv extends si{constructor(e=1,t=1,n={}){super(),n=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:qe,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},n),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=n.depth,this.scissor=new It(0,0,e,t),this.scissorTest=!1,this.viewport=new It(0,0,e,t),this.textures=[];const i={width:e,height:t,depth:n.depth},s=new Rt(i),a=n.count;for(let o=0;o<a;o++)this.textures[o]=s.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(n),this.depthBuffer=n.depthBuffer,this.stencilBuffer=n.stencilBuffer,this.resolveDepthBuffer=n.resolveDepthBuffer,this.resolveStencilBuffer=n.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=n.depthTexture,this.samples=n.samples,this.multiview=n.multiview}_setTextureOptions(e={}){const t={minFilter:qe,generateMipmaps:!1,flipY:!1,internalFormat:null};e.mapping!==void 0&&(t.mapping=e.mapping),e.wrapS!==void 0&&(t.wrapS=e.wrapS),e.wrapT!==void 0&&(t.wrapT=e.wrapT),e.wrapR!==void 0&&(t.wrapR=e.wrapR),e.magFilter!==void 0&&(t.magFilter=e.magFilter),e.minFilter!==void 0&&(t.minFilter=e.minFilter),e.format!==void 0&&(t.format=e.format),e.type!==void 0&&(t.type=e.type),e.anisotropy!==void 0&&(t.anisotropy=e.anisotropy),e.colorSpace!==void 0&&(t.colorSpace=e.colorSpace),e.flipY!==void 0&&(t.flipY=e.flipY),e.generateMipmaps!==void 0&&(t.generateMipmaps=e.generateMipmaps),e.internalFormat!==void 0&&(t.internalFormat=e.internalFormat);for(let n=0;n<this.textures.length;n++)this.textures[n].setValues(t)}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}set depthTexture(e){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),e!==null&&(e.renderTarget=this),this._depthTexture=e}get depthTexture(){return this._depthTexture}setSize(e,t,n=1){if(this.width!==e||this.height!==t||this.depth!==n){this.width=e,this.height=t,this.depth=n;for(let i=0,s=this.textures.length;i<s;i++)this.textures[i].image.width=e,this.textures[i].image.height=t,this.textures[i].image.depth=n,this.textures[i].isData3DTexture!==!0&&(this.textures[i].isArrayTexture=this.textures[i].image.depth>1);this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t<n;t++){this.textures[t]=e.textures[t].clone(),this.textures[t].isRenderTargetTexture=!0,this.textures[t].renderTarget=this;const i=Object.assign({},e.textures[t].image);this.textures[t].source=new nh(i)}return this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.resolveDepthBuffer=e.resolveDepthBuffer,this.resolveStencilBuffer=e.resolveStencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class Sn extends sv{constructor(e=1,t=1,n={}){super(e,t,n),this.isWebGLRenderTarget=!0}}class nb extends Rt{constructor(e=null,t=1,n=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=St,this.minFilter=St,this.wrapR=Dt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class ib extends Rt{constructor(e=null,t=1,n=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:n,depth:i},this.magFilter=St,this.minFilter=St,this.wrapR=Dt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class Oe{constructor(e,t,n,i,s,a,o,c,l,h,u,d,f,p,m,A){Oe.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,n,i,s,a,o,c,l,h,u,d,f,p,m,A)}set(e,t,n,i,s,a,o,c,l,h,u,d,f,p,m,A){const g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=i,g[1]=s,g[5]=a,g[9]=o,g[13]=c,g[2]=l,g[6]=h,g[10]=u,g[14]=d,g[3]=f,g[7]=p,g[11]=m,g[15]=A,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Oe().fromArray(this.elements)}copy(e){const t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){const t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return this.determinant()===0?(e.set(1,0,0),t.set(0,1,0),n.set(0,0,1),this):(e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this)}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){if(e.determinant()===0)return this.identity();const t=this.elements,n=e.elements,i=1/fr.setFromMatrixColumn(e,0).length(),s=1/fr.setFromMatrixColumn(e,1).length(),a=1/fr.setFromMatrixColumn(e,2).length();return t[0]=n[0]*i,t[1]=n[1]*i,t[2]=n[2]*i,t[3]=0,t[4]=n[4]*s,t[5]=n[5]*s,t[6]=n[6]*s,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,n=e.x,i=e.y,s=e.z,a=Math.cos(n),o=Math.sin(n),c=Math.cos(i),l=Math.sin(i),h=Math.cos(s),u=Math.sin(s);if(e.order==="XYZ"){const d=a*h,f=a*u,p=o*h,m=o*u;t[0]=c*h,t[4]=-c*u,t[8]=l,t[1]=f+p*l,t[5]=d-m*l,t[9]=-o*c,t[2]=m-d*l,t[6]=p+f*l,t[10]=a*c}else if(e.order==="YXZ"){const d=c*h,f=c*u,p=l*h,m=l*u;t[0]=d+m*o,t[4]=p*o-f,t[8]=a*l,t[1]=a*u,t[5]=a*h,t[9]=-o,t[2]=f*o-p,t[6]=m+d*o,t[10]=a*c}else if(e.order==="ZXY"){const d=c*h,f=c*u,p=l*h,m=l*u;t[0]=d-m*o,t[4]=-a*u,t[8]=p+f*o,t[1]=f+p*o,t[5]=a*h,t[9]=m-d*o,t[2]=-a*l,t[6]=o,t[10]=a*c}else if(e.order==="ZYX"){const d=a*h,f=a*u,p=o*h,m=o*u;t[0]=c*h,t[4]=p*l-f,t[8]=d*l+m,t[1]=c*u,t[5]=m*l+d,t[9]=f*l-p,t[2]=-l,t[6]=o*c,t[10]=a*c}else if(e.order==="YZX"){const d=a*c,f=a*l,p=o*c,m=o*l;t[0]=c*h,t[4]=m-d*u,t[8]=p*u+f,t[1]=u,t[5]=a*h,t[9]=-o*h,t[2]=-l*h,t[6]=f*u+p,t[10]=d-m*u}else if(e.order==="XZY"){const d=a*c,f=a*l,p=o*c,m=o*l;t[0]=c*h,t[4]=-u,t[8]=l*h,t[1]=d*u+m,t[5]=a*h,t[9]=f*u-p,t[2]=p*u-f,t[6]=o*h,t[10]=m*u+d}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(rv,e,av)}lookAt(e,t,n){const i=this.elements;return In.subVectors(e,t),In.lengthSq()===0&&(In.z=1),In.normalize(),$i.crossVectors(n,In),$i.lengthSq()===0&&(Math.abs(n.z)===1?In.x+=1e-4:In.z+=1e-4,In.normalize(),$i.crossVectors(n,In)),$i.normalize(),Yo.crossVectors(In,$i),i[0]=$i.x,i[4]=Yo.x,i[8]=In.x,i[1]=$i.y,i[5]=Yo.y,i[9]=In.y,i[2]=$i.z,i[6]=Yo.z,i[10]=In.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const n=e.elements,i=t.elements,s=this.elements,a=n[0],o=n[4],c=n[8],l=n[12],h=n[1],u=n[5],d=n[9],f=n[13],p=n[2],m=n[6],A=n[10],g=n[14],b=n[3],x=n[7],_=n[11],v=n[15],C=i[0],I=i[4],E=i[8],S=i[12],P=i[1],w=i[5],L=i[9],N=i[13],O=i[2],D=i[6],U=i[10],F=i[14],$=i[3],q=i[7],te=i[11],Z=i[15];
vendor: 4,293 bytes, line 40
40return s[0]=a*C+o*P+c*O+l*$,s[4]=a*I+o*w+c*D+l*q,s[8]=a*E+o*L+c*U+l*te,s[12]=a*S+o*N+c*F+l*Z,s[1]=h*C+u*P+d*O+f*$,s[5]=h*I+u*w+d*D+f*q,s[9]=h*E+u*L+d*U+f*te,s[13]=h*S+u*N+d*F+f*Z,s[2]=p*C+m*P+A*O+g*$,s[6]=p*I+m*w+A*D+g*q,s[10]=p*E+m*L+A*U+g*te,s[14]=p*S+m*N+A*F+g*Z,s[3]=b*C+x*P+_*O+v*$,s[7]=b*I+x*w+_*D+v*q,s[11]=b*E+x*L+_*U+v*te,s[15]=b*S+x*N+_*F+v*Z,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],n=e[4],i=e[8],s=e[12],a=e[1],o=e[5],c=e[9],l=e[13],h=e[2],u=e[6],d=e[10],f=e[14],p=e[3],m=e[7],A=e[11],g=e[15],b=c*f-l*d,x=o*f-l*u,_=o*d-c*u,v=a*f-l*h,C=a*d-c*h,I=a*u-o*h;return t*(m*b-A*x+g*_)-n*(p*b-A*v+g*C)+i*(p*x-m*v+g*I)-s*(p*_-m*C+A*I)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this}invert(){const e=this.elements,t=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],c=e[6],l=e[7],h=e[8],u=e[9],d=e[10],f=e[11],p=e[12],m=e[13],A=e[14],g=e[15],b=t*o-n*a,x=t*c-i*a,_=t*l-s*a,v=n*c-i*o,C=n*l-s*o,I=i*l-s*c,E=h*m-u*p,S=h*A-d*p,P=h*g-f*p,w=u*A-d*m,L=u*g-f*m,N=d*g-f*A,O=b*N-x*L+_*w+v*P-C*S+I*E;if(O===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const D=1/O;return e[0]=(o*N-c*L+l*w)*D,e[1]=(i*L-n*N-s*w)*D,e[2]=(m*I-A*C+g*v)*D,e[3]=(d*C-u*I-f*v)*D,e[4]=(c*P-a*N-l*S)*D,e[5]=(t*N-i*P+s*S)*D,e[6]=(A*_-p*I-g*x)*D,e[7]=(h*I-d*_+f*x)*D,e[8]=(a*L-o*P+l*E)*D,e[9]=(n*P-t*L-s*E)*D,e[10]=(p*C-m*_+g*b)*D,e[11]=(u*_-h*C-f*b)*D,e[12]=(o*S-a*w-c*E)*D,e[13]=(t*w-n*S+i*E)*D,e[14]=(m*x-p*v-A*b)*D,e[15]=(h*v-u*x+d*b)*D,this}scale(e){const t=this.elements,n=e.x,i=e.y,s=e.z;return t[0]*=n,t[4]*=i,t[8]*=s,t[1]*=n,t[5]*=i,t[9]*=s,t[2]*=n,t[6]*=i,t[10]*=s,t[3]*=n,t[7]*=i,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const n=Math.cos(t),i=Math.sin(t),s=1-n,a=e.x,o=e.y,c=e.z,l=s*a,h=s*o;return this.set(l*a+n,l*o-i*c,l*c+i*o,0,l*o+i*c,h*o+n,h*c-i*a,0,l*c-i*o,h*c+i*a,s*c*c+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,i,s,a){return this.set(1,n,s,0,e,1,a,0,t,i,1,0,0,0,0,1),this}compose(e,t,n){const i=this.elements,s=t._x,a=t._y,o=t._z,c=t._w,l=s+s,h=a+a,u=o+o,d=s*l,f=s*h,p=s*u,m=a*h,A=a*u,g=o*u,b=c*l,x=c*h,_=c*u,v=n.x,C=n.y,I=n.z;return i[0]=(1-(m+g))*v,i[1]=(f+_)*v,i[2]=(p-x)*v,i[3]=0,i[4]=(f-_)*C,i[5]=(1-(d+g))*C,i[6]=(A+b)*C,i[7]=0,i[8]=(p+x)*I,i[9]=(A-b)*I,i[10]=(1-(d+m))*I,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,n){const i=this.elements;e.x=i[12],e.y=i[13],e.z=i[14];const s=this.determinant();if(s===0)return n.set(1,1,1),t.identity(),this;let a=fr.set(i[0],i[1],i[2]).length();const o=fr.set(i[4],i[5],i[6]).length(),c=fr.set(i[8],i[9],i[10]).length();s<0&&(a=-a),qn.copy(this);const l=1/a,h=1/o,u=1/c;return qn.elements[0]*=l,qn.elements[1]*=l,qn.elements[2]*=l,qn.elements[4]*=h,qn.elements[5]*=h,qn.elements[6]*=h,qn.elements[8]*=u,qn.elements[9]*=u,qn.elements[10]*=u,t.setFromRotationMatrix(qn),n.x=a,n.y=o,n.z=c,this}makePerspective(e,t,n,i,s,a,o=Ai,c=!1){const l=this.elements,h=2*s/(t-e),u=2*s/(n-i),d=(t+e)/(t-e),f=(n+i)/(n-i);let p,m;if(c)p=s/(a-s),m=a*s/(a-s);else if(o===Ai)p=-(a+s)/(a-s),m=-2*a*s/(a-s);else if(o===Fo)p=-a/(a-s),m=-a*s/(a-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return l[0]=h,l[4]=0,l[8]=d,l[12]=0,l[1]=0,l[5]=u,l[9]=f,l[13]=0,l[2]=0,l[6]=0,l[10
vendor: 5,646 bytes, line 40
40]=p,l[14]=m,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,n,i,s,a,o=Ai,c=!1){const l=this.elements,h=2/(t-e),u=2/(n-i),d=-(t+e)/(t-e),f=-(n+i)/(n-i);let p,m;if(c)p=1/(a-s),m=a/(a-s);else if(o===Ai)p=-2/(a-s),m=-(a+s)/(a-s);else if(o===Fo)p=-1/(a-s),m=-s/(a-s);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return l[0]=h,l[4]=0,l[8]=0,l[12]=d,l[1]=0,l[5]=u,l[9]=0,l[13]=f,l[2]=0,l[6]=0,l[10]=p,l[14]=m,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,n=e.elements;for(let i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){const n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}}const fr=new R,qn=new Oe,rv=new R(0,0,0),av=new R(1,1,1),$i=new R,Yo=new R,In=new R,Op=new Oe,kp=new An;class Hn{constructor(e=0,t=0,n=0,i=Hn.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=n,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,i=this._order){return this._x=e,this._y=t,this._z=n,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){const i=e.elements,s=i[0],a=i[4],o=i[8],c=i[1],l=i[5],h=i[9],u=i[2],d=i[6],f=i[10];switch(t){case"XYZ":this._y=Math.asin(We(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-h,f),this._z=Math.atan2(-a,s)):(this._x=Math.atan2(d,l),this._z=0);break;case"YXZ":this._x=Math.asin(-We(h,-1,1)),Math.abs(h)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(We(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,f),this._z=Math.atan2(-a,l)):(this._y=0,this._z=Math.atan2(c,s));break;case"ZYX":this._y=Math.asin(-We(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(c,s)):(this._x=0,this._z=Math.atan2(-a,l));break;case"YZX":this._z=Math.asin(We(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-h,l),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(o,f));break;case"XZY":this._z=Math.asin(-We(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,l),this._y=Math.atan2(o,s)):(this._x=Math.atan2(-h,f),this._y=0);break;default:Ie("Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return Op.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Op,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return kp.setFromEuler(this),this.setFromQuaternion(kp,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Hn.DEFAULT_ORDER="XYZ";class Gf{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}}let ov=0;const Qp=new R,pr=new An,Si=new Oe,Jo=new R,Ia=new R,cv=new R,lv=new An,Gp=new R(1,0,0),Hp=new R(0,1,0),zp=new R(0,0,1),Vp={type:"added"},hv={type:"removed"},Ar={type:"childadded",child:null},yh={type:"childremoved",child:null};class ht extends si{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:ov++}),this.uuid=Gn(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ht.DEFAULT_UP.clone();const e=new R,t=new Hn,n=new An,i=new R(1,1,1);function s(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(s),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Oe},normalMatrix:{value:new Qe}}),this.matrix=new Oe,this.matrixWorld=new Oe,this.matrixAutoUpdate=ht.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=ht.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new Gf,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.static=!1,this.userData={},this.pivot=null}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}
vendor: 1,231 bytes, line 40
40setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return pr.setFromAxisAngle(e,t),this.quaternion.multiply(pr),this}rotateOnWorldAxis(e,t){return pr.setFromAxisAngle(e,t),this.quaternion.premultiply(pr),this}rotateX(e){return this.rotateOnAxis(Gp,e)}rotateY(e){return this.rotateOnAxis(Hp,e)}rotateZ(e){return this.rotateOnAxis(zp,e)}translateOnAxis(e,t){return Qp.copy(e).applyQuaternion(this.quaternion),this.position.add(Qp.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(Gp,e)}translateY(e){return this.translateOnAxis(Hp,e)}translateZ(e){return this.translateOnAxis(zp,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(Si.copy(this.matrixWorld).invert())}lookAt(e,t,n){e.isVector3?Jo.copy(e):Jo.set(e,t,n);const i=this.parent;this.updateWorldMatrix(!0,!1),Ia.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Si.lookAt(Ia,Jo,this.up):Si.lookAt(Jo,Ia,this.up),this.quaternion.setFromRotationMatrix(Si),i&&(Si.extractRotation(i.matrixWorld),pr.setFromRotationMatrix(Si),this.quaternion.premultiply(
vendor: 18,167 bytes, line 40
40pr.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(Pe("Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.removeFromParent(),e.parent=this,this.children.push(e),e.dispatchEvent(Vp),Ar.child=e,this.dispatchEvent(Ar),Ar.child=null):Pe("Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let n=0;n<arguments.length;n++)this.remove(arguments[n]);return this}const t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(hv),yh.child=e,this.dispatchEvent(yh),yh.child=null),this}removeFromParent(){const e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),Si.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),Si.multiply(e.parent.matrixWorld)),e.applyMatrix4(Si),e.removeFromParent(),e.parent=this,this.children.push(e),e.updateWorldMatrix(!1,!0),e.dispatchEvent(Vp),Ar.child=e,this.dispatchEvent(Ar),Ar.child=null,this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let n=0,i=this.children.length;n<i;n++){const a=this.children[n].getObjectByProperty(e,t);if(a!==void 0)return a}}getObjectsByProperty(e,t,n=[]){this[e]===t&&n.push(this);const i=this.children;for(let s=0,a=i.length;s<a;s++)i[s].getObjectsByProperty(e,t,n);return n}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ia,e,cv),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ia,lv,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}traverseAncestors(e){const t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale);const e=this.pivot;if(e!==null){const t=e.x,n=e.y,i=e.z,s=this.matrix.elements;s[12]+=t-s[0]*t-s[4]*n-s[8]*i,s[13]+=n-s[1]*t-s[5]*n-s[9]*i,s[14]+=i-s[2]*t-s[6]*n-s[10]*i}this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,e=!0);const t=this.children;for(let n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)}updateWorldMatrix(e,t){const n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),t===!0){const i=this.children;for(let s=0,a=i.length;s<a;s++)i[s].updateWorldMatrix(!1,!0)}}toJSON(e){const t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},n.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),this.static!==!1&&(i.static=this.static),Object.keys(this.userData).length>0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.pivot!==null&&(i.pivot=this.pivot.toArray()),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.morphTargetDictionary!==void 0&&(i.morphTargetDictionary=Object.assign({},this.morphTargetDictionary)),this.morphTargetInfluences!==void 0&&(i.morphTargetInfluences=this.morphTargetInfluences.slice()),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),i.instanceInfo=this._instanceInfo.map(o=>({...o})),i.availableInstanceIds=this._availableInstanceIds.slice(),i.availableGeometryIds=this._availableGeometryIds.slice(),i.nextIndexStart=this._nextIndexStart,i.nextVertexStart=this._nextVertexStart,i.geometryCount=this._geometryCount,i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.matricesTexture=this._matricesTexture.toJSON(e),i.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(i.boundingBox=this.boundingBox.toJSON()));function s(o,c){return o[c.uuid]===void 0&&(o[c.uuid]=c.toJSON(e)),c.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const c=o.shapes;if(Array.isArray(c))for(let l=0,h=c.length;l<h;l++){const u=c[l];s(e.shapes,u)}else s(e.shapes,c)}}if(this.isSkinnedMesh&&(i.bindMode=this.bindMode,i.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),i.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let c=0,l=this.material.length;c<l;c++)o.push(s(e.materials,this.material[c]));i.material=o}else i.material=s(e.materials,this.material);if(this.children.length>0){i.children=[];for(let o=0;o<this.children.length;o++)i.children.push(this.children[o].toJSON(e).object)}if(this.animations.length>0){i.animations=[];for(let o=0;o<this.animations.length;o++){const c=this.animations[o];i.animations.push(s(e.animations,c))}}if(t){const o=a(e.geometries),c=a(e.materials),l=a(e.textures),h=a(e.images),u=a(e.shapes),d=a(e.skeletons),f=a(e.animations),p=a(e.nodes);o.length>0&&(n.geometries=o),c.length>0&&(n.materials=c),l.length>0&&(n.textures=l),h.length>0&&(n.images=h),u.length>0&&(n.shapes=u),d.length>0&&(n.skeletons=d),f.length>0&&(n.animations=f),p.length>0&&(n.nodes=p)}return n.object=i,n;function a(o){const c=[];for(const l in o){const h=o[l];delete h.metadata,c.push(h)}return c}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),e.pivot!==null&&(this.pivot=e.pivot.clone()),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.static=e.static,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let n=0;n<e.children.length;n++){const i=e.children[n];this.add(i.clone())}return this}}ht.DEFAULT_UP=new R(0,1,0);ht.DEFAULT_MATRIX_AUTO_UPDATE=!0;ht.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;class fs extends ht{constructor(){super(),this.isGroup=!0,this.type="Group"}}const uv={type:"move"};class Sh{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new fs,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new fs,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new R,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new R),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new fs,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new R,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new R),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let i=null,s=null,a=null;const o=this._targetRay,c=this._grip,l=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(l&&e.hand){a=!0;for(const m of e.hand.values()){const A=t.getJointPose(m,n),g=this._getHandJoint(l,m);A!==null&&(g.matrix.fromArray(A.transform.matrix),g.matrix.decompose(g.position,g.rotation,g.scale),g.matrixWorldNeedsUpdate=!0,g.jointRadius=A.radius),g.visible=A!==null}const h=l.joints["index-finger-tip"],u=l.joints["thumb-tip"],d=h.position.distanceTo(u.position),f=.02,p=.005;l.inputState.pinching&&d>f+p?(l.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!l.inputState.pinching&&d<=f-p&&(l.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else c!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,n),s!==null&&(c.matrix.fromArray(s.transform.matrix),c.matrix.decompose(c.position,c.rotation,c.scale),c.matrixWorldNeedsUpdate=!0,s.linearVelocity?(c.hasLinearVelocity=!0,c.linearVelocity.copy(s.linearVelocity)):c.hasLinearVelocity=!1,s.angularVelocity?(c.hasAngularVelocity=!0,c.angularVelocity.copy(s.angularVelocity)):c.hasAngularVelocity=!1));o!==null&&(i=t.getPose(e.targetRaySpace,n),i===null&&s!==null&&(i=s),i!==null&&(o.matrix.fromArray(i.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,i.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(i.linearVelocity)):o.hasLinearVelocity=!1,i.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(i.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(uv)))}return o!==null&&(o.visible=i!==null),c!==null&&(c.visible=s!==null),l!==null&&(l.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const n=new fs;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}}const sb={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},Yi={h:0,s:0,l:0},Zo={h:0,s:0,l:0};function Ch(r,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?r+(e-r)*6*t:t<1/2?e:t<2/3?r+(e-r)*6*(2/3-t):r}class Me{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=mt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,tt.colorSpaceToWorking(this,t),this}setRGB(e,t,n,i=tt.workingColorSpace){return this.r=e,this.g=t,this.b=n,tt.colorSpaceToWorking(this,i),this}setHSL(e,t,n,i=tt.workingColorSpace){if(e=Qf(e,1),t=We(t,0,1),n=We(n,0,1),t===0)this.r=this.g=this.b=n;else{const s=n<=.5?n*(1+t):n+t-n*t,a=2*n-s;this.r=Ch(a,s,e+1/3),this.g=Ch(a,s,e),this.b=Ch(a,s,e-1/3)}return tt.colorSpaceToWorking(this,i),this}setStyle(e,t=mt){function n(s){s!==void 0&&parseFloat(s)<1&&Ie("Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const a=i[1],o=i[2];switch(a){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:Ie("Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],a=s.length;if(a===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(a===6)return this.setHex(parseInt(s,16),t);Ie("Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=mt){const n=sb[e.toLowerCase()];return n!==void 0?this.setHex(n,t):Ie("Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=Vi(e.r),this.g=Vi(e.g),this.b=Vi(e.b),this}copyLinearToSRGB(e){return this.r=Jr(e.r),this.g=Jr(e.g),this.b=Jr(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=mt){return tt.workingToColorSpace(un.copy(this),e),Math.round(We(un.r*255,0,255))*65536+Math.round(We(un.g*255,0,255))*256+Math.round(We(un.b*255,0,255))}getHexString(e=mt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=tt.workingColorSpace){tt.workingToColorSpace(un.copy(this),t);const n=un.r,i=un.g,s=un.b,a=Math.max(n,i,s),o=Math.min(n,i,s);let c,l;const h=(o+a)/2;if(o===a)c=0,l=0;else{const u=a-o;switch(l=h<=.5?u/(a+o):u/(2-a-o),a){case n:c=(i-s)/u+(i<s?6:0);break;case i:c=(s-n)/u+2;break;case s:c=(n-i)/u+4;break}c/=6}return e.h=c,e.s=l,e.l=h,e}getRGB(e,t=tt.workingColorSpace){return tt.workingToColorSpace(un.copy(this),t),e.r=un.r,e.g=un.g,e.b=un.b,e}getStyle(e=mt){tt.workingToColorSpace(un.copy(this),e);const t=un.r,n=un.g,i=un.b;return e!==mt?`color(${e} ${t.toFixed(3)} ${n.toFixed(3)} ${i.toFixed(3)})`:`rgb(${Math.round(t*255)},${Math.round(n*255)},${Math.round(i*255)})`}
vendor: 5,423 bytes, line 40
40offsetHSL(e,t,n){return this.getHSL(Yi),this.setHSL(Yi.h+e,Yi.s+t,Yi.l+n)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,n){return this.r=e.r+(t.r-e.r)*n,this.g=e.g+(t.g-e.g)*n,this.b=e.b+(t.b-e.b)*n,this}lerpHSL(e,t){this.getHSL(Yi),e.getHSL(Zo);const n=bo(Yi.h,Zo.h,t),i=bo(Yi.s,Zo.s,t),s=bo(Yi.l,Zo.l,t);return this.setHSL(n,i,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){const t=this.r,n=this.g,i=this.b,s=e.elements;return this.r=s[0]*t+s[3]*n+s[6]*i,this.g=s[1]*t+s[4]*n+s[7]*i,this.b=s[2]*t+s[5]*n+s[8]*i,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const un=new Me;Me.NAMES=sb;class xs extends ht{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Hn,this.environmentIntensity=1,this.environmentRotation=new Hn,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}const jn=new R,Ci=new R,Mh=new R,Mi=new R,gr=new R,mr=new R,Wp=new R,Ih=new R,wh=new R,Th=new R,Rh=new It,Bh=new It,Dh=new It;class Tn{constructor(e=new R,t=new R,n=new R){this.a=e,this.b=t,this.c=n}static getNormal(e,t,n,i){i.subVectors(n,t),jn.subVectors(e,t),i.cross(jn);const s=i.lengthSq();return s>0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,n,i,s){jn.subVectors(i,t),Ci.subVectors(n,t),Mh.subVectors(e,t);const a=jn.dot(jn),o=jn.dot(Ci),c=jn.dot(Mh),l=Ci.dot(Ci),h=Ci.dot(Mh),u=a*l-o*o;if(u===0)return s.set(0,0,0),null;const d=1/u,f=(l*c-o*h)*d,p=(a*h-o*c)*d;return s.set(1-f-p,p,f)}static containsPoint(e,t,n,i){return this.getBarycoord(e,t,n,i,Mi)===null?!1:Mi.x>=0&&Mi.y>=0&&Mi.x+Mi.y<=1}static getInterpolation(e,t,n,i,s,a,o,c){return this.getBarycoord(e,t,n,i,Mi)===null?(c.x=0,c.y=0,"z"in c&&(c.z=0),"w"in c&&(c.w=0),null):(c.setScalar(0),c.addScaledVector(s,Mi.x),c.addScaledVector(a,Mi.y),c.addScaledVector(o,Mi.z),c)}static getInterpolatedAttribute(e,t,n,i,s,a){return Rh.setScalar(0),Bh.setScalar(0),Dh.setScalar(0),Rh.fromBufferAttribute(e,t),Bh.fromBufferAttribute(e,n),Dh.fromBufferAttribute(e,i),a.setScalar(0),a.addScaledVector(Rh,s.x),a.addScaledVector(Bh,s.y),a.addScaledVector(Dh,s.z),a}static isFrontFacing(e,t,n,i){return jn.subVectors(n,t),Ci.subVectors(e,t),jn.cross(Ci).dot(i)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,n,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return jn.subVectors(this.c,this.b),Ci.subVectors(this.a,this.b),jn.cross(Ci).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Tn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Tn.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,n,i,s){return Tn.getInterpolation(e,this.a,this.b,this.c,t,n,i,s)}containsPoint(e){return Tn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Tn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const n=this.a,i=this.b,s=this.c;let a,o;gr.subVectors(i,n),mr.subVectors(s,n),Ih.subVectors(e,n);
vendor: 30,515 bytes, line 40
40const c=gr.dot(Ih),l=mr.dot(Ih);if(c<=0&&l<=0)return t.copy(n);wh.subVectors(e,i);const h=gr.dot(wh),u=mr.dot(wh);if(h>=0&&u<=h)return t.copy(i);const d=c*u-h*l;if(d<=0&&c>=0&&h<=0)return a=c/(c-h),t.copy(n).addScaledVector(gr,a);Th.subVectors(e,s);const f=gr.dot(Th),p=mr.dot(Th);if(p>=0&&f<=p)return t.copy(s);const m=f*l-c*p;if(m<=0&&l>=0&&p<=0)return o=l/(l-p),t.copy(n).addScaledVector(mr,o);const A=h*p-f*u;if(A<=0&&u-h>=0&&f-p>=0)return Wp.subVectors(s,i),o=(u-h)/(u-h+(f-p)),t.copy(i).addScaledVector(Wp,o);const g=1/(A+m+d);return a=m*g,o=d*g,t.copy(n).addScaledVector(gr,a).addScaledVector(mr,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}class fn{constructor(e=new R(1/0,1/0,1/0),t=new R(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t+=3)this.expandByPoint(Xn.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,n=e.count;t<n;t++)this.expandByPoint(Xn.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){const n=Xn.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(n),this.max.copy(e).add(n),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);const n=e.geometry;if(n!==void 0){const s=n.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let a=0,o=s.count;a<o;a++)e.isMesh===!0?e.getVertexPosition(a,Xn):Xn.fromBufferAttribute(s,a),Xn.applyMatrix4(e.matrixWorld),this.expandByPoint(Xn);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),ec.copy(e.boundingBox)):(n.boundingBox===null&&n.computeBoundingBox(),ec.copy(n.boundingBox)),ec.applyMatrix4(e.matrixWorld),this.union(ec)}const i=e.children;for(let s=0,a=i.length;s<a;s++)this.expandByObject(i[s],t);return this}containsPoint(e){return e.x>=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Xn),Xn.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(wa),tc.subVectors(this.max,wa),br.subVectors(e.a,wa),xr.subVectors(e.b,wa),Er.subVectors(e.c,wa),Ji.subVectors(xr,br),Zi.subVectors(Er,xr),Ss.subVectors(br,Er);let t=[0,-Ji.z,Ji.y,0,-Zi.z,Zi.y,0,-Ss.z,Ss.y,Ji.z,0,-Ji.x,Zi.z,0,-Zi.x,Ss.z,0,-Ss.x,-Ji.y,Ji.x,0,-Zi.y,Zi.x,0,-Ss.y,Ss.x,0];return!Lh(t,br,xr,Er,tc)||(t=[1,0,0,0,1,0,0,0,1],!Lh(t,br,xr,Er,tc))?!1:(nc.crossVectors(Ji,Zi),t=[nc.x,nc.y,nc.z],Lh(t,br,xr,Er,tc))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Xn).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Xn).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Ii[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Ii[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Ii[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Ii[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Ii[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Ii[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Ii[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Ii[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Ii),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}}const Ii=[new R,new R,new R,new R,new R,new R,new R,new R],Xn=new R,ec=new fn,br=new R,xr=new R,Er=new R,Ji=new R,Zi=new R,Ss=new R,wa=new R,tc=new R,nc=new R,Cs=new R;function Lh(r,e,t,n,i){for(let s=0,a=r.length-3;s<=a;s+=3){Cs.fromArray(r,s);const o=i.x*Math.abs(Cs.x)+i.y*Math.abs(Cs.y)+i.z*Math.abs(Cs.z),c=e.dot(Cs),l=t.dot(Cs),h=n.dot(Cs);if(Math.max(-Math.max(c,l,h),Math.min(c,l,h))>o)return!1}return!0}const ki=dv();function dv(){const r=new ArrayBuffer(4),e=new Float32Array(r),t=new Uint32Array(r),n=new Uint32Array(512),i=new Uint32Array(512);for(let c=0;c<256;++c){const l=c-127;l<-27?(n[c]=0,n[c|256]=32768,i[c]=24,i[c|256]=24):l<-14?(n[c]=1024>>-l-14,n[c|256]=1024>>-l-14|32768,i[c]=-l-1,i[c|256]=-l-1):l<=15?(n[c]=l+15<<10,n[c|256]=l+15<<10|32768,i[c]=13,i[c|256]=13):l<128?(n[c]=31744,n[c|256]=64512,i[c]=24,i[c|256]=24):(n[c]=31744,n[c|256]=64512,i[c]=13,i[c|256]=13)}const s=new Uint32Array(2048),a=new Uint32Array(64),o=new Uint32Array(64);for(let c=1;c<1024;++c){let l=c<<13,h=0;for(;(l&8388608)===0;)l<<=1,h-=8388608;l&=-8388609,h+=947912704,s[c]=l|h}for(let c=1024;c<2048;++c)s[c]=939524096+(c-1024<<13);for(let c=1;c<31;++c)a[c]=c<<23;a[31]=1199570944,a[32]=2147483648;for(let c=33;c<63;++c)a[c]=2147483648+(c-32<<23);a[63]=3347054592;for(let c=1;c<64;++c)c!==32&&(o[c]=1024);return{floatView:e,uint32View:t,baseTable:n,shiftTable:i,mantissaTable:s,exponentTable:a,offsetTable:o}}function fv(r){Math.abs(r)>65504&&Ie("DataUtils.toHalfFloat(): Value out of range."),r=We(r,-65504,65504),ki.floatView[0]=r;const e=ki.uint32View[0],t=e>>23&511;return ki.baseTable[t]+((e&8388607)>>ki.shiftTable[t])}function pv(r){const e=r>>10;return ki.uint32View[0]=ki.mantissaTable[ki.offsetTable[e]+(r&1023)]+ki.exponentTable[e],ki.floatView[0]}class ic{static toHalfFloat(e){return fv(e)}static fromHalfFloat(e){return pv(e)}}const Vt=new R,sc=new pe;let Av=0;class Lt{constructor(e,t,n=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:Av++}),this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n,this.usage=Xd,this.updateRanges=[],this.gpuType=Nt,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let i=0,s=this.itemSize;i<s;i++)this.array[e+i]=t.array[n+i];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,n=this.count;t<n;t++)sc.fromBufferAttribute(this,t),sc.applyMatrix3(e),this.setXY(t,sc.x,sc.y);else if(this.itemSize===3)for(let t=0,n=this.count;t<n;t++)Vt.fromBufferAttribute(this,t),Vt.applyMatrix3(e),this.setXYZ(t,Vt.x,Vt.y,Vt.z);return this}applyMatrix4(e){for(let t=0,n=this.count;t<n;t++)Vt.fromBufferAttribute(this,t),Vt.applyMatrix4(e),this.setXYZ(t,Vt.x,Vt.y,Vt.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)Vt.fromBufferAttribute(this,t),Vt.applyNormalMatrix(e),this.setXYZ(t,Vt.x,Vt.y,Vt.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)Vt.fromBufferAttribute(this,t),Vt.transformDirection(e),this.setXYZ(t,Vt.x,Vt.y,Vt.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let n=this.array[e*this.itemSize+t];return this.normalized&&(n=$n(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=pt(n,this.array)),this.array[e*this.itemSize+t]=n,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=$n(t,this.array)),t}setX(e,t){return this.normalized&&(t=pt(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=$n(t,this.array)),t}setY(e,t){return this.normalized&&(t=pt(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=$n(t,this.array)),t}setZ(e,t){return this.normalized&&(t=pt(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=$n(t,this.array)),t}setW(e,t){return this.normalized&&(t=pt(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,n){return e*=this.itemSize,this.normalized&&(t=pt(t,this.array),n=pt(n,this.array)),this.array[e+0]=t,this.array[e+1]=n,this}setXYZ(e,t,n,i){return e*=this.itemSize,this.normalized&&(t=pt(t,this.array),n=pt(n,this.array),i=pt(i,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e*=this.itemSize,this.normalized&&(t=pt(t,this.array),n=pt(n,this.array),i=pt(i,this.array),s=pt(s,this.array)),this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Xd&&(e.usage=this.usage),e}}class rb extends Lt{constructor(e,t,n){super(new Uint16Array(e),t,n)}}class ab extends Lt{constructor(e,t,n){super(new Uint32Array(e),t,n)}}class nn extends Lt{constructor(e,t,n){super(new Float32Array(e),t,n)}}const gv=new fn,Ta=new R,Ph=new R;class Vn{constructor(e=new R,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const n=this.center;t!==void 0?n.copy(t):gv.setFromPoints(e).getCenter(n);let i=0;for(let s=0,a=e.length;s<a;s++)i=Math.max(i,n.distanceToSquared(e[s]));return this.radius=Math.sqrt(i),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){const t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){const n=this.center.distanceToSquared(e);return t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Ta.subVectors(e,this.center);const t=Ta.lengthSq();if(t>this.radius*this.radius){const n=Math.sqrt(t),i=(n-this.radius)*.5;this.center.addScaledVector(Ta,i/n),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Ph.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Ta.copy(e.center).add(Ph)),this.expandByPoint(Ta.copy(e.center).sub(Ph))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}}let mv=0;const Ln=new Oe,Fh=new ht,_r=new R,wn=new fn,Ra=new fn,$t=new R;class cn extends si{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:mv++}),this.uuid=Gn(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.indirectOffset=0,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(P_(e)?ab:rb)(e,1):this.index=e,this}setIndirect(e,t=0){return this.indirect=e,this.indirectOffset=t,this}getIndirect(){return this.indirect}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,n=0){this.groups.push({start:e,count:t,materialIndex:n})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){const t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);const n=this.attributes.normal;if(n!==void 0){const s=new Qe().getNormalMatrix(e);n.applyNormalMatrix(s),n.needsUpdate=!0}const i=this.attributes.tangent;return i!==void 0&&(i.transformDirection(e),i.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Ln.makeRotationFromQuaternion(e),this.applyMatrix4(Ln),this}rotateX(e){return Ln.makeRotationX(e),this.applyMatrix4(Ln),this}rotateY(e){return Ln.makeRotationY(e),this.applyMatrix4(Ln),this}rotateZ(e){return Ln.makeRotationZ(e),this.applyMatrix4(Ln),this}translate(e,t,n){return Ln.makeTranslation(e,t,n),this.applyMatrix4(Ln),this}scale(e,t,n){return Ln.makeScale(e,t,n),this.applyMatrix4(Ln),this}lookAt(e){return Fh.lookAt(e),Fh.updateMatrix(),this.applyMatrix4(Fh.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(_r).negate(),this.translate(_r.x,_r.y,_r.z),this}setFromPoints(e){const t=this.getAttribute("position");if(t===void 0){const n=[];for(let i=0,s=e.length;i<s;i++){const a=e[i];n.push(a.x,a.y,a.z||0)}this.setAttribute("position",new nn(n,3))}else{const n=Math.min(e.length,t.count);for(let i=0;i<n;i++){const s=e[i];t.setXYZ(i,s.x,s.y,s.z||0)}e.length>t.count&&Ie("BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry."),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new fn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Pe("BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new R(-1/0,-1/0,-1/0),new R(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let n=0,i=t.length;n<i;n++){const s=t[n];wn.setFromBufferAttribute(s),this.morphTargetsRelative?($t.addVectors(this.boundingBox.min,wn.min),this.boundingBox.expandByPoint($t),$t.addVectors(this.boundingBox.max,wn.max),this.boundingBox.expandByPoint($t)):(this.boundingBox.expandByPoint(wn.min),this.boundingBox.expandByPoint(wn.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&Pe('BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new Vn);const e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){Pe("BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new R,1/0);return}if(e){const n=this.boundingSphere.center;if(wn.setFromBufferAttribute(e),t)for(let s=0,a=t.length;s<a;s++){const o=t[s];Ra.setFromBufferAttribute(o),this.morphTargetsRelative?($t.addVectors(wn.min,Ra.min),wn.expandByPoint($t),$t.addVectors(wn.max,Ra.max),wn.expandByPoint($t)):(wn.expandByPoint(Ra.min),wn.expandByPoint(Ra.max))}wn.getCenter(n);let i=0;for(let s=0,a=e.count;s<a;s++)$t.fromBufferAttribute(e,s),i=Math.max(i,n.distanceToSquared($t));if(t)for(let s=0,a=t.length;s<a;s++){const o=t[s],c=this.morphTargetsRelative;for(let l=0,h=o.count;l<h;l++)$t.fromBufferAttribute(o,l),c&&(_r.fromBufferAttribute(e,l),$t.add(_r)),i=Math.max(i,n.distanceToSquared($t))}this.boundingSphere.radius=Math.sqrt(i),isNaN(this.boundingSphere.radius)&&Pe('BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){const e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){Pe("BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}const n=t.position,i=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new Lt(new Float32Array(4*n.count),4));const a=this.getAttribute("tangent"),o=[],c=[];for(let E=0;E<n.count;E++)o[E]=new R,c[E]=new R;const l=new R,h=new R,u=new R,d=new pe,f=new pe,p=new pe,m=new R,A=new R;function g(E,S,P){l.fromBufferAttribute(n,E),h.fromBufferAttribute(n,S),u.fromBufferAttribute(n,P),d.fromBufferAttribute(s,E),f.fromBufferAttribute(s,S),p.fromBufferAttribute(s,P),h.sub(l),u.sub(l),f.sub(d),p.sub(d);const w=1/(f.x*p.y-p.x*f.y);isFinite(w)&&(m.copy(h).multiplyScalar(p.y).addScaledVector(u,-f.y).multiplyScalar(w),A.copy(u).multiplyScalar(f.x).addScaledVector(h,-p.x).multiplyScalar(w),o[E].add(m),o[S].add(m),o[P].add(m),c[E].add(A),c[S].add(A),c[P].add(A))}let b=this.groups;b.length===0&&(b=[{start:0,count:e.count}]);for(let E=0,S=b.length;E<S;++E){const P=b[E],w=P.start,L=P.count;for(let N=w,O=w+L;N<O;N+=3)g(e.getX(N+0),e.getX(N+1),e.getX(N+2))}const x=new R,_=new R,v=new R,C=new R;function I(E){v.fromBufferAttribute(i,E),C.copy(v);const S=o[E];x.copy(S),x.sub(v.multiplyScalar(v.dot(S))).normalize(),_.crossVectors(C,S);const w=_.dot(c[E])<0?-1:1;a.setXYZW(E,x.x,x.y,x.z,w)}for(let E=0,S=b.length;E<S;++E){const P=b[E],w=P.start,L=P.count;for(let N=w,O=w+L;N<O;N+=3)I(e.getX(N+0)),I(e.getX(N+1)),I(e.getX(N+2))}}computeVertexNormals(){const e=this.index,t=this.getAttribute("position");if(t!==void 0){let n=this.getAttribute("normal");if(n===void 0)n=new Lt(new Float32Array(t.count*3),3),this.setAttribute("normal",n);else for(let d=0,f=n.count;d<f;d++)n.setXYZ(d,0,0,0);const i=new R,s=new R,a=new R,o=new R,c=new R,l=new R,h=new R,u=new R;if(e)for(let d=0,f=e.count;d<f;d+=3){const p=e.getX(d+0),m=e.getX(d+1),A=e.getX(d+2);i.fromBufferAttribute(t,p),s.fromBufferAttribute(t,m),a.fromBufferAttribute(t,A),h.subVectors(a,s),u.subVectors(i,s),h.cross(u),o.fromBufferAttribute(n,p),c.fromBufferAttribute(n,m),l.fromBufferAttribute(n,A),o.add(h),c.add(h),l.add(h),n.setXYZ(p,o.x,o.y,o.z),n.setXYZ(m,c.x,c.y,c.z),n.setXYZ(A,l.x,l.y,l.z)}else for(let d=0,f=t.count;d<f;d+=3)i.fromBufferAttribute(t,d+0),s.fromBufferAttribute(t,d+1),a.fromBufferAttribute(t,d+2),h.subVectors(a,s),u.subVectors(i,s),h.cross(u),n.setXYZ(d+0,h.x,h.y,h.z),n.setXYZ(d+1,h.x,h.y,h.z),n.setXYZ(d+2,h.x,h.y,h.z);this.normalizeNormals(),n.needsUpdate=!0}}normalizeNormals(){const e=this.attributes.normal;for(let t=0,n=e.count;t<n;t++)$t.fromBufferAttribute(e,t),$t.normalize(),e.setXYZ(t,$t.x,$t.y,$t.z)}toNonIndexed(){function e(o,c){const l=o.array,h=o.itemSize,u=o.normalized,d=new l.constructor(c.length*h);let f=0,p=0;for(let m=0,A=c.length;m<A;m++){o.isInterleavedBufferAttribute?f=c[m]*o.data.stride+o.offset:f=c[m]*h;for(let g=0;g<h;g++)d[p++]=l[f++]}return new Lt(d,h,u)}if(this.index===null)return Ie("BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;const t=new cn,n=this.index.array,i=this.attributes;for(const o in i){const c=i[o],l=e(c,n);t.setAttribute(o,l)}const s=this.morphAttributes;for(const o in s){const c=[],l=s[o];for(let h=0,u=l.length;h<u;h++){const d=l[h],f=e(d,n);c.push(f)}t.morphAttributes[o]=c}t.morphTargetsRelative=this.morphTargetsRelative;const a=this.groups;for(let o=0,c=a.length;o<c;o++){const l=a[o];t.addGroup(l.start,l.count,l.materialIndex)}return t}toJSON(){const e={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){const c=this.parameters;for(const l in c)c[l]!==void 0&&(e[l]=c[l]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const n=this.attributes;for(const c in n){const l=n[c];e.data.attributes[c]=l.toJSON(e.data)}const i={};let s=!1;for(const c in this.morphAttributes){const l=this.morphAttributes[c],h=[];for(let u=0,d=l.length;u<d;u++){const f=l[u];h.push(f.toJSON(e.data))}h.length>0&&(i[c]=h,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));const o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const n=e.index;n!==null&&this.setIndex(n.clone());const i=e.attributes;for(const l in i){const h=i[l];this.setAttribute(l,h.clone(t))}const s=e.morphAttributes;for(const l in s){const h=[],u=s[l];for(let d=0,f=u.length;d<f;d++)h.push(u[d].clone(t));this.morphAttributes[l]=h}this.morphTargetsRelative=e.morphTargetsRelative;const a=e.groups;for(let l=0,h=a.length;l<h;l++){const u=a[l];this.addGroup(u.start,u.count,u.materialIndex)}const o=e.boundingBox;o!==null&&(this.boundingBox=o.clone());const c=e.boundingSphere;return c!==null&&(this.boundingSphere=c.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}class ob{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Xd,this.updateRanges=[],this.version=0,this.uuid=Gn()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let i=0,s=this.stride;i<s;i++)this.array[e+i]=t.array[n+i];return this}set(e,t=0){return this.array.set(e,t),this}clone(e){e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Gn()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const t=new this.array.constructor(e.arrayBuffers[this.array.buffer._uuid]),n=new this.constructor(t,this.stride);return n.setUsage(this.usage),n}onUpload(e){return this.onUploadCallback=e,this}toJSON(e){return e.arrayBuffers===void 0&&(e.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Gn()),e.arrayBuffers[this.array.buffer._uuid]===void 0&&(e.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const xn=new R;class ih{constructor(e,t,n,i=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=e,this.itemSize=t,this.offset=n,this.normalized=i}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(e){this.data.needsUpdate=e}applyMatrix4(e){for(let t=0,n=this.data.count;t<n;t++)xn.fromBufferAttribute(this,t),xn.applyMatrix4(e),this.setXYZ(t,xn.x,xn.y,xn.z);return this}applyNormalMatrix(e){for(let t=0,n=this.count;t<n;t++)xn.fromBufferAttribute(this,t),xn.applyNormalMatrix(e),this.setXYZ(t,xn.x,xn.y,xn.z);return this}transformDirection(e){for(let t=0,n=this.count;t<n;t++)xn.fromBufferAttribute(this,t),xn.transformDirection(e),this.setXYZ(t,xn.x,xn.y,xn.z);return this}getComponent(e,t){let n=this.array[e*this.data.stride+this.offset+t];return this.normalized&&(n=$n(n,this.array)),n}setComponent(e,t,n){return this.normalized&&(n=pt(n,this.array)),this.data.array[e*this.data.stride+this.offset+t]=n,this}setX(e,t){return this.normalized&&(t=pt(t,this.array)),this.data.array[e*this.data.stride+this.offset]=t,this}setY(e,t){return this.normalized&&(t=pt(t,this.array)),this.data.array[e*this.data.stride+this.offset+1]=t,this}setZ(e,t){return this.normalized&&(t=pt(t,this.array)),this.data.array[e*this.data.stride+this.offset+2]=t,this}setW(e,t){return this.normalized&&(t=pt(t,this.array)),this.data.array[e*this.data.stride+this.offset+3]=t,this}getX(e){let t=this.data.array[e*this.data.stride+this.offset];return this.normalized&&(t=$n(t,this.array)),t}getY(e){let t=this.data.array[e*this.data.stride+this.offset+1];return this.normalized&&(t=$n(t,this.array)),t}getZ(e){let t=this.data.array[e*this.data.stride+this.offset+2];return this.normalized&&(t=$n(t,this.array)),t}getW(e){let t=this.data.array[e*this.data.stride+this.offset+3];return this.normalized&&(t=$n(t,this.array)),t}setXY(e,t,n){return e=e*this.data.stride+this.offset,this.normalized&&(t=pt(t,this.array),n=pt(n,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this}setXYZ(e,t,n,i){return e=e*this.data.stride+this.offset,this.normalized&&(t=pt(t,this.array),n=pt(n,this.array),i=pt(i,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this}setXYZW(e,t,n,i,s){return e=e*this.data.stride+this.offset,this.normalized&&(t=pt(t,this.array),n=pt(n,this.array),i=pt(i,this.array),s=pt(s,this.array)),this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=s,this}clone(e){if(e===void 0){Fl("InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return new Lt(new this.array.constructor(t),this.itemSize,this.normalized)}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.clone(e)),new ih(e.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(e){if(e===void 0){Fl("InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.");const t=[];for(let n=0;n<this.count;n++){const i=n*this.data.stride+this.offset;for(let s=0;s<this.itemSize;s++)t.push(this.data.array[i+s])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:t,normalized:this.normalized}}else return e.interleavedBuffers===void 0&&(e.interleavedBuffers={}),e.interleavedBuffers[this.data.uuid]===void 0&&(e.interleavedBuffers[this.data.uuid]=this.data.toJSON(e)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}let bv=0,ei=class extends si{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:bv++}),this.uuid=Gn(),this.name="",this.type="Material",this.blending=$s,this.side=ti,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Sd,this.blendDst=Cd,this.blendEquation=Ws,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Me(0,0,0),this.blendAlpha=0,this.depthFunc=ia,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Bp,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=ur,this.stencilZFail=ur,this.stencilZPass=ur,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const n=e[t];if(n===void 0){Ie(`Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){Ie(`Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const n={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};
vendor: 9,098 bytes, line 40
40n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(n.sheenColorMap=this.sheenColorMap.toJSON(e).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(n.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(e).uuid),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==$s&&(n.blending=this.blending),this.side!==ti&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==Sd&&(n.blendSrc=this.blendSrc),this.blendDst!==Cd&&(n.blendDst=this.blendDst),this.blendEquation!==Ws&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==ia&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Bp&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==ur&&(n.stencilFail=this.stencilFail),this.stencilZFail!==ur&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==ur&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.allowOverride===!1&&(n.allowOverride=!1),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function i(s){const a=[];for(const o in s){const c=s[o];delete c.metadata,a.push(c)}return a}if(t){const s=i(e.textures),a=i(e.images);s.length>0&&(n.textures=s),a.length>0&&(n.images=a)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let n=null;if(t!==null){const i=t.length;n=new Array(i);for(let s=0;s!==i;++s)n[s]=t[s].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipSh
vendor: 35,685 bytes, line 40
40adows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.allowOverride=e.allowOverride,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}};const wi=new R,Nh=new R,rc=new R,es=new R,Uh=new R,ac=new R,Oh=new R;class qo{constructor(e=new R,t=new R(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,wi)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=wi.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(wi.copy(this.origin).addScaledVector(this.direction,t),wi.distanceToSquared(e))}distanceSqToSegment(e,t,n,i){Nh.copy(e).add(t).multiplyScalar(.5),rc.copy(t).sub(e).normalize(),es.copy(this.origin).sub(Nh);const s=e.distanceTo(t)*.5,a=-this.direction.dot(rc),o=es.dot(this.direction),c=-es.dot(rc),l=es.lengthSq(),h=Math.abs(1-a*a);let u,d,f,p;if(h>0)if(u=a*c-o,d=a*o-c,p=s*h,u>=0)if(d>=-p)if(d<=p){const m=1/h;u*=m,d*=m,f=u*(u+a*d+2*o)+d*(a*u+d+2*c)+l}else d=s,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*c)+l;else d=-s,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*c)+l;else d<=-p?(u=Math.max(0,-(-a*s+o)),d=u>0?-s:Math.min(Math.max(-s,-c),s),f=-u*u+d*(d+2*c)+l):d<=p?(u=0,d=Math.min(Math.max(-s,-c),s),f=d*(d+2*c)+l):(u=Math.max(0,-(a*s+o)),d=u>0?s:Math.min(Math.max(-s,-c),s),f=-u*u+d*(d+2*c)+l);else d=a>0?-s:s,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*c)+l;return n&&n.copy(this.origin).addScaledVector(this.direction,u),i&&i.copy(Nh).addScaledVector(rc,d),f}intersectSphere(e,t){wi.subVectors(e.center,this.origin);const n=wi.dot(this.direction),i=wi.dot(wi)-n*n,s=e.radius*e.radius;if(i>s)return null;const a=Math.sqrt(s-i),o=n-a,c=n+a;return c<0?null:o<0?this.at(c,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){const n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,i,s,a,o,c;const l=1/this.direction.x,h=1/this.direction.y,u=1/this.direction.z,d=this.origin;return l>=0?(n=(e.min.x-d.x)*l,i=(e.max.x-d.x)*l):(n=(e.max.x-d.x)*l,i=(e.min.x-d.x)*l),h>=0?(s=(e.min.y-d.y)*h,a=(e.max.y-d.y)*h):(s=(e.max.y-d.y)*h,a=(e.min.y-d.y)*h),n>a||s>i||((s>n||isNaN(n))&&(n=s),(a<i||isNaN(i))&&(i=a),u>=0?(o=(e.min.z-d.z)*u,c=(e.max.z-d.z)*u):(o=(e.max.z-d.z)*u,c=(e.min.z-d.z)*u),n>c||o>i)||((o>n||n!==n)&&(n=o),(c<i||i!==i)&&(i=c),i<0)?null:this.at(n>=0?n:i,t)}intersectsBox(e){return this.intersectBox(e,wi)!==null}intersectTriangle(e,t,n,i,s){Uh.subVectors(t,e),ac.subVectors(n,e),Oh.crossVectors(Uh,ac);let a=this.direction.dot(Oh),o;if(a>0){if(i)return null;o=1}else if(a<0)o=-1,a=-a;else return null;es.subVectors(this.origin,e);const c=o*this.direction.dot(ac.crossVectors(es,ac));if(c<0)return null;const l=o*this.direction.dot(Uh.cross(es));if(l<0||c+l>a)return null;const h=-o*es.dot(Oh);return h<0?null:this.at(h/a,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class pn extends ei{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Me(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Hn,this.combine=K0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const qp=new Oe,Ms=new qo,oc=new Vn,jp=new R,cc=new R,lc=new R,hc=new R,kh=new R,uc=new R,Xp=new R,dc=new R;class at extends ht{constructor(e=new cn,t=new pn){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const o=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}getVertexPosition(e,t){const n=this.geometry,i=n.attributes.position,s=n.morphAttributes.position,a=n.morphTargetsRelative;t.fromBufferAttribute(i,e);const o=this.morphTargetInfluences;if(s&&o){uc.set(0,0,0);for(let c=0,l=s.length;c<l;c++){const h=o[c],u=s[c];h!==0&&(kh.fromBufferAttribute(u,e),a?uc.addScaledVector(kh,h):uc.addScaledVector(kh.sub(t),h))}t.add(uc)}return t}raycast(e,t){const n=this.geometry,i=this.material,s=this.matrixWorld;i!==void 0&&(n.boundingSphere===null&&n.computeBoundingSphere(),oc.copy(n.boundingSphere),oc.applyMatrix4(s),Ms.copy(e.ray).recast(e.near),!(oc.containsPoint(Ms.origin)===!1&&(Ms.intersectSphere(oc,jp)===null||Ms.origin.distanceToSquared(jp)>(e.far-e.near)**2))&&(qp.copy(s).invert(),Ms.copy(e.ray).applyMatrix4(qp),!(n.boundingBox!==null&&Ms.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,Ms)))}_computeIntersections(e,t,n){let i;const s=this.geometry,a=this.material,o=s.index,c=s.attributes.position,l=s.attributes.uv,h=s.attributes.uv1,u=s.attributes.normal,d=s.groups,f=s.drawRange;if(o!==null)if(Array.isArray(a))for(let p=0,m=d.length;p<m;p++){const A=d[p],g=a[A.materialIndex],b=Math.max(A.start,f.start),x=Math.min(o.count,Math.min(A.start+A.count,f.start+f.count));for(let _=b,v=x;_<v;_+=3){const C=o.getX(_),I=o.getX(_+1),E=o.getX(_+2);i=fc(this,g,e,n,l,h,u,C,I,E),i&&(i.faceIndex=Math.floor(_/3),i.face.materialIndex=A.materialIndex,t.push(i))}}else{const p=Math.max(0,f.start),m=Math.min(o.count,f.start+f.count);for(let A=p,g=m;A<g;A+=3){const b=o.getX(A),x=o.getX(A+1),_=o.getX(A+2);i=fc(this,a,e,n,l,h,u,b,x,_),i&&(i.faceIndex=Math.floor(A/3),t.push(i))}}else if(c!==void 0)if(Array.isArray(a))for(let p=0,m=d.length;p<m;p++){const A=d[p],g=a[A.materialIndex],b=Math.max(A.start,f.start),x=Math.min(c.count,Math.min(A.start+A.count,f.start+f.count));for(let _=b,v=x;_<v;_+=3){const C=_,I=_+1,E=_+2;i=fc(this,g,e,n,l,h,u,C,I,E),i&&(i.faceIndex=Math.floor(_/3),i.face.materialIndex=A.materialIndex,t.push(i))}}else{const p=Math.max(0,f.start),m=Math.min(c.count,f.start+f.count);for(let A=p,g=m;A<g;A+=3){const b=A,x=A+1,_=A+2;i=fc(this,a,e,n,l,h,u,b,x,_),i&&(i.faceIndex=Math.floor(A/3),t.push(i))}}}}function xv(r,e,t,n,i,s,a,o){let c;if(e.side===on?c=n.intersectTriangle(a,s,i,!0,o):c=n.intersectTriangle(i,s,a,e.side===ti,o),c===null)return null;dc.copy(o),dc.applyMatrix4(r.matrixWorld);const l=t.ray.origin.distanceTo(dc);return l<t.near||l>t.far?null:{distance:l,point:dc.clone(),object:r}}function fc(r,e,t,n,i,s,a,o,c,l){r.getVertexPosition(o,cc),r.getVertexPosition(c,lc),r.getVertexPosition(l,hc);const h=xv(r,e,t,n,cc,lc,hc,Xp);if(h){const u=new R;Tn.getBarycoord(Xp,cc,lc,hc,u),i&&(h.uv=Tn.getInterpolatedAttribute(i,o,c,l,u,new pe)),s&&(h.uv1=Tn.getInterpolatedAttribute(s,o,c,l,u,new pe)),a&&(h.normal=Tn.getInterpolatedAttribute(a,o,c,l,u,new R),h.normal.dot(n.direction)>0&&h.normal.multiplyScalar(-1));const d={a:o,b:c,c:l,normal:new R,materialIndex:0};Tn.getNormal(cc,lc,hc,d.normal),h.face=d,h.barycoord=u}return h}const Kp=new R,$p=new It,Yp=new It,Ev=new R,Jp=new Oe,pc=new R,Qh=new Vn,Zp=new Oe,Gh=new qo;class _v extends at{constructor(e,t){super(e,t),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=wp,this.bindMatrix=new Oe,this.bindMatrixInverse=new Oe,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const e=this.geometry;this.boundingBox===null&&(this.boundingBox=new fn),this.boundingBox.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,pc),this.boundingBox.expandByPoint(pc)}computeBoundingSphere(){const e=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new Vn),this.boundingSphere.makeEmpty();const t=e.getAttribute("position");for(let n=0;n<t.count;n++)this.getVertexPosition(n,pc),this.boundingSphere.expandByPoint(pc)}copy(e,t){return super.copy(e,t),this.bindMode=e.bindMode,this.bindMatrix.copy(e.bindMatrix),this.bindMatrixInverse.copy(e.bindMatrixInverse),this.skeleton=e.skeleton,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}raycast(e,t){const n=this.material,i=this.matrixWorld;n!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Qh.copy(this.boundingSphere),Qh.applyMatrix4(i),e.ray.intersectsSphere(Qh)!==!1&&(Zp.copy(i).invert(),Gh.copy(e.ray).applyMatrix4(Zp),!(this.boundingBox!==null&&Gh.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(e,t,Gh)))}getVertexPosition(e,t){return super.getVertexPosition(e,t),this.applyBoneTransform(e,t),t}bind(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.copy(t).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const e=new It,t=this.geometry.attributes.skinWeight;for(let n=0,i=t.count;n<i;n++){e.fromBufferAttribute(t,n);const s=1/e.manhattanLength();s!==1/0?e.multiplyScalar(s):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.bindMode===wp?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===y_?this.bindMatrixInverse.copy(this.bindMatrix).invert():Ie("SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}applyBoneTransform(e,t){const n=this.skeleton,i=this.geometry;$p.fromBufferAttribute(i.attributes.skinIndex,e),Yp.fromBufferAttribute(i.attributes.skinWeight,e),Kp.copy(t).applyMatrix4(this.bindMatrix),t.set(0,0,0);for(let s=0;s<4;s++){const a=Yp.getComponent(s);if(a!==0){const o=$p.getComponent(s);Jp.multiplyMatrices(n.bones[o].matrixWorld,n.boneInverses[o]),t.addScaledVector(Ev.copy(Kp).applyMatrix4(Jp),a)}}return t.applyMatrix4(this.bindMatrixInverse)}}class cb extends ht{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Ea extends Rt{constructor(e=null,t=1,n=1,i,s,a,o,c,l=St,h=St,u,d){super(null,a,o,c,l,h,i,s,u,d),this.isDataTexture=!0,this.image={data:e,width:t,height:n},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const eA=new Oe,vv=new Oe;class Hf{constructor(e=[],t=[]){this.uuid=Gn(),this.bones=e.slice(0),this.boneInverses=t,this.boneMatrices=null,this.previousBoneMatrices=null,this.boneTexture=null,this.init()}init(){const e=this.bones,t=this.boneInverses;if(this.boneMatrices=new Float32Array(e.length*16),t.length===0)this.calculateInverses();else if(e.length!==t.length){Ie("Skeleton: Number of inverse bone matrices does not match amount of bones."),this.boneInverses=[];for(let n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new Oe)}}calculateInverses(){this.boneInverses.length=0;for(let e=0,t=this.bones.length;e<t;e++){const n=new Oe;this.bones[e]&&n.copy(this.bones[e].matrixWorld).invert(),this.boneInverses.push(n)}}pose(){for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&n.matrixWorld.copy(this.boneInverses[e]).invert()}for(let e=0,t=this.bones.length;e<t;e++){const n=this.bones[e];n&&(n.parent&&n.parent.isBone?(n.matrix.copy(n.parent.matrixWorld).invert(),n.matrix.multiply(n.matrixWorld)):n.matrix.copy(n.matrixWorld),n.matrix.decompose(n.position,n.quaternion,n.scale))}}update(){const e=this.bones,t=this.boneInverses,n=this.boneMatrices,i=this.boneTexture;for(let s=0,a=e.length;s<a;s++){const o=e[s]?e[s].matrixWorld:vv;eA.multiplyMatrices(o,t[s]),eA.toArray(n,s*16)}i!==null&&(i.needsUpdate=!0)}clone(){return new Hf(this.bones,this.boneInverses)}computeBoneTexture(){let e=Math.sqrt(this.bones.length*4);e=Math.ceil(e/4)*4,e=Math.max(e,4);const t=new Float32Array(e*e*4);t.set(this.boneMatrices);const n=new Ea(t,e,e,Tt,Nt);return n.needsUpdate=!0,this.boneMatrices=t,this.boneTexture=n,this}getBoneByName(e){for(let t=0,n=this.bones.length;t<n;t++){const i=this.bones[t];if(i.name===e)return i}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(e,t){this.uuid=e.uuid;for(let n=0,i=e.bones.length;n<i;n++){const s=e.bones[n];let a=t[s];a===void 0&&(Ie("Skeleton: No bone found with UUID:",s),a=new cb),this.bones.push(a),this.boneInverses.push(new Oe().fromArray(e.boneInverses[n]))}return this.init(),this}toJSON(){const e={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};e.uuid=this.uuid;const t=this.bones,n=this.boneInverses;for(let i=0,s=t.length;i<s;i++){const a=t[i];e.bones.push(a.uuid);const o=n[i];e.boneInverses.push(o.toArray())}return e}}class Kd extends Lt{constructor(e,t,n,i=1){super(e,t,n),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=i}copy(e){return super.copy(e),this.meshPerAttribute=e.meshPerAttribute,this}toJSON(){const e=super.toJSON();return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}}const vr=new Oe,tA=new Oe,Ac=[],nA=new fn,yv=new Oe,Ba=new at,Da=new Vn;class Sv extends at{constructor(e,t,n){super(e,t),this.isInstancedMesh=!0,this.instanceMatrix=new Kd(new Float32Array(n*16),16),this.previousInstanceMatrix=null,this.instanceColor=null,this.morphTexture=null,this.count=n,this.boundingBox=null,this.boundingSphere=null;for(let i=0;i<n;i++)this.setMatrixAt(i,yv)}computeBoundingBox(){const e=this.geometry,t=this.count;this.boundingBox===null&&(this.boundingBox=new fn),e.boundingBox===null&&e.computeBoundingBox(),this.boundingBox.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,vr),nA.copy(e.boundingBox).applyMatrix4(vr),this.boundingBox.union(nA)}computeBoundingSphere(){const e=this.geometry,t=this.count;this.boundingSphere===null&&(this.boundingSphere=new Vn),e.boundingSphere===null&&e.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let n=0;n<t;n++)this.getMatrixAt(n,vr),Da.copy(e.boundingSphere).applyMatrix4(vr),this.boundingSphere.union(Da)}copy(e,t){return super.copy(e,t),this.instanceMatrix.copy(e.instanceMatrix),e.previousInstanceMatrix!==null&&(this.previousInstanceMatrix=e.previousInstanceMatrix.clone()),e.morphTexture!==null&&(this.morphTexture=e.morphTexture.clone()),e.instanceColor!==null&&(this.instanceColor=e.instanceColor.clone()),this.count=e.count,e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this}getColorAt(e,t){t.fromArray(this.instanceColor.array,e*3)}getMatrixAt(e,t){t.fromArray(this.instanceMatrix.array,e*16)}getMorphAt(e,t){const n=t.morphTargetInfluences,i=this.morphTexture.source.data.data,s=n.length+1,a=e*s+1;for(let o=0;o<n.length;o++)n[o]=i[a+o]}raycast(e,t){const n=this.matrixWorld,i=this.count;if(Ba.geometry=this.geometry,Ba.material=this.material,Ba.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),Da.copy(this.boundingSphere),Da.applyMatrix4(n),e.ray.intersectsSphere(Da)!==!1))for(let s=0;s<i;s++){this.getMatrixAt(s,vr),tA.multiplyMatrices(n,vr),Ba.matrixWorld=tA,Ba.raycast(e,Ac);for(let a=0,o=Ac.length;a<o;a++){const c=Ac[a];c.instanceId=s,c.object=this,t.push(c)}Ac.length=0}}setColorAt(e,t){this.instanceColor===null&&(this.instanceColor=new Kd(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),t.toArray(this.instanceColor.array,e*3)}setMatrixAt(e,t){t.toArray(this.instanceMatrix.array,e*16)}setMorphAt(e,t){const n=t.morphTargetInfluences,i=n.length+1;this.morphTexture===null&&(this.morphTexture=new Ea(new Float32Array(i*this.count),i,this.count,ds,Nt));const s=this.morphTexture.source.data.data;let a=0;for(let l=0;l<n.length;l++)a+=n[l];const o=this.geometry.morphTargetsRelative?1:1-a,c=i*e;s[c]=o,s.set(n,c+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}const Hh=new R,Cv=new R,Mv=new Qe;class ks{constructor(e=new R(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,n){const i=Hh.subVectors(n,t).cross(Cv.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const n=e.delta(Hh),i=this.normal.dot(n);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/i;return s<0||s>1?null:t.copy(e.start).addScaledVector(n,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const n=t||Mv.getNormalMatrix(e),i=this.coplanarPoint(Hh).applyMatrix4(e),s=this.normal.applyMatrix3(n).normalize();return this.constant=-i.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const Is=new Vn,Iv=new pe(.5,.5),gc=new R;class zf{constructor(e=new ks,t=new ks,n=new ks,i=new ks,s=new ks,a=new ks){this.planes=[e,t,n,i,s,a]}set(e,t,n,i,s,a){const o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(s),o[5].copy(a),this}copy(e){const t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Ai,n=!1){const i=this.planes,s=e.elements,a=s[0],o=s[1],c=s[2],l=s[3],h=s[4],u=s[5],d=s[6],f=s[7],p=s[8],m=s[9],A=s[10],g=s[11],b=s[12],x=s[13],_=s[14],v=s[15];if(i[0].setComponents(l-a,f-h,g-p,v-b).normalize(),i[1].setComponents(l+a,f+h,g+p,v+b).normalize(),i[2].setComponents(l+o,f+u,g+m,v+x).normalize(),i[3].setComponents(l-o,f-u,g-m,v-x).normalize(),n)i[4].setComponents(c,d,A,_).normalize(),i[5].setComponents(l-c,f-d,g-A,v-_).normalize();else if(i[4].setComponents(l-c,f-d,g-A,v-_).normalize(),t===Ai)i[5].setComponents(l+c,f+d,g+A,v+_).normalize();else if(t===Fo)i[5].setComponents(c,d,A,_).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Is.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Is.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Is)}intersectsSprite(e){Is.center.set(0,0,0);const t=Iv.distanceTo(e.center);return Is.radius=.7071067811865476+t,Is.applyMatrix4(e.matrixWorld),this.intersectsSphere(Is)}intersectsSphere(e){const t=this.planes,n=e.center,i=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(n)<i)return!1;return!0}intersectsBox(e){const t=this.planes;for(let n=0;n<6;n++){const i=t[n];if(gc.x=i.normal.x>0?e.max.x:e.min.x,gc.y=i.normal.y>0?e.max.y:e.min.y,gc.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(gc)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}class lb extends ei{constructor(e){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new Me(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}}const Ol=new R,kl=new R,iA=new Oe,La=new qo,mc=new Vn,zh=new R,sA=new R;class Uo extends ht{constructor(e=new cn,t=new lb){super(),this.isLine=!0,this.type="Line",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[0];for(let i=1,s=t.count;i<s;i++)Ol.fromBufferAttribute(t,i-1),kl.fromBufferAttribute(t,i),n[i]=n[i-1],n[i]+=Ol.distanceTo(kl);e.setAttribute("lineDistance",new nn(n,1))}else Ie("Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Line.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),mc.copy(n.boundingSphere),mc.applyMatrix4(i),mc.radius+=s,e.ray.intersectsSphere(mc)===!1)return;iA.copy(i).invert(),La.copy(e.ray).applyMatrix4(iA);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),c=o*o,l=this.isLineSegments?2:1,h=n.index,d=n.attributes.position;if(h!==null){const f=Math.max(0,a.start),p=Math.min(h.count,a.start+a.count);for(let m=f,A=p-1;m<A;m+=l){const g=h.getX(m),b=h.getX(m+1),x=bc(this,e,La,c,g,b,m);x&&t.push(x)}if(this.isLineLoop){const m=h.getX(p-1),A=h.getX(f),g=bc(this,e,La,c,m,A,p-1);g&&t.push(g)}}else{const f=Math.max(0,a.start),p=Math.min(d.count,a.start+a.count);for(let m=f,A=p-1;m<A;m+=l){const g=bc(this,e,La,c,m,m+1,m);g&&t.push(g)}if(this.isLineLoop){const m=bc(this,e,La,c,p-1,f,p-1);m&&t.push(m)}}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const o=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function bc(r,e,t,n,i,s,a){const o=r.geometry.attributes.position;if(Ol.fromBufferAttribute(o,i),kl.fromBufferAttribute(o,s),t.distanceSqToSegment(Ol,kl,zh,sA)>n)return;zh.applyMatrix4(r.matrixWorld);const l=e.ray.origin.distanceTo(zh);if(!(l<e.near||l>e.far))return{distance:l,point:sA.clone().applyMatrix4(r.matrixWorld),index:a,face:null,faceIndex:null,barycoord:null,object:r}}const rA=new R,aA=new R;class wv extends Uo{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,n=[];for(let i=0,s=t.count;i<s;i+=2)rA.fromBufferAttribute(t,i),aA.fromBufferAttribute(t,i+1),n[i]=i===0?0:n[i-1],n[i+1]=n[i]+rA.distanceTo(aA);e.setAttribute("lineDistance",new nn(n,1))}else Ie("LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");return this}}class Tv extends Uo{constructor(e,t){super(e,t),this.isLineLoop=!0,this.type="LineLoop"}}class hb extends ei{constructor(e){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new Me(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.alphaMap=e.alphaMap,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.fog=e.fog,this}}const oA=new Oe,$d=new qo,xc=new Vn,Ec=new R;class Rv extends ht{constructor(e=new cn,t=new hb){super(),this.isPoints=!0,this.type="Points",this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}raycast(e,t){const n=this.geometry,i=this.matrixWorld,s=e.params.Points.threshold,a=n.drawRange;if(n.boundingSphere===null&&n.computeBoundingSphere(),xc.copy(n.boundingSphere),xc.applyMatrix4(i),xc.radius+=s,e.ray.intersectsSphere(xc)===!1)return;oA.copy(i).invert(),$d.copy(e.ray).applyMatrix4(oA);const o=s/((this.scale.x+this.scale.y+this.scale.z)/3),c=o*o,l=n.index,u=n.attributes.position;if(l!==null){const d=Math.max(0,a.start),f=Math.min(l.count,a.start+a.count);for(let p=d,m=f;p<m;p++){const A=l.getX(p);Ec.fromBufferAttribute(u,A),cA(Ec,A,c,i,e,t,this)}}else{const d=Math.max(0,a.start),f=Math.min(u.count,a.start+a.count);for(let p=d,m=f;p<m;p++)Ec.fromBufferAttribute(u,p),cA(Ec,p,c,i,e,t,this)}}updateMorphTargets(){const t=this.geometry.morphAttributes,n=Object.keys(t);if(n.length>0){const i=t[n[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,a=i.length;s<a;s++){const o=i[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=s}}}}}function cA(r,e,t,n,i,s,a){const o=$d.distanceSqToPoint(r);if(o<t){const c=new R;$d.closestPointToPoint(r,c),c.applyMatrix4(n);const l=i.ray.origin.distanceTo(c);if(l<i.near||l>i.far)return;s.push({distance:l,distanceToRay:Math.sqrt(o),point:c,index:e,face:null,faceIndex:null,barycoord:null,object:a})}}class Bv extends Rt{constructor(e,t,n,i,s=qe,a=qe,o,c,l){super(e,t,n,i,s,a,o,c,l),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const h=this;function u(){h.needsUpdate=!0,h._requestVideoFrameCallbackId=e.requestVideoFrameCallback(u)}"requestVideoFrameCallback"in e&&(this._requestVideoFrameCallbackId=e.requestVideoFrameCallback(u))}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&(this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),this._requestVideoFrameCallbackId=0),super.dispose()}}class tr extends Rt{constructor(e,t,n,i,s,a,o,c,l,h,u,d){super(null,a,o,c,l,h,i,s,u,d),this.isCompressedTexture=!0,this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class Dv extends tr{constructor(e,t,n,i,s,a){super(e,t,n,s,a),this.isCompressedArrayTexture=!0,this.image.depth=i,this.wrapR=Dt,this.layerUpdates=new Set}addLayerUpdate(e){this.layerUpdates.add(e)}clearLayerUpdates(){this.layerUpdates.clear()}}class Lv extends tr{constructor(e,t,n){super(void 0,e[0].width,e[0].height,t,n,bs),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=e}}class ub extends Rt{constructor(e=[],t=bs,n,i,s,a,o,c,l,h){super(e,t,n,i,s,a,o,c,l,h),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Ql extends Rt{constructor(e,t,n,i,s,a,o,c,l){super(e,t,n,i,s,a,o,c,l),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Oo extends Rt{constructor(e,t,n=ii,i,s,a,o=St,c=St,l,h=qi,u=1){if(h!==qi&&h!==Xs)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const d={width:e,height:t,depth:u};super(d,i,s,a,o,c,h,n,l),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new nh(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){const t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}}class Pv extends Oo{constructor(e,t=ii,n=bs,i,s,a=St,o=St,c,l=qi){const h={width:e,height:e,depth:1},u=[h,h,h,h,h,h];super(e,e,t,n,i,s,a,o,c,l),this.image=u,this.isCubeDepthTexture=!0,this.isCubeTexture=!0}get images(){return this.image}set images(e){this.image=e}}class db extends Rt{constructor(e=null){super(),this.sourceTexture=e,this.isExternalTexture=!0}copy(e){return super.copy(e),this.sourceTexture=e.sourceTexture,this}}class ji extends cn{constructor(e=1,t=1,n=1,i=1,s=1,a=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:s,depthSegments:a};const o=this;i=Math.floor(i),s=Math.floor(s),a=Math.floor(a);const c=[],l=[],h=[],u=[];let d=0,f=0;p("z","y","x",-1,-1,n,t,e,a,s,0),p("z","y","x",1,-1,n,t,-e,a,s,1),p("x","z","y",1,1,e,n,t,i,a,2),p("x","z","y",1,-1,e,n,-t,i,a,3),p("x","y","z",1,-1,e,t,n,i,s,4),p("x","y","z",-1,-1,e,t,-n,i,s,5),this.setIndex(c),this.setAttribute("position",new nn(l,3)),this.setAttribute("normal",new nn(h,3)),this.setAttribute("uv",new nn(u,2));function p(m,A,g,b,x,_,v,C,I,E,S){const P=_/I,w=v/E,L=_/2,N=v/2,O=C/2,D=I+1,U=E+1;let F=0,$=0;const q=new R;for(let te=0;te<U;te++){const Z=te*w-N;for(let Y=0;Y<D;Y++){const fe=Y*P-L;q[m]=fe*b,q[A]=Z*x,q[g]=O,l.push(q.x,q.y,q.z),q[m]=0,q[A]=0,q[g]=C>0?1:-1,h.push(q.x,q.y,q.z),u.push(Y/I),u.push(1-te/E),F+=1}}for(let te=0;te<E;te++)for(let Z=0;Z<I;Z++){const Y=d+Z+D*te,fe=d+Z+D*(te+1),Ge=d+(Z+1)+D*(te+1),ze=d+(Z+1)+D*te;c.push(Y,fe,ze),c.push(fe,Ge,ze),$+=6}o.addGroup(f,$,S),f+=$,d+=F}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new ji(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}}class xi{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){Ie("Curve: .getPoint() not implemented.")}getPointAt(e,t){const n=this.getUtoTmapping(e);return this.getPoint(n,t)}getPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return t}getSpacedPoints(e=5){const t=[];for(let n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let n,i=this.getPoint(0),s=0;t.push(0);for(let a=1;a<=e;a++)n=this.getPoint(a/e),s+=n.distanceTo(i),t.push(s),i=n;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t=null){const n=this.getLengths();let i=0;const s=n.length;let a;t?a=t:a=e*n[s-1];let o=0,c=s-1,l;for(;o<=c;)if(i=Math.floor(o+(c-o)/2),l=n[i]-a,l<0)o=i+1;else if(l>0)c=i-1;else{c=i;break}if(i=c,n[i]===a)return i/(s-1);const h=n[i],d=n[i+1]-h,f=(a-h)/d;return(i+f)/(s-1)}getTangent(e,t){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const a=this.getPoint(i),o=this.getPoint(s),c=t||(a.isVector2?new pe:new R);return c.copy(o).sub(a).normalize(),c}getTangentAt(e,t){const n=this.getUtoTmapping(e);return this.getTangent(n,t)}computeFrenetFrames(e,t=!1){const n=new R,i=[],s=[],a=[],o=new R,c=new Oe;for(let f=0;f<=e;f++){const p=f/e;i[f]=this.getTangentAt(p,new R)}s[0]=new R,a[0]=new R;let l=Number.MAX_VALUE;const h=Math.abs(i[0].x),u=Math.abs(i[0].y),d=Math.abs(i[0].z);h<=l&&(l=h,n.set(1,0,0)),u<=l&&(l=u,n.set(0,1,0)),d<=l&&n.set(0,0,1),o.crossVectors(i[0],n).normalize(),s[0].crossVectors(i[0],o),a[0].crossVectors(i[0],s[0]);for(let f=1;f<=e;f++){if(s[f]=s[f-1].clone(),a[f]=a[f-1].clone(),o.crossVectors(i[f-1],i[f]),o.length()>Number.EPSILON){o.normalize();const p=Math.acos(We(i[f-1].dot(i[f]),-1,1));s[f].applyMatrix4(c.makeRotationAxis(o,p))}a[f].crossVectors(i[f],s[f])}if(t===!0){let f=Math.acos(We(s[0].dot(s[e]),-1,1));f/=e,i[0].dot(o.crossVectors(s[0],s[e]))>0&&(f=-f);for(let p=1;p<=e;p++)s[p].applyMatrix4(c.makeRotationAxis(i[p],f*p)),a[p].crossVectors(i[p],s[p])}return{tangents:i,normals:s,binormals:a}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Vf extends xi{constructor(e=0,t=0,n=1,i=1,s=0,a=Math.PI*2,o=!1,c=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=n,this.yRadius=i,this.aStartAngle=s,this.aEndAngle=a,this.aClockwise=o,this.aRotation=c}getPoint(e,t=new pe){const n=t,i=Math.PI*2;let s=this.aEndAngle-this.aStartAngle;const a=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=i;for(;s>i;)s-=i;s<Number.EPSILON&&(a?s=0:s=i),this.aClockwise===!0&&!a&&(s===i?s=-i:s=s-i);const o=this.aStartAngle+e*s;let c=this.aX+this.xRadius*Math.cos(o),l=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){const h=Math.cos(this.aRotation),u=Math.sin(this.aRotation),d=c-this.aX,f=l-this.aY;c=d*h-f*u+this.aX,l=d*u+f*h+this.aY}return n.set(c,l)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){const e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}}class Fv extends Vf{constructor(e,t,n,i,s,a){super(e,t,n,n,i,s,a),this.isArcCurve=!0,this.type="ArcCurve"}}function Wf(){let r=0,e=0,t=0,n=0;function i(s,a,o,c){r=s,e=o,t=-3*s+3*a-2*o-c,n=2*s-2*a+o+c}return{initCatmullRom:function(s,a,o,c,l){i(a,o,l*(o-s),l*(c-a))}
vendor: 4,271 bytes, line 40
40,initNonuniformCatmullRom:function(s,a,o,c,l,h,u){let d=(a-s)/l-(o-s)/(l+h)+(o-a)/h,f=(o-a)/h-(c-a)/(h+u)+(c-o)/u;d*=h,f*=h,i(a,o,d,f)},calc:function(s){const a=s*s,o=a*s;return r+e*s+t*a+n*o}}}const _c=new R,Vh=new Wf,Wh=new Wf,qh=new Wf;class Nv extends xi{constructor(e=[],t=!1,n="centripetal",i=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=n,this.tension=i}getPoint(e,t=new R){const n=t,i=this.points,s=i.length,a=(s-(this.closed?0:1))*e;let o=Math.floor(a),c=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/s)+1)*s:c===0&&o===s-1&&(o=s-2,c=1);let l,h;this.closed||o>0?l=i[(o-1)%s]:(_c.subVectors(i[0],i[1]).add(i[0]),l=_c);const u=i[o%s],d=i[(o+1)%s];if(this.closed||o+2<s?h=i[(o+2)%s]:(_c.subVectors(i[s-1],i[s-2]).add(i[s-1]),h=_c),this.curveType==="centripetal"||this.curveType==="chordal"){const f=this.curveType==="chordal"?.5:.25;let p=Math.pow(l.distanceToSquared(u),f),m=Math.pow(u.distanceToSquared(d),f),A=Math.pow(d.distanceToSquared(h),f);m<1e-4&&(m=1),p<1e-4&&(p=m),A<1e-4&&(A=m),Vh.initNonuniformCatmullRom(l.x,u.x,d.x,h.x,p,m,A),Wh.initNonuniformCatmullRom(l.y,u.y,d.y,h.y,p,m,A),qh.initNonuniformCatmullRom(l.z,u.z,d.z,h.z,p,m,A)}else this.curveType==="catmullrom"&&(Vh.initCatmullRom(l.x,u.x,d.x,h.x,this.tension),Wh.initCatmullRom(l.y,u.y,d.y,h.y,this.tension),qh.initCatmullRom(l.z,u.z,d.z,h.z,this.tension));return n.set(Vh.calc(c),Wh.calc(c),qh.calc(c)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new R().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}}function lA(r,e,t,n,i){const s=(n-e)*.5,a=(i-t)*.5,o=r*r,c=r*o;return(2*t-2*n+s+a)*c+(-3*t+3*n-2*s-a)*o+s*r+t}function Uv(r,e){const t=1-r;return t*t*e}function Ov(r,e){return 2*(1-r)*r*e}function kv(r,e){return r*r*e}function xo(r,e,t,n){return Uv(r,e)+Ov(r,t)+kv(r,n)}function Qv(r,e){const t=1-r;return t*t*t*e}function Gv(r,e){const t=1-r;return 3*t*t*r*e}function Hv(r,e){return 3*(1-r)*r*r*e}function zv(r,e){return r*r*r*e}function Eo(r,e,t,n,i){return Qv(r,e)+Gv(r,t)+Hv(r,n)+zv(r,i)}class fb extends xi{constructor(e=new pe,t=new pe,n=new pe,i=new pe){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new pe){const n=t,i=this.v0,s=this.v1,a=this.v2,o=this.v3;return n.set(Eo(e,i.x,s.x,a.x,o.x),Eo(e,i.y,s.y,a.y,o.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class Vv extends xi{constructor(e=new R,t=new R,n=new R,i=new R){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=n,this.v3=i}getPoint(e,t=new R){const n=t,i=this.v0,s=this.v1,a=this.v2,o=this.v3;return n.set(Eo(e,i.x,s.x,a.x,o.x),Eo(e,i.y,s.y,a.y,o.y),Eo(e,i.z,s.z,a.z,o.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}}class pb extends xi{constructor(e=new pe,t=new pe){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new pe){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}
vendor: 8,595 bytes, line 40
40getTangent(e,t=new pe){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Wv extends xi{constructor(e=new R,t=new R){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new R){const n=t;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new R){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class Ab extends xi{constructor(e=new pe,t=new pe,n=new pe){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new pe){const n=t,i=this.v0,s=this.v1,a=this.v2;return n.set(xo(e,i.x,s.x,a.x),xo(e,i.y,s.y,a.y)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class qv extends xi{constructor(e=new R,t=new R,n=new R){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=n}getPoint(e,t=new R){const n=t,i=this.v0,s=this.v1,a=this.v2;return n.set(xo(e,i.x,s.x,a.x),xo(e,i.y,s.y,a.y),xo(e,i.z,s.z,a.z)),n}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){const e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}}class gb extends xi{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new pe){const n=t,i=this.points,s=(i.length-1)*e,a=Math.floor(s),o=s-a,c=i[a===0?a:a-1],l=i[a],h=i[a>i.length-2?i.length-1:a+1],u=i[a>i.length-3?i.length-1:a+2];return n.set(lA(o,c.x,l.x,h.x,u.x),lA(o,c.y,l.y,h.y,u.y)),n}copy(e){super.copy(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.points=[];for(let t=0,n=this.points.length;t<n;t++){const i=this.points[t];e.points.push(i.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,n=e.points.length;t<n;t++){const i=e.points[t];this.points.push(new pe().fromArray(i))}return this}}var hA=Object.freeze({__proto__:null,ArcCurve:Fv,CatmullRomCurve3:Nv,CubicBezierCurve:fb,CubicBezierCurve3:Vv,EllipseCurve:Vf,LineCurve:pb,LineCurve3:Wv,QuadraticBezierCurve:Ab,QuadraticBezierCurve3:qv,SplineCurve:gb});class jv extends xi{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){const e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){const n=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new hA[n](t,e))}return this}getPoint(e,t){const n=e*this.getLength(),i=this.getCurveLengths();let s=0;for(;s<i.length;){if(i[s]>=n){const a=i[s]-n,o=this.curves[s],c=o.getLength(),l=c===0?0:1-a/c;return o.getPointAt(l,t)}s++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){const t=[];for(let n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){const t=[];let n;for(let i=0,s=this.curves;i<s.length;i++){const a=s[i],o=a.isEllipseCurve?e*2:a.isLineCurve||a.isLineCurve3?1:a.isSplineCurve?e*a.points.length:e,c=a.getPoints(o);for(let l=0;l<c.length;l++){const h=c[l];n&&n.equals(h)||(t.push(h),n=h)}}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this}toJSON(){const e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,n=this.curves.length;t<n;t++){const i=this.curves[t];e.curves.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,n=e.curves.length;t<n;t++){const i=e.curves[t];this.curves.push(new hA[i.type]().fromJSON(i))}return this}}class uA extends jv{constructor(e){super(),this.type="Path",this.currentPoint=new pe,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){const n=new pb(this.currentPoint.clone(),new pe(e,t));return this.curves.push(n),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,n,i){const s=new Ab(this.currentPoint.clone(),new pe(e,t),new pe(n,i));return this.curves.push(s),this.currentPoint.set(n,i),this}bezierCurveTo(e,t,n,i,s,a){const o=new fb(this.currentPoint.clone(),new pe(e,t),new pe(n,i),new pe(s,a));return this.curves.push(o),this.currentPoint.set(s,a),this}splineThru(e){const t=[this.currentPoint.clone()].concat(e),n=new gb(t);return this.curves.push(n),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,n,i,s,a){const o=this.currentPoint.x,c=this.currentPoint.y;return this.absarc(e+o,t+c,n,i,s,a),this}absarc(e,t,n,i,s,a){return this.absellipse(e,t,n,n,i,s,a),this}ellipse(e,t,n,i,s,a,o,c){const l=this.currentPoint.x,h=this.currentPoint.y;return this.absellipse(e+l,t+h,n,i,s,a,o,c),this}absellipse(e,t,n,i,s,a,o,c){const l=new Vf(e,t,n,i,s,a,o,c);if(this.curves.length>0){const u=l.getPoint(0);u.equals(this.currentPoint)||this.lineTo(u.x,u.y)}this.curves.push(l);const h=l.getPoint(1);return this.currentPoint.copy(h),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class mb extends uA{constructor(e){super(e),this.uuid=Gn(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(i.clone())}return this}toJSON(){const e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,n=this.holes.length;t<n;t++){const i=this.holes[t];e.holes.push(i.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,n=e.holes.length;t<n;t++){const i=e.holes[t];this.holes.push(new uA().fromJSON(i))}return this}}function Xv(r,e,t=2){const n=e&&e.length,i=n?e[0]*t:r.length;let s=bb(r,0,i,t,!0);const a=[];if(!s||s.next===s.prev)return a;let o,c,l;if(n&&(s=Zv(r,e,s,t)),r.length>80*t){o=r[0],c=r[1];let h=o,u=c;for(let d=t;d<i;d+=t){const f=r[d],p=r[d+1];f<o&&(o=f),p<c&&(c=p),f>h&&(h=f),p>u&&(u=p)}l=Math.max(h-o,u-c),l=l!==0?32767/l:0}return ko(s,a,t,o,c,l,0),a}function bb(r,e,t,n,i){let s;if(i===hy(r,e,t,n)>0)for(let a=e;a<t;a+=n)s=dA(a/n|0,r[a],r[a+1],s);else for(let a=t-n;a>=e;a-=n)s=dA(a/n|0,r[a],r[a+1],s);return s&&da(s,s.next)&&(Go(s),s=s.next),s}function sr(r,e){if(!r)return r;e||(e=r);let t=r,n;do if(n=!1,!t.steiner&&(da(t,t.next)||Ft(t.prev,t,t.next)===0)){if(Go(t),t=e=t.prev,t===t.next)break;n=!0}else t=t.next;while(n||t!==e);return e}function ko(r,e,t,n,i,s,a){if(!r)return;!a&&s&&sy(r,n,i,s);let o=r;for(;r.prev!==r.next;){const c=r.prev,l=r.next;if(s?$v(r,n,i,s):Kv(r)){e.push(c.i,r.i,l.i),Go(r),r=l.next,o=l.next;continue}if(r=l,r===o){a?a===1?(r=Yv(sr(r),e),ko(r,e,t,n,i,s,2)):a===2&&Jv(r,e,t,n,i,s):ko(sr(r),e,t,n,i,s,1);break}}}function Kv(r){const e=r.prev,t=r,n=r.next;
vendor: 1,695 bytes, line 40
40if(Ft(e,t,n)>=0)return!1;const i=e.x,s=t.x,a=n.x,o=e.y,c=t.y,l=n.y,h=Math.min(i,s,a),u=Math.min(o,c,l),d=Math.max(i,s,a),f=Math.max(o,c,l);let p=n.next;for(;p!==e;){if(p.x>=h&&p.x<=d&&p.y>=u&&p.y<=f&&ao(i,o,s,c,a,l,p.x,p.y)&&Ft(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function $v(r,e,t,n){const i=r.prev,s=r,a=r.next;if(Ft(i,s,a)>=0)return!1;const o=i.x,c=s.x,l=a.x,h=i.y,u=s.y,d=a.y,f=Math.min(o,c,l),p=Math.min(h,u,d),m=Math.max(o,c,l),A=Math.max(h,u,d),g=Yd(f,p,e,t,n),b=Yd(m,A,e,t,n);let x=r.prevZ,_=r.nextZ;for(;x&&x.z>=g&&_&&_.z<=b;){if(x.x>=f&&x.x<=m&&x.y>=p&&x.y<=A&&x!==i&&x!==a&&ao(o,h,c,u,l,d,x.x,x.y)&&Ft(x.prev,x,x.next)>=0||(x=x.prevZ,_.x>=f&&_.x<=m&&_.y>=p&&_.y<=A&&_!==i&&_!==a&&ao(o,h,c,u,l,d,_.x,_.y)&&Ft(_.prev,_,_.next)>=0))return!1;_=_.nextZ}for(;x&&x.z>=g;){if(x.x>=f&&x.x<=m&&x.y>=p&&x.y<=A&&x!==i&&x!==a&&ao(o,h,c,u,l,d,x.x,x.y)&&Ft(x.prev,x,x.next)>=0)return!1;x=x.prevZ}for(;_&&_.z<=b;){if(_.x>=f&&_.x<=m&&_.y>=p&&_.y<=A&&_!==i&&_!==a&&ao(o,h,c,u,l,d,_.x,_.y)&&Ft(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0}function Yv(r,e){let t=r;do{const n=t.prev,i=t.next.next;!da(n,i)&&Eb(n,t,t.next,i)&&Qo(n,i)&&Qo(i,n)&&(e.push(n.i,t.i,i.i),Go(t),Go(t.next),t=r=i),t=t.next}while(t!==r);return sr(t)}function Jv(r,e,t,n,i,s){let a=r;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&&oy(a,o)){let c=_b(a,o);a=sr(a,a.next),c=sr(c,c.next),ko(a,e,t,n,i,s,0),ko(c,e,t,n,i,s,0);return}o=o.next}a=a.next}while(a!==r)}function Zv(r,e,t,n){const i=[];for(let s=0,a=e.length;s<a;s++){const o=e[s]*n,c=s<a-1?e[s+1]*n:r.length,l=bb(r,o,c,n,!1);l===l.next&&(l.steiner=!0),i.push(ay(l))}i.sort(ey);for(let s=0;s<i.length;s++)t=ty(i[s],t);return t}function ey(r,e){let t=r.x-e.x;
vendor: 20,746 bytes, lines 40-44
40if(t===0&&(t=r.y-e.y,t===0)){const n=(r.next.y-r.y)/(r.next.x-r.x),i=(e.next.y-e.y)/(e.next.x-e.x);t=n-i}return t}function ty(r,e){const t=ny(r,e);if(!t)return e;const n=_b(t,r);return sr(n,n.next),sr(t,t.next)}function ny(r,e){let t=e;const n=r.x,i=r.y;let s=-1/0,a;if(da(r,t))return t;do{if(da(r,t.next))return t.next;if(i<=t.y&&i>=t.next.y&&t.next.y!==t.y){const u=t.x+(i-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(u<=n&&u>s&&(s=u,a=t.x<t.next.x?t:t.next,u===n))return a}t=t.next}while(t!==e);if(!a)return null;const o=a,c=a.x,l=a.y;let h=1/0;t=a;do{if(n>=t.x&&t.x>=c&&n!==t.x&&xb(i<l?n:s,i,c,l,i<l?s:n,i,t.x,t.y)){const u=Math.abs(i-t.y)/(n-t.x);Qo(t,r)&&(u<h||u===h&&(t.x>a.x||t.x===a.x&&iy(a,t)))&&(a=t,h=u)}t=t.next}while(t!==o);return a}function iy(r,e){return Ft(r.prev,r,e.prev)<0&&Ft(e.next,r,r.next)<0}function sy(r,e,t,n){let i=r;do i.z===0&&(i.z=Yd(i.x,i.y,e,t,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,ry(i)}function ry(r){let e,t=1;do{let n=r,i;r=null;let s=null;for(e=0;n;){e++;let a=n,o=0;for(let l=0;l<t&&(o++,a=a.nextZ,!!a);l++);let c=t;for(;o>0||c>0&&a;)o!==0&&(c===0||!a||n.z<=a.z)?(i=n,n=n.nextZ,o--):(i=a,a=a.nextZ,c--),s?s.nextZ=i:r=i,i.prevZ=s,s=i;n=a}s.nextZ=null,t*=2}while(e>1);return r}function Yd(r,e,t,n,i){return r=(r-t)*i|0,e=(e-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,r|e<<1}function ay(r){let e=r,t=r;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==r);return t}function xb(r,e,t,n,i,s,a,o){return(i-a)*(e-o)>=(r-a)*(s-o)&&(r-a)*(n-o)>=(t-a)*(e-o)&&(t-a)*(s-o)>=(i-a)*(n-o)}function ao(r,e,t,n,i,s,a,o){return!(r===a&&e===o)&&xb(r,e,t,n,i,s,a,o)}function oy(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!cy(r,e)&&(Qo(r,e)&&Qo(e,r)&&ly(r,e)&&(Ft(r.prev,r,e.prev)||Ft(r,e.prev,e))||da(r,e)&&Ft(r.prev,r,r.next)>0&&Ft(e.prev,e,e.next)>0)}function Ft(r,e,t){return(e.y-r.y)*(t.x-e.x)-(e.x-r.x)*(t.y-e.y)}function da(r,e){return r.x===e.x&&r.y===e.y}function Eb(r,e,t,n){const i=yc(Ft(r,e,t)),s=yc(Ft(r,e,n)),a=yc(Ft(t,n,r)),o=yc(Ft(t,n,e));return!!(i!==s&&a!==o||i===0&&vc(r,t,e)||s===0&&vc(r,n,e)||a===0&&vc(t,r,n)||o===0&&vc(t,e,n))}function vc(r,e,t){return e.x<=Math.max(r.x,t.x)&&e.x>=Math.min(r.x,t.x)&&e.y<=Math.max(r.y,t.y)&&e.y>=Math.min(r.y,t.y)}function yc(r){return r>0?1:r<0?-1:0}function cy(r,e){let t=r;do{if(t.i!==r.i&&t.next.i!==r.i&&t.i!==e.i&&t.next.i!==e.i&&Eb(t,t.next,r,e))return!0;t=t.next}while(t!==r);return!1}function Qo(r,e){return Ft(r.prev,r,r.next)<0?Ft(r,e,r.next)>=0&&Ft(r,r.prev,e)>=0:Ft(r,e,r.prev)<0||Ft(r,r.next,e)<0}function ly(r,e){let t=r,n=!1;const i=(r.x+e.x)/2,s=(r.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&i<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(n=!n),t=t.next;while(t!==r);return n}function _b(r,e){const t=Jd(r.i,r.x,r.y),n=Jd(e.i,e.x,e.y),i=r.next,s=e.prev;return r.next=e,e.prev=r,t.next=i,i.prev=t,n.next=t,t.prev=n,s.next=n,n.prev=s,n}function dA(r,e,t,n){const i=Jd(r,e,t);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Go(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function Jd(r,e,t){return{i:r,x:e,y:t,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function hy(r,e,t,n){let i=0;for(let s=e,a=t-n;s<t;s+=n)i+=(r[a]-r[s])*(r[s+1]+r[a+1]),a=s;return i}class uy{static triangulate(e,t,n=2){return Xv(e,t,n)}}class _o{static area(e){const t=e.length;let n=0;for(let i=t-1,s=0;s<t;i=s++)n+=e[i].x*e[s].y-e[s].x*e[i].y;return n*.5}static isClockWise(e){return _o.area(e)<0}static triangulateShape(e,t){const n=[],i=[],s=[];fA(e),pA(n,e);let a=e.length;t.forEach(fA);for(let c=0;c<t.length;c++)i.push(a),a+=t[c].length,pA(n,t[c]);const o=uy.triangulate(n,i);for(let c=0;c<o.length;c+=3)s.push(o.slice(c,c+3));return s}}function fA(r){const e=r.length;e>2&&r[e-1].equals(r[0])&&r.pop()}function pA(r,e){for(let t=0;t<e.length;t++)r.push(e[t].x),r.push(e[t].y)}class zn extends cn{constructor(e=1,t=1,n=1,i=1){super(),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i};const s=e/2,a=t/2,o=Math.floor(n),c=Math.floor(i),l=o+1,h=c+1,u=e/o,d=t/c,f=[],p=[],m=[],A=[];for(let g=0;g<h;g++){const b=g*d-a;for(let x=0;x<l;x++){const _=x*u-s;p.push(_,-b,0),m.push(0,0,1),A.push(x/o),A.push(1-g/c)}}for(let g=0;g<c;g++)for(let b=0;b<o;b++){const x=b+l*g,_=b+l*(g+1),v=b+1+l*(g+1),C=b+1+l*g;f.push(x,_,C),f.push(_,v,C)}this.setIndex(f),this.setAttribute("position",new nn(p,3)),this.setAttribute("normal",new nn(m,3)),this.setAttribute("uv",new nn(A,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new zn(e.width,e.height,e.widthSegments,e.heightSegments)}}class qf extends cn{constructor(e=new mb([new pe(0,.5),new pe(-.5,-.5),new pe(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};const n=[],i=[],s=[],a=[];let o=0,c=0;if(Array.isArray(e)===!1)l(e);else for(let h=0;h<e.length;h++)l(e[h]),this.addGroup(o,c,h),o+=c,c=0;this.setIndex(n),this.setAttribute("position",new nn(i,3)),this.setAttribute("normal",new nn(s,3)),this.setAttribute("uv",new nn(a,2));function l(h){const u=i.length/3,d=h.extractPoints(t);let f=d.shape;const p=d.holes;_o.isClockWise(f)===!1&&(f=f.reverse());for(let A=0,g=p.length;A<g;A++){const b=p[A];_o.isClockWise(b)===!0&&(p[A]=b.reverse())}const m=_o.triangulateShape(f,p);for(let A=0,g=p.length;A<g;A++){const b=p[A];f=f.concat(b)}for(let A=0,g=f.length;A<g;A++){const b=f[A];i.push(b.x,b.y,0),s.push(0,0,1),a.push(b.x,b.y)}for(let A=0,g=m.length;A<g;A++){const b=m[A],x=b[0]+u,_=b[1]+u,v=b[2]+u;n.push(x,_,v),c+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){const e=super.toJSON(),t=this.parameters.shapes;return dy(t,e)}static fromJSON(e,t){const n=[];for(let i=0,s=e.shapes.length;i<s;i++){const a=t[e.shapes[i]];n.push(a)}return new qf(n,e.curveSegments)}}function dy(r,e){if(e.shapes=[],Array.isArray(r))for(let t=0,n=r.length;t<n;t++){const i=r[t];e.shapes.push(i.uuid)}else e.shapes.push(r.uuid);return e}class jf extends cn{constructor(e=1,t=32,n=16,i=0,s=Math.PI*2,a=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:s,thetaStart:a,thetaLength:o},t=Math.max(3,Math.floor(t)),n=Math.max(2,Math.floor(n));const c=Math.min(a+o,Math.PI);let l=0;const h=[],u=new R,d=new R,f=[],p=[],m=[],A=[];for(let g=0;g<=n;g++){const b=[],x=g/n;let _=0;g===0&&a===0?_=.5/t:g===n&&c===Math.PI&&(_=-.5/t);for(let v=0;v<=t;v++){const C=v/t;u.x=-e*Math.cos(i+C*s)*Math.sin(a+x*o),u.y=e*Math.cos(a+x*o),u.z=e*Math.sin(i+C*s)*Math.sin(a+x*o),p.push(u.x,u.y,u.z),d.copy(u).normalize(),m.push(d.x,d.y,d.z),A.push(C+_,1-x),b.push(l++)}h.push(b)}for(let g=0;g<n;g++)for(let b=0;b<t;b++){const x=h[g][b+1],_=h[g][b],v=h[g+1][b],C=h[g+1][b+1];(g!==0||a>0)&&f.push(x,_,C),(g!==n-1||c<Math.PI)&&f.push(_,v,C)}this.setIndex(f),this.setAttribute("position",new nn(p,3)),this.setAttribute("normal",new nn(m,3)),this.setAttribute("uv",new nn(A,2))}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new jf(e.radius,e.widthSegments,e.heightSegments,e.phiStart,e.phiLength,e.thetaStart,e.thetaLength)}}function fa(r){const e={};for(const t in r){e[t]={};for(const n in r[t]){const i=r[t][n];i&&(i.isColor||i.isMatrix3||i.isMatrix4||i.isVector2||i.isVector3||i.isVector4||i.isTexture||i.isQuaternion)?i.isRenderTargetTexture?(Ie("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][n]=null):e[t][n]=i.clone():Array.isArray(i)?e[t][n]=i.slice():e[t][n]=i}}return e}function _n(r){const e={};for(let t=0;t<r.length;t++){const n=fa(r[t]);for(const i in n)e[i]=n[i]}return e}function fy(r){const e=[];for(let t=0;t<r.length;t++)e.push(r[t].clone());return e}function vb(r){const e=r.getRenderTarget();return e===null?r.outputColorSpace:e.isXRRenderTarget===!0?e.texture.colorSpace:tt.workingColorSpace}const py={clone:fa,merge:_n};var Ay=`void main() {
41	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
42}`,gy=`void main() {
43	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
44}`;class mn extends ei{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=Ay,this.fragmentShader=gy,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=fa(e.uniforms),this.uniformsGroups=fy(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this.defaultAttributeValues=Object.assign({},e.defaultAttributeValues),this.index0AttributeName=e.index0AttributeName,this.uniformsNeedUpdate=e.uniformsNeedUpdate,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const i in this.uniforms){const a=this.uniforms[i].value;a&&a.isTexture?t.uniforms[i]={type:"t",value:a.toJSON(e).uuid}:a&&a.isColor?t.uniforms[i]={type:"c",value:a.getHex()}:a&&a.isVector2?t.uniforms[i]={type:"v2",value:a.toArray()}:a&&a.isVector3?t.uniforms[i]={type:"v3",value:a.toArray()}:a&&a.isVector4?t.uniforms[i]={type:"v4",value:a.toArray()}:a&&a.isMatrix3?t.uniforms[i]={type:"m3",value:a.toArray()}:a&&a.isMatrix4?t.uniforms[i]={type:"m4",value:a.toArray()}:t.uniforms[i]={value:a}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const n={};for(const i in this.extensions)this.extensions[i]===!0&&(n[i]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}}class my extends mn{constructor(e){super(e),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class Ho extends ei{constructor(e){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new Me(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Me(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Z0,this.normalScale=new pe(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Hn,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.envMapIntensity=e.envMapIntensity,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Ei extends Ho{constructor(e){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new pe(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return We(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(t){this.ior=(1+.4*t)/(1-.4*t)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new Me(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new Me(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new Me(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(e)}get anisotropy(){return this._anisotropy}set anisotropy(e){this._anisotropy>0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class yb extends ei{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=M_,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class by extends ei{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}function Sc(r,e){return!r||r.constructor===e?r:typeof e.BYTES_PER_ELEMENT=="number"?new e(r):Array.prototype.slice.call(r)}function xy(r){function e(i,s){return r[i]-r[s]}const t=r.length,n=new Array(t);for(let i=0;i!==t;++i)n[i]=i;return n.sort(e),n}function AA(r,e,t){const n=r.length,i=new r.constructor(n);for(let s=0,a=0;a!==n;++s){const o=t[s]*e;for(let c=0;c!==e;++c)i[a++]=r[o+c]}return i}function Sb(r,e,t,n){let i=1,s=r[0];for(;s!==void 0&&s[n]===void 0;)s=r[i++];if(s===void 0)return;let a=s[n];if(a!==void 0)if(Array.isArray(a))do a=s[n],a!==void 0&&(e.push(s.time),t.push(...a)),s=r[i++];while(s!==void 0);else if(a.toArray!==void 0)do a=s[n],a!==void 0&&(e.push(s.time),a.toArray(t,t.length)),s=r[i++];while(s!==void 0);else do a=s[n],a!==void 0&&(e.push(s.time),t.push(a)),s=r[i++];while(s!==void 0)}class _a{constructor(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let n=this._cachedIndex,i=t[n],s=t[n-1];e:{t:{let a;n:{i:if(!(e<i)){for(let o=n+2;;){if(i===void 0){if(e<s)break i;return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}if(n===o)break;if(s=i,i=t[++n],e<i)break t}a=t.length;break n}if(!(e>=s)){const o=t[1];e<o&&(n=2,s=o);for(let c=n-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(n===c)break;if(i=s,s=t[--n-1],e>=s)break t}a=n,n=0;break n}break e}for(;n<a;){const o=n+a>>>1;e<t[o]?a=o:n=o+1}if(i=t[n],s=t[n-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===void 0)return n=t.length,this._cachedIndex=n,this.copySampleValue_(n-1)}this._cachedIndex=n,this.intervalChanged_(n,s,i)}return this.interpolate_(n,s,e,i)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=e*i;for(let a=0;a!==i;++a)t[a]=n[s+a];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class Ey extends _a{constructor(e,t,n,i){super(e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Vr,endingEnd:Vr}}intervalChanged_(e,t,n){const i=this.parameterPositions;let s=e-2,a=e+1,o=i[s],c=i[a];if(o===void 0)switch(this.getSettings_().endingStart){case Wr:s=e,o=2*t-n;break;case Ll:s=i.length-2,o=t+i[s]-i[s+1];break;default:s=e,o=n}if(c===void 0)switch(this.getSettings_().endingEnd){case Wr:a=e,c=2*n-t;break;case Ll:a=1,c=n+i[1]-i[0];break;default:a=e-1,c=t}const l=(n-t)*.5,h=this.valueSize;this._weightPrev=l/(t-o),this._weightNext=l/(c-n),this._offsetPrev=s*h,this._offsetNext=a*h}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=e*o,l=c-o,h=this._offsetPrev,u=this._offsetNext,d=this._weightPrev,f=this._weightNext,p=(n-t)/(i-t),m=p*p,A=m*p,g=-d*A+2*d*m-d*p,b=(1+d)*A+(-1.5-2*d)*m+(-.5+d)*p+1,x=(-1-f)*A+(1.5+f)*m+.5*p,_=f*A-f*m;for(let v=0;v!==o;++v)s[v]=g*a[h+v]+b*a[l+v]+x*a[c+v]+_*a[u+v];return s}}class Cb extends _a{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=e*o,l=c-o,h=(n-t)/(i-t),u=1-h;for(let d=0;d!==o;++d)s[d]=a[l+d]*u+a[c+d]*h;return s}}class _y extends _a{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e){return this.copySampleValue_(e-1)}}class vy extends _a{interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=e*o,l=c-o,h=this.settings||this.DefaultSettings_,u=h.inTangents,d=h.outTangents;if(!u||!d){const m=(n-t)/(i-t),A=1-m;for(let g=0;g!==o;++g)s[g]=a[l+g]*A+a[c+g]*m;return s}const f=o*2,p=e-1;for(let m=0;m!==o;++m){const A=a[l+m],g=a[c+m],b=p*f+m*2,x=d[b],_=d[b+1],v=e*f+m*2,C=u[v],I=u[v+1];let E=(n-t)/(i-t),S,P,w,L,N;for(let O=0;O<8;O++){S=E*E,P=S*E,w=1-E,L=w*w,N=L*w;const U=N*t+3*L*E*x+3*w*S*C+P*i-n;if(Math.abs(U)<1e-10)break;const F=3*L*(x-t)+6*w*E*(C-x)+3*S*(i-C);if(Math.abs(F)<1e-10)break;E=E-U/F,E=Math.max(0,Math.min(1,E))}s[m]=N*A+3*L*E*_+3*w*S*I+P*g}return s}}class ri{constructor(e,t,n,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyfra
44mes in track named "+e);this.name=e,this.times=Sc(t,this.TimeBufferType),this.values=Sc(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}static toJSON(e){const t=e.constructor;let n;if(t.toJSON!==this.toJSON)n=t.toJSON(e);else{n={name:e.name,times:Sc(e.times,Array),values:Sc(e.values,Array)};const i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}InterpolantFactoryMethodDiscrete(e){return new _y(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Cb(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Ey(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodBezier(e){const t=new vy(this.times,this.values,this.getValueSize(),e);return this.settings&&(t.settings=this.settings),t}setInterpolation(e){let t;switch(e){case la:t=this.InterpolantFactoryMethodDiscrete;break;case ha:t=this.InterpolantFactoryMethodLinear;break;case bh:t=this.InterpolantFactoryMethodSmooth;break;case Rp:t=this.InterpolantFactoryMethodBezier;break}if(t===void 0){const n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return Ie("KeyframeTrack:",n),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return la;case this.InterpolantFactoryMethodLinear:return ha;case this.InterpolantFactoryMethodSmooth:return bh;case this.InterpolantFactoryMethodBezier:return Rp}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]+=e}return this}scale(e){if(e!==1){const t=this.times;for(let n=0,i=t.length;n!==i;++n)t[n]*=e}return this}trim(e,t){const n=this.times,i=n.length;let s=0,a=i-1;for(;s!==i&&n[s]<e;)++s;for(;a!==-1&&n[a]>t;)--a;if(++a,s!==0||a!==i){s>=a&&(a=Math.max(a,1),s=a-1);const o=this.getValueSize();this.times=n.slice(s,a),this.values=this.values.slice(s*o,a*o)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(Pe("KeyframeTrack: Invalid value size in track.",this),e=!1);const n=this.times,i=this.values,s=n.length;s===0&&(Pe("KeyframeTrack: Track is empty.",this),e=!1);let a=null;for(let o=0;o!==s;o++){const c=n[o];if(typeof c=="number"&&isNaN(c)){Pe("KeyframeTrack: Time is not a valid number.",this,o,c),e=!1;break}if(a!==null&&a>c){Pe("KeyframeTrack: Out of order keys.",this,o,c,a),e=!1;break}a=c}if(i!==void 0&&F_(i))for(let o=0,c=i.length;o!==c;++o){const l=i[o];if(isNaN(l)){Pe("KeyframeTrack: Value is not a valid number.",this,o,l),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),i=this.getInterpolation()===bh,s=e.length-1;let a=1;for(let o=1;o<s;++o){let c=!1;const l=e[o],h=e[o+1];if(l!==h&&(o!==1||l!==e[0]))if(i)c=!0;else{const u=o*n,d=u-n,f=u+n;for(let p=0;p!==n;++p){const m=t[u+p];if(m!==t[d+p]||m!==t[f+p]){c=!0;break}}}if(c){if(o!==a){e[a]=e[o];const u=o*n,d=a*n;for(let f=0;f!==n;++f)t[d+f]=t[u+f]}++a}}if(s>0){e[a]=e[s];for(let o=s*n,c=a*n,l=0;l!==n;++l)t[c+l]=t[o+l];++a}return a!==e.length?(this.times=e.slice(0,a),this.values=t.slice(0,a*n)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}ri.prototype.ValueTypeName="";ri.prototype.TimeBufferType=Float32Array;ri.prototype.ValueBufferType=Float32Array;ri.prototype.DefaultInterpolation=ha;class va extends ri{constructor(e,t,n){super(e,t,n)}}va.prototype.ValueTypeName="bool";va.prototype.ValueBufferType=Array;va.prototype.DefaultInterpolation=la;va.prototype.InterpolantFactoryMethodLinear=void 0;va.prototype.InterpolantFactoryMethodSmooth=void 0;class Mb extends ri{constructor(e,t,n,i){super(e,t,n,i)}}Mb.prototype.ValueTypeName="color";class pa extends ri{constructor(e,t,n,i){super(e,t,n,i)}}pa.prototype.ValueTypeName="number";class yy extends _a{constructor(e,t,n,i){super(e,t,n,i)}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=(n-t)/(i-t);let l=e*o;for(let h=l+o;l!==h;l+=4)An.slerpFlat(s,0,a,l-o,a,l,c);return s}}class Aa extends ri{constructor(e,t,n,i){super(e,t,n,i)}InterpolantFactoryMethodLinear(e){return new yy(this.times,this.values,this.getValueSize(),e)}}Aa.prototype.ValueTypeName="quaternion";Aa.prototype.InterpolantFactoryMethodSmooth=void 0;class ya extends ri{constructor(e,t,n){super(e,t,n)}}ya.prototype.ValueTypeName="string";ya.prototype.ValueBufferType=Array;
vendor: 10,340 bytes, line 44
44ya.prototype.DefaultInterpolation=la;ya.prototype.InterpolantFactoryMethodLinear=void 0;ya.prototype.InterpolantFactoryMethodSmooth=void 0;class ga extends ri{constructor(e,t,n,i){super(e,t,n,i)}}ga.prototype.ValueTypeName="vector";class Zd{constructor(e="",t=-1,n=[],i=Uf){this.name=e,this.tracks=n,this.duration=t,this.blendMode=i,this.uuid=Gn(),this.userData={},this.duration<0&&this.resetDuration()}static parse(e){const t=[],n=e.tracks,i=1/(e.fps||1);for(let a=0,o=n.length;a!==o;++a)t.push(Cy(n[a]).scale(i));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s.userData=JSON.parse(e.userData||"{}"),s}static toJSON(e){const t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode,userData:JSON.stringify(e.userData)};for(let s=0,a=n.length;s!==a;++s)t.push(ri.toJSON(n[s]));return i}static CreateFromMorphTargetSequence(e,t,n,i){const s=t.length,a=[];for(let o=0;o<s;o++){let c=[],l=[];c.push((o+s-1)%s,o,(o+1)%s),l.push(0,1,0);const h=xy(c);c=AA(c,1,h),l=AA(l,1,h),!i&&c[0]===0&&(c.push(s),l.push(l[0])),a.push(new pa(".morphTargetInfluences["+t[o].name+"]",c,l).scale(1/n))}return new this(e,-1,a)}static findByName(e,t){let n=e;if(!Array.isArray(e)){const i=e;n=i.geometry&&i.geometry.animations||i.animations}for(let i=0;i<n.length;i++)if(n[i].name===t)return n[i];return null}static CreateClipsFromMorphTargetSequences(e,t,n){const i={},s=/^([\w-]*?)([\d]+)$/;for(let o=0,c=e.length;o<c;o++){const l=e[o],h=l.name.match(s);if(h&&h.length>1){const u=h[1];let d=i[u];d||(i[u]=d=[]),d.push(l)}}const a=[];for(const o in i)a.push(this.CreateFromMorphTargetSequence(o,i[o],t,n));return a}static parseAnimation(e,t){if(Ie("AnimationClip: parseAnimation() is deprecated and will be removed with r185"),!e)return Pe("AnimationClip: No animation in JSONLoader data."),null;const n=function(u,d,f,p,m){if(f.length!==0){const A=[],g=[];Sb(f,A,g,p),A.length!==0&&m.push(new u(d,A,g))}},i=[],s=e.name||"default",a=e.fps||30,o=e.blendMode;let c=e.length||-1;const l=e.hierarchy||[];for(let u=0;u<l.length;u++){const d=l[u].keys;if(!(!d||d.length===0))if(d[0].morphTargets){const f={};let p;for(p=0;p<d.length;p++)if(d[p].morphTargets)for(let m=0;m<d[p].morphTargets.length;m++)f[d[p].morphTargets[m]]=-1;for(const m in f){const A=[],g=[];for(let b=0;b!==d[p].morphTargets.length;++b){const x=d[p];A.push(x.time),g.push(x.morphTarget===m?1:0)}i.push(new pa(".morphTargetInfluence["+m+"]",A,g))}c=f.length*a}else{const f=".bones["+t[u].name+"]";n(ga,f+".position",d,"pos",i),n(Aa,f+".quaternion",d,"rot",i),n(ga,f+".scale",d,"scl",i)}}return i.length===0?null:new this(s,c,i,o)}resetDuration(){const e=this.tracks;let t=0;for(let n=0,i=e.length;n!==i;++n){const s=this.tracks[n];t=Math.max(t,s.times[s.times.length-1])}return this.duration=t,this}trim(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this}validate(){let e=!0;for(let t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e}optimize(){for(let e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this}clone(){const e=[];for(let n=0;n<this.tracks.length;n++)e.push(this.tracks[n].clone());const t=new this.constructor(this.name,this.duration,e,this.blendMode);return t.userData=JSON.parse(JSON.stringify(this.userData)),t}toJSON(){return this.constructor.toJSON(this)}}function Sy(r){switch(r.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return pa;case"vector":case"vector2":case"vector3":case"vector4":return ga;case"color":return Mb;case"quaternion":return Aa;case"bool":case"boolean":return va;case"string":return ya}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+r)}function Cy(r){if(r.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const e=Sy(r.type);if(r.times===void 0){const t=[],n=[];Sb(r.keys,t,n,"value"),r.times=t,r.values=n}return e.parse!==void 0?e.parse(r):new e(r.name,r.times,r.values,r.interpolation)}const Hi={enabled:!1,files:{},add:function(r,e){this.enabled!==!1&&(gA(r)||(this.files[r]=e))},get:function(r){if(this.enabled!==!1&&!gA(r))return this.files[r]},remove:function(r){delete this.files[r]},clear:function(){this.files={}}};function gA(r){try{const e=r.slice(r.indexOf(":")+1);return new URL(e).protocol==="blob:"}catch{return!1}}class Ib{constructor(e,t,n){const i=this;let s=!1,a=0,o=0,c;const l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this._abortController=null,this.itemStart=function(h){o++,s===!1&&i.onStart!==void 0&&i.onStart(h,a,o),s=!0},this.itemEnd=function(h){a++,i.onProgress!==void 0&&i.onProgress(h,a,o),a===o&&(s=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(h){i.onError!==void 0&&i.onError(h)},this.resolveURL=function(h){return c?c(h):h},this.setURLModifier=function(h){return c=h,this},this.addHandler=function(h,u){return l.push(h,u),this},this.removeHandler=function(h){const u=l.indexOf(h);return u!==-1&&l.splice(u,2),this},this.getHandler=function(h){for(let u=0,d=l.length;u<d;u+=2){const f=l[u],p=l[u+1];if(f.global&&(f.lastIndex=0),f.test(h))return p}return null},this.abort=function(){return this.abortController.abort(),this._abortController=null,this}}get abortController(){return this._abortController||(this._abortController=new AbortController),this._abortController}}const My=new Ib;class _i{constructor(e){this.manager=e!==void 0?e:My,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}load(){}loadAsync(e,t){const n=this;return new Promise(function(i,s){n.load(e,i,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}abort(){return this}}_i.DEFAULT_MATERIAL_NAME="__DEFAULT";const Ti={};class Iy extends Error{constructor(e,t){super(e),this.response=t}}class Wi extends _i{constructor(e){super(e),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=Hi.get(`file:${e}`);if(s!==void 0)return this.manager.itemStart(e),setTimeout(()=>{t&&t(s),this.manager.itemEnd(e)},0),s;if(Ti[e]!==void 0){Ti[e].push({onLoad:t,onProgress:n,onError:i});return}Ti[e]=[],Ti[e].push({onLoad:t,onProgress:n,onError:i});const a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),o=this.mimeType,c=this.responseType;fetch(a).then(l=>{if(l.status===200||l.status===0){if(l.status===0&&Ie("FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||l.body===void 0||l.body.getReader===void 0)return l;const h=Ti[e],u=l.body.getReader(),d=l.headers.get("X-File-Size")||l.headers.get("Content-Length"),f=d?parseInt(d):0,p=f!==0;let m=0;const A=new ReadableStream({start(g){b();function b(){u.read().then(({done:x,value:_})=>{if(x)g.close();else{m+=_.byteLength;const v=new ProgressEvent("progress",{lengthComputable:p,loaded:m,total:f});for(let C=0,I=h.length;C<I;C++){const E=h[C];E.onProgress&&E.onProgress(v)}g.enqueue(_),b()}},x=>{g.error(x)})}}});return new Response(A)}else throw new Iy(`fetch for "${l.url}" responded with ${l.status}: ${l.statusText}`,l)}).then(l=>{switch(c){case"arraybuffer":return l.arrayBuffer();case"blob":return l.blob();case"document":return l.text().then(h=>new DOMParser().parseFromString(h,o));case"json":return l.json();default:if(o==="")return l.text();{const u=/charset="?([^;"\s]*)"?/i.exec(o),d=u&&u[1]?u[1].toLowerCase():void 0,f=new TextDecoder(d);return l.arrayBuffer().then(p=>f.decode(p))}}}).then(l=>{Hi.add(`file:${e}`,l);const h=Ti[e];delete Ti[e];for(let u=0,d=h.length;u<d;u++){const f=h[u];f.onLoad&&f.onLoad(l)}}).catch(l=>{const h=Ti[e];if(h===void 0)throw this.manager.itemError(e),l;delete Ti[e];for(let u=0,d=h.length;u<d;u++){const f=h[u];f.onError&&f.onError(l)}this.manager.itemError(e)}).finally(()=>{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}const yr=new WeakMap;class wy extends _i{constructor(e){super(e)}load(e,t,n,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=Hi.get(`image:${e}`);if(a!==void 0){if(a.complete===!0)s.manager.itemStart(e),setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0);else{let u=yr.get(a);u===void 0&&(u=[],yr.set(a,u)),u.push({onLoad:t,onError:i})}return a}const o=No("img");function c(){h(),t&&t(this);const u=yr.get(this)||[];for(let d=0;d<u.length;d++){const f=u[d];f.onLoad&&f.onLoad(this)}yr.delete(this),s.manager.itemEnd(e)}function l(u){h(),i&&i(u),Hi.remove(`image:${e}`);const d=yr.get(this)||[];for(let f=0;f<d.length;f++){const p=d[f];p.onError&&p.onError(u)}yr.delete(this),s.manager.itemError(e),s.manager.itemEnd(e)}function h(){o.removeEventListener("load",c,!1),o.removeEventListener("error",l,!1)}return o.addEventListener("load",c,!1),o.addEventListener("error",l,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),Hi.add(`image:${e}`,o),s.manager.itemStart(e),o.src=e,o}}class Ty extends _i{constructor(e){super(e)}load(e,t,n,i){const s=this,a=new Ea,o=new Wi(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(s.withCredentials),o.load(e,function(c){let l;try{l=s.parse(c)}catch(h){if(i!==void 0)i(h);else{h(h);return}}l.image!==void 0?a.image=l.image:l.data!==void 0&&(a.image.width=l.width,a.image.height=l.height,a.image.data=l.data),a.wrapS=l.wrapS!==void 0?l.wrapS:Dt,a.wrapT=l.wrapT!==void 0?l.wrapT:Dt,a.magFilter=l.magFilter!==void 0?l.magFilter:qe,a.minFilter=l.minFilter!==void 0?l.minFilter:qe,a.anisotropy=l.anisotropy!==void 0?l.anisotropy:1,l.colorSpace!==void 0&&(a.colorSpace
44=l.colorSpace),l.flipY!==void 0&&(a.flipY=l.flipY),l.format!==void 0&&(a.format=l.format),l.type!==void 0&&(a.type=l.type),l.mipmaps!==void 0&&(a.mipmaps=l.mipmaps,a.minFilter=yn),l.mipmapCount===1&&(a.minFilter=qe),l.generateMipmaps!==void 0&&(a.generateMipmaps=l.generateMipmaps),a.needsUpdate=!0,t&&t(a,l)},n,i),a}}class wb extends _i{constructor(e){super(e)}load(e,t,n,i){const s=new Rt,a=new wy(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(o){s.image=o,s.needsUpdate=!0,t!==void 0&&t(s)},n,i),s}}class sh extends ht{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Me(e),this.intensity=t}dispose(){this.dispatchEvent({type:"dispose"})}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,t}}const jh=new Oe,mA=new R,bA=new R;class Xf{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.biasNode=null,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new pe(512,512),this.mapType=Le,this.map=null,this.mapPass=null,this.matrix=new Oe,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new zf,this._frameExtents=new pe(1,1),this._viewportCount=1,this._viewports=[new It(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,n=this.matrix;mA.setFromMatrixPosition(e.matrixWorld),t.position.copy(mA),bA.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(bA),t.updateMatrixWorld(),jh.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(jh,t.coordinateSystem,t.reversedDepth),t.coordinateSystem===Fo||t.reversedDepth?n.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(jh)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this.biasNode=e.biasNode,this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}const Cc=new R,Mc=new An,oi=new R;class Tb extends ht{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Oe,this.projectionMatrix=new Oe,this.projectionMatrixInverse=new Oe,this.coordinateSystem=Ai,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorld.decompose(Cc,Mc,oi),oi.x===1&&oi.y===1&&oi.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(Cc,Mc,oi.set(1,1,1)).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorld.decompose(Cc,Mc,oi),oi.x===1&&oi.y===1&&oi.z===1?this.matrixWorldInverse.copy(this.matrixWorld).invert():this.matrixWorldInverse.compose(Cc,Mc,oi.set(1,1,1)).invert()}clone(){return new this.constructor().copy(this)}}const ts=new R,xA=new pe,EA=new pe;class Zt extends Tb{constructor(e=50,t=1,n=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=n,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=ua*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(mo*.5*this.fov);return .5*this.getFilmHeight()/e}
vendor: 10,735 bytes, line 44
44getEffectiveFOV(){return ua*2*Math.atan(Math.tan(mo*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){ts.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(ts.x,ts.y).multiplyScalar(-e/ts.z),ts.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(ts.x,ts.y).multiplyScalar(-e/ts.z)}getViewSize(e,t){return this.getViewBounds(e,xA,EA),t.subVectors(EA,xA)}setViewOffset(e,t,n,i,s,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(mo*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,s=-.5*i;const a=this.view;if(this.view!==null&&this.view.enabled){const c=a.fullWidth,l=a.fullHeight;s+=a.offsetX*i/c,t-=a.offsetY*n/l,i*=a.width/c,n*=a.height/l}const o=this.filmOffset;o!==0&&(s+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,t,t-n,e,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}class Ry extends Xf{constructor(){super(new Zt(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){const t=this.camera,n=ua*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height*this.aspect,s=e.distance||t.far;(n!==t.fov||i!==t.aspect||s!==t.far)&&(t.fov=n,t.aspect=i,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class By extends sh{constructor(e,t,n=0,i=Math.PI/3,s=0,a=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(ht.DEFAULT_UP),this.updateMatrix(),this.target=new ht,this.distance=n,this.angle=i,this.penumbra=s,this.decay=a,this.map=null,this.shadow=new Ry}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.map=e.map,this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.distance=this.distance,t.object.angle=this.angle,t.object.decay=this.decay,t.object.penumbra=this.penumbra,t.object.target=this.target.uuid,this.map&&this.map.isTexture&&(t.object.map=this.map.toJSON(e).uuid),t.object.shadow=this.shadow.toJSON(),t}}class Dy extends Xf{constructor(){super(new Zt(90,1,.5,500)),this.isPointLightShadow=!0}}class Rb extends sh{constructor(e,t,n=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=n,this.decay=i,this.shadow=new Dy}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){super.dispose(),this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.distance=this.distance,t.object.decay=this.decay,t.object.shadow=this.shadow.toJSON(),t}}class cr extends Tb{constructor(e=-1,t=1,n=1,i=-1,s=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=i,this.near=s,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,i,s,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=s,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=n-e,a=n+e,o=i+t,c=i-t;if(this.view!==null&&this.view.enabled){const l=(this.right-this.left)/this.view.fullWidth/this.zoom,h=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=l*this.view.offsetX,a=s+l*this.view.width,o-=h*this.view.offsetY,c=o-h*this.view.height}this.projectionMatrix.makeOrthographic(s,a,o,c,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}class Ly extends Xf{constructor(){super(new cr(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class Bb extends sh{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(ht.DEFAULT_UP),this.updateMatrix(),this.target=new ht,this.shadow=new Ly}dispose(){super.dispose(),this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){const t=super.toJSON(e);return t.object.shadow=this.shadow.toJSON(),t.object.target=this.target.uuid,t}}class Py{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let e=0;e<9;e++)this.coefficients.push(new R)}set(e){for(let t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this}zero(){for(let e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this}getAt(e,t){const n=e.x,i=e.y,s=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScaledVector(a[1],.488603*i),t.addScaledVector(a[2],.488603*s),t.addScaledVector(a[3],.488603*n),t.addScaledVector(a[4],1.092548*(n*i)),t.addScaledVector(a[5],1.092548*(i*s)),t.addScaledVector(a[6],.315392*(3*s*s-1)),t.addScaledVector(a[7],1.092548*(n*s)),t.addScaledVector(a[8],.546274*(n*n-i*i)),t}getIrradianceAt(e,t){const n=e.x,i=e.y,s=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScaledVector(a[1],2*.511664*i),t.addScaledVector(a[2],2*.511664*s),t.addScaledVector(a[3],2*.511664*n),t.addScaledVector(a[4],2*.429043*n*i),t.addScaledVector(a[5],2*.429043*i*s),t.addScaledVector(a[6],.743125*s*s-.247708),t.addScaledVector(a[7],2*.429043*n*s),t.addScaledVector(a[8],.429043*(n*n-i*i)),t}add(e){for(let t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this}addScaledSH(e,t){for(let n=0;n<9;n++)this.coefficients[n].addScaledVector(e.coefficients[n],t);return this}scale(e){for(let t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this}lerp(e,t){for(let n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this}equals(e){for(let t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0}copy(e){return this.set(e.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(e,t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].fromArray(e,t+i*3);return this}toArray(e=[],t=0){const n=this.coefficients;for(let i=0;i<9;i++)n[i].toArray(e,t+i*3);return e}static getBasisAt(e,t){const n=e.x,i=e.y,s=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*s,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*s,t[6]=.315392*(3*s*s-1),t[7]=1.092548*n*s,t[8]=.546274*(n*n-i*i)}}class Fy extends sh{constructor(e=new Py,t=1){super(void 0,t),this.isLightProbe=!0,this.sh=e}copy(e){return super.copy(e),this.sh.copy(e.sh),this}toJSON(e){const t=super.toJSON(e);return t.object.sh=this.sh.toArray(),t}}class vo{static extractUrlBase(e){const t=e.lastIndexOf("/");return t===-1?"./":e.slice(0,t+1)}static resolveURL(e,t){return typeof e!="string"||e===""?"":(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}}const Xh=new WeakMap;class Ny extends _i{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>"u"&&Ie("ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&Ie("ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(e){return this.options=e,this}load(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,a=Hi.get(`image-bitmap:${e}`);if(a!==void 0){if(s.manager.itemStart(e),a.then){a.then(l=>{if(Xh.has(a)===!0)i&&i(Xh.get(a)),s.manager.itemError(e),s.manager.itemEnd(e);else return t&&t(l),s.manager.itemEnd(e),l});return}return setTimeout(function(){t&&t(a),s.manager.itemEnd(e)},0),a}const o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader,o.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const c=fetch(e,o).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(l){return Hi.add(`image-bitmap:${e}`,l),t&&t(l),s.manager.itemEnd(e),l}).catch(function(l){i&&i(l),Xh.set(c,l),Hi.remove(`image-bitmap:${e}`),s.manager.itemError(e),s.manager.itemEnd(e)});Hi.add(`image-bitmap:${e}`,c),s.manager.itemStart(e)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}const Sr=-90,Cr=1;class ef extends ht{constructor(e,t,n){super(),this.type="CubeCamera",this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Zt(Sr,Cr,e,t);i.layers=this.layers,this.add(i);const s=new Zt(Sr,Cr,e,t);s.layers=this.layers,this.add(s);const a=new Zt(Sr,Cr,e,t);a.layers=this.layers,this.add(a);const o=new Zt(Sr,Cr,e,t);o.layers=this.layers,this.add(o);const c=new Zt(Sr,Cr,e,t);c.layers=this.layers,this.add(c);const l=new Zt(Sr,Cr,e,t);l.layers=this.layers,this.add(l)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[n,i,s,a,o,c]=t;for(const l of t)this.remove(l);
vendor: 7,434 bytes, line 44
44if(e===Ai)n.up.set(0,1,0),n.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),c.up.set(0,1,0),c.lookAt(0,0,-1);else if(e===Fo)n.up.set(0,-1,0),n.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),c.up.set(0,-1,0),c.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const l of t)this.add(l),l.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:n,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,a,o,c,l,h]=this.children,u=e.getRenderTarget(),d=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;const m=n.texture.generateMipmaps;n.texture.generateMipmaps=!1;let A=!1;e.isWebGLRenderer===!0?A=e.state.buffers.depth.getReversed():A=e.reversedDepthBuffer,e.setRenderTarget(n,0,i),A&&e.autoClear===!1&&e.clearDepth(),e.render(t,s),e.setRenderTarget(n,1,i),A&&e.autoClear===!1&&e.clearDepth(),e.render(t,a),e.setRenderTarget(n,2,i),A&&e.autoClear===!1&&e.clearDepth(),e.render(t,o),e.setRenderTarget(n,3,i),A&&e.autoClear===!1&&e.clearDepth(),e.render(t,c),e.setRenderTarget(n,4,i),A&&e.autoClear===!1&&e.clearDepth(),e.render(t,l),n.texture.generateMipmaps=m,e.setRenderTarget(n,5,i),A&&e.autoClear===!1&&e.clearDepth(),e.render(t,h),e.setRenderTarget(u,d,f),e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}}class Uy extends Zt{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}}class Oy{constructor(e,t,n){this.binding=e,this.valueSize=n;let i,s,a;switch(t){case"quaternion":i=this._slerp,s=this._slerpAdditive,a=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(n*6),this._workIndex=5;break;case"string":case"bool":i=this._select,s=this._select,a=this._setAdditiveIdentityOther,this.buffer=new Array(n*5);break;default:i=this._lerp,s=this._lerpAdditive,a=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(n*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=s,this._setIdentity=a,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const n=this.buffer,i=this.valueSize,s=e*i+i;let a=this.cumulativeWeight;if(a===0){for(let o=0;o!==i;++o)n[s+o]=n[o];a=t}else{a+=t;const o=t/a;this._mixBufferRegion(n,s,0,o,i)}this.cumulativeWeight=a}accumulateAdditive(e){const t=this.buffer,n=this.valueSize,i=n*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,n),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,n=this.buffer,i=e*t+t,s=this.cumulativeWeight,a=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const c=t*this._origIndex;this._mixBufferRegion(n,i,c,1-s,t)}a>0&&this._mixBufferRegionAdditive(n,i,this._addIndex*t,1,t);for(let c=t,l=t+t;c!==l;++c)if(n[c]!==n[c+t]){o.setValue(n,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,n=this.valueSize,i=n*this._origIndex;e.getValue(t,i);for(let s=n,a=i;s!==a;++s)t[s]=t[i+s%n];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let n=e;n<t;n++)this.buffer[n]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const e=this._origIndex*this.valueSize,t=this._addIndex*this.valueSize;for(let n=0;n<this.valueSize;n++)this.buffer[t+n]=this.buffer[e+n]}_select(e,t,n,i,s){if(i>=.5)for(let a=0;a!==s;++a)e[t+a]=e[n+a]}_slerp(e,t,n,i){An.slerpFlat(e,t,e,t,e,n,i)}_slerpAdditive(e,t,n,i,s){const a=this._workIndex*s;An.multiplyQuaternionsFlat(e,a,e,t,e,n),An.slerpFlat(e,t,e,t,e,a,i)}_lerp(e,t,n,i,s){const a=1-i;for(let o=0;o!==s;++o){const c=t+o;e[c]=e[c]*a+e[n+o]*i}}_lerpAdditive(e,t,n,i,s){for(let a=0;a!==s;++a){const o=t+a;e[o]=e[o]+e[n+a]*i}}}const Kf="\\[\\]\\.:\\/",ky=new RegExp("["+Kf+"]","g"),$f="[^"+Kf+"]",Qy="[^"+Kf.replace("\\.","")+"]",Gy=/((?:WC+[\/:])*)/.source.replace("WC",$f),Hy=/(WCOD+)?/.source.replace("WCOD",Qy),zy=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",$f),Vy=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",$f),Wy=new RegExp("^"+Gy+Hy+zy+Vy+"$"),qy=["material","materials","bones","map"];class jy{constructor(e,t,n){const i=n||nt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)}setValue(e,t){const n=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=n.length;i!==s;++i)n[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}}class nt{constructor(e,t,n){this.path=t,this.parsedPath=n||nt.parseTrackName(t),this.node=nt.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,n){return e&&e.isAnimationObjectGroup?new nt.Composite(e,t,n):new nt(e,t,n)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(ky,"")}static parseTrackName(e){const t=Wy.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=n.nodeName&&n.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const s=n.nodeName.substring(i+1);qy.indexOf(s)!==-1&&(n.nodeName=n.nodeName.substring(0,i),n.objectName=s)}if(n.propertyName===null||n.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return n}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){const n=function(s){for(let a=0;a<s.length;a++){const o=s[a];if(o.name===t||o.uuid===t)return o;const c=n(o.children);if(c)return c}return null},i=n(e.children);if(i)return i}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)e[t++]=n[i]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++]}_setValue_array_setNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.needsUpdate=!0}
vendor: 9,205 bytes, line 44
44_setValue_array_setMatrixWorldNeedsUpdate(e,t){const n=this.resolvedProperty;for(let i=0,s=n.length;i!==s;++i)n[i]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node;const t=this.parsedPath,n=t.objectName,i=t.propertyName;let s=t.propertyIndex;if(e||(e=nt.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){Ie("PropertyBinding: No target node found for track: "+this.path+".");return}if(n){let l=t.objectIndex;switch(n){case"materials":if(!e.material){Pe("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){Pe("PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){Pe("PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let h=0;h<e.length;h++)if(e[h].name===l){l=h;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){Pe("PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){Pe("PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[n]===void 0){Pe("PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(l!==void 0){if(e[l]===void 0){Pe("PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[l]}}const a=e[i];if(a===void 0){const l=t.nodeName;Pe("PropertyBinding: Trying to update property for track: "+l+"."+i+" but it wasn't found.",e);return}let o=this.Versioning.None;this.targetObject=e,e.isMaterial===!0?o=this.Versioning.NeedsUpdate:e.isObject3D===!0&&(o=this.Versioning.MatrixWorldNeedsUpdate);let c=this.BindingType.Direct;if(s!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){Pe("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){Pe("PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}c=this.BindingType.ArrayElement,this.resolvedProperty=a,this.propertyIndex=s}else a.fromArray!==void 0&&a.toArray!==void 0?(c=this.BindingType.HasFromToArray,this.resolvedProperty=a):Array.isArray(a)?(c=this.BindingType.EntireArray,this.resolvedProperty=a):this.propertyName=i;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}nt.Composite=jy;nt.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};nt.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};nt.prototype.GetterByBindingType=[nt.prototype._getValue_direct,nt.prototype._getValue_array,nt.prototype._getValue_arrayElement,nt.prototype._getValue_toArray];nt.prototype.SetterByBindingTypeAndVersioning=[[nt.prototype._setValue_direct,nt.prototype._setValue_direct_setNeedsUpdate,nt.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[nt.prototype._setValue_array,nt.prototype._setValue_array_setNeedsUpdate,nt.prototype._setValue_array_setMatrixWorldNeedsUpdate],[nt.prototype._setValue_arrayElement,nt.prototype._setValue_arrayElement_setNeedsUpdate,nt.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[nt.prototype._setValue_fromArray,nt.prototype._setValue_fromArray_setNeedsUpdate,nt.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class Xy{constructor(e,t,n=null,i=t.blendMode){this._mixer=e,this._clip=t,this._localRoot=n,this.blendMode=i;const s=t.tracks,a=s.length,o=new Array(a),c={endingStart:Vr,endingEnd:Vr};for(let l=0;l!==a;++l){const h=s[l].createInterpolant(null);o[l]=h,h.settings=c}this._interpolantSettings=c,this._interpolants=o,this._propertyBindings=new Array(a),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=Yr,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(e){return this._startTime=e,this}setLoop(e,t){return this.loop=e,this.repetitions=t,this}setEffectiveWeight(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(e){return this._scheduleFading(e,0,1)}fadeOut(e){return this._scheduleFading(e,1,0)}crossFadeFrom(e,t,n=!1){if(e.fadeOut(t),this.fadeIn(t),n===!0){const i=this._clip.duration,s=e._clip.duration,a=s/i,o=i/s;e.warp(1,a,t),this.warp(o,1,t)}return this}crossFadeTo(e,t,n=!1){return e.crossFadeFrom(this,t,n)}stopFading(){const e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}setEffectiveTimeScale(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(e){return this.timeScale=this._clip.duration/e,this.stopWarping()}syncWith(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()}halt(e){return this.warp(this._effectiveTimeScale,0,e)}warp(e,t,n){const i=this._mixer,s=i.time,a=this.timeScale;let o=this._timeScaleInterpolant;o===null&&(o=i._lendControlInterpolant(),this._timeScaleInterpolant=o);const c=o.parameterPositions,l=o.sampleValues;return c[0]=s,c[1]=s+n,l[0]=e/a,l[1]=t/a,this}stopWarping(){const e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}const s=this._startTime;if(s!==null){const c=(e-s)*n;c<0||n===0?t=0:(this._startTime=null,t=n*c)}t*=this._updateTimeScale(e);const a=this._updateTime(t),o=this._updateWeight(e);if(o>0){const c=this._interpolants,l=this._propertyBindings;switch(this.blendMode){case S_:for(let h=0,u=c.length;h!==u;++h)c[h].evaluate(a),l[h].accumulateAdditive(o);break;case Uf:default:for(let h=0,u=c.length;h!==u;++h)c[h].evaluate(a),l[h].accumulate(i,o)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const n=this._weightInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const n=this._timeScaleInterpolant;if(n!==null){const i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,n=this.loop;let i=this.time+e,s=this._loopCount;const a=n===Dl;if(e===0)return s===-1?i:a&&(s&1)===1?t-i:i;if(n===Po){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),i>=t||i<0){const o=Math.floor(i/t);i-=t*o,s+=Math.abs(o);const c=this.repetitions-s;if(c<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(c===1){const l=e<0;this._setEndings(l,!l,a)}else this._setEndings(!1,!1,a);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=i;
vendor: 7,417 bytes, line 44
44if(a&&(s&1)===1)return t-i}return i}_setEndings(e,t,n){const i=this._interpolantSettings;n?(i.endingStart=Wr,i.endingEnd=Wr):(e?i.endingStart=this.zeroSlopeAtStart?Wr:Vr:i.endingStart=Ll,t?i.endingEnd=this.zeroSlopeAtEnd?Wr:Vr:i.endingEnd=Ll)}_scheduleFading(e,t,n){const i=this._mixer,s=i.time;let a=this._weightInterpolant;a===null&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);const o=a.parameterPositions,c=a.sampleValues;return o[0]=s,c[0]=t,o[1]=s+e,c[1]=n,this}}const Ky=new Float32Array(1);class _A extends si{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}_bindAction(e,t){const n=e._localRoot||this._root,i=e._clip.tracks,s=i.length,a=e._propertyBindings,o=e._interpolants,c=n.uuid,l=this._bindingsByRootAndName;let h=l[c];h===void 0&&(h={},l[c]=h);for(let u=0;u!==s;++u){const d=i[u],f=d.name;let p=h[f];if(p!==void 0)++p.referenceCount,a[u]=p;else{if(p=a[u],p!==void 0){p._cacheIndex===null&&(++p.referenceCount,this._addInactiveBinding(p,c,f));continue}const m=t&&t._propertyBindings[u].binding.parsedPath;p=new Oy(nt.create(n,f,m),d.ValueTypeName,d.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,c,f),a[u]=p}o[u].resultBuffer=p.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const n=(e._localRoot||this._root).uuid,i=e._clip.uuid,s=this._actionsByClip[i];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,i,n)}const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t<this._nActiveActions}_addInactiveAction(e,t,n){const i=this._actions,s=this._actionsByClip;let a=s[t];if(a===void 0)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,s[t]=a;else{const o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=i.length,i.push(e),a.actionByRoot[n]=e}_removeInactiveAction(e){const t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;const s=e._clip.uuid,a=this._actionsByClip,o=a[s],c=o.knownActions,l=c[c.length-1],h=e._byClipCacheIndex;l._byClipCacheIndex=h,c[h]=l,c.pop(),e._byClipCacheIndex=null;const u=o.actionByRoot,d=(e._localRoot||this._root).uuid;delete u[d],c.length===0&&delete a[s],this._removeInactiveBindingsForAction(e)}_removeInactiveBindingsForAction(e){const t=e._propertyBindings;for(let n=0,i=t.length;n!==i;++n){const s=t[n];--s.referenceCount===0&&this._removeInactiveBinding(s)}}_lendAction(e){const t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_takeBackAction(e){const t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_addInactiveBinding(e,t,n){const i=this._bindingsByRootAndName,s=this._bindings;let a=i[t];a===void 0&&(a={},i[t]=a),a[n]=e,e._cacheIndex=s.length,s.push(e)}_removeInactiveBinding(e){const t=this._bindings,n=e.binding,i=n.rootNode.uuid,s=n.path,a=this._bindingsByRootAndName,o=a[i],c=t[t.length-1],l=e._cacheIndex;c._cacheIndex=l,t[l]=c,t.pop(),delete o[s],Object.keys(o).length===0&&delete a[i]}_lendBinding(e){const t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_takeBackBinding(e){const t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,s=t[i];e._cacheIndex=i,t[i]=e,s._cacheIndex=n,t[n]=s}_lendControlInterpolant(){const e=this._controlInterpolants,t=this._nActiveControlInterpolants++;let n=e[t];return n===void 0&&(n=new Cb(new Float32Array(2),new Float32Array(2),1,Ky),n.__cacheIndex=t,e[t]=n),n}_takeBackControlInterpolant(e){const t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,s=t[i];e.__cacheIndex=i,t[i]=e,s.__cacheIndex=n,t[n]=s}clipAction(e,t,n){const i=t||this._root,s=i.uuid;let a=typeof e=="string"?Zd.findByName(i,e):e;const o=a!==null?a.uuid:e,c=this._actionsByClip[o];let l=null;if(n===void 0&&(a!==null?n=a.blendMode:n=Uf),c!==void 0){const u=c.actionByRoot[s];if(u!==void 0&&u.blendMode===n)return u;l=c.knownActions[0],a===null&&(a=l._clip)}if(a===null)return null;const h=new Xy(this,a,t,n);return this._bindAction(h,l),this._addInactiveAction(h,o,s),h}existingAction(e,t){const n=t||this._root,i=n.uuid,s=typeof e=="string"?Zd.findByName(n,e):e,a=s?s.uuid:e,o=this._actionsByClip[a];return o!==void 0&&o.actionByRoot[i]||null}stopAllAction(){const e=this._actions,t=this._nActiveActions;for(let n=t-1;n>=0;--n)e[n].stop();return this}update(e){e*=this.timeScale;const t=this._actions,n=this._nActiveActions,i=this.time+=e,s=Math.sign(e),a=this._accuIndex^=1;for(let l=0;l!==n;++l)t[l]._update(i,e,s,a);const o=this._bindings,c=this._nActiveBindings;for(let l=0;l!==c;++l)o[l].apply(a);return this}setTime(e){this.time=0;for(let t=0;t<this._actions.length;t++)this._actions[t].time=0;return this.update(e)}getRoot(){return this._root}uncacheClip(e){const t=this._actions,n=e.uuid,i=this._actionsByClip,s=i[n];if(s!==void 0){const a=s.knownActions;for(let o=0,c=a.length;o!==c;++o){const l=a[o];this._deactivateAction(l);const h=l._cacheIndex,u=t[t.length-1];l._cacheIndex=null,l._byClipCacheIndex=null,u._cacheIndex=h,t[h]=u,t.pop(),this._removeInactiveBindingsForAction(l)}delete i[n]}}uncacheRoot(e){const t=e.uuid,n=this._actionsByClip;for(const a in n){const o=n[a].actionByRoot,c=o[t];c!==void 0&&(this._deactivateAction(c),this._removeInactiveAction(c))}const i=this._bindingsByRootAndName,s=i[t];if(s!==void 0)for(const a in s){const o=s[a];o.restoreOriginalState(),this._removeInactiveBinding(o)}}uncacheAction(e,t){const n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}}class Yf{constructor(e){this.value=e}clone(){return new Yf(this.value.clone===void 0?this.value:this.value.clone())}}const vA=new Oe;class $y{constructor(e,t,n=0,i=1/0){this.ray=new qo(e,t),this.near=n,this.far=i,this.camera=null,this.layers=new Gf,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(e,t){this.ray.set(e,t)}setFromCamera(e,t){t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this.camera=t):t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this.camera=t):Pe("Raycaster: 
vendor: 8,184 bytes, lines 44-107
44Unsupported camera type: "+t.type)}setFromXRController(e){return vA.identity().extractRotation(e.matrixWorld),this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(vA),this}intersectObject(e,t=!0,n=[]){return tf(e,this,n,t),n.sort(yA),n}intersectObjects(e,t=!0,n=[]){for(let i=0,s=e.length;i<s;i++)tf(e[i],this,n,t);return n.sort(yA),n}}function yA(r,e){return r.distance-e.distance}function tf(r,e,t,n){let i=!0;if(r.layers.test(e.layers)&&r.raycast(e,t)===!1&&(i=!1),i===!0&&n===!0){const s=r.children;for(let a=0,o=s.length;a<o;a++)tf(s[a],e,t,!0)}}class ul{constructor(e=1,t=0,n=0){this.radius=e,this.phi=t,this.theta=n}set(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this}copy(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this}makeSafe(){return this.phi=We(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(e){return this.setFromCartesianCoords(e.x,e.y,e.z)}setFromCartesianCoords(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(We(t/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}function SA(r,e,t,n){const i=Yy(n);switch(t){case Y0:return r*e;case ds:return r*e/i.components*i.byteLength;case Pf:return r*e/i.components*i.byteLength;case Jn:return r*e*2/i.components*i.byteLength;case Ff:return r*e*2/i.components*i.byteLength;case Ro:return r*e*3/i.components*i.byteLength;case Tt:return r*e*4/i.components*i.byteLength;case Nf:return r*e*4/i.components*i.byteLength;case Kr:case Js:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case ll:case Zs:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Ld:case Bo:return Math.max(r,16)*Math.max(e,8)/4;case _l:case oa:return Math.max(r,8)*Math.max(e,8)/2;case vl:case Do:case yl:case Sl:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*8;case Lo:case Cl:case Ml:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case er:return Math.floor((r+3)/4)*Math.floor((e+3)/4)*16;case Pd:return Math.floor((r+4)/5)*Math.floor((e+3)/4)*16;case Fd:return Math.floor((r+4)/5)*Math.floor((e+4)/5)*16;case Nd:return Math.floor((r+5)/6)*Math.floor((e+4)/5)*16;case $r:return Math.floor((r+5)/6)*Math.floor((e+5)/6)*16;case Ud:return Math.floor((r+7)/8)*Math.floor((e+4)/5)*16;case Od:return Math.floor((r+7)/8)*Math.floor((e+5)/6)*16;case kd:return Math.floor((r+7)/8)*Math.floor((e+7)/8)*16;case Qd:return Math.floor((r+9)/10)*Math.floor((e+4)/5)*16;case Gd:return Math.floor((r+9)/10)*Math.floor((e+5)/6)*16;case Hd:return Math.floor((r+9)/10)*Math.floor((e+7)/8)*16;case zd:return Math.floor((r+9)/10)*Math.floor((e+9)/10)*16;case Vd:return Math.floor((r+11)/12)*Math.floor((e+9)/10)*16;case Wd:return Math.floor((r+11)/12)*Math.floor((e+11)/12)*16;case ca:case qd:case Il:return Math.ceil(r/4)*Math.ceil(e/4)*16;case wl:case Tl:return Math.ceil(r/4)*Math.ceil(e/4)*8;case Rl:case Bl:return Math.ceil(r/4)*Math.ceil(e/4)*16}throw new Error(`Unable to determine texture byte length for ${t} format.`)}function Yy(r){switch(r){case Le:case Rf:return{byteLength:1,components:1};case wo:case Bf:case yt:return{byteLength:2,components:1};case Df:case Lf:return{byteLength:2,components:4};case ii:case Zl:case Nt:return{byteLength:4,components:1};case eh:case th:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${r}.`)}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Yl}}));typeof window<"u"&&(window.__THREE__?Ie("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Yl);/**
45 * @license
46 * Copyright 2010-2026 Three.js Authors
47 * SPDX-License-Identifier: MIT
48 */function Db(){let r=null,e=!1,t=null,n=null;function i(s,a){t(s,a),n=r.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(n=r.requestAnimationFrame(i),e=!0)},stop:function(){r.cancelAnimationFrame(n),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){r=s}}}function Jy(r){const e=new WeakMap;function t(o,c){const l=o.array,h=o.usage,u=l.byteLength,d=r.createBuffer();r.bindBuffer(c,d),r.bufferData(c,l,h),o.onUploadCallback();let f;if(l instanceof Float32Array)f=r.FLOAT;else if(typeof Float16Array<"u"&&l instanceof Float16Array)f=r.HALF_FLOAT;else if(l instanceof Uint16Array)o.isFloat16BufferAttribute?f=r.HALF_FLOAT:f=r.UNSIGNED_SHORT;else if(l instanceof Int16Array)f=r.SHORT;else if(l instanceof Uint32Array)f=r.UNSIGNED_INT;else if(l instanceof Int32Array)f=r.INT;else if(l instanceof Int8Array)f=r.BYTE;else if(l instanceof Uint8Array)f=r.UNSIGNED_BYTE;else if(l instanceof Uint8ClampedArray)f=r.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+l);return{buffer:d,type:f,bytesPerElement:l.BYTES_PER_ELEMENT,version:o.version,size:u}}function n(o,c,l){const h=c.array,u=c.updateRanges;if(r.bindBuffer(l,o),u.length===0)r.bufferSubData(l,0,h);else{u.sort((f,p)=>f.start-p.start);let d=0;for(let f=1;f<u.length;f++){const p=u[d],m=u[f];m.start<=p.start+p.count+1?p.count=Math.max(p.count,m.start+m.count-p.start):(++d,u[d]=m)}u.length=d+1;for(let f=0,p=u.length;f<p;f++){const m=u[f];r.bufferSubData(l,m.start*h.BYTES_PER_ELEMENT,h,m.start,m.count)}c.clearUpdateRanges()}c.onUploadCallback()}function i(o){return o.isInterleavedBufferAttribute&&(o=o.data),e.get(o)}function s(o){o.isInterleavedBufferAttribute&&(o=o.data);const c=e.get(o);c&&(r.deleteBuffer(c.buffer),e.delete(o))}function a(o,c){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const h=e.get(o);(!h||h.version<o.version)&&e.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}const l=e.get(o);if(l===void 0)e.set(o,t(o,c));else if(l.version<o.version){if(l.size!==o.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.");n(l.buffer,o,c),l.version=o.version}}return{get:i,remove:s,update:a}}var Zy=`#ifdef USE_ALPHAHASH
49	if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
50#endif`,eS=`#ifdef USE_ALPHAHASH
51	const float ALPHA_HASH_SCALE = 0.05;
52	float hash2D( vec2 value ) {
53		return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
54	}
55	float hash3D( vec3 value ) {
56		return hash2D( vec2( hash2D( value.xy ), value.z ) );
57	}
58	float getAlphaHashThreshold( vec3 position ) {
59		float maxDeriv = max(
60			length( dFdx( position.xyz ) ),
61			length( dFdy( position.xyz ) )
62		);
63		float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
64		vec2 pixScales = vec2(
65			exp2( floor( log2( pixScale ) ) ),
66			exp2( ceil( log2( pixScale ) ) )
67		);
68		vec2 alpha = vec2(
69			hash3D( floor( pixScales.x * position.xyz ) ),
70			hash3D( floor( pixScales.y * position.xyz ) )
71		);
72		float lerpFactor = fract( log2( pixScale ) );
73		float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
74		float a = min( lerpFactor, 1.0 - lerpFactor );
75		vec3 cases = vec3(
76			x * x / ( 2.0 * a * ( 1.0 - a ) ),
77			( x - 0.5 * a ) / ( 1.0 - a ),
78			1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
79		);
80		float threshold = ( x < ( 1.0 - a ) )
81			? ( ( x < a ) ? cases.x : cases.y )
82			: cases.z;
83		return clamp( threshold , 1.0e-6, 1.0 );
84	}
85#endif`,tS=`#ifdef USE_ALPHAMAP
86	diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
87#endif`,nS=`#ifdef USE_ALPHAMAP
88	uniform sampler2D alphaMap;
89#endif`,iS=`#ifdef USE_ALPHATEST
90	#ifdef ALPHA_TO_COVERAGE
91	diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
92	if ( diffuseColor.a == 0.0 ) discard;
93	#else
94	if ( diffuseColor.a < alphaTest ) discard;
95	#endif
96#endif`,sS=`#ifdef USE_ALPHATEST
97	uniform float alphaTest;
98#endif`,rS=`#ifdef USE_AOMAP
99	float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
100	reflectedLight.indirectDiffuse *= ambientOcclusion;
101	#if defined( USE_CLEARCOAT ) 
102		clearcoatSpecularIndirect *= ambientOcclusion;
103	#endif
104	#if defined( USE_SHEEN ) 
105		sheenSpecularIndirect *= ambientOcclusion;
106	#endif
107	#if defined( USE_ENVMAP ) && defined( STANDARD )
108		float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
109		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
110	#endif
111#endif`,aS=`#ifdef USE_AOMAP
112	uniform sampler2D aoMap;
113	uniform float aoMapIntensity;
114#endif`,oS=`#ifdef USE_BATCHING
115	#if ! defined( GL_ANGLE_multi_draw )
116	#define gl_DrawID _gl_DrawID
117	uniform int _gl_DrawID;
118	#endif
119	uniform highp sampler2D batchingTexture;
120	uniform highp usampler2D batchingIdTexture;
121	mat4 getBatchingMatrix( const in float i ) {
122		int size = textureSize( batchingTexture, 0 ).x;
123		int j = int( i ) * 4;
124		int x = j % size;
125		int y = j / size;
126		vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
127		vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
128		vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
129		vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
130		return mat4( v1, v2, v3, v4 );
131	}
132	float getIndirectIndex( const in int i ) {
133		int size = textureSize( batchingIdTexture, 0 ).x;
134		int x = i % size;
135		int y = i / size;
136		return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
137	}
138#endif
139#ifdef USE_BATCHING_COLOR
140	uniform sampler2D batchingColorTexture;
141	vec4 getBatchingColor( const in float i ) {
142		int size = textureSize( batchingColorTexture, 0 ).x;
143		int j = int( i );
144		int x = j % size;
145		int y = j / size;
146		return texelFetch( batchingColorTexture, ivec2( x, y ), 0 );
147	}
148#endif`,cS=`#ifdef USE_BATCHING
149	mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
150#endif`,lS=`vec3 transformed = vec3( position );
151#ifdef USE_ALPHAHASH
152	vPosition = vec3( position );
153#endif`,hS=`vec3 objectNormal = vec3( normal );
154#ifdef USE_TANGENT
155	vec3 objectTangent = vec3( tangent.xyz );
156#endif`,uS=`float G_BlinnPhong_Implicit( ) {
157	return 0.25;
158}
159float D_BlinnPhong( const in float shininess, const in float dotNH ) {
160	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
161}
162vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
163	vec3 halfDir = normalize( lightDir + viewDir );
164	float dotNH = saturate( dot( normal, halfDir ) );
165	float dotVH = saturate( dot( viewDir, halfDir ) );
166	vec3 F = F_Schlick( specularColor, 1.0, dotVH );
167	float G = G_BlinnPhong_Implicit( );
168	float D = D_BlinnPhong( shininess, dotNH );
169	return F * ( G * D );
170} // validated`,dS=`#ifdef USE_IRIDESCENCE
171	const mat3 XYZ_TO_REC709 = mat3(
172		 3.2404542, -0.9692660,  0.0556434,
173		-1.5371385,  1.8760108, -0.2040259,
174		-0.4985314,  0.0415560,  1.0572252
175	);
176	vec3 Fresnel0ToIor( vec3 fresnel0 ) {
177		vec3 sqrtF0 = sqrt( fresnel0 );
178		return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
179	}
180	vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
181		return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
182	}
183	float IorToFresnel0( float transmittedIor, float incidentIor ) {
184		return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
185	}
186	vec3 evalSensitivity( float OPD, vec3 shift ) {
187		float phase = 2.0 * PI * OPD * 1.0e-9;
188		vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
189		vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
190		vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
191		vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
192		xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
193		xyz /= 1.0685e-7;
194		vec3 rgb = XYZ_TO_REC709 * xyz;
195		return rgb;
196	}
197	vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
198		vec3 I;
199		float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
200		float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
201		float cosTheta2Sq = 1.0 - sinTheta2Sq;
202		if ( cosTheta2Sq < 0.0 ) {
203			return vec3( 1.0 );
204		}
205		float cosTheta2 = sqrt( cosTheta2Sq );
206		float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
207		float R12 = F_Schlick( R0, 1.0, cosTheta1 );
208		float T121 = 1.0 - R12;
209		float phi12 = 0.0;
210		if ( iridescenceIOR < outsideIOR ) phi12 = PI;
211		float phi21 = PI - phi12;
212		vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );		vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
213		vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
214		vec3 phi23 = vec3( 0.0 );
215		if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
216		if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
217		if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
218		float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
219		vec3 phi = vec3( phi21 ) + phi23;
220		vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
221		vec3 r123 = sqrt( R123 );
222		vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
223		vec3 C0 = R12 + Rs;
224		I = C0;
225		vec3 Cm = Rs - T121;
226		for ( int m = 1; m <= 2; ++ m ) {
227			Cm *= r123;
228			vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
229			I += Cm * Sm;
230		}
231		return max( I, vec3( 0.0 ) );
232	}
233#endif`,fS=`#ifdef USE_BUMPMAP
234	uniform sampler2D bumpMap;
235	uniform float bumpScale;
236	vec2 dHdxy_fwd() {
237		vec2 dSTdx = dFdx( vBumpMapUv );
238		vec2 dSTdy = dFdy( vBumpMapUv );
239		float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
240		float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
241		float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
242		return vec2( dBx, dBy );
243	}
244	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
245		vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
246		vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
247		vec3 vN = surf_norm;
248		vec3 R1 = cross( vSigmaY, vN );
249		vec3 R2 = cross( vN, vSigmaX );
250		float fDet = dot( vSigmaX, R1 ) * faceDirection;
251		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
252		return normalize( abs( fDet ) * surf_norm - vGrad );
253	}
254#endif`,pS=`#if NUM_CLIPPING_PLANES > 0
255	vec4 plane;
256	#ifdef ALPHA_TO_COVERAGE
257		float distanceToPlane, distanceGradient;
258		float clipOpacity = 1.0;
259		#pragma unroll_loop_start
260		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
261			plane = clippingPlanes[ i ];
262			distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
263			distanceGradient = fwidth( distanceToPlane ) / 2.0;
264			clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
265			if ( clipOpacity == 0.0 ) discard;
266		}
267		#pragma unroll_loop_end
268		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
269			float unionClipOpacity = 1.0;
270			#pragma unroll_loop_start
271			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
272				plane = clippingPlanes[ i ];
273				distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
274				distanceGradient = fwidth( distanceToPlane ) / 2.0;
275				unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
276			}
277			#pragma unroll_loop_end
278			clipOpacity *= 1.0 - unionClipOpacity;
279		#endif
280		diffuseColor.a *= clipOpacity;
281		if ( diffuseColor.a == 0.0 ) discard;
282	#else
283		#pragma unroll_loop_start
284		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
285			plane = clippingPlanes[ i ];
286			if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
287		}
288		#pragma unroll_loop_end
289		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
290			bool clipped = true;
291			#pragma unroll_loop_start
292			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
293				plane = clippingPlanes[ i ];
294				clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
295			}
296			#pragma unroll_loop_end
297			if ( clipped ) discard;
298		#endif
299	#endif
300#endif`,AS=`#if NUM_CLIPPING_PLANES > 0
301	varying vec3 vClipPosition;
302	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
303#endif`,gS=`#if NUM_CLIPPING_PLANES > 0
304	varying vec3 vClipPosition;
305#endif`,mS=`#if NUM_CLIPPING_PLANES > 0
306	vClipPosition = - mvPosition.xyz;
307#endif`,bS=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
308	diffuseColor *= vColor;
309#endif`,xS=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA )
310	varying vec4 vColor;
311#endif`,ES=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
312	varying vec4 vColor;
313#endif`,_S=`#if defined( USE_COLOR ) || defined( USE_COLOR_ALPHA ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
314	vColor = vec4( 1.0 );
315#endif
316#ifdef USE_COLOR_ALPHA
317	vColor *= color;
318#elif defined( USE_COLOR )
319	vColor.rgb *= color;
320#endif
321#ifdef USE_INSTANCING_COLOR
322	vColor.rgb *= instanceColor.rgb;
323#endif
324#ifdef USE_BATCHING_COLOR
325	vColor *= getBatchingColor( getIndirectIndex( gl_DrawID ) );
326#endif`,vS=`#define PI 3.141592653589793
327#define PI2 6.283185307179586
328#define PI_HALF 1.5707963267948966
329#define RECIPROCAL_PI 0.3183098861837907
330#define RECIPROCAL_PI2 0.15915494309189535
331#define EPSILON 1e-6
332#ifndef saturate
333#define saturate( a ) clamp( a, 0.0, 1.0 )
334#endif
335#define whiteComplement( a ) ( 1.0 - saturate( a ) )
336float pow2( const in float x ) { return x*x; }
337vec3 pow2( const in vec3 x ) { return x*x; }
338float pow3( const in float x ) { return x*x*x; }
339float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
340float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
341float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
342highp float rand( const in vec2 uv ) {
343	const highp float a = 12.9898, b = 78.233, c = 43758.5453;
344	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
345	return fract( sin( sn ) * c );
346}
347#ifdef HIGH_PRECISION
348	float precisionSafeLength( vec3 v ) { return length( v ); }
349#else
350	float precisionSafeLength( vec3 v ) {
351		float maxComponent = max3( abs( v ) );
352		return length( v / maxComponent ) * maxComponent;
353	}
354#endif
355struct IncidentLight {
356	vec3 color;
357	vec3 direction;
358	bool visible;
359};
360struct ReflectedLight {
361	vec3 directDiffuse;
362	vec3 directSpecular;
363	vec3 indirectDiffuse;
364	vec3 indirectSpecular;
365};
366#ifdef USE_ALPHAHASH
367	varying vec3 vPosition;
368#endif
369vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
370	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
371}
372vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
373	return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
374}
375bool isPerspectiveMatrix( mat4 m ) {
376	return m[ 2 ][ 3 ] == - 1.0;
377}
378vec2 equirectUv( in vec3 dir ) {
379	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
380	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
381	return vec2( u, v );
382}
383vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
384	return RECIPROCAL_PI * diffuseColor;
385}
386vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
387	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
388	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
389}
390float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
391	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
392	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
393} // validated`,yS=`#ifdef ENVMAP_TYPE_CUBE_UV
394	#define cubeUV_minMipLevel 4.0
395	#define cubeUV_minTileSize 16.0
396	float getFace( vec3 direction ) {
397		vec3 absDirection = abs( direction );
398		float face = - 1.0;
399		if ( absDirection.x > absDirection.z ) {
400			if ( absDirection.x > absDirection.y )
401				face = direction.x > 0.0 ? 0.0 : 3.0;
402			else
403				face = direction.y > 0.0 ? 1.0 : 4.0;
404		} else {
405			if ( absDirection.z > absDirection.y )
406				face = direction.z > 0.0 ? 2.0 : 5.0;
407			else
408				face = direction.y > 0.0 ? 1.0 : 4.0;
409		}
410		return face;
411	}
412	vec2 getUV( vec3 direction, float face ) {
413		vec2 uv;
414		if ( face == 0.0 ) {
415			uv = vec2( direction.z, direction.y ) / abs( direction.x );
416		} else if ( face == 1.0 ) {
417			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
418		} else if ( face == 2.0 ) {
419			uv = vec2( - direction.x, direction.y ) / abs( direction.z );
420		} else if ( face == 3.0 ) {
421			uv = vec2( - direction.z, direction.y ) / abs( direction.x );
422		} else if ( face == 4.0 ) {
423			uv = vec2( - direction.x, direction.z ) / abs( direction.y );
424		} else {
425			uv = vec2( direction.x, direction.y ) / abs( direction.z );
426		}
427		return 0.5 * ( uv + 1.0 );
428	}
429	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
430		float face = getFace( direction );
431		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
432		mipInt = max( mipInt, cubeUV_minMipLevel );
433		float faceSize = exp2( mipInt );
434		highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
435		if ( face > 2.0 ) {
436			uv.y += faceSize;
437			face -= 3.0;
438		}
439		uv.x += face * faceSize;
440		uv.x += filterInt * 3.0 * cubeUV_minTileSize;
441		uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
442		uv.x *= CUBEUV_TEXEL_WIDTH;
443		uv.y *= CUBEUV_TEXEL_HEIGHT;
444		#ifdef texture2DGradEXT
445			return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
446		#else
447			return texture2D( envMap, uv ).rgb;
448		#endif
449	}
450	#define cubeUV_r0 1.0
451	#define cubeUV_m0 - 2.0
452	#define cubeUV_r1 0.8
453	#define cubeUV_m1 - 1.0
454	#define cubeUV_r4 0.4
455	#define cubeUV_m4 2.0
456	#define cubeUV_r5 0.305
457	#define cubeUV_m5 3.0
458	#define cubeUV_r6 0.21
459	#define cubeUV_m6 4.0
460	float roughnessToMip( float roughness ) {
461		float mip = 0.0;
462		if ( roughness >= cubeUV_r1 ) {
463			mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
464		} else if ( roughness >= cubeUV_r4 ) {
465			mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
466		} else if ( roughness >= cubeUV_r5 ) {
467			mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
468		} else if ( roughness >= cubeUV_r6 ) {
469			mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
470		} else {
471			mip = - 2.0 * log2( 1.16 * roughness );		}
472		return mip;
473	}
474	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
475		float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
476		float mipF = fract( mip );
477		float mipInt = floor( mip );
478		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
479		if ( mipF == 0.0 ) {
480			return vec4( color0, 1.0 );
481		} else {
482			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
483			return vec4( mix( color0, color1, mipF ), 1.0 );
484		}
485	}
486#endif`,SS=`vec3 transformedNormal = objectNormal;
487#ifdef USE_TANGENT
488	vec3 transformedTangent = objectTangent;
489#endif
490#ifdef USE_BATCHING
491	mat3 bm = mat3( batchingMatrix );
492	transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
493	transformedNormal = bm * transformedNormal;
494	#ifdef USE_TANGENT
495		transformedTangent = bm * transformedTangent;
496	#endif
497#endif
498#ifdef USE_INSTANCING
499	mat3 im = mat3( instanceMatrix );
500	transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
501	transformedNormal = im * transformedNormal;
502	#ifdef USE_TANGENT
503		transformedTangent = im * transformedTangent;
504	#endif
505#endif
506transformedNormal = normalMatrix * transformedNormal;
507#ifdef FLIP_SIDED
508	transformedNormal = - transformedNormal;
509#endif
510#ifdef USE_TANGENT
511	transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
512	#ifdef FLIP_SIDED
513		transformedTangent = - transformedTangent;
514	#endif
515#endif`,CS=`#ifdef USE_DISPLACEMENTMAP
516	uniform sampler2D displacementMap;
517	uniform float displacementScale;
518	uniform float displacementBias;
519#endif`,MS=`#ifdef USE_DISPLACEMENTMAP
520	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + dis
520placementBias );
521#endif`,IS=`#ifdef USE_EMISSIVEMAP
522	vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
523	#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
524		emissiveColor = sRGBTransferEOTF( emissiveColor );
525	#endif
526	totalEmissiveRadiance *= emissiveColor.rgb;
527#endif`,wS=`#ifdef USE_EMISSIVEMAP
528	uniform sampler2D emissiveMap;
529#endif`,TS="gl_FragColor = linearToOutputTexel( gl_FragColor );",RS=`vec4 LinearTransferOETF( in vec4 value ) {
530	return value;
531}
532vec4 sRGBTransferEOTF( in vec4 value ) {
533	return 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 );
534}
535vec4 sRGBTransferOETF( in vec4 value ) {
536	return 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 );
537}`,BS=`#ifdef USE_ENVMAP
538	#ifdef ENV_WORLDPOS
539		vec3 cameraToFrag;
540		if ( isOrthographic ) {
541			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
542		} else {
543			cameraToFrag = normalize( vWorldPosition - cameraPosition );
544		}
545		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
546		#ifdef ENVMAP_MODE_REFLECTION
547			vec3 reflectVec = reflect( cameraToFrag, worldNormal );
548		#else
549			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
550		#endif
551	#else
552		vec3 reflectVec = vReflect;
553	#endif
554	#ifdef ENVMAP_TYPE_CUBE
555		vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
556		#ifdef ENVMAP_BLENDING_MULTIPLY
557			outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
558		#elif defined( ENVMAP_BLENDING_MIX )
559			outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
560		#elif defined( ENVMAP_BLENDING_ADD )
561			outgoingLight += envColor.xyz * specularStrength * reflectivity;
562		#endif
563	#endif
564#endif`,DS=`#ifdef USE_ENVMAP
565	uniform float envMapIntensity;
566	uniform float flipEnvMap;
567	uniform mat3 envMapRotation;
568	#ifdef ENVMAP_TYPE_CUBE
569		uniform samplerCube envMap;
570	#else
571		uniform sampler2D envMap;
572	#endif
573#endif`,LS=`#ifdef USE_ENVMAP
574	uniform float reflectivity;
575	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
576		#define ENV_WORLDPOS
577	#endif
578	#ifdef ENV_WORLDPOS
579		varying vec3 vWorldPosition;
580		uniform float refractionRatio;
581	#else
582		varying vec3 vReflect;
583	#endif
584#endif`,PS=`#ifdef USE_ENVMAP
585	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
586		#define ENV_WORLDPOS
587	#endif
588	#ifdef ENV_WORLDPOS
589		
590		varying vec3 vWorldPosition;
591	#else
592		varying vec3 vReflect;
593		uniform float refractionRatio;
594	#endif
595#endif`,FS=`#ifdef USE_ENVMAP
596	#ifdef ENV_WORLDPOS
597		vWorldPosition = worldPosition.xyz;
598	#else
599		vec3 cameraToVertex;
600		if ( isOrthographic ) {
601			cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
602		} else {
603			cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
604		}
605		vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
606		#ifdef ENVMAP_MODE_REFLECTION
607			vReflect = reflect( cameraToVertex, worldNormal );
608		#else
609			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
610		#endif
611	#endif
612#endif`,NS=`#ifdef USE_FOG
613	vFogDepth = - mvPosition.z;
614#endif`,US=`#ifdef USE_FOG
615	varying float vFogDepth;
616#endif`,OS=`#ifdef USE_FOG
617	#ifdef FOG_EXP2
618		float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
619	#else
620		float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
621	#endif
622	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
623#endif`,kS=`#ifdef USE_FOG
624	uniform vec3 fogColor;
625	varying float vFogDepth;
626	#ifdef FOG_EXP2
627		uniform float fogDensity;
628	#else
629		uniform float fogNear;
630		uniform float fogFar;
631	#endif
632#endif`,QS=`#ifdef USE_GRADIENTMAP
633	uniform sampler2D gradientMap;
634#endif
635vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
636	float dotNL = dot( normal, lightDirection );
637	vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
638	#ifdef USE_GRADIENTMAP
639		return vec3( texture2D( gradientMap, coord ).r );
640	#else
641		vec2 fw = fwidth( coord ) * 0.5;
642		return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
643	#endif
644}`,GS=`#ifdef USE_LIGHTMAP
645	uniform sampler2D lightMap;
646	uniform float lightMapIntensity;
647#endif`,HS=`LambertMaterial material;
648material.diffuseColor = diffuseColor.rgb;
649material.specularStrength = specularStrength;`,zS=`varying vec3 vViewPosition;
650struct LambertMaterial {
651	vec3 diffuseColor;
652	float specularStrength;
653};
654void 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 ) {
655	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
656	vec3 irradiance = dotNL * directLight.color;
657	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
658}
659void 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 ) {
660	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
661}
662#define RE_Direct				RE_Direct_Lambert
663#define RE_IndirectDiffuse		RE_IndirectDiffuse_Lambert`,VS=`uniform bool receiveShadow;
664uniform vec3 ambientLightColor;
665#if defined( USE_LIGHT_PROBES )
666	uniform vec3 lightProbe[ 9 ];
667#endif
668vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
669	float x = normal.x, y = normal.y, z = normal.z;
670	vec3 result = shCoefficients[ 0 ] * 0.886227;
671	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
672	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
673	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
674	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
675	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
676	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
677	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
678	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
679	return result;
680}
681vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
682	vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
683	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
684	return irradiance;
685}
686vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
687	vec3 irradiance = ambientLightColor;
688	return irradiance;
689}
690float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
691	float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
692	if ( cutoffDistance > 0.0 ) {
693		distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
694	}
695	return distanceFalloff;
696}
697float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
698	return smoothstep( coneCosine, penumbraCosine, angleCosine );
699}
700#if NUM_DIR_LIGHTS > 0
701	struct DirectionalLight {
702		vec3 direction;
703		vec3 color;
704	};
705	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
706	void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
707		light.color = directionalLight.color;
708		light.direction = directionalLight.direction;
709		light.visible = true;
710	}
711#endif
712#if NUM_POINT_LIGHTS > 0
713	struct PointLight {
714		vec3 position;
715		vec3 color;
716		float distance;
717		float decay;
718	};
719	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
720	void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
721		vec3 lVector = pointLight.position - geometryPosition;
722		light.direction = normalize( lVector );
723		float lightDistance = length( lVector );
724		light.color = pointLight.color;
725		light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
726		light.visible = ( light.color != vec3( 0.0 ) );
727	}
728#endif
729#if NUM_SPOT_LIGHTS > 0
730	struct SpotLight {
731		vec3 position;
732		vec3 direction;
733		vec3 color;
734		float distance;
735		float decay;
736		float coneCos;
737		float penumbraCos;
738	};
739	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
740	void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
741		vec3 lVector = spotLight.position - geometryPosition;
742		light.direction = normalize( lVector );
743		float angleCos = dot( light.direction, spotLight.direction );
744		float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
745		if ( spotAttenuation > 0.0 ) {
746			float lightDistance = length( lVector );
747			light.color = spotLight.color * spotAttenuation;
748			light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
749			light.visible = ( light.color != vec3( 0.0 ) );
750		} else {
751			light.color = vec3( 0.0 );
752			light.visible = false;
753		}
754	}
755#endif
756#if NUM_RECT_AREA_LIGHTS > 0
757	struct RectAreaLight {
758		vec3 color;
759		vec3 position;
760		vec3 halfWidth;
761		vec3 halfHeight;
762	};
763	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;
764	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
765#endif
766#if NUM_HEMI_LIGHTS > 0
767	struct HemisphereLight {
768		vec3 direction;
769		vec3 skyColor;
770		vec3 groundColor;
771	};
772	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
773	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
774		float dotNL = dot( normal, hemiLight.direction );
775		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
776		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
777		return irradiance;
778	}
779#endif`,WS=`#ifdef USE_ENVMAP
780	vec3 getIBLIrradiance( const in vec3 normal ) {
781		#ifdef ENVMAP_TYPE_CUBE_UV
782			vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
783			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
784			return PI * envMapColor.rgb * envMapIntensity;
785		#else
786			return vec3( 0.0 );
787		#endif
788	}
789	vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
790		#ifdef ENVMAP_TYPE_CUBE_UV
791			vec3 reflectVec = reflect( - viewDir, normal );
792			reflectVec = normalize( mix( reflectVec, normal, pow4( roughness ) ) );
793			reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
794			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
795			return envMapColor.rgb * envMapIntensity;
796		#else
797			return vec3( 0.0 );
798		#endif
799	}
800	#ifdef USE_ANISOTROPY
801		vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
802			#ifdef ENVMAP_TYPE_CUBE_UV
803				vec3 bentNormal = cross( bitangent, viewDir );
804				bentNormal = normalize( cross( bentNormal, bitangent ) );
805				bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
806				return getIBLRadiance( viewDir, bentNormal, roughness );
807			#else
808				return vec3( 0.0 );
809			#endif
810		}
811	#endif
812#endif`,qS=`ToonMaterial material;
813material.diffuseColor = diffuseColor.rgb;`,jS=`varying vec3 vViewPosition;
814struct ToonMaterial {
815	vec3 diffuseColor;
816};
817void 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 ) {
818	vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
819	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
820}
821void 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 ) {
822	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
823}
824#define RE_Direct				RE_Direct_Toon
825#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon`,XS=`BlinnPhongMaterial material;
826material.diffuseColor = diffuseColor.rgb;
827material.specularColor = specular;
828material.specularShininess = shininess;
829material.specularStrength = specularStrength;`,KS=`varying vec3 vViewPosition;
830struct BlinnPhongMaterial {
831	vec3 diffuseColor;
832	vec3 specularColor;
833	float specularShininess;
834	float specularStrength;
835};
836void 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 ) {
837	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
838	vec3 irradiance = dotNL * directLight.color;
839	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
840	reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
841}
842void 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 ) {
843	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
844}
845#define RE_Direct				RE_Direct_BlinnPhong
846#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong`,$S=`PhysicalMaterial material;
847material.diffuseColor = diffuseColor.rgb;
848material.diffuseContribution = diffuseColor.rgb * ( 1.0 - metalnessFactor );
849material.metalness = metalnessFactor;
850vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
851float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
852material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
853material.roughness = min( material.roughness, 1.0 );
854#ifdef IOR
855	material.ior = ior;
856	#ifdef USE_SPECULAR
857		float specularIntensityFactor = specularIntensity;
858		vec3 specularColorFactor = specularColor;
859		#ifdef USE_SPECULAR_COLORMAP
860			specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
861		#endif
862		#ifdef USE_SPECULAR_INTENSITYMAP
863			specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
864		#endif
865		material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
866	#else
867		float specularIntensityFactor = 1.0;
868		vec3 specularColorFactor = vec3( 1.0 );
869		material.specularF90 = 1.0;
870	#endif
871	material.specularColor = min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor;
872	material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
873#else
874	material.specularColor = vec3( 0.04 );
875	material.specularColorBlended = mix( material.specularColor, diffuseColor.rgb, metalnessFactor );
876	material.specularF90 = 1.0;
877#endif
878#ifdef USE_CLEARCOAT
879	material.clearcoat = clearcoat;
880	material.clearcoatRoughness = clearcoatRoughness;
881	material.clearcoatF0 = vec3( 0.04 );
882	material.clearcoatF90 = 1.0;
883	#ifdef USE_CLEARCOATMAP
884		material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
885	#endif
886	#ifdef USE_CLEARCOAT_ROUGHNESSMAP
887		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
888	#endif
889	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
890	material.clearcoatRoughness += geometryRoughness;
891	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
892#endif
893#ifdef USE_DISPERSION
894	material.dispersion = dispersion;
895#endif
896#ifdef USE_IRIDESCENCE
897	material.iridescence = iridescence;
898	material.iridescenceIOR = iridescenceIOR;
899	#ifdef USE_IRIDESCENCEMAP
900		material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
901	#endif
902	#ifdef USE_IRIDESCENCE_THICKNESSMAP
903		material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
904	#else
905		material.iridescenceThickness = iridescenceThicknessMaximum;
906	#endif
907#endif
908#ifdef USE_SHEEN
909	material.sheenColor = sheenColor;
910	#ifdef USE_SHEEN_COLORMAP
911		material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
912	#endif
913	material.sheenRoughness = clamp( sheenRoughness, 0.0001, 1.0 );
914	#ifdef USE_SHEEN_ROUGHNESSMAP
915		material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
916	#endif
917#endif
918#ifdef USE_ANISOTROPY
919	#ifdef USE_ANISOTROPYMAP
920		mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
921		vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
922		vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
923	#else
924		vec2 anisotropyV = anisotropyVector;
925	#endif
926	material.anisotropy = length( anisotropyV );
927	if( material.anisotropy == 0.0 ) {
928		anisotropyV = vec2( 1.0, 0.0 );
929	} else {
930		anisotropyV /= material.anisotropy;
931		material.anisotropy = saturate( material.anisotropy );
932	}
933	material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
934	material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
935	material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
936#endif`,YS
vendor: 9,654 bytes, lines 936-1167
936=`uniform sampler2D dfgLUT;
937struct PhysicalMaterial {
938	vec3 diffuseColor;
939	vec3 diffuseContribution;
940	vec3 specularColor;
941	vec3 specularColorBlended;
942	float roughness;
943	float metalness;
944	float specularF90;
945	float dispersion;
946	#ifdef USE_CLEARCOAT
947		float clearcoat;
948		float clearcoatRoughness;
949		vec3 clearcoatF0;
950		float clearcoatF90;
951	#endif
952	#ifdef USE_IRIDESCENCE
953		float iridescence;
954		float iridescenceIOR;
955		float iridescenceThickness;
956		vec3 iridescenceFresnel;
957		vec3 iridescenceF0;
958		vec3 iridescenceFresnelDielectric;
959		vec3 iridescenceFresnelMetallic;
960	#endif
961	#ifdef USE_SHEEN
962		vec3 sheenColor;
963		float sheenRoughness;
964	#endif
965	#ifdef IOR
966		float ior;
967	#endif
968	#ifdef USE_TRANSMISSION
969		float transmission;
970		float transmissionAlpha;
971		float thickness;
972		float attenuationDistance;
973		vec3 attenuationColor;
974	#endif
975	#ifdef USE_ANISOTROPY
976		float anisotropy;
977		float alphaT;
978		vec3 anisotropyT;
979		vec3 anisotropyB;
980	#endif
981};
982vec3 clearcoatSpecularDirect = vec3( 0.0 );
983vec3 clearcoatSpecularIndirect = vec3( 0.0 );
984vec3 sheenSpecularDirect = vec3( 0.0 );
985vec3 sheenSpecularIndirect = vec3(0.0 );
986vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
987    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
988    float x2 = x * x;
989    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
990    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
991}
992float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
993	float a2 = pow2( alpha );
994	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
995	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
996	return 0.5 / max( gv + gl, EPSILON );
997}
998float D_GGX( const in float alpha, const in float dotNH ) {
999	float a2 = pow2( alpha );
1000	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
1001	return RECIPROCAL_PI * a2 / pow2( denom );
1002}
1003#ifdef USE_ANISOTROPY
1004	float 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 ) {
1005		float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
1006		float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
1007		float v = 0.5 / ( gv + gl );
1008		return v;
1009	}
1010	float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
1011		float a2 = alphaT * alphaB;
1012		highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
1013		highp float v2 = dot( v, v );
1014		float w2 = a2 / v2;
1015		return RECIPROCAL_PI * a2 * pow2 ( w2 );
1016	}
1017#endif
1018#ifdef USE_CLEARCOAT
1019	vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
1020		vec3 f0 = material.clearcoatF0;
1021		float f90 = material.clearcoatF90;
1022		float roughness = material.clearcoatRoughness;
1023		float alpha = pow2( roughness );
1024		vec3 halfDir = normalize( lightDir + viewDir );
1025		float dotNL = saturate( dot( normal, lightDir ) );
1026		float dotNV = saturate( dot( normal, viewDir ) );
1027		float dotNH = saturate( dot( normal, halfDir ) );
1028		float dotVH = saturate( dot( viewDir, halfDir ) );
1029		vec3 F = F_Schlick( f0, f90, dotVH );
1030		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
1031		float D = D_GGX( alpha, dotNH );
1032		return F * ( V * D );
1033	}
1034#endif
1035vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
1036	vec3 f0 = material.specularColorBlended;
1037	float f90 = material.specularF90;
1038	float roughness = material.roughness;
1039	float alpha = pow2( roughness );
1040	vec3 halfDir = normalize( lightDir + viewDir );
1041	float dotNL = saturate( dot( normal, lightDir ) );
1042	float dotNV = saturate( dot( normal, viewDir ) );
1043	float dotNH = saturate( dot( normal, halfDir ) );
1044	float dotVH = saturate( dot( viewDir, halfDir ) );
1045	vec3 F = F_Schlick( f0, f90, dotVH );
1046	#ifdef USE_IRIDESCENCE
1047		F = mix( F, material.iridescenceFresnel, material.iridescence );
1048	#endif
1049	#ifdef USE_ANISOTROPY
1050		float dotTL = dot( material.anisotropyT, lightDir );
1051		float dotTV = dot( material.anisotropyT, viewDir );
1052		float dotTH = dot( material.anisotropyT, halfDir );
1053		float dotBL = dot( material.anisotropyB, lightDir );
1054		float dotBV = dot( material.anisotropyB, viewDir );
1055		float dotBH = dot( material.anisotropyB, halfDir );
1056		float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
1057		float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
1058	#else
1059		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
1060		float D = D_GGX( alpha, dotNH );
1061	#endif
1062	return F * ( V * D );
1063}
1064vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
1065	const float LUT_SIZE = 64.0;
1066	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
1067	const float LUT_BIAS = 0.5 / LUT_SIZE;
1068	float dotNV = saturate( dot( N, V ) );
1069	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
1070	uv = uv * LUT_SCALE + LUT_BIAS;
1071	return uv;
1072}
1073float LTC_ClippedSphereFormFactor( const in vec3 f ) {
1074	float l = length( f );
1075	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
1076}
1077vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
1078	float x = dot( v1, v2 );
1079	float y = abs( x );
1080	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
1081	float b = 3.4175940 + ( 4.1616724 + y ) * y;
1082	float v = a / b;
1083	float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
1084	return cross( v1, v2 ) * theta_sintheta;
1085}
1086vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
1087	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
1088	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
1089	vec3 lightNormal = cross( v1, v2 );
1090	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
1091	vec3 T1, T2;
1092	T1 = normalize( V - N * dot( V, N ) );
1093	T2 = - cross( N, T1 );
1094	mat3 mat = mInv * transpose( mat3( T1, T2, N ) );
1095	vec3 coords[ 4 ];
1096	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
1097	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
1098	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
1099	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
1100	coords[ 0 ] = normalize( coords[ 0 ] );
1101	coords[ 1 ] = normalize( coords[ 1 ] );
1102	coords[ 2 ] = normalize( coords[ 2 ] );
1103	coords[ 3 ] = normalize( coords[ 3 ] );
1104	vec3 vectorFormFactor = vec3( 0.0 );
1105	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
1106	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
1107	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
1108	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
1109	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
1110	return vec3( result );
1111}
1112#if defined( USE_SHEEN )
1113float D_Charlie( float roughness, float dotNH ) {
1114	float alpha = pow2( roughness );
1115	float invAlpha = 1.0 / alpha;
1116	float cos2h = dotNH * dotNH;
1117	float sin2h = max( 1.0 - cos2h, 0.0078125 );
1118	return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
1119}
1120float V_Neubelt( float dotNV, float dotNL ) {
1121	return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
1122}
1123vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
1124	vec3 halfDir = normalize( lightDir + viewDir );
1125	float dotNL = saturate( dot( normal, lightDir ) );
1126	float dotNV = saturate( dot( normal, viewDir ) );
1127	float dotNH = saturate( dot( normal, halfDir ) );
1128	float D = D_Charlie( sheenRoughness, dotNH );
1129	float V = V_Neubelt( dotNV, dotNL );
1130	return sheenColor * ( D * V );
1131}
1132#endif
1133float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
1134	float dotNV = saturate( dot( normal, viewDir ) );
1135	float r2 = roughness * roughness;
1136	float rInv = 1.0 / ( roughness + 0.1 );
1137	float a = -1.9362 + 1.0678 * roughness + 0.4573 * r2 - 0.8469 * rInv;
1138	float b = -0.6014 + 0.5538 * roughness - 0.4670 * r2 - 0.1255 * rInv;
1139	float DG = exp( a * dotNV + b );
1140	return saturate( DG );
1141}
1142vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
1143	float dotNV = saturate( dot( normal, viewDir ) );
1144	vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;
1145	return specularColor * fab.x + specularF90 * fab.y;
1146}
1147#ifdef USE_IRIDESCENCE
1148void 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 ) {
1149#else
1150void 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 ) {
1151#endif
1152	float dotNV = saturate( dot( normal, viewDir ) );
1153	vec2 fab = texture2D( dfgLUT, vec2( roughness, dotNV ) ).rg;
1154	#ifdef USE_IRIDESCENCE
1155		vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
1156	#else
1157		vec3 Fr = specularColor;
1158	#endif
1159	vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
1160	float Ess = fab.x + fab.y;
1161	float Ems = 1.0 - Ess;
1162	vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
1163	singleScatter += FssEss;
1164	multiScatter += Fms * Ems;
1165}
1166vec3 BRDF_GGX_Multiscatter( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
1167	vec3 singleScatter = BRDF_GGX( lightDir, viewDir, normal, material );
vendor: 8,354 bytes, lines 1168-1297
1168	float dotNL = saturate( dot( normal, lightDir ) );
1169	float dotNV = saturate( dot( normal, viewDir ) );
1170	vec2 dfgV = texture2D( dfgLUT, vec2( material.roughness, dotNV ) ).rg;
1171	vec2 dfgL = texture2D( dfgLUT, vec2( material.roughness, dotNL ) ).rg;
1172	vec3 FssEss_V = material.specularColorBlended * dfgV.x + material.specularF90 * dfgV.y;
1173	vec3 FssEss_L = material.specularColorBlended * dfgL.x + material.specularF90 * dfgL.y;
1174	float Ess_V = dfgV.x + dfgV.y;
1175	float Ess_L = dfgL.x + dfgL.y;
1176	float Ems_V = 1.0 - Ess_V;
1177	float Ems_L = 1.0 - Ess_L;
1178	vec3 Favg = material.specularColorBlended + ( 1.0 - material.specularColorBlended ) * 0.047619;
1179	vec3 Fms = FssEss_V * FssEss_L * Favg / ( 1.0 - Ems_V * Ems_L * Favg + EPSILON );
1180	float compensationFactor = Ems_V * Ems_L;
1181	vec3 multiScatter = Fms * compensationFactor;
1182	return singleScatter + multiScatter;
1183}
1184#if NUM_RECT_AREA_LIGHTS > 0
1185	void 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 ) {
1186		vec3 normal = geometryNormal;
1187		vec3 viewDir = geometryViewDir;
1188		vec3 position = geometryPosition;
1189		vec3 lightPos = rectAreaLight.position;
1190		vec3 halfWidth = rectAreaLight.halfWidth;
1191		vec3 halfHeight = rectAreaLight.halfHeight;
1192		vec3 lightColor = rectAreaLight.color;
1193		float roughness = material.roughness;
1194		vec3 rectCoords[ 4 ];
1195		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
1196		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
1197		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
1198		vec2 uv = LTC_Uv( normal, viewDir, roughness );
1199		vec4 t1 = texture2D( ltc_1, uv );
1200		vec4 t2 = texture2D( ltc_2, uv );
1201		mat3 mInv = mat3(
1202			vec3( t1.x, 0, t1.y ),
1203			vec3(    0, 1,    0 ),
1204			vec3( t1.z, 0, t1.w )
1205		);
1206		vec3 fresnel = ( material.specularColorBlended * t2.x + ( material.specularF90 - material.specularColorBlended ) * t2.y );
1207		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
1208		reflectedLight.directDiffuse += lightColor * material.diffuseContribution * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
1209		#ifdef USE_CLEARCOAT
1210			vec3 Ncc = geometryClearcoatNormal;
1211			vec2 uvClearcoat = LTC_Uv( Ncc, viewDir, material.clearcoatRoughness );
1212			vec4 t1Clearcoat = texture2D( ltc_1, uvClearcoat );
1213			vec4 t2Clearcoat = texture2D( ltc_2, uvClearcoat );
1214			mat3 mInvClearcoat = mat3(
1215				vec3( t1Clearcoat.x, 0, t1Clearcoat.y ),
1216				vec3(             0, 1,             0 ),
1217				vec3( t1Clearcoat.z, 0, t1Clearcoat.w )
1218			);
1219			vec3 fresnelClearcoat = material.clearcoatF0 * t2Clearcoat.x + ( material.clearcoatF90 - material.clearcoatF0 ) * t2Clearcoat.y;
1220			clearcoatSpecularDirect += lightColor * fresnelClearcoat * LTC_Evaluate( Ncc, viewDir, position, mInvClearcoat, rectCoords );
1221		#endif
1222	}
1223#endif
1224void 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 ) {
1225	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
1226	vec3 irradiance = dotNL * directLight.color;
1227	#ifdef USE_CLEARCOAT
1228		float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
1229		vec3 ccIrradiance = dotNLcc * directLight.color;
1230		clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
1231	#endif
1232	#ifdef USE_SHEEN
1233 
1234 		sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
1235 
1236 		float sheenAlbedoV = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1237 		float sheenAlbedoL = IBLSheenBRDF( geometryNormal, directLight.direction, material.sheenRoughness );
1238 
1239 		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * max( sheenAlbedoV, sheenAlbedoL );
1240 
1241 		irradiance *= sheenEnergyComp;
1242 
1243 	#endif
1244	reflectedLight.directSpecular += irradiance * BRDF_GGX_Multiscatter( directLight.direction, geometryViewDir, geometryNormal, material );
1245	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseContribution );
1246}
1247void 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 ) {
1248	vec3 diffuse = irradiance * BRDF_Lambert( material.diffuseContribution );
1249	#ifdef USE_SHEEN
1250		float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1251		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
1252		diffuse *= sheenEnergyComp;
1253	#endif
1254	reflectedLight.indirectDiffuse += diffuse;
1255}
1256void 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) {
1257	#ifdef USE_CLEARCOAT
1258		clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
1259	#endif
1260	#ifdef USE_SHEEN
1261		sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ) * RECIPROCAL_PI;
1262 	#endif
1263	vec3 singleScatteringDielectric = vec3( 0.0 );
1264	vec3 multiScatteringDielectric = vec3( 0.0 );
1265	vec3 singleScatteringMetallic = vec3( 0.0 );
1266	vec3 multiScatteringMetallic = vec3( 0.0 );
1267	#ifdef USE_IRIDESCENCE
1268		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnelDielectric, material.roughness, singleScatteringDielectric, multiScatteringDielectric );
1269		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.iridescence, material.iridescenceFresnelMetallic, material.roughness, singleScatteringMetallic, multiScatteringMetallic );
1270	#else
1271		computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScatteringDielectric, multiScatteringDielectric );
1272		computeMultiscattering( geometryNormal, geometryViewDir, material.diffuseColor, material.specularF90, material.roughness, singleScatteringMetallic, multiScatteringMetallic );
1273	#endif
1274	vec3 singleScattering = mix( singleScatteringDielectric, singleScatteringMetallic, material.metalness );
1275	vec3 multiScattering = mix( multiScatteringDielectric, multiScatteringMetallic, material.metalness );
1276	vec3 totalScatteringDielectric = singleScatteringDielectric + multiScatteringDielectric;
1277	vec3 diffuse = material.diffuseContribution * ( 1.0 - totalScatteringDielectric );
1278	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
1279	vec3 indirectSpecular = radiance * singleScattering;
1280	indirectSpecular += multiScattering * cosineWeightedIrradiance;
1281	vec3 indirectDiffuse = diffuse * cosineWeightedIrradiance;
1282	#ifdef USE_SHEEN
1283		float sheenAlbedo = IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
1284		float sheenEnergyComp = 1.0 - max3( material.sheenColor ) * sheenAlbedo;
1285		indirectSpecular *= sheenEnergyComp;
1286		indirectDiffuse *= sheenEnergyComp;
1287	#endif
1288	reflectedLight.indirectSpecular += indirectSpecular;
1289	reflectedLight.indirectDiffuse += indirectDiffuse;
1290}
1291#define RE_Direct				RE_Direct_Physical
1292#define RE_Direct_RectArea		RE_Direct_RectArea_Physical
1293#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical
1294#define RE_IndirectSpecular		RE_IndirectSpecular_Physical
1295float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
1296	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
1297}`,
1297JS=`
1298vec3 geometryPosition = - vViewPosition;
1299vec3 geometryNormal = normal;
1300vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
1301vec3 geometryClearcoatNormal = vec3( 0.0 );
1302#ifdef USE_CLEARCOAT
1303	geometryClearcoatNormal = clearcoatNormal;
1304#endif
1305#ifdef USE_IRIDESCENCE
1306	float dotNVi = saturate( dot( normal, geometryViewDir ) );
1307	if ( material.iridescenceThickness == 0.0 ) {
1308		material.iridescence = 0.0;
1309	} else {
1310		material.iridescence = saturate( material.iridescence );
1311	}
1312	if ( material.iridescence > 0.0 ) {
1313		material.iridescenceFresnelDielectric = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
1314		material.iridescenceFresnelMetallic = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.diffuseColor );
1315		material.iridescenceFresnel = mix( material.iridescenceFresnelDielectric, material.iridescenceFresnelMetallic, material.metalness );
1316		material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
1317	}
1318#endif
1319IncidentLight directLight;
1320#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
1321	PointLight pointLight;
1322	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
1323	PointLightShadow pointLightShadow;
1324	#endif
1325	#pragma unroll_loop_start
1326	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
1327		pointLight = pointLights[ i ];
1328		getPointLightInfo( pointLight, geometryPosition, directLight );
1329		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
1330		pointLightShadow = pointLightShadows[ i ];
1331		directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
1332		#endif
1333		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1334	}
1335	#pragma unroll_loop_end
1336#endif
1337#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
1338	SpotLight spotLight;
1339	vec4 spotColor;
1340	vec3 spotLightCoord;
1341	bool inSpotLightMap;
1342	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
1343	SpotLightShadow spotLightShadow;
1344	#endif
1345	#pragma unroll_loop_start
1346	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
1347		spotLight = spotLights[ i ];
1348		getSpotLightInfo( spotLight, geometryPosition, directLight );
1349		#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1350		#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
1351		#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1352		#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
1353		#else
1354		#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
1355		#endif
1356		#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
1357			spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
1358			inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
1359			spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
1360			directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
1361		#endif
1362		#undef SPOT_LIGHT_MAP_INDEX
1363		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
1364		spotLightShadow = spotLightShadows[ i ];
1365		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
1366		#endif
1367		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1368	}
1369	#pragma unroll_loop_end
1370#endif
1371#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
1372	DirectionalLight directionalLight;
1373	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
1374	DirectionalLightShadow directionalLightShadow;
1375	#endif
1376	#pragma unroll_loop_start
1377	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
1378		directionalLight = directionalLights[ i ];
1379		getDirectionalLightInfo( directionalLight, directLight );
1380		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
1381		directionalLightShadow = directionalLightShadows[ i ];
1382		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
1383		#endif
1384		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1385	}
1386	#pragma unroll_loop_end
1387#endif
1388#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
1389	RectAreaLight rectAreaLight;
1390	#pragma unroll_loop_start
1391	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
1392		rectAreaLight = rectAreaLights[ i ];
1393		RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1394	}
1395	#pragma unroll_loop_end
1396#endif
1397#if defined( RE_IndirectDiffuse )
1398	vec3 iblIrradiance = vec3( 0.0 );
1399	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
1400	#if defined( USE_LIGHT_PROBES )
1401		irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
1402	#endif
1403	#if ( NUM_HEMI_LIGHTS > 0 )
1404		#pragma unroll_loop_start
1405		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
1406			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
1407		}
1408		#pragma unroll_loop_end
1409	#endif
1410#endif
1411#if defined( RE_IndirectSpecular )
1412	vec3 radiance = vec3( 0.0 );
1413	vec3 clearcoatRadiance = vec3( 0.0 );
1414#endif`,ZS=`#if defined( RE_IndirectDiffuse )
1415	#ifdef USE_LIGHTMAP
1416		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
1417		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
1418		irradiance += lightMapIrradiance;
1419	#endif
1420	#if defined( USE_ENVMAP ) && defined( ENVMAP_TYPE_CUBE_UV )
1421		#if defined( STANDARD ) || defined( LAMBERT ) || defined( PHONG )
1422			iblIrradiance += getIBLIrradiance( geometryNormal );
1423		#endif
1424	#endif
1425#endif
1426#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
1427	#ifdef USE_ANISOTROPY
1428		radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
1429	#else
1430		radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
1431	#endif
1432	#ifdef USE_CLEARCOAT
1433		clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
1434	#endif
1435#endif`,eC=`#if defined( RE_IndirectDiffuse )
1436	#if defined( LAMBERT ) || defined( PHONG )
1437		irradiance += iblIrradiance;
1438	#endif
1439	RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1440#endif
1441#if defined( RE_IndirectSpecular )
1442	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
1443#endif`,tC=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1444	gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
1445#endif`,nC=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
1446	uniform float logDepthBufFC;
1447	varying float vFragDepth;
1448	varying float vIsPerspective;
1449#endif`,iC=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1450	varying float vFragDepth;
1451	varying float vIsPerspective;
1452#endif`,sC=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
1453	vFragDepth = 1.0 + gl_Position.w;
1454	vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
1455#endif`,rC=`#ifdef USE_MAP
1456	vec4 sampledDiffuseColor = texture2D( map, vMapUv );
1457	#ifdef DECODE_VIDEO_TEXTURE
1458		sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
1459	#endif
1460	diffuseColor *= sampledDiffuseColor;
1461#endif`,aC=`#ifdef USE_MAP
1462	uniform sampler2D map;
1463#endif`,oC=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1464	#if defined( USE_POINTS_UV )
1465		vec2 uv = vUv;
1466	#else
1467		vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
1468	#endif
1469#endif
1470#ifdef USE_MAP
1471	diffuseColor *= texture2D( map, uv );
1472#endif
1473#ifdef USE_ALPHAMAP
1474	diffuseColor.a *= texture2D( alphaMap, uv ).g;
1475#endif`,cC=`#if defined( USE_POINTS_UV )
1476	varying vec2 vUv;
1477#else
1478	#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
1479		uniform mat3 uvTransform;
1480	#endif
1481#endif
1482#ifdef USE_MAP
1483	uniform sampler2D map;
1484#endif
1485#ifdef USE_ALPHAMAP
1486	uniform sampler2D alphaMap;
1487#endif`,lC=`float metalnessFactor = metalness;
1488#ifdef USE_METALNESSMAP
1489	vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
1490	metalnessFactor *= texelMetalness.b;
1491#endif`,hC=`#ifdef USE_METALNESSMAP
1492	uniform sampler2D metalnessMap;
1493#endif`,uC=`#ifdef USE_INSTANCING_MORPH
1494	float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1495	float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
1496	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1497		morphTargetInfluences[i] =  texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
1498	}
1499#endif`,dC=`#if defined( USE_MORPHCOLORS )
1500	vColor *= morphTargetBaseInfluence;
1501	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1502		#if defined( USE_COLOR_ALPHA )
1503			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
1504		#elif defined( USE_COLOR )
1505			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
1506		#endif
1507	}
1508#endif`,fC=`#ifdef USE_MORPHNORMALS
1509	objectNormal *= morphTargetBaseInfluence;
1510	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1511		if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
1512	}
1513#endif`,pC=`#ifdef USE_MORPHTARGETS
1514	#ifndef USE_INSTANCING_MORPH
1515		uniform float morphTargetBaseInfluence;
1516		uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
1517	#endif
1518	uniform sampler2DArray morphTargetsTexture;
1519	uniform ivec2 morphTargetsTextureSize;
1520	vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
1521		int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
1522		int y = texelIndex / morphTargetsTextureSize.x;
1523		int x = texelIndex - y * morphTargetsTextureSize.x;
1524		ivec3 morphUV = ivec3( x, y, morphTargetIndex );
1525		return texelFetch( morphTargetsTexture, morphUV, 0 );
1526	}
1527#endif`,AC=`#ifdef USE_MORPHTARGETS
1528	transformed *= morphTargetBaseInfluence;
1529	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
1530		if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
1531	}
1532#endif`,gC=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
1533#ifdef FLAT_SHADED
1534	vec3 fdx = dFdx( vViewPosition );
1535	vec3 fdy = dFdy( vViewPosition );
1536	vec3 normal = normalize( cross( fdx, fdy ) );
1537#else
1538	vec3 normal = normalize( vNormal );
1539	#ifdef DOUBLE_SIDED
1540		normal *= faceDirection;
1541	#endif
1542#endif
1543#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
1544	#ifdef USE_TANGENT
1545		mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1546	#else
1547		mat3 tbn = getTangentFrame( - vViewPosition, normal,
1548		#if defined( USE_NORMALMAP )
1549			vNormalMapUv
1550		#elif defined( USE_CLEARCOAT_NORMALMAP )
1551			vClearcoatNormalMapUv
1552		#else
1553			vUv
1554		#endif
1555		);
1556	#endif
1557	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
1558		tbn[0] *= faceDirection;
1559		tbn[1] *= faceDirection;
1560	#endif
1561#endif
1562#ifdef USE_CLEARCOAT_NORMALMAP
1563	#ifdef USE_TANGENT
1564		mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
1565	#else
1566		mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
1567	#endif
1568	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
1569		tbn2[0] *= faceDirection;
1570		tbn2[1] *= faceDirection;
1571	#endif
1572#endif
1573vec3 nonPerturbedNormal = normal;`,mC=`#ifdef USE_NORMALMAP_OBJECTSPACE
1574	normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1575	#ifdef FLIP_SIDED
1576		normal = - normal;
1577	#endif
1578	#ifdef DOUBLE_SIDED
1579		normal = normal * faceDirection;
1580	#endif
1581	normal = normalize( normalMatrix * normal );
1582#elif defined( USE_NORMALMAP_TANGENTSPACE )
1583	vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
1584	mapN.xy *= normalScale;
1585	normal = normalize( tbn * mapN );
1586#elif defined( USE_BUMPMAP )
1587	normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
1588#endif`,bC=`#ifndef FLAT_SHADED
1589	varying vec3 vNormal;
1590	#ifdef USE_TANGENT
1591		varying vec3 vTangent;
1592		varying vec3 vBitangent;
1593	#endif
1594#endif`,xC=`#ifndef FLAT_SHADED
1595	varying vec3 vNormal;
1596	#ifdef USE_TANGENT
1597		varying vec3 vTangent;
1598		varying vec3 vBitangent;
1599	#endif
1600#endif`,EC=`#ifndef FLAT_SHADED
1601	vNormal = normalize( transformedNormal );
1602	#ifdef USE_TANGENT
1603		vTangent = normalize( transformedTangent );
1604		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
1605	#endif
1606#endif`,_C=`#ifdef USE_NORMALMAP
1607	uniform sampler2D normalMap;
1608	uniform vec2 normalScale;
1609#endif
1610#ifdef USE_NORMALMAP_OBJECTSPACE
1611	uniform mat3 normalMatrix;
1612#endif
1613#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
1614	mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
1615		vec3 q0 = dFdx( eye_pos.xyz );
1616		vec3 q1 = dFdy( eye_pos.xyz );
1617		vec2 st0 = dFdx( uv.st );
1618		vec2 st1 = dFdy( uv.st );
1619		vec3 N = surf_norm;
1620		vec3 q1perp = cross( q1, N );
1621		vec3 q0perp = cross( N, q0 );
1622		vec3 T = q1perp * st0.x + q0perp * st1.x;
1623		vec3 B = q1perp * st0.y + q0perp * st1.y;
1624		float det = max( dot( T, T ), dot( B, B ) );
1625		float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
1626		return mat3( T * scale, B * scale, N );
1627	}
1628#endif`,vC=`#ifdef USE_CLEARCOAT
1629	vec3 clearcoatNormal = nonPerturbedNormal;
1630#endif`,yC=`#ifdef USE_CLEARCOAT_NORMALMAP
1631	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
1632	clearcoatMapN.xy *= clearcoatNormalScale;
1633	clearcoatNormal = normalize( tbn2 * clearcoatMapN );
1634#endif`,SC=`#ifdef USE_CLEARCOATMAP
1635	uniform sampler2D clearcoatMap;
1636#endif
1637#ifdef USE_CLEARCOAT_NORMALMAP
1638	uniform sampler2D clearcoatNormalMap;
1639	uniform vec2 clearcoatNormalScale;
1640#endif
1641#ifdef USE_CLEARCOAT_ROUGHNESSMAP
1642	uniform sampler2D clearcoatRoughnessMap;
1643#endif`,CC=`#ifdef USE_IRIDESCENCEMAP
1644	uniform sampler2D iridescenceMap;
1645#endif
1646#ifdef USE_IRIDESCENCE_THICKNESSMAP
1647	uniform sampler2D iridescenceThicknessMap;
1648#endif`,MC=`#ifdef OPAQUE
1649diffuseColor.a = 1.0;
1650#endif
1651#ifdef USE_TRANSMISSION
1652diffuseColor.a *= material.transmissionAlpha;
1653#endif
1654gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,IC=`vec3 packNormalToRGB( const in vec3 normal ) {
1655	return normalize( normal ) * 0.5 + 0.5;
1656}
1657vec3 unpackRGBToNormal( const in vec3 rgb ) {
1658	return 2.0 * rgb.xyz - 1.0;
1659}
1660const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
1661const float Inv255 = 1. / 255.;
1662const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
1663const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
1664const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
1665const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
1666vec4 packDepthToRGBA( const in float v ) {
1667	if( v <= 0.0 )
1668		return vec4( 0., 0., 0., 0. );
1669	if( v >= 1.0 )
1670		return vec4( 1., 1., 1., 1. );
1671	float vuf;
1672	float af = modf( v * PackFactors.a, vuf );
1673	float bf = modf( vuf * ShiftRight8, vuf );
1674	float gf = modf( vuf * ShiftRight8, vuf );
1675	return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
1676}
1677vec3 packDepthToRGB( const in float v ) {
1678	if( v <= 0.0 )
1679		return vec3( 0., 0., 0. );
1680	if( v >= 1.0 )
1681		return vec3( 1., 1., 1. );
1682	float vuf;
1683	float bf = modf( v * PackFactors.b, vuf );
1684	float gf = modf( vuf * ShiftRight8, vuf );
1685	return vec3( vuf * Inv255, gf * PackUpscale, bf );
1686}
1687vec2 packDepthToRG( const in float v ) {
1688	if( v <= 0.0 )
1689		return vec2( 0., 0. );
1690	if( v >= 1.0 )
1691		return vec2( 1., 1. );
1692	float vuf;
1693	float gf = modf( v * 256., vuf );
1694	return vec2( vuf * Inv255, gf );
1695}
1696float unpackRGBAToDepth( const in vec4 v ) {
1697	return dot( v, UnpackFactors4 );
1698}
1699float unpackRGBToDepth( const in vec3 v ) {
1700	return dot( v, UnpackFactors3 );
1701}
1702float unpackRGToDepth( const in vec2 v ) {
1703	return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
1704}
1705vec4 pack2HalfToRGBA( const in vec2 v ) {
1706	vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
1707	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
1708}
1709vec2 unpackRGBATo2Half( const in vec4 v ) {
1710	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
1711}
1712float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
1713	return ( viewZ + near ) / ( near - far );
1714}
1715float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
1716	#ifdef USE_REVERSED_DEPTH_BUFFER
1717	
1718		return depth * ( far - near ) - far;
1719	#else
1720		return depth * ( near - far ) - near;
1721	#endif
1722}
1723float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
1724	return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
1725}
1726float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
1727	
1728	#ifdef USE_REVERSED_DEPTH_BUFFER
1729		return ( near * far ) / ( ( near - far ) * depth - near );
1730	#else
1731		return ( near * far ) / ( ( far - near ) * depth - far );
1732	#endif
1733}`,wC=`#ifdef PREMULTIPLIED_ALPHA
1734	gl_FragColor.rgb *= gl_FragColor.a;
1735#endif`,TC=`vec4 mvPosition = vec4( transformed, 1.0 );
1736#ifdef USE_BATCHING
1737	mvPosition = batchingMatrix * mvPosition;
1738#endif
1739#ifdef USE_INSTANCING
1740	mvPosition = instanceMatrix * mvPosition;
1741#endif
1742mvPosition = modelViewMatrix * mvPosition;
1743gl_Position = projectionMatrix * mvPosition;`,RC=`#ifdef DITHERING
1744	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
1745#endif`,BC=`#ifdef DITHERING
1746	vec3 dithering( vec3 color ) {
1747		float grid_position = rand( gl_FragCoord.xy );
1748		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
1749		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
1750		return color + dither_shift_RGB;
1751	}
1752#endif`,DC=`float roughnessFactor = roughness;
1753#ifdef USE_ROUGHNESSMAP
1754	vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
1755	roughnessFactor *= texelRoughness.g;
1756#endif`,LC=`#ifdef USE_ROUGHNESSMAP
1757	uniform sampler2D roughnessMap;
1758#endif`,PC=`#if NUM_SPOT_LIGHT_COORDS > 0
1759	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1760#endif
1761#if NUM_SPOT_LIGHT_MAPS > 0
1762	uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
1763#endif
1764#ifdef USE_SHADOWMAP
1765	#if NUM_DIR_LIGHT_SHADOWS > 0
1766		#if defined( SHADOWMAP_TYPE_PCF )
1767			uniform sampler2DShadow directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
1768		#else
1769			uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
1770		#endif
1771		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1772		struct DirectionalLightShadow {
1773			float shadowIntensity;
1774			float shadowBias;
1775			float shadowNormalBias;
1776			float shadowRadius;
1777			vec2 shadowMapSize;
1778		};
1779		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1780	#endif
1781	#if NUM_SPOT_LIGHT_SHADOWS > 0
1782		#if defined( SHADOWMAP_TYPE_PCF )
1783			uniform sampler2DShadow spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
1784		#else
1785			uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
1786		#endif
1787		struct SpotLightShadow {
1788			float shadowIntensity;
1789			float shadowBias;
1790			float shadowNormalBias;
1791			float shadowRadius;
1792			vec2 shadowMapSize;
1793		};
1794		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1795	#endif
1796	#if NUM_POINT_LIGHT_SHADOWS > 0
1797		#if defined( SHADOWMAP_TYPE_PCF )
1798			uniform samplerCubeShadow pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
1799		#elif defined( SHADOWMAP_TYPE_BASIC )
1800			uniform samplerCube pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
1801		#endif
1802		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1803		struct PointLightShadow {
1804			float shadowIntensity;
1805			float shadowBias;
1806			float shadowNormalBias;
1807			float shadowRadius;
1808			vec2 shadowMapSize;
1809			float shadowCameraNear;
1810			float shadowCameraFar;
1811		};
1812		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1813	#endif
1814	#if defined( SHADOWMAP_TYPE_PCF )
1815		float interleavedGradientNoise( vec2 position ) {
1816			return fract( 52.9829189 * fract( dot( position, vec2( 0.06711056, 0.00583715 ) ) ) );
1817		}
1818		vec2 vogelDiskSample( int sampleIndex, int samplesCount, float phi ) {
1819			const float goldenAngle = 2.399963229728653;
1820			float r = sqrt( ( float( sampleIndex ) + 0.5 ) / float( samplesCount ) );
1821			float theta = float( sampleIndex ) * goldenAngle + phi;
1822			return vec2( cos( theta ), sin( theta ) ) * r;
1823		}
1824	#endif
1825	#if defined( SHADOWMAP_TYPE_PCF )
1826		float getShadow( sampler2DShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1827			float shadow = 1.0;
1828			shadowCoord.xyz /= shadowCoord.w;
1829			shadowCoord.z += shadowBias;
1830			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1831			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1832			if ( frustumTest ) {
1833				vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
1834				float radius = shadowRadius * texelSize.x;
1835				float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;
1836				shadow = (
1837					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 0, 5, phi ) * radius, shadowCoord.z ) ) +
1838					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 1, 5, phi ) * radius, shadowCoord.z ) ) +
1839					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 2, 5, phi ) * radius, shadowCoord.z ) ) +
1840					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 3, 5, phi ) * radius, shadowCoord.z ) ) +
1841					texture( shadowMap, vec3( shadowCoord.xy + vogelDiskSample( 4, 5, phi ) * radius, shadowCoord.z ) )
1842				) * 0.2;
1843			}
1844			return mix( 1.0, shadow, shadowIntensity );
1845		}
1846	#elif defined( SHADOWMAP_TYPE_VSM )
1847		float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1848			float shadow = 1.0;
1849			shadowCoord.xyz /= shadowCoord.w;
1850			#ifdef USE_REVERSED_DEPTH_BUFFER
1851				shadowCoord.z -= shadowBias;
1852			#else
1853				shadowCoord.z += shadowBias;
1854			#endif
1855			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1856			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1857			if ( frustumTest ) {
1858				vec2 distribution = texture2D( shadowMap, shadowCoord.xy ).rg;
1859				float mean = distribution.x;
1860				float variance = distribution.y * distribution.y;
1861				#ifdef USE_REVERSED_DEPTH_BUFFER
1862					float hard_shadow = step( mean, shadowCoord.z );
1863				#else
1864					float hard_shadow = step( shadowCoord.z, mean );
1865				#endif
1866				
1867				if ( hard_shadow == 1.0 ) {
1868					shadow = 1.0;
1869				} else {
1870					variance = max( variance, 0.0000001 );
1871					float d = shadowCoord.z - mean;
1872					float p_max = variance / ( variance + d * d );
1873					p_max = clamp( ( p_max - 0.3 ) / 0.65, 0.0, 1.0 );
1874					shadow = max( hard_shadow, p_max );
1875				}
1876			}
1877			return mix( 1.0, shadow, shadowIntensity );
1878		}
1879	#else
1880		float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
1881			float shadow = 1.0;
1882			shadowCoord.xyz /= shadowCoord.w;
1883			#ifdef USE_REVERSED_DEPTH_BUFFER
1884				shadowCoord.z -= shadowBias;
1885			#else
1886				shadowCoord.z += shadowBias;
1887			#endif
1888			bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
1889			bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
1890			if ( frustumTest ) {
1891				float depth = texture2D( shadowMap, shadowCoord.xy ).r;
1892				#ifdef USE_REVERSED_DEPTH_BUFFER
1893					shadow = step( depth, shadowCoord.z );
1894				#else
1895					shadow = step( shadowCoord.z, depth );
1896				#endif
1897			}
1898			return mix( 1.0, shadow, shadowIntensity );
1899		}
1900	#endif
1901	#if NUM_POINT_LIGHT_SHADOWS > 0
1902	#if defined( SHADOWMAP_TYPE_PCF )
1903	float getPointShadow( samplerCubeShadow shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
1904		float shadow = 1.0;
1905		vec3 lightToPosition = shadowCoord.xyz;
1906		vec3 bd3D = normalize( lightToPosition );
1907		vec3 absVec = abs( lightToPosition );
1908		float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
1909		if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
1910			#ifdef USE_REVERSED_DEPTH_BUFFER
1911				float dp = ( shadowCameraNear * ( shadowCameraFar - viewSpaceZ ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
1912				dp -= shadowBias;
1913			#else
1914				float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
1915				dp += shadowBias;
1916			#endif
1917			float texelSize = shadowRadius / shadowMapSize.x;
1918			vec3 absDir = abs( bd3D );
1919			vec3 tangent = absDir.x > absDir.z ? vec3( 0.0, 1.0, 0.0 ) : vec3( 1.0, 0.0, 0.0 );
1920			tangent = normalize( cross( bd3D, tangent ) );
1921			vec3 bitangent = cross( bd3D, tangent );
1922			float phi = interleavedGradientNoise( gl_FragCoord.xy ) * PI2;
1923			vec2 sample0 = vogelDiskSample( 0, 5, phi );
1924			vec2 sample1 = vogelDiskSample( 1, 5, phi );
1925			vec2 sample2 = vogelDiskSample( 2, 5, phi );
1926			vec2 sample3 = vogelDiskSample( 3, 5, phi );
1927			vec2 sample4 = vogelDiskSample( 4, 5, phi );
1928			shadow = (
1929				texture( shadowMap, vec4( bd3D + ( tangent * sample0.x + bitangent * sample0.y ) * texelSize, dp ) ) +
1930				texture( shadowMap, vec4( bd3D + ( tangent * sample1.x + bitangent * sample1.y ) * texelSize, dp ) ) +
1931				texture( shadowMap, vec4( bd3D + ( tangent * sample2.x + bitangent * sample2.y ) * texelSize, dp ) ) +
1932				texture( shadowMap, vec4( bd3D + ( tangent * sample3.x + bitangent * sample3.y ) * texelSize, dp ) ) +
1933				texture( shadowMap, vec4( bd3D + ( tangent * sample4.x + bitangent * sample4.y ) * texelSize, dp ) )
1934			) * 0.2;
1935		}
1936		return mix( 1.0, shadow, shadowIntensity );
1937	}
1938	#elif defined( SHADOWMAP_TYPE_BASIC )
1939	float getPointShadow( samplerCube shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
1940		float shadow = 1.0;
1941		vec3 lightToPosition = shadowCoord.xyz;
1942		vec3 absVec = abs( lightToPosition );
1943		float viewSpaceZ = max( max( absVec.x, absVec.y ), absVec.z );
1944		if ( viewSpaceZ - shadowCameraFar <= 0.0 && viewSpaceZ - shadowCameraNear >= 0.0 ) {
1945			float dp = ( shadowCameraFar * ( viewSpaceZ - shadowCameraNear ) ) / ( viewSpaceZ * ( shadowCameraFar - shadowCameraNear ) );
1946			dp += shadowBias;
1947			vec3 bd3D = normalize( lightToPosition );
1948			float depth = textureCube( shadowMap, bd3D ).r;
1949			#ifdef USE_REVERSED_DEPTH_BUFFER
1950				depth = 1.0 - depth;
1951			#endif
1952			shadow = step( dp, depth );
1953		}
1954		return mix( 1.0, shadow, shadowIntensity );
1955	}
1956	#endif
1957	#endif
1958#endif`,FC=`#if NUM_SPOT_LIGHT_COORDS > 0
1959	uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
1960	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
1961#endif
1962#ifdef USE_SHADOWMAP
1963	#if NUM_DIR_LIGHT_SHADOWS > 0
1964		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
1965		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
1966		struct DirectionalLightShadow {
1967			float shadowIntensity;
1968			float shadowBias;
1969			float shadowNormalBias;
1970			float shadowRadius;
1971			vec2 shadowMapSize;
1972		};
1973		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
1974	#endif
1975	#if NUM_SPOT_LIGHT_SHADOWS > 0
1976		struct SpotLightShadow {
1977			float shadowIntensity;
1978			float shadowBias;
1979			float shadowNormalBias;
1980			float shadowRadius;
1981			vec2 shadowMapSize;
1982		};
1983		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
1984	#endif
1985	#if NUM_POINT_LIGHT_SHADOWS > 0
1986		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
1987		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
1988		struct PointLightShadow {
1989			float shadowIntensity;
1990			float shadowBias;
1991			float shadowNormalBias;
1992			float shadowRadius;
1993			vec2 shadowMapSize;
1994			float shadowCameraNear;
1995			float shadowCameraFar;
1996		};
1997		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
1998	#endif
1999#endif`,NC=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
2000	vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
2001	vec4 shadowWorldPosition;
2002#endif
2003#if defined( USE_SHADOWMAP )
2004	#if NUM_DIR_LIGHT_SHADOWS > 0
2005		#pragma unroll_loop_start
2006		for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
2007			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
2008			vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
2009		}
2010		#pragma unroll_loop_end
2011	#endif
2012	#if NUM_POINT_LIGHT_SHADOWS > 0
2013		#pragma unroll_loop_start
2014		for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
2015			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
2016			vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
2017		}
2018		#pragma unroll_loop_end
2019	#endif
2020#endif
2021#if NUM_SPOT_LIGHT_COORDS > 0
2022	#pragma unroll_loop_start
2023	for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
2024		shadowWorldPosition = worldPosition;
2025		#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
2026			shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
2027		#endif
2028		vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
2029	}
2030	#pragma unroll_loop_end
2031#endif`,UC=`float getShadowMask() {
2032	float shadow = 1.0;
2033	#ifdef USE_SHADOWMAP
2034	#if NUM_DIR_LIGHT_SHADOWS > 0
2035	DirectionalLightShadow directionalLight;
2036	#pragma unroll_loop_start
2037	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
2038		directionalLight = directionalLightShadows[ i ];
2039		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
2040	}
2041	#pragma unroll_loop_end
2042	#endif
2043	#if NUM_SPOT_LIGHT_SHADOWS > 0
2044	SpotLightShadow spotLight;
2045	#pragma unroll_loop_start
2046	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
2047		spotLight = spotLightShadows[ i ];
2048		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
2049	}
2050	#pragma unroll_loop_end
2051	#endif
2052	#if NUM_POINT_LIGHT_SHADOWS > 0 && ( defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_BASIC ) )
2053	PointLightShadow pointLight;
2054	#pragma unroll_loop_start
2055	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
2056		pointLight = pointLightShadows[ i ];
2057		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
2058	}
2059	#pragma unroll_loop_end
2060	#endif
2061	#endif
2062	return shadow;
2063}`,OC=`#ifdef USE_SKINNING
2064	mat4 boneMatX = getBoneMatrix( skinIndex.x );
2065	mat4 boneMatY = getBoneMatrix( skinIndex.y );
2066	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
2067	mat4 boneMatW = getBoneMatrix( skinIndex.w );
2068#endif`,kC=`#ifdef USE_SKINNING
2069	uniform mat4 bindMatrix;
2070	uniform mat4 bindMatrixInverse;
2071	uniform highp sampler2D boneTexture;
2072	mat4 getBoneMatrix( const in float i ) {
2073		int size = textureSize( boneTexture, 0 ).x;
2074		int j = int( i ) * 4;
2075		int x = j % size;
2076		int y = j / size;
2077		vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
2078		vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
2079		vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
2080		vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
2081		return mat4( v1, v2, v3, v4 );
2082	}
2083#endif`,QC=`#ifdef USE_SKINNING
2084	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
2085	vec4 skinned = vec4( 0.0 );
2086	skinned += boneMatX * skinVertex * skinWeight.x;
2087	skinned += boneMatY * skinVertex * skinWeight.y;
2088	skinned += boneMatZ * skinVertex * skinWeight.z;
2089	skinned += boneMatW * skinVertex * skinWeight.w;
2090	transformed = ( bindMatrixInverse * skinned ).xyz;
2091#endif`,GC=`#ifdef USE_SKINNING
2092	mat4 skinMatrix = mat4( 0.0 );
2093	skinMatrix += skinWeight.x * boneMatX;
2094	skinMatrix += skinWeight.y * boneMatY;
2095	skinMatrix += skinWeight.z * boneMatZ;
2096	skinMatrix += skinWeight.w * boneMatW;
2097	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
2098	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
2099	#ifdef USE_TANGENT
2100		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
2101	#endif
2102#endif`,HC=`float specularStrength;
2103#ifdef USE_SPECULARMAP
2104	vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
2105	specularStrength = texelSpecular.r;
2106#else
2107	specularStrength = 1.0;
2108#endif`,zC=`#ifdef USE_SPECULARMAP
2109	uniform sampler2D specularMap;
2110#endif`,VC=`#if defined( TONE_MAPPING )
2111	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
2112#endif`,WC=`#ifndef saturate
2113#define saturate( a ) clamp( a, 0.0, 1.0 )
2114#endif
2115uniform float toneMappingExposure;
2116vec3 LinearToneMapping( vec3 color ) {
2117	return saturate( toneMappingExposure * color );
2118}
2119vec3 ReinhardToneMapping( vec3 color ) {
2120	color *= toneMappingExposure;
2121	return saturate( color / ( vec3( 1.0 ) + color ) );
2122}
2123vec3 CineonToneMapping( vec3 color ) {
2124	color *= toneMappingExposure;
2125	color = max( vec3( 0.0 ), color - 0.004 );
2126	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
2127}
2128vec3 RRTAndODTFit( vec3 v ) {
2129	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
2130	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
2131	return a / b;
2132}
2133vec3 ACESFilmicToneMapping( vec3 color ) {
2134	const mat3 ACESInputMat = mat3(
2135		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),
2136		vec3( 0.04823, 0.01566, 0.83777 )
2137	);
2138	const mat3 ACESOutputMat = mat3(
2139		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),
2140		vec3( -0.07367, -0.00605,  1.07602 )
2141	);
2142	color *= toneMappingExposure / 0.6;
2143	color = ACESInputMat * color;
2144	color = RRTAndODTFit( color );
2145	color = ACESOutputMat * color;
2146	return saturate( color );
2147}
2148const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
2149	vec3( 1.6605, - 0.1246, - 0.0182 ),
2150	vec3( - 0.5876, 1.1329, - 0.1006 ),
2151	vec3( - 0.0728, - 0.0083, 1.1187 )
2152);
2153const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
2154	vec3( 0.6274, 0.0691, 0.0164 ),
2155	vec3( 0.3293, 0.9195, 0.0880 ),
2156	vec3( 0.0433, 0.0113, 0.8956 )
2157);
2158vec3 agxDefaultContrastApprox( vec3 x ) {
2159	vec3 x2 = x * x;
2160	vec3 x4 = x2 * x2;
2161	return + 15.5 * x4 * x2
2162		- 40.14 * x4 * x
2163		+ 31.96 * x4
2164		- 6.868 * x2 * x
2165		+ 0.4298 * x2
2166		+ 0.1191 * x
2167		- 0.00232;
2168}
2169vec3 AgXToneMapping( vec3 color ) {
2170	const mat3 AgXInsetMatrix = mat3(
2171		vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
2172		vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
2173		vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
2174	);
2175	const mat3 AgXOutsetMatrix = mat3(
2176		vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
2177		vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
2178		vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
2179	);
2180	const float AgxMinEv = - 12.47393;	const float AgxMaxEv = 4.026069;
2181	color *= toneMappingExposure;
2182	color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
2183	color = AgXInsetMatrix * color;
2184	color = max( color, 1e-10 );	color = log2( color );
2185	color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
2186	color = clamp( color, 0.0, 1.0 );
2187	color = agxDefaultContrastApprox( color );
2188	color = AgXOutsetMatrix * color;
2189	color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
2190	color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
2191	color = clamp( color, 0.0, 1.0 );
2192	return color;
2193}
2194vec3 NeutralToneMapping( vec3 color ) {
2195	const float StartCompression = 0.8 - 0.04;
2196	const float Desaturation = 0.15;
2197	color *= toneMappingExposure;
2198	float x = min( color.r, min( color.g, color.b ) );
2199	float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
2200	color -= offset;
2201	float peak = max( color.r, max( color.g, color.b ) );
2202	if ( peak < StartCompression ) return color;
2203	float d = 1. - StartCompression;
2204	float newPeak = 1. - d * d / ( peak + d - StartCompression );
2205	color *= newPeak / peak;
2206	float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
2207	return mix( color, vec3( newPeak ), g );
2208}
2209vec3 CustomToneMapping( vec3 color ) { return color; }`,qC=`#ifdef USE_TRANSMISSION
2210	material.transmission = transmission;
2211	material.transmissionAlpha = 1.0;
2212	material.thickness = thickness;
2213	material.attenuationDistance = attenuationDistance;
2214	material.attenuationColor = attenuationColor;
2215	#ifdef USE_TRANSMISSIONMAP
2216		material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
2217	#endif
2218	#ifdef USE_THICKNESSMAP
2219		material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
2220	#endif
2221	vec3 pos = vWorldPosition;
2222	vec3 v = normalize( cameraPosition - pos );
2223	vec3 n = inverseTransformDirection( normal, viewMatrix );
2224	vec4 transmitted = getIBLVolumeRefraction(
2225		n, v, material.roughness, material.diffuseContribution, material.specularColorBlended, material.specularF90,
2226		pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
2227		material.attenuationColor, material.attenuationDistance );
2228	material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
2229	totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
2230#endif`,jC=`#ifdef USE_TRANSMISSION
2231	uniform float transmission;
2232	uniform float thickness;
2233	uniform float attenuationDistance;
2234	uniform vec3 attenuationColor;
2235	#ifdef USE_TRANSMISSIONMAP
2236		uniform sampler2D transmissionMap;
2237	#endif
2238	#ifdef USE_THICKNESSMAP
2239		uniform sampler2D thicknessMap;
2240	#endif
2241	uniform vec2 transmissionSamplerSize;
2242	uniform sampler2D transmissionSamplerMap;
2243	uniform mat4 modelMatrix;
2244	uniform mat4 projectionMatrix;
2245	varying vec3 vWorldPosition;
2246	float w0( float a ) {
2247		return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
2248	}
2249	float w1( float a ) {
2250		return ( 1.0 / 6.0 ) * ( a *  a * ( 3.0 * a - 6.0 ) + 4.0 );
2251	}
2252	float w2( float a ){
2253		return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
2254	}
2255	float w3( float a ) {
2256		return ( 1.0 / 6.0 ) * ( a * a * a );
2257	}
2258	float g0( float a ) {
2259		return w0( a ) + w1( a );
2260	}
2261	float g1( float a ) {
2262		return w2( a ) + w3( a );
2263	}
2264	float h0( float a ) {
2265		return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
2266	}
2267	float h1( float a ) {
2268		return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
2269	}
2270	vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
2271		uv = uv * texelSize.zw + 0.5;
2272		vec2 iuv = floor( uv );
2273		vec2 fuv = fract( uv );
2274		float g0x = g0( fuv.x );
2275		float g1x = g1( fuv.x );
2276		float h0x = h0( fuv.x );
2277		float h1x = h1( fuv.x );
2278		float h0y = h0( fuv.y );
2279		float h1y = h1( fuv.y );
2280		vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2281		vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
2282		vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2283		vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
2284		return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
2285			g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
2286	}
2287	vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
2288		vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
2289		vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
2290		vec2 fLodSizeInv = 1.0 / fLodSize;
2291		vec2 cLodSizeInv = 1.0 / cLodSize;
2292		vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
2293		vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
2294		return mix( fSample, cSample, fract( lod ) );
2295	}
2296	vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
2297		vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
2298		vec3 modelScale;
2299		modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
2300		modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
2301		modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
2302		return normalize( refractionVector ) * thickness * modelScale;
2303	}
2304	float applyIorToRoughness( const in float roughness, const in float ior ) {
2305		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
2306	}
2307	vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
2308		float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
2309		return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
2310	}
2311	vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
2312		if ( isinf( attenuationDistance ) ) {
2313			return vec3( 1.0 );
2314		} else {
2315			vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
2316			vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance;
2317		}
2318	}
2319	vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
2320		const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
2321		const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
2322		const in vec3 attenuationColor, const in float attenuationDistance ) {
2323		vec4 transmittedLight;
2324		vec3 transmittance;
2325		#ifdef USE_DISPERSION
2326			float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
2327			vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
2328			for ( int i = 0; i < 3; i ++ ) {
2329				vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
2330				vec3 refractedRayExit = position + transmissionRay;
2331				vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2332				vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2333				refractionCoords += 1.0;
2334				refractionCoords /= 2.0;
2335				vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
2336				transmittedLight[ i ] = transmissionSample[ i ];
2337				transmittedLight.a += transmissionSample.a;
2338				transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
2339			}
2340			transmittedLight.a /= 3.0;
2341		#else
2342			vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
2343			vec3 refractedRayExit = position + transmissionRay;
2344			vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
2345			vec2 refractionCoords = ndcPos.xy / ndcPos.w;
2346			refractionCoords += 1.0;
2347			refractionCoords /= 2.0;
2348			transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
2349			transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
2350		#endif
2351		vec3 attenuatedColor = transmittance * transmittedLight.rgb;
2352		vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
2353		float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
2354		return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
2355	}
2356#endif`,XC=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2357	varying vec2 vUv;
2358#endif
2359#ifdef USE_MAP
2360	varying vec2 vMapUv;
2361#endif
2362#ifdef USE_ALPHAMAP
2363	varying vec2 vAlphaMapUv;
2364#endif
2365#ifdef USE_LIGHTMAP
2366	varying vec2 vLightMapUv;
2367#endif
2368#ifdef USE_AOMAP
2369	varying vec2 vAoMapUv;
2370#endif
2371#ifdef USE_BUMPMAP
2372	varying vec2 vBumpMapUv;
2373#endif
2374#ifdef USE_NORMALMAP
2375	varying vec2 vNormalMapUv;
2376#endif
2377#ifdef USE_EMISSIVEMAP
2378	varying vec2 vEmissiveMapUv;
2379#endif
2380#ifdef USE_METALNESSMAP
2381	varying vec2 vMetalnessMapUv;
2382#endif
2383#ifdef USE_ROUGHNESSMAP
2384	varying vec2 vRoughnessMapUv;
2385#endif
2386#ifdef USE_ANISOTROPYMAP
2387	varying vec2 vAnisotropyMapUv;
2388#endif
2389#ifdef USE_CLEARCOATMAP
2390	varying vec2 vClearcoatMapUv;
2391#endif
2392#ifdef USE_CLEARCOAT_NORMALMAP
2393	varying vec2 vClearcoatNormalMapUv;
2394#endif
2395#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2396	varying vec2 vClearcoatRoughnessMapUv;
2397#endif
2398#ifdef USE_IRIDESCENCEMAP
2399	varying vec2 vIridescenceMapUv;
2400#endif
2401#ifdef USE_IRIDESCENCE_THICKNESSMAP
2402	varying vec2 vIridescenceThicknessMapUv;
2403#endif
2404#ifdef USE_SHEEN_COLORMAP
2405	varying vec2 vSheenColorMapUv;
2406#endif
2407#ifdef USE_SHEEN_ROUGHNESSMAP
2408	varying vec2 vSheenRoughnessMapUv;
2409#endif
2410#ifdef USE_SPECULARMAP
2411	varying vec2 vSpecularMapUv;
2412#endif
2413#ifdef USE_SPECULAR_COLORMAP
2414	varying vec2 vSpecularColorMapUv;
2415#endif
2416#ifdef USE_SPECULAR_INTENSITYMAP
2417	varying vec2 vSpecularIntensityMapUv;
2418#endif
2419#ifdef USE_TRANSMISSIONMAP
2420	uniform mat3 transmissionMapTransform;
2421	varying vec2 vTransmissionMapUv;
2422#endif
2423#ifdef USE_THICKNESSMAP
2424	uniform mat3 thicknessMapTransform;
2425	varying vec2 vThicknessMapUv;
2426#endif`,KC=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2427	varying vec2 vUv;
2428#endif
2429#ifdef USE_MAP
2430	uniform mat3 mapTransform;
2431	varying vec2 vMapUv;
2432#endif
2433#ifdef USE_ALPHAMAP
2434	uniform mat3 alphaMapTransform;
2435	varying vec2 vAlphaMapUv;
2436#endif
2437#ifdef USE_LIGHTMAP
2438	uniform mat3 lightMapTransform;
2439	varying vec2 vLightMapUv;
2440#endif
2441#ifdef USE_AOMAP
2442	uniform mat3 aoMapTransform;
2443	varying vec2 vAoMapUv;
2444#endif
2445#ifdef USE_BUMPMAP
2446	uniform mat3 bumpMapTransform;
2447	varying vec2 vBumpMapUv;
2448#endif
2449#ifdef USE_NORMALMAP
2450	uniform mat3 normalMapTransform;
2451	varying vec2 vNormalMapUv;
2452#endif
2453#ifdef USE_DISPLACEMENTMAP
2454	uniform mat3 displacementMapTransform;
2455	varying vec2 vDisplacementMapUv;
2456#endif
2457#ifdef USE_EMISSIVEMAP
2458	uniform mat3 emissiveMapTransform;
2459	varying vec2 vEmissiveMapUv;
2460#endif
2461#ifdef USE_METALNESSMAP
2462	uniform mat3 metalnessMapTransform;
2463	varying vec2 vMetalnessMapUv;
2464#endif
2465#ifdef USE_ROUGHNESSMAP
2466	uniform mat3 roughnessMapTransform;
2467	varying vec2 vRoughnessMapUv;
2468#endif
2469#ifdef USE_ANISOTROPYMAP
2470	uniform mat3 anisotropyMapTransform;
2471	varying vec2 vAnisotropyMapUv;
2472#endif
2473#ifdef USE_CLEARCOATMAP
2474	uniform mat3 clearcoatMapTransform;
2475	varying vec2 vClearcoatMapUv;
2476#endif
2477#ifdef USE_CLEARCOAT_NORMALMAP
2478	uniform mat3 clearcoatNormalMapTransform;
2479	varying vec2 vClearcoatNormalMapUv;
2480#endif
2481#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2482	uniform mat3 clearcoatRoughnessMapTransform;
2483	varying vec2 vClearcoatRoughnessMapUv;
2484#endif
2485#ifdef USE_SHEEN_COLORMAP
2486	uniform mat3 sheenColorMapTransform;
2487	varying vec2 vSheenColorMapUv;
2488#endif
2489#ifdef USE_SHEEN_ROUGHNESSMAP
2490	uniform mat3 sheenRoughnessMapTransform;
2491	varying vec2 vSheenRoughnessMapUv;
2492#endif
2493#ifdef USE_IRIDESCENCEMAP
2494	uniform mat3 iridescenceMapTransform;
2495	varying vec2 vIridescenceMapUv;
2496#endif
2497#ifdef USE_IRIDESCENCE_THICKNESSMAP
2498	uniform mat3 iridescenceThicknessMapTransform;
2499	varying vec2 vIridescenceThicknessMapUv;
2500#endif
2501#ifdef USE_SPECULARMAP
2502	uniform mat3 specularMapTransform;
2503	varying vec2 vSpecularMapUv;
2504#endif
2505#ifdef USE_SPECULAR_COLORMAP
2506	uniform mat3 specularColorMapTransform;
2507	varying vec2 vSpecularColorMapUv;
2508#endif
2509#ifdef USE_SPECULAR_INTENSITYMAP
2510	uniform mat3 specularIntensityMapTransform;
2511	varying vec2 vSpecularIntensityMapUv;
2512#endif
2513#ifdef USE_TRANSMISSIONMAP
2514	uniform mat3 transmissionMapTransform;
2515	varying vec2 vTransmissionMapUv;
2516#endif
2517#ifdef USE_THICKNESSMAP
2518	uniform mat3 thicknessMapTransform;
2519	varying vec2 vThicknessMapUv;
2520#endif`,$C=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
2521	vUv = vec3( uv, 1 ).xy;
2522#endif
2523#ifdef USE_MAP
2524	vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
2525#endif
2526#ifdef USE_ALPHAMAP
2527	vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
2528#endif
2529#ifdef USE_LIGHTMAP
2530	vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
2531#endif
2532#ifdef USE_AOMAP
2533	vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
2534#endif
2535#ifdef USE_BUMPMAP
2536	vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
2537#endif
2538#ifdef USE_NORMALMAP
2539	vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
2540#endif
2541#ifdef USE_DISPLACEMENTMAP
2542	vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
2543#endif
2544#ifdef USE_EMISSIVEMAP
2545	vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
2546#endif
2547#ifdef USE_METALNESSMAP
2548	vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
2549#endif
2550#ifdef USE_ROUGHNESSMAP
2551	vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
2552#endif
2553#ifdef USE_ANISOTROPYMAP
2554	vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
2555#endif
2556#ifdef USE_CLEARCOATMAP
2557	vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
2558#endif
2559#ifdef USE_CLEARCOAT_NORMALMAP
2560	vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
2561#endif
2562#ifdef USE_CLEARCOAT_ROUGHNESSMAP
2563	vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
2564#endif
2565#ifdef USE_IRIDESCENCEMAP
2566	vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
2567#endif
2568#ifdef USE_IRIDESCENCE_THICKNESSMAP
2569	vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
2570#endif
2571#ifdef USE_SHEEN_COLORMAP
2572	vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
2573#endif
2574#ifdef USE_SHEEN_ROUGHNESSMAP
2575	vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
2576#endif
2577#ifdef USE_SPECULARMAP
2578	vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
2579#endif
2580#ifdef USE_SPECULAR_COLORMAP
2581	vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
2582#endif
2583#ifdef USE_SPECULAR_INTENSITYMAP
2584	vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
2585#endif
2586#ifdef USE_TRANSMISSIONMAP
2587	vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
2588#endif
2589#ifdef USE_THICKNESSMAP
2590	vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
2591#endif`,YC=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
2592	vec4 worldPosition = vec4( transformed, 1.0 );
2593	#ifdef USE_BATCHING
2594		worldPosition = batchingMatrix * worldPosition;
2595	#endif
2596	#ifdef USE_INSTANCING
2597		worldPosition = instanceMatrix * worldPosition;
2598	#endif
2599	worldPosition = modelMatrix * worldPosition;
2600#endif`;const JC=`varying vec2 vUv;
2601uniform mat3 uvTransform;
2602void main() {
2603	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
2604	gl_Position = vec4( position.xy, 1.0, 1.0 );
2605}`,ZC=`uniform sampler2D t2D;
2606uniform float backgroundIntensity;
2607varying vec2 vUv;
2608void main() {
2609	vec4 texColor = texture2D( t2D, vUv );
2610	#ifdef DECODE_VIDEO_TEXTURE
2611		texColor = 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 );
2612	#endif
2613	texColor.rgb *= backgroundIntensity;
2614	gl_FragColor = texColor;
2615	#include <tonemapping_fragment>
2616	#include <colorspace_fragment>
2617}`,eM=`varying vec3 vWorldDirection;
2618#include <common>
2619void main() {
2620	vWorldDirection = transformDirection( position, modelMatrix );
2621	#include <begin_vertex>
2622	#include <project_vertex>
2623	gl_Position.z = gl_Position.w;
2624}`,tM=`#ifdef ENVMAP_TYPE_CUBE
2625	uniform samplerCube envMap;
2626#elif defined( ENVMAP_TYPE_CUBE_UV )
2627	uniform sampler2D envMap;
2628#endif
2629uniform float flipEnvMap;
2630uniform float backgroundBlurriness;
2631uniform float backgroundIntensity;
2632uniform mat3 backgroundRotation;
2633varying vec3 vWorldDirection;
2634#include <cube_uv_reflection_fragment>
2635void main() {
2636	#ifdef ENVMAP_TYPE_CUBE
2637		vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
2638	#elif defined( ENVMAP_TYPE_CUBE_UV )
2639		vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
2640	#else
2641		vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
2642	#endif
2643	texColor.rgb *= backgroundIntensity;
2644	gl_FragColor = texColor;
2645	#include <tonemapping_fragment>
2646	#include <colorspace_fragment>
2647}`,nM=`varying vec3 vWorldDirection;
2648#include <common>
2649void main() {
2650	vWorldDirection = transformDirection( position, modelMatrix );
2651	#include <begin_vertex>
2652	#include <project_vertex>
2653	gl_Position.z = gl_Position.w;
2654}`,iM=`uniform samplerCube tCube;
2655uniform float tFlip;
2656uniform float opacity;
2657varying vec3 vWorldDirection;
2658void main() {
2659	vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
2660	gl_FragColor = texColor;
2661	gl_FragColor.a *= opacity;
2662	#include <tonemapping_fragment>
2663	#include <colorspace_fragment>
2664}`,sM=`#include <common>
2665#include <batching_pars_vertex>
2666#include <uv_pars_vertex>
2667#include <displacementmap_pars_vertex>
2668#include <morphtarget_pars_vertex>
2669#include <skinning_pars_vertex>
2670#include <logdepthbuf_pars_vertex>
2671#include <clipping_planes_pars_vertex>
2672varying vec2 vHighPrecisionZW;
2673void main() {
2674	#include <uv_vertex>
2675	#include <batching_vertex>
2676	#include <skinbase_vertex>
2677	#include <morphinstance_vertex>
2678	#ifdef USE_DISPLACEMENTMAP
2679		#include <beginnormal_vertex>
2680		#include <morphnormal_vertex>
2681		#include <skinnormal_vertex>
2682	#endif
2683	#include <begin_vertex>
2684	#include <morphtarget_vertex>
2685	#include <skinning_vertex>
2686	#include <displacementmap_vertex>
2687	#include <project_vertex>
2688	#include <logdepthbuf_vertex>
2689	#include <clipping_planes_vertex>
2690	vHighPrecisionZW = gl_Position.zw;
2691}`,rM=`#if DEPTH_PACKING == 3200
2692	uniform float opacity;
2693#endif
2694#include <common>
2695#include <packing>
2696#include <uv_pars_fragment>
2697#include <map_pars_fragment>
2698#include <alphamap_pars_fragment>
2699#include <alphatest_pars_fragment>
2700#include <alphahash_pars_fragment>
2701#include <logdepthbuf_pars_fragment>
2702#include <clipping_planes_pars_fragment>
2703varying vec2 vHighPrecisionZW;
2704void main() {
2705	vec4 diffuseColor = vec4( 1.0 );
2706	#include <clipping_planes_fragment>
2707	#if DEPTH_PACKING == 3200
2708		diffuseColor.a = opacity;
2709	#endif
2710	#include <map_fragment>
2711	#include <alphamap_fragment>
2712	#include <alphatest_fragment>
2713	#include <alphahash_fragment>
2714	#include <logdepthbuf_fragment>
2715	#ifdef USE_REVERSED_DEPTH_BUFFER
2716		float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];
2717	#else
2718		float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;
2719	#endif
2720	#if DEPTH_PACKING == 3200
2721		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
2722	#elif DEPTH_PACKING == 3201
2723		gl_FragColor = packDepthToRGBA( fragCoordZ );
2724	#elif DEPTH_PACKING == 3202
2725		gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
2726	#elif DEPTH_PACKING == 3203
2727		gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
2728	#endif
2729}`,aM=`#define DISTANCE
2730varying vec3 vWorldPosition;
2731#include <common>
2732#include <batching_pars_vertex>
2733#include <uv_pars_vertex>
2734#include <displacementmap_pars_vertex>
2735#include <morphtarget_pars_vertex>
2736#include <skinning_pars_vertex>
2737#include <clipping_planes_pars_vertex>
2738void main() {
2739	#include <uv_vertex>
2740	#include <batching_vertex>
2741	#include <skinbase_vertex>
2742	#include <morphinstance_vertex>
2743	#ifdef USE_DISPLACEMENTMAP
2744		#include <beginnormal_vertex>
2745		#include <morphnormal_vertex>
2746		#include <skinnormal_vertex>
2747	#endif
2748	#include <begin_vertex>
2749	#include <morphtarget_vertex>
2750	#include <skinning_vertex>
2751	#include <displacementmap_vertex>
2752	#include <project_vertex>
2753	#include <worldpos_vertex>
2754	#include <clipping_planes_vertex>
2755	vWorldPosition = worldPosition.xyz;
2756}`,oM=`#define DISTANCE
2757uniform vec3 referencePosition;
2758uniform float nearDistance;
2759uniform float farDistance;
2760varying vec3 vWorldPosition;
2761#include <common>
2762#include <uv_pars_fragment>
2763#include <map_pars_fragment>
2764#include <alphamap_pars_fragment>
2765#include <alphatest_pars_fragment>
2766#include <alphahash_pars_fragment>
2767#include <clipping_planes_pars_fragment>
2768void main () {
2769	vec4 diffuseColor = vec4( 1.0 );
2770	#include <clipping_planes_fragment>
2771	#include <map_fragment>
2772	#include <alphamap_fragment>
2773	#include <alphatest_fragment>
2774	#include <alphahash_fragment>
2775	float dist = length( vWorldPosition - referencePosition );
2776	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
2777	dist = saturate( dist );
2778	gl_FragColor = vec4( dist, 0.0, 0.0, 1.0 );
2779}`,cM=`varying vec3 vWorldDirection;
2780#include <common>
2781void main() {
2782	vWorldDirection = transformDirection( position, modelMatrix );
2783	#include <begin_vertex>
2784	#include <project_vertex>
2785}`,lM=`uniform sampler2D tEquirect;
2786varying vec3 vWorldDirection;
2787#include <common>
2788void main() {
2789	vec3 direction = normalize( vWorldDirection );
2790	vec2 sampleUV = equirectUv( direction );
2791	gl_FragColor = texture2D( tEquirect, sampleUV );
2792	#include <tonemapping_fragment>
2793	#include <colorspace_fragment>
2794}`,hM=`uniform float scale;
2795attribute float lineDistance;
2796varying float vLineDistance;
2797#include <common>
2798#include <uv_pars_vertex>
2799#include <color_pars_vertex>
2800#include <fog_pars_vertex>
2801#include <morphtarget_pars_vertex>
2802#include <logdepthbuf_pars_vertex>
2803#include <clipping_planes_pars_vertex>
2804void main() {
2805	vLineDistance = scale * lineDistance;
2806	#include <uv_vertex>
2807	#include <color_vertex>
2808	#include <morphinstance_vertex>
2809	#include <morphcolor_vertex>
2810	#include <begin_vertex>
2811	#include <morphtarget_vertex>
2812	#include <project_vertex>
2813	#include <logdepthbuf_vertex>
2814	#include <clipping_planes_vertex>
2815	#include <fog_vertex>
2816}`,uM=`uniform vec3 diffuse;
2817uniform float opacity;
2818uniform float dashSize;
2819uniform float totalSize;
2820varying float vLineDistance;
2821#include <common>
2822#include <color_pars_fragment>
2823#include <uv_pars_fragment>
2824#include <map_pars_fragment>
2825#include <fog_pars_fragment>
2826#include <logdepthbuf_pars_fragment>
2827#include <clipping_planes_pars_fragment>
2828void main() {
2829	vec4 diffuseColor = vec4( diffuse, opacity );
2830	#include <clipping_planes_fragment>
2831	if ( mod( vLineDistance, totalSize ) > dashSize ) {
2832		discard;
2833	}
2834	vec3 outgoingLight = vec3( 0.0 );
2835	#include <logdepthbuf_fragment>
2836	#include <map_fragment>
2837	#include <color_fragment>
2838	outgoingLight = diffuseColor.rgb;
2839	#include <opaque_fragment>
2840	#include <tonemapping_fragment>
2841	#include <colorspace_fragment>
2842	#include <fog_fragment>
2843	#include <premultiplied_alpha_fragment>
2844}`,dM=`#include <common>
2845#include <batching_pars_vertex>
2846#include <uv_pars_vertex>
2847#include <envmap_pars_vertex>
2848#include <color_pars_vertex>
2849#include <fog_pars_vertex>
2850#include <morphtarget_pars_vertex>
2851#include <skinning_pars_vertex>
2852#include <logdepthbuf_pars_vertex>
2853#include <clipping_planes_pars_vertex>
2854void main() {
2855	#include <uv_vertex>
2856	#include <color_vertex>
2857	#include <morphinstance_vertex>
2858	#include <morphcolor_vertex>
2859	#include <batching_vertex>
2860	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
2861		#include <beginnormal_vertex>
2862		#include <morphnormal_vertex>
2863		#include <skinbase_vertex>
2864		#include <skinnormal_vertex>
2865		#include <defaultnormal_vertex>
2866	#endif
2867	#include <begin_vertex>
2868	#include <morphtarget_vertex>
2869	#include <skinning_vertex>
2870	#include <project_vertex>
2871	#include <logdepthbuf_vertex>
2872	#include <clipping_planes_vertex>
2873	#include <worldpos_vertex>
2874	#include <envmap_vertex>
2875	#include <fog_vertex>
2876}`,fM=`uniform vec3 diffuse;
2877uniform float opacity;
2878#ifndef FLAT_SHADED
2879	varying vec3 vNormal;
2880#endif
2881#include <common>
2882#include <dithering_pars_fragment>
2883#include <color_pars_fragment>
2884#include <uv_pars_fragment>
2885#include <map_pars_fragment>
2886#include <alphamap_pars_fragment>
2887#include <alphatest_pars_fragment>
2888#include <alphahash_pars_fragment>
2889#include <aomap_pars_fragment>
2890#include <lightmap_pars_fragment>
2891#include <envmap_common_pars_fragment>
2892#include <envmap_pars_fragment>
2893#include <fog_pars_fragment>
2894#include <specularmap_pars_fragment>
2895#include <logdepthbuf_pars_fragment>
2896#include <clipping_planes_pars_fragment>
2897void main() {
2898	vec4 diffuseColor = vec4( diffuse, opacity );
2899	#include <clipping_planes_fragment>
2900	#include <logdepthbuf_fragment>
2901	#include <map_fragment>
2902	#include <color_fragment>
2903	#include <alphamap_fragment>
2904	#include <alphatest_fragment>
2905	#include <alphahash_fragment>
2906	#include <specularmap_fragment>
2907	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2908	#ifdef USE_LIGHTMAP
2909		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
2910		reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
2911	#else
2912		reflectedLight.indirectDiffuse += vec3( 1.0 );
2913	#endif
2914	#include <aomap_fragment>
2915	reflectedLight.indirectDiffuse *= diffuseColor.rgb;
2916	vec3 outgoingLight = reflectedLight.indirectDiffuse;
2917	#include <envmap_fragment>
2918	#include <opaque_fragment>
2919	#include <tonemapping_fragment>
2920	#include <colorspace_fragment>
2921	#include <fog_fragment>
2922	#include <premultiplied_alpha_fragment>
2923	#include <dithering_fragment>
2924}`,pM=`#define LAMBERT
2925varying vec3 vViewPosition;
2926#include <common>
2927#include <batching_pars_vertex>
2928#include <uv_pars_vertex>
2929#include <displacementmap_pars_vertex>
2930#include <envmap_pars_vertex>
2931#include <color_pars_vertex>
2932#include <fog_pars_vertex>
2933#include <normal_pars_vertex>
2934#include <morphtarget_pars_vertex>
2935#include <skinning_pars_vertex>
2936#include <shadowmap_pars_vertex>
2937#include <logdepthbuf_pars_vertex>
2938#include <clipping_planes_pars_vertex>
2939void main() {
2940	#include <uv_vertex>
2941	#include <color_vertex>
2942	#include <morphinstance_vertex>
2943	#include <morphcolor_vertex>
2944	#include <batching_vertex>
2945	#include <beginnormal_vertex>
2946	#include <morphnormal_vertex>
2947	#include <skinbase_vertex>
2948	#include <skinnormal_vertex>
2949	#include <defaultnormal_vertex>
2950	#include <normal_vertex>
2951	#include <begin_vertex>
2952	#include <morphtarget_vertex>
2953	#include <skinning_vertex>
2954	#include <displacementmap_vertex>
2955	#include <project_vertex>
2956	#include <logdepthbuf_vertex>
2957	#include <clipping_planes_vertex>
2958	vViewPosition = - mvPosition.xyz;
2959	#include <worldpos_vertex>
2960	#include <envmap_vertex>
2961	#include <shadowmap_vertex>
2962	#include <fog_vertex>
2963}`,AM=`#define LAMBERT
2964uniform vec3 diffuse;
2965uniform vec3 emissive;
2966uniform float opacity;
2967#include <common>
2968#include <dithering_pars_fragment>
2969#include <color_pars_fragment>
2970#include <uv_pars_fragment>
2971#include <map_pars_fragment>
2972#include <alphamap_pars_fragment>
2973#include <alphatest_pars_fragment>
2974#include <alphahash_pars_fragment>
2975#include <aomap_pars_fragment>
2976#include <lightmap_pars_fragment>
2977#include <emissivemap_pars_fragment>
2978#include <cube_uv_reflection_fragment>
2979#include <envmap_common_pars_fragment>
2980#include <envmap_pars_fragment>
2981#include <envmap_physical_pars_fragment>
2982#include <fog_pars_fragment>
2983#include <bsdfs>
2984#include <lights_pars_begin>
2985#include <normal_pars_fragment>
2986#include <lights_lambert_pars_fragment>
2987#include <shadowmap_pars_fragment>
2988#include <bumpmap_pars_fragment>
2989#include <normalmap_pars_fragment>
2990#include <specularmap_pars_fragment>
2991#include <logdepthbuf_pars_fragment>
2992#include <clipping_planes_pars_fragment>
2993void main() {
2994	vec4 diffuseColor = vec4( diffuse, opacity );
2995	#include <clipping_planes_fragment>
2996	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
2997	vec3 totalEmissiveRadiance = emissive;
2998	#include <logdepthbuf_fragment>
2999	#include <map_fragment>
3000	#include <color_fragment>
3001	#include <alphamap_fragment>
3002	#include <alphatest_fragment>
3003	#include <alphahash_fragment>
3004	#include <specularmap_fragment>
3005	#include <normal_fragment_begin>
3006	#include <normal_fragment_maps>
3007	#include <emissivemap_fragment>
3008	#include <lights_lambert_fragment>
3009	#include <lights_fragment_begin>
3010	#include <lights_fragment_maps>
3011	#include <lights_fragment_end>
3012	#include <aomap_fragment>
3013	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
3014	#include <envmap_fragment>
3015	#include <opaque_fragment>
3016	#include <tonemapping_fragment>
3017	#include <colorspace_fragment>
3018	#include <fog_fragment>
3019	#include <premultiplied_alpha_fragment>
3020	#include <dithering_fragment>
3021}`,gM=`#define MATCAP
3022varying vec3 vViewPosition;
3023#include <common>
3024#include <batching_pars_vertex>
3025#include <uv_pars_vertex>
3026#include <color_pars_vertex>
3027#include <displacementmap_pars_vertex>
3028#include <fog_pars_vertex>
3029#include <normal_pars_vertex>
3030#include <morphtarget_pars_vertex>
3031#include <skinning_pars_vertex>
3032#include <logdepthbuf_pars_vertex>
3033#include <clipping_planes_pars_vertex>
3034void main() {
3035	#include <uv_vertex>
3036	#include <color_vertex>
3037	#include <morphinstance_vertex>
3038	#include <morphcolor_vertex>
3039	#include <batching_vertex>
3040	#include <beginnormal_vertex>
3041	#include <morphnormal_vertex>
3042	#include <skinbase_vertex>
3043	#include <skinnormal_vertex>
3044	#include <defaultnormal_vertex>
3045	#include <normal_vertex>
3046	#include <begin_vertex>
3047	#include <morphtarget_vertex>
3048	#include <skinning_vertex>
3049	#include <displacementmap_vertex>
3050	#include <project_vertex>
3051	#include <logdepthbuf_vertex>
3052	#include <clipping_planes_vertex>
3053	#include <fog_vertex>
3054	vViewPosition = - mvPosition.xyz;
3055}`,mM=`#define MATCAP
3056uniform vec3 diffuse;
3057uniform float opacity;
3058uniform sampler2D matcap;
3059varying vec3 vViewPosition;
3060#include <common>
3061#include <dithering_pars_fragment>
3062#include <color_pars_fragment>
3063#include <uv_pars_fragment>
3064#include <map_pars_fragment>
3065#include <alphamap_pars_fragment>
3066#include <alphatest_pars_fragment>
3067#include <alphahash_pars_fragment>
3068#include <fog_pars_fragment>
3069#include <normal_pars_fragm
3069ent>
3070#include <bumpmap_pars_fragment>
3071#include <normalmap_pars_fragment>
3072#include <logdepthbuf_pars_fragment>
3073#include <clipping_planes_pars_fragment>
3074void main() {
3075	vec4 diffuseColor = vec4( diffuse, opacity );
3076	#include <clipping_planes_fragment>
3077	#include <logdepthbuf_fragment>
3078	#include <map_fragment>
3079	#include <color_fragment>
3080	#include <alphamap_fragment>
3081	#include <alphatest_fragment>
3082	#include <alphahash_fragment>
3083	#include <normal_fragment_begin>
3084	#include <normal_fragment_maps>
3085	vec3 viewDir = normalize( vViewPosition );
3086	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
3087	vec3 y = cross( viewDir, x );
3088	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
3089	#ifdef USE_MATCAP
3090		vec4 matcapColor = texture2D( matcap, uv );
3091	#else
3092		vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
3093	#endif
3094	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
3095	#include <opaque_fragment>
3096	#include <tonemapping_fragment>
3097	#include <colorspace_fragment>
3098	#include <fog_fragment>
3099	#include <premultiplied_alpha_fragment>
3100	#include <dithering_fragment>
3101}`,bM=`#define NORMAL
3102#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3103	varying vec3 vViewPosition;
3104#endif
3105#include <common>
3106#include <batching_pars_vertex>
3107#include <uv_pars_vertex>
3108#include <displacementmap_pars_vertex>
3109#include <normal_pars_vertex>
3110#include <morphtarget_pars_vertex>
3111#include <skinning_pars_vertex>
3112#include <logdepthbuf_pars_vertex>
3113#include <clipping_planes_pars_vertex>
3114void main() {
3115	#include <uv_vertex>
3116	#include <batching_vertex>
3117	#include <beginnormal_vertex>
3118	#include <morphinstance_vertex>
3119	#include <morphnormal_vertex>
3120	#include <skinbase_vertex>
3121	#include <skinnormal_vertex>
3122	#include <defaultnormal_vertex>
3123	#include <normal_vertex>
3124	#include <begin_vertex>
3125	#include <morphtarget_vertex>
3126	#include <skinning_vertex>
3127	#include <displacementmap_vertex>
3128	#include <project_vertex>
3129	#include <logdepthbuf_vertex>
3130	#include <clipping_planes_vertex>
3131#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3132	vViewPosition = - mvPosition.xyz;
3133#endif
3134}`,xM=`#define NORMAL
3135uniform float opacity;
3136#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
3137	varying vec3 vViewPosition;
3138#endif
3139#include <uv_pars_fragment>
3140#include <normal_pars_fragment>
3141#include <bumpmap_pars_fragment>
3142#include <normalmap_pars_fragment>
3143#include <logdepthbuf_pars_fragment>
3144#include <clipping_planes_pars_fragment>
3145void main() {
3146	vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
3147	#include <clipping_planes_fragment>
3148	#include <logdepthbuf_fragment>
3149	#include <normal_fragment_begin>
3150	#include <normal_fragment_maps>
3151	gl_FragColor = vec4( normalize( normal ) * 0.5 + 0.5, diffuseColor.a );
3152	#ifdef OPAQUE
3153		gl_FragColor.a = 1.0;
3154	#endif
3155}`,EM=`#define PHONG
3156varying vec3 vViewPosition;
3157#include <common>
3158#include <batching_pars_vertex>
3159#include <uv_pars_vertex>
3160#include <displacementmap_pars_vertex>
3161#include <envmap_pars_vertex>
3162#include <color_pars_vertex>
3163#include <fog_pars_vertex>
3164#include <normal_pars_vertex>
3165#include <morphtarget_pars_vertex>
3166#include <skinning_pars_vertex>
3167#include <shadowmap_pars_vertex>
3168#include <logdepthbuf_pars_vertex>
3169#include <clipping_planes_pars_vertex>
3170void main() {
3171	#include <uv_vertex>
3172	#include <color_vertex>
3173	#include <morphcolor_vertex>
3174	#include <batching_vertex>
3175	#include <beginnormal_vertex>
3176	#include <morphinstance_vertex>
3177	#include <morphnormal_vertex>
3178	#include <skinbase_vertex>
3179	#include <skinnormal_vertex>
3180	#include <defaultnormal_vertex>
3181	#include <normal_vertex>
3182	#include <begin_vertex>
3183	#include <morphtarget_vertex>
3184	#include <skinning_vertex>
3185	#include <displacementmap_vertex>
3186	#include <project_vertex>
3187	#include <logdepthbuf_vertex>
3188	#include <clipping_planes_vertex>
3189	vViewPosition = - mvPosition.xyz;
3190	#include <worldpos_vertex>
3191	#include <envmap_vertex>
3192	#include <shadowmap_vertex>
3193	#include <fog_vertex>
3194}`,_M=`#define PHONG
3195uniform vec3 diffuse;
3196uniform vec3 emissive;
3197uniform vec3 specular;
3198uniform float shininess;
3199uniform float opacity;
3200#include <common>
3201#include <dithering_pars_fragment>
3202#include <color_pars_fragment>
3203#include <uv_pars_fragment>
3204#include <map_pars_fragment>
3205#include <alphamap_pars_fragment>
3206#include <alphatest_pars_fragment>
3207#include <alphahash_pars_fragment>
3208#include <aomap_pars_fragment>
3209#include <lightmap_pars_fragment>
3210#include <emissivemap_pars_fragment>
3211#include <cube_uv_reflection_fragment>
3212#include <envmap_common_pars_fragment>
3213#include <envmap_pars_fragment>
3214#include <envmap_physical_pars_fragment>
3215#include <fog_pars_fragment>
3216#include <bsdfs>
3217#include <lights_pars_begin>
3218#include <normal_pars_fragment>
3219#include <lights_phong_pars_fragment>
3220#include <shadowmap_pars_fragment>
3221#include <bumpmap_pars_fragment>
3222#include <normalmap_pars_fragment>
3223#include <specularmap_pars_fragment>
3224#include <logdepthbuf_pars_fragment>
3225#include <clipping_planes_pars_fragment>
3226void main() {
3227	vec4 diffuseColor = vec4( diffuse, opacity );
3228	#include <clipping_planes_fragment>
3229	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3230	vec3 totalEmissiveRadiance = emissive;
3231	#include <logdepthbuf_fragment>
3232	#include <map_fragment>
3233	#include <color_fragment>
3234	#include <alphamap_fragment>
3235	#include <alphatest_fragment>
3236	#include <alphahash_fragment>
3237	#include <specularmap_fragment>
3238	#include <normal_fragment_begin>
3239	#include <normal_fragment_maps>
3240	#include <emissivemap_fragment>
3241	#include <lights_phong_fragment>
3242	#include <lights_fragment_begin>
3243	#include <lights_fragment_maps>
3244	#include <lights_fragment_end>
3245	#include <aomap_fragment>
3246	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
3247	#include <envmap_fragment>
3248	#include <opaque_fragment>
3249	#include <tonemapping_fragment>
3250	#include <colorspace_fragment>
3251	#include <fog_fragment>
3252	#include <premultiplied_alpha_fragment>
3253	#include <dithering_fragment>
3254}`,vM=`#define STANDARD
3255varying vec3 vViewPosition;
3256#ifdef USE_TRANSMISSION
3257	varying vec3 vWorldPosition;
3258#endif
3259#include <common>
3260#include <batching_pars_vertex>
3261#include <uv_pars_vertex>
3262#include <displacementmap_pars_vertex>
3263#include <color_pars_vertex>
3264#include <fog_pars_vertex>
3265#include <normal_pars_vertex>
3266#include <morphtarget_pars_vertex>
3267#include <skinning_pars_vertex>
3268#include <shadowmap_pars_vertex>
3269#include <logdepthbuf_pars_vertex>
3270#include <clipping_planes_pars_vertex>
3271void main() {
3272	#include <uv_vertex>
3273	#include <color_vertex>
3274	#include <morphinstance_vertex>
3275	#include <morphcolor_vertex>
3276	#include <batching_vertex>
3277	#include <beginnormal_vertex>
3278	#include <morphnormal_vertex>
3279	#include <skinbase_vertex>
3280	#include <skinnormal_vertex>
3281	#include <defaultnormal_vertex>
3282	#include <normal_vertex>
3283	#include <begin_vertex>
3284	#include <morphtarget_vertex>
3285	#include <skinning_vertex>
3286	#include <displacementmap_vertex>
3287	#include <project_vertex>
3288	#include <logdepthbuf_vertex>
3289	#include <clipping_planes_vertex>
3290	vViewPosition = - mvPosition.xyz;
3291	#include <worldpos_vertex>
3292	#include <shadowmap_vertex>
3293	#include <fog_vertex>
3294#ifdef USE_TRANSMISSION
3295	vWorldPosition = worldPosition.xyz;
3296#endif
3297}`,yM=`#define STANDARD
3298#ifdef PHYSICAL
3299	#define IOR
3300	#define USE_SPECULAR
3301#endif
3302uniform vec3 diffuse;
3303uniform vec3 emissive;
3304uniform float roughness;
3305uniform float metalness;
3306uniform float opacity;
3307#ifdef IOR
3308	uniform float ior;
3309#endif
3310#ifdef USE_SPECULAR
3311	uniform float specularIntensity;
3312	uniform vec3 specularColor;
3313	#ifdef USE_SPECULAR_COLORMAP
3314		uniform sampler2D specularColorMap;
3315	#endif
3316	#ifdef USE_SPECULAR_INTENSITYMAP
3317		uniform sampler2D specularIntensityMap;
3318	#endif
3319#endif
3320#ifdef USE_CLEARCOAT
3321	uniform float clearcoat;
3322	uniform float clearcoatRoughness;
3323#endif
3324#ifdef USE_DISPERSION
3325	uniform float dispersion;
3326#endif
3327#ifdef USE_IRIDESCENCE
3328	uniform float iridescence;
3329	uniform float iridescenceIOR;
3330	uniform float iridescenceThicknessMinimum;
3331	uniform float iridescenceThicknessMaximum;
3332#endif
3333#ifdef USE_SHEEN
3334	uniform vec3 sheenColor;
3335	uniform float sheenRoughness;
3336	#ifdef USE_SHEEN_COLORMAP
3337		uniform sampler2D sheenColorMap;
3338	#endif
3339	#ifdef USE_SHEEN_ROUGHNESSMAP
3340		uniform sampler2D sheenRoughnessMap;
3341	#endif
3342#endif
3343#ifdef USE_ANISOTROPY
3344	uniform vec2 anisotropyVector;
3345	#ifdef USE_ANISOTROPYMAP
3346		uniform sampler2D anisotropyMap;
3347	#endif
3348#endif
3349varying vec3 vViewPosition;
3350#include <common>
3351#include <dithering_pars_fragment>
3352#include <color_pars_fragment>
3353#include <uv_pars_fragment>
3354#include <map_pars_fragment>
3355#include <alphamap_pars_fragment>
3356#include <alphatest_pars_fragment>
3357#include <alphahash_pars_fragment>
3358#include <aomap_pars_fragment>
3359#include <lightmap_pars_fragment>
3360#include <emissivemap_pars_fragment>
3361#include <iridescence_fragment>
3362#include <cube_uv_reflection_fragment>
3363#include <envmap_common_pars_fragment>
3364#include <envmap_physical_pars_fragment>
3365#include <fog_pars_fragment>
3366#include <lights_pars_begin>
3367#include <normal_pars_fragment>
3368#include <lights_physical_pars_fragment>
3369#include <transmission_pars_fragment>
3370#include <shadowmap_pars_fragment>
3371#include <bumpmap_pars_fragment>
3372#include <normalmap_pars_fragment>
3373#include <clearcoat_pars_fragment>
3374#include <iridescence_pars_fragment>
3375#include <roughnessmap_pars_fragment>
3376#include <metalnessmap_pars_fragment>
3377#include <logdepthbuf_pars_fragment>
3378#include <clipping_planes_pars_fragment>
3379void main() {
3380	vec4 diffuseColor = vec4( diffuse, opacity );
3381	#include <clipping_planes_fragment>
3382	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3383	vec3 totalEmissiveRadiance = emissive;
3384	#include <logdepthbuf_fragment>
3385	#include <map_fragment>
3386	#include <color_fragment>
3387	#include <alphamap_fragment>
3388	#include <alphatest_fragment>
3389	#include <alphahash_fragment>
3390	#include <roughnessmap_fragment>
3391	#include <metalnessmap_fragment>
3392	#include <normal_fragment_begin>
3393	#include <normal_fragment_maps>
3394	#include <clearcoat_normal_fragment_begin>
3395	#include <clearcoat_normal_fragment_maps>
3396	#include <emissivemap_fragment>
3397	#include <lights_physical_fragment>
3398	#include <lights_fragment_begin>
3399	#include <lights_fragment_maps>
3400	#include <lights_fragment_end>
3401	#include <aomap_fragment>
3402	vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
3403	vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
3404	#include <transmission_fragment>
3405	vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
3406	#ifdef USE_SHEEN
3407 
3408		outgoingLight = outgoingLight + sheenSpecularDirect + sheenSpecularIndirect;
3409 
3410 	#endif
3411	#ifdef USE_CLEARCOAT
3412		float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
3413		vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
3414		outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
3415	#endif
3416	#include <opaque_fragment>
3417	#include <tonemapping_fragment>
3418	#include <colorspace_fragment>
3419	#include <fog_fragment>
3420	#include <premultiplied_alpha_fragment>
3421	#include <dithering_fragment>
3422}`,SM=`#define TOON
3423varying vec3 vViewPosition;
3424#include <common>
3425#include <batching_pars_vertex>
3426#include <uv_pars_vertex>
3427#include <displacementmap_pars_vertex>
3428#include <color_pars_vertex>
3429#include <fog_pars_vertex>
3430#include <normal_pars_vertex>
3431#include <morphtarget_pars_vertex>
3432#include <skinning_pars_vertex>
3433#include <shadowmap_pars_vertex>
3434#include <logdepthbuf_pars_vertex>
3435#include <clipping_planes_pars_vertex>
3436void main() {
3437	#include <uv_vertex>
3438	#include <color_vertex>
3439	#include <morphinstance_vertex>
3440	#include <morphcolor_vertex>
3441	#include <batching_vertex>
3442	#include <beginnormal_vertex>
3443	#include <morphnormal_vertex>
3444	#include <skinbase_vertex>
3445	#include <skinnormal_vertex>
3446	#include <defaultnormal_vertex>
3447	#include <normal_vertex>
3448	#include <begin_vertex>
3449	#include <morphtarget_vertex>
3450	#include <skinning_vertex>
3451	#include <displacementmap_vertex>
3452	#include <project_vertex>
3453	#include <logdepthbuf_vertex>
3454	#include <clipping_planes_vertex>
3455	vViewPosition = - mvPosition.xyz;
3456	#include <worldpos_vertex>
3457	#include <shadowmap_vertex>
3458	#include <fog_vertex>
3459}
3459`,CM=`#define TOON
3460uniform vec3 diffuse;
3461uniform vec3 emissive;
3462uniform float opacity;
3463#include <common>
3464#include <dithering_pars_fragment>
3465#include <color_pars_fragment>
3466#include <uv_pars_fragment>
3467#include <map_pars_fragment>
3468#include <alphamap_pars_fragment>
3469#include <alphatest_pars_fragment>
3470#include <alphahash_pars_fragment>
3471#include <aomap_pars_fragment>
3472#include <lightmap_pars_fragment>
3473#include <emissivemap_pars_fragment>
3474#include <gradientmap_pars_fragment>
3475#include <fog_pars_fragment>
3476#include <bsdfs>
3477#include <lights_pars_begin>
3478#include <normal_pars_fragment>
3479#include <lights_toon_pars_fragment>
3480#include <shadowmap_pars_fragment>
3481#include <bumpmap_pars_fragment>
3482#include <normalmap_pars_fragment>
3483#include <logdepthbuf_pars_fragment>
3484#include <clipping_planes_pars_fragment>
3485void main() {
3486	vec4 diffuseColor = vec4( diffuse, opacity );
3487	#include <clipping_planes_fragment>
3488	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
3489	vec3 totalEmissiveRadiance = emissive;
3490	#include <logdepthbuf_fragment>
3491	#include <map_fragment>
3492	#include <color_fragment>
3493	#include <alphamap_fragment>
3494	#include <alphatest_fragment>
3495	#include <alphahash_fragment>
3496	#include <normal_fragment_begin>
3497	#include <normal_fragment_maps>
3498	#include <emissivemap_fragment>
3499	#include <lights_toon_fragment>
3500	#include <lights_fragment_begin>
3501	#include <lights_fragment_maps>
3502	#include <lights_fragment_end>
3503	#include <aomap_fragment>
3504	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
3505	#include <opaque_fragment>
3506	#include <tonemapping_fragment>
3507	#include <colorspace_fragment>
3508	#include <fog_fragment>
3509	#include <premultiplied_alpha_fragment>
3510	#include <dithering_fragment>
3511}`,MM=`uniform float size;
3512uniform float scale;
3513#include <common>
3514#include <color_pars_vertex>
3515#include <fog_pars_vertex>
3516#include <morphtarget_pars_vertex>
3517#include <logdepthbuf_pars_vertex>
3518#include <clipping_planes_pars_vertex>
3519#ifdef USE_POINTS_UV
3520	varying vec2 vUv;
3521	uniform mat3 uvTransform;
3522#endif
3523void main() {
3524	#ifdef USE_POINTS_UV
3525		vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
3526	#endif
3527	#include <color_vertex>
3528	#include <morphinstance_vertex>
3529	#include <morphcolor_vertex>
3530	#include <begin_vertex>
3531	#include <morphtarget_vertex>
3532	#include <project_vertex>
3533	gl_PointSize = size;
3534	#ifdef USE_SIZEATTENUATION
3535		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3536		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
3537	#endif
3538	#include <logdepthbuf_vertex>
3539	#include <clipping_planes_vertex>
3540	#include <worldpos_vertex>
3541	#include <fog_vertex>
3542}`,IM=`uniform vec3 diffuse;
3543uniform float opacity;
3544#include <common>
3545#include <color_pars_fragment>
3546#include <map_particle_pars_fragment>
3547#include <alphatest_pars_fragment>
3548#include <alphahash_pars_fragment>
3549#include <fog_pars_fragment>
3550#include <logdepthbuf_pars_fragment>
3551#include <clipping_planes_pars_fragment>
3552void main() {
3553	vec4 diffuseColor = vec4( diffuse, opacity );
3554	#include <clipping_planes_fragment>
3555	vec3 outgoingLight = vec3( 0.0 );
3556	#include <logdepthbuf_fragment>
3557	#include <map_particle_fragment>
3558	#include <color_fragment>
3559	#include <alphatest_fragment>
3560	#include <alphahash_fragment>
3561	outgoingLight = diffuseColor.rgb;
3562	#include <opaque_fragment>
3563	#include <tonemapping_fragment>
3564	#include <colorspace_fragment>
3565	#include <fog_fragment>
3566	#include <premultiplied_alpha_fragment>
3567}`,wM=`#include <common>
3568#include <batching_pars_vertex>
3569#include <fog_pars_vertex>
3570#include <morphtarget_pars_vertex>
3571#include <skinning_pars_vertex>
3572#include <logdepthbuf_pars_vertex>
3573#include <shadowmap_pars_vertex>
3574void main() {
3575	#include <batching_vertex>
3576	#include <beginnormal_vertex>
3577	#include <morphinstance_vertex>
3578	#include <morphnormal_vertex>
3579	#include <skinbase_vertex>
3580	#include <skinnormal_vertex>
3581	#include <defaultnormal_vertex>
3582	#include <begin_vertex>
3583	#include <morphtarget_vertex>
3584	#include <skinning_vertex>
3585	#include <project_vertex>
3586	#include <logdepthbuf_vertex>
3587	#include <worldpos_vertex>
3588	#include <shadowmap_vertex>
3589	#include <fog_vertex>
3590}`,TM=`uniform vec3 color;
3591uniform float opacity;
3592#include <common>
3593#include <fog_pars_fragment>
3594#include <bsdfs>
3595#include <lights_pars_begin>
3596#include <logdepthbuf_pars_fragment>
3597#include <shadowmap_pars_fragment>
3598#include <shadowmask_pars_fragment>
3599void main() {
3600	#include <logdepthbuf_fragment>
3601	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
3602	#include <tonemapping_fragment>
3603	#include <colorspace_fragment>
3604	#include <fog_fragment>
3605	#include <premultiplied_alpha_fragment>
3606}`,RM=`uniform float rotation;
3607uniform vec2 center;
3608#include <common>
3609#include <uv_pars_vertex>
3610#include <fog_pars_vertex>
3611#include <logdepthbuf_pars_vertex>
3612#include <clipping_planes_pars_vertex>
3613void main() {
3614	#include <uv_vertex>
3615	vec4 mvPosition = modelViewMatrix[ 3 ];
3616	vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
3617	#ifndef USE_SIZEATTENUATION
3618		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
3619		if ( isPerspective ) scale *= - mvPosition.z;
3620	#endif
3621	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
3622	vec2 rotatedPosition;
3623	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
3624	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
3625	mvPosition.xy += rotatedPosition;
3626	gl_Position = projectionMatrix * mvPosition;
3627	#include <logdepthbuf_vertex>
3628	#include <clipping_planes_vertex>
3629	#include <fog_vertex>
3630}`,BM=`uniform vec3 diffuse;
3631uniform float opacity;
3632#include <common>
3633#include <uv_pars_fragment>
3634#include <map_pars_fragment>
3635#include <alphamap_pars_fragment>
3636#include <alphatest_pars_fragment>
3637#include <alphahash_pars_fragment>
3638#include <fog_pars_fragment>
3639#include <logdepthbuf_pars_fragment>
3640#include <clipping_planes_pars_fragment>
3641void main() {
3642	vec4 diffuseColor = vec4( diffuse, opacity );
3643	#include <clipping_planes_fragment>
3644	vec3 outgoingLight = vec3( 0.0 );
3645	#include <logdepthbuf_fragment>
3646	#include <map_fragment>
3647	#include <alphamap_fragment>
3648	#include <alphatest_fragment>
3649	#include <alphahash_fragment>
3650	outgoingLight = diffuseColor.rgb;
3651	#include <opaque_fragment>
3652	#include <tonemapping_fragment>
3653	#include <colorspace_fragment>
3654	#include <fog_fragment>
3655}`,je={alphahash_fragment:Zy,alphahash_pars_fragment:eS,alphamap_fragment:tS,alph
vendor: 7,306 bytes, line 3655
3655amap_pars_fragment:nS,alphatest_fragment:iS,alphatest_pars_fragment:sS,aomap_fragment:rS,aomap_pars_fragment:aS,batching_pars_vertex:oS,batching_vertex:cS,begin_vertex:lS,beginnormal_vertex:hS,bsdfs:uS,iridescence_fragment:dS,bumpmap_pars_fragment:fS,clipping_planes_fragment:pS,clipping_planes_pars_fragment:AS,clipping_planes_pars_vertex:gS,clipping_planes_vertex:mS,color_fragment:bS,color_pars_fragment:xS,color_pars_vertex:ES,color_vertex:_S,common:vS,cube_uv_reflection_fragment:yS,defaultnormal_vertex:SS,displacementmap_pars_vertex:CS,displacementmap_vertex:MS,emissivemap_fragment:IS,emissivemap_pars_fragment:wS,colorspace_fragment:TS,colorspace_pars_fragment:RS,envmap_fragment:BS,envmap_common_pars_fragment:DS,envmap_pars_fragment:LS,envmap_pars_vertex:PS,envmap_physical_pars_fragment:WS,envmap_vertex:FS,fog_vertex:NS,fog_pars_vertex:US,fog_fragment:OS,fog_pars_fragment:kS,gradientmap_pars_fragment:QS,lightmap_pars_fragment:GS,lights_lambert_fragment:HS,lights_lambert_pars_fragment:zS,lights_pars_begin:VS,lights_toon_fragment:qS,lights_toon_pars_fragment:jS,lights_phong_fragment:XS,lights_phong_pars_fragment:KS,lights_physical_fragment:$S,lights_physical_pars_fragment:YS,lights_fragment_begin:JS,lights_fragment_maps:ZS,lights_fragment_end:eC,logdepthbuf_fragment:tC,logdepthbuf_pars_fragment:nC,logdepthbuf_pars_vertex:iC,logdepthbuf_vertex:sC,map_fragment:rC,map_pars_fragment:aC,map_particle_fragment:oC,map_particle_pars_fragment:cC,metalnessmap_fragment:lC,metalnessmap_pars_fragment:hC,morphinstance_vertex:uC,morphcolor_vertex:dC,morphnormal_vertex:fC,morphtarget_pars_vertex:pC,morphtarget_vertex:AC,normal_fragment_begin:gC,normal_fragment_maps:mC,normal_pars_fragment:bC,normal_pars_vertex:xC,normal_vertex:EC,normalmap_pars_fragment:_C,clearcoat_normal_fragment_begin:vC,clearcoat_normal_fragment_maps:yC,clearcoat_pars_fragment:SC,iridescence_pars_fragment:CC,opaque_fragment:MC,packing:IC,premultiplied_alpha_fragment:wC,project_vertex:TC,dithering_fragment:RC,dithering_pars_fragment:BC,roughnessmap_fragment:DC,roughnessmap_pars_fragment:LC,shadowmap_pars_fragment:PC,shadowmap_pars_vertex:FC,shadowmap_vertex:NC,shadowmask_pars_fragment:UC,skinbase_vertex:OC,skinning_pars_vertex:kC,skinning_vertex:QC,skinnormal_vertex:GC,specularmap_fragment:HC,specularmap_pars_fragment:zC,tonemapping_fragment:VC,tonemapping_pars_fragment:WC,transmission_fragment:qC,transmission_pars_fragment:jC,uv_pars_fragment:XC,uv_pars_vertex:KC,uv_vertex:$C,worldpos_vertex:YC,background_vert:JC,background_frag:ZC,backgroundCube_vert:eM,backgroundCube_frag:tM,cube_vert:nM,cube_frag:iM,depth_vert:sM,depth_frag:rM,distance_vert:aM,distance_frag:oM,equirect_vert:cM,equirect_frag:lM,linedashed_vert:hM,linedashed_frag:uM,meshbasic_vert:dM,meshbasic_frag:fM,meshlambert_vert:pM,meshlambert_frag:AM,meshmatcap_vert:gM,meshmatcap_frag:mM,meshnormal_vert:bM,meshnormal_frag:xM,meshphong_vert:EM,meshphong_frag:_M,meshphysical_vert:vM,meshphysical_frag:yM,meshtoon_vert:SM,meshtoon_frag:CM,points_vert:MM,points_frag:IM,shadow_vert:wM,shadow_frag:TM,sprite_vert:RM,sprite_frag:BM},he={common:{diffuse:{value:new Me(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Qe},alphaMap:{value:null},alphaMapTransform:{value:new Qe},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Qe}},envmap:{envMap:{value:null},envMapRotation:{value:new Qe},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98},dfgLUT:{value:null}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Qe}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Qe}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Qe},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Qe},normalScale:{value:new pe(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Qe},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Qe}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Qe}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Qe}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Me(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Me(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Qe},alphaTest:{value:0},uvTransform:{value:new Qe}},sprite:{diffuse:{value:new Me(16777215)},opacity:{value:1},center:{value:new pe(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Qe},alphaMap:{value:null},alphaMapTransform:{value:new Qe},alphaTest:{value:0}}},fi={basic:{uniforms:_n([he.common,he.specularmap,he.envmap,he.aomap,he.lightmap,he.fog]),vertexShader:je.meshbasic_vert,fragmentShader:je.meshbasic_frag},lambert:{uniforms:_n([he.common,he.specularmap,he.envmap,he.aomap,he.lightmap,he.emissivemap,he.bumpmap,he.normalmap,he.displacementmap,he.fog,he.lights,{emissive:{value:new Me(0)},envMapIntensity:{value:1}}]),vertexShader:je.meshlambert_vert,fragmentShader:je.meshlambert_frag},phong:{uniforms:_n([he.common,he.specularmap,he.envmap,he.aomap,he.lightmap,he.emissivemap,he.bumpmap,he.normalmap,he.displacementmap,he.fog,he.lights,{emissive:{value:new Me(0)},specular:{value:new Me(1118481)},shininess:{value:30},envMapIntensity:{value:1}}]),vertexShader:je.meshphong_vert,fragmentShader:je.meshphong_frag},standard:{uniforms:_n([he.common,he.envmap,he.aomap,he.lightmap,he.emissivemap,he.bumpmap,he.normalmap,he.displacementmap,he.roughnessmap,he.metalnessmap,he.fog,he.lights,{emissive:{value:new Me(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:je.meshphysical_vert,fragmentShader:je.meshphysical_frag},toon:{uniforms:_n([he.common,he.aomap,he.lightmap,he.emissivemap,he.bumpmap,he.normalmap,he.displacementmap,he.gradientmap,he.fog,he.lights,{emissive:{value:new Me(0)}}]),vertexShader:je.meshtoon_vert,fragmentShader:je.meshtoon_frag},matcap:{uniforms:_n([he.common,he.bumpmap,he.normalmap,he.displacementmap,he.fog,{matc
vendor: 5,273 bytes, line 3655
3655ap:{value:null}}]),vertexShader:je.meshmatcap_vert,fragmentShader:je.meshmatcap_frag},points:{uniforms:_n([he.points,he.fog]),vertexShader:je.points_vert,fragmentShader:je.points_frag},dashed:{uniforms:_n([he.common,he.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:je.linedashed_vert,fragmentShader:je.linedashed_frag},depth:{uniforms:_n([he.common,he.displacementmap]),vertexShader:je.depth_vert,fragmentShader:je.depth_frag},normal:{uniforms:_n([he.common,he.bumpmap,he.normalmap,he.displacementmap,{opacity:{value:1}}]),vertexShader:je.meshnormal_vert,fragmentShader:je.meshnormal_frag},sprite:{uniforms:_n([he.sprite,he.fog]),vertexShader:je.sprite_vert,fragmentShader:je.sprite_frag},background:{uniforms:{uvTransform:{value:new Qe},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:je.background_vert,fragmentShader:je.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Qe}},vertexShader:je.backgroundCube_vert,fragmentShader:je.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:je.cube_vert,fragmentShader:je.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:je.equirect_vert,fragmentShader:je.equirect_frag},distance:{uniforms:_n([he.common,he.displacementmap,{referencePosition:{value:new R},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:je.distance_vert,fragmentShader:je.distance_frag},shadow:{uniforms:_n([he.lights,he.fog,{color:{value:new Me(0)},opacity:{value:1}}]),vertexShader:je.shadow_vert,fragmentShader:je.shadow_frag}};fi.physical={uniforms:_n([fi.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Qe},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Qe},clearcoatNormalScale:{value:new pe(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Qe},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Qe},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Qe},sheen:{value:0},sheenColor:{value:new Me(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Qe},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Qe},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Qe},transmissionSamplerSize:{value:new pe},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Qe},attenuationDistance:{value:0},attenuationColor:{value:new Me(0)},specularColor:{value:new Me(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Qe},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Qe},anisotropyVector:{value:new pe},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Qe}}]),vertexShader:je.meshphysical_vert,fragmentShader:je.meshphysical_frag};const Ic={r:0,b:0,g:0},ws=new Hn,DM=new Oe;function LM(r,e,t,n,i,s){const a=new Me(0);let o=i===!0?0:1,c,l,h=null,u=0,d=null;function f(b){let x=b.isScene===!0?b.background:null;if(x&&x.isTexture){const _=b.backgroundBlurriness>0;x=e.get(x,_)}return x}function p(b){let x=!1;const _=f(b);_===null?A(a,o):_&&_.isColor&&(A(_,1),x=!0);const v=r.xr.getEnvironmentBlendMode();v==="additive"?t.buffers.color.setClear(0,0,0,1,s):v==="alpha-blend"&&t.buffers.color.setClear(0,0,0,0,s),(r.autoClear||x)&&(t.buffers.depth.setTest(!0),t.buffers.depth.setMask(!0),t.buffers.color.setMask(!0),r.clear(r.autoClearColor,r.autoClearDepth,r.autoClearStencil))}function m(b,x){const _=f(x);_&&(_.isCubeTexture||_.mapping===Jl)?(l===void 0&&(l=new at(new ji(1,1,1),new mn({name:"BackgroundCubeMaterial",uniforms:fa(fi.backgroundCube.uniforms),vertexShader:fi.backgroundCube.vertexShader,fragmentShader:fi.backgroundCube.fragmentShader,side:on,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute("normal"),l.geometry.deleteAttribute("uv"),l.onBeforeRender=function(v,C,I){this.matrixWorld.copyPosition(I.matrixWorld)},Object.defineProperty(l.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),n.update(l)),ws.copy(x.backgroundRotation),ws.x*=-1,ws.y*=-1,ws.z*=-1,_.isCubeTexture&&_.isRenderTargetTexture===!1&&(ws.y*=-1,ws.z*=-1),l.material.uniforms.envMap.value=_,l.material.uniforms.flipEnvMap.value=_.isCubeTexture&&_.isRenderTargetTexture===!1?-1:1,l.material.uniforms.backgroundBlurriness.value=x.backgroundBlurriness,l.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,l.material.uniforms.backgroundRotation.value.setFromMatrix4(DM.makeRotationFromEuler(ws)),l.material.toneMapped=tt.getTransfer(_.colorSpace)!==ft,(h!==_||u!==_.version||d!==r.toneMapping)&&(l.material.needsUpdate=!0,h=_,u=_.version,d=r.toneMapping),l.layers.enableAll(),b.unshift(l,l.geometry,l.material,0,0,null)):_&&_.isTexture&&(c===void 0&&(c=new at(new zn(2,2),new mn({name:"Backgroun
3655dMaterial",uniforms:fa(fi.background.uniforms),vertexShader:fi.background.vertexShader,fragmentShader:fi.background.fragmentShader,side:ti,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(c)),c.material.uniforms.t2D.value=_,c.material.uniforms.backgroundIntensity.value=x.backgroundIntensity,c.material.toneMapped=tt.getTransfer(_.colorSpace)!==ft,_.matrixAutoUpdate===!0&&_.updateMatrix(),c.material.uniforms.uvTransform.value.copy(_.matrix),(h!==_||u!==_.version||d!==r.toneMapping)&&(c.material.needsUpdate=!0,h=_,u=_.version,d=r.toneMapping),c.layers.enableAll(),b.unshift(c,c.geometry,c.material,0,0,null))}function A(b,x){b.getRGB(Ic,vb(r)),t.buffers.color.setClear(Ic.r,Ic.g,Ic.b,x,s)}function g(){l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0),c!==void 0&&(c.geometry.dispose(),c.material.dispose(),c=void 0)}return{getClearColor:function(){return a},setClearColor:function(b,x=1){a.set(b),o=x,A(a,o)},getClearAlpha:function(){return o},setClearAlpha:function(b){o=b,A(a,o)},render:p,addToRenderList:m,dispose:g}}function PM(r,e){const t=r.getParameter(r.MAX_VERTEX_ATTRIBS),n={},i=d(null);let s=i,a=!1;function o(w,L,N,O,D){let U=!1;const F=u(w,O,N,L);s!==F&&(s=F,l(s.object)),U=f(w,O,N,D),U&&p(w,O,N,D),D!==null&&e.update(D,r.ELEMENT_ARRAY_BUFFER),(U||a)&&(a=!1,_(w,L,N,O),D!==null&&r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e.get(D).buffer))}function c(){return r.createVertexArray()}function l(w){return r.bindVertexArray(w)}function h(w){return r.deleteVertexArray(w)}function u(w,L,N,O){const D=O.wireframe===!0;let U=n[L.id];U===void 0&&(U={},n[L.id]=U);const F=w.isInstancedMesh===!0?w.id:0;let $=U[F];$===void 0&&($={},U[F]=$);let q=$[N.id];q===void 0&&(q={},$[N.id]=q);let te=q[D];return te===void 0&&(te=d(c()),q[D]=te),te}function d(w){const L=[],N=[],O=[];for(let D=0;D<t;D++)L[D]=0,N[D]=0,O[D]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:L,enabledAttributes:N,attributeDivisors:O,object:w,attributes:{},index:null}}function f(w,L,N,O){const D=s.attributes,U=L.attributes;let F=0;const $=N.getAttributes();for(const q in $)if($[q].location>=0){const Z=D[q];let Y=U[q];if(Y===void 0&&(q==="instanceMatrix"&&w.instanceMatrix&&(Y=w.instanceMatrix),q==="instanceColor"&&w.instanceColor&&(Y=w.instanceColor)),Z===void 0||Z.attribute!==Y||Y&&Z.data!==Y.data)return!0;F++}return s.attributesNum!==F||s.index!==O}function p(w,L,N,O){const D={},U=L.attributes;let F=0;const $=N.getAttributes();for(const q in $)if($[q].location>=0){let Z=U[q];Z===void 0&&(q==="instanceMatrix"&&w.instanceMatrix&&(Z=w.instanceMatrix),q==="instanceColor"&&w.instanceColor&&(Z=w.instanceColor));const Y={};Y.attribute=Z,Z&&Z.data&&(Y.data=Z.data),D[q]=Y,F++}s.attributes=D,s.attributesNum=F,s.index=O}function m(){const w=s.newAttributes;for(let L=0,N=w.length;L<N;L++)w[L]=0}function A(w){g(w,0)}function g(w,L){const N=s.newAttributes,O=s.enabledAttributes,D=s.attributeDivisors;N[w]=1,O[w]===0&&(r.enableVertexAttribArray(w),O[w]=1),D[w]!==L&&(r.vertexAttribDivisor(w,L),D[w]=L)}function b(){const w=s.newAttributes,L=s.enabledAttributes;for(let N=0,O=L.length;N<O;N++)L[N]!==w[N]&&(r.disableVertexAttribArray(N),L[N]=0)}function x(w,L,N,O,D,U,F){F===!0?r.vertexAttribIPointer(w,L,N,D,U):r.vertexAttribPointer(w,L,N,O,D,U)}function _(w,L,N,O){m();const D=O.attributes,U=N.getAttributes(),F=L.defaultAttributeValues;for(const $ in U){const q=U[$];if(q.location>=0){let te=D[$];if(te===void 0&&($==="instanceMatrix"&&w.instanceMatrix&&(te=w.instanceMatrix),$==="instanceColor"&&w.instanceColor&&(te=w.instanceColor)),te!==void 0){const Z=te.normalized,Y=te.itemSize,fe=e.get(te);if(fe===void 0)continue;const Ge=fe.buffer,ze=fe.type,X=fe.bytesPerElement,se=ze===r.INT||ze===r.UNSIGNED_INT||te.gpuType===Zl;if(te.isInterleavedBufferAttribute){const oe=te.data,He=oe.stride,De=te.offset;if(oe.isInstancedInterleavedBuffer){for(let Fe=0;Fe<q.locationSize;Fe++)g(q.location+Fe,oe.meshPerAttribute);w.isInstancedMesh!==!0&&O._maxInstanceCount===void 0&&(O._maxInstanceCount=oe.meshPerAttribute*oe.count)}else for(let Fe=0;Fe<q.locationSize;Fe++)A(q.location+Fe);r.bindBuffer(r.ARRAY_BUFFER,Ge);for(let Fe=0;Fe<q.locationSize;Fe++)x(q.location+Fe,Y/q.locationSize,ze,Z,He*X,(De+Y/q.locationSize*Fe)*X,se)}else{if(te.isInstancedBufferAttribute){for(let oe=0;oe<q.locationSize;oe++)g(q.location+oe,te.meshPerAttribute);w.isInstancedMesh!==!0&&O._maxInstanceCount===void 0&&(O._maxInstanceCount=te.meshPerAttribute*te.count)}else for(let oe=0;oe<q.locationSize;oe++)A(q.location+oe);r.bindBuffer(r.ARRAY_BUFFER,Ge);for(let oe=0;oe<q.locationSize;oe++)x(q.location+oe,Y/q.locationSize,ze,Z,Y*X,Y/q.locationSize*oe*X,se)}}else if(F!==void 0){const Z=F[$];if(Z!==void 0)switch(Z.length){case 2:r.vertexAttrib2fv(q.location,Z);break;case 3:r.vertexAttrib3fv(q.location,Z);break;case 4:r.vertexAttrib4fv(q.location,Z);break;default:r.vertexAttrib1fv(q.location,Z)}}}}b()}function v(){S();for(const w in n){const L=n[w];for(const N in L){const O=L[N];for(const D in O){const U=O[D];for(const F in U)h(U[F].object),delete U[F];delete O[D]}}delete n[w]}}function C(w){if(n[w.id]===void 0)return;const L=n[w.id];for(const N in L){const O=L[N];for(const D in O){const U=O[D];for(const F in U)h(U[F].object),delete U[F];delete O[D]}}delete n[w.id]}function I(w){for(const L in n){const N=n[L];for(const O in N){const D=N[O];if(D[w.id]===void 0)continue;const U=D[w.id];for(const F in U)h(U[F].object),delete U[F];delete D[w.id]}}}function E(w){for(const L in n){const N=n[L],O=w.isInstancedMesh===!0?w.id:0,D=N[O];if(D!==void 0){for(const U in D){const F=D[U];for(const $ in F)h(F[$].object),delete F[$];delete D[U]}delete N[O],Object.keys(N).length===0&&delete n[L]}}}function S(){P(),a=!0,s!==i&&(s=i,l(s.object))}function P(){i.geometry=null,i.program=null,i.wireframe=!1}return{setup:o,reset:S,resetDefaultState:P,dispose:v,releaseStatesOfGeometry:C,releaseStatesOfObject:E,releaseStatesOfProgram:I,initAttributes:m,enableAttribute:A,disableUnusedAttributes:b}}function FM(r,e,t){let n;function i(l){n=l}function s(l,h){r.drawArrays(n,l,h),t.update(h,n,1)}function a(l,h,u){u!==0&&(r.drawArraysInstanced(n,l,h,u),t.update(h,n,u))}function o(l,h,u){if(u===0)return;e.get("WEBGL_multi_draw").multiDrawArraysWEBGL(n,l,0,h,0,u);let f=0;for(let p=0;p<u;p++)f+=h[p];t.update(f,n,1)}function c(l,h,u,d){if(u===0)return;const f=e.get("WEBGL_multi_draw");if(f===null)for(let p=0;p<l.length;p++)a(l[p],h[p],d[p]);
vendor: 13,052 bytes, lines 3655-3728
3655else{f.multiDrawArraysInstancedWEBGL(n,l,0,h,0,d,0,u);let p=0;for(let m=0;m<u;m++)p+=h[m]*d[m];t.update(p,n,1)}}this.setMode=i,this.render=s,this.renderInstances=a,this.renderMultiDraw=o,this.renderMultiDrawInstances=c}function NM(r,e,t,n){let i;function s(){if(i!==void 0)return i;if(e.has("EXT_texture_filter_anisotropic")===!0){const I=e.get("EXT_texture_filter_anisotropic");i=r.getParameter(I.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else i=0;return i}function a(I){return!(I!==Tt&&n.convert(I)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(I){const E=I===yt&&(e.has("EXT_color_buffer_half_float")||e.has("EXT_color_buffer_float"));return!(I!==Le&&n.convert(I)!==r.getParameter(r.IMPLEMENTATION_COLOR_READ_TYPE)&&I!==Nt&&!E)}function c(I){if(I==="highp"){if(r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.HIGH_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision>0)return"highp";I="mediump"}return I==="mediump"&&r.getShaderPrecisionFormat(r.VERTEX_SHADER,r.MEDIUM_FLOAT).precision>0&&r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let l=t.precision!==void 0?t.precision:"highp";const h=c(l);h!==l&&(Ie("WebGLRenderer:",l,"not supported, using",h,"instead."),l=h);const u=t.logarithmicDepthBuffer===!0,d=t.reversedDepthBuffer===!0&&e.has("EXT_clip_control"),f=r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS),p=r.getParameter(r.MAX_VERTEX_TEXTURE_IMAGE_UNITS),m=r.getParameter(r.MAX_TEXTURE_SIZE),A=r.getParameter(r.MAX_CUBE_MAP_TEXTURE_SIZE),g=r.getParameter(r.MAX_VERTEX_ATTRIBS),b=r.getParameter(r.MAX_VERTEX_UNIFORM_VECTORS),x=r.getParameter(r.MAX_VARYING_VECTORS),_=r.getParameter(r.MAX_FRAGMENT_UNIFORM_VECTORS),v=r.getParameter(r.MAX_SAMPLES),C=r.getParameter(r.SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:c,textureFormatReadable:a,textureTypeReadable:o,precision:l,logarithmicDepthBuffer:u,reversedDepthBuffer:d,maxTextures:f,maxVertexTextures:p,maxTextureSize:m,maxCubemapSize:A,maxAttributes:g,maxVertexUniforms:b,maxVaryings:x,maxFragmentUniforms:_,maxSamples:v,samples:C}}function UM(r){const e=this;let t=null,n=0,i=!1,s=!1;const a=new ks,o=new Qe,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(u,d){const f=u.length!==0||d||n!==0||i;return i=d,n=u.length,f},this.beginShadows=function(){s=!0,h(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(u,d){t=h(u,d,0)},this.setState=function(u,d,f){const p=u.clippingPlanes,m=u.clipIntersection,A=u.clipShadows,g=r.get(u);if(!i||p===null||p.length===0||s&&!A)s?h(null):l();else{const b=s?0:n,x=b*4;let _=g.clippingState||null;c.value=_,_=h(p,d,x,f);for(let v=0;v!==x;++v)_[v]=t[v];g.clippingState=_,this.numIntersection=m?this.numPlanes:0,this.numPlanes+=b}};function l(){c.value!==t&&(c.value=t,c.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function h(u,d,f,p){const m=u!==null?u.length:0;let A=null;if(m!==0){if(A=c.value,p!==!0||A===null){const g=f+m*4,b=d.matrixWorldInverse;o.getNormalMatrix(b),(A===null||A.length<g)&&(A=new Float32Array(g));for(let x=0,_=f;x!==m;++x,_+=4)a.copy(u[x]).applyMatrix4(b,o),a.normal.toArray(A,_),A[_+3]=a.constant}c.value=A,c.needsUpdate=!0}return e.numPlanes=m,e.numIntersection=0,A}}const ps=4,CA=[.125,.215,.35,.446,.526,.582],qs=20,OM=256,Pa=new cr,MA=new Me;let Kh=null,$h=0,Yh=0,Jh=!1;const kM=new R;class IA{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._sizeLods=[],this._sigmas=[],this._lodMeshes=[],this._backgroundBox=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._blurMaterial=null,this._ggxMaterial=null}fromScene(e,t=0,n=.1,i=100,s={}){const{size:a=256,position:o=kM}=s;Kh=this._renderer.getRenderTarget(),$h=this._renderer.getActiveCubeFace(),Yh=this._renderer.getActiveMipmapLevel(),Jh=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);const c=this._allocateTargets();return c.depthBuffer=!0,this._sceneToCubeUV(e,n,i,c,o),t>0&&this._blur(c,0,0,t),this._applyPMREM(c),this._cleanup(c),c}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=RA(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=TA(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose(),this._backgroundBox!==null&&(this._backgroundBox.geometry.dispose(),this._backgroundBox.material.dispose())}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._ggxMaterial!==null&&this._ggxMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e<this._lodMeshes.length;e++)this._lodMeshes[e].geometry.dispose()}_cleanup(e){this._renderer.setRenderTarget(Kh,$h,Yh),this._renderer.xr.enabled=Jh,e.scissorTest=!1,Mr(e,0,0,e.width,e.height)}_fromTexture(e,t){e.mapping===bs||e.mapping===aa?this._setSize(e.image.length===0?16:e.image[0].width||e.image[0].image.width):this._setSize(e.image.width/4),Kh=this._renderer.getRenderTarget(),$h=this._renderer.getActiveCubeFace(),Yh=this._renderer.getActiveMipmapLevel(),Jh=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const n=t||this._allocateTargets();return this._textureToCubeUV(e,n),this._applyPMREM(n),this._cleanup(n),n}_allocateTargets(){const e=3*Math.max(this._cubeSize,112),t=4*this._cubeSize,n={magFilter:qe,minFilter:qe,generateMipmaps:!1,type:yt,format:Tt,colorSpace:Ct,depthBuffer:!1},i=wA(e,t,n);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==e||this._pingPongRenderTarget.height!==t){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=wA(e,t,n);const{_lodMax:s}=this;({lodMeshes:this._lodMeshes,sizeLods:this._sizeLods,sigmas:this._sigmas}=QM(s)),this._blurMaterial=HM(s,e,t),this._ggxMaterial=GM(s,e,t)}return i}_compileMaterial(e){const t=new at(new cn,e);this._renderer.compile(t,Pa)}_sceneToCubeUV(e,t,n,i,s){const c=new Zt(90,1,t,n),l=[1,-1,1,1,1,1],h=[1,1,1,-1,-1,-1],u=this._renderer,d=u.autoClear,f=u.toneMapping;u.getClearColor(MA),u.toneMapping=Qn,u.autoClear=!1,u.state.buffers.depth.getReversed()&&(u.setRenderTarget(i),u.clearDepth(),u.setRenderTarget(null)),this._backgroundBox===null&&(this._backgroundBox=new at(new ji,new pn({name:"PMREM.Background",side:on,depthWrite:!1,depthTest:!1})));const m=this._backgroundBox,A=m.material;let g=!1;const b=e.background;b?b.isColor&&(A.color.copy(b),e.background=null,g=!0):(A.color.copy(MA),g=!0);for(let x=0;x<6;x++){const _=x%3;_===0?(c.up.set(0,l[x],0),c.position.set(s.x,s.y,s.z),c.lookAt(s.x+h[x],s.y,s.z)):_===1?(c.up.set(0,0,l[x]),c.position.set(s.x,s.y,s.z),c.lookAt(s.x,s.y+h[x],s.z)):(c.up.set(0,l[x],0),c.position.set(s.x,s.y,s.z),c.lookAt(s.x,s.y,s.z+h[x]));const v=this._cubeSize;Mr(i,_*v,x>2?v:0,v,v),u.setRenderTarget(i),g&&u.render(m,c),u.render(e,c)}u.toneMapping=f,u.autoClear=d,e.background=b}_textureToCubeUV(e,t){const n=this._renderer,i=e.mapping===bs||e.mapping===aa;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=RA()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=TA());const s=i?this._cubemapMaterial:this._equirectMaterial,a=this._lodMeshes[0];a.material=s;const o=s.uniforms;o.envMap.value=e;const c=this._cubeSize;Mr(t,0,0,3*c,2*c),n.setRenderTarget(t),n.render(a,Pa)}_applyPMREM(e){const t=this._renderer,n=t.autoClear;t.autoClear=!1;const i=this._lodMeshes.length;for(let s=1;s<i;s++)this._applyGGXFilter(e,s-1,s);t.autoClear=n}_applyGGXFilter(e,t,n){const i=this._renderer,s=this._pingPongRenderTarget,a=this._ggxMaterial,o=this._lodMeshes[n];o.material=a;const c=a.uniforms,l=n/(this._lodMeshes.length-1),h=t/(this._lodMeshes.length-1),u=Math.sqrt(l*l-h*h),d=0+l*1.25,f=u*d,{_lodMax:p}=this,m=this._sizeLods[n],A=3*m*(n>p-ps?n-p+ps:0),g=4*(this._cubeSize-m);c.envMap.value=e.texture,c.roughness.value=f,c.mipInt.value=p-t,Mr(s,A,g,3*m,2*m),i.setRenderTarget(s),i.render(o,Pa),c.envMap.value=s.texture,c.roughness.value=0,c.mipInt.value=p-n,Mr(e,A,g,3*m,2*m),i.setRenderTarget(e),i.render(o,Pa)}_blur(e,t,n,i,s){const a=this._pingPongRenderTarget;this._halfBlur(e,a,t,n,i,"latitudinal",s),this._halfBlur(a,e,n,n,i,"longitudinal",s)}_halfBlur(e,t,n,i,s,a,o){const c=this._renderer,l=this._blurMaterial;a!=="latitudinal"&&a!=="longitudinal"&&Pe("blur direction must be either latitudinal or longitudinal!");const h=3,u=this._lodMeshes[i];u.material=l;const d=l.uniforms,f=this._sizeLods[n]-1,p=isFinite(s)?Math.PI/(2*f):2*Math.PI/(2*qs-1),m=s/p,A=isFinite(s)?1+Math.floor(h*m):qs;A>qs&&Ie(`sigmaRadians, ${s}, is too large and will clip, as it requested ${A} samples when the maximum is set to ${qs}`);const g=[];let b=0;for(let I=0;I<qs;++I){const E=I/m,S=Math.exp(-E*E/2);g.push(S),I===0?b+=S:I<A&&(b+=2*S)}for(let I=0;I<g.length;I++)g[I]=g[I]/b;d.envMap.value=e.texture,d.samples.value=A,d.weights.value=g,d.latitudinal.value=a==="latitudinal",o&&(d.poleAxis.value=o);const{_lodMax:x}=this;d.dTheta.value=p,d.mipInt.value=x-n;const _=this._sizeLods[i],v=3*_*(i>x-ps?i-x+ps:0),C=4*(this._cubeSize-_);Mr(t,v,C,3*_,2*_),c.setRenderTarget(t),c.render(u,Pa)}}function QM(r){const e=[],t=[],n=[];let i=r;const s=r-ps+1+CA.length;for(let a=0;a<s;a++){const o=Math.pow(2,i);e.push(o);let c=1/o;a>r-ps?c=CA[a-r+ps-1]:a===0&&(c=0),t.push(c);const l=1/(o-2),h=-l,u=1+l,d=[h,h,u,h,u,u,h,h,u,u,h,u],f=6,p=6,m=3,A=2,g=1,b=new Float32Array(m*p*f),x=new Float32Array(A*p*f),_=new Float32Array(g*p*f);for(let C=0;C<f;C++){const I=C%3*2/3-1,E=C>2?0:-1,S=[I,E,0,I+2/3,E,0,I+2/3,E+1,0,I,E,0,I+2/3,E+1,0,I,E+1,0];b.set(S,m*p*C),x.set(d,A*p*C);const P=[C,C,C,C,C,C];_.set(P,g*p*C)}const v=new cn;v.setAttribute("position",new Lt(b,m)),v.setAttribute("uv",new Lt(x,A)),v.setAttribute("faceIndex",new Lt(_,g)),n.push(new at(v,null)),i>ps&&i--}return{lodMeshes:n,sizeLods:e,sigmas:t}}function wA(r,e,t){const n=new Sn(r,e,t);return n.texture.mapping=Jl,n.texture.name="PMREM.cubeUv",n.scissorTest=!0,n}function Mr(r,e,t,n,i){r.viewport.set(e,t,n,i),r.scissor.set(e,t,n,i)}function GM(r,e,t){return new mn({name:"PMREMGGXConvolution",defines:{GGX_SAMPLES:OM,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},roughness:{value:0},mipInt:{value:0}},vertexShader:rh(),fragmentShader:`
3656
3657			precision highp float;
3658			precision highp int;
3659
3660			varying vec3 vOutputDirection;
3661
3662			uniform sampler2D envMap;
3663			uniform float roughness;
3664			uniform float mipInt;
3665
3666			#define ENVMAP_TYPE_CUBE_UV
3667			#include <cube_uv_reflection_fragment>
3668
3669			#define PI 3.14159265359
3670
3671			// Van der Corput radical inverse
3672			float radicalInverse_VdC(uint bits) {
3673				bits = (bits << 16u) | (bits >> 16u);
3674				bits = ((bits & 0x55555555u) << 1u) | ((bits & 0xAAAAAAAAu) >> 1u);
3675				bits = ((bits & 0x33333333u) << 2u) | ((bits & 0xCCCCCCCCu) >> 2u);
3676				bits = ((bits & 0x0F0F0F0Fu) << 4u) | ((bits & 0xF0F0F0F0u) >> 4u);
3677				bits = ((bits & 0x00FF00FFu) << 8u) | ((bits & 0xFF00FF00u) >> 8u);
3678				return float(bits) * 2.3283064365386963e-10; // / 0x100000000
3679			}
3680
3681			// Hammersley sequence
3682			vec2 hammersley(uint i, uint N) {
3683				return vec2(float(i) / float(N), radicalInverse_VdC(i));
3684			}
3685
3686			// GGX VNDF importance sampling (Eric Heitz 2018)
3687			// "Sampling the GGX Distribution of Visible Normals"
3688			// https://jcgt.org/published/0007/04/01/
3689			vec3 importanceSampleGGX_VNDF(vec2 Xi, vec3 V, float roughness) {
3690				float alpha = roughness * roughness;
3691
3692				// Section 4.1: Orthonormal basis
3693				vec3 T1 = vec3(1.0, 0.0, 0.0);
3694				vec3 T2 = cross(V, T1);
3695
3696				// Section 4.2: Parameterization of projected area
3697				float r = sqrt(Xi.x);
3698				float phi = 2.0 * PI * Xi.y;
3699				float t1 = r * cos(phi);
3700				float t2 = r * sin(phi);
3701				float s = 0.5 * (1.0 + V.z);
3702				t2 = (1.0 - s) * sqrt(1.0 - t1 * t1) + s * t2;
3703
3704				// Section 4.3: Reprojection onto hemisphere
3705				vec3 Nh = t1 * T1 + t2 * T2 + sqrt(max(0.0, 1.0 - t1 * t1 - t2 * t2)) * V;
3706
3707				// Section 3.4: Transform back to ellipsoid configuration
3708				return normalize(vec3(alpha * Nh.x, alpha * Nh.y, max(0.0, Nh.z)));
3709			}
3710
3711			void main() {
3712				vec3 N = normalize(vOutputDirection);
3713				vec3 V = N; // Assume view direction equals normal for pre-filtering
3714
3715				vec3 prefilteredColor = vec3(0.0);
3716				float totalWeight = 0.0;
3717
3718				// For very low roughness, just sample the environment directly
3719				if (roughness < 0.001) {
3720					gl_FragColor = vec4(bilinearCubeUV(envMap, N, mipInt), 1.0);
3721					return;
3722				}
3723
3724				// Tangent space basis for VNDF sampling
3725				vec3 up = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
3726				vec3 tangent = normalize(cross(up, N));
3727				vec3 bitangent = cross(N, tangent);
3728
3729				for(uint i = 0u; i < uint(GGX_SAMPLES); i++) {
3730					vec2 Xi = hammersley(i, uint(GGX_SAMPLES));
3731
3732					// For PMREM, V = N, so in tangent space V is always (0, 0, 1)
3733					vec3 H_tangent = importanceSampleGGX_VNDF(Xi, vec3(0.0, 0.0, 1.0), roughness);
3734
3735					// Transform H back to world space
3736					vec3 H = normalize(tangent * H_tangent.x + bitangent * H_tangent.y + N * H_tangent.z);
3737					vec3 L = normalize(2.0 * dot(V, H) * H - V);
3738
3739					float NdotL = max(dot(N, L), 0.0);
3740
3741					if(NdotL > 0.0) {
3742						// Sample environment at fixed mip level
3743						// VNDF importance sampling handles the distribution filtering
3744						vec3 sampleColor = bilinearCubeUV(envMap, L, mipInt);
3745
3746						// Weight by NdotL for the split-sum approximation
3747						// VNDF PDF naturally accounts for the visible microfacet distribution
3748						prefilteredColor += sampleColor * NdotL;
3749						totalWeight += NdotL;
3750					}
3751				}
3752
3753				if (totalWeight > 0.0) {
3754					prefilteredColor = prefilteredColor / totalWeight;
3755				}
3756
3757				gl_FragColor = vec4(prefilteredColor, 1.0);
3758			}
3759		`,blending:Zn,depthTest:!1,depthWrite:!1})}function HM(r,e,t){const n=new Float32Array(qs),i=new R(0,1,0);return new mn({name:"SphericalGaussianBlur",defines:{n:qs,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${r}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:n},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:rh(),fragmentShader:`
3760
3761			precision mediump float;
3762			precision mediump int;
3763
3764			varying vec3 vOutputDirection;
3765
3766			uniform sampler2D envMap;
3767			uniform int samples;
3768			uniform float weights[ n ];
3769			uniform bool latitudinal;
3770			uniform float dTheta;
3771			uniform float mipInt;
3772			uniform vec3 poleAxis;
3773
3774			#define ENVMAP_TYPE_CUBE_UV
3775			#include <cube_uv_reflection_fragment>
3776
3777			vec3 getSample( float theta, vec3 axis ) {
3778
3779				float cosTheta = cos( theta );
3780				// Rodrigues' axis-angle rotation
3781				vec3 sampleDirection = vOutputDirection * cosTheta
3782					+ cross( axis, vOutputDirection ) * sin( theta )
3783					+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
3784
3785				return bilinearCubeUV( envMap, sampleDirection, mipInt );
3786
3787			}
3788
3789			void main() {
3790
3791				vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
3792
3793				if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
3794
3795					axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
3796
3797				}
3798
3799				axis = normalize( axis );
3800
3801				gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
3802				gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
3803
3804				for ( int i = 1; i < n; i++ ) {
3805
3806					if ( i >= samples ) {
3807
3808						break;
3809
3810					}
3811
3812					float theta = dTheta * float( i );
3813					gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
3814					gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
3815
3816				}
3817
3818			}
3819		`,blending:Zn,depthTest:!1,depthWrite:!1})}function TA(){return new mn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:rh(),fragmentShader:`
3820
3821			precision mediump float;
3822			precision mediump int;
3823
3824			varying vec3 vOutputDirection;
3825
3826			uniform sampler2D envMap;
3827
3828			#include <common>
3829
3830			void main() {
3831
3832				vec3 outputDirection = normalize( vOutputDirection );
3833				vec2 uv = equirectUv( outputDirection );
3834
3835				gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );
3836
3837			}
3838		`,blending:Zn,depthTest:!1,depthWrite:!1})}function RA(){return new mn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:rh(),fragmentShader:`
3839
3840			precision mediump float;
3841			precision mediump int;
3842
3843			uniform float flipEnvMap;
3844
3845			varying vec3 vOutputDirection;
3846
3847			uniform samplerCube envMap;
3848
3849			void main() {
3850
3851				gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );
3852
3853			}
3854		`,blending:Zn,depthTest:!1,depthWrite:!1})}function rh(){return`
3855
3856		precision mediump float;
3857		precision mediump int;
3858
3859		attribute float faceIndex;
3860
3861		varying vec3 vOutputDirection;
3862
3863		// RH coordinate system; PMREM face-indexing convention
3864		vec3 getDirection( vec2 uv, float face ) {
3865
3866			uv = 2.0 * uv - 1.0;
3867
3868			vec3 direction = vec3( uv, 1.0 );
3869
3870			if ( face == 0.0 ) {
3871
3872				direction = direction.zyx; // ( 1, v, u ) pos x
3873
3874			} else if ( face == 1.0 ) {
3875
3876				direction = direction.xzy;
3877				direction.xz *= -1.0; // ( -u, 1, -v ) pos y
3878
3879			} else if ( face == 2.0 ) {
3880
3881				direction.x *= -1.0; // ( -u, v, 1 ) pos z
3882
3883			} else if ( face == 3.0 ) {
3884
3885				direction = direction.zyx;
3886				direction.xz *= -1.0; // ( -1, v, -u ) neg x
3887
3888			} else if ( face == 4.0 ) {
3889
3890				direction = direction.xzy;
3891				direction.xy *= -1.0; // ( -u, -1, v ) neg y
3892
3893			} else if ( face == 5.0 ) {
3894
3895				direction.z *= -1.0; // ( u, v, -1 ) neg z
3896
3897			}
3898
3899			return direction;
3900
3901		}
3902
3903		void main() {
3904
3905			vOutputDirection = getDirection( uv, faceIndex );
3906			gl_Position = vec4( position, 1.0 );
3907
3908		}
3909	`}class ah extends Sn{constructor(e=1,t={}
vendor: 25,963 bytes, lines 3909-4025
3909){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const n={width:e,height:e,depth:1},i=[n,n,n,n,n,n];this.texture=new ub(i),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const n={uniforms:{tEquirect:{value:null}},vertexShader:`
3910
3911				varying vec3 vWorldDirection;
3912
3913				vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
3914
3915					return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
3916
3917				}
3918
3919				void main() {
3920
3921					vWorldDirection = transformDirection( position, modelMatrix );
3922
3923					#include <begin_vertex>
3924					#include <project_vertex>
3925
3926				}
3927			`,fragmentShader:`
3928
3929				uniform sampler2D tEquirect;
3930
3931				varying vec3 vWorldDirection;
3932
3933				#include <common>
3934
3935				void main() {
3936
3937					vec3 direction = normalize( vWorldDirection );
3938
3939					vec2 sampleUV = equirectUv( direction );
3940
3941					gl_FragColor = texture2D( tEquirect, sampleUV );
3942
3943				}
3944			`},i=new ji(5,5,5),s=new mn({name:"CubemapFromEquirect",uniforms:fa(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:on,blending:Zn});s.uniforms.tEquirect.value=t;const a=new at(i,s),o=t.minFilter;return t.minFilter===yn&&(t.minFilter=qe),new ef(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,n=!0,i=!0){const s=e.getRenderTarget();for(let a=0;a<6;a++)e.setRenderTarget(this,a),e.clear(t,n,i);e.setRenderTarget(s)}}function zM(r){let e=new WeakMap,t=new WeakMap,n=null;function i(d,f=!1){return d==null?null:f?a(d):s(d)}function s(d){if(d&&d.isTexture){const f=d.mapping;if(f===cl||f===mh)if(e.has(d)){const p=e.get(d).texture;return o(p,d.mapping)}else{const p=d.image;if(p&&p.height>0){const m=new ah(p.height);return m.fromEquirectangularTexture(r,d),e.set(d,m),d.addEventListener("dispose",l),o(m.texture,d.mapping)}else return null}}return d}function a(d){if(d&&d.isTexture){const f=d.mapping,p=f===cl||f===mh,m=f===bs||f===aa;if(p||m){let A=t.get(d);const g=A!==void 0?A.texture.pmremVersion:0;if(d.isRenderTargetTexture&&d.pmremVersion!==g)return n===null&&(n=new IA(r)),A=p?n.fromEquirectangular(d,A):n.fromCubemap(d,A),A.texture.pmremVersion=d.pmremVersion,t.set(d,A),A.texture;if(A!==void 0)return A.texture;{const b=d.image;return p&&b&&b.height>0||m&&b&&c(b)?(n===null&&(n=new IA(r)),A=p?n.fromEquirectangular(d):n.fromCubemap(d),A.texture.pmremVersion=d.pmremVersion,t.set(d,A),d.addEventListener("dispose",h),A.texture):null}}}return d}function o(d,f){return f===cl?d.mapping=bs:f===mh&&(d.mapping=aa),d}function c(d){let f=0;const p=6;for(let m=0;m<p;m++)d[m]!==void 0&&f++;return f===p}function l(d){const f=d.target;f.removeEventListener("dispose",l);const p=e.get(f);p!==void 0&&(e.delete(f),p.dispose())}function h(d){const f=d.target;f.removeEventListener("dispose",h);const p=t.get(f);p!==void 0&&(t.delete(f),p.dispose())}function u(){e=new WeakMap,t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:i,dispose:u}}function VM(r){const e={};function t(n){if(e[n]!==void 0)return e[n];const i=r.getExtension(n);return e[n]=i,i}return{has:function(n){return t(n)!==null},init:function(){t("EXT_color_buffer_float"),t("WEBGL_clip_cull_distance"),t("OES_texture_float_linear"),t("EXT_color_buffer_half_float"),t("WEBGL_multisampled_render_to_texture"),t("WEBGL_render_shared_exponent")},get:function(n){const i=t(n);return i===null&&Nl("WebGLRenderer: "+n+" extension not supported."),i}}}function WM(r,e,t,n){const i={},s=new WeakMap;function a(u){const d=u.target;d.index!==null&&e.remove(d.index);for(const p in d.attributes)e.remove(d.attributes[p]);d.removeEventListener("dispose",a),delete i[d.id];const f=s.get(d);f&&(e.remove(f),s.delete(d)),n.releaseStatesOfGeometry(d),d.isInstancedBufferGeometry===!0&&delete d._maxInstanceCount,t.memory.geometries--}function o(u,d){return i[d.id]===!0||(d.addEventListener("dispose",a),i[d.id]=!0,t.memory.geometries++),d}function c(u){const d=u.attributes;for(const f in d)e.update(d[f],r.ARRAY_BUFFER)}function l(u){const d=[],f=u.index,p=u.attributes.position;let m=0;if(p===void 0)return;if(f!==null){const b=f.array;m=f.version;for(let x=0,_=b.length;x<_;x+=3){const v=b[x+0],C=b[x+1],I=b[x+2];d.push(v,C,C,I,I,v)}}else{const b=p.array;m=p.version;for(let x=0,_=b.length/3-1;x<_;x+=3){const v=x+0,C=x+1,I=x+2;d.push(v,C,C,I,I,v)}}const A=new(p.count>=65535?ab:rb)(d,1);A.version=m;const g=s.get(u);g&&e.remove(g),s.set(u,A)}function h(u){const d=s.get(u);if(d){const f=u.index;f!==null&&d.version<f.version&&l(u)}else l(u);return s.get(u)}return{get:o,update:c,getWireframeAttribute:h}}function qM(r,e,t){let n;function i(d){n=d}let s,a;function o(d){s=d.type,a=d.bytesPerElement}function c(d,f){r.drawElements(n,f,s,d*a),t.update(f,n,1)}function l(d,f,p){p!==0&&(r.drawElementsInstanced(n,f,s,d*a,p),t.update(f,n,p))}function h(d,f,p){if(p===0)return;e.get("WEBGL_multi_draw").multiDrawElementsWEBGL(n,f,0,s,d,0,p);let A=0;for(let g=0;g<p;g++)A+=f[g];t.update(A,n,1)}function u(d,f,p,m){if(p===0)return;const A=e.get("WEBGL_multi_draw");if(A===null)for(let g=0;g<d.length;g++)l(d[g]/a,f[g],m[g]);else{A.multiDrawElementsInstancedWEBGL(n,f,0,s,d,0,m,0,p);let g=0;for(let b=0;b<p;b++)g+=f[b]*m[b];t.update(g,n,1)}}this.setMode=i,this.setIndex=o,this.render=c,this.renderInstances=l,this.renderMultiDraw=h,this.renderMultiDrawInstances=u}function jM(r){const e={geometries:0,textures:0},t={frame:0,calls:0,triangles:0,points:0,lines:0};function n(s,a,o){switch(t.calls++,a){case r.TRIANGLES:t.triangles+=o*(s/3);break;case r.LINES:t.lines+=o*(s/2);break;case r.LINE_STRIP:t.lines+=o*(s-1);break;case r.LINE_LOOP:t.lines+=o*s;break;case r.POINTS:t.points+=o*s;break;default:Pe("WebGLInfo: Unknown draw mode:",a);break}}function i(){t.calls=0,t.triangles=0,t.points=0,t.lines=0}return{memory:e,render:t,programs:null,autoReset:!0,reset:i,update:n}}function XM(r,e,t){const n=new WeakMap,i=new It;function s(a,o,c){const l=a.morphTargetInfluences,h=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,u=h!==void 0?h.length:0;let d=n.get(o);if(d===void 0||d.count!==u){let P=function(){E.dispose(),n.delete(o),o.removeEventListener("dispose",P)};var f=P;d!==void 0&&d.texture.dispose();const p=o.morphAttributes.position!==void 0,m=o.morphAttributes.normal!==void 0,A=o.morphAttributes.color!==void 0,g=o.morphAttributes.position||[],b=o.morphAttributes.normal||[],x=o.morphAttributes.color||[];let _=0;p===!0&&(_=1),m===!0&&(_=2),A===!0&&(_=3);let v=o.attributes.position.count*_,C=1;v>e.maxTextureSize&&(C=Math.ceil(v/e.maxTextureSize),v=e.maxTextureSize);const I=new Float32Array(v*C*4*u),E=new nb(I,v,C,u);E.type=Nt,E.needsUpdate=!0;const S=_*4;for(let w=0;w<u;w++){const L=g[w],N=b[w],O=x[w],D=v*C*4*w;for(let U=0;U<L.count;U++){const F=U*S;p===!0&&(i.fromBufferAttribute(L,U),I[D+F+0]=i.x,I[D+F+1]=i.y,I[D+F+2]=i.z,I[D+F+3]=0),m===!0&&(i.fromBufferAttribute(N,U),I[D+F+4]=i.x,I[D+F+5]=i.y,I[D+F+6]=i.z,I[D+F+7]=0),A===!0&&(i.fromBufferAttribute(O,U),I[D+F+8]=i.x,I[D+F+9]=i.y,I[D+F+10]=i.z,I[D+F+11]=O.itemSize===4?i.w:1)}}d={count:u,texture:E,size:new pe(v,C)},n.set(o,d),o.addEventListener("dispose",P)}if(a.isInstancedMesh===!0&&a.morphTexture!==null)c.getUniforms().setValue(r,"morphTexture",a.morphTexture,t);else{let p=0;for(let A=0;A<l.length;A++)p+=l[A];const m=o.morphTargetsRelative?1:1-p;c.getUniforms().setValue(r,"morphTargetBaseInfluence",m),c.getUniforms().setValue(r,"morphTargetInfluences",l)}c.getUniforms().setValue(r,"morphTargetsTexture",d.texture,t),c.getUniforms().setValue(r,"morphTargetsTextureSize",d.size)}return{update:s}}function KM(r,e,t,n,i){let s=new WeakMap;function a(l){const h=i.render.frame,u=l.geometry,d=e.get(l,u);if(s.get(d)!==h&&(e.update(d),s.set(d,h)),l.isInstancedMesh&&(l.hasEventListener("dispose",c)===!1&&l.addEventListener("dispose",c),s.get(l)!==h&&(t.update(l.instanceMatrix,r.ARRAY_BUFFER),l.instanceColor!==null&&t.update(l.instanceColor,r.ARRAY_BUFFER),s.set(l,h))),l.isSkinnedMesh){const f=l.skeleton;s.get(f)!==h&&(f.update(),s.set(f,h))}return d}function o(){s=new WeakMap}function c(l){const h=l.target;h.removeEventListener("dispose",c),n.releaseStatesOfObject(h),t.remove(h.instanceMatrix),h.instanceColor!==null&&t.remove(h.instanceColor)}return{update:a,dispose:o}}const $M={[Cf]:"LINEAR_TONE_MAPPING",[Mf]:"REINHARD_TONE_MAPPING",[If]:"CINEON_TONE_MAPPING",[wf]:"ACES_FILMIC_TONE_MAPPING",[Tf]:"AGX_TONE_MAPPING",[sa]:"NEUTRAL_TONE_MAPPING",[$0]:"CUSTOM_TONE_MAPPING"};function YM(r,e,t,n,i){const s=new Sn(e,t,{type:r,depthBuffer:n,stencilBuffer:i}),a=new Sn(e,t,{type:yt,depthBuffer:!1,stencilBuffer:!1}),o=new cn;o.setAttribute("position",new nn([-1,3,0,-1,-1,0,3,-1,0],3)),o.setAttribute("uv",new nn([0,2,0,0,2,0],2));const c=new my({uniforms:{tDiffuse:{value:null}},vertexShader:`
3945			precision highp float;
3946
3947			uniform mat4 modelViewMatrix;
3948			uniform mat4 projectionMatrix;
3949
3950			attribute vec3 position;
3951			attribute vec2 uv;
3952
3953			varying vec2 vUv;
3954
3955			void main() {
3956				vUv = uv;
3957				gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
3958			}`,fragmentShader:`
3959			precision highp float;
3960
3961			uniform sampler2D tDiffuse;
3962
3963			varying vec2 vUv;
3964
3965			#include <tonemapping_pars_fragment>
3966			#include <colorspace_pars_fragment>
3967
3968			void main() {
3969				gl_FragColor = texture2D( tDiffuse, vUv );
3970
3971				#ifdef LINEAR_TONE_MAPPING
3972					gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );
3973				#elif defined( REINHARD_TONE_MAPPING )
3974					gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );
3975				#elif defined( CINEON_TONE_MAPPING )
3976					gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );
3977				#elif defined( ACES_FILMIC_TONE_MAPPING )
3978					gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );
3979				#elif defined( AGX_TONE_MAPPING )
3980					gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );
3981				#elif defined( NEUTRAL_TONE_MAPPING )
3982					gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );
3983				#elif defined( CUSTOM_TONE_MAPPING )
3984					gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );
3985				#endif
3986
3987				#ifdef SRGB_TRANSFER
3988					gl_FragColor = sRGBTransferOETF( gl_FragColor );
3989				#endif
3990			}`,depthTest:!1,depthWrite:!1}),l=new at(o,c),h=new cr(-1,1,1,-1,0,1);let u=null,d=null,f=!1,p,m=null,A=[],g=!1;this.setSize=function(b,x){s.setSize(b,x),a.setSize(b,x);for(let _=0;_<A.length;_++){const v=A[_];v.setSize&&v.setSize(b,x)}},this.setEffects=function(b){A=b,g=A.length>0&&A[0].isRenderPass===!0;const x=s.width,_=s.height;for(let v=0;v<A.length;v++){const C=A[v];C.setSize&&C.setSize(x,_)}},this.begin=function(b,x){if(f||b.toneMapping===Qn&&A.length===0)return!1;if(m=x,x!==null){const _=x.width,v=x.height;(s.width!==_||s.height!==v)&&this.setSize(_,v)}return g===!1&&b.setRenderTarget(s),p=b.toneMapping,b.toneMapping=Qn,!0},this.hasRenderPass=function(){return g},this.end=function(b,x){b.toneMapping=p,f=!0;let _=s,v=a;for(let C=0;C<A.length;C++){const I=A[C];if(I.enabled!==!1&&(I.render(b,v,_,x),I.needsSwap!==!1)){const E=_;_=v,v=E}}if(u!==b.outputColorSpace||d!==b.toneMapping){u=b.outputColorSpace,d=b.toneMapping,c.defines={},tt.getTransfer(u)===ft&&(c.defines.SRGB_TRANSFER="");const C=$M[d];C&&(c.defines[C]=""),c.needsUpdate=!0}c.uniforms.tDiffuse.value=_.texture,b.setRenderTarget(m),b.render(l,h),m=null,f=!1},this.isCompositing=function(){return f},this.dispose=function(){s.dispose(),a.dispose(),o.dispose(),c.dispose()}}const Lb=new Rt,nf=new Oo(1,1),Pb=new nb,Fb=new ib,Nb=new ub,BA=[],DA=[],LA=new Float32Array(16),PA=new Float32Array(9),FA=new Float32Array(4);function Sa(r,e,t){const n=r[0];if(n<=0||n>0)return r;const i=e*t;let s=BA[i];if(s===void 0&&(s=new Float32Array(i),BA[i]=s),e!==0){n.toArray(s,0);for(let a=1,o=0;a!==e;++a)o+=t,r[a].toArray(s,o)}return s}function jt(r,e){if(r.length!==e.length)return!1;for(let t=0,n=r.length;t<n;t++)if(r[t]!==e[t])return!1;return!0}function Xt(r,e){for(let t=0,n=e.length;t<n;t++)r[t]=e[t]}function oh(r,e){let t=DA[e];t===void 0&&(t=new Int32Array(e),DA[e]=t);for(let n=0;n!==e;++n)t[n]=r.allocateTextureUnit();return t}function JM(r,e){const t=this.cache;t[0]!==e&&(r.uniform1f(this.addr,e),t[0]=e)}function ZM(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2f(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(jt(t,e))return;r.uniform2fv(this.addr,e),Xt(t,e)}}function eI(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3f(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else if(e.r!==void 0)(t[0]!==e.r||t[1]!==e.g||t[2]!==e.b)&&(r.uniform3f(this.addr,e.r,e.g,e.b),t[0]=e.r,t[1]=e.g,t[2]=e.b);else{if(jt(t,e))return;r.uniform3fv(this.addr,e),Xt(t,e)}}function tI(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4f(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(jt(t,e))return;r.uniform4fv(this.addr,e),Xt(t,e)}}function nI(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(jt(t,e))return;r.uniformMatrix2fv(this.addr,!1,e),Xt(t,e)}else{if(jt(t,n))return;FA.set(n),r.uniformMatrix2fv(this.addr,!1,FA),Xt(t,n)}}function iI(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(jt(t,e))return;r.uniformMatrix3fv(this.addr,!1,e),Xt(t,e)}else{if(jt(t,n))return;PA.set(n),r.uniformMatrix3fv(this.addr,!1,PA),Xt(t,n)}}function sI(r,e){const t=this.cache,n=e.elements;if(n===void 0){if(jt(t,e))return;r.uniformMatrix4fv(this.addr,!1,e),Xt(t,e)}else{if(jt(t,n))return;LA.set(n),r.uniformMatrix4fv(this.addr,!1,LA),Xt(t,n)}}function rI(r,e){const t=this.cache;t[0]!==e&&(r.uniform1i(this.addr,e),t[0]=e)}function aI(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2i(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(jt(t,e))return;r.uniform2iv(this.addr,e),Xt(t,e)}}function oI(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3i(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(jt(t,e))return;r.uniform3iv(this.addr,e),Xt(t,e)}}function cI(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4i(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(jt(t,e))return;r.uniform4iv(this.addr,e),Xt(t,e)}}function lI(r,e){const t=this.cache;t[0]!==e&&(r.uniform1ui(this.addr,e),t[0]=e)}function hI(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y)&&(r.uniform2ui(this.addr,e.x,e.y),t[0]=e.x,t[1]=e.y);else{if(jt(t,e))return;r.uniform2uiv(this.addr,e),Xt(t,e)}}function uI(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z)&&(r.uniform3ui(this.addr,e.x,e.y,e.z),t[0]=e.x,t[1]=e.y,t[2]=e.z);else{if(jt(t,e))return;r.uniform3uiv(this.addr,e),Xt(t,e)}}function dI(r,e){const t=this.cache;if(e.x!==void 0)(t[0]!==e.x||t[1]!==e.y||t[2]!==e.z||t[3]!==e.w)&&(r.uniform4ui(this.addr,e.x,e.y,e.z,e.w),t[0]=e.x,t[1]=e.y,t[2]=e.z,t[3]=e.w);else{if(jt(t,e))return;r.uniform4uiv(this.addr,e),Xt(t,e)}}function fI(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i);let s;this.type===r.SAMPLER_2D_SHADOW?(nf.compareFunction=t.isReversedDepthBuffer()?kf:Of,s=nf):s=Lb,t.setTexture2D(e||s,i)}function pI(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture3D(e||Fb,i)}function AI(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTextureCube(e||Nb,i)}function gI(r,e,t){const n=this.cache,i=t.allocateTextureUnit();n[0]!==i&&(r.uniform1i(this.addr,i),n[0]=i),t.setTexture2DArray(e||Pb,i)}function mI(r){switch(r){case 5126:return JM;case 35664:return ZM;case 35665:return eI;case 35666:return tI;case 35674:return nI;case 35675:return iI;case 35676:return sI;case 5124:case 35670:return rI;case 35667:case 35671:return aI;case 35668:case 35672:return oI;case 35669:case 35673:return cI;case 5125:return lI;case 36294:return hI;case 36295:return uI;case 36296:return dI;case 35678:case 36198:case 36298:case 36306:case 35682:return fI;case 35679:case 36299:case 36307:return pI;case 35680:case 36300:case 36308:case 36293:return AI;case 36289:case 36303:case 36311:case 36292:return gI}}function bI(r,e){r.uniform1fv(this.addr,e)}function xI(r,e){const t=Sa(e,this.size,2);r.uniform2fv(this.addr,t)}function EI(r,e){const t=Sa(e,this.size,3);r.uniform3fv(this.addr,t)}function _I(r,e){const t=Sa(e,this.size,4);r.uniform4fv(this.addr,t)}function vI(r,e){const t=Sa(e,this.size,4);r.uniformMatrix2fv(this.addr,!1,t)}function yI(r,e){const t=Sa(e,this.size,9);r.uniformMatrix3fv(this.addr,!1,t)}function SI(r,e){const t=Sa(e,this.size,16);r.uniformMatrix4fv(this.addr,!1,t)}function CI(r,e){r.uniform1iv(this.addr,e)}function MI(r,e){r.uniform2iv(this.addr,e)}function II(r,e){r.uniform3iv(this.addr,e)}function wI(r,e){r.uniform4iv(this.addr,e)}function TI(r,e){r.uniform1uiv(this.addr,e)}function RI(r,e){r.uniform2uiv(this.addr,e)}function BI(r,e){r.uniform3uiv(this.addr,e)}function DI(r,e){r.uniform4uiv(this.addr,e)}function LI(r,e,t){const n=this.cache,i=e.length,s=oh(t,i);jt(n,s)||(r.uniform1iv(this.addr,s),Xt(n,s));let a;this.type===r.SAMPLER_2D_SHADOW?a=nf:a=Lb;for(let o=0;o!==i;++o)t.setTexture2D(e[o]||a,s[o])}function PI(r,e,t){const n=this.cache,i=e.length,s=oh(t,i);jt(n,s)||(r.uniform1iv(this.addr,s),Xt(n,s));for(let a=0;a!==i;++a)t.setTexture3D(e[a]||Fb,s[a])}function FI(r,e,t){const n=this.cache,i=e.length,s=oh(t,i);jt(n,s)||(r.uniform1iv(this.addr,s),Xt(n,s));for(let a=0;a!==i;++a)t.setTextureCube(e[a]||Nb,s[a])}function NI(r,e,t){const n=this.cache,i=e.length,s=oh(t,i);jt(n,s)||(r.uniform1iv(this.addr,s),Xt(n,s));for(let a=0;a!==i;++a)t.setTexture2DArray(e[a]||Pb,s[a])}function UI(r){switch(r){case 5126:return bI;case 35664:return xI;case 35665:return EI;case 35666:return _I;case 35674:return vI;case 35675:return yI;case 35676:return SI;case 5124:case 35670:return CI;case 35667:case 35671:return MI;case 35668:case 35672:return II;case 35669:case 35673:return wI;case 5125:return TI;case 36294:return RI;case 36295:return BI;case 36296:return DI;case 35678:case 36198:case 36298:case 36306:case 35682:return LI;case 35679:case 36299:case 36307:return PI;case 35680:case 36300:case 36308:case 36293:return FI;case 36289:case 36303:case 36311:case 36292:return NI}}class OI{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.setValue=mI(t.type)}}class kI{constructor(e,t,n){this.id=e,this.addr=n,this.cache=[],this.type=t.type,this.size=t.size,this.setValue=UI(t.type)}}class QI{constructor(e){this.id=e,this.seq=[],this.map={}}setValue(e,t,n){const i=this.seq;for(let s=0,a=i.length;s!==a;++s){const o=i[s];o.setValue(e,t[o.id],n)}}}const Zh=/(\w+)(\])?(\[|\.)?/g;function NA(r,e){r.seq.push(e),r.map[e.id]=e}function GI(r,e,t){const n=r.name,i=n.length;for(Zh.lastIndex=0;;){const s=Zh.exec(n),a=Zh.lastIndex;let o=s[1];const c=s[2]==="]",l=s[3];if(c&&(o=o|0),l===void 0||l==="["&&a+2===i){NA(t,l===void 0?new OI(o,r,e):new kI(o,r,e));break}else{let u=t.map[o];u===void 0&&(u=new QI(o),NA(t,u)),t=u}}}class dl{constructor(e,t){this.seq=[],this.map={};const n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS);for(let a=0;a<n;++a){const o=e.getActiveUniform(t,a),c=e.getUniformLocation(t,o.name);GI(o,c,this)}const i=[],s=[];for(const a of this.seq)a.type===e.SAMPLER_2D_SHADOW||a.type===e.SAMPLER_CUBE_SHADOW||a.type===e.SAMPLER_2D_ARRAY_SHADOW?i.push(a):s.push(a);i.length>0&&(this.seq=i.concat(s))}setValue(e,t,n,i){const s=this.map[t];s!==void 0&&s.setValue(e,n,i)}setOptional(e,t,n){const i=t[n];i!==void 0&&this.setValue(e,n,i)}static upload(e,t,n,i){for(let s=0,a=t.length;s!==a;++s){const o=t[s],c=n[o.id];c.needsUpdate!==!1&&o.setValue(e,c.value,i)}}static seqWithValue(e,t){const n=[];for(let i=0,s=e.length;i!==s;++i){const a=e[i];a.id in t&&n.push(a)}return n}}function UA(r,e,t){const n=r.createShader(e);return r.shaderSource(n,t),r.compileShader(n),n}const HI=37297;let zI=0;function VI(r,e){const t=r.split(`
3991`),n=[],i=Math.max(e-6,0),s=Math.min(e+6,t.length);for(let a=i;a<s;a++){const o=a+1;n.push(`${o===e?">":" "} ${o}: ${t[a]}`)}return n.join(`
3992`)}const OA=new Qe;function WI(r){tt._getMatrix(OA,tt.workingColorSpace,r);const e=`mat3( ${OA.elements.map(t=>t.toFixed(4))} )`;switch(tt.getTransfer(r)){case Pl:return[e,"LinearTransferOETF"];case ft:return[e,"sRGBTransferOETF"];default:return Ie("WebGLProgram: Unsupported color space: ",r),[e,"LinearTransferOETF"]}}function kA(r,e,t){const n=r.getShaderParameter(e,r.COMPILE_STATUS),s=(r.getShaderInfoLog(e)||"").trim();if(n&&s==="")return"";const a=/ERROR: 0:(\d+)/.exec(s);if(a){const o=parseInt(a[1]);return t.toUpperCase()+`
3993
3994`+s+`
3995
3996`+VI(r.getShaderSource(e),o)}else return s}function qI(r,e){const t=WI(e);return[`vec4 ${r}( vec4 value ) {`,`	return ${t[1]}( vec4( value.rgb * ${t[0]}, value.a ) );`,"}"].join(`
3997`)}const jI={[Cf]:"Linear",[Mf]:"Reinhard",[If]:"Cineon",[wf]:"ACESFilmic",[Tf]:"AgX",[sa]:"Neutral",[$0]:"Custom"};function XI(r,e){const t=jI[e];return t===void 0?(Ie("WebGLProgram: Unsupported toneMapping:",e),"vec3 "+r+"( vec3 color ) { return LinearToneMapping( color ); }"):"vec3 "+r+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const wc=new R;function KI(){tt.getLuminanceCoefficients(wc);const r=wc.x.toFixed(4),e=wc.y.toFixed(4),t=wc.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",`	const vec3 weights = vec3( ${r}, ${e}, ${t} );`,"	return dot( weights, rgb );","}"].join(`
3998`)}function $I(r){return[r.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",r.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(oo).join(`
3999`)}function YI(r){const e=[];for(const t in r){const n=r[t];n!==!1&&e.push("#define "+t+" "+n)}return e.join(`
4000`)}function JI(r,e){const t={},n=r.getProgramParameter(e,r.ACTIVE_ATTRIBUTES);for(let i=0;i<n;i++){const s=r.getActiveAttrib(e,i),a=s.name;let o=1;s.type===r.FLOAT_MAT2&&(o=2),s.type===r.FLOAT_MAT3&&(o=3),s.type===r.FLOAT_MAT4&&(o=4),t[a]={type:s.type,location:r.getAttribLocation(e,a),locationSize:o}}return t}function oo(r){return r!==""}function QA(r,e){const t=e.numSpotLightShadows+e.numSpotLightMaps-e.numSpotLightShadowsWithMaps;return r.replace(/NUM_DIR_LIGHTS/g,e.numDirLights).replace(/NUM_SPOT_LIGHTS/g,e.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,e.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,t).replace(/NUM_RECT_AREA_LIGHTS/g,e.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,e.numPointLights).replace(/NUM_HEMI_LIGHTS/g,e.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,e.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,e.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,e.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,e.numPointLightShadows)}function GA(r,e){return r.replace(/NUM_CLIPPING_PLANES/g,e.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,e.numClippingPlanes-e.numClipIntersection)}const ZI=/^[ \t]*#include +<([\w\d./]+)>/gm;function sf(r){return r.replace(ZI,tw)}const ew=new Map;function tw(r,e){let t=je[e];if(t===void 0){const n=ew.get(e);if(n!==void 0)t=je[n],Ie('WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,n);else throw new Error("Can not resolve #include <"+e+">")}return sf(t)}const nw=/#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 HA(r){return r.replace(nw,iw)}function iw(r,e,t,n){let i="";for(let s=parseInt(e);s<parseInt(t);s++)i+=n.replace(/\[\s*i\s*\]/g,"[ "+s+" ]").replace(/UNROLLED_LOOP_INDEX/g,s);return i}function zA(r){let e=`precision ${r.precision} float;
4001	precision ${r.precision} int;
4002	precision ${r.precision} sampler2D;
4003	precision ${r.precision} samplerCube;
4004	precision ${r.precision} sampler3D;
4005	precision ${r.precision} sampler2DArray;
4006	precision ${r.precision} sampler2DShadow;
4007	precision ${r.precision} samplerCubeShadow;
4008	precision ${r.precision} sampler2DArrayShadow;
4009	precision ${r.precision} isampler2D;
4010	precision ${r.precision} isampler3D;
4011	precision ${r.precision} isamplerCube;
4012	precision ${r.precision} isampler2DArray;
4013	precision ${r.precision} usampler2D;
4014	precision ${r.precision} usampler3D;
4015	precision ${r.precision} usamplerCube;
4016	precision ${r.precision} usampler2DArray;
4017	`;return r.precision==="highp"?e+=`
4018#define HIGH_PRECISION`:r.precision==="mediump"?e+=`
4019#define MEDIUM_PRECISION`:r.precision==="lowp"&&(e+=`
4020#define LOW_PRECISION`),e}const sw={[ol]:"SHADOWMAP_TYPE_PCF",[ro]:"SHADOWMAP_TYPE_VSM"};function rw(r){return sw[r.shadowMapType]||"SHADOWMAP_TYPE_BASIC"}const aw={[bs]:"ENVMAP_TYPE_CUBE",[aa]:"ENVMAP_TYPE_CUBE",[Jl]:"ENVMAP_TYPE_CUBE_UV"};function ow(r){return r.envMap===!1?"ENVMAP_TYPE_CUBE":aw[r.envMapMode]||"ENVMAP_TYPE_CUBE"}const cw={[aa]:"ENVMAP_MODE_REFRACTION"};function lw(r){return r.envMap===!1?"ENVMAP_MODE_REFLECTION":cw[r.envMapMode]||"ENVMAP_MODE_REFLECTION"}const hw={[K0]:"ENVMAP_BLENDING_MULTIPLY",[__]:"ENVMAP_BLENDING_MIX",[v_]:"ENVMAP_BLENDING_ADD"};function uw(r){return r.envMap===!1?"ENVMAP_BLENDING_NONE":hw[r.combine]||"ENVMAP_BLENDING_NONE"}function dw(r){const e=r.envMapCubeUVHeight;if(e===null)return null;const t=Math.log2(e)-2,n=1/e;return{texelWidth:1/(3*Math.max(Math.pow(2,t),112)),texelHeight:n,maxMip:t}}function fw(r,e,t,n){const i=r.getContext(),s=t.defines;let a=t.vertexShader,o=t.fragmentShader;const c=rw(t),l=ow(t),h=lw(t),u=uw(t),d=dw(t),f=$I(t),p=YI(s),m=i.createProgram();let A,g,b=t.glslVersion?"#version "+t.glslVersion+`
4021`:"";t.isRawShaderMaterial?(A=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p].filter(oo).join(`
4022`),A.length>0&&(A+=`
4023`),g=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p].filter(oo).join(`
4024`),g.length>0&&(g+=`
4025`)):(A=[zA(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p,t.extensionCl
vendor: 6,474 bytes, lines 4025-4027
4025ipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+h:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+c:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","	attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","	attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","	uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","	attribute vec2 uv1;","#endif","#ifdef USE_UV2","	attribute vec2 uv2;","#endif","#ifdef USE_UV3","	attribute vec2 uv3;","#endif","#ifdef USE_TANGENT","	attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","	attribute vec4 color;","#elif defined( USE_COLOR )","	attribute vec3 color;","#endif","#ifdef USE_SKINNING","	attribute vec4 skinIndex;","	attribute vec4 skinWeight;","#endif",`
4026`].filter(oo).join(`
4027`),g=[zA(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,p,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+l:"",t.envMap?"#define "+h:"",t.envMap?"#define "+u:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IR
4027IDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas||t.batchingColor?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+c:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",t.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",t.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Qn?"#define TONE_MAPPING":"",t.toneMapping!==Qn?je.tonemapping_pars_fragment:"",t.toneMapping!==Qn?XI("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",je.colorspace_pars_fragment,qI("linearToOutputTexel",t.outputColorSpace),KI(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",`
4028`].filter(oo).join(`
4029`)),a=sf(a),a=QA(a,t),a=GA(a,t),o=sf(o),o=QA(o,t),o=GA(o,t),a=HA(a),o=HA(o),t.isRawShaderMaterial!==!0&&(b=`#version 300 es
4030`,A=[f,"#define attribute in","#define varying out","#define texture2D texture"].join(`
4031`)+`
4032`+A,g=["#define varying in",t.glslVersion===Dp?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===Dp?"":"#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(`
4033`)+`
4034`+g);const x=b+A+a,_=b+g+o,v=UA(i,i.VERTEX_SHADER,x),C=UA(i,i.FRAGMENT_SHADER,_);i.attachShader(m,v),i.attachShader(m,C),t.index0AttributeName!==void 0?i.bindAttribLocation(m,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(m,0,"position"),i.linkProgram(m);function I(w){if(r.debug.checkShaderErrors){const L=i.getProgramInfoLog(m)||"",N=i.getShaderInfoLog(v)||"",O=i.getShaderInfoLog(C)||"",D=L.trim(),U=N.trim(),F=O.trim();let $=!0,q=!0;if(i.getProgramParameter(m,i.LINK_STATUS)===!1)if($=!1,typeof r.debug.onShaderError=="function")r.debug.onShaderError(i,m,v,C);else{const te=kA(i,v,"vertex"),Z=kA(i,C,"fragment");Pe("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(m,i.VALIDATE_STATUS)+`
4035
4036Material Name: `+w.name+`
4037Material Type: `+w.type+`
4038
4039Program Info Log: `+D+`
4040`+te+`
4041`+Z)}else D!==""?Ie("WebGLProgram: Program Info Log:",D):(U===""||F==="")&&(q=!1);q&&(w.diagnostics={runnable:$,programLog:D,vertexShader:{log:U,prefix:A},fragmentShader:{log:F,prefix:g}})}i.deleteShader(v),i.deleteShader(C),E=new dl(i,m),S=JI(i,m)}let E;this.getUniforms=function(){return E===void 0&&I(this),E};let S;this.getAttributes=function(){return S===void 0&&I(this),S};let P=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return P===!1&&(P=i.getProgramParameter(m,HI)),P},this.destroy=function(){n.releaseStatesOfProgram(this),i.deleteProgram(m),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=zI++,this.cacheKey=e,this.usedTimes=1,this.program=m,this.vertexShader=v,this.fragmentShader=C,this}let pw=0;class Aw{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,n=e.fragmentShader,i=this._getShaderStage(t),s=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(i)===!1&&(a.add(i),i.usedTimes++),a.has(s)===!1&&(a.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const n of t)n.usedTimes--,n.usedTimes===0&&this.shaderCache.delete(n.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){const t=this.shaderCache;let n=t.get(e);return n===void 0&&(n=new gw(e),t.set(e,n)),n}}class gw{constructor(e){this.id=pw++,this.code=e,this.usedTimes=0}}function mw(r,e,t,n,i,s){const a=new Gf,o=new Aw,c=new Set,l=[],h=new Map,u=n.logarithmicDepthBuffer;let d=n.precision;const f={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distance",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function p(E){return c.add(E),E===0?"uv":`uv${E}`}function m(E,S,P,w,L){const N=w.fog,O=L.geometry,D=E.isMeshStandardMaterial||E.isMeshLambertMaterial||E.isMeshPhongMaterial?w.environment:null,U=E.isMeshStandardMaterial||E.isMeshLambertMaterial&&!E.envMap||E.isMeshPhongMaterial&&!E.envMap,F=e.get(E.envMap||D,U),$=F&&F.mapping===Jl?F.image.height:null,q=f[E.type];E.precision!==null&&(d=n.getMaxPrecision(E.precision),d!==E.precision&&Ie("WebGLProgram.getParameters:",E.precision,"not supported, using",d,"instead."));const te=O.morphAttributes.position||O.morphAttributes.normal||O.morphAttributes.color,Z=te!==void 0?te.length:0;let Y=0;O.morphAttributes.position!==void 0&&(Y=1),O.morphAttributes.normal!==void 0&&(Y=2),O.morphAttributes.color!==void 0&&(Y=3);let fe,Ge,ze,X;if(q){const ut=fi[q];fe=ut.vertexShader,Ge=ut.fragmentShader}else fe=E.vertexShader,Ge=E.fragmentShader,o.update(E),ze=o.getVertexShaderID(E),X=o.getFragmentShaderID(E);const se=r.getRenderTarget(),oe=r.state.buffers.depth.getReversed(),He=L.isInstancedMesh===!0,De=L.isBatchedMesh===!0,Fe=!!E.map,kt=!!E.matcap,Ze=!!F,it=!!E.aoMap,bt=!!E.lightMap,Ke=!!E.bumpMap,Qt=!!E.normalMap,B=!!E.displacementMap,zt=!!E.emissiveMap,ct=!!E.metalnessMap,_t=!!E.roughnessMap,Se=E.anisotropy>0,T=E.clearcoat>0,y=E.dispersion>0,Q=E.iridescence>0,K=E.sheen>0,ee=E.transmission>0,j=Se&&!!E.anisotropyMap,xe=T&&!!E.clearcoatMap,ce=T&&!!E.clearcoatNormalMap,Be=T&&!!E.clearcoatRoughnessMap,Ne=Q&&!!E.iridescenceMap,ne=Q&&!!E.iridescenceThicknessMap,re=K&&!!E.sheenColorMap,Ee=K&&!!E.sheenRoughnessMap,ve=!!E.specularMap,Ae=!!E.specularColorMap,$e=!!E.specularIntensityMap,k=ee&&!!E.transmissionMap,le=ee&&!!E.thicknessMap,ae=!!E.gradientMap,me=!!E.alphaMap,ie=E.alphaTest>0,W=!!E.alphaHash,_e=!!E.extensions;let ke=Qn;E.toneMapped&&(se===null||se.isXRRenderTarget===!0)&&(ke=r.toneMapping);const vt={shaderID:q,shaderType:E.type,shaderName:E.name,vertexShader:fe,fragmentShader:Ge,defines:E.defines,customVertexShaderID:ze,customFragmentShaderID:X,isRawShaderMaterial:E.isRawShaderMaterial===!0,glslVersion:E.glslVersion,precision:d,batching:De,batchingColor:De&&L._colorsTexture!==null,instancing:He,instancingColor:He&&L.instanceColor!==null,instancingMorph:He&&L.morphTexture!==null,outputColorSpace:se===null?r.outputColorSpace:se.isXRRenderTarget===!0?se.texture.colorSpace:Ct,alphaToCoverage:!!E.alphaToCoverage,map:Fe,matcap:kt,envMap:Ze,envMapMode:Ze&&F.mapping,envMapCubeUVHeight:$,aoMap:it,lightMap:bt,bumpMap:Ke,normalMap:Qt,displacementMap:B,emissiveMap:zt,normalMapObjectSpace:Qt&&E.normalMapType===I_,normalMapTangentSpace:Qt&&E.normalMapType===Z0,metalnessMap:ct,roughnessMap:_t,anisotropy:Se,anisotropyMap:j,clearcoat:T,clearcoatMap:xe,clearcoatNormalMap:ce,clearcoatRoughnessMap:Be,dispersion:y,iridescence:Q,iridescenceMap:Ne,iridescenceThicknessMap:ne,sheen:K,sheenColorMap:re,sheenRoughnessMap:Ee,specularMap:ve,specularColorMap:Ae,specularIntensityMap:$e,transmission:ee,transmissionMap:k,thicknessMap:le,gradientMap:ae,opaque:E.transparent===!1&&E.blending===$s&&E.alphaToCoverage===!1,alphaMap:me,alphaTest:ie,alphaHash:W,combine:E.combine,mapUv:Fe&&p(E.map.channel),aoMapUv:it&&p(E.aoMap.channel),lightMapUv:bt&&p(E.lightMap.channel),bumpMapUv:Ke&&p(E.bumpMap.channel),normalMapUv:Qt&&p(E.normalMap.channel),displacementMapUv:B&&p(E.displacementMap.channel),emissiveMapUv:zt&&p(E.emissiveMap.channel),metalnessMapUv:ct&&p(E.metalnessMap.channel),roughnessMapUv:_t&&p(E.roughnessMap.channel),anisotropyMapUv:j&&p(E.anisotropyMap.channel),clearcoatMapUv:xe&&p(E.clearcoatMap.channel),clearcoatNormalMapUv:ce&&p(E.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:Be&&p(E.clearcoatRoughnessMap.channel),iridescenceMapUv:Ne&&p(E.iridescenceMap.channel),iridescenceThicknessMapUv:ne&&p(E.iridescenceThicknessMap.channel),sheenColorMapUv:re&&p(E.sheenColorMap.channel),sheenRoughnessMapUv:Ee&&p(E.sheenRoughnessMap.channel),specularMapUv:ve&&p(E.specularMap.channel),specularColorMapUv:Ae&&p(E.specularColorMap.channel),specularIntensityMapUv:$e&&p(E.specularIntensityMap.channel),transmissionMapUv:k&&p(E.transmissionMap.channel),thicknessMapUv:le&&p(E.thicknessMap.channel),alphaMapUv:me&&p(E.alphaMap.channel),vertexTangents:!!O.attributes.tangent&&(Qt||Se),vertexColors:E.vertexColors,vertexAlphas:E.vertexColors===!0&&!!O.attributes.color&&O.attributes.color.itemSize===4,pointsUvs:L.isPoints===!0&&!!O.attributes.uv&&(Fe||me),fog:!!N,useFog:E.fog===!0,fogExp2:!!N&&N.isFogExp2,flatShading:E.wireframe===!1&&(E.flatShading===!0||O.attributes.normal===void 0&&Qt===!1&&(E.isMeshLambertMaterial||E.isMeshPhongMaterial||E.isMeshStandardMaterial||E.isMeshPhysicalMaterial)),sizeAttenuation:E.sizeAttenuation===!0,logarithmicDepthBuffer:u,reversedDepthBuffer:oe,skinning:L.isSkinnedMesh===!0,morphTargets:O.morphAttributes.position!==void 0,morphNormals:O.morphAttributes.normal!==void 0,morphColors:O.morphAttributes.color!==void 0,morphTargetsCount:Z,morphTextureStride:Y,numDirLights:S.directional.length,numPointLights:S.point.length,numSpotLights:S.spot.length,numSpotLightMaps:S.spotLightMap.length,numRectAreaLights:S.rectArea.length,numHemiLights:S.hemi.length,numDirLightShadows:S.directionalShadowMap.length,numPointLightShadows:S.pointShadowMap.length,numSpotLightShadows:S.spotShadowMap.length,numSpotLightShadowsWithMaps:S.numSpotLightShadowsWithMaps,numLightProbes:S.numLightProbes,numClippingPlanes:s.numPlanes,numClipIntersection:s.numIntersection,dithering:E.dithering,shadowMapEnabled:r.shadowMap.enabled&&P.length>0,shadowMapType:r.shadowMap.type,toneMapping:ke,decodeVideoTexture:Fe&&E.map.isVideoTexture===!0&&tt.getTransfer(E.map.colorSpace)===ft,decodeVideoTextureEmissive:zt&&E.emissiveMap.isVideoTexture===!0&&tt.getTransfer(E.emissiveMap.colorSpace)===ft,premultipliedAlpha:E.premultipliedAlpha,doubleSided:E.side===qt,flipSided:E.side===on,useDepthPacking:E.depthPacking>=0,depthPacking:E.depthPacking||0,index0AttributeName:E.index0AttributeName,extensionCl
vendor: 8,411 bytes, line 4041
4041ipCullDistance:_e&&E.extensions.clipCullDistance===!0&&t.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(_e&&E.extensions.multiDraw===!0||De)&&t.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:t.has("KHR_parallel_shader_compile"),customProgramCacheKey:E.customProgramCacheKey()};return vt.vertexUv1s=c.has(1),vt.vertexUv2s=c.has(2),vt.vertexUv3s=c.has(3),c.clear(),vt}function A(E){const S=[];if(E.shaderID?S.push(E.shaderID):(S.push(E.customVertexShaderID),S.push(E.customFragmentShaderID)),E.defines!==void 0)for(const P in E.defines)S.push(P),S.push(E.defines[P]);return E.isRawShaderMaterial===!1&&(g(S,E),b(S,E),S.push(r.outputColorSpace)),S.push(E.customProgramCacheKey),S.join()}function g(E,S){E.push(S.precision),E.push(S.outputColorSpace),E.push(S.envMapMode),E.push(S.envMapCubeUVHeight),E.push(S.mapUv),E.push(S.alphaMapUv),E.push(S.lightMapUv),E.push(S.aoMapUv),E.push(S.bumpMapUv),E.push(S.normalMapUv),E.push(S.displacementMapUv),E.push(S.emissiveMapUv),E.push(S.metalnessMapUv),E.push(S.roughnessMapUv),E.push(S.anisotropyMapUv),E.push(S.clearcoatMapUv),E.push(S.clearcoatNormalMapUv),E.push(S.clearcoatRoughnessMapUv),E.push(S.iridescenceMapUv),E.push(S.iridescenceThicknessMapUv),E.push(S.sheenColorMapUv),E.push(S.sheenRoughnessMapUv),E.push(S.specularMapUv),E.push(S.specularColorMapUv),E.push(S.specularIntensityMapUv),E.push(S.transmissionMapUv),E.push(S.thicknessMapUv),E.push(S.combine),E.push(S.fogExp2),E.push(S.sizeAttenuation),E.push(S.morphTargetsCount),E.push(S.morphAttributeCount),E.push(S.numDirLights),E.push(S.numPointLights),E.push(S.numSpotLights),E.push(S.numSpotLightMaps),E.push(S.numHemiLights),E.push(S.numRectAreaLights),E.push(S.numDirLightShadows),E.push(S.numPointLightShadows),E.push(S.numSpotLightShadows),E.push(S.numSpotLightShadowsWithMaps),E.push(S.numLightProbes),E.push(S.shadowMapType),E.push(S.toneMapping),E.push(S.numClippingPlanes),E.push(S.numClipIntersection),E.push(S.depthPacking)}function b(E,S){a.disableAll(),S.instancing&&a.enable(0),S.instancingColor&&a.enable(1),S.instancingMorph&&a.enable(2),S.matcap&&a.enable(3),S.envMap&&a.enable(4),S.normalMapObjectSpace&&a.enable(5),S.normalMapTangentSpace&&a.enable(6),S.clearcoat&&a.enable(7),S.iridescence&&a.enable(8),S.alphaTest&&a.enable(9),S.vertexColors&&a.enable(10),S.vertexAlphas&&a.enable(11),S.vertexUv1s&&a.enable(12),S.vertexUv2s&&a.enable(13),S.vertexUv3s&&a.enable(14),S.vertexTangents&&a.enable(15),S.anisotropy&&a.enable(16),S.alphaHash&&a.enable(17),S.batching&&a.enable(18),S.dispersion&&a.enable(19),S.batchingColor&&a.enable(20),S.gradientMap&&a.enable(21),E.push(a.mask),a.disableAll(),S.fog&&a.enable(0),S.useFog&&a.enable(1),S.flatShading&&a.enable(2),S.logarithmicDepthBuffer&&a.enable(3),S.reversedDepthBuffer&&a.enable(4),S.skinning&&a.enable(5),S.morphTargets&&a.enable(6),S.morphNormals&&a.enable(7),S.morphColors&&a.enable(8),S.premultipliedAlpha&&a.enable(9),S.shadowMapEnabled&&a.enable(10),S.doubleSided&&a.enable(11),S.flipSided&&a.enable(12),S.useDepthPacking&&a.enable(13),S.dithering&&a.enable(14),S.transmission&&a.enable(15),S.sheen&&a.enable(16),S.opaque&&a.enable(17),S.pointsUvs&&a.enable(18),S.decodeVideoTexture&&a.enable(19),S.decodeVideoTextureEmissive&&a.enable(20),S.alphaToCoverage&&a.enable(21),E.push(a.mask)}function x(E){const S=f[E.type];let P;if(S){const w=fi[S];P=py.clone(w.uniforms)}else P=E.uniforms;return P}function _(E,S){let P=h.get(S);return P!==void 0?++P.usedTimes:(P=new fw(r,S,E,i),l.push(P),h.set(S,P)),P}function v(E){if(--E.usedTimes===0){const S=l.indexOf(E);l[S]=l[l.length-1],l.pop(),h.delete(E.cacheKey),E.destroy()}}function C(E){o.remove(E)}function I(){o.dispose()}return{getParameters:m,getProgramCacheKey:A,getUniforms:x,acquireProgram:_,releaseProgram:v,releaseShaderCache:C,programs:l,dispose:I}}function bw(){let r=new WeakMap;function e(a){return r.has(a)}function t(a){let o=r.get(a);return o===void 0&&(o={},r.set(a,o)),o}function n(a){r.delete(a)}function i(a,o,c){r.get(a)[o]=c}function s(){r=new WeakMap}return{has:e,get:t,remove:n,update:i,dispose:s}}function xw(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.material.id!==e.material.id?r.material.id-e.material.id:r.materialVariant!==e.materialVariant?r.materialVariant-e.materialVariant:r.z!==e.z?r.z-e.z:r.id-e.id}function VA(r,e){return r.groupOrder!==e.groupOrder?r.groupOrder-e.groupOrder:r.renderOrder!==e.renderOrder?r.renderOrder-e.renderOrder:r.z!==e.z?e.z-r.z:r.id-e.id}function WA(){const r=[];let e=0;const t=[],n=[],i=[];function s(){e=0,t.length=0,n.length=0,i.length=0}function a(d){let f=0;return d.isInstancedMesh&&(f+=2),d.isSkinnedMesh&&(f+=1),f}function o(d,f,p,m,A,g){let b=r[e];return b===void 0?(b={id:d.id,object:d,geometry:f,material:p,materialVariant:a(d),groupOrder:m,renderOrder:d.renderOrder,z:A,group:g},r[e]=b):(b.id=d.id,b.object=d,b.geometry=f,b.material=p,b.materialVariant=a(d),b.groupOrder=m,b.renderOrder=d.renderOrder,b.z=A,b.group=g),e++,b}function c(d,f,p,m,A,g){const b=o(d,f,p,m,A,g);p.transmission>0?n.push(b):p.transparent===!0?i.push(b):t.push(b)}function l(d,f,p,m,A,g){const b=o(d,f,p,m,A,g);p.transmission>0?n.unshift(b):p.transparent===!0?i.unshift(b):t.unshift(b)}function h(d,f){t.length>1&&t.sort(d||xw),n.length>1&&n.sort(f||VA),i.length>1&&i.sort(f||VA)}function u(){for(let d=e,f=r.length;d<f;d++){const p=r[d];if(p.id===null)break;p.id=null,p.object=null,p.geometry=null,p.material=null,p.group=null}}return{opaque:t,transmissive:n,transparent:i,init:s,push:c,unshift:l,finish:u,sort:h}}function Ew(){let r=new WeakMap;function e(n,i){const s=r.get(n);let a;return s===void 0?(a=new WA,r.set(n,[a])):i>=s.length?(a=new WA,s.push(a)):a=s[i],a}function t(){r=new WeakMap}return{get:e,dispose:t}}function _w(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new R,color:new Me};break;case"SpotLight":t={position:new R,direction:new R,color:new Me,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new R,color:new Me,distance:0,decay:0};break;case"HemisphereLight":t={direction:new R,skyColor:new Me,groundColor:new Me};break;case"RectAreaLight":t={color:new Me,position:new R,halfWidth:new R,halfHeight:new R};break}return r[e.id]=t,t}}}function vw(){const r={};return{get:function(e){if(r[e.id]!==void 0)return r[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new pe};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new pe};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new pe,shadowCameraNear:1,shadowCameraFar:1e3};break}return r[e.id]=t,t}}}let yw=0;function Sw(r,e){return(e.castShadow?2:0)-(r.castShadow?2:0)+(e.map?1:0)-(r.map?1:0)}function Cw(r){const e=new _w,t=vw(),n={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let l=0;l<9;l++)n.probe.push(new R);const i=new R,s=new Oe,a=new Oe;function o(l){let h=0,u=0,d=0;for(let S=0;S<9;S++)n.probe[S].set(0,0,0);let f=0,p=0,m=0,A=0,g=0,b=0,x=0,_=0,v=0,C=0,I=0;l.sort(Sw);for(let S=0,P=l.length;S<P;S++){const w=l[S],L=w.color,N=w.intensity,O=w.distance;let D=null;if(w.shadow&&w.shadow.map&&(w.shadow.map.texture.format===Jn?D=w.shadow.map.texture:D=w.shadow.map.depthTexture||w.shadow.map.texture),w.isAmbientLight)h+=L.r*N,u+=L.g*N,d+=L.b*N;else if(w.isLightProbe){for(let U=0;U<9;U++)n.probe[U].addScaledVector(w.sh.coefficients[U],N);I++}else if(w.isDirectionalLight){const U=e.get(w);if(U.color.copy(w.color).multiplyScalar(w.intensity),w.castShadow){const F=w.shadow,$=t.get(w);$.shadowIntensity=F.intensity,$.shadowBias=F.bias,$.shadowNormalBias=F.normalBias,$.shadowRadius=F.radius,$.shadowMapSize=F.mapSize,n.directionalShadow[f]=$,
vendor: 4,263 bytes, line 4041
4041n.directionalShadowMap[f]=D,n.directionalShadowMatrix[f]=w.shadow.matrix,b++}n.directional[f]=U,f++}else if(w.isSpotLight){const U=e.get(w);U.position.setFromMatrixPosition(w.matrixWorld),U.color.copy(L).multiplyScalar(N),U.distance=O,U.coneCos=Math.cos(w.angle),U.penumbraCos=Math.cos(w.angle*(1-w.penumbra)),U.decay=w.decay,n.spot[m]=U;const F=w.shadow;if(w.map&&(n.spotLightMap[v]=w.map,v++,F.updateMatrices(w),w.castShadow&&C++),n.spotLightMatrix[m]=F.matrix,w.castShadow){const $=t.get(w);$.shadowIntensity=F.intensity,$.shadowBias=F.bias,$.shadowNormalBias=F.normalBias,$.shadowRadius=F.radius,$.shadowMapSize=F.mapSize,n.spotShadow[m]=$,n.spotShadowMap[m]=D,_++}m++}else if(w.isRectAreaLight){const U=e.get(w);U.color.copy(L).multiplyScalar(N),U.halfWidth.set(w.width*.5,0,0),U.halfHeight.set(0,w.height*.5,0),n.rectArea[A]=U,A++}else if(w.isPointLight){const U=e.get(w);if(U.color.copy(w.color).multiplyScalar(w.intensity),U.distance=w.distance,U.decay=w.decay,w.castShadow){const F=w.shadow,$=t.get(w);$.shadowIntensity=F.intensity,$.shadowBias=F.bias,$.shadowNormalBias=F.normalBias,$.shadowRadius=F.radius,$.shadowMapSize=F.mapSize,$.shadowCameraNear=F.camera.near,$.shadowCameraFar=F.camera.far,n.pointShadow[p]=$,n.pointShadowMap[p]=D,n.pointShadowMatrix[p]=w.shadow.matrix,x++}n.point[p]=U,p++}else if(w.isHemisphereLight){const U=e.get(w);U.skyColor.copy(w.color).multiplyScalar(N),U.groundColor.copy(w.groundColor).multiplyScalar(N),n.hemi[g]=U,g++}}A>0&&(r.has("OES_texture_float_linear")===!0?(n.rectAreaLTC1=he.LTC_FLOAT_1,n.rectAreaLTC2=he.LTC_FLOAT_2):(n.rectAreaLTC1=he.LTC_HALF_1,n.rectAreaLTC2=he.LTC_HALF_2)),n.ambient[0]=h,n.ambient[1]=u,n.ambient[2]=d;const E=n.hash;(E.directionalLength!==f||E.pointLength!==p||E.spotLength!==m||E.rectAreaLength!==A||E.hemiLength!==g||E.numDirectionalShadows!==b||E.numPointShadows!==x||E.numSpotShadows!==_||E.numSpotMaps!==v||E.numLightProbes!==I)&&(n.directional.length=f,n.spot.length=m,n.rectArea.length=A,n.point.length=p,n.hemi.length=g,n.directionalShadow.length=b,n.directionalShadowMap.length=b,n.pointShadow.length=x,n.pointShadowMap.length=x,n.spotShadow.length=_,n.spotShadowMap.length=_,n.directionalShadowMatrix.length=b,n.pointShadowMatrix.length=x,n.spotLightMatrix.length=_+v-C,n.spotLightMap.length=v,n.numSpotLightShadowsWithMaps=C,n.numLightProbes=I,E.directionalLength=f,E.pointLength=p,E.spotLength=m,E.rectAreaLength=A,E.hemiLength=g,E.numDirectionalShadows=b,E.numPointShadows=x,E.numSpotShadows=_,E.numSpotMaps=v,E.numLightProbes=I,n.version=yw++)}function c(l,h){let u=0,d=0,f=0,p=0,m=0;const A=h.matrixWorldInverse;for(let g=0,b=l.length;g<b;g++){const x=l[g];if(x.isDirectionalLight){const _=n.directional[u];_.direction.setFromMatrixPosition(x.matrixWorld),i.setFromMatrixPosition(x.target.matrixWorld),_.direction.sub(i),_.direction.transformDirection(A),u++}else if(x.isSpotLight){const _=n.spot[f];_.position.setFromMatrixPosition(x.matrixWorld),_.position.applyMatrix4(A),_.direction.setFromMatrixPosition(x.matrixWorld),i.setFromMatrixPosition(x.target.matrixWorld),_.direction.sub(i),_.direction.transformDirection(A),f++}else if(x.isRectAreaLight){const _=n.rectArea[p];_.position.setFromMatrixPosition(x.matrixWorld),_.position.applyMatrix4(A),a.identity(),s.copy(x.matrixWorld),s.premultiply(A),a.extractRotation(s),_.halfWidth.set(x.width*.5,0,0),_.halfHeight.set(0,x.height*.5,0),_.halfWidth.applyMatrix4(a),_.halfHeight.applyMatrix4(a),p++}else if(x.isPointLight){const _=n.point[d];_.position.setFromMatrixPosition(x.matrixWorld),_.position.applyMatrix4(A),d++}else if(x.isHemisphereLight){const _=n.hemi[m];_.direction.setFromMatrixPosition(x.matrixWorld),_.direction.transformDirection(A),m++}}}return{setup:o,setupView:c,state:n}}function qA(r){const e=new Cw(r),t=[],n=[];function i(h){l.camera=h,t.length=0,n.length=0}function s(h){t.push(h)}function a(h){n.push(h)}function o(){e.setup(t)}function c(h){e.setupView(t,h)}const l={lightsArray:t,shadowsArray:n,camera:null,lights:e,transmissionRenderTarget:{}};return{init:i,state:l,setupLights:o,setupLightsView:c,pushLight:s,pushShadow:a}}function Mw(r){let e=new WeakMap;function t(i,s=0){const a=e.get(i);let o;return a===void 0?(o=new qA(r),e.set(i,[o])):s>=a.length?(o=new qA(r),a.push(o)):o=a[s],o}
vendor: 4,067 bytes, lines 4041-4068
4041function n(){e=new WeakMap}return{get:t,dispose:n}}const Iw=`void main() {
4042	gl_Position = vec4( position, 1.0 );
4043}`,ww=`uniform sampler2D shadow_pass;
4044uniform vec2 resolution;
4045uniform float radius;
4046void main() {
4047	const float samples = float( VSM_SAMPLES );
4048	float mean = 0.0;
4049	float squared_mean = 0.0;
4050	float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
4051	float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
4052	for ( float i = 0.0; i < samples; i ++ ) {
4053		float uvOffset = uvStart + i * uvStride;
4054		#ifdef HORIZONTAL_PASS
4055			vec2 distribution = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ).rg;
4056			mean += distribution.x;
4057			squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
4058		#else
4059			float depth = texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ).r;
4060			mean += depth;
4061			squared_mean += depth * depth;
4062		#endif
4063	}
4064	mean = mean / samples;
4065	squared_mean = squared_mean / samples;
4066	float std_dev = sqrt( max( 0.0, squared_mean - mean * mean ) );
4067	gl_FragColor = vec4( mean, std_dev, 0.0, 1.0 );
4068}`,Tw=[new R(1,0,0),new R(-1,0,0),new R(0,1,0),new R(0,-1,0),new R(0,0,1),new R(0,0,-1)],Rw=[new R(0,-1,0),new R(0,-1,0),new R(0,0,1),new R(0,0,-1),new R(0,-1,0),new R(0,-1,0)],jA=new Oe,Fa=new R,eu=new R;function Bw(r,e,t){let n=new zf;const i=new pe,s=new pe,a=new It,o=new yb,c=new by,l={},h=t.maxTextureSize,u={[ti]:on,[on]:ti,[qt]:qt},d=new mn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new pe},radius:{value:4}},vertexShader:Iw,fragmentShader:ww}),f=d.clone();f.defines.HORIZONTAL_PASS=1;const p=new cn;p.setAttribute("position",new Lt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const m=new at(p,d),A=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=ol;let g=this.type;this.render=function(C,I,E){if(A.enabled===!1||A.autoUpdate===!1&&A.needsUpdate===!1||C.length===0)return;this.type===n_&&(Ie("WebGLShadowMap: PCFSoftShadowMap has been deprecated. Using PCFShadowMap instead."),this.type=ol);const S=r.getRenderTarget(),P=r.getActiveCubeFace(),w=r.getActiveMipmapLevel(),L=r.state;L.setBlending(Zn),L.buffers.depth.getReversed()===!0?L.buffers.color.setClear(0,0,0,0):L.buffers.color.setClear(1,1,1,1),L.buffers.depth.setTest(!0),L.setScissorTest(!1);const N=g!==this.type;N&&I.traverse(function(O){O.material&&(Array.isArray(O.material)?O.material.forEach(D=>D.needsUpdate=!0):O.material.needsUpdate=!0)});for(let O=0,D=C.length;O<D;O++){const U=C[O],F=U.shadow;if(F===void 0){Ie("WebGLShadowMap:",U,"has no shadow.");continue}if(F.autoUpdate===!1&&F.needsUpdate===!1)continue;i.copy(F.mapSize);const $=F.getFrameExtents();i.multiply($),s.copy(F.mapSize),(i.x>h||i.y>h)&&(i.x>h&&(s.x=Math.floor(h/$.x),i.x=s.x*$.x,F.mapSize.x=s.x),i.y>h&&(s.y=Math.floor(h/$.y),i.y=s.y*$.y,F.mapSize.y=s.y));const q=r.state.buffers.depth.getReversed();if(F.camera._reversedDepth=q,F.map===null||N===!0){if(F.map!==null&&(F.map.depthTexture!==null&&(F.map.depthTexture.dispose(),F.map.depthTexture=null),F.map.dispose()),this.type===ro){if(U.isPointLight){Ie("WebGLShadowMap: VSM shadow maps are not supported for PointLights. Use PCF or BasicShadowMap instead.");continue}F.map=new Sn(i.x,i.y,{format:Jn,type:yt,minFilter:qe,magFilter:qe,generateMipmaps:!1}),F.map.texture.name=U.name+".shadowMap",F.map.depthTexture=new Oo(i.x,i.y,Nt),F.map.depthTexture.name=U.name+".shadowMapDepth",F.map.depthTexture.format=qi,F.map.depthTexture.compareFunction=null,F.map.depthTexture.minFilter=St,F.map.depthTexture.magFilter=St}else U.isPointLight?(F.map=new ah(i.x),F.map.depthTexture=new Pv(i.x,ii)):(F.map=new Sn(i.x,i.y),F.map.depthTexture=new Oo(i.x,i.y,ii)),F.map.depthTexture.name=U.name+".shadowMap",F.map.depthTexture.format=qi,this.type===ol?(F.map.depthTexture.compareFunction=q?kf:Of,F.map.depthTexture.minFilter=qe,F.map.depthTexture.magFilter=qe):(F.map.depthTexture.compareFunction=null,F.map.depthTexture.minFilter=St,F.map.depthTexture.magFilter=St);F.camera.updateProjectionMatrix()}
vendor: 9,235 bytes, line 4068
4068const te=F.map.isWebGLCubeRenderTarget?6:1;for(let Z=0;Z<te;Z++){if(F.map.isWebGLCubeRenderTarget)r.setRenderTarget(F.map,Z),r.clear();else{Z===0&&(r.setRenderTarget(F.map),r.clear());const Y=F.getViewport(Z);a.set(s.x*Y.x,s.y*Y.y,s.x*Y.z,s.y*Y.w),L.viewport(a)}if(U.isPointLight){const Y=F.camera,fe=F.matrix,Ge=U.distance||Y.far;Ge!==Y.far&&(Y.far=Ge,Y.updateProjectionMatrix()),Fa.setFromMatrixPosition(U.matrixWorld),Y.position.copy(Fa),eu.copy(Y.position),eu.add(Tw[Z]),Y.up.copy(Rw[Z]),Y.lookAt(eu),Y.updateMatrixWorld(),fe.makeTranslation(-Fa.x,-Fa.y,-Fa.z),jA.multiplyMatrices(Y.projectionMatrix,Y.matrixWorldInverse),F._frustum.setFromProjectionMatrix(jA,Y.coordinateSystem,Y.reversedDepth)}else F.updateMatrices(U);n=F.getFrustum(),_(I,E,F.camera,U,this.type)}F.isPointLightShadow!==!0&&this.type===ro&&b(F,E),F.needsUpdate=!1}g=this.type,A.needsUpdate=!1,r.setRenderTarget(S,P,w)};function b(C,I){const E=e.update(m);d.defines.VSM_SAMPLES!==C.blurSamples&&(d.defines.VSM_SAMPLES=C.blurSamples,f.defines.VSM_SAMPLES=C.blurSamples,d.needsUpdate=!0,f.needsUpdate=!0),C.mapPass===null&&(C.mapPass=new Sn(i.x,i.y,{format:Jn,type:yt})),d.uniforms.shadow_pass.value=C.map.depthTexture,d.uniforms.resolution.value=C.mapSize,d.uniforms.radius.value=C.radius,r.setRenderTarget(C.mapPass),r.clear(),r.renderBufferDirect(I,null,E,d,m,null),f.uniforms.shadow_pass.value=C.mapPass.texture,f.uniforms.resolution.value=C.mapSize,f.uniforms.radius.value=C.radius,r.setRenderTarget(C.map),r.clear(),r.renderBufferDirect(I,null,E,f,m,null)}function x(C,I,E,S){let P=null;const w=E.isPointLight===!0?C.customDistanceMaterial:C.customDepthMaterial;if(w!==void 0)P=w;else if(P=E.isPointLight===!0?c:o,r.localClippingEnabled&&I.clipShadows===!0&&Array.isArray(I.clippingPlanes)&&I.clippingPlanes.length!==0||I.displacementMap&&I.displacementScale!==0||I.alphaMap&&I.alphaTest>0||I.map&&I.alphaTest>0||I.alphaToCoverage===!0){const L=P.uuid,N=I.uuid;let O=l[L];O===void 0&&(O={},l[L]=O);let D=O[N];D===void 0&&(D=P.clone(),O[N]=D,I.addEventListener("dispose",v)),P=D}if(P.visible=I.visible,P.wireframe=I.wireframe,S===ro?P.side=I.shadowSide!==null?I.shadowSide:I.side:P.side=I.shadowSide!==null?I.shadowSide:u[I.side],P.alphaMap=I.alphaMap,P.alphaTest=I.alphaToCoverage===!0?.5:I.alphaTest,P.map=I.map,P.clipShadows=I.clipShadows,P.clippingPlanes=I.clippingPlanes,P.clipIntersection=I.clipIntersection,P.displacementMap=I.displacementMap,P.displacementScale=I.displacementScale,P.displacementBias=I.displacementBias,P.wireframeLinewidth=I.wireframeLinewidth,P.linewidth=I.linewidth,E.isPointLight===!0&&P.isMeshDistanceMaterial===!0){const L=r.properties.get(P);L.light=E}return P}function _(C,I,E,S,P){if(C.visible===!1)return;if(C.layers.test(I.layers)&&(C.isMesh||C.isLine||C.isPoints)&&(C.castShadow||C.receiveShadow&&P===ro)&&(!C.frustumCulled||n.intersectsObject(C))){C.modelViewMatrix.multiplyMatrices(E.matrixWorldInverse,C.matrixWorld);const N=e.update(C),O=C.material;if(Array.isArray(O)){const D=N.groups;for(let U=0,F=D.length;U<F;U++){const $=D[U],q=O[$.materialIndex];if(q&&q.visible){const te=x(C,q,S,P);C.onBeforeShadow(r,C,I,E,N,te,$),r.renderBufferDirect(E,null,N,te,C,$),C.onAfterShadow(r,C,I,E,N,te,$)}}}else if(O.visible){const D=x(C,O,S,P);C.onBeforeShadow(r,C,I,E,N,D,null),r.renderBufferDirect(E,null,N,D,C,null),C.onAfterShadow(r,C,I,E,N,D,null)}}const L=C.children;for(let N=0,O=L.length;N<O;N++)_(L[N],I,E,S,P)}function v(C){C.target.removeEventListener("dispose",v);for(const E in l){const S=l[E],P=C.target.uuid;P in S&&(S[P].dispose(),delete S[P])}}}function Dw(r,e){function t(){let k=!1;const le=new It;let ae=null;const me=new It(0,0,0,0);return{setMask:function(ie){ae!==ie&&!k&&(r.colorMask(ie,ie,ie,ie),ae=ie)},setLocked:function(ie){k=ie},setClear:function(ie,W,_e,ke,vt){vt===!0&&(ie*=ke,W*=ke,_e*=ke),le.set(ie,W,_e,ke),me.equals(le)===!1&&(r.clearColor(ie,W,_e,ke),me.copy(le))},reset:function(){k=!1,ae=null,me.set(-1,0,0,0)}}}function n(){let k=!1,le=!1,ae=null,me=null,ie=null;return{setReversed:function(W){if(le!==W){const _e=e.get("EXT_clip_control");W?_e.clipControlEXT(_e.LOWER_LEFT_EXT,_e.ZERO_TO_ONE_EXT):_e.clipControlEXT(_e.LOWER_LEFT_EXT,_e.NEGATIVE_ONE_TO_ONE_EXT),le=W;const ke=ie;ie=null,this.setClear(ke)}},getReversed:function(){return le},setTest:function(W){W?se(r.DEPTH_TEST):oe(r.DEPTH_TEST)},setMask:function(W){ae!==W&&!k&&(r.depthMask(W),ae=W)},setFunc:function(W){if(le&&(W=O_[W]),me!==W){switch(W){case Md:r.depthFunc(r.NEVER);break;case Id:r.depthFunc(r.ALWAYS);break;case wd:r.depthFunc(r.LESS);break;case ia:r.depthFunc(r.LEQUAL);break;case Td:r.depthFunc(r.EQUAL);break;case Rd:r.depthFunc(r.GEQUAL);break;case Bd:r.depthFunc(r.GREATER);break;case Dd:r.depthFunc(r.NOTEQUAL);break;default:r.depthFunc(r.LEQUAL)}me=W}},setLocked:function(W){k=W},setClear:function(W){ie!==W&&(ie=W,le&&(W=1-W),r.clearDepth(W))},reset:function(){k=!1,ae=null,me=null,ie=null,le=!1}}}function i(){let k=!1,le=null,ae=null,me=null,ie=null,W=null,_e=null,ke=null,vt=null;return{setTest:function(ut){k||(ut?se(r.STENCIL_TEST):oe(r.STENCIL_TEST))},setMask:function(ut){le!==ut&&!k&&(r.stencilMask(ut),le=ut)},setFunc:function(ut,vi,yi){(ae!==ut||me!==vi||ie!==yi)&&(r.stencilFunc(ut,vi,yi),ae=ut,me=vi,ie=yi)},setOp:function(ut,vi,yi){(W!==ut||_e!==vi||ke!==yi)&&(r.stencilOp(ut,vi,yi),W=ut,_e=vi,ke=yi)},setLocked:function(ut){k=ut},setClear:function(ut){vt!==ut&&(r.clearStencil(ut),vt=ut)},reset:function(){k=!1,le=null,ae=null,me=null,ie=null,W=null,_e=null,ke=null,vt=null}}}const s=new t,a=new n,o=new i,c=new WeakMap,l=new WeakMap;let h={},u={},d=new WeakMap,f=[],p=null,m=!1,A=null,g=null,b=null,x=null,_=null,v=null,C=null,I=new Me(0,0,0),E=0,S=!1,P=null,w=null,L=null,N=null,O=null;const D=r.getParameter(r.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let U=!1,F=0;const $=r.getParameter(r.VERSION);$.indexOf("WebGL")!==-1?(F=parseFloat(/^WebGL (\d)/.exec($)[1]),U=F>=1):$.indexOf("OpenGL ES")!==-1&&(F=parseFloat(/^OpenGL ES (\d)/.exec($)[1]),U=F>=2);let q=null,te={};const Z=r.getParameter(r.SCISSOR_BOX),Y=r.getParameter(r.VIEWPORT),fe=new It().fromArray(Z),Ge=new It().fromArray(Y);function ze(k,le,ae,me){const ie=new Uint8Array(4),W=r.createTexture();r.bindTexture(k,W),r.texParameteri(k,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(k,r.TEXTURE_MAG_FILTER,r.NEAREST);for(let _e=0;_e<ae;_e++)k===r.TEXTURE_3D||k===r.TEXTURE_2D_ARRAY?r.texImage3D(le,0,r.RGBA,1,1,me,0,r.RGBA,r.UNSIGNED_BYTE,ie):r.texImage2D(le+_e,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,ie);return W}const X={};X[r.TEXTURE_2D]=ze(r.TEXTURE_2D,r.TEXTURE_2D,1),X[r.TEXTURE_CUBE_MAP]=ze(r.TEXTURE_CUBE_MAP,r.TEXTURE_CUBE_MAP_POSITIVE_X,6),X[r.TEXTURE_2D_ARRAY]=ze(r.TEXTURE_2D_ARRAY,r.TEXTURE_2D_ARRAY,1,1),X[r.TEXTURE_3D]=ze(r.TEXTURE_3D,r.TEXTURE_3D,1,1),s.setClear(0,0,0,1),a.setClear(1),o.setClear(0),se(r.DEPTH_TEST),a.setFunc(ia),Ke(!1),Qt(Cp),se(r.CULL_FACE),it(Zn);function se(k){h[k]!==!0&&(r.enable(k),h[k]=!0)}function oe(k){h[k]!==!1&&(r.disable(k),h[k]=!1)}function He(k,le){return u[k]!==le?(r.bindFramebuffer(k,le),u[k]=le,k===r.DRAW_FRAMEBUFFER&&(u[r.FRAMEBUFFER]=le),k===r.FRAMEBUFFER&&(u[r.DRAW_FRAMEBUFFER]=le),!0):!1}function De(k,le){let ae=f,me=!1;if(k){ae=d.get(le),ae===void 0&&(ae=[],d.set(le,ae));const ie=k.textures;if(ae.length!==ie.length||ae[0]!==r.COLOR_ATTACHMENT0){for(let W=0,_e=ie.length;W<_e;W++)ae[W]=r.COLOR_ATTACHMENT0+W;ae.length=ie.length,me=!0}}else ae[0]!==r.BACK&&(ae[0]=r.BACK,me=!0);me&&r.drawBuffers(ae)}function Fe(k){return p!==k?(r.useProgram(k),p=k,!0):!1}const kt={[Ws]:r.FUNC_ADD,[s_]:r.FUNC_SUBTRACT,[r_]:r.FUNC_REVERSE_SUBTRACT};kt[a_]=r.MIN,kt[o_]=r.MAX;const Ze={[c_]:r.ZERO,[l_]:r.ONE,[h_]:r.SRC_COLOR,[Sd]:r.SRC_ALPHA,[g_]:r.SRC_ALPHA_SATURATE,[p_]:r.DST_COLOR,[d_]:r.DST_ALPHA,[u_]:r.ONE_MINUS_SRC_COLOR,[Cd]:r.ONE_MINUS_SRC_ALPHA,[A_]:r.ONE_MINUS_DST_COLOR,[f_]:r.ONE_MINUS_DST_ALPHA,[m_]:r.CONSTANT_COLOR,[b_]:r.ONE_MINUS_CONSTANT_COLOR,[x_]:r.CONSTANT_ALPHA,[E_]:r.ONE_MINUS_CONSTANT_ALPHA};function it(k,le,ae,me,ie,W,_e,ke,vt,ut){if(k===Zn){m===!0&&(oe(r.BLEND),m=!1);return}if(m===!1&&(se(r.BLEND),m=!0),k!==i_){if(k!==A||ut!==S){if((g!==Ws||_!==Ws)&&(r.blendEquation(r.FUNC_ADD),g=Ws,_=Ws),ut)switch(k){case $s:r.blendFuncSeparate(r.ONE,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case yd:r.blendFunc(r.ONE,r.ONE);break;case Mp:r.blendFuncSeparate(r.ZERO,r.ONE_MINUS_SRC_COLOR,r.ZERO,r.ONE);break;case Ip:r.blendFuncSeparate(r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ZERO,r.ONE);break;default:Pe("WebGLState: Invalid blending: ",k);break}else switch(k){case $s:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA);break;case yd:r.blendFuncSeparate(r.SRC_ALPHA,r.ONE,r.ONE,r.ONE);break;case Mp:Pe("WebGLState: SubtractiveBlending requires material.premultipliedAlpha = true");break;case Ip:Pe("WebGLState: MultiplyBlending requires material.premultipliedAlpha = true");break;default:Pe("WebGLState: Invalid blending: ",k);break}b=null,x=null,v=null,C=null,I.set(0,0,0),E=0,A=k,S=ut}return}ie=ie||le,W=W||ae,_e=_e||me,(le!==g||ie!==_)&&(r.blendEquationSeparate(kt[le],kt[ie]),g=le,_=ie),(ae!==b||me!==x||W!==v||_e!==C)&&(r.blendFuncSeparate(Ze[ae],Ze[me],Ze[W],Ze[_e]),b=ae,x=me,v=W,C=_e),(ke.equals(I)===!1||vt!==E)&&(r.blendColor
vendor: 5,101 bytes, line 4068
4068(ke.r,ke.g,ke.b,vt),I.copy(ke),E=vt),A=k,S=!1}function bt(k,le){k.side===qt?oe(r.CULL_FACE):se(r.CULL_FACE);let ae=k.side===on;le&&(ae=!ae),Ke(ae),k.blending===$s&&k.transparent===!1?it(Zn):it(k.blending,k.blendEquation,k.blendSrc,k.blendDst,k.blendEquationAlpha,k.blendSrcAlpha,k.blendDstAlpha,k.blendColor,k.blendAlpha,k.premultipliedAlpha),a.setFunc(k.depthFunc),a.setTest(k.depthTest),a.setMask(k.depthWrite),s.setMask(k.colorWrite);const me=k.stencilWrite;o.setTest(me),me&&(o.setMask(k.stencilWriteMask),o.setFunc(k.stencilFunc,k.stencilRef,k.stencilFuncMask),o.setOp(k.stencilFail,k.stencilZFail,k.stencilZPass)),zt(k.polygonOffset,k.polygonOffsetFactor,k.polygonOffsetUnits),k.alphaToCoverage===!0?se(r.SAMPLE_ALPHA_TO_COVERAGE):oe(r.SAMPLE_ALPHA_TO_COVERAGE)}function Ke(k){P!==k&&(k?r.frontFace(r.CW):r.frontFace(r.CCW),P=k)}function Qt(k){k!==e_?(se(r.CULL_FACE),k!==w&&(k===Cp?r.cullFace(r.BACK):k===t_?r.cullFace(r.FRONT):r.cullFace(r.FRONT_AND_BACK))):oe(r.CULL_FACE),w=k}function B(k){k!==L&&(U&&r.lineWidth(k),L=k)}function zt(k,le,ae){k?(se(r.POLYGON_OFFSET_FILL),(N!==le||O!==ae)&&(N=le,O=ae,a.getReversed()&&(le=-le),r.polygonOffset(le,ae))):oe(r.POLYGON_OFFSET_FILL)}function ct(k){k?se(r.SCISSOR_TEST):oe(r.SCISSOR_TEST)}function _t(k){k===void 0&&(k=r.TEXTURE0+D-1),q!==k&&(r.activeTexture(k),q=k)}function Se(k,le,ae){ae===void 0&&(q===null?ae=r.TEXTURE0+D-1:ae=q);let me=te[ae];me===void 0&&(me={type:void 0,texture:void 0},te[ae]=me),(me.type!==k||me.texture!==le)&&(q!==ae&&(r.activeTexture(ae),q=ae),r.bindTexture(k,le||X[k]),me.type=k,me.texture=le)}function T(){const k=te[q];k!==void 0&&k.type!==void 0&&(r.bindTexture(k.type,null),k.type=void 0,k.texture=void 0)}function y(){try{r.compressedTexImage2D(...arguments)}catch(k){Pe("WebGLState:",k)}}function Q(){try{r.compressedTexImage3D(...arguments)}catch(k){Pe("WebGLState:",k)}}function K(){try{r.texSubImage2D(...arguments)}catch(k){Pe("WebGLState:",k)}}function ee(){try{r.texSubImage3D(...arguments)}catch(k){Pe("WebGLState:",k)}}function j(){try{r.compressedTexSubImage2D(...arguments)}catch(k){Pe("WebGLState:",k)}}function xe(){try{r.compressedTexSubImage3D(...arguments)}catch(k){Pe("WebGLState:",k)}}function ce(){try{r.texStorage2D(...arguments)}catch(k){Pe("WebGLState:",k)}}function Be(){try{r.texStorage3D(...arguments)}catch(k){Pe("WebGLState:",k)}}function Ne(){try{r.texImage2D(...arguments)}catch(k){Pe("WebGLState:",k)}}function ne(){try{r.texImage3D(...arguments)}catch(k){Pe("WebGLState:",k)}}function re(k){fe.equals(k)===!1&&(r.scissor(k.x,k.y,k.z,k.w),fe.copy(k))}function Ee(k){Ge.equals(k)===!1&&(r.viewport(k.x,k.y,k.z,k.w),Ge.copy(k))}function ve(k,le){let ae=l.get(le);ae===void 0&&(ae=new WeakMap,l.set(le,ae));let me=ae.get(k);me===void 0&&(me=r.getUniformBlockIndex(le,k.name),ae.set(k,me))}function Ae(k,le){const me=l.get(le).get(k);c.get(le)!==me&&(r.uniformBlockBinding(le,me,k.__bindingPointIndex),c.set(le,me))}function $e(){r.disable(r.BLEND),r.disable(r.CULL_FACE),r.disable(r.DEPTH_TEST),r.disable(r.POLYGON_OFFSET_FILL),r.disable(r.SCISSOR_TEST),r.disable(r.STENCIL_TEST),r.disable(r.SAMPLE_ALPHA_TO_COVERAGE),r.blendEquation(r.FUNC_ADD),r.blendFunc(r.ONE,r.ZERO),r.blendFuncSeparate(r.ONE,r.ZERO,r.ONE,r.ZERO),r.blendColor(0,0,0,0),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0),r.depthMask(!0),r.depthFunc(r.LESS),a.setReversed(!1),r.clearDepth(1),r.stencilMask(4294967295),r.stencilFunc(r.ALWAYS,0,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.KEEP),r.clearStencil(0),r.cullFace(r.BACK),r.frontFace(r.CCW),r.polygonOffset(0,0),r.activeTexture(r.TEXTURE0),r.bindFramebuffer(r.FRAMEBUFFER,null),r.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),r.bindFramebuffer(r.READ_FRAMEBUFFER,null),r.useProgram(null),r.lineWidth(1),r.scissor(0,0,r.canvas.width,r.canvas.height),r.viewport(0,0,r.canvas.width,r.canvas.height),h={},q=null,te={},u={},d=new WeakMap,f=[],p=null,m=!1,A=null,g=null,b=null,x=null,_=null,v=null,C=null,I=new Me(0,0,0),E=0,S=!1,P=null,w=null,L=null,N=null,O=null,fe.set(0,0,r.canvas.width,r.canvas.height),Ge.set(0,0,r.canvas.width,r.canvas.height),s.reset(),a.reset(),o.reset()}return{buffers:{color:s,depth:a,stencil:o},enable:se,disable:oe,bindFramebuffer:He,drawBuffers:De,useProgram:Fe,setBlending:it,setMaterial:bt,setFlipSided:Ke,setCullFace:Qt,setLineWidth:B,setPolygonOffset:zt,setScissorTest:ct,activeTexture:_t,bindTexture:Se,unbindTexture:T,compressedTexImage2D:y,compressedTexImage3D:Q,texImage2D:Ne,texImage3D:ne,updateUBOMapping:ve,uniformBlockBinding:Ae,texStorage2D:ce,texStorage3D:Be,texSubImage2D:K,texSubImage3D:ee,compressedTexSubImage2D:j,compressedTexSubImage3D:xe,scissor:re,viewport:Ee,reset:$e}}function Lw(r,e,t,n,i,s,a){const o=e.has("WEBGL_multisampled_render_to_texture")?e.get("WEBGL_multisampled_render_to_texture"):null,c=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),l=new pe,h=new WeakMap;let u;const d=new WeakMap;let f=!1;try{f=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function p(T,y){return f?new OffscreenCanvas(T,y):No("canvas")}function m(T,y,Q){let K=1;const ee=Se(T);
vendor: 43,074 bytes, lines 4068-4092
4068if((ee.width>Q||ee.height>Q)&&(K=Q/Math.max(ee.width,ee.height)),K<1)if(typeof HTMLImageElement<"u"&&T instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&T instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&T instanceof ImageBitmap||typeof VideoFrame<"u"&&T instanceof VideoFrame){const j=Math.floor(K*ee.width),xe=Math.floor(K*ee.height);u===void 0&&(u=p(j,xe));const ce=y?p(j,xe):u;return ce.width=j,ce.height=xe,ce.getContext("2d").drawImage(T,0,0,j,xe),Ie("WebGLRenderer: Texture has been resized from ("+ee.width+"x"+ee.height+") to ("+j+"x"+xe+")."),ce}else return"data"in T&&Ie("WebGLRenderer: Image in DataTexture is too big ("+ee.width+"x"+ee.height+")."),T;return T}function A(T){return T.generateMipmaps}function g(T){r.generateMipmap(T)}function b(T){return T.isWebGLCubeRenderTarget?r.TEXTURE_CUBE_MAP:T.isWebGL3DRenderTarget?r.TEXTURE_3D:T.isWebGLArrayRenderTarget||T.isCompressedArrayTexture?r.TEXTURE_2D_ARRAY:r.TEXTURE_2D}function x(T,y,Q,K,ee=!1){if(T!==null){if(r[T]!==void 0)return r[T];Ie("WebGLRenderer: Attempt to use non-existing WebGL internal format '"+T+"'")}let j=y;if(y===r.RED&&(Q===r.FLOAT&&(j=r.R32F),Q===r.HALF_FLOAT&&(j=r.R16F),Q===r.UNSIGNED_BYTE&&(j=r.R8)),y===r.RED_INTEGER&&(Q===r.UNSIGNED_BYTE&&(j=r.R8UI),Q===r.UNSIGNED_SHORT&&(j=r.R16UI),Q===r.UNSIGNED_INT&&(j=r.R32UI),Q===r.BYTE&&(j=r.R8I),Q===r.SHORT&&(j=r.R16I),Q===r.INT&&(j=r.R32I)),y===r.RG&&(Q===r.FLOAT&&(j=r.RG32F),Q===r.HALF_FLOAT&&(j=r.RG16F),Q===r.UNSIGNED_BYTE&&(j=r.RG8)),y===r.RG_INTEGER&&(Q===r.UNSIGNED_BYTE&&(j=r.RG8UI),Q===r.UNSIGNED_SHORT&&(j=r.RG16UI),Q===r.UNSIGNED_INT&&(j=r.RG32UI),Q===r.BYTE&&(j=r.RG8I),Q===r.SHORT&&(j=r.RG16I),Q===r.INT&&(j=r.RG32I)),y===r.RGB_INTEGER&&(Q===r.UNSIGNED_BYTE&&(j=r.RGB8UI),Q===r.UNSIGNED_SHORT&&(j=r.RGB16UI),Q===r.UNSIGNED_INT&&(j=r.RGB32UI),Q===r.BYTE&&(j=r.RGB8I),Q===r.SHORT&&(j=r.RGB16I),Q===r.INT&&(j=r.RGB32I)),y===r.RGBA_INTEGER&&(Q===r.UNSIGNED_BYTE&&(j=r.RGBA8UI),Q===r.UNSIGNED_SHORT&&(j=r.RGBA16UI),Q===r.UNSIGNED_INT&&(j=r.RGBA32UI),Q===r.BYTE&&(j=r.RGBA8I),Q===r.SHORT&&(j=r.RGBA16I),Q===r.INT&&(j=r.RGBA32I)),y===r.RGB&&(Q===r.UNSIGNED_INT_5_9_9_9_REV&&(j=r.RGB9_E5),Q===r.UNSIGNED_INT_10F_11F_11F_REV&&(j=r.R11F_G11F_B10F)),y===r.RGBA){const xe=ee?Pl:tt.getTransfer(K);Q===r.FLOAT&&(j=r.RGBA32F),Q===r.HALF_FLOAT&&(j=r.RGBA16F),Q===r.UNSIGNED_BYTE&&(j=xe===ft?r.SRGB8_ALPHA8:r.RGBA8),Q===r.UNSIGNED_SHORT_4_4_4_4&&(j=r.RGBA4),Q===r.UNSIGNED_SHORT_5_5_5_1&&(j=r.RGB5_A1)}return(j===r.R16F||j===r.R32F||j===r.RG16F||j===r.RG32F||j===r.RGBA16F||j===r.RGBA32F)&&e.get("EXT_color_buffer_float"),j}function _(T,y){let Q;return T?y===null||y===ii||y===To?Q=r.DEPTH24_STENCIL8:y===Nt?Q=r.DEPTH32F_STENCIL8:y===wo&&(Q=r.DEPTH24_STENCIL8,Ie("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):y===null||y===ii||y===To?Q=r.DEPTH_COMPONENT24:y===Nt?Q=r.DEPTH_COMPONENT32F:y===wo&&(Q=r.DEPTH_COMPONENT16),Q}function v(T,y){return A(T)===!0||T.isFramebufferTexture&&T.minFilter!==St&&T.minFilter!==qe?Math.log2(Math.max(y.width,y.height))+1:T.mipmaps!==void 0&&T.mipmaps.length>0?T.mipmaps.length:T.isCompressedTexture&&Array.isArray(T.image)?y.mipmaps.length:1}function C(T){const y=T.target;y.removeEventListener("dispose",C),E(y),y.isVideoTexture&&h.delete(y)}function I(T){const y=T.target;y.removeEventListener("dispose",I),P(y)}function E(T){const y=n.get(T);if(y.__webglInit===void 0)return;const Q=T.source,K=d.get(Q);if(K){const ee=K[y.__cacheKey];ee.usedTimes--,ee.usedTimes===0&&S(T),Object.keys(K).length===0&&d.delete(Q)}n.remove(T)}function S(T){const y=n.get(T);r.deleteTexture(y.__webglTexture);const Q=T.source,K=d.get(Q);delete K[y.__cacheKey],a.memory.textures--}function P(T){const y=n.get(T);if(T.depthTexture&&(T.depthTexture.dispose(),n.remove(T.depthTexture)),T.isWebGLCubeRenderTarget)for(let K=0;K<6;K++){if(Array.isArray(y.__webglFramebuffer[K]))for(let ee=0;ee<y.__webglFramebuffer[K].length;ee++)r.deleteFramebuffer(y.__webglFramebuffer[K][ee]);else r.deleteFramebuffer(y.__webglFramebuffer[K]);y.__webglDepthbuffer&&r.deleteRenderbuffer(y.__webglDepthbuffer[K])}else{if(Array.isArray(y.__webglFramebuffer))for(let K=0;K<y.__webglFramebuffer.length;K++)r.deleteFramebuffer(y.__webglFramebuffer[K]);else r.deleteFramebuffer(y.__webglFramebuffer);if(y.__webglDepthbuffer&&r.deleteRenderbuffer(y.__webglDepthbuffer),y.__webglMultisampledFramebuffer&&r.deleteFramebuffer(y.__webglMultisampledFramebuffer),y.__webglColorRenderbuffer)for(let K=0;K<y.__webglColorRenderbuffer.length;K++)y.__webglColorRenderbuffer[K]&&r.deleteRenderbuffer(y.__webglColorRenderbuffer[K]);y.__webglDepthRenderbuffer&&r.deleteRenderbuffer(y.__webglDepthRenderbuffer)}const Q=T.textures;for(let K=0,ee=Q.length;K<ee;K++){const j=n.get(Q[K]);j.__webglTexture&&(r.deleteTexture(j.__webglTexture),a.memory.textures--),n.remove(Q[K])}n.remove(T)}let w=0;function L(){w=0}function N(){const T=w;return T>=i.maxTextures&&Ie("WebGLTextures: Trying to use "+T+" texture units while this GPU supports only "+i.maxTextures),w+=1,T}function O(T){const y=[];return y.push(T.wrapS),y.push(T.wrapT),y.push(T.wrapR||0),y.push(T.magFilter),y.push(T.minFilter),y.push(T.anisotropy),y.push(T.internalFormat),y.push(T.format),y.push(T.type),y.push(T.generateMipmaps),y.push(T.premultiplyAlpha),y.push(T.flipY),y.push(T.unpackAlignment),y.push(T.colorSpace),y.join()}function D(T,y){const Q=n.get(T);if(T.isVideoTexture&&ct(T),T.isRenderTargetTexture===!1&&T.isExternalTexture!==!0&&T.version>0&&Q.__version!==T.version){const K=T.image;if(K===null)Ie("WebGLRenderer: Texture marked for update but no image data found.");else if(K.complete===!1)Ie("WebGLRenderer: Texture marked for update but image is incomplete");else{X(Q,T,y);return}}else T.isExternalTexture&&(Q.__webglTexture=T.sourceTexture?T.sourceTexture:null);t.bindTexture(r.TEXTURE_2D,Q.__webglTexture,r.TEXTURE0+y)}function U(T,y){const Q=n.get(T);if(T.isRenderTargetTexture===!1&&T.version>0&&Q.__version!==T.version){X(Q,T,y);return}else T.isExternalTexture&&(Q.__webglTexture=T.sourceTexture?T.sourceTexture:null);t.bindTexture(r.TEXTURE_2D_ARRAY,Q.__webglTexture,r.TEXTURE0+y)}function F(T,y){const Q=n.get(T);if(T.isRenderTargetTexture===!1&&T.version>0&&Q.__version!==T.version){X(Q,T,y);return}t.bindTexture(r.TEXTURE_3D,Q.__webglTexture,r.TEXTURE0+y)}function $(T,y){const Q=n.get(T);if(T.isCubeDepthTexture!==!0&&T.version>0&&Q.__version!==T.version){se(Q,T,y);return}t.bindTexture(r.TEXTURE_CUBE_MAP,Q.__webglTexture,r.TEXTURE0+y)}const q={[ni]:r.REPEAT,[Dt]:r.CLAMP_TO_EDGE,[ir]:r.MIRRORED_REPEAT},te={[St]:r.NEAREST,[xa]:r.NEAREST_MIPMAP_NEAREST,[us]:r.NEAREST_MIPMAP_LINEAR,[qe]:r.LINEAR,[Ys]:r.LINEAR_MIPMAP_NEAREST,[yn]:r.LINEAR_MIPMAP_LINEAR},Z={[w_]:r.NEVER,[L_]:r.ALWAYS,[T_]:r.LESS,[Of]:r.LEQUAL,[R_]:r.EQUAL,[kf]:r.GEQUAL,[B_]:r.GREATER,[D_]:r.NOTEQUAL};function Y(T,y){if(y.type===Nt&&e.has("OES_texture_float_linear")===!1&&(y.magFilter===qe||y.magFilter===Ys||y.magFilter===us||y.magFilter===yn||y.minFilter===qe||y.minFilter===Ys||y.minFilter===us||y.minFilter===yn)&&Ie("WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),r.texParameteri(T,r.TEXTURE_WRAP_S,q[y.wrapS]),r.texParameteri(T,r.TEXTURE_WRAP_T,q[y.wrapT]),(T===r.TEXTURE_3D||T===r.TEXTURE_2D_ARRAY)&&r.texParameteri(T,r.TEXTURE_WRAP_R,q[y.wrapR]),r.texParameteri(T,r.TEXTURE_MAG_FILTER,te[y.magFilter]),r.texParameteri(T,r.TEXTURE_MIN_FILTER,te[y.minFilter]),y.compareFunction&&(r.texParameteri(T,r.TEXTURE_COMPARE_MODE,r.COMPARE_REF_TO_TEXTURE),r.texParameteri(T,r.TEXTURE_COMPARE_FUNC,Z[y.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(y.magFilter===St||y.minFilter!==us&&y.minFilter!==yn||y.type===Nt&&e.has("OES_texture_float_linear")===!1)return;if(y.anisotropy>1||n.get(y).__currentAnisotropy){const Q=e.get("EXT_texture_filter_anisotropic");r.texParameterf(T,Q.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(y.anisotropy,i.getMaxAnisotropy())),n.get(y).__currentAnisotropy=y.anisotropy}}}function fe(T,y){let Q=!1;T.__webglInit===void 0&&(T.__webglInit=!0,y.addEventListener("dispose",C));const K=y.source;let ee=d.get(K);ee===void 0&&(ee={},d.set(K,ee));const j=O(y);if(j!==T.__cacheKey){ee[j]===void 0&&(ee[j]={texture:r.createTexture(),usedTimes:0},a.memory.textures++,Q=!0),ee[j].usedTimes++;const xe=ee[T.__cacheKey];xe!==void 0&&(ee[T.__cacheKey].usedTimes--,xe.usedTimes===0&&S(y)),T.__cacheKey=j,T.__webglTexture=ee[j].texture}return Q}function Ge(T,y,Q){return Math.floor(Math.floor(T/Q)/y)}function ze(T,y,Q,K){const j=T.updateRanges;if(j.length===0)t.texSubImage2D(r.TEXTURE_2D,0,0,0,y.width,y.height,Q,K,y.data);else{j.sort((ne,re)=>ne.start-re.start);let xe=0;for(let ne=1;ne<j.length;ne++){const re=j[xe],Ee=j[ne],ve=re.start+re.count,Ae=Ge(Ee.start,y.width,4),$e=Ge(re.start,y.width,4);Ee.start<=ve+1&&Ae===$e&&Ge(Ee.start+Ee.count-1,y.width,4)===Ae?re.count=Math.max(re.count,Ee.start+Ee.count-re.start):(++xe,j[xe]=Ee)}j.length=xe+1;const ce=r.getParameter(r.UNPACK_ROW_LENGTH),Be=r.getParameter(r.UNPACK_SKIP_PIXELS),Ne=r.getParameter(r.UNPACK_SKIP_ROWS);r.pixelStorei(r.UNPACK_ROW_LENGTH,y.width);for(let ne=0,re=j.length;ne<re;ne++){const Ee=j[ne],ve=Math.floor(Ee.start/4),Ae=Math.ceil(Ee.count/4),$e=ve%y.width,k=Math.floor(ve/y.width),le=Ae,ae=1;r.pixelStorei(r.UNPACK_SKIP_PIXELS,$e),r.pixelStorei(r.UNPACK_SKIP_ROWS,k),t.texSubImage2D(r.TEXTURE_2D,0,$e,k,le,ae,Q,K,y.data)}T.clearUpdateRanges(),r.pixelStorei(r.UNPACK_ROW_LENGTH,ce),r.pixelStorei(r.UNPACK_SKIP_PIXELS,Be),r.pixelStorei(r.UNPACK_SKIP_ROWS,Ne)}}function X(T,y,Q){let K=r.TEXTURE_2D;(y.isDataArrayTexture||y.isCompressedArrayTexture)&&(K=r.TEXTURE_2D_ARRAY),y.isData3DTexture&&(K=r.TEXTURE_3D);const ee=fe(T,y),j=y.source;t.bindTexture(K,T.__webglTexture,r.TEXTURE0+Q);const xe=n.get(j);if(j.version!==xe.__version||ee===!0){t.activeTexture(r.TEXTURE0+Q);const ce=tt.getPrimaries(tt.workingColorSpace),Be=y.colorSpace===Un?null:tt.getPrimaries(y.colorSpace),Ne=y.colorSpace===Un||ce===Be?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,y.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,y.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,y.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,Ne);let ne=m(y.image,!1,i.maxTextureSize);ne=_t(y,ne);const re=s.convert(y.format,y.colorSpace),Ee=s.convert(y.type);let ve=x(y.internalFormat,re,Ee,y.colorSpace,y.isVideoTexture);Y(K,y);let Ae;const $e=y.mipmaps,k=y.isVideoTexture!==!0,le=xe.__version===void 0||ee===!0,ae=j.dataReady,me=v(y,ne);if(y.isDepthTexture)ve=_(y.format===Xs,y.type),le&&(k?t.texStorage2D(r.TEXTURE_2D,1,ve,ne.width,ne.height):t.texImage2D(r.TEXTURE_2D,0,ve,ne.width,ne.height,0,re,Ee,null));else if(y.isDataTexture)if($e.length>0){k&&le&&t.texStorage2D(r.TEXTURE_2D,me,ve,$e[0].width,$e[0].height);for(let ie=0,W=$e.length;ie<W;ie++)Ae=$e[ie],k?ae&&t.texSubImage2D(r.TEXTURE_2D,ie,0,0,Ae.width,Ae.height,re,Ee,Ae.data):t.texImage2D(r.TEXTURE_2D,ie,ve,Ae.width,Ae.height,0,re,Ee,Ae.data);y.generateMipmaps=!1}else k?(le&&t.texStorage2D(r.TEXTURE_2D,me,ve,ne.width,ne.height),ae&&ze(y,ne,re,Ee)):t.texImage2D(r.TEXTURE_2D,0,ve,ne.width,ne.height,0,re,Ee,ne.data);else if(y.isCompressedTexture)if(y.isCompressedArrayTexture){k&&le&&t.texStorage3D(r.TEXTURE_2D_ARRAY,me,ve,$e[0].width,$e[0].height,ne.depth);for(let ie=0,W=$e.length;ie<W;ie++)if(Ae=$e[ie],y.format!==Tt)if(re!==null)if(k){if(ae)if(y.layerUpdates.size>0){const _e=SA(Ae.width,Ae.height,y.format,y.type);for(const ke of y.layerUpdates){const vt=Ae.data.subarray(ke*_e/Ae.data.BYTES_PER_ELEMENT,(ke+1)*_e/Ae.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,ie,0,0,ke,Ae.width,Ae.height,1,re,vt)}y.clearLayerUpdates()}else t.compressedTexSubImage3D(r.TEXTURE_2D_ARRAY,ie,0,0,0,Ae.width,Ae.height,ne.depth,re,Ae.data)}else t.compressedTexImage3D(r.TEXTURE_2D_ARRAY,ie,ve,Ae.width,Ae.height,ne.depth,0,Ae.data,0,0);else Ie("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else k?ae&&t.texSubImage3D(r.TEXTURE_2D_ARRAY,ie,0,0,0,Ae.width,Ae.height,ne.depth,re,Ee,Ae.data):t.texImage3D(r.TEXTURE_2D_ARRAY,ie,ve,Ae.width,Ae.height,ne.depth,0,re,Ee,Ae.data)}else{k&&le&&t.texStorage2D(r.TEXTURE_2D,me,ve,$e[0].width,$e[0].height);for(let ie=0,W=$e.length;ie<W;ie++)Ae=$e[ie],y.format!==Tt?re!==null?k?ae&&t.compressedTexSubImage2D(r.TEXTURE_2D,ie,0,0,Ae.width,Ae.height,re,Ae.data):t.compressedTexImage2D(r.TEXTURE_2D,ie,ve,Ae.width,Ae.height,0,Ae.data):Ie("WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):k?ae&&t.texSubImage2D(r.TEXTURE_2D,ie,0,0,Ae.width,Ae.height,re,Ee,Ae.data):t.texImage2D(r.TEXTURE_2D,ie,ve,Ae.width,Ae.height,0,re,Ee,Ae.data)}else if(y.isDataArrayTexture)if(k){if(le&&t.texStorage3D(r.TEXTURE_2D_ARRAY,me,ve,ne.width,ne.height,ne.depth),ae)if(y.layerUpdates.size>0){const ie=SA(ne.width,ne.height,y.format,y.type);for(const W of y.layerUpdates){const _e=ne.data.subarray(W*ie/ne.data.BYTES_PER_ELEMENT,(W+1)*ie/ne.data.BYTES_PER_ELEMENT);t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,W,ne.width,ne.height,1,re,Ee,_e)}y.clearLayerUpdates()}else t.texSubImage3D(r.TEXTURE_2D_ARRAY,0,0,0,0,ne.width,ne.height,ne.depth,re,Ee,ne.data)}else t.texImage3D(r.TEXTURE_2D_ARRAY,0,ve,ne.width,ne.height,ne.depth,0,re,Ee,ne.data);else if(y.isData3DTexture)k?(le&&t.texStorage3D(r.TEXTURE_3D,me,ve,ne.width,ne.height,ne.depth),ae&&t.texSubImage3D(r.TEXTURE_3D,0,0,0,0,ne.width,ne.height,ne.depth,re,Ee,ne.data)):t.texImage3D(r.TEXTURE_3D,0,ve,ne.width,ne.height,ne.depth,0,re,Ee,ne.data);else if(y.isFramebufferTexture){if(le)if(k)t.texStorage2D(r.TEXTURE_2D,me,ve,ne.width,ne.height);else{let ie=ne.width,W=ne.height;for(let _e=0;_e<me;_e++)t.texImage2D(r.TEXTURE_2D,_e,ve,ie,W,0,re,Ee,null),ie>>=1,W>>=1}}else if($e.length>0){if(k&&le){const ie=Se($e[0]);t.texStorage2D(r.TEXTURE_2D,me,ve,ie.width,ie.height)}for(let ie=0,W=$e.length;ie<W;ie++)Ae=$e[ie],k?ae&&t.texSubImage2D(r.TEXTURE_2D,ie,0,0,re,Ee,Ae):t.texImage2D(r.TEXTURE_2D,ie,ve,re,Ee,Ae);y.generateMipmaps=!1}else if(k){if(le){const ie=Se(ne);t.texStorage2D(r.TEXTURE_2D,me,ve,ie.width,ie.height)}ae&&t.texSubImage2D(r.TEXTURE_2D,0,0,0,re,Ee,ne)}else t.texImage2D(r.TEXTURE_2D,0,ve,re,Ee,ne);A(y)&&g(K),xe.__version=j.version,y.onUpdate&&y.onUpdate(y)}T.__version=y.version}function se(T,y,Q){if(y.image.length!==6)return;const K=fe(T,y),ee=y.source;t.bindTexture(r.TEXTURE_CUBE_MAP,T.__webglTexture,r.TEXTURE0+Q);const j=n.get(ee);if(ee.version!==j.__version||K===!0){t.activeTexture(r.TEXTURE0+Q);const xe=tt.getPrimaries(tt.workingColorSpace),ce=y.colorSpace===Un?null:tt.getPrimaries(y.colorSpace),Be=y.colorSpace===Un||xe===ce?r.NONE:r.BROWSER_DEFAULT_WEBGL;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,y.flipY),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,y.premultiplyAlpha),r.pixelStorei(r.UNPACK_ALIGNMENT,y.unpackAlignment),r.pixelStorei(r.UNPACK_COLORSPACE_CONVERSION_WEBGL,Be);const Ne=y.isCompressedTexture||y.image[0].isCompressedTexture,ne=y.image[0]&&y.image[0].isDataTexture,re=[];for(let W=0;W<6;W++)!Ne&&!ne?re[W]=m(y.image[W],!0,i.maxCubemapSize):re[W]=ne?y.image[W].image:y.image[W],re[W]=_t(y,re[W]);const Ee=re[0],ve=s.convert(y.format,y.colorSpace),Ae=s.convert(y.type),$e=x(y.internalFormat,ve,Ae,y.colorSpace),k=y.isVideoTexture!==!0,le=j.__version===void 0||K===!0,ae=ee.dataReady;let me=v(y,Ee);Y(r.TEXTURE_CUBE_MAP,y);let ie;if(Ne){k&&le&&t.texStorage2D(r.TEXTURE_CUBE_MAP,me,$e,Ee.width,Ee.height);for(let W=0;W<6;W++){ie=re[W].mipmaps;for(let _e=0;_e<ie.length;_e++){const ke=ie[_e];y.format!==Tt?ve!==null?k?ae&&t.compressedTexSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+W,_e,0,0,ke.width,ke.height,ve,ke.data):t.compressedTexImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+W,_e,$e,ke.width,ke.height,0,ke.data):Ie("WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):k?ae&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+W,_e,0,0,ke.width,ke.height,ve,Ae,ke.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+W,_e,$e,ke.width,ke.height,0,ve,Ae,ke.data)}}}else{if(ie=y.mipmaps,k&&le){ie.length>0&&me++;const W=Se(re[0]);t.texStorage2D(r.TEXTURE_CUBE_MAP,me,$e,W.width,W.height)}for(let W=0;W<6;W++)if(ne){k?ae&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+W,0,0,0,re[W].width,re[W].height,ve,Ae,re[W].data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+W,0,$e,re[W].width,re[W].height,0,ve,Ae,re[W].data);for(let _e=0;_e<ie.length;_e++){const vt=ie[_e].image[W].image;k?ae&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+W,_e+1,0,0,vt.width,vt.height,ve,Ae,vt.data):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+W,_e+1,$e,vt.width,vt.height,0,ve,Ae,vt.data)}}else{k?ae&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+W,0,0,0,ve,Ae,re[W]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+W,0,$e,ve,Ae,re[W]);for(let _e=0;_e<ie.length;_e++){const ke=ie[_e];k?ae&&t.texSubImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+W,_e+1,0,0,ve,Ae,ke.image[W]):t.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+W,_e+1,$e,ve,Ae,ke.image[W])}}}A(y)&&g(r.TEXTURE_CUBE_MAP),j.__version=ee.version,y.onUpdate&&y.onUpdate(y)}T.__version=y.version}function oe(T,y,Q,K,ee,j){const xe=s.convert(Q.format,Q.colorSpace),ce=s.convert(Q.type),Be=x(Q.internalFormat,xe,ce,Q.colorSpace),Ne=n.get(y),ne=n.get(Q);if(ne.__renderTarget=y,!Ne.__hasExternalTextures){const re=Math.max(1,y.width>>j),Ee=Math.max(1,y.height>>j);ee===r.TEXTURE_3D||ee===r.TEXTURE_2D_ARRAY?t.texImage3D(ee,j,Be,re,Ee,y.depth,0,xe,ce,null):t.texImage2D(ee,j,Be,re,Ee,0,xe,ce,null)}t.bindFramebuffer(r.FRAMEBUFFER,T),zt(y)?o.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,K,ee,ne.__webglTexture,0,B(y)):(ee===r.TEXTURE_2D||ee>=r.TEXTURE_CUBE_MAP_POSITIVE_X&&ee<=r.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&r.framebufferTexture2D(r.FRAMEBUFFER,K,ee,ne.__webglTexture,j),t.bindFramebuffer(r.FRAMEBUFFER,null)}function He(T,y,Q){if(r.bindRenderbuffer(r.RENDERBUFFER,T),y.depthBuffer){const K=y.depthTexture,ee=K&&K.isDepthTexture?K.type:null,j=_(y.stencilBuffer,ee),xe=y.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;zt(y)?o.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,B(y),j,y.width,y.height):Q?r.renderbufferStorageMultisample(r.RENDERBUFFER,B(y),j,y.width,y.height):r.renderbufferStorage(r.RENDERBUFFER,j,y.width,y.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,xe,r.RENDERBUFFER,T)}else{const K=y.textures;for(let ee=0;ee<K.length;ee++){const j=K[ee],xe=s.convert(j.format,j.colorSpace),ce=s.convert(j.type),Be=x(j.internalFormat,xe,ce,j.colorSpace);zt(y)?o.renderbufferStorageMultisampleEXT(r.RENDERBUFFER,B(y),Be,y.width,y.height):Q?r.renderbufferStorageMultisample(r.RENDERBUFFER,B(y),Be,y.width,y.height):r.renderbufferStorage(r.RENDERBUFFER,Be,y.width,y.height)}}r.bindRenderbuffer(r.RENDERBUFFER,null)}function De(T,y,Q){const K=y.isWebGLCubeRenderTarget===!0;if(t.bindFramebuffer(r.FRAMEBUFFER,T),!(y.depthTexture&&y.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const ee=n.get(y.depthTexture);if(ee.__renderTarget=y,(!ee.__webglTexture||y.depthTexture.image.width!==y.width||y.depthTexture.image.height!==y.height)&&(y.depthTexture.image.width=y.width,y.depthTexture.image.height=y.height,y.depthTexture.needsUpdate=!0),K){if(ee.__webglInit===void 0&&(ee.__webglInit=!0,y.depthTexture.addEventListener("dispose",C)),ee.__webglTexture===void 0){ee.__webglTexture=r.createTexture(),t.bindTexture(r.TEXTURE_CUBE_MAP,ee.__webglTexture),Y(r.TEXTURE_CUBE_MAP,y.depthTexture);const Ne=s.convert(y.depthTexture.format),ne=s.convert(y.depthTexture.type);let re;y.depthTexture.format===qi?re=r.DEPTH_COMPONENT24:y.depthTexture.format===Xs&&(re=r.DEPTH24_STENCIL8);for(let Ee=0;Ee<6;Ee++)r.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+Ee,0,re,y.width,y.height,0,Ne,ne,null)}}else D(y.depthTexture,0);const j=ee.__webglTexture,xe=B(y),ce=K?r.TEXTURE_CUBE_MAP_POSITIVE_X+Q:r.TEXTURE_2D,Be=y.depthTexture.format===Xs?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;if(y.depthTexture.format===qi)zt(y)?o.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,Be,ce,j,0,xe):r.framebufferTexture2D(r.FRAMEBUFFER,Be,ce,j,0);else if(y.depthTexture.format===Xs)zt(y)?o.framebufferTexture2DMultisampleEXT(r.FRAMEBUFFER,Be,ce,j,0,xe):r.framebufferTexture2D(r.FRAMEBUFFER,Be,ce,j,0);else throw new Error("Unknown depthTexture format")}function Fe(T){const y=n.get(T),Q=T.isWebGLCubeRenderTarget===!0;if(y.__boundDepthTexture!==T.depthTexture){const K=T.depthTexture;if(y.__depthDisposeCallback&&y.__depthDisposeCallback(),K){const ee=()=>{delete y.__boundDepthTexture,delete y.__depthDisposeCallback,K.removeEventListener("dispose",ee)};K.addEventListener("dispose",ee),y.__depthDisposeCallback=ee}y.__boundDepthTexture=K}if(T.depthTexture&&!y.__autoAllocateDepthBuffer)if(Q)for(let K=0;K<6;K++)De(y.__webglFramebuffer[K],T,K);else{const K=T.texture.mipmaps;K&&K.length>0?De(y.__webglFramebuffer[0],T,0):De(y.__webglFramebuffer,T,0)}else if(Q){y.__webglDepthbuffer=[];for(let K=0;K<6;K++)if(t.bindFramebuffer(r.FRAMEBUFFER,y.__webglFramebuffer[K]),y.__webglDepthbuffer[K]===void 0)y.__webglDepthbuffer[K]=r.createRenderbuffer(),He(y.__webglDepthbuffer[K],T,!1);else{const ee=T.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,j=y.__webglDepthbuffer[K];r.bindRenderbuffer(r.RENDERBUFFER,j),r.framebufferRenderbuffer(r.FRAMEBUFFER,ee,r.RENDERBUFFER,j)}}else{const K=T.texture.mipmaps;if(K&&K.length>0?t.bindFramebuffer(r.FRAMEBUFFER,y.__webglFramebuffer[0]):t.bindFramebuffer(r.FRAMEBUFFER,y.__webglFramebuffer),y.__webglDepthbuffer===void 0)y.__webglDepthbuffer=r.createRenderbuffer(),He(y.__webglDepthbuffer,T,!1);else{const ee=T.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,j=y.__webglDepthbuffer;r.bindRenderbuffer(r.RENDERBUFFER,j),r.framebufferRenderbuffer(r.FRAMEBUFFER,ee,r.RENDERBUFFER,j)}}t.bindFramebuffer(r.FRAMEBUFFER,null)}function kt(T,y,Q){const K=n.get(T);y!==void 0&&oe(K.__webglFramebuffer,T,T.texture,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,0),Q!==void 0&&Fe(T)}function Ze(T){const y=T.texture,Q=n.get(T),K=n.get(y);T.addEventListener("dispose",I);const ee=T.textures,j=T.isWebGLCubeRenderTarget===!0,xe=ee.length>1;if(xe||(K.__webglTexture===void 0&&(K.__webglTexture=r.createTexture()),K.__version=y.version,a.memory.textures++),j){Q.__webglFramebuffer=[];for(let ce=0;ce<6;ce++)if(y.mipmaps&&y.mipmaps.length>0){Q.__webglFramebuffer[ce]=[];for(let Be=0;Be<y.mipmaps.length;Be++)Q.__webglFramebuffer[ce][Be]=r.createFramebuffer()}else Q.__webglFramebuffer[ce]=r.createFramebuffer()}else{if(y.mipmaps&&y.mipmaps.length>0){Q.__webglFramebuffer=[];for(let ce=0;ce<y.mipmaps.length;ce++)Q.__webglFramebuffer[ce]=r.createFramebuffer()}else Q.__webglFramebuffer=r.createFramebuffer();if(xe)for(let ce=0,Be=ee.length;ce<Be;ce++){const Ne=n.get(ee[ce]);Ne.__webglTexture===void 0&&(Ne.__webglTexture=r.createTexture(),a.memory.textures++)}if(T.samples>0&&zt(T)===!1){Q.__webglMultisampledFramebuffer=r.createFramebuffer(),Q.__webglColorRenderbuffer=[],t.bindFramebuffer(r.FRAMEBUFFER,Q.__webglMultisampledFramebuffer);for(let ce=0;ce<ee.length;ce++){const Be=ee[ce];Q.__webglColorRenderbuffer[ce]=r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,Q.__webglColorRenderbuffer[ce]);const Ne=s.convert(Be.format,Be.colorSpace),ne=s.convert(Be.type),re=x(Be.internalFormat,Ne,ne,Be.colorSpace,T.isXRRenderTarget===!0),Ee=B(T);r.renderbufferStorageMultisample(r.RENDERBUFFER,Ee,re,T.width,T.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+ce,r.RENDERBUFFER,Q.__webglColorRenderbuffer[ce])}r.bindRenderbuffer(r.RENDERBUFFER,null),T.depthBuffer&&(Q.__webglDepthRenderbuffer=r.createRenderbuffer(),He(Q.__webglDepthRenderbuffer,T,!0)),t.bindFramebuffer(r.FRAMEBUFFER,null)}}if(j){t.bindTexture(r.TEXTURE_CUBE_MAP,K.__webglTexture),Y(r.TEXTURE_CUBE_MAP,y);for(let ce=0;ce<6;ce++)if(y.mipmaps&&y.mipmaps.length>0)for(let Be=0;Be<y.mipmaps.length;Be++)oe(Q.__webglFramebuffer[ce][Be],T,y,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+ce,Be);else oe(Q.__webglFramebuffer[ce],T,y,r.COLOR_ATTACHMENT0,r.TEXTURE_CUBE_MAP_POSITIVE_X+ce,0);A(y)&&g(r.TEXTURE_CUBE_MAP),t.unbindTexture()}else if(xe){for(let ce=0,Be=ee.length;ce<Be;ce++){const Ne=ee[ce],ne=n.get(Ne);let re=r.TEXTURE_2D;(T.isWebGL3DRenderTarget||T.isWebGLArrayRenderTarget)&&(re=T.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY),t.bindTexture(re,ne.__webglTexture),Y(re,Ne),oe(Q.__webglFramebuffer,T,Ne,r.COLOR_ATTACHMENT0+ce,re,0),A(Ne)&&g(re)}t.unbindTexture()}else{let ce=r.TEXTURE_2D;if((T.isWebGL3DRenderTarget||T.isWebGLArrayRenderTarget)&&(ce=T.isWebGL3DRenderTarget?r.TEXTURE_3D:r.TEXTURE_2D_ARRAY),t.bindTexture(ce,K.__webglTexture),Y(ce,y),y.mipmaps&&y.mipmaps.length>0)for(let Be=0;Be<y.mipmaps.length;Be++)oe(Q.__webglFramebuffer[Be],T,y,r.COLOR_ATTACHMENT0,ce,Be);else oe(Q.__webglFramebuffer,T,y,r.COLOR_ATTACHMENT0,ce,0);A(y)&&g(ce),t.unbindTexture()}T.depthBuffer&&Fe(T)}function it(T){const y=T.textures;for(let Q=0,K=y.length;Q<K;Q++){const ee=y[Q];if(A(ee)){const j=b(T),xe=n.get(ee).__webglTexture;t.bindTexture(j,xe),g(j),t.unbindTexture()}}}const bt=[],Ke=[];function Qt(T){if(T.samples>0){if(zt(T)===!1){const y=T.textures,Q=T.width,K=T.height;let ee=r.COLOR_BUFFER_BIT;const j=T.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT,xe=n.get(T),ce=y.length>1;if(ce)for(let Ne=0;Ne<y.length;Ne++)t.bindFramebuffer(r.FRAMEBUFFER,xe.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Ne,r.RENDERBUFFER,null),t.bindFramebuffer(r.FRAMEBUFFER,xe.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+Ne,r.TEXTURE_2D,null,0);t.bindFramebuffer(r.READ_FRAMEBUFFER,xe.__webglMultisampledFramebuffer);const Be=T.texture.mipmaps;Be&&Be.length>0?t.bindFramebuffer(r.DRAW_FRAMEBUFFER,xe.__webglFramebuffer[0]):t.bindFramebuffer(r.DRAW_FRAMEBUFFER,xe.__webglFramebuffer);for(let Ne=0;Ne<y.length;Ne++){if(T.resolveDepthBuffer&&(T.depthBuffer&&(ee|=r.DEPTH_BUFFER_BIT),T.stencilBuffer&&T.resolveStencilBuffer&&(ee|=r.STENCIL_BUFFER_BIT)),ce){r.framebufferRenderbuffer(r.READ_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,xe.__webglColorRenderbuffer[Ne]);const ne=n.get(y[Ne]).__webglTexture;r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,ne,0)}r.blitFramebuffer(0,0,Q,K,0,0,Q,K,ee,r.NEAREST),c===!0&&(bt.length=0,Ke.length=0,bt.push(r.COLOR_ATTACHMENT0+Ne),T.depthBuffer&&T.resolveDepthBuffer===!1&&(bt.push(j),Ke.push(j),r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,Ke)),r.invalidateFramebuffer(r.READ_FRAMEBUFFER,bt))}if(t.bindFramebuffer(r.READ_FRAMEBUFFER,null),t.bindFramebuffer(r.DRAW_FRAMEBUFFER,null),ce)for(let Ne=0;Ne<y.length;Ne++){t.bindFramebuffer(r.FRAMEBUFFER,xe.__webglMultisampledFramebuffer),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0+Ne,r.RENDERBUFFER,xe.__webglColorRenderbuffer[Ne]);const ne=n.get(y[Ne]).__webglTexture;t.bindFramebuffer(r.FRAMEBUFFER,xe.__webglFramebuffer),r.framebufferTexture2D(r.DRAW_FRAMEBUFFER,r.COLOR_ATTACHMENT0+Ne,r.TEXTURE_2D,ne,0)}t.bindFramebuffer(r.DRAW_FRAMEBUFFER,xe.__webglMultisampledFramebuffer)}else if(T.depthBuffer&&T.resolveDepthBuffer===!1&&c){const y=T.stencilBuffer?r.DEPTH_STENCIL_ATTACHMENT:r.DEPTH_ATTACHMENT;r.invalidateFramebuffer(r.DRAW_FRAMEBUFFER,[y])}}}function B(T){return Math.min(i.maxSamples,T.samples)}function zt(T){const y=n.get(T);return T.samples>0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&y.__useRenderToTexture!==!1}function ct(T){const y=a.render.frame;h.get(T)!==y&&(h.set(T,y),T.update())}function _t(T,y){const Q=T.colorSpace,K=T.format,ee=T.type;return T.isCompressedTexture===!0||T.isVideoTexture===!0||Q!==Ct&&Q!==Un&&(tt.getTransfer(Q)===ft?(K!==Tt||ee!==Le)&&Ie("WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):Pe("WebGLTextures: Unsupported texture color space:",Q)),y}function Se(T){return typeof HTMLImageElement<"u"&&T instanceof HTMLImageElement?(l.width=T.naturalWidth||T.width,l.height=T.naturalHeight||T.height):typeof VideoFrame<"u"&&T instanceof VideoFrame?(l.width=T.displayWidth,l.height=T.displayHeight):(l.width=T.width,l.height=T.height),l}this.allocateTextureUnit=N,this.resetTextureUnits=L,this.setTexture2D=D,this.setTexture2DArray=U,this.setTexture3D=F,this.setTextureCube=$,this.rebindTextures=kt,this.setupRenderTarget=Ze,this.updateRenderTargetMipmap=it,this.updateMultisampleRenderTarget=Qt,this.setupDepthRenderbuffer=Fe,this.setupFrameBufferTexture=oe,this.useMultisampledRTT=zt,this.isReversedDepthBuffer=function(){return t.buffers.depth.getReversed()}}function Pw(r,e){function t(n,i=Un){let s;const a=tt.getTransfer(i);if(n===Le)return r.UNSIGNED_BYTE;if(n===Df)return r.UNSIGNED_SHORT_4_4_4_4;if(n===Lf)return r.UNSIGNED_SHORT_5_5_5_1;if(n===eh)return r.UNSIGNED_INT_5_9_9_9_REV;if(n===th)return r.UNSIGNED_INT_10F_11F_11F_REV;if(n===Rf)return r.BYTE;if(n===Bf)return r.SHORT;if(n===wo)return r.UNSIGNED_SHORT;if(n===Zl)return r.INT;if(n===ii)return r.UNSIGNED_INT;if(n===Nt)return r.FLOAT;if(n===yt)return r.HALF_FLOAT;if(n===Y0)return r.ALPHA;if(n===Ro)return r.RGB;if(n===Tt)return r.RGBA;if(n===qi)return r.DEPTH_COMPONENT;if(n===Xs)return r.DEPTH_STENCIL;if(n===ds)return r.RED;if(n===Pf)return r.RED_INTEGER;if(n===Jn)return r.RG;if(n===Ff)return r.RG_INTEGER;if(n===Nf)return r.RGBA_INTEGER;if(n===Kr||n===Js||n===ll||n===Zs)if(a===ft)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(n===Kr)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===Js)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===ll)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===Zs)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(n===Kr)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===Js)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===ll)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===Zs)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===_l||n===Ld||n===oa||n===Bo)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(n===_l)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===Ld)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===oa)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===Bo)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===vl||n===Do||n===Lo||n===yl||n===Sl||n===Cl||n===Ml)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(n===vl||n===Do)return a===ft?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(n===Lo)return a===ft?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC;if(n===yl)return s.COMPRESSED_R11_EAC;if(n===Sl)return s.COMPRESSED_SIGNED_R11_EAC;if(n===Cl)return s.COMPRESSED_RG11_EAC;if(n===Ml)return s.COMPRESSED_SIGNED_RG11_EAC}else return null;if(n===er||n===Pd||n===Fd||n===Nd||n===$r||n===Ud||n===Od||n===kd||n===Qd||n===Gd||n===Hd||n===zd||n===Vd||n===Wd)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(n===er)return a===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===Pd)return a===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===Fd)return a===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===Nd)return a===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===$r)return a===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===Ud)return a===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===Od)return a===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===kd)return a===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===Qd)return a===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===Gd)return a===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===Hd)return a===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===zd)return a===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===Vd)return a===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===Wd)return a===ft?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===ca||n===qd||n===Il)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(n===ca)return a===ft?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===qd)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===Il)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===wl||n===Tl||n===Rl||n===Bl)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(n===wl)return s.COMPRESSED_RED_RGTC1_EXT;if(n===Tl)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===Rl)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===Bl)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===To?r.UNSIGNED_INT_24_8:r[n]!==void 0?r[n]:null}return{convert:t}}const Fw=`
4069void main() {
4070
4071	gl_Position = vec4( position, 1.0 );
4072
4073}`,Nw=`
4074uniform sampler2DArray depthColor;
4075uniform float depthWidth;
4076uniform float depthHeight;
4077
4078void main() {
4079
4080	vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
4081
4082	if ( coord.x >= 1.0 ) {
4083
4084		gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
4085
4086	} else {
4087
4088		gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
4089
4090	}
4091
4092}`;class Uw{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t){if(this.texture===null){const n=new db(e.texture);(e.depthNear!==t.depthNear||e.depthFar!==t.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=n}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,n=new mn({vertexShader:Fw,fragmentShader:Nw,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new at(new zn(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class Ow extends si{constructor(e,t){super();const n=this;let i=null,s=1,a=null,o="local-floor",c=1,l=null,h=null,u=null,d=null,f=null,p=null;const m=typeof XRWebGLBinding<"u",A=new Uw,g={},b=t.getContextAttributes();let x=null,_=null;const v=[],C=[],I=new pe;let E=null;const S=new Zt;S.viewport=new It;const P=new Zt;P.viewport=new It;const w=[S,P],L=new Uy;let N=null,O=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(X){let se=v[X];return se===void 0&&(se=new Sh,v[X]=se),se.getTargetRaySpace()},this.getControllerGrip=function(X){let se=v[X];return se===void 0&&(se=new Sh,v[X]=se),se.getGripSpace()},this.getHand=function(X){let se=v[X];return se===void 0&&(se=new Sh,v[X]=se),se.getHandSpace()};function D(X){const se=C.indexOf(X.inputSource);if(se===-1)return;const oe=v[se];oe!==void 0&&(oe.update(X.inputSource,X.frame,l||a),oe.dispatchEvent({type:X.type,data:X.inputSource}))}function U(){i.removeEventListener("select",D),i.removeEventListener("selectstart",D),i.removeEventListener("selectend",D),i.removeEventListener("squeeze",D),i.removeEventListener("squeezestart",D),i.removeEventListener("squeezeend",D),i.removeEventListener("end",U),i.removeEventListener("inputsourceschange",F);for(let X=0;X<v.length;X++){const se=C[X];se!==null&&(C[X]=null,v[X].disconnect(se))}N=null,O=null,A.reset();for(const X in g)delete g[X];e.setRenderTarget(x),f=null,d=null,u=null,i=null,_=null,ze.stop(),n.isPresenting=!1,e.setPixelRatio(E),e.setSize(I.width,I.height,!1),n.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(X){s=X,n.isPresenting===!0&&Ie("WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(X){o=X,n.isPresenting===!0&&Ie("WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||a},this.setReferenceSpace=function(X){l=X},this.getBaseLayer=function(){return d!==null?d:f},this.getBinding=function(){return u===null&&m&&(u=new XRWebGLBinding(i,t)),u},this.getFrame=function(){return p},this.getSession=function(){return i},this.setSession=async function(X){if(i=X,i!==null){if(x=e.getRenderTarget(),i.addEventListener("select",D),i.addEventListener("selectstart",D),i.addEventListener("selectend",D),i.addEventListener("squeeze",D),i.addEventListener("squeezestart",D),i.addEventListener("squeezeend",D),i.addEventListener("end",U),i.addEventListener("inputsourceschange",F),b.xrCompatible!==!0&&await t.makeXRCompatible(),E=e.getPixelRatio(),e.getSize(I),m&&"createProjectionLayer"in XRWebGLBinding.prototype){let oe=null,He=null,De=null;b.depth&&(De=b.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,oe=b.stencil?Xs:qi,He=b.stencil?To:ii);const Fe={colorFormat:t.RGBA8,depthFormat:De,scaleFactor:s};u=this.getBinding(),d=u.createProjectionLayer(Fe),i.updateRenderState({layers:[d]}),e.setPixelRatio(1),e.setSize(d.textureWidth,d.textureHeight,!1),_=new Sn(d.textureWidth,d.textureHeight,{format:Tt,type:Le,depthTexture:new Oo(d.textureWidth,d.textureHeight,He,void 0,void 0,void 0,void 0,void 0,void 0,oe),stencilBuffer:b.stencil,colorSpace:e.outputColorSpace,samples:b.antialias?4:0,resolveDepthBuffer:d.ignoreDepthValues===!1,resolveStencilBuffer:d.ignoreDepthValues===!1})}else{const oe={antialias:b.antialias,alpha:!0,depth:b.depth,stencil:b.stencil,framebufferScaleFactor:s};f=new XRWebGLLayer(i,t,oe),i.updateRenderState({baseLayer:f}),e.setPixelRatio(1),e.setSize(f.framebufferWidth,f.framebufferHeight,!1),_=new Sn(f.framebufferWidth,f.framebufferHeight,{format:Tt,type:Le,colorSpace:e.outputColorSpace,stencilBuffer:b.stencil,resolveDepthBuffer:f.ignoreDepthValues===!1,resolveStencilBuffer:f.ignoreDepthValues===!1})}_.isXRRenderTarget=!0,this.setFoveation(c),l=null,a=await i.requestReferenceSpace(o),ze.setContext(i),ze.start(),n.isPresenting=!0,n.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(i!==null)return i.environmentBlendMode},this.getDepthTexture=function(){return A.getDepthTexture()};function F(X){for(let se=0;se<X.removed.length;se++){const oe=X.removed[se],He=C.indexOf(oe);He>=0&&(C[He]=null,v[He].disconnect(oe))}for(let se=0;se<X.added.length;se++){const oe=X.added[se];let He=C.indexOf(oe);if(He===-1){for(let Fe=0;Fe<v.length;Fe++)if(Fe>=C.length){C.push(oe),He=Fe;break}else if(C[Fe]===null){C[Fe]=oe,He=Fe;break}if(He===-1)break}const De=v[He];De&&De.connect(oe)}}const $=new R,q=new R;function te(X,se,oe){$.setFromMatrixPosition(se.matrixWorld),q.setFromMatrixPosition(oe.matrixWorld);const He=$.distanceTo(q),De=se.projectionMatrix.elements,Fe=oe.projectionMatrix.elements,kt=De[14]/(De[10]-1),Ze=De[14]/(De[10]+1),it=(De[9]+1)/De[5],bt=(De[9]-1)/De[5],Ke=(De[8]-1)/De[0],Qt=(Fe[8]+1)/Fe[0],B=kt*Ke,zt=kt*Qt,ct=He/(-Ke+Qt),_t=ct*-Ke;if(se.matrixWorld.decompose(X.position,X.quaternion,X.scale),X.translateX(_t),X.translateZ(ct),X.matrixWorld.compose(X.position,X.quaternion,X.scale),X.matrixWorldInverse.copy(X.matrixWorld).invert(),De[10]===-1)X.projectionMatrix.copy(se.projectionMatrix),X.projectionMatrixInverse.copy(se.projectionMatrixInverse);else{const Se=kt+ct,T=Ze+ct,y=B-_t,Q=zt+(He-_t),K=it*Ze/T*Se,ee=bt*Ze/T*Se;X.projectionMatrix.makePerspective(y,Q,K,ee,Se,T),X.projectionMatrixInverse.copy(X.projectionMatrix).invert()}}function Z(X,se){se===null?X.matrixWorld.copy(X.matrix):X.matrixWorld.multiplyMatrices(se.matrixWorld,X.matrix),X.matrixWorldInverse.copy(X.matrixWorld).invert()}this.updateCamera=function(X){if(i===null)return;let se=X.near,oe=X.far;A.texture!==null&&(A.depthNear>0&&(se=A.depthNear),A.depthFar>0&&(oe=A.depthFar)),L.near=P.near=S.near=se,L.far=P.far=S.far=oe,(N!==L.near||O!==L.far)&&(i.updateRenderState({depthNear:L.near,depthFar:L.far}),N=L.near,O=L.far),L.layers.mask=X.layers.mask|6,S.layers.mask=L.layers.mask&-5,P.layers.mask=L.layers.mask&-3;const He=X.parent,De=L.cameras;Z(L,He);for(let Fe=0;Fe<De.length;Fe++)Z(De[Fe],He);De.length===2?te(L,S,P):L.projectionMatrix.copy(S.projectionMatrix),Y(X,L,He)};function Y(X,se,oe){oe===null?X.matrix.copy(se.matrixWorld):(X.matrix.copy(oe.matrixWorld),X.matrix.invert(),X.matrix.multiply(se.matrixWorld)),X.matrix.decompose(X.position,X.quaternion,X.scale),X.updateMatrixWorld(!0),X.projectionMatrix.copy(se.projectionMatrix),X.projectionMatrixInverse.copy(se.projectionMatrixInverse),X.isPerspectiveCamera&&(X.fov=ua*2*Math.atan(1/X.projectionMatrix.elements[5]),X.zoom=1)}this.getCamera=function(){return L},this.getFoveation=function(){if(!(d===null&&f===null))return c},this.setFoveation=function(X){c=X,d!==null&&(d.fixedFoveation=X),f!==null&&f.fixedFoveation!==void 0&&(f.fixedFoveation=X)},this.hasDepthSensing=function(){return A.texture!==null},this.getDepthSensingMesh=function(){return A.getMesh(L)},this.getCameraTexture=function(X){return g[X]};let fe=null;function Ge(X,se){if(h=se.getViewerPose(l||a),p=se,h!==null){const oe=h.views;f!==null&&(e.setRenderTargetFramebuffer(_,f.framebuffer),e.setRenderTarget(_));let He=!1;oe.length!==L.cameras.length&&(L.cameras.length=0,He=!0);for(let Ze=0;Ze<oe.length;Ze++){const it=oe[Ze];let bt=null;if(f!==null)bt=f.getViewport(it);else{const Qt=u.getViewSubImage(d,it);bt=Qt.viewport,Ze===0&&(e.setRenderTargetTextures(_,Qt.colorTexture,Qt.depthStencilTexture),e.setRenderTarget(_))}let Ke=w[Ze];Ke===void 0&&(Ke=new Zt,Ke.layers.enable(Ze),Ke.viewport=new It,w[Ze]=Ke),Ke.matrix.fromArray(it.transform.matrix),Ke.matrix.decompose(Ke.position,Ke.quaternion,Ke.scale),Ke.projectionMatrix.fromArray(it.projectionMatrix),Ke.projectionMatrixInverse.copy(Ke.projectionMatrix).invert(),Ke.viewport.set(bt.x,bt.y,bt.width,bt.height),Ze===0&&(L.matrix.copy(Ke.matrix),L.matrix.decompose(L.position,L.quaternion,L.scale)),He===!0&&L.cameras.push(Ke)}const De=i.enabledFeatures;if(De&&De.includes("depth-sensing")&&i.depthUsage=="gpu-optimized"&&m){u=n.getBinding();const Ze=u.getDepthInformation(oe[0]);Ze&&Ze.isValid&&Ze.texture&&A.init(Ze,i.renderState)}if(De&&De.includes("camera-access")&&m){e.state.unbindTexture(),u=n.getBinding();for(let Ze=0;Ze<oe.length;Ze++){const it=oe[Ze].camera;if(it){let bt=g[it];bt||(bt=new db,g[it]=bt);const Ke=u.getCameraImage(it);bt.sourceTexture=Ke}}}}for(let oe=0;oe<v.length;oe++){const He=C[oe],De=v[oe];He!==null&&De!==void 0&&De.update(He,se,l||a)}fe&&fe(X,se),se.detectedPlanes&&n.dispatchEvent({type:"planesdetected",data:se}),p=null}const ze=new Db;ze.setAnimationLoop(Ge),this.setAnimationLoop=function(X){fe=X},this.dispose=function(){}}}const Ts=new Hn,kw=new Oe;function Qw(r,e){function t(A,g){A.matrixAutoUpdate===!0&&A.updateMatrix(),g.value.copy(A.matrix)}function n(A,g){g.color.getRGB(A.fogColor.value,vb(r)),g.isFog?(A.fogNear.value=g.near,A.fogFar.value=g.far):g.isFogExp2&&(A.fogDensity.value=g.density)}function i(A,g,b,x,_){g.isMeshBasicMaterial?s(A,g):g.isMeshLambertMaterial?(s(A,g),g.envMap&&(A.envMapIntensity.value=g.envMapIntensity)):g.isMeshToonMaterial?(s(A,g),u(A,g)):g.isMeshPhongMaterial?(s(A,g),h(A,g),g.envMap&&(A.envMapIntensity.value=g.envMapIntensity)):g.isMeshStandardMaterial?(s(A,g),d(A,g),g.isMeshPhysicalMaterial&&f(A,g,_)):g.isMeshMat
vendor: 6,380 bytes, line 4092
4092capMaterial?(s(A,g),p(A,g)):g.isMeshDepthMaterial?s(A,g):g.isMeshDistanceMaterial?(s(A,g),m(A,g)):g.isMeshNormalMaterial?s(A,g):g.isLineBasicMaterial?(a(A,g),g.isLineDashedMaterial&&o(A,g)):g.isPointsMaterial?c(A,g,b,x):g.isSpriteMaterial?l(A,g):g.isShadowMaterial?(A.color.value.copy(g.color),A.opacity.value=g.opacity):g.isShaderMaterial&&(g.uniformsNeedUpdate=!1)}function s(A,g){A.opacity.value=g.opacity,g.color&&A.diffuse.value.copy(g.color),g.emissive&&A.emissive.value.copy(g.emissive).multiplyScalar(g.emissiveIntensity),g.map&&(A.map.value=g.map,t(g.map,A.mapTransform)),g.alphaMap&&(A.alphaMap.value=g.alphaMap,t(g.alphaMap,A.alphaMapTransform)),g.bumpMap&&(A.bumpMap.value=g.bumpMap,t(g.bumpMap,A.bumpMapTransform),A.bumpScale.value=g.bumpScale,g.side===on&&(A.bumpScale.value*=-1)),g.normalMap&&(A.normalMap.value=g.normalMap,t(g.normalMap,A.normalMapTransform),A.normalScale.value.copy(g.normalScale),g.side===on&&A.normalScale.value.negate()),g.displacementMap&&(A.displacementMap.value=g.displacementMap,t(g.displacementMap,A.displacementMapTransform),A.displacementScale.value=g.displacementScale,A.displacementBias.value=g.displacementBias),g.emissiveMap&&(A.emissiveMap.value=g.emissiveMap,t(g.emissiveMap,A.emissiveMapTransform)),g.specularMap&&(A.specularMap.value=g.specularMap,t(g.specularMap,A.specularMapTransform)),g.alphaTest>0&&(A.alphaTest.value=g.alphaTest);const b=e.get(g),x=b.envMap,_=b.envMapRotation;x&&(A.envMap.value=x,Ts.copy(_),Ts.x*=-1,Ts.y*=-1,Ts.z*=-1,x.isCubeTexture&&x.isRenderTargetTexture===!1&&(Ts.y*=-1,Ts.z*=-1),A.envMapRotation.value.setFromMatrix4(kw.makeRotationFromEuler(Ts)),A.flipEnvMap.value=x.isCubeTexture&&x.isRenderTargetTexture===!1?-1:1,A.reflectivity.value=g.reflectivity,A.ior.value=g.ior,A.refractionRatio.value=g.refractionRatio),g.lightMap&&(A.lightMap.value=g.lightMap,A.lightMapIntensity.value=g.lightMapIntensity,t(g.lightMap,A.lightMapTransform)),g.aoMap&&(A.aoMap.value=g.aoMap,A.aoMapIntensity.value=g.aoMapIntensity,t(g.aoMap,A.aoMapTransform))}function a(A,g){A.diffuse.value.copy(g.color),A.opacity.value=g.opacity,g.map&&(A.map.value=g.map,t(g.map,A.mapTransform))}function o(A,g){A.dashSize.value=g.dashSize,A.totalSize.value=g.dashSize+g.gapSize,A.scale.value=g.scale}function c(A,g,b,x){A.diffuse.value.copy(g.color),A.opacity.value=g.opacity,A.size.value=g.size*b,A.scale.value=x*.5,g.map&&(A.map.value=g.map,t(g.map,A.uvTransform)),g.alphaMap&&(A.alphaMap.value=g.alphaMap,t(g.alphaMap,A.alphaMapTransform)),g.alphaTest>0&&(A.alphaTest.value=g.alphaTest)}function l(A,g){A.diffuse.value.copy(g.color),A.opacity.value=g.opacity,A.rotation.value=g.rotation,g.map&&(A.map.value=g.map,t(g.map,A.mapTransform)),g.alphaMap&&(A.alphaMap.value=g.alphaMap,t(g.alphaMap,A.alphaMapTransform)),g.alphaTest>0&&(A.alphaTest.value=g.alphaTest)}function h(A,g){A.specular.value.copy(g.specular),A.shininess.value=Math.max(g.shininess,1e-4)}function u(A,g){g.gradientMap&&(A.gradientMap.value=g.gradientMap)}function d(A,g){A.metalness.value=g.metalness,g.metalnessMap&&(A.metalnessMap.value=g.metalnessMap,t(g.metalnessMap,A.metalnessMapTransform)),A.roughness.value=g.roughness,g.roughnessMap&&(A.roughnessMap.value=g.roughnessMap,t(g.roughnessMap,A.roughnessMapTransform)),g.envMap&&(A.envMapIntensity.value=g.envMapIntensity)}function f(A,g,b){A.ior.value=g.ior,g.sheen>0&&(A.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),A.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(A.sheenColorMap.value=g.sheenColorMap,t(g.sheenColorMap,A.sheenColorMapTransform)),g.sheenRoughnessMap&&(A.sheenRoughnessMap.value=g.sheenRoughnessMap,t(g.sheenRoughnessMap,A.sheenRoughnessMapTransform))),g.clearcoat>0&&(A.clearcoat.value=g.clearcoat,A.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(A.clearcoatMap.value=g.clearcoatMap,t(g.clearcoatMap,A.clearcoatMapTransform)),g.clearcoatRoughnessMap&&(A.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap,t(g.clearcoatRoughnessMap,A.clearcoatRoughnessMapTransform)),g.clearcoatNormalMap&&(A.clearcoatNormalMap.value=g.clearcoatNormalMap,t(g.clearcoatNormalMap,A.clearcoatNormalMapTransform),A.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),g.side===on&&A.clearcoatNormalScale.value.negate())),g.dispersion>0&&(A.dispersion.value=g.dispersion),g.iridescence>0&&(A.iridescence.value=g.iridescence,A.iridescenceIOR.value=g.iridescenceIOR,A.iridescenceThicknessMinimum.value=g.iridescenceThicknessRange[0],A.iridescenceThicknessMaximum.value=g.iridescenceThicknessRange[1],g.iridescenceMap&&(A.iridescenceMap.value=g.iridescenceMap,t(g.iridescenceMap,A.iridescenceMapTransform)),g.iridescenceThicknessMap&&(A.iridescenceThicknessMap.value=g.iridescenceThicknessMap,t(g.iridescenceThicknessMap,A.iridescenceThicknessMapTransform))),g.transmission>0&&(A.transmission.value=g.transmission,A.transmissionSamplerMap.value=b.texture,A.transmissionSamplerSize.value.set(b.width,b.height),g.transmissionMap&&(A.transmissionMap.value=g.transmissionMap,t(g.transmissionMap,A.transmissionMapTransform)),A.thickness.value=g.thickness,g.thicknessMap&&(A.thicknessMap.value=g.thicknessMap,t(g.thicknessMap,A.thicknessMapTransform)),A.attenuationDistance.value=g.attenuationDistance,A.attenuationColor.value.copy(g.attenuationColor)),g.anisotropy>0&&(A.anisotropyVector.value.set(g.anisotropy*Math.cos(g.anisotropyRotation),g.anisotropy*Math.sin(g.anisotropyRotation)),g.anisotropyMap&&(A.anisotropyMap.value=g.anisotropyMap,t(g.anisotropyMap,A.anisotropyMapTransform))),A.specularIntensity.value=g.specularIntensity,A.specularColor.value.copy(g.specularColor),g.specularColorMap&&(A.specularColorMap.value=g.specularColorMap,t(g.specularColorMap,A.specularColorMapTransform)),g.specularIntensityMap&&(A.specularIntensityMap.value=g.specularIntensityMap,t(g.specularIntensityMap,A.specularIntensityMapTransform))}function p(A,g){g.matcap&&(A.matcap.value=g.matcap)}function m(A,g){const b=e.get(g).light;A.referencePosition.value.setFromMatrixPosition(b.matrixWorld),A.nearDistance.value=b.shadow.camera.near,A.farDistance.value=b.shadow.camera.far}return{refreshFogUniforms:n,refreshMaterialUniforms:i}}function Gw(r,e,t,n){let i={},s={},a=[];const o=r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS);function c(b,x){const _=x.program;n.uniformBlockBinding(b,_)}function l(b,x){let _=i[b.id];_===void 0&&(p(b),_=h(b),i[b.id]=_,b.addEventListener("dispose",A));
vendor: 37,542 bytes, line 4092
4092const v=x.program;n.updateUBOMapping(b,v);const C=e.render.frame;s[b.id]!==C&&(d(b),s[b.id]=C)}function h(b){const x=u();b.__bindingPointIndex=x;const _=r.createBuffer(),v=b.__size,C=b.usage;return r.bindBuffer(r.UNIFORM_BUFFER,_),r.bufferData(r.UNIFORM_BUFFER,v,C),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,x,_),_}function u(){for(let b=0;b<o;b++)if(a.indexOf(b)===-1)return a.push(b),b;return Pe("WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function d(b){const x=i[b.id],_=b.uniforms,v=b.__cache;r.bindBuffer(r.UNIFORM_BUFFER,x);for(let C=0,I=_.length;C<I;C++){const E=Array.isArray(_[C])?_[C]:[_[C]];for(let S=0,P=E.length;S<P;S++){const w=E[S];if(f(w,C,S,v)===!0){const L=w.__offset,N=Array.isArray(w.value)?w.value:[w.value];let O=0;for(let D=0;D<N.length;D++){const U=N[D],F=m(U);typeof U=="number"||typeof U=="boolean"?(w.__data[0]=U,r.bufferSubData(r.UNIFORM_BUFFER,L+O,w.__data)):U.isMatrix3?(w.__data[0]=U.elements[0],w.__data[1]=U.elements[1],w.__data[2]=U.elements[2],w.__data[3]=0,w.__data[4]=U.elements[3],w.__data[5]=U.elements[4],w.__data[6]=U.elements[5],w.__data[7]=0,w.__data[8]=U.elements[6],w.__data[9]=U.elements[7],w.__data[10]=U.elements[8],w.__data[11]=0):(U.toArray(w.__data,O),O+=F.storage/Float32Array.BYTES_PER_ELEMENT)}r.bufferSubData(r.UNIFORM_BUFFER,L,w.__data)}}}r.bindBuffer(r.UNIFORM_BUFFER,null)}function f(b,x,_,v){const C=b.value,I=x+"_"+_;if(v[I]===void 0)return typeof C=="number"||typeof C=="boolean"?v[I]=C:v[I]=C.clone(),!0;{const E=v[I];if(typeof C=="number"||typeof C=="boolean"){if(E!==C)return v[I]=C,!0}else if(E.equals(C)===!1)return E.copy(C),!0}return!1}function p(b){const x=b.uniforms;let _=0;const v=16;for(let I=0,E=x.length;I<E;I++){const S=Array.isArray(x[I])?x[I]:[x[I]];for(let P=0,w=S.length;P<w;P++){const L=S[P],N=Array.isArray(L.value)?L.value:[L.value];for(let O=0,D=N.length;O<D;O++){const U=N[O],F=m(U),$=_%v,q=$%F.boundary,te=$+q;_+=q,te!==0&&v-te<F.storage&&(_+=v-te),L.__data=new Float32Array(F.storage/Float32Array.BYTES_PER_ELEMENT),L.__offset=_,_+=F.storage}}}const C=_%v;return C>0&&(_+=v-C),b.__size=_,b.__cache={},this}function m(b){const x={boundary:0,storage:0};return typeof b=="number"||typeof b=="boolean"?(x.boundary=4,x.storage=4):b.isVector2?(x.boundary=8,x.storage=8):b.isVector3||b.isColor?(x.boundary=16,x.storage=12):b.isVector4?(x.boundary=16,x.storage=16):b.isMatrix3?(x.boundary=48,x.storage=48):b.isMatrix4?(x.boundary=64,x.storage=64):b.isTexture?Ie("WebGLRenderer: Texture samplers can not be part of an uniforms group."):Ie("WebGLRenderer: Unsupported uniform value type.",b),x}function A(b){const x=b.target;x.removeEventListener("dispose",A);const _=a.indexOf(x.__bindingPointIndex);a.splice(_,1),r.deleteBuffer(i[x.id]),delete i[x.id],delete s[x.id]}function g(){for(const b in i)r.deleteBuffer(i[b]);a=[],i={},s={}}return{bind:c,update:l,dispose:g}}const Hw=new Uint16Array([12469,15057,12620,14925,13266,14620,13807,14376,14323,13990,14545,13625,14713,13328,14840,12882,14931,12528,14996,12233,15039,11829,15066,11525,15080,11295,15085,10976,15082,10705,15073,10495,13880,14564,13898,14542,13977,14430,14158,14124,14393,13732,14556,13410,14702,12996,14814,12596,14891,12291,14937,11834,14957,11489,14958,11194,14943,10803,14921,10506,14893,10278,14858,9960,14484,14039,14487,14025,14499,13941,14524,13740,14574,13468,14654,13106,14743,12678,14818,12344,14867,11893,14889,11509,14893,11180,14881,10751,14852,10428,14812,10128,14765,9754,14712,9466,14764,13480,14764,13475,14766,13440,14766,13347,14769,13070,14786,12713,14816,12387,14844,11957,14860,11549,14868,11215,14855,10751,14825,10403,14782,10044,14729,9651,14666,9352,14599,9029,14967,12835,14966,12831,14963,12804,14954,12723,14936,12564,14917,12347,14900,11958,14886,11569,14878,11247,14859,10765,14828,10401,14784,10011,14727,9600,14660,9289,14586,8893,14508,8533,15111,12234,15110,12234,15104,12216,15092,12156,15067,12010,15028,11776,14981,11500,14942,11205,14902,10752,14861,10393,14812,9991,14752,9570,14682,9252,14603,8808,14519,8445,14431,8145,15209,11449,15208,11451,15202,11451,15190,11438,15163,11384,15117,11274,15055,10979,14994,10648,14932,10343,14871,9936,14803,9532,14729,9218,14645,8742,14556,8381,14461,8020,14365,7603,15273,10603,15272,10607,15267,10619,15256,10631,15231,10614,15182,10535,15118,10389,15042,10167,14963,9787,14883,9447,14800,9115,14710,8665,14615,8318,14514,7911,14411,7507,14279,7198,15314,9675,15313,9683,15309,9712,15298,9759,15277,9797,15229,9773,15166,9668,15084,9487,14995,9274,14898,8910,14800,8539,14697,8234,14590,7790,14479,7409,14367,7067,14178,6621,15337,8619,15337,8631,15333,8677,15325,8769,15305,8871,15264,8940,15202,8909,15119,8775,15022,8565,14916,8328,14804,8009,14688,7614,14569,7287,14448,6888,14321,6483,14088,6171,15350,7402,15350,7419,15347,7480,15340,7613,15322,7804,15287,7973,15229,8057,15148,8012,15046,7846,14933,7611,14810,7357,14682,7069,14552,6656,14421,6316,14251,5948,14007,5528,15356,5942,15356,5977,15353,6119,15348,6294,15332,6551,15302,6824,15249,7044,15171,7122,15070,7050,14949,6861,14818,6611,14679,6349,14538,6067,14398,5651,14189,5311,13935,4958,15359,4123,15359,4153,15356,4296,15353,4646,15338,5160,15311,5508,15263,5829,15188,6042,15088,6094,14966,6001,14826,5796,14678,5543,14527,5287,14377,4985,14133,4586,13869,4257,15360,1563,15360,1642,15358,2076,15354,2636,15341,3350,15317,4019,15273,4429,15203,4732,15105,4911,14981,4932,14836,4818,14679,4621,14517,4386,14359,4156,14083,3795,13808,3437,15360,122,15360,137,15358,285,15355,636,15344,1274,15322,2177,15281,2765,15215,3223,15120,3451,14995,3569,14846,3567,14681,3466,14511,3305,14344,3121,14037,2800,13753,2467,15360,0,15360,1,15359,21,15355,89,15346,253,15325,479,15287,796,15225,1148,15133,1492,15008,1749,14856,1882,14685,1886,14506,1783,14324,1608,13996,1398,13702,1183]);let ci=null;function zw(){return ci===null&&(ci=new Ea(Hw,16,16,Jn,yt),ci.name="DFG_LUT",ci.minFilter=qe,ci.magFilter=qe,ci.wrapS=Dt,ci.wrapT=Dt,ci.generateMipmaps=!1,ci.needsUpdate=!0),ci}class Jf{constructor(e={}){const{canvas:t=N_(),context:n=null,depth:i=!0,stencil:s=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:h="default",failIfMajorPerformanceCaveat:u=!1,reversedDepthBuffer:d=!1,outputBufferType:f=Le}=e;this.isWebGLRenderer=!0;let p;if(n!==null){if(typeof WebGLRenderingContext<"u"&&n instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");p=n.getContextAttributes().alpha}else p=a;const m=f,A=new Set([Nf,Ff,Pf]),g=new Set([Le,ii,wo,To,Df,Lf]),b=new Uint32Array(4),x=new Int32Array(4);let _=null,v=null;const C=[],I=[];let E=null;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=Qn,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const S=this;let P=!1;this._outputColorSpace=mt;let w=0,L=0,N=null,O=-1,D=null;const U=new It,F=new It;let $=null;const q=new Me(0);let te=0,Z=t.width,Y=t.height,fe=1,Ge=null,ze=null;const X=new It(0,0,Z,Y),se=new It(0,0,Z,Y);let oe=!1;const He=new zf;let De=!1,Fe=!1;const kt=new Oe,Ze=new R,it=new It,bt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let Ke=!1;function Qt(){return N===null?fe:1}let B=n;function zt(M,G){return t.getContext(M,G)}try{const M={alpha:!0,depth:i,stencil:s,antialias:o,premultipliedAlpha:c,preserveDrawingBuffer:l,powerPreference:h,failIfMajorPerformanceCaveat:u};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Yl}`),t.addEventListener("webglcontextlost",_e,!1),t.addEventListener("webglcontextrestored",ke,!1),t.addEventListener("webglcontextcreationerror",vt,!1),B===null){const G="webgl2";if(B=zt(G,M),B===null)throw zt(G)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(M){throw Pe("WebGLRenderer: "+M.message),M}let ct,_t,Se,T,y,Q,K,ee,j,xe,ce,Be,Ne,ne,re,Ee,ve,Ae,$e,k,le,ae,me;function ie(){ct=new VM(B),ct.init(),le=new Pw(B,ct),_t=new NM(B,ct,e,le),Se=new Dw(B,ct),_t.reversedDepthBuffer&&d&&Se.buffers.depth.setReversed(!0),T=new jM(B),y=new bw,Q=new Lw(B,ct,Se,y,_t,le,T),K=new zM(S),ee=new Jy(B),ae=new PM(B,ee),j=new WM(B,ee,T,ae),xe=new KM(B,j,ee,ae,T),Ae=new XM(B,_t,Q),re=new UM(y),ce=new mw(S,K,ct,_t,ae,re),Be=new Qw(S,y),Ne=new Ew,ne=new Mw(ct),ve=new LM(S,K,Se,xe,p,c),Ee=new Bw(S,xe,_t),me=new Gw(B,T,_t,Se),$e=new FM(B,ct,T),k=new qM(B,ct,T),T.programs=ce.programs,S.capabilities=_t,S.extensions=ct,S.properties=y,S.renderLists=Ne,S.shadowMap=Ee,S.state=Se,S.info=T}ie(),m!==Le&&(E=new YM(m,t.width,t.height,i,s));const W=new Ow(S,B);this.xr=W,this.getContext=function(){return B},this.getContextAttributes=function(){return B.getContextAttributes()},this.forceContextLoss=function(){const M=ct.get("WEBGL_lose_context");M&&M.loseContext()},this.forceContextRestore=function(){const M=ct.get("WEBGL_lose_context");M&&M.restoreContext()},this.getPixelRatio=function(){return fe},this.setPixelRatio=function(M){M!==void 0&&(fe=M,this.setSize(Z,Y,!1))},this.getSize=function(M){return M.set(Z,Y)},this.setSize=function(M,G,V=!0){if(W.isPresenting){Ie("WebGLRenderer: Can't change size while VR device is presenting.");return}Z=M,Y=G,t.width=Math.floor(M*fe),t.height=Math.floor(G*fe),V===!0&&(t.style.width=M+"px",t.style.height=G+"px"),E!==null&&E.setSize(t.width,t.height),this.setViewport(0,0,M,G)},this.getDrawingBufferSize=function(M){return M.set(Z*fe,Y*fe).floor()},this.setDrawingBufferSize=function(M,G,V){Z=M,Y=G,fe=V,t.width=Math.floor(M*V),t.height=Math.floor(G*V),this.setViewport(0,0,M,G)},this.setEffects=function(M){if(m===Le){console.error("THREE.WebGLRenderer: setEffects() requires outputBufferType set to HalfFloatType or FloatType.");return}if(M){for(let G=0;G<M.length;G++)if(M[G].isOutputPass===!0){console.warn("THREE.WebGLRenderer: OutputPass is not needed in setEffects(). Tone mapping and color space conversion are applied automatically.");break}}E.setEffects(M||[])},this.getCurrentViewport=function(M){return M.copy(U)},this.getViewport=function(M){return M.copy(X)},this.setViewport=function(M,G,V,z){M.isVector4?X.set(M.x,M.y,M.z,M.w):X.set(M,G,V,z),Se.viewport(U.copy(X).multiplyScalar(fe).round())},this.getScissor=function(M){return M.copy(se)},this.setScissor=function(M,G,V,z){M.isVector4?se.set(M.x,M.y,M.z,M.w):se.set(M,G,V,z),Se.scissor(F.copy(se).multiplyScalar(fe).round())},this.getScissorTest=function(){return oe},this.setScissorTest=function(M){Se.setScissorTest(oe=M)},this.setOpaqueSort=function(M){Ge=M},this.setTransparentSort=function(M){ze=M},this.getClearColor=function(M){return M.copy(ve.getClearColor())},this.setClearColor=function(){ve.setClearColor(...arguments)},this.getClearAlpha=function(){return ve.getClearAlpha()},this.setClearAlpha=function(){ve.setClearAlpha(...arguments)},this.clear=function(M=!0,G=!0,V=!0){let z=0;if(M){let H=!1;if(N!==null){const ue=N.texture.format;H=A.has(ue)}if(H){const ue=N.texture.type,ge=g.has(ue),de=ve.getClearColor(),ye=ve.getClearAlpha(),we=de.r,Ve=de.g,Ye=de.b;ge?(b[0]=we,b[1]=Ve,b[2]=Ye,b[3]=ye,B.clearBufferuiv(B.COLOR,0,b)):(x[0]=we,x[1]=Ve,x[2]=Ye,x[3]=ye,B.clearBufferiv(B.COLOR,0,x))}else z|=B.COLOR_BUFFER_BIT}G&&(z|=B.DEPTH_BUFFER_BIT),V&&(z|=B.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),z!==0&&B.clear(z)},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",_e,!1),t.removeEventListener("webglcontextrestored",ke,!1),t.removeEventListener("webglcontextcreationerror",vt,!1),ve.dispose(),Ne.dispose(),ne.dispose(),y.dispose(),K.dispose(),xe.dispose(),ae.dispose(),me.dispose(),ce.dispose(),W.dispose(),W.removeEventListener("sessionstart",ap),W.removeEventListener("sessionend",op),_s.stop()};function _e(M){M.preventDefault(),Fl("WebGLRenderer: Context Lost."),P=!0}function ke(){Fl("WebGLRenderer: Context Restored."),P=!1;const M=T.autoReset,G=Ee.enabled,V=Ee.autoUpdate,z=Ee.needsUpdate,H=Ee.type;ie(),T.autoReset=M,Ee.enabled=G,Ee.autoUpdate=V,Ee.needsUpdate=z,Ee.type=H}function vt(M){Pe("WebGLRenderer: A WebGL context could not be created. Reason: ",M.statusMessage)}function ut(M){const G=M.target;G.removeEventListener("dispose",ut),vi(G)}function vi(M){yi(M),y.remove(M)}function yi(M){const G=y.get(M).programs;G!==void 0&&(G.forEach(function(V){ce.releaseProgram(V)}),M.isShaderMaterial&&ce.releaseShaderCache(M))}this.renderBufferDirect=function(M,G,V,z,H,ue){G===null&&(G=bt);const ge=H.isMesh&&H.matrixWorld.determinant()<0,de=CE(M,G,V,z,H);Se.setMaterial(z,ge);let ye=V.index,we=1;if(z.wireframe===!0){if(ye=j.getWireframeAttribute(V),ye===void 0)return;we=2}const Ve=V.drawRange,Ye=V.attributes.position;let Te=Ve.start*we,At=(Ve.start+Ve.count)*we;ue!==null&&(Te=Math.max(Te,ue.start*we),At=Math.min(At,(ue.start+ue.count)*we)),ye!==null?(Te=Math.max(Te,0),At=Math.min(At,ye.count)):Ye!=null&&(Te=Math.max(Te,0),At=Math.min(At,Ye.count));const Gt=At-Te;if(Gt<0||Gt===1/0)return;ae.setup(H,z,de,V,ye);let Ut,gt=$e;if(ye!==null&&(Ut=ee.get(ye),gt=k,gt.setIndex(Ut)),H.isMesh)z.wireframe===!0?(Se.setLineWidth(z.wireframeLinewidth*Qt()),gt.setMode(B.LINES)):gt.setMode(B.TRIANGLES);else if(H.isLine){let ln=z.linewidth;ln===void 0&&(ln=1),Se.setLineWidth(ln*Qt()),H.isLineSegments?gt.setMode(B.LINES):H.isLineLoop?gt.setMode(B.LINE_LOOP):gt.setMode(B.LINE_STRIP)}else H.isPoints?gt.setMode(B.POINTS):H.isSprite&&gt.setMode(B.TRIANGLES);if(H.isBatchedMesh)if(H._multiDrawInstances!==null)Nl("WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),gt.renderMultiDrawInstances(H._multiDrawStarts,H._multiDrawCounts,H._multiDrawCount,H._multiDrawInstances);else if(ct.get("WEBGL_multi_draw"))gt.renderMultiDraw(H._multiDrawStarts,H._multiDrawCounts,H._multiDrawCount);else{const ln=H._multiDrawStarts,Ce=H._multiDrawCounts,Mn=H._multiDrawCount,st=ye?ee.get(ye).bytesPerElement:1,Wn=y.get(z).currentProgram.getUniforms();for(let ai=0;ai<Mn;ai++)Wn.setValue(B,"_gl_DrawID",ai),gt.render(ln[ai]/st,Ce[ai])}else if(H.isInstancedMesh)gt.renderInstances(Te,Gt,H.count);else if(V.isInstancedBufferGeometry){const ln=V._maxInstanceCount!==void 0?V._maxInstanceCount:1/0,Ce=Math.min(V.instanceCount,ln);gt.renderInstances(Te,Gt,Ce)}else gt.render(Te,Gt)};function rp(M,G,V){M.transparent===!0&&M.side===qt&&M.forceSinglePass===!1?(M.side=on,M.needsUpdate=!0,$o(M,G,V),M.side=ti,M.needsUpdate=!0,$o(M,G,V),M.side=qt):$o(M,G,V)}this.compile=function(M,G,V=null){V===null&&(V=M),v=ne.get(V),v.init(G),I.push(v),V.traverseVisible(function(H){H.isLight&&H.layers.test(G.layers)&&(v.pushLight(H),H.castShadow&&v.pushShadow(H))}),M!==V&&M.traverseVisible(function(H){H.isLight&&H.layers.test(G.layers)&&(v.pushLight(H),H.castShadow&&v.pushShadow(H))}),v.setupLights();const z=new Set;return M.traverse(function(H){if(!(H.isMesh||H.isPoints||H.isLine||H.isSprite))return;const ue=H.material;if(ue)if(Array.isArray(ue))for(let ge=0;ge<ue.length;ge++){const de=ue[ge];rp(de,V,H),z.add(de)}else rp(ue,V,H),z.add(ue)}),v=I.pop(),z},this.compileAsync=function(M,G,V=null){const z=this.compile(M,G,V);return new Promise(H=>{function ue(){if(z.forEach(function(ge){y.get(ge).currentProgram.isReady()&&z.delete(ge)}),z.size===0){H(M);return}setTimeout(ue,10)}ct.get("KHR_parallel_shader_compile")!==null?ue():setTimeout(ue,10)})};let uh=null;function SE(M){uh&&uh(M)}function ap(){_s.stop()}function op(){_s.start()}const _s=new Db;_s.setAnimationLoop(SE),typeof self<"u"&&_s.setContext(self),this.setAnimationLoop=function(M){uh=M,W.setAnimationLoop(M),M===null?_s.stop():_s.start()},W.addEventListener("sessionstart",ap),W.addEventListener("sessionend",op),this.render=function(M,G){if(G!==void 0&&G.isCamera!==!0){Pe("WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(P===!0)return;const V=W.enabled===!0&&W.isPresenting===!0,z=E!==null&&(N===null||V)&&E.begin(S,N);if(M.matrixWorldAutoUpdate===!0&&M.updateMatrixWorld(),G.parent===null&&G.matrixWorldAutoUpdate===!0&&G.updateMatrixWorld(),W.enabled===!0&&W.isPresenting===!0&&(E===null||E.isCompositing()===!1)&&(W.cameraAutoUpdate===!0&&W.updateCamera(G),G=W.getCamera()),M.isScene===!0&&M.onBeforeRender(S,M,G,N),v=ne.get(M,I.length),v.init(G),I.push(v),kt.multiplyMatrices(G.projectionMatrix,G.matrixWorldInverse),He.setFromProjectionMatrix(kt,Ai,G.reversedDepth),Fe=this.localClippingEnabled,De=re.init(this.clippingPlanes,Fe),_=Ne.get(M,C.length),_.init(),C.push(_),W.enabled===!0&&W.isPresenting===!0){const ge=S.xr.getDepthSensingMesh();ge!==null&&dh(ge,G,-1/0,S.sortObjects)}dh(M,G,0,S.sortObjects),_.finish(),S.sortObjects===!0&&_.sort(Ge,ze),Ke=W.enabled===!1||W.isPresenting===!1||W.hasDepthSensing()===!1,Ke&&ve.addToRenderList(_,M),this.info.render.frame++,De===!0&&re.beginShadows();const H=v.state.shadowsArray;if(Ee.render(H,M,G),De===!0&&re.endShadows(),this.info.autoReset===!0&&this.info.reset(),(z&&E.hasRenderPass())===!1){const ge=_.opaque,de=_.transmissive;if(v.setupLights(),G.isArrayCamera){const ye=G.cameras;if(de.length>0)for(let we=0,Ve=ye.length;we<Ve;we++){const Ye=ye[we];lp(ge,de,M,Ye)}Ke&&ve.render(M);for(let we=0,Ve=ye.length;we<Ve;we++){const Ye=ye[we];cp(_,M,Ye,Ye.viewport)}}else de.length>0&&lp(ge,de,M,G),Ke&&ve.render(M),cp(_,M,G)}N!==null&&L===0&&(Q.updateMultisampleRenderTarget(N),Q.updateRenderTargetMipmap(N)),z&&E.end(S),M.isScene===!0&&M.onAfterRender(S,M,G),ae.resetDefaultState(),O=-1,D=null,I.pop(),I.length>0?(v=I[I.length-1],De===!0&&re.setGlobalState(S.clippingPlanes,v.state.camera)):v=null,C.pop(),C.length>0?_=C[C.length-1]:_=null};function dh(M,G,V,z){if(M.visible===!1)return;if(M.layers.test(G.layers)){if(M.isGroup)V=M.renderOrder;else if(M.isLOD)M.autoUpdate===!0&&M.update(G);else if(M.isLight)v.pushLight(M),M.castShadow&&v.pushShadow(M);else if(M.isSprite){if(!M.frustumCulled||He.intersectsSprite(M)){z&&it.setFromMatrixPosition(M.matrixWorld).applyMatrix4(kt);const ge=xe.update(M),de=M.material;de.visible&&_.push(M,ge,de,V,it.z,null)}}else if((M.isMesh||M.isLine||M.isPoints)&&(!M.frustumCulled||He.intersectsObject(M))){const ge=xe.update(M),de=M.material;if(z&&(M.boundingSphere!==void 0?(M.boundingSphere===null&&M.computeBoundingSphere(),it.copy(M.boundingSphere.center)):(ge.boundingSphere===null&&ge.computeBoundingSphere(),it.copy(ge.boundingSphere.center)),it.applyMatrix4(M.matrixWorld).applyMatrix4(kt)),Array.isArray(de)){const ye=ge.groups;for(let we=0,Ve=ye.length;we<Ve;we++){const Ye=ye[we],Te=de[Ye.materialIndex];Te&&Te.visible&&_.push(M,ge,Te,V,it.z,Ye)}}else de.visible&&_.push(M,ge,de,V,it.z,null)}}const ue=M.children;for(let ge=0,de=ue.length;ge<de;ge++)dh(ue[ge],G,V,z)}function cp(M,G,V,z){const{opaque:H,transmissive:ue,transparent:ge}=M;v.setupLightsView(V),De===!0&&re.setGlobalState(S.clippingPlanes,V),z&&Se.viewport(U.copy(z)),H.length>0&&Ko(H,G,V),ue.length>0&&Ko(ue,G,V),ge.length>0&&Ko(ge,G,V),Se.buffers.depth.setTest(!0),Se.buffers.depth.setMask(!0),Se.buffers.color.setMask(!0),Se.setPolygonOffset(!1)}function lp(M,G,V,z){if((V.isScene===!0?V.overrideMaterial:null)!==null)return;if(v.state.transmissionRenderTarget[z.id]===void 0){const Te=ct.has("EXT_color_buffer_half_float")||ct.has("EXT_color_buffer_float");v.state.transmissionRenderTarget[z.id]=new Sn(1,1,{generateMipmaps:!0,type:Te?yt:Le,minFilter:yn,samples:Math.max(4,_t.samples),stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:tt.workingColorSpace})}const ue=v.state.transmissionRenderTarget[z.id],ge=z.viewport||U;ue.setSize(ge.z*S.transmissionResolutionScale,ge.w*S.transmissionResolutionScale);const de=S.getRenderTarget(),ye=S.getActiveCubeFace(),we=S.getActiveMipmapLevel();S.setRenderTarget(ue),S.getClearColor(q),te=S.getClearAlpha(),te<1&&S.setClearColor(16777215,.5),S.clear(),Ke&&ve.render(V);const Ve=S.toneMapping;S.toneMapping=Qn;const Ye=z.viewport;if(z.viewport!==void 0&&(z.viewport=void 0),v.setupLightsView(z),De===!0&&re.setGlobalState(S.clippingPlanes,z),Ko(M,V,z),Q.updateMultisampleRenderTarget(ue),Q.updateRenderTargetMipmap(ue),ct.has("WEBGL_multisampled_render_to_texture")===!1){let Te=!1;for(let At=0,Gt=G.length;At<Gt;At++){const Ut=G[At],{object:gt,geometry:ln,material:Ce,group:Mn}=Ut;if(Ce.side===qt&&gt.layers.test(z.layers)){const st=Ce.side;Ce.side=on,Ce.needsUpdate=!0,hp(gt,V,z,ln,Ce,Mn),Ce.side=st,Ce.needsUpdate=!0,Te=!0}}Te===!0&&(Q.updateMultisampleRenderTarget(ue),Q.updateRenderTargetMipmap(ue))}S.setRenderTarget(de,ye,we),S.setClearColor(q,te),Ye!==void 0&&(z.viewport=Ye),S.toneMapping=Ve}function Ko(M,G,V){const z=G.isScene===!0?G.overrideMaterial:null;for(let H=0,ue=M.length;H<ue;H++){const ge=M[H],{object:de,geometry:ye,group:we}=ge;let Ve=ge.material;Ve.allowOverride===!0&&z!==null&&(Ve=z),de.layers.test(V.layers)&&hp(de,G,V,ye,Ve,we)}}function hp(M,G,V,z,H,ue){M.onBeforeRender(S,G,V,z,H,ue),M.modelViewMatrix.multiplyMatrices(V.matrixWorldInverse,M.matrixWorld),M.normalMatrix.getNormalMatrix(M.modelViewMatrix),H.onBeforeRender(S,G,V,z,M,ue),H.transparent===!0&&H.side===qt&&H.forceSinglePass===!1?(H.side=on,H.needsUpdate=!0,S.renderBufferDirect(V,G,z,H,M,ue),H.side=ti,H.needsUpdate=!0,S.renderBufferDirect(V,G,z,H,M,ue),H.side=qt):S.renderBufferDirect(V,G,z,H,M,ue),M.onAfterRender(S,G,V,z,H,ue)}function $o(M,G,V){G.isScene!==!0&&(G=bt);const z=y.get(M),H=v.state.lights,ue=v.state.shadowsArray,ge=H.state.version,de=ce.getParameters(M,H.state,ue,G,V),ye=ce.getProgramCacheKey(de);let we=z.programs;z.environment=M.isMeshStandardMaterial||M.isMeshLambertMaterial||M.isMeshPhongMaterial?G.environment:null,z.fog=G.fog;const Ve=M.isMeshStandardMaterial||M.isMeshLambertMaterial&&!M.envMap||M.isMeshPhongMaterial&&!M.envMap;z.envMap=K.get(M.envMap||z.environment,Ve),z.envMapRotation=z.environment!==null&&M.envMap===null?G.environmentRotation:M.envMapRotation,we===void 0&&(M.addEventListener("dispose",ut),we=new Map,z.programs=we);let Ye=we.get(ye);if(Ye!==void 0){if(z.currentProgram===Ye&&z.lightsStateVersion===ge)return dp(M,de),Ye}else de.uniforms=ce.getUniforms(M),M.onBeforeCompile(de,S),Ye=ce.acquireProgram(de,ye),we.set(ye,Ye),z.uniforms=de.uniforms;const Te=z.uniforms;return(!M.isShaderMaterial&&!M.isRawShaderMaterial||M.clipping===!0)&&(Te.clippingPlanes=re.uniform),dp(M,de),z.needsLights=IE(M),z.lightsStateVersion=ge,z.needsLights&&(Te.ambientLightColor.value=H.state.ambient,Te.lightProbe.value=H.state.probe,Te.directionalLights.value=H.state.directional,Te.directionalLightShadows.value=H.state.directionalShadow,Te.spotLights.value=H.state.spot,Te.spotLightShadows.value=H.state.spotShadow,Te.rectAreaLights.value=H.state.rectArea,Te.ltc_1.value=H.state.rectAreaLTC1,Te.ltc_2.value=H.state.rectAreaLTC2,Te.pointLights.value=H.state.point,Te.pointLightShadows.value=H.state.pointShadow,Te.hemisphereLights.value=H.state.hemi,Te.directionalShadowMatrix.value=H.state.directionalShadowMatrix,Te.spotLightMatrix.value=H.state.spotLightMatrix,Te.spotLightMap.value=H.state.spotLightMap,Te.pointShadowMatrix.value=H.state.pointShadowMatrix),z.currentProgram=Ye,z.uniformsList=null,Ye}function up(M){if(M.uniformsList===null){const G=M.currentProgram.getUniforms();M.uniformsList=dl.seqWithValue(G.seq,M.uniforms)}return M.uniformsList}function dp(M,G){const V=y.get(M);V.outputColorSpace=G.outputColorSpace,V.batching=G.batching,V.batchingColor=G.batchingColor,V.instancing=G.instancing,V.instancingColor=G.instancingColor,V.instancingMorph=G.instancingMorph,V.skinning=G.skinning,V.morphTargets=G.morphTargets,V.morphNormals=G.morphNormals,V.morphColors=G.morphColors,V.morphTargetsCount=G.morphTargetsCount,V.numClippingPlanes=G.numClippingPlanes,V.numIntersection=G.numClipIntersection,V.vertexAlphas=G.vertexAlphas,V.vertexTangents=G.vertexTangents,V.toneMapping=G.toneMapping}function CE(M,G,V,z,H){G.isScene!==!0&&(G=bt),Q.resetTextureUnits();const ue=G.fog,ge=z.isMeshStandardMaterial||z.isMeshLambertMaterial||z.isMeshPhongMaterial?G.environment:null,de=N===null?S.outputColorSpace:N.isXRRenderTarget===!0?N.texture.colorSpace:Ct,ye=z.isMeshStandardMaterial||z.isMeshLambertMaterial&&!z.envMap||z.isMeshPhongMaterial&&!z.envMap,we=K.get(z.envMap||ge,ye),Ve=z.vertexColors===!0&&!!V.attributes.color&&V.attributes.color.itemSize===4,Ye=!!V.attributes.tangent&&(!!z.normalMap||z.anisotropy>0),Te=!!V.morphAttributes.position,At=!!V.morphAttributes.normal,Gt=!!V.morphAttributes.color;let Ut=Qn;z.toneMapped&&(N===null||N.isXRRenderTarget===!0)&&(Ut=S.toneMapping);const gt=V.morphAttributes.position||V.morphAttributes.normal||V.morphAttributes.color,ln=gt!==void 0?gt.length:0,Ce=y.get(z),Mn=v.state.lights;if(De===!0&&(Fe===!0||M!==D)){const Kt=M===D&&z.id===O;re.setState(z,M,Kt)}let st=!1;z.version===Ce.__version?(Ce.needsLights&&Ce.lightsStateVersion!==Mn.state.version||Ce.outputColorSpace!==de||H.isBatchedMesh&&Ce.batching===!1||!H.isBatchedMesh&&Ce.batching===!0||H.isBatchedMesh&&Ce.batchingColor===!0&&H.colorTexture===null||H.isBatchedMesh&&Ce.batchingColor===!1&&H.colorTexture!==null||H.isInstancedMesh&&Ce.instancing===!1||!H.isInstancedMesh&&Ce.instancing===!0||H.isSkinnedMesh&&Ce.skinning===!1||!H.isSkinnedMesh&&Ce.skinning===!0||H.isInstancedMesh&&Ce.instancingColor===!0&&H.instanceColor===null||H.isInstancedMesh&&Ce.instancingColor===!1&&H.instanceColor!==null||H.isInstancedMesh&&Ce.instancingMorph===!0&&H.morphTexture===null||H.isInstancedMesh&&Ce.instancingMorph===!1&&H.morphTexture!==null||Ce.envMap!==we||z.fog===!0&&Ce.fog!==ue||Ce.numClippingPlanes!==void 0&&(Ce.numClippingPlanes!==re.numPlanes||Ce.numIntersection!==re.numIntersection)||Ce.vertexAlphas!==Ve||Ce.vertexTangents!==Ye||Ce.morphTargets!==Te||Ce.morphNormals!==At||Ce.morphColors!==Gt||Ce.toneMapping!==Ut||Ce.morphTargetsCount!==ln)&&(st=!0):(st=!0,Ce.__version=z.version);let Wn=Ce.currentProgram;st===!0&&(Wn=$o(z,G,H));let ai=!1,vs=!1,lr=!1;const xt=Wn.getUniforms(),sn=Ce.uniforms;if(Se.useProgram(Wn.program)&&(ai=!0,vs=!0,lr=!0),z.id!==O&&(O=z.id,vs=!0),ai||D!==M){Se.buffers.depth.getReversed()&&M.reversedDepth!==!0&&(M._reversedDepth=!0,M.updateProjectionMatrix()),xt.setValue(B,"projectionMatrix",M.projectionMatrix),xt.setValue(B,"viewMatrix",M.matrixWorldInverse);const Ki=xt.map.cameraPosition;Ki!==void 0&&Ki.setValue(B,Ze.setFromMatrixPosition(M.matrixWorld)),_t.logarithmicDepthBuffer&&xt.setValue(B,"logDepthBufFC",2/(Math.log(M.far+1)/Math.LN2)),(z.isMeshPhongMaterial||z.isMeshToonMaterial||z.isMeshLambertMaterial||z.isMeshBasicMaterial||z.isMeshStandardMaterial||z.isShaderMaterial)&&xt.setValue(B,"isOrthographic",M.isOrthographicCamera===!0),D!==M&&(D=M,vs=!0,lr=!0)}if(Ce.needsLights&&(Mn.state.directionalShadowMap.length>0&&xt.setValue(B,"directionalShadowMap",Mn.state.directionalShadowMap,Q),Mn.state.spotShadowMap.length>0&&xt.setValue(B,"spotShadowMap",Mn.state.spotShadowMap,Q),Mn.state.pointShadowMap.length>0&&xt.setValue(B,"pointShadowMap",Mn.state.pointShadowMap,Q)),H.isSkinnedMesh){xt.setOptional(B,H,"bindMatrix"),xt.setOptional(B,H,"bindMatrixInverse");const Kt=H.skeleton;Kt&&(Kt.boneTexture===null&&Kt.computeBoneTexture(),xt.setValue(B,"boneTexture",Kt.boneTexture,Q))}H.isBatchedMesh&&(xt.setOptional(B,H,"batchingTexture"),xt.setValue(B,"batchingTexture",H._matricesTexture,Q),xt.setOptional(B,H,"batchingIdTexture"),xt.setValue(B,"batchingIdTexture",H._indirectTexture,Q),xt.setOptional(B,H,"batchingColorTexture"),H._colorsTexture!==null&&xt.setValue(B,"batchingColorTexture",H._colorsTexture,Q));const Xi=V.morphAttributes;if((Xi.position!==void 0||Xi.normal!==void 0||Xi.color!==void 0)&&Ae.update(H,V,Wn),(vs||Ce.receiveShadow!==H.receiveShadow)&&(Ce.receiveShadow=H.receiveShadow,xt.setValue(B,"receiveShadow",H.receiveShadow)),(z.isMeshStandardMaterial||z.isMeshLambertMaterial||z.isMeshPhongMaterial)&&z.envMap===null&&G.environment!==null&&(sn.envMapIntensity.value=G.environmentIntensity),sn.dfgLUT!==void 0&&(sn.dfgLUT.value=zw()),vs&&(xt.setValue(B,"toneMappingExposure",S.toneMappingExposure),Ce.needsLights&&ME(sn,lr),ue&&z.fog===!0&&Be.refreshFogUniforms(sn,ue),Be.refreshMaterialUniforms(sn,z,fe,Y,v.state.transmissionRenderTarget[M.id]),dl.upload(B,up(Ce),sn,Q)),z.isShaderMaterial&&z.uniformsNeedUpdate===!0&&(dl.upload(B,up(Ce),sn,Q),z.uniformsNeedUpdate=!1),z.isSpriteMaterial&&xt.setValue(B,"center",H.center),xt.setValue(B,"modelViewMatrix",H.modelViewMatrix),xt.setValue(B,"normalMatrix",H.normalMatrix),xt.setValue(B,"modelMatrix",H.matrixWorld),z.isShaderMaterial||z.isRawShaderMaterial){const Kt=z.uniformsGroups;for(let Ki=0,hr=Kt.length;Ki<hr;Ki++){const fp=Kt[Ki];me.update(fp,Wn),me.bind(fp,Wn)}}return Wn}function ME(M,G){M.ambientLightColor.needsUpdate=G,M.lightProbe.needsUpdate=G,M.directionalLights.needsUpdate=G,M.directionalLightShadows.needsUpdate=G,M.pointLights.needsUpdate=G,M.pointLightShadows.needsUpdate=G,M.spotLights.needsUpdate=G,M.spotLightShadows.needsUpdate=G,M.rectAreaLights.needsUpdate=G,M.hemisphereLights.needsUpdate=G}function IE(M){return M.isMeshLambertMaterial||M.isMeshToonMaterial||M.isMeshPhongMaterial||M.isMeshStandardMaterial||M.isShadowMaterial||M.isShaderMaterial&&M.lights===!0}this.getActiveCubeFace=function(){return w},this.getActiveMipmapLevel=function(){return L},this.getRenderTarget=function(){return N},this.setRenderTargetTextures=function(M,G,V){const z=y.get(M);z.__autoAllocateDepthBuffer=M.resolveDepthBuffer===!1,z.__autoAllocateDepthBuffer===!1&&(z.__useRenderToTexture=!1),y.get(M.texture).__webglTexture=G,y.get(M.depthTexture).__webglTexture=z.__autoAllocateDepthBuffer?void 0:V,z.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(M,G){const V=y.get(M);V.__webglFramebuffer=G,V.__useDefaultFramebuffer=G===void 0};const wE=B.createFramebuffer();this.setRenderTarget=function(M,G=0,V=0){N=M,w=G,L=V;let z=null,H=!1,ue=!1;if(M){const de=y.get(M);if(de.__useDefaultFramebuffer!==void 0){Se.bindFramebuffer(B.FRAMEBUFFER,de.__webglFramebuffer),U.copy(M.viewport),F.copy(M.scissor),$=M.scissorTest,Se.viewport(U),Se.scissor(F),Se.setScissorTest($),O=-1;return}else if(de.__webglFramebuffer===void 0)Q.setupRenderTarget(M);else if(de.__hasExternalTextures)Q.rebindTextures(M,y.get(M.texture).__webglTexture,y.get(M.depthTexture).__webglTexture);else if(M.depthBuffer){const Ve=M.depthTexture;if(de.__boundDepthTexture!==Ve){if(Ve!==null&&y.has(Ve)&&(M.width!==Ve.image.width||M.height!==Ve.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");Q.setupDepthRenderbuffer(M)}}const ye=M.texture;(ye.isData3DTexture||ye.isDataArrayTexture||ye.isCompressedArrayTexture)&&(ue=!0);const we=y.get(M).__webglFramebuffer;M.isWebGLCubeRenderTarget?(Array.isArray(we[G])?z=we[G][V]:z=we[G],H=!0):M.samples>0&&Q.useMultisampledRTT(M)===!1?z=y.get(M).__webglMultisampledFramebuffer:Array.isArray(we)?z=we[V]:z=we,U.copy(M.viewport),F.copy(M.scissor),$=M.scissorTest}else U.copy(X).multiplyScalar(fe).floor(),F.copy(se).multiplyScalar(fe).floor(),$=oe;if(V!==0&&(z=wE),Se.bindFramebuffer(B.FRAMEBUFFER,z)&&Se.drawBuffers(M,z),Se.viewport(U),Se.scissor(F),Se.setScissorTest($),H){const de=y.get(M.texture);B.framebufferTexture2D(B.FRAMEBUFFER,B.COLOR_ATTACHMENT0,B.TEXTURE_CUBE_MAP_POSITIVE_X+G,de.__webglTexture,V)}else if(ue){const de=G;for(let ye=0;ye<M.textures.length;ye++){const we=y.get(M.textures[ye]);B.framebufferTextureLayer(B.FRAMEBUFFER,B.COLOR_ATTACHMENT0+ye,we.__webglTexture,V,de)}}else if(M!==null&&V!==0){const de=y.get(M.texture);B.framebufferTexture2D(B.FRAMEBUFFER,B.COLOR_ATTACHMENT0,B.TEXTURE_2D,de.__webglTexture,V)}O=-1},this.readRenderTargetPixels=function(M,G,V,z,H,ue,ge,de=0){if(!(M&&M.isWebGLRenderTarget)){Pe("WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ye=y.get(M).__webglFramebuffer;if(M.isWebGLCubeRenderTarget&&ge!==void 0&&(ye=ye[ge]),ye){Se.bindFramebuffer(B.FRAMEBUFFER,ye);try{const we=M.textures[de],Ve=we.format,Ye=we.type;if(M.textures.length>1&&B.readBuffer(B.COLOR_ATTACHMENT0+de),!_t.textureFormatReadable(Ve)){Pe("WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!_t.textureTypeReadable(Ye)){Pe("WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}G>=0&&G<=M.width-z&&V>=0&&V<=M.height-H&&B.readPixels(G,V,z,H,le.convert(Ve),le.convert(Ye),ue)}finally{const we=N!==null?y.get(N).__webglFramebuffer:null;Se.bindFramebuffer(B.FRAMEBUFFER,we)}}},this.readRenderTargetPixelsAsync=async function(M,G,V,z,H,ue,ge,de=0){if(!(M&&M.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let ye=y.get(M).__webglFramebuffer;if(M.isWebGLCubeRenderTarget&&ge!==void 0&&(ye=ye[ge]),ye)if(G>=0&&G<=M.width-z&&V>=0&&V<=M.height-H){Se.bindFramebuffer(B.FRAMEBUFFER,ye);const we=M.textures[de],Ve=we.format,Ye=we.type;if(M.textures.length>1&&B.readBuffer(B.COLOR_ATTACHMENT0+de),!_t.textureFormatReadable(Ve))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!_t.textureTypeReadable(Ye))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Te=B.createBuffer();B.bindBuffer(B.PIXEL_PACK_BUFFER,Te),B.bufferData(B.PIXEL_PACK_BUFFER,ue.byteLength,B.STREAM_READ),B.readPixels(G,V,z,H,le.convert(Ve),le.convert(Ye),0);const At=N!==null?y.get(N).__webglFramebuffer:null;Se.bindFramebuffer(B.FRAMEBUFFER,At);const Gt=B.fenceSync(B.SYNC_GPU_COMMANDS_COMPLETE,0);return B.flush(),await U_(B,Gt,4),B.bindBuffer(B.PIXEL_PACK_BUFFER,Te),B.getBufferSubData(B.PIXEL_PACK_BUFFER,0,ue),B.deleteBuffer(Te),B.deleteSync(Gt),ue}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(M,G=null,V=0){const z=Math.pow(2,-V),H=Math.floor(M.image.width*z),ue=Math.floor(M.image.height*z),ge=G!==null?G.x:0,de=G!==null?G.y:0;Q.setTexture2D(M,0),B.copyTexSubImage2D(B.TEXTURE_2D,V,0,0,ge,de,H,ue),Se.unbindTexture()};const TE=B.createFramebuffer(),RE=B.createFramebuffer();this.copyTextureToTexture=function(M,G,V=null,z=null,H=0,ue=0){let ge,de,ye,we,Ve,Ye,Te,At,Gt;const Ut=M.isCompressedTexture?M.mipmaps[ue]:M.image;if(V!==null)ge=V.max.x-V.min.x,de=V.max.y-V.min.y,ye=V.isBox3?V.max.z-V.min.z:1,we=V.min.x,Ve=V.min.y,Ye=V.isBox3?V.min.z:0;else{const sn=Math.pow(2,-H);ge=Math.floor(Ut.width*sn),de=Math.floor(Ut.height*sn),M.isDataArrayTexture?ye=Ut.depth:M.isData3DTexture?ye=Math.floor(Ut.depth*sn):ye=1,we=0,Ve=0,Ye=0}z!==null?(Te=z.x,At=z.y,Gt=z.z):(Te=0,At=0,Gt=0);const gt=le.convert(G.format),ln=le.convert(G.type);let Ce;G.isData3DTexture?(Q.setTexture3D(G,0),Ce=B.TEXTURE_3D):G.isDataArrayTexture||G.isCompressedArrayTexture?(Q.setTexture2DArray(G,0),Ce=B.TEXTURE_2D_ARRAY):(Q.setTexture2D(G,0),Ce=B.TEXTURE_2D),B.pixelStorei(B.UNPACK_FLIP_Y_WEBGL,G.flipY),B.pixelStorei(B.UNPACK_PREMULTIPLY_ALPHA_WEBGL,G.premultiplyAlpha),B.pixelStorei(B.UNPACK_ALIGNMENT,G.unpackAlignment);const Mn=B.getParameter(B.UNPACK_ROW_LENGTH),st=B.getParameter(B.UNPACK_IMAGE_HEIGHT),Wn=B.getParameter(B.UNPACK_SKIP_PIXELS),ai=B.getParameter(B.UNPACK_SKIP_ROWS),vs=B.getParameter(B.UNPACK_SKIP_IMAGES);B.pixelStorei(B.UNPACK_ROW_LENGTH,Ut.width),B.pixelStorei(B.UNPACK_IMAGE_HEIGHT,Ut.height),B.pixelStorei(B.UNPACK_SKIP_PIXELS,we),B.pixelStorei(B.UNPACK_SKIP_ROWS,Ve),B.pixelStorei(B.UNPACK_SKIP_IMAGES,Ye);const lr=M.isDataArrayTexture||M.isData3DTexture,xt=G.isDataArrayTexture||G.isData3DTexture;if(M.isDepthTexture){const sn=y.get(M),Xi=y.get(G),Kt=y.get(sn.__renderTarget),Ki=y.get(Xi.__renderTarget);Se.bindFramebuffer(B.READ_FRAMEBUFFER,Kt.__webglFramebuffer),Se.bindFramebuffer(B.DRAW_FRAMEBUFFER,Ki.__webglFramebuffer);for(let hr=0;hr<ye;hr++)lr&&(B.framebufferTextureLayer(B.READ_FRAMEBUFFER,B.COLOR_ATTACHMENT0,y.get(M).__webglTexture,H,Ye+hr),B.framebufferTextureLayer(B.DRAW_FRAMEBUFFER,B.COLOR_ATTACHMENT0,y.get(G).__webglTexture,ue,Gt+hr)),B.blitFramebuffer(we,Ve,ge,de,Te,At,ge,de,B.DEPTH_BUFFER_BIT,B.NEAREST);Se.bindFramebuffer(B.READ_FRAMEBUFFER,null),Se.bindFramebuffer(B.DRAW_FRAMEBUFFER,null)}else if(H!==0||M.isRenderTargetTexture||y.has(M)){const sn=y.get(M),Xi=y.get(G);Se.bindFramebuffer(B.READ_FRAMEBUFFER,TE),Se.bindFramebuffer(B.DRAW_FRAMEBUFFER,RE);for(let Kt=0;Kt<ye;Kt++)lr?B.framebufferTextureLayer(B.READ_FRAMEBUFFER,B.COLOR_ATTACHMENT0,sn.__webglTexture,H,Ye+Kt):B.framebufferTexture2D(B.READ_FRAMEBUFFER,B.COLOR_ATTACHMENT0,B.TEXTURE_2D,sn.__webglTexture,H),xt?B.framebufferTextureLayer(B.DRAW_FRAMEBUFFER,B.COLOR_ATTACHMENT0,Xi.__webglTexture,ue,Gt+Kt):B.framebufferTexture2D(B.DRAW_FRAMEBUFFER,B.COLOR_ATTACHMENT0,B.TEXTURE_2D,Xi.__webglTexture,ue),H!==0?B.blitFramebuffer(we,Ve,ge,de,Te,At,ge,de,B.COLOR_BUFFER_BIT,B.NEAREST):xt?B.copyTexSubImage3D(Ce,ue,Te,At,Gt+Kt,we,Ve,ge,de):B.copyTexSubImage2D(Ce,ue,Te,At,we,Ve,ge,de);Se.bindFramebuffer(B.READ_FRAMEBUFFER,null),Se.bindFramebuffer(B.DRAW_FRAMEBUFFER,null)}else xt?M.isDataTexture||M.isData3DTexture?B.texSubImage3D(Ce,ue,Te,At,Gt,ge,de,ye,gt,ln,Ut.data):G.isCompressedArrayTexture?B.compressedTexSubImage3D(Ce,ue,Te,At,Gt,ge,de,ye,gt,
4092Ut.data):B.texSubImage3D(Ce,ue,Te,At,Gt,ge,de,ye,gt,ln,Ut):M.isDataTexture?B.texSubImage2D(B.TEXTURE_2D,ue,Te,At,ge,de,gt,ln,Ut.data):M.isCompressedTexture?B.compressedTexSubImage2D(B.TEXTURE_2D,ue,Te,At,Ut.width,Ut.height,gt,Ut.data):B.texSubImage2D(B.TEXTURE_2D,ue,Te,At,ge,de,gt,ln,Ut);B.pixelStorei(B.UNPACK_ROW_LENGTH,Mn),B.pixelStorei(B.UNPACK_IMAGE_HEIGHT,st),B.pixelStorei(B.UNPACK_SKIP_PIXELS,Wn),B.pixelStorei(B.UNPACK_SKIP_ROWS,ai),B.pixelStorei(B.UNPACK_SKIP_IMAGES,vs),ue===0&&G.generateMipmaps&&B.generateMipmap(Ce),Se.unbindTexture()},this.initRenderTarget=function(M){y.get(M).__webglFramebuffer===void 0&&Q.setupRenderTarget(M)},this.initTexture=function(M){M.isCubeTexture?Q.setTextureCube(M,0):M.isData3DTexture?Q.setTexture3D(M,0):M.isDataArrayTexture||M.isCompressedArrayTexture?Q.setTexture2DArray(M,0):Q.setTexture2D(M,0),Se.unbindTexture()},this.resetState=function(){w=0,L=0,N=null,Se.reset(),ae.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Ai}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=tt._getDrawingBufferColorSpace(e),t.unpackColorSpace=tt._getUnpackColorSpace()}}/* @license
4093 * Copyright 2019 Google LLC. All Rights Reserved.
4094 * Licensed under the Apache License, Version 2.0 (the 'License');
4095 * you may not use this file except in compliance with the License.
4096 * You may obtain a copy of the License at
4097 *
4098 *     http://www.apache.org/licenses/LICENSE-2.0
4099 *
4100 * Unless required by applicable law or agreed to in writing, software
4101 * distributed under the License is distributed on an 'AS IS' BASIS,
4102 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4103 * See the License for the specific language governing permissions and
4104 * limitations under the License.
4105 */const Ub=navigator.xr!=null&&self.XRSession!=null&&navigator.xr.isSessionSupported!=null,Ob=Ub&&self.XRSession.prototype.requestHitTestSource!=null,tu=self.ResizeObserver!=null,nu=self.IntersectionObserver!=null,kb=Ob;(()=>{const r=navigator.userAgent||navigator.vendor||self.opera;let e=!1;return(/(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(r)||/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(r.substr(0,4)))&&(e=!0),e})();const Vw=/android/i.test(navigator.userAgent),Zf=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!self.MSStream||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,Ww=/firefox/i.test(navigator.userAgent),qw=/OculusBrowser/.test(navigator.userAgent),Qb=Zf&&/CriOS\/|EdgiOS\/|FxiOS\/|GSA\/|DuckDuckGo\//.test(navigator.userAgent),XA=Zf&&/GSA\//.test(navigator.userAgent),jw=Vw&&!Ww&&!qw;window.webkit&&window.webkit.messageHandlers;const KA=(()=>
vendor: 5,126 bytes, lines 4105-4133
4105{if(Zf){if(Qb)return!0;const r=document.createElement("a");return!!(r.relList&&r.relList.supports&&r.relList.supports("ar"))}else return!1})();/* @license
4106 * Copyright 2019 Google LLC. All Rights Reserved.
4107 * Licensed under the Apache License, Version 2.0 (the 'License');
4108 * you may not use this file except in compliance with the License.
4109 * You may obtain a copy of the License at
4110 *
4111 *     http://www.apache.org/licenses/LICENSE-2.0
4112 *
4113 * Unless required by applicable law or agreed to in writing, software
4114 * distributed under the License is distributed on an 'AS IS' BASIS,
4115 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4116 * See the License for the specific language governing permissions and
4117 * limitations under the License.
4118 */const Gb=r=>r&&r!=="null"?Xw(r):null,$A=()=>{if(kb)return;const r=[];throw Ub||r.push("WebXR Device API"),Ob||r.push("WebXR Hit Test API"),new Error(`The following APIs are required for AR, but are missing in this browser: ${r.join(", ")}`)},Xw=r=>new URL(r,window.location.toString()).toString(),Kw=(r,e)=>{let t=null;const n=(...i)=>{t==null&&(r(...i),t=self.setTimeout(()=>t=null,e))};return n.flush=()=>{t!=null&&(self.clearTimeout(t),t=null)},n},YA=(r,e)=>{let t=null;return(...n)=>{t!=null&&self.clearTimeout(t),t=self.setTimeout(()=>{t=null,r(...n)},e)}},pi=(r,e,t)=>Math.max(e,Math.min(t,r)),JA=(()=>{const r="model-viewer-debug-mode",e=new RegExp(`[?&]${r}(&|$)`);return()=>self.ModelViewerElement&&self.ModelViewerElement.debugMode||self.location&&self.location.search&&self.location.search.match(e)})(),$w=(r=0)=>new Promise(e=>setTimeout(e,r)),Yw=(r,e,t=null)=>new Promise(n=>{function i(s){(!t||t(s))&&(n(s),r.removeEventListener(e,i))}r.addEventListener(e,i)});/* @license
4119 * Copyright 2019 Google LLC. All Rights Reserved.
4120 * Licensed under the Apache License, Version 2.0 (the 'License');
4121 * you may not use this file except in compliance with the License.
4122 * You may obtain a copy of the License at
4123 *
4124 *     http://www.apache.org/licenses/LICENSE-2.0
4125 *
4126 * Unless required by applicable law or agreed to in writing, software
4127 * distributed under the License is distributed on an 'AS IS' BASIS,
4128 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4129 * See the License for the specific language governing permissions and
4130 * limitations under the License.
4131 */var Rs=function(r,e,t,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var o=r.length-1;o>=0;o--)(a=r[o])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s};const Jw=.5,Zw=0,eT=1,tT=1,co=Symbol("currentEnvironmentMap"),lo=Symbol("currentBackground"),Gl=Symbol("updateEnvironment"),Tc=Symbol("cancelEnvironmentUpdate"),nT=r=>{var e,t,n;class i extends r{constructor(){super(...arguments),this.environmentImage=null,this.skyboxImage=null,this.shadowIntensity=Zw,this.shadowSoftness=eT,this.exposure=tT,this.toneMapping="auto",this.skyboxHeight="0",this[e]=null,this[t]=null,this[n]=null}updated(a){var o;if(super.updated(a),a.has("shadowIntensity")&&(this[J].setShadowIntensity(this.shadowIntensity*Jw),this[tn]()),a.has("shadowSoftness")&&(this[J].setShadowSoftness(this.shadowSoftness),this[tn]()),a.has("exposure")&&(this[J].exposure=this.exposure,this[tn]()),a.has("toneMapping")){const c=new Map([["aces",wf],["agx",Tf],["reinhard",Mf],["cineon",If],["linear",Cf],["none",Qn]]);this[J].toneMapping=(o=c.get(this.toneMapping))!==null&&o!==void 0?o:sa,this[tn]()}(a.has("environmentImage")||a.has("skyboxImage"))&&this[ma]()&&this[Gl](),a.has("skyboxHeight")&&(this[J].setGroundedSkybox(),this[tn]())}hasBakedShadow(){return this[J].bakedShadows.size>0}async[(e=co,t=lo,n=Tc,Gl)](){const{skyboxImage:a,environmentImage:o}=this;this[Tc]!=null&&(this[Tc](),this[Tc]=null);const{textureUtils:c}=this[ot];if(c==null)return;const l=this[rr].beginActivity("environment-update");try{const{environmentMap:h,skybox:u}=await c.generateEnvironmentMapAndSkybox(Gb(a),o,d=>l(pi(d,0,1)),this.withCredentials);this[co]!==h&&(this[co]=h,this.dispatchEvent(new CustomEvent("environment-change"))),u!=null?this[lo]=u.name===h.name?h:u:this[lo]=null,this[J].setEnvironmentAndSkybox(this[co],this[lo])}catch(h){if(h instanceof Error)throw this[J].setEnvironmentAndSkybox(null,null),h}finally{l(1)}}}return Rs([Re({type:String,attribute:"environment-image"})],i.prototype,"environmentImage",void 0),Rs([Re({type:String,attribute:"skybox-image"})],i.prototype,"skyboxImage",void 0),Rs([Re({type:Number,attribute:"shadow-intensity"})],i.prototype,"shadowIntensity",void 0),Rs([Re({type:Number,attribute:"shadow-softness"})],i.prototype,"shadowSoftness",void 0),Rs([Re({type:Number})],i.prototype,"exposure",void 0),Rs([Re({type:String,attribute:"tone-mapping"})],i.prototype,"toneMapping",void 0),Rs([Re({type:String,attribute:"skybox-height"})],i.prototype,"skyboxHeight",void 0),i};/* @license
4132 * Copyright 2019 Google LLC. All Rights Reserved.
4133 * Licensed under the Apache License, Version 2.0 (the 'License');
4134 * you may not use this file except in compliance with the License.
4135 * You may obtain a copy of the License at
4136 *
4137 *     http://www.apache.org/licenses/LICENSE-2.0
4138 *
4139 * Unless required by applicable law or agreed to in writing, software
4140 * distributed under the License is distributed on an 'AS IS' BASIS,
4141 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4142 * See the License for the specific language governing permissions and
4143 * limitations under the License.
4144 */const iT=Kl`
4145<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="#000000">
4146    <!-- NOTE(cdata): This SVG filter is a stop-gap until we can implement
4147         support for dynamic re-coloring of UI components -->
4148    <defs>
4149      <filter id="drop-shadow" x="-100%" y="-100%" width="300%" height="300%">
4150        <feGaussianBlur in="SourceAlpha" stdDeviation="1"/>
4151        <feOffset dx="0" dy="0" result="offsetblur"/>
4152        <feFlood flood-color="#000000"/>
4153        <feComposite in2="offsetblur" operator="in"/>
4154        <feMerge>
4155          <feMergeNode/>
4156          <feMergeNode in="SourceGraphic"/>
4157        </feMerge>
4158      </filter>
4159    </defs>
4160    <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"/>
4161    <path d="M0 0h24v24H0z" fill="none"/>
4162</svg>`;/* @license
4163 * Copyright 2019 Google LLC. All Rights Reserved.
4164 * Licensed under the Apache License, Version 2.0 (the 'License');
4165 * you may not use this file except in compliance with the License.
4166 * You may obtain a copy of the License at
4167 *
4168 *     http://www.apache.org/licenses/LICENSE-2.0
4169 *
4170 * Unless required by applicable law or agreed to in writing, software
4171 * distributed under the License is distributed on an 'AS IS' BASIS,
4172 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4173 * See the License for the specific language governing permissions and
4174 * limitations under the License.
4175 */const sT=Kl`
4176<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="25" height="36">
4177    <defs>
4178        <path id="A" d="M.001.232h24.997V36H.001z" />
4179    </defs>
4180    <g transform="translate(-11 -4)" fill="none" fill-rule="evenodd">
4181        <path fill-opacity="0" fill="#fff" d="M0 0h44v44H0z" />
4182        <g transform="translate(11 3)">
4183            <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" />
4184            <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" />
4185            <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" />
4186            <g transform="translate(0 .769)">
4187                <mask id="B" fill="#fff">
4188                    <use xlink:href="#A" />
4189                </mask>
4190                <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.71
41905-.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)" />
4191            </g>
4192        </g>
4193    </g>
4194</svg>`;/* @license
4195 * Copyright 2019 Google LLC. All Rights Reserved.
4196 * Licensed under the Apache License, Version 2.0 (the 'License');
4197 * you may not use this file except in compliance with the License.
4198 * You may obtain a copy of the License at
4199 *
4200 *     http://www.apache.org/licenses/LICENSE-2.0
4201 *
4202 * Unless required by applicable law or agreed to in writing, software
4203 * distributed under the License is distributed on an 'AS IS' BASIS,
4204 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4205 * See the License for the specific language governing permissions and
4206 * limitations under the License.
4207 */const rT=Kl`
4208<svg version="1.1" id="view_x5F_in_x5F_AR_x5F_icon"
4209	 xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px"
4210	 viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve">
4211<rect id="Bounding_Box" x="0" y="0" fill="none" width="24" height="24"/>
4212<g id="Art_layer">
4213	<path d="M3,4c0-0.55,0.45-1,1-1h2V1H4C2.35,1,1,2.35,1,4v2h2V4z"/>
4214	<path d="M20,3c0.55,0,1,0.45,1,1v2h2V4c0-1.65-1.35-3-3-3h-2v2H20z"/>
4215	<path d="M4,21c-0.55,0-1-0.45-1-1v-2H1v2c0,1.65,1.35,3,3,3h2v-2H4z"/>
4216	<path d="M20,21c0.55,0,1-0.45,1-1v-2h2v2c0,1.65-1.35,3-3,3h-2v-2H20z"/>
4217	<g>
4218		<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
4219			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
4220			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"/>
4221	</g>
4222</g>
4223</svg>`;/* @license
4224 * Copyright 2019 Google LLC. All Rights Reserved.
4225 * Licensed under the Apache License, Version 2.0 (the 'License');
4226 * you may not use this file except in compliance with the License.
4227 * You may obtain a copy of the License at
4228 *
4229 *     http://www.apache.org/licenses/LICENSE-2.0
4230 *
4231 * Unless required by applicable law or agreed to in writing, software
4232 * distributed under the License is distributed on an 'AS IS' BASIS,
4233 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4234 * See the License for the specific language governing permissions and
4235 * limitations under the License.
4236 */const aT=Kl`
4237<style>
4238:host {
4239  display: block;
4240  position: relative;
4241  contain: strict;
4242  width: 300px;
4243  height: 150px;
4244}
4245
4246.container {
4247  position: relative;
4248  overflow: hidden;
4249}
4250
4251.userInput {
4252  width: 100%;
4253  height: 100%;
4254  display: none;
4255  position: relative;
4256  outline-offset: -1px;
4257  outline-width: 1px;
4258}
4259
4260canvas {
4261  position: absolute;
4262  display: none;
4263  pointer-events: none;
4264  /* NOTE(cdata): Chrome 76 and below apparently have a bug
4265   * that causes our canvas not to display pixels unless it is
4266   * on its own render layer
4267   * @see https://github.com/google/model-viewer/pull/755#issuecomment-536597893
4268   */
4269  transform: translateZ(0);
4270}
4271
4272.show {
4273  display: block;
4274}
4275
4276/* Adapted from HTML5 Boilerplate
4277 *
4278 * @see https://github.com/h5bp/html5-boilerplate/blob/ceb4620c78fc82e13534fc44202a3f168754873f/dist/css/main.css#L122-L133 */
4279.screen-reader-only {
4280  border: 0;
4281  left: 0;
4282  top: 0;
4283  clip: rect(0, 0, 0, 0);
4284  height: 1px;
4285  margin: -1px;
4286  overflow: hidden;
4287  padding: 0;
4288  position: absolute;
4289  white-space: nowrap;
4290  width: 1px;
4291  pointer-events: none;
4292}
4293
4294.slot {
4295  position: absolute;
4296  pointer-events: none;
4297  top: 0;
4298  left: 0;
4299  width: 100%;
4300  height: 100%;
4301}
4302
4303.slot > * {
4304  pointer-events: initial;
4305}
4306
4307.annotation-wrapper ::slotted(*) {
4308  opacity: var(--max-hotspot-opacity, 1);
4309  transition: opacity 0.3s;
4310}
4311
4312.pointer-tumbling .annotation-wrapper ::slotted(*) {
4313  pointer-events: none;
4314}
4315
4316.annotation-wrapper ::slotted(*) {
4317  pointer-events: initial;
4318}
4319
4320.annotation-wrapper.hide ::slotted(*) {
4321  opacity: var(--min-hotspot-opacity, 0.25);
4322}
4323
4324.slot.poster {
4325  display: none;
4326  background-color: inherit;
4327}
4328
4329.slot.poster.show {
4330  display: inherit;
4331}
4332
4333.slot.poster > * {
4334  pointer-events: initial;
4335}
4336
4337.slot.poster:not(.show) > * {
4338  pointer-events: none;
4339}
4340
4341#default-poster {
4342  width: 100%;
4343  height: 100%;
4344  /* The default poster is a <button> so we need to set display
4345   * to prevent it from being affected by text-align: */
4346  display: block;
4347  position: absolute;
4348  border: none;
4349  padding: 0;
4350  background-size: contain;
4351  background-repeat: no-repeat;
4352  background-position: center;
4353  background-color: #fff0;
4354}
4355
4356#default-progress-bar {
4357  display: block;
4358  position: relative;
4359  width: 100%;
4360  height: 100%;
4361  pointer-events: none;
4362  overflow: hidden;
4363}
4364
4365#default-progress-bar > .bar {
4366  position: absolute;
4367  top: 0;
4368  left: 0;
4369  width: 100%;
4370  height: var(--progress-bar-height, 5px);
4371  background-color: var(--progress-bar-color, rgba(0, 0, 0, 0.4));
4372  transition: transform 0.09s;
4373  transform-origin: top left;
4374  transform: scaleX(0);
4375  overflow: hidden;
4376}
4377
4378#default-progress-bar > .bar.hide {
4379  transition: opacity 0.3s 1s;
4380  opacity: 0;
4381}
4382
4383.centered {
4384  align-items: center;
4385  justify-content: center;
4386}
4387
4388.cover {
4389  position: absolute;
4390  top: 0;
4391  left: 0;
4392  width: 100%;
4393  height: 100%;
4394  pointer-events: none;
4395}
4396
4397.slot.interaction-prompt {
4398  display: var(--interaction-prompt-display, flex);
4399  overflow: hidden;
4400  opacity: 0;
4401  will-change: opacity;
4402  transition: opacity 0.3s;
4403}
4404
4405.slot.interaction-prompt.visible {
4406  opacity: 1;
4407}
4408
4409.animated-container {
4410  will-change: transform, opacity;
4411  opacity: 0;
4412  transition: opacity 0.3s;
4413}
4414
4415.slot.interaction-prompt > * {
4416  pointer-events: none;
4417}
4418
4419.slot.ar-button {
4420  -moz-user-select: none;
4421  -webkit-tap-highlight-color: transparent;
4422  user-select: none;
4423
4424  display: var(--ar-button-display, block);
4425}
4426
4427.slot.ar-button:not(.enabled) {
4428  display: none;
4429}
4430
4431.fab {
4432  display: flex;
4433  align-items: center;
4434  justify-content: center;
4435  box-sizing: border-box;
4436  width: 40px;
4437  height: 40px;
4438  cursor: pointer;
4439  background-color: #fff;
4440  box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.15);
4441  border-radius: 100px;
4442}
4443
4444.fab > * {
4445  opacity: 0.87;
4446}
4447
4448#default-ar-button {
4449  position: absolute;
4450  bottom: 16px;
4451  right: 16px;
4452  transform: scale(var(--ar-button-scale, 1));
4453  transform-origin: bottom right;
4454}
4455
4456.slot.pan-target {
4457  display: block;
4458  position: absolute;
4459  width: 0;
4460  height: 0;
4461  left: 50%;
4462  top: 50%;
4463  transform: translate3d(-50%, -50%, 0);
4464  background-color: transparent;
4465  opacity: 0;
4466  transition: opacity 0.3s;
4467}
4468
4469#default-pan-target {
4470  width: 6px;
4471  height: 6px;
4472  border-radius: 6px;
4473  border: 1px solid white;
4474  box-shadow: 0px 0px 2px 1px rgba(0, 0, 0, 0.8);
4475}
4476
4477.slot.default {
4478  pointer-events: none;
4479}
4480
4481.slot.progress-bar {
4482  pointer-events: none;
4483}
4484
4485.slot.exit-webxr-ar-button {
4486  pointer-events: none;
4487}
4488
4489.slot.exit-webxr-ar-button > slot,
4490.slot.exit-webxr-ar-button ::slotted(*) {
4491  pointer-events: auto;
4492}
4493
4494.slot.exit-webxr-ar-button:not(.enabled) {
4495  display: none;
4496}
4497
4498#default-exit-webxr-ar-button {
4499  pointer-events: auto;
4500  display: flex;
4501  align-items: center;
4502  justify-content: center;
4503  position: absolute;
4504  top: env(safe-area-inset-top, 16px);
4505  right: 16px;
4506  width: 40px;
4507  height: 40px;
4508  box-sizing: border-box;
4509}
4510
4511#default-exit-webxr-ar-button > svg {
4512  fill: #fff;
4513}
4514</style>
4515<div class="container">
4516  <div class="userInput" tabindex="0" role="img"
4517      aria-label="3D model">
4518      <div class="slot canvas">
4519        <slot name="canvas">
4520          <canvas></canvas>
4521        </slot>
4522      </div>
4523
4524  </div>
4525
4526  <!-- NOTE(cdata): We need to wrap slots because browsers without ShadowDOM
4527        will have their <slot> elements removed by ShadyCSS -->
4528  <div class="slot poster">
4529    <slot name="poster">
4530      <button type="button" id="default-poster" aria-hidden="true" aria-label="Loading 3D model"></button>
4531    </slot>
4532  </div>
4533
4534  <div class="slot ar-button">
4535    <slot name="ar-button">
4536      <a id="default-ar-button" part="default-ar-button" class="fab"
4537          tabindex="2"
4538          role="button"
4539          href="javascript:void(0);"
4540          aria-label="View in your space">
4541        ${rT}
4542      </a>
4543    </slot>
4544  </div>
4545
4546  <div class="slot pan-target">
4547    <slot name="pan-target">
4548      <div id="default-pan-target">
4549      </div>
4550    </slot>
4551  </div>
4552
4553  <div class="slot interaction-prompt cover centered">
4554    <div id="prompt" class="animated-container">
4555      <slot name="interaction-prompt" aria-hidden="true">
4556        ${sT}
4557      </slot>
4558    </div>
4559  </div>
4560
4561  <div id="finger0" class="animated-container cover">
4562    <slot name="finger0" aria-hidden="true">
4563    </slot>
4564  </div>
4565  <div id="finger1" class="animated-container cover">
4566    <slot name="finger1" aria-hidden="true">
4567    </slot>
4568  </div>
4569
4570  <div class="slot default">
4571    <slot></slot>
4572
4573    <div class="slot progress-bar">
4574      <slot name="progress-bar">
4575        <div id="default-progress-bar" aria-hidden="true">
4576          <div class="bar" part="default-progress-bar"></div>
4577        </div>
4578      </slot>
4579    </div>
4580
4581    <div class="slot exit-webxr-ar-button">
4582      <slot name="exit-webxr-ar-button">
4583        <a id="default-exit-webxr-ar-button" part="default-exit-webxr-ar-button"
4584            tabindex="3"
4585            aria-label="Exit AR"
4586            aria-hidden="true">
4587          ${iT}
4588        </a>
4589      </slot>
4590    </div>
4591  </div>
4592</div>
4593<div class="screen-reader-only" role="region" aria-label="Live announcements">
4594  <span id="status" role="status"></span>
4595</div>`,oT=r=>{X0(aT,r)};var ZA=(function(){var r="
vendor: 9,475 bytes, line 4595
4595b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuixkbeeeddddillviebeoweuec:W:Odkr;Neqo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949WboY9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVJ9V29VVbrl79IV9Rbwq;lZkdbk;jYi5ud9:du8Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnalTmbcuhoaiRbbgrc;WeGc:Ge9hmbarcsGgwce0mbc9:hoalcufadcd4cbawEgDadfgrcKcaawEgqaraq0Egk6mbaicefhxcj;abad9Uc;WFbGcjdadca0EhmaialfgPar9Rgoadfhsavaoadz:jjjjbgzceVhHcbhOdndninaeaO9nmeaPax9RaD6mdamaeaO9RaOamfgoae6EgAcsfglc9WGhCabaOad2fhXaAcethQaxaDfhiaOaeaoaeao6E9RhLalcl4cifcd4hKazcj;cbfaAfhYcbh8AazcjdfhEaHh3incbhodnawTmbaxa8Acd4fRbbhokaocFeGh5cbh8Eazcj;cbfhqinaih8Fdndndndna5a8Ecet4ciGgoc9:fPdebdkaPa8F9RaA6mrazcj;cbfa8EaA2fa8FaAz:jjjjb8Aa8FaAfhixdkazcj;cbfa8EaA2fcbaAz:kjjjb8Aa8FhixekaPa8F9RaK6mva8FaKfhidnaCTmbaPai9RcK6mbaocdtc:q1jjbfcj1jjbawEhaczhrcbhlinargoc9Wfghaqfhrdndndndndndnaaa8Fahco4fRbbalcoG4ciGcdtfydbPDbedvivvvlvkar9cb83bbarcwf9cb83bbxlkarcbaiRbdai8Xbb9c:c:qj:bw9:9c:q;c1:I1e:d9c:b:c:e1z9:gg9cjjjjjz:dg8J9qE86bbaqaofgrcGfag9c8F1:NghcKtc8F91aicdfa8J9c8N1:Nfg8KRbbG86bbarcVfcba8KahcjeGcr4fghRbbag9cjjjjjl:dg8J9qE86bbarc7fcbaha8J9c8L1:NfghRbbag9cjjjjjd:dg8J9qE86bbarctfcbaha8J9c8K1:NfghRbbag9cjjjjje:dg8J9qE86bbarc91fcbaha8J9c8J1:NfghRbbag9cjjjj;ab:dg8J9qE86bbarc4fcbaha8J9cg1:NfghRbbag9cjjjja:dg8J9qE86bbarc93fcbaha8J9ch1:NfghRbbag9cjjjjz:dgg9qE86bbarc94fcbahag9ca1:NfghRbbai8Xbe9c:c:qj:bw9:9c:q;c1:I1e:d9c:b:c:e1z9:gg9cjjjjjz:dg8J9qE86bbarc95fag9c8F1:NgicKtc8F91aha8J9c8N1:NfghRbbG86bbarc96fcbahaicjeGcr4fgiRbbag9cjjjjjl:dg8J9qE86bbarc97fcbaia8J9c8L1:NfgiRbbag9cjjjjjd:dg8J9qE86bbarc98fcbaia8J9c8K1:NfgiRbbag9cjjjjje:dg8J9qE86bbarc99fcbaia8J9c8J1:NfgiRbbag9cjjjj;ab:dg8J9qE86bbarc9:fcbaia8J9cg1:NfgiRbbag9cjjjja:dg8J9qE86bbarcufcbaia8J9ch1:NfgiRbbag9cjjjjz:dgg9qE86bbaiag9ca1:NfhixikaraiRblaiRbbghco4g8Ka8KciSg8KE86bbaqaofgrcGfaiclfa8Kfg8KRbbahcl4ciGg8La8LciSg8LE86bbarcVfa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc7fa8Ka8Lfg8KRbbahciGghahciSghE86bbarctfa8Kahfg8KRbbaiRbeghco4g8La8LciSg8LE86bbarc91fa8Ka8Lfg8KRbbahcl4ciGg8La8LciSg8LE86bbarc4fa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc93fa8Ka8Lfg8KRbbahciGghahciSghE86bbarc94fa8Kahfg8KRbbaiRbdghco4g8La8LciSg8LE86bbarc95fa8Ka8Lfg8KRbbahcl4ciGg8La8LciSg8LE86bbarc96fa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc97fa8Ka8Lfg8KRbbahciGghahciSghE86bbarc98fa8KahfghRbbaiRbigico4g8Ka8KciSg8KE86bbarc99faha8KfghRbbaicl4ciGg8Ka8KciSg8KE86bbarc9:faha8KfghRbbaicd4ciGg8Ka8KciSg8KE86bbarcufaha8KfgrRbbaiciGgiaiciSgiE86bbaraifhixdkaraiRbwaiRbbghcl4g8Ka8KcsSg8KE86bbaqaofgrcGfaicwfa8Kfg8KRbbahcsGghahcsSghE86bbarcVfa8KahfghRbbaiRbeg8Kcl4g8La8LcsSg8LE86bbarc7faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarctfaha8KfghRbbaiRbdg8Kcl4g8La8LcsSg8LE86bbarc91faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc4faha8KfghRbbaiRbig8Kcl4g8La8LcsSg8LE86bbarc93faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc94faha8KfghRbbaiRblg8Kcl4g8La8LcsSg8LE86bbarc95faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc96faha8KfghRbbaiRbvg8Kcl4g8La8LcsSg8LE86bbarc97faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc98faha8KfghRbbaiRbog8Kcl4g8La8LcsSg8LE86bbarc99faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc9:faha8KfghRbbaiRbrgicl4g8Ka8KcsSg8KE86bbarcufaha8KfgrRbbaicsGgiaicsSgiE86bbaraifhixekarai8Pbb83bbarcwfaicwf8Pbb83bbaiczfhikdnaoaC9pmbalcdfhlaoczfhraPai9RcL0mekkaoaC6moaimexokaCmva8FTmvkaqaAfhqa8Ecefg8Ecl9hmbkdndndndnawTmbasa8Acd4fRbbgociGPlbedrbkaATmdaza8Afh8Fazcj;cbfhhcbh8EaEhaina8FRbbhraahocbhlinaoahalfRbbgqce4cbaqceG9R7arfgr86bbaoadfhoaAalcefgl9hmbkaacefhaa8Fcefh8FahaAfhha8Ecefg8Ecl9hmbxikkaATmeaza8Afhaazcj;cbfhhcbhoceh8EaYh8FinaEaofhlaa8Vbbhrcbhoinala8FaofRbbcwtahaofRbbgqVc;:FiGce4cbaqceG9R7arfgr87bbaladfhlaLaocefgofmbka8FaQfh8FcdhoaacdfhaahaQfhha8EceGhlcbh8EalmbxdkkaATmbcbaocl49Rh8Eaza8AfRbbhqcwhoa3hlinalRbbaotaqVhqalcefhlaocwfgoca9hmbkcbhhaEh8FaYhainazcj;cbfahfRbbhrcwhoaahlinalRbbaotarVhralaAfhlaocwfgoca9hmbkara8E93aq7hqcbhoa8Fhlinalaqao486bbalcefhlaocwfgoca9hmbka8Fadfh8FaacefhaahcefghaA9hmbkkaEclfhEa3clfh3a8Aclfg8Aad6mbkaXazcjdfaAad2z:jjjjb8AazazcjdfaAcufad2fadz:jjjjb8AaAaOfhOaihxaimbkc9:hoxdkcbc99aPax9RakSEhoxekc9:hokavcj;kbf8Kjjjjbaok:XseHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:kjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhldnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhoindnalaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfaoaDcu7gPcl4fcsGcitfgsydlhzasydbhHdndnaDcsGgsak9pmbavaiaPfcsGcdtfydbaxasEhDaxasTgOfhxxekdndnascsSmbcehOasc987asamffcefhDxekalcefhDal8SbbgscFeGhPdndnascu9mmbaDhlxekalcvfhlaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhlkcehOaPce4cbaPceG9R7amfhDkaDhmkavc;abfaocitfgsaDBdbasazBdlavaicdtfaDBdbavc;abfaocefcsGcitfgsaHBdbasaDBdlaocdfhoaOaifhidnadcd9hmbabarcetfgsaH87ebasclfaD87ebascdfaz87ebxdkabarcdtfgsaHBdbascwfaDBdbasclfazBdbxekdnaDcpe0mbaxcefgOavaiaqaDcsGfRbbgscl49RcsGcdtfydbascz6gPEhDavaias9RcsGcdtfydbaOaPfgzascsGgOEhsaOThOdndnadcd9hmbabarcetfgHax87ebaHclfas87ebaHcdfaD87ebxekabarcdtfgHaxBdbaHcwfasBdbaHclfaDBdbkavaicdtfaxBdbavc;abfaocitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfaocefcsGcitfgHasBdbaHaDBdlavaiaPfgicsGcdtfasBdbavc;abfaocdfcsGcitfgDaxBdbaDasBdlaocifhoaiaOfhiazaOfhxxekaxcbalRbbgHEgAaDc;:eSgDfhzaHcsGhCaHcl4hXdndnaHcs0mbazcefhOxekazhOavaiaX9RcsGcdtfydbhzkdndnaCmbaOcefhxxekaOhxavaiaH9RcsGcdtfydbhOkdndnaDTmbalcefhDxekalcdfhDal8SbegPcFeGhsdnaPcu9kmbalcofhAascFbGhscrhldninaD8SbbgPcFbGaltasVhsaPcu9kmeaDcefhDalcrfglc8J9hmbkaAhDxekaDcefhDkasce4cbasceG9R7amfgmhAkdndnaXcsSmbaDhsxekaDcefhsaD8SbbglcFeGhPdnalcu9kmbaDcvfhzaPcFbGhPcrhldninas8SbbgDcFbGaltaPVhPaDcu9kmeascefhsalcrfglc8J9hmbkazhsxekascefhskaPce4cbaPceG9R7amfgmhzkdndnaCcsSmbashlxekascefhlas8SbbgDcFeGhPdnaDcu9kmbascvfhOaPcFbGhPcrhDdninal8SbbgscFbGaDtaPVhPascu9kmealcefhlaDcrfgDc8J9hmbkaOhlxekalcefhlkaPce4cbaPceG9R7amfgmhOkdndnadcd9hmbabarcetfgDaA87ebaDclfaO87ebaDcdfaz87ebxekabarcdtfgDaABdbaDcwfaOBdbaDclfazBdbkavc;abfaocitfgDazBdbaDaABdlavaicdtfaABdbavc;abfaocefcsGcitfgDaOBdbaDazBdlavaicefgicsGcdtfazBdbavc;abfaocdfcsGcitfgDaABdbaDaOBdlavaiaHcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhiaocifhokawcefhwaocsGhoaicsGhiarcifgrae6mbkkcbc99alaqSEhokavc;aef8Kjjjjbaok:clevu8Jjjjjbcz9Rhvdnaecvfal9nmbc9:skdnaiRbbc;:eGc;qeSmbcuskav9cb83iwaicefhoaialfc98fhrdnaeTmbdnadcdSmbcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcdtfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgiBdbalaiBdbawcefgwae9hmbxdkkcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcetfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgi87ebalaiBdbawcefgwae9hmbkkcbc99aoarSEk:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk::ioiue99dud99dud99dnaeTmbcbhiabhlindndnal8Uebgv:YgoJ:ji:1Salcof8UebgrciVgw:Y:vgDNJbbbZJbbb:;avcu9kEMgq:lJbbb9p9DTmbaq:Ohkxekcjjjj94hkkalclf8Uebhvalcdf8UebhxabaiarcefciGfcetfak87ebdndnax:YgqaDNJbbbZJbbb:;axcu9kEMgm:lJbbb9p9DTmbam:Ohxxekcjjjj94hxkabaiarciGfgkcd7cetfax87ebdndnav:YgmaDNJbbbZJbbb:;avcu9kEMgP:lJbbb9p9DTmbaP:Ohvxekcjjjj94hvkabaiarcufciGfcetfav87ebdndnawaw2:ZgPaPMaoaoN:taqaqN:tamamN:tgoJbbbbaoJbbbb9GE:raDNJbbbZMgD:lJbbb9p9DTmbaD:Ohrxekcjjjj94hrkabakcetfar87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2gdTmbinababydbgecwtcw91:Yaece91cjjj98Gcjjj;8if::NUdbabclfhbadcufgdmbkkk:Tvirud99eudndnadcl9hmbaeTmeindndnabRbbgiabcefgl8Sbbgvabcdfgo8Sbbgrf9R:YJbbuJabcifgwRbbgdce4adVgDcd4aDVgDcl4aDVgD:Z:vgqNJbbbZMgk:lJbbb9p9DTmbak:Ohxxekcjjjj94hxkaoax86bbdndnaraif:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohoxekcjjjj94hokalao86bbdndnavaifar9R:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohixekcjjjj94hikabai86bbdndnaDadcetGadceGV:ZaqNJbbbZMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkawad86bbabclfhbaecufgembxdkkaeTmbindndnab8Vebgiabcdfgl8Uebgvabclfgo8Uebgrf9R:YJbFu9habcofgw8Vebgdce4adVgDcd4aDVgDcl4aDVgDcw4aDVgD:Z:vgqNJbbbZMgk:lJbbb9p9DTmbak:Ohxxekcjjjj94hxkaoax87ebdndnaraif:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohoxekcjjjj94hokalao87ebdndnavaifar9R:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohixekcjjjj94hikabai87ebdndnaDadcetGadceGV:ZaqNJbbbZMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkawad87ebabcwfhbaecufgembkkk9teiucbcbyd:K1jjbgeabcifc98GfgbBd:K1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;teeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiaeydlBdlaiaeydwBdwaiaeydxBdxaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk:3eedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdxaialBdwaialBdlaialBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkk81dbcjwk8Kbbbbdbbblbbbwbbbbbbbebbbdbbblbbbwbbbbc:Kwkl8WNbb
4595",e="
vendor: 16,894 bytes, line 4595
4595b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuixkbbebeeddddilve9Weeeviebeoweuec:q:6dkr;Neqo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949WbwY9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVJ9V29VVbDl79IV9Rbqq:Ctklbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk:183lYud97dur978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnalTmbcuhoaiRbbgrc;WeGc:Ge9hmbarcsGgwce0mbc9:hoalcufadcd4cbawEgDadfgrcKcaawEgqaraq0Egk6mbaicefhxavaialfgmar9Rgoad;8qbbcj;abad9Uc;WFbGcjdadca0EhPdndndnadTmbaoadfhscbhzinaeaz9nmdamax9RaD6miabazad2fhHaxaDfhOaPaeaz9RazaPfae6EgAcsfgocl4cifcd4hCavcj;cbfaoc9WGgXcetfhQavcj;cbfaXci2fhLavcj;cbfaXfhKcbhYaoc;ab6h8AincbhodnawTmbaxaYcd4fRbbhokaocFeGhEcbh3avcj;cbfh5indndndndnaEa3cet4ciGgoc9:fPdebdkamaO9RaX6mwavcj;cbfa3aX2faOaX;8qbbaOaAfhOxdkavcj;cbfa3aX2fcbaX;8kbxekamaO9RaC6moaoclVcbawEhraOaCfhocbhidna8Ambamao9Rc;Gb6mbcbhlina5alfhidndndndndndnaOalco4fRbbgqciGarfPDbedibledibkaipxbbbbbbbbbbbbbbbbpklbxlkaiaopbblaopbbbg8Eclp:mea8EpmbzeHdOiAlCvXoQrLg8Ecdp:mea8EpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9og8Fpxiiiiiiiiiiiiiiiip8Jg8Ep5b9cjF;8;4;W;G;ab9:9cU1:Ngacitc:q1jjbfpbibaac:q:yjjbfRbbgapsa8Ep5e9cjF;8;4;W;G;ab9:9cU1:Nghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPa8Fa8Ep9spklbaaaoclffahc:q:yjjbfRbbfhoxikaiaopbbwaopbbbg8Eclp:mea8EpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9og8Fpxssssssssssssssssp8Jg8Ep5b9cjF;8;4;W;G;ab9:9cU1:Ngacitc:q1jjbfpbibaac:q:yjjbfRbbgapsa8Ep5e9cjF;8;4;W;G;ab9:9cU1:Nghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPa8Fa8Ep9spklbaaaocwffahc:q:yjjbfRbbfhoxdkaiaopbbbpklbaoczfhoxekaiaopbbdaoRbbgacitc:q1jjbfpbibaac:q:yjjbfRbbgapsaoRbeghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPpklbaaaocdffahc:q:yjjbfRbbfhokdndndndndndnaqcd4ciGarfPDbedibledibkaiczfpxbbbbbbbbbbbbbbbbpklbxlkaiczfaopbblaopbbbg8Eclp:mea8EpmbzeHdOiAlCvXoQrLg8Ecdp:mea8EpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9og8Fpxiiiiiiiiiiiiiiiip8Jg8Ep5b9cjF;8;4;W;G;ab9:9cU1:Ngacitc:q1jjbfpbibaac:q:yjjbfRbbgapsa8Ep5e9cjF;8;4;W;G;ab9:9cU1:Nghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPa8Fa8Ep9spklbaaaoclffahc:q:yjjbfRbbfhoxikaiczfaopbbwaopbbbg8Eclp:mea8EpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9og8Fpxssssssssssssssssp8Jg8Ep5b9cjF;8;4;W;G;ab9:9cU1:Ngacitc:q1jjbfpbibaac:q:yjjbfRbbgapsa8Ep5e9cjF;8;4;W;G;ab9:9cU1:Nghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPa8Fa8Ep9spklbaaaocwffahc:q:yjjbfRbbfhoxdkaiczfaopbbbpklbaoczfhoxekaiczfaopbbdaoRbbgacitc:q1jjbfpbibaac:q:yjjbfRbbgapsaoRbeghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPpklbaaaocdffahc:q:yjjbfRbbfhokdndndndndndnaqcl4ciGarfPDbedibledibkaicafpxbbbbbbbbbbbbbbbbpklbxlkaicafaopbblaopbbbg8Eclp:mea8EpmbzeHdOiAlCvXoQrLg8Ecdp:mea8EpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9og8Fpxiiiiiiiiiiiiiiiip8Jg8Ep5b9cjF;8;4;W;G;ab9:9cU1:Ngacitc:q1jjbfpbibaac:q:yjjbfRbbgapsa8Ep5e9cjF;8;4;W;G;ab9:9cU1:Nghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPa8Fa8Ep9spklbaaaoclffahc:q:yjjbfRbbfhoxikaicafaopbbwaopbbbg8Eclp:mea8EpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9og8Fpxssssssssssssssssp8Jg8Ep5b9cjF;8;4;W;G;ab9:9cU1:Ngacitc:q1jjbfpbibaac:q:yjjbfRbbgapsa8Ep5e9cjF;8;4;W;G;ab9:9cU1:Nghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPa8Fa8Ep9spklbaaaocwffahc:q:yjjbfRbbfhoxdkaicafaopbbbpklbaoczfhoxekaicafaopbbdaoRbbgacitc:q1jjbfpbibaac:q:yjjbfRbbgapsaoRbeghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPpklbaaaocdffahc:q:yjjbfRbbfhokdndndndndndnaqco4arfPDbedibledibkaic8Wfpxbbbbbbbbbbbbbbbbpklbxlkaic8Wfaopbblaopbbbg8Eclp:mea8EpmbzeHdOiAlCvXoQrLg8Ecdp:mea8EpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9og8Fpxiiiiiiiiiiiiiiiip8Jg8Ep5b9cjF;8;4;W;G;ab9:9cU1:Ngicitc:q1jjbfpbibaic:q:yjjbfRbbgipsa8Ep5e9cjF;8;4;W;G;ab9:9cU1:Ngqcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPa8Fa8Ep9spklbaiaoclffaqc:q:yjjbfRbbfhoxikaic8Wfaopbbwaopbbbg8Eclp:mea8EpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9og8Fpxssssssssssssssssp8Jg8Ep5b9cjF;8;4;W;G;ab9:9cU1:Ngicitc:q1jjbfpbibaic:q:yjjbfRbbgipsa8Ep5e9cjF;8;4;W;G;ab9:9cU1:Ngqcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPa8Fa8Ep9spklbaiaocwffaqc:q:yjjbfRbbfhoxdkaic8Wfaopbbbpklbaoczfhoxekaic8WfaopbbdaoRbbgicitc:q1jjbfpbibaic:q:yjjbfRbbgipsaoRbegqcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPpklbaiaocdffaqc:q:yjjbfRbbfhokalc;abfhialcjefaX0meaihlamao9Rc;Fb0mbkkdnaiaX9pmbaici4hlinamao9RcK6mwa5aifhqdndndndndndnaOaico4fRbbalcoG4ciGarfPDbedibledibkaqpxbbbbbbbbbbbbbbbbpkbbxlkaqaopbblaopbbbg8Eclp:mea8EpmbzeHdOiAlCvXoQrLg8Ecdp:mea8EpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9og8Fpxiiiiiiiiiiiiiiiip8Jg8Ep5b9cjF;8;4;W;G;ab9:9cU1:Ngacitc:q1jjbfpbibaac:q:yjjbfRbbgapsa8Ep5e9cjF;8;4;W;G;ab9:9cU1:Nghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPa8Fa8Ep9spkbbaaaoclffahc:q:yjjbfRbbfhoxikaqaopbbwaopbbbg8Eclp:mea8EpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9og8Fpxssssssssssssssssp8Jg8Ep5b9cjF;8;4;W;G;ab9:9cU1:Ngacitc:q1jjbfpbibaac:q:yjjbfRbbgapsa8Ep5e9cjF;8;4;W;G;ab9:9cU1:Nghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPa8Fa8Ep9spkbbaaaocwffahc:q:yjjbfRbbfhoxdkaqaopbbbpkbbaoczfhoxekaqaopbbdaoRbbgacitc:q1jjbfpbibaac:q:yjjbfRbbgapsaoRbeghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPpkbbaaaocdffahc:q:yjjbfRbbfhokalcdfhlaiczfgiaX6mbkkaohOaoTmoka5aXfh5a3cefg3cl9hmbkdndndndnawTmbasaYcd4fRbbglciGPlbedwbkaXTmdavcjdfaYfhlavaYfpbdbhgcbhoinalavcj;cbfaofpblbg8JaKaofpblbg8KpmbzeHdOiAlCvXoQrLg8LaQaofpblbg8MaLaofpblbg8NpmbzeHdOiAlCvXoQrLgypmbezHdiOAlvCXorQLg8Ecep9Ta8Epxeeeeeeeeeeeeeeeeg8Fp9op9Hp9rg8Eagp9Uggp9Abbbaladfglaga8Ea8Epmlvorlvorlvorlvorp9Uggp9Abbbaladfglaga8Ea8EpmwDqkwDqkwDqkwDqkp9Uggp9Abbbaladfglaga8Ea8EpmxmPsxmPsxmPsxmPsp9Uggp9Abbbaladfglaga8LaypmwDKYqk8AExm35Ps8E8Fg8Ecep9Ta8Ea8Fp9op9Hp9rg8Ep9Uggp9Abbbaladfglaga8Ea8Epmlvorlvorlvorlvorp9Uggp9Abbbaladfglaga8Ea8EpmwDqkwDqkwDqkwDqkp9Uggp9Abbbaladfglaga8Ea8EpmxmPsxmPsxmPsxmPsp9Uggp9Abbbaladfglaga8Ja8KpmwKDYq8AkEx3m5P8Es8Fg8Ja8Ma8NpmwKDYq8AkEx3m5P8Es8Fg8KpmbezHdiOAlvCXorQLg8Ecep9Ta8Ea8Fp9op9Hp9rg8Ep9Uggp9Abbbaladfglaga8Ea8Epmlvorlvorlvorlvorp9Uggp9Abbbaladfglaga8Ea8EpmwDqkwDqkwDqkwDqkp9Uggp9Abbbaladfglaga8Ea8EpmxmPsxmPsxmPsxmPsp9Uggp9Abbbaladfglaga8Ja8KpmwDKYqk8AExm35Ps8E8Fg8Ecep9Ta8Ea8Fp9op9Hp9rg8Ep9Ug8Fp9Abbbaladfgla8Fa8Ea8Epmlvorlvorlvorlvorp9Ug8Fp9Abbbaladfgla8Fa8Ea8EpmwDqkwDqkwDqkwDqkp9Ug8Fp9Abbbaladfgla8Fa8Ea8EpmxmPsxmPsxmPsxmPsp9Uggp9AbbbaladfhlaoczfgoaX6mbxikkaXTmeavcjdfaYfhlavaYfpbdbhgcbhoinalavcj;cbfaofpblbg8JaKaofpblbg8KpmbzeHdOiAlCvXoQrLg8LaQaofpblbg8MaLaofpblbg8NpmbzeHdOiAlCvXoQrLgypmbezHdiOAlvCXorQLg8Ecep:nea8Epxebebebebebebebebg8Fp9op:bep9rg8Eagp:oeggp9Abbbaladfglaga8Ea8Epmlvorlvorlvorlvorp:oeggp9Abbbaladfglaga8Ea8EpmwDqkwDqkwDqkwDqkp:oeggp9Abbbaladfglaga8Ea8EpmxmPsxmPsxmPsxmPsp:oeggp9Abbbaladfglaga8LaypmwDKYqk8AExm35Ps8E8Fg8Ecep:nea8Ea8Fp9op:bep9rg8Ep:oeggp9Abbbaladfglaga8Ea8Epmlvorlvorlvorlvorp:oeggp9Abbbaladfglaga8Ea8EpmwDqkwDqkwDqkwDqkp:oeggp9Abbbaladfglaga8Ea8EpmxmPsxmPsxmPsxmPsp:oeggp9Abbbaladfglaga8Ja8KpmwKDYq8AkEx3m5P8Es8Fg8Ja8Ma8NpmwKDYq8AkEx3m5P8Es8Fg8KpmbezHdiOAlvCXorQLg8Ecep:nea8Ea8Fp9op:bep9rg8Ep:oeggp9Abbbaladfglaga8Ea8Epmlvorlvorlvorlvorp:oeggp9Abbbaladfglaga8Ea8EpmwDqkwDqkwDqkwDqkp:oeggp9Abbbaladfglaga8Ea8EpmxmPsxmPsxmPsxmPsp:oeggp9Abbbaladfglaga8Ja8KpmwDKYqk8AExm35Ps8E8Fg8Ecep:nea8Ea8Fp9op:bep9rg8Ep:oeg8Fp9Abbbaladfgla8Fa8Ea8Epmlvorlvorlvorlvorp:oeg8Fp9Abbbaladfgla8Fa8Ea8EpmwDqkwDqkwDqkwDqkp:oeg8Fp9Abbbaladfgla8Fa8Ea8EpmxmPsxmPsxmPsxmPsp:oeggp9AbbbaladfhlaoczfgoaX6mbxdkkaXTmbcbhocbalcl4gl9Rc8FGhiavcjdfaYfhravaYfpbdbh8Finaravcj;cbfaofpblbggaKaofpblbg8JpmbzeHdOiAlCvXoQrLg8KaQaofpblbg8LaLaofpblbg8MpmbzeHdOiAlCvXoQrLg8NpmbezHdiOAlvCXorQLg8Eaip:Rea8Ealp:Sep9qg8Ea8Fp9rg8Fp9Abbbaradfgra8Fa8Ea8Epmlvorlvorlvorlvorp9rg8Fp9Abbbaradfgra8Fa8Ea8EpmwDqkwDqkwDqkwDqkp9rg8Fp9Abbbaradfgra8Fa8Ea8EpmxmPsxmPsxmPsxmPsp9rg8Fp9Abbbaradfgra8Fa8Ka8NpmwDKYqk8AExm35Ps8E8Fg8Eaip:Rea8Ealp:Sep9qg8Ep9rg8Fp9Abbbaradfgra8Fa8Ea8Epmlvorlvorlvorlvorp9rg8Fp9Abbbaradfgra8Fa8Ea8EpmwDqkwDqkwDqkwDqkp9rg8Fp9Abbbaradfgra8Fa8Ea8EpmxmPsxmPsxmPsxmPsp9rg8Fp9Abbbaradfgra8Faga8JpmwKDYq8AkEx3m5P8Es8Fgga8La8MpmwKDYq8AkEx3m5P8Es8Fg8JpmbezHdiOAlvCXorQLg8Eaip:Rea8Ealp:Sep9qg8Ep9rg8Fp9Abbbaradfgra8Fa8Ea8Epmlvorlvorlvorlvorp9rg8Fp9Abbbaradfgra8Fa8Ea8EpmwDqkwDqkwDqkwDqkp9rg8Fp9Abbbaradfgra8Fa8Ea8EpmxmPsxmPsxmPsxmPsp9rg8Fp9Abbbaradfgra8Faga8JpmwDKYqk8AExm35Ps8E8Fg8Eaip:Rea8Ealp:Sep9qg8Ep9rg8Fp9Abbbaradfgra8Fa8Ea8Epmlvorlvorlvorlvorp9rg8Fp9Abbbaradfgra8Fa8Ea8EpmwDqkwDqkwDqkwDqkp9rg8Fp9Abbbaradfgra8Fa8Ea8EpmxmPsxmPsxmPsxmPsp9rg8Fp9AbbbaradfhraoczfgoaX6mbkkaYclfgYad6mbkaHavcjdfaAad2;8qbbavavcjdfaAcufad2fad;8qbbaAazfhzc9:hoaOhxaOmbxlkkaeTmbaDalfhrcbhocuhlinaralaD9RglfaD6mdaPaeao9RaoaPfae6Eaofgoae6mbkaial9Rhxkcbc99amax9RakSEhoxekc9:hokavcj;kbf8Kjjjjbaokwbz:bjjjbk:TseHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhldnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhoindnalaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfaoaDcu7gPcl4fcsGcitfgsydlhzasydbhHdndnaDcsGgsak9pmbavaiaPfcsGcdtfydbaxasEhDaxasTgOfhxxekdndnascsSmbcehOasc987asamffcefhDxekalcefhDal8SbbgscFeGhPdndnascu9mmbaDhlxekalcvfhlaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhlkcehOaPce4cbaPceG9R7amfhDkaDhmkavc;abfaocitfgsaDBdbasazBdlavaicdtfaDBdbavc;abfaocefcsGcitfgsaHBdbasaDBdlaocdfhoaOaifhidnadcd9hmbabarcetfgsaH87ebasclfaD87ebascdfaz87ebxdkabarcdtfgsaHBdbascwfaDBdbasclfazBdbxekdnaDcpe0mbaxcefgOavaiaqaDcsGfRbbgscl49RcsGcdtfydbascz6gPEhDavaias9RcsGcdtfydbaOaPfgzascsGgOEhsaOThOdndnadcd9hmbabarcetfgHax87ebaHclfas87ebaHcdfaD87ebxekabarcdtfgHaxBdbaHcwfasBdbaHclfaDBdbkavaicdtfaxBdbavc;abfaocitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfaocefcsGcitfgHasBdbaHaDBdlavaiaPfgicsGcdtfasBdbavc;abfaocdfcsGcitfgDaxBdbaDasBdlaocifhoaiaOfhiazaOfhxxekaxcbalRbbgHEgAaDc;:eSgDfhzaHcsGhCaHcl4hXdndnaHcs0mbazcefhOxekazhOavaiaX9RcsGcdtfydbhzkdndnaCmbaOcefhxxekaOhxavaiaH9RcsGcdtfydbhOkdndnaDTmbalcefhDxekalcdfhDal8SbegPcFeGhsdnaPcu9kmbalcofhAascFbGhscrhldninaD8SbbgPcFbGaltasVhsaPcu9kmeaDcefhDalcrfglc8J9hmbkaAhDxekaDcefhDkasce4cbasceG9R7amfgmhAkdndnaXcsSmbaDhsxekaDcefhsaD8SbbglcFeGhPdnalcu9kmbaDcvfhzaPcFbGhPcrhldninas8SbbgDcFbGaltaPVhPaDcu9kmeascefhsalcrfglc8J9hmbkazhsxekascefhskaPce4cbaPceG9R7amfgmhzkdndnaCcsSmbashlxekascefhlas8SbbgDcFeGhPdnaDcu9kmbascvfhOaPcFbGhPcrhDdninal8SbbgscFbGaDtaPVhPascu9kmealcefhlaDcrfgDc8J9hmbkaOhlxekalcefhlkaPce4cbaPceG9R7amfgmhOkdndnadcd9hmbabarcetfgDaA87ebaDclfaO87ebaDcdfaz87ebxekabarcdtfgDaABdbaDcwfaOBdbaDclfazBdbkavc;abfaocitfgDazBdbaDaABdlavaicdtfaABdbavc;abfaocefcsGcitfgDaOBdbaDazBdlavaicefgicsGcdtfazBdbavc;abfaocdfcsGcitfgDaABdbaDaOBdlavaiaHcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhiaocifhokawcefhwaocsGhoaicsGhiarcifgrae6mbkkcbc99alaqSEhokavc;aef8Kjjjjbaok:clevu8Jjjjjbcz9Rhvdnaecvfal9nmbc9:skdnaiRbbc;:eGc;qeSmbcuskav9cb83iwaicefhoaialfc98fhrdnaeTmbdnadcdSmbcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcdtfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgiBdbalaiBdbawcefgwae9hmbxdkkcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcetfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgi87ebalaiBdbawcefgwae9hmbkkcbc99aoarSEk:2Pliur97eue978Jjjjjbc8W9Rhiaec98Ghldndnadcl9hmbdnalTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalaeSmeaipxbbbbbbbbbbbbbbbbgqpklbaiabalcdtfgdaeciGglcdtgv;8qbbdnalTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDaqp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkadaiav;8qbbskaipxFubbFubbFubbFubbgxpklbdnalTmbcbhvabhdinadczfgmampbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmbediwDqkzHOAKY8AEgwczp:Reczp:Sep;6egraipblbaDaopmlvorxmPsCXQL358E8Fp9op;6eawczp:Sep;6egwp;Gearp;Gep;Kep;Legopxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgPp9op9rp;Kegrpxb;:FSb;:FSb;:FSb;:FSararp;Meaoaop;MeawaqawaPp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFFbbFFbbFFbbFFbbp9oaoawp;Meaqp;Keczp:Rep9qgoarawp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogrpmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oaoarpmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgval6mbkkalaeSmbaiczfpxbbbbbbbbbbbbbbbbgopklbaiaopklbaiabalcitfgdaeciGglcitgv;8qbbaiaxpkladnalTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmbediwDqkzHOAKY8AEgwczp:Reczp:Sep;6egraipblaaDaopmlvorxmPsCXQL358E8Fp9op;6eawczp:Sep;6egwp;Gearp;Gep;Kep;Legopxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgPp9op9rp;Kegrpxb;:FSb;:FSb;:FSb;:FSararp;Meaoaop;MeawaqawaPp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFFbbFFbbFFbbFFbbp9oaoawp;Meaqp;Keczp:Rep9qgoarawp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogrpmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oaoarpmbezHdiOAlvCXorQLp9qpklbkadaiav;8qbbkk:Iwllue97euo978Jjjjjbca9Rhidnaec98GglTmbcbhvabhoinaocKfpx:ji:1S:ji:1S:ji:1S:ji:1SaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkpxibbbibbbibbbibbbp9qgxp;6ep;Negmaxaxp:1ep;7egxaxp;KearaDpmbediwDqkzHOAKY8AEgxczp:Reczp:Sep;6egrarp;Meaxczp:Sep;6egDaDp;Meaqczp:Reczp:Sep;6egqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jep;Mepxbbn0bbn0bbn0bbn0gxp;KepxFFbbFFbbFFbbFFbbgPp9oamaDp;Meaxp;Keczp:Rep9qgDamarp;Meaxp;KeaPp9oamaqp;Meaxp;Keczp:Rep9qgxpmwDKYqk8AExm35Ps8E8Fgrp5eakclp:RegmpEi:T:j83ibawarp5bampEd:T:j83ibaocwfaDaxpmbezHdiOAlvCXorQLgxp5eampEe:T:j83ibaoaxp5bampEb:T:j83ibaocafhoavclfgval6mbkkdnalaeSmbaiczfpxbbbbbbbbbbbbbbbbgmpklbaiampklbaiabalcitfgoaeciGgvcitgw;8qbbdnavTmbaipx:ji:1S:ji:1S:ji:1S:ji:1SaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkpxibbbibbbibbbibbbp9qgxp;6ep;Negmaxaxp:1ep;7egxaxp;KearaDpmbediwDqkzHOAKY8AEgxczp:Reczp:Sep;6egrarp;Meaxczp:Sep;6egDaDp;Meaqczp:Reczp:Sep;6egqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jep;Mepxbbn0bbn0bbn0bbn0gxp;KepxFFbbFFbbFFbbFFbbgPp9oamaDp;Meaxp;Keczp:Rep9qgDamarp;Meaxp;KeaPp9oamaqp;Meaxp;Keczp:Rep9qgxpmwDKYqk8AExm35Ps8E8Fgrp5eakclp:RegmpEi:T:j83iKaiarp5bampEd:T:j83izaiaDaxpmbezHdiOAlvCXorQLgxp5eampEe:T:j83iwaiaxp5bampEb:T:j83ibkaoaiaw;8qbbkk;uddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbheabhdinadadpbbbgocwp:Recwp:Sep;6eaocep:SepxbbjFbbjFbbjFbbjFp9opxbbjZbbjZbbjZbbjZp:Uep;Mepkbbadczfhdaeclfgeav6mbkkdnavalSmbaic8WfpxbbbbbbbbbbbbbbbbgopklbaicafaopklbaiczfaopklbaiaopklbaiabavcdtfgdalciGgecdtgv;8qbbdnaeTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjFbbjFbbjFbbjFp9opxbbjZbbjZbbjZbbjZp:Uep;Mepklbkadaiav;8qbbkk:CPvdue97euw97eu8Jjjjjbc8W9Rhiaec98Ghldndnadcl9hmbaipxbbbbbbbbbbbbbbbbgvpklbdnalTmbcbhoabhdinadpbbbhradpxbbuJbbuJbbuJbbuJaipblbarcKp:Tep9qgwcep:Seawp9qgDcdp:SeaDp9qgDclp:SeaDp9qgqp;6ep;NegDarcwp:RecKp:SegkarpxFbbbFbbbFbbbFbbbgxp9ogmp:Uep;6ep;Mepxbbn0bbn0bbn0bbn0gPp;Kecwp:RepxbFbbbFbbbFbbbFbbp9oaDamakp:Xearczp:RecKp:Segrp:Uep;6ep;MeaPp;Keaxp9op9qaDamakarp:Uep:Xep;6ep;MeaPp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qaDaqawcep:Rep9oawpxebbbebbbebbbebbbp9op9qp;6ep;MeaPp;KecKp:Rep9qpkbbadczfhdaoclfgoal6mbkkalaeSmeaiavpklaaicafabalcdtfgdaeciGglcdtgo;8qbbaiavpklbdnalTmbaipblahraipxbbuJbbuJbbuJbbuJaipblbarcKp:Tep9qgwcep:Seawp9qgDcdp:SeaDp9qgDclp:SeaDp9qgqp;6ep;NegDarcwp:RecKp:SegkarpxFbbbFbbbFbbbFbbbgxp9ogmp:Uep;6ep;Mepxbbn0bbn0bbn0bbn0gPp;Kecwp:RepxbFbbbFbbbFbbbFbbp9oaDamakp:Xearczp:RecKp:Segrp:Uep;6ep;MeaPp;Keaxp9op9qaDamakarp:Uep:Xep;6ep;MeaPp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qaDaqawcep:Rep9oawpxebbbebbbebbbebbbp9op9qp;6ep;MeaPp;KecKp:Rep9qpklakadaicafao;8qbbskaipxbbbbbbbbbbbbbbbbgvpklbdnalTmbcbhoabhdinadczfgspxbFu9hbFu9hbFu9hbFu9hadpbbbgDaspbbbgPpmlvorxmPsCXQL358E8Fgmczp:Teaipblbp9qgrcep:Searp9qgwcdp:Seawp9qgwclp:Seawp9qgwcwp:Seawp9qgqp;6ep;NegwaDaPpmbediwDqkzHOAKY8AEgDpxFFbbFFbbFFbbFFbbgPp9ogkaDczp:Segxp:Ueamczp:Reczp:Segmp:Xep;6ep;Mepxbbn0bbn0bbn0bbn0gDp;KeaPp9oawakaxamp:Uep:Xep;6ep;MeaDp;Keczp:Rep9qgxawaqarcep:Rep9oarpxebbbebbbebbbebbbp9op9qp;6ep;MeaDp;Keczp:Reawamakp:Uep;6ep;MeaDp;KeaPp9op9qgrpmwDKYqk8AExm35Ps8E8FpkbbadaxarpmbezHdiOAlvCXorQLpkbbadcafhdaoclfgoal6mbkkalaeSmbaiczfpxbbbbbbbbbbbbbbbbgrpklbaiarpklbaiabalcitfgdaeciGglcitgo;8qbbaiavpkladnalTmbaipxbFu9hbFu9hbFu9hbFu9haipblbgDaipblzgPpmlvorxmPsCXQL358E8Fgmczp:Teaipblap9qgrcep:Searp9qgwcdp:Seawp9qgwclp:Seawp9qgwcwp:Seawp9qgqp;6ep;NegwaDaPpmbediwDqkzHOAKY8AEgDpxFFbbFFbbFFbbFFbbgPp9ogkaDczp:Segxp:Ueamczp:Reczp:Segmp:Xep;6ep;Mepxbbn0bbn0bbn0bbn0gDp;KeaPp9oawakaxamp:Uep:Xep;6ep;MeaDp;Keczp:Rep9qgxawaqarcep:Rep9oarpxebbbebbbebbbebbbp9op9qp;6ep;MeaDp;Keczp:Reawamakp:Uep;6ep;MeaDp;KeaPp9op9qgrpmwDKYqk8AExm35Ps8E8FpklzaiaxarpmbezHdiOAlvCXorQLpklbkadaiao;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz:Dbb
4595",t=new 
vendor: 4,250 bytes, line 4595
4595Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),n=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if(typeof WebAssembly!="object")return{supported:!1};var i=WebAssembly.validate(t)?o(e):o(r),s,a=WebAssembly.instantiate(i,{}).then(function(g){s=g.instance,s.exports.__wasm_call_ctors()});function o(g){for(var b=new Uint8Array(g.length),x=0;x<g.length;++x){var _=g.charCodeAt(x);b[x]=_>96?_-97:_>64?_-39:_+4}for(var v=0,x=0;x<g.length;++x)b[v++]=b[x]<60?n[b[x]]:(b[x]-60)*64+b[++x];return b.buffer.slice(0,v)}function c(g,b,x,_,v,C,I){var E=g.exports.sbrk,S=_+3&-4,P=E(S*v),w=E(C.length),L=new Uint8Array(g.exports.memory.buffer);L.set(C,w);var N=b(P,_,v,w,C.length);if(N==0&&I&&I(P,S,v),x.set(L.subarray(P,P+_*v)),E(P-E(0)),N!=0)throw new Error("Malformed buffer data: "+N)}var l={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp",COLOR:"meshopt_decodeFilterColor"},h={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},u=[],d=0;function f(g){var b={object:new Worker(g),pending:0,requests:{}};return b.object.onmessage=function(x){var _=x.data;b.pending-=_.count,b.requests[_.id][_.action](_.value),delete b.requests[_.id]},b}function p(g){for(var b="self.ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(i)+"]), {}).then(function(result) { result.instance.exports.__wasm_call_ctors(); return result.instance; });self.onmessage = "+A.name+";"+c.toString()+A.toString(),x=new Blob([b],{type:"text/javascript"}),_=URL.createObjectURL(x),v=u.length;v<g;++v)u[v]=f(_);for(var v=g;v<u.length;++v)u[v].object.postMessage({});u.length=g,URL.revokeObjectURL(_)}function m(g,b,x,_,v){for(var C=u[0],I=1;I<u.length;++I)u[I].pending<C.pending&&(C=u[I]);return new Promise(function(E,S){var P=new Uint8Array(x),w=++d;C.pending+=g,C.requests[w]={resolve:E,reject:S},C.object.postMessage({id:w,count:g,size:b,source:P,mode:_,filter:v},[P.buffer])})}function A(g){var b=g.data;if(!b.id)return self.close();self.ready.then(function(x){try{var _=new Uint8Array(b.count*b.size);c(x,x.exports[b.mode],_,b.count,b.size,b.source,x.exports[b.filter]),self.postMessage({id:b.id,count:b.count,action:"resolve",value:_},[_.buffer])}catch(v){self.postMessage({id:b.id,count:b.count,action:"reject",value:v})}})}return{ready:a,supported:!0,useWorkers:function(g){p(g)},decodeVertexBuffer:function(g,b,x,_,v){c(s,s.exports.meshopt_decodeVertexBuffer,g,b,x,_,s.exports[l[v]])},decodeIndexBuffer:function(g,b,x,_){c(s,s.exports.meshopt_decodeIndexBuffer,g,b,x,_)},decodeIndexSequence:function(g,b,x,_){c(s,s.exports.meshopt_decodeIndexSequence,g,b,x,_)},decodeGltfBuffer:function(g,b,x,_,v,C){c(s,s.exports[h[v]],g,b,x,_,s.exports[l[C]])},decodeGltfBufferAsync:function(g,b,x,_,v){return u.length>0?m(g,b,x,h[_],l[v]):a.then(function(){var C=new Uint8Array(g*b);return c(s,s.exports[h[_]],C,g,b,x,s.exports[l[v]]),C})}}})();const iu=new WeakMap;class cT extends _i{constructor(e){super(e),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,n,i){const s=new Wi(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,a=>{this.parse(a,t,i)},n,i)}parse(e,t,n=()=>{}){this.decodeDracoFile(e,t,null,null,mt,n).catch(n)}decodeDracoFile(e,t,n,i,s=Ct,a=()=>{}){const o={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!n,vertexColorSpace:s};
vendor: 4,336 bytes, lines 4595-4596
4595return this.decodeGeometry(e,o).then(t).catch(a)}decodeGeometry(e,t){const n=JSON.stringify(t);if(iu.has(e)){const c=iu.get(e);if(c.key===n)return c.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let i;const s=this.workerNextTaskID++,a=e.byteLength,o=this._getWorker(s,a).then(c=>(i=c,new Promise((l,h)=>{i._callbacks[s]={resolve:l,reject:h},i.postMessage({type:"decode",id:s,taskConfig:t,buffer:e},[e])}))).then(c=>this._createGeometry(c.geometry));return o.catch(()=>!0).then(()=>{i&&s&&this._releaseTask(i,s)}),iu.set(e,{key:n,promise:o}),o}_createGeometry(e){const t=new cn;e.index&&t.setIndex(new Lt(e.index.array,1));for(let n=0;n<e.attributes.length;n++){const{name:i,array:s,itemSize:a,stride:o,vertexColorSpace:c}=e.attributes[n];let l;if(a===o)l=new Lt(s,a);else{const h=new ob(s,o);l=new ih(h,a,0)}i==="color"&&(this._assignVertexColorSpace(l,c),l.normalized=!(s instanceof Float32Array)),t.setAttribute(i,l)}return t}_assignVertexColorSpace(e,t){if(t!==mt)return;const n=new Me;for(let i=0,s=e.count;i<s;i++)n.fromBufferAttribute(e,i),tt.colorSpaceToWorking(n,mt),e.setXYZ(i,n.r,n.g,n.b)}_loadLibrary(e,t){const n=new Wi(this.manager);return n.setPath(this.decoderPath),n.setResponseType(t),n.setWithCredentials(this.withCredentials),new Promise((i,s)=>{n.load(e,i,void 0,s)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",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(n=>{const i=n[0];e||(this.decoderConfig.wasmBinary=n[1]);const s=lT.toString(),a=["/* draco decoder */",i,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join(`
4596`);this.workerSourceURL=URL.createObjectURL(new Blob([a]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const i=new Worker(this.workerSourceURL);i._callbacks={},i._taskCosts={},i._taskLoad=0,i.postMessage({type:"init",decoderConfig:this.decoderConfig}),i.onmessage=function(s){const a=s.data;switch(a.type){case"decode":i._callbacks[a.id].resolve(a);break;case"error":i._callbacks[a.id].reject(a);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+a.type+'"')}},this.workerPool.push(i)}else this.workerPool.sort(function(i,s){return i._taskLoad>s._taskLoad?-1:1});const n=this.workerPool[this.workerPool.length-1];return n._taskCosts[e]=t,n._taskLoad+=t,n})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,this.workerSourceURL!==""&&URL.revokeObjectURL(this.workerSourceURL),this}}function lT(){let r,e;onmessage=function(a){const o=a.data;switch(o.type){case"init":r=o.decoderConfig,e=new Promise(function(h){r.onModuleLoaded=function(u){h({draco:u})},DracoDecoderModule(r)});break;case"decode":const c=o.buffer,l=o.taskConfig;e.then(h=>{const u=h.draco,d=new u.Decoder;try{const f=t(u,d,new Int8Array(c),l),p=f.attributes.map(m=>m.array.buffer);f.index&&p.push(f.index.array.buffer),self.postMessage({type:"decode",id:o.id,geometry:f},p)}catch(f){console.error(f),self.postMessage({type:"error",id:o.id,error:f.message})}finally{u.destroy(d)}});break}};function t(a,o,c,l){const h=l.attributeIDs,u=l.attributeTypes;let d,f;const p=o.GetEncodedGeometryType(c);if(p===a.TRIANGULAR_MESH)d=new a.Mesh,f=o.DecodeArrayToMesh(c,c.byteLength,d);else if(p===a.POINT_CLOUD)d=new a.PointCloud,f=o.DecodeArrayToPointCloud(c,c.byteLength,d);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!f.ok()||d.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+f.error_msg());const m={index:null,attributes:[]};for(const A in h){const g=self[u[A]];let b,x;if(l.useUniqueIDs)x=h[A],b=o.GetAttributeByUniqueId(d,x);else{if(x=o.GetAttributeId(d,a[h[A]]),x===-1)continue;b=o.GetAttribute(d,x)}const _=i(a,o,d,A,g,b);
4596A==="color"&&(_.vertexColorSpace=l.vertexColorSpace),m.attributes.push(_)}return p===a.TRIANGULAR_MESH&&(m.index=n(a,o,d)),a.destroy(d),m}function n(a,o,c){const h=c.num_faces()*3,u=h*4,d=a._malloc(u);o.GetTrianglesUInt32Array(c,u,d);const f=new Uint32Array(a.HEAPF32.buffer,d,h).slice();return a._free(d),{array:f,itemSize:1}}function i(a,o,c,l,h,u){const d=c.num_points(),f=u.num_components(),p=s(a,h),m=f*h.BYTES_PER_ELEMENT,A=Math.ceil(m/4)*4,g=A/h.BYTES_PER_ELEMENT,b=d*m,x=d*A,_=a._malloc(b);o.GetAttributeDataArrayForAllPoints(c,u,p,b,_);const v=new h(a.HEAPF32.buffer,_,b/h.BYTES_PER_ELEMENT);let C;if(m===A)C=v.slice();else{C=new h(x/h.BYTES_PER_ELEMENT);let I=0;for(let E=0,S=v.length;E<S;E++){for(let P=0;P<f;P++)C[I+P]=v[E*f+P];I+=g}}return a._free(_),{name:l,count:d,itemSize:f,array:C,stride:g}}function s(a,o){switch(o){case Float32Array:return a.DT_FLOAT32;case Int8Array:return a.DT_INT8;case Int16Array:return a.DT_INT16;case Int32Array:return a.DT_INT32;case Uint8Array:return a.DT_UINT8;case Uint16Array:return a.DT_UINT16;case Uint32Array:return a.DT_UINT32}}}function eg(r,e){if(e===C_)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),r;if(e===jd||e===J0){let t=r.getIndex();if(t===null){const a=[],o=r.getAttribute("position");if(o!==void 0){for(let c=0;c<o.count;c++)a.push(c);r.setIndex(a),t=r.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),r}const n=t.count-2,i=[];if(e===jd)for(let a=1;a<=n;a++)i.push(t.getX(0)),i.push(t.getX(a)),i.push(t.getX(a+1));else for(let a=0;a<n;a++)a%2===0?(i.push(t.getX(a)),i.push(t.getX(a+1)),i.push(t.getX(a+2))):(i.push(t.getX(a+2)),i.push(t.getX(a+1)),i.push(t.getX(a)));i.length/3!==n&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const s=r.clone();return s.setIndex(i),s.clearGroups(),s}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",e),r}function Hb(r){const e=new Map,t=new Map,n=r.clone();return zb(r,n,function(i,s){e.set(s,i),t.set(i,s)}),n.traverse(function(i){if(!i.isSkinnedMesh)return;const s=i,a=e.get(i),o=a.skeleton.bones;s.skeleton=a.skeleton.clone(),s.bindMatrix.copy(a.bindMatrix),s.skeleton.bones=o.map(function(c){return t.get(c)}),s.bind(s.skeleton,s.bindMatrix)}),n}function zb(r,e,t){t(r,e);for(let n=0;n<r.children.length;n++)zb(r.children[n],e.children[n],t)}class hT extends _i{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(t){return new AT(t)}),this.register(function(t){return new gT(t)}),this.register(function(t){return new CT(t)}),this.register(function(t){return new MT(t)}),this.register(function(t){return new IT(t)}),this.register(function(t){return new bT(t)}),this.register(function(t){return new xT(t)}),this.register(function(t){return new ET(t)}),this.register(function(t){return new _T(t)}),this.register(function(t){return new pT(t)}),this.register(function(t){return new vT(t)}),this.register(function(t){return new mT(t)}),this.register(function(t){return new ST(t)}),this.register(function(t){return new yT(t)}),this.register(function(t){return new dT(t)}),this.register(function(t){return new tg(t,Je.EXT_MESHOPT_COMPRESSION)}),this.register(function(t){return new tg(t,Je.KHR_MESHOPT_COMPRESSION)}),this.register(function(t){return new wT(t)})}load(e,t,n,i){const s=this;let a;if(this.resourcePath!=="")a=this.resourcePath;else if(this.path!==""){const l=vo.extractUrlBase(e);a=vo.resolveURL(l,this.path)}else a=vo.extractUrlBase(e);this.manager.itemStart(e);const o=function(l){i?i(l):console.error(l),s.manager.itemError(e),s.manager.itemEnd(e)},c=new Wi(this.manager);c.setPath(this.path),c.setResponseType("arraybuffer"),c.setRequestHeader(this.requestHeader),c.setWithCredentials(this.withCredentials),c.load(e,function(l){try{s.parse(l,a,function(h){t(h),s.manager.itemEnd(e)},o)}catch(h){o(h)}},n,o)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,i){let s;const a={},o={},c=new TextDecoder;if(typeof e=="string")s=JSON.parse(e);else if(e instanceof ArrayBuffer)if(c.decode(new Uint8Array(e,0,4))===Vb){try{a[Je.KHR_BINARY_GLTF]=new TT(e)}catch(u){i&&i(u);return}s=JSON.parse(a[Je.KHR_BINARY_GLTF].content)}else s=JSON.parse(c.decode(e));else s=e;if(s.asset===void 0||s.asset.version[0]<2){i&&i(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const l=new HT(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});l.fileLoader.setRequestHeader(this.requestHeader);for(let h=0;h<this.pluginCallbacks.length;h++){const u=this.pluginCallbacks[h](l);u.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),o[u.name]=u,a[u.name]=!0}if(s.extensionsUsed)for(let h=0;h<s.extensionsUsed.length;++h){const u=s.extensionsUsed[h],d=s.extensionsRequired||[];
vendor: 34,638 bytes, line 4596
4596switch(u){case Je.KHR_MATERIALS_UNLIT:a[u]=new fT;break;case Je.KHR_DRACO_MESH_COMPRESSION:a[u]=new RT(s,this.dracoLoader);break;case Je.KHR_TEXTURE_TRANSFORM:a[u]=new BT;break;case Je.KHR_MESH_QUANTIZATION:a[u]=new DT;break;default:d.indexOf(u)>=0&&o[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}l.setExtensions(a),l.setPlugins(o),l.parse(n,i)}parseAsync(e,t){const n=this;return new Promise(function(i,s){n.parse(e,t,i,s)})}}function uT(){let r={};return{get:function(e){return r[e]},add:function(e,t){r[e]=t},remove:function(e){delete r[e]},removeAll:function(){r={}}}}function Ht(r,e,t){const n=r.json.materials[e];return n.extensions&&n.extensions[t]?n.extensions[t]:null}const Je={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",KHR_MESHOPT_COMPRESSION:"KHR_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class dT{constructor(e){this.parser=e,this.name=Je.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n<i;n++){const s=t[n];s.extensions&&s.extensions[this.name]&&s.extensions[this.name].light!==void 0&&e._addNodeRef(this.cache,s.extensions[this.name].light)}}_loadLight(e){const t=this.parser,n="light:"+e;let i=t.cache.get(n);if(i)return i;const s=t.json,c=((s.extensions&&s.extensions[this.name]||{}).lights||[])[e];let l;const h=new Me(16777215);c.color!==void 0&&h.setRGB(c.color[0],c.color[1],c.color[2],Ct);const u=c.range!==void 0?c.range:0;switch(c.type){case"directional":l=new Bb(h),l.target.position.set(0,0,-1),l.add(l.target);break;case"point":l=new Rb(h),l.distance=u;break;case"spot":l=new By(h),l.distance=u,c.spot=c.spot||{},c.spot.innerConeAngle=c.spot.innerConeAngle!==void 0?c.spot.innerConeAngle:0,c.spot.outerConeAngle=c.spot.outerConeAngle!==void 0?c.spot.outerConeAngle:Math.PI/4,l.angle=c.spot.outerConeAngle,l.penumbra=1-c.spot.innerConeAngle/c.spot.outerConeAngle,l.target.position.set(0,0,-1),l.add(l.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+c.type)}return l.position.set(0,0,0),ui(l,c),c.intensity!==void 0&&(l.intensity=c.intensity),l.name=t.createUniqueName(c.name||"light_"+e),i=Promise.resolve(l),t.cache.add(n,i),i}getDependency(e,t){if(e==="light")return this._loadLight(t)}createNodeAttachment(e){const t=this,n=this.parser,s=n.json.nodes[e],o=(s.extensions&&s.extensions[this.name]||{}).light;return o===void 0?null:this._loadLight(o).then(function(c){return n._getNodeRef(t.cache,o,c)})}}let fT=class{constructor(){this.name=Je.KHR_MATERIALS_UNLIT}getMaterialType(){return pn}extendParams(e,t,n){const i=[];e.color=new Me(1,1,1),e.opacity=1;const s=t.pbrMetallicRoughness;if(s){if(Array.isArray(s.baseColorFactor)){const a=s.baseColorFactor;e.color.setRGB(a[0],a[1],a[2],Ct),e.opacity=a[3]}s.baseColorTexture!==void 0&&i.push(n.assignTexture(e,"map",s.baseColorTexture,mt))}return Promise.all(i)}},pT=class{constructor(e){this.parser=e,this.name=Je.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const n=Ht(this.parser,e,this.name);return n===null||n.emissiveStrength!==void 0&&(t.emissiveIntensity=n.emissiveStrength),Promise.resolve()}},AT=class{constructor(e){this.parser=e,this.name=Je.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){return Ht(this.parser,e,this.name)!==null?Ei:null}extendMaterialParams(e,t){const n=Ht(this.parser,e,this.name);if(n===null)return Promise.resolve();const i=[];if(n.clearcoatFactor!==void 0&&(t.clearcoat=n.clearcoatFactor),n.clearcoatTexture!==void 0&&i.push(this.parser.assignTexture(t,"clearcoatMap",n.clearcoatTexture)),n.clearcoatRoughnessFactor!==void 0&&(t.clearcoatRoughness=n.clearcoatRoughnessFactor),n.clearcoatRoughnessTexture!==void 0&&i.push(this.parser.assignTexture(t,"clearcoatRoughnessMap",n.clearcoatRoughnessTexture)),n.clearcoatNormalTexture!==void 0&&(i.push(this.parser.assignTexture(t,"clearcoatNormalMap",n.clearcoatNormalTexture)),n.clearcoatNormalTexture.scale!==void 0)){const s=n.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new pe(s,s)}return Promise.all(i)}},gT=class{constructor(e){this.parser=e,this.name=Je.KHR_MATERIALS_DISPERSION}getMaterialType(e){return Ht(this.parser,e,this.name)!==null?Ei:null}extendMaterialParams(e,t){const n=Ht(this.parser,e,this.name);return n===null||(t.dispersion=n.dispersion!==void 0?n.dispersion:0),Promise.resolve()}},mT=class{constructor(e){this.parser=e,this.name=Je.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){return Ht(this.parser,e,this.name)!==null?Ei:null}extendMaterialParams(e,t){const n=Ht(this.parser,e,this.name);if(n===null)return Promise.resolve();const i=[];return n.iridescenceFactor!==void 0&&(t.iridescence=n.iridescenceFactor),n.iridescenceTexture!==void 0&&i.push(this.parser.assignTexture(t,"iridescenceMap",n.iridescenceTexture)),n.iridescenceIor!==void 0&&(t.iridescenceIOR=n.iridescenceIor),t.iridescenceThicknessRange===void 0&&(t.iridescenceThicknessRange=[100,400]),n.iridescenceThicknessMinimum!==void 0&&(t.iridescenceThicknessRange[0]=n.iridescenceThicknessMinimum),n.iridescenceThicknessMaximum!==void 0&&(t.iridescenceThicknessRange[1]=n.iridescenceThicknessMaximum),n.iridescenceThicknessTexture!==void 0&&i.push(this.parser.assignTexture(t,"iridescenceThicknessMap",n.iridescenceThicknessTexture)),Promise.all(i)}},bT=class{constructor(e){this.parser=e,this.name=Je.KHR_MATERIALS_SHEEN}getMaterialType(e){return Ht(this.parser,e,this.name)!==null?Ei:null}extendMaterialParams(e,t){const n=Ht(this.parser,e,this.name);if(n===null)return Promise.resolve();const i=[];if(t.sheenColor=new Me(0,0,0),t.sheenRoughness=0,t.sheen=1,n.sheenColorFactor!==void 0){const s=n.sheenColorFactor;t.sheenColor.setRGB(s[0],s[1],s[2],Ct)}return n.sheenRoughnessFactor!==void 0&&(t.sheenRoughness=n.sheenRoughnessFactor),n.sheenColorTexture!==void 0&&i.push(this.parser.assignTexture(t,"sheenColorMap",n.sheenColorTexture,mt)),n.sheenRoughnessTexture!==void 0&&i.push(this.parser.assignTexture(t,"sheenRoughnessMap",n.sheenRoughnessTexture)),Promise.all(i)}},xT=class{constructor(e){this.parser=e,this.name=Je.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){return Ht(this.parser,e,this.name)!==null?Ei:null}extendMaterialParams(e,t){const n=Ht(this.parser,e,this.name);if(n===null)return Promise.resolve();const i=[];return n.transmissionFactor!==void 0&&(t.transmission=n.transmissionFactor),n.transmissionTexture!==void 0&&i.push(this.parser.assignTexture(t,"transmissionMap",n.transmissionTexture)),Promise.all(i)}},ET=class{constructor(e){this.parser=e,this.name=Je.KHR_MATERIALS_VOLUME}getMaterialType(e){return Ht(this.parser,e,this.name)!==null?Ei:null}extendMaterialParams(e,t){const n=Ht(this.parser,e,this.name);if(n===null)return Promise.resolve();const i=[];t.thickness=n.thicknessFactor!==void 0?n.thicknessFactor:0,n.thicknessTexture!==void 0&&i.push(this.parser.assignTexture(t,"thicknessMap",n.thicknessTexture)),t.attenuationDistance=n.attenuationDistance||1/0;const s=n.attenuationColor||[1,1,1];return t.attenuationColor=new Me().setRGB(s[0],s[1],s[2],Ct),Promise.all(i)}},_T=class{constructor(e){this.parser=e,this.name=Je.KHR_MATERIALS_IOR}getMaterialType(e){return Ht(this.parser,e,this.name)!==null?Ei:null}extendMaterialParams(e,t){const n=Ht(this.parser,e,this.name);return n===null||(t.ior=n.ior!==void 0?n.ior:1.5),Promise.resolve()}},vT=class{constructor(e){this.parser=e,this.name=Je.KHR_MATERIALS_SPECULAR}getMaterialType(e){return Ht(this.parser,e,this.name)!==null?Ei:null}extendMaterialParams(e,t){const n=Ht(this.parser,e,this.name);if(n===null)return Promise.resolve();const i=[];t.specularIntensity=n.specularFactor!==void 0?n.specularFactor:1,n.specularTexture!==void 0&&i.push(this.parser.assignTexture(t,"specularIntensityMap",n.specularTexture));const s=n.specularColorFactor||[1,1,1];return t.specularColor=new Me().setRGB(s[0],s[1],s[2],Ct),n.specularColorTexture!==void 0&&i.push(this.parser.assignTexture(t,"specularColorMap",n.specularColorTexture,mt)),Promise.all(i)}},yT=class{constructor(e){this.parser=e,this.name=Je.EXT_MATERIALS_BUMP}getMaterialType(e){return Ht(this.parser,e,this.name)!==null?Ei:null}extendMaterialParams(e,t){const n=Ht(this.parser,e,this.name);if(n===null)return Promise.resolve();const i=[];return t.bumpScale=n.bumpFactor!==void 0?n.bumpFactor:1,n.bumpTexture!==void 0&&i.push(this.parser.assignTexture(t,"bumpMap",n.bumpTexture)),Promise.all(i)}},ST=class{constructor(e){this.parser=e,this.name=Je.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){return Ht(this.parser,e,this.name)!==null?Ei:null}extendMaterialParams(e,t){const n=Ht(this.parser,e,this.name);if(n===null)return Promise.resolve();const i=[];return n.anisotropyStrength!==void 0&&(t.anisotropy=n.anisotropyStrength),n.anisotropyRotation!==void 0&&(t.anisotropyRotation=n.anisotropyRotation),n.anisotropyTexture!==void 0&&i.push(this.parser.assignTexture(t,"anisotropyMap",n.anisotropyTexture)),Promise.all(i)}};class CT{constructor(e){this.parser=e,this.name=Je.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,n=t.json,i=n.textures[e];if(!i.extensions||!i.extensions[this.name])return null;const s=i.extensions[this.name],a=t.options.ktx2Loader;if(!a){if(n.extensionsRequired&&n.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,s.source,a)}}class MT{constructor(e){this.parser=e,this.name=Je.EXT_TEXTURE_WEBP}loadTexture(e){const t=this.name,n=this.parser,i=n.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;const a=s.extensions[t],o=i.images[a.source];let c=n.textureLoader;if(o.uri){const l=n.options.manager.getHandler(o.uri);l!==null&&(c=l)}return n.loadTextureImage(e,a.source,c)}}class IT{constructor(e){this.parser=e,this.name=Je.EXT_TEXTURE_AVIF}loadTexture(e){const t=this.name,n=this.parser,i=n.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;const a=s.extensions[t],o=i.images[a.source];let c=n.textureLoader;if(o.uri){const l=n.options.manager.getHandler(o.uri);l!==null&&(c=l)}return n.loadTextureImage(e,a.source,c)}}class tg{constructor(e,t){this.name=t,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const i=n.extensions[this.name],s=this.parser.getDependency("buffer",i.buffer),a=this.parser.options.meshoptDecoder;if(!a||!a.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(o){const c=i.byteOffset||0,l=i.byteLength||0,h=i.count,u=i.byteStride,d=new Uint8Array(o,c,l);return a.decodeGltfBufferAsync?a.decodeGltfBufferAsync(h,u,d,i.mode,i.filter).then(function(f){return f.buffer}):a.ready.then(function(){const f=new ArrayBuffer(h*u);return a.decodeGltfBuffer(new Uint8Array(f),h,u,d,i.mode,i.filter),f})})}else return null}}let wT=class{constructor(e){this.name=Je.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;const i=t.meshes[n.mesh];for(const l of i.primitives)if(l.mode!==Nn.TRIANGLES&&l.mode!==Nn.TRIANGLE_STRIP&&l.mode!==Nn.TRIANGLE_FAN&&l.mode!==void 0)return null;const a=n.extensions[this.name].attributes,o=[],c={};for(const l in a)o.push(this.parser.getDependency("accessor",a[l]).then(h=>(c[l]=h,c[l])));return o.length<1?null:(o.push(this.parser.createNodeMesh(e)),Promise.all(o).then(l=>{const h=l.pop(),u=h.isGroup?h.children:[h],d=l[0].count,f=[];for(const p of u){const m=new Oe,A=new R,g=new An,b=new R(1,1,1),x=new Sv(p.geometry,p.material,d);for(let _=0;_<d;_++)c.TRANSLATION&&A.fromBufferAttribute(c.TRANSLATION,_),c.ROTATION&&g.fromBufferAttribute(c.ROTATION,_),c.SCALE&&b.fromBufferAttribute(c.SCALE,_),x.setMatrixAt(_,m.compose(A,g,b));for(const _ in c)if(_==="_COLOR_0"){const v=c[_];x.instanceColor=new Kd(v.array,v.itemSize,v.normalized)}else _!=="TRANSLATION"&&_!=="ROTATION"&&_!=="SCALE"&&p.geometry.setAttribute(_,c[_]);ht.prototype.copy.call(x,p),this.parser.assignFinalMaterial(x),f.push(x)}return h.isGroup?(h.clear(),h.add(...f),h):f[0]}))}};const Vb="glTF",Na=12,ng={JSON:1313821514,BIN:5130562};class TT{constructor(e){this.name=Je.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,Na),n=new TextDecoder;if(this.header={magic:n.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==Vb)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-Na,s=new DataView(e,Na);let a=0;for(;a<i;){const o=s.getUint32(a,!0);a+=4;const c=s.getUint32(a,!0);if(a+=4,c===ng.JSON){const l=new Uint8Array(e,Na+a,o);this.content=n.decode(l)}else if(c===ng.BIN){const l=Na+a;this.body=e.slice(l,l+o)}a+=o}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class RT{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Je.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const n=this.json,i=this.dracoLoader,s=e.extensions[this.name].bufferView,a=e.extensions[this.name].attributes,o={},c={},l={};for(const h in a){const u=rf[h]||h.toLowerCase();o[u]=a[h]}for(const h in e.attributes){const u=rf[h]||h.toLowerCase();if(a[h]!==void 0){const d=n.accessors[e.attributes[h]],f=Zr[d.componentType];l[u]=f.name,c[u]=d.normalized===!0}}return t.getDependency("bufferView",s).then(function(h){return new Promise(function(u,d){i.decodeDracoFile(h,function(f){for(const p in f.attributes){const m=f.attributes[p],A=c[p];A!==void 0&&(m.normalized=A)}u(f)},o,l,Ct,d)})})}}class BT{constructor(){this.name=Je.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return(t.texCoord===void 0||t.texCoord===e.channel)&&t.offset===void 0&&t.rotation===void 0&&t.scale===void 0||(e=e.clone(),t.texCoord!==void 0&&(e.channel=t.texCoord),t.offset!==void 0&&e.offset.fromArray(t.offset),t.rotation!==void 0&&(e.rotation=t.rotation),t.scale!==void 0&&e.repeat.fromArray(t.scale),e.needsUpdate=!0),e}}class DT{constructor(){this.name=Je.KHR_MESH_QUANTIZATION}}class Wb extends _a{constructor(e,t,n,i){super(e,t,n,i)}copySampleValue_(e){const t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,s=e*i*3+i;for(let a=0;a!==i;a++)t[a]=n[s+a];return t}interpolate_(e,t,n,i){const s=this.resultBuffer,a=this.sampleValues,o=this.valueSize,c=o*2,l=o*3,h=i-t,u=(n-t)/h,d=u*u,f=d*u,p=e*l,m=p-l,A=-2*f+3*d,g=f-d,b=1-A,x=g-d+u;for(let _=0;_!==o;_++){const v=a[m+_+o],C=a[m+_+c]*h,I=a[p+_+o],E=a[p+_]*h;s[_]=b*v+x*C+A*I+g*E}return s}}const LT=new An;class PT extends Wb{interpolate_(e,t,n,i){const s=super.interpolate_(e,t,n,i);return LT.fromArray(s).normalize().toArray(s),s}}const Nn={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},Zr={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},ig={9728:St,9729:qe,9984:xa,9985:Ys,9986:us,9987:yn},sg={33071:Dt,33648:ir,10497:ni},su={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},rf={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"},ns={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},FT={CUBICSPLINE:void 0,LINEAR:ha,STEP:la},ru={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function NT(r){return r.DefaultMaterial===void 0&&(r.DefaultMaterial=new Ho({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:ti})),r.DefaultMaterial}function Bs(r,e,t){for(const n in t.extensions)r[n]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[n]=t.extensions[n])}function ui(r,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(r.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function UT(r,e,t){let n=!1,i=!1,s=!1;for(let l=0,h=e.length;l<h;l++){const u=e[l];if(u.POSITION!==void 0&&(n=!0),u.NORMAL!==void 0&&(i=!0),u.COLOR_0!==void 0&&(s=!0),n&&i&&s)break}if(!n&&!i&&!s)return Promise.resolve(r);const a=[],o=[],c=[];for(let l=0,h=e.length;l<h;l++){const u=e[l];if(n){const d=u.POSITION!==void 0?t.getDependency("accessor",u.POSITION):r.attributes.position;a.push(d)}if(i){const d=u.NORMAL!==void 0?t.getDependency("accessor",u.NORMAL):r.attributes.normal;o.push(d)}if(s){const d=u.COLOR_0!==void 0?t.getDependency("accessor",u.COLOR_0):r.attributes.color;c.push(d)}}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(c)]).then(function(l){const h=l[0],u=l[1],d=l[2];return n&&(r.morphAttributes.position=h),i&&(r.morphAttributes.normal=u),s&&(r.morphAttributes.color=d),r.morphTargetsRelative=!0,r})}function OT(r,e){if(r.updateMorphTargets(),e.weights!==void 0)for(let t=0,n=e.weights.length;t<n;t++)r.morphTargetInfluences[t]=e.weights[t];if(e.extras&&Array.isArray(e.extras.targetNames)){const t=e.extras.targetNames;if(r.morphTargetInfluences.length===t.length){r.morphTargetDictionary={};for(let n=0,i=t.length;n<i;n++)r.morphTargetDictionary[t[n]]=n}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function kT(r){let e;const t=r.extensions&&r.extensions[Je.KHR_DRACO_MESH_COMPRESSION];if(t?e="draco:"+t.bufferView+":"+t.indices+":"+au(t.attributes):e=r.indices+":"+au(r.attributes)+":"+r.mode,r.targets!==void 0)for(let n=0,i=r.targets.length;n<i;n++)e+=":"+au(r.targets[n]);return e}function au(r){let e="";const t=Object.keys(r).sort();for(let n=0,i=t.length;n<i;n++)e+=t[n]+":"+r[t[n]]+";";return e}function af(r){switch(r){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.")}}function QT(r){return r.search(/\.jpe?g($|\?)/i)>0||r.search(/^data\:image\/jpeg/)===0?"image/jpeg":r.search(/\.webp($|\?)/i)>0||r.search(/^data\:image\/webp/)===0?"image/webp":r.search(/\.ktx2($|\?)/i)>0||r.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const GT=new Oe;class HT{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new uT,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,i=-1,s=!1,a=-1;if(typeof navigator<"u"&&typeof navigator.userAgent<"u"){const o=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(o)===!0;const c=o.match(/Version\/(\d+)/);i=n&&c?parseInt(c[1],10):-1,s=o.indexOf("Firefox")>-1,a=s?o.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||n&&i<17||s&&a<98?this.textureLoader=new wb(this.options.manager):this.textureLoader=new Ny(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Wi(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const n=this,i=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(a){return a._markDefs&&a._markDefs()}),Promise.all(this._invokeAll(function(a){return a.beforeRoot&&a.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(a){const o={scene:a[0][i.scene||0],scenes:a[0],animations:a[1],cameras:a[2],asset:i.asset,parser:n,userData:{}};return Bs(s,o,i),ui(o,i),Promise.all(n._invokeAll(function(c){return c.afterRoot&&c.afterRoot(o)})).then(function(){for(const c of o.scenes)c.updateMatrixWorld();e(o)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let i=0,s=t.length;i<s;i++){const a=t[i].joints;for(let o=0,c=a.length;o<c;o++)e[a[o]].isBone=!0}for(let i=0,s=e.length;i<s;i++){const a=e[i];a.mesh!==void 0&&(this._addNodeRef(this.meshCache,a.mesh),a.skin!==void 0&&(n[a.mesh].isSkinnedMesh=!0)),a.camera!==void 0&&this._addNodeRef(this.cameraCache,a.camera)}}_addNodeRef(e,t){t!==void 0&&(e.refs[t]===void 0&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,n){if(e.refs[t]<=1)return n;const i=n.clone(),s=(a,o)=>{const c=this.associations.get(a);c!=null&&this.associations.set(o,c);for(const[l,h]of a.children.entries())s(h,o.children[l])};return s(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n<t.length;n++){const i=e(t[n]);if(i)return i}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const n=[];for(let i=0;i<t.length;i++){const s=e(t[i]);s&&n.push(s)}return n}getDependency(e,t){const n=e+":"+t;let i=this.cache.get(n);if(!i){switch(e){case"scene":i=this.loadScene(t);break;case"node":i=this._invokeOne(function(s){return s.loadNode&&s.loadNode(t)});break;case"mesh":i=this._invokeOne(function(s){return s.loadMesh&&s.loadMesh(t)});break;case"accessor":i=this.loadAccessor(t);break;case"bufferView":i=this._invokeOne(function(s){return s.loadBufferView&&s.loadBufferView(t)});break;case"buffer":i=this.loadBuffer(t);break;case"material":i=this._invokeOne(function(s){return s.loadMaterial&&s.loadMaterial(t)});break;case"texture":i=this._invokeOne(function(s){return s.loadTexture&&s.loadTexture(t)});break;case"skin":i=this.loadSkin(t);break;case"animation":i=this._invokeOne(function(s){return s.loadAnimation&&s.loadAnimation(t)});break;case"camera":i=this.loadCamera(t);break;default:if(i=this._invokeOne(function(s){return s!=this&&s.getDependency&&s.getDependency(e,t)}),!i)throw new Error("Unknown type: "+e);break}this.cache.add(n,i)}return i}getDependencies(e){let t=this.cache.get(e);if(!t){const n=this,i=this.json[e+(e==="mesh"?"es":"s")]||[];t=Promise.all(i.map(function(s,a){return n.getDependency(e,a)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],n=this.fileLoader;if(t.type&&t.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(t.uri===void 0&&e===0)return Promise.resolve(this.extensions[Je.KHR_BINARY_GLTF].body);const i=this.options;return new Promise(function(s,a){n.load(vo.resolveURL(t.uri,i.path),s,void 0,function(){a(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(n){const i=t.byteLength||0,s=t.byteOffset||0;return n.slice(s,s+i)})}loadAccessor(e){const t=this,n=this.json,i=this.json.accessors[e];if(i.bufferView===void 0&&i.sparse===void 0){const a=su[i.type],o=Zr[i.componentType],c=i.normalized===!0,l=new o(i.count*a);return Promise.resolve(new Lt(l,a,c))}const s=[];return i.bufferView!==void 0?s.push(this.getDependency("bufferView",i.bufferView)):s.push(null),i.sparse!==void 0&&(s.push(this.getDependency("bufferView",i.sparse.indices.bufferView)),s.push(this.getDependency("bufferView",i.sparse.values.bufferView))),Promise.all(s).then(function(a){const o=a[0],c=su[i.type],l=Zr[i.componentType],h=l.BYTES_PER_ELEMENT,u=h*c,d=i.byteOffset||0,f=i.bufferView!==void 0?n.bufferViews[i.bufferView].byteStride:void 0,p=i.normalized===!0;let m,A;if(f&&f!==u){const g=Math.floor(d/f),b="InterleavedBuffer:"+i.bufferView+":"+i.componentType+":"+g+":"+i.count;let x=t.cache.get(b);x||(m=new l(o,g*f,i.count*f/h),x=new ob(m,f/h),t.cache.add(b,x)),A=new ih(x,c,d%f/h,p)}else o===null?m=new l(i.count*c):m=new l(o,d,i.count*c),A=new Lt(m,c,p);if(i.sparse!==void 0){const g=su.SCALAR,b=Zr[i.sparse.indices.componentType],x=i.sparse.indices.byteOffset||0,_=i.sparse.values.byteOffset||0,v=new b(a[1],x,i.sparse.count*g),C=new l(a[2],_,i.sparse.count*c);o!==null&&(A=new Lt(A.array.slice(),A.itemSize,A.normalized)),A.normalized=!1;for(let I=0,E=v.length;I<E;I++){const S=v[I];if(A.setX(S,C[I*c]),c>=2&&A.setY(S,C[I*c+1]),c>=3&&A.setZ(S,C[I*c+2]),c>=4&&A.setW(S,C[I*c+3]),c>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}A.normalized=p}return A})}loadTexture(e){const t=this.json,n=this.options,s=t.textures[e].source,a=t.images[s];let o=this.textureLoader;if(a.uri){const c=n.manager.getHandler(a.uri);c!==null&&(o=c)}return this.loadTextureImage(e,s,o)}loadTextureImage(e,t,n){const i=this,s=this.json,a=s.textures[e],o=s.images[t],c=(o.uri||o.bufferView)+":"+a.sampler;if(this.textureCache[c])return this.textureCache[c];const l=this.loadImageSource(t,n).then(function(h){h.flipY=!1,h.name=a.name||o.name||"",h.name===""&&typeof o.uri=="string"&&o.uri.startsWith("data:image/")===!1&&(h.name=o.uri);const d=(s.samplers||{})[a.sampler]||{};return h.magFilter=ig[d.magFilter]||qe,h.minFilter=ig[d.minFilter]||yn,h.wrapS=sg[d.wrapS]||ni,h.wrapT=sg[d.wrapT]||ni,h.generateMipmaps=!h.isCompressedTexture&&h.minFilter!==St&&h.minFilter!==qe,i.associations.set(h,{textures:e}),h}).catch(function(){return null});return this.textureCache[c]=l,l}loadImageSource(e,t){const n=this,i=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(u=>u.clone());const a=i.images[e],o=self.URL||self.webkitURL;let c=a.uri||"",l=!1;if(a.bufferView!==void 0)c=n.getDependency("bufferView",a.bufferView).then(function(u){l=!0;const d=new Blob([u],{type:a.mimeType});return c=o.createObjectURL(d),c});else if(a.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const h=Promise.resolve(c).then(function(u){return new Promise(function(d,f){let p=d;t.isImageBitmapLoader===!0&&(p=function(m){const A=new Rt(m);A.needsUpdate=!0,d(A)}),t.load(vo.resolveURL(u,s.path),p,void 0,f)})}).then(function(u){return l===!0&&o.revokeObjectURL(c),ui(u,a),u.userData.mimeType=a.mimeType||QT(a.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",c),u});return this.sourceCache[e]=h,h}assignTexture(e,t,n,i){const s=this;return this.getDependency("texture",n.index).then(function(a){if(!a)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(a=a.clone(),a.channel=n.texCoord),s.extensions[Je.KHR_TEXTURE_TRANSFORM]){const o=n.extensions!==void 0?n.extensions[Je.KHR_TEXTURE_TRANSFORM]:void 0;if(o){const c=s.associations.get(a);a=s.extensions[Je.KHR_TEXTURE_TRANSFORM].extendTexture(a,o),s.associations.set(a,c)}}return i!==void 0&&(a.colorSpace=i),e[t]=a,a})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const i=t.attributes.tangent===void 0,s=t.attributes.color!==void 0,a=t.attributes.normal===void 0;if(e.isPoints){const o="PointsMaterial:"+n.uuid;let c=this.cache.get(o);c||(c=new hb,ei.prototype.copy.call(c,n),c.color.copy(n.color),c.map=n.map,c.sizeAttenuation=!1,this.cache.add(o,c)),n=c}else if(e.isLine){const o="LineBasicMaterial:"+n.uuid;let c=this.cache.get(o);c||(c=new lb,ei.prototype.copy.call(c,n),c.color.copy(n.color),c.map=n.map,this.cache.add(o,c)),n=c}if(i||s||a){let o="ClonedMaterial:"+n.uuid+":";i&&(o+="derivative-tangents:"),s&&(o+="vertex-colors:"),a&&(o+="flat-shading:");let c=this.cache.get(o);c||(c=n.clone(),s&&(c.vertexColors=!0),a&&(c.flatShading=!0),i&&(c.normalScale&&(c.normalScale.y*=-1),c.clearcoatNormalScale&&(c.clearcoatNormalScale.y*=-1)),this.cache.add(o,c),this.associations.set(c,this.associations.get(n))),n=c}e.material=n}getMaterialType(){return Ho}loadMaterial(e){const t=this,n=this.json,i=this.extensions,s=n.materials[e];let a;const o={},c=s.extensions||{},l=[];if(c[Je.KHR_MATERIALS_UNLIT]){const u=i[Je.KHR_MATERIALS_UNLIT];a=u.getMaterialType(),l.push(u.extendParams(o,s,t))}else{const u=s.pbrMetallicRoughness||{};if(o.color=new Me(1,1,1),o.opacity=1,Array.isArray(u.baseColorFactor)){const d=u.baseColorFactor;o.color.setRGB(d[0],d[1],d[2],Ct),o.opacity=d[3]}u.baseColorTexture!==void 0&&l.push(t.assignTexture(o,"map",u.baseColorTexture,mt)),o.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,o.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(l.push(t.assignTexture(o,"metalnessMap",u.metallicRoughnessTexture)),l.push(t.assignTexture(o,"roughnessMap",u.metallicRoughnessTexture))),a=this._invokeOne(function(d){return d.getMaterialType&&d.getMaterialType(e)}),l.push(Promise.all(this._invokeAll(function(d){return d.extendMaterialParams&&d.extendMaterialParams(e,o)})))}s.doubleSided===!0&&(o.side=qt);const h=s.alphaMode||ru.OPAQUE;if(h===ru.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,h===ru.MASK&&(o.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&a!==pn&&(l.push(t.assignTexture(o,"normalMap",s.normalTexture)),o.normalScale=new pe(1,1),s.normalTexture.scale!==void 0)){const u=s.normalTexture.scale;o.normalScale.set(u,u)}if(s.occlusionTexture!==void 0&&a!==pn&&(l.push(t.assignTexture(o,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&a!==pn){const u=s.emissiveFactor;o.emissive=new Me().setRGB(u[0],u[1],u[2],Ct)}return s.emissiveTexture!==void 0&&a!==pn&&l.push(t.assignTexture(o,"emissiveMap",s.emissiveTexture,mt)),Promise.all(l).then(function(){const u=new a(o);return s.name&&(u.name=s.name),ui(u,s),t.associations.set(u,{materials:e}),s.extensions&&Bs(i,u,s),u})}createUniqueName(e){const t=nt.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,i=this.primitiveCache;function s(o){return n[Je.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(o,t).then(function(c){return rg(c,o,t)})}const a=[];for(let o=0,c=e.length;o<c;o++){const l=e[o],h=kT(l),u=i[h];if(u)a.push(u.promise);else{let d;l.extensions&&l.extensions[Je.KHR_DRACO_MESH_COMPRESSION]?d=s(l):d=rg(new cn,l,t),i[h]={primitive:l,promise:d},a.push(d)}}return Promise.all(a)}loadMesh(e){const t=this,n=this.json,i=this.extensions,s=n.meshes[e],a=s.primitives,o=[];for(let c=0,l=a.length;c<l;c++){const h=a[c].material===void 0?NT(this.cache):this.getDependency("material",a[c].material);o.push(h)}return o.push(t.loadGeometries(a)),Promise.all(o).then(function(c){const l=c.slice(0,c.length-1),h=c[c.length-1],u=[];for(let f=0,p=h.length;f<p;f++){const m=h[f],A=a[f];let g;const b=l[f];if(A.mode===Nn.TRIANGLES||A.mode===Nn.TRIANGLE_STRIP||A.mode===Nn.TRIANGLE_FAN||A.mode===void 0)g=s.isSkinnedMesh===!0?new _v(m,b):new at(m,b),g.isSkinnedMesh===!0&&g.normalizeSkinWeights(),A.mode===Nn.TRIANGLE_STRIP?g.geometry=eg(g.geometry,J0):A.mode===Nn.TRIANGLE_FAN&&(g.geometry=eg(g.geometry,jd));else if(A.mode===Nn.LINES)g=new wv(m,b);else if(A.mode===Nn.LINE_STRIP)g=new Uo(m,b);else if(A.mode===Nn.LINE_LOOP)g=new Tv(m,b);else if(A.mode===Nn.POINTS)g=new Rv(m,b);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+A.mode);Object.keys(g.geometry.morphAttributes).length>0&&OT(g,s),g.name=t.createUniqueName(s.name||"mesh_"+e),ui(g,s),A.extensions&&Bs(i,g,A),t.assignFinalMaterial(g),u.push(g)}for(let f=0,p=u.length;f<p;f++)t.associations.set(u[f],{meshes:e,primitives:f});if(u.length===1)return s.extensions&&Bs(i,u[0],s),u[0];const d=new fs;s.extensions&&Bs(i,d,s),t.associations.set(d,{meshes:e});for(let f=0,p=u.length;f<p;f++)d.add(u[f]);return d})}loadCamera(e){let t;const n=this.json.cameras[e],i=n[n.type];if(!i){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return n.type==="perspective"?t=new Zt(Ul.radToDeg(i.yfov),i.aspectRatio||1,i.znear||1,i.zfar||2e6):n.type==="orthographic"&&(t=new cr(-i.xmag,i.xmag,i.ymag,-i.ymag,i.znear,i.zfar)),n.name&&(t.name=this.createUniqueName(n.name)),ui(t,n),Promise.resolve(t)}loadSkin(e){const t=this.json.skins[e],n=[];for(let i=0,s=t.joints.length;i<s;i++)n.push(this._loadNodeShallow(t.joints[i]));return t.inverseBindMatrices!==void 0?n.push(this.getDependency("accessor",t.inverseBindMatrices)):n.push(null),Promise.all(n).then(function(i){const s=i.pop(),a=i,o=[],c=[];for(let l=0,h=a.length;l<h;l++){const u=a[l];if(u){o.push(u);const d=new Oe;s!==null&&d.fromArray(s.array,l*16),c.push(d)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[l])}return new Hf(o,c)})}loadAnimation(e){const t=this.json,n=this,i=t.animations[e],s=i.name?i.name:"animation_"+e,a=[],o=[],c=[],l=[],h=[];for(let u=0,d=i.channels.length;u<d;u++){const f=i.channels[u],p=i.samplers[f.sampler],m=f.target,A=m.node,g=i.parameters!==void 0?i.parameters[p.input]:p.input,b=i.parameters!==void 0?i.parameters[p.output]:p.output;m.node!==void 0&&(a.push(this.getDependency("node",A)),o.push(this.getDependency("accessor",g)),c.push(this.getDependency("accessor",b)),l.push(p),h.push(m))}return Promise.all([Promise.all(a),Promise.all(o),Promise.all(c),Promise.all(l),Promise.all(h)]).then(function(u){const d=u[0],f=u[1],p=u[2],m=u[3],A=u[4],g=[];for(let x=0,_=d.length;x<_;x++){const v=d[x],C=f[x],I=p[x],E=m[x],S=A[x];if(v===void 0)continue;v.updateMatrix&&v.updateMatrix();const P=n._createAnimationTracks(v,C,I,E,S);if(P)for(let w=0;w<P.length;w++)g.push(P[w])}const b=new Zd(s,void 0,g);return ui(b,i),b})}createNodeMesh(e){const t=this.json,n=this,i=t.nodes[e];return i.mesh===void 0?null:n.getDependency("mesh",i.mesh).then(function(s){const a=n._getNodeRef(n.meshCache,i.mesh,s);
4596return i.weights!==void 0&&a.traverse(function(o){if(o.isMesh)for(let c=0,l=i.weights.length;c<l;c++)o.morphTargetInfluences[c]=i.weights[c]}),a})}loadNode(e){const t=this.json,n=this,i=t.nodes[e],s=n._loadNodeShallow(e),a=[],o=i.children||[];for(let l=0,h=o.length;l<h;l++)a.push(n.getDependency("node",o[l]));const c=i.skin===void 0?Promise.resolve(null):n.getDependency("skin",i.skin);return Promise.all([s,Promise.all(a),c]).then(function(l){const h=l[0],u=l[1],d=l[2];d!==null&&h.traverse(function(f){f.isSkinnedMesh&&f.bind(d,GT)});for(let f=0,p=u.length;f<p;f++)h.add(u[f]);if(h.userData.pivot!==void 0&&u.length>0){const f=h.userData.pivot,p=u[0];h.pivot=new R().fromArray(f),h.position.x-=f[0],h.position.y-=f[1],h.position.z-=f[2],p.position.set(0,0,0),delete h.userData.pivot}return h})}_loadNodeShallow(e){const t=this.json,n=this.extensions,i=this;if(this.nodeCache[e]!==void 0)return this.nodeCache[e];const s=t.nodes[e],a=s.name?i.createUniqueName(s.name):"",o=[],c=i._invokeOne(function(l){return l.createNodeMesh&&l.createNodeMesh(e)});return c&&o.push(c),s.camera!==void 0&&o.push(i.getDependency("camera",s.camera).then(function(l){return i._getNodeRef(i.cameraCache,s.camera,l)})),i._invokeAll(function(l){return l.createNodeAttachment&&l.createNodeAttachment(e)}).forEach(function(l){o.push(l)}),this.nodeCache[e]=Promise.all(o).then(function(l){let h;if(s.isBone===!0?h=new cb:l.length>1?h=new fs:l.length===1?h=l[0]:h=new ht,h!==l[0])for(let u=0,d=l.length;u<d;u++)h.add(l[u]);if(s.name&&(h.userData.name=s.name,h.name=a),ui(h,s),s.extensions&&Bs(n,h,s),s.matrix!==void 0){const u=new Oe;u.fromArray(s.matrix),h.applyMatrix4(u)}else s.translation!==void 0&&h.position.fromArray(s.translation),s.rotation!==void 0&&h.quaternion.fromArray(s.rotation),s.scale!==void 0&&h.scale.fromArray(s.scale);if(!i.associations.has(h))i.associations.set(h,{});else if(s.mesh!==void 0&&i.meshCache.refs[s.mesh]>1){const u=i.associations.get(h);i.associations.set(h,{...u})}return i.associations.get(h).nodes=e,h}),this.nodeCache[e]}loadScene(e){const t=this.extensions,n=this.json.scenes[e],i=this,s=new fs;n.name&&(s.name=i.createUniqueName(n.name)),ui(s,n),n.extensions&&Bs(t,s,n);const a=n.nodes||[],o=[];for(let c=0,l=a.length;c<l;c++)o.push(i.getDependency("node",a[c]));return Promise.all(o).then(function(c){for(let h=0,u=c.length;h<u;h++){const d=c[h];d.parent!==null?s.add(Hb(d)):s.add(d)}const l=h=>{const u=new Map;for(const[d,f]of i.associations)(d instanceof ei||d instanceof Rt)&&u.set(d,f);return h.traverse(d=>{const f=i.associations.get(d);f!=null&&u.set(d,f)}),u};return i.associations=l(s),s})}_createAnimationTracks(e,t,n,i,s){const a=[],o=e.name?e.name:e.uuid,c=[];ns[s.path]===ns.weights?e.traverse(function(d){d.morphTargetInfluences&&c.push(d.name?d.name:d.uuid)}):c.push(o);let l;switch(ns[s.path]){case ns.weights:l=pa;break;case ns.rotation:l=Aa;break;case ns.translation:case ns.scale:l=ga;break;default:switch(n.itemSize){case 1:l=pa;break;case 2:case 3:default:l=ga;break}break}
vendor: 4,385 bytes, line 4596
4596const h=i.interpolation!==void 0?FT[i.interpolation]:ha,u=this._getArrayFromAccessor(n);for(let d=0,f=c.length;d<f;d++){const p=new l(c[d]+"."+ns[s.path],t.array,u,h);i.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(p),a.push(p)}return a}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const n=af(t.constructor),i=new Float32Array(t.length);for(let s=0,a=t.length;s<a;s++)i[s]=t[s]*n;t=i}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(n){const i=this instanceof Aa?PT:Wb;return new i(this.times,this.values,this.getValueSize()/3,n)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function zT(r,e,t){const n=e.attributes,i=new fn;if(n.POSITION!==void 0){const o=t.json.accessors[n.POSITION],c=o.min,l=o.max;if(c!==void 0&&l!==void 0){if(i.set(new R(c[0],c[1],c[2]),new R(l[0],l[1],l[2])),o.normalized){const h=af(Zr[o.componentType]);i.min.multiplyScalar(h),i.max.multiplyScalar(h)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const s=e.targets;if(s!==void 0){const o=new R,c=new R;for(let l=0,h=s.length;l<h;l++){const u=s[l];if(u.POSITION!==void 0){const d=t.json.accessors[u.POSITION],f=d.min,p=d.max;if(f!==void 0&&p!==void 0){if(c.setX(Math.max(Math.abs(f[0]),Math.abs(p[0]))),c.setY(Math.max(Math.abs(f[1]),Math.abs(p[1]))),c.setZ(Math.max(Math.abs(f[2]),Math.abs(p[2]))),d.normalized){const m=af(Zr[d.componentType]);c.multiplyScalar(m)}o.max(c)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}i.expandByVector(o)}r.boundingBox=i;const a=new Vn;i.getCenter(a.center),a.radius=i.min.distanceTo(i.max)/2,r.boundingSphere=a}function rg(r,e,t){const n=e.attributes,i=[];function s(a,o){return t.getDependency("accessor",a).then(function(c){r.setAttribute(o,c)})}for(const a in n){const o=rf[a]||a.toLowerCase();o in r.attributes||i.push(s(n[a],o))}if(e.indices!==void 0&&!r.index){const a=t.getDependency("accessor",e.indices).then(function(o){r.setIndex(o)});i.push(a)}return tt.workingColorSpace!==Ct&&"COLOR_0"in n&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${tt.workingColorSpace}" not supported.`),ui(r,e),zT(r,e,t),Promise.all(i).then(function(){return e.targets!==void 0?UT(r,e.targets,t):r})}class VT{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 n=this.workersResolve[e];if(n&&n(t),this.queue.length){const{resolve:i,msg:s,transfer:a}=this.queue.shift();this.workersResolve[e]=i,this.workers[e].postMessage(s,a)}else this.workerStatus^=1<<e}setWorkerCreator(e){this.workerCreator=e}setWorkerLimit(e){this.pool=e}postMessage(e,t){return new Promise(n=>{const i=this._getIdleWorker();i!==-1?(this._initWorker(i),this.workerStatus|=1<<i,this.workersResolve[i]=n,this.workers[i].postMessage(e,t)):this.queue.push({resolve:n,msg:e,transfer:t})})}dispose(){this.workers.forEach(e=>e.terminate()),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}const WT=0,ag=2,qT=1,og=2,jT=0,XT=1,KT=10,$T=0,qb=9,jb=15,Xb=16,Kb=22,$b=37,Yb=43,Jb=76,Zb=83,ex=97,tx=100,nx=103,ix=109,sx=122,rx=123,ax=131,ox=132,cx=133,lx=134,hx=137,ux=138,dx=139,fx=140,px=141,Ax=142,gx=145,mx=146,bx=148,xx=152,Ex=153,_x=154,vx=155,yx=156,Sx=157,Cx=158,Mx=165,Ix=166,wx=1000054e3,Tx=1000054001,Rx=1000054004,Bx=1000054005,ep=1000066e3,Dx=1000066004;class Ua{constructor(e,t,n,i){this._dataView=void 0,this._littleEndian=void 0,this._offset=void 0,this._dataView=new DataView(e.buffer,e.byteOffset+t,n),this._littleEndian=i,this._offset=0}_nextUint8(){const e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){const e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){const e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){const e=this._dataView.getUint32(this._offset,this._littleEndian)+4294967296*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,e}
vendor: 4,336 bytes, line 4596
4596_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=0){const n=this._offset;let i=0;for(;this._dataView.getUint8(this._offset)!==t&&i<e;)i++,this._offset++;return i<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+n,i)}}const En=[171,75,84,88,32,50,48,187,13,10,26,10];function cg(r){return new TextDecoder().decode(r)}function YT(r){const e=new Uint8Array(r.buffer,r.byteOffset,En.length);if(e[0]!==En[0]||e[1]!==En[1]||e[2]!==En[2]||e[3]!==En[3]||e[4]!==En[4]||e[5]!==En[5]||e[6]!==En[6]||e[7]!==En[7]||e[8]!==En[8]||e[9]!==En[9]||e[10]!==En[10]||e[11]!==En[11])throw new Error("Missing KTX 2.0 identifier.");const t={vkFormat:0,typeSize:1,pixelWidth:0,pixelHeight:0,pixelDepth:0,layerCount:0,faceCount:1,levelCount:0,supercompressionScheme:0,levels:[],dataFormatDescriptor:[{vendorId:0,descriptorType:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],keyValue:{},globalData:null},n=17*Uint32Array.BYTES_PER_ELEMENT,i=new Ua(r,En.length,n,!0);t.vkFormat=i._nextUint32(),t.typeSize=i._nextUint32(),t.pixelWidth=i._nextUint32(),t.pixelHeight=i._nextUint32(),t.pixelDepth=i._nextUint32(),t.layerCount=i._nextUint32(),t.faceCount=i._nextUint32(),t.levelCount=i._nextUint32(),t.supercompressionScheme=i._nextUint32();const s=i._nextUint32(),a=i._nextUint32(),o=i._nextUint32(),c=i._nextUint32(),l=i._nextUint64(),h=i._nextUint64(),u=3*Math.max(t.levelCount,1)*8,d=new Ua(r,En.length+n,u,!0);for(let Z=0,Y=Math.max(t.levelCount,1);Z<Y;Z++)t.levels.push({levelData:new Uint8Array(r.buffer,r.byteOffset+d._nextUint64(),d._nextUint64()),uncompressedByteLength:d._nextUint64()});const f=new Ua(r,s,a,!0);f._skip(4);const p=f._nextUint16(),m=f._nextUint16(),A=f._nextUint16(),g=f._nextUint16(),b={vendorId:p,descriptorType:m,versionNumber:A,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:[]},x=(g/4-6)/4;for(let Z=0;Z<x;Z++){const Y={bitOffset:f._nextUint16(),bitLength:f._nextUint8(),channelType:f._nextUint8(),samplePosition:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],sampleLower:Number.NEGATIVE_INFINITY,sampleUpper:Number.POSITIVE_INFINITY};64&Y.channelType?(Y.sampleLower=f._nextInt32(),Y.sampleUpper=f._nextInt32()):(Y.sampleLower=f._nextUint32(),Y.sampleUpper=f._nextUint32()),b.samples[Z]=Y}t.dataFormatDescriptor.length=0,t.dataFormatDescriptor.push(b);const _=new Ua(r,o,c,!0);for(;_._offset<c;){const Z=_._nextUint32(),Y=_._scan(Z),fe=cg(Y);if(t.keyValue[fe]=_._nextUint8Array(Z-Y.byteLength-1),fe.match(/^ktx/i)){const Ge=cg(t.keyValue[fe]);t.keyValue[fe]=Ge.substring(0,Ge.lastIndexOf("\0"))}_._skip(Z%4?4-Z%4:0)}if(h<=0)return t;const v=new Ua(r,l,h,!0),C=v._nextUint16(),I=v._nextUint16(),E=v._nextUint32(),S=v._nextUint32(),P=v._nextUint32(),w=v._nextUint32(),L=[];for(let Z=0,Y=Math.max(t.levelCount,1);Z<Y;Z++)L.push({imageFlags:v._nextUint32(),rgbSliceByteOffset:v._nextUint32(),rgbSliceByteLength:v._nextUint32(),alphaSliceByteOffset:v._nextUint32(),alphaSliceByteLength:v._nextUint32()});const N=l+v._offset,O=N+E,D=O+S,U=D+P,F=new Uint8Array(r.buffer,r.byteOffset+N,E),$=new Uint8Array(r.buffer,r.byteOffset+O,S),q=new Uint8Array(r.buffer,r.byteOffset+D,P),te=new Uint8Array(r.buffer,r.byteOffset+U,w);return t.globalData={endpointCount:C,selectorCount:I,imageDescs:L,endpointsData:F,selectorsData:$,tablesData:q,extendedData:te},t}let ou,Ui,of;const cu={env:{emscripten_notify_memory_growth:function(r){of=new Uint8Array(Ui.exports.memory.buffer)}}};class JT{init(){return ou||(ou=typeof fetch<"u"?fetch("data:application/wasm;base64,"+lg).then(e=>e.arrayBuffer()).then(e=>WebAssembly.instantiate(e,cu)).then(this._init):WebAssembly.instantiate(Buffer.from(lg,"base64"),cu).then(this._init),ou)}_init(e){Ui=e.instance,cu.env.emscripten_notify_memory_growth(0)}
4596decode(e,t=0){if(!Ui)throw new Error("ZSTDDecoder: Await .init() before decoding.");const n=e.byteLength,i=Ui.exports.malloc(n);of.set(e,i),t=t||Number(Ui.exports.ZSTD_findDecompressedSize(i,n));const s=Ui.exports.malloc(t),a=Ui.exports.ZSTD_decompress(s,t,i,n),o=of.slice(s,s+a);return Ui.exports.free(i),Ui.exports.free(s),o}}const lg
vendor: 38,980 bytes, line 4596
4596="AGFzbQEAAAABpQEVYAF/AX9gAn9/AGADf39/AX9gBX9/f39/AX9gAX8AYAJ/fwF/YAR/f39/AX9gA39/fwBgBn9/f39/fwF/YAd/f39/f39/AX9gAn9/AX5gAn5+AX5gAABgBX9/f39/AGAGf39/f39/AGAIf39/f39/f38AYAl/f39/f39/f38AYAABf2AIf39/f39/f38Bf2ANf39/f39/f39/f39/fwF/YAF/AX4CJwEDZW52H2Vtc2NyaXB0ZW5fbm90aWZ5X21lbW9yeV9ncm93dGgABANpaAEFAAAFAgEFCwACAQABAgIFBQcAAwABDgsBAQcAEhMHAAUBDAQEAAANBwQCAgYCBAgDAwMDBgEACQkHBgICAAYGAgQUBwYGAwIGAAMCAQgBBwUGCgoEEQAEBAEIAwgDBQgDEA8IAAcABAUBcAECAgUEAQCAAgYJAX8BQaCgwAILB2AHBm1lbW9yeQIABm1hbGxvYwAoBGZyZWUAJgxaU1REX2lzRXJyb3IAaBlaU1REX2ZpbmREZWNvbXByZXNzZWRTaXplAFQPWlNURF9kZWNvbXByZXNzAEoGX3N0YXJ0ACQJBwEAQQELASQKussBaA8AIAAgACgCBCABajYCBAsZACAAKAIAIAAoAgRBH3F0QQAgAWtBH3F2CwgAIABBiH9LC34BBH9BAyEBIAAoAgQiA0EgTQRAIAAoAggiASAAKAIQTwRAIAAQDQ8LIAAoAgwiAiABRgRAQQFBAiADQSBJGw8LIAAgASABIAJrIANBA3YiBCABIARrIAJJIgEbIgJrIgQ2AgggACADIAJBA3RrNgIEIAAgBCgAADYCAAsgAQsUAQF/IAAgARACIQIgACABEAEgAgv3AQECfyACRQRAIABCADcCACAAQQA2AhAgAEIANwIIQbh/DwsgACABNgIMIAAgAUEEajYCECACQQRPBEAgACABIAJqIgFBfGoiAzYCCCAAIAMoAAA2AgAgAUF/ai0AACIBBEAgAEEIIAEQFGs2AgQgAg8LIABBADYCBEF/DwsgACABNgIIIAAgAS0AACIDNgIAIAJBfmoiBEEBTQRAIARBAWtFBEAgACABLQACQRB0IANyIgM2AgALIAAgAS0AAUEIdCADajYCAAsgASACakF/ai0AACIBRQRAIABBADYCBEFsDwsgAEEoIAEQFCACQQN0ams2AgQgAgsWACAAIAEpAAA3AAAgACABKQAINwAICy8BAX8gAUECdEGgHWooAgAgACgCAEEgIAEgACgCBGprQR9xdnEhAiAAIAEQASACCyEAIAFCz9bTvtLHq9lCfiAAfEIfiUKHla+vmLbem55/fgsdAQF/IAAoAgggACgCDEYEfyAAKAIEQSBGBUEACwuCBAEDfyACQYDAAE8EQCAAIAEgAhBnIAAPCyAAIAJqIQMCQCAAIAFzQQNxRQRAAkAgAkEBSARAIAAhAgwBCyAAQQNxRQRAIAAhAgwBCyAAIQIDQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADTw0BIAJBA3ENAAsLAkAgA0F8cSIEQcAASQ0AIAIgBEFAaiIFSw0AA0AgAiABKAIANgIAIAIgASgCBDYCBCACIAEoAgg2AgggAiABKAIMNgIMIAIgASgCEDYCECACIAEoAhQ2AhQgAiABKAIYNgIYIAIgASgCHDYCHCACIAEoAiA2AiAgAiABKAIkNgIkIAIgASgCKDYCKCACIAEoAiw2AiwgAiABKAIwNgIwIAIgASgCNDYCNCACIAEoAjg2AjggAiABKAI8NgI8IAFBQGshASACQUBrIgIgBU0NAAsLIAIgBE8NAQNAIAIgASgCADYCACABQQRqIQEgAkEEaiICIARJDQALDAELIANBBEkEQCAAIQIMAQsgA0F8aiIEIABJBEAgACECDAELIAAhAgNAIAIgAS0AADoAACACIAEtAAE6AAEgAiABLQACOgACIAIgAS0AAzoAAyABQQRqIQEgAkEEaiICIARNDQALCyACIANJBEADQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADRw0ACwsgAAsMACAAIAEpAAA3AAALQQECfyAAKAIIIgEgACgCEEkEQEEDDwsgACAAKAIEIgJBB3E2AgQgACABIAJBA3ZrIgE2AgggACABKAAANgIAQQALDAAgACABKAIANgAAC/cCAQJ/AkAgACABRg0AAkAgASACaiAASwRAIAAgAmoiBCABSw0BCyAAIAEgAhALDwsgACABc0EDcSEDAkACQCAAIAFJBEAgAwRAIAAhAwwDCyAAQQNxRQRAIAAhAwwCCyAAIQMDQCACRQ0EIAMgAS0AADoAACABQQFqIQEgAkF/aiECIANBAWoiA0EDcQ0ACwwBCwJAIAMNACAEQQNxBEADQCACRQ0FIAAgAkF/aiICaiIDIAEgAmotAAA6AAAgA0EDcQ0ACwsgAkEDTQ0AA0AgACACQXxqIgJqIAEgAmooAgA2AgAgAkEDSw0ACwsgAkUNAgNAIAAgAkF/aiICaiABIAJqLQAAOgAAIAINAAsMAgsgAkEDTQ0AIAIhBANAIAMgASgCADYCACABQQRqIQEgA0EEaiEDIARBfGoiBEEDSw0ACyACQQNxIQILIAJFDQADQCADIAEtAAA6AAAgA0EBaiEDIAFBAWohASACQX9qIgINAAsLIAAL8wICAn8BfgJAIAJFDQAgACACaiIDQX9qIAE6AAAgACABOgAAIAJBA0kNACADQX5qIAE6AAAgACABOgABIANBfWogAToAACAAIAE6AAIgAkEHSQ0AIANBfGogAToAACAAIAE6AAMgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRqIgJBfGogATYCACAEQQlJDQAgAyABNgIIIAMgATYCBCACQXhqIAE2AgAgAkF0aiABNgIAIARBGUkNACADIAE2AhggAyABNgIUIAMgATYCECADIAE2AgwgAkFwaiABNgIAIAJBbGogATYCACACQWhqIAE2AgAgAkFkaiABNgIAIAQgA0EEcUEYciIEayICQSBJDQAgAa0iBUIghiAFhCEFIAMgBGohAQNAIAEgBTcDGCABIAU3AxAgASAFNwMIIAEgBTcDACABQSBqIQEgAkFgaiICQR9LDQALCyAACy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAIajYCACADCy8BAn8gACgCBCAAKAIAQQJ0aiICLQACIQMgACACLwEAIAEgAi0AAxAFajYCACADCx8AIAAgASACKAIEEAg2AgAgARAEGiAAIAJBCGo2AgQLCAAgAGdBH3MLugUBDX8jAEEQayIKJAACfyAEQQNNBEAgCkEANgIMIApBDGogAyAEEAsaIAAgASACIApBDGpBBBAVIgBBbCAAEAMbIAAgACAESxsMAQsgAEEAIAEoAgBBAXRBAmoQECENQVQgAygAACIGQQ9xIgBBCksNABogAiAAQQVqNgIAIAMgBGoiAkF8aiEMIAJBeWohDiACQXtqIRAgAEEGaiELQQQhBSAGQQR2IQRBICAAdCIAQQFyIQkgASgCACEPQQAhAiADIQYCQANAIAlBAkggAiAPS3JFBEAgAiEHAkAgCARAA0AgBEH//wNxQf//A0YEQCAHQRhqIQcgBiAQSQR/IAZBAmoiBigAACAFdgUgBUEQaiEFIARBEHYLIQQMAQsLA0AgBEEDcSIIQQNGBEAgBUECaiEFIARBAnYhBCAHQQNqIQcMAQsLIAcgCGoiByAPSw0EIAVBAmohBQNAIAIgB0kEQCANIAJBAXRqQQA7AQAgAkEBaiECDAELCyAGIA5LQQAgBiAFQQN1aiIHIAxLG0UEQCAHKAAAIAVBB3EiBXYhBAwCCyAEQQJ2IQQLIAYhBwsCfyALQX9qIAQgAEF/anEiBiAAQQF0QX9qIgggCWsiEUkNABogBCAIcSIEQQAgESAEIABIG2shBiALCyEIIA0gAkEBdGogBkF/aiIEOwEAIAlBASAGayAEIAZBAUgbayEJA0AgCSAASARAIABBAXUhACALQX9qIQsMAQsLAn8gByAOS0EAIAcgBSAIaiIFQQN1aiIGIAxLG0UEQCAFQQdxDAELIAUgDCIGIAdrQQN0awshBSACQQFqIQIgBEUhCCAGKAAAIAVBH3F2IQQMAQsLQWwgCUEBRyAFQSBKcg0BGiABIAJBf2o2AgAgBiAFQQdqQQN1aiADawwBC0FQCyEAIApBEGokACAACwkAQQFBBSAAGwsMACAAIAEoAAA2AAALqgMBCn8jAEHwAGsiCiQAIAJBAWohDiAAQQhqIQtBgIAEIAVBf2p0QRB1IQxBACECQQEhBkEBIAV0IglBf2oiDyEIA0AgAiAORkUEQAJAIAEgAkEBdCINai8BACIHQf//A0YEQCALIAhBA3RqIAI2AgQgCEF/aiEIQQEhBwwBCyAGQQAgDCAHQRB0QRB1ShshBgsgCiANaiAHOwEAIAJBAWohAgwBCwsgACAFNgIEIAAgBjYCACAJQQN2IAlBAXZqQQNqIQxBACEAQQAhBkEAIQIDQCAGIA5GBEADQAJAIAAgCUYNACAKIAsgAEEDdGoiASgCBCIGQQF0aiICIAIvAQAiAkEBajsBACABIAUgAhAUayIIOgADIAEgAiAIQf8BcXQgCWs7AQAgASAEIAZBAnQiAmooAgA6AAIgASACIANqKAIANgIEIABBAWohAAwBCwsFIAEgBkEBdGouAQAhDUEAIQcDQCAHIA1ORQRAIAsgAkEDdGogBjYCBANAIAIgDGogD3EiAiAISw0ACyAHQQFqIQcMAQsLIAZBAWohBgwBCwsgCkHwAGokAAsjAEIAIAEQCSAAhUKHla+vmLbem55/fkLj3MqV/M7y9YV/fAsQACAAQn43AwggACABNgIACyQBAX8gAARAIAEoAgQiAgRAIAEoAgggACACEQEADwsgABAmCwsfACAAIAEgAi8BABAINgIAIAEQBBogACACQQRqNgIEC0oBAX9BoCAoAgAiASAAaiIAQX9MBEBBiCBBMDYCAEF/DwsCQCAAPwBBEHRNDQAgABBmDQBBiCBBMDYCAEF/DwtBoCAgADYCACABC9cBAQh/Qbp/IQoCQCACKAIEIgggAigCACIJaiIOIAEgAGtLDQBBbCEKIAkgBCADKAIAIgtrSw0AIAAgCWoiBCACKAIIIgxrIQ0gACABQWBqIg8gCyAJQQAQKSADIAkgC2o2AgACQAJAIAwgBCAFa00EQCANIQUMAQsgDCAEIAZrSw0CIAcgDSAFayIAaiIBIAhqIAdNBEAgBCABIAgQDxoMAgsgBCABQQAgAGsQDyEBIAIgACAIaiIINgIEIAEgAGshBAsgBCAPIAUgCEEBECkLIA4hCgsgCgubAgEBfyMAQYABayINJAAgDSADNgJ8AkAgAkEDSwRAQX8hCQwBCwJAAkACQAJAIAJBAWsOAwADAgELIAZFBEBBuH8hCQwEC0FsIQkgBS0AACICIANLDQMgACAHIAJBAnQiAmooAgAgAiAIaigCABA7IAEgADYCAEEBIQkMAwsgASAJNgIAQQAhCQwCCyAKRQRAQWwhCQwCC0EAIQkgC0UgDEEZSHINAUEIIAR0QQhqIQBBACECA0AgAiAATw0CIAJBQGshAgwAAAsAC0FsIQkgDSANQfwAaiANQfgAaiAFIAYQFSICEAMNACANKAJ4IgMgBEsNACAAIA0gDSgCfCAHIAggAxAYIAEgADYCACACIQkLIA1BgAFqJAAgCQsLACAAIAEgAhALGgsQACAALwAAIAAtAAJBEHRyCy8AAn9BuH8gAUEISQ0AGkFyIAAoAAQiAEF3Sw0AGkG4fyAAQQhqIgAgACABSxsLCwkAIAAgATsAAAsDAAELigYBBX8gACAAKAIAIgVBfnE2AgBBACAAIAVBAXZqQYQgKAIAIgQgAEYbIQECQAJAIAAoAgQiAkUNACACKAIAIgNBAXENACACQQhqIgUgA0EBdkF4aiIDQQggA0EISxtnQR9zQQJ0QYAfaiIDKAIARgRAIAMgAigCDDYCAAsgAigCCCIDBEAgAyACKAIMNgIECyACKAIMIgMEQCADIAIoAgg2AgALIAIgAigCACAAKAIAQX5xajYCAEGEICEAAkACQCABRQ0AIAEgAjYCBCABKAIAIgNBAXENASADQQF2QXhqIgNBCCADQQhLG2dBH3NBAnRBgB9qIgMoAgAgAUEIakYEQCADIAEoAgw2AgALIAEoAggiAwRAIAMgASgCDDYCBAsgASgCDCIDBEAgAyABKAIINgIAQYQgKAIAIQQLIAIgAigCACABKAIAQX5xajYCACABIARGDQAgASABKAIAQQF2akEEaiEACyAAIAI2AgALIAIoAgBBAXZBeGoiAEEIIABBCEsbZ0Efc0ECdEGAH2oiASgCACEAIAEgBTYCACACIAA2AgwgAkEANgIIIABFDQEgACAFNgIADwsCQCABRQ0AIAEoAgAiAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAigCACABQQhqRgRAIAIgASgCDDYCAAsgASgCCCICBEAgAiABKAIMNgIECyABKAIMIgIEQCACIAEoAgg2AgBBhCAoAgAhBAsgACAAKAIAIAEoAgBBfnFqIgI2AgACQCABIARHBEAgASABKAIAQQF2aiAANgIEIAAoAgAhAgwBC0GEICAANgIACyACQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgIoAgAhASACIABBCGoiAjYCACAAIAE2AgwgAEEANgIIIAFFDQEgASACNgIADwsgBUEBdkF4aiIBQQggAUEISxtnQR9zQQJ0QYAfaiICKAIAIQEgAiAAQQhqIgI2AgAgACABNgIMIABBADYCCCABRQ0AIAEgAjYCAAsLDgAgAARAIABBeGoQJQsLgAIBA38CQCAAQQ9qQXhxQYQgKAIAKAIAQQF2ayICEB1Bf0YNAAJAQYQgKAIAIgAoAgAiAUEBcQ0AIAFBAXZBeGoiAUEIIAFBCEsbZ0Efc0ECdEGAH2oiASgCACAAQQhqRgRAIAEgACgCDDYCAAsgACgCCCIBBEAgASAAKAIMNgIECyAAKAIMIgFFDQAgASAAKAIINgIAC0EBIQEgACAAKAIAIAJBAXRqIgI2AgAgAkEBcQ0AIAJBAXZBeGoiAkEIIAJBCEsbZ0Efc0ECdEGAH2oiAygCACECIAMgAEEIaiIDNgIAIAAgAjYCDCAAQQA2AgggAkUNACACIAM2AgALIAELtwIBA38CQAJAIABBASAAGyICEDgiAA0AAkACQEGEICgCACIARQ0AIAAoAgAiA0EBcQ0AIAAgA0EBcjYCACADQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgAgAEEIakYEQCABIAAoAgw2AgALIAAoAggiAQRAIAEgACgCDDYCBAsgACgCDCIBBEAgASAAKAIINgIACyACECchAkEAIQFBhCAoAgAhACACDQEgACAAKAIAQX5xNgIAQQAPCyACQQ9qQXhxIgMQHSICQX9GDQIgAkEHakF4cSIAIAJHBEAgACACaxAdQX9GDQMLAkBBhCAoAgAiAUUEQEGAICAANgIADAELIAAgATYCBAtBhCAgADYCACAAIANBAXRBAXI2AgAMAQsgAEUNAQsgAEEIaiEBCyABC7kDAQJ/IAAgA2ohBQJAIANBB0wEQANAIAAgBU8NAiAAIAItAAA6AAAgAEEBaiEAIAJBAWohAgwAAAsACyAEQQFGBEACQCAAIAJrIgZBB00EQCAAIAItAAA6AAAgACACLQABOgABIAAgAi0AAjoAAiAAIAItAAM6AAMgAEEEaiACIAZBAnQiBkHAHmooAgBqIgIQFyACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiBkGo6r5pRg0AQXYhAyAGQXBxQdDUtMIBRw0BQQghAyACQQhJDQEgAEEAQSgQECEAIAEoAAQhASAAQQE2AhQgACABrTcDAEEADwsgASACIAMQLyIDIAJLDQAgACADNgIYQXIhAyABIARqIgVBf2otAAAiAkEIcQ0AIAJBIHEiBkUEQEFwIQMgBS0AACIFQacBSw0BIAVBB3GtQgEgBUEDdkEKaq2GIgdCA4h+IAd8IQggBEEBaiEECyACQQZ2IQMgAkECdiEFAkAgAkEDcUF/aiICQQJLBEBBACECDAELAkACQAJAIAJBAWsOAgECAAsgASAEai0AACECIARBAWohBAwCCyABIARqLwAAIQIgBEECaiEEDAELIAEgBGooAAAhAiAEQQRqIQQLIAVBAXEhBQJ+AkACQAJAIANBf2oiA0ECTQRAIANBAWsOAgIDAQtCfyAGRQ0DGiABIARqMQAADAMLIAEgBGovAACtQoACfAwCCyABIARqKAAArQwBCyABIARqKQAACyEHIAAgBTYCICAAIAI2AhwgACAHNwMAQQAhAyAAQQA2AhQgACAHIAggBhsiBzcDCCAAIAdCgIAIIAdCgIAIVBs+AhALIAMLWwEBf0G4fyEDIAIQFiICIAFNBH8gACACakF/ai0AACIAQQNxQQJ0QaAeaigCACACaiAAQQZ2IgFBAnRBsB5qKAIAaiAAQSBxIgBFaiABRSAAQQV2cWoFQbh/CwsdACAAKAKQ4gEQWiAAQQA2AqDiASAAQgA3A5DiAQu1AwEFfyMAQZACayIKJABBuH8hBgJAIAVFDQAgBCwAACIIQf8BcSEHAkAgCEF/TARAIAdBgn9qQQF2IgggBU8NAkFsIQYgB0GBf2oiBUGAAk8NAiAEQQFqIQdBACEGA0AgBiAFTwRAIAUhBiAIIQcMAwUgACAGaiAHIAZBAXZqIgQtAABBBHY6AAAgACAGQQFyaiAELQAAQQ9xOgAAIAZBAmohBgwBCwAACwALIAcgBU8NASAAIARBAWogByAKEFMiBhADDQELIAYhBEEAIQYgAUEAQTQQECEJQQAhBQNAIAQgBkcEQCAAIAZqIggtAAAiAUELSwRAQWwhBgwDBSAJIAFBAnRqIgEgASgCAEEBajYCACAGQQFqIQZBASAILQAAdEEBdSAFaiEFDAILAAsLQWwhBiAFRQ0AIAUQFEEBaiIBQQxLDQAgAyABNgIAQQFBASABdCAFayIDEBQiAXQgA0cNACAAIARqIAFBAWoiADoAACAJIABBAnRqIgAgACgCAEEBajYCACAJKAIEIgBBAkkgAEEBcXINACACIARBAWo2AgAgB0EBaiEGCyAKQZACaiQAIAYLxhEBDH8jAEHwAGsiBSQAQWwhCwJAIANBCkkNACACLwAAIQogAi8AAiEJIAIvAAQhByAFQQhqIAQQDgJAIAMgByAJIApqakEGaiIMSQ0AIAUtAAohCCAFQdgAaiACQQZqIgIgChAGIgsQAw0BIAVBQGsgAiAKaiICIAkQBiILEAMNASAFQShqIAIgCWoiAiAHEAYiCxADDQEgBUEQaiACIAdqIAMgDGsQBiILEAMNASAAIAFqIg9BfWohECAEQQRqIQZBASELIAAgAUEDakECdiIDaiIMIANqIgIgA2oiDiEDIAIhBCAMIQcDQCALIAMgEElxBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgCS0AAyELIAcgBiAFQUBrIAgQAkECdGoiCS8BADsAACAFQUBrIAktAAIQASAJLQADIQogBCAGIAVBKGogCBACQQJ0aiIJLwEAOwAAIAVBKGogCS0AAhABIAktAAMhCSADIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgDS0AAyENIAAgC2oiCyAGIAVB2ABqIAgQAkECdGoiAC8BADsAACAFQdgAaiAALQACEAEgAC0AAyEAIAcgCmoiCiAGIAVBQGsgCBACQQJ0aiIHLwEAOwAAIAVBQGsgBy0AAhABIActAAMhByAEIAlqIgkgBiAFQShqIAgQAkECdGoiBC8BADsAACAFQShqIAQtAAIQASAELQADIQQgAyANaiIDIAYgBUEQaiAIEAJBAnRqIg0vAQA7AAAgBUEQaiANLQACEAEgACALaiEAIAcgCmohByAEIAlqIQQgAyANLQADaiEDIAVB2ABqEA0gBUFAaxANciAFQShqEA1yIAVBEGoQDXJFIQsMAQsLIAQgDksgByACS3INAEFsIQsgACAMSw0BIAxBfWohCQNAQQAgACAJSSAFQdgAahAEGwRAIAAgBiAFQdgAaiAIEAJBAnRqIgovAQA7AAAgBUHYAGogCi0AAhABIAAgCi0AA2oiACAGIAVB2ABqIAgQAkECdGoiCi8BADsAACAFQdgAaiAKLQACEAEgACAKLQADaiEADAEFIAxBfmohCgNAIAVB2ABqEAQgACAKS3JFBEAgACAGIAVB2ABqIAgQAkECdGoiCS8BADsAACAFQdgAaiAJLQACEAEgACAJLQADaiEADAELCwNAIAAgCk0EQCAAIAYgBUHYAGogCBACQQJ0aiIJLwEAOwAAIAVB2ABqIAktAAIQASAAIAktAANqIQAMAQsLAkAgACAMTw0AIAAgBiAFQdgAaiAIEAIiAEECdGoiDC0AADoAACAMLQADQQFGBEAgBUHYAGogDC0AAhABDAELIAUoAlxBH0sNACAFQdgAaiAGIABBAnRqLQACEAEgBSgCXEEhSQ0AIAVBIDYCXAsgAkF9aiEMA0BBACAHIAxJIAVBQGsQBBsEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiIAIAYgBUFAayAIEAJBAnRqIgcvAQA7AAAgBUFAayAHLQACEAEgACAHLQADaiEHDAEFIAJBfmohDANAIAVBQGsQBCAHIAxLckUEQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwNAIAcgDE0EQCAHIAYgBUFAayAIEAJBAnRqIgAvAQA7AAAgBUFAayAALQACEAEgByAALQADaiEHDAELCwJAIAcgAk8NACAHIAYgBUFAayAIEAIiAEECdGoiAi0AADoAACACLQADQQFGBEAgBUFAayACLQACEAEMAQsgBSgCREEfSw0AIAVBQGsgBiAAQQJ0ai0AAhABIAUoAkRBIUkNACAFQSA2AkQLIA5BfWohAgNAQQAgBCACSSAFQShqEAQbBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2oiACAGIAVBKGogCBACQQJ0aiIELwEAOwAAIAVBKGogBC0AAhABIAAgBC0AA2ohBAwBBSAOQX5qIQIDQCAFQShqEAQgBCACS3JFBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsDQCAEIAJNBEAgBCAGIAVBKGogCBACQQJ0aiIALwEAOwAAIAVBKGogAC0AAhABIAQgAC0AA2ohBAwBCwsCQCAEIA5PDQAgBCAGIAVBKGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBKGogAi0AAhABDAELIAUoAixBH0sNACAFQShqIAYgAEECdGotAAIQASAFKAIsQSFJDQAgBUEgNgIsCwNAQQAgAyAQSSAFQRBqEAQbBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2oiACAGIAVBEGogCBACQQJ0aiICLwEAOwAAIAVBEGogAi0AAhABIAAgAi0AA2ohAwwBBSAPQX5qIQIDQCAFQRBqEAQgAyACS3JFBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsDQCADIAJNBEAgAyAGIAVBEGogCBACQQJ0aiIALwEAOwAAIAVBEGogAC0AAhABIAMgAC0AA2ohAwwBCwsCQCADIA9PDQAgAyAGIAVBEGogCBACIgBBAnRqIgItAAA6AAAgAi0AA0EBRgRAIAVBEGogAi0AAhABDAELIAUoAhRBH0sNACAFQRBqIAYgAEECdGotAAIQASAFKAIUQSFJDQAgBUEgNgIUCyABQWwgBUHYAGoQCiAFQUBrEApxIAVBKGoQCnEgBUEQahAKcRshCwwJCwAACwALAAALAAsAAAsACwAACwALQWwhCwsgBUHwAGokACALC7UEAQ5/IwBBEGsiBiQAIAZBBGogABAOQVQhBQJAIARB3AtJDQAgBi0ABCEHIANB8ARqQQBB7AAQECEIIAdBDEsNACADQdwJaiIJIAggBkEIaiAGQQxqIAEgAhAxIhAQA0UEQCAGKAIMIgQgB0sNASADQdwFaiEPIANBpAVqIREgAEEEaiESIANBqAVqIQEgBCEFA0AgBSICQX9qIQUgCCACQQJ0aigCAEUNAAsgAkEBaiEOQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgASALaiAKNgIAIAVBAWohBSAKIAxqIQoMAQsLIAEgCjYCAEEAIQUgBigCCCELA0AgBSALRkUEQCABIAUgCWotAAAiDEECdGoiDSANKAIAIg1BAWo2AgAgDyANQQF0aiINIAw6AAEgDSAFOgAAIAVBAWohBQwBCwtBACEBIANBADYCqAUgBEF/cyAHaiEJQQEhBQNAIAUgDk9FBEAgCCAFQQJ0IgtqKAIAIQwgAyALaiABNgIAIAwgBSAJanQgAWohASAFQQFqIQUMAQsLIAcgBEEBaiIBIAJrIgRrQQFqIQgDQEEBIQUgBCAIT0UEQANAIAUgDk9FBEAgBUECdCIJIAMgBEE0bGpqIAMgCWooAgAgBHY2AgAgBUEBaiEFDAELCyAEQQFqIQQMAQsLIBIgByAPIAogESADIAIgARBkIAZBAToABSAGIAc6AAYgACAGKAIENgIACyAQIQULIAZBEGokACAFC8ENAQt/IwBB8ABrIgUkAEFsIQkCQCADQQpJDQAgAi8AACEKIAIvAAIhDCACLwAEIQYgBUEIaiAEEA4CQCADIAYgCiAMampBBmoiDUkNACAFLQAKIQcgBUHYAGogAkEGaiICIAoQBiIJEAMNASAFQUBrIAIgCmoiAiAMEAYiCRADDQEgBUEoaiACIAxqIgIgBhAGIgkQAw0BIAVBEGogAiAGaiADIA1rEAYiCRADDQEgACABaiIOQX1qIQ8gBEEEaiEGQQEhCSAAIAFBA2pBAnYiAmoiCiACaiIMIAJqIg0hAyAMIQQgCiECA0AgCSADIA9JcQRAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAACAGIAVBQGsgBxACQQF0aiIILQAAIQsgBUFAayAILQABEAEgAiALOgAAIAYgBUEoaiAHEAJBAXRqIggtAAAhCyAFQShqIAgtAAEQASAEIAs6AAAgBiAFQRBqIAcQAkEBdGoiCC0AACELIAVBEGogCC0AARABIAMgCzoAACAGIAVB2ABqIAcQAkEBdGoiCC0AACELIAVB2ABqIAgtAAEQASAAIAs6AAEgBiAFQUBrIAcQAkEBdGoiCC0AACELIAVBQGsgCC0AARABIAIgCzoAASAGIAVBKGogBxACQQF0aiIILQAAIQsgBUEoaiAILQABEAEgBCALOgABIAYgBUEQaiAHEAJBAXRqIggtAAAhCyAFQRBqIAgtAAEQASADIAs6AAEgA0ECaiEDIARBAmohBCACQQJqIQIgAEECaiEAIAkgBUHYAGoQDUVxIAVBQGsQDUVxIAVBKGoQDUVxIAVBEGoQDUVxIQkMAQsLIAQgDUsgAiAMS3INAEFsIQkgACAKSw0BIApBfWohCQNAIAVB2ABqEAQgACAJT3JFBEAgBiAFQdgAaiAHEAJBAXRqIggtAAAhCyAFQdgAaiAILQABEAEgACALOgAAIAYgBUHYAGogBxACQQF0aiIILQAAIQsgBUHYAGogCC0AARABIAAgCzoAASAAQQJqIQAMAQsLA0AgBUHYAGoQBCAAIApPckUEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCwNAIAAgCkkEQCAGIAVB2ABqIAcQAkEBdGoiCS0AACEIIAVB2ABqIAktAAEQASAAIAg6AAAgAEEBaiEADAELCyAMQX1qIQADQCAFQUBrEAQgAiAAT3JFBEAgBiAFQUBrIAcQAkEBdGoiCi0AACEJIAVBQGsgCi0AARABIAIgCToAACAGIAVBQGsgBxACQQF0aiIKLQAAIQkgBUFAayAKLQABEAEgAiAJOgABIAJBAmohAgwBCwsDQCAFQUBrEAQgAiAMT3JFBEAgBiAFQUBrIAcQAkEBdGoiAC0AACEKIAVBQGsgAC0AARABIAIgCjoAACACQQFqIQIMAQsLA0AgAiAMSQRAIAYgBUFAayAHEAJBAXRqIgAtAAAhCiAFQUBrIAAtAAEQASACIAo6AAAgAkEBaiECDAELCyANQX1qIQADQCAFQShqEAQgBCAAT3JFBEAgBiAFQShqIAcQAkEBdGoiAi0AACEKIAVBKGogAi0AARABIAQgCjoAACAGIAVBKGogBxACQQF0aiICLQAAIQogBUEoaiACLQABEAEgBCAKOgABIARBAmohBAwBCwsDQCAFQShqEAQgBCANT3JFBEAgBiAFQShqIAcQAkEBdGoiAC0AACECIAVBKGogAC0AARABIAQgAjoAACAEQQFqIQQMAQsLA0AgBCANSQRAIAYgBUEoaiAHEAJBAXRqIgAtAAAhAiAFQShqIAAtAAEQASAEIAI6AAAgBEEBaiEEDAELCwNAIAVBEGoQBCADIA9PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIAYgBUEQaiAHEAJBAXRqIgAtAAAhAiAFQRBqIAAtAAEQASADIAI6AAEgA0ECaiEDDAELCwNAIAVBEGoQBCADIA5PckUEQCAGIAVBEGogBxACQQF0aiIALQAAIQIgBUEQaiAALQABEAEgAyACOgAAIANBAWohAwwBCwsDQCADIA5JBEAgBiAFQRBqIAcQAkEBdGoiAC0AACECIAVBEGogAC0AARABIAMgAjoAACADQQFqIQMMAQsLIAFBbCAFQdgAahAKIAVBQGsQCnEgBUEoahAKcSAFQRBqEApxGyEJDAELQWwhCQsgBUHwAGokACAJC8oCAQR/IwBBIGsiBSQAIAUgBBAOIAUtAAIhByAFQQhqIAIgAxAGIgIQA0UEQCAEQQRqIQIgACABaiIDQX1qIQQDQCAFQQhqEAQgACAET3JFBEAgAiAFQQhqIAcQAkEBdGoiBi0AACEIIAVBCGogBi0AARABIAAgCDoAACACIAVBCGogBxACQQF0aiIGLQAAIQggBUEIaiAGLQABEAEgACAIOgABIABBAmohAAwBCwsDQCAFQQhqEAQgACADT3JFBEAgAiAFQQhqIAcQAkEBdGoiBC0AACEGIAVBCGogBC0AARABIAAgBjoAACAAQQFqIQAMAQsLA0AgACADT0UEQCACIAVBCGogBxACQQF0aiIELQAAIQYgBUEIaiAELQABEAEgACAGOgAAIABBAWohAAwBCwsgAUFsIAVBCGoQChshAgsgBUEgaiQAIAILtgMBCX8jAEEQayIGJAAgBkEANgIMIAZBADYCCEFUIQQCQAJAIANBQGsiDCADIAZBCGogBkEMaiABIAIQMSICEAMNACAGQQRqIAAQDiAGKAIMIgcgBi0ABEEBaksNASAAQQRqIQogBkEAOgAFIAYgBzoABiAAIAYoAgQ2AgAgB0EBaiEJQQEhBANAIAQgCUkEQCADIARBAnRqIgEoAgAhACABIAU2AgAgACAEQX9qdCAFaiEFIARBAWohBAwBCwsgB0EBaiEHQQAhBSAGKAIIIQkDQCAFIAlGDQEgAyAFIAxqLQAAIgRBAnRqIgBBASAEdEEBdSILIAAoAgAiAWoiADYCACAHIARrIQhBACEEAkAgC0EDTQRAA0AgBCALRg0CIAogASAEakEBdGoiACAIOgABIAAgBToAACAEQQFqIQQMAAALAAsDQCABIABPDQEgCiABQQF0aiIEIAg6AAEgBCAFOgAAIAQgCDoAAyAEIAU6AAIgBCAIOgAFIAQgBToABCAEIAg6AAcgBCAFOgAGIAFBBGohAQwAAAsACyAFQQFqIQUMAAALAAsgAiEECyAGQRBqJAAgBAutAQECfwJAQYQgKAIAIABHIAAoAgBBAXYiAyABa0F4aiICQXhxQQhHcgR/IAIFIAMQJ0UNASACQQhqC0EQSQ0AIAAgACgCACICQQFxIAAgAWpBD2pBeHEiASAAa0EBdHI2AgAgASAANgIEIAEgASgCAEEBcSAAIAJBAXZqIAFrIgJBAXRyNgIAQYQgIAEgAkH/////B3FqQQRqQYQgKAIAIABGGyABNgIAIAEQJQsLygIBBX8CQAJAAkAgAEEIIABBCEsbZ0EfcyAAaUEBR2oiAUEESSAAIAF2cg0AIAFBAnRB/B5qKAIAIgJFDQADQCACQXhqIgMoAgBBAXZBeGoiBSAATwRAIAIgBUEIIAVBCEsbZ0Efc0ECdEGAH2oiASgCAEYEQCABIAIoAgQ2AgALDAMLIARBHksNASAEQQFqIQQgAigCBCICDQALC0EAIQMgAUEgTw0BA0AgAUECdEGAH2ooAgAiAkUEQCABQR5LIQIgAUEBaiEBIAJFDQEMAwsLIAIgAkF4aiIDKAIAQQF2QXhqIgFBCCABQQhLG2dBH3NBAnRBgB9qIgEoAgBGBEAgASACKAIENgIACwsgAigCACIBBEAgASACKAIENgIECyACKAIEIgEEQCABIAIoAgA2AgALIAMgAygCAEEBcjYCACADIAAQNwsgAwvhCwINfwV+IwBB8ABrIgckACAHIAAoAvDhASIINgJcIAEgAmohDSAIIAAoAoDiAWohDwJAAkAgBUUEQCABIQQMAQsgACgCxOABIRAgACgCwOABIREgACgCvOABIQ4gAEEBNgKM4QFBACEIA0AgCEEDRwRAIAcgCEECdCICaiAAIAJqQazQAWooAgA2AkQgCEEBaiEIDAELC0FsIQwgB0EYaiADIAQQBhADDQEgB0EsaiAHQRhqIAAoAgAQEyAHQTRqIAdBGGogACgCCBATIAdBPGogB0EYaiAAKAIEEBMgDUFgaiESIAEhBEEAIQwDQCAHKAIwIAcoAixBA3RqKQIAIhRCEIinQf8BcSEIIAcoAkAgBygCPEEDdGopAgAiFUIQiKdB/wFxIQsgBygCOCAHKAI0QQN0aikCACIWQiCIpyEJIBVCIIghFyAUQiCIpyECAkAgFkIQiKdB/wFxIgNBAk8EQAJAIAZFIANBGUlyRQRAIAkgB0EYaiADQSAgBygCHGsiCiAKIANLGyIKEAUgAyAKayIDdGohCSAHQRhqEAQaIANFDQEgB0EYaiADEAUgCWohCQwBCyAHQRhqIAMQBSAJaiEJIAdBGGoQBBoLIAcpAkQhGCAHIAk2AkQgByAYNwNIDAELAkAgA0UEQCACBEAgBygCRCEJDAMLIAcoAkghCQwBCwJAAkAgB0EYakEBEAUgCSACRWpqIgNBA0YEQCAHKAJEQX9qIgMgA0VqIQkMAQsgA0ECdCAHaigCRCIJIAlFaiEJIANBAUYNAQsgByAHKAJINgJMCwsgByAHKAJENgJIIAcgCTYCRAsgF6chAyALBEAgB0EYaiALEAUgA2ohAwsgCCALakEUTwRAIAdBGGoQBBoLIAgEQCAHQRhqIAgQBSACaiECCyAHQRhqEAQaIAcgB0EYaiAUQhiIp0H/AXEQCCAUp0H//wNxajYCLCAHIAdBGGogFUIYiKdB/wFxEAggFadB//8DcWo2AjwgB0EYahAEGiAHIAdBGGogFkIYiKdB/wFxEAggFqdB//8DcWo2AjQgByACNgJgIAcoAlwhCiAHIAk2AmggByADNgJkAkACQAJAIAQgAiADaiILaiASSw0AIAIgCmoiEyAPSw0AIA0gBGsgC0Egak8NAQsgByAHKQNoNwMQIAcgBykDYDcDCCAEIA0gB0EIaiAHQdwAaiAPIA4gESAQEB4hCwwBCyACIARqIQggBCAKEAcgAkERTwRAIARBEGohAgNAIAIgCkEQaiIKEAcgAkEQaiICIAhJDQALCyAIIAlrIQIgByATNgJcIAkgCCAOa0sEQCAJIAggEWtLBEBBbCELDAILIBAgAiAOayICaiIKIANqIBBNBEAgCCAKIAMQDxoMAgsgCCAKQQAgAmsQDyEIIAcgAiADaiIDNgJkIAggAmshCCAOIQILIAlBEE8EQCADIAhqIQMDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALDAELAkAgCUEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgCUECdCIDQcAeaigCAGoiAhAXIAIgA0HgHmooAgBrIQIgBygCZCEDDAELIAggAhAMCyADQQlJDQAgAyAIaiEDIAhBCGoiCCACQQhqIgJrQQ9MBEADQCAIIAIQDCACQQhqIQIgCEEIaiIIIANJDQAMAgALAAsDQCAIIAIQByACQRBqIQIgCEEQaiIIIANJDQALCyAHQRhqEAQaIAsgDCALEAMiAhshDCAEIAQgC2ogAhshBCAFQX9qIgUNAAsgDBADDQFBbCEMIAdBGGoQBEECSQ0BQQAhCANAIAhBA0cEQCAAIAhBAnQiAmpBrNABaiACIAdqKAJENgIAIAhBAWohCAwBCwsgBygCXCEIC0G6fyEMIA8gCGsiACANIARrSw0AIAQEfyAEIAggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdBKGogACgCBBATQQAhBCAHQeAAaiEMIAdB5ABqIQoDQCAHQShqEARBAksgBCAXTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEJIAcoAkggBygCREEDdGopAgAiH0IgiKchCCAeQiCIISAgHUIgiKchAgJAIB9CEIinQf8BcSIDQQJPBEACQCAGRSADQRlJckUEQCAIIAdBKGogA0EgIAcoAixrIg0gDSADSxsiDRAFIAMgDWsiA3RqIQggB0EoahAEGiADRQ0BIAdBKGogAxAFIAhqIQgMAQsgB0EoaiADEAUgCGohCCAHQShqEAQaCyAHKQJUISEgByAINgJUIAcgITcDWAwBCwJAIANFBEAgAgRAIAcoAlQhCAwDCyAHKAJYIQgMAQsCQAJAIAdBKGpBARAFIAggAkVqaiIDQQNGBEAgBygCVEF/aiIDIANFaiEIDAELIANBAnQgB2ooAlQiCCAIRWohCCADQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAg2AlQLICCnIQMgCQRAIAdBKGogCRAFIANqIQMLIAkgC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgAmohAgsgB0EoahAEGiAHIAcoAmggAmoiCSADajYCaCAKIAwgCCAJSxsoAgAhDSAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogB0EoaiAfQhiIp0H/AXEQCCEOIAdB8ABqIARBBHRqIgsgCSANaiAIazYCDCALIAg2AgggCyADNgIEIAsgAjYCACAHIA4gH6dB//8DcWo2AkQgBEEBaiEEDAELCyAEIBdIDQEgEkFgaiEYIAdB4ABqIRogB0HkAGohGyABIQMDQCAHQShqEARBAksgBCAFTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEIIAcoAkggBygCREEDdGopAgAiH0IgiKchCSAeQiCIISAgHUIgiKchDAJAIB9CEIinQf8BcSICQQJPBEACQCAGRSACQRlJckUEQCAJIAdBKGogAkEgIAcoAixrIgogCiACSxsiChAFIAIgCmsiAnRqIQkgB0EoahAEGiACRQ0BIAdBKGogAhAFIAlqIQkMAQsgB0EoaiACEAUgCWohCSAHQShqEAQaCyAHKQJUISEgByAJNgJUIAcgITcDWAwBCwJAIAJFBEAgDARAIAcoAlQhCQwDCyAHKAJYIQkMAQsCQAJAIAdBKGpBARAFIAkgDEVqaiICQQNGBEAgBygCVEF/aiICIAJFaiEJDAELIAJBAnQgB2ooAlQiCSAJRWohCSACQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAk2AlQLICCnIRQgCARAIAdBKGogCBAFIBRqIRQLIAggC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgDGohDAsgB0EoahAEGiAHIAcoAmggDGoiGSAUajYCaCAbIBogCSAZSxsoAgAhHCAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2AjwgByAHQShqIB5CGIinQf8BcRAIIB6nQf//A3FqNgJMIAdBKGoQBBogByAHQShqIB9CGIinQf8BcRAIIB+nQf//A3FqNgJEIAcgB0HwAGogBEEDcUEEdGoiDSkDCCIdNwPIASAHIA0pAwAiHjcDwAECQAJAAkAgBygCvAEiDiAepyICaiIWIBNLDQAgAyAHKALEASIKIAJqIgtqIBhLDQAgEiADayALQSBqTw0BCyAHIAcpA8gBNwMQIAcgBykDwAE3AwggAyASIAdBCGogB0G8AWogEyAPIBUgERAeIQsMAQsgAiADaiEIIAMgDhAHIAJBEU8EQCADQRBqIQIDQCACIA5BEGoiDhAHIAJBEGoiAiAISQ0ACwsgCCAdpyIOayECIAcgFjYCvAEgDiAIIA9rSwRAIA4gCCAVa0sEQEFsIQsMAgsgESACIA9rIgJqIhYgCmogEU0EQCAIIBYgChAPGgwCCyAIIBZBACACaxAPIQggByACIApqIgo2AsQBIAggAmshCCAPIQILIA5BEE8EQCAIIApqIQoDQCAIIAIQByACQRBqIQIgCEEQaiIIIApJDQALDAELAkAgDkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgDkECdCIKQcAeaigCAGoiAhAXIAIgCkHgHmooAgBrIQIgBygCxAEhCgwBCyAIIAIQDAsgCkEJSQ0AIAggCmohCiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAKSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAKSQ0ACwsgCxADBEAgCyEQDAQFIA0gDDYCACANIBkgHGogCWs2AgwgDSAJNgIIIA0gFDYCBCAEQQFqIQQgAyALaiEDDAILAAsLIAQgBUgNASAEIBdrIQtBACEEA0AgCyAFSARAIAcgB0HwAGogC0EDcUEEdGoiAikDCCIdNwPIASAHIAIpAwAiHjcDwAECQAJAAkAgBygCvAEiDCAepyICaiIKIBNLDQAgAyAHKALEASIJIAJqIhBqIBhLDQAgEiADayAQQSBqTw0BCyAHIAcpA8gBNwMgIAcgBykDwAE3AxggAyASIAdBGGogB0G8AWogEyAPIBUgERAeIRAMAQsgAiADaiEIIAMgDBAHIAJBEU8EQCADQRBqIQIDQCACIAxBEGoiDBAHIAJBEGoiAiAISQ0ACwsgCCAdpyIGayECIAcgCjYCvAEgBiAIIA9rSwRAIAYgCCAVa0sEQEFsIRAMAgsgESACIA9rIgJqIgwgCWogEU0EQCAIIAwgCRAPGgwCCyAIIAxBACACaxAPIQggByACIAlqIgk2AsQBIAggAmshCCAPIQILIAZBEE8EQCAIIAlqIQYDQCAIIAIQByACQRBqIQIgCEEQaiIIIAZJDQALDAELAkAgBkEHTQRAIAggAi0AADoAACAIIAItAAE6AAEgCCACLQACOgACIAggAi0AAzoAAyAIQQRqIAIgBkECdCIGQcAeaigCAGoiAhAXIAIgBkHgHmooAgBrIQIgBygCxAEhCQwBCyAIIAIQDAsgCUEJSQ0AIAggCWohBiAIQQhqIgggAkEIaiICa0EPTARAA0AgCCACEAwgAkEIaiECIAhBCGoiCCAGSQ0ADAIACwALA0AgCCACEAcgAkEQaiECIAhBEGoiCCAGSQ0ACwsgEBADDQMgC0EBaiELIAMgEGohAwwBCwsDQCAEQQNHBEAgACAEQQJ0IgJqQazQAWogAiAHaigCVDYCACAEQQFqIQQMAQsLIAcoArwBIQgLQbp/IRAgEyAIayIAIBIgA2tLDQAgAwR/IAMgCCAAEAsgAGoFQQALIAFrIRALIAdB0AFqJAAgEAslACAAQgA3AgAgAEEAOwEIIABBADoACyAAIAE2AgwgACACOgAKC7QFAQN/IwBBMGsiBCQAIABB/wFqIgVBfWohBgJAIAMvAQIEQCAEQRhqIAEgAhAGIgIQAw0BIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahASOgAAIAMgBEEIaiAEQRhqEBI6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0FIAEgBEEQaiAEQRhqEBI6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWsiAyQAQWIhCAJAIAJBCUkNACAAQZjQAGogAUEIaiIEIAJBeGogAEGY0AAQMyIFEAMiBg0AIANBHzYCfCADIANB/ABqIANB+ABqIAQgBCAFaiAGGyIEIAEgAmoiAiAEaxAVIgUQAw0AIAMoAnwiBkEfSw0AIAMoAngiB0EJTw0AIABBiCBqIAMgBkGAC0GADCAHEBggA0E0NgJ8IAMgA0H8AGogA0H4AGogBCAFaiIEIAIgBGsQFSIFEAMNACADKAJ8IgZBNEsNACADKAJ4IgdBCk8NACAAQZAwaiADIAZBgA1B4A4gBxAYIANBIzYCfCADIANB/ABqIANB+ABqIAQgBWoiBCACIARrEBUiBRADDQAgAygCfCIGQSNLDQAgAygCeCIHQQpPDQAgACADIAZBwBBB0BEgBxAYIAQgBWoiBEEMaiIFIAJLDQAgAiAFayEFQQAhAgNAIAJBA0cEQCAEKAAAIgZBf2ogBU8NAiAAIAJBAnRqQZzQAWogBjYCACACQQFqIQIgBEEEaiEEDAELCyAEIAFrIQgLIANBgAFqJAAgCAtGAQN/IABBCGohAyAAKAIEIQJBACEAA0AgACACdkUEQCABIAMgAEEDdGotAAJBFktqIQEgAEEBaiEADAELCyABQQggAmt0C4YDAQV/Qbh/IQcCQCADRQ0AIAItAAAiBEUEQCABQQA2AgBBAUG4fyADQQFGGw8LAn8gAkEBaiIFIARBGHRBGHUiBkF/Sg0AGiAGQX9GBEAgA0EDSA0CIAUvAABBgP4BaiEEIAJBA2oMAQsgA0ECSA0BIAItAAEgBEEIdHJBgIB+aiEEIAJBAmoLIQUgASAENgIAIAVBAWoiASACIANqIgNLDQBBbCEHIABBEGogACAFLQAAIgVBBnZBI0EJIAEgAyABa0HAEEHQEUHwEiAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBmCBqIABBCGogBUEEdkEDcUEfQQggASABIAZqIAgbIgEgAyABa0GAC0GADEGAFyAAKAKM4QEgACgCnOIBIAQQHyIGEAMiCA0AIABBoDBqIABBBGogBUECdkEDcUE0QQkgASABIAZqIAgbIgEgAyABa0GADUHgDkGQGSAAKAKM4QEgACgCnOIBIAQQHyIAEAMNACAAIAFqIAJrIQcLIAcLrQMBCn8jAEGABGsiCCQAAn9BUiACQf8BSw0AGkFUIANBDEsNABogAkEBaiELIABBBGohCUGAgAQgA0F/anRBEHUhCkEAIQJBASEEQQEgA3QiB0F/aiIMIQUDQCACIAtGRQRAAkAgASACQQF0Ig1qLwEAIgZB//8DRgRAIAkgBUECdGogAjoAAiAFQX9qIQVBASEGDAELIARBACAKIAZBEHRBEHVKGyEECyAIIA1qIAY7AQAgAkEBaiECDAELCyAAIAQ7AQIgACADOwEAIAdBA3YgB0EBdmpBA2ohBkEAIQRBACECA0AgBCALRkUEQCABIARBAXRqLgEAIQpBACEAA0AgACAKTkUEQCAJIAJBAnRqIAQ6AAIDQCACIAZqIAxxIgIgBUsNAAsgAEEBaiEADAELCyAEQQFqIQQMAQsLQX8gAg0AGkEAIQIDfyACIAdGBH9BAAUgCCAJIAJBAnRqIgAtAAJBAXRqIgEgAS8BACIBQQFqOwEAIAAgAyABEBRrIgU6AAMgACABIAVB/wFxdCAHazsBACACQQFqIQIMAQsLCyEFIAhBgARqJAAgBQvjBgEIf0FsIQcCQCACQQNJDQACQAJAAkACQCABLQAAIgNBA3EiCUEBaw4DAwEAAgsgACgCiOEBDQBBYg8LIAJBBUkNAkEDIQYgASgAACEFAn8CQAJAIANBAnZBA3EiCEF+aiIEQQFNBEAgBEEBaw0BDAILIAVBDnZB/wdxIQQgBUEEdkH/B3EhAyAIRQwCCyAFQRJ2IQRBBCEGIAVBBHZB//8AcSEDQQAMAQsgBUEEdkH//w9xIgNBgIAISw0DIAEtAARBCnQgBUEWdnIhBEEFIQZBAAshBSAEIAZqIgogAksNAgJAIANBgQZJDQAgACgCnOIBRQ0AQQAhAgNAIAJBg4ABSw0BIAJBQGshAgwAAAsACwJ/IAlBA0YEQCABIAZqIQEgAEHw4gFqIQIgACgCDCEGIAUEQCACIAMgASAEIAYQXwwCCyACIAMgASAEIAYQXQwBCyAAQbjQAWohAiABIAZqIQEgAEHw4gFqIQYgAEGo0ABqIQggBQRAIAggBiADIAEgBCACEF4MAQsgCCAGIAMgASAEIAIQXAsQAw0CIAAgAzYCgOIBIABBATYCiOEBIAAgAEHw4gFqNgLw4QEgCUECRgRAIAAgAEGo0ABqNgIMCyAAIANqIgBBiOMBakIANwAAIABBgOMBakIANwAAIABB+OIBakIANwAAIABB8OIBakIANwAAIAoPCwJ/AkACQAJAIANBAnZBA3FBf2oiBEECSw0AIARBAWsOAgACAQtBASEEIANBA3YMAgtBAiEEIAEvAABBBHYMAQtBAyEEIAEQIUEEdgsiAyAEaiIFQSBqIAJLBEAgBSACSw0CIABB8OIBaiABIARqIAMQCyEBIAAgAzYCgOIBIAAgATYC8OEBIAEgA2oiAEIANwAYIABCADcAECAAQgA3AAggAEIANwAAIAUPCyAAIAM2AoDiASAAIAEgBGo2AvDhASAFDwsCfwJAAkACQCADQQJ2QQNxQX9qIgRBAksNACAEQQFrDgIAAgELQQEhByADQQN2DAILQQIhByABLwAAQQR2DAELIAJBBEkgARAhIgJBj4CAAUtyDQFBAyEHIAJBBHYLIQIgAEHw4gFqIAEgB2otAAAgAkEgahAQIQEgACACNgKA4gEgACABNgLw4QEgB0EBaiEHCyAHC0sAIABC+erQ0OfJoeThADcDICAAQgA3AxggAELP1tO+0ser2UI3AxAgAELW64Lu6v2J9eAANwMIIABCADcDACAAQShqQQBBKBAQGgviAgICfwV+IABBKGoiASAAKAJIaiECAn4gACkDACIDQiBaBEAgACkDECIEQgeJIAApAwgiBUIBiXwgACkDGCIGQgyJfCAAKQMgIgdCEol8IAUQGSAEEBkgBhAZIAcQGQwBCyAAKQMYQsXP2bLx5brqJ3wLIAN8IQMDQCABQQhqIgAgAk0EQEIAIAEpAAAQCSADhUIbiUKHla+vmLbem55/fkLj3MqV/M7y9YV/fCEDIAAhAQwBCwsCQCABQQRqIgAgAksEQCABIQAMAQsgASgAAK1Ch5Wvr5i23puef34gA4VCF4lCz9bTvtLHq9lCfkL5893xmfaZqxZ8IQMLA0AgACACSQRAIAAxAABCxc/ZsvHluuonfiADhUILiUKHla+vmLbem55/fiEDIABBAWohAAwBCwsgA0IhiCADhULP1tO+0ser2UJ+IgNCHYggA4VC+fPd8Zn2masWfiIDQiCIIAOFC+8CAgJ/BH4gACAAKQMAIAKtfDcDAAJAAkAgACgCSCIDIAJqIgRBH00EQCABRQ0BIAAgA2pBKGogASACECAgACgCSCACaiEEDAELIAEgAmohAgJ/IAMEQCAAQShqIgQgA2ogAUEgIANrECAgACAAKQMIIAQpAAAQCTcDCCAAIAApAxAgACkAMBAJNwMQIAAgACkDGCAAKQA4EAk3AxggACAAKQMgIABBQGspAAAQCTcDICAAKAJIIQMgAEEANgJIIAEgA2tBIGohAQsgAUEgaiACTQsEQCACQWBqIQMgACkDICEFIAApAxghBiAAKQMQIQcgACkDCCEIA0AgCCABKQAAEAkhCCAHIAEpAAgQCSEHIAYgASkAEBAJIQYgBSABKQAYEAkhBSABQSBqIgEgA00NAAsgACAFNwMgIAAgBjcDGCAAIAc3AxAgACAINwMICyABIAJPDQEgAEEoaiABIAIgAWsiBBAgCyAAIAQ2AkgLCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQEBogAwVBun8LCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQCxogAwVBun8LC6gCAQZ/IwBBEGsiByQAIABB2OABaikDAEKAgIAQViEIQbh/IQUCQCAEQf//B0sNACAAIAMgBBBCIgUQAyIGDQAgACgCnOIBIQkgACAHQQxqIAMgAyAFaiAGGyIKIARBACAFIAYbayIGEEAiAxADBEAgAyEFDAELIAcoAgwhBCABRQRAQbp/IQUgBEEASg0BCyAGIANrIQUgAyAKaiEDAkAgCQRAIABBADYCnOIBDAELAkACQAJAIARBBUgNACAAQdjgAWopAwBCgICACFgNAAwBCyAAQQA2ApziAQwBCyAAKAIIED8hBiAAQQA2ApziASAGQRRPDQELIAAgASACIAMgBSAEIAgQOSEFDAELIAAgASACIAMgBSAEIAgQOiEFCyAHQRBqJAAgBQtnACAAQdDgAWogASACIAAoAuzhARAuIgEQAwRAIAEPC0G4fyECAkAgAQ0AIABB7OABaigCACIBBEBBYCECIAAoApjiASABRw0BC0EAIQIgAEHw4AFqKAIARQ0AIABBkOEBahBDCyACCycBAX8QVyIERQRAQUAPCyAEIAAgASACIAMgBBBLEE8hACAEEFYgAAs/AQF/AkACQAJAIAAoAqDiAUEBaiIBQQJLDQAgAUEBaw4CAAECCyAAEDBBAA8LIABBADYCoOIBCyAAKAKU4gELvAMCB38BfiMAQRBrIgkkAEG4fyEGAkAgBCgCACIIQQVBCSAAKALs4QEiBRtJDQAgAygCACIHQQFBBSAFGyAFEC8iBRADBEAgBSEGDAELIAggBUEDakkNACAAIAcgBRBJIgYQAw0AIAEgAmohCiAAQZDhAWohCyAIIAVrIQIgBSAHaiEHIAEhBQNAIAcgAiAJECwiBhADDQEgAkF9aiICIAZJBEBBuH8hBgwCCyAJKAIAIghBAksEQEFsIQYMAgsgB0EDaiEHAn8CQAJAAkAgCEEBaw4CAgABCyAAIAUgCiAFayAHIAYQSAwCCyAFIAogBWsgByAGEEcMAQsgBSAKIAVrIActAAAgCSgCCBBGCyIIEAMEQCAIIQYMAgsgACgC8OABBEAgCyAFIAgQRQsgAiAGayECIAYgB2ohByAFIAhqIQUgCSgCBEUNAAsgACkD0OABIgxCf1IEQEFsIQYgDCAFIAFrrFINAQsgACgC8OABBEBBaiEGIAJBBEkNASALEEQhDCAHKAAAIAynRw0BIAdBBGohByACQXxqIQILIAMgBzYCACAEIAI2AgAgBSABayEGCyAJQRBqJAAgBgsuACAAECsCf0EAQQAQAw0AGiABRSACRXJFBEBBYiAAIAEgAhA9EAMNARoLQQALCzcAIAEEQCAAIAAoAsTgASABKAIEIAEoAghqRzYCnOIBCyAAECtBABADIAFFckUEQCAAIAEQWwsL0QIBB38jAEEQayIGJAAgBiAENgIIIAYgAzYCDCAFBEAgBSgCBCEKIAUoAgghCQsgASEIAkACQANAIAAoAuzhARAWIQsCQANAIAQgC0kNASADKAAAQXBxQdDUtMIBRgRAIAMgBBAiIgcQAw0EIAQgB2shBCADIAdqIQMMAQsLIAYgAzYCDCAGIAQ2AggCQCAFBEAgACAFEE5BACEHQQAQA0UNAQwFCyAAIAogCRBNIgcQAw0ECyAAIAgQUCAMQQFHQQAgACAIIAIgBkEMaiAGQQhqEEwiByIDa0EAIAMQAxtBCkdyRQRAQbh/IQcMBAsgBxADDQMgAiAHayECIAcgCGohCEEBIQwgBigCDCEDIAYoAgghBAwBCwsgBiADNgIMIAYgBDYCCEG4fyEHIAQNASAIIAFrIQcMAQsgBiADNgIMIAYgBDYCCAsgBkEQaiQAIAcLRgECfyABIAAoArjgASICRwRAIAAgAjYCxOABIAAgATYCuOABIAAoArzgASEDIAAgATYCvOABIAAgASADIAJrajYCwOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAEgAiADIAVqIAQgBWsgABA1BUG4fwsLRgEBfyMAQRBrIgUkACAFQQhqIAQQDgJ/IAUtAAkEQCAAIAEgAiADIAQQYgwBCyAAIAEgAiADIAQQNQshACAFQRBqJAAgAAtZAQF/QQ8hAiABIABJBEAgAUEEdCAAbiECCyAAQQh2IgEgAkEYbCIAQYwIaigCAGwgAEGICGooAgBqIgJBA3YgAmogAEGACGooAgAgAEGECGooAgAgAWxqSQs3ACAAIAMgBCAFQYAQEDMiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQMgVBuH8LC78DAQN/IwBBIGsiBSQAIAVBCGogAiADEAYiAhADRQRAIAAgAWoiB0F9aiEGIAUgBBAOIARBBGohAiAFLQACIQMDQEEAIAAgBkkgBUEIahAEGwRAIAAgAiAFQQhqIAMQAkECdGoiBC8BADsAACAFQQhqIAQtAAIQASAAIAQtAANqIgQgAiAFQQhqIAMQAkECdGoiAC8BADsAACAFQQhqIAAtAAIQASAEIAAtAANqIQAMAQUgB0F+aiEEA0AgBUEIahAEIAAgBEtyRQRAIAAgAiAFQQhqIAMQAkECdGoiBi8BADsAACAFQQhqIAYtAAIQASAAIAYtAANqIQAMAQsLA0AgACAES0UEQCAAIAIgBUEIaiADEAJBAnRqIgYvAQA7AAAgBUEIaiAGLQACEAEgACAGLQADaiEADAELCwJAIAAgB08NACAAIAIgBUEIaiADEAIiA0ECdGoiAC0AADoAACAALQADQQFGBEAgBUEIaiAALQACEAEMAQsgBSgCDEEfSw0AIAVBCGogAiADQQJ0ai0AAhABIAUoAgxBIUkNACAFQSA2AgwLIAFBbCAFQQhqEAobIQILCwsgBUEgaiQAIAILkgIBBH8jAEFAaiIJJAAgCSADQTQQCyEDAkAgBEECSA0AIAMgBEECdGooAgAhCSADQTxqIAgQIyADQQE6AD8gAyACOgA+QQAhBCADKAI8IQoDQCAEIAlGDQEgACAEQQJ0aiAKNgEAIARBAWohBAwAAAsAC0EAIQkDQCAGIAlGRQRAIAMgBSAJQQF0aiIKLQABIgtBAnRqIgwoAgAhBCADQTxqIAotAABBCHQgCGpB//8DcRAjIANBAjoAPyADIAcgC2siCiACajoAPiAEQQEgASAKa3RqIQogAygCPCELA0AgACAEQQJ0aiALNgEAIARBAWoiBCAKSQ0ACyAMIAo2AgAgCUEBaiEJDAELCyADQUBrJAALowIBCX8jAEHQAGsiCSQAIAlBEGogBUE0EAsaIAcgBmshDyAHIAFrIRADQAJAIAMgCkcEQEEBIAEgByACIApBAXRqIgYtAAEiDGsiCGsiC3QhDSAGLQAAIQ4gCUEQaiAMQQJ0aiIMKAIAIQYgCyAPTwRAIAAgBkECdGogCyAIIAUgCEE0bGogCCAQaiIIQQEgCEEBShsiCCACIAQgCEECdGooAgAiCEEBdGogAyAIayAHIA4QYyAGIA1qIQgMAgsgCUEMaiAOECMgCUEBOgAPIAkgCDoADiAGIA1qIQggCSgCDCELA0AgBiAITw0CIAAgBkECdGogCzYBACAGQQFqIQYMAAALAAsgCUHQAGokAA8LIAwgCDYCACAKQQFqIQoMAAALAAs0ACAAIAMgBCAFEDYiBRADBEAgBQ8LIAUgBEkEfyABIAIgAyAFaiAEIAVrIAAQNAVBuH8LCyMAIAA/AEEQdGtB//8DakEQdkAAQX9GBEBBAA8LQQAQAEEBCzsBAX8gAgRAA0AgACABIAJBgCAgAkGAIEkbIgMQCyEAIAFBgCBqIQEgAEGAIGohACACIANrIgINAAsLCwYAIAAQAwsLqBUJAEGICAsNAQAAAAEAAAACAAAAAgBBoAgLswYBAAAAAQAAAAIAAAACAAAAJgAAAIIAAAAhBQAASgAAAGcIAAAmAAAAwAEAAIAAAABJBQAASgAAAL4IAAApAAAALAIAAIAAAABJBQAASgAAAL4IAAAvAAAAygIAAIAAAACKBQAASgAAAIQJAAA1AAAAcwMAAIAAAACdBQAASgAAAKAJAAA9AAAAgQMAAIAAAADrBQAASwAAAD4KAABEAAAAngMAAIAAAABNBgAASwAAAKoKAABLAAAAswMAAIAAAADBBgAATQAAAB8NAABNAAAAUwQAAIAAAAAjCAAAUQAAAKYPAABUAAAAmQQAAIAAAABLCQAAVwAAALESAABYAAAA2gQAAIAAAABvCQAAXQAAACMUAABUAAAARQUAAIAAAABUCgAAagAAAIwUAABqAAAArwUAAIAAAAB2CQAAfAAAAE4QAAB8AAAA0gIAAIAAAABjBwAAkQAAAJAHAACSAAAAAAAAAAEAAAABAAAABQAAAA0AAAAdAAAAPQAAAH0AAAD9AAAA/QEAAP0DAAD9BwAA/Q8AAP0fAAD9PwAA/X8AAP3/AAD9/wEA/f8DAP3/BwD9/w8A/f8fAP3/PwD9/38A/f//AP3//wH9//8D/f//B/3//w/9//8f/f//P/3//38AAAAAAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABEAAAASAAAAEwAAABQAAAAVAAAAFgAAABcAAAAYAAAAGQAAABoAAAAbAAAAHAAAAB0AAAAeAAAAHwAAAAMAAAAEAAAABQAAAAYAAAAHAAAACAAAAAkAAAAKAAAACwAAAAwAAAANAAAADgAAAA8AAAAQAAAAEQAAABIAAAATAAAAFAAAABUAAAAWAAAAFwAAABgAAAAZAAAAGgAAABsAAAAcAAAAHQAAAB4AAAAfAAAAIAAAACEAAAAiAAAAIwAAACUAAAAnAAAAKQAAACsAAAAvAAAAMwAAADsAAABDAAAAUwAAAGMAAACDAAAAAwEAAAMCAAADBAAAAwgAAAMQAAADIAAAA0AAAAOAAAADAAEAQeAPC1EBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAEAAAABQAAAAcAAAAIAAAACQAAAAoAAAALAAAADAAAAA0AAAAOAAAADwAAABAAQcQQC4sBAQAAAAIAAAADAAAABAAAAAUAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAABIAAAAUAAAAFgAAABgAAAAcAAAAIAAAACgAAAAwAAAAQAAAAIAAAAAAAQAAAAIAAAAEAAAACAAAABAAAAAgAAAAQAAAAIAAAAAAAQBBkBIL5gQBAAAAAQAAAAEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAGAAAABwAAAAgAAAAJAAAACgAAAAsAAAAMAAAADQAAAA4AAAAPAAAAEAAAAAEAAAAEAAAACAAAAAAAAAABAAEBBgAAAAAAAAQAAAAAEAAABAAAAAAgAAAFAQAAAAAAAAUDAAAAAAAABQQAAAAAAAAFBgAAAAAAAAUHAAAAAAAABQkAAAAAAAAFCgAAAAAAAAUMAAAAAAAABg4AAAAAAAEFEAAAAAAAAQUUAAAAAAABBRYAAAAAAAIFHAAAAAAAAwUgAAAAAAAEBTAAAAAgAAYFQAAAAAAABwWAAAAAAAAIBgABAAAAAAoGAAQAAAAADAYAEAAAIAAABAAAAAAAAAAEAQAAAAAAAAUCAAAAIAAABQQAAAAAAAAFBQAAACAAAAUHAAAAAAAABQgAAAAgAAAFCgAAAAAAAAULAAAAAAAABg0AAAAgAAEFEAAAAAAAAQUSAAAAIAABBRYAAAAAAAIFGAAAACAAAwUgAAAAAAADBSgAAAAAAAYEQAAAABAABgRAAAAAIAAHBYAAAAAAAAkGAAIAAAAACwYACAAAMAAABAAAAAAQAAAEAQAAACAAAAUCAAAAIAAABQMAAAAgAAAFBQAAACAAAAUGAAAAIAAABQgAAAAgAAAFCQAAACAAAAULAAAAIAAABQwAAAAAAAAGDwAAACAAAQUSAAAAIAABBRQAAAAgAAIFGAAAACAAAgUcAAAAIAADBSgAAAAgAAQFMAAAAAAAEAYAAAEAAAAPBgCAAAAAAA4GAEAAAAAADQYAIABBgBcLhwIBAAEBBQAAAAAAAAUAAAAAAAAGBD0AAAAAAAkF/QEAAAAADwX9fwAAAAAVBf3/HwAAAAMFBQAAAAAABwR9AAAAAAAMBf0PAAAAABIF/f8DAAAAFwX9/38AAAAFBR0AAAAAAAgE/QAAAAAADgX9PwAAAAAUBf3/DwAAAAIFAQAAABAABwR9AAAAAAALBf0HAAAAABEF/f8BAAAAFgX9/z8AAAAEBQ0AAAAQAAgE/QAAAAAADQX9HwAAAAATBf3/BwAAAAEFAQAAABAABgQ9AAAAAAAKBf0DAAAAABAF/f8AAAAAHAX9//8PAAAbBf3//wcAABoF/f//AwAAGQX9//8BAAAYBf3//wBBkBkLhgQBAAEBBgAAAAAAAAYDAAAAAAAABAQAAAAgAAAFBQAAAAAAAAUGAAAAAAAABQgAAAAAAAAFCQAAAAAAAAULAAAAAAAABg0AAAAAAAAGEAAAAAAAAAYTAAAAAAAABhYAAAAAAAAGGQAAAAAAAAYcAAAAAAAABh8AAAAAAAAGIgAAAAAAAQYlAAAAAAABBikAAAAAAAIGLwAAAAAAAwY7AAAAAAAEBlMAAAAAAAcGgwAAAAAACQYDAgAAEAAABAQAAAAAAAAEBQAAACAAAAUGAAAAAAAABQcAAAAgAAAFCQAAAAAAAAUKAAAAAAAABgwAAAAAAAAGDwAAAAAAAAYSAAAAAAAABhUAAAAAAAAGGAAAAAAAAAYbAAAAAAAABh4AAAAAAAAGIQAAAAAAAQYjAAAAAAABBicAAAAAAAIGKwAAAAAAAwYzAAAAAAAEBkMAAAAAAAUGYwAAAAAACAYDAQAAIAAABAQAAAAwAAAEBAAAABAAAAQFAAAAIAAABQcAAAAgAAAFCAAAACAAAAUKAAAAIAAABQsAAAAAAAAGDgAAAAAAAAYRAAAAAAAABhQAAAAAAAAGFwAAAAAAAAYaAAAAAAAABh0AAAAAAAAGIAAAAAAAEAYDAAEAAAAPBgOAAAAAAA4GA0AAAAAADQYDIAAAAAAMBgMQAAAAAAsGAwgAAAAACgYDBABBpB0L2QEBAAAAAwAAAAcAAAAPAAAAHwAAAD8AAAB/AAAA/wAAAP8BAAD/AwAA/wcAAP8PAAD/HwAA/z8AAP9/AAD//wAA//8BAP//AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ",
4596ZT="display-p3",e1="display-p3-linear";({...tt.spaces[mt]});const lu=new WeakMap;let hu=0,uu;class On extends _i{constructor(e){super(e),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new VT,this.workerSourceURL="",this.workerConfig=null,typeof MSC_TRANSCODER<"u"&&console.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.')}setTranscoderPath(e){return this.transcoderPath=e,this}setWorkerLimit(e){return this.workerPool.setWorkerLimit(e),this}async detectSupportAsync(e){return console.warn('KTX2Loader: "detectSupportAsync()" has been deprecated. Use "detectSupport()" and "await renderer.init();" when creating the renderer.'),await e.init(),this.detectSupport(e)}detectSupport(e){return e.isWebGPURenderer===!0?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-s3tc"),bptcSupported:e.hasFeature("texture-compression-bc"),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")},typeof navigator<"u"&&typeof navigator.platform<"u"&&typeof navigator.userAgent<"u"&&navigator.platform.indexOf("Linux")>=0&&navigator.userAgent.indexOf("Firefox")>=0&&this.workerConfig.astcSupported&&this.workerConfig.etc2Supported&&this.workerConfig.bptcSupported&&this.workerConfig.dxtSupported&&(this.workerConfig.astcSupported=!1,this.workerConfig.etc2Supported=!1)),this}init(){if(!this.transcoderPending){const e=new Wi(this.manager);e.setPath(this.transcoderPath),e.setWithCredentials(this.withCredentials);const t=e.loadAsync("basis_transcoder.js"),n=new Wi(this.manager);n.setPath(this.transcoderPath),n.setResponseType("arraybuffer"),n.setWithCredentials(this.withCredentials);const i=n.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([t,i]).then(([s,a])=>{const o=On.BasisWorker.toString(),c=["/* constants */","let _EngineFormat = "+JSON.stringify(On.EngineFormat),"let _EngineType = "+JSON.stringify(On.EngineType),"let _TranscoderFormat = "+JSON.stringify(On.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(On.BasisFormat),"/* basis_transcoder.js */",s,"/* worker */",o.substring(o.indexOf("{")+1,o.lastIndexOf("}"))].join(`
4597`);this.workerSourceURL=URL.createObjectURL(new Blob([c])),this.transcoderBinary=a,this.workerPool.setWorkerCreator(()=>{const l=new Worker(this.workerSourceURL),h=this.transcoderBinary.slice(0);return l.postMessage({type:"init",config:this.workerConfig,transcoderBinary:h},[h]),l})}),hu>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),hu++}return this.transcoderPending}load(e,t,n,i){if(this.workerConfig===null)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");const s=new Wi(this.manager);s.setPath(this.path),s.setCrossOrigin(this.crossOrigin),s.setWithCredentials(this.withCredentials),s.setRequestHeader(this.requestHeader),s.setResponseType("arraybuffer"),s.load(e,a=>{this.parse(a,t,i)},n,i)}parse(e,t,n){if(this.workerConfig===null)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");if(lu.has(e))return lu.get(e).promise.then(t).catch(n);this._createTexture(e).then(i=>
4597t?t(i):null).catch(n)}_createTextureFrom(e,t){const{type:n,error:i,data:{faces:s,width:a,height:o,format:c,type:l,dfdFlags:h}}=e;if(n==="error")return Promise.reject(i);let u;if(t.faceCount===6)u=new Lv(s,c,l);else{const d=s[0].mipmaps;u=t.layerCount>1?new Dv(d,a,o,t.layerCount,c,l):new tr(d,a,o,c,l)}return u.minFilter=s[0].mipmaps.length===1?qe:yn,u.magFilter=qe,u.generateMipmaps=!1,u.needsUpdate=!0,u.colorSpace=Lx(t),u.premultiplyAlpha=!!(h&qT),u}async _createTexture(e,t={}){const n=YT(new Uint8Array(e)),i=n.vkFormat===ep&&n.dataFormatDescriptor[0].colorModel===167;if(!(n.vkFormat===$T||i&&!this.workerConfig.astcHDRSupported))return n1(n);const a=t,o=this.init().then(()=>this.workerPool.postMessage({type:"transcode",buffer:e,taskConfig:a},[e])).then(c=>this._createTextureFrom(c.data,n));return lu.set(e,{promise:o}),o}dispose(){this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),hu--}}On.BasisFormat={ETC1S:0,UASTC:1,UASTC_HDR:2};On.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};On.EngineFormat={RGBAFormat:Tt,RGBA_ASTC_4x4_Format:er,RGB_BPTC_UNSIGNED_Format:Il,RGBA_BPTC_Format:ca,RGBA_ETC2_EAC_Format:Lo,RGBA_PVRTC_4BPPV1_Format:oa,RGBA_S3TC_DXT5_Format:Zs,RGB_ETC1_Format:vl,RGB_ETC2_Format:Do,RGB_PVRTC_4BPPV1_Format:_l,RGBA_S3TC_DXT1_Format:Js};On.EngineType={UnsignedByteType:Le,HalfFloatType:yt,FloatType:Nt};On.BasisWorker=function(){let r,e,t;const n=_EngineFormat,i=_EngineType,s=_TranscoderFormat,a=_BasisFormat;self.addEventListener("message",function(p){const m=p.data;switch(m.type){case"init":r=m.config,o(m.transcoderBinary);break;case"transcode":e.then(()=>{try{const{faces:A,buffers:g,width:b,height:x,hasAlpha:_,format:v,type:C,dfdFlags:I}=c(m.buffer);self.postMessage({type:"transcode",id:m.id,data:{faces:A,width:b,height:x,hasAlpha:_,format:v,type:C,dfdFlags:I}},g)}catch(A){console.error(A),self.postMessage({type:"error",id:m.id,error:A.message})}});break}});function o(p){e=new Promise(m=>{t={wasmBinary:p,onRuntimeInitialized:m},BASIS(t)}).then(()=>{t.initializeBasis(),t.KTX2File===void 0&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")})}
vendor: 4,095 bytes, line 4597
4597function c(p){const m=new t.KTX2File(new Uint8Array(p));function A(){m.close(),m.delete()}if(!m.isValid())throw A(),new Error("THREE.KTX2Loader:	Invalid or unsupported .ktx2 file");let g;if(m.isUASTC())g=a.UASTC;else if(m.isETC1S())g=a.ETC1S;else if(m.isHDR())g=a.UASTC_HDR;else throw new Error("THREE.KTX2Loader: Unknown Basis encoding");const b=m.getWidth(),x=m.getHeight(),_=m.getLayers()||1,v=m.getLevels(),C=m.getFaces(),I=m.getHasAlpha(),E=m.getDFDFlags(),{transcoderFormat:S,engineFormat:P,engineType:w}=u(g,b,x,I);if(!b||!x||!v)throw A(),new Error("THREE.KTX2Loader:	Invalid texture");if(!m.startTranscoding())throw A(),new Error("THREE.KTX2Loader: .startTranscoding failed");const L=[],N=[];for(let O=0;O<C;O++){const D=[];for(let U=0;U<v;U++){const F=[];let $,q;for(let Z=0;Z<_;Z++){const Y=m.getImageLevelInfo(U,Z,O);O===0&&U===0&&Z===0&&(Y.origWidth%4!==0||Y.origHeight%4!==0)&&console.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."),v>1?($=Y.origWidth,q=Y.origHeight):($=Y.width,q=Y.height);let fe=new Uint8Array(m.getImageTranscodedSizeInBytes(U,Z,0,S));const Ge=m.transcodeImage(fe,U,Z,O,S,0,-1,-1);if(w===i.HalfFloatType&&(fe=new Uint16Array(fe.buffer,fe.byteOffset,fe.byteLength/Uint16Array.BYTES_PER_ELEMENT)),!Ge)throw A(),new Error("THREE.KTX2Loader: .transcodeImage failed.");F.push(fe)}const te=f(F);D.push({data:te,width:$,height:q}),N.push(te.buffer)}L.push({mipmaps:D,width:b,height:x,format:P,type:w})}return A(),{faces:L,buffers:N,width:b,height:x,hasAlpha:I,dfdFlags:E,format:P,type:w}}const l=[{if:"astcSupported",basisFormat:[a.UASTC],transcoderFormat:[s.ASTC_4x4,s.ASTC_4x4],engineFormat:[n.RGBA_ASTC_4x4_Format,n.RGBA_ASTC_4x4_Format],engineType:[i.UnsignedByteType],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[a.ETC1S,a.UASTC],transcoderFormat:[s.BC7_M5,s.BC7_M5],engineFormat:[n.RGBA_BPTC_Format,n.RGBA_BPTC_Format],engineType:[i.UnsignedByteType],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[a.ETC1S,a.UASTC],transcoderFormat:[s.BC1,s.BC3],engineFormat:[n.RGBA_S3TC_DXT1_Format,n.RGBA_S3TC_DXT5_Format],engineType:[i.UnsignedByteType],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[a.ETC1S,a.UASTC],transcoderFormat:[s.ETC1,s.ETC2],engineFormat:[n.RGB_ETC2_Format,n.RGBA_ETC2_EAC_Format],engineType:[i.UnsignedByteType],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[a.ETC1S,a.UASTC],transcoderFormat:[s.ETC1],engineFormat:[n.RGB_ETC1_Format],engineType:[i.UnsignedByteType],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[a.ETC1S,a.UASTC],transcoderFormat:[s.PVRTC1_4_RGB,s.PVRTC1_4_RGBA],engineFormat:[n.RGB_PVRTC_4BPPV1_Format,n.RGBA_PVRTC_4BPPV1_Format],engineType:[i.UnsignedByteType],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0},{if:"bptcSupported",basisFormat:[a.UASTC_HDR],transcoderFormat:[s.BC6H],engineFormat:[n.RGB_BPTC_UNSIGNED_Format],engineType:[i.HalfFloatType],priorityHDR:1,needsPowerOfTwo:!1},{basisFormat:[a.ETC1S,a.UASTC],transcoderFormat:[s.RGBA32,s.RGBA32],engineFormat:[n.RGBAFormat,n.RGBAFormat],engineType:[i.UnsignedByteType,i.UnsignedByteType],priorityETC1S:100,priorityUASTC:100,needsPowerOfTwo:!1},{basisFormat:[a.UASTC_HDR],transcoderFormat:[s.RGBA_HALF],engineFormat:[n.RGBAFormat],engineType:[i.HalfFloatType],priorityHDR:100,needsPowerOfTwo:!1}],h={[a.ETC1S]:l.filter(p=>p.basisFormat.includes(a.ETC1S)).sort((p,m)=>p.priorityETC1S-m.priorityETC1S),[a.UASTC]:l.filter(p=>p.basisFormat.includes(a.UASTC)).sort((p,m)=>p.priorityUASTC-m.priorityUASTC),[a.UASTC_HDR]:l.filter(p=>p.basisFormat.includes(a.UASTC_HDR)).sort((p,m)=>p.priorityHDR-m.priorityHDR)};function u(p,m,A,g){const b=h[p];for(let x=0;x<b.length;x++){const _=b[x];if(_.if&&!r[_.if]||!_.basisFormat.includes(p)||g&&_.transcoderFormat.length<2||_.needsPowerOfTwo&&!(d(m)&&d(A)))continue;const v=_.transcoderFormat[g?1:0],C=_.engineFormat[g?1:0],I=_.engineType[0];return{transcoderFormat:v,engineFormat:C,engineType:I}}
4597throw new Error("THREE.KTX2Loader: Failed to identify transcoding target.")}function d(p){return p<=2?!0:(p&p-1)===0&&p!==0}function f(p){if(p.length===1)return p[0];let m=0;for(let b=0;b<p.length;b++){const x=p[b];m+=x.byteLength}const A=new Uint8Array(m);let g=0;for(let b=0;b<p.length;b++){const x=p[b];A.set(x,g),g+=x.byteLength}return A}};const t1=new Set([Tt,Ro,Jn,ds]),du={[ix]:Tt,[nx]:Jn,[tx]:ds,[ex]:Tt,[Zb]:Jn,[Jb]:ds,[Yb]:Tt,[$b]:Tt,[Kb]:Jn,[Xb]:Jn,[jb]:ds,[qb]:ds,[rx]:Ro,[sx]:Ro,[xx]:Lo,[bx]:Do,[Ex]:yl,[_x]:Sl,[vx]:Cl,[yx]:Ml,[ep]:er,[Cx]:er,[Sx]:er,[Dx]:$r,[Ix]:$r,[Mx]:$r,[lx]:Js,[cx]:Js,[ox]:Kr,[ax]:Kr,[ux]:Zs,[hx]:Zs,[fx]:Tl,[dx]:wl,[Ax]:Bl,[px]:Rl,[mx]:ca,[gx]:ca,[Bx]:oa,[Tx]:oa,[Rx]:Bo,[wx]:Bo},Ir={[ix]:Nt,[nx]:Nt,[tx]:Nt,[ex]:yt,[Zb]:yt,[Jb]:yt,[Yb]:Le,[$b]:Le,[Kb]:Le,[Xb]:Le,[jb]:Le,[qb]:Le,[rx]:eh,[sx]:th,[xx]:Le,[bx]:Le,[Ex]:Le,[_x]:Le,[vx]:Le,[yx]:Le,[ep]:yt,[Cx]:Le,[Sx]:Le,[Dx]:yt,[Ix]:Le,[Mx]:Le,[lx]:Le,[cx]:Le,[ox]:Le,[ax]:Le,[ux]:Le,[hx]:Le,[fx]:Le,[dx]:Le,[Ax]:Le,[px]:Le,[mx]:Le,[gx]:Le,[Bx]:Le,[Tx]:Le,[Rx]:Le,[wx]:Le};async function n1(r){const{vkFormat:e}=r;if(du[e]===void 0)throw new Error("THREE.KTX2Loader: Unsupported vkFormat: "+e);Ir[e]===void 0&&console.warn('THREE.KTX2Loader: Missing ".type" for vkFormat: '+e);let t;r.supercompressionScheme===ag&&(uu||(uu=new Promise(async a=>{const o=new JT;await o.init(),a(o)})),t=await uu);const n=[];for(let a=0;a<r.levels.length;a++){const o=Math.max(1,r.pixelWidth>>a),c=Math.max(1,r.pixelHeight>>a),l=r.pixelDepth?Math.max(1,r.pixelDepth>>a):0,h=r.levels[a];let u;if(r.supercompressionScheme===WT)u=h.levelData;else if(r.supercompressionScheme===ag)u=t.decode(h.levelData,h.uncompressedByteLength);else throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");let d;Ir[e]===Nt?d=new Float32Array(u.buffer,u.byteOffset,u.byteLength/Float32Array.BYTES_PER_ELEMENT):Ir[e]===yt?d=new Uint16Array(u.buffer,u.byteOffset,u.byteLength/Uint16Array.BYTES_PER_ELEMENT):Ir[e]===eh||Ir[e]===th?d=new Uint32Array(u.buffer,u.byteOffset,u.byteLength/Uint32Array.BYTES_PER_ELEMENT):d=u,n.push({data:d,width:o,height:c,depth:l})}const i=r.levelCount===0||n.length>1;let s;if(t1.has(du[e]))s=r.pixelDepth===0?new Ea(n[0].data,r.pixelWidth,r.pixelHeight):new ib(n[0].data,r.pixelWidth,r.pixelHeight,r.pixelDepth),s.minFilter=i?xa:St,s.magFilter=St,s.generateMipmaps=r.levelCount===0;else{if(r.pixelDepth>0)throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");s=new tr(n,r.pixelWidth,r.pixelHeight),s.minFilter=i?yn:qe,s.magFilter=qe}
vendor: 43,047 bytes, lines 4597-4636
4597return s.mipmaps=n,s.type=Ir[e],s.format=du[e],s.colorSpace=Lx(r),s.needsUpdate=!0,Promise.resolve(s)}function Lx(r){const e=r.dataFormatDescriptor[0];return e.colorPrimaries===XT?e.transferFunction===og?mt:Ct:e.colorPrimaries===KT?e.transferFunction===og?ZT:e1:(e.colorPrimaries===jT||console.warn(`THREE.KTX2Loader: Unsupported color primaries, "${e.colorPrimaries}"`),Un)}/* @license
4598 * Copyright 2019 Google LLC. All Rights Reserved.
4599 * Licensed under the Apache License, Version 2.0 (the 'License');
4600 * you may not use this file except in compliance with the License.
4601 * You may obtain a copy of the License at
4602 *
4603 *     http://www.apache.org/licenses/LICENSE-2.0
4604 *
4605 * Unless required by applicable law or agreed to in writing, software
4606 * distributed under the License is distributed on an 'AS IS' BASIS,
4607 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4608 * See the License for the specific language governing permissions and
4609 * limitations under the License.
4610 */var hg,ug;const Kn=Symbol("retainerCount"),Ri=Symbol("recentlyUsed"),Rc=Symbol("evict"),Oa=Symbol("evictionThreshold"),fu=Symbol("cache");class i1{constructor(e,t=5){this[hg]=new Map,this[ug]=[],this[fu]=e,this[Oa]=t}set evictionThreshold(e){this[Oa]=e,this[Rc]()}get evictionThreshold(){return this[Oa]}get cache(){return this[fu]}retainerCount(e){return this[Kn].get(e)||0}reset(){this[Kn].clear(),this[Ri]=[]}retain(e){this[Kn].has(e)||this[Kn].set(e,0),this[Kn].set(e,this[Kn].get(e)+1);const t=this[Ri].indexOf(e);t!==-1&&this[Ri].splice(t,1),this[Ri].unshift(e),this[Rc]()}release(e){this[Kn].has(e)&&this[Kn].set(e,Math.max(this[Kn].get(e)-1,0)),this[Rc]()}[(hg=Kn,ug=Ri,Rc)](){if(!(this[Ri].length<this[Oa]))for(let e=this[Ri].length-1;e>=this[Oa];--e){const t=this[Ri][e];this[Kn].get(t)===0&&(this[fu].delete(t),this[Ri].splice(e,1))}}}/* @license
4611 * Copyright 2021 Google LLC. All Rights Reserved.
4612 * Licensed under the Apache License, Version 2.0 (the 'License');
4613 * you may not use this file except in compliance with the License.
4614 * You may obtain a copy of the License at
4615 *
4616 *     http://www.apache.org/licenses/LICENSE-2.0
4617 *
4618 * Unless required by applicable law or agreed to in writing, software
4619 * distributed under the License is distributed on an 'AS IS' BASIS,
4620 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4621 * See the License for the specific language governing permissions and
4622 * limitations under the License.
4623 */const s1=r=>{const e=[],t=new Set;for(const n of r){let i=n,s=0;for(;t.has(i);)i=n+"."+ ++s;t.add(i),e.push(i)}return e},r1=r=>{const e=new Map;for(const t of r.mappings)for(const n of t.variants)e.set(n,{material:null,gltfMaterialIndex:t.material});return e};class a1{constructor(e){this.parser=e,this.name="KHR_materials_variants"}afterRoot(e){const t=this.parser,n=t.json;if(n.extensions===void 0||n.extensions[this.name]===void 0)return null;const s=n.extensions[this.name].variants||[],a=s1(s.map(o=>o.name));for(const o of e.scenes)o.traverse(c=>{const l=c;if(!l.material)return;const h=t.associations.get(l);if(h==null||h.meshes==null||h.primitives==null)return;const p=n.meshes[h.meshes].primitives[h.primitives].extensions;!p||!p[this.name]||(l.userData.variantMaterials=r1(p[this.name]))});return e.userData.variants=a,Promise.resolve()}}/* @license
4624 * Copyright 2019 Google LLC. All Rights Reserved.
4625 * Licensed under the Apache License, Version 2.0 (the 'License');
4626 * you may not use this file except in compliance with the License.
4627 * You may obtain a copy of the License at
4628 *
4629 *     http://www.apache.org/licenses/LICENSE-2.0
4630 *
4631 * Unless required by applicable law or agreed to in writing, software
4632 * distributed under the License is distributed on an 'AS IS' BASIS,
4633 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4634 * See the License for the specific language governing permissions and
4635 * limitations under the License.
4636 */var Px,dg;Rt.DEFAULT_ANISOTROPY=4;const o1=(r,e,t=()=>{})=>{const n=i=>{const s=i.loaded/i.total;t(Math.max(0,Math.min(1,isFinite(s)?s:1)))};return new Promise((i,s)=>{e.load(r,i,n,s)})},c1=r=>new Promise((e,t)=>{const n=document.createElement("script");document.body.appendChild(n),n.onload=e,n.onerror=t,n.async=!0,n.src=r}),Bi=new Map,pu=new Map;let fg;const pg=new cT;let Ag;const yo=new On;let Au,gu;const Qs=Symbol("loader"),as=Symbol("evictionPolicy"),gg=Symbol("GLTFInstance");class vn extends si{static setDRACODecoderLocation(e){fg=e,pg.setDecoderPath(e)}static getDRACODecoderLocation(){return fg}static setKTX2TranscoderLocation(e){Ag=e,yo.setTranscoderPath(e)}static getKTX2TranscoderLocation(){return Ag}static setMeshoptDecoderLocation(e){Au!==e&&(Au=e,gu=c1(e).then(()=>ZA.ready).then(()=>ZA))}static getMeshoptDecoderLocation(){return Au}static initializeKTX2Loader(e){yo.detectSupport(e)}static get cache(){return Bi}static clearCache(){Bi.forEach((e,t)=>{this.delete(t)}),this[as].reset()}static has(e){return Bi.has(e)}static async delete(e){if(!this.has(e))return;const t=Bi.get(e);pu.delete(e),Bi.delete(e),(await t).dispose()}static hasFinishedLoading(e){return!!pu.get(e)}constructor(e){super(),this[dg]=new hT().register(t=>new a1(t)),this[gg]=e,this[Qs].setDRACOLoader(pg),this[Qs].setKTX2Loader(yo)}get[(Px=as,dg=Qs,as)](){return this.constructor[as]}async preload(e,t,n=()=>{}){if(this[Qs].setWithCredentials(t.withCredentials),this.dispatchEvent({type:"preload",element:t,src:e}),!Bi.has(e)){gu!=null&&this[Qs].setMeshoptDecoder(await gu);const i=o1(e,this[Qs],o=>{n(o*.8)}),s=this[gg],a=i.then(o=>s.prepare(o)).then(o=>(n(.9),new s(o))).catch((o=>(console.error(o),new s)));Bi.set(e,a)}await Bi.get(e),pu.set(e,!0),n&&n(1)}async load(e,t,n=()=>{}){await this.preload(e,t,n);const s=await(await Bi.get(e)).clone();return this[as].retain(e),s.dispose=()=>{this[as].release(e)},s}}vn[Px]=new i1(vn);class l1 extends ht{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 pe(.5,.5),this.addEventListener("removed",function(){this.traverse(function(t){t.element&&t.element instanceof t.element.ownerDocument.defaultView.Element&&t.element.parentNode!==null&&t.element.remove()})})}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this.center=e.center,this}}const wr=new R,mg=new Oe,bg=new Oe,xg=new R,Eg=new R;class h1{constructor(e={}){const t=this;let n,i,s,a;const o={objects:new WeakMap},c=e.element!==void 0?e.element:document.createElement("div");c.style.overflow="hidden",this.domElement=c,this.sortObjects=!0,this.getSize=function(){return{width:n,height:i}},this.render=function(p,m){p.matrixWorldAutoUpdate===!0&&p.updateMatrixWorld(),m.parent===null&&m.matrixWorldAutoUpdate===!0&&m.updateMatrixWorld(),mg.copy(m.matrixWorldInverse),bg.multiplyMatrices(m.projectionMatrix,mg),h(p,p,m),this.sortObjects&&f(p)},this.setSize=function(p,m){n=p,i=m,s=n/2,a=i/2,c.style.width=p+"px",c.style.height=m+"px"};function l(p){p.isCSS2DObject&&(p.element.style.display="none");for(let m=0,A=p.children.length;m<A;m++)l(p.children[m])}function h(p,m,A){if(p.visible===!1){l(p);return}if(p.isCSS2DObject){wr.setFromMatrixPosition(p.matrixWorld),wr.applyMatrix4(bg);const g=wr.z>=-1&&wr.z<=1&&p.layers.test(A.layers)===!0,b=p.element;b.style.display=g===!0?"":"none",g===!0&&(p.onBeforeRender(t,m,A),b.style.transform="translate("+-100*p.center.x+"%,"+-100*p.center.y+"%)translate("+(wr.x*s+s)+"px,"+(-wr.y*a+a)+"px)",b.parentNode!==c&&c.appendChild(b),p.onAfterRender(t,m,A));const x={distanceToCameraSquared:u(A,p)};o.objects.set(p,x)}for(let g=0,b=p.children.length;g<b;g++)h(p.children[g],m,A)}function u(p,m){return xg.setFromMatrixPosition(p.matrixWorld),Eg.setFromMatrixPosition(m.matrixWorld),xg.distanceToSquared(Eg)}function d(p){const m=[];return p.traverseVisible(function(A){A.isCSS2DObject&&m.push(A)}),m}function f(p){const m=d(p).sort(function(g,b){if(g.renderOrder!==b.renderOrder)return b.renderOrder-g.renderOrder;const x=o.objects.get(g).distanceToCameraSquared,_=o.objects.get(b).distanceToCameraSquared;return x-_}),A=m.length;for(let g=0,b=m.length;g<b;g++)m[g].element.style.zIndex=A-g}}}function Bc(r,e,t){let n=t;const i=new R;return r.updateWorldMatrix(!0,!0),r.traverseVisible(s=>{const{geometry:a}=s;if(a!==void 0){const{position:o}=a.attributes;if(o!==void 0)for(let c=0,l=o.count;c<l;c++)s.isMesh?s.getVertexPosition(c,i):i.fromBufferAttribute(o,c),s.isSkinnedMesh||i.applyMatrix4(s.matrixWorld),n=e(n,i)}}),n}const _g={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 So{constructor(){this.textureUtils=null,this.pluginCallbacks=[],this.register(function(e){return new _1(e)}),this.register(function(e){return new v1(e)}),this.register(function(e){return new M1(e)}),this.register(function(e){return new I1(e)}),this.register(function(e){return new w1(e)}),this.register(function(e){return new T1(e)}),this.register(function(e){return new y1(e)}),this.register(function(e){return new S1(e)}),this.register(function(e){return new C1(e)}),this.register(function(e){return new R1(e)}),this.register(function(e){return new B1(e)}),this.register(function(e){return new D1(e)}),this.register(function(e){return new L1(e)}),this.register(function(e){return new P1(e)})}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}setTextureUtils(e){return this.textureUtils=e,this}parse(e,t,n,i){const s=new E1,a=[];for(let o=0,c=this.pluginCallbacks.length;o<c;o++)a.push(this.pluginCallbacks[o](s));s.setPlugins(a),s.setTextureUtils(this.textureUtils),s.writeAsync(e,t,i).catch(n)}parseAsync(e,t){const n=this;return new Promise(function(i,s){n.parse(e,i,s,t)})}}const et={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,BYTE:5120,UNSIGNED_BYTE:5121,SHORT:5122,UNSIGNED_SHORT:5123,INT:5124,UNSIGNED_INT:5125,FLOAT:5126,ARRAY_BUFFER:34962,ELEMENT_ARRAY_BUFFER:34963,NEAREST:9728,LINEAR:9729,NEAREST_MIPMAP_NEAREST:9984,LINEAR_MIPMAP_NEAREST:9985,NEAREST_MIPMAP_LINEAR:9986,LINEAR_MIPMAP_LINEAR:9987,CLAMP_TO_EDGE:33071,MIRRORED_REPEAT:33648,REPEAT:10497},mu="KHR_mesh_quantization",Bn={};Bn[St]=et.NEAREST;Bn[xa]=et.NEAREST_MIPMAP_NEAREST;Bn[us]=et.NEAREST_MIPMAP_LINEAR;Bn[qe]=et.LINEAR;Bn[Ys]=et.LINEAR_MIPMAP_NEAREST;Bn[yn]=et.LINEAR_MIPMAP_LINEAR;Bn[Dt]=et.CLAMP_TO_EDGE;Bn[ni]=et.REPEAT;Bn[ir]=et.MIRRORED_REPEAT;const vg={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"},u1=new Me,yg=12,d1=1179937895,f1=2,Sg=8,p1=1313821514,A1=5130562;function Oi(r,e){return r.length===e.length&&r.every(function(t,n){return t===e[n]})}function g1(r){return new TextEncoder().encode(r).buffer}function m1(r){return Oi(r.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}function b1(r,e,t){const n={min:new Array(r.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(r.itemSize).fill(Number.NEGATIVE_INFINITY)};for(let i=e;i<e+t;i++)for(let s=0;s<r.itemSize;s++){let a;r.itemSize>4?a=r.array[i*r.itemSize+s]:(s===0?a=r.getX(i):s===1?a=r.getY(i):s===2?a=r.getZ(i):s===3&&(a=r.getW(i)),r.normalized===!0&&(a=Ul.normalize(a,r.array))),n.min[s]=Math.min(n.min[s],a),n.max[s]=Math.max(n.max[s],a)}return n}function Fx(r){return Math.ceil(r/4)*4}function bu(r,e=0){const t=Fx(r.byteLength);if(t!==r.byteLength){const n=new Uint8Array(t);if(n.set(new Uint8Array(r)),e!==0)for(let i=r.byteLength;i<t;i++)n[i]=e;return n.buffer}return r}function Cg(){return typeof document>"u"&&typeof OffscreenCanvas<"u"?new OffscreenCanvas(1,1):document.createElement("canvas")}function x1(r,e){if(typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas){let t;return e==="image/jpeg"?t=.92:e==="image/webp"&&(t=.8),r.convertToBlob({type:e,quality:t})}else return new Promise(t=>r.toBlob(t,e))}class E1{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"+Yl}},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,n={}){this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},n),this.options.animations.length>0&&(this.options.trs=!0),await this.processInputAsync(e),await Promise.all(this.pending);const i=this,s=i.buffers,a=i.json;n=i.options;const o=i.extensionsUsed,c=i.extensionsRequired,l=new Blob(s,{type:"application/octet-stream"}),h=Object.keys(o),u=Object.keys(c);if(h.length>0&&(a.extensionsUsed=h),u.length>0&&(a.extensionsRequired=u),a.buffers&&a.buffers.length>0&&(a.buffers[0].byteLength=l.size),n.binary===!0){const d=new FileReader;d.readAsArrayBuffer(l),d.onloadend=function(){const f=bu(d.result),p=new DataView(new ArrayBuffer(Sg));p.setUint32(0,f.byteLength,!0),p.setUint32(4,A1,!0);const m=bu(g1(JSON.stringify(a)),32),A=new DataView(new ArrayBuffer(Sg));A.setUint32(0,m.byteLength,!0),A.setUint32(4,p1,!0);const g=new ArrayBuffer(yg),b=new DataView(g);b.setUint32(0,d1,!0),b.setUint32(4,f1,!0);const x=yg+A.byteLength+m.byteLength+p.byteLength+f.byteLength;b.setUint32(8,x,!0);const _=new Blob([g,A,m,p,f],{type:"application/octet-stream"}),v=new FileReader;v.readAsArrayBuffer(_),v.onloadend=function(){t(v.result)}}}else if(a.buffers&&a.buffers.length>0){const d=new FileReader;d.readAsDataURL(l),d.onloadend=function(){const f=d.result;a.buffers[0].uri=f,t(a)}}else t(a)}serializeUserData(e,t){if(Object.keys(e.userData).length===0)return;const n=this.options,i=this.extensionsUsed;try{const s=JSON.parse(JSON.stringify(e.userData));if(n.includeCustomExtensions&&s.gltfExtensions){t.extensions===void 0&&(t.extensions={});for(const a in s.gltfExtensions)t.extensions[a]=s.gltfExtensions[a],i[a]=!0;delete s.gltfExtensions}Object.keys(s).length>0&&(t.extras=s)}catch(s){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+s.message)}}getUID(e,t=!1){if(this.uids.has(e)===!1){const i=new Map;i.set(!0,this.uid++),i.set(!1,this.uid++),this.uids.set(e,i)}return this.uids.get(e).get(t)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;const n=new R;for(let i=0,s=e.count;i<s;i++)if(Math.abs(n.fromBufferAttribute(e,i).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 n=e.clone(),i=new R;for(let s=0,a=n.count;s<a;s++)i.fromBufferAttribute(n,s),i.x===0&&i.y===0&&i.z===0?i.setX(1):i.normalize(),n.setXYZ(s,i.x,i.y,i.z);return t.attributesNormalized.set(e,n),n}applyTextureTransform(e,t){let n=!1;const i={};(t.offset.x!==0||t.offset.y!==0)&&(i.offset=t.offset.toArray(),n=!0),t.rotation!==0&&(i.rotation=t.rotation,n=!0),(t.repeat.x!==1||t.repeat.y!==1)&&(i.scale=t.repeat.toArray(),n=!0),n&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=i,this.extensionsUsed.KHR_texture_transform=!0)}async buildMetalRoughTextureAsync(e,t){if(e===t)return e;function n(f){return f.colorSpace===mt?function(m){return m<.04045?m*.0773993808:Math.pow(m*.9478672986+.0521327014,2.4)}:function(m){return m}}e instanceof tr&&(e=await this.decompressTextureAsync(e)),t instanceof tr&&(t=await this.decompressTextureAsync(t));const i=e?e.image:null,s=t?t.image:null,a=Math.max(i?i.width:0,s?s.width:0),o=Math.max(i?i.height:0,s?s.height:0),c=Cg();c.width=a,c.height=o;const l=c.getContext("2d",{willReadFrequently:!0});l.fillStyle="#00ffff",l.fillRect(0,0,a,o);const h=l.getImageData(0,0,a,o);if(i){l.drawImage(i,0,0,a,o);const f=n(e),p=l.getImageData(0,0,a,o).data;for(let m=2;m<p.length;m+=4)h.data[m]=f(p[m]/256)*256}if(s){l.drawImage(s,0,0,a,o);const f=n(t),p=l.getImageData(0,0,a,o).data;for(let m=1;m<p.length;m+=4)h.data[m]=f(p[m]/256)*256}l.putImageData(h,0,0);const d=(e||t).clone();return d.source=new nh(c),d.colorSpace=Un,d.channel=(e||t).channel,e&&t&&e.channel!==t.channel&&console.warn("THREE.GLTFExporter: UV channels for metalnessMap and roughnessMap textures must match."),console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures."),d}async decompressTextureAsync(e,t=1/0){if(this.textureUtils===null)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,n=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),n.push(e),0}processBufferView(e,t,n,i,s){const a=this.json;a.bufferViews||(a.bufferViews=[]);let o;switch(t){case et.BYTE:case et.UNSIGNED_BYTE:o=1;break;case et.SHORT:case et.UNSIGNED_SHORT:o=2;break;default:o=4}let c=e.itemSize*o;s===et.ARRAY_BUFFER&&(c=Math.ceil(c/4)*4);const l=Fx(i*c),h=new DataView(new ArrayBuffer(l));let u=0;for(let p=n;p<n+i;p++){for(let m=0;m<e.itemSize;m++){let A;e.itemSize>4?A=e.array[p*e.itemSize+m]:(m===0?A=e.getX(p):m===1?A=e.getY(p):m===2?A=e.getZ(p):m===3&&(A=e.getW(p)),e.normalized===!0&&(A=Ul.normalize(A,e.array))),t===et.FLOAT?h.setFloat32(u,A,!0):t===et.INT?h.setInt32(u,A,!0):t===et.UNSIGNED_INT?h.setUint32(u,A,!0):t===et.SHORT?h.setInt16(u,A,!0):t===et.UNSIGNED_SHORT?h.setUint16(u,A,!0):t===et.BYTE?h.setInt8(u,A):t===et.UNSIGNED_BYTE&&h.setUint8(u,A),u+=o}u%c!==0&&(u+=c-u%c)}const d={buffer:this.processBuffer(h.buffer),byteOffset:this.byteOffset,byteLength:l};return s!==void 0&&(d.target=s),s===et.ARRAY_BUFFER&&(d.byteStride=c),this.byteOffset+=l,a.bufferViews.push(d),{id:a.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){const t=this,n=t.json;return n.bufferViews||(n.bufferViews=[]),new Promise(function(i){const s=new FileReader;s.readAsArrayBuffer(e),s.onloadend=function(){const a=bu(s.result),o={buffer:t.processBuffer(a),byteOffset:t.byteOffset,byteLength:a.byteLength};t.byteOffset+=a.byteLength,i(n.bufferViews.push(o)-1)}})}processAccessor(e,t,n,i){const s=this.json,a={1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",9:"MAT3",16:"MAT4"};let o;if(e.array.constructor===Float32Array)o=et.FLOAT;else if(e.array.constructor===Int32Array)o=et.INT;else if(e.array.constructor===Uint32Array)o=et.UNSIGNED_INT;else if(e.array.constructor===Int16Array)o=et.SHORT;else if(e.array.constructor===Uint16Array)o=et.UNSIGNED_SHORT;else if(e.array.constructor===Int8Array)o=et.BYTE;else if(e.array.constructor===Uint8Array)o=et.UNSIGNED_BYTE;else throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: "+e.array.constructor.name);if(n===void 0&&(n=0),(i===void 0||i===1/0)&&(i=e.count),i===0)return null;const c=b1(e,n,i);let l;t!==void 0&&(l=e===t.index?et.ELEMENT_ARRAY_BUFFER:et.ARRAY_BUFFER);const h=this.processBufferView(e,o,n,i,l),u={bufferView:h.id,byteOffset:h.byteOffset,componentType:o,count:i,max:c.max,min:c.min,type:a[e.itemSize]};return e.normalized===!0&&(u.normalized=!0),s.accessors||(s.accessors=[]),s.accessors.push(u)-1}processImage(e,t,n,i="image/png"){if(e!==null){const s=this,a=s.cache,o=s.json,c=s.options,l=s.pending;a.images.has(e)||a.images.set(e,{});const h=a.images.get(e),u=i+":flipY/"+n.toString();if(h[u]!==void 0)return h[u];o.images||(o.images=[]);const d={mimeType:i},f=Cg();f.width=Math.min(e.width,c.maxTextureSize),f.height=Math.min(e.height,c.maxTextureSize);const p=f.getContext("2d",{willReadFrequently:!0});if(n===!0&&(p.translate(0,f.height),p.scale(1,-1)),e.data!==void 0){t!==Tt&&console.error("GLTFExporter: Only RGBAFormat is supported.",t),(e.width>c.maxTextureSize||e.height>c.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);const A=new Uint8ClampedArray(e.height*e.width*4);for(let g=0;g<A.length;g+=4)A[g+0]=e.data[g+0],A[g+1]=e.data[g+1],A[g+2]=e.data[g+2],A[g+3]=e.data[g+3];p.putImageData(new ImageData(A,e.width,e.height),0,0)}else if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&e instanceof OffscreenCanvas)p.drawImage(e,0,0,f.width,f.height);else throw new Error("THREE.GLTFExporter: Invalid image type. Use HTMLImageElement, HTMLCanvasElement, ImageBitmap or OffscreenCanvas.");c.binary===!0?l.push(x1(f,i).then(A=>s.processBufferViewImage(A)).then(A=>{d.bufferView=A})):d.uri=tb.getDataURL(f,i);const m=o.images.push(d)-1;return h[u]=m,m}else 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 n={magFilter:Bn[e.magFilter],minFilter:Bn[e.minFilter],wrapS:Bn[e.wrapS],wrapT:Bn[e.wrapT]};return t.samplers.push(n)-1}async processTextureAsync(e){const n=this.options,i=this.cache,s=this.json;if(i.textures.has(e))return i.textures.get(e);s.textures||(s.textures=[]),e instanceof tr&&(e=await this.decompressTextureAsync(e,n.maxTextureSize));let a=e.userData.mimeType;a==="image/webp"&&(a="image/png");const o={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,a)};e.name&&(o.name=e.name),await this._invokeAllAsync(async function(l){l.writeTexture&&await l.writeTexture(e,o)});const c=s.textures.push(o)-1;return i.textures.set(e,c),c}async processMaterialAsync(e){const t=this.cache,n=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;n.materials||(n.materials=[]);const i={pbrMetallicRoughness:{}};e.isMeshStandardMaterial!==!0&&e.isMeshBasicMaterial!==!0&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");const s=e.color.toArray().concat([e.opacity]);if(Oi(s,[1,1,1,1])||(i.pbrMetallicRoughness.baseColorFactor=s),e.isMeshStandardMaterial?(i.pbrMetallicRoughness.metallicFactor=e.metalness,i.pbrMetallicRoughness.roughnessFactor=e.roughness):(i.pbrMetallicRoughness.metallicFactor=0,i.pbrMetallicRoughness.roughnessFactor=1),e.metalnessMap||e.roughnessMap){const o=await this.buildMetalRoughTextureAsync(e.metalnessMap,e.roughnessMap),c={index:await this.processTextureAsync(o),texCoord:o.channel};this.applyTextureTransform(c,o),i.pbrMetallicRoughness.metallicRoughnessTexture=c}if(e.map){const o={index:await this.processTextureAsync(e.map),texCoord:e.map.channel};this.applyTextureTransform(o,e.map),i.pbrMetallicRoughness.baseColorTexture=o}if(e.emissive){const o=e.emissive;if(Math.max(o.r,o.g,o.b)>0&&(i.emissiveFactor=e.emissive.toArray()),e.emissiveMap){const l={index:await this.processTextureAsync(e.emissiveMap),texCoord:e.emissiveMap.channel};this.applyTextureTransform(l,e.emissiveMap),i.emissiveTexture=l}}if(e.normalMap){const o={index:await this.processTextureAsync(e.normalMap),texCoord:e.normalMap.channel};e.normalScale&&e.normalScale.x!==1&&(o.scale=e.normalScale.x),this.applyTextureTransform(o,e.normalMap),i.normalTexture=o}if(e.aoMap){const o={index:await this.processTextureAsync(e.aoMap),texCoord:e.aoMap.channel};e.aoMapIntensity!==1&&(o.strength=e.aoMapIntensity),this.applyTextureTransform(o,e.aoMap),i.occlusionTexture=o}e.transparent?i.alphaMode="BLEND":e.alphaTest>0&&(i.alphaMode="MASK",i.alphaCutoff=e.alphaTest),e.side===qt&&(i.doubleSided=!0),e.name!==""&&(i.name=e.name),this.serializeUserData(e,i),await this._invokeAllAsync(async function(o){o.writeMaterialAsync&&await o.writeMaterialAsync(e,i)});const a=n.materials.push(i)-1;return t.materials.set(e,a),a}async processMeshAsync(e){const t=this.cache,n=this.json,i=[e.geometry.uuid];if(Array.isArray(e.material))for(let _=0,v=e.material.length;_<v;_++)i.push(e.material[_].uuid);else i.push(e.material.uuid);const s=i.join(":");if(t.meshes.has(s))return t.meshes.get(s);const a=e.geometry;let o;e.isLineSegments?o=et.LINES:e.isLineLoop?o=et.LINE_LOOP:e.isLine?o=et.LINE_STRIP:e.isPoints?o=et.POINTS:o=e.material.wireframe?et.LINES:et.TRIANGLES;const c={},l={},h=[],u=[],d={uv:"TEXCOORD_0",uv1:"TEXCOORD_1",uv2:"TEXCOORD_2",uv3:"TEXCOORD_3",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},f=a.getAttribute("normal");f!==void 0&&!this.isNormalizedNormalAttribute(f)&&(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),a.setAttribute("normal",this.createNormalizedNormalAttribute(f)));let p=null;for(let _ in a.attributes){if(_.slice(0,5)==="morph")continue;const v=a.attributes[_];if(_=d[_]||_.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(_)||(_="_"+_),t.attributes.has(this.getUID(v))){l[_]=t.attributes.get(this.getUID(v));continue}p=null;const I=v.array;_==="JOINTS_0"&&!(I instanceof Uint16Array)&&!(I instanceof Uint8Array)?(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),p=So.Utils.toTypedBufferAttribute(v,Uint16Array)):(I instanceof Uint32Array||I instanceof Int32Array)&&!_.startsWith("_")&&(console.warn(`GLTFExporter: Attribute "${_}" converted to type FLOAT.`),p=So.Utils.toTypedBufferAttribute(v,Float32Array));const E=this.processAccessor(p||v,a);E!==null&&(_.startsWith("_")||this.detectMeshQuantization(_,v),l[_]=E,t.attributes.set(this.getUID(v),E))}if(f!==void 0&&a.setAttribute("normal",f),Object.keys(l).length===0)return null;if(e.morphTargetInfluences!==void 0&&e.morphTargetInfluences.length>0){const _=[],v=[],C={};if(e.morphTargetDictionary!==void 0)for(const I in e.morphTargetDictionary)C[e.morphTargetDictionary[I]]=I;for(let I=0;I<e.morphTargetInfluences.length;++I){const E={};let S=!1;for(const P in a.morphAttributes){if(P!=="position"&&P!=="normal"){S||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),S=!0);continue}const w=a.morphAttributes[P][I],L=P.toUpperCase(),N=a.attributes[P];if(t.attributes.has(this.getUID(w,!0))){E[L]=t.attributes.get(this.getUID(w,!0));continue}const O=w.clone();if(!a.morphTargetsRelative)for(let D=0,U=w.count;D<U;D++)for(let F=0;F<w.itemSize;F++)F===0&&O.setX(D,w.getX(D)-N.getX(D)),F===1&&O.setY(D,w.getY(D)-N.getY(D)),F===2&&O.setZ(D,w.getZ(D)-N.getZ(D)),F===3&&O.setW(D,w.getW(D)-N.getW(D));E[L]=this.processAccessor(O,a),t.attributes.set(this.getUID(N,!0),E[L])}u.push(E),_.push(e.morphTargetInfluences[I]),e.morphTargetDictionary!==void 0&&v.push(C[I])}c.weights=_,v.length>0&&(c.extras={},c.extras.targetNames=v)}const m=Array.isArray(e.material);if(m&&a.groups.length===0)return null;let A=!1;if(m&&a.index===null){const _=[];for(let v=0,C=a.attributes.position.count;v<C;v++)_[v]=v;a.setIndex(_),A=!0}const g=m?e.material:[e.material],b=m?a.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let _=0,v=b.length;_<v;_++){const C={mode:o,attributes:l};if(this.serializeUserData(a,C),u.length>0&&(C.targets=u),a.index!==null){let E=this.getUID(a.index);(b[_].start!==void 0||b[_].count!==void 0)&&(E+=":"+b[_].start+":"+b[_].count),t.attributes.has(E)?C.indices=t.attributes.get(E):(C.indices=this.processAccessor(a.index,a,b[_].start,b[_].count),t.attributes.set(E,C.indices)),C.indices===null&&delete C.indices}const I=await this.processMaterialAsync(g[b[_].materialIndex]);I!==null&&(C.material=I),h.push(C)}A===!0&&a.setIndex(null),c.primitives=h,n.meshes||(n.meshes=[]),await this._invokeAllAsync(function(_){_.writeMesh&&_.writeMesh(e,c)});const x=n.meshes.push(c)-1;return t.meshes.set(s,x),x}detectMeshQuantization(e,t){if(this.extensionsUsed[mu])return;let n;switch(t.array.constructor){case Int8Array:n="byte";break;case Uint8Array:n="unsigned byte";break;case Int16Array:n="short";break;case Uint16Array:n="unsigned short";break;default:return}t.normalized&&(n+=" normalized");const i=e.split("_",1)[0];_g[i]&&_g[i].includes(n)&&(this.extensionsUsed[mu]=!0,this.extensionsRequired[mu]=!0)}processCamera(e){const t=this.json;t.cameras||(t.cameras=[]);const n=e.isOrthographicCamera,i={type:n?"orthographic":"perspective"};return n?i.orthographic={xmag:e.right*2,ymag:e.top*2,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:i.perspective={aspectRatio:e.aspect,yfov:Ul.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},e.name!==""&&(i.name=e.type),t.cameras.push(i)-1}processAnimation(e,t){const n=this.json,i=this.nodeMap;n.animations||(n.animations=[]),e=So.Utils.mergeMorphTargetTracks(e.clone(),t);const s=e.tracks,a=[],o=[];for(let l=0;l<s.length;++l){const h=s[l],u=nt.parseTrackName(h.name);let d=nt.findNode(t,u.nodeName);const f=vg[u.propertyName];if(u.objectName==="bones"&&(d.isSkinnedMesh===!0?d=d.skeleton.getBoneByName(u.objectIndex):d=void 0),!d||!f){console.warn('THREE.GLTFExporter: Could not export animation track "%s".',h.name);continue}const p=1;let m=h.values.length/h.times.length;f===vg.morphTargetInfluences&&(m/=d.morphTargetInfluences.length);let A;h.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline===!0?(A="CUBICSPLINE",m/=3):h.getInterpolation()===la?A="STEP":A="LINEAR",o.push({input:this.processAccessor(new Lt(h.times,p)),output:this.processAccessor(new Lt(h.values,m)),interpolation:A}),a.push({sampler:o.length-1,target:{node:i.get(d),path:f}})}const c={name:e.name||"clip_"+n.animations.length,samplers:o,channels:a};return this.serializeUserData(e,c),n.animations.push(c),n.animations.length-1}processSkin(e){const t=this.json,n=this.nodeMap,i=t.nodes[n.get(e)],s=e.skeleton;if(s===void 0)return null;const a=e.skeleton.bones[0];if(a===void 0)return null;const o=[],c=new Float32Array(s.bones.length*16),l=new Oe;for(let u=0;u<s.bones.length;++u)o.push(n.get(s.bones[u])),l.copy(s.boneInverses[u]),l.multiply(e.bindMatrix).toArray(c,u*16);return t.skins===void 0&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new Lt(c,16)),joints:o,skeleton:n.get(a)}),i.skin=t.skins.length-1}async processNodeAsync(e){const t=this.json,n=this.options,i=this.nodeMap;if(t.nodes||(t.nodes=[]),e.pivot!==null)return await this._processNodeWithPivotAsync(e);const s={};if(n.trs){const o=e.quaternion.toArray(),c=e.position.toArray(),l=e.scale.toArray();Oi(o,[0,0,0,1])||(s.rotation=o),Oi(c,[0,0,0])||(s.translation=c),Oi(l,[1,1,1])||(s.scale=l)}else e.matrixAutoUpdate&&e.updateMatrix(),m1(e.matrix)===!1&&(s.matrix=e.matrix.elements);if(e.name!==""&&(s.name=String(e.name)),this.serializeUserData(e,s),e.isMesh||e.isLine||e.isPoints){const o=await this.processMeshAsync(e);o!==null&&(s.mesh=o)}else e.isCamera&&(s.camera=this.processCamera(e));e.isSkinnedMesh&&this.skins.push(e);const a=t.nodes.push(s)-1;if(i.set(e,a),e.children.length>0){const o=[];for(let c=0,l=e.children.length;c<l;c++){const h=e.children[c];if(h.visible||n.onlyVisible===!1){const u=await this.processNodeAsync(h);u!==null&&o.push(u)}}o.length>0&&(s.children=o)}return await this._invokeAllAsync(function(o){o.writeNode&&o.writeNode(e,s)}),a}async _processNodeWithPivotAsync(e){const t=this.json,n=this.options,i=this.nodeMap,s=e.pivot,a={},o=e.quaternion.toArray(),c=[e.position.x+s.x,e.position.y+s.y,e.position.z+s.z],l=e.scale.toArray();Oi(o,[0,0,0,1])||(a.rotation=o),Oi(c,[0,0,0])||(a.translation=c),Oi(l,[1,1,1])||(a.scale=l),a.extras={pivot:s.toArray()},e.name!==""&&(a.name=String(e.name)),this.serializeUserData(e,a);const h=t.nodes.push(a)-1;i.set(e,h);const u={},d=[-s.x,-s.y,-s.z];if(Oi(d,[0,0,0])||(u.translation=d),e.isMesh||e.isLine||e.isPoints){const m=await this.processMeshAsync(e);m!==null&&(u.mesh=m)}else e.isCamera&&(u.camera=this.processCamera(e));e.isSkinnedMesh&&this.skins.push(e);const p=[t.nodes.push(u)-1];if(e.children.length>0){const m=[];for(let A=0,g=e.children.length;A<g;A++){const b=e.children[A];if(b.visible||n.onlyVisible===!1){const x=await this.processNodeAsync(b);x!==null&&m.push(x)}}m.length>0&&(u.children=m)}return a.children=p,await this._invokeAllAsync(function(m){m.writeNode&&m.writeNode(e,a)}),h}async processSceneAsync(e){const t=this.json,n=this.options;t.scenes||(t.scenes=[],t.scene=0);const i={};e.name!==""&&(i.name=e.name),t.scenes.push(i);const s=[];for(let a=0,o=e.children.length;a<o;a++){const c=e.children[a];if(c.visible||n.onlyVisible===!1){const l=await this.processNodeAsync(c);l!==null&&s.push(l)}}s.length>0&&(i.nodes=s),this.serializeUserData(e,i)}async processObjectsAsync(e){const t=new xs;t.name="AuxScene";for(let n=0;n<e.length;n++)t.children.push(e[n]);await this.processSceneAsync(t)}async processInputAsync(e){const t=this.options;e=e instanceof Array?e:[e],await this._invokeAllAsync(function(i){i.beforeParse&&i.beforeParse(e)});const n=[];for(let i=0;i<e.length;i++)e[i]instanceof xs?await this.processSceneAsync(e[i]):n.push(e[i]);n.length>0&&await this.processObjectsAsync(n);for(let i=0;i<this.skins.length;++i)this.processSkin(this.skins[i]);for(let i=0;i<t.animations.length;++i)this.processAnimation(t.animations[i],e[0]);await this._invokeAllAsync(function(i){i.afterParse&&i.afterParse(e)})}async _invokeAllAsync(e){for(let t=0,n=this.plugins.length;t<n;t++)await e(this.plugins[t])}}class _1{constructor(e){this.writer=e,this.name="KHR_lights_punctual"}writeNode(e,t){if(!e.isLight)return;if(!e.isDirectionalLight&&!e.isPointLight&&!e.isSpotLight){console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e);return}const n=this.writer,i=n.json,s=n.extensionsUsed,a={};e.name&&(a.name=e.name),a.color=e.color.toArray(),a.intensity=e.intensity,e.isDirectionalLight?a.type="directional":e.isPointLight?(a.type="point",e.distance>0&&(a.range=e.distance)):e.isSpotLight&&(a.type="spot",e.distance>0&&(a.range=e.distance),a.spot={},a.spot.innerConeAngle=(1-e.penumbra)*e.angle,a.spot.outerConeAngle=e.angle),e.decay!==void 0&&e.decay!==2&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),e.target&&(e.target.parent!==e||e.target.position.x!==0||e.target.position.y!==0||e.target.position.z!==-1)&&console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),s[this.name]||(i.extensions=i.extensions||{},i.extensions[this.name]={lights:[]},s[this.name]=!0);const o=i.extensions[this.name].lights;o.push(a),t.extensions=t.extensions||{},t.extensions[this.name]={light:o.length-1}}}class v1{constructor(e){this.writer=e,this.name="KHR_materials_unlit"}async writeMaterialAsync(e,t){if(!e.isMeshBasicMaterial)return;const i=this.writer.extensionsUsed;t.extensions=t.extensions||{},t.extensions[this.name]={},i[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9}}class y1{constructor(e){this.writer=e,this.name="KHR_materials_clearcoat"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||e.clearcoat===0)return;const n=this.writer,i=n.extensionsUsed,s={};if(s.clearcoatFactor=e.clearcoat,e.clearcoatMap){const a={index:await n.processTextureAsync(e.clearcoatMap),texCoord:e.clearcoatMap.channel};n.applyTextureTransform(a,e.clearcoatMap),s.clearcoatTexture=a}if(s.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap){const a={index:await n.processTextureAsync(e.clearcoatRoughnessMap),texCoord:e.clearcoatRoughnessMap.channel};n.applyTextureTransform(a,e.clearcoatRoughnessMap),s.clearcoatRoughnessTexture=a}if(e.clearcoatNormalMap){const a={index:await n.processTextureAsync(e.clearcoatNormalMap),texCoord:e.clearcoatNormalMap.channel};e.clearcoatNormalScale.x!==1&&(a.scale=e.clearcoatNormalScale.x),n.applyTextureTransform(a,e.clearcoatNormalMap),s.clearcoatNormalTexture=a}t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class S1{constructor(e){this.writer=e,this.name="KHR_materials_dispersion"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||e.dispersion===0)return;const i=this.writer.extensionsUsed,s={};s.dispersion=e.dispersion,t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class C1{constructor(e){this.writer=e,this.name="KHR_materials_iridescence"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||e.iridescence===0)return;const n=this.writer,i=n.extensionsUsed,s={};if(s.iridescenceFactor=e.iridescence,e.iridescenceMap){const a={index:await n.processTextureAsync(e.iridescenceMap),texCoord:e.iridescenceMap.channel};n.applyTextureTransform(a,e.iridescenceMap),s.iridescenceTexture=a}if(s.iridescenceIor=e.iridescenceIOR,s.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],s.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap){const a={index:await n.processTextureAsync(e.iridescenceThicknessMap),texCoord:e.iridescenceThicknessMap.channel};n.applyTextureTransform(a,e.iridescenceThicknessMap),s.iridescenceThicknessTexture=a}t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class M1{constructor(e){this.writer=e,this.name="KHR_materials_transmission"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||e.transmission===0)return;const n=this.writer,i=n.extensionsUsed,s={};if(s.transmissionFactor=e.transmission,e.transmissionMap){const a={index:await n.processTextureAsync(e.transmissionMap),texCoord:e.transmissionMap.channel};n.applyTextureTransform(a,e.transmissionMap),s.transmissionTexture=a}t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class I1{constructor(e){this.writer=e,this.name="KHR_materials_volume"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||e.transmission===0)return;const n=this.writer,i=n.extensionsUsed,s={};if(s.thicknessFactor=e.thickness,e.thicknessMap){const a={index:await n.processTextureAsync(e.thicknessMap),texCoord:e.thicknessMap.channel};n.applyTextureTransform(a,e.thicknessMap),s.thicknessTexture=a}e.attenuationDistance!==1/0&&(s.attenuationDistance=e.attenuationDistance),s.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class w1{constructor(e){this.writer=e,this.name="KHR_materials_ior"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||e.ior===1.5)return;const i=this.writer.extensionsUsed,s={};s.ior=e.ior,t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class T1{constructor(e){this.writer=e,this.name="KHR_materials_specular"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||e.specularIntensity===1&&e.specularColor.equals(u1)&&!e.specularIntensityMap&&!e.specularColorMap)return;const n=this.writer,i=n.extensionsUsed,s={};if(e.specularIntensityMap){const a={index:await n.processTextureAsync(e.specularIntensityMap),texCoord:e.specularIntensityMap.channel};n.applyTextureTransform(a,e.specularIntensityMap),s.specularTexture=a}if(e.specularColorMap){const a={index:await n.processTextureAsync(e.specularColorMap),texCoord:e.specularColorMap.channel};n.applyTextureTransform(a,e.specularColorMap),s.specularColorTexture=a}s.specularFactor=e.specularIntensity,s.specularColorFactor=e.specularColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class R1{constructor(e){this.writer=e,this.name="KHR_materials_sheen"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||e.sheen==0)return;const n=this.writer,i=n.extensionsUsed,s={};if(e.sheenRoughnessMap){const a={index:await n.processTextureAsync(e.sheenRoughnessMap),texCoord:e.sheenRoughnessMap.channel};n.applyTextureTransform(a,e.sheenRoughnessMap),s.sheenRoughnessTexture=a}if(e.sheenColorMap){const a={index:await n.processTextureAsync(e.sheenColorMap),texCoord:e.sheenColorMap.channel};n.applyTextureTransform(a,e.sheenColorMap),s.sheenColorTexture=a}s.sheenRoughnessFactor=e.sheenRoughness,s.sheenColorFactor=e.sheenColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class B1{constructor(e){this.writer=e,this.name="KHR_materials_anisotropy"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||e.anisotropy==0)return;const n=this.writer,i=n.extensionsUsed,s={};if(e.anisotropyMap){const a={index:await n.processTextureAsync(e.anisotropyMap)};n.applyTextureTransform(a,e.anisotropyMap),s.anisotropyTexture=a}s.anisotropyStrength=e.anisotropy,s.anisotropyRotation=e.anisotropyRotation,t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class D1{constructor(e){this.writer=e,this.name="KHR_materials_emissive_strength"}async writeMaterialAsync(e,t){if(!e.isMeshStandardMaterial||e.emissiveIntensity===1)return;const i=this.writer.extensionsUsed,s={};s.emissiveStrength=e.emissiveIntensity,t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class L1{constructor(e){this.writer=e,this.name="EXT_materials_bump"}async writeMaterialAsync(e,t){if(!e.isMeshStandardMaterial||e.bumpScale===1&&!e.bumpMap)return;const n=this.writer,i=n.extensionsUsed,s={};if(e.bumpMap){const a={index:await n.processTextureAsync(e.bumpMap),texCoord:e.bumpMap.channel};n.applyTextureTransform(a,e.bumpMap),s.bumpTexture=a}s.bumpFactor=e.bumpScale,t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class P1{constructor(e){this.writer=e,this.name="EXT_mesh_gpu_instancing"}writeNode(e,t){if(!e.isInstancedMesh)return;const n=this.writer,i=e,s=new Float32Array(i.count*3),a=new Float32Array(i.count*4),o=new Float32Array(i.count*3),c=new Oe,l=new R,h=new An,u=new R;for(let f=0;f<i.count;f++)i.getMatrixAt(f,c),c.decompose(l,h,u),l.toArray(s,f*3),h.toArray(a,f*4),u.toArray(o,f*3);const d={TRANSLATION:n.processAccessor(new Lt(s,3)),ROTATION:n.processAccessor(new Lt(a,4)),SCALE:n.processAccessor(new Lt(o,3))};i.instanceColor&&(d._COLOR_0=n.processAccessor(i.instanceColor)),t.extensions=t.extensions||{},t.extensions[this.name]={attributes:d},n.extensionsUsed[this.name]=!0,n.extensionsRequired[this.name]=!0}}So.Utils={insertKeyframe:function(r,e){const n=r.getValueSize(),i=new r.TimeBufferType(r.times.length+1),s=new r.ValueBufferType(r.values.length+n),a=r.createInterpolant(new r.ValueBufferType(n));let o;if(r.times.length===0){i[0]=e;for(let c=0;c<n;c++)s[c]=0;o=0}else if(e<r.times[0]){if(Math.abs(r.times[0]-e)<.001)return 0;i[0]=e,i.set(r.times,1),s.set(a.evaluate(e),0),s.set(r.values,n),o=0}else if(e>r.times[r.times.length-1]){if(Math.abs(r.times[r.times.length-1]-e)<.001)return r.times.length-1;i[i.length-1]=e,i.set(r.times,0),s.set(r.values,0),s.set(a.evaluate(e),r.values.length),o=i.length-1}else for(let c=0;c<r.times.length;c++){if(Math.abs(r.times[c]-e)<.001)return c;if(r.times[c]<e&&r.times[c+1]>e){i.set(r.times.slice(0,c+1),0),i[c+1]=e,i.set(r.times.slice(c+1),c+2),s.set(r.values.slice(0,(c+1)*n),0),s.set(a.evaluate(e),(c+1)*n),s.set(r.values.slice((c+1)
4636*n),(c+2)*n),o=c+1;break}}return r.times=i,r.values=s,o},mergeMorphTargetTracks:function(r,e){const t=[],n={},i=r.tracks;for(let s=0;s<i.length;++s){let a=i[s];const o=nt.parseTrackName(a.name),c=nt.findNode(e,o.nodeName);if(o.propertyName!=="morphTargetInfluences"||o.propertyIndex===void 0){t.push(a);continue}if(a.createInterpolant!==a.InterpolantFactoryMethodDiscrete&&a.createInterpolant!==a.InterpolantFactoryMethodLinear){if(a.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),a=a.clone(),a.setInterpolation(ha)}const l=c.morphTargetInfluences.length,h=c.morphTargetDictionary[o.propertyIndex];if(h===void 0)throw new Error("THREE.GLTFExporter: Morph target name not found: "+o.propertyIndex);let u;if(n[c.uuid]===void 0){u=a.clone();const f=new u.ValueBufferType(l*u.times.length);for(let p=0;p<u.times.length;p++)f[p*l+h]=u.values[p];u.name=(o.nodeName||"")+".morphTargetInfluences",u.values=f,n[c.uuid]=u,t.push(u);continue}const d=a.createInterpolant(new a.ValueBufferType(1));u=n[c.uuid];for(let f=0;f<u.times.length;f++)u.values[f*l+h]=d.evaluate(u.times[f]);for(let f=0;f<a.times.length;f++){const p=this.insertKeyframe(u,a.times[f]);u.values[p*l+h]=a.values[f]}}return r.tracks=t,r},toTypedBufferAttribute:function(r,e){const t=new Lt(new e(r.count*r.itemSize),r.itemSize,!1);if(!r.normalized&&!r.isInterleavedBufferAttribute)return t.array.set(r.array),t;for(let n=0,i=r.count;n<i;n++)for(let s=0;s<r.itemSize;s++)t.setComponent(n,s,r.getComponent(n,s));return t}};let ka,xu,Tr,Dc;function F1(r,e=1/0,t=null){xu||(xu=new zn(2,2,1,1)),Tr||(Tr=new mn({uniforms:{blitTexture:new Yf(r)},vertexShader:`
4637			varying vec2 vUv;
4638			void main(){
4639				vUv = uv;
4640				gl_Position = vec4(position.xy * 1.0,0.,.999999);
4641			}`,fragmentShader:`
4642			uniform sampler2D blitTexture; 
4643			varying vec2 vUv;
4644
4645			void main(){ 
4646				gl_FragColor = vec4(vUv.xy, 0, 1);
4647				
4648				#ifdef IS_SRGB
4649				gl_FragColor = sRGBTransferOETF( texture2D( blitTexture, vUv) );
4650				#else
4651				gl_FragColor = texture2D( blitTexture, vUv);
4652				#endif
4653			}`})),Tr.uniforms.blitTexture.value=r,Tr.defines.IS_SRGB=r.colorSpace==mt,Tr.needsUpdate=!0,Dc||(Dc=new at(xu,Tr),Dc.frustumCulled=!1);const n=new Zt,i=new xs;i.add(Dc),t===null&&(t=ka=new Jf({antialias:!1}));const s=Math.min(r.image.width,e),a=Math.min(r.image.height,e);t.setSize(s,a),t.clear(),t.render(i,n);const o=document.createElement("canvas"),c=o.getContext("2d");o.width=s,o.height=a,c.drawImage(t.domElement,0,0,s,a);const l=new Ql(o);return l.minFilter=r.minFilter,l.magFilter=r.magFilter,l.wrapS=r.wrapS,l.wrapT=r.wrapT,l.colorSpace=r.colorSpace,l.name=r.name,ka&&(ka.forceContextLoss(),ka.dispose(),ka=null),l}/* @license
4654 * Copyright 2021 Google LLC. All Rights Reserved.
4655 * Licensed under the Apache License, Version 2.0 (the 'License');
4656 * you may not use this file except in compliance with the License.
4657 * You may obtain a copy of the License at
4658 *
4659 *     http://www.apache.org/licenses/LICENSE-2.0
4660 *
4661 * Unless required by applicable law or agreed to in writing, software
4662 * distributed under the License is distributed on an 'AS IS' BASIS,
4663 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4664 * See the License for the specific language governing permissions and
4665 * limitations under the License.
4666 */const Mg=r=>r.material!==void 0&&r.userData&&r.userData.variantMaterials&&!!Array.from(r.userData.variantMaterials.values()).filter(e=>fl(e.material)),fl=r=>r&&r.isMaterial&&!Array.isArray(r);class N1{constructor(e){this.writer=e,this.name="KHR_materials_variants",this.variantNames=[]}beforeParse(e){const t=new Set,n=i=>{if(!Mg(i))return;const s=i.userData.variantMaterials,a=i.userData.variantData;for(const[o,c]of a){const l=s.get(c.index);l&&fl(l.material)&&t.add(o)}};if(Array.isArray(e))for(const i of e)i.traverse(n);else e.traverse(n);t.forEach(i=>this.variantNames.push(i))}async writeMesh(e,t){if(!Mg(e))return;const n=e.userData,i=n.variantMaterials,s=n.variantData,a=new Map,o=new Map,c=Array.from(s.values()).sort((u,d)=>u.index-d.index);for(const[u,d]of c.entries())o.set(d.index,u);for(const u of s.values()){const d=i.get(u.index);if(!d||!fl(d.material))continue;const f=await this.writer.processMaterialAsync(d.material);a.has(f)||a.set(f,{material:f,variants:[]}),a.get(f).variants.push(o.get(u.index))}const l=Array.from(a.values()).map((u=>u.variants.sort((d,f)=>d-f)&&u)).sort((u,d)=>u.material-d.material);
vendor: 4,193 bytes, lines 4666-4681
4666if(l.length===0)return;const h=fl(n.originalMaterial)?await this.writer.processMaterialAsync(n.originalMaterial):-1;for(const u of t.primitives)h>=0&&(u.material=h),u.extensions=u.extensions||{},u.extensions[this.name]={mappings:l}}afterParse(){if(this.variantNames.length===0)return;const e=this.writer.json;e.extensions=e.extensions||{};const t=this.variantNames.map(n=>({name:n}));e.extensions[this.name]={variants:t},this.writer.extensionsUsed[this.name]=!0}}class U1{constructor(e,t,n,i,s){this.xrLight=e,this.renderer=t,this.lightProbe=n,this.xrWebGLBinding=null,this.estimationStartCallback=s,this.frameCallback=this.onXRFrame.bind(this);const a=t.xr.getSession();if(i&&"XRWebGLBinding"in window){const o=new ah(16);e.environment=o.texture;const c=t.getContext();switch(a.preferredReflectionFormat){case"srgba8":c.getExtension("EXT_sRGB");break;case"rgba16f":c.getExtension("OES_texture_half_float");break}this.xrWebGLBinding=new XRWebGLBinding(a,c),this.lightProbe.addEventListener("reflectionchange",()=>{this.updateReflection()})}a.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 i=t.getLightEstimate(this.lightProbe);if(i){this.xrLight.lightProbe.sh.fromArray(i.sphericalHarmonicsCoefficients),this.xrLight.lightProbe.intensity=1;const s=Math.max(1,Math.max(i.primaryLightIntensity.x,Math.max(i.primaryLightIntensity.y,i.primaryLightIntensity.z)));this.xrLight.directionalLight.color.setRGB(i.primaryLightIntensity.x/s,i.primaryLightIntensity.y/s,i.primaryLightIntensity.z/s),this.xrLight.directionalLight.intensity=s,this.xrLight.directionalLight.position.copy(i.primaryLightDirection),this.estimationStartCallback&&(this.estimationStartCallback(),this.estimationStartCallback=null)}}dispose(){this.xrLight=null,this.renderer=null,this.lightProbe=null,this.xrWebGLBinding=null}}class O1 extends fs{constructor(e,t=!0){super(),this.lightProbe=new Fy,this.lightProbe.intensity=0,this.add(this.lightProbe),this.directionalLight=new Bb,this.directionalLight.intensity=0,this.add(this.directionalLight),this.environment=null;let n=null,i=!1;e.xr.addEventListener("sessionstart",()=>{const s=e.xr.getSession();"requestLightProbe"in s&&s.requestLightProbe({reflectionFormat:s.preferredReflectionFormat}).then(a=>{n=new U1(this,e,a,t,()=>{i=!0,this.dispatchEvent({type:"estimationstart"})})})}),e.xr.addEventListener("sessionend",()=>{n&&(n.dispose(),n=null),i&&this.dispatchEvent({type:"estimationend"})}),this.dispose=()=>{n&&(n.dispose(),n=null),this.remove(this.lightProbe),this.lightProbe=null,this.remove(this.directionalLight),this.directionalLight=null,this.environment=null}}}/* @license
4667 * Copyright 2020 Google LLC. All Rights Reserved.
4668 * Licensed under the Apache License, Version 2.0 (the 'License');
4669 * you may not use this file except in compliance with the License.
4670 * You may obtain a copy of the License at
4671 *
4672 *     http://www.apache.org/licenses/LICENSE-2.0
4673 *
4674 * Unless required by applicable law or agreed to in writing, software
4675 * distributed under the License is distributed on an 'AS IS' BASIS,
4676 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4677 * See the License for the specific language governing permissions and
4678 * limitations under the License.
4679 */const Nx=1e4,k1=.001,Ux=50;class an{constructor(e=Ux){this.velocity=0,this.naturalFrequency=0,this.setDecayTime(e)}setDecayTime(e){this.naturalFrequency=1/Math.max(k1,e)}update(e,t,n,i){const s=2e-4*this.naturalFrequency;if(e==null||i===0||e===t&&this.velocity===0)return t;if(n<0)return e;const a=e-t,o=this.velocity+this.naturalFrequency*a,c=a+n*o,l=Math.exp(-this.naturalFrequency*n),h=(o-this.naturalFrequency*c)*l,u=-this.naturalFrequency*(h+o*l);return Math.abs(h)<s*Math.abs(i)&&u*a>=0?(this.velocity=0,t):(this.velocity=h,t+c*l)}}/* @license
4680 * Copyright 2020 Google LLC. All Rights Reserved.
4681 * Licensed under the Apache License, Version 2.0 (the 'License');
vendor: 11,375 bytes, lines 4682-4720
4682 * you may not use this file except in compliance with the License.
4683 * You may obtain a copy of the License at
4684 *
4685 *     http://www.apache.org/licenses/LICENSE-2.0
4686 *
4687 * Unless required by applicable law or agreed to in writing, software
4688 * distributed under the License is distributed on an 'AS IS' BASIS,
4689 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4690 * See the License for the specific language governing permissions and
4691 * limitations under the License.
4692 */const rt={MIN_TOUCH_AREA:.05,BASE_RADIUS:.15,LINE_WIDTH:.02,SEGMENTS:16,DELTA_PHI:Math.PI/32,COLORS:{EDGE_FALLOFF:new Me(.98,.98,.98),EDGE_CUTOFF:new Me(.8,.8,.8),FILL_FALLOFF:new Me(.4,.4,.4),FILL_CUTOFF:new Me(.4,.4,.4),ACTIVE_EDGE:new Me(1,1,1),ACTIVE_FILL:new Me(.6,.6,.6)},MAX_OPACITY:.75,FILL_OPACITY_MULTIPLIER:.5,INTERACTIVE_OPACITY_MULTIPLIER:1.2,MIN_DISTANCE:.5,MAX_DISTANCE:10,BASE_SCALE:1,DISTANCE_SCALE_FACTOR:.3,COLOR_LERP_FACTOR:.15,SCREEN_SPACE_SCALE:1.2,SIZE_UPDATE_THRESHOLD:.001,GEOMETRY_UPDATE_DEBOUNCE:100},Ig=new pe,Lc=(r,e,t,n,i)=>{let s=e>0?t>0?0:-Math.PI/2:t>0?Math.PI/2:Math.PI;for(let a=0;a<=rt.SEGMENTS;++a)r.push(e+(n-i)*Math.cos(s),t+(n-i)*Math.sin(s),0,e+n*Math.cos(s),t+n*Math.sin(s),0),s+=rt.DELTA_PHI};class Q1 extends at{constructor(e,t){const n=new cn;super(n),this.shadowHeight=0,this.isActive=!1,this.isHovered=!1,this.lastGeometryUpdateTime=0,this.needsGeometryUpdate=!1,this.scene=e,this.side=t,this.currentSize=new R,this.goalSize=new R,this.sizeDamper=new an,this.updateSizeFromScene(),this.edgeMaterial=new pn({color:rt.COLORS.EDGE_FALLOFF,transparent:!0,opacity:0,side:qt,depthWrite:!1,blending:yd}),this.fillMaterial=new pn({color:rt.COLORS.FILL_FALLOFF,transparent:!0,opacity:0,side:qt,depthWrite:!1,blending:$s}),this.material=this.edgeMaterial,this.goalOpacity=0,this.opacityDamper=new an,this.createHitMeshes(),this.updatePositionFromScene(),e.target.add(this),e.target.add(this.hitBox),this.offsetHeight=0}updateSizeFromScene(){const{size:e}=this.scene;this.goalSize.copy(e);const t=Math.sqrt(e.x*e.x+e.z*e.z),n=Math.max(rt.MIN_TOUCH_AREA,t*.4);this.goalSize.x<n&&(this.goalSize.x=n),this.goalSize.z<n&&(this.goalSize.z=n),this.updateGeometry()}updateGeometry(){const e=this.geometry,t=[],n=[],i=this.goalSize.x/2,s=(this.side==="back"?this.goalSize.y:this.goalSize.z)/2,a=Math.min(i,s),o=Math.max(rt.BASE_RADIUS*.7,a*.2),c=Math.max(rt.LINE_WIDTH*.7,a*.025);Lc(n,i,s,o,c),Lc(n,-i,s,o,c),Lc(n,-i,-s,o,c),Lc(n,i,-s,o,c);const l=n.length/3;for(let u=0;u<l-2;u+=2)t.push(u,u+1,u+3,u,u+3,u+2);const h=l-2;t.push(h,h+1,1,h,1,0),e.setAttribute("position",new nn(n,3)),e.setIndex(t),e.computeBoundingSphere()}createHitMeshes(){const e=this.goalSize.x/2,t=(this.side==="back"?this.goalSize.y:this.goalSize.z)/2,n=Math.min(e,t),i=Math.max(rt.BASE_RADIUS*.7,n*.2);this.hitPlane=new at(new zn(2*(e+i),2*(t+i))),this.hitPlane.visible=!1,this.hitPlane.material.side=qt,this.add(this.hitPlane),this.hitBox=new at(new ji(this.goalSize.x+2*i,this.goalSize.y+i,this.goalSize.z+2*i)),this.hitBox.visible=!1,this.hitBox.material.side=qt,this.add(this.hitBox)}updatePositionFromScene(){const{boundingBox:e}=this.scene;switch(e.getCenter(this.position),this.rotation.set(0,0,0),this.side){case"bottom":this.rotateX(-Math.PI/2),this.shadowHeight=e.min.y,this.position.y=this.shadowHeight;break;case"back":this.shadowHeight=e.min.z,this.position.z=this.shadowHeight;break}if(this.hitBox){const t=this.side==="back"?(this.goalSize.y+rt.BASE_RADIUS)/2:(this.goalSize.y+rt.BASE_RADIUS)/2;this.hitBox.position.y=t+e.min.y}}updateFromModelChanges(){this.updateSizeFromScene(),this.updatePositionFromScene(),this.updateGeometry(),this.updateHitMeshes(),this.ensureProperOrientation(),this.needsGeometryUpdate=!1,this.lastGeometryUpdateTime=performance.now()}ensureProperOrientation(){this.side==="bottom"?(this.rotation.x=-Math.PI/2,this.rotation.y=0,this.rotation.z=0):this.side==="back"&&(this.rotation.x=0,this.rotation.y=0,this.rotation.z=0)}setScreenSpaceMode(e){e?this.scale.set(rt.SCREEN_SPACE_SCALE,rt.SCREEN_SPACE_SCALE,rt.SCREEN_SPACE_SCALE):this.scale.set(1,1,1)}updateHitMeshes(){if(this.hitPlane&&this.hitBox){const e=this.goalSize.x/2,t=(this.side==="back"?this.goalSize.y:this.goalSize.z)/2,n=Math.min(e,t),i=Math.max(rt.BASE_RADIUS*.7,n*.2),s=new zn(2*(e+i),2*(t+i));this.hitPlane.geometry.dispose(),this.hitPlane.geometry=s;const a=new ji(this.goalSize.x+2*i,this.goalSize.y+i,this.goalSize.z+2*i);this.hitBox.geometry.dispose(),this.hitBox.geometry=a}}setInteractionState(e,t=!1){this.isActive=e,this.isHovered=t,this.updateVisualState()}updateVisualState(){let e,t;this.isActive?(e=rt.COLORS.ACTIVE_EDGE,t=rt.COLORS.ACTIVE_FILL):this.isHovered?(e=rt.COLORS.EDGE_FALLOFF,t=rt.COLORS.FILL_FALLOFF):(e=rt.COLORS.EDGE_CUTOFF,t=rt.COLORS.FILL_CUTOFF),this.edgeMaterial.color.lerp(e,rt.COLOR_LERP_FACTOR),this.fillMaterial.color.lerp(t,rt.COLOR_LERP_FACTOR)}applyDistanceScaling(e){const t=e.distanceTo(this.position),n=Math.max(rt.MIN_DISTANCE,Math.min(rt.MAX_DISTANCE,t)),i=rt.BASE_SCALE+(n-rt.MIN_DISTANCE)*rt.DISTANCE_SCALE_FACTOR;this.scale.set(i,i,i)}getHit(e,t,n){Ig.set(t,-n),this.hitPlane.visible=!0;const i=e.positionAndNormalFromPoint(Ig,this.hitPlane);return this.hitPlane.visible=!1,i==null?null:i.position}getExpandedHit(e,t,n){this.hitPlane.scale.set(1e3,1e3,1e3),this.hitPlane.updateMatrixWorld();const i=this.getHit(e,t,n);return this.hitPlane.scale.set(1,1,1),i}controllerIntersection(e,t){this.hitBox.visible=!0;const n=e.hitFromController(t,this.hitBox);return this.hitBox.visible=!1,n}set offsetHeight(e){e-=.001,this.side==="back"?this.position.z=this.shadowHeight+e:this.position.y=this.shadowHeight+e}get offsetHeight(){return this.side==="back"?this.position.z-this.shadowHeight:this.position.y-this.shadowHeight}set show(e){this.goalOpacity=e?rt.MAX_OPACITY:0}updateOpacity(e){const t=this.material,n=this.opacityDamper.update(t.opacity,this.goalOpacity,e,1);this.edgeMaterial.opacity=n,this.fillMaterial.opacity=n*rt.FILL_OPACITY_MULTIPLIER,(this.isActive||this.isHovered)&&(this.edgeMaterial.opacity=n*rt.INTERACTIVE_OPACITY_MULTIPLIER),this.visible=n>0}update(e,t){if(this.updateOpacity(e),!this.currentSize.equals(this.goalSize)){const i=new R;i.x=this.sizeDamper.update(this.currentSize.x,this.goalSize.x,e,1),i.y=this.sizeDamper.update(this.currentSize.y,this.goalSize.y,e,1),i.z=this.sizeDamper.update(this.currentSize.z,this.goalSize.z,e,1),i.distanceTo(this.currentSize)>rt.SIZE_UPDATE_THRESHOLD&&(this.currentSize.copy(i),this.needsGeometryUpdate=!0)}const n=performance.now();this.needsGeometryUpdate&&n-this.lastGeometryUpdateTime>rt.GEOMETRY_UPDATE_DEBOUNCE&&(this.updateGeometry(),this.updateHitMeshes(),this.needsGeometryUpdate=!1,this.lastGeometryUpdateTime=n),t&&this.applyDistanceScaling(t),this.updateVisualState()}getSize(){return this.goalSize.clone()}dispose(){const{geometry:e,material:t}=this.hitPlane;e.dispose(),t.dispose(),this.hitBox.geometry.dispose(),this.hitBox.material.dispose(),this.geometry.dispose(),this.edgeMaterial.dispose(),this.fillMaterial.dispose(),this.hitBox.removeFromParent(),this.removeFromParent()}}/* @license
4693 * Copyright 2019 Google LLC. All Rights Reserved.
4694 * Licensed under the Apache License, Version 2.0 (the 'License');
4695 * you may not use this file except in compliance with the License.
4696 * You may obtain a copy of the License at
4697 *
4698 *     http://www.apache.org/licenses/LICENSE-2.0
4699 *
4700 * Unless required by applicable law or agreed to in writing, software
4701 * distributed under the License is distributed on an 'AS IS' BASIS,
4702 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4703 * See the License for the specific language governing permissions and
4704 * limitations under the License.
4705 */const gn=(r,e)=>({type:"number",number:r,unit:e}),zi=(()=>{const r={};return t=>{const n=t;if(n in r)return r[n];const i=[];let s=0;for(;t;){if(++s>1e3){t="";break}const a=Ox(t),o=a.nodes[0];if(o==null||o.terms.length===0)break;i.push(o),t=a.remainingInput}return r[n]=i}})(),Ox=(()=>{const r=/^(\-\-|[a-z\u0240-\uffff])/i,e=/^([\*\+\/]|[\-]\s)/i,t=/^[\),]/;return s=>{const a=[];for(;s.length&&(s=s.trim(),!t.test(s));)if(s[0]==="("){const{nodes:o,remainingInput:c}=wg(s);s=c,a.push({type:"function",name:{type:"ident",value:"calc"},arguments:o})}else if(r.test(s)){const o=G1(s),c=o.nodes[0];if(s=o.remainingInput,s[0]==="("){const{nodes:l,remainingInput:h}=wg(s);a.push({type:"function",name:c,arguments:l}),s=h}else a.push(c)}else if(e.test(s))a.push({type:"operator",value:s[0]}),s=s.slice(1);else{const{nodes:o,remainingInput:c}=s[0]==="#"?z1(s):H1(s);if(o.length===0)break;a.push(o[0]),s=c}return{nodes:[{type:"expression",terms:a}],remainingInput:s}}})(),G1=(()=>{const r=/[^a-z0-9_\-\u0240-\uffff]/i;return e=>{const t=e.match(r),n=t==null?e:e.substr(0,t.index),i=t==null?"":e.substr(t.index);return{nodes:[{type:"ident",value:n}],remainingInput:i}}})(),H1=(()=>{const r=/[\+\-]?(\d+[\.]\d+|\d+|[\.]\d+)([eE][\+\-]?\d+)?/,e=/^[a-z%]+/i,t=/^(m|mm|cm|rad|deg|[%])$/;return n=>{const i=n.match(r),s=i==null?"0":i[0];n=s==null?n:n.slice(s.length);const a=n.match(e);let o=a!=null&&a[0]!==""?a[0]:null;const c=a==null?n:n.slice(o.length);return o!=null&&!t.test(o)&&(o=null),{nodes:[{type:"number",number:parseFloat(s)||0,unit:o}],remainingInput:c}}})(),z1=(()=>{const r=/^[a-f0-9]*/i;return e=>{e=e.slice(1).trim();const t=e.match(r);return{nodes:t==null?[]:[{type:"hex",value:t[0]}],remainingInput:t==null?e:e.slice(t[0].length)}}})(),wg=r=>{const e=[];for(r=r.slice(1).trim();r.length;){const t=Ox(r);if(e.push(t.nodes[0]),r=t.remainingInput.trim(),r[0]===",")r=r.slice(1).trim();else if(r[0]===")"){r=r.slice(1);break}}return{nodes:e,remainingInput:r}},Tg=Symbol("visitedTypes");class V1{constructor(e){this[Tg]=e}walk(e,t){const n=e.slice();for(;n.length;){const i=n.shift();switch(this[Tg].indexOf(i.type)>-1&&t(i),i.type){case"expression":n.unshift(...i.terms);break;case"function":n.unshift(i.name,...i.arguments);break}}}}const Es=Object.freeze({type:"number",number:0,unit:null});/* @license
4706 * Copyright 2019 Google LLC. All Rights Reserved.
4707 * Licensed under the Apache License, Version 2.0 (the 'License');
4708 * you may not use this file except in compliance with the License.
4709 * You may obtain a copy of the License at
4710 *
4711 *     http://www.apache.org/licenses/LICENSE-2.0
4712 *
4713 * Unless required by applicable law or agreed to in writing, software
4714 * distributed under the License is distributed on an 'AS IS' BASIS,
4715 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4716 * See the License for the specific language governing permissions and
4717 * limitations under the License.
4718 */const ch=(r,e=0)=>{let{number:t,unit:n}=r;if(!isFinite(t))t=e,n="rad";else if(r.unit==="rad"||r.unit==null)return r;return{type:"number",number:(n==="deg"&&t!=null?t:0)*Math.PI/180,unit:"rad"}},Rg=(r,e=0)=>{let{number:t,unit:n}=r;if(!isFinite(t))t=e,n="m";else if(r.unit==="m")return r;let i;switch(n){default:i=1;break;case"cm":i=1/100;break;case"mm":i=1/1e3;break}return{type:"number",number:i*t,unit:"m"}},gi=(()=>{const r=t=>t,e={rad:r,deg:ch,m:r,mm:Rg,cm:Rg};return(t,n=Es)=>{isFinite(t.number)||(t.number=n.number,t.unit=n.unit);const{unit:i}=t;if(i==null)return t;const s=e[i];return s==null?n:s(t)}})();/* @license
4719 * Copyright 2019 Google LLC. All Rights Reserved.
4720 * Licensed under the Apache License, Version 2.0 (the 'License');
vendor: 4,244 bytes, lines 4721-4739
4721 * you may not use this file except in compliance with the License.
4722 * You may obtain a copy of the License at
4723 *
4724 *     http://www.apache.org/licenses/LICENSE-2.0
4725 *
4726 * Unless required by applicable law or agreed to in writing, software
4727 * distributed under the License is distributed on an 'AS IS' BASIS,
4728 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4729 * See the License for the specific language governing permissions and
4730 * limitations under the License.
4731 */var kx,Bg,Dg;const Ca=Symbol("evaluate"),pl=Symbol("lastValue");class Bt{constructor(){this[kx]=null}static evaluatableFor(e,t=Es){if(e instanceof Bt)return e;if(e.type==="number")return e.unit==="%"?new W1(e,t):e;switch(e.name.value){case"calc":return new X1(e,t);case"env":return new q1(e)}return Es}static evaluate(e){return e instanceof Bt?e.evaluate():e}static isConstant(e){return e instanceof Bt?e.isConstant:!0}static applyIntrinsics(e,t){const{basis:n,keywords:i}=t,{auto:s}=i;return n.map((a,o)=>{const c=s[o]==null?a:s[o];let l=e[o]?e[o]:c;if(l.type==="ident"){const h=l.value;h in i&&(l=i[h][o])}return(l==null||l.type==="ident")&&(l=c),l.unit==="%"?gn(l.number/100*a.number,a.unit):(l=gi(l,a),l.unit!==a.unit?a:l)})}get isConstant(){return!1}evaluate(){return(!this.isConstant||this[pl]==null)&&(this[pl]=this[Ca]()),this[pl]}}kx=pl;const Lg=Symbol("percentage"),Eu=Symbol("basis");class W1 extends Bt{constructor(e,t){super(),this[Lg]=e,this[Eu]=t}get isConstant(){return!0}[Ca](){return gn(this[Lg].number/100*this[Eu].number,this[Eu].unit)}}const Pc=Symbol("identNode");class q1 extends Bt{constructor(e){super(),this[Bg]=null;const t=e.arguments.length?e.arguments[0].terms[0]:null;t!=null&&t.type==="ident"&&(this[Pc]=t)}get isConstant(){return!1}[(Bg=Pc,Ca)](){if(this[Pc]!=null)switch(this[Pc].value){case"window-scroll-y":const e=window.pageYOffset,t=Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight);return{type:"number",number:e/(t-window.innerHeight)||0,unit:null}}return Es}}const j1=/[\*\/]/,Rr=Symbol("evaluator");class X1 extends Bt{constructor(e,t=Es){if(super(),this[Dg]=null,e.arguments.length!==1)return;const n=e.arguments[0].terms.slice(),i=[];for(;n.length;){const s=n.shift();if(i.length>0){const a=i[i.length-1];if(a.type==="operator"&&j1.test(a.value)){const o=i.pop(),c=i.pop();if(c==null)return;i.push(new Fg(o,Bt.evaluatableFor(c,t),Bt.evaluatableFor(s,t)));continue}}i.push(s.type==="operator"?s:Bt.evaluatableFor(s,t))}for(;i.length>2;){const[s,a,o]=i.splice(0,3);if(a.type!=="operator")return;i.unshift(new Fg(a,Bt.evaluatableFor(s,t),Bt.evaluatableFor(o,t)))}i.length===1&&(this[Rr]=i[0])}get isConstant(){return this[Rr]==null||Bt.isConstant(this[Rr])}[(Dg=Rr,Ca)](){return this[Rr]!=null?Bt.evaluate(this[Rr]):Es}}const Pg=Symbol("operator"),_u=Symbol("left"),vu=Symbol("right");class Fg extends Bt{constructor(e,t,n){super(),this[Pg]=e,this[_u]=t,this[vu]=n}get isConstant(){return Bt.isConstant(this[_u])&&Bt.isConstant(this[vu])}[Ca](){const e=gi(Bt.evaluate(this[_u])),t=gi(Bt.evaluate(this[vu])),{number:n,unit:i}=e,{number:s,unit:a}=t;if(a!=null&&i!=null&&a!=i)return Es;const o=i||a;let c;switch(this[Pg].value){case"+":c=n+s;break;case"-":c=n-s;break;case"/":c=n/s;break;case"*":c=n*s;break;default:return Es}return{type:"number",number:c,unit:o}}}const yu=Symbol("evaluatables"),Ng=Symbol("intrinsics");class Qx extends Bt{constructor(e,t){super(),this[Ng]=t;const n=e[0],i=n!=null?n.terms:[];this[yu]=t.basis.map((s,a)=>{const o=i[a];return o==null?{type:"ident",value:"auto"}:o.type==="ident"?o:Bt.evaluatableFor(o,s)})}get isConstant(){for(const e of this[yu])if(!Bt.isConstant(e))return!1;return!0}[Ca](){const e=this[yu].map(t=>Bt.evaluate(t));return Bt.applyIntrinsics(e,this[Ng]).map(t=>t.number)}}/* @license
4732 * Copyright 2019 Google LLC. All Rights Reserved.
4733 * Licensed under the Apache License, Version 2.0 (the 'License');
4734 * you may not use this file except in compliance with the License.
4735 * You may obtain a copy of the License at
4736 *
4737 *     http://www.apache.org/licenses/LICENSE-2.0
4738 *
4739 * Unless required by applicable law or agreed to in writing, softw
4739are
4740 * distributed under the License is distributed on an 'AS IS' BASIS,
4741 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4742 * See the License for the specific language governing permissions and
4743 * limitations under the License.
4744 */var Gx,Hx,zx,Vx;const Br=Symbol("instances"),Ug=Symbol("activateListener"),Og=Symbol("deactivateListener"),Su=Symbol("notifyInstances"),kg=Symbol("notify"),Qg=Symbol("callback");class di{static[Su](){for(const e of di[Br])e[kg]()}static[(Gx=Br,Ug)](){window.addEventListener("scroll",this[Su],{passive:!0})}static[Og](){window.removeEventListener("scroll",this[Su])}constructor(e){this[Qg]=e}observe(){di[Br].size===0&&di[Ug](),di[Br].add(this)}disconnect(){di[Br].delete(this),di[Br].size===0&&di[Og]()}[kg](){this[Qg]()}}di[Gx]=new Set;const Gg=Symbol("computeStyleCallback"),Wx=Symbol("astWalker"),ho=Symbol("dependencies"),qx=Symbol("onScroll");class K1{constructor(e){this[Hx]={},this[zx]=new V1(["function"]),this[Vx]=()=>{this[Gg]({relatedState:"window-scroll"})},this[Gg]=e}observeEffectsFor(e){const t={},n=this[ho];this[Wx].walk(e,i=>{const{name:s}=i,o=i.arguments[0].terms[0];if(!(s.value!=="env"||o==null||o.type!=="ident"))switch(o.value){case"window-scroll-y":if(t["window-scroll"]==null){const c="window-scroll"in n?n["window-scroll"]:new di(this[qx]);c.observe(),delete n["window-scroll"],t["window-scroll"]=c}break}});for(const i in n)n[i].disconnect();this[ho]=t}dispose(){for(const e in this[ho])this[ho][e].disconnect()}}Hx=ho,zx=Wx,Vx=qx;/* @license
4745 * Copyright 2019 Google LLC. All Rights Reserved.
4746 * Licensed under the Apache License, Version 2.0 (the 'License');
4747 * you may not use this file except in compliance with the License.
4748 * You may obtain a copy of the License at
4749 *
4750 *     http://www.apache.org/licenses/LICENSE-2.0
4751 *
4752 * Unless required by applicable law or agreed to in writing, software
4753 * distributed under the License is distributed on an 'AS IS' BASIS,
4754 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4755 * See the License for the specific language governing permissions and
4756 * limitations under the License.
4757 */const rs=r=>{const e=r.observeEffects||!1,t=r.intrinsics instanceof Function?r.intrinsics:(()=>r.intrinsics);return(n,i)=>{const s=n.updated,a=n.connectedCallback,o=n.disconnectedCallback,c=Symbol(`${i}StyleEffector`),l=Symbol(`${i}StyleEvaluator`),h=Symbol(`${i}UpdateEvaluator`),u=Symbol(`${i}EvaluateAndSync`);Object.defineProperties(n,{[c]:{value:null,writable:!0},[l]:{value:null,writable:!0},[h]:{value:function(){const d=zi(this[i]);this[l]=new Qx(d,t(this)),this[c]==null&&e&&(this[c]=new K1(()=>this[u]())),this[c]!=null&&this[c].observeEffectsFor(d)}},[u]:{value:function(){if(this[l]==null)return;const d=this[l].evaluate();this[r.updateHandler](d)}},updated:{value:function(d){d.has(i)&&(this[h](),this[u]()),s.call(this,d)}},connectedCallback:{value:function(){a.call(this),this.requestUpdate(i,this[i])}},disconnectedCallback:{value:function(){o.call(this),this[c]!=null&&(this[c].dispose(),this[c]=null)}}})}};/* @license
4758 * Copyright 2019 Google LLC. All Rights Reserved.
4759 * Licensed under the Apache License, Version 2.0 (the 'License');
4760 * you may not use this file except in compliance with the License.
4761 * You may obtain a copy of the License at
4762 *
4763 *     http://www.apache.org/licenses/LICENSE-2.0
4764 *
4765 * Unless required by applicable law or agreed to in writing, software
4766 * distributed under the License is distributed on an 'AS IS' BASIS,
4767 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4768 * See the License for the specific language governing permissions and
4769 * limitations under the License.
4770 */const jx=r=>r<.5?2*r*r:-1+(4-2*r)*r,$1=(r,e,t=jx)=>n=>r+(e-r)*t(n),Y1=(r,e)=>{const t=(i=>s=>i+=s),n=e.map(t(0));return i=>{i=pi(i,0,1),i*=n[n.length-1];const s=n.findIndex(c=>c>=i),a=s<1?0:n[s-1],o=n[s];return r[s]((i-a)/(o-a))}},qr=r=>{const e=[],t=[];let n=r.initialValue;for(let i=0;i<r.keyframes.length;++i){const s=r.keyframes[i],{value:a,frames:o}=s,c=s.ease||jx,l=$1(n,a,c);e.push(l),t.push(o),n=a}return Y1(e,t)};/* @license
4771 * Copyright 2019 Google LLC. All Rights Reserved.
4772 * Licensed under the Apache License, Version 2.0 (the 'License');
4773 * you may not use this file except in compliance with the License.
4774 * You may obtain a copy of the License at
4775 *
4776 *     http://www.apache.org/licenses/LICENSE-2.0
4777 *
4778 * Unless required by applicable law or agreed to in writing, software
4779 * distributed under the License is distributed on an 'AS IS' BASIS,
4780 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4781 * See the License for the specific language governing permissions and
4782 * limitations under the License.
4783 */var Wt=function(r,e,t,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var o=r.length-1;o>=0;o--)(a=r[o])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s};const J1=5e3,Z1=qr({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}]}),eR=qr({initialValue:0,keyframes:[{frames:1,value:1},{frames:5,value:1},{frames:1,value:0},{frames:6,value:0}]}),tR=30,nR=12,Xx="0deg 75deg 105%",iR="auto auto auto",sR="auto",rR=2.2,aR=["front","right","back","left"],oR=["upper-","","lower-"],cR=3e3,lR=". Use mouse, touch or arrow keys to move.",Fc={AUTO:"auto"},Cu={BASIC:"basic",WIGGLE:"wiggle"},hR={NONE:"none"},Hg=()=>({basis:[ch(gn(tR,"deg"))],keywords:{auto:[null]}}),uR=()=>({basis:[ch(gn(nR,"deg"))],keywords:{auto:[null]}}),Kx=(()=>{const r=zi(Xx)[0].terms,e=gi(r[0]),t=gi(r[1]);return n=>{const i=n[J].idealCameraDistance();return{basis:[e,t,gn(i,"m")],keywords:{auto:[null,null,gn(105,"%")]}}}})(),dR=r=>{const e=rR*r[J].boundingSphere.radius;return{basis:[gn(-1/0,"rad"),gn(0,"rad"),gn(e,"m")],keywords:{auto:[null,null,null]}}},fR=r=>{const e=Kx(r),n=new Qx([],e).evaluate()[2];
vendor: 24,150 bytes, lines 4783-4795
4783return{basis:[gn(1/0,"rad"),gn(Math.PI,"rad"),gn(n,"m")],keywords:{auto:[null,null,null]}}},pR=r=>{r[J].updateBoundingBoxAndShadowIfDirty();const e=r[J].boundingBox.getCenter(new R);return{basis:[gn(e.x,"m"),gn(e.y,"m"),gn(e.z,"m")],keywords:{auto:[null,null,null]}}},$x=Math.PI/2,AR=Math.PI/3,gR=$x/2,mR=2*Math.PI,dt=Symbol("controls"),Al=Symbol("panElement"),Mu=Symbol("promptElement"),Nc=Symbol("promptAnimatedContainer"),Iu=Symbol("fingerAnimatedContainers"),Uc=Symbol("deferInteractionPrompt"),zg=Symbol("updateAria"),Di=Symbol("a11y"),Vg=Symbol("updateA11y"),Wg=Symbol("updateCameraForRadius"),Dr=Symbol("cancelPrompts"),wu=Symbol("onChange"),Qa=Symbol("onPointerChange"),Ds=Symbol("waitingToPromptUser"),Oc=Symbol("userHasInteracted"),Lr=Symbol("promptElementVisibleTime"),Ga=Symbol("lastPromptOffset"),kc=Symbol("cancellationSource"),Tu=Symbol("lastSpherical"),Ha=Symbol("jumpCamera"),Ru=Symbol("initialized"),za=Symbol("maintainThetaPhi"),qg=Symbol("syncCameraOrbit"),jg=Symbol("syncFieldOfView"),Xg=Symbol("syncCameraTarget"),Kg=Symbol("syncMinCameraOrbit"),$g=Symbol("syncMaxCameraOrbit"),Yg=Symbol("syncMinFieldOfView"),Jg=Symbol("syncMaxFieldOfView"),bR=r=>{var e,t,n,i,s,a,o,c,l,h,u,d,f,p,m,A,g,b;class x extends r{constructor(){super(...arguments),this.cameraControls=!1,this.cameraOrbit=Xx,this.cameraTarget=iR,this.fieldOfView=sR,this.minCameraOrbit="auto",this.maxCameraOrbit="auto",this.minFieldOfView="auto",this.maxFieldOfView="auto",this.interactionPromptThreshold=cR,this.interactionPrompt=Fc.AUTO,this.interactionPromptStyle=Cu.WIGGLE,this.orbitSensitivity=1,this.zoomSensitivity=1,this.panSensitivity=1,this.touchAction=hR.NONE,this.disableZoom=!1,this.disablePan=!1,this.disableTap=!1,this.interpolationDecay=Ux,this.a11y=null,this[e]=this.shadowRoot.querySelector(".interaction-prompt"),this[t]=this.shadowRoot.querySelector("#prompt"),this[n]=[this.shadowRoot.querySelector("#finger0"),this.shadowRoot.querySelector("#finger1")],this[i]=this.shadowRoot.querySelector(".pan-target"),this[s]=0,this[a]=1/0,this[o]=!1,this[c]=!1,this[l]=Pt.AUTOMATIC,this[h]=new vR(this[J].camera,this[Yn],this[J]),this[u]=new ul,this[d]=!1,this[f]=!1,this[p]=!1,this[m]={},this[A]=()=>{const v=this[dt].changeSource;this[kc]=v,v===Pt.USER_INTERACTION&&(this[Oc]=!0,this[Uc]())},this[g]=()=>{this[zg](),this[tn]();const v=this[dt].changeSource;this.dispatchEvent(new CustomEvent("camera-change",{detail:{source:v}}))},this[b]=v=>{this[bl].classList.toggle("pointer-tumbling",v.type==="pointer-change-start")}}get inputSensitivity(){return this[dt].inputSensitivity}set inputSensitivity(v){this[dt].inputSensitivity=v}getCameraOrbit(){const{theta:v,phi:C,radius:I}=this[Tu];return{theta:v,phi:C,radius:I,toString(){return`${this.theta}rad ${this.phi}rad ${this.radius}m`}}}getCameraTarget(){return hs(this[ot].isPresenting?this[ot].arRenderer.target:this[J].getDynamicTarget())}getFieldOfView(){return this[dt].getFieldOfView()}getMinimumFieldOfView(){return this[dt].options.minimumFieldOfView}getMaximumFieldOfView(){return this[dt].options.maximumFieldOfView}getIdealAspect(){return this[J].idealAspect}jumpCameraToGoal(){this[Ha]=!0,this.requestUpdate(Ha,!1)}resetInteractionPrompt(){this[Ga]=0,this[Lr]=1/0,this[Oc]=!1,this[Ds]=this.interactionPrompt===Fc.AUTO&&this.cameraControls}zoom(v){const C=new WheelEvent("wheel",{deltaY:-30*v});this[Yn].dispatchEvent(C)}connectedCallback(){super.connectedCallback(),this[dt].addEventListener("user-interaction",this[Dr]),this[dt].addEventListener("pointer-change-start",this[Qa]),this[dt].addEventListener("pointer-change-end",this[Qa])}disconnectedCallback(){super.disconnectedCallback(),this[dt].removeEventListener("user-interaction",this[Dr]),this[dt].removeEventListener("pointer-change-start",this[Qa]),this[dt].removeEventListener("pointer-change-end",this[Qa])}updated(v){super.updated(v);const C=this[dt],I=this[J];if(v.has("cameraControls")&&(this.cameraControls?(C.enableInteraction(),this.interactionPrompt===Fc.AUTO&&(this[Ds]=!0)):(C.disableInteraction(),this[Uc]()),this[Yn].setAttribute("aria-label",this[Xr])),v.has("disableZoom")&&(C.disableZoom=this.disableZoom),v.has("disablePan")&&(C.enablePan=!this.disablePan),v.has("disableTap")&&(C.enableTap=!this.disableTap),(v.has("interactionPrompt")||v.has("cameraControls")||v.has("src"))&&(this.interactionPrompt===Fc.AUTO&&this.cameraControls&&!this[Oc]?this[Ds]=!0:this[Uc]()),v.has("interactionPromptStyle")&&(this[Nc].style.opacity=this.interactionPromptStyle==Cu.BASIC?"1":"0"),v.has("touchAction")){const E=this.touchAction;C.applyOptions({touchAction:E}),C.updateTouchActionStyle()}v.has("orbitSensitivity")&&(C.orbitSensitivity=this.orbitSensitivity),v.has("zoomSensitivity")&&(C.zoomSensitivity=this.zoomSensitivity),v.has("panSensitivity")&&(C.panSensitivity=this.panSensitivity),v.has("interpolationDecay")&&(C.setDamperDecayTime(this.interpolationDecay),I.setTargetDamperDecayTime(this.interpolationDecay)),v.has("a11y")&&this[Vg](),this[Ha]===!0&&Promise.resolve().then(()=>{C.jumpToGoal(),I.jumpToGoal(),this[wu](),this[Ha]=!1})}async updateFraming(){const v=this[J],C=v.adjustedFoV(v.framedFoVDeg);await v.updateFraming();const I=v.adjustedFoV(v.framedFoVDeg),E=this[dt].getFieldOfView()/C;this[dt].setFieldOfView(I*E),this[za]=!0,this.requestUpdate("maxFieldOfView"),this.requestUpdate("fieldOfView"),this.requestUpdate("minCameraOrbit"),this.requestUpdate("maxCameraOrbit"),this.requestUpdate("cameraOrbit"),await this.updateComplete}interact(v,C,I){const E=this[Yn],S=this[Iu];if(S[0].style.opacity==="1"){console.warn("interact() failed because an existing interaction is running.");return}const P=new Array;P.push({x:qr(C.x),y:qr(C.y)});const w=[{x:P[0].x(0),y:P[0].y(0)}];I!=null&&(P.push({x:qr(I.x),y:qr(I.y)}),w.push({x:P[1].x(0),y:P[1].y(0)}));let L=performance.now();const{width:N,height:O}=this[J],D=this.getBoundingClientRect(),U=q=>{for(const[te,Z]of w.entries()){const{style:Y}=S[te];Y.transform=`translateX(${N*Z.x}px) translateY(${O*Z.y}px)`,q==="pointerdown"?Y.opacity="1":q==="pointerup"&&(Y.opacity="0");const fe={pointerId:te-5678,pointerType:"touch",target:E,clientX:N*Z.x+D.x,clientY:O*Z.y+D.y,altKey:!0};E.dispatchEvent(new PointerEvent(q,fe))}},F=()=>{const q=this[kc];if(q!==Pt.AUTOMATIC||!E.isConnected){for(const Z of this[Iu])Z.style.opacity="0";U("pointercancel"),this.dispatchEvent(new CustomEvent("interact-stopped",{detail:{source:q}})),document.removeEventListener("visibilitychange",$);return}const te=Math.min(1,(performance.now()-L)/v);for(const[Z,Y]of w.entries())Y.x=P[Z].x(te),Y.y=P[Z].y(te);U("pointermove"),te<1?requestAnimationFrame(F):(U("pointerup"),this.dispatchEvent(new CustomEvent("interact-stopped",{detail:{source:Pt.AUTOMATIC}})),document.removeEventListener("visibilitychange",$))},$=()=>{let q=0;document.visibilityState==="hidden"?q=performance.now()-L:L=performance.now()-q};document.addEventListener("visibilitychange",$),U("pointerdown"),this[kc]=Pt.AUTOMATIC,requestAnimationFrame(F)}[(e=Mu,t=Nc,n=Iu,i=Al,s=Ga,a=Lr,o=Oc,c=Ds,l=kc,h=dt,u=Tu,d=Ha,f=Ru,p=za,m=Di,jg)](v){const C=this[dt],I=this[J];I.framedFoVDeg=v[0]*180/Math.PI,C.changeSource=Pt.NONE,C.setFieldOfView(I.adjustedFoV(I.framedFoVDeg)),this[Dr]()}[qg](v){const C=this[dt];if(this[za]){const{theta:I,phi:E}=this.getCameraOrbit();v[0]=I,v[1]=E,this[za]=!1}C.changeSource=Pt.NONE,C.setOrbit(v[0],v[1],v[2]),this[Dr]()}[Kg](v){this[dt].applyOptions({minimumAzimuthalAngle:v[0],minimumPolarAngle:v[1],minimumRadius:v[2]}),this.jumpCameraToGoal()}[$g](v){this[dt].applyOptions({maximumAzimuthalAngle:v[0],maximumPolarAngle:v[1],maximumRadius:v[2]}),this[Wg](v[2]),this.jumpCameraToGoal()}[Yg](v){this[dt].applyOptions({minimumFieldOfView:v[0]*180/Math.PI}),this.jumpCameraToGoal()}[Jg](v){const C=this[J].adjustedFoV(v[0]*180/Math.PI);this[dt].applyOptions({maximumFieldOfView:C}),this.jumpCameraToGoal()}[Xg](v){const[C,I,E]=v;this[ot].arRenderer.isPresenting||this[J].setTarget(C,I,E),this[dt].changeSource=Pt.NONE,this[ot].arRenderer.updateTarget(),this[Dr]()}[mi](v,C){if(super[mi](v,C),this[ot].isPresenting||!this[ar]())return;const I=this[dt],E=this[J],S=performance.now();if(this[Ds]&&this.loaded&&S>this[po]+this.interactionPromptThreshold&&(this[Ds]=!1,this[Lr]=S,this[Mu].classList.add("visible")),isFinite(this[Lr])&&this.interactionPromptStyle===Cu.WIGGLE){const L=(S-this[Lr])/J1%1,N=Z1(L),O=eR(L);if(this[Nc].style.opacity=`${O}`,N!==this[Ga]){const D=N*E.width*.05,U=(N-this[Ga])*Math.PI/16;this[Nc].style.transform=`translateX(${D}px)`,I.changeSource=Pt.AUTOMATIC,I.adjustOrbit(U,0,0),this[Ga]=N}}const P=I.update(v,C),w=E.updateTarget(C);(P||w)&&this[wu]()}[Uc](){this[Ds]=!1,this[Mu].classList.remove("visible"),this[Lr]=1/0}[Wg](v){const C=Math.max(this[J].farRadius(),v),I=0,E=Math.abs(2*C);this[dt].updateNearFar(I,E)}[zg](){const{theta:v,phi:C}=this[dt].getCameraSpherical(this[Tu]),I=(4+Math.floor((v%mR+gR)/$x))%4,E=Math.floor(C/AR),S=aR[I],w=`${oR[E]}${S}`,L=w;L in this[Di]?this[Wl](this[Di][L]):this[Wl](`View from stage ${w}`)}get[Xr](){let v=lR;return"interaction-prompt"in this[Di]&&(v=`. ${this[Di]["interaction-prompt"]}`),super[Xr].replace(/\.$/,"")+(this.cameraControls?v:"")}async[ql](v){const C=this[dt],I=this[J],E=I.adjustedFoV(I.framedFoVDeg);super[ql](v);const S=I.adjustedFoV(I.framedFoVDeg)/E,P=C.getFieldOfView()*(isFinite(S)?S:1);C.updateAspect(this[J].aspect),this.requestUpdate("maxFieldOfView",this.maxFieldOfView),await this.updateComplete,this[dt].setFieldOfView(P),this.jumpCameraToGoal()}[bi](){super[bi](),this[Ru]?this[za]=!0:this[Ru]=!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()}[(A=Dr,g=wu,b=Qa,Vg)](){if(typeof this.a11y=="string")if(this.a11y.startsWith("{"))try{this[Di]=JSON.parse(this.a11y)}catch(v){console.warn("Error parsing a11y JSON:",v)}else this.a11y.length>0?console.warn("Error not supported format, should be a JSON string:",this.a11y):this[Di]={};else typeof this.a11y=="object"&&this.a11y!=null?this[Di]=Object.assign({},this.a11y):this[Di]={};this[Yn].setAttribute("aria-label",this[Xr])}}return Wt([Re({type:Boolean,attribute:"camera-controls"})],x.prototype,"cameraControls",void 0),Wt([rs({intrinsics:Kx,observeEffects:!0,updateHandler:qg}),Re({type:String,attribute:"camera-orbit",hasChanged:()=>!0})],x.prototype,"cameraOrbit",void 0),Wt([rs({intrinsics:pR,observeEffects:!0,updateHandler:Xg}),Re({type:String,attribute:"camera-target",hasChanged:()=>!0})],x.prototype,"cameraTarget",void 0),Wt([rs({intrinsics:Hg,observeEffects:!0,updateHandler:jg}),Re({type:String,attribute:"field-of-view",hasChanged:()=>!0})],x.prototype,"fieldOfView",void 0),Wt([rs({intrinsics:dR,updateHandler:Kg}),Re({type:String,attribute:"min-camera-orbit",hasChanged:()=>!0})],x.prototype,"minCameraOrbit",void 0),Wt([rs({intrinsics:fR,updateHandler:$g}),Re({type:String,attribute:"max-camera-orbit",hasChanged:()=>!0})],x.prototype,"maxCameraOrbit",void 0),Wt([rs({intrinsics:uR,updateHandler:Yg}),Re({type:String,attribute:"min-field-of-view",hasChanged:()=>!0})],x.prototype,"minFieldOfView",void 0),Wt([rs({intrinsics:Hg,updateHandler:Jg}),Re({type:String,attribute:"max-field-of-view",hasChanged:()=>!0})],x.prototype,"maxFieldOfView",void 0),Wt([Re({type:Number,attribute:"interaction-prompt-threshold"})],x.prototype,"interactionPromptThreshold",void 0),Wt([Re({type:String,attribute:"interaction-prompt"})],x.prototype,"interactionPrompt",void 0),Wt([Re({type:String,attribute:"interaction-prompt-style"})],x.prototype,"interactionPromptStyle",void 0),Wt([Re({type:Number,attribute:"orbit-sensitivity"})],x.prototype,"orbitSensitivity",void 0),Wt([Re({type:Number,attribute:"zoom-sensitivity"})],x.prototype,"zoomSensitivity",void 0),Wt([Re({type:Number,attribute:"pan-sensitivity"})],x.prototype,"panSensitivity",void 0),Wt([Re({type:String,attribute:"touch-action"})],x.prototype,"touchAction",void 0),Wt([Re({type:Boolean,attribute:"disable-zoom"})],x.prototype,"disableZoom",void 0),Wt([Re({type:Boolean,attribute:"disable-pan"})],x.prototype,"disablePan",void 0),Wt([Re({type:Boolean,attribute:"disable-tap"})],x.prototype,"disableTap",void 0),Wt([Re({type:Number,attribute:"interpolation-decay"})],x.prototype,"interpolationDecay",void 0),Wt([Re()],x.prototype,"a11y",void 0),x};/* @license
4784 * Licensed under the Apache License, Version 2.0 (the 'License');
4785 * you may not use this file except in compliance with the License.
4786 * You may obtain a copy of the License at
4787 *
4788 *     http://www.apache.org/licenses/LICENSE-2.0
4789 *
4790 * Unless required by applicable law or agreed to in writing, software
4791 * distributed under the License is distributed on an 'AS IS' BASIS,
4792 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4793 * See the License for the specific language governing permissions and
4794 * limitations under the License.
4795 */const xR=.018,Zg=2,ER=300,_R=new pe,em=new R,tm=Object.freeze({minimumRadius:0,maximumRadius:1/0,minimumPolarAngle:0,maximumPolarAngle:Math.PI,minimumAzimuthalAngle:-1/0,maximumAzimuthalAngle:1/0,minimumFieldOfView:10,maximumFieldOfView:45,touchAction:"none"}),Qc=Math.PI/8,Gc=.04,Hc=10,Pt={USER_INTERACTION:"user-interaction",NONE:"none",AUTOMATIC:"automatic"};class vR extends si{constructor(e,t,n){super(),this.camera=e,this.element=t,this.scene=n,this.orbitSensitivity=1,this.zoomSensitivity=1,this.panSensitivity=1,this.inputSensitivity=1,this.changeSource=Pt.NONE,this._interactionEnabled=!1,this._disableZoom=!1,this.isUserPointing=!1,this.enablePan=!0,this.enableTap=!0,this.panProjection=new Qe,this.panPerPixel=0,this.spherical=new ul,this.goalSpherical=new ul,this.thetaDamper=new an,this.phiDamper=new an,this.radiusDamper=new an,this.logFov=Math.log(tm.maximumFieldOfView),this.goalLogFov=this.logFov,this.fovDamper=new an,this.touchMode=null,this.pointers=[],this.startTime=0,this.startPointerPosition={clientX:0,clientY:0},this.lastSeparation=0,this.touchDecided=!1,this.onContext=i=>{if(this.enablePan)i.preventDefault();else for(const s of this.pointers)this.onPointerUp(new PointerEvent("pointercancel",Object.assign(Object.assign({},this.startPointerPosition),{pointerId:s.id})))},this.touchModeZoom=(i,s)=>{if(!this._disableZoom){const a=this.twoTouchDistance(this.pointers[0],this.pointers[1]),o=Gc*this.zoomSensitivity*(this.lastSeparation-a)*50/this.scene.height;this.lastSeparation=a,this.userAdjustOrbit(0,0,o)}this.panPerPixel>0&&this.movePan(i,s)},this.disableScroll=i=>{i.preventDefault()},this.touchModeRotate=(i,s)=>{const{touchAction:a}=this._options;if(!this.touchDecided&&a!=="none"){this.touchDecided=!0;const o=Math.abs(i),c=Math.abs(s);if(this.changeSource===Pt.USER_INTERACTION&&(a==="pan-y"&&c>o||a==="pan-x"&&o>c)){this.touchMode=null;return}else this.element.addEventListener("touchmove",this.disableScroll,{passive:!1})}this.handleSinglePointerMove(i,s)},this.onPointerDown=i=>{if(this.pointers.length>2)return;const{element:s}=this;this.pointers.length===0&&(s.addEventListener("pointermove",this.onPointerMove),s.addEventListener("pointerup",this.onPointerUp),this.touchMode=null,this.touchDecided=!1,this.startPointerPosition.clientX=i.clientX,this.startPointerPosition.clientY=i.clientY,this.startTime=performance.now());try{s.setPointerCapture(i.pointerId)}catch{}this.pointers.push({clientX:i.clientX,clientY:i.clientY,id:i.pointerId}),this.isUserPointing=!1,i.pointerType==="touch"?(this.changeSource=i.altKey?Pt.AUTOMATIC:Pt.USER_INTERACTION,this.onTouchChange(i)):(this.changeSource=Pt.USER_INTERACTION,this.onMouseDown(i)),this.changeSource===Pt.USER_INTERACTION&&this.dispatchEvent({type:"user-interaction"})},this.onPointerMove=i=>{const s=this.pointers.find(l=>l.id===i.pointerId);if(s==null)return;if(i.pointerType==="mouse"&&i.buttons===0){this.onPointerUp(i);return}const a=this.pointers.length,o=(i.clientX-s.clientX)/a,c=(i.clientY-s.clientY)/a;o===0&&c===0||(s.clientX=i.clientX,s.clientY=i.clientY,i.pointerType==="touch"?(this.changeSource=i.altKey?Pt.AUTOMATIC:Pt.USER_INTERACTION,this.touchMode!==null&&this.touchMode(o,c)):(this.changeSource=Pt.USER_INTERACTION,this.panPerPixel>0?this.movePan(o,c):this.handleSinglePointerMove(o,c)))},this.onPointerUp=i=>{const{element:s}=this,a=this.pointers.findIndex(o=>o.id===i.pointerId);a!==-1&&this.pointers.splice(a,1),this.panPerPixel>0&&!i.altKey&&this.resetRadius(),this.pointers.length===0?(s.removeEventListener("pointermove",this.onPointerMove),s.removeEventListener("pointerup",this.onPointerUp),s.removeEventListener("touchmove",this.disableScroll),this.enablePan&&this.enableTap&&this.recenter(i)):this.touchMode!==null&&this.onTouchChange(i),this.scene.element[Al].style.opacity=0,s.style.cursor="grab",this.panPerPixel=0,this.isUserPointing&&this.dispatchEvent({type:"pointer-change-end"})},this.onWheel=i=>{this.changeSource=Pt.USER_INTERACTION;const s=i.deltaY*(i.deltaMode==1?18:1)*Gc*this.zoomSensitivity/30;this.userAdjustOrbit(0,0,s),i.preventDefault(),this.dispatchEvent({type:"user-interaction"})},this.onKeyDown=i=>{const{changeSource:s}=this;this.changeSource=Pt.USER_INTERACTION,(i.shiftKey&&this.enablePan?this.panKeyCodeHandler(i):this.orbitZoomKeyCodeHandler(i))?(i.preventDefault(),this.dispatchEvent({type:"user-interaction"})):this.changeSource=s},this._options=Object.assign({},tm),this.setOrbit(0,Math.PI/2,1),this.setFieldOfView(100),this.jumpToGoal()}get interactionEnabled(){return this._interactionEnabled}enableInteraction(){if(this._interactionEnabled===!1){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(this._interactionEnabled===!0){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,e===!0?this.element.removeEventListener("wheel",this.onWheel):this.element.addEventListener("wheel",this.onWheel),this.updateTouchActionStyle())}getCameraSpherical(e=new ul){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=t===0?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,n=this.goalSpherical.radius){const{minimumAzimuthalAngle:i,maximumAzimuthalAngle:s,minimumPolarAngle:a,maximumPolarAngle:o,minimumRadius:c,maximumRadius:l}=this._options,{theta:h,phi:u,radius:d}=this.goalSpherical,f=pi(e,i,s);!isFinite(i)&&!isFinite(s)&&(this.spherical.theta=this.wrapAngle(this.spherical.theta-f)+f);const p=pi(t,a,o),m=pi(n,c,l);return f===h&&p===u&&m===d||!isFinite(f)||!isFinite(p)||!isFinite(m)?!1:(this.goalSpherical.theta=f,this.goalSpherical.phi=p,this.goalSpherical.radius=m,this.goalSpherical.makeSafe(),!0)}setRadius(e){this.goalSpherical.radius=e,this.setOrbit()}setFieldOfView(e){const{minimumFieldOfView:t,maximumFieldOfView:n}=this._options;e=pi(e,t,n),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,n){const{theta:i,phi:s,radius:a}=this.goalSpherical,{minimumRadius:o,maximumRadius:c,minimumFieldOfView:l,maximumFieldOfView:h}=this._options,u=this.spherical.theta-i,d=Math.PI-.001,f=i-pi(e,-d-u,d-u),p=s-t,m=n===0?0:((n>0?c:o)-a)/(Math.log(n>0?h:l)-this.goalLogFov),A=a+n*(isFinite(m)?m:(c-o)*2);if(this.setOrbit(f,p,A),n!==0){const g=this.goalLogFov+n;this.setFieldOfView(Math.exp(g))}}jumpToGoal(){this.update(0,Nx)}update(e,t){if(this.isStationary())return!1;const{maximumPolarAngle:n,maximumRadius:i}=this._options,s=this.spherical.theta-this.goalSpherical.theta;return Math.abs(s)>Math.PI&&!isFinite(this._options.minimumAzimuthalAngle)&&!isFinite(this._options.maximumAzimuthalAngle)&&(this.spherical.theta-=Math.sign(s)*2*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,n),this.spherical.radius=this.radiusDamper.update(this.spherical.radius,this.goalSpherical.radius,t,i),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&&t!=="none"?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 Hn(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,n){this.adjustOrbit(e*this.orbitSensitivity*this.inputSensitivity,t*this.orbitSensitivity*this.inputSensitivity,n*this.inputSensitivity)}wrapAngle(e){const t=(e+Math.PI)/(2*Math.PI);return(t-Math.floor(t))*2*Math.PI-Math.PI}pixelLengthToSphericalAngle(e){return 2*Math.PI*e/this.scene.height}twoTouchDistance(e,t){const{clientX:n,clientY:i}=e,{clientX:s,clientY:a}=t,o=s-n,c=a-i;return Math.sqrt(o*o+c*c)}handleSinglePointerMove(e,t){const n=this.pixelLengthToSphericalAngle(e),i=this.pixelLengthToSphericalAngle(t);this.isUserPointing===!1&&(this.isUserPointing=!0,this.dispatchEvent({type:"pointer-change-start"})),this.userAdjustOrbit(n,i,0)}initializePan(){const{theta:e,phi:t}=this.spherical,n=e-this.scene.yaw;this.panPerPixel=xR*this.panSensitivity/this.scene.height,this.panProjection.set(-Math.cos(n),-Math.cos(t)*Math.sin(n),0,0,Math.sin(t),0,Math.sin(n),-Math.cos(t)*Math.cos(n),0)}movePan(e,t){const{scene:n}=this,i=em.set(e,t,0).multiplyScalar(this.inputSensitivity),s=this.spherical.radius*Math.exp(this.logFov)*this.panPerPixel;i.multiplyScalar(s);const a=n.getTarget();a.add(i.applyMatrix3(this.panProjection)),n.boundingSphere.clampPoint(a,a),n.setTarget(a.x,a.y,a.z)}recenter(e){if(performance.now()>this.startTime+ER||Math.abs(e.clientX-this.startPointerPosition.clientX)>Zg||Math.abs(e.clientY-this.startPointerPosition.clientY)>Zg)return;const{scene:t}=this,n=t.positionAndNormalFromPoint(t.getNDC(e.clientX,e.clientY));if(n==null){const{cameraTarget:i}=t.element;t.element.cameraTarget="",t.element.cameraTarget=i,this.userAdjustOrbit(0,0,1)}else t.target.worldToLocal(n.position),t.setTarget(n.position.x,n.position.y,n.position.z)}resetRadius(){const{scene:e}=this,t=e.positionAndNormalFromPoint(_R.set(0,0));if(t==null)return;e.target.worldToLocal(t.position);const n=e.getTarget(),{theta:i,phi:s}=this.spherical,a=i-e.yaw,o=em.set(Math.sin(s)*Math.sin(a),Math.cos(s),Math.sin(s)*Math.cos(a)),c=o.dot(t.position.sub(n));n.add(o.multiplyScalar(c)),e.setTarget(n.x,n.y,n.z),this.setOrbit(void 0,void 0,this.goalSpherical.radiu
vendor: 29,859 bytes, lines 4795-4823
4795s-c)}onTouchChange(e){if(this.pointers.length===1)this.touchMode=this.touchModeRotate;else{if(this._disableZoom){this.touchMode=null,this.element.removeEventListener("touchmove",this.disableScroll);return}this.touchMode=this.touchDecided&&this.touchMode===null?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&&this.touchMode!=null&&(this.initializePan(),e.altKey||(this.scene.element[Al].style.opacity=1))}}onMouseDown(e){this.panPerPixel=0,this.enablePan&&(e.button===2||e.ctrlKey||e.metaKey||e.shiftKey)&&(this.initializePan(),this.scene.element[Al].style.opacity=1),this.element.style.cursor="grabbing"}orbitZoomKeyCodeHandler(e){let t=!0;switch(e.key){case"PageUp":this.userAdjustOrbit(0,0,Gc*this.zoomSensitivity);break;case"PageDown":this.userAdjustOrbit(0,0,-1*Gc*this.zoomSensitivity);break;case"ArrowUp":this.userAdjustOrbit(0,-Qc,0);break;case"ArrowDown":this.userAdjustOrbit(0,Qc,0);break;case"ArrowLeft":this.userAdjustOrbit(-Qc,0,0);break;case"ArrowRight":this.userAdjustOrbit(Qc,0,0);break;default:t=!1;break}return t}panKeyCodeHandler(e){this.initializePan();let t=!0;switch(e.key){case"ArrowUp":this.movePan(0,-1*Hc);break;case"ArrowDown":this.movePan(0,Hc);break;case"ArrowLeft":this.movePan(-1*Hc,0);break;case"ArrowRight":this.movePan(Hc,0);break;default:t=!1;break}return t}}const nm=`<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="#e8eaed">
4796   <path d="M6.4,19L5,17.6L10.6,12L5,6.4L6.4,5L12,10.6L17.6,5L19,6.4L13.4,12L19,17.6L17.6,19L12,13.4L6.4,19Z"/>
4797</svg>`,im=`<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="#e8eaed">
4798   <path d="M7,17V9H5V7H9V17H7ZM11,17V15H13V17H11ZM16,17V9H14V7H18V17H16ZM11,13V11H13V13H11Z"/>
4799</svg>`,sm=`<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="#E1E2E8">
4800   <defs>
4801       <clipPath id="clip0">
4802           <path d="M0,0h24v24h-24z"/>
4803       </clipPath>
4804   </defs>
4805   <g clip-path="url(#clip0)">
4806       <path d="M12,22C10.75,22 9.575,21.767 8.475,21.3C7.392,20.817 6.442,20.175 5.625,19.375C4.825,18.558 4.183,17.608 3.7,16.525C3.233,15.425 3,14.25 3,13H5C5,14.95 5.675,16.608 7.025,17.975C8.392,19.325 10.05,20 12,20C13.95,20 15.6,19.325 16.95,17.975C18.317,16.608 19,14.95 19,13C19,11.05 18.317,9.4 16.95,8.05C15.6,6.683 13.95,6 12,6H11.85L13.4,7.55L12,9L8,5L12,1L13.4,2.45L11.85,4H12C13.25,4 14.417,4.242 15.5,4.725C16.6,5.192 17.55,5.833 18.35,6.65C19.167,7.45 19.808,8.4 20.275,9.5C20.758,10.583 21,11.75 21,13C21,14.25 20.758,15.425 20.275,16.525C19.808,17.608 19.167,18.558 18.35,19.375C17.55,20.175 16.6,20.817 15.5,21.3C14.417,21.767 13.25,22 12,22Z"/>
4807   </g>
4808</svg>`,li={width:.16,height:.07,cornerRadius:.03,opacity:1,color:0,minDistance:.5,maxDistance:10,baseScale:1,distanceScaleFactor:.3},Va={size:.05,zOffset:.01,spacing:.07},Wa={canvasSize:128,filter:qe};class Qi extends ht{constructor(){super(),this.isActualSize=!1,this.preRenderIcons(),this.createPanel(),this.createButtons(),this.opacityDamper=new an,this.goalOpacity=li.opacity}createPanel(){const e=this.createPanelShape(),t=new qf(e),n=new pn({color:li.color,opacity:li.opacity,transparent:!0});this.panelMesh=new at(t,n),this.panelMesh.name="MenuPanel",this.add(this.panelMesh)}createButtons(){this.exitButton=this.createButton("close"),this.exitButton.name="ExitButton",this.exitButton.position.set(Va.spacing/2,0,Va.zOffset),this.add(this.exitButton),this.toggleButton=this.createButton("view-real-size"),this.toggleButton.name="ToggleButton",this.toggleButton.position.set(-.07/2,0,Va.zOffset),this.add(this.toggleButton)}createPanelShape(){const e=new mb,{width:t,height:n,cornerRadius:i}=li;return e.moveTo(-t/2+i,-n/2),e.lineTo(t/2-i,-n/2),e.quadraticCurveTo(t/2,-n/2,t/2,-n/2+i),e.lineTo(t/2,n/2-i),e.quadraticCurveTo(t/2,n/2,t/2-i,n/2),e.lineTo(-t/2+i,n/2),e.quadraticCurveTo(-t/2,n/2,-t/2,n/2-i),e.lineTo(-t/2,-n/2+i),e.quadraticCurveTo(-t/2,-n/2,-t/2+i,-n/2),e}preRenderIcons(){[{key:"close",svg:nm},{key:"view-real-size",svg:im},{key:"replay",svg:sm}].forEach(({key:t,svg:n})=>{Qi.iconTextures.has(t)||this.createTextureFromSvg(n,t)})}createTextureFromSvg(e,t){const n=document.createElement("canvas");n.width=Wa.canvasSize,n.height=Wa.canvasSize;const i=n.getContext("2d"),s=new Image,a=new Blob([e],{type:"image/svg+xml"}),o=URL.createObjectURL(a);s.onload=()=>{i.drawImage(s,0,0,Wa.canvasSize,Wa.canvasSize);const c=new Ql(n);c.needsUpdate=!0,c.minFilter=Wa.filter,Qi.iconTextures.set(t,c),URL.revokeObjectURL(o)},s.src=o}createButton(e){const t=new pn({transparent:!0}),n=new zn(Va.size,Va.size),i=new at(n,t),s=Qi.iconTextures.get(e);if(s)i.material.map=s,i.material.needsUpdate=!0;else{this.createTextureFromSvg(e==="close"?nm:e==="view-real-size"?im:sm,e);const a=()=>{const o=Qi.iconTextures.get(e);o?(i.material.map=o,i.material.needsUpdate=!0):setTimeout(a,10)};a()}return i}exitButtonControllerIntersection(e,t){return e.hitFromController(t,this.exitButton)}scaleModeButtonControllerIntersection(e,t){return e.hitFromController(t,this.toggleButton)}handleScaleToggle(e,t,n,i){if(!e)return null;this.isActualSize=!this.isActualSize;const s=this.isActualSize?"replay":"view-real-size";this.updateScaleModeButtonLabel(s);const a=this.isActualSize?1:t;return Math.max(n,Math.min(i,a))}updateScaleModeButtonLabel(e){const t=Qi.iconTextures.get(e);t&&(this.toggleButton.material.map=t,this.toggleButton.material.needsUpdate=!0)}updatePosition(e,t){if(!t)return;const n=new R;t.getWorldPosition(n);const i=t.getSize(),s=Math.min(i.x,i.z),a=-.2,o=.9,c=Math.max(.5,Math.min(2,s/1)),l=a*c,h=o*c,u=new R().copy(e.position).sub(n);u.y=0,u.normalize();const d=new R().copy(n).add(new R(0,l,0)).add(u.multiplyScalar(h));this.position.copy(d);const f=e.position.distanceTo(d),p=Math.max(li.minDistance,Math.min(li.maxDistance,f)),m=li.baseScale+(p-li.minDistance)*li.distanceScaleFactor;this.scale.set(m,m,m),this.lookAt(e.position)}set show(e){this.goalOpacity=e?li.opacity:0}updateOpacity(e){const n=this.panelMesh.material.opacity,i=this.opacityDamper.update(n,this.goalOpacity,e,1);this.traverse(s=>{if(s instanceof at){const a=s.material;a.transparent&&(a.opacity=i)}}),this.visible=i>0}dispose(){var e;this.children.forEach(t=>{t instanceof at&&(t.geometry&&t.geometry.dispose(),(Array.isArray(t.material)?t.material:[t.material]).forEach(i=>{i&&("map"in i&&i.map instanceof Ql&&i.map.dispose(),i.dispose())}))}),(e=this.parent)===null||e===void 0||e.remove(this)}}Qi.iconTextures=new Map;/* @license
4809 * Copyright 2019 Google LLC. All Rights Reserved.
4810 * Licensed under the Apache License, Version 2.0 (the 'License');
4811 * you may not use this file except in compliance with the License.
4812 * You may obtain a copy of the License at
4813 *
4814 *     http://www.apache.org/licenses/LICENSE-2.0
4815 *
4816 * Unless required by applicable law or agreed to in writing, software
4817 * distributed under the License is distributed on an 'AS IS' BASIS,
4818 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4819 * See the License for the specific language governing permissions and
4820 * limitations under the License.
4821 */const yR=30,zc=.8,rm=1.5,SR=20,CR=.2,MR=.25,IR=10,Ls=150,am=5,wR=new R(0,1,0),TR=.3,RR=1.5,BR=15,om=.3,Bu=.01,DR=.15,LR=70,Du=.001,PR=.2,Gi={NOT_PRESENTING:"not-presenting",SESSION_STARTED:"session-started",OBJECT_PLACED:"object-placed",FAILED:"failed"},cf={TRACKING:"tracking",NOT_TRACKING:"not-tracking"},qa=new R,Lu=new An,FR=new Oe,NR=new R,UR=new Zt(45,1,.1,100),cm=new cn().setFromPoints([new R(0,0,0),new R(0,0,-1)]),Yt={SCREEN_SPACE:"screen-space",WORLD_SPACE:"world-space"};class OR extends si{isWorldSpaceReady(){return this.xrMode===Yt.WORLD_SPACE&&this.worldSpaceInitialPlacementDone}constructor(e){super(),this.renderer=e,this.currentSession=null,this.placeOnWall=!1,this.placementBox=null,this.menuPanel=null,this.lastTick=null,this.turntableRotation=null,this.oldShadowIntensity=null,this.frame=null,this.initialHitSource=null,this.transientHitTestSource=null,this.inputSource=null,this._presentedScene=null,this.resolveCleanup=null,this.exitWebXRButtonContainer=null,this.overlay=null,this.xrLight=null,this.xrMode=null,this.xrController1=null,this.xrController2=null,this.selectedXRController=null,this.tracking=!0,this.frames=0,this.initialized=!1,this.oldTarget=new R,this.placementComplete=!1,this.isTranslating=!1,this.isRotating=!1,this.isTwoHandInteraction=!1,this.lastDragPosition=new R,this.deltaRotation=new An,this.scaleLine=new Uo(cm),this.firstRatio=0,this.lastAngle=0,this.goalPosition=new R,this.goalYaw=0,this.goalScale=1,this.xDamper=new an,this.yDamper=new an,this.zDamper=new an,this.yawDamper=new an,this.pitchDamper=new an,this.rollDamper=new an,this.scaleDamper=new an,this.wasTwoFingering=!1,this.worldSpaceInitialPlacementDone=!1,this.initialModelScale=1,this.minScale=1,this.maxScale=1,this.onExitWebXRButtonContainerClick=()=>this.stopPresenting(),this.onControllerSelectStart=t=>{var n,i,s;const a=this.presentedScene,o=t.target,c=this.menuPanel;if(this.menuPanel.exitButtonControllerIntersection(a,o)!=null){(n=this.menuPanel)===null||n===void 0||n.dispose(),this.stopPresenting();return}if(this.menuPanel.scaleModeButtonControllerIntersection(a,o)!=null){const d=this.menuPanel.handleScaleToggle(this.worldSpaceInitialPlacementDone,this.initialModelScale,this.minScale,this.maxScale);d!==null&&(this.goalScale=d);return}c&&(c.show=!1);const u=this.placementBox.controllerIntersection(a,o);if(u!=null){const f=new fn().setFromObject(a.scenePivot).min.y+PR;if(u.point.y<=f)this.selectedXRController!=null?(this.selectedXRController.userData.line.visible=!1,a.canScale&&this.isWorldSpaceReady()&&(this.isTwoHandInteraction=!0,this.firstRatio=this.controllerSeparation()/a.scenePivot.scale.x,this.scaleLine.visible=!0)):o.attach(a.scenePivot),this.selectedXRController=o,a.setShadowIntensity(.01);else if(o==this.xrController1?this.xrController1.userData.isSelected=!0:o==this.xrController2&&(this.xrController2.userData.isSelected=!0),!((i=this.xrController1)===null||i===void 0)&&i.userData.isSelected&&(!((s=this.xrController2)===null||s===void 0)&&s.userData.isSelected))a.canScale&&this.isWorldSpaceReady()&&(this.isTwoHandInteraction=!0,this.firstRatio=this.controllerSeparation()/a.scenePivot.scale.x,this.scaleLine.visible=!0);else{const m=o===this.xrController1?this.xrController2:this.xrController1;o.userData.initialX=o.position.x,m.userData.turning=!1,o.userData.turning=!0,o.userData.line.visible=!1}}},this.onControllerSelectEnd=t=>{const n=t.target;if(n.userData.turning=!1,n.userData.line.visible=!0,this.isTwoHandInteraction=!1,this.scaleLine.visible=!1,n==this.xrController1?this.xrController1.userData.isSelected=!1:n==this.xrController2&&(this.xrController2.userData.isSelected=!1),this.selectedXRController!=null&&this.selectedXRController!=n)return;const i=this.presentedScene;i.attach(i.scenePivot),this.selectedXRController=null,this.goalYaw=Math.atan2(i.scenePivot.matrix.elements[8],i.scenePivot.matrix.elements[10]),this.goalPosition.x=i.scenePivot.position.x,this.goalPosition.z=i.scenePivot.position.z,this.isWorldSpaceReady()&&(this.goalPosition.y=i.scenePivot.position.y);const s=this.menuPanel;s.show=!0},this.onUpdateScene=()=>{this.placementBox!=null&&this.isPresenting&&(this.placementBox.updateFromModelChanges(),this.placementBox.setScreenSpaceMode(this.xrMode===Yt.SCREEN_SPACE)),this.xrMode!==Yt.SCREEN_SPACE&&(this.menuPanel&&(this.menuPanel.dispose(),this.menuPanel=null),this.menuPanel=new Qi,this.presentedScene.add(this.menuPanel),this.menuPanel.updatePosition(this.presentedScene.getCamera(),this.placementBox))},this.onSelectStart=t=>{const n=this.transientHitTestSource;if(n==null)return;const i=this.frame.getHitTestResultsForTransientInput(n),s=this.presentedScene,a=this.placementBox;if(i.length===1){this.inputSource=t.inputSource;const{axes:o}=this.inputSource.gamepad,c=a.getHit(this.presentedScene,o[0],o[1]);a.show=!0,c!=null?(this.isTranslating=!0,this.lastDragPosition.copy(c)):this.placeOnWall===!1&&(this.isRotating=!0,this.lastAngle=o[0]*rm)}else if(i.length===2){a.show=!0,this.isTwoHandInteraction=!0;const{separation:o,angle:c}=this.fingerPolar(i);this.lastAngle=c,this.firstRatio===0&&(this.firstRatio=o/s.scenePivot.scale.x),s.canScale&&this.setScale(o);return}},this.onSelectEnd=()=>{this.isTranslating=!1,this.isRotating=!1,this.isTwoHandInteraction=!1,this.inputSource=null,this.goalPosition.y+=this.placementBox.offsetHeight*this.presentedScene.scale.x,this.placementBox.show=!1},this.onBeforeXRSelect=t=>{const n=t.composedPath();for(const i of n)if(i instanceof HTMLElement){const s=i.tagName.toLowerCase();if(s==="input"||s==="button"||s==="select"||s==="textarea"||s==="a"||i.hasAttribute("data-pointer-coalesce")||i.classList.contains("interactive")){t.preventDefault();break}}},this.threeRenderer=e.threeRenderer,this.threeRenderer.xr.enabled=!0}async resolveARSession(){$A();const e=await navigator.xr.requestSession("immersive-ar",{requiredFeatures:[],optionalFeatures:["hit-test","dom-overlay","light-estimation"],domOverlay:this.overlay?{root:this.overlay}:void 0});return this.threeRenderer.xr.setReferenceSpaceType("local"),await this.threeRenderer.xr.setSession(e),this.threeRenderer.xr.cameraAutoUpdate=!1,e}get presentedScene(){return this._presentedScene}async supportsPresentation(){try{return $A(),await navigator.xr.isSessionSupported("immersive-ar")}catch(e){return console.warn("Request to present in WebXR denied:"),console.warn(e),console.warn("Falling back to next ar-mode"),!1}}async present(e,t=!1){this.isPresenting&&console.warn("Cannot present while a model is already presenting");let n=new Promise((l,h)=>{requestAnimationFrame(()=>l())});e.setHotspotsVisibility(!1),e.queueRender(),await n,this._presentedScene=e,this.overlay=e.element.shadowRoot.querySelector("div.default"),this.overlay!=null&&this.overlay.addEventListener("beforexrselect",this.onBeforeXRSelect),t===!0&&(this.xrLight=new O1(this.threeRenderer),this.xrLight.addEventListener("estimationstart",()=>{if(!this.isPresenting||this.xrLight==null)return;const l=this.presentedScene;l.add(this.xrLight),l.environment=this.xrLight.environment}));const i=await this.resolveARSession();i.addEventListener("end",()=>{this.postSessionCleanup()},{once:!0});const s=e.element.shadowRoot.querySelector(".slot.exit-webxr-ar-button");s.classList.add("enabled"),s.addEventListener("click",this.onExitWebXRButtonContainerClick),this.exitWebXRButtonContainer=s;const a=await i.requestReferenceSpace("viewer");this.xrMode=i.interactionMode,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 o=SR*Math.PI/180,c=this.placeOnWall===!0?void 0:new XRRay(new DOMPoint(0,0,0),{x:0,y:-Math.sin(o),z:-Math.cos(o)});i.requestHitTestSource({space:a,offsetRay:c}).then(l=>{this.initialHitSource=l}),this.xrMode!==Yt.SCREEN_SPACE&&(this.setupXRControllers(),this.xDamper.setDecayTime(Ls),this.yDamper.setDecayTime(Ls),this.zDamper.setDecayTime(Ls),this.yawDamper.setDecayTime(Ls),this.pitchDamper.setDecayTime(Ls),this.rollDamper.setDecayTime(Ls),this.scaleDamper.setDecayTime(Ls)),this.currentSession=i,this.placementBox=new Q1(e,this.placeOnWall?"back":"bottom"),this.placementBox&&this.placementBox.setScreenSpaceMode(this.xrMode===Yt.SCREEN_SPACE),this.placementComplete=!1,this.xrMode!==Yt.SCREEN_SPACE&&(this.menuPanel=new Qi,e.add(this.menuPanel),this.menuPanel.updatePosition(e.getCamera(),this.placementBox)),this.lastTick=performance.now(),this.dispatchEvent({type:"status",status:Gi.SESSION_STARTED})}setupXRControllerLine(e){if(!e.userData.line){const t=new Uo(cm);t.name="line",t.scale.z=am,e.userData.turning=!1,e.userData.line=t,e.add(t)}}setupController(e){this.setupXRControllerLine(e),e.addEventListener("selectstart",this.onControllerSelectStart),e.addEventListener("selectend",this.onControllerSelectEnd)}setupXRControllers(){this.xrController1=this.threeRenderer.xr.getController(0),this.xrController2=this.threeRenderer.xr.getController(1),this.setupController(this.xrController1),this.setupController(this.xrController2),this.scaleLine.name="scale line",this.scaleLine.visible=!1,this.xrController1.add(this.scaleLine);const e=this.presentedScene;e.add(this.xrController1),e.add(this.xrController2)}hover(e){if(this.xrMode===Yt.SCREEN_SPACE||this.selectedXRController==e)return!1;const t=this.presentedScene,n=this.placementBox.controllerIntersection(t,e);return e.userData.line.scale.z=n==null?am:n.distance,n!=null}controllerSeparation(){return this.xrController1.position.distanceTo(this.xrController2.position)}async stopPresenting(){if(!this.isPresenting)return;const e=new Promise(t=>{this.resolveCleanup=t});try{await this.currentSession.end(),await e}catch(t){console.warn("Error while trying to end WebXR AR session"),console.warn(t),this.postSessionCleanup()}}get isPresenting(){return this.presentedScene!=null}get target(){return this.oldTarget}updateTarget(){const e=this.presentedScene;if(e!=null){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)}}cleanupXRController(e){e.userData.turning=!1,e.userData.line.visible=!0,e.removeEventListener("selectstart",this.onControllerSelectStart),e.removeEventListener("selectend",this.onControllerSelectEnd),e.removeFromParent()}postSessionCleanup(){const e=this.currentSession;e!=null&&(e.removeEventListener("selectstart",this.onSelectStart),e.removeEventListener("selectend",this.onSelectEnd),this.currentSession=null);const t=this.presentedScene;if(this._presentedScene=null,t!=null){const{element:a}=t;this.xrLight!=null&&(t.remove(this.xrLight),this.xrLight.dispose(),this.xrLight=null),this.menuPanel!=null&&(this.menuPanel.dispose(),this.menuPanel=null),t.add(t.scenePivot),t.scenePivot.quaternion.set(0,0,0,1),t.scenePivot.position.set(0,0,0),t.scenePivot.scale.set(1,1,1),t.setShadowOffset(0);const o=this.turntableRotation;o!=null&&(t.yaw=o);const c=this.oldShadowIntensity;c!=null&&t.setShadowIntensity(c),t.setEnvironmentAndSkybox(a[co],a[lo]);const l=this.oldTarget;t.setTarget(l.x,l.y,l.z),t.xrCamera=null,t.element.removeEventListener("load",this.onUpdateScene),t.orientHotspots(0);const{width:h,height:u}=a.getBoundingClientRect();t.setSize(h,u),requestAnimationFrame(()=>{t.element.dispatchEvent(new CustomEvent("camera-change",{detail:{source:Pt.NONE}}))})}this.renderer.height=0;const n=this.exitWebXRButtonContainer;n!=null&&(n.classList.remove("enabled"),n.removeEventListener("click",this.onExitWebXRButtonContainerClick),this.exitWebXRButtonContainer=null);const i=this.transientHitTestSource;i!=null&&(i.cancel(),this.transientHitTestSource=null);const s=this.initialHitSource;s!=null&&(s.cancel(),this.initialHitSource=null),this.placementBox!=null&&(this.placementBox.dispose(),this.placementBox=null),this.xrMode!==Yt.SCREEN_SPACE&&(this.xrController1!=null&&(this.cleanupXRController(this.xrController1),this.xrController1=null),this.xrController2!=null&&(this.cleanupXRController(this.xrController2),this.xrController2=null),this.selectedXRController=null,this.scaleLine.visible=!1),this.isTranslating=!1,this.isRotating=!1,this.isTwoHandInteraction=!1,this.lastTick=null,this.turntableRotation=null,this.oldShadowIntensity=null,this.frame=null,this.inputSource=null,this.overlay!=null&&(this.overlay.removeEventListener("beforexrselect",this.onBeforeXRSelect),this.overlay=null),this.worldSpaceInitialPlacementDone=!1,this.resolveCleanup!=null&&this.resolveCleanup(),this.dispatchEvent({type:"status",status:Gi.NOT_PRESENTING})}updateView(e){const t=this.presentedScene,n=this.threeRenderer.xr;n.updateCamera(UR),t.xrCamera=n.getCamera();const{elements:i}=t.getCamera().matrixWorld;if(t.orientHotspots(Math.atan2(i[1],i[5])),this.initialized||(this.placeInitially(),this.initialized=!0),e.requestViewportScale&&e.recommendedViewportScale){const a=e.recommendedViewportScale;e.requestViewportScale(Math.max(a,MR))}const s=n.getBaseLayer();if(s!=null){const a=s instanceof XRWebGLLayer?s.getViewport(e):n.getBinding().getViewSubImage(s,e).viewport;this.threeRenderer.setViewport(a.x,a.y,a.width,a.height)}}placeInitially(){const e=this.presentedScene,{scenePivot:t,element:n}=e,{position:i}=t,s=e.getCamera(),{width:a,height:o}=this.overlay.getBoundingClientRect();e.setSize(a,o),s.projectionMatrixInverse.copy(s.projectionMatrix).invert();const{theta:c}=n.getCameraOrbit(),l=s.getWorldDirection(qa);if(e.yaw=Math.atan2(-l.x,-l.z)-c,this.goalYaw=e.yaw,this.xrMode===Yt.WORLD_SPACE&&!this.worldSpaceInitialPlacementDone){const{position:h,scale:u}=this.calculateWorldSpaceOptimalPlacement(e,s);this.goalPosition.copy(h),this.goalScale=u,this.initialModelScale=u,i.copy(h),t.scale.set(u,u,u),this.worldSpaceInitialPlacementDone=!0,this.calculateWorldSpaceScaleLimits(e),this.enableWorldSpaceUserInteraction()}else if(this.xrMode===Yt.SCREEN_SPACE){const h=Math.max(1,2*e.boundingSphere.radius);i.copy(s.position).add(l.multiplyScalar(h)),this.updateTarget();const u=e.getTarget();i.add(u).sub(this.oldTarget),this.goalPosition.copy(i)}if(e.setHotspotsVisibility(!0),this.xrMode===Yt.SCREEN_SPACE){const{session:h}=this.frame;h.addEventListener("selectstart",this.onSelectStart),h.addEventListener("selectend",this.onSelectEnd),h.requestHitTestSourceForTransientInput({profile:"generic-touchscreen"}).then(u=>{this.transientHitTestSource=u})}}getTouchLocation(){const{axes:e}=this.inputSource.gamepad;let t=this.placementBox.getExpandedHit(this.presentedScene,e[0],e[1]);return t!=null&&(qa.copy(t).sub(this.presentedScene.getCamera().position),qa.length()>IR)?null:t}getHitPoint(e){const t=this.threeRenderer.xr.getReferenceSpace(),n=e.getPose(t);if(n==null)return null;const i=FR.fromArray(n.transform.matrix);return this.placeOnWall===!0&&(this.goalYaw=Math.atan2(i.elements[4],i.elements[6])),i.elements[5]>.75!==this.placeOnWall?NR.setFromMatrixPosition(i):null}moveToFloor(e){if(this.xrMode===Yt.WORLD_SPACE&&!this.worldSpaceInitialPlacementDone){this.placementBox.show=!1,this.dispatchEvent({type:"status",status:Gi.OBJECT_PLACED});return}const t=this.initialHitSource;if(t==null)return;const n=e.getHitTestResults(t);if(n.length==0)return;const i=n[0],s=this.getHitPoint(i);s!=null&&(this.placementBox.show=!0,this.isTranslating||(this.placeOnWall?this.goalPosition.copy(s):this.goalPosition.y=s.y),t.cancel(),this.initialHitSource=null,this.dispatchEvent({type:"status",status:Gi.OBJECT_PLACED}))}fingerPolar(e){const t=e[0].inputSource.gamepad.axes,n=e[1].inputSource.gamepad.axes,i=n[0]-t[0],s=n[1]-t[1],a=Math.atan2(s,i);let o=this.lastAngle-a;return o>Math.PI?o-=2*Math.PI:o<-Math.PI&&(o+=2*Math.PI),{separation:Math.sqrt(i*i+s*s),deltaYaw:o,angle:a}}setScale(e){let t=e/this.firstRatio;t=Math.abs(t-1)<CR?1:t,this.isWorldSpaceReady()&&(t=Math.max(this.minScale,Math.min(this.maxScale,t))),this.goalScale=t}processInput(e){const t=this.transientHitTestSource;if(t==null)return;const n=e.getHitTestResultsForTransientInput(t),i=this.presentedScene,s=i.scenePivot.scale.x;if(n.length===2){if(!this.wasTwoFingering){const{separation:l,angle:h}=this.fingerPolar(n);this.firstRatio=l/s,this.lastAngle=h,this.wasTwoFingering=!0,this.isTwoHandInteraction=!0;return}const{separation:a,deltaYaw:o,angle:c}=this.fingerPolar(n);this.goalYaw+=o,this.lastAngle=c,i.canScale&&this.setScale(a),this.isTwoHandInteraction=!0;return}else this.wasTwoFingering&&(this.wasTwoFingering=!1,this.isTwoHandInteraction=!1,this.firstRatio=0);if(!(!this.isTranslating&&!this.isTwoHandInteraction&&!this.isRotating))if(this.isRotating){const a=this.inputSource.gamepad.axes[0]*rm;this.goalYaw+=a-this.lastAngle,this.lastAngle=a}else this.isTranslating&&n.forEach(a=>{if(a.inputSource!==this.inputSource)return;let o=null;if(a.results.length>0&&(o=this.getHitPoint(a.results[0])),o==null&&(o=this.getTouchLocation()),o!=null){if(this.goalPosition.sub(this.lastDragPosition),this.isWorldSpaceReady())console.log("[processInput] Setting goalPosition.y to hit.y:",o.y),this.goalPosition.add(o);else if(this.placeOnWall===!1){const c=o.y-this.lastDragPosition.y;if(c<0){this.placementBox.offsetHeight=c/s,this.presentedScene.setShadowOffset(c);const l=qa.copy(i.getCamera().position),h=-c/(l.y-o.y);l.multiplyScalar(h),o.multiplyScalar(1-h).add(l)}this.goalPosition.add(o)}else this.goalPosition.add(o);this.lastDragPosition.copy(o)}})}applyXRControllerRotation(e,t){if(!e.userData.turning)return;const n=(e.position.x-e.userData.initialX)*TR;this.deltaRotation.setFromAxisAngle(wR,n),t.quaternion.multiplyQuaternions(this.deltaRotation,t.quaternion)}handleScalingInXR(e,t){if(this.xrMode===Yt.WORLD_SPACE&&!this.worldSpaceInitialPlacementDone)return;if(this.xrController1&&this.xrController2&&this.isTwoHandInteraction){const i=this.controllerSeparation();this.setScale(i),this.scaleLine.scale.z=-i,this.scaleLine.lookAt(this.xrController2.position)}const n=e.scenePivot.scale.x;if(this.goalScale!==n){const i=this.scaleDamper.update(n,this.goalScale,t,1);e.scenePivot.scale.set(i,i,i)}}updatePivotPosition(e,t){const{scenePivot:n}=e,i=this.placementBox,s=e.boundingSphere.radius,a=this.goalPosition,o=n.position;let c=Pt.NONE;if(!a.equals(o)){c=Pt.USER_INTERACTION;let{x:l,y:h,z:u}=o;if(l=this.xDamper.update(l,a.x,t,s),h=this.yDamper.update(h,a.y,t,s),u=this.zDamper.update(u,a.z,t,s),o.set(l,h,u),this.xrMode===Yt.SCREEN_SPACE&&!this.isTranslating){const d=a.y-h;this.placementComplete&&this.placeOnWall===!1?(i.offsetHeight=d/e.scenePivot.scale.x,e.setShadowOffset(d)):d===0&&(this.placementComplete=!0,i.show=!1,e.setShadowIntensity(zc))}this.xrMode!==Yt.SCREEN_SPACE&&a.equals(o)&&e.setShadowIntensity(zc),this.isWorldSpaceReady()&&e.setShadowIntensity(zc)}if(this.xrMode===Yt.WORLD_SPACE&&!this.worldSpaceInitialPlacementDone&&this.goalScale!==n.scale.x){const l=this.scaleDamper.update(n.scale.x,this.goalScale,t,1);n.scale.set(l,l,l)}return e.updateTarget(t),c}updateYaw(e,t){Lu.setFromAxisAngle(qa.set(0,1,0),this.goalYaw);const n=e.scenePivot.quaternion.angleTo(Lu),i=n-this.yawDamper.update(n,0,t,Math.PI);e.scenePivot.quaternion.rotateTowards(Lu,i)}updateMenuPanel(e,t,n){this.menuPanel&&(this.menuPanel.updateOpacity(n),this.menuPanel.updatePosition(e.getCamera(),t))}applyXRInputToScene(e){const t=this.presentedScene,n=t.scenePivot,i=this.placementBox;if(this.updatePlacementBoxOpacity(i,e),this.updateTwoHandInteractionState(),this.applyXRControllerRotations(n),this.handleScalingInXR(t,e),n.parent!==t){this.updateMenuPanel(t,i,e);return}const s=this.updatePivotPosition(t,e);this.updateYaw(t,e),this.dispatchCameraChangeEvent(t,s),this.updateMenuPanel(t,i,e)}updatePlacementBoxOpacity(e,t){const n=this.presentedScene.getCamera();e.update(t,n.position);const i=this.hover(this.xrController1),s=this.hover(this.xrController2),a=(i||s)&&!this.isTwoHandInteraction;e.setInteractionState(this.isTranslating||this.isRotating,a)}updateTwoHandInteractionState(){var e,t;const n=((e=this.xrController1)===null||e===void 0?void 0:e.userData.isSelected)&&((t=this.xrController2)===null||t===void 0?void 0:t.userData.isSelected);this.isTwoHandInteraction=!!n}applyXRControllerRotations(e){this.isTwoHandInteraction||(this.xrController1&&this.applyXRControllerRotation(this.xrController1,e),this.xrController2&&this.applyXRControllerRotation(this.xrController2,e))}dispatchCameraChangeEvent(e,t){e.element.dispatchEvent(new CustomEvent("camera-change",{detail:{source:t}}))}updateXRControllerHover(){const e=this.hover(this.xrController1),t=this.hover(this.xrController2),n=(e||t)&&!this.isTwoHandInteraction;this.placementBox&&(this.placementBox.setInteractionState(this.isTranslating||this.isRotating,n),this.placementBox.show=n)}enableWorldSpaceUserInteraction(){this.placementBox&&(this.placementBox.show=!0),this.presentedScene&&this.presentedScene.setShadowIntensity(zc)}handleFirstView(e,t){(this.xrMode!==Yt.WORLD_SPACE||!this.worldSpaceInitialPlacementDone)&&this.moveToFloor(e),this.processInput(e);const n=t-this.lastTick;this.applyXRInputToScene(n),this.renderer.preRender(this.presentedScene,t,n),this.lastTick=t,this.presentedScene.renderShadow(this.threeRenderer)}onWebXRFrame(e,t){this.xrMode!==Yt.SCREEN_SPACE&&this.updateXRControllerHover(),this.frame=t,++this.frames;const n=this.threeRenderer.xr.getReferenceSpace(),i=t.getViewerPose(n);i==null&&this.tracking===!0&&this.frames>yR&&(this.tracking=!1,this.dispatchEvent({type:"tracking",status:cf.NOT_TRACKING}));const s=this.presentedScene;if(i==null||s==null||!s.element.loaded){this.threeRenderer.clear();return}this.tracking===!1&&(this.tracking=!0,this.dispatchEvent({type:"tracking",status:cf.TRACKING}));let a=!0;for(const o of i.views)this.updateView(o),a&&(this.handleFirstView(t,e),a=!1),this.threeRenderer.render(s,s.getCamera())}calculateWorldSpaceOptimalPlacement(e,t){const n=e.boundingBox,i={x:(n.max.x-n.min.x)/2,y:(n.max.y-n.min.y)/2,z:(n.max.z-n.min.z)/2},s=DR,a=Math.max(RR+s,2*Math.max(i.x,i.z)+s),o=BR*Math.PI/180,c=new R(0,-a*Math.sin(o),-a*Math.cos(o)),l=t.matrixWorld,h=c.clone().applyMatrix4(l),u=Math.max(i.x,i.z)+s,d=i.y,f=a*om,m=a*om/Math.max(d,Bu),A=f/Math.max(u,Bu),g=Math.min(m,A);return{position:h.clone().sub(new R(0,g*i.y,0)),scale:g}}calculateWorldSpaceScaleLimits(e){const t=e.size,n=Math.max(t.x,t.y,t.z),i=Math.max(Math.min(t.x,t.y,t.z),Du),s=Bu/Math.max(n,Du),a=LR/Math.max(i,Du);this.minScale=Math.min(s,a,this.goalScale),this.maxScale=Math.max(s,a,this.goalScale)}}/* @license
4822 * Copyright 2020 Google LLC. All Rights Reserved.
4823 * Licensed under the Apache License, Version 2.0 (the 'License');
4824 * you may not use this file except in compliance with the License.
4825 * You may obtain a copy of the License at
4826 *
4827 *     http://www.apache.org/licenses/LICENSE-2.0
4828 *
4829 * Unless required by applicable law or agreed to in writing, software
4830 * distributed under the License is distributed on an 'AS IS' BASIS,
4831 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4832 * See the License for the specific language governing permissions and
4833 * limitations under the License.
4834 */const lm=Symbol("prepared"),Hl=Symbol("prepare"),hi=Symbol("preparedGLTF"),zl=Symbol("clone");class kR{static prepare(e){if(e.scene==null)throw new Error("Model does not have a scene");if(e[lm])return e;const t=this[Hl](e);return t[lm]=!0,t}static[Hl](e){const{scene:t}=e,n=[t];return Object.assign(Object.assign({},e),{scene:t,scenes:n})}get parser(){return this[hi].parser}get animations(){return this[hi].animations}get scene(){return this[hi].scene}get scenes(){return this[hi].scenes}get cameras(){return this[hi].cameras}get asset(){return this[hi].asset}get userData(){return this[hi].userData}constructor(e){this[hi]=e}clone(){const e=this.constructor,t=this[zl]();return new e(t)}dispose(){this.scenes.forEach(e=>{e.traverse(t=>{const n=t;if(!n.material)return;(Array.isArray(n.material)?n.material:[n.material]).forEach(s=>{for(const a in s){const o=s[a];if(o instanceof Rt){const c=o.source.data;c.close!=null&&c.close(),o.dispose()}}s.dispose()}),n.geometry.dispose()})})}[zl](){const e=this[hi],t=Hb(this.scene);QR(t,this.scene);const n=[t],i=e.userData?Object.assign({},e.userData):{};return Object.assign(Object.assign({},e),{scene:t,scenes:n,userData:i})}}const QR=(r,e)=>{Yx(r,e,(t,n)=>{n.userData.variantMaterials!==void 0&&(t.userData.variantMaterials=new Map(n.userData.variantMaterials)),n.userData.variantData!==void 0&&(t.userData.variantData=n.userData.variantData),n.userData.originalMaterial!==void 0&&(t.userData.originalMaterial=n.userData.originalMaterial)})},Yx=(r,e,t)=>{t(r,e);for(let n=0;n<r.children.length;n++)Yx(r.children[n],e.children[n],t)},hm=Symbol("threeGLTF"),um=Symbol("gltf"),dm=Symbol("gltfElementMap"),fm=Symbol("threeObjectMap"),pm=Symbol("parallelTraverseThreeScene"),Am=Symbol("correlateOriginalThreeGLTF"),gm=Symbol("correlateCloneThreeGLTF");class zo{static from(e,t){return t!=null?this[gm](e,t):this[Am](e)}static[Am](e){const t=e.parser.json,n=e.parser.associations,i=new Map,s={name:"Default"},a={index:-1};for(const o of n.keys())o instanceof ei&&n.get(o)==null&&(a.index<0&&(t.materials==null&&(t.materials=[]),a.index=t.materials.length,t.materials.push(s)),o.name=s.name,n.set(o,{materials:a.index}));for(const[o,c]of n){c&&(o.userData=o.userData||{},o.userData.associations=c);for(const l in c)if(l!=null&&l!=="primitives"){const h=l,d=(t[h]||[])[c[h]];if(d==null)continue;let f=i.get(d);f==null&&(f=new Set,i.set(d,f)),f.add(o)}}return new zo(e,t,n,i)}static[gm](e,t){const n=t.threeGLTF,i=t.gltf,s=JSON.parse(JSON.stringify(i)),a=new Map,o=new Map;for(let c=0;c<n.scenes.length;c++)this[pm](n.scenes[c],e.scenes[c],(l,h)=>{const u=t.threeObjectMap.get(l);if(u!=null){for(const d in u)if(d!=null&&d!=="primitives"){const f=d,p=u[f],m=s[f][p],A=a.get(h)||{};A[f]=p,a.set(h,A);const g=o.get(m)||new Set;g.add(h),o.set(m,g)}}});return new zo(e,s,a,o)}static[pm](e,t,n){const i=(s,a)=>{if(n(s,a),s.isObject3D){const o=s,c=a;if(o.material)if(Array.isArray(o.material))for(let l=0;l<o.material.length;++l)n(o.material[l],c.material[l]);else n(o.material,c.material);for(let l=0;l<s.children.length;++l)i(s.children[l],a.children[l])}};i(e,t)}get threeGLTF(){return this[hm]}get gltf(){return this[um]}get gltfElementMap(){return this[dm]}get threeObjectMap(){return this[fm]}constructor(e,t,n,i){this[hm]=e,this[um]=t,this[dm]=i,this[fm]=n}}/* @license
4835 * Copyright 2020 Google LLC. All Rights Reserved.
4836 * Licensed under the Apache License, Version 2.0 (the 'License');
4837 * you may not use this file except in compliance with the License.
4838 * You may obtain a copy of the License at
4839 *
4840 *     http://www.apache.org/licenses/LICENSE-2.0
4841 *
4842 * Unless required by applicable law or agreed to in writing, softw
4842are
4843 * distributed under the License is distributed on an 'AS IS' BASIS,
4844 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4845 * See the License for the specific language governing permissions and
4846 * limitations under the License.
4847 */const ja=Symbol("correlatedSceneGraph");class GR extends kR{static[Hl](e){const t=super[Hl](e);t[ja]==null&&(t[ja]=zo.from(t));const{scene:n}=t,i=new Vn(void 0,1/0);return n.traverse(s=>{s.renderOrder=1e3,s.frustumCulled=!1,s.name||(s.name=s.uuid);const a=s;if(a.material){const{geometry:o}=a;a.castShadow=!0,a.isSkinnedMesh&&(o.boundingSphere=i,o.boundingBox=null);const c=a.material;if(c.isMeshBasicMaterial===!0&&(c.toneMapped=!1),c.shadowSide=ti,c.aoMap){const{gltf:l,threeObjectMap:h}=t[ja],u=h.get(c);if(l.materials!=null&&u!=null&&u.materials!=null){const d=l.materials[u.materials];d.occlusionTexture&&d.occlusionTexture.texCoord===0&&o.attributes.uv!=null&&o.setAttribute("uv2",o.attributes.uv)}}}}),t}get correlatedSceneGraph(){return this[hi][ja]}[zl](){const e=super[zl](),t=new Map;return e.scene.traverse(n=>{const i=n;if(i.material){const a=i.material;if(a!=null){if(t.has(a.uuid)){i.material=t.get(a.uuid);return}i.material=a.clone(),t.set(a.uuid,i.material)}}const s=n;s.target!==void 0&&s.add(s.target)}),e[ja]=zo.from(e,this.correlatedSceneGraph),e}}const Jx=(r,e,t)=>{let n;switch(r){case Le:n=new Uint8ClampedArray(e*t*4);break;case yt:n=new Uint16Array(e*t*4);break;case ii:n=new Uint32Array(e*t*4);break;case Rf:n=new Int8Array(e*t*4);break;case Bf:n=new Int16Array(e*t*4);break;case Zl:n=new Int32Array(e*t*4);break;case Nt:n=new Float32Array(e*t*4);break;default:throw new Error("Unsupported data type")}return n};let Vc;const HR=(r,e,t,n)=>{if(Vc!==void 0)return Vc;const i=new Sn(1,1,n);e.setRenderTarget(i);const s=new at(new zn,new pn({color:16777215}));e.render(s,t),e.setRenderTarget(null);const a=Jx(r,i.width,i.height);return e.readRenderTargetPixels(i,0,0,i.width,i.height,a),i.dispose(),s.geometry.dispose(),s.material.dispose(),Vc=a[0]!==0,Vc};class tp{constructor(e){Ot(this,"_renderer");Ot(this,"_rendererIsDisposable",!1);Ot(this,"_material");Ot(this,"_scene");Ot(this,"_camera");Ot(this,"_quad");Ot(this,"_renderTarget");Ot(this,"_width");Ot(this,"_height");Ot(this,"_type");Ot(this,"_colorSpace");Ot(this,"_supportsReadPixels",!0);Ot(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)});var n,i,s,a,o,c,l,h,u,d,f,p,m,A,g,b;this._width=e.width,this._height=e.height,this._type=e.type,this._colorSpace
vendor: 5,187 bytes, line 4847
4847=e.colorSpace;const t={format:Tt,depthBuffer:!1,stencilBuffer:!1,type:this._type,colorSpace:this._colorSpace,anisotropy:((n=e.renderTargetOptions)==null?void 0:n.anisotropy)!==void 0?(i=e.renderTargetOptions)==null?void 0:i.anisotropy:1,generateMipmaps:((s=e.renderTargetOptions)==null?void 0:s.generateMipmaps)!==void 0?(a=e.renderTargetOptions)==null?void 0:a.generateMipmaps:!1,magFilter:((o=e.renderTargetOptions)==null?void 0:o.magFilter)!==void 0?(c=e.renderTargetOptions)==null?void 0:c.magFilter:qe,minFilter:((l=e.renderTargetOptions)==null?void 0:l.minFilter)!==void 0?(h=e.renderTargetOptions)==null?void 0:h.minFilter:qe,samples:((u=e.renderTargetOptions)==null?void 0:u.samples)!==void 0?(d=e.renderTargetOptions)==null?void 0:d.samples:void 0,wrapS:((f=e.renderTargetOptions)==null?void 0:f.wrapS)!==void 0?(p=e.renderTargetOptions)==null?void 0:p.wrapS:Dt,wrapT:((m=e.renderTargetOptions)==null?void 0:m.wrapT)!==void 0?(A=e.renderTargetOptions)==null?void 0:A.wrapT:Dt};if(this._material=e.material,e.renderer?this._renderer=e.renderer:(this._renderer=tp.instantiateRenderer(),this._rendererIsDisposable=!0),this._scene=new xs,this._camera=new cr,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(),!HR(this._type,this._renderer,this._camera,t)){let x;switch(this._type){case yt:x=this._renderer.extensions.has("EXT_color_buffer_float")?Nt:void 0;break}x!==void 0?(console.warn(`This browser does not support reading pixels from ${this._type} RenderTargets, switching to ${Nt}`),this._type=x):(this._supportsReadPixels=!1,console.warn("This browser dos not support toArray or toDataTexture, calls to those methods will result in an error thrown"))}this._quad=new at(new zn,this._material),this._quad.geometry.computeBoundingBox(),this._scene.add(this._quad),this._renderTarget=new Sn(this.width,this.height,t),this._renderTarget.texture.mapping=((g=e.renderTargetOptions)==null?void 0:g.mapping)!==void 0?(b=e.renderTargetOptions)==null?void 0:b.mapping:ra}static instantiateRenderer(){const e=new Jf;return e.setSize(128,128),e}toArray(){if(!this._supportsReadPixels)throw new Error("Can't read pixels in this browser");const e=Jx(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 Ea(this.toArray(),this.width,this.height,Tt,this._type,(e==null?void 0:e.mapping)||ra,(e==null?void 0:e.wrapS)||Dt,(e==null?void 0:e.wrapT)||Dt,(e==null?void 0:e.magFilter)||qe,(e==null?void 0:e.minFilter)||qe,(e==null?void 0:e.anisotropy)||1,Ct);return t.generateMipmaps=(e==null?void 0:e.generateMipmaps)!==void 0?e==null?void 0:e.generateMipmaps:!1,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 mn&&Object.values(this.material.uniforms).forEach(t=>{t.value instanceof Rt&&t.value.dispose()}),Object.values(this.material).forEach(t=>{t instanceof Rt&&t.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}}class Zx extends Error{}class eE extends Error{}const Xa=(r,e,t)=>{const n=new RegExp(`${e}="([^"]*)"`,"i").exec(r);if(n)return n[1];const i=new RegExp(`<${e}[^>]*>([\\s\\S]*?)</${e}>`,"i").exec(r);if(i){const s=i[1].match(/<rdf:li>([^<]*)<\/rdf:li>/g);return s&&s.length===3?s.map(a=>a.replace(/<\/?rdf:li>/g,"")):i[1].trim()}if(t!==void 0)return t;throw new Error(`Can't find ${e} in gainmap metadata`)},zR=r=>{let e;typeof TextDecoder<"u"?e=new TextDecoder().decode(r):e=r.toString();let t=e.indexOf("<x:xmpmeta");for(;t!==-1;){const n=e.indexOf("x:xmpmeta>",t),i=e.slice(t,n+10);try{const s=Xa(i,"hdrgm:GainMapMin","0"),a=Xa(i,"hdrgm:GainMapMax"),o=Xa(i,"hdrgm:Gamma","1"),c=Xa(i,"hdrgm:OffsetSDR","0.015625"),l=Xa(i,"hdrgm:OffsetHDR","0.015625"),h=/hdrgm:HDRCapacityMin="([^"]*)"/.exec(i),u=h?h[1]:"0",d=/hdrgm:HDRCapacityMax="([^"]*)"/.exec(i);if(!d)throw new Error("Incomplete gainmap metadata");const f=d[1];return{gainMapMin:Array.isArray(s)?s.map(p=>parseFloat(p)):[parseFloat(s),parseFloat(s),parseFloat(s)],gainMapMax:Array.isArray(a)?a.map(p=>parseFloat(p)):[parseFloat(a),parseFloat(a),parseFloat(a)],gamma:Array.isArray(o)?o.map(p=>parseFloat(p)):[parseFloat(o),parseFloat(o),parseFloat(o)],offsetSdr:Array.isArray(c)?c.map(p=>parseFloat(p)):[parseFloat(c),parseFloat(c),parseFloat(c)],offsetHdr:Array.isArray(l)?l.map(p=>parseFloat(p)):[parseFloat(l),parseFloat(l),parseFloat(l)],hdrCapacityMin:parseFloat(u),hdrCapacityMax:p
vendor: 4,549 bytes, lines 4847-4852
4847arseFloat(f)}}catch{}t=e.indexOf("<x:xmpmeta",n)}};class VR{constructor(e){Ot(this,"options");this.options={debug:e&&e.debug!==void 0?e.debug:!1,extractFII:e&&e.extractFII!==void 0?e.extractFII:!0,extractNonFII:e&&e.extractNonFII!==void 0?e.extractNonFII:!0}}extract(e){return new Promise((t,n)=>{const i=this.options.debug,s=new DataView(e.buffer);if(s.getUint16(0)!==65496){n(new Error("Not a valid jpeg"));return}const a=s.byteLength;let o=2,c=0,l;for(;o<a;){if(++c>250){n(new Error(`Found no marker after ${c} loops 😵`));return}if(s.getUint8(o)!==255){n(new Error(`Not a valid marker at offset 0x${o.toString(16)}, found: 0x${s.getUint8(o).toString(16)}`));return}if(l=s.getUint8(o+1),i&&console.log(`Marker: ${l.toString(16)}`),l===226){i&&console.log("Found APP2 marker (0xffe2)");const h=o+4;if(s.getUint32(h)===1297106432){const u=h+4;let d;if(s.getUint16(u)===18761)d=!1;else if(s.getUint16(u)===19789)d=!0;else{n(new Error("No valid endianness marker found in TIFF header"));return}if(s.getUint16(u+2,!d)!==42){n(new Error("Not valid TIFF data! (no 0x002A marker)"));return}const f=s.getUint32(u+4,!d);if(f<8){n(new Error("Not valid TIFF data! (First offset less than 8)"));return}const p=u+f,m=s.getUint16(p,!d),A=p+2;let g=0;for(let v=A;v<A+12*m;v+=12)s.getUint16(v,!d)===45057&&(g=s.getUint32(v+8,!d));const x=p+2+m*12+4,_=[];for(let v=x;v<x+g*16;v+=16){const C={MPType:s.getUint32(v,!d),size:s.getUint32(v+4,!d),dataOffset:s.getUint32(v+8,!d),dependantImages:s.getUint32(v+12,!d),start:-1,end:-1,isFII:!1};C.dataOffset?(C.start=u+C.dataOffset,C.isFII=!1):(C.start=0,C.isFII=!0),C.end=C.start+C.size,_.push(C)}if(this.options.extractNonFII&&_.length){const v=new Blob([s]),C=[];for(const I of _){if(I.isFII&&!this.options.extractFII)continue;const E=v.slice(I.start,I.end+1,"image/jpeg");C.push(E)}t(C)}}}o+=2+s.getUint16(o+2)}})}}const WR=async r=>{const e=zR(r);if(!e)throw new eE("Gain map XMP metadata not found");const n=await new VR({extractFII:!0,extractNonFII:!0}).extract(r);if(n.length!==2)throw new Zx("Gain map recovery image not found");return{sdr:new Uint8Array(await n[0].arrayBuffer()),gainMap:new Uint8Array(await n[1].arrayBuffer()),metadata:e}},mm=r=>new Promise((e,t)=>{const n=document.createElement("img");n.onload=()=>{e(n)},n.onerror=i=>{t(i)},n.src=URL.createObjectURL(r)});class qR extends _i{constructor(t,n){super(n);Ot(this,"_renderer");Ot(this,"_renderTargetOptions");Ot(this,"_internalLoadingManager");Ot(this,"_config");this._config=t,t.renderer&&(this._renderer=t.renderer),this._internalLoadingManager=new Ib}setRenderer(t){return this._renderer=t,this}setRenderTargetOptions(t){return this._renderTargetOptions=t,this}prepareQuadRenderer(){this._renderer||console.warn("WARNING: A Renderer was not passed to this Loader constructor or in setRenderer, the result of this Loader will need to be converted to a Data Texture with toDataTexture() before you can use it in your renderer.");const t=this._config.createMaterial({gainMapMax:[1,1,1],gainMapMin:[0,0,0],gamma:[1,1,1],offsetHdr:[1,1,1],offsetSdr:[1,1,1],hdrCapacityMax:1,hdrCapacityMin:0,maxDisplayBoost:1,gainMap:new Rt,sdr:new Rt});return this._config.createQuadRenderer({width:16,height:16,type:yt,colorSpace:Ct,material:t,renderer:this._renderer,renderTargetOptions:this._renderTargetOptions})}async processImages(t,n,i){const s=n?new Blob([n],{type:"image/jpeg"}):void 0,a=new Blob([t],{type:"image/jpeg"});let o,c,l=!1;if(typeof createImageBitmap>"u"){const h=await Promise.all([s?mm(s):Promise.resolve(void 0),mm(a)]);c=h[0],o=h[1],l=i==="flipY"}else{const h=await Promise.all([s?createImageBitmap(s,{imageOrientation:i||"flipY"}):Promise.resolve(void 0),createImageBitmap(a,{imageOrientation:i||"flipY"})]);c=h[0],o=h[1]}return{sdrImage:o,gainMapImage:c,needsFlip:l}}createTextures(t,n,i){const s=new Rt(n||new ImageData(2,2),ra,Dt,Dt,qe,Tp,Tt,Le,1,Ct);s.flipY=i,s.needsUpdate=!0;const a=new Rt(t,ra,Dt,Dt,qe,Tp,Tt,Le,1,mt);return a.flipY=i,a.needsUpdate=!0,{gainMap:s,sdr:a}}updateQuadRenderer(t,n,i,s,a){t.width=n.width,t.height=n.height,t.material.gainMap=i,t.material.sdr=s,t.material.gainMapMin=a.gainMapMin,t.material.gainMapMax=a.gainMapMax,t.material.offsetHdr=a.offsetHdr,t.material.offsetSdr=a.offsetSdr,t.material.gamma=a.gamma,t.material.hdrCapacityMin=a.hdrCapacityMin,t.material.hdrCapacityMax=a.hdrCapacityMax,t.material.maxDisplayBoost=Math.pow(2,a.hdrCapacityMax),t.material.needsUpdate=!0}}const jR=`
4848varying vec2 vUv;
4849
4850void main() {
4851  vUv = uv;
4852  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0
4852);
4853}
4854`,XR=`
4855// min half float value
4856#define HALF_FLOAT_MIN vec3( -65504, -65504, -65504 )
4857// max half float value
4858#define HALF_FLOAT_MAX vec3( 65504, 65504, 65504 )
4859
4860uniform sampler2D sdr;
4861uniform sampler2D gainMap;
4862uniform vec3 gamma;
4863uniform vec3 offsetHdr;
4864uniform vec3 offsetSdr;
4865uniform vec3 gainMapMin;
4866uniform vec3 gainMapMax;
4867uniform float weightFactor;
4868
4869varying vec2 vUv;
4870
4871void main() {
4872  vec3 rgb = texture2D( sdr, vUv ).rgb;
4873  vec3 recovery = texture2D( gainMap, vUv ).rgb;
4874  vec3 logRecovery = pow( recovery, gamma );
4875  vec3 logBoost = gainMapMin * ( 1.0 - logRecovery ) + gainMapMax * logRecovery;
4876  vec3 hdrColor = (rgb + offsetSdr) * exp2( logBoost * weightFactor ) - offsetHdr;
4877  vec3 clampedHdrColor = max( HALF_FLOAT_MIN, min( HALF_FLOAT_MAX, hdrColor ));
4878  gl_FragColor = vec4( clampedHdrColor , 1.0 );
4879}
4880`;class KR extends mn{constructor({gamma:t,offsetHdr:n,offsetSdr:i,gainMapMin:s,gainMapMax:a,maxDisplayBoost:o,hdrCapacityMin:c,hdrCapacityMax:l,sdr:h,gainMap:u}){super({name:"GainMapDecoderMaterial",vertexShader:jR,fragmentShader:XR,uniforms:{sdr:{value:h},gainMap:{value:u},gamma:{value:new R(1/t[0],1/t[1],1/t[2])},offsetHdr:{value:new R().fromArray(n)},offsetSdr:{value:new R().fromArray(i)},gainMapMin:{value:new R().fromArray(s)},gainMapMax:{value:new R().fromArray(a)},weightFactor:{value:(Math.log2(o)-c)/(l-c)}},blending:Zn,depthTest:!1,depthWrite:!1});Ot(this,"_maxDisplayBoost");Ot(this,"_hdrCapacityMin");Ot(this,"_hdrCapacityMax");this._maxDisplayBoost=o,this._hdrCapacityMin=c,this._hdrCapacityMax=l,this.needsUpdate=!0,this.uniformsNeedUpdate=!0}get sdr(){return this.uniforms.sdr.value}set sdr(t){this.uniforms.sdr.value=t}get gainMap(){return this.uniforms.gainMap.value}set gainMap(t){this.uniforms.gainMap.value=t}get offsetHdr(){return this.uniforms.offsetHdr.value.toArray()}set offsetHdr(t){this.uniforms.offsetHdr.value.fromArray(t)}get offsetSdr(){return this.uniforms.offsetSdr.value.toArray()}set offsetSdr(t){this.uniforms.offsetSdr.value.fromArray(t)}get gainMapMin(){return this.uniforms.gainMapMin.value.toArray()}set gainMapMin(t){this.uniforms.gainMapMin.value.fromArray(t)}get gainMapMax(){return this.uniforms.gainMapMax.value.toArray()}set gainMapMax(t){this.uniforms.gainMapMax.value.fromArray(t)}get gamma(){const t=this.uniforms.gamma.value;return[1/t.x,1/t.y,1/t.z]}set gamma(t){const n=this.uniforms.gamma.value;n.x=1/t[0],n.y=1/t[1],n.z=1/t[2]}get hdrCapacityMin(){return this._hdrCapacityMin}set hdrCapacityMin(t){this._hdrCapacityMin=t,this.calculateWeight()}get hdrCapacityMax(){return this._hdrCapacityMax}set hdrCapacityMax(t){this._hdrCapacityMax=t,this.calculateWeight()}get maxDisplayBoost(){return this._maxDisplayBoost}set maxDisplayBoost(t){this._maxDisplayBoost=Math.max(1,Math.min(65504,t)),this.calculateWeight()}calculateWeight(){const t=(Math.log2(this._maxDisplayBoost)-this._hdrCapacityMin)/(this._hdrCapacityMax-this._hdrCapacityMin);this.uniforms.weightFactor.value=Math.max(0,Math.min(1,t))}}class $R extends qR{constructor(e,t){super({renderer:e,createMaterial:n=>new KR(n),createQuadRenderer:n=>new tp(n)},t)}async render(e,t,n,i){const{sdrImage:s,gainMapImage:a,needsFlip:o}=await this.processImages(n,i,"flipY"),{gainMap:c,sdr:l}=this.createTextures(s,a,o);this.updateQuadRenderer(e,s,c,l,t),e.render()}}class YR extends $R{load(e,t,n,i){const s=this.prepareQuadRenderer(),a=new Wi(this._internalLoadingManager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(this.withCredentials),this.manager.itemStart(e),a.load(e,async o=>{if(typeof o=="string")throw new Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");const c=new Uint8Array(o);let l,h,u;try{const d=await WR(c);l=d.sdr,h=d.gainMap,u=d.metadata}catch(d){if(d instanceof eE||d instanceof Zx)console.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),u={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},l=c;else throw d}try{await this.render(s,u,l.buffer,h==null?void 0:h.buffer)}catch(d){this.manager.itemError(e),typeof i=="function"&&i(d),s.disposeOnDemandRenderer();return}typeof t=="function"&&t(s),this.manager.itemEnd(e),s.disposeOnDemandRenderer()},n,o=>{this.manager.itemError(e),typeof i=="function"&&i(o)}),s}}class JR extends Ty{constructor(e){super(e),this.type=yt}parse(e){const a=function(E,S){switch(E){case 1:throw new Error("THREE.HDRLoader: Read Error: "+(S||""));case 2:throw new Error("THREE.HDRLoader: Write Error: "+(S||""));case 3:throw new Error("THREE.HDRLoader: Bad File Format: "+(S||""));default:case 4:throw new Error("THREE.HDRLoader: Memory Error: "+(S||""))}},u=function(E,S,P){S=S||1024;let L=E.pos,N=-1,O=0,D="",U=String.fromCharCode.apply(null,new Uint16Array(E.subarray(L,L+128)));for(;0>(N=U.indexOf(`
4881`))&&O<S&&L<E.byteLength;)D+=U,O+=U.length,L+=128,U+=String.fromCharCode.apply(null,new Uint16Array(E.subarray(L,L+128)));
vendor: 8,386 bytes, lines 4881-4910
4881return-1<N?(E.pos+=O+N+1,D+U.slice(0,N)):!1},d=function(E){const S=/^#\?(\S+)/,P=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,w=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,L=/^\s*FORMAT=(\S+)\s*$/,N=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,O={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let D,U;for((E.pos>=E.byteLength||!(D=u(E)))&&a(1,"no header found"),(U=D.match(S))||a(3,"bad initial token"),O.valid|=1,O.programtype=U[1],O.string+=D+`
4882`;D=u(E),D!==!1;){if(O.string+=D+`
4883`,D.charAt(0)==="#"){O.comments+=D+`
4884`;continue}if((U=D.match(P))&&(O.gamma=parseFloat(U[1])),(U=D.match(w))&&(O.exposure=parseFloat(U[1])),(U=D.match(L))&&(O.valid|=2,O.format=U[1]),(U=D.match(N))&&(O.valid|=4,O.height=parseInt(U[1],10),O.width=parseInt(U[2],10)),O.valid&2&&O.valid&4)break}return O.valid&2||a(3,"missing format specifier"),O.valid&4||a(3,"missing image size specifier"),O},f=function(E,S,P){const w=S;if(w<8||w>32767||E[0]!==2||E[1]!==2||E[2]&128)return new Uint8Array(E);w!==(E[2]<<8|E[3])&&a(3,"wrong scanline width");const L=new Uint8Array(4*S*P);L.length||a(4,"unable to allocate buffer space");let N=0,O=0;const D=4*w,U=new Uint8Array(4),F=new Uint8Array(D);let $=P;for(;$>0&&O<E.byteLength;){O+4>E.byteLength&&a(1),U[0]=E[O++],U[1]=E[O++],U[2]=E[O++],U[3]=E[O++],(U[0]!=2||U[1]!=2||(U[2]<<8|U[3])!=w)&&a(3,"bad rgbe scanline format");let q=0,te;for(;q<D&&O<E.byteLength;){te=E[O++];const Y=te>128;if(Y&&(te-=128),(te===0||q+te>D)&&a(3,"bad scanline data"),Y){const fe=E[O++];for(let Ge=0;Ge<te;Ge++)F[q++]=fe}else F.set(E.subarray(O,O+te),q),q+=te,O+=te}const Z=w;for(let Y=0;Y<Z;Y++){let fe=0;L[N]=F[Y+fe],fe+=w,L[N+1]=F[Y+fe],fe+=w,L[N+2]=F[Y+fe],fe+=w,L[N+3]=F[Y+fe],N+=4}$--}return L},p=function(E,S,P,w){const L=E[S+3],N=Math.pow(2,L-128)/255;P[w+0]=E[S+0]*N,P[w+1]=E[S+1]*N,P[w+2]=E[S+2]*N,P[w+3]=1},m=function(E,S,P,w){const L=E[S+3],N=Math.pow(2,L-128)/255;P[w+0]=ic.toHalfFloat(Math.min(E[S+0]*N,65504)),P[w+1]=ic.toHalfFloat(Math.min(E[S+1]*N,65504)),P[w+2]=ic.toHalfFloat(Math.min(E[S+2]*N,65504)),P[w+3]=ic.toHalfFloat(1)},A=new Uint8Array(e);A.pos=0;const g=d(A),b=g.width,x=g.height,_=f(A.subarray(A.pos),b,x);let v,C,I;switch(this.type){case Nt:I=_.length/4;const E=new Float32Array(I*4);for(let P=0;P<I;P++)p(_,P*4,E,P*4);v=E,C=Nt;break;case yt:I=_.length/4;const S=new Uint16Array(I*4);for(let P=0;P<I;P++)m(_,P*4,S,P*4);v=S,C=yt;break;default:throw new Error("THREE.HDRLoader: Unsupported type: "+this.type)}return{width:b,height:x,data:v,header:g.string,gamma:g.gamma,exposure:g.exposure,type:C}}setDataType(e){return this.type=e,this}load(e,t,n,i){function s(a,o){switch(a.type){case Nt:case yt:a.colorSpace=Ct,a.minFilter=qe,a.magFilter=qe,a.generateMipmaps=!1,a.flipY=!0;break}t&&t(a,o)}return super.load(e,s,n,i)}}class ZR extends JR{constructor(e){console.warn("RGBELoader has been deprecated. Please use HDRLoader instead."),super(e)}}/* @license
4885 * Copyright 2021 Google LLC. All Rights Reserved.
4886 * Licensed under the Apache License, Version 2.0 (the 'License');
4887 * you may not use this file except in compliance with the License.
4888 * You may obtain a copy of the License at
4889 *
4890 *     http://www.apache.org/licenses/LICENSE-2.0
4891 *
4892 * Unless required by applicable law or agreed to in writing, software
4893 * distributed under the License is distributed on an 'AS IS' BASIS,
4894 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4895 * See the License for the specific language governing permissions and
4896 * limitations under the License.
4897 */const eB={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]}]},tB={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 bm extends xs{constructor(e){super(),this.position.y=-3.5;const t=new ji;t.deleteAttribute("uv");const n=new Ho({metalness:0,side:on}),i=new Ho({metalness:0}),s=e=="legacy"?eB:tB,a=new Rb(16777215,s.topLight.intensity,28,2);a.position.set(...s.topLight.position),this.add(a);const o=new at(t,n);o.position.set(...s.room.position),o.scale.set(...s.room.scale),this.add(o);for(const c of s.boxes){const l=new at(t,i);l.position.set(...c.position),l.rotation.set(0,c.rotation,0),l.scale.set(...c.scale),this.add(l)}for(const c of s.lights){const l=new at(t,this.createAreaLightMaterial(c.intensity));l.position.set(...c.position),l.scale.set(...c.scale),this.add(l)}}createAreaLightMaterial(e){const t=new pn;return t.color.setScalar(e),t}}/* @license
4898 * Copyright 2019 Google LLC. All Rights Reserved.
4899 * Licensed under the Apache License, Version 2.0 (the 'License');
4900 * you may not use this file except in compliance with the License.
4901 * You may obtain a copy of the License at
4902 *
4903 *     http://www.apache.org/licenses/LICENSE-2.0
4904 *
4905 * Unless required by applicable law or agreed to in writing, software
4906 * distributed under the License is distributed on an 'AS IS' BASIS,
4907 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4908 * See the License for the specific language governing permissions and
4909 * limitations under the License.
4910 */const nB=.04,Pr=20,iB=/\.hdr(\.js)?$/,sB=/\.ktx2(\?|#|$)/;class xm{constructor(e){this.threeRenderer=e,this.lottieLoaderUrl="",this._ldrLoader=null,this._imageLoader=null,this._hdrLoader=null,this._lottieLoader=null,this.generatedEnvironmentMap=null,this.generatedEnvironmentMapAlt=null,this.skyboxCache=new Map,this.blurMaterial=null,this.blurScene=null}ldrLoader(e){return this._ldrLoader==null&&(this._ldrLoader=new wb),this._ldrLoader.setWithCredentials(e),this._ldrLoader}imageLoader(e){return this._imageLoader==null&&(this._imageLoader=new YR(this.threeRenderer)),this._imageLoader.setWithCredentials(e),this._imageLoader}hdrLoader(e){return this._hdrLoader==null&&(this._hdrLoader=new ZR,this._hdrLoader.setDataType(yt)),this._hdrLoader.setWithCredentials(e),this._hdrLoader}async getLottieLoader(e){if(this._lottieLoader==null){const{LottieLoader:t}=await import(this.lottieLoaderUrl);this._lottieLoader=new t}return this._lottieLoader.setWithCredentials(e),this._lottieLoader}async loadImage(e,t,n){if(n==="image/ktx2"||sB.test(e))return this.loadKTX2(e,t);const i=await new Promise((s,a)=>this.ldrLoader(t).load(e,s,()=>{},a));return i.name=e,i.flipY=!1,i}async loadKTX2(e,t){yo.setWithCredentials(t);const n=await new Promise((i,s)=>yo.load(e,i,()=>{},s));return n.name=e,n.flipY=!1,n}async loadLottie(e,t,n){const i=await this.getLottieLoader(n);i.setQuality(t);const s=await new Promise((a,o)=>i.load(e,a,()=>{},o));return s.name=e,s}async loadEquirect(e,t=!1,n=()=>{}){try{const i=iB.test(e),s=i?this.hdrLoader(t):this.imageLoader(t),a=await new Promise((o,c)=>s.load(e,l=>{const{renderTarget:h}=l;if(h!=null){let u;
4910try{const d=l.toDataTexture();d.needsUpdate=!0;const f=d.image.data;let p=!1;const m=f.length;for(let A=0;A<m;A++)if(f[A]!==0){p=!0;break}p?(u=d,l.dispose(!0)):(console.warn("Decoded DataTexture is completely black, falling back to render target texture."),u=h.texture,l.dispose(!1))}catch(d){console.warn("Failed to convert gainmap to DataTexture, falling back to render target texture:",d),u=h.texture,l.dispose(!1)}o(u)}else o(l)},l=>{n(l.loaded/l.total*.9)},c));return n(1),a.name=e,a.mapping=cl,!i&&a.type!==yt&&(a.colorSpace=mt),a}finally{n&&n(1)}}async generateEnvironmentMapAndSkybox(e=null,t=null,n=()=>{},i=!1){const s=t!=="legacy";(t==="legacy"||t==="neutral")&&(t=null),t=Gb(t);let a=Promise.resolve(null),o;e&&(a=this.loadEquirectFromUrl(e,i,n)),t?o=this.loadEquirectFromUrl(t,i,n):e?o=this.loadEquirectFromUrl(e,i,n):o=s?this.loadGeneratedEnvironmentMapAlt():this.loadGeneratedEnvironmentMap();const[c,l]=await Promise.all([o,a]);if(c==null)throw new Error("Failed to load environment map.");return{environmentMap:c,skybox:l}}async loadEquirectFromUrl(e,t,n){if(!this.skyboxCache.has(e)){const i=this.loadEquirect(e,t,n);this.skyboxCache.set(e,i)}return this.skyboxCache.get(e)}async GenerateEnvironmentMap(e,t){await $w();const n=this.threeRenderer,i=new ah(256,{generateMipmaps:!1,type:yt,format:Tt,colorSpace:Ct,depthBuffer:!0}),s=new ef(.1,100,i),a=s.renderTarget.texture;a.name=t;const o=n.outputColorSpace,c=n.toneMapping;return n.toneMapping=Qn,n.outputColorSpace=Ct,s.update(n,e),this.blurCubemap(i,nB),n.toneMapping=c,n.outputColorSpace=o,a}async loadGeneratedEnvironmentMap(){return this.generatedEnvironmentMap==null&&(this.generatedEnvironmentMap=this.GenerateEnvironmentMap(new bm("legacy"),"legacy")),this.generatedEnvironmentMap}async loadGeneratedEnvironmentMapAlt(){return this.generatedEnvironmentMapAlt==null&&(this.generatedEnvironmentMapAlt=this.GenerateEnvironmentMap(new bm("neutral"),"neutral")),this.generatedEnvironmentMapAlt}blurCubemap(e,t){if(this.blurMaterial==null){this.blurMaterial=this.getBlurShader(Pr);const i=new ji,s=new at(i,this.blurMaterial);this.blurScene=new xs,this.blurScene.add(s)}const n=e.clone();this.halfblur(e,n,t,"latitudinal"),this.halfblur(n,e,t,"longitudinal")}halfblur(e,t,n,i){const a=e.width,o=isFinite(n)?Math.PI/(2*a):2*Math.PI/(2*Pr-1),c=n/o,l=isFinite(n)?1+Math.floor(3*c):Pr;l>Pr&&console.warn(`sigmaRadians, ${n}, is too large and will clip, as it requested ${l} samples when the maximum is set to ${Pr}`);const h=[];let u=0;for(let p=0;p<Pr;++p){const m=p/c,A=Math.exp(-m*m/2);h.push(A),p==0?u+=A:p<l&&(u+=2*A)}for(let p=0;p<h.length;p++)h[p]=h[p]/u;const d=this.blurMaterial.uniforms;d.envMap.value=e.texture,d.samples.value=l,d.weights.value=h,d.latitudinal.value=i==="latitudinal",d.dTheta.value=o,new ef(.1,100,t).update(this.threeRenderer,this.blurScene)}getBlurShader(e){const t=new Float32Array(e),n=new R(0,1,0);return new mn({name:"SphericalGaussianBlur",defines:{n:e},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:t},latitudinal:{value:!1},dTheta:{value:0},poleAxis:{value:n}},vertexShader:`
4911      
4912      varying vec3 vOutputDirection;
4913  
4914      void main() {
4915  
4916        vOutputDirection = vec3( position );
4917        gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
4918  
4919      }
4920    `,fragmentShader:`
4921        varying vec3 vOutputDirection;
4922  
4923        uniform samplerCube envMap;
4924        uniform int samples;
4925        uniform float weights[ n ];
4926        uniform bool latitudinal;
4927        uniform float dTheta;
4928        uniform vec3 poleAxis;
4929  
4930        vec3 getSample( float theta, vec3 axis ) {
4931  
4932          float cosTheta = cos( theta );
4933          // Rodrigues' axis-angle rotation
4934          vec3 sampleDirection = vOutputDirection * cosTheta
4935            + cross( axis, vOutputDirection ) * sin( theta )
4936            + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );
4937  
4938          return vec3( textureCube( envMap, sampleDirection ) );
4939  
4940        }
4941  
4942        void main() {
4943  
4944          vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );
4945  
4946          if ( all( equal( axis, vec3( 0.0 ) ) ) ) {
4947  
4948            axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );
4949  
4950          }
4951  
4952          axis = normalize( axis );
4953  
4954          gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
4955          gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );
4956  
4957          for ( int i = 1; i < n; i++ ) {
4958  
4959            if ( i >= samples ) {
4960  
4961              break;
4962  
4963            }
4964  
4965            float theta = dTheta * float( i );
4966            gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
4967            gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );
4968  
4969          }
4970        }
4971      `,blending:Zn,depthTest:!1,depthWrite:!1,side:on})}async dispose(){for(const[,e]of this.skyboxCache)(await e).dispose();this.generatedEnvironmentMap!=null&&((await this.generatedEnvironmentMap).dispose(),this.generatedEnvironmentMap=null),this.generatedEnvironmentMapAlt!=null&&((await this.generatedEnvironmentMapAlt).dispose(),this.generatedEnvironmentMapAlt=null),this.blurMaterial!=null&&this.blurMaterial.dispose()}}/* @license
4972 * Copyright 2019 Google LLC. All Rights Reserved.
4973 * Licensed under the Apache License, Version 2.0 (the 'License');
vendor: 11,325 bytes, lines 4974-5012
4974 * you may not use this file except in compliance with the License.
4975 * You may obtain a copy of the License at
4976 *
4977 *     http://www.apache.org/licenses/LICENSE-2.0
4978 *
4979 * Unless required by applicable law or agreed to in writing, software
4980 * distributed under the License is distributed on an 'AS IS' BASIS,
4981 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4982 * See the License for the specific language governing permissions and
4983 * limitations under the License.
4984 */const rB=.2,Pu=40,Fu=60,Em=5,Fr=[1,.79,.62,.5,.4,.31,.25],aB=3,_m="high-performance",oB=1.3;class kn extends si{static get singleton(){return this._singleton||(this._singleton=new kn({powerPreference:(self.ModelViewerElement||{}).powerPreference||_m,debug:JA()})),this._singleton}static resetSingleton(){const e=this._singleton.dispose();for(const t of e)t.disconnectedCallback();this._singleton=new kn({powerPreference:(self.ModelViewerElement||{}).powerPreference||_m,debug:JA()});for(const t of e)t.connectedCallback()}get canRender(){return this.threeRenderer!=null}get scaleFactor(){return Fr[this.scaleStep]}set minScale(e){let t=1;for(;t<Fr.length&&!(Fr[t]<e);)++t;this.lastStep=t-1}constructor(e){super(),this.loader=new vn(GR),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=aB,this.avgFrameDuration=(Fu+Pu)/2,this.onWebGLContextLost=t=>{this.dispatchEvent({type:"contextlost",sourceEvent:t})},this.onWebGLContextRestored=()=>{var t;(t=this.textureUtils)===null||t===void 0||t.dispose(),this.textureUtils=this.canRender?new xm(this.threeRenderer):null;for(const n of this.scenes)n.element[Gl]()},this.dpr=window.devicePixelRatio,this.canvas3D=document.createElement("canvas"),this.canvas3D.id="webgl-canvas",this.canvas3D.classList.add("show");try{this.threeRenderer=new Jf({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=sa}catch(t){console.warn(t)}this.arRenderer=this.canRender?new OR(this):null,this.textureUtils=this.canRender?new xm(this.threeRenderer):null,this.canRender&&vn.initializeKTX2Loader(this.threeRenderer),this.canvas3D.addEventListener("webglcontextlost",this.onWebGLContextLost),this.canvas3D.addEventListener("webglcontextrestored",this.onWebGLContextRestored),this.updateRendererSize()}registerScene(e){if(this.scenes.add(e),e.forceRescale(),this.canRender){const t=new pe;this.threeRenderer.getSize(t),e.canvas.width=t.x,e.canvas.height=t.y,this.scenes.size>0&&this.threeRenderer.setAnimationLoop((n,i)=>this.render(n,i))}}unregisterScene(e){this.scenes.delete(e),this.canvas3D.parentElement===e.canvas.parentElement&&e.canvas.parentElement.removeChild(this.canvas3D),this.canRender&&this.scenes.size===0&&this.threeRenderer.setAnimationLoop(null)}displayCanvas(e){return e.element.modelIsVisible&&!this.multipleScenesVisible?this.canvas3D:e.element[gf]}countVisibleScenes(){const{canvas3D:e}=this;let t=0,n=null;for(const s of this.scenes){const{element:a}=s;a.modelIsVisible&&s.externalRenderer==null&&++t,e.parentElement===s.canvas.parentElement&&(n=s)}const i=t>1;if(n!=null){const s=i&&!this.multipleScenesVisible,a=!n.element.modelIsVisible;if(s||a){const{width:o,height:c}=this.sceneSize(n);this.copyPixels(n,o,c),e.parentElement.removeChild(e)}}this.multipleScenesVisible=i}updateRendererSize(){var e;const t=window.devicePixelRatio;if(t!==this.dpr)for(const s of this.scenes){const{element:a}=s;a[zr](a.getBoundingClientRect())}let n=0,i=0;for(const s of this.scenes)n=Math.max(n,s.width),i=Math.max(i,s.height);if(!(n===this.width&&i===this.height&&t===this.dpr)){this.width=n,this.height=i,this.dpr=t,n=Math.ceil(n*t),i=Math.ceil(i*t),this.canRender&&this.threeRenderer.setSize(n,i,!1);for(const s of this.scenes){const{canvas:a}=s;a.width=n,a.height=i,s.forceRescale(),(e=s.effectRenderer)===null||e===void 0||e.setSize(n,i)}}}updateRendererScale(e){const t=this.scaleStep;this.avgFrameDuration+=pi(rB*(e-this.avgFrameDuration),-Em,Em),this.avgFrameDuration>Fu?++this.scaleStep:this.avgFrameDuration<Pu&&this.scaleStep>0&&--this.scaleStep,this.scaleStep=Math.min(this.scaleStep,this.lastStep),t!==this.scaleStep&&(this.avgFrameDuration=(Fu+Pu)/2)}shouldRender(e){if(e.shouldRender())e.scaleStep!=this.scaleStep&&(e.scaleStep=this.scaleStep,this.rescaleCanvas(e));else if(e.scaleStep!=0)e.scaleStep=0,this.rescaleCanvas(e);else return!1;return!0}rescaleCanvas(e){const t=Fr[e.scaleStep],n=Math.ceil(this.width/t),i=Math.ceil(this.height/t),{style:s}=e.canvas;s.width=`${n}px`,s.height=`${i}px`,this.canvas3D.style.width=`${n}px`,this.canvas3D.style.height=`${i}px`;const a=this.dpr*t,o=t<1?"GPU throttling":this.dpr!==window.devicePixelRatio?"No meta viewport tag":"";e.element.dispatchEvent(new CustomEvent("render-scale",{detail:{reportedDpr:window.devicePixelRatio,renderedDpr:a,minimumDpr:this.dpr*Fr[this.lastStep],pixelWidth:Math.ceil(e.width*a),pixelHeight:Math.ceil(e.height*a),reason:o}}))}sceneSize(e){const{dpr:t}=this,n=Fr[e.scaleStep],i=Math.min(Math.ceil(e.width*n*t),this.canvas3D.width),s=Math.min(Math.ceil(e.height*n*t),this.canvas3D.height);return{width:i,height:s}}copyPixels(e,t,n){const i=e.context;if(i==null){console.log("could not acquire 2d context");return}i.clearRect(0,0,t,n),i.drawImage(this.canvas3D,0,0,t,n,0,0,t,n),e.canvas.classList.add("show")}orderedScenes(){const e=[];for(const t of[!1,!0])for(const n of this.scenes)n.element.modelIsVisible===t&&e.push(n);return e}get isPresenting(){var e;return((e=this.arRenderer)===null||e===void 0?void 0:e.isPresenting)===!0}preRender(e,t,n){const{element:i,exposure:s,toneMapping:a}=e;i[mi](t,n);const o=typeof s=="number"&&!Number.isNaN(s),c=i.environmentImage,l=i.skyboxImage,h=a===sa&&(c==="neutral"||c==="legacy"||!c&&!l);this.threeRenderer.toneMappingExposure=(o?s:1)*(h?oB:1)}render(e,t){if(t!=null){this.arRenderer!=null&&this.arRenderer.onWebXRFrame(e,t);return}const n=e-this.lastTick;if(this.lastTick=e,!this.canRender||this.isPresenting)return;this.countVisibleScenes(),this.updateRendererSize(),this.renderedLastFrame&&(this.updateRendererScale(n),this.renderedLastFrame=!1);const{canvas3D:i}=this;for(const s of this.orderedScenes()){const{element:a}=s;if(!a.loaded||!a.modelIsVisible&&s.renderCount>0||(this.preRender(s,e,n),!this.shouldRender(s)))continue;if(s.externalRenderer!=null){const l=s.getCamera();l.updateMatrix();const{matrix:h,projectionMatrix:u}=l,d=h.elements.slice(),f=s.getTarget();d[12]+=f.x,d[13]+=f.y,d[14]+=f.z,s.externalRenderer.render({viewMatrix:d,projectionMatrix:u.elements});continue}if(!a.modelIsVisible&&!this.multipleScenesVisible)for(const l of this.scenes)l.element.modelIsVisible&&l.queueRender();const{width:o,height:c}=this.sceneSize(s);s.renderShadow(this.threeRenderer),this.threeRenderer.setRenderTarget(null),this.threeRenderer.setViewport(0,Math.ceil(this.height*this.dpr)-c,o,c),s.effectRenderer!=null?s.effectRenderer.render(n):(this.threeRenderer.autoClear=!0,this.threeRenderer.toneMapping=s.toneMapping,this.threeRenderer.render(s,s.camera)),this.multipleScenesVisible||!s.element.modelIsVisible&&s.renderCount===0?this.copyPixels(s,o,c):i.parentElement!==s.canvas.parentElement&&(s.canvas.parentElement.appendChild(i),s.canvas.classList.remove("show")),s.hasRendered(),++s.renderCount,this.renderedLastFrame=!0}}dispose(){this.textureUtils!=null&&this.textureUtils.dispose(),this.threeRenderer!=null&&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}}/* @license
4985 * Copyright 2020 Google LLC. All Rights Reserved.
4986 * Licensed under the Apache License, Version 2.0 (the 'License');
4987 * you may not use this file except in compliance with the License.
4988 * You may obtain a copy of the License at
4989 *
4990 *     http://www.apache.org/licenses/LICENSE-2.0
4991 *
4992 * Unless required by applicable law or agreed to in writing, software
4993 * distributed under the License is distributed on an 'AS IS' BASIS,
4994 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4995 * See the License for the specific language governing permissions and
4996 * limitations under the License.
4997 */const Xe=Symbol("correlatedObjects"),lt=Symbol("onUpdate");class jo{constructor(e,t){this[lt]=e,this[Xe]=t}}/* @license
4998 * Copyright 2020 Google LLC. All Rights Reserved.
4999 * Licensed under the Apache License, Version 2.0 (the 'License');
5000 * you may not use this file except in compliance with the License.
5001 * You may obtain a copy of the License at
5002 *
5003 *     http://www.apache.org/licenses/LICENSE-2.0
5004 *
5005 * Unless required by applicable law or agreed to in writing, software
5006 * distributed under the License is distributed on an 'AS IS' BASIS,
5007 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5008 * See the License for the specific language governing permissions and
5009 * limitations under the License.
5010 */const vm=new pn,cB=new zn(2,2);let lB=0;const Fn=Symbol("threeTexture"),ym=Symbol("threeTextures");let hB=class extends jo{get[Fn](){var e;return(e=this[Xe])===null||e===void 0?void 0:e.values().next().value}get[ym](){return this[Xe]}constructor(e,t){super(e,new Set(t?[t]:[]));const n=this[Fn].image;n.src||(n.src=t.name?t.name:"adhoc_image"+lB++),n.name||(n.name=t&&n&&n.src?n.src.split("/").pop():"adhoc_image")}get name(){return this[Fn].image.name||""}get uri(){return this[Fn].image.src}get bufferView(){return this[Fn].image.bufferView}get element(){const e=this[Fn];if(e&&(e.isCanvasTexture||e.isVideoTexture))return e.image}get animation(){const e=this[Fn];if(e&&e.isCanvasTexture&&e.animation)return e.animation}get type(){return this.uri!=null?"external":"embedded"}set name(e){for(const t of this[ym])t.image.name=e}update(){const e=this[Fn];e&&e.isCanvasTexture&&!e.animation&&(this[Fn].needsUpdate=!0,this[lt]())}async createThumbnail(e,t){const n=new xs;vm.map=this[Fn];const i=new at(cB,vm);n.add(i);const s=new cr(-1,1,1,-1,0,1),{threeRenderer:a}=kn.singleton,o=new Sn(e,t);a.setRenderTarget(o),a.render(n,s),a.setRenderTarget(null);const c=new Uint8Array(e*t*4);a.readRenderTargetPixels(o,0,0,e,t,c),As.width=e,As.height=t;const l=As.getContext("2d"),h=l.createImageData(e,t);return h.data.set(c),l.putImageData(h,0,0),new Promise(async(u,d)=>{As.toBlob(f=>{if(!f)return d("Failed to capture thumbnail.");u(URL.createObjectURL(f))},"image/png")})}};var en;(function(r){r[r.Nearest=9728]="Nearest",r[r.Linear=9729]="Linear",r[r.NearestMipmapNearest=9984]="NearestMipmapNearest",r[r.LinearMipmapNearest=9985]="LinearMipmapNearest",r[r.NearestMipmapLinear=9986]="NearestMipmapLinear",r[r.LinearMipmapLinear=9987]="LinearMipmapLinear"})(en||(en={}));var ms;(function(r){r[r.ClampToEdge=33071]="ClampToEdge",r[r.MirroredRepeat=33648]="MirroredRepeat",r[r.Repeat=10497]="Repeat"})(ms||(ms={}));/* @license
5011 * Copyright 2020 Google LLC. All Rights Reserved.
5012 * Licensed under the Apache License, Version 2.0 (the 'License');
5013 * you may not use this file except in compliance with the License.
5014 * You may obtain a copy of the License at
5015 *
5016 *     http://www.apache.org/licenses/LICENSE-2.0
5017 *
5018 * Unless required by applicable law or agreed to in writing, software
5019 * distributed under the License is distributed on an 'AS IS' BASIS,
5020 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5021 * See the License for the specific language governing permissions and
5022 * limitations under the License.
5023 */const Sm=new Map([[ms.Repeat,ni],[ms.ClampToEdge,Dt],[ms.MirroredRepeat,ir]]),lf=new Map([[ni,ms.Repeat],[Dt,ms.ClampToEdge],[ir,ms.MirroredRepeat]]),uB=new Map([[en.Nearest,St],[en.Linear,qe],[en.NearestMipmapNearest,xa],[en.LinearMipmapNearest,Ys],[en.NearestMipmapLinear,us],[en.LinearMipmapLinear,yn]]),tE=new Map([[St,en.Nearest],[qe,en.Linear],[xa,en.NearestMipmapNearest],[Ys,en.LinearMipmapNearest],[us,en.NearestMipmapLinear],[yn,en.LinearMipmapLinear]]),dB=new Map([[en.Nearest,St],[en.Linear,qe]]),nE=new Map([[St,en.Nearest],[qe,en.Linear]]),fB=r=>tE.has(r),pB=r=>nE.has(r),AB=r=>lf.has(r),gB=(r,e)=>{switch(r){case"minFilter":return fB(e);case"magFilter":return pB(e);case"wrapS":case"wrapT":return AB(e);case"rotation":case"repeat":case"offset":return!0;default:throw new Error(`Cannot configure property "${r}" on Sampler`)}},Li=Symbol("threeTexture"),Cm=Symbol("threeTextures"),is=Symbol("setProperty");class mB extends jo{get[Li](){var e;return(e=this[Xe])===null||e===void 0?void 0:e.values().next().value}get[Cm](){return this[Xe]}constructor(e,t){super(e,new Set(t?[t]:[]))}get name(){return this[Li].name||""}get minFilter(){return tE.get(this[Li].minFilter)}get magFilter(){return nE.get(this[Li].magFilter)}get wrapS(){return lf.get(this[Li].wrapS)}get wrapT(){return lf.get(this[Li].wrapT)}get rotation(){return this[Li].rotation}get scale(){return mf(this[Li].repeat)}get offset(){return mf(this[Li].offset)}setMinFilter(e){this[is]("minFilter",uB.get(e))}setMagFilter(e){this[is]("magFilter",dB.get(e))}setWrapS(e){this[is]("wrapS",Sm.get(e))}setWrapT(e){this[is]("wrapT",Sm.get(e))}setRotation(e){e==null&&(e=0),this[is]("rotation",e)}setScale(e){e==null&&(e={u:1,v:1}),this[is]("repeat",new pe(e.u,e.v))}setOffset(e){e==null&&(e={u:0,v:0}),this[is]("offset",new pe(e.u,e.v))}[is](e,t){if(gB(e,t))for(const n of this[Cm])n[e]=t,n.needsUpdate=!0;this[lt]()}}/* @license
5024 * Copyright 2020 Google LLC. All Rights Reserved.
5025 * Licensed under the Apache License, Version 2.0 (the 'License');
5026 * you may not use this file except in compliance with the License.
5027 * You may obtain a copy of the License at
5028 *
5029 *     http://www.apache.org/licenses/LICENSE-2.0
5030 *
5031 * Unless required by applicable law or agreed to in writing, software
5032 * distributed under the License is distributed on an 'AS IS' BASIS,
5033 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5034 * See the License for the specific language governing permissions and
5035 * limitations under the License.
5036 */const Mm=Symbol("image"),Im=Symbol("sampler"),wm=Symbol("threeTexture");class iE extends jo{get[wm](){var e;return(e=this[Xe])===null||e===void 0?void 0:e.values().next().value}constructor(e,t){super(e,new Set(t?[t]:[])),this[Im]=new mB(e,t),this[Mm]=new hB(e,t)}get name(){return this[wm].name||""}set name(e){for(const t of this[Xe])t.name=e}get sampler(){return this[Im]}get source(){return this[Mm]}}/* @license
5037 * Copyright 2020 Google LLC. All Rights Reserved.
5038 * Licensed under the Apache License, Version 2.0 (the 'License');
5039 * you may not use this file except in compliance with the License.
5040 * You may obtain a copy of the License at
5041 *
5042 *     http://www.apache.org/licenses/LICENSE-2.0
5043 *
5044 * Unless required by applicable law or agreed to in writing, software
5045 * distributed under the License is distributed on an 'AS IS' BASIS,
5046 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5047 * See the License for the specific language governing permissions and
5048 * limitations under the License.
5049 */var sE,rE,aE;const Gs=Symbol("texture"),Hs=Symbol("transform"),Nu=Symbol("materials"),Tm=Symbol("usage"),Nr=Symbol("onUpdate"),uo=Symbol("activeVideo");var Ue;(function(r){r[r.Base=0]="Base",r[r.MetallicRoughness=1]="MetallicRoughness",r[r.Normal=2]="Normal",r[r.Occlusion=3]="Occlusion",r[r.Emissive=4]="Emissive",r[r.Clearcoat=5]="Clearcoat",r[r.ClearcoatRoughness=6]="ClearcoatRoughness",r[r.ClearcoatNormal=7]="ClearcoatNormal",r[r.SheenColor=8]="SheenColor",r[r.SheenRoughness=9]="SheenRoughness",r[r.Transmission=10]="Transmission",r[r.Thickness=11]="Thickness",r[r.Specular=12]="Specular",r[r.SpecularColor=13]="SpecularColor",r[r.Iridescence=14]="Iridescence",r[r.IridescenceThickness=1
vendor: 19,430 bytes, lines 5049-5092
50495]="IridescenceThickness",r[r.Anisotropy=16]="Anisotropy"})(Ue||(Ue={}));class jr{constructor(e,t,n,i){this[sE]=null,this[rE]={rotation:0,scale:new pe(1,1),offset:new pe(0,0)},this[aE]=!1,n&&(this[Hs].rotation=n.rotation,this[Hs].scale.copy(n.repeat),this[Hs].offset.copy(n.offset),this[Gs]=new iE(e,n)),this[Nr]=e,this[Nu]=i,this[Tm]=t}get texture(){return this[Gs]}setTexture(e){var t,n;const i=e!=null?e.source[Fn]:null,s=(t=this[Gs])===null||t===void 0?void 0:t.source[Fn];if(s!=null&&s.isVideoTexture?this[uo]=!1:!((n=this[Gs])===null||n===void 0)&&n.source.animation&&this[Gs].source.animation.removeEventListener("enterFrame",this[Nr]),this[Gs]=e,i!=null&&i.isVideoTexture){const o=i.image;if(this[uo]=!0,o.requestVideoFrameCallback!=null){const c=()=>{this[uo]&&(this[Nr](),o.requestVideoFrameCallback(c))};o.requestVideoFrameCallback(c)}else{const c=()=>{this[uo]&&(this[Nr](),requestAnimationFrame(c))};requestAnimationFrame(c)}}else(e==null?void 0:e.source.animation)!=null&&e.source.animation.addEventListener("enterFrame",this[Nr]);let a=mt;if(this[Nu])for(const o of this[Nu]){switch(this[Tm]){case Ue.Base:o.map=i;break;case Ue.MetallicRoughness:a=Ct,o.metalnessMap=i,o.roughnessMap=i;break;case Ue.Normal:a=Ct,o.normalMap=i;break;case Ue.Occlusion:a=Ct,o.aoMap=i;break;case Ue.Emissive:o.emissiveMap=i;break;case Ue.Clearcoat:o.clearcoatMap=i;break;case Ue.ClearcoatRoughness:o.clearcoatRoughnessMap=i;break;case Ue.ClearcoatNormal:o.clearcoatNormalMap=i;break;case Ue.SheenColor:o.sheenColorMap=i;break;case Ue.SheenRoughness:o.sheenRoughnessMap=i;break;case Ue.Transmission:o.transmissionMap=i;break;case Ue.Thickness:o.thicknessMap=i;break;case Ue.Specular:o.specularIntensityMap=i;break;case Ue.SpecularColor:o.specularColorMap=i;break;case Ue.Iridescence:o.iridescenceMap=i;break;case Ue.IridescenceThickness:o.iridescenceThicknessMap=i;break;case Ue.Anisotropy:o.anisotropyMap=i;break}o.needsUpdate=!0}i&&(i.colorSpace=a,i.rotation=this[Hs].rotation,i.repeat=this[Hs].scale,i.offset=this[Hs].offset),this[Nr]()}}sE=Gs,rE=Hs,aE=uo;/* @license
5050 * Copyright 2020 Google LLC. All Rights Reserved.
5051 * Licensed under the Apache License, Version 2.0 (the 'License');
5052 * you may not use this file except in compliance with the License.
5053 * You may obtain a copy of the License at
5054 *
5055 *     http://www.apache.org/licenses/LICENSE-2.0
5056 *
5057 * Unless required by applicable law or agreed to in writing, software
5058 * distributed under the License is distributed on an 'AS IS' BASIS,
5059 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5060 * See the License for the specific language governing permissions and
5061 * limitations under the License.
5062 */const Ka=Symbol("threeMaterial"),Wc=Symbol("threeMaterials"),Rm=Symbol("baseColorTexture"),Bm=Symbol("metallicRoughnessTexture");class bB extends jo{get[Wc](){return this[Xe]}get[Ka](){var e;return(e=this[Xe])===null||e===void 0?void 0:e.values().next().value}constructor(e,t){super(e,t);const{map:n,metalnessMap:i}=t.values().next().value;this[Rm]=new jr(e,Ue.Base,n,t),this[Bm]=new jr(e,Ue.MetallicRoughness,i,t)}get baseColorFactor(){const e=[0,0,0,this[Ka].opacity];return this[Ka].color.toArray(e),e}get metallicFactor(){return this[Ka].metalness}get roughnessFactor(){return this[Ka].roughness}get baseColorTexture(){return this[Rm]}get metallicRoughnessTexture(){return this[Bm]}setBaseColorFactor(e){const t=new Me;e instanceof Array?t.fromArray(e):t.set(e);for(const n of this[Wc])n.color.set(t),e instanceof Array&&e.length>3?n.opacity=e[3]:(e=[0,0,0,n.opacity],t.toArray(e));this[lt]()}setMetallicFactor(e){for(const t of this[Wc])t.metalness=e;this[lt]()}setRoughnessFactor(e){for(const t of this[Wc])t.roughness=e;this[lt]()}}/* @license
5063 * Copyright 2020 Google LLC. All Rights Reserved.
5064 * Licensed under the Apache License, Version 2.0 (the 'License');
5065 * you may not use this file except in compliance with the License.
5066 * You may obtain a copy of the License at
5067 *
5068 *     http://www.apache.org/licenses/LICENSE-2.0
5069 *
5070 * Unless required by applicable law or agreed to in writing, software
5071 * distributed under the License is distributed on an 'AS IS' BASIS,
5072 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5073 * See the License for the specific language governing permissions and
5074 * limitations under the License.
5075 */var Dm,Lm;const Pm=Symbol("pbrMetallicRoughness"),Fm=Symbol("normalTexture"),Nm=Symbol("occlusionTexture"),Um=Symbol("emissiveTexture"),Mt=Symbol("backingThreeMaterial"),Om=Symbol("applyAlphaCutoff"),Uu=Symbol("getAlphaMode"),Ur=Symbol("lazyLoadGLTFInfo"),Ou=Symbol("initialize"),hf=Symbol("getLoadedMaterial"),be=Symbol("ensureMaterialIsLoaded"),km=Symbol("gltfIndex"),fo=Symbol("setActive"),ea=Symbol("variantIndices"),ku=Symbol("isActive"),Qm=Symbol("modelVariants"),Qu=Symbol("name"),Cn=Symbol("pbrTextures");class Gu extends jo{get[(Dm=ea,Lm=Cn,Mt)](){return this[Xe].values().next().value}constructor(e,t,n,i,s,a,o=void 0){super(e,s),this[Dm]=new Set,this[Lm]=new Map,this[km]=t,this[ku]=n,this[Qm]=i,this[Qu]=a,o==null?this[Ou]():this[Ur]=o}[Ou](){const e=this[lt],t=this[Xe];this[Pm]=new bB(e,t);const{normalMap:n,aoMap:i,emissiveMap:s}=t.values().next().value;this[Fm]=new jr(e,Ue.Normal,n,t),this[Nm]=new jr(e,Ue.Occlusion,i,t),this[Um]=new jr(e,Ue.Emissive,s,t);const a=o=>{this[Cn].set(o,new jr(e,o,null,t))};a(Ue.Clearcoat),a(Ue.ClearcoatRoughness),a(Ue.ClearcoatNormal),a(Ue.SheenColor),a(Ue.SheenRoughness),a(Ue.Transmission),a(Ue.Thickness),a(Ue.Specular),a(Ue.SpecularColor),a(Ue.Iridescence),a(Ue.IridescenceThickness),a(Ue.Anisotropy)}async[hf](){if(this[Ur]!=null){const e=await this[Ur].doLazyLoad();return this[Ou](),this[Ur]=void 0,this.ensureLoaded=async()=>{},e}return null}colorFromRgb(e){const t=new Me;return e instanceof Array?t.fromArray(e):t.set(e),t}[be](){if(this[Ur]!=null)throw new Error(`Material "${this.name}" has not been loaded, call 'await
5076    myMaterial.ensureLoaded()' before using an unloaded material.`)}async ensureLoaded(){await this[hf]()}get isLoaded(){return this[Ur]==null}get isActive(){return this[ku]}[fo](e){this[ku]=e}get name(){return this[Qu]||""}set name(e){if(this[Qu]=e,this[Xe]!=null)for(const t of this[Xe])t.name=e}get pbrMetallicRoughness(){return this[be](),this[Pm]}get normalTexture(){return this[be](),this[Fm]}get occlusionTexture(){return this[be](),this[Nm]}get emissiveTexture(){return this[be](),this[Um]}get emissiveFactor(){return this[be](),this[Mt].emissive.toArray()}get index(){return this[km]}hasVariant(e){const t=this[Qm].get(e);return t!=null&&this[ea].has(t.index)}setEmissiveFactor(e){this[be]();const t=this.colorFromRgb(e);for(const n of this[Xe])n.emissive.set(t);this[lt]()}[Uu](){return this[Mt].transparent?"BLEND":this[Mt].alphaTest>0?"MASK":"OPAQUE"}[Om](){this[be]();for(const e of this[Xe])this[Uu]()==="MASK"?e.alphaTest==null&&(e.alphaTest=.5):e.alphaTest=void 0,e.needsUpdate=!0}setAlphaCutoff(e){this[be]();for(const t of this[Xe])t.alphaTest=e,t.needsUpdate=!0;this[Om](),this[lt]()}getAlphaCutoff(){return this[be](),this[Mt].alphaTest}setDoubleSided(e){this[be]();for(const t of this[Xe])t.side=e?qt:ti,t.needsUpdate=!0;this[lt]()}getDoubleSided(){return this[be](),this[Mt].side==qt}setAlphaMode(e){this[be]();const t=(n,i)=>{n.transparent=i,n.depthWrite=!i};for(const n of this[Xe])t(n,e==="BLEND"),e==="MASK"?n.alphaTest=.5:n.alphaTest=void 0,n.needsUpdate=!0;this[lt]()}getAlphaMode(){return this[be](),this[Uu]()}get emissiveStrength(){return this[be](),this[Mt].emissiveIntensity}setEmissiveStrength(e){this[be]();for(const t of this[Xe])t.emissiveIntensity=e;this[lt]()}get clearcoatFactor(){return this[be](),this[Mt].clearcoat}get clearcoatRoughnessFactor(){return this[be](),this[Mt].clearcoatRoughness}get clearcoatTexture(){return this[be](),this[Cn].get(Ue.Clearcoat)}get clearcoatRoughnessTexture(){return this[be](),this[Cn].get(Ue.ClearcoatRoughness)}get clearcoatNormalTexture(){return this[be](),this[Cn].get(Ue.ClearcoatNormal)}get clearcoatNormalScale(){return this[be](),this[Mt].clearcoatNormalScale.x}setClearcoatFactor(e){this[be]();for(const t of this[Xe])t.clearcoat=e;this[lt]()}setClearcoatRoughnessFactor(e){this[be]();for(const t of this[Xe])t.clearcoatRoughness=e;this[lt]()}setClearcoatNormalScale(e){this[be]();for(const t of this[Xe])t.clearcoatNormalScale=new pe(e,e);this[lt]()}get ior(){return this[be](),this[Mt].ior}setIor(e){this[be]();for(const t of this[Xe])t.ior=e;this[lt]()}get sheenColorFactor(){return this[be](),this[Mt].sheenColor.toArray()}get sheenColorTexture(){return this[be](),this[Cn].get(Ue.SheenColor)}get sheenRoughnessFactor(){return this[be](),this[Mt].sheenRoughness}get sheenRoughnessTexture(){return this[be](),this[Cn].get(Ue.SheenRoughness)}setSheenColorFactor(e){this[be]();const t=this.colorFromRgb(e);for(const n of this[Xe])n.sheenColor.set(t),n.sheen=1;this[lt]()}setSheenRoughnessFactor(e){this[be]();for(const t of this[Xe])t.sheenRoughness=e,t.sheen=1;this[lt]()}get transmissionFactor(){return this[be](),this[Mt].transmission}get transmissionTexture(){return this[be](),this[Cn].get(Ue.Transmission)}setTransmissionFactor(e){this[be]();for(const t of this[Xe])t.transmission=e;this[lt]()}get thicknessFactor(){return this[be](),this[Mt].thickness}get thicknessTexture(){return this[be](),this[Cn].get(Ue.Thickness)}get attenuationDistance(){return this[be](),this[Mt].attenuationDistance}get attenuationColor(){return this[be](),this[Mt].attenuationColor.toArray()}setThicknessFactor(e){this[be]();for(const t of this[Xe])t.thickness=e;this[lt]()}setAttenuationDistance(e){this[be]();for(const t of this[Xe])t.attenuationDistance=e;this[lt]()}setAttenuationColor(e){this[be]();const t=this.colorFromRgb(e);for(const n of this[Xe])n.attenuationColor.set(t);this[lt]()}get specularFactor(){return this[be](),this[Mt].specularIntensity}get specularTexture(){return this[be](),this[Cn].get(Ue.Specular)}get specularColorFactor(){return this[be](),this[Mt].specularColor.toArray()}get specularColorTexture(){return this[be](),this[Cn].get(Ue.SheenColor)}setSpecularFactor(e){this[be]();for(const t of this[Xe])t.specularIntensity=e;this[lt]()}setSpecularColorFactor(e){this[be]();const t=this.colorFromRgb(e);for(const n of this[Xe])n.specularColor.set(t);this[lt]()}get iridescenceFactor(){return this[be](),this[Mt].iridescence}get iridescenceTexture(){return this[be](),this[Cn].get(Ue.Iridescence)}get iridescenceIor(){return this[be](),this[Mt].iridescenceIOR}get iridescenceThicknessMinimum(){return this[be](),this[Mt].iridescenceThicknessRange[0]}get iridescenceThicknessMaximum(){return this[be](),this[Mt].iridescenceThicknessRange[1]}get iridescenceThicknessTexture(){return this[be](),this[Cn].get(Ue.IridescenceThickness)}setIridescenceFactor(e){this[be]();for(const t of this[Xe])t.iridescence=e;this[lt]()}setIridescenceIor(e){this[be]();for(const t of this[Xe])t.iridescenceIOR=e;this[lt]()}setIridescenceThicknessMinimum(e){this[be]();for(const t of this[Xe])t.iridescenceThicknessRange[0]=e;this[lt]()}setIridescenceThicknessMaximum(e){this[be]();for(const t of this[Xe])t.iridescenceThicknessRange[1]=e;this[lt]()}get anisotropyStrength(){return this[be](),this[Mt].anisotropy}get anisotropyRotation(){return this[be](),this[Mt].anisotropyRotation}get anisotropyTexture(){return this[be](),this[Cn].get(Ue.Anisotropy)}setAnisotropyStrength(e){this[be]();for(const t of this[Xe])t.anisotropy=e;this[lt]()}setAnisotropyRotation(e){this[be]();for(const t of this[Xe])t.anisotropyRotation=e;this[lt]()}}let oE=class{constructor(e){this.name="",this.children=new Array,this.name=e}};class Hu extends oE{constructor(e,t,n,i){super(e.name),this.materials=new Map,this.variantToMaterialMap=new Map,this.initialMaterialIdx=0,this.activeMaterialIdx=0,this.mesh=e;const{gltf:s,threeGLTF:a,threeObjectMap:o}=i;this.parser=a.parser,this.modelVariants=n,this.mesh.userData.variantData=n;const c=o.get(e.material);c.materials!=null?this.initialMaterialIdx=this.activeMaterialIdx=c.materials:console.error(`Primitive (${e.name}) missing initial material reference.`);const l=e.userData.associations||{};if(l.meshes==null){console.error("Mesh is missing primitive index association");return}const d=((s.meshes||[])[l.meshes].primitives||[])[l.primitives];if(d==null){console.error("Mesh primitive definition is missing.");return}if(d.material!=null)this.materials.set(d.material,t[d.material]);else{const f=t.findIndex(p=>p.name==="Default");f>=0?this.materials.set(f,t[f]):console.warn("gltfPrimitive has no material!")}if(d.extensions&&d.extensions.KHR_materials_variants){const f=d.extensions.KHR_materials_variants,m=a.parser.json.extensions.KHR_materials_variants.variants;for(const A of f.mappings){const g=t[A.material];this.materials.set(A.material,g);for(const b of A.variants){const{name:x}=m[b];this.variantToMaterialMap.set(b,g),g[ea].add(b),n.has(x)||n.set(x,{name:x,index:b})}}}}async setActiveMaterial(e){const t=this.materials.get(e);if(e!==this.activeMaterialIdx){const n=t[Xe],i=await t[hf]();i!=null?this.mesh.material=i:this.mesh.material=n.values().next().value,this.parser.assignFinalMaterial(this.mesh),n.add(this.mesh.material),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(e==null)return this.setActiveMaterial(this.initialMaterialIdx);if(this.variantToMaterialMap!=null&&this.modelVariants.has(e)){const t=this.modelVariants.get(e);return this.enableVariantHelper(t.index)}return null}async enableVariantHelper(e){if(this.variantToMaterialMap!=null&&e!=null){const t=this.variantToMaterialMap.get(e);if(t!=null)return this.setActiveMaterial(t.index)}return null}async instantiateVariants(){if(this.variantToMaterialMap!=null)for(const e of this.variantToMaterialMap.keys()){const t=this.mesh.userData.variantMaterials.get(e);if(t.material!=null)continue;const n=await this.enableVariantHelper(e);n!=null&&(t.material=n)}}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 i=this.modelVariants.get(t).index;return e[ea].add(i),this.variantToMaterialMap.set(i,e),this.materials.set(e.index,e),this.updateVariantUserData(i,e),!0}deleteVariant(e){if(this.variantInfo.has(e)){this.variantInfo.delete(e);const t=this.mesh.userData.variantMaterials;t!=null&&t.delete(e)}}updateVariantUserData(e,t){t[ea].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[Xe].values().next().value,gltfMaterialIndex:t.index})}ensureVariantIsUnused(e){const t=this.modelVariants.get(e);return t!=null&&this.variantInfo.has(t.index)?(console.warn(`Primitive cannot add variant '${e}' for this material, it already exists.`),!1):!0}}/* @license
5077 * Copyright 2020 Google LLC. All Rights Reserved.
5078 * Licensed under the Apache License, Version 2.0 (the 'License');
5079 * you may not use this file except in compliance with the License.
5080 * You may obtain a copy of the License at
5081 *
5082 *     http://www.apache.org/licenses/LICENSE-2.0
5083 *
5084 * Unless required by applicable law or agreed to in writing, software
5085 * distributed under the License is distributed on an 'AS IS' BASIS,
5086 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5087 * See the License for the specific language governing permissions and
5088 * limitations under the License.
5089 */var Gm,Hm,zm,Vm,Wm,qm;const Ps=Symbol("materials"),qc=Symbol("hierarchy"),jm=Symbol("roots"),Pi=Symbol("primitives"),cE=Symbol("prepareVariantsForExport"),lE=Symbol("switchVariant"),uf=Symbol("materialFromPoint"),df=Symbol("nodeFromPoint"),hE=Symbol("nodeFromIndex"),dn=Symbol("variantData"),ff=Symbol("availableVariants"),zu=Symbol("modelOnUpdate"),Xm=Symbol("cloneMaterial");class xB{constructor(e,t,n,i){this.gltf=e,this.gltfElementMap=t,this.mapKey=n,this.doLazyLoad=i}}class Km{constructor(e,t=()=>{}){this[Gm]=new Array,this[Hm]=new Array,this[zm]=new Array,this[Vm]=new Array,this[Wm]=()=>{},this[qm]=new Map,this[zu]=t;const{gltf:n,threeGLTF:i,gltfElementMap:s}=e;for(const[c,l]of n.materials.entries()){const h=s.get(l);if(h!=null)this[Ps].push(new Gu(t,c,!0,this[dn],h,l.name));else{const d=(n.materials||[])[c],f=new Set;s.set(d,f);const p=async()=>{const m=await i.parser.getDependency("material",c);return f.add(m),m};this[Ps].push(new Gu(t,c,!1,this[dn],f,l.name,new xB(n,s,d,p)))}}const a=new Map,o=new Array;for(const c of i.scene.children)o.push(c);for(;o.length>0;){const c=o.pop();let l=null;c instanceof at?(l=new Hu(c,this.materials,this[dn],e),this[Pi].push(l)):l=new oE(c.name);const h=a.get(c);h!=null?h.children.push(l):this[jm].push(l),this[qc].push(l);for(const u of c.children)o.push(u),a.set(c,l)}}get materials(){return this[Ps]}[(Gm=Ps,Hm=qc,zm=jm,Vm=Pi,Wm=zu,qm=dn,ff)](){const e=Array.from(this[dn].values());return e.sort((t,n)=>t.index-n.index),e.map(t=>t.name)}getMaterialByName(e){const t=this[Ps].filter(n=>n.name===e);return t.length>0?t[0]:null}[hE](e,t){const n=this[qc].find(i=>{if(i instanceof Hu){const{meshes:s,primitives:a}=i.mesh.userData.associations;if(s==e&&a==t)return!0}return!1});return n??null}[df](e){const t=this[qc].find(n=>n instanceof Hu&&n.mesh===e.object);return t||null}[uf](e){const t=this[df](e);return t?t.getActiveMaterial():null}async[lE](e){for(const t of this[Pi])await t.enableVariant(e);for(const t of this.materials)t[fo](!1);for(const t of this[Pi])this.materials[t.getActiveMaterial().index][fo](!0)}async[cE](){const e=new Array;for(const t of this[Pi])e.push(t.instantiateVariants());await Promise.all(e)}[Xm](e,t){const n=this.materials[e];n.isLoaded||console.error(`Cloning an unloaded material,
5090           call 'material.ensureLoaded() before cloning the material.`);const i=n[Xe],s=new Set;for(const[o,c]of i.entries()){const l=c.clone();l.name=t+(i.size>1?"_inst"+o:""),s.add(l)}const a=new Gu(this[zu],this[Ps].length,!1,this[dn],s,t);return this[Ps].push(a),a}createMaterialInstanceForVariant(e,t,n,i=!0){let s=null;for(const a of this[Pi]){const o=this[dn].get(n);o!=null&&a.variantInfo.has(o.index)||a.getMaterial(e)!=null&&(this.hasVariant(n)||this.createVariant(n),s==null&&(s=this[Xm](e,t)),a.addVariant(s,n))}if(i&&s!=null){s[fo](!0),this.materials[e][fo](!1);for(const a of this[Pi])a.enableVariant(n)}return s}createVariant(e){this[dn].has(e)?console.warn(`Variant '${e}'' already exists`):this[dn].set(e,{name:e,index:this[dn].size})}hasVariant(e){return this[dn].has(e)}setMaterialToVariant(e,t){if(this[ff]().find(n=>n===t)==null){console.warn(`Can't add material to '${t}', the variant does not exist.'`);return}if(e<0||e>=this.materials.length){console.error("setMaterialToVariant(): materialIndex is out of bounds.");return}for(const n of this[Pi]){const i=n.getMaterial(e);i!=null&&n.addVariant(i,t)}}updateVariantName(e,t){const n=this[dn].get(e);n!=null&&(n.name=t,this[dn].set(t,n),this[dn].delete(e))}deleteVariant(e){const t=this[dn].get(e);if(t!=null){for(const n of this.materials)n.hasVariant(e)&&n[ea].delete(t.index);for(const n of this[Pi])n.deleteVariant(t.index);this[dn].delete(e)}}}/* @license
5091 * Copyright 2020 Google LLC. All Rights Reserved.
5092 * Licensed under the Apache License, Version 2.0 (the 'License');
5093 * you may not use this file except in compliance with the License.
5094 * You may obtain a copy of the License at
5095 *
5096 *     http://www.apache.org/licenses/LICENSE-2.0
5097 *
5098 * Unless required by applicable law or agreed to in writing, software
5099 * distributed under the License is distributed on an 'AS IS' BASIS,
5100 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5101 * See the License for the specific language governing permissions and
5102 * limitations under the License.
5103 */var Vu=function(r,e,t,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var o=r.length-1;o>=0;o--)(a=r[o])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s};const gl=Symbol("currentGLTF"),ml=Symbol("originalGltfJson"),zs=Symbol("model"),$a=Symbol("extraModels"),jc=Symbol("getOnUpdateMethod"),Ya=Symbol("buildTexture"),EB=r=>{var e,t,n,i;class s extends r{constructor(){super(...arguments),this[e]=void 0,this[t]=[],this[n]=null,this[i]=null,this.variantName=null,this.orientation="0 0 0",this.scale="1 1 1"}get model(){return this[zs]}get extraModels(){return this[$a]}get availableVariants(){return this.model?this.model[ff]():[]}get originalGltfJson(){return this[ml]}[(e=zs,t=$a,n=gl,i=ml,jc)](){return()=>{this[tn]()}}[Ya](o){return o.colorSpace=mt,o.wrapS=ni,o.wrapT=ni,new iE(this[jc](),o)}async createTexture(o,c="image/png"){const{textureUtils:l}=this[ot],h=await l.loadImage(o,this.withCredentials,c),u=c==="image/ktx2"?"image/png":c;return h.userData.mimeType=u,this[Ya](h)}async createLottieTexture(o,c=1){const{textureUtils:l}=this[ot],h=await l.loadLottie(o,c,this.withCredentials);return this[Ya](h)}createVideoTexture(o){const c=document.createElement("video");c.crossOrigin=this.withCredentials?"use-credentials":"anonymous",c.src=o,c.muted=!0,c.playsInline=!0,c.loop=!0,c.play();const l=new Bv(c);return this[Ya](l)}createCanvasTexture(){const o=document.createElement("canvas"),c=new Ql(o);return this[Ya](c)}async updated(o){if(super.updated(o),o.has("variantName")){const c=this[rr].beginActivity("variant-update");c(.1);const l=this[zs],{variantName:h}=this;l!=null&&(await l[lE](h),this[tn](),this.dispatchEvent(new CustomEvent("variant-applied"))),c(1)}if(o.has("orientation")||o.has("scale")){if(!this.loaded)return;const c=this[J];c.applyTransform(),c.updateBoundingBox(),c.updateShadow(),this[ot].arRenderer.onUpdateScene(),this[tn]()}}[bi](){super[bi]();const{currentGLTFs:o}=this[J],c=o.length>0?o[0]:null;if(c!=null){const{correlatedSceneGraph:h}=c;h!=null&&c!==this[gl]&&(this[zs]=new Km(h,this[jc]()),this[ml]=JSON.parse(JSON.stringify(h.gltf))),"variants"in c.userData&&this.requestUpdate("variantName")}this[$a]=[];const l=Array.from(this.querySelectorAll("extra-model"));for(let h=1;h<o.length;h++){const u=o[h];if(u!=null&&u.correlatedSceneGraph!=null){const d=new Km(u.correlatedSceneGraph,this[jc]());this[$a].push(d),l[h-1]&&(l[h-1].model=d)}}this[gl]=c}async exportScene(o){const c=this[J];return new Promise(async(l,h)=>{const u={binary:!0,onlyVisible:!0,maxTextureSize:1/0,includeCustomExtensions:!1,forceIndices:!1};Object.assign(u,o),u.animations=c.animations,u.truncateDrawRange=!0;const d=c.shadow;let f=!1;d!=null&&(f=d.visible,d.visible=!1),await this[zs][cE]();const p=new So().register(A=>new N1(A));p.setTextureUtils({decompress:(A,g)=>F1(A,g??1/0,void 0)});let m;if(c.models.length>1){m=new ht;for(const A of c.models)m.add(A)}else m=c.models[0];p.parse(m,A=>{if(c.models.length>1)for(const g of c.models)c.target.add(g);else c.target.add(c.models[0]);return l(new Blob([u.binary?A:JSON.stringify(A)],{type:u.binary?"application/octet-stream":"application/json"}))},()=>h("glTF export failed"),u),d!=null&&(d.visible=f)})}materialFromPoint(o,c){const l=this[J],h=l.getNDC(o,c),u=l.hitFromPoint(h);if(u==null||u.face==null)return null;const d=this[zs];if(d!=null){const f=d[uf](u);if(f!=null)return f}for(const f of this[$a]){const p=f[uf](u);if(p!=null)return p}return null}}return Vu([Re({type:String,attribute:"variant-name"})],s.prototype,"variantName",void 0),Vu([Re({type:String,attribute:"orientation"})],s.prototype,"orientation",void 0),Vu([Re({type:String,attribute:"scale"})],s.prototype,"scale",void 0),s};/* @license
5104 * Copyright 2023 Google LLC. All Rights Reserved.
5105 * Licensed under the Apache License, Version 2.0 (the 'License');
5106 * you may not use this file except in compliance with the License.
5107 * You may obtain a copy of the License at
5108 *
5109 *     http://www.apache.org/licenses/LICENSE-2.0
5110 *
5111 * Unless required by applicable law or agreed to in writing, software
5112 * distributed under the License is distributed on an 'AS IS' BASIS,
5113 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5114 * See the License for the specific language governing permissions and
5115 * limitations under the License.
5116 */class _B extends at{constructor(){super(void 0,new pn({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&&this.geometry!=null&&this.map!=null}updateGeometry(e=this.height,t=this.radius,n=128){(e!=this.height||t!=this.radius||n!=this.resolution)&&(this.height=e,this.radius=t,this.resolution=n,e>0&&t>0&&(this.geometry.dispose(),this.geometry=vB(e,t,n)))}}function vB(r,e,t){const n=new jf(e,2*t,t);n.scale(1,1,-1);const i=n.getAttribute("position"),s=new R;for(let a=0;a<i.count;++a)if(s.fromBufferAttribute(i,a),s.y<0){const o=-r*3/2,c=s.y<o?-r/s.y:1-s.y*s.y/(3*o*o);s.multiplyScalar(c),s.toArray(i.array,3*a)}return i.needsUpdate=!0,n}/* @license
5117 * Copyright 2020 Google LLC. All Rights Reserved.
5118 * Licensed under the Apache License, Version 2.0 (the 'License');
5119 * you may not use this file except in compliance with the License.
5120 * You may obtain a copy of the License at
5121 *
5122 *     http://www.apache.org/licenses/LICENSE-2.0
5123 *
5124 * Unless required by applicable law or agreed to in writing, software
5125 * distributed under the License is distributed on an 'AS IS' BASIS,
5126 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5127 * See the License for the specific language governing permissions and
5128 * limitations under the License.
5129 */const Xc=new R,Wu=new R,qu=new R,Kc=new Qe,$m=new Tn,Ym=new An;class pf extends l1{constructor(e){super(document.createElement("div")),this.normal=new R(0,1,0),this.initialized=!1,this.referenceCount=1,this.pivotEl=document.createElement("div"),this.slot=document.createElement("slot"),this.element.classList.add("annotation-wrapper"),this.slot.name=e.name,this.element.appendChild(this.pivotEl),this.pivotEl.appendChild(this.slot),this.updatePosition(e.position),this.updateNormal(e.normal),this.surface=e.surface,e.modelIndex!=null&&(this.modelIndex=e.modelIndex)}get facingCamera(){return!this.element.classList.contains("hide")}show(){(!this.facingCamera||!this.initialized)&&this.updateVisibility(!0)}hide(){(this.facingCamera||!this.initialized)&&this.updateVisibility(!1)}increment(){this.referenceCount++}decrement(){return this.referenceCount>0&&--this.referenceCount,this.referenceCount===0}updatePosition(e){if(e==null)return;const t=zi(e)[0].terms;for(let n=0;n<3;++n)this.position.setComponent(n,gi(t[n]).number);this.updateMatrixWorld()}updateNormal(e){if(e==null)return;const t=zi(e)[0].terms;for(let n=0;n<3;++n)this.normal.setComponent(n,t[n].number)}updateSurface(){const{mesh:e,tri:t,bary:n}=this;if(e==null||t==null||n==null)return;e.getVertexPosition(t.x,Xc),e.getVertexPosition(t.y,Wu),e.getVertexPosition(t.z,qu),Xc.toArray(Kc.elements,0),Wu.toArray(Kc.elements,3),qu.toArray(Kc.elements,6),this.position.copy(n).applyMatrix3(Kc);const i=this.parent;i.worldToLocal(e.localToWorld(this.position)),$m.set(Xc,Wu,qu),$m.getNormal(this.normal).transformDirection(e.matrixWorld);const s=i.parent;Ym.setFromAxisAngle(Xc.set(0,1,0),-s.rotation.y),this.normal.applyQuaternion(Ym)}orient(e){this.pivotEl.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 n=t,i=n.dataset.visibilityAttribute;if(i!=null){const s=`data-${i}`;n.toggleAttribute(s,e)}n.dispatchEvent(new CustomEvent("hotspot-visibility",{detail:{visible:e}}))}),this.initialized=!0}}const yB={name:"HorizontalBlurShader",uniforms:{tDiffuse:{value:null},h:{value:1/512}},vertexShader:`
5130
5131		varying vec2 vUv;
5132
5133		void main() {
5134
5135			vUv = uv;
5136			gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
5137
5138		}`,fragmentShader:`
5139
5140		uniform sampler2D tDiffuse;
5141		uniform float h;
5142
5143		varying vec2 vUv;
5144
5145		void main() {
5146
5147			vec4 sum = vec4( 0.0 );
5148
5149			sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;
5150			sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;
5151			sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;
5152			sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;
5153			sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;
5154			sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;
5155			sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;
5156			sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;
5157			sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;
5158
5159			gl_FragColor = sum;
5160
5161		}`},SB={name:"VerticalBlurShader",uniforms:{tDiffuse:{value:null},v:{value:1/512}},vertexShader:`
5162
5163		varying vec2 vUv;
5164
5165		void main() {
5166
5167			vUv = uv;
5168			gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
5169
5170		}`,fragmentShader:`
5171
5172		uniform sampler2D tDiffuse;
5173		uniform float v;
5174
5175		varying vec2 vUv;
5176
5177		void main() {
5178
5179			vec4 sum = vec4( 0.0 );
5180
5181			sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;
5182			sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;
5183			sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;
5184			sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;
5185			sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;
5186			sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;
5187			sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;
5188			sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;
5189			sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;
5190
5191			gl_FragColor = sum;
5192
5193		}`};function Jm(r,e,t){return(1-t)*r+t*e}/* @license
5194 * Copyright 2022 Google LLC. All Rights Reserved.
5195 * Licensed under the Apache License, Version 2.0 (the 'License');
5196 * you may not use this file except in compliance with the License.
5197 * You may obtain a copy of the License at
5198 *
5199 *     http://www.apache.org/licenses/LICENSE-2.0
5200 *
5201 * Unless required by applicable law or agreed to in writing, software
5202 * distributed under the License is distributed on an 'AS IS' BASIS,
5203 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5204 * See the License for the specific language governing permissions and
5205 * limitations under the License.
5206 */const Zm=9,CB=6,ju=2,MB=.3;class IB extends ht{constructor(e,t,n){super(),this.camera=new cr,this.renderTarget=null,this.renderTargetBlur=null,this.depthMaterial=new yb,this.horizontalBlurMaterial=new mn(yB),this.verticalBlurMaterial=new mn(SB),this.intensity=0,this.softness=1,this.boundingBox=new fn,this.size=new R,this.maxDimension=0,this.isAnimated=!1,this.needsUpdate=!1;const{camera:i}=this;i.rotation.x=Math.PI/2,i.left=-.5,i.right=.5,i.bottom=-.5,i.top=.5,this.add(i);const s=new zn,a=new pn({opacity:1,transparent:!0,side:on});this.floor=new at(s,a),this.floor.userData.noHit=!0,i.add(this.floor),this.blurPlane=new at(s),this.blurPlane.visible=!1,i.add(this.blurPlane),e.target.add(this),this.depthMaterial.onBeforeCompile=function(o){o.fragmentShader=o.fragmentShader.replace(/gl_FragColor\s*=\s*vec4\(\s*vec3\(\s*1\.0\s*-\s*fragCoordZ\s*\),\s*
5206opacity\s*\);/,"gl_FragColor = vec4( vec3( 0.0 ), ( 1.0 - fragCoordZ ) * opacity );")},this.depthMaterial.side=qt,this.horizontalBlurMaterial.depthTest=!1,this.verticalBlurMaterial.depthTest=!1,this.setScene(e,t,n)}setScene(e,t,n){const{boundingBox:i,size:s,rotation:a,position:o}=this;if(this.isAnimated=e.animationNames.length>0,this.boundingBox.copy(e.boundingBox),this.size.copy(e.size),this.maxDimension=Math.max(s.x,s.y,s.z)*(this.isAnimated?ju:1),this.boundingBox.getCenter(o),n==="back"){const{min:c,max:l}=i;[c.y,c.z]=[c.z,c.y],[l.y,l.z]=[l.z,l.y],[s.y,s.z]=[s.z,s.y],a.x=Math.PI/2,a.y=Math.PI}else a.x=0,a.y=0;if(this.isAnimated){const c=i.min.y,l=i.max.y;s.y=this.maxDimension,i.expandByVector(s.subScalar(this.maxDimension).multiplyScalar(-.5)),i.min.y=c,i.max.y=l,s.set(this.maxDimension,l-c,this.maxDimension)}n==="bottom"?o.y=i.min.y:o.z=i.min.y,this.setSoftness(t)}setSoftness(e){this.softness=e;const{size:t,camera:n}=this,i=this.isAnimated?ju:1,s=i*Math.pow(2,Zm-e*(Zm-CB));this.setMapSize(s);const a=t.y/2,o=t.y*i;n.near=0,n.far=Jm(o,a,e),this.depthMaterial.opacity=1/e,n.updateProjectionMatrix(),this.setIntensity(this.intensity),this.setOffset(0)}setMapSize(e){const{size:t}=this;this.isAnimated&&(e*=ju);const n=Math.floor(t.x>t.z?e:e*t.x/t.z),i=Math.floor(t.x>t.z?e*t.z/t.x:e),s=10,a=s+n,o=s+i;if(this.renderTarget!=null&&(this.renderTarget.width!==a||this.renderTarget.height!==o)&&(this.renderTarget.dispose(),this.renderTarget=null,this.renderTargetBlur.dispose(),this.renderTargetBlur=null),this.renderTarget==null){const h={format:Tt};this.renderTarget=new Sn(a,o,h),this.renderTargetBlur=new Sn(a,o,h),this.floor.material.map=this.renderTarget.texture}const c=t.x*(1+s/n),l=t.z*(1+s/i);this.camera.left=-c/2,this.camera.right=c/2,this.camera.bottom=-l/2,this.camera.top=l/2,this.camera.scale.set(1,1,1),this.floor.scale.set(c,l,1),this.blurPlane.scale.set(c,l,1),this.needsUpdate=!0}setIntensity(e){this.intensity=e,e>0?(this.visible=!0,this.floor.visible=!0,this.floor.material.opacity=e*Jm(MB,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,this.floor.visible=!1;const n=e.xr.enabled;e.xr.enabled=!1;const i=e.getRenderTarget();e.setRenderTarget(this.renderTarget);const s=e.getClearAlpha();e.setClearAlpha(0);const a=e.state;a!=null&&(a.buffers.color.setMask(!0),a.buffers.depth.setMask(!0)),e.clear();const o=e.autoClear;e.autoClear=!1,e.render(t,this.camera),e.autoClear=o,t.overrideMaterial=null,this.floor.visible=!0,this.blurShadow(e),e.xr.enabled=n,e.setRenderTarget(i),e.setClearAlpha(s)}blurShadow(e){const{camera:t,horizontalBlurMaterial:n,verticalBlurMaterial:i,renderTarget:s,renderTargetBlur:a,blurPlane:o}=this;o.visible=!0,o.material=n,n.uniforms.h.value=1/this.renderTarget.width,n.uniforms.tDiffuse.value=this.renderTarget.texture,e.setRenderTarget(a),e.render(o,t),o.material=i,i.uniforms.v.value=1/this.renderTarget.height,i.uniforms.tDiffuse.value=this.renderTargetBlur.texture,e.setRenderTarget(s),e.render(o,t),o.visible=!1}dispose(){this.renderTarget!=null&&this.renderTarget.dispose(),this.renderTargetBlur!=null&&this.renderTargetBlur.dispose(),this.depthMaterial.dispose(),this.horizontalBlurMaterial.dispose(),this.verticalBlurMaterial.dispose(),this.floor.material.dispose(),this.floor.geometry.dispose(),this.blurPlane.geometry.dispose(),this.removeFromParent()}}/* @license
5207 * Copyright 2025 Google LLC. All Rights Reserved.
5208 * Licensed under the Apache License, Version 2.0 (the 'License');
5209 * you may not use this file except in compliance with the License.
5210 * You may obtain a copy of the License at
5211 *
5212 *     http://www.apache.org/licenses/LICENSE-2.0
5213 *
5214 * Unless required by applicable law or agreed to in writing, software
5215 * distributed under the License is distributed on an 'AS IS' BASIS,
5216 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5217 * See the License for the specific language governing permissions and
5218 * limitations under the License.
5219 */const e0=10,Xu=100,Ku=new R,t0=new R,n0=new R,$c=new $y,wB=new R,Ja=new pe;class TB extends xs{constructor({canvas:e,element:t,width:n,height:i}
5219){super(),this.annotationRenderer=new h1,this.effectRenderer=null,this.schemaElement=document.createElement("script"),this.width=1,this.height=1,this.aspect=1,this.scaleStep=0,this.renderCount=0,this.externalRenderer=null,this.appendedAnimations=[],this.markedAnimations=[],this.camera=new Zt(45,1,.1,100),this.xrCamera=null,this.url=null,this.extraUrls=[],this.scenePivot=new ht,this.target=new ht,this.animationNames=[],this.boundingBox=new fn,this.boundingSphere=new Vn,this.size=new R,this.idealAspect=0,this.framedFoVDeg=0,this.shadow=null,this.shadowIntensity=0,this.shadowSoftness=1,this.bakedShadows=new Set,this.exposure=1,this.toneMapping=sa,this.canScale=!0,this.isDirty=!1,this.goalTarget=new R,this.targetDamperX=new an,this.targetDamperY=new an,this.targetDamperZ=new an,this._currentGLTFs=[],this._models=[],this.boundsAndShadowDirty=!1,this.mixers=[],this.mixerPausedStates=[],this.cancelPendingSourceChange=null,this.animationsByName=new Map,this.currentAnimationActions=[],this.groundedSkybox=new _B,this.name="ModelScene",this.element=t,this.canvas=e,this.camera=new Zt(45,1,.1,100),this.camera.name="MainCamera",this.add(this.scenePivot),this.scenePivot.name="Pivot",this.scenePivot.add(this.target),this.setSize(n,i),this.target.name="Target",this.mixers=[];const{domElement:s}=this.annotationRenderer,{style:a}=s;a.display="none",a.pointerEvents="none",a.position="absolute",a.top="0",this.element.shadowRoot.querySelector(".default").appendChild(s),this.schemaElement.setAttribute("type","application/ld+json")}get context(){return this.canvas.getContext("2d")}getCamera(){return this.xrCamera!=null?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._models=[e],this.target.add(e),await this.setupScene()}async setSource(e,t=[],n=()=>{}){if((!e||e===this.url)&&t.join(",")===this.extraUrls.join(",")){n(1);return}if(this.reset(),this.url=e,this.extraUrls=t,this.externalRenderer!=null){const c=await this.externalRenderer.load(n);this.boundingSphere.radius=c.framedRadius,this.idealAspect=c.fieldOfViewAspect;return}this.cancelPendingSourceChange!=null&&(this.cancelPendingSourceChange(),this.cancelPendingSourceChange=null);let i=[];try{const c=[];e&&c.push(e),t&&c.push(...t),c.length>0&&(i=await new Promise((l,h)=>{this.cancelPendingSourceChange=()=>h(),(async()=>{try{const u=await Promise.all(c.map(d=>this.element[ot].loader.load(d,this.element,n)));l(u)}catch(u){h(u)}})()}))}catch(c){if(c==null)return;throw c}this.cancelPendingSourceChange=null,this.reset(),this.url=e,this.extraUrls=t,this._currentGLTFs=i;for(const c of i)c!=null?(this._models.push(c.scene),this.target.add(c.scene),this.mixers.push(new _A(c.scene)),this.mixerPausedStates.push(!1),this.currentAnimationActions.push(null)):(this.mixers.push(new _A(this.target)),this.mixerPausedStates.push(!1),this.currentAnimationActions.push(null));const s=new Map,a=[],o=[];for(const c of i)for(const l of c.animations||[])s.set(l.name,l),a.push(l.name),o.push(l);this.animations=o,this.animationsByName=s,this.animationNames=a,await this.setupScene()}async setupScene(){this.applyTransform(),this.updateBoundingBox(),await this.updateFraming(),this.updateShadow(),this.setShadowIntensity(this.shadowIntensity),this.setGroundedSkybox()}updateModelTransforms(e,t,n,i){const s=this._models[e];if(s){if(t){const a=t.split(" ").map(o=>o.trim()).filter(o=>o.length>0).map(Number);a.length===3&&!a.some(isNaN)&&s.position.set(a[0],a[1],a[2])}if(i){const a=i.split(" ").map(o=>o.trim()).filter(o=>o.length>0).map(Number);a.length===1&&!isNaN(a[0])?s.scale.setScalar(a[0]):a.length===3&&!a.some(isNaN)&&s.scale.set(a[0],a[1],a[2])}s.updateMatrixWorld(!0),this.boundsAndShadowDirty=!0,this.queueRender()}}updateBoundingBoxAndShadowIfDirty(){this.boundsAndShadowDirty&&(this.boundsAndShadowDirty=!1,this.updateBoundingBox(),this.updateShadow())}reset(){this.url=null,this.renderCount=0,this.queueRender(),this.shadow!=null&&this.shadow.setIntensity(0),this.bakedSha
5219dows.clear();const{_models:e}=this;for(const n of e)n!=null&&n.removeFromParent();this._models=[];const t=this._currentGLTFs;for(const n of t)n!=null&&n.dispose();this._currentGLTFs=[];for(const n of this.currentAnimationActions)n!=null&&n.stop();this.currentAnimationActions=[];for(const n of this.mixers)n.stopAllAction(),n.uncacheRoot(this);this.mixers=[],this.mixerPausedStates=[]}dispose(){this.reset(),this.shadow!=null&&(this.shadow.dispose(),this.shadow=null),this.element[gl]=null,this.element[ml]=null,this.element[zs]=null}get currentGLTF(){return this._currentGLTFs[0]||null}get currentGLTFs(){return this._currentGLTFs}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,this.externalRenderer!=null){const n=window.devicePixelRatio;this.externalRenderer.resize(e*n,t*n)}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 fn;e.traverse(n=>{const i=n;if(!i.material||!i.material.transparent)return;t.setFromObject(i);const a=t.getSize(wB),o=Math.min(a.x,a.y,a.z);Math.max(a.x,a.y,a.z)<Xu*o||this.markBakedShadow(i)})}checkBakedShadows(){const{min:e,max:t}=this.boundingBox,n=new fn;this.boundingBox.getSize(this.size);for(const i of this.bakedShadows)n.setFromObject(i),!(n.min.y<e.y+this.size.y/Xu&&n.min.x<=e.x&&n.max.x>=t.x&&n.min.z<=e.z&&n.max.z>=t.z)&&(n.min.z<e.z+this.size.z/Xu&&n.min.x<=e.x&&n.max.x>=t.x&&n.min.y<=e.y&&n.max.y>=t.y||this.unmarkBakedShadow(i))}applyTransform(){const{models:e}=this;if(e.length===0)return;const t=zi(this.element.orientation)[0].terms,n=gi(t[0]).number,i=gi(t[1]).number,s=gi(t[2]).number,a=zi(this.element.scale)[0].terms;for(const o of e)o.quaternion.setFromEuler(new Hn(i,s,n,"YXZ")),o.scale.set(a[0].number,a[1].number,a[2].number)}updateBoundingBox(){const{models:e}=this;if(e.length===0)return;for(const i of e)this.target.remove(i),this.findBakedShadows(i);const t=(i,s)=>i.expandByPoint(s);this.setBakedShadowVisibility(!1);let n=new fn;for(const i of e)n=Bc(i,t,n);if(this.boundingBox=n,this.boundingBox.isEmpty()){this.setBakedShadowVisibility(!0),this.bakedShadows.forEach(i=>this.unmarkBakedShadow(i)),n=new fn;for(const i of e)n=Bc(i,t,n);this.boundingBox=n}this.checkBakedShadows(),this.setBakedShadowVisibility(),this.boundingBox.getSize(this.size);for(const i of e)this.target.add(i)}async updateFraming(){const{models:e}=this;if(e.length===0)return;for(const o of e)this.target.remove(o);this.setBakedShadowVisibility(!1);const{center:t}=this.boundingSphere;this.element.requestUpdate("cameraTarget"),await this.element.updateComplete,t.copy(this.getTarget());const n=(o,c)=>Math.max(o,t.distanceToSquared(c));let i=0;for(const o of e)i=Math.max(i,Bc(o,n,0));this.boundingSphere.radius=Math.sqrt(i);const s=(o,c)=>{c.sub(t);const l=Math.sqrt(c.x*c.x+c.z*c.z);return Math.max(o,l/(this.idealCameraDistance()-Math.abs(c.y)))};let a=0;for(const o of e)a=Math.max(a,Bc(o,s,0));this.idealAspect=a/Math.tan(this.framedFoVDeg/2*Math.PI/180),this.setBakedShadowVisibility();for(const o of e)this.target.add(o)}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(this.xrCamera!=null)Ja.set(e/window.screen.width,t/window.screen.height);else{const n=this.element.getBoundingClientRect();Ja.set((e-n.x)/this.width,(t-n.y)/this.height)}return Ja.multiplyScalar(2).subScalar(1),Ja.y*=-1,Ja}getSize(){return{width:this.width,height:this.height}}setEnvironmentAndSkybox(e,t){this.element[ot].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*(this.groundedSkybox.parent!=null?e0:1)}setGroundedSkybox(){const e=zi(this.element.skyboxHeight)[0].terms[0],t=gi(e).number,n=e0*this.boundingSphere.radius;this.groundedSkybox.updateGeometry(t,n),this.groundedSkybox.position.y=t-(this.shadow?2*this.shadow.gap():0),this.setBackgroun
5219d(this.groundedSkybox.map)}setTarget(e,t,n){this.goalTarget.set(-e,-t,-n)}setTargetDamperDecayTime(e){this.targetDamperX.setDecayTime(e),this.targetDamperY.setDecayTime(e),this.targetDamperZ.setDecayTime(e)}getTarget(){return this.goalTarget.clone().multiplyScalar(-1)}getDynamicTarget(){return this.target.position.clone().multiplyScalar(-1)}jumpToGoal(){this.updateTarget(Nx)}updateTarget(e){const t=this.goalTarget,n=this.target.position;if(t.equals(n))return!1;{const i=this.boundingSphere.radius/10;let{x:s,y:a,z:o}=n;return s=this.targetDamperX.update(s,t.x,e,i),a=this.targetDamperY.update(a,t.y,e,i),o=this.targetDamperZ.update(o,t.z,e,i),this.groundedSkybox.position.x=-s,this.groundedSkybox.position.z=-o,this.target.position.set(s,a,o),this.target.updateMatrixWorld(),this.queueRender(),!0}}pointTowards(e,t){const{x:n,z:i}=this.position;this.yaw=Math.atan2(e-n,t-i)}get model(){return this._models[0]||null}get models(){return this._models}set yaw(e){this.scenePivot.rotation.y=e,this.groundedSkybox.rotation.y=-e,this.queueRender()}get yaw(){return this.scenePivot.rotation.y}set animationTime(e){for(const t of this.mixers)t.setTime(e);this.queueShadowRender()}get animationTime(){let e=0;for(const t of this.currentAnimationActions)if(t!=null){let n=t.time;const i=Math.max(t._loopCount,0);t.loop===Dl&&(i&1)===1&&(n=(t.getClip()?t.getClip().duration:0)-t.time),n>e&&(e=n)}return e}set animationTimeScale(e){for(const t of this.mixers)t.timeScale=e}get animationTimeScale(){return this.mixers.length>0?this.mixers[0].timeScale:1}get duration(){let e=0;for(const t of this.currentAnimationActions)if(t!=null&&t.getClip()){const n=t.getClip().duration;n>e&&(e=n)}return e}get hasActiveAnimation(){return this.currentAnimationActions.some(e=>e!=null)}playAnimation(e=null,t=0,n=Yr,i=1/0,s=null){const a=s??0,o=s!=null?s+1:this._models.length;for(let c=a;c<o;c++){const l=this._currentGLTFs[c];if(l==null)continue;const h=l.animations||[];if(h.length===0)continue;let u=null;if(e!=null){for(let d=h.length-1;d>=0;d--)if(h[d].name===e){u=h[d];break}if(u==null){const d=parseInt(e);!isNaN(d)&&d>=0&&d<h.length&&(u=h[d])}}u==null&&(u=h[0]);try{const d=this.currentAnimationActions[c],f=this.mixers[c],p=f.clipAction(u,this._models[c]);this.currentAnimationActions[c]=p,this.element.paused?(f.stopAllAction(),this.mixerPausedStates[c]=!0):(p.paused=!1,this.mixerPausedStates[c]=!1,d!=null&&p!==d?p.crossFadeFrom(d,t,!1):this.animationTimeScale>0&&this.animationTime==this.duration&&(this.animationTime=0)),p.setLoop(n,i),p.enabled=!0,p.clampWhenFinished=!0,p.play()}catch(d){console.error(d)}}}appendAnimation(e="",t=Yr,n=1/0,i=1,s=1,a=!1,o=!1,c=!0,l=null,h=!1,u=null){if(this.currentGLTF==null||e===this.element.animationName)return;const{animations:d}=this;if(d==null||d.length===0)return;const f=e?this.animationsByName.get(e):null;if(f==null)return;if(typeof n=="string"?isNaN(parseFloat(n))?(n=1/0,console.warn(`Invalid repetitionCount value: ${n}. Using default: Infinity`)):(parseInt(n)<1&&console.warn(`Invalid repetitionCount value: ${n}. Using 1 as minimum.`),n=Math.max(parseInt(n),1)):typeof n=="number"&&n<1?(n=1,console.warn(`Invalid repetitionCount value: ${n}. Using  1 value as minimum.`)):console.warn(`Invalid repetitionCount value: ${n}. Using default: Infinity`),n===1&&t!==Po&&(t=Po),typeof i=="string"){const x=parseFloat(i);isNaN(x)||x<0||x>1?(i=1,console.warn(`Invalid weight value: ${i}. Using default: 1`)):i=x}if(typeof s=="string"){const x=parseFloat(s);isNaN(x)||x<0?(s=1,console.warn(`Invalid timeScale value: ${s}. Using default: 1`)):s=x}if(typeof l=="string"){const x=parseFloat(l);isNaN(x)?(l=null,console.warn(`Invalid time value: ${l}. Using default: 0 or previous time`)):l=x}const{shouldFade:p,duration:m}=this.parseFadeValue(a,!1,1.25),A=1.25;let g=!1,b=0;typeof o=="boolean"?(g=o,b=o?A:0):typeof o=="number"?(g=o>0,b=Math.max(o,0),o<0&&console.warn(`Invalid warp value: ${o}. Using default: false`)):typeof o=="string"&&(o.toLowerCase().trim()==="true"?(g=!0,b=A):o.toLowerCase().trim()==="false"?g=!1:isNaN(parseFloat(o))?console.warn(`Invalid warp value: ${o}. Using default: false`):(b=Math.max(parseFloat(o),0),g=b>0,b<=0&&console.warn(`Invalid warp value: ${o}. Using default: false`)));try{h&&this.appendedAnimations.includes(e)&&(this.markedAnimations.map(v=>
5219v.name).includes(e)||this.markedAnimations.push({name:e,loopMode:t,repetitionCount:n}));const x=u??0,_=u!=null?u+1:this.mixers.length;for(let v=x;v<_;v++){const C=this.mixers[v],I=C.existingAction(f)||C.clipAction(f,this._models[v]||this),E=I.timeScale;typeof l=="number"&&(I.time=Math.min(Math.max(l,0),f.duration)),p?I.fadeIn(m):i>=0&&(I.weight=Math.min(Math.max(i,0),1)),g?I.warp(c?E:0,s,b):I.timeScale=s,I.isRunning()||(I.time==f.duration&&I.stop(),I.setLoop(t,n),I.paused=!1,I.enabled=!0,I.clampWhenFinished=!0,I.play())}this.appendedAnimations.includes(e)||this.element[J].appendedAnimations.push(e)}catch(x){console.error(x)}}parseFadeValue(e,t=!0,n=1.5){const i=s=>s.toLowerCase().trim();if(typeof e=="boolean")return{shouldFade:e,duration:e?n:0};if(typeof e=="number"){const s=Math.max(e,0);return{shouldFade:s>0,duration:s}}if(typeof e=="string"){const s=i(e);if(s==="true")return{shouldFade:!0,duration:n};if(s==="false")return{shouldFade:!1,duration:0};const a=parseFloat(s);if(!isNaN(a)){const o=Math.max(a,0);return{shouldFade:o>0,duration:o}}}return console.warn(`Invalid fade value: ${e}. Using default: ${t}`),{shouldFade:t,duration:t?n:0}}detachAnimation(e="",t=!0,n=null){if(this.currentGLTF==null||e===this.element.animationName)return;const{animations:i}=this;if(i==null||i.length===0)return;const s=e?this.animationsByName.get(e):null;if(s==null)return;const{shouldFade:a,duration:o}=this.parseFadeValue(t,!0,1.5);try{const c=n??0,l=n!=null?n+1:this.mixers.length;for(let h=c;h<l;h++){const u=this.mixers[h],d=u.existingAction(s)||u.clipAction(s,this._models[h]||this);a?d.fadeOut(o):d.stop()}this.element[J].appendedAnimations=this.element[J].appendedAnimations.filter(h=>h!==e)}catch(c){console.error(c)}}updateAnimationLoop(e="",t=Yr,n=1/0,i=null){if(this.currentGLTF==null||e===this.element.animationName)return;const{animations:s}=this;if(s==null||s.length===0)return;let a=null;if(e&&(a=this.animationsByName.get(e)),a!=null)try{const o=i??0,c=i!=null?i+1:this.mixers.length;for(let l=o;l<c;l++){const h=this.mixers[l],u=h.existingAction(a)||h.clipAction(a,this._models[l]||this);u.stop(),u.setLoop(t,n),u.play()}}catch(o){console.error(o)}}stopAnimation(){this.currentAnimationActions.fill(null);for(const e of this.mixers)e.stopAllAction();this.mixerPausedStates.fill(!0)}isAllAnimationsPaused(){return this.mixerPausedStates.every(e=>e)}pauseAnimation(e=null){const t=e??0,n=e!=null?e+1:this.mixers.length;for(let i=t;i<n;i++)this.mixerPausedStates[i]=!0}unpauseAnimation(e=null){const t=e??0,n=e!=null?e+1:this.mixers.length;for(let i=t;i<n;i++)this.mixerPausedStates[i]=!1}updateAnimation(e){for(let t=0;t<this.mixers.length;t++)this.mixerPausedStates[t]||this.mixers[t].update(e);this.queueShadowRender()}subscribeMixerEvent(e,t){for(const n of this.mixers)n.addEventListener(e,t)}updateShadow(){const e=this.shadow;if(e!=null){const t=this.element.arPlacement==="wall"?"back":"bottom";e.setScene(this,this.shadowSoftness,t),e.needsUpdate=!0}}renderShadow(e){this.updateBoundingBoxAndShadowIfDirty();const t=this.shadow;t!=null&&t.needsUpdate==!0&&(t.render(e,this),t.needsUpdate=!1)}queueShadowRender(){this.shadow!=null&&(this.shadow.needsUpdate=!0)}setShadowIntensity(e){if(this.shadowIntensity=e,this.currentGLTF!=null&&(this.setBakedShadowVisibility(),!(e<=0&&this.shadow==null))){if(this.shadow==null){const t=this.element.arPlacement==="wall"?"back":"bottom";this.shadow=new IB(this,this.shadowSoftness,t)}this.shadow.setIntensity(e)}}setShadowSoftness(e){this.shadowSoftness=e;const t=this.shadow;t!=null&&t.setSoftness(e)}setShadowOffset(e){const t=this.shadow;t!=null&&t.setOffset(e)}getHit(e=this){return $c.intersectObject(e,!0).find(n=>n.object.visible&&!n.object.userData.noHit)}hitFromController(e,t=this){return $c.setFromXRController(e),this.getHit(t)}hitFromPoint(e,t=this){return $c.setFromCamera(e,this.getCamera()),this.getHit(t)}getModelIndexFromHit(e){let t=e.object;for(;t!=null;){const n=this.models.indexOf(t);if(n!==-1)return n;t=t.parent}return 0}positionAndNormalFromPoint(e,t=this){var n;const i=this.hitFromPoint(e,t);if(i==null)return null;const s=i.point,a=i.face!=null?i.face.normal.clone().applyNormalMatrix(new Qe().getNormalMatrix(i.object.matrixWorld)):$c.ray.direction.clone().multiplyScalar(-1),o=(n=i.uv)!==null&&n!==void 0?n:null,c=this.getModelIndexFromHit(i),l=this.models[c]||this.target,h=new Oe().copy(l.matrixWorld).invert();return{position:s,normal:a,uv:o,modelIndex:c,worldToModel:h}}surfaceFromPoint(e,t=this){var n;const i=this.hitFromPoint(e,t);if(i==null||i.face==null)return null;const s=this.getModelIndexFromHit(i),a=s===0?this.element.model:(n=this.element.extraModels)===null||n===void 0?void 0:n[s-1];if(a==null)return null;const o=a[df](i);if(o==null)return null;const{meshes:c,primitives:l}=o.mesh.userData.associations,h=new R,u=new R,d=new R,{a:f,b:p,c:m}=i.face,A=i.object;A.getVertexPosition(f,h),A.getVertexPosition(p,u),A.getVertexPosition(m,d);const g=new Tn(h,u,d),b=new R;g.getBarycoord(A.worldToLocal(i.point),b),g.getBarycoord(A.worldToLocal(i.point),b);const x=`${c} ${l} ${f} ${p} ${m} ${b.x.toFixed(3)} ${b.y.toFixed(3)} ${b.z.toFixed(3)}`;return s===0?x:`${s} ${x}`}updateHotspotAttachment(e){const t=e.modelIndex!=null&&e.modelIndex>0&&this._models[e.modelIndex]?this._models[e.modelIndex]:this.target;e.parent!==t&&(t.add(e),e.updatePosition(e.position.toArray().join(" ")+"m"),e.updateMatrixWorld(!0))}addHotspot(e){this.updateHotspotAttachment(e),this.annotationRenderer.domElement.appendChild(e.element),this.updateSurfaceHotspot(e)}removeHotspot(e){e.parent&&e.parent.remove(e)}forHotspots(e){const t=[...this.target.children];for(let n=0,i=t.length;n<i;n++){const s=t[n];s instanceof pf&&e(s)}for(const n of this._models)if(n&&n!==this.target){const i=[...n.children];for(let s=0,a=i.length;s<a;s++){const o=i[s];o instanceof pf&&e(o)}}}updateSurfaceHotspot(e){var t,n;if(e.surface==null)return;const i=zi(e.surface)[0].terms;if(i.length!==8&&i.length!==9){console.warn(e.surface+" does not have exactly 8 or 9 numbers. Did you use an outdated string?");return}const s=i.length===8,a=s?0:i[0].number,o=s?0:1,c=(t=e.modelIndex)!==null&&t!==void 0?t:a;e.modelIndex=c,this.updateHotspotAttachment(e);const l=c===0?this.element.model:(n=this.element.extraModels)===null||n===void 0?void 0:n[c-1];if(l==null)return;const h=l[hE](i[0+o].number,i[1+o].number);
vendor: 4,568 bytes, lines 5219-5245
5219if(h==null){console.warn(e.surface+" does not match a node/primitive in this glTF! Skipping this hotspot.");return}const u=h.mesh.geometry.attributes.position.count,d=new R(i[2+o].number,i[3+o].number,i[4+o].number);if(d.x>=u||d.y>=u||d.z>=u){console.warn(e.surface+" vertex indices out of range in this glTF! Skipping this hotspot.");return}const f=new R(i[5+o].number,i[6+o].number,i[7+o].number);e.mesh=h.mesh,e.tri=d,e.bary=f,e.updateSurface()}animateSurfaceHotspots(){this.element.paused||this.forHotspots(e=>{e.updateSurface()})}updateHotspotsVisibility(e){this.forHotspots(t=>{Ku.copy(e),t0.setFromMatrixPosition(t.matrixWorld),Ku.sub(t0),n0.copy(t.normal).transformDirection(this.target.matrixWorld),Ku.dot(n0)<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:n,element:i}=this,{alt:s,poster:a,iosSrc:o}=i;if(e!=null){const c=[{"@type":"MediaObject",contentUrl:e,encodingFormat:((t=e.split(".").pop())===null||t===void 0?void 0:t.toLowerCase())==="gltf"?"model/gltf+json":"model/gltf-binary"}];o&&c.push({"@type":"MediaObject",contentUrl:o,encodingFormat:"model/vnd.usdz+zip"});const l={"@context":"http://schema.org/","@type":"3DModel",image:a??void 0,name:s??void 0,encoding:c};n.textContent=JSON.stringify(l),document.head.appendChild(n)}else n.parentElement!=null&&n.parentElement.removeChild(n)}}/* @license
5220 * Copyright 2019 Google LLC. All Rights Reserved.
5221 * Licensed under the Apache License, Version 2.0 (the 'License');
5222 * you may not use this file except in compliance with the License.
5223 * You may obtain a copy of the License at
5224 *
5225 *     http://www.apache.org/licenses/LICENSE-2.0
5226 *
5227 * Unless required by applicable law or agreed to in writing, software
5228 * distributed under the License is distributed on an 'AS IS' BASIS,
5229 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5230 * See the License for the specific language governing permissions and
5231 * limitations under the License.
5232 */class RB 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),this.ongoingActivityCount===1&&this.announceTotalProgress(t,0,e),n=>{let i;return i=Math.max(pi(n,0,1),t.progress),i!==t.progress&&this.announceTotalProgress(t,i,e),t.progress}}announceTotalProgress(e,t,n){let i=0,s=0;t==1&&(e.completed=!0);for(const c of this.ongoingActivities){const{progress:l}=c;i+=1-l,c.completed&&s++}const a=e.progress;e.progress=t,this.totalProgress+=(t-a)*(1-this.totalProgress)/i;const o=s===this.ongoingActivityCount?1:this.totalProgress;this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:o,reason:n}})),s===this.ongoingActivityCount&&(this.totalProgress=0,this.ongoingActivities.clear())}}/* @license
5233 * Copyright 2019 Google LLC. All Rights Reserved.
5234 * Licensed under the Apache License, Version 2.0 (the 'License');
5235 * you may not use this file except in compliance with the License.
5236 * You may obtain a copy of the License at
5237 *
5238 *     http://www.apache.org/licenses/LICENSE-2.0
5239 *
5240 * Unless required by applicable law or agreed to in writing, software
5241 * distributed under the License is distributed on an 'AS IS' BASIS,
5242 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5243 * See the License for the specific language governing permissions and
5244 * limitations under the License.
5245 */var lh=function(r,e,t,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var o=r.length-1;o>=0;o--)(a=r[o])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s},i0,s0,r0,a0,o0,c0,l0,h0,u0,d0,f0,p0,A0,g0,m0;const BB=10,DB=50,LB=0,PB=300,FB=150,As=document.createElement("canvas"),$u=Symbol("fallbackResizeHandler"),b0=Symbol("defaultAriaLabel"),Yc=Symbol("resizeObserver"),Or=Symbol("clearModelTimeout"),Yu=Symbol("onContextLost"),Fs=Symbol("loaded"),Ju=Symbol("status"),Zu=Symbol("onFocus"),ed=Symbol("onBlur"),td=Symbol("onSlotChange"),nd=Symbol("onExtraModelChanged"),zr=Symbol("updateSize"),Jc=Symbol("intersectionObserver"),Vs=Symbol("isElementInViewport"),Vl=Symbol("announceModelVisibility"),Xr=Symbol("ariaLabel"),Af=Symbol("altDefaulted"),Za=Symbol("statusElement"),Wl=Symbol("updateStatus"),po=Symbol("loadedT
5245ime"),ls=Symbol("updateSource"),x0=Symbol("markLoaded"),bl=Symbol("container"),Yn=Symbol("input"),gf=Symbol("canvas"),J=Symbol("scene"),tn=Symbol("needsRender"),mi=Symbol("tick"),bi=Symbol("onModelLoad"),ql=Symbol("onResize"),ot=Symbol("renderer"),rr=Symbol("progressTracker"),E0=Symbol("getLoaded"),ar=Symbol("getModelIsVisible"),ma=Symbol("shouldAttemptPreload"),hs=r=>({x:r.x,y:r.y,z:r.z,toString(){return`${this.x}m ${this.y}m ${this.z}m`}}),mf=r=>({u:r.x,v:r.y,toString(){return`${this.u} ${this.v}`}});class Xo extends os{static get is(){return"model-viewer"}static set modelCacheSize(e){vn[as].evictionThreshold=e}static get modelCacheSize(){return vn[as].evictionThreshold}static set minimumRenderScale(e){e>1&&console.warn("<model-viewer> minimumRenderScale has been clamped to a maximum value of 1."),e<=0&&console.warn("<model-viewer> minimumRenderScale has been clamped to a minimum value of 0.25."),kn.singleton.minScale=e}static get minimumRenderScale(){return kn.singleton.minScale}get loaded(){return this[E0]()}get[(i0=Vs,s0=Fs,r0=po,a0=Ju,o0=Or,c0=td,l0=nd,h0=$u,u0=Vl,d0=Yc,f0=Jc,p0=rr,ot)](){return kn.singleton}get modelIsVisible(){return this[ar]()}constructor(){super(),this.alt=null,this.src=null,this.withCredentials=!1,this.generateSchema=!1,this[i0]=!1,this[s0]=!1,this[r0]=0,this[a0]="",this[o0]=null,this[c0]=()=>{if(!this[J])return;const i=Array.from(this.querySelectorAll("extra-model")),s=i.map(o=>o.src).filter(o=>o!=null),a=this[J].extraUrls||[];(s.join(",")!==a.join(",")||i.length!==a.length)&&this[ls]()},this[l0]=i=>{const s=i,a=s.target,c=Array.from(this.querySelectorAll("extra-model")).indexOf(a);if(console.log(`[onExtraModelChanged] childIndex: ${c} srcChanged: ${s.detail.srcChanged} offset: ${s.detail.offset}`),c===-1)return;const l=this.src?c+1:c;s.detail.srcChanged?(this[Fs]=!1,this[ls]()):this[J]&&this[J].updateModelTransforms(l,s.detail.offset,s.detail.orientation,s.detail.scale)},this[h0]=YA(()=>{const i=this.getBoundingClientRect();this[zr](i)},DB),this[u0]=YA(i=>{const s=this.modelIsVisible;s!==i&&this.dispatchEvent(new CustomEvent("model-visibility",{detail:{visible:s}}))},LB),this[d0]=null,this[f0]=null,this[p0]=new RB,this[A0]=()=>{this[Za].textContent=this[Ju]},this[g0]=()=>{this[Za].textContent=""},this[m0]=i=>{this.dispatchEvent(new CustomEvent("error",{detail:{type:"webglcontextlost",sourceError:i.sourceEvent}}))},this.attachShadow({mode:"open"});const e=this.shadowRoot;oT(e),this[bl]=e.querySelector(".container"),this[Yn]=e.querySelector(".userIn
5245put"),this[gf]=e.querySelector("canvas"),this[Za]=e.querySelector("#status"),this[b0]=this[Yn].getAttribute("aria-label");let t,n;if(this.isConnected){const i=this.getBoundingClientRect();t=i.width,n=i.height}else t=PB,n=FB;this[J]=new TB({canvas:this[gf],element:this,width:t,height:n}),Promise.resolve().then(()=>{this[zr](this.getBoundingClientRect())}),tu&&(this[Yc]=new ResizeObserver(i=>{if(!this[ot].isPresenting)for(let s of i)s.target===this&&this[zr](s.contentRect)})),nu?this[Jc]=new IntersectionObserver(i=>{for(let s of i)if(s.target===this){const a=this.modelIsVisible;this[Vs]=s.isIntersecting,this[Vl](a),console.log(`IntersectionObserver fired! isIntersecting: ${s.isIntersecting}`),this[Vs]&&!this.loaded&&this[ls]()}},{root:null,rootMargin:"0px",threshold:1e-5}):this[Vs]=!0}connectedCallback(){super.connectedCallback&&super.connectedCallback(),tu?this[Yc].observe(this):self.addEventListener("resize",this[$u]),nu&&this[Jc].observe(this),this.addEventListener("focus",this[Zu]),this.addEventListener("blur",this[ed]),this.addEventListener("extra-model-changed",this[nd]);const e=this.shadowRoot.querySelector(".slot.default slot");e&&e.addEventListener("slotchange",this[td]);const t=this[ot];t.addEventListener("contextlost",this[Yu]),t.registerScene(this[J]),this[Or]!=null&&(self.clearTimeout(this[Or]),this[Or]=null,this.requestUpdate("src",null))}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback(),tu?this[Yc].unobserve(this):self.removeEventListener("resize",this[$u]),nu&&this[Jc].unobserve(this),this.removeEventListener("focus",this[Zu]),this.removeEventListener("blur",this[ed]),this.removeEventListener("extra-model-changed",this[nd]);const e=this.shadowRoot.querySelector(".slot.default slot");e&&e.removeEventListener("slotchange",this[td]);const t=this[ot];t.removeEventListener("contextlost",this[Yu]),t.unregisterScene(this[J]),this[Or]=self.setTimeout(()=>{this[J].dispose(),this[Or]=null},BB)}updated(e){if(super.updated(e),e.has("src")){const t=Array.from(this.querySelectorAll("extra-model")),i=t.map(s=>s.src).filter(s=>s!=null).join(",")===(this[J].extraUrls||[]).join(",");this.src==null&&t.length===0?(this[Fs]=!1,this[po]=0,this[J].reset()):(this.src!==this[J].url||!i)&&(this[Fs]=!1,this[po]=0,this[ls]())}if(e.has("alt")&&this[Yn].setAttribute("aria-label",this[Xr]),e.has("generateSchema"))if(this.generateSchema){const n=Array.from(this.querySelectorAll("extra-model")).map(s=>s.src).filter(s=>s!=null),i=this.src||n[0]||null;this[J].updateSchema(i)}else this[J].updateSchema(null)}toDataURL(e,t){return this[ot].displayCanvas(this[J]).toDataURL(e,t)}async toBlob(e){const t=e?e.mimeType:void 0,n=e?e.qualityArgument:void 0,i=e?e.idealAspect:void 0,{width:s,height:a,idealAspect:o,aspect:c}=this[J],{dpr:l,scaleFactor:h}=this[ot];let u=s*h*l,d=a*h*l,f=0,p=0;if(i===!0)if(o>c){const m=d;d=Math.round(u/o),p=(m-d)/2}else{const m=u;u=Math.round(d*o),f=(m-u)/2}As.width=u,As.height=d;try{return new Promise(async(m,A)=>{As.getContext("2d").drawImage(this[ot].displayCanvas(this[J]),f,p,u,d,0,0,u,d),As.toBlob(g=>{if(!g)return A(new Error("Unable to retrieve canvas blob"));m(g)},t,n)})}finally{this[zr]({width:s,height:a})}}registerEffectComposer(e){e.setRenderer(this[ot].threeRenderer),e.setMainCamera(this[J].getCamera()),e.setMainScene(this[J]),this[J].effectRenderer=e}unregisterEffectComposer(){this[J].effectRenderer=null}registerRenderer(e){this[J].externalRenderer=e}unregisterRenderer(){this[J].externalRenderer=null}get[Xr](){return this[Af]}get[Af](){return this.alt==null||this.alt==="null"?this[b0]:this.alt}[E0](){return this[Fs]}[ar](){return this.loaded&&this[Vs]}[ma](){const e=Array.from(this.querySelectorAll("extra-model"));return!!(this.src||e.length>0)&&this[Vs]}[zr]({width:e,height:t}){e===0||t===0||(this[bl].style.width=`${e}px`,this[bl].style.height=`${t}px`,this[ql]({width:e,height:t}))}[mi](e,t){var n;(n=this[J].effectRenderer)===null||n===void 0||n.beforeRender(e,t)}[x0](){this[Fs]||(this[Fs]=!0,this[po]=performance.now())}[tn](){this[J].queueRender()}[bi](){}[Wl](e){this[Ju]=e;const t=this.getRootNode();t!=null&&t.activeElement===this&&this[Za].textContent!=e&&(this[Za].textContent=e)}[(A0=Zu,g0=ed,ql)](e){this[J].setSize(e.width,e.height)}async[(m0=Yu,ls)](){const e=this[J],n=Array.from(this.querySelectorAll("extra-model")).map(c=>
5245c.src).filter(c=>c!=null),i=n.join(",")===(e.extraUrls||[]).join(",");if(console.log(`[$updateSource] called! 
5246src: ${this.src}
5247extraUrls: ${n.join(",")}
5248loaded: ${this.loaded}`),this.loaded||!this[ma]()||this.src===e.url&&i){console.log("[$updateSource] BAILING OUT EARLY!");return}const s=this.src,a=s||n[0]||null;this.generateSchema&&e.updateSchema(a),this[Wl]("Loading"),e.stopAnimation();const o=this[rr].beginActivity("model-load");try{const c=e.setSource(s,n,u=>o(pi(u,0,1)*.95)),l=this[Gl]();await Promise.all([c,l]),Array.from(this.querySelectorAll("extra-model")).forEach((u,d)=>{const f=this.src?d+1:d;this[J].updateModelTransforms(f,u.offset,u.orientation,u.scale)}),this[x0](),this[bi](),this.updateComplete.then(()=>{this.dispatchEvent(new CustomEvent("before-render"))}),await new Promise(u=>{const d=setTimeout(()=>{console.warn("rAF timed out in updateSource"),u()},500);requestAnimationFrame(()=>{requestAnimationFrame(()=>{clearTimeout(d),u()})})}),this.dispatchEvent(new CustomEvent("load",{detail:{url:a}}))}catch(c){this.dispatchEvent(new CustomEvent("error",{detail:{type:"loadfailure",sourceError:c}}))}finally{o(1)}}}lh([Re({type:String})],Xo.prototype,"alt",void 0);lh([Re({type:String})],Xo.prototype,"src",void 0);lh([Re({type:Boolean,attribute:"with-credentials"})],Xo.prototype,"withCredentials",void 0);lh([Re({type:Boolean,attribute:"generate-schema"})],Xo.prototype,"generateSchema",void 0);/* @license
5249 * Copyright 2019 Google LLC. All Rights Reserved.
5250 * Licensed under the Apache License, Version 2.0 (the 'License');
5251 * you may not use this file except in compliance with the License.
5252 * You may obtain a copy of the License at
5253 *
5254 *     http://www.apache.org/licenses/LICENSE-2.0
5255 *
5256 * Unless required by applicable law or agreed to in writing, software
5257 * distributed under the License is distributed on an 'AS IS' BASIS,
5258 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5259 * See the License for the specific language governing permissions and
5260 * limitations under the License.
5261 */var id=function(r,e,t,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var o=r.length-1;o>=0;o--)(a=r[o])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s};const _0=1e3,Zc=Symbol("changeAnimation"),v0=Symbol("appendAnimation"),y0=Symbol("detachAnimation"),Ns=Symbol("paused"),NB={repetitions:1/0,pingpong:!1},UB={pingpong:!1,repetitions:null,weight:1,timeScale:1,fade:!1,warp:!1,relativeWarp:!0,time:null},OB={fade:!0},kB=r=>{var e;class t extends r{constructor(...i){super(i),this.autoplay=!1,this.animationName=void 0,this.animationCrossfadeDuration=300,this[e]=!0,this[J].subscribeMixerEvent("loop",s=>{const a=s.action._loopCount,o=s.action._clip.name,c=s.action._clip.uuid,l=this[J].markedAnimations.find(h=>h.name===o);if(l){this[J].updateAnimationLoop(l.name,l.loopMode,l.repetitionCount);const h=this[J].markedAnimations.filter(u=>u.name!==o);this[J].markedAnimations=h}this.dispatchEvent(new CustomEvent("loop",{detail:{count:a,name:o,uuid:c}}))}),this[J].subscribeMixerEvent("finished",s=>{if(!this[J].appendedAnimations.includes(s.action._clip.name))this[Ns]=!0;else{const a=this[J].appendedAnimations.filter(o=>o!==s.action._clip.name);this[J].appendedAnimations=a}this.dispatchEvent(new CustomEvent("finished"))})}get availableAnimations(){return this.loaded?this[J].animationNames:[]}get duration(){return this[J].duration}get paused(){return this[J].isAllAnimationsPaused()}get currentTime(){return this[J].animationTime}get appendedAnimations(){return this[J].appendedAnimations}set currentTime(i){this[J].animationTime=i,this[tn]()}get timeScale(){return this[J].animationTimeScale}set timeScale(i){this[J].animationTimeScale=i}pause(i){var s;if((i==null?void 0:i.modelIndex)==null&&this.paused)return;const a=(s=i==null?void 0:i.modelIndex)!==null&&s!==void 0?s:null;this[J].pauseAnimation(a),this.dispatchEvent(new CustomEvent("pause"))}play(i){var s;if(this.availableAnimations.length>0){const a=(s=i==null?void 0:i.modelIndex)!==null&&s!==void 0?s:null;this[J].unpauseAnimation(a),this[Zc](i),this.dispatchEvent(new CustomEvent("play"))}}appendAnimation(i,s){var a;this.availableAnimations.length>0&&(this[Ns]=!1,this[J].unpauseAnimation((a=s==null?void 0:s.modelIndex)!==null&&a!==void 0?a:null),this[v0](i,s),this.dispatchEvent(new CustomEvent("append-animation")))}detachAnimation(i,s){var a;this.availableAnimations.length>0&&(this[Ns]=!1,this[J].unpauseAnimation((a=s==null?void 0:s.modelIndex)!==null&&a!==void 0?a:null),this[y0](i,s),this.dispatchEvent(new CustomEvent("detach-animation")))}[(e=Ns,bi)](){super[bi](),this[J].pauseAnimation(),this.animationName!=null&&this[Zc](),this.autoplay&&this.play()}[mi](i,s){super[mi](i,s),!(this.paused||!this[ar]()&&!this[ot].isPresenting)&&(this[J].updateAnimation(s/_0),this[tn]())}updated(i){super.updated(i),i.has("autoplay")&&this.autoplay&&this.play(),i.has("animationName")&&this[Zc]()}[Zc](i=NB){var s;const a=(s=i.repetitions)!==null&&s!==void 0?s:1/0,o=i.pingpong?Dl:a===1?Po:Yr;this[J].playAnimation(this.animationName,this.animationCrossfadeDuration/_0,o,a,i.modelIndex),this[Ns]&&(this[J].updateAnimation(0),this[tn]())}[v0](i="",s={}){var a;const o=Object.assign(Object.assign({},UB),s),c=(a=o.repetitions)!==null&&a!==void 0?a:1/0,l=o.pingpong?Dl:c===1?Po:Yr,h=!!s.repetitions||"pingpong"in s;this[J].appendAnimation(i||this.animationName,l,c,o.weight,o.timeScale,o.fade,o.warp,o.relativeWarp,o.time,h,o.modelIndex),this[Ns]&&(this[J].updateAnimation(0),this[tn]())}[y0](i="",s={}){const a=Object.assign(Object.assign({},OB),s);this[J].detachAnimation(i||this.animationName,a.fade,a.modelIndex),this[Ns]&&(this[J].updateAnimation(0),this[tn]())}}return id([Re({type:Boolean})],t.prototype,"autoplay",void 0),id([Re({type:String,attribute:"animation-name"})],t.prototype,"animationName",void 0),id([Re({type:Number,attribute:"animation-crossfade-duration"})],t.prototype,"animationCrossfadeDuration",void 0),t};/* @license
5262 * Copyright 2019 Google LLC. All Rights Reserved.
5263 * Licensed under the Apache License, Version 2.0 (the 'License');
5264 * you may not use this file except in compliance with the License.
5265 * You may obtain a copy of the License at
5266 *
5267 *     http://www.apache.org/licenses/LICENSE-2.0
5268 *
5269 * Unless required by applicable law or agreed to in writing, software
5270 * distributed under the License is distributed on an 'AS IS' BASIS,
5271 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5272 * See the License for the specific language governing permissions and
5273 * limitations under the License.
5274 */const Us=Symbol("hotspotMap"),sd=Symbol("mutationCallback"),eo=Symbol("observer"),rd=Symbol("addHotspot"),S0=Symbol("removeHotspot"),QB=r=>{var e,t,n;class i extends r{constructor(){super(...arguments),this[e]=new Map,this[t]=a=>{a.forEach(o=>{(!(o instanceof MutationRecord)||o.type==="childList")&&(o.addedNodes.forEach(c=>{this[rd](c)}),o.removedNodes.forEach(c=>{this[S0](c)}),this[tn]())})},this[n]=new MutationObserver(this[sd])}connectedCallback(){super.connectedCallback();for(let o=0;o<this.children.length;++o)this[rd](this.children[o]);const{ShadyDOM:a}=self;a==null?this[eo].observe(this,{childList:!0}):this[eo]=a.observeChildren(this,this[sd])}disconnectedCallback(){super.disconnectedCallback();const{ShadyDOM:a}=self;a==null?this[eo].disconnect():a.unobserveChildren(this[eo])}[(e=Us,t=sd,n=eo,bi)](){super[bi]();const a=this[J];a.forHotspots(o=>{a.updateHotspotAttachment(o),a.updateSurfaceHotspot(o)})}[mi](a,o){super[mi](a,o);const c=this[J],{annotationRenderer:l}=c,h=c.getCamera();c.shouldRender()&&(c.animateSurfaceHotspots(),c.updateHotspotsVisibility(h.position),l.domElement.style.display="",l.render(c,h))}updateHotspot(a){const o=this[Us].get(a.name);o!=null&&(o.updatePosition(a.position),o.updateNormal(a.normal),o.surface=a.surface,a.modelIndex!==void 0&&a.modelIndex!==null&&(o.modelIndex=a.modelIndex),this[J].updateSurfaceHotspot(o),this[tn]())}queryHotspot(a){const o=this[Us].get(a);if(o==null)return null;const c=hs(o.position),l=hs(o.normal),h=o.facingCamera,u=this[J],d=u.getCamera(),f=new R;f.setFromMatrixPosition(o.matrixWorld),f.project(d);const p=u.width/2,m=u.height/2;f.x=f.x*p+p,f.y=-(f.y*m)+m;const A=hs(new R(f.x,f.y,f.z));return!Number.isFinite(A.x)||!Number.isFinite(A.y)?null:{position:c,normal:l,canvasPosition:A,facingCamera:h}}positionAndNormalFromPoint(a,o){const c=this[J],l=c.getNDC(a,o),h=c.positionAndNormalFromPoint(l);if(h==null)return null;const u=h.worldToModel,d=hs(h.position.applyMatrix4(u)),f=hs(h.normal.transformDirection(u));let p=null;return h.uv!=null&&(p=mf(h.uv)),{position:d,normal:f,uv:p,modelIndex:h.modelIndex}}surfaceFromPoint(a,o){const c=this[J],l=c.getNDC(a,o);return c.surfaceFromPoint(l)}[rd](a){if(!(a instanceof HTMLElement&&a.slot.indexOf("hotspot")===0))return;let o=this[Us].get(a.slot);if(o!=null){o.increment();const c=a.dataset.visibilityAttribute;if(c!=null){const l=`data-${c}`;a.toggleAttribute(l,o.facingCamera)}a.dispatchEvent(new CustomEvent("hotspot-visibility",{detail:{visible:o.facingCamera}}))}else o=new pf({name:a.slot,position:a.dataset.position,normal:a.dataset.normal,surface:a.dataset.surface,modelIndex:a.dataset.modelIndex!=null?parseInt(a.dataset.modelIndex):null}),this[Us].set(a.slot,o),this[J].addHotspot(o);this[J].queueRender()}[S0](a){if(!(a instanceof HTMLElement))return;const o=this[Us].get(a.slot);o&&(o.decrement()&&(this[J].removeHotspot(o),this[Us].delete(a.slot)),this[J].queueRender())}}return i};/*!
5275fflate - fast JavaScript compression/decompression
5276<https://101arrowz.github.io/fflate>
5277Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE
5278version 0.8.2
5279*/var bn=Uint8Array,Dn=Uint16Array,np=Int32Array,ip=new bn([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),sp=new bn([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),C0=new bn([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),uE=function(r,e){for(var t=new Dn(31),n=0;n<31;++n)t[n]=e+=1<<r[n-1];for(var i=new np(t[30]),n=1;n<30;++n)for(var s=t[n];s<t[n+1];++s)i[s]=s-t[n]<<5|n;return{b:t,r:i}},dE=uE(ip,2),GB=dE.b,bf=dE.r;GB[28]=258,bf[258]=28;
vendor: 7,967 bytes, line 5279
5279var HB=uE(sp,0),M0=HB.r,xf=new Dn(32768);for(var wt=0;wt<32768;++wt){var ss=(wt&43690)>>1|(wt&21845)<<1;ss=(ss&52428)>>2|(ss&13107)<<2,ss=(ss&61680)>>4|(ss&3855)<<4,xf[wt]=((ss&65280)>>8|(ss&255)<<8)>>1}var Co=(function(r,e,t){for(var n=r.length,i=0,s=new Dn(e);i<n;++i)r[i]&&++s[r[i]-1];var a=new Dn(e);for(i=1;i<e;++i)a[i]=a[i-1]+s[i-1]<<1;var o;if(t){o=new Dn(1<<e);var c=15-e;for(i=0;i<n;++i)if(r[i])for(var l=i<<4|r[i],h=e-r[i],u=a[r[i]-1]++<<h,d=u|(1<<h)-1;u<=d;++u)o[xf[u]>>c]=l}else for(o=new Dn(n),i=0;i<n;++i)r[i]&&(o[i]=xf[a[r[i]-1]++]>>15-r[i]);return o}),or=new bn(288);for(var wt=0;wt<144;++wt)or[wt]=8;for(var wt=144;wt<256;++wt)or[wt]=9;for(var wt=256;wt<280;++wt)or[wt]=7;for(var wt=280;wt<288;++wt)or[wt]=8;var jl=new bn(32);for(var wt=0;wt<32;++wt)jl[wt]=5;var zB=Co(or,9,0),VB=Co(jl,5,0),fE=function(r){return(r+7)/8|0},pE=function(r,e,t){return(t==null||t>r.length)&&(t=r.length),new bn(r.subarray(e,t))},WB=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],hh=function(r,e,t){var n=new Error(e||WB[r]);if(n.code=r,Error.captureStackTrace&&Error.captureStackTrace(n,hh),!t)throw n;return n},Fi=function(r,e,t){t<<=e&7;var n=e/8|0;r[n]|=t,r[n+1]|=t>>8},to=function(r,e,t){t<<=e&7;var n=e/8|0;r[n]|=t,r[n+1]|=t>>8,r[n+2]|=t>>16},ad=function(r,e){for(var t=[],n=0;n<r.length;++n)r[n]&&t.push({s:n,f:r[n]});var i=t.length,s=t.slice();if(!i)return{t:gE,l:0};if(i==1){var a=new bn(t[0].s+1);return a[t[0].s]=1,{t:a,l:1}}t.sort(function(v,C){return v.f-C.f}),t.push({s:-1,f:25001});var o=t[0],c=t[1],l=0,h=1,u=2;for(t[0]={s:-1,f:o.f+c.f,l:o,r:c};h!=i-1;)o=t[t[l].f<t[u].f?l++:u++],c=t[l!=h&&t[l].f<t[u].f?l++:u++],t[h++]={s:-1,f:o.f+c.f,l:o,r:c};for(var d=s[0].s,n=1;n<i;++n)s[n].s>d&&(d=s[n].s);var f=new Dn(d+1),p=Ef(t[h-1],f,0);if(p>e){var n=0,m=0,A=p-e,g=1<<A;for(s.sort(function(C,I){return f[I.s]-f[C.s]||C.f-I.f});n<i;++n){var b=s[n].s;if(f[b]>e)m+=g-(1<<p-f[b]),f[b]=e;else break}for(m>>=A;m>0;){var x=s[n].s;f[x]<e?m-=1<<e-f[x]++-1:++n}for(;n>=0&&m;--n){var _=s[n].s;f[_]==e&&(--f[_],++m)}p=e}return{t:new bn(f),l:p}},Ef=function(r,e,t){return r.s==-1?Math.max(Ef(r.l,e,t+1),Ef(r.r,e,t+1)):e[r.s]=t},I0=function(r){for(var e=r.length;e&&!r[--e];);for(var t=new Dn(++e),n=0,i=r[0],s=1,a=function(c){t[n++]=c},o=1;o<=e;++o)if(r[o]==i&&o!=e)++s;else{if(!i&&s>2){for(;s>138;s-=138)a(32754);s>2&&(a(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(a(i),--s;s>6;s-=6)a(8304);s>2&&(a(s-3<<5|8208),s=0)}for(;s--;)a(i);s=1,i=r[o]}return{c:t.subarray(0,n),n:e}},no=function(r,e){for(var t=0,n=0;n<e.length;++n)t+=r[n]*e[n];return t},AE=function(r,e,t){var n=t.length,i=fE(e+2);r[i]=n&255,r[i+1]=n>>8,r[i+2]=r[i]^255,r[i+3]=r[i+1]^255;for(var s=0;s<n;++s)r[i+s+4]=t[s];return(i+4+n)*8},w0=function(r,e,t,n,i,s,a,o,c,l,h){Fi(e,h++,t),++i[256];for(var u=ad(i,15),d=u.t,f=u.l,p=ad(s,15),m=p.t,A=p.l,g=I0(d),b=g.c,x=g.n,_=I0(m),v=_.c,C=_.n,I=new Dn(19),E=0;E<b.length;++E)++I[b[E]&31];for(var E=0;E<v.length;++E)++I[v[E]&31];for(var S=ad(I,7),P=S.t,w=S.l,L=19;L>4&&!P[C0[L-1]];--L);var N=l+5<<3,O=no(i,or)+no(s,jl)+a,D=no(i,d)+no(s,m)+a+14+3*L+no(I,P)+2*I[16]+3*I[17]+7*I[18];if(c>=0&&N<=O&&N<=D)return AE(e,h,r.subarray(c,c+l));var U,F,$,q;if(Fi(e,h,1+(D<O)),h+=2,D<O){U=Co(d,f,0),F=d,$=Co(m,A,0),q=m;var te=Co(P,w,0);Fi(e,h,x-257),Fi(e,h+5,C-1),Fi(e,h+10,L-4),h+=14;for(var E=0;E<L;++E)Fi(e,h+3*E,P[C0[E]]);h+=3*L;for(var Z=[b,v],Y=0;Y<2;++Y)for(var fe=Z[Y],E=0;E<fe.length;++E){var Ge=fe[E]&31;Fi(e,h,te[Ge]),h+=P[Ge],Ge>15&&(Fi(e,h,fe[E]>>5&127),h+=fe[E]>>12)}}else U=zB,F=or,$=VB,q=jl;for(var E=0;E<o;++E){var ze=n[E];if(ze>255){var Ge=ze>>18&31;to(e,h,U[Ge+257]),h+=F[Ge+257],Ge>7&&(Fi(e,h,ze>>23&31),h+=ip[Ge]);var X=ze&31;to(e,h,$[X]),h+=q[X],X>3&&(to(e,h,ze>>5&8191),h+=sp[X])}else to(e,h,U[ze]),h+=F[ze]}return to(e,h,U[256]),h+F[256]},qB=new np([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),gE=new bn(0),jB=function(r,e,t,n,i,s){var a=s.z||r.length,o=new bn(n+a+5*(1+Math.ceil(a/7e3))+i),c=o.subarray(n,o.length-i),l=s.l,h=(s.r||0)&7;if(e){h&&(c[0]=s.r>>3);for(var u=qB[e-1],d=u>>13,f=u&8191,p=(1<<t)-1,m=s.p||new Dn(32768),A=s.h||new Dn(p+1),g=Math.ceil(t/3),b=2*g,x=function(it){return(r[it]^r[it+1]<<g^r[it+2]<<b)&p},_=new np(25e3),v=new Dn(288),C=new Dn(32),I=0,E=0,S=s.i||0,P=0,w=s.w||0,L=0;S+2<a;++S){var N=x(S),O=S&32767,D=A[N];if(m[O]=D,A[N]=O,w<=S){var U=a-S;if((I>7e3||P>24576)&&(U>423||!l)){h=w0(r,c,0,_,v,C,E,P,L,S-L,h),P=I=E=0,L=S;for(var F=0;F<286;++F)v[F]=0;for(var F=0;F<30;++F)C[F]=0}var $=2,q=0,te=f,Z=O-D&32767;if(U>2&&N==x(S-Z))for(var Y=Math.min(d,U)-1,fe=Math.min(32767,S),Ge=Math.min(258,U);Z<=fe&&--te&&O!=D;){if(r[S+$]==r[S+$-Z]){for(var ze=0;ze<Ge&&r[S+ze]==r[S+ze-Z];++ze);if(ze>$){if($=ze,q=Z,ze>Y)break;for(var X=Math.min(Z,ze-2),se=0,F=0;F<X;++F){var oe=S-Z+F&32767,He=m[oe],De=oe-He&32767;De>se&&(se=De,D=oe)}}}O=D,D=m[O],Z+=O-D&32767}if(q){_[P++]=268435456|bf[$]<<18|M0[q];var Fe=bf[$]&31,kt=M0[q]&31;E+=ip[Fe]+sp[kt],++v[257+Fe],++C[kt],w=S+$,++I}else _[P++]=r[S],++v[r[S]]}}for(S=Math.max(S,w);S<a;++S)_[P++]=r[S],++v[r[S]];h=w0(r,c,l,_,v,C,E,P,L,S-L,h),l||(s.r=h&7|c[h/8|0]<<3,h-=7,s.h=A,s.p=m,s.i=S,s.w=w)}else{for(var S=s.w||0;S<a+l;S+=65535){var Ze=S+65535;Ze>=a&&(c[h/8|0]=l,Ze=a),h=AE(c,h+1,r.subarray(S,Ze))}s.i=a}return pE(o,0,n+fE(h)+i)},XB=(function(){for(var r=new Int32Array(256),e=0;e<256;++e){for(var t=e,n=9;--n;)t=(t&1&&-306674912)^t>>>1;r[e]=t}return r})(),KB=function(){var r=-1;return{p:function(e){for(var t=r,n=0;n<e.length;++n)t=XB[t&255^e[n]]^t>>>8;r=t},d:function(){return~r}}},$B=function(r,e,t,n,i){if(!i&&(i={l:1},e.dictionary)){var s=e.dictionary.subarray(-32768),a=new bn(s.length+r.length);a.set(s),a.set(r,s.length),r=a,i.w=s.length}return jB(r,e.level==null?6:e.level,e.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(r.length)))*1.5):20:12+e.mem,t,n,i)},mE=function(r,e){var t={};for(var n in r)t[n]=r[n];for(var n in e)t[n]=e[n];return t},rn=function(r,e,t){for(;t;++e)r[e]=t,t>>>=8};function YB(r,e){return $B(r,e||{},0,0)}var bE=function(r,e,t,n){for(var i in r){var s=r[i],a=e+i,o=n;Array.isArray(s)&&(o=mE(n,s[1]),s=s[0]),s instanceof bn?t[a]=[s,o]:(t[a+="/"]=[new bn(0),o],bE(s,a,t,n))}},T0=typeof TextEncoder<"u"&&new TextEncoder,JB=typeof TextDecoder<"u"&&new TextDecoder,ZB=0;try{JB.decode(gE,{stream:!0}),ZB=1}catch{}function Xl(r,e){var t;if(T0)return T0.encode(r);for(var n=r.length,i=new bn(r.length+(r.length>>1)),s=0,a=function(l){i[s++]=l},t=0;t<n;++t){if(s+5>i.length){var o=new bn(s+8+(n-t<<1));o.set(i),i=o}var c=r.charCodeAt(t);c<128||e?a(c):c<2048?(a(192|c>>6),a(128|c&63)):c>55295&&c<57344?(c=65536+(c&1047552)|r.charCodeAt(++t)&1023,a(240|c>>18),a(128|c>>12&63),a(128|c>>6&63),a(128|c&63)):(a(224|c>>12),a(128|c>>6&63),a(128|c&63))}return pE(i,0,s)}var _f=function(r){var e=0;if(r)for(var t in r){var n=r[t].length;n>65535&&hh(9),e+=n+4}return e},R0=function(r,e,t,n,i,s,a,o){var c=n.length,l=t.extra,h=o&&o.length,u=_f(l);rn(r,e,a!=null?33639248:67324752),e+=4,a!=null&&(r[e++]=20,r[e++]=t.os),r[e]=20,e+=2,r[e++]=t.flag<<1|(s<0&&8),r[e++]=i&&8,r[e++]=t.compression&255,r[e++]=t.compression>>8;var d=new Date(t.mtime==null?Date.now():t.mtime),f=d.getFullYear()-1980;if((f<0||f>119)&&hh(10),rn(r,e,f<<25|d.getMonth()+1<<21|d.getDate()<<16|d.getHours()<<11|d.getMinutes()<<5|d.getSeconds()>>1),e+=4,s!=-1&&(rn(r,e,t.crc),rn(r,e+4,s<0?-s-2:s),rn(r,e+8,t.size)),rn(r,e+12,c),rn(r,e+14,u),e+=16,a!=null&&(rn(r,e,h),rn(r,e+6,t.attrs),rn(r,e+10,a),e+=14),r.set(n,e),e+=c,u)for(var p in l){var m=l[p],A=m.length;rn(r,e,+p),rn(r,e+2,A),r.set(m,e+4),e+=4+A}return h&&(r.set(o,e),e+=h),e},eD=function(r,e,t,n,i){rn(r,e,101010256),rn(r,e+8,t),rn(r,e+10,t),rn(r,e+12,n),rn(r,e+16,i)};function tD(r,e){e||(e={});var t={},n=[];bE(r,"",t,e);var i=0,s=0;for(var a in t){var o=t[a],c=o[0],l=o[1],h=l.level==0?0:8,u=Xl(a
5279),d=u.length,f=l.comment,p=f&&Xl(f),m=p&&p.length,A=_f(l.extra);d>65535&&hh(11);var g=h?YB(c,l):c,b=g.length,x=KB();x.p(c),n.push(mE(l,{size:c.length,crc:x.d(),c:g,f:u,m:p,u:d!=a.length||p&&f.length!=m,o:i,compression:h})),i+=30+d+A+b,s+=76+2*(d+A)+(m||0)+b}for(var _=new bn(s+22),v=i,C=s-i,I=0;I<n.length;++I){var u=n[I];R0(_,u.o,u,u.f,u.u,u.c.length);var E=30+u.f.length+_f(u.extra);_.set(u.c,u.o+E),R0(_,i,u,u.f,u.u,u.c.length,u.o,u.m),i+=16+E+(u.m?u.m.length:0)}return eD(_,i,n.length,C,v),_}class Rn{constructor(e,t="",n=[],i=[]){this.name=e,this.type=t,this.metadata=n,this.properties=i,this.children=[]}addMetadata(e,t){this.metadata.push({key:e,value:t})}addProperty(e,t=[]){this.properties.push({property:e,metadata:t})}addChild(e){this.children.push(e)}toString(e=0){const t="	".repeat(e),n=this.metadata.map(h=>{const u=h.key,d=h.value;if(Array.isArray(d)){const f=[];return f.push(`${u} = {`),d.forEach(p=>{f.push(`${t}		${p}`)}),f.push(`${t}	}`),f.join(`
5280`)}else return`${u} = ${d}`}),i=n.length?` (
5281${n.map(h=>`${t}	${h}`).join(`
5282`)}
5283${t})`:"",s=this.properties.map(h=>{const u=h.property,d=h.metadata.length?` (
5284${h.metadata.map(f=>`${t}		${f}`).join(`
5285`)}
5286${t}	)`:"";return`${t}	${u}${d}`}),a=this.children.map(h=>h.toString(e+1)),o=[];if(s.length>0&&o.push(...s),a.length>0){s.length>0&&o.push("");for(let h=0;h<a.length;h++)o.push(a[h]),h<a.length-1&&o.push("")}const c=o.join(`
5287`),l=this.type?this.type+" ":"";return`${t}def ${l}"${this.name}"${i}
5288${t}{
5289${c}
5290${t}}`}}class nD{constructor(){this.textureUtils=null}setTextureUtils(e){this.textureUtils=e}parse(e,t,n,i){this.parseAsync(e,i).then(t).catch(n)}async parseAsync(e,t={}){t=Object.assign({ar:{anchoring:{type:"plane"},planeAnchoring:{alignment:"horizontal"}},includeAnchoringProperties:!0,onlyVisible:!0,quickLookCompatible:!1,maxTextureSize:1024},t);const n=new Set,i={},s="model.usda";i[s]=null;const a=new Rn("Root","Xform"),o=new Rn("Scenes","Scope");o.addMetadata("kind",'"sceneLibrary"'),a.addChild(o);const c="Scene",l=new Rn(c,"Xform");l.addMetadata("customData",["bool preliminary_collidesWithEnvironment = 0",`string sceneName = "${c}"`]),l.addMetadata("sceneName",`"${c}"`),t.includeAnchoringProperties&&(l.addProperty(`token preliminary:anchoring:type = "${t.ar.anchoring.type}"`),l.addProperty(`token preliminary:planeAnchoring:alignment = "${t.ar.planeAnchoring.alignment}"`)),o.addChild(l);let h;const u={},d={};_E(e,l,u,n,i,t);const f=hD(u,d,t.quickLookCompatible);h=EE()+`
5291`+a.toString()+`
5292
5293`+f.toString(),i[s]=Xl(h),h=null;for(const m in d){let A=d[m];if(A.isCompressedTexture===!0){if(this.textureUtils===null)throw new Error("THREE.USDZExporter: setTextureUtils() must be called to process compressed textures.");A=await this.textureUtils.decompress(A)}const g=iD(A.image,A.flipY,t.maxTextureSize),b=await new Promise(x=>g.toBlob(x,"image/png",1));i[`textures/Texture_${m}.png`]=new Uint8Array(await b.arrayBuffer())}let p=0;for(const m in i){const A=i[m],g=34+m.length;p+=g;const b=p&63;if(b!==4){const x=64-b,_=new Uint8Array(x);i[m]=[A,{extra:{12345:_}}]}p=A.length}return tD(i,{level:0})}}function xE(r,e){let t=r.name;return t=t.replace(/[^A-Za-z0-9_]/g,""),/^[0-9]/.test(t)&&(t="_"+t),t===""&&(r.isCamera?t="Camera":t="Object"),e.has(t)&&(t=t+"_"+r.id),e.add(t),t}function iD(r,e,t){if(typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&r instanceof HTMLCanvasElement||typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas||typeof ImageBitmap<"u"&&r instanceof ImageBitmap){const n=t/Math.max(r.width,r.height),i=document.createElement("canvas");i.width=r.width*Math.min(1,n),i.height=r.height*Math.min(1,n);const s=i.getContext("2d");return e===!0&&(s.translate(0,i.height),s.scale(1,-1)),s.drawImage(r,0,0,i.width,i.height),i}else throw new Error("THREE.USDZExporter: No valid image data found. Unable to process texture.")}const Et=7;function EE(){return`#usda 1.0
5294(
5295	customLayerData = {
5296		string creator = "Three.js USDZExporter"
5297	}
5298	defaultPrim = "Root"
5299	metersPerUnit = 1
5300	upAxis = "Y"
5301)
5302`}function _E(r,e,t,n,i,s){for(let a=0,o=r.children.length;a<o;a++){const c=r.children[a];if(c.visible===!1&&s.onlyVisible===!0)continue;let l;if(c.isMesh){const h=c.geometry,u=c.material;if(u.isMeshStandardMaterial){const d="geometries/Geometry_"+h.id+".usda";if(!(d in i)){const f=rD(h);i[d]=Xl(EE()+`
5303`+f.toString())}u.uuid in t||(t[u.uuid]=u),l=sD(c,h,t[u.uuid],n)}else console.warn("THREE.USDZExporter: Unsupported material type (USDZ only supports MeshStandardMaterial)",c)}else c.isCamera?l=fD(c,n):l=vE(c,n);l&&(e.addChild(l),_E(c,l,t,n,i,s))}}function vE(r,e){const t=xE(r,e);r.matrix.determinant()<0&&console.warn("THREE.USDZExporter: USDZ does not support negative scales",r);const n=new Rn(t,"Xform");if(r.pivot!==null){const i=r.position,s=r.quaternion,a=r.scale,o=r.pivot;n.addProperty(`float3 xformOp:translate = (${i.x.toPrecision(Et)}, ${i.y.toPrecision(Et)}, ${i.z.toPrecision(Et)})`),n.addProperty(`float3 xformOp:translate:pivot = (${o.x.toPrecision(Et)}, ${o.y.toPrecision(Et)}, ${o.z.toPrecision(Et)})`),n.addProperty(`quatf xformOp:orient = (${s.w.toPrecision(Et)}, ${s.x.toPrecision(Et)}, ${s.y.toPrecision(Et)}, ${s.z.toPrecision(Et)})`),n.addProperty(`float3 xformOp:scale = (${a.x.toPrecision(Et)}, ${a.y.toPrecision(Et)}, ${a.z.toPrecision(Et)})`),n.addProperty('uniform token[] xformOpOrder = ["xformOp:translate", "xformOp:translate:pivot", "xformOp:orient", "xformOp:scale", "!invert!xformOp:translate:pivot"]')}else{const i=yE(r.matrix);n.addProperty(`matrix4d xformOp:transform = ${i}`),n.addProperty('uniform token[] xformOpOrder = ["xformOp:transform"]')}return n}function sD(r,e,t,n){const i=vE(r,n);return i.addMetadata("prepend references",`@./geometries/Geometry_${e.id}.usda@</Geometry>`),i.addMetadata("prepend apiSchemas",'["MaterialBindingAPI"]'),i.addProperty(`rel material:binding = </Materials/Material_${t.id}>`),i}function yE(r){const e=r.elements;return`( ${el(e,0)}, ${el(e,4)}, ${el(e,8)}, ${el(e,12)} )`}function el(r,e){return`(${r[e+0]}, ${r[e+1]}, ${r[e+2]}, ${r[e+3]})`}function rD(r){const e=new Rn("Geometry"),t=aD(r);return e.addChild(t),e}function aD(r){const e="Geometry",t=r.attributes,n=t.position.count,i=new Rn(e,"Mesh");i.addProperty(`int[] faceVertexCounts = [${oD(r)}]`),i.addProperty(`int[] faceVertexIndices = [${cD(r)}]`),i.addProperty(`normal3f[] normals = [${od(t.normal,n)}]`,['interpolation = "vertex"']),i.addProperty(`point3f[] points = [${od(t.position,n)}]`);for(let a=0;a<4;a++){const o=a>0?a:"",c=t["uv"+o];c!==void 0&&i.addProperty(`texCoord2f[] primvars:st${o} = [${lD(c)}]`,['interpolation = "vertex"'])}const s=t.color;return s!==void 0&&i.addProperty(`color3f[] primvars:displayColor = [${od(s,n)}]`,['interpolation = "vertex"']),i.addProperty('uniform token subdivisionScheme = "none"'),i}function oD(r){const e=r.index!==null?r.index.count:r.attributes.position.count;return Array(e/3).fill(3).join(", ")}function cD(r){const e=r.index,t=[];if(e!==null)for(let n=0;n<e.count;n++)t.push(e.getX(n));else{const n=r.attributes.position.count;for(let i=0;i<n;i++)t.push(i)}return t.join(", ")}function od(r,e){if(r===void 0)return console.warn("USDZExporter: Normals missing."),Array(e).fill("(0, 0, 0)").join(", ");const t=[];for(let n=0;n<r.count;n++){const i=r.getX(n),s=r.getY(n),a=r.getZ(n);t.push(`(${i.toPrecision(Et)}, ${s.toPrecision(Et)}, ${a.toPrecision(Et)})`)}return t.join(", ")}function lD(r){const e=[];for(let t=0;t<r.count;t++){const n=r.getX(t),i=r.getY(t);e.push(`(${n.toPrecision(Et)}, ${1-i.toPrecision(Et)})`)}return e.join(", ")}function hD(r,e,t=!1){const n=new Rn("Materials");for(const i in r){const s=r[i];n.addChild(uD(s,e,t))}return n}function uD(r,e,t=!1){const n=new Rn(`Material_${r.id}`,"Material");function i(a,o,c){const l=a.source.id+"_"+a.flipY;e[l]=a;const h=a.channel>0?"st"+a.channel:"st",u={1e3:"repeat",1001:"clamp",1002:"mirror"},d=a.repeat.clone(),f=a.offset.clone(),p=a.rotation,m=Math.sin(p),A=Math.cos(p);f.y=1-f.y-d.y,t?(f.x=f.x/d.x,f.y=f.y/d.y,f.x+=m/d.x,f.y+=A-1):(f.x+=m*d.x,f.y+=(1-A)*d.y);const g=new Rn(`PrimvarReader_${o}`,"Shader");g.addProperty('uniform token info:id = "UsdPrimvarReader_float2"'),g.addProperty("float2 inputs:fallback = (0.0, 0.0)"),g.addProperty(`string inputs:varname = "${h}"`),g.addProperty("float2 outputs:result");const b=new Rn(`Transform2d_${o}`,"Shader");b.addProperty('uniform token info:id = "UsdTransform2d"'),b.addProperty(`float2 inputs:in.connect = </Materials/Material_${r.id}/PrimvarReader_${o}.outputs:result>`),b.addProperty(`float inputs:rotation = ${(p*(180/Math.PI)).toFixed(Et)}`),b.addProperty(`float2 inputs:scale = ${D0(d)}`),b.addProperty(`float2 inputs:translation = ${D0(f)}`),b.addProperty("float2 outputs:result");const x=new Rn(`Texture_${a.id}_${o}`,"Shader");return x.addProperty('uniform token info:id = "UsdUVTexture"'),x.addProperty(`asset inputs:file = @textures/Texture_${l}.png@`),x.addProperty(`float2 inputs:st.connect = </Materials/Material_${r.id}/Transform2d_${o}.outputs:result>`),c!==void 0&&x.addProperty(`float4 inputs:scale = ${dD(c)}`),o==="normal"&&(x.addProperty("float4 inputs:scale = (2, 2, 2, 1)"),x.addProperty("float4 inputs:bias = (-1, -1, -1, 0)")),x.addProperty(`token input
5303s:sourceColorSpace = "${a.colorSpace===Un?"raw":"sRGB"}"`),x.addProperty(`token inputs:wrapS = "${u[a.wrapS]}"`),x.addProperty(`token inputs:wrapT = "${u[a.wrapT]}"`),x.addProperty("float outputs:r"),x.addProperty("float outputs:g"),x.addProperty("float outputs:b"),x.addProperty("float3 outputs:rgb"),(r.transparent||r.alphaTest>0)&&x.addProperty("float outputs:a"),[g,b,x]}r.side===qt&&console.warn("THREE.USDZExporter: USDZ does not support double sided materials",r);const s=new Rn("PreviewSurface","Shader");if(s.addProperty('uniform token info:id = "UsdPreviewSurface"'),r.map!==null?(s.addProperty(`color3f inputs:diffuseColor.connect = </Materials/Material_${r.id}/Texture_${r.map.id}_diffuse.outputs:rgb>`),r.transparent?s.addProperty(`float inputs:opacity.connect = </Materials/Material_${r.id}/Texture_${r.map.id}_diffuse.outputs:a>`):r.alphaTest>0&&(s.addProperty(`float inputs:opacity.connect = </Materials/Material_${r.id}/Texture_${r.map.id}_diffuse.outputs:a>`),s.addProperty(`float inputs:opacityThreshold = ${r.alphaTest}`)),i(r.map,"diffuse",r.color).forEach(o=>n.addChild(o))):s.addProperty(`color3f inputs:diffuseColor = ${B0(r.color)}`),r.emissiveMap!==null){s.addProperty(`color3f inputs:emissiveColor.connect = </Materials/Material_${r.id}/Texture_${r.emissiveMap.id}_emissive.outputs:rgb>`);const a=new Me(r.emissive.r*r.emissiveIntensity,r.emissive.g*r.emissiveIntensity,r.emissive.b*r.emissiveIntensity);i(r.emissiveMap,"emissive",a).forEach(c=>n.addChild(c))}else r.emissive.getHex()>0&&s.addProperty(`color3f inputs:emissiveColor = ${B0(r.emissive)}`);if(r.normalMap!==null&&(s.addProperty(`normal3f inputs:normal.connect = </Materials/Material_${r.id}/Texture_${r.normalMap.id}_normal.outputs:rgb>`),i(r.normalMap,"normal").forEach(o=>n.addChild(o))),r.aoMap!==null){s.addProperty(`float inputs:occlusion.connect = </Materials/Material_${r.id}/Texture_${r.aoMap.id}_occlusion.outputs:r>`);const a=new Me(r.aoMapIntensity,r.aoMapIntensity,r.aoMapIntensity);i(r.aoMap,"occlusion",a).forEach(c=>n.addChild(c))}if(r.roughnessMap!==null){s.addProperty(`float inputs:roughness.connect = </Materials/Material_${r.id}/Texture_${r.roughnessMap.id}_roughness.outputs:g>`);const a=new Me(r.roughness,r.roughness,r.roughness);i(r.roughnessMap,"roughness",a).forEach(c=>n.addChild(c))}else s.addProperty(`float inputs:roughness = ${r.roughness}`);if(r.metalnessMap!==null){s.addProperty(`float inputs:metallic.connect = </Materials/Material_${r.id}/Texture_${r.metalnessMap.id}_metallic.outputs:b>`);const a=new Me(r.metalness,r.metalness,r.metalness);i(r.metalnessMap,"metallic",a).forEach(c=>n.addChild(c))}else s.addProperty(`float inputs:metallic = ${r.metalness}`);if(r.alphaMap!==null?(s.addProperty(`float inputs:opacity.connect = </Materials/Material_${r.id}/Texture_${r.alphaMap.id}_opacity.outputs:r>`),s.addProperty("float inputs:opacityThreshold = 0.0001"),i(r.alphaMap,"opacity").forEach(o=>n.addChild(o))):s.addProperty(`float inputs:opacity = ${r.opacity}`),r.isMeshPhysicalMaterial){if(r.clearcoatMap!==null){s.addProperty(`float inputs:clearcoat.connect = </Materials/Material_${r.id}/Texture_${r.clearcoatMap.id}_clearcoat.outputs:r>`);const a=new Me(r.clearcoat,r.clearcoat,r.clearcoat);i(r.clearcoatMap,"clearcoat",a).forEach(c=>n.addChild(c))}else s.addProperty(`float inputs:clearcoat = ${r.clearcoat}`);if(r.clearcoatRoughnessMap!==null){s.addProperty(`float inputs:clearcoatRoughness.connect = </Materials/Material_${r.id}/Texture_${r.clearcoatRoughnessMap.id}_clearcoatRoughness.outputs:g>`);const a=new Me(r.clearcoatRoughness,r.clearcoatRoughness,r.clearcoatRoughness);i(r.clearcoatRoughnessMap,"clearcoatRoughness",a).forEach(c=>n.addChild(c))}else s.addProperty(`float inputs:clearcoatRoughness = ${r.clearcoatRoughness}`);s.addProperty(`float inputs:ior = ${r.ior}`)}return s.addProperty("int inputs:useSpecularWorkflow = 0"),s.addProperty("token outputs:surface"),n.addChild(s),n.addProperty(`token outputs:surface.connect = </Materials/Material_${r.id}/PreviewSurface.outputs:surface>`),n}function B0(r){return`(${r.r}, ${r.g}, ${r.b})`}function dD(r){return`(${r.r}, ${r.g}, ${r.b}, 1.0)`}function D0(r){return`(${r.x}, ${r.y})`}function fD(r,e){const t=xE(r,e),n=yE(r.matrix);r.matrix.determinant()<0&&console.warn("THREE.USDZExporter: USDZ does not support negative scales",r);const i=new Rn(t,"Camera");i.addProperty(`matrix4d xformOp:transform = ${n}`),i.addProperty('uniform token[] xformOpOrder = ["xformOp:transform"]');const s=r.isOrthographicCamera?"orthographic":"perspective";i.addProperty(`token projection = "${s}"`);const a=`(${r.near.toPrecision(Et)}, ${r.far.toPrecision(Et)})`;i.addProperty(`float2 clippingRange = ${a}`);let o;r.isOrthographicCamera?o=((Math.abs(r.left)+Math.abs(r.right))*10).toPrecision(Et):o=r.getFilmWidth().toPrecision(Et),i.addProperty(`float horizontalAperture = ${o}`);let c;if(r.isOrthographicCamera?c=((Math.abs(r.top)+Math.abs(r.bottom))*10).toPrecision(Et):c=r.getFilmHeight().toPrecision(Et),i.addProperty(`float verticalAperture = ${c}`),r.isPerspectiveCamera){const l=r.getFocalLength().toPrecision(Et);i.addProperty(`float focalLength = ${l}`);const h=r.focus.toPrecision(Et);i.addProperty(`float focusDistance = ${h}`)}return i}/* @license
5304 * Copyright 2019 Google LLC. All Rights Reserved.
5305 * Licensed under the Apache License, Version 2.0 (the 'License');
5306 * you may not use this file except in compliance with the License.
5307 * You may obtain a copy of the License at
5308 *
5309 *     http://www.apache.org/licenses/LICENSE-2.0
5310 *
5311 * Unless required by applicable law or agreed to in writing, software
5312 * distributed under the License is distributed on an 'AS IS' BASIS,
5313 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5314 * See the License for the specific language governing permissions and
5315 * limitations under the License.
5316 */const pD=r=>e=>{try{const t=zi(e),n=(t.length?t[0].terms:[]).filter(i=>i&&i.type==="ident").map(i=>i.value).filter(i=>r.indexOf(i)>-1);return new Set(n)}catch{}return new Set};/* @license
5317 * Copyright 2019 Google LLC. All Rights Reserved.
5318 * Licensed under the Apache License, Version 2.0 (the 'License');
5319 * you may not use this file except in compliance with the License.
5320 * You may obtain a copy of the License at
5321 *
5322 *     http://www.apache.org/licenses/LICENSE-2.0
5323 *
5324 * Unless required by applicable law or agreed to in writing, software
5325 * distributed under the License is distributed on an 'AS IS' BASIS,
5326 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5327 * See the License for the specific language governing permissions and
5328 * limitations under the License.
5329 */var Os=function(r,e,t,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var o=r.length-1;o>=0;o--)(a=r[o])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s};let L0=!1,P0=!1;const F0="#model-viewer-no-ar-fallback",AD=pD(["quick-look","scene-viewer","webxr","none"]),gD="webxr scene-viewer quick-look",Pn={QUICK_LOOK:"quick-look",SCENE_VIEWER:"scene-viewer",WEBXR:"webxr",NONE:"none"},Ni=Symbol("arButtonContainer"),N0=Symbol("enterARWithWebXR"),U0=Symbol("openSceneViewer"),O0=Symbol("openIOSARQuickLook"),mD=Symbol("canActivateAR"),tl=Symbol("arMode"),cd=Symbol("arModes"),kr=Symbol("arAnchor"),nl=Symbol("preload"),il=Symbol("onARButtonContainerClick"),ld=Symbol("onARStatus"),hd=Symbol("onARTracking"),ud=Symbol("onARTap"),io=Symbol("selectARMode"),dd=Symbol("triggerLoad"),bD=r=>{var e,t,n,i,s,a,o,c,l,h;class u extends r{constructor(){super(...arguments),this.ar=!1,this.arScale="auto",this.arUsdzMaxTextureSize="auto",this.arPlacement="floor",this.arModes=gD,this.iosSrc=null,this.xrEnvironment=!1,this[e]=!1,this[t]=this.shadowRoot.querySelector(".ar-button"),this[n]=document.createElement("a"),this[i]=new Set,this[s]=Pn.NONE,this[a]=!1,this[o]=f=>{f.preventDefault(),this.activateAR()},this[c]=({status:f})=>{(f===Gi.NOT_PRESENTING||this[ot].arRenderer.presentedScene===this[J])&&(this.setAttribute("ar-status",f),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:f}})),f===Gi.NOT_PRESENTING?this.removeAttribute("ar-tracking"):f===Gi.SESSION_STARTED&&this.setAttribute("ar-tracking",cf.TRACKING))},this[l]=({status:f})=>{this.setAttribute("ar-tracking",f),this.dispatchEvent(new CustomEvent("ar-tracking",{detail:{status:f}}))},this[h]=f=>{f.data=="_apple_ar_quicklook_button_tapped"&&this.dispatchEvent(new CustomEvent("quick-look-button-tapped"))}}get canActivateAR(){return this[tl]!==Pn.NONE}connectedCallback(){super.connectedCallback(),this[ot].arRenderer!=null&&(this[ot].arRenderer.addEventListener("status",this[ld]),this.setAttribute("ar-status",Gi.NOT_PRESENTING),this[ot].arRenderer.addEventListener("tracking",this[hd])),this[kr].addEventListener("message",this[ud])}disconnectedCallback(){super.disconnectedCallback(),this[ot].arRenderer!=null&&(this[ot].arRenderer.removeEventListener("status",this[ld]),this[ot].arRenderer.removeEventListener("tracking",this[hd])),this[kr].removeEventListener("message",this[ud])}update(f){super.update(f),f.has("arScale")&&(this[J].canScale=this.arScale!=="fixed"),f.has("arPlacement")&&(this[J].updateShadow(),this[tn]()),f.has("arModes")&&(this[cd]=AD(this.arModes)),(f.has("ar")||f.has("arModes")||f.has("src")||f.has("iosSrc")||f.has("arUsdzMaxTextureSize"))&&this[io]()}async activateAR(){switch(this[tl]){case Pn.QUICK_LOOK:await this[O0]();break;case Pn.WEBXR:await this[N0]();break;case Pn.SCENE_VIEWER:await this[U0]();break;default:console.warn("No AR Mode can be activated. This is probably due to missing configuration or device capabilities");break}}async[(e=mD,t=Ni,n=kr,i=cd,s=tl,a=nl,o=il,c=ld,l=hd,h=ud,io)](){var f;let p=Pn.NONE;
5329if(this.ar){if(this.src!=null)for(const m of this[cd]){if(m==="webxr"&&kb&&!L0&&await this[ot].arRenderer.supportsPresentation()){p=Pn.WEBXR;break}if(m==="scene-viewer"&&!P0&&(jw||navigator.userAgentData&&navigator.userAgentData.getHighEntropyValues&&(!((f=(await navigator.userAgentData.getHighEntropyValues(["formFactor"])).formFactor)===null||f===void 0)&&f.includes("XR")))){p=Pn.SCENE_VIEWER;break}if(m==="quick-look"&&KA&&!XA&&(!Qb||this.iosSrc!=null)){p=Pn.QUICK_LOOK;break}}p===Pn.NONE&&this.iosSrc!=null&&KA&&!XA&&(p=Pn.QUICK_LOOK)}if(p!==Pn.NONE)this[Ni].classList.add("enabled"),this[Ni].addEventListener("click",this[il]);else if(this[Ni].classList.contains("enabled")){this[Ni].removeEventListener("click",this[il]),this[Ni].classList.remove("enabled");const m=Gi.FAILED;this.setAttribute("ar-status",m),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:m}}))}this[tl]=p}async[N0](){console.log("Attempting to present in AR with WebXR..."),await this[dd]();try{this[Ni].removeEventListener("click",this[il]);const{arRenderer:f}=this[ot];f.placeOnWall=this.arPlacement==="wall",await f.present(this[J],this.xrEnvironment)}catch(f){console.warn("Error while trying to present in AR with WebXR"),console.error(f),await this[ot].arRenderer.stopPresenting(),L0=!0,console.warn("Falling back to next ar-mode"),await this[io](),this.activateAR()}finally{this[io]()}}async[dd](){this.loaded||(this[nl]=!0,this[ls](),await Yw(this,"load"),this[nl]=!1)}[ma](){return super[ma]()||this[nl]}async[U0](){const f=self.location.toString(),p=new URL(f),A=Array.from(this.querySelectorAll("extra-model")).map(C=>C.src).filter(C=>C!=null),g=this.src||A[0]||null;if(!g){console.warn("No src or extra-model provided for Scene Viewer fallback.");return}let b=new URL(g,f);b.hash&&(b.hash="");const x=new URLSearchParams(b.search);if(p.hash=F0,x.set("mode","ar_preferred"),x.has("disable_occlusion")||x.set("disable_occlusion","true"),this.arScale==="fixed"&&x.set("resizable","false"),this.arPlacement==="wall"&&x.set("enable_vertical_placement","true"),x.has("sound")){const C=new URL(x.get("sound"),f);x.set("sound",C.toString())}if(x.has("link")){const C=new URL(x.get("link"),f);x.set("link",C.toString())}const _=`intent://arvr.google.com/scene-viewer/1.2?${x.toString()+"&file="+encodeURIComponent(b.toString())}#Intent;scheme=https;package=com.google.android.googlequicksearchbox;action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(p.toString())};end;`,v=()=>{self.location.hash===F0&&(P0=!0,self.history.back(),console.warn("Error while trying to present in AR with Scene Viewer"),console.warn("Falling back to next ar-mode"),this[io]())};self.addEventListener("hashchange",v,{once:!0}),this[kr].setAttribute("href",_),console.log("Attempting to present in AR with Scene Viewer..."),this[kr].click()}async[O0](){const f=!this.iosSrc;this[Ni].classList.remove("enabled");const p=f?await this.prepareUSDZ():this.iosSrc,m=new URL(p,self.location.toString());if(f){const b=self.location.toString(),x=new URL(b),v=Array.from(this.querySelectorAll("extra-model")).map(I=>I.src).filter(I=>I!=null),C=this.src||v[0]||null;if(C){const I=new URL(C,x);I.hash&&(m.hash=I.hash)}}this.arScale==="fixed"&&(m.hash&&(m.hash+="&"),m.hash+="allowsContentScaling=0");const A=this[kr];A.setAttribute("rel","ar");const g=document.createElement("img");A.appendChild(g),A.setAttribute("href",m.toString()),f&&A.setAttribute("download","model.usdz"),A.style.display="none",A.isConnected||this.shadowRoot.appendChild(A),console.log("Attempting to present in AR with Quick Look..."),A.click(),A.removeChild(g),f&&URL.revokeObjectURL(p),this[Ni].classList.add("enabled")}async prepareUSDZ(){const f=this[rr].beginActivity("usdz-conversion");await this[dd]();const{models:p,shadow:m,target:A}=this[J];if(p.length===0||p[0]==null)return"";let g=!1;m!=null&&(g=m.visible,m.visible=!1),f(.2);const b=new nD,x=new ht;x.position.copy(A.position);for(const I of p)A.remove(I),x.add(I);x.updateWorldMatrix(!1,!0);const _=await b.parseAsync(x,{maxTextureSize:isNaN(this.arUsdzMaxTextureSize)?1/0:Math.max(parseInt(this.arUsdzMaxTextureSize),
vendor: 5,069 bytes, lines 5329-5342
532916)});for(const I of p)x.remove(I),A.add(I);const v=new Blob([_],{type:"model/vnd.usdz+zip"}),C=URL.createObjectURL(v);return f(1),m!=null&&(m.visible=g),C}}return Os([Re({type:Boolean,attribute:"ar"})],u.prototype,"ar",void 0),Os([Re({type:String,attribute:"ar-scale"})],u.prototype,"arScale",void 0),Os([Re({type:String,attribute:"ar-usdz-max-texture-size"})],u.prototype,"arUsdzMaxTextureSize",void 0),Os([Re({type:String,attribute:"ar-placement"})],u.prototype,"arPlacement",void 0),Os([Re({type:String,attribute:"ar-modes"})],u.prototype,"arModes",void 0),Os([Re({type:String,attribute:"ios-src"})],u.prototype,"iosSrc",void 0),Os([Re({type:Boolean,attribute:"xr-environment"})],u.prototype,"xrEnvironment",void 0),u};/* @license
5330 * Copyright 2019 Google LLC. All Rights Reserved.
5331 * Licensed under the Apache License, Version 2.0 (the 'License');
5332 * you may not use this file except in compliance with the License.
5333 * You may obtain a copy of the License at
5334 *
5335 *     http://www.apache.org/licenses/LICENSE-2.0
5336 *
5337 * Unless required by applicable law or agreed to in writing, software
5338 * distributed under the License is distributed on an 'AS IS' BASIS,
5339 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5340 * See the License for the specific language governing permissions and
5341 * limitations under the License.
5342 */var fd=function(r,e,t,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var o=r.length-1;o>=0;o--)(a=r[o])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s};const xD=100,ED="https://www.gstatic.com/draco/versioned/decoders/1.5.6/",_D="https://www.gstatic.com/basis-universal/versioned/2021-04-15-ba1c3e4/",vD="https://cdn.jsdelivr.net/npm/[email protected]/examples/jsm/loaders/LottieLoader.js",pd={AUTO:"auto"},k0={AUTO:"auto",EAGER:"eager"},Qr=Symbol("defaultProgressBarElement"),Ad=Symbol("posterContainerElement"),Gr=Symbol("defaultPosterElement"),so=Symbol("shouldDismissPoster"),gd=Symbol("hidePoster"),sl=Symbol("modelIsRevealed"),md=Symbol("updateProgressBar"),yD=Symbol("ariaLabelCallToAction"),bd=Symbol("onProgress"),SD=r=>{var e,t,n,i,s,a,o,c;class l extends r{static set dracoDecoderLocation(u){vn.setDRACODecoderLocation(u)}static get dracoDecoderLocation(){return vn.getDRACODecoderLocation()}static set ktx2TranscoderLocation(u){vn.setKTX2TranscoderLocation(u)}static get ktx2TranscoderLocation(){return vn.getKTX2TranscoderLocation()}static set meshoptDecoderLocation(u){vn.setMeshoptDecoderLocation(u)}static get meshoptDecoderLocation(){return vn.getMeshoptDecoderLocation()}static set lottieLoaderLocation(u){kn.singleton.textureUtils.lottieLoaderUrl=u}static get lottieLoaderLocation(){return kn.singleton.textureUtils.lottieLoaderUrl}static mapURLs(u){kn.singleton.loader[Qs].manager.setURLModifier(u)}dismissPoster(){this.loaded?this[gd]():(this[so]=!0,this[ls]())}showPoster(){const u=this[Ad];if(u.classList.contains("show"))return;u.classList.add("show"),this[Yn].classList.remove("show");const d=this[Gr];d.removeAttribute("tabindex"),d.removeAttribute("aria-hidden");const f=this.modelIsVisible;this[sl]=!1,this[Vl](f)}getDimensions(){return this[J].updateBoundingBoxAndShadowIfDirty(),hs(this[J].size)}getBoundingBoxCenter(){return this[J].updateBoundingBoxAndShadowIfDirty(),hs(this[J].boundingBox.getCenter(new R))}constructor(...u){super(...u),this.poster=null,this.reveal=pd.AUTO,this.loading=k0.AUTO,this[e]=!1,this[t]=!1,this[n]=this.shadowRoot.querySelector(".slot.poster"),this[i]=this.shadowRoot.querySelector("#default-poster"),this[s]=this.shadowRoot.querySelector("#default-progress-bar > .bar"),this[a]=this[Gr].getAttribute("aria-label"),this[o]=Kw(A=>{const g=this[Qr].parentNode;requestAnimationFrame(()=>{this[Qr].style.transform=`scaleX(${A})`,A===0&&(g.removeChild(this[Qr]),g.appendChild(this[Qr])),this[Qr].classList.toggle("hide",A===1)})},xD),this[c]=A=>{const g=A.detail.totalProgress,b=A.detail.reason;g===1&&(this[md].flush(),this.loaded&&(this[so]||this.reveal===pd.AUTO)&&this[gd]()),this[md](g),this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:g,reason:b}}))};const d=self.ModelViewerElement||{},f=d.dracoDecoderLocation||ED;vn.setDRACODecoderLocation(f);const p=d.ktx2TranscoderLocation||_D;vn.setKTX2TranscoderLocation(p),d.meshoptDecoderLocation&&vn.setMeshoptDecoderLocation(d.meshoptDecoderLocation);const m=d.lottieLoaderLocation||vD;kn.singleton.textureUtils!=null&&(kn.singleton.textureUtils.lottieLoaderUrl=m)}connectedCallback(){super.connectedCallback(),this.loaded||this.showPoster(),this[rr].addEventListener("progress",this[bd])}disconnectedCallback(){super.disconnectedCallback(),this[rr].removeEventListener("progress",this[bd])}async updated(u){super.updated(u),u.has("poster")&&this.poster!=null&&(this[Gr].style.backgroundImage=`url(${this.poster})`),u.has("alt")&&this[Gr].setAttribute("aria-label",this[Af]),(u.has("reveal")||u.has("loading"))&&this[ls]()}
vendor: 3,893 bytes, lines 5342-5368
5342[(e=sl,t=so,n=Ad,i=Gr,s=Qr,a=yD,o=md,c=bd,ma)](){const u=Array.from(this.querySelectorAll("extra-model"));return!!(this.src||u.length>0)&&(this[so]||this.loading===k0.EAGER||this.reveal===pd.AUTO&&this[Vs])}[gd](){this[so]=!1;const u=this[Ad];if(!u.classList.contains("show"))return;u.classList.remove("show"),this[Yn].classList.add("show");const d=this.modelIsVisible;this[sl]=!0,this[Vl](d);const f=this.getRootNode();f&&f.activeElement===this&&this[Yn].focus();const p=this[Gr];p.setAttribute("aria-hidden","true"),p.tabIndex=-1,this.dispatchEvent(new CustomEvent("poster-dismissed"))}[ar](){return super[ar]()&&this[sl]}}return fd([Re({type:String})],l.prototype,"poster",void 0),fd([Re({type:String})],l.prototype,"reveal",void 0),fd([Re({type:String})],l.prototype,"loading",void 0),l};/* @license
5343 * Copyright 2019 Google LLC. All Rights Reserved.
5344 * Licensed under the Apache License, Version 2.0 (the 'License');
5345 * you may not use this file except in compliance with the License.
5346 * You may obtain a copy of the License at
5347 *
5348 *     http://www.apache.org/licenses/LICENSE-2.0
5349 *
5350 * Unless required by applicable law or agreed to in writing, software
5351 * distributed under the License is distributed on an 'AS IS' BASIS,
5352 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5353 * See the License for the specific language governing permissions and
5354 * limitations under the License.
5355 */var xd=function(r,e,t,n){var i=arguments.length,s=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(r,e,t,n);else for(var o=r.length-1;o>=0;o--)(a=r[o])&&(s=(i<3?a(s):i>3?a(e,t,s):a(e,t))||s);return i>3&&s&&Object.defineProperty(e,t,s),s};const CD=Math.PI/32,MD=3e3,ID={basis:[ch(gn(CD,"rad"))],keywords:{auto:[null]}},Hr=Symbol("autoRotateStartTime"),Ed=Symbol("radiansPerSecond"),Q0=Symbol("syncRotationRate"),_d=Symbol("onCameraChange"),wD=r=>{var e,t,n;class i extends r{constructor(){super(...arguments),this.autoRotate=!1,this.autoRotateDelay=MD,this.rotationPerSecond="auto",this[e]=performance.now(),this[t]=0,this[n]=a=>{this.autoRotate&&a.detail.source==="user-interaction"&&(this[Hr]=performance.now())}}connectedCallback(){super.connectedCallback(),this.addEventListener("camera-change",this[_d]),this[Hr]=performance.now()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("camera-change",this[_d]),this[Hr]=performance.now()}updated(a){super.updated(a),a.has("autoRotate")&&(this[Hr]=performance.now())}[(e=Hr,t=Ed,Q0)](a){this[Ed]=a[0]}[mi](a,o){if(super[mi](a,o),!this.autoRotate||!this[ar]()||this[ot].isPresenting)return;const c=Math.min(o,a-this[Hr]-this.autoRotateDelay);c>0&&(this[J].yaw=this.turntableRotation+this[Ed]*c*.001)}get turntableRotation(){return this[J].yaw}resetTurntableRotation(a=0){this[J].yaw=a}}return n=_d,xd([Re({type:Boolean,attribute:"auto-rotate"})],i.prototype,"autoRotate",void 0),xd([Re({type:Number,attribute:"auto-rotate-delay"})],i.prototype,"autoRotateDelay",void 0),xd([rs({intrinsics:ID,updateHandler:Q0}),Re({type:String,attribute:"rotation-per-second"})],i.prototype,"rotationPerSecond",void 0),i};/* @license
5356 * Copyright 2019 Google LLC. All Rights Reserved.
5357 * Licensed under the Apache License, Version 2.0 (the 'License');
5358 * you may not use this file except in compliance with the License.
5359 * You may obtain a copy of the License at
5360 *
5361 *     http://www.apache.org/licenses/LICENSE-2.0
5362 *
5363 * Unless required by applicable law or agreed to in writing, software
5364 * distributed under the License is distributed on an 'AS IS' BASIS,
5365 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5366 * See the License for the specific language governing permissions and
5367 * limitations under the License.
5368 */const TD=QB(EB(wD(nT(bR(bD(SD(kB(Xo))))))));customElements.define("model-viewer",TD);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.