@crystaldesign/diva-web-planner-react 24.11.2 → 24.11.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/umd/3444.diva-web-planner-react.umd.min.js +1 -1
- package/build/umd/4563.diva-web-planner-react.umd.min.js +1 -1
- package/build/umd/5063.diva-web-planner-react.umd.min.js +1 -1
- package/build/umd/560.diva-web-planner-react.umd.min.js +1 -1
- package/build/umd/6854.diva-web-planner-react.umd.min.js +2 -2
- package/build/umd/9068.diva-web-planner-react.umd.min.js +1 -1
- package/build/umd/diva-web-planner-react.umd.min.js +1 -1
- package/build/umd/report.html +1 -1
- package/package.json +6 -6
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*! For license information please see 6854.diva-web-planner-react.umd.min.js.LICENSE.txt */
|
|
2
|
-
"use strict";(self.webpackChunkCrystaldesignDivaWebPlannerReact=self.webpackChunkCrystaldesignDivaWebPlannerReact||[]).push([[6854],{46854:(e,t,s)=>{s.r(t),s.d(t,{CanvasTexture:()=>o.GOR,FileLoader:()=>o.Y9S,Loader:()=>o.aHM,ModelViewerElement:()=>Il,NearestFilter:()=>o.hxR});const i=(e,t)=>"method"===t.kind&&t.descriptor&&!("value"in t.descriptor)?{...t,finisher(s){s.createProperty(t.key,e)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:t.key,initializer(){"function"==typeof t.initializer&&(this[t.key]=t.initializer.call(this))},finisher(s){s.createProperty(t.key,e)}};function n(e){return(t,s)=>void 0!==s?((e,t,s)=>{t.constructor.createProperty(s,e)})(e,t,s):i(e,t)}var r;null===(r=window.HTMLSlotElement)||void 0===r||r.prototype.assignedElements;var o=s(91177);const A=window,l=A.ShadowRoot&&(void 0===A.ShadyCSS||A.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,h=Symbol(),c=new WeakMap;class css_tag_o{constructor(e,t,s){if(this._$cssResult$=!0,s!==h)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(l&&void 0===e){const s=void 0!==t&&1===t.length;s&&(e=c.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),s&&c.set(t,e))}return e}toString(){return this.cssText}}const d=l?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const s of e.cssRules)t+=s.cssText;return(e=>new css_tag_o("string"==typeof e?e:e+"",void 0,h))(t)})(e):e;var g;const p=window,m=p.trustedTypes,f=m?m.emptyScript:"",I=p.reactiveElementPolyfillSupport,E={toAttribute(e,t){switch(t){case Boolean:e=e?f:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let s=e;switch(t){case Boolean:s=null!==e;break;case Number:s=null===e?null:Number(e);break;case Object:case Array:try{s=JSON.parse(e)}catch(e){s=null}}return s}},a=(e,t)=>t!==e&&(t==t||e==e),C={attribute:!0,type:String,converter:E,reflect:!1,hasChanged:a},B="finalized";class u extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var t;this.finalize(),(null!==(t=this.h)&&void 0!==t?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach(((t,s)=>{const r=this._$Ep(s,t);void 0!==r&&(this._$Ev.set(r,s),e.push(r))})),e}static createProperty(e,t=C){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const s="symbol"==typeof e?Symbol():"__"+e,r=this.getPropertyDescriptor(e,s,t);void 0!==r&&Object.defineProperty(this.prototype,e,r)}}static getPropertyDescriptor(e,t,s){return{get(){return this[t]},set(r){const o=this[e];this[t]=r,this.requestUpdate(e,o,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||C}static finalize(){if(this.hasOwnProperty(B))return!1;this[B]=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),void 0!==e.h&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const e=this.properties,t=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const s of t)this.createProperty(s,e[s])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const s=new Set(e.flat(1/0).reverse());for(const e of s)t.unshift(d(e))}else void 0!==e&&t.push(d(e));return t}static _$Ep(e,t){const s=t.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof e?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(e=this.constructor.h)||void 0===e||e.forEach((e=>e(this)))}addController(e){var t,s;(null!==(t=this._$ES)&&void 0!==t?t:this._$ES=[]).push(e),void 0!==this.renderRoot&&this.isConnected&&(null===(s=e.hostConnected)||void 0===s||s.call(e))}removeController(e){var t;null===(t=this._$ES)||void 0===t||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])}))}createRenderRoot(){var e;const t=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{l?e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):t.forEach((t=>{const s=document.createElement("style"),r=A.litNonce;void 0!==r&&s.setAttribute("nonce",r),s.textContent=t.cssText,e.appendChild(s)}))})(t,this.constructor.elementStyles),t}connectedCallback(){var e;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostConnected)||void 0===t?void 0:t.call(e)}))}enableUpdating(e){}disconnectedCallback(){var e;null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostDisconnected)||void 0===t?void 0:t.call(e)}))}attributeChangedCallback(e,t,s){this._$AK(e,s)}_$EO(e,t,s=C){var r;const o=this.constructor._$Ep(e,s);if(void 0!==o&&!0===s.reflect){const A=(void 0!==(null===(r=s.converter)||void 0===r?void 0:r.toAttribute)?s.converter:E).toAttribute(t,s.type);this._$El=e,null==A?this.removeAttribute(o):this.setAttribute(o,A),this._$El=null}}_$AK(e,t){var s;const r=this.constructor,o=r._$Ev.get(e);if(void 0!==o&&this._$El!==o){const e=r.getPropertyOptions(o),A="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==(null===(s=e.converter)||void 0===s?void 0:s.fromAttribute)?e.converter:E;this._$El=o,this[o]=A.fromAttribute(t,e.type),this._$El=null}}requestUpdate(e,t,s){let r=!0;void 0!==e&&(((s=s||this.constructor.getPropertyOptions(e)).hasChanged||a)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),!0===s.reflect&&this._$El!==e&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(e,s))):r=!1),!this.isUpdatePending&&r&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((e,t)=>this[t]=e)),this._$Ei=void 0);let t=!1;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostUpdate)||void 0===t?void 0:t.call(e)})),this.update(s)):this._$Ek()}catch(e){throw t=!1,this._$Ek(),e}t&&this._$AE(s)}willUpdate(e){}_$AE(e){var t;null===(t=this._$ES)||void 0===t||t.forEach((e=>{var t;return null===(t=e.hostUpdated)||void 0===t?void 0:t.call(e)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){void 0!==this._$EC&&(this._$EC.forEach(((e,t)=>this._$EO(t,this[t],e))),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}}var y;u[B]=!0,u.elementProperties=new Map,u.elementStyles=[],u.shadowRootOptions={mode:"open"},null==I||I({ReactiveElement:u}),(null!==(g=p.reactiveElementVersions)&&void 0!==g?g:p.reactiveElementVersions=[]).push("1.6.3");const Q=window,x=Q.trustedTypes,b=x?x.createPolicy("lit-html",{createHTML:e=>e}):void 0,S="$lit$",T=`lit$${(Math.random()+"").slice(9)}$`,F="?"+T,_=`<${F}>`,U=document,lit_html_u=()=>U.createComment(""),lit_html_d=e=>null===e||"object"!=typeof e&&"function"!=typeof e,G=Array.isArray,v=e=>G(e)||"function"==typeof(null==e?void 0:e[Symbol.iterator]),O="[ \t\n\f\r]",q=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,$=/-->/g,J=/>/g,K=RegExp(`>|${O}(?:([^\\s"'>=/]+)(${O}*=${O}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),Y=/'/g,j=/"/g,W=/^(?:script|style|textarea|title)$/i,w=e=>(t,...s)=>({_$litType$:e,strings:t,values:s}),X=w(1),ee=(w(2),Symbol.for("lit-noChange")),te=Symbol.for("lit-nothing"),ie=new WeakMap,se=U.createTreeWalker(U,129,null,!1);function P(e,t){if(!Array.isArray(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==b?b.createHTML(t):t}const V=(e,t)=>{const s=e.length-1,r=[];let o,A=2===t?"<svg>":"",l=q;for(let t=0;t<s;t++){const s=e[t];let h,c,d=-1,g=0;for(;g<s.length&&(l.lastIndex=g,c=l.exec(s),null!==c);)g=l.lastIndex,l===q?"!--"===c[1]?l=$:void 0!==c[1]?l=J:void 0!==c[2]?(W.test(c[2])&&(o=RegExp("</"+c[2],"g")),l=K):void 0!==c[3]&&(l=K):l===K?">"===c[0]?(l=null!=o?o:q,d=-1):void 0===c[1]?d=-2:(d=l.lastIndex-c[2].length,h=c[1],l=void 0===c[3]?K:'"'===c[3]?j:Y):l===j||l===Y?l=K:l===$||l===J?l=q:(l=K,o=void 0);const p=l===K&&e[t+1].startsWith("/>")?" ":"";A+=l===q?s+_:d>=0?(r.push(h),s.slice(0,d)+S+s.slice(d)+T+p):s+T+(-2===d?(r.push(void 0),t):p)}return[P(e,A+(e[s]||"<?>")+(2===t?"</svg>":"")),r]};class N{constructor({strings:e,_$litType$:t},s){let r;this.parts=[];let o=0,A=0;const l=e.length-1,h=this.parts,[c,d]=V(e,t);if(this.el=N.createElement(c,s),se.currentNode=this.el.content,2===t){const e=this.el.content,t=e.firstChild;t.remove(),e.append(...t.childNodes)}for(;null!==(r=se.nextNode())&&h.length<l;){if(1===r.nodeType){if(r.hasAttributes()){const e=[];for(const t of r.getAttributeNames())if(t.endsWith(S)||t.startsWith(T)){const s=d[A++];if(e.push(t),void 0!==s){const e=r.getAttribute(s.toLowerCase()+S).split(T),t=/([.?@])?(.*)/.exec(s);h.push({type:1,index:o,name:t[2],strings:e,ctor:"."===t[1]?H:"?"===t[1]?L:"@"===t[1]?z:k})}else h.push({type:6,index:o})}for(const t of e)r.removeAttribute(t)}if(W.test(r.tagName)){const e=r.textContent.split(T),t=e.length-1;if(t>0){r.textContent=x?x.emptyScript:"";for(let s=0;s<t;s++)r.append(e[s],lit_html_u()),se.nextNode(),h.push({type:2,index:++o});r.append(e[t],lit_html_u())}}}else if(8===r.nodeType)if(r.data===F)h.push({type:2,index:o});else{let e=-1;for(;-1!==(e=r.data.indexOf(T,e+1));)h.push({type:7,index:o}),e+=T.length-1}o++}}static createElement(e,t){const s=U.createElement("template");return s.innerHTML=e,s}}function lit_html_S(e,t,s=e,r){var o,A,l,h;if(t===ee)return t;let c=void 0!==r?null===(o=s._$Co)||void 0===o?void 0:o[r]:s._$Cl;const d=lit_html_d(t)?void 0:t._$litDirective$;return(null==c?void 0:c.constructor)!==d&&(null===(A=null==c?void 0:c._$AO)||void 0===A||A.call(c,!1),void 0===d?c=void 0:(c=new d(e),c._$AT(e,s,r)),void 0!==r?(null!==(l=(h=s)._$Co)&&void 0!==l?l:h._$Co=[])[r]=c:s._$Cl=c),void 0!==c&&(t=lit_html_S(e,c._$AS(e,t.values),c,r)),t}class M{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var t;const{el:{content:s},parts:r}=this._$AD,o=(null!==(t=null==e?void 0:e.creationScope)&&void 0!==t?t:U).importNode(s,!0);se.currentNode=o;let A=se.nextNode(),l=0,h=0,c=r[0];for(;void 0!==c;){if(l===c.index){let t;2===c.type?t=new R(A,A.nextSibling,this,e):1===c.type?t=new c.ctor(A,c.name,c.strings,this,e):6===c.type&&(t=new Z(A,this,e)),this._$AV.push(t),c=r[++h]}l!==(null==c?void 0:c.index)&&(A=se.nextNode(),l++)}return se.currentNode=U,o}v(e){let t=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(e,s,t),t+=s.strings.length-2):s._$AI(e[t])),t++}}class R{constructor(e,t,s,r){var o;this.type=2,this._$AH=te,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=s,this.options=r,this._$Cp=null===(o=null==r?void 0:r.isConnected)||void 0===o||o}get _$AU(){var e,t;return null!==(t=null===(e=this._$AM)||void 0===e?void 0:e._$AU)&&void 0!==t?t:this._$Cp}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===(null==e?void 0:e.nodeType)&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=lit_html_S(this,e,t),lit_html_d(e)?e===te||null==e||""===e?(this._$AH!==te&&this._$AR(),this._$AH=te):e!==this._$AH&&e!==ee&&this._(e):void 0!==e._$litType$?this.g(e):void 0!==e.nodeType?this.$(e):v(e)?this.T(e):this._(e)}k(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}$(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}_(e){this._$AH!==te&&lit_html_d(this._$AH)?this._$AA.nextSibling.data=e:this.$(U.createTextNode(e)),this._$AH=e}g(e){var t;const{values:s,_$litType$:r}=e,o="number"==typeof r?this._$AC(e):(void 0===r.el&&(r.el=N.createElement(P(r.h,r.h[0]),this.options)),r);if((null===(t=this._$AH)||void 0===t?void 0:t._$AD)===o)this._$AH.v(s);else{const e=new M(o,this),t=e.u(this.options);e.v(s),this.$(t),this._$AH=e}}_$AC(e){let t=ie.get(e.strings);return void 0===t&&ie.set(e.strings,t=new N(e)),t}T(e){G(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let s,r=0;for(const o of e)r===t.length?t.push(s=new R(this.k(lit_html_u()),this.k(lit_html_u()),this,this.options)):s=t[r],s._$AI(o),r++;r<t.length&&(this._$AR(s&&s._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){var s;for(null===(s=this._$AP)||void 0===s||s.call(this,!1,!0,t);e&&e!==this._$AB;){const t=e.nextSibling;e.remove(),e=t}}setConnected(e){var t;void 0===this._$AM&&(this._$Cp=e,null===(t=this._$AP)||void 0===t||t.call(this,e))}}class k{constructor(e,t,s,r,o){this.type=1,this._$AH=te,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=o,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=te}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,t=this,s,r){const o=this.strings;let A=!1;if(void 0===o)e=lit_html_S(this,e,t,0),A=!lit_html_d(e)||e!==this._$AH&&e!==ee,A&&(this._$AH=e);else{const r=e;let l,h;for(e=o[0],l=0;l<o.length-1;l++)h=lit_html_S(this,r[s+l],t,l),h===ee&&(h=this._$AH[l]),A||(A=!lit_html_d(h)||h!==this._$AH[l]),h===te?e=te:e!==te&&(e+=(null!=h?h:"")+o[l+1]),this._$AH[l]=h}A&&!r&&this.j(e)}j(e){e===te?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=e?e:"")}}class H extends k{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===te?void 0:e}}const ne=x?x.emptyScript:"";class L extends k{constructor(){super(...arguments),this.type=4}j(e){e&&e!==te?this.element.setAttribute(this.name,ne):this.element.removeAttribute(this.name)}}class z extends k{constructor(e,t,s,r,o){super(e,t,s,r,o),this.type=5}_$AI(e,t=this){var s;if((e=null!==(s=lit_html_S(this,e,t,0))&&void 0!==s?s:te)===ee)return;const r=this._$AH,o=e===te&&r!==te||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,A=e!==te&&(r===te||o);o&&this.element.removeEventListener(this.name,this,r),A&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t,s;"function"==typeof this._$AH?this._$AH.call(null!==(s=null===(t=this.options)||void 0===t?void 0:t.host)&&void 0!==s?s:this.element,e):this._$AH.handleEvent(e)}}class Z{constructor(e,t,s){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(e){lit_html_S(this,e)}}const re=Q.litHtmlPolyfillSupport;null==re||re(N,R),(null!==(y=Q.litHtmlVersions)&&void 0!==y?y:Q.litHtmlVersions=[]).push("2.8.0");const D=(e,t,s)=>{var r,o;const A=null!==(r=null==s?void 0:s.renderBefore)&&void 0!==r?r:t;let l=A._$litPart$;if(void 0===l){const e=null!==(o=null==s?void 0:s.renderBefore)&&void 0!==o?o:null;A._$litPart$=l=new R(t.insertBefore(lit_html_u(),e),e,void 0,null!=s?s:{})}return l._$AI(e),l},ae=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,oe=Symbol(),Ae=new Map;class css_tag_s{constructor(e,t){if(this._$cssResult$=!0,t!==oe)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){let e=Ae.get(this.cssText);return ae&&void 0===e&&(Ae.set(this.cssText,e=new CSSStyleSheet),e.replaceSync(this.cssText)),e}toString(){return this.cssText}}const le=ae?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const s of e.cssRules)t+=s.cssText;return(e=>new css_tag_s("string"==typeof e?e:e+"",oe))(t)})(e):e;var he;const ce=window.trustedTypes,ue=ce?ce.emptyScript:"",de=window.reactiveElementPolyfillSupport,ge={toAttribute(e,t){switch(t){case Boolean:e=e?ue:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let s=e;switch(t){case Boolean:s=null!==e;break;case Number:s=null===e?null:Number(e);break;case Object:case Array:try{s=JSON.parse(e)}catch(e){s=null}}return s}},reactive_element_reactive_element_n=(e,t)=>t!==e&&(t==t||e==e),pe={attribute:!0,type:String,converter:ge,reflect:!1,hasChanged:reactive_element_reactive_element_n};class reactive_element_a extends HTMLElement{constructor(){super(),this._$Et=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Ei=null,this.o()}static addInitializer(e){var t;null!==(t=this.l)&&void 0!==t||(this.l=[]),this.l.push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach(((t,s)=>{const r=this._$Eh(s,t);void 0!==r&&(this._$Eu.set(r,s),e.push(r))})),e}static createProperty(e,t=pe){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const s="symbol"==typeof e?Symbol():"__"+e,r=this.getPropertyDescriptor(e,s,t);void 0!==r&&Object.defineProperty(this.prototype,e,r)}}static getPropertyDescriptor(e,t,s){return{get(){return this[t]},set(r){const o=this[e];this[t]=r,this.requestUpdate(e,o,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||pe}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),this.elementProperties=new Map(e.elementProperties),this._$Eu=new Map,this.hasOwnProperty("properties")){const e=this.properties,t=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const s of t)this.createProperty(s,e[s])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const s=new Set(e.flat(1/0).reverse());for(const e of s)t.unshift(le(e))}else void 0!==e&&t.push(le(e));return t}static _$Eh(e,t){const s=t.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof e?e.toLowerCase():void 0}o(){var e;this._$Ep=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$Em(),this.requestUpdate(),null===(e=this.constructor.l)||void 0===e||e.forEach((e=>e(this)))}addController(e){var t,s;(null!==(t=this._$Eg)&&void 0!==t?t:this._$Eg=[]).push(e),void 0!==this.renderRoot&&this.isConnected&&(null===(s=e.hostConnected)||void 0===s||s.call(e))}removeController(e){var t;null===(t=this._$Eg)||void 0===t||t.splice(this._$Eg.indexOf(e)>>>0,1)}_$Em(){this.constructor.elementProperties.forEach(((e,t)=>{this.hasOwnProperty(t)&&(this._$Et.set(t,this[t]),delete this[t])}))}createRenderRoot(){var e;const t=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{ae?e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):t.forEach((t=>{const s=document.createElement("style"),r=window.litNonce;void 0!==r&&s.setAttribute("nonce",r),s.textContent=t.cssText,e.appendChild(s)}))})(t,this.constructor.elementStyles),t}connectedCallback(){var e;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(e=this._$Eg)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostConnected)||void 0===t?void 0:t.call(e)}))}enableUpdating(e){}disconnectedCallback(){var e;null===(e=this._$Eg)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostDisconnected)||void 0===t?void 0:t.call(e)}))}attributeChangedCallback(e,t,s){this._$AK(e,s)}_$ES(e,t,s=pe){var r,o;const A=this.constructor._$Eh(e,s);if(void 0!==A&&!0===s.reflect){const l=(null!==(o=null===(r=s.converter)||void 0===r?void 0:r.toAttribute)&&void 0!==o?o:ge.toAttribute)(t,s.type);this._$Ei=e,null==l?this.removeAttribute(A):this.setAttribute(A,l),this._$Ei=null}}_$AK(e,t){var s,r,o;const A=this.constructor,l=A._$Eu.get(e);if(void 0!==l&&this._$Ei!==l){const e=A.getPropertyOptions(l),h=e.converter,c=null!==(o=null!==(r=null===(s=h)||void 0===s?void 0:s.fromAttribute)&&void 0!==r?r:"function"==typeof h?h:null)&&void 0!==o?o:ge.fromAttribute;this._$Ei=l,this[l]=c(t,e.type),this._$Ei=null}}requestUpdate(e,t,s){let r=!0;void 0!==e&&(((s=s||this.constructor.getPropertyOptions(e)).hasChanged||reactive_element_reactive_element_n)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),!0===s.reflect&&this._$Ei!==e&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(e,s))):r=!1),!this.isUpdatePending&&r&&(this._$Ep=this._$E_())}async _$E_(){this.isUpdatePending=!0;try{await this._$Ep}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Et&&(this._$Et.forEach(((e,t)=>this[t]=e)),this._$Et=void 0);let t=!1;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),null===(e=this._$Eg)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostUpdate)||void 0===t?void 0:t.call(e)})),this.update(s)):this._$EU()}catch(e){throw t=!1,this._$EU(),e}t&&this._$AE(s)}willUpdate(e){}_$AE(e){var t;null===(t=this._$Eg)||void 0===t||t.forEach((e=>{var t;return null===(t=e.hostUpdated)||void 0===t?void 0:t.call(e)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Ep}shouldUpdate(e){return!0}update(e){void 0!==this._$EC&&(this._$EC.forEach(((e,t)=>this._$ES(t,this[t],e))),this._$EC=void 0),this._$EU()}updated(e){}firstUpdated(e){}}var me,fe;reactive_element_a.finalized=!0,reactive_element_a.elementProperties=new Map,reactive_element_a.elementStyles=[],reactive_element_a.shadowRootOptions={mode:"open"},null==de||de({ReactiveElement:reactive_element_a}),(null!==(he=globalThis.reactiveElementVersions)&&void 0!==he?he:globalThis.reactiveElementVersions=[]).push("1.3.2");class lit_element_s extends reactive_element_a{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,t;const s=super.createRenderRoot();return null!==(e=(t=this.renderOptions).renderBefore)&&void 0!==e||(t.renderBefore=s.firstChild),s}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=D(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),null===(e=this._$Do)||void 0===e||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),null===(e=this._$Do)||void 0===e||e.setConnected(!1)}render(){return ee}}lit_element_s.finalized=!0,lit_element_s._$litElement$=!0,null===(me=globalThis.litElementHydrateSupport)||void 0===me||me.call(globalThis,{LitElement:lit_element_s});const Ie=globalThis.litElementPolyfillSupport;null==Ie||Ie({LitElement:lit_element_s});(null!==(fe=globalThis.litElementVersions)&&void 0!==fe?fe:globalThis.litElementVersions=[]).push("3.3.3");const Ee=null!=navigator.xr&&null!=self.XRSession&&null!=navigator.xr.isSessionSupported,Ce=Ee&&null!=self.XRSession.prototype.requestHitTestSource,Be=null!=self.ResizeObserver,ye=null!=self.IntersectionObserver,we=Ce,ve=((()=>{const e=navigator.userAgent||navigator.vendor||self.opera;let t=!1;(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4)))&&(t=!0)})(),/\bCrOS\b/.test(navigator.userAgent),/android/i.test(navigator.userAgent)),Qe=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!self.MSStream||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1,xe=(/Safari\//.test(navigator.userAgent),/firefox/i.test(navigator.userAgent)),be=/OculusBrowser/.test(navigator.userAgent),Se=(Qe&&/CriOS\//.test(navigator.userAgent),ve&&!xe&&!be),Me=Boolean(window.webkit&&window.webkit.messageHandlers),Te=(()=>{if(Qe){if(Me)return Boolean(/CriOS\/|EdgiOS\/|FxiOS\/|GSA\/|DuckDuckGo\//.test(navigator.userAgent));{const e=document.createElement("a");return Boolean(e.relList&&e.relList.supports&&e.relList.supports("ar"))}}return!1})();var Re=s(96763);const deserializeUrl=e=>e&&"null"!==e?toFullUrl(e):null,assertIsArCandidate=()=>{if(we)return;const e=[];throw Ee||e.push("WebXR Device API"),Ce||e.push("WebXR Hit Test API"),new Error(`The following APIs are required for AR, but are missing in this browser: ${e.join(", ")}`)},toFullUrl=e=>new URL(e,window.location.toString()).toString(),debounce=(e,t)=>{let s=null;return(...r)=>{null!=s&&self.clearTimeout(s),s=self.setTimeout((()=>{s=null,e(...r)}),t)}},clamp=(e,t,s)=>Math.max(t,Math.min(s,e)),De=(()=>{const e=(()=>{var e;if(null===(e=document.documentElement.getAttribute("itemtype"))||void 0===e?void 0:e.includes("schema.org/SearchResultsPage"))return!0;const t=null!=document.head?Array.from(document.head.querySelectorAll("meta")):[];for(const e of t)if("viewport"===e.name)return!0;return!1})();return e||Re.warn('No <meta name="viewport"> detected; <model-viewer> will cap pixel density at 1.'),()=>e?window.devicePixelRatio:1})(),Le=(()=>{const e=new RegExp("[?&]model-viewer-debug-mode(&|$)");return()=>self.ModelViewerElement&&self.ModelViewerElement.debugMode||self.location&&self.location.search&&self.location.search.match(e)})();var __decorate=function(e,t,s,r){var o,A=arguments.length,l=A<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,s,r);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(l=(A<3?o(l):A>3?o(t,s,l):o(t,s))||l);return A>3&&l&&Object.defineProperty(t,s,l),l};const Fe=Symbol("currentEnvironmentMap"),_e=Symbol("currentBackground"),ke=Symbol("updateEnvironment"),Ue=Symbol("cancelEnvironmentUpdate"),Ge=X`
|
|
2
|
+
"use strict";(self.webpackChunkCrystaldesignDivaWebPlannerReact=self.webpackChunkCrystaldesignDivaWebPlannerReact||[]).push([[6854],{46854:(e,t,s)=>{s.r(t),s.d(t,{CanvasTexture:()=>o.GOR,FileLoader:()=>o.Y9S,Loader:()=>o.aHM,ModelViewerElement:()=>gl,NearestFilter:()=>o.hxR});const i=(e,t)=>"method"===t.kind&&t.descriptor&&!("value"in t.descriptor)?{...t,finisher(s){s.createProperty(t.key,e)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:t.key,initializer(){"function"==typeof t.initializer&&(this[t.key]=t.initializer.call(this))},finisher(s){s.createProperty(t.key,e)}};function n(e){return(t,s)=>void 0!==s?((e,t,s)=>{t.constructor.createProperty(s,e)})(e,t,s):i(e,t)}var r;null===(r=window.HTMLSlotElement)||void 0===r||r.prototype.assignedElements;var o=s(91177);const A=window,l=A.ShadowRoot&&(void 0===A.ShadyCSS||A.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,h=Symbol(),c=new WeakMap;class css_tag_o{constructor(e,t,s){if(this._$cssResult$=!0,s!==h)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(l&&void 0===e){const s=void 0!==t&&1===t.length;s&&(e=c.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),s&&c.set(t,e))}return e}toString(){return this.cssText}}const d=l?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const s of e.cssRules)t+=s.cssText;return(e=>new css_tag_o("string"==typeof e?e:e+"",void 0,h))(t)})(e):e;var g;const p=window,m=p.trustedTypes,f=m?m.emptyScript:"",I=p.reactiveElementPolyfillSupport,E={toAttribute(e,t){switch(t){case Boolean:e=e?f:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let s=e;switch(t){case Boolean:s=null!==e;break;case Number:s=null===e?null:Number(e);break;case Object:case Array:try{s=JSON.parse(e)}catch(e){s=null}}return s}},a=(e,t)=>t!==e&&(t==t||e==e),C={attribute:!0,type:String,converter:E,reflect:!1,hasChanged:a},B="finalized";class u extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var t;this.finalize(),(null!==(t=this.h)&&void 0!==t?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach(((t,s)=>{const r=this._$Ep(s,t);void 0!==r&&(this._$Ev.set(r,s),e.push(r))})),e}static createProperty(e,t=C){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const s="symbol"==typeof e?Symbol():"__"+e,r=this.getPropertyDescriptor(e,s,t);void 0!==r&&Object.defineProperty(this.prototype,e,r)}}static getPropertyDescriptor(e,t,s){return{get(){return this[t]},set(r){const o=this[e];this[t]=r,this.requestUpdate(e,o,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||C}static finalize(){if(this.hasOwnProperty(B))return!1;this[B]=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),void 0!==e.h&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const e=this.properties,t=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const s of t)this.createProperty(s,e[s])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const s=new Set(e.flat(1/0).reverse());for(const e of s)t.unshift(d(e))}else void 0!==e&&t.push(d(e));return t}static _$Ep(e,t){const s=t.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof e?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(e=this.constructor.h)||void 0===e||e.forEach((e=>e(this)))}addController(e){var t,s;(null!==(t=this._$ES)&&void 0!==t?t:this._$ES=[]).push(e),void 0!==this.renderRoot&&this.isConnected&&(null===(s=e.hostConnected)||void 0===s||s.call(e))}removeController(e){var t;null===(t=this._$ES)||void 0===t||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])}))}createRenderRoot(){var e;const t=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{l?e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):t.forEach((t=>{const s=document.createElement("style"),r=A.litNonce;void 0!==r&&s.setAttribute("nonce",r),s.textContent=t.cssText,e.appendChild(s)}))})(t,this.constructor.elementStyles),t}connectedCallback(){var e;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostConnected)||void 0===t?void 0:t.call(e)}))}enableUpdating(e){}disconnectedCallback(){var e;null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostDisconnected)||void 0===t?void 0:t.call(e)}))}attributeChangedCallback(e,t,s){this._$AK(e,s)}_$EO(e,t,s=C){var r;const o=this.constructor._$Ep(e,s);if(void 0!==o&&!0===s.reflect){const A=(void 0!==(null===(r=s.converter)||void 0===r?void 0:r.toAttribute)?s.converter:E).toAttribute(t,s.type);this._$El=e,null==A?this.removeAttribute(o):this.setAttribute(o,A),this._$El=null}}_$AK(e,t){var s;const r=this.constructor,o=r._$Ev.get(e);if(void 0!==o&&this._$El!==o){const e=r.getPropertyOptions(o),A="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==(null===(s=e.converter)||void 0===s?void 0:s.fromAttribute)?e.converter:E;this._$El=o,this[o]=A.fromAttribute(t,e.type),this._$El=null}}requestUpdate(e,t,s){let r=!0;void 0!==e&&(((s=s||this.constructor.getPropertyOptions(e)).hasChanged||a)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),!0===s.reflect&&this._$El!==e&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(e,s))):r=!1),!this.isUpdatePending&&r&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((e,t)=>this[t]=e)),this._$Ei=void 0);let t=!1;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostUpdate)||void 0===t?void 0:t.call(e)})),this.update(s)):this._$Ek()}catch(e){throw t=!1,this._$Ek(),e}t&&this._$AE(s)}willUpdate(e){}_$AE(e){var t;null===(t=this._$ES)||void 0===t||t.forEach((e=>{var t;return null===(t=e.hostUpdated)||void 0===t?void 0:t.call(e)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){void 0!==this._$EC&&(this._$EC.forEach(((e,t)=>this._$EO(t,this[t],e))),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}}var y;u[B]=!0,u.elementProperties=new Map,u.elementStyles=[],u.shadowRootOptions={mode:"open"},null==I||I({ReactiveElement:u}),(null!==(g=p.reactiveElementVersions)&&void 0!==g?g:p.reactiveElementVersions=[]).push("1.6.3");const Q=window,x=Q.trustedTypes,b=x?x.createPolicy("lit-html",{createHTML:e=>e}):void 0,S="$lit$",T=`lit$${(Math.random()+"").slice(9)}$`,F="?"+T,_=`<${F}>`,U=document,lit_html_u=()=>U.createComment(""),lit_html_d=e=>null===e||"object"!=typeof e&&"function"!=typeof e,G=Array.isArray,v=e=>G(e)||"function"==typeof(null==e?void 0:e[Symbol.iterator]),O="[ \t\n\f\r]",q=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,$=/-->/g,J=/>/g,K=RegExp(`>|${O}(?:([^\\s"'>=/]+)(${O}*=${O}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),Y=/'/g,j=/"/g,W=/^(?:script|style|textarea|title)$/i,w=e=>(t,...s)=>({_$litType$:e,strings:t,values:s}),X=w(1),ee=(w(2),Symbol.for("lit-noChange")),te=Symbol.for("lit-nothing"),ie=new WeakMap,se=U.createTreeWalker(U,129,null,!1);function P(e,t){if(!Array.isArray(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==b?b.createHTML(t):t}const V=(e,t)=>{const s=e.length-1,r=[];let o,A=2===t?"<svg>":"",l=q;for(let t=0;t<s;t++){const s=e[t];let h,c,d=-1,g=0;for(;g<s.length&&(l.lastIndex=g,c=l.exec(s),null!==c);)g=l.lastIndex,l===q?"!--"===c[1]?l=$:void 0!==c[1]?l=J:void 0!==c[2]?(W.test(c[2])&&(o=RegExp("</"+c[2],"g")),l=K):void 0!==c[3]&&(l=K):l===K?">"===c[0]?(l=null!=o?o:q,d=-1):void 0===c[1]?d=-2:(d=l.lastIndex-c[2].length,h=c[1],l=void 0===c[3]?K:'"'===c[3]?j:Y):l===j||l===Y?l=K:l===$||l===J?l=q:(l=K,o=void 0);const p=l===K&&e[t+1].startsWith("/>")?" ":"";A+=l===q?s+_:d>=0?(r.push(h),s.slice(0,d)+S+s.slice(d)+T+p):s+T+(-2===d?(r.push(void 0),t):p)}return[P(e,A+(e[s]||"<?>")+(2===t?"</svg>":"")),r]};class N{constructor({strings:e,_$litType$:t},s){let r;this.parts=[];let o=0,A=0;const l=e.length-1,h=this.parts,[c,d]=V(e,t);if(this.el=N.createElement(c,s),se.currentNode=this.el.content,2===t){const e=this.el.content,t=e.firstChild;t.remove(),e.append(...t.childNodes)}for(;null!==(r=se.nextNode())&&h.length<l;){if(1===r.nodeType){if(r.hasAttributes()){const e=[];for(const t of r.getAttributeNames())if(t.endsWith(S)||t.startsWith(T)){const s=d[A++];if(e.push(t),void 0!==s){const e=r.getAttribute(s.toLowerCase()+S).split(T),t=/([.?@])?(.*)/.exec(s);h.push({type:1,index:o,name:t[2],strings:e,ctor:"."===t[1]?H:"?"===t[1]?L:"@"===t[1]?z:k})}else h.push({type:6,index:o})}for(const t of e)r.removeAttribute(t)}if(W.test(r.tagName)){const e=r.textContent.split(T),t=e.length-1;if(t>0){r.textContent=x?x.emptyScript:"";for(let s=0;s<t;s++)r.append(e[s],lit_html_u()),se.nextNode(),h.push({type:2,index:++o});r.append(e[t],lit_html_u())}}}else if(8===r.nodeType)if(r.data===F)h.push({type:2,index:o});else{let e=-1;for(;-1!==(e=r.data.indexOf(T,e+1));)h.push({type:7,index:o}),e+=T.length-1}o++}}static createElement(e,t){const s=U.createElement("template");return s.innerHTML=e,s}}function lit_html_S(e,t,s=e,r){var o,A,l,h;if(t===ee)return t;let c=void 0!==r?null===(o=s._$Co)||void 0===o?void 0:o[r]:s._$Cl;const d=lit_html_d(t)?void 0:t._$litDirective$;return(null==c?void 0:c.constructor)!==d&&(null===(A=null==c?void 0:c._$AO)||void 0===A||A.call(c,!1),void 0===d?c=void 0:(c=new d(e),c._$AT(e,s,r)),void 0!==r?(null!==(l=(h=s)._$Co)&&void 0!==l?l:h._$Co=[])[r]=c:s._$Cl=c),void 0!==c&&(t=lit_html_S(e,c._$AS(e,t.values),c,r)),t}class M{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var t;const{el:{content:s},parts:r}=this._$AD,o=(null!==(t=null==e?void 0:e.creationScope)&&void 0!==t?t:U).importNode(s,!0);se.currentNode=o;let A=se.nextNode(),l=0,h=0,c=r[0];for(;void 0!==c;){if(l===c.index){let t;2===c.type?t=new R(A,A.nextSibling,this,e):1===c.type?t=new c.ctor(A,c.name,c.strings,this,e):6===c.type&&(t=new Z(A,this,e)),this._$AV.push(t),c=r[++h]}l!==(null==c?void 0:c.index)&&(A=se.nextNode(),l++)}return se.currentNode=U,o}v(e){let t=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(e,s,t),t+=s.strings.length-2):s._$AI(e[t])),t++}}class R{constructor(e,t,s,r){var o;this.type=2,this._$AH=te,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=s,this.options=r,this._$Cp=null===(o=null==r?void 0:r.isConnected)||void 0===o||o}get _$AU(){var e,t;return null!==(t=null===(e=this._$AM)||void 0===e?void 0:e._$AU)&&void 0!==t?t:this._$Cp}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===(null==e?void 0:e.nodeType)&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=lit_html_S(this,e,t),lit_html_d(e)?e===te||null==e||""===e?(this._$AH!==te&&this._$AR(),this._$AH=te):e!==this._$AH&&e!==ee&&this._(e):void 0!==e._$litType$?this.g(e):void 0!==e.nodeType?this.$(e):v(e)?this.T(e):this._(e)}k(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}$(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}_(e){this._$AH!==te&&lit_html_d(this._$AH)?this._$AA.nextSibling.data=e:this.$(U.createTextNode(e)),this._$AH=e}g(e){var t;const{values:s,_$litType$:r}=e,o="number"==typeof r?this._$AC(e):(void 0===r.el&&(r.el=N.createElement(P(r.h,r.h[0]),this.options)),r);if((null===(t=this._$AH)||void 0===t?void 0:t._$AD)===o)this._$AH.v(s);else{const e=new M(o,this),t=e.u(this.options);e.v(s),this.$(t),this._$AH=e}}_$AC(e){let t=ie.get(e.strings);return void 0===t&&ie.set(e.strings,t=new N(e)),t}T(e){G(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let s,r=0;for(const o of e)r===t.length?t.push(s=new R(this.k(lit_html_u()),this.k(lit_html_u()),this,this.options)):s=t[r],s._$AI(o),r++;r<t.length&&(this._$AR(s&&s._$AB.nextSibling,r),t.length=r)}_$AR(e=this._$AA.nextSibling,t){var s;for(null===(s=this._$AP)||void 0===s||s.call(this,!1,!0,t);e&&e!==this._$AB;){const t=e.nextSibling;e.remove(),e=t}}setConnected(e){var t;void 0===this._$AM&&(this._$Cp=e,null===(t=this._$AP)||void 0===t||t.call(this,e))}}class k{constructor(e,t,s,r,o){this.type=1,this._$AH=te,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=o,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=te}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,t=this,s,r){const o=this.strings;let A=!1;if(void 0===o)e=lit_html_S(this,e,t,0),A=!lit_html_d(e)||e!==this._$AH&&e!==ee,A&&(this._$AH=e);else{const r=e;let l,h;for(e=o[0],l=0;l<o.length-1;l++)h=lit_html_S(this,r[s+l],t,l),h===ee&&(h=this._$AH[l]),A||(A=!lit_html_d(h)||h!==this._$AH[l]),h===te?e=te:e!==te&&(e+=(null!=h?h:"")+o[l+1]),this._$AH[l]=h}A&&!r&&this.j(e)}j(e){e===te?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=e?e:"")}}class H extends k{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===te?void 0:e}}const ne=x?x.emptyScript:"";class L extends k{constructor(){super(...arguments),this.type=4}j(e){e&&e!==te?this.element.setAttribute(this.name,ne):this.element.removeAttribute(this.name)}}class z extends k{constructor(e,t,s,r,o){super(e,t,s,r,o),this.type=5}_$AI(e,t=this){var s;if((e=null!==(s=lit_html_S(this,e,t,0))&&void 0!==s?s:te)===ee)return;const r=this._$AH,o=e===te&&r!==te||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,A=e!==te&&(r===te||o);o&&this.element.removeEventListener(this.name,this,r),A&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t,s;"function"==typeof this._$AH?this._$AH.call(null!==(s=null===(t=this.options)||void 0===t?void 0:t.host)&&void 0!==s?s:this.element,e):this._$AH.handleEvent(e)}}class Z{constructor(e,t,s){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(e){lit_html_S(this,e)}}const re=Q.litHtmlPolyfillSupport;null==re||re(N,R),(null!==(y=Q.litHtmlVersions)&&void 0!==y?y:Q.litHtmlVersions=[]).push("2.8.0");const D=(e,t,s)=>{var r,o;const A=null!==(r=null==s?void 0:s.renderBefore)&&void 0!==r?r:t;let l=A._$litPart$;if(void 0===l){const e=null!==(o=null==s?void 0:s.renderBefore)&&void 0!==o?o:null;A._$litPart$=l=new R(t.insertBefore(lit_html_u(),e),e,void 0,null!=s?s:{})}return l._$AI(e),l},ae=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,oe=Symbol(),Ae=new Map;class css_tag_s{constructor(e,t){if(this._$cssResult$=!0,t!==oe)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e}get styleSheet(){let e=Ae.get(this.cssText);return ae&&void 0===e&&(Ae.set(this.cssText,e=new CSSStyleSheet),e.replaceSync(this.cssText)),e}toString(){return this.cssText}}const le=ae?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const s of e.cssRules)t+=s.cssText;return(e=>new css_tag_s("string"==typeof e?e:e+"",oe))(t)})(e):e;var he;const ce=window.trustedTypes,ue=ce?ce.emptyScript:"",de=window.reactiveElementPolyfillSupport,ge={toAttribute(e,t){switch(t){case Boolean:e=e?ue:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let s=e;switch(t){case Boolean:s=null!==e;break;case Number:s=null===e?null:Number(e);break;case Object:case Array:try{s=JSON.parse(e)}catch(e){s=null}}return s}},reactive_element_reactive_element_n=(e,t)=>t!==e&&(t==t||e==e),pe={attribute:!0,type:String,converter:ge,reflect:!1,hasChanged:reactive_element_reactive_element_n};class reactive_element_a extends HTMLElement{constructor(){super(),this._$Et=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Ei=null,this.o()}static addInitializer(e){var t;null!==(t=this.l)&&void 0!==t||(this.l=[]),this.l.push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach(((t,s)=>{const r=this._$Eh(s,t);void 0!==r&&(this._$Eu.set(r,s),e.push(r))})),e}static createProperty(e,t=pe){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const s="symbol"==typeof e?Symbol():"__"+e,r=this.getPropertyDescriptor(e,s,t);void 0!==r&&Object.defineProperty(this.prototype,e,r)}}static getPropertyDescriptor(e,t,s){return{get(){return this[t]},set(r){const o=this[e];this[t]=r,this.requestUpdate(e,o,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||pe}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),this.elementProperties=new Map(e.elementProperties),this._$Eu=new Map,this.hasOwnProperty("properties")){const e=this.properties,t=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const s of t)this.createProperty(s,e[s])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const s=new Set(e.flat(1/0).reverse());for(const e of s)t.unshift(le(e))}else void 0!==e&&t.push(le(e));return t}static _$Eh(e,t){const s=t.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof e?e.toLowerCase():void 0}o(){var e;this._$Ep=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$Em(),this.requestUpdate(),null===(e=this.constructor.l)||void 0===e||e.forEach((e=>e(this)))}addController(e){var t,s;(null!==(t=this._$Eg)&&void 0!==t?t:this._$Eg=[]).push(e),void 0!==this.renderRoot&&this.isConnected&&(null===(s=e.hostConnected)||void 0===s||s.call(e))}removeController(e){var t;null===(t=this._$Eg)||void 0===t||t.splice(this._$Eg.indexOf(e)>>>0,1)}_$Em(){this.constructor.elementProperties.forEach(((e,t)=>{this.hasOwnProperty(t)&&(this._$Et.set(t,this[t]),delete this[t])}))}createRenderRoot(){var e;const t=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{ae?e.adoptedStyleSheets=t.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):t.forEach((t=>{const s=document.createElement("style"),r=window.litNonce;void 0!==r&&s.setAttribute("nonce",r),s.textContent=t.cssText,e.appendChild(s)}))})(t,this.constructor.elementStyles),t}connectedCallback(){var e;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(e=this._$Eg)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostConnected)||void 0===t?void 0:t.call(e)}))}enableUpdating(e){}disconnectedCallback(){var e;null===(e=this._$Eg)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostDisconnected)||void 0===t?void 0:t.call(e)}))}attributeChangedCallback(e,t,s){this._$AK(e,s)}_$ES(e,t,s=pe){var r,o;const A=this.constructor._$Eh(e,s);if(void 0!==A&&!0===s.reflect){const l=(null!==(o=null===(r=s.converter)||void 0===r?void 0:r.toAttribute)&&void 0!==o?o:ge.toAttribute)(t,s.type);this._$Ei=e,null==l?this.removeAttribute(A):this.setAttribute(A,l),this._$Ei=null}}_$AK(e,t){var s,r,o;const A=this.constructor,l=A._$Eu.get(e);if(void 0!==l&&this._$Ei!==l){const e=A.getPropertyOptions(l),h=e.converter,c=null!==(o=null!==(r=null===(s=h)||void 0===s?void 0:s.fromAttribute)&&void 0!==r?r:"function"==typeof h?h:null)&&void 0!==o?o:ge.fromAttribute;this._$Ei=l,this[l]=c(t,e.type),this._$Ei=null}}requestUpdate(e,t,s){let r=!0;void 0!==e&&(((s=s||this.constructor.getPropertyOptions(e)).hasChanged||reactive_element_reactive_element_n)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),!0===s.reflect&&this._$Ei!==e&&(void 0===this._$EC&&(this._$EC=new Map),this._$EC.set(e,s))):r=!1),!this.isUpdatePending&&r&&(this._$Ep=this._$E_())}async _$E_(){this.isUpdatePending=!0;try{await this._$Ep}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Et&&(this._$Et.forEach(((e,t)=>this[t]=e)),this._$Et=void 0);let t=!1;const s=this._$AL;try{t=this.shouldUpdate(s),t?(this.willUpdate(s),null===(e=this._$Eg)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostUpdate)||void 0===t?void 0:t.call(e)})),this.update(s)):this._$EU()}catch(e){throw t=!1,this._$EU(),e}t&&this._$AE(s)}willUpdate(e){}_$AE(e){var t;null===(t=this._$Eg)||void 0===t||t.forEach((e=>{var t;return null===(t=e.hostUpdated)||void 0===t?void 0:t.call(e)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Ep}shouldUpdate(e){return!0}update(e){void 0!==this._$EC&&(this._$EC.forEach(((e,t)=>this._$ES(t,this[t],e))),this._$EC=void 0),this._$EU()}updated(e){}firstUpdated(e){}}var me,fe;reactive_element_a.finalized=!0,reactive_element_a.elementProperties=new Map,reactive_element_a.elementStyles=[],reactive_element_a.shadowRootOptions={mode:"open"},null==de||de({ReactiveElement:reactive_element_a}),(null!==(he=globalThis.reactiveElementVersions)&&void 0!==he?he:globalThis.reactiveElementVersions=[]).push("1.3.2");class lit_element_s extends reactive_element_a{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,t;const s=super.createRenderRoot();return null!==(e=(t=this.renderOptions).renderBefore)&&void 0!==e||(t.renderBefore=s.firstChild),s}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=D(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),null===(e=this._$Do)||void 0===e||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),null===(e=this._$Do)||void 0===e||e.setConnected(!1)}render(){return ee}}lit_element_s.finalized=!0,lit_element_s._$litElement$=!0,null===(me=globalThis.litElementHydrateSupport)||void 0===me||me.call(globalThis,{LitElement:lit_element_s});const Ie=globalThis.litElementPolyfillSupport;null==Ie||Ie({LitElement:lit_element_s});(null!==(fe=globalThis.litElementVersions)&&void 0!==fe?fe:globalThis.litElementVersions=[]).push("3.3.3");const Ee=null!=navigator.xr&&null!=self.XRSession&&null!=navigator.xr.isSessionSupported,Ce=Ee&&null!=self.XRSession.prototype.requestHitTestSource,Be=null!=self.ResizeObserver,ye=null!=self.IntersectionObserver,we=Ce,ve=((()=>{const e=navigator.userAgent||navigator.vendor||self.opera;let t=!1;(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(e)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(e.substr(0,4)))&&(t=!0)})(),/\bCrOS\b/.test(navigator.userAgent),/android/i.test(navigator.userAgent)),Qe=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!self.MSStream||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1,xe=(/Safari\//.test(navigator.userAgent),/firefox/i.test(navigator.userAgent)),be=/OculusBrowser/.test(navigator.userAgent),Se=(Qe&&/CriOS\//.test(navigator.userAgent),ve&&!xe&&!be),Me=Boolean(window.webkit&&window.webkit.messageHandlers),Te=(()=>{if(Qe){if(Me)return Boolean(/CriOS\/|EdgiOS\/|FxiOS\/|GSA\/|DuckDuckGo\//.test(navigator.userAgent));{const e=document.createElement("a");return Boolean(e.relList&&e.relList.supports&&e.relList.supports("ar"))}}return!1})();var Re=s(96763);const deserializeUrl=e=>e&&"null"!==e?toFullUrl(e):null,assertIsArCandidate=()=>{if(we)return;const e=[];throw Ee||e.push("WebXR Device API"),Ce||e.push("WebXR Hit Test API"),new Error(`The following APIs are required for AR, but are missing in this browser: ${e.join(", ")}`)},toFullUrl=e=>new URL(e,window.location.toString()).toString(),debounce=(e,t)=>{let s=null;return(...r)=>{null!=s&&self.clearTimeout(s),s=self.setTimeout((()=>{s=null,e(...r)}),t)}},clamp=(e,t,s)=>Math.max(t,Math.min(s,e)),De=(()=>{const e=(()=>{var e;if(null===(e=document.documentElement.getAttribute("itemtype"))||void 0===e?void 0:e.includes("schema.org/SearchResultsPage"))return!0;const t=null!=document.head?Array.from(document.head.querySelectorAll("meta")):[];for(const e of t)if("viewport"===e.name)return!0;return!1})();return e||Re.warn('No <meta name="viewport"> detected; <model-viewer> will cap pixel density at 1.'),()=>e?window.devicePixelRatio:1})(),Le=(()=>{const e=new RegExp("[?&]model-viewer-debug-mode(&|$)");return()=>self.ModelViewerElement&&self.ModelViewerElement.debugMode||self.location&&self.location.search&&self.location.search.match(e)})();var __decorate=function(e,t,s,r){var o,A=arguments.length,l=A<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,s,r);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(l=(A<3?o(l):A>3?o(t,s,l):o(t,s))||l);return A>3&&l&&Object.defineProperty(t,s,l),l};const Fe=Symbol("currentEnvironmentMap"),_e=Symbol("currentBackground"),ke=Symbol("updateEnvironment"),Ue=Symbol("cancelEnvironmentUpdate"),Ge=X`
|
|
3
3
|
<style>
|
|
4
4
|
:host {
|
|
5
5
|
display: block;
|
|
@@ -405,4 +405,4 @@ canvas {
|
|
|
405
405
|
</div>
|
|
406
406
|
<div class="screen-reader-only" role="region" aria-label="Live announcements">
|
|
407
407
|
<span id="status" role="status"></span>
|
|
408
|
-
</div>`;var Pe=s(96763);const Ne=new WeakMap;class DRACOLoader extends o.aHM{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,s,r){const A=new o.Y9S(this.manager);A.setPath(this.path),A.setResponseType("arraybuffer"),A.setRequestHeader(this.requestHeader),A.setWithCredentials(this.withCredentials),A.load(e,(e=>{this.parse(e,t,r)}),s,r)}parse(e,t,s=()=>{}){this.decodeDracoFile(e,t,null,null,o.er$).catch(s)}decodeDracoFile(e,t,s,r,A=o.Zr2,l=()=>{}){const h={attributeIDs:s||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!s,vertexColorSpace:A};return this.decodeGeometry(e,h).then(t).catch(l)}decodeGeometry(e,t){const s=JSON.stringify(t);if(Ne.has(e)){const t=Ne.get(e);if(t.key===s)return t.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let r;const o=this.workerNextTaskID++,A=e.byteLength,l=this._getWorker(o,A).then((s=>(r=s,new Promise(((s,A)=>{r._callbacks[o]={resolve:s,reject:A},r.postMessage({type:"decode",id:o,taskConfig:t,buffer:e},[e])}))))).then((e=>this._createGeometry(e.geometry)));return l.catch((()=>!0)).then((()=>{r&&o&&this._releaseTask(r,o)})),Ne.set(e,{key:s,promise:l}),l}_createGeometry(e){const t=new o.LoY;e.index&&t.setIndex(new o.THS(e.index.array,1));for(let s=0;s<e.attributes.length;s++){const r=e.attributes[s],A=r.name,l=r.array,h=r.itemSize,c=new o.THS(l,h);"color"===A&&(this._assignVertexColorSpace(c,r.vertexColorSpace),c.normalized=l instanceof Float32Array==!1),t.setAttribute(A,c)}return t}_assignVertexColorSpace(e,t){if(t!==o.er$)return;const s=new o.Q1f;for(let t=0,r=e.count;t<r;t++)s.fromBufferAttribute(e,t).convertSRGBToLinear(),e.setXYZ(t,s.r,s.g,s.b)}_loadLibrary(e,t){const s=new o.Y9S(this.manager);return s.setPath(this.decoderPath),s.setResponseType(t),s.setWithCredentials(this.withCredentials),new Promise(((t,r)=>{s.load(e,t,void 0,r)}))}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then((t=>{const s=t[0];e||(this.decoderConfig.wasmBinary=t[1]);const r=DRACOWorker.toString(),o=["/* draco decoder */",s,"","/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([o]))})),this.decoderPending}_getWorker(e,t){return this._initDecoder().then((()=>{if(this.workerPool.length<this.workerLimit){const e=new Worker(this.workerSourceURL);e._callbacks={},e._taskCosts={},e._taskLoad=0,e.postMessage({type:"init",decoderConfig:this.decoderConfig}),e.onmessage=function(t){const s=t.data;switch(s.type){case"decode":e._callbacks[s.id].resolve(s);break;case"error":e._callbacks[s.id].reject(s);break;default:Pe.error('THREE.DRACOLoader: Unexpected message, "'+s.type+'"')}},this.workerPool.push(e)}else this.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));const s=this.workerPool[this.workerPool.length-1];return s._taskCosts[e]=t,s._taskLoad+=t,s}))}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){Pe.log("Task load: ",this.workerPool.map((e=>e._taskLoad)))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,""!==this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),this}}function DRACOWorker(){let e,t;function decodeAttribute(e,t,s,r,o,A){const l=A.num_components(),h=s.num_points()*l,c=h*o.BYTES_PER_ELEMENT,d=function getDracoDataType(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(e,o),g=e._malloc(c);t.GetAttributeDataArrayForAllPoints(s,A,d,c,g);const p=new o(e.HEAPF32.buffer,g,h).slice();return e._free(g),{name:r,array:p,itemSize:l}}onmessage=function(s){const r=s.data;switch(r.type){case"init":e=r.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":const s=r.buffer,o=r.taskConfig;t.then((e=>{const t=e.draco,A=new t.Decoder;try{const e=function decodeGeometry(e,t,s,r){const o=r.attributeIDs,A=r.attributeTypes;let l,h;const c=t.GetEncodedGeometryType(s);if(c===e.TRIANGULAR_MESH)l=new e.Mesh,h=t.DecodeArrayToMesh(s,s.byteLength,l);else{if(c!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");l=new e.PointCloud,h=t.DecodeArrayToPointCloud(s,s.byteLength,l)}if(!h.ok()||0===l.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+h.error_msg());const d={index:null,attributes:[]};for(const s in o){const h=self[A[s]];let c,g;if(r.useUniqueIDs)g=o[s],c=t.GetAttributeByUniqueId(l,g);else{if(g=t.GetAttributeId(l,e[o[s]]),-1===g)continue;c=t.GetAttribute(l,g)}const p=decodeAttribute(e,t,l,s,h,c);"color"===s&&(p.vertexColorSpace=r.vertexColorSpace),d.attributes.push(p)}c===e.TRIANGULAR_MESH&&(d.index=function decodeIndex(e,t,s){const r=s.num_faces(),o=3*r,A=4*o,l=e._malloc(A);t.GetTrianglesUInt32Array(s,A,l);const h=new Uint32Array(e.HEAPF32.buffer,l,o).slice();return e._free(l),{array:h,itemSize:1}}(e,t,l));return e.destroy(l),d}(t,A,new Int8Array(s),o),l=e.attributes.map((e=>e.array.buffer));e.index&&l.push(e.index.array.buffer),self.postMessage({type:"decode",id:r.id,geometry:e},l)}catch(e){Pe.error(e),self.postMessage({type:"error",id:r.id,error:e.message})}finally{t.destroy(A)}}))}}}var Oe=s(96763);function toTrianglesDrawMode(e,t){if(t===o.RJ4)return Oe.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(t===o.rYR||t===o.O49){let s=e.getIndex();if(null===s){const t=[],r=e.getAttribute("position");if(void 0===r)return Oe.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e<r.count;e++)t.push(e);e.setIndex(t),s=e.getIndex()}const r=s.count-2,A=[];if(t===o.rYR)for(let e=1;e<=r;e++)A.push(s.getX(0)),A.push(s.getX(e)),A.push(s.getX(e+1));else for(let e=0;e<r;e++)e%2==0?(A.push(s.getX(e)),A.push(s.getX(e+1)),A.push(s.getX(e+2))):(A.push(s.getX(e+2)),A.push(s.getX(e+1)),A.push(s.getX(e)));A.length/3!==r&&Oe.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const l=e.clone();return l.setIndex(A),l.clearGroups(),l}return Oe.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e}var He=s(96763);class GLTFLoader extends o.aHM{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register((function(e){return new GLTFMaterialsClearcoatExtension(e)})),this.register((function(e){return new GLTFTextureBasisUExtension(e)})),this.register((function(e){return new GLTFTextureWebPExtension(e)})),this.register((function(e){return new GLTFTextureAVIFExtension(e)})),this.register((function(e){return new GLTFMaterialsSheenExtension(e)})),this.register((function(e){return new GLTFMaterialsTransmissionExtension(e)})),this.register((function(e){return new GLTFMaterialsVolumeExtension(e)})),this.register((function(e){return new GLTFMaterialsIorExtension(e)})),this.register((function(e){return new GLTFMaterialsEmissiveStrengthExtension(e)})),this.register((function(e){return new GLTFMaterialsSpecularExtension(e)})),this.register((function(e){return new GLTFMaterialsIridescenceExtension(e)})),this.register((function(e){return new GLTFMaterialsAnisotropyExtension(e)})),this.register((function(e){return new GLTFMaterialsBumpExtension(e)})),this.register((function(e){return new GLTFLightsExtension(e)})),this.register((function(e){return new GLTFMeshoptCompression(e)})),this.register((function(e){return new GLTFMeshGpuInstancing(e)}))}load(e,t,s,r){const A=this;let l;if(""!==this.resourcePath)l=this.resourcePath;else if(""!==this.path){const t=o.r6x.extractUrlBase(e);l=o.r6x.resolveURL(t,this.path)}else l=o.r6x.extractUrlBase(e);this.manager.itemStart(e);const _onError=function(t){r?r(t):He.error(t),A.manager.itemError(e),A.manager.itemEnd(e)},h=new o.Y9S(this.manager);h.setPath(this.path),h.setResponseType("arraybuffer"),h.setRequestHeader(this.requestHeader),h.setWithCredentials(this.withCredentials),h.load(e,(function(s){try{A.parse(s,l,(function(s){t(s),A.manager.itemEnd(e)}),_onError)}catch(e){_onError(e)}}),s,_onError)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,s,r){let o;const A={},l={},h=new TextDecoder;if("string"==typeof e)o=JSON.parse(e);else if(e instanceof ArrayBuffer){if(h.decode(new Uint8Array(e,0,4))===Ve){try{A[qe.KHR_BINARY_GLTF]=new GLTFBinaryExtension(e)}catch(e){return void(r&&r(e))}o=JSON.parse(A[qe.KHR_BINARY_GLTF].content)}else o=JSON.parse(h.decode(e))}else o=e;if(void 0===o.asset||o.asset.version[0]<2)return void(r&&r(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")));const c=new GLTFParser(o,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e<this.pluginCallbacks.length;e++){const t=this.pluginCallbacks[e](c);t.name||He.error("THREE.GLTFLoader: Invalid plugin found: missing name"),l[t.name]=t,A[t.name]=!0}if(o.extensionsUsed)for(let e=0;e<o.extensionsUsed.length;++e){const t=o.extensionsUsed[e],s=o.extensionsRequired||[];switch(t){case qe.KHR_MATERIALS_UNLIT:A[t]=new GLTFMaterialsUnlitExtension;break;case qe.KHR_DRACO_MESH_COMPRESSION:A[t]=new GLTFDracoMeshCompressionExtension(o,this.dracoLoader);break;case qe.KHR_TEXTURE_TRANSFORM:A[t]=new GLTFTextureTransformExtension;break;case qe.KHR_MESH_QUANTIZATION:A[t]=new GLTFMeshQuantizationExtension;break;default:s.indexOf(t)>=0&&void 0===l[t]&&He.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}c.setExtensions(A),c.setPlugins(l),c.parse(s,r)}parseAsync(e,t){const s=this;return new Promise((function(r,o){s.parse(e,t,r,o)}))}}function GLTFRegistry(){let e={};return{get:function(t){return e[t]},add:function(t,s){e[t]=s},remove:function(t){delete e[t]},removeAll:function(){e={}}}}const qe={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_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class GLTFLightsExtension{constructor(e){this.parser=e,this.name=qe.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let s=0,r=t.length;s<r;s++){const r=t[s];r.extensions&&r.extensions[this.name]&&void 0!==r.extensions[this.name].light&&e._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(e){const t=this.parser,s="light:"+e;let r=t.cache.get(s);if(r)return r;const A=t.json,l=((A.extensions&&A.extensions[this.name]||{}).lights||[])[e];let h;const c=new o.Q1f(16777215);void 0!==l.color&&c.setRGB(l.color[0],l.color[1],l.color[2],o.Zr2);const d=void 0!==l.range?l.range:0;switch(l.type){case"directional":h=new o.ZyN(c),h.target.position.set(0,0,-1),h.add(h.target);break;case"point":h=new o.HiM(c),h.distance=d;break;case"spot":h=new o.nCl(c),h.distance=d,l.spot=l.spot||{},l.spot.innerConeAngle=void 0!==l.spot.innerConeAngle?l.spot.innerConeAngle:0,l.spot.outerConeAngle=void 0!==l.spot.outerConeAngle?l.spot.outerConeAngle:Math.PI/4,h.angle=l.spot.outerConeAngle,h.penumbra=1-l.spot.innerConeAngle/l.spot.outerConeAngle,h.target.position.set(0,0,-1),h.add(h.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+l.type)}return h.position.set(0,0,0),h.decay=2,assignExtrasToUserData(h,l),void 0!==l.intensity&&(h.intensity=l.intensity),h.name=t.createUniqueName(l.name||"light_"+e),r=Promise.resolve(h),t.cache.add(s,r),r}getDependency(e,t){if("light"===e)return this._loadLight(t)}createNodeAttachment(e){const t=this,s=this.parser,r=s.json.nodes[e],o=(r.extensions&&r.extensions[this.name]||{}).light;return void 0===o?null:this._loadLight(o).then((function(e){return s._getNodeRef(t.cache,o,e)}))}}class GLTFMaterialsUnlitExtension{constructor(){this.name=qe.KHR_MATERIALS_UNLIT}getMaterialType(){return o.V9B}extendParams(e,t,s){const r=[];e.color=new o.Q1f(1,1,1),e.opacity=1;const A=t.pbrMetallicRoughness;if(A){if(Array.isArray(A.baseColorFactor)){const t=A.baseColorFactor;e.color.setRGB(t[0],t[1],t[2],o.Zr2),e.opacity=t[3]}void 0!==A.baseColorTexture&&r.push(s.assignTexture(e,"map",A.baseColorTexture,o.er$))}return Promise.all(r)}}class GLTFMaterialsEmissiveStrengthExtension{constructor(e){this.parser=e,this.name=qe.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const s=this.parser.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=s.extensions[this.name].emissiveStrength;return void 0!==r&&(t.emissiveIntensity=r),Promise.resolve()}}class GLTFMaterialsClearcoatExtension{constructor(e){this.parser=e,this.name=qe.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.uSd:null}extendMaterialParams(e,t){const s=this.parser,r=s.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const A=[],l=r.extensions[this.name];if(void 0!==l.clearcoatFactor&&(t.clearcoat=l.clearcoatFactor),void 0!==l.clearcoatTexture&&A.push(s.assignTexture(t,"clearcoatMap",l.clearcoatTexture)),void 0!==l.clearcoatRoughnessFactor&&(t.clearcoatRoughness=l.clearcoatRoughnessFactor),void 0!==l.clearcoatRoughnessTexture&&A.push(s.assignTexture(t,"clearcoatRoughnessMap",l.clearcoatRoughnessTexture)),void 0!==l.clearcoatNormalTexture&&(A.push(s.assignTexture(t,"clearcoatNormalMap",l.clearcoatNormalTexture)),void 0!==l.clearcoatNormalTexture.scale)){const e=l.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new o.I9Y(e,e)}return Promise.all(A)}}class GLTFMaterialsIridescenceExtension{constructor(e){this.parser=e,this.name=qe.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.uSd:null}extendMaterialParams(e,t){const s=this.parser,r=s.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const o=[],A=r.extensions[this.name];return void 0!==A.iridescenceFactor&&(t.iridescence=A.iridescenceFactor),void 0!==A.iridescenceTexture&&o.push(s.assignTexture(t,"iridescenceMap",A.iridescenceTexture)),void 0!==A.iridescenceIor&&(t.iridescenceIOR=A.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==A.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=A.iridescenceThicknessMinimum),void 0!==A.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=A.iridescenceThicknessMaximum),void 0!==A.iridescenceThicknessTexture&&o.push(s.assignTexture(t,"iridescenceThicknessMap",A.iridescenceThicknessTexture)),Promise.all(o)}}class GLTFMaterialsSheenExtension{constructor(e){this.parser=e,this.name=qe.KHR_MATERIALS_SHEEN}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.uSd:null}extendMaterialParams(e,t){const s=this.parser,r=s.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const A=[];t.sheenColor=new o.Q1f(0,0,0),t.sheenRoughness=0,t.sheen=1;const l=r.extensions[this.name];if(void 0!==l.sheenColorFactor){const e=l.sheenColorFactor;t.sheenColor.setRGB(e[0],e[1],e[2],o.Zr2)}return void 0!==l.sheenRoughnessFactor&&(t.sheenRoughness=l.sheenRoughnessFactor),void 0!==l.sheenColorTexture&&A.push(s.assignTexture(t,"sheenColorMap",l.sheenColorTexture,o.er$)),void 0!==l.sheenRoughnessTexture&&A.push(s.assignTexture(t,"sheenRoughnessMap",l.sheenRoughnessTexture)),Promise.all(A)}}class GLTFMaterialsTransmissionExtension{constructor(e){this.parser=e,this.name=qe.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.uSd:null}extendMaterialParams(e,t){const s=this.parser,r=s.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const o=[],A=r.extensions[this.name];return void 0!==A.transmissionFactor&&(t.transmission=A.transmissionFactor),void 0!==A.transmissionTexture&&o.push(s.assignTexture(t,"transmissionMap",A.transmissionTexture)),Promise.all(o)}}class GLTFMaterialsVolumeExtension{constructor(e){this.parser=e,this.name=qe.KHR_MATERIALS_VOLUME}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.uSd:null}extendMaterialParams(e,t){const s=this.parser,r=s.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const A=[],l=r.extensions[this.name];t.thickness=void 0!==l.thicknessFactor?l.thicknessFactor:0,void 0!==l.thicknessTexture&&A.push(s.assignTexture(t,"thicknessMap",l.thicknessTexture)),t.attenuationDistance=l.attenuationDistance||1/0;const h=l.attenuationColor||[1,1,1];return t.attenuationColor=(new o.Q1f).setRGB(h[0],h[1],h[2],o.Zr2),Promise.all(A)}}class GLTFMaterialsIorExtension{constructor(e){this.parser=e,this.name=qe.KHR_MATERIALS_IOR}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.uSd:null}extendMaterialParams(e,t){const s=this.parser.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=s.extensions[this.name];return t.ior=void 0!==r.ior?r.ior:1.5,Promise.resolve()}}class GLTFMaterialsSpecularExtension{constructor(e){this.parser=e,this.name=qe.KHR_MATERIALS_SPECULAR}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.uSd:null}extendMaterialParams(e,t){const s=this.parser,r=s.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const A=[],l=r.extensions[this.name];t.specularIntensity=void 0!==l.specularFactor?l.specularFactor:1,void 0!==l.specularTexture&&A.push(s.assignTexture(t,"specularIntensityMap",l.specularTexture));const h=l.specularColorFactor||[1,1,1];return t.specularColor=(new o.Q1f).setRGB(h[0],h[1],h[2],o.Zr2),void 0!==l.specularColorTexture&&A.push(s.assignTexture(t,"specularColorMap",l.specularColorTexture,o.er$)),Promise.all(A)}}class GLTFMaterialsBumpExtension{constructor(e){this.parser=e,this.name=qe.EXT_MATERIALS_BUMP}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.uSd:null}extendMaterialParams(e,t){const s=this.parser,r=s.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const o=[],A=r.extensions[this.name];return t.bumpScale=void 0!==A.bumpFactor?A.bumpFactor:1,void 0!==A.bumpTexture&&o.push(s.assignTexture(t,"bumpMap",A.bumpTexture)),Promise.all(o)}}class GLTFMaterialsAnisotropyExtension{constructor(e){this.parser=e,this.name=qe.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.uSd:null}extendMaterialParams(e,t){const s=this.parser,r=s.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const o=[],A=r.extensions[this.name];return void 0!==A.anisotropyStrength&&(t.anisotropy=A.anisotropyStrength),void 0!==A.anisotropyRotation&&(t.anisotropyRotation=A.anisotropyRotation),void 0!==A.anisotropyTexture&&o.push(s.assignTexture(t,"anisotropyMap",A.anisotropyTexture)),Promise.all(o)}}class GLTFTextureBasisUExtension{constructor(e){this.parser=e,this.name=qe.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,s=t.json,r=s.textures[e];if(!r.extensions||!r.extensions[this.name])return null;const o=r.extensions[this.name],A=t.options.ktx2Loader;if(!A){if(s.extensionsRequired&&s.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,o.source,A)}}class GLTFTextureWebPExtension{constructor(e){this.parser=e,this.name=qe.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,s=this.parser,r=s.json,o=r.textures[e];if(!o.extensions||!o.extensions[t])return null;const A=o.extensions[t],l=r.images[A.source];let h=s.textureLoader;if(l.uri){const e=s.options.manager.getHandler(l.uri);null!==e&&(h=e)}return this.detectSupport().then((function(o){if(o)return s.loadTextureImage(e,A.source,h);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return s.loadTexture(e)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}class GLTFTextureAVIFExtension{constructor(e){this.parser=e,this.name=qe.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,s=this.parser,r=s.json,o=r.textures[e];if(!o.extensions||!o.extensions[t])return null;const A=o.extensions[t],l=r.images[A.source];let h=s.textureLoader;if(l.uri){const e=s.options.manager.getHandler(l.uri);null!==e&&(h=e)}return this.detectSupport().then((function(o){if(o)return s.loadTextureImage(e,A.source,h);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return s.loadTexture(e)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}class GLTFMeshoptCompression{constructor(e){this.name=qe.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,s=t.bufferViews[e];if(s.extensions&&s.extensions[this.name]){const e=s.extensions[this.name],r=this.parser.getDependency("buffer",e.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return r.then((function(t){const s=e.byteOffset||0,r=e.byteLength||0,A=e.count,l=e.byteStride,h=new Uint8Array(t,s,r);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(A,l,h,e.mode,e.filter).then((function(e){return e.buffer})):o.ready.then((function(){const t=new ArrayBuffer(A*l);return o.decodeGltfBuffer(new Uint8Array(t),A,l,h,e.mode,e.filter),t}))}))}return null}}class GLTFMeshGpuInstancing{constructor(e){this.name=qe.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,s=t.nodes[e];if(!s.extensions||!s.extensions[this.name]||void 0===s.mesh)return null;const r=t.meshes[s.mesh];for(const e of r.primitives)if(e.mode!==Ye.TRIANGLES&&e.mode!==Ye.TRIANGLE_STRIP&&e.mode!==Ye.TRIANGLE_FAN&&void 0!==e.mode)return null;const A=s.extensions[this.name].attributes,l=[],h={};for(const e in A)l.push(this.parser.getDependency("accessor",A[e]).then((t=>(h[e]=t,h[e]))));return l.length<1?null:(l.push(this.parser.createNodeMesh(e)),Promise.all(l).then((e=>{const t=e.pop(),s=t.isGroup?t.children:[t],r=e[0].count,A=[];for(const e of s){const t=new o.kn4,s=new o.Pq0,l=new o.PTz,c=new o.Pq0(1,1,1),d=new o.ZLX(e.geometry,e.material,r);for(let e=0;e<r;e++)h.TRANSLATION&&s.fromBufferAttribute(h.TRANSLATION,e),h.ROTATION&&l.fromBufferAttribute(h.ROTATION,e),h.SCALE&&c.fromBufferAttribute(h.SCALE,e),d.setMatrixAt(e,t.compose(s,l,c));for(const t in h)if("_COLOR_0"===t){const e=h[t];d.instanceColor=new o.uWO(e.array,e.itemSize,e.normalized)}else"TRANSLATION"!==t&&"ROTATION"!==t&&"SCALE"!==t&&e.geometry.setAttribute(t,h[t]);o.B69.prototype.copy.call(d,e),this.parser.assignFinalMaterial(d),A.push(d)}return t.isGroup?(t.clear(),t.add(...A),t):A[0]})))}}const Ve="glTF",$e=1313821514,Je=5130562;class GLTFBinaryExtension{constructor(e){this.name=qe.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,12),s=new TextDecoder;if(this.header={magic:s.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==Ve)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const r=this.header.length-12,o=new DataView(e,12);let A=0;for(;A<r;){const t=o.getUint32(A,!0);A+=4;const r=o.getUint32(A,!0);if(A+=4,r===$e){const r=new Uint8Array(e,12+A,t);this.content=s.decode(r)}else if(r===Je){const s=12+A;this.body=e.slice(s,s+t)}A+=t}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class GLTFDracoMeshCompressionExtension{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=qe.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const s=this.json,r=this.dracoLoader,A=e.extensions[this.name].bufferView,l=e.extensions[this.name].attributes,h={},c={},d={};for(const e in l){const t=Ze[e]||e.toLowerCase();h[t]=l[e]}for(const t in e.attributes){const r=Ze[t]||t.toLowerCase();if(void 0!==l[t]){const o=s.accessors[e.attributes[t]],A=ze[o.componentType];d[r]=A.name,c[r]=!0===o.normalized}}return t.getDependency("bufferView",A).then((function(e){return new Promise((function(t,s){r.decodeDracoFile(e,(function(e){for(const t in e.attributes){const s=e.attributes[t],r=c[t];void 0!==r&&(s.normalized=r)}t(e)}),h,d,o.Zr2,s)}))}))}}class GLTFTextureTransformExtension{constructor(){this.name=qe.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return void 0!==t.texCoord&&t.texCoord!==e.channel||void 0!==t.offset||void 0!==t.rotation||void 0!==t.scale?(e=e.clone(),void 0!==t.texCoord&&(e.channel=t.texCoord),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),e.needsUpdate=!0,e):e}}class GLTFMeshQuantizationExtension{constructor(){this.name=qe.KHR_MESH_QUANTIZATION}}class GLTFCubicSplineInterpolant extends o.lGw{constructor(e,t,s,r){super(e,t,s,r)}copySampleValue_(e){const t=this.resultBuffer,s=this.sampleValues,r=this.valueSize,o=e*r*3+r;for(let e=0;e!==r;e++)t[e]=s[o+e];return t}interpolate_(e,t,s,r){const o=this.resultBuffer,A=this.sampleValues,l=this.valueSize,h=2*l,c=3*l,d=r-t,g=(s-t)/d,p=g*g,m=p*g,f=e*c,I=f-c,E=-2*m+3*p,C=m-p,B=1-E,y=C-p+g;for(let e=0;e!==l;e++){const t=A[I+e+l],s=A[I+e+h]*d,r=A[f+e+l],c=A[f+e]*d;o[e]=B*t+y*s+E*r+C*c}return o}}const Ke=new o.PTz;class GLTFCubicSplineQuaternionInterpolant extends GLTFCubicSplineInterpolant{interpolate_(e,t,s,r){const o=super.interpolate_(e,t,s,r);return Ke.fromArray(o).normalize().toArray(o),o}}const Ye={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},ze={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},je={9728:o.hxR,9729:o.k6q,9984:o.pHI,9985:o.kRr,9986:o.Cfg,9987:o.$_I},We={33071:o.ghU,33648:o.kTW,10497:o.GJx},Xe={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Ze={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"},et={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},tt={CUBICSPLINE:void 0,LINEAR:o.PJ3,STEP:o.ljd},it="OPAQUE",st="MASK",nt="BLEND";function createDefaultMaterial(e){return void 0===e.DefaultMaterial&&(e.DefaultMaterial=new o._4j({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:o.hB5})),e.DefaultMaterial}function addUnknownExtensionsToUserData(e,t,s){for(const r in s.extensions)void 0===e[r]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[r]=s.extensions[r])}function assignExtrasToUserData(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):He.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function updateMorphTargets(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let s=0,r=t.weights.length;s<r;s++)e.morphTargetInfluences[s]=t.weights[s];if(t.extras&&Array.isArray(t.extras.targetNames)){const s=t.extras.targetNames;if(e.morphTargetInfluences.length===s.length){e.morphTargetDictionary={};for(let t=0,r=s.length;t<r;t++)e.morphTargetDictionary[s[t]]=t}else He.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function createPrimitiveKey(e){let t;const s=e.extensions&&e.extensions[qe.KHR_DRACO_MESH_COMPRESSION];if(t=s?"draco:"+s.bufferView+":"+s.indices+":"+createAttributesKey(s.attributes):e.indices+":"+createAttributesKey(e.attributes)+":"+e.mode,void 0!==e.targets)for(let s=0,r=e.targets.length;s<r;s++)t+=":"+createAttributesKey(e.targets[s]);return t}function createAttributesKey(e){let t="";const s=Object.keys(e).sort();for(let r=0,o=s.length;r<o;r++)t+=s[r]+":"+e[s[r]]+";";return t}function getNormalizedComponentScale(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}const rt=new o.kn4;class GLTFParser{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new GLTFRegistry,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let s=!1,r=!1,A=-1;"undefined"!=typeof navigator&&(s=!0===/^((?!chrome|android).)*safari/i.test(navigator.userAgent),r=navigator.userAgent.indexOf("Firefox")>-1,A=r?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||s||r&&A<98?this.textureLoader=new o.Tap(this.options.manager):this.textureLoader=new o.Kzg(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new o.Y9S(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const s=this,r=this.json,o=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll((function(e){return e._markDefs&&e._markDefs()})),Promise.all(this._invokeAll((function(e){return e.beforeRoot&&e.beforeRoot()}))).then((function(){return Promise.all([s.getDependencies("scene"),s.getDependencies("animation"),s.getDependencies("camera")])})).then((function(t){const A={scene:t[0][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:s,userData:{}};return addUnknownExtensionsToUserData(o,A,r),assignExtrasToUserData(A,r),Promise.all(s._invokeAll((function(e){return e.afterRoot&&e.afterRoot(A)}))).then((function(){e(A)}))})).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],s=this.json.meshes||[];for(let s=0,r=t.length;s<r;s++){const r=t[s].joints;for(let t=0,s=r.length;t<s;t++)e[r[t]].isBone=!0}for(let t=0,r=e.length;t<r;t++){const r=e[t];void 0!==r.mesh&&(this._addNodeRef(this.meshCache,r.mesh),void 0!==r.skin&&(s[r.mesh].isSkinnedMesh=!0)),void 0!==r.camera&&this._addNodeRef(this.cameraCache,r.camera)}}_addNodeRef(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,s){if(e.refs[t]<=1)return s;const r=s.clone(),updateMappings=(e,t)=>{const s=this.associations.get(e);null!=s&&this.associations.set(t,s);for(const[s,r]of e.children.entries())updateMappings(r,t.children[s])};return updateMappings(s,r),r.name+="_instance_"+e.uses[t]++,r}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let s=0;s<t.length;s++){const r=e(t[s]);if(r)return r}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const s=[];for(let r=0;r<t.length;r++){const o=e(t[r]);o&&s.push(o)}return s}getDependency(e,t){const s=e+":"+t;let r=this.cache.get(s);if(!r){switch(e){case"scene":r=this.loadScene(t);break;case"node":r=this._invokeOne((function(e){return e.loadNode&&e.loadNode(t)}));break;case"mesh":r=this._invokeOne((function(e){return e.loadMesh&&e.loadMesh(t)}));break;case"accessor":r=this.loadAccessor(t);break;case"bufferView":r=this._invokeOne((function(e){return e.loadBufferView&&e.loadBufferView(t)}));break;case"buffer":r=this.loadBuffer(t);break;case"material":r=this._invokeOne((function(e){return e.loadMaterial&&e.loadMaterial(t)}));break;case"texture":r=this._invokeOne((function(e){return e.loadTexture&&e.loadTexture(t)}));break;case"skin":r=this.loadSkin(t);break;case"animation":r=this._invokeOne((function(e){return e.loadAnimation&&e.loadAnimation(t)}));break;case"camera":r=this.loadCamera(t);break;default:if(r=this._invokeOne((function(s){return s!=this&&s.getDependency&&s.getDependency(e,t)})),!r)throw new Error("Unknown type: "+e)}this.cache.add(s,r)}return r}getDependencies(e){let t=this.cache.get(e);if(!t){const s=this,r=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(r.map((function(t,r){return s.getDependency(e,r)}))),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],s=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[qe.KHR_BINARY_GLTF].body);const r=this.options;return new Promise((function(e,A){s.load(o.r6x.resolveURL(t.uri,r.path),e,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(e){const s=t.byteLength||0,r=t.byteOffset||0;return e.slice(r,r+s)}))}loadAccessor(e){const t=this,s=this.json,r=this.json.accessors[e];if(void 0===r.bufferView&&void 0===r.sparse){const e=Xe[r.type],t=ze[r.componentType],s=!0===r.normalized,A=new t(r.count*e);return Promise.resolve(new o.THS(A,e,s))}const A=[];return void 0!==r.bufferView?A.push(this.getDependency("bufferView",r.bufferView)):A.push(null),void 0!==r.sparse&&(A.push(this.getDependency("bufferView",r.sparse.indices.bufferView)),A.push(this.getDependency("bufferView",r.sparse.values.bufferView))),Promise.all(A).then((function(e){const A=e[0],l=Xe[r.type],h=ze[r.componentType],c=h.BYTES_PER_ELEMENT,d=c*l,g=r.byteOffset||0,p=void 0!==r.bufferView?s.bufferViews[r.bufferView].byteStride:void 0,m=!0===r.normalized;let f,I;if(p&&p!==d){const e=Math.floor(g/p),s="InterleavedBuffer:"+r.bufferView+":"+r.componentType+":"+e+":"+r.count;let d=t.cache.get(s);d||(f=new h(A,e*p,r.count*p/c),d=new o.eB$(f,p/c),t.cache.add(s,d)),I=new o.eHs(d,l,g%p/c,m)}else f=null===A?new h(r.count*l):new h(A,g,r.count*l),I=new o.THS(f,l,m);if(void 0!==r.sparse){const t=Xe.SCALAR,s=ze[r.sparse.indices.componentType],c=r.sparse.indices.byteOffset||0,d=r.sparse.values.byteOffset||0,g=new s(e[1],c,r.sparse.count*t),p=new h(e[2],d,r.sparse.count*l);null!==A&&(I=new o.THS(I.array.slice(),I.itemSize,I.normalized));for(let e=0,t=g.length;e<t;e++){const t=g[e];if(I.setX(t,p[e*l]),l>=2&&I.setY(t,p[e*l+1]),l>=3&&I.setZ(t,p[e*l+2]),l>=4&&I.setW(t,p[e*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return I}))}loadTexture(e){const t=this.json,s=this.options,r=t.textures[e].source,o=t.images[r];let A=this.textureLoader;if(o.uri){const e=s.manager.getHandler(o.uri);null!==e&&(A=e)}return this.loadTextureImage(e,r,A)}loadTextureImage(e,t,s){const r=this,A=this.json,l=A.textures[e],h=A.images[t],c=(h.uri||h.bufferView)+":"+l.sampler;if(this.textureCache[c])return this.textureCache[c];const d=this.loadImageSource(t,s).then((function(t){t.flipY=!1,t.name=l.name||h.name||"",""===t.name&&"string"==typeof h.uri&&!1===h.uri.startsWith("data:image/")&&(t.name=h.uri);const s=(A.samplers||{})[l.sampler]||{};return t.magFilter=je[s.magFilter]||o.k6q,t.minFilter=je[s.minFilter]||o.$_I,t.wrapS=We[s.wrapS]||o.GJx,t.wrapT=We[s.wrapT]||o.GJx,r.associations.set(t,{textures:e}),t})).catch((function(){return null}));return this.textureCache[c]=d,d}loadImageSource(e,t){const s=this,r=this.json,A=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then((e=>e.clone()));const l=r.images[e],h=self.URL||self.webkitURL;let c=l.uri||"",d=!1;if(void 0!==l.bufferView)c=s.getDependency("bufferView",l.bufferView).then((function(e){d=!0;const t=new Blob([e],{type:l.mimeType});return c=h.createObjectURL(t),c}));else if(void 0===l.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const g=Promise.resolve(c).then((function(e){return new Promise((function(s,r){let l=s;!0===t.isImageBitmapLoader&&(l=function(e){const t=new o.gPd(e);t.needsUpdate=!0,s(t)}),t.load(o.r6x.resolveURL(e,A.path),l,void 0,r)}))})).then((function(e){return!0===d&&h.revokeObjectURL(c),e.userData.mimeType=l.mimeType||function getImageURIMimeType(e){return e.search(/\.jpe?g($|\?)/i)>0||0===e.search(/^data\:image\/jpeg/)?"image/jpeg":e.search(/\.webp($|\?)/i)>0||0===e.search(/^data\:image\/webp/)?"image/webp":"image/png"}(l.uri),e})).catch((function(e){throw He.error("THREE.GLTFLoader: Couldn't load texture",c),e}));return this.sourceCache[e]=g,g}assignTexture(e,t,s,r){const o=this;return this.getDependency("texture",s.index).then((function(A){if(!A)return null;if(void 0!==s.texCoord&&s.texCoord>0&&((A=A.clone()).channel=s.texCoord),o.extensions[qe.KHR_TEXTURE_TRANSFORM]){const e=void 0!==s.extensions?s.extensions[qe.KHR_TEXTURE_TRANSFORM]:void 0;if(e){const t=o.associations.get(A);A=o.extensions[qe.KHR_TEXTURE_TRANSFORM].extendTexture(A,e),o.associations.set(A,t)}}return void 0!==r&&(A.colorSpace=r),e[t]=A,A}))}assignFinalMaterial(e){const t=e.geometry;let s=e.material;const r=void 0===t.attributes.tangent,A=void 0!==t.attributes.color,l=void 0===t.attributes.normal;if(e.isPoints){const e="PointsMaterial:"+s.uuid;let t=this.cache.get(e);t||(t=new o.BH$,o.imn.prototype.copy.call(t,s),t.color.copy(s.color),t.map=s.map,t.sizeAttenuation=!1,this.cache.add(e,t)),s=t}else if(e.isLine){const e="LineBasicMaterial:"+s.uuid;let t=this.cache.get(e);t||(t=new o.mrM,o.imn.prototype.copy.call(t,s),t.color.copy(s.color),t.map=s.map,this.cache.add(e,t)),s=t}if(r||A||l){let e="ClonedMaterial:"+s.uuid+":";r&&(e+="derivative-tangents:"),A&&(e+="vertex-colors:"),l&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=s.clone(),A&&(t.vertexColors=!0),l&&(t.flatShading=!0),r&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(s))),s=t}e.material=s}getMaterialType(){return o._4j}loadMaterial(e){const t=this,s=this.json,r=this.extensions,A=s.materials[e];let l;const h={},c=[];if((A.extensions||{})[qe.KHR_MATERIALS_UNLIT]){const e=r[qe.KHR_MATERIALS_UNLIT];l=e.getMaterialType(),c.push(e.extendParams(h,A,t))}else{const s=A.pbrMetallicRoughness||{};if(h.color=new o.Q1f(1,1,1),h.opacity=1,Array.isArray(s.baseColorFactor)){const e=s.baseColorFactor;h.color.setRGB(e[0],e[1],e[2],o.Zr2),h.opacity=e[3]}void 0!==s.baseColorTexture&&c.push(t.assignTexture(h,"map",s.baseColorTexture,o.er$)),h.metalness=void 0!==s.metallicFactor?s.metallicFactor:1,h.roughness=void 0!==s.roughnessFactor?s.roughnessFactor:1,void 0!==s.metallicRoughnessTexture&&(c.push(t.assignTexture(h,"metalnessMap",s.metallicRoughnessTexture)),c.push(t.assignTexture(h,"roughnessMap",s.metallicRoughnessTexture))),l=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),c.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,h)}))))}!0===A.doubleSided&&(h.side=o.$EB);const d=A.alphaMode||it;if(d===nt?(h.transparent=!0,h.depthWrite=!1):(h.transparent=!1,d===st&&(h.alphaTest=void 0!==A.alphaCutoff?A.alphaCutoff:.5)),void 0!==A.normalTexture&&l!==o.V9B&&(c.push(t.assignTexture(h,"normalMap",A.normalTexture)),h.normalScale=new o.I9Y(1,1),void 0!==A.normalTexture.scale)){const e=A.normalTexture.scale;h.normalScale.set(e,e)}if(void 0!==A.occlusionTexture&&l!==o.V9B&&(c.push(t.assignTexture(h,"aoMap",A.occlusionTexture)),void 0!==A.occlusionTexture.strength&&(h.aoMapIntensity=A.occlusionTexture.strength)),void 0!==A.emissiveFactor&&l!==o.V9B){const e=A.emissiveFactor;h.emissive=(new o.Q1f).setRGB(e[0],e[1],e[2],o.Zr2)}return void 0!==A.emissiveTexture&&l!==o.V9B&&c.push(t.assignTexture(h,"emissiveMap",A.emissiveTexture,o.er$)),Promise.all(c).then((function(){const s=new l(h);return A.name&&(s.name=A.name),assignExtrasToUserData(s,A),t.associations.set(s,{materials:e}),A.extensions&&addUnknownExtensionsToUserData(r,s,A),s}))}createUniqueName(e){const t=o.Nwf.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,s=this.extensions,r=this.primitiveCache;function createDracoPrimitive(e){return s[qe.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(s){return addPrimitiveAttributes(s,e,t)}))}const A=[];for(let s=0,l=e.length;s<l;s++){const l=e[s],h=createPrimitiveKey(l),c=r[h];if(c)A.push(c.promise);else{let e;e=l.extensions&&l.extensions[qe.KHR_DRACO_MESH_COMPRESSION]?createDracoPrimitive(l):addPrimitiveAttributes(new o.LoY,l,t),r[h]={primitive:l,promise:e},A.push(e)}}return Promise.all(A)}loadMesh(e){const t=this,s=this.json,r=this.extensions,A=s.meshes[e],l=A.primitives,h=[];for(let e=0,t=l.length;e<t;e++){const t=void 0===l[e].material?createDefaultMaterial(this.cache):this.getDependency("material",l[e].material);h.push(t)}return h.push(t.loadGeometries(l)),Promise.all(h).then((function(s){const h=s.slice(0,s.length-1),c=s[s.length-1],d=[];for(let s=0,g=c.length;s<g;s++){const g=c[s],p=l[s];let m;const f=h[s];if(p.mode===Ye.TRIANGLES||p.mode===Ye.TRIANGLE_STRIP||p.mode===Ye.TRIANGLE_FAN||void 0===p.mode)m=!0===A.isSkinnedMesh?new o.I46(g,f):new o.eaF(g,f),!0===m.isSkinnedMesh&&m.normalizeSkinWeights(),p.mode===Ye.TRIANGLE_STRIP?m.geometry=toTrianglesDrawMode(m.geometry,o.O49):p.mode===Ye.TRIANGLE_FAN&&(m.geometry=toTrianglesDrawMode(m.geometry,o.rYR));else if(p.mode===Ye.LINES)m=new o.DXC(g,f);else if(p.mode===Ye.LINE_STRIP)m=new o.N1A(g,f);else if(p.mode===Ye.LINE_LOOP)m=new o.FCc(g,f);else{if(p.mode!==Ye.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+p.mode);m=new o.ONl(g,f)}Object.keys(m.geometry.morphAttributes).length>0&&updateMorphTargets(m,A),m.name=t.createUniqueName(A.name||"mesh_"+e),assignExtrasToUserData(m,A),p.extensions&&addUnknownExtensionsToUserData(r,m,p),t.assignFinalMaterial(m),d.push(m)}for(let s=0,r=d.length;s<r;s++)t.associations.set(d[s],{meshes:e,primitives:s});if(1===d.length)return A.extensions&&addUnknownExtensionsToUserData(r,d[0],A),d[0];const g=new o.YJl;A.extensions&&addUnknownExtensionsToUserData(r,g,A),t.associations.set(g,{meshes:e});for(let e=0,t=d.length;e<t;e++)g.add(d[e]);return g}))}loadCamera(e){let t;const s=this.json.cameras[e],r=s[s.type];if(r)return"perspective"===s.type?t=new o.ubm(o.cj9.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):"orthographic"===s.type&&(t=new o.qUd(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),s.name&&(t.name=this.createUniqueName(s.name)),assignExtrasToUserData(t,s),Promise.resolve(t);He.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(e){const t=this.json.skins[e],s=[];for(let e=0,r=t.joints.length;e<r;e++)s.push(this._loadNodeShallow(t.joints[e]));return void 0!==t.inverseBindMatrices?s.push(this.getDependency("accessor",t.inverseBindMatrices)):s.push(null),Promise.all(s).then((function(e){const s=e.pop(),r=e,A=[],l=[];for(let e=0,h=r.length;e<h;e++){const h=r[e];if(h){A.push(h);const t=new o.kn4;null!==s&&t.fromArray(s.array,16*e),l.push(t)}else He.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[e])}return new o.EAD(A,l)}))}loadAnimation(e){const t=this.json,s=this,r=t.animations[e],A=r.name?r.name:"animation_"+e,l=[],h=[],c=[],d=[],g=[];for(let e=0,t=r.channels.length;e<t;e++){const t=r.channels[e],s=r.samplers[t.sampler],o=t.target,A=o.node,p=void 0!==r.parameters?r.parameters[s.input]:s.input,m=void 0!==r.parameters?r.parameters[s.output]:s.output;void 0!==o.node&&(l.push(this.getDependency("node",A)),h.push(this.getDependency("accessor",p)),c.push(this.getDependency("accessor",m)),d.push(s),g.push(o))}return Promise.all([Promise.all(l),Promise.all(h),Promise.all(c),Promise.all(d),Promise.all(g)]).then((function(e){const t=e[0],r=e[1],l=e[2],h=e[3],c=e[4],d=[];for(let e=0,o=t.length;e<o;e++){const o=t[e],A=r[e],g=l[e],p=h[e],m=c[e];if(void 0===o)continue;o.updateMatrix&&o.updateMatrix();const f=s._createAnimationTracks(o,A,g,p,m);if(f)for(let e=0;e<f.length;e++)d.push(f[e])}return new o.tz3(A,void 0,d)}))}createNodeMesh(e){const t=this.json,s=this,r=t.nodes[e];return void 0===r.mesh?null:s.getDependency("mesh",r.mesh).then((function(e){const t=s._getNodeRef(s.meshCache,r.mesh,e);return void 0!==r.weights&&t.traverse((function(e){if(e.isMesh)for(let t=0,s=r.weights.length;t<s;t++)e.morphTargetInfluences[t]=r.weights[t]})),t}))}loadNode(e){const t=this,s=this.json.nodes[e],r=t._loadNodeShallow(e),o=[],A=s.children||[];for(let e=0,s=A.length;e<s;e++)o.push(t.getDependency("node",A[e]));const l=void 0===s.skin?Promise.resolve(null):t.getDependency("skin",s.skin);return Promise.all([r,Promise.all(o),l]).then((function(e){const t=e[0],s=e[1],r=e[2];null!==r&&t.traverse((function(e){e.isSkinnedMesh&&e.bind(r,rt)}));for(let e=0,r=s.length;e<r;e++)t.add(s[e]);return t}))}_loadNodeShallow(e){const t=this.json,s=this.extensions,r=this;if(void 0!==this.nodeCache[e])return this.nodeCache[e];const A=t.nodes[e],l=A.name?r.createUniqueName(A.name):"",h=[],c=r._invokeOne((function(t){return t.createNodeMesh&&t.createNodeMesh(e)}));return c&&h.push(c),void 0!==A.camera&&h.push(r.getDependency("camera",A.camera).then((function(e){return r._getNodeRef(r.cameraCache,A.camera,e)}))),r._invokeAll((function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)})).forEach((function(e){h.push(e)})),this.nodeCache[e]=Promise.all(h).then((function(t){let h;if(h=!0===A.isBone?new o.$Kf:t.length>1?new o.YJl:1===t.length?t[0]:new o.B69,h!==t[0])for(let e=0,s=t.length;e<s;e++)h.add(t[e]);if(A.name&&(h.userData.name=A.name,h.name=l),assignExtrasToUserData(h,A),A.extensions&&addUnknownExtensionsToUserData(s,h,A),void 0!==A.matrix){const e=new o.kn4;e.fromArray(A.matrix),h.applyMatrix4(e)}else void 0!==A.translation&&h.position.fromArray(A.translation),void 0!==A.rotation&&h.quaternion.fromArray(A.rotation),void 0!==A.scale&&h.scale.fromArray(A.scale);return r.associations.has(h)||r.associations.set(h,{}),r.associations.get(h).nodes=e,h})),this.nodeCache[e]}loadScene(e){const t=this.extensions,s=this.json.scenes[e],r=this,A=new o.YJl;s.name&&(A.name=r.createUniqueName(s.name)),assignExtrasToUserData(A,s),s.extensions&&addUnknownExtensionsToUserData(t,A,s);const l=s.nodes||[],h=[];for(let e=0,t=l.length;e<t;e++)h.push(r.getDependency("node",l[e]));return Promise.all(h).then((function(e){for(let t=0,s=e.length;t<s;t++)A.add(e[t]);return r.associations=(e=>{const t=new Map;for(const[e,s]of r.associations)(e instanceof o.imn||e instanceof o.gPd)&&t.set(e,s);return e.traverse((e=>{const s=r.associations.get(e);null!=s&&t.set(e,s)})),t})(A),A}))}_createAnimationTracks(e,t,s,r,A){const l=[],h=e.name?e.name:e.uuid,c=[];let d;switch(et[A.path]===et.weights?e.traverse((function(e){e.morphTargetInfluences&&c.push(e.name?e.name:e.uuid)})):c.push(h),et[A.path]){case et.weights:d=o.Hit;break;case et.rotation:d=o.MBL;break;case et.position:case et.scale:d=o.RiT;break;default:if(1===s.itemSize)d=o.Hit;else d=o.RiT}const g=void 0!==r.interpolation?tt[r.interpolation]:o.PJ3,p=this._getArrayFromAccessor(s);for(let e=0,s=c.length;e<s;e++){const s=new d(c[e]+"."+et[A.path],t.array,p,g);"CUBICSPLINE"===r.interpolation&&this._createCubicSplineTrackInterpolant(s),l.push(s)}return l}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const e=getNormalizedComponentScale(t.constructor),s=new Float32Array(t.length);for(let r=0,o=t.length;r<o;r++)s[r]=t[r]*e;t=s}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function InterpolantFactoryMethodGLTFCubicSpline(e){return new(this instanceof o.MBL?GLTFCubicSplineQuaternionInterpolant:GLTFCubicSplineInterpolant)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function addPrimitiveAttributes(e,t,s){const r=t.attributes,A=[];function assignAttributeAccessor(t,r){return s.getDependency("accessor",t).then((function(t){e.setAttribute(r,t)}))}for(const t in r){const s=Ze[t]||t.toLowerCase();s in e.attributes||A.push(assignAttributeAccessor(r[t],s))}if(void 0!==t.indices&&!e.index){const r=s.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)}));A.push(r)}return o.ppV.workingColorSpace!==o.Zr2&&"COLOR_0"in r&&He.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${o.ppV.workingColorSpace}" not supported.`),assignExtrasToUserData(e,t),function computeBounds(e,t,s){const r=t.attributes,A=new o.NRn;if(void 0===r.POSITION)return;{const e=s.json.accessors[r.POSITION],t=e.min,l=e.max;if(void 0===t||void 0===l)return void He.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(A.set(new o.Pq0(t[0],t[1],t[2]),new o.Pq0(l[0],l[1],l[2])),e.normalized){const t=getNormalizedComponentScale(ze[e.componentType]);A.min.multiplyScalar(t),A.max.multiplyScalar(t)}}const l=t.targets;if(void 0!==l){const e=new o.Pq0,t=new o.Pq0;for(let r=0,o=l.length;r<o;r++){const o=l[r];if(void 0!==o.POSITION){const r=s.json.accessors[o.POSITION],A=r.min,l=r.max;if(void 0!==A&&void 0!==l){if(t.setX(Math.max(Math.abs(A[0]),Math.abs(l[0]))),t.setY(Math.max(Math.abs(A[1]),Math.abs(l[1]))),t.setZ(Math.max(Math.abs(A[2]),Math.abs(l[2]))),r.normalized){const e=getNormalizedComponentScale(ze[r.componentType]);t.multiplyScalar(e)}e.max(t)}else He.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}A.expandByVector(e)}e.boundingBox=A;const h=new o.iyt;A.getCenter(h.center),h.radius=A.min.distanceTo(A.max)/2,e.boundingSphere=h}(e,t,s),Promise.all(A).then((function(){return void 0!==t.targets?function addMorphTargets(e,t,s){let r=!1,o=!1,A=!1;for(let e=0,s=t.length;e<s;e++){const s=t[e];if(void 0!==s.POSITION&&(r=!0),void 0!==s.NORMAL&&(o=!0),void 0!==s.COLOR_0&&(A=!0),r&&o&&A)break}if(!r&&!o&&!A)return Promise.resolve(e);const l=[],h=[],c=[];for(let d=0,g=t.length;d<g;d++){const g=t[d];if(r){const t=void 0!==g.POSITION?s.getDependency("accessor",g.POSITION):e.attributes.position;l.push(t)}if(o){const t=void 0!==g.NORMAL?s.getDependency("accessor",g.NORMAL):e.attributes.normal;h.push(t)}if(A){const t=void 0!==g.COLOR_0?s.getDependency("accessor",g.COLOR_0):e.attributes.color;c.push(t)}}return Promise.all([Promise.all(l),Promise.all(h),Promise.all(c)]).then((function(t){const s=t[0],l=t[1],h=t[2];return r&&(e.morphAttributes.position=s),o&&(e.morphAttributes.normal=l),A&&(e.morphAttributes.color=h),e.morphTargetsRelative=!0,e}))}(e,t.targets,s):e}))}class WorkerPool{constructor(e=4){this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}_initWorker(e){if(!this.workers[e]){const t=this.workerCreator();t.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=t}}_getIdleWorker(){for(let e=0;e<this.pool;e++)if(!(this.workerStatus&1<<e))return e;return-1}_onMessage(e,t){const s=this.workersResolve[e];if(s&&s(t),this.queue.length){const{resolve:t,msg:s,transfer:r}=this.queue.shift();this.workersResolve[e]=t,this.workers[e].postMessage(s,r)}else this.workerStatus^=1<<e}setWorkerCreator(e){this.workerCreator=e}setWorkerLimit(e){this.pool=e}postMessage(e,t){return new Promise((s=>{const r=this._getIdleWorker();-1!==r?(this._initWorker(r),this.workerStatus|=1<<r,this.workersResolve[r]=s,this.workers[r].postMessage(e,t)):this.queue.push({resolve:s,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}}var at=s(48287).hp;const ot=2,At=0,lt=1,ht=10,ct=9,ut=15,dt=16,gt=22,pt=37,mt=43,ft=76,It=83,Et=97,Ct=100,Bt=103,yt=109,wt=165,vt=166;class Si{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=0,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:0,descriptorBlockSize:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null}}class Ii{constructor(e,t,s,r){this._dataView=new DataView(e.buffer,e.byteOffset+t,s),this._littleEndian=r,this._offset=0}_nextUint8(){const e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){const e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){const e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){const e=this._dataView.getUint32(this._offset,this._littleEndian)+2**32*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,e}_nextInt32(){const e=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,e}_skip(e){return this._offset+=e,this}_scan(e,t=0){const s=this._offset;let r=0;for(;this._dataView.getUint8(this._offset)!==t&&r<e;)r++,this._offset++;return r<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+s,r)}}new Uint8Array([0]);const Qt=[171,75,84,88,32,50,48,187,13,10,26,10];function Ei(e){return"undefined"!=typeof TextDecoder?(new TextDecoder).decode(e):at.from(e).toString("utf8")}var xt=s(48287).hp;let bt,St,Mt;const Tt={env:{emscripten_notify_memory_growth:function(e){Mt=new Uint8Array(St.exports.memory.buffer)}}};class zstddec_module_Q{init(){return bt||(bt="undefined"!=typeof fetch?fetch("data:application/wasm;base64,"+Rt).then((e=>e.arrayBuffer())).then((e=>WebAssembly.instantiate(e,Tt))).then(this._init):WebAssembly.instantiate(xt.from(Rt,"base64"),Tt).then(this._init),bt)}_init(e){St=e.instance,Tt.env.emscripten_notify_memory_growth(0)}decode(e,t=0){if(!St)throw new Error("ZSTDDecoder: Await .init() before decoding.");const s=e.byteLength,r=St.exports.malloc(s);Mt.set(e,r),t=t||Number(St.exports.ZSTD_findDecompressedSize(r,s));const o=St.exports.malloc(t),A=St.exports.ZSTD_decompress(o,t,r,s),l=Mt.slice(o,o+A);return St.exports.free(r),St.exports.free(o),l}}const Rt="AGF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QJ/IAAgA2ohBQJAIANBB0wEQANAIAAgBU8NAiAAIAItAAA6AAAgAEEBaiEAIAJBAWohAgwAAAsACyAEQQFGBEACQCAAIAJrIgZBB00EQCAAIAItAAA6AAAgACACLQABOgABIAAgAi0AAjoAAiAAIAItAAM6AAMgAEEEaiACIAZBAnQiBkHAHmooAgBqIgIQFyACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIAFBAWsOAgEAAgtBbA8LIAAhAwsgAwsMACAAIAEgAkEAEC4LiAQCA38CfiADEBYhBCAAQQBBKBAQIQAgBCACSwRAIAQPCyABRQRAQX8PCwJAAkAgA0EBRg0AIAEoAAAiB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AggABALIABqBUEACyABayEMCyAHQfAAaiQAIAwLkRcCFn8FfiMAQdABayIHJAAgByAAKALw4QEiCDYCvAEgASACaiESIAggACgCgOIBaiETAkACQCAFRQRAIAEhAwwBCyAAKALE4AEhESAAKALA4AEhFSAAKAK84AEhDyAAQQE2AozhAUEAIQgDQCAIQQNHBEAgByAIQQJ0IgJqIAAgAmpBrNABaigCADYCVCAIQQFqIQgMAQsLIAcgETYCZCAHIA82AmAgByABIA9rNgJoQWwhECAHQShqIAMgBBAGEAMNASAFQQQgBUEESBshFyAHQTxqIAdBKGogACgCABATIAdBxABqIAdBKGogACgCCBATIAdBzABqIAdBKGogACgCBBATQQAhBCAHQeAAaiEMIAdB5ABqIQoDQCAHQShqEARBAksgBCAXTnJFBEAgBygCQCAHKAI8QQN0aikCACIdQhCIp0H/AXEhCyAHKAJQIAcoAkxBA3RqKQIAIh5CEIinQf8BcSEJIAcoAkggBygCREEDdGopAgAiH0IgiKchCCAeQiCIISAgHUIgiKchAgJAIB9CEIinQf8BcSIDQQJPBEACQCAGRSADQRlJckUEQCAIIAdBKGogA0EgIAcoAixrIg0gDSADSxsiDRAFIAMgDWsiA3RqIQggB0EoahAEGiADRQ0BIAdBKGogAxAFIAhqIQgMAQsgB0EoaiADEAUgCGohCCAHQShqEAQaCyAHKQJUISEgByAINgJUIAcgITcDWAwBCwJAIANFBEAgAgRAIAcoAlQhCAwDCyAHKAJYIQgMAQsCQAJAIAdBKGpBARAFIAggAkVqaiIDQQNGBEAgBygCVEF/aiIDIANFaiEIDAELIANBAnQgB2ooAlQiCCAIRWohCCADQQFGDQELIAcgBygCWDYCXAsLIAcgBygCVDYCWCAHIAg2AlQLICCnIQMgCQRAIAdBKGogCRAFIANqIQMLIAkgC2pBFE8EQCAHQShqEAQaCyALBEAgB0EoaiALEAUgAmohAgsgB0EoahAEGiAHIAcoAmggAmoiCSADajYCaCAKIAwgCCAJSxsoAgAhDSAHIAdBKGogHUIYiKdB/wFxEAggHadB//8DcWo2Aj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IAAoArzgASEDIAAgATYCvOABIAAgASADIAJrajYCwOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF/IwBBEGsiBSQAIAVBCGogBBAOAn8gBS0ACQRAIAAgASACIAMgBBAyDAELIAAgASACIAMgBBA0CyEAIAVBEGokACAACzQAIAAgAyAEIAUQNiIFEAMEQCAFDwsgBSAESQR/IAE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AAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ";var Dt=s(96763);const Lt=new WeakMap;let Ft,_t=0;class KTX2Loader extends o.aHM{constructor(e){super(e),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new WorkerPool,this.workerSourceURL="",this.workerConfig=null,"undefined"!=typeof MSC_TRANSCODER&&Dt.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}detectSupport(e){return!0===e.isWebGPURenderer?this.workerConfig={astcSupported:e.hasFeature("texture-compression-astc"),etc1Supported:!1,etc2Supported:e.hasFeature("texture-compression-etc2"),dxtSupported:e.hasFeature("texture-compression-bc"),bptcSupported:!1,pvrtcSupported:!1}:(this.workerConfig={astcSupported:e.extensions.has("WEBGL_compressed_texture_astc"),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")},e.capabilities.isWebGL2&&(this.workerConfig.etc1Supported=!1)),this}init(){if(!this.transcoderPending){const e=new o.Y9S(this.manager);e.setPath(this.transcoderPath),e.setWithCredentials(this.withCredentials);const t=e.loadAsync("basis_transcoder.js"),s=new o.Y9S(this.manager);s.setPath(this.transcoderPath),s.setResponseType("arraybuffer"),s.setWithCredentials(this.withCredentials);const r=s.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([t,r]).then((([e,t])=>{const s=KTX2Loader.BasisWorker.toString(),r=["/* constants */","let _EngineFormat = "+JSON.stringify(KTX2Loader.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(KTX2Loader.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(KTX2Loader.BasisFormat),"/* basis_transcoder.js */",e,"/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([r])),this.transcoderBinary=t,this.workerPool.setWorkerCreator((()=>{const e=new Worker(this.workerSourceURL),t=this.transcoderBinary.slice(0);return e.postMessage({type:"init",config:this.workerConfig,transcoderBinary:t},[t]),e}))})),_t>0&&Dt.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),_t++}return this.transcoderPending}load(e,t,s,r){if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");const A=new o.Y9S(this.manager);A.setResponseType("arraybuffer"),A.setWithCredentials(this.withCredentials),A.load(e,(e=>{if(Lt.has(e)){return Lt.get(e).promise.then(t).catch(r)}this._createTexture(e).then((e=>t?t(e):null)).catch(r)}),s,r)}_createTextureFrom(e,t){const{faces:s,width:r,height:A,format:l,type:h,error:c,dfdFlags:d}=e;if("error"===h)return Promise.reject(c);let g;if(6===t.faceCount)g=new o.c5h(s,l,o.OUM);else{const e=s[0].mipmaps;g=t.layerCount>1?new o.iOZ(e,r,A,t.layerCount,l,o.OUM):new o.FvD(e,r,A,l,o.OUM)}return g.minFilter=1===s[0].mipmaps.length?o.k6q:o.$_I,g.magFilter=o.k6q,g.generateMipmaps=!1,g.needsUpdate=!0,g.colorSpace=parseColorSpace(t),g.premultiplyAlpha=!!(1&d),g}async _createTexture(e,t={}){const s=function Pi(e){const t=new Uint8Array(e.buffer,e.byteOffset,Qt.length);if(t[0]!==Qt[0]||t[1]!==Qt[1]||t[2]!==Qt[2]||t[3]!==Qt[3]||t[4]!==Qt[4]||t[5]!==Qt[5]||t[6]!==Qt[6]||t[7]!==Qt[7]||t[8]!==Qt[8]||t[9]!==Qt[9]||t[10]!==Qt[10]||t[11]!==Qt[11])throw new Error("Missing KTX 2.0 identifier.");const s=new Si,r=17*Uint32Array.BYTES_PER_ELEMENT,o=new Ii(e,Qt.length,r,!0);s.vkFormat=o._nextUint32(),s.typeSize=o._nextUint32(),s.pixelWidth=o._nextUint32(),s.pixelHeight=o._nextUint32(),s.pixelDepth=o._nextUint32(),s.layerCount=o._nextUint32(),s.faceCount=o._nextUint32();const A=o._nextUint32();s.supercompressionScheme=o._nextUint32();const l=o._nextUint32(),h=o._nextUint32(),c=o._nextUint32(),d=o._nextUint32(),g=o._nextUint64(),p=o._nextUint64(),m=new Ii(e,Qt.length+r,3*A*8,!0);for(let t=0;t<A;t++)s.levels.push({levelData:new Uint8Array(e.buffer,e.byteOffset+m._nextUint64(),m._nextUint64()),uncompressedByteLength:m._nextUint64()});const f=new Ii(e,l,h,!0),I={vendorId:f._skip(4)._nextUint16(),descriptorType:f._nextUint16(),versionNumber:f._nextUint16(),descriptorBlockSize:f._nextUint16(),colorModel:f._nextUint8(),colorPrimaries:f._nextUint8(),transferFunction:f._nextUint8(),flags:f._nextUint8(),texelBlockDimension:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],bytesPlane:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],samples:[]},E=(I.descriptorBlockSize/4-6)/4;for(let e=0;e<E;e++){const t={bitOffset:f._nextUint16(),bitLength:f._nextUint8(),channelType:f._nextUint8(),samplePosition:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};64&t.channelType?(t.sampleLower=f._nextInt32(),t.sampleUpper=f._nextInt32()):(t.sampleLower=f._nextUint32(),t.sampleUpper=f._nextUint32()),I.samples[e]=t}s.dataFormatDescriptor.length=0,s.dataFormatDescriptor.push(I);const C=new Ii(e,c,d,!0);for(;C._offset<d;){const e=C._nextUint32(),t=C._scan(e),r=Ei(t),o=C._scan(e-t.byteLength);s.keyValue[r]=r.match(/^ktx/i)?Ei(o):o,C._offset%4&&C._skip(4-C._offset%4)}if(p<=0)return s;const B=new Ii(e,g,p,!0),y=B._nextUint16(),Q=B._nextUint16(),x=B._nextUint32(),b=B._nextUint32(),S=B._nextUint32(),T=B._nextUint32(),F=[];for(let e=0;e<A;e++)F.push({imageFlags:B._nextUint32(),rgbSliceByteOffset:B._nextUint32(),rgbSliceByteLength:B._nextUint32(),alphaSliceByteOffset:B._nextUint32(),alphaSliceByteLength:B._nextUint32()});const _=g+B._offset,U=_+x,G=U+b,O=G+S,q=new Uint8Array(e.buffer,e.byteOffset+_,x),$=new Uint8Array(e.buffer,e.byteOffset+U,b),J=new Uint8Array(e.buffer,e.byteOffset+G,S),K=new Uint8Array(e.buffer,e.byteOffset+O,T);return s.globalData={endpointCount:y,selectorCount:Q,imageDescs:F,endpointsData:q,selectorsData:$,tablesData:J,extendedData:K},s}(new Uint8Array(e));if(0!==s.vkFormat)return async function createRawTexture(e){const{vkFormat:t}=e;if(void 0===Ut[t])throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");let s;2===e.supercompressionScheme&&(Ft||(Ft=new Promise((async e=>{const t=new zstddec_module_Q;await t.init(),e(t)}))),s=await Ft);const r=[];for(let A=0;A<e.levels.length;A++){const l=Math.max(1,e.pixelWidth>>A),h=Math.max(1,e.pixelHeight>>A),c=e.pixelDepth?Math.max(1,e.pixelDepth>>A):0,d=e.levels[A];let g,p;if(0===e.supercompressionScheme)g=d.levelData;else{if(2!==e.supercompressionScheme)throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");g=s.decode(d.levelData,d.uncompressedByteLength)}p=Gt[t]===o.RQf?new Float32Array(g.buffer,g.byteOffset,g.byteLength/Float32Array.BYTES_PER_ELEMENT):Gt[t]===o.ix0?new Uint16Array(g.buffer,g.byteOffset,g.byteLength/Uint16Array.BYTES_PER_ELEMENT):g,r.push({data:p,width:l,height:h,depth:c})}let A;if(kt.has(Ut[t]))A=0===e.pixelDepth?new o.GYF(r[0].data,e.pixelWidth,e.pixelHeight):new o.dYF(r[0].data,e.pixelWidth,e.pixelHeight,e.pixelDepth);else{if(e.pixelDepth>0)throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");A=new o.FvD(r,e.pixelWidth,e.pixelHeight)}return A.mipmaps=r,A.type=Gt[t],A.format=Ut[t],A.colorSpace=parseColorSpace(e),A.needsUpdate=!0,Promise.resolve(A)}(s);const r=t,A=this.init().then((()=>this.workerPool.postMessage({type:"transcode",buffer:e,taskConfig:r},[e]))).then((e=>this._createTextureFrom(e.data,s)));return Lt.set(e,{promise:A}),A}dispose(){return this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),_t--,this}}KTX2Loader.BasisFormat={ETC1S:0,UASTC_4x4:1},KTX2Loader.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16},KTX2Loader.EngineFormat={RGBAFormat:o.GWd,RGBA_ASTC_4x4_Format:o.qa3,RGBA_BPTC_Format:o.Fn,RGBA_ETC2_EAC_Format:o.KDk,RGBA_PVRTC_4BPPV1_Format:o.HXV,RGBA_S3TC_DXT5_Format:o.BXX,RGB_ETC1_Format:o.CVz,RGB_ETC2_Format:o.Riy,RGB_PVRTC_4BPPV1_Format:o.k6Q,RGB_S3TC_DXT1_Format:o.IE4},KTX2Loader.BasisWorker=function(){let e,t,s;const r=_EngineFormat,o=_TranscoderFormat,A=_BasisFormat;self.addEventListener("message",(function(l){const d=l.data;switch(d.type){case"init":e=d.config,function init(e){t=new Promise((t=>{s={wasmBinary:e,onRuntimeInitialized:t},BASIS(s)})).then((()=>{s.initializeBasis(),void 0===s.KTX2File&&Dt.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")}))}(d.transcoderBinary);break;case"transcode":t.then((()=>{try{const{faces:t,buffers:l,width:g,height:p,hasAlpha:m,format:f,dfdFlags:I}=function transcode(t){const l=new s.KTX2File(new Uint8Array(t));function cleanup(){l.close(),l.delete()}if(!l.isValid())throw cleanup(),new Error("THREE.KTX2Loader:\tInvalid or unsupported .ktx2 file");const d=l.isUASTC()?A.UASTC_4x4:A.ETC1S,g=l.getWidth(),p=l.getHeight(),m=l.getLayers()||1,f=l.getLevels(),I=l.getFaces(),E=l.getHasAlpha(),C=l.getDFDFlags(),{transcoderFormat:B,engineFormat:y}=function getTranscoderFormat(t,s,l,d){let g,p;const m=t===A.ETC1S?h:c;for(let r=0;r<m.length;r++){const o=m[r];if(e[o.if]&&(o.basisFormat.includes(t)&&!(d&&o.transcoderFormat.length<2)&&(!o.needsPowerOfTwo||isPowerOfTwo(s)&&isPowerOfTwo(l))))return g=o.transcoderFormat[d?1:0],p=o.engineFormat[d?1:0],{transcoderFormat:g,engineFormat:p}}return Dt.warn("THREE.KTX2Loader: No suitable compressed texture format found. Decoding to RGBA32."),g=o.RGBA32,p=r.RGBAFormat,{transcoderFormat:g,engineFormat:p}}(d,g,p,E);if(!g||!p||!f)throw cleanup(),new Error("THREE.KTX2Loader:\tInvalid texture");if(!l.startTranscoding())throw cleanup(),new Error("THREE.KTX2Loader: .startTranscoding failed");const Q=[],x=[];for(let e=0;e<I;e++){const t=[];for(let s=0;s<f;s++){const r=[];let o,A;for(let t=0;t<m;t++){const h=l.getImageLevelInfo(s,t,e);0!==e||0!==s||0!==t||h.origWidth%4==0&&h.origHeight%4==0||Dt.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."),f>1?(o=h.origWidth,A=h.origHeight):(o=h.width,A=h.height);const c=new Uint8Array(l.getImageTranscodedSizeInBytes(s,t,0,B));if(!l.transcodeImage(c,s,t,e,B,0,-1,-1))throw cleanup(),new Error("THREE.KTX2Loader: .transcodeImage failed.");r.push(c)}const h=concat(r);t.push({data:h,width:o,height:A}),x.push(h.buffer)}Q.push({mipmaps:t,width:g,height:p,format:y})}return cleanup(),{faces:Q,buffers:x,width:g,height:p,hasAlpha:E,format:y,dfdFlags:C}}(d.buffer);self.postMessage({type:"transcode",id:d.id,faces:t,width:g,height:p,hasAlpha:m,format:f,dfdFlags:I},l)}catch(e){Dt.error(e),self.postMessage({type:"error",id:d.id,error:e.message})}}))}}));const l=[{if:"astcSupported",basisFormat:[A.UASTC_4x4],transcoderFormat:[o.ASTC_4x4,o.ASTC_4x4],engineFormat:[r.RGBA_ASTC_4x4_Format,r.RGBA_ASTC_4x4_Format],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[A.ETC1S,A.UASTC_4x4],transcoderFormat:[o.BC7_M5,o.BC7_M5],engineFormat:[r.RGBA_BPTC_Format,r.RGBA_BPTC_Format],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[A.ETC1S,A.UASTC_4x4],transcoderFormat:[o.BC1,o.BC3],engineFormat:[r.RGB_S3TC_DXT1_Format,r.RGBA_S3TC_DXT5_Format],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[A.ETC1S,A.UASTC_4x4],transcoderFormat:[o.ETC1,o.ETC2],engineFormat:[r.RGB_ETC2_Format,r.RGBA_ETC2_EAC_Format],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[A.ETC1S,A.UASTC_4x4],transcoderFormat:[o.ETC1],engineFormat:[r.RGB_ETC1_Format],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[A.ETC1S,A.UASTC_4x4],transcoderFormat:[o.PVRTC1_4_RGB,o.PVRTC1_4_RGBA],engineFormat:[r.RGB_PVRTC_4BPPV1_Format,r.RGBA_PVRTC_4BPPV1_Format],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0}],h=l.sort((function(e,t){return e.priorityETC1S-t.priorityETC1S})),c=l.sort((function(e,t){return e.priorityUASTC-t.priorityUASTC}));function isPowerOfTwo(e){return e<=2||!(e&e-1)&&0!==e}function concat(e){if(1===e.length)return e[0];let t=0;for(let s=0;s<e.length;s++){t+=e[s].byteLength}const s=new Uint8Array(t);let r=0;for(let t=0;t<e.length;t++){const o=e[t];s.set(o,r),r+=o.byteLength}return s}};const kt=new Set([o.GWd,o.paN,o.VT0]),Ut={[yt]:o.GWd,[Et]:o.GWd,[pt]:o.GWd,[mt]:o.GWd,[Bt]:o.paN,[It]:o.paN,[dt]:o.paN,[gt]:o.paN,[Ct]:o.VT0,[ft]:o.VT0,[ut]:o.VT0,[ct]:o.VT0,[vt]:o.Qrf,[wt]:o.Qrf},Gt={[yt]:o.RQf,[Et]:o.ix0,[pt]:o.OUM,[mt]:o.OUM,[Bt]:o.RQf,[It]:o.ix0,[dt]:o.OUM,[gt]:o.OUM,[Ct]:o.RQf,[ft]:o.ix0,[ut]:o.OUM,[ct]:o.OUM,[vt]:o.OUM,[wt]:o.OUM};function parseColorSpace(e){const t=e.dataFormatDescriptor[0];return t.colorPrimaries===lt?t.transferFunction===ot?o.er$:o.Zr2:t.colorPrimaries===ht?t.transferFunction===ot?o.V5c:o.qIQ:(t.colorPrimaries===At||Dt.warn(`THREE.KTX2Loader: Unsupported color primaries, "${t.colorPrimaries}"`),o.jf0)}var Pt,Nt;const Ot=Symbol("retainerCount"),Ht=Symbol("recentlyUsed"),qt=Symbol("evict"),Vt=Symbol("evictionThreshold"),$t=Symbol("cache");class CacheEvictionPolicy{constructor(e,t=5){this[Pt]=new Map,this[Nt]=[],this[$t]=e,this[Vt]=t}set evictionThreshold(e){this[Vt]=e,this[qt]()}get evictionThreshold(){return this[Vt]}get cache(){return this[$t]}retainerCount(e){return this[Ot].get(e)||0}reset(){this[Ot].clear(),this[Ht]=[]}retain(e){this[Ot].has(e)||this[Ot].set(e,0),this[Ot].set(e,this[Ot].get(e)+1);const t=this[Ht].indexOf(e);-1!==t&&this[Ht].splice(t,1),this[Ht].unshift(e),this[qt]()}release(e){this[Ot].has(e)&&this[Ot].set(e,Math.max(this[Ot].get(e)-1,0)),this[qt]()}[(Pt=Ot,Nt=Ht,qt)](){if(!(this[Ht].length<this[Vt]))for(let e=this[Ht].length-1;e>=this[Vt];--e){const t=this[Ht][e];0===this[Ot].get(t)&&(this[$t].delete(t),this[Ht].splice(e,1))}}}const mappingsArrayToTable=e=>{const t=new Map;for(const s of e.mappings)for(const e of s.variants)t.set(e,{material:null,gltfMaterialIndex:s.material});return t};class GLTFMaterialsVariantsExtension{constructor(e){this.parser=e,this.name="KHR_materials_variants"}afterRoot(e){const t=this.parser,s=t.json;if(void 0===s.extensions||void 0===s.extensions[this.name])return null;const r=(e=>{const t=[],s=new Set;for(const r of e){let e=r,o=0;for(;s.has(e);)e=r+"."+ ++o;s.add(e),t.push(e)}return t})((s.extensions[this.name].variants||[]).map((e=>e.name)));for(const r of e.scenes)r.traverse((e=>{const r=e;if(!r.material)return;const o=t.associations.get(r);if(null==o||null==o.meshes||null==o.primitives)return;const A=s.meshes[o.meshes].primitives[o.primitives].extensions;A&&A[this.name]&&(r.userData.variantMaterials=mappingsArrayToTable(A[this.name]))}));return e.userData.variants=r,Promise.resolve()}}var Jt,Kt,Yt=s(96763);o.gPd.DEFAULT_ANISOTROPY=4;const zt=new Map,jt=new Map;let Wt;const Xt=new DRACOLoader;let Zt;const ei=new KTX2Loader;let ti,ii;const si=Symbol("loader"),ni=Symbol("evictionPolicy"),ri=Symbol("GLTFInstance");class CachingGLTFLoader extends o.Qev{constructor(e){super(),this[Kt]=(new GLTFLoader).register((e=>new GLTFMaterialsVariantsExtension(e))),this[ri]=e,this[si].setDRACOLoader(Xt),this[si].setKTX2Loader(ei)}static setDRACODecoderLocation(e){Wt=e,Xt.setDecoderPath(e)}static getDRACODecoderLocation(){return Wt}static setKTX2TranscoderLocation(e){Zt=e,ei.setTranscoderPath(e)}static getKTX2TranscoderLocation(){return Zt}static setMeshoptDecoderLocation(e){var t;ti!==e&&(ti=e,ii=(t=e,new Promise(((e,s)=>{const r=document.createElement("script");document.body.appendChild(r),r.onload=e,r.onerror=s,r.async=!0,r.src=t}))).then((()=>MeshoptDecoder.ready)).then((()=>MeshoptDecoder)))}static getMeshoptDecoderLocation(){return ti}static initializeKTX2Loader(e){ei.detectSupport(e)}static get cache(){return zt}static clearCache(){zt.forEach(((e,t)=>{this.delete(t)})),this[ni].reset()}static has(e){return zt.has(e)}static async delete(e){if(!this.has(e))return;const t=zt.get(e);jt.delete(e),zt.delete(e);(await t).dispose()}static hasFinishedLoading(e){return!!jt.get(e)}get[(Jt=ni,Kt=si,ni)](){return this.constructor[ni]}async preload(e,t,s=()=>{}){if(this[si].setWithCredentials(CachingGLTFLoader.withCredentials),this.dispatchEvent({type:"preload",element:t,src:e}),!zt.has(e)){null!=ii&&this[si].setMeshoptDecoder(await ii);const t=((e,t,s=()=>{})=>{const onProgress=e=>{const t=e.loaded/e.total;s(Math.max(0,Math.min(1,isFinite(t)?t:1)))};return new Promise(((s,r)=>{t.load(e,s,onProgress,r)}))})(e,this[si],(e=>{s(.8*e)})),r=this[ri],o=t.then((e=>r.prepare(e))).then((e=>(s(.9),new r(e)))).catch((e=>(Yt.error(e),new r)));zt.set(e,o)}await zt.get(e),jt.set(e,!0),s&&s(1)}async load(e,t,s=()=>{}){await this.preload(e,t,s);const r=await zt.get(e),o=await r.clone();return this[ni].retain(e),o.dispose=()=>{this[ni].release(e)},o}}CachingGLTFLoader[Jt]=new CacheEvictionPolicy(CachingGLTFLoader);class CSS2DObject extends o.B69{constructor(e=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new o.I9Y(.5,.5),this.addEventListener("removed",(function(){this.traverse((function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))}))}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this.center=e.center,this}}const ai=new o.Pq0,oi=new o.kn4,Ai=new o.kn4,li=new o.Pq0,hi=new o.Pq0;class CSS2DRenderer{constructor(e={}){const t=this;let s,r,o,A;const l={objects:new WeakMap},h=void 0!==e.element?e.element:document.createElement("div");function renderObject(e,s,r){if(e.isCSS2DObject){ai.setFromMatrixPosition(e.matrixWorld),ai.applyMatrix4(Ai);const c=!0===e.visible&&ai.z>=-1&&ai.z<=1&&!0===e.layers.test(r.layers);if(e.element.style.display=!0===c?"":"none",!0===c){e.onBeforeRender(t,s,r);const l=e.element;l.style.transform="translate("+-100*e.center.x+"%,"+-100*e.center.y+"%)translate("+(ai.x*o+o)+"px,"+(-ai.y*A+A)+"px)",l.parentNode!==h&&h.appendChild(l),e.onAfterRender(t,s,r)}const d={distanceToCameraSquared:getDistanceToSquared(r,e)};l.objects.set(e,d)}for(let t=0,o=e.children.length;t<o;t++)renderObject(e.children[t],s,r)}function getDistanceToSquared(e,t){return li.setFromMatrixPosition(e.matrixWorld),hi.setFromMatrixPosition(t.matrixWorld),li.distanceToSquared(hi)}h.style.overflow="hidden",this.domElement=h,this.getSize=function(){return{width:s,height:r}},this.render=function(e,t){!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),oi.copy(t.matrixWorldInverse),Ai.multiplyMatrices(t.projectionMatrix,oi),renderObject(e,e,t),function zOrder(e){const t=function filterAndFlatten(e){const t=[];return e.traverse((function(e){e.isCSS2DObject&&t.push(e)})),t}(e).sort((function(e,t){if(e.renderOrder!==t.renderOrder)return t.renderOrder-e.renderOrder;return l.objects.get(e).distanceToCameraSquared-l.objects.get(t).distanceToCameraSquared})),s=t.length;for(let e=0,r=t.length;e<r;e++)t[e].element.style.zIndex=s-e}(e)},this.setSize=function(e,t){s=e,r=t,o=s/2,A=r/2,h.style.width=e+"px",h.style.height=t+"px"}}}s(96763);function reduceVertices(e,t,s){let r=s;const A=new o.Pq0;return e.updateWorldMatrix(!0,!0),e.traverseVisible((e=>{const{geometry:s}=e;if(void 0!==s){const{position:o}=s.attributes;if(void 0!==o)for(let s=0,l=o.count;s<l;s++)e.isMesh?e.getVertexPosition(s,A):A.fromBufferAttribute(o,s),e.isSkinnedMesh||A.applyMatrix4(e.matrixWorld),r=t(r,A)}})),r}let ci,ui,di,gi;function decompress(e,t=1/0,s=null){ui||(ui=new o.bdM(2,2,1,1)),di||(di=new o.BKk({uniforms:{blitTexture:new o.nc$(e)},vertexShader:"\n\t\t\tvarying vec2 vUv;\n\t\t\tvoid main(){\n\t\t\t\tvUv = uv;\n\t\t\t\tgl_Position = vec4(position.xy * 1.0,0.,.999999);\n\t\t\t}",fragmentShader:"\n\t\t\tuniform sampler2D blitTexture; \n\t\t\tvarying vec2 vUv;\n\n\t\t\tvoid main(){ \n\t\t\t\tgl_FragColor = vec4(vUv.xy, 0, 1);\n\t\t\t\t\n\t\t\t\t#ifdef IS_SRGB\n\t\t\t\tgl_FragColor = LinearTosRGB( texture2D( blitTexture, vUv) );\n\t\t\t\t#else\n\t\t\t\tgl_FragColor = texture2D( blitTexture, vUv);\n\t\t\t\t#endif\n\t\t\t}"})),di.uniforms.blitTexture.value=e,di.defines.IS_SRGB=e.colorSpace==o.er$,di.needsUpdate=!0,gi||(gi=new o.eaF(ui,di),gi.frustrumCulled=!1);const r=new o.ubm,A=new o.Z58;A.add(gi),null===s&&(s=ci=new o.JeP({antialias:!1}));const l=Math.min(e.image.width,t),h=Math.min(e.image.height,t);s.setSize(l,h),s.clear(),s.render(A,r);const c=document.createElement("canvas"),d=c.getContext("2d");c.width=l,c.height=h,d.drawImage(s.domElement,0,0,l,h);const g=new o.GOR(c);return g.minFilter=e.minFilter,g.magFilter=e.magFilter,g.wrapS=e.wrapS,g.wrapT=e.wrapT,g.name=e.name,ci&&(ci.forceContextLoss(),ci.dispose(),ci=null),g}var pi=s(96763);const mi={POSITION:["byte","byte normalized","unsigned byte","unsigned byte normalized","short","short normalized","unsigned short","unsigned short normalized"],NORMAL:["byte normalized","short normalized"],TANGENT:["byte normalized","short normalized"],TEXCOORD:["byte","byte normalized","unsigned byte","short","short normalized","unsigned short"]};class GLTFExporter{constructor(){this.pluginCallbacks=[],this.register((function(e){return new GLTFLightExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsUnlitExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsTransmissionExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsVolumeExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsIorExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsSpecularExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsClearcoatExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsIridescenceExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsSheenExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsAnisotropyExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsEmissiveStrengthExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsBumpExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMeshGpuInstancing(e)}))}register(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,s,r){const o=new GLTFWriter,A=[];for(let e=0,t=this.pluginCallbacks.length;e<t;e++)A.push(this.pluginCallbacks[e](o));o.setPlugins(A),o.write(e,t,r).catch(s)}parseAsync(e,t){const s=this;return new Promise((function(r,o){s.parse(e,r,o,t)}))}}const fi=0,Ci=1,Bi=2,yi=3,wi=4,vi=5120,Qi=5121,xi=5122,bi=5123,Mi=5124,Ti=5125,Ri=5126,Di=34962,Li=34963,Fi=9728,_i=9729,ki=9984,Ui=9985,Gi=9986,Ni=9987,Oi=33071,Hi=33648,qi=10497,Vi="KHR_mesh_quantization",$i={};$i[o.hxR]=Fi,$i[o.pHI]=ki,$i[o.Cfg]=Gi,$i[o.k6q]=_i,$i[o.kRr]=Ui,$i[o.$_I]=Ni,$i[o.ghU]=Oi,$i[o.GJx]=qi,$i[o.kTW]=Hi;const Ji={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"},Ki=new o.Q1f;function equalArray(e,t){return e.length===t.length&&e.every((function(e,s){return e===t[s]}))}function getPaddedBufferSize(e){return 4*Math.ceil(e/4)}function getPaddedArrayBuffer(e,t=0){const s=getPaddedBufferSize(e.byteLength);if(s!==e.byteLength){const r=new Uint8Array(s);if(r.set(new Uint8Array(e)),0!==t)for(let o=e.byteLength;o<s;o++)r[o]=t;return r.buffer}return e}function getCanvas(){return"undefined"==typeof document&&"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas")}function getToBlobPromise(e,t){if(void 0!==e.toBlob)return new Promise((s=>e.toBlob(s,t)));let s;return"image/jpeg"===t?s=.92:"image/webp"===t&&(s=.8),e.convertToBlob({type:t,quality:s})}class GLTFWriter{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}setPlugins(e){this.plugins=e}async write(e,t,s={}){this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},s),this.options.animations.length>0&&(this.options.trs=!0),this.processInput(e),await Promise.all(this.pending);const r=this,o=r.buffers,A=r.json;s=r.options;const l=r.extensionsUsed,h=r.extensionsRequired,c=new Blob(o,{type:"application/octet-stream"}),d=Object.keys(l),g=Object.keys(h);if(d.length>0&&(A.extensionsUsed=d),g.length>0&&(A.extensionsRequired=g),A.buffers&&A.buffers.length>0&&(A.buffers[0].byteLength=c.size),!0===s.binary){const e=new FileReader;e.readAsArrayBuffer(c),e.onloadend=function(){const s=getPaddedArrayBuffer(e.result),r=new DataView(new ArrayBuffer(8));r.setUint32(0,s.byteLength,!0),r.setUint32(4,5130562,!0);const o=getPaddedArrayBuffer(function stringToArrayBuffer(e){return(new TextEncoder).encode(e).buffer}(JSON.stringify(A)),32),l=new DataView(new ArrayBuffer(8));l.setUint32(0,o.byteLength,!0),l.setUint32(4,1313821514,!0);const h=new ArrayBuffer(12),c=new DataView(h);c.setUint32(0,1179937895,!0),c.setUint32(4,2,!0);const d=12+l.byteLength+o.byteLength+r.byteLength+s.byteLength;c.setUint32(8,d,!0);const g=new Blob([h,l,o,r,s],{type:"application/octet-stream"}),p=new FileReader;p.readAsArrayBuffer(g),p.onloadend=function(){t(p.result)}}}else if(A.buffers&&A.buffers.length>0){const e=new FileReader;e.readAsDataURL(c),e.onloadend=function(){const s=e.result;A.buffers[0].uri=s,t(A)}}else t(A)}serializeUserData(e,t){if(0===Object.keys(e.userData).length)return;const s=this.options,r=this.extensionsUsed;try{const o=JSON.parse(JSON.stringify(e.userData));if(s.includeCustomExtensions&&o.gltfExtensions){void 0===t.extensions&&(t.extensions={});for(const e in o.gltfExtensions)t.extensions[e]=o.gltfExtensions[e],r[e]=!0;delete o.gltfExtensions}Object.keys(o).length>0&&(t.extras=o)}catch(t){pi.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+t.message)}}getUID(e,t=!1){if(!1===this.uids.has(e)){const t=new Map;t.set(!0,this.uid++),t.set(!1,this.uid++),this.uids.set(e,t)}return this.uids.get(e).get(t)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;const t=new o.Pq0;for(let s=0,r=e.count;s<r;s++)if(Math.abs(t.fromBufferAttribute(e,s).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 s=e.clone(),r=new o.Pq0;for(let e=0,t=s.count;e<t;e++)r.fromBufferAttribute(s,e),0===r.x&&0===r.y&&0===r.z?r.setX(1):r.normalize(),s.setXYZ(e,r.x,r.y,r.z);return t.attributesNormalized.set(e,s),s}applyTextureTransform(e,t){let s=!1;const r={};0===t.offset.x&&0===t.offset.y||(r.offset=t.offset.toArray(),s=!0),0!==t.rotation&&(r.rotation=t.rotation,s=!0),1===t.repeat.x&&1===t.repeat.y||(r.scale=t.repeat.toArray(),s=!0),s&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=r,this.extensionsUsed.KHR_texture_transform=!0)}buildMetalRoughTexture(e,t){if(e===t)return e;function getEncodingConversion(e){return e.colorSpace===o.er$?function SRGBToLinear(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}:function LinearToLinear(e){return e}}pi.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures."),e instanceof o.FvD&&(e=decompress(e)),t instanceof o.FvD&&(t=decompress(t));const s=e?e.image:null,r=t?t.image:null,A=Math.max(s?s.width:0,r?r.width:0),l=Math.max(s?s.height:0,r?r.height:0),h=getCanvas();h.width=A,h.height=l;const c=h.getContext("2d");c.fillStyle="#00ffff",c.fillRect(0,0,A,l);const d=c.getImageData(0,0,A,l);if(s){c.drawImage(s,0,0,A,l);const t=getEncodingConversion(e),r=c.getImageData(0,0,A,l).data;for(let e=2;e<r.length;e+=4)d.data[e]=256*t(r[e]/256)}if(r){c.drawImage(r,0,0,A,l);const e=getEncodingConversion(t),s=c.getImageData(0,0,A,l).data;for(let t=1;t<s.length;t+=4)d.data[t]=256*e(s[t]/256)}c.putImageData(d,0,0);const g=(e||t).clone();return g.source=new o.kLi(h),g.colorSpace=o.jf0,g.channel=(e||t).channel,e&&t&&e.channel!==t.channel&&pi.warn("THREE.GLTFExporter: UV channels for metalnessMap and roughnessMap textures must match."),g}processBuffer(e){const t=this.json,s=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),s.push(e),0}processBufferView(e,t,s,r,A){const l=this.json;let h;switch(l.bufferViews||(l.bufferViews=[]),t){case vi:case Qi:h=1;break;case xi:case bi:h=2;break;default:h=4}const c=getPaddedBufferSize(r*e.itemSize*h),d=new DataView(new ArrayBuffer(c));let g=0;for(let A=s;A<s+r;A++)for(let s=0;s<e.itemSize;s++){let r;e.itemSize>4?r=e.array[A*e.itemSize+s]:(0===s?r=e.getX(A):1===s?r=e.getY(A):2===s?r=e.getZ(A):3===s&&(r=e.getW(A)),!0===e.normalized&&(r=o.cj9.normalize(r,e.array))),t===Ri?d.setFloat32(g,r,!0):t===Mi?d.setInt32(g,r,!0):t===Ti?d.setUint32(g,r,!0):t===xi?d.setInt16(g,r,!0):t===bi?d.setUint16(g,r,!0):t===vi?d.setInt8(g,r):t===Qi&&d.setUint8(g,r),g+=h}const p={buffer:this.processBuffer(d.buffer),byteOffset:this.byteOffset,byteLength:c};void 0!==A&&(p.target=A),A===Di&&(p.byteStride=e.itemSize*h),this.byteOffset+=c,l.bufferViews.push(p);return{id:l.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){const t=this,s=t.json;return s.bufferViews||(s.bufferViews=[]),new Promise((function(r){const o=new FileReader;o.readAsArrayBuffer(e),o.onloadend=function(){const e=getPaddedArrayBuffer(o.result),A={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,r(s.bufferViews.push(A)-1)}}))}processAccessor(e,t,s,r){const A=this.json;let l;if(e.array.constructor===Float32Array)l=Ri;else if(e.array.constructor===Int32Array)l=Mi;else if(e.array.constructor===Uint32Array)l=Ti;else if(e.array.constructor===Int16Array)l=xi;else if(e.array.constructor===Uint16Array)l=bi;else if(e.array.constructor===Int8Array)l=vi;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: "+e.array.constructor.name);l=Qi}if(void 0===s&&(s=0),void 0!==r&&r!==1/0||(r=e.count),0===r)return null;const h=function getMinMax(e,t,s){const r={min:new Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)};for(let A=t;A<t+s;A++)for(let t=0;t<e.itemSize;t++){let s;e.itemSize>4?s=e.array[A*e.itemSize+t]:(0===t?s=e.getX(A):1===t?s=e.getY(A):2===t?s=e.getZ(A):3===t&&(s=e.getW(A)),!0===e.normalized&&(s=o.cj9.normalize(s,e.array))),r.min[t]=Math.min(r.min[t],s),r.max[t]=Math.max(r.max[t],s)}return r}(e,s,r);let c;void 0!==t&&(c=e===t.index?Li:Di);const d=this.processBufferView(e,l,s,r,c),g={bufferView:d.id,byteOffset:d.byteOffset,componentType:l,count:r,max:h.max,min:h.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",9:"MAT3",16:"MAT4"}[e.itemSize]};return!0===e.normalized&&(g.normalized=!0),A.accessors||(A.accessors=[]),A.accessors.push(g)-1}processImage(e,t,s,r="image/png"){if(null!==e){const A=this,l=A.cache,h=A.json,c=A.options,d=A.pending;l.images.has(e)||l.images.set(e,{});const g=l.images.get(e),p=r+":flipY/"+s.toString();if(void 0!==g[p])return g[p];h.images||(h.images=[]);const m={mimeType:r},f=getCanvas();f.width=Math.min(e.width,c.maxTextureSize),f.height=Math.min(e.height,c.maxTextureSize);const I=f.getContext("2d");if(!0===s&&(I.translate(0,f.height),I.scale(1,-1)),void 0!==e.data){t!==o.GWd&&pi.error("GLTFExporter: Only RGBAFormat is supported.",t),(e.width>c.maxTextureSize||e.height>c.maxTextureSize)&&pi.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);const s=new Uint8ClampedArray(e.height*e.width*4);for(let t=0;t<s.length;t+=4)s[t+0]=e.data[t+0],s[t+1]=e.data[t+1],s[t+2]=e.data[t+2],s[t+3]=e.data[t+3];I.putImageData(new ImageData(s,e.width,e.height),0,0)}else I.drawImage(e,0,0,f.width,f.height);!0===c.binary?d.push(getToBlobPromise(f,r).then((e=>A.processBufferViewImage(e))).then((e=>{m.bufferView=e}))):void 0!==f.toDataURL?m.uri=f.toDataURL(r):d.push(getToBlobPromise(f,r).then((e=>(new FileReader).readAsDataURL(e))).then((e=>{m.uri=e})));const E=h.images.push(m)-1;return g[p]=E,E}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 s={magFilter:$i[e.magFilter],minFilter:$i[e.minFilter],wrapS:$i[e.wrapS],wrapT:$i[e.wrapT]};return t.samplers.push(s)-1}processTexture(e){const t=this.options,s=this.cache,r=this.json;if(s.textures.has(e))return s.textures.get(e);r.textures||(r.textures=[]),e instanceof o.FvD&&(e=decompress(e,t.maxTextureSize));let A=e.userData.mimeType;"image/webp"===A&&(A="image/png");const l={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,A)};e.name&&(l.name=e.name),this._invokeAll((function(t){t.writeTexture&&t.writeTexture(e,l)}));const h=r.textures.push(l)-1;return s.textures.set(e,h),h}processMaterial(e){const t=this.cache,s=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return pi.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;s.materials||(s.materials=[]);const r={pbrMetallicRoughness:{}};!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&pi.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");const A=e.color.toArray().concat([e.opacity]);if(equalArray(A,[1,1,1,1])||(r.pbrMetallicRoughness.baseColorFactor=A),e.isMeshStandardMaterial?(r.pbrMetallicRoughness.metallicFactor=e.metalness,r.pbrMetallicRoughness.roughnessFactor=e.roughness):(r.pbrMetallicRoughness.metallicFactor=.5,r.pbrMetallicRoughness.roughnessFactor=.5),e.metalnessMap||e.roughnessMap){const t=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),s={index:this.processTexture(t),channel:t.channel};this.applyTextureTransform(s,t),r.pbrMetallicRoughness.metallicRoughnessTexture=s}if(e.map){const t={index:this.processTexture(e.map),texCoord:e.map.channel};this.applyTextureTransform(t,e.map),r.pbrMetallicRoughness.baseColorTexture=t}if(e.emissive){const t=e.emissive;if(Math.max(t.r,t.g,t.b)>0&&(r.emissiveFactor=e.emissive.toArray()),e.emissiveMap){const t={index:this.processTexture(e.emissiveMap),texCoord:e.emissiveMap.channel};this.applyTextureTransform(t,e.emissiveMap),r.emissiveTexture=t}}if(e.normalMap){const t={index:this.processTexture(e.normalMap),texCoord:e.normalMap.channel};e.normalScale&&1!==e.normalScale.x&&(t.scale=e.normalScale.x),this.applyTextureTransform(t,e.normalMap),r.normalTexture=t}if(e.aoMap){const t={index:this.processTexture(e.aoMap),texCoord:e.aoMap.channel};1!==e.aoMapIntensity&&(t.strength=e.aoMapIntensity),this.applyTextureTransform(t,e.aoMap),r.occlusionTexture=t}e.transparent?r.alphaMode="BLEND":e.alphaTest>0&&(r.alphaMode="MASK",r.alphaCutoff=e.alphaTest),e.side===o.$EB&&(r.doubleSided=!0),""!==e.name&&(r.name=e.name),this.serializeUserData(e,r),this._invokeAll((function(t){t.writeMaterial&&t.writeMaterial(e,r)}));const l=s.materials.push(r)-1;return t.materials.set(e,l),l}processMesh(e){const t=this.cache,s=this.json,r=[e.geometry.uuid];if(Array.isArray(e.material))for(let t=0,s=e.material.length;t<s;t++)r.push(e.material[t].uuid);else r.push(e.material.uuid);const A=r.join(":");if(t.meshes.has(A))return t.meshes.get(A);const l=e.geometry;let h;h=e.isLineSegments?Ci:e.isLineLoop?Bi:e.isLine?yi:e.isPoints?fi:e.material.wireframe?Ci:wi;const c={},d={},g=[],p=[],m={uv:"TEXCOORD_0",uv1:"TEXCOORD_1",uv2:"TEXCOORD_2",uv3:"TEXCOORD_3",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},f=l.getAttribute("normal");void 0===f||this.isNormalizedNormalAttribute(f)||(pi.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),l.setAttribute("normal",this.createNormalizedNormalAttribute(f)));let I=null;for(let e in l.attributes){if("morph"===e.slice(0,5))continue;const s=l.attributes[e];e=m[e]||e.toUpperCase();if(/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(e)||(e="_"+e),t.attributes.has(this.getUID(s))){d[e]=t.attributes.get(this.getUID(s));continue}I=null;const r=s.array;"JOINTS_0"!==e||r instanceof Uint16Array||r instanceof Uint8Array||(pi.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),I=new o.THS(new Uint16Array(r),s.itemSize,s.normalized));const A=this.processAccessor(I||s,l);null!==A&&(e.startsWith("_")||this.detectMeshQuantization(e,s),d[e]=A,t.attributes.set(this.getUID(s),A))}if(void 0!==f&&l.setAttribute("normal",f),0===Object.keys(d).length)return null;if(void 0!==e.morphTargetInfluences&&e.morphTargetInfluences.length>0){const s=[],r=[],o={};if(void 0!==e.morphTargetDictionary)for(const t in e.morphTargetDictionary)o[e.morphTargetDictionary[t]]=t;for(let A=0;A<e.morphTargetInfluences.length;++A){const h={};let c=!1;for(const e in l.morphAttributes){if("position"!==e&&"normal"!==e){c||(pi.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),c=!0);continue}const s=l.morphAttributes[e][A],r=e.toUpperCase(),o=l.attributes[e];if(t.attributes.has(this.getUID(s,!0))){h[r]=t.attributes.get(this.getUID(s,!0));continue}const d=s.clone();if(!l.morphTargetsRelative)for(let e=0,t=s.count;e<t;e++)for(let t=0;t<s.itemSize;t++)0===t&&d.setX(e,s.getX(e)-o.getX(e)),1===t&&d.setY(e,s.getY(e)-o.getY(e)),2===t&&d.setZ(e,s.getZ(e)-o.getZ(e)),3===t&&d.setW(e,s.getW(e)-o.getW(e));h[r]=this.processAccessor(d,l),t.attributes.set(this.getUID(o,!0),h[r])}p.push(h),s.push(e.morphTargetInfluences[A]),void 0!==e.morphTargetDictionary&&r.push(o[A])}c.weights=s,r.length>0&&(c.extras={},c.extras.targetNames=r)}const E=Array.isArray(e.material);if(E&&0===l.groups.length)return null;let C=!1;if(E&&null===l.index){const e=[];for(let t=0,s=l.attributes.position.count;t<s;t++)e[t]=t;l.setIndex(e),C=!0}const B=E?e.material:[e.material],y=E?l.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let e=0,s=y.length;e<s;e++){const s={mode:h,attributes:d};if(this.serializeUserData(l,s),p.length>0&&(s.targets=p),null!==l.index){let r=this.getUID(l.index);void 0===y[e].start&&void 0===y[e].count||(r+=":"+y[e].start+":"+y[e].count),t.attributes.has(r)?s.indices=t.attributes.get(r):(s.indices=this.processAccessor(l.index,l,y[e].start,y[e].count),t.attributes.set(r,s.indices)),null===s.indices&&delete s.indices}const r=this.processMaterial(B[y[e].materialIndex]);null!==r&&(s.material=r),g.push(s)}!0===C&&l.setIndex(null),c.primitives=g,s.meshes||(s.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,c)}));const Q=s.meshes.push(c)-1;return t.meshes.set(A,Q),Q}detectMeshQuantization(e,t){if(this.extensionsUsed[Vi])return;let s;switch(t.array.constructor){case Int8Array:s="byte";break;case Uint8Array:s="unsigned byte";break;case Int16Array:s="short";break;case Uint16Array:s="unsigned short";break;default:return}t.normalized&&(s+=" normalized");const r=e.split("_",1)[0];mi[r]&&mi[r].includes(s)&&(this.extensionsUsed[Vi]=!0,this.extensionsRequired[Vi]=!0)}processCamera(e){const t=this.json;t.cameras||(t.cameras=[]);const s=e.isOrthographicCamera,r={type:s?"orthographic":"perspective"};return s?r.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:r.perspective={aspectRatio:e.aspect,yfov:o.cj9.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(r.name=e.type),t.cameras.push(r)-1}processAnimation(e,t){const s=this.json,r=this.nodeMap;s.animations||(s.animations=[]);const A=(e=GLTFExporter.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks,l=[],h=[];for(let e=0;e<A.length;++e){const s=A[e],c=o.Nwf.parseTrackName(s.name);let d=o.Nwf.findNode(t,c.nodeName);const g=Ji[c.propertyName];if("bones"===c.objectName&&(d=!0===d.isSkinnedMesh?d.skeleton.getBoneByName(c.objectIndex):void 0),!d||!g)return pi.warn('THREE.GLTFExporter: Could not export animation track "%s".',s.name),null;const p=1;let m,f=s.values.length/s.times.length;g===Ji.morphTargetInfluences&&(f/=d.morphTargetInfluences.length),!0===s.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(m="CUBICSPLINE",f/=3):m=s.getInterpolation()===o.ljd?"STEP":"LINEAR",h.push({input:this.processAccessor(new o.THS(s.times,p)),output:this.processAccessor(new o.THS(s.values,f)),interpolation:m}),l.push({sampler:h.length-1,target:{node:r.get(d),path:g}})}return s.animations.push({name:e.name||"clip_"+s.animations.length,samplers:h,channels:l}),s.animations.length-1}processSkin(e){const t=this.json,s=this.nodeMap,r=t.nodes[s.get(e)],A=e.skeleton;if(void 0===A)return null;const l=e.skeleton.bones[0];if(void 0===l)return null;const h=[],c=new Float32Array(16*A.bones.length),d=new o.kn4;for(let t=0;t<A.bones.length;++t)h.push(s.get(A.bones[t])),d.copy(A.boneInverses[t]),d.multiply(e.bindMatrix).toArray(c,16*t);void 0===t.skins&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new o.THS(c,16)),joints:h,skeleton:s.get(l)});return r.skin=t.skins.length-1}processNode(e){const t=this.json,s=this.options,r=this.nodeMap;t.nodes||(t.nodes=[]);const o={};if(s.trs){const t=e.quaternion.toArray(),s=e.position.toArray(),r=e.scale.toArray();equalArray(t,[0,0,0,1])||(o.rotation=t),equalArray(s,[0,0,0])||(o.translation=s),equalArray(r,[1,1,1])||(o.scale=r)}else e.matrixAutoUpdate&&e.updateMatrix(),!1===function isIdentityMatrix(e){return equalArray(e.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}(e.matrix)&&(o.matrix=e.matrix.elements);if(""!==e.name&&(o.name=String(e.name)),this.serializeUserData(e,o),e.isMesh||e.isLine||e.isPoints){const t=this.processMesh(e);null!==t&&(o.mesh=t)}else e.isCamera&&(o.camera=this.processCamera(e));if(e.isSkinnedMesh&&this.skins.push(e),e.children.length>0){const t=[];for(let r=0,o=e.children.length;r<o;r++){const o=e.children[r];if(o.visible||!1===s.onlyVisible){const e=this.processNode(o);null!==e&&t.push(e)}}t.length>0&&(o.children=t)}this._invokeAll((function(t){t.writeNode&&t.writeNode(e,o)}));const A=t.nodes.push(o)-1;return r.set(e,A),A}processScene(e){const t=this.json,s=this.options;t.scenes||(t.scenes=[],t.scene=0);const r={};""!==e.name&&(r.name=e.name),t.scenes.push(r);const o=[];for(let t=0,r=e.children.length;t<r;t++){const r=e.children[t];if(r.visible||!1===s.onlyVisible){const e=this.processNode(r);null!==e&&o.push(e)}}o.length>0&&(r.nodes=o),this.serializeUserData(e,r)}processObjects(e){const t=new o.Z58;t.name="AuxScene";for(let s=0;s<e.length;s++)t.children.push(e[s]);this.processScene(t)}processInput(e){const t=this.options;e=e instanceof Array?e:[e],this._invokeAll((function(t){t.beforeParse&&t.beforeParse(e)}));const s=[];for(let t=0;t<e.length;t++)e[t]instanceof o.Z58?this.processScene(e[t]):s.push(e[t]);s.length>0&&this.processObjects(s);for(let e=0;e<this.skins.length;++e)this.processSkin(this.skins[e]);for(let s=0;s<t.animations.length;++s)this.processAnimation(t.animations[s],e[0]);this._invokeAll((function(t){t.afterParse&&t.afterParse(e)}))}_invokeAll(e){for(let t=0,s=this.plugins.length;t<s;t++)e(this.plugins[t])}}class GLTFLightExtension{constructor(e){this.writer=e,this.name="KHR_lights_punctual"}writeNode(e,t){if(!e.isLight)return;if(!e.isDirectionalLight&&!e.isPointLight&&!e.isSpotLight)return void pi.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e);const s=this.writer,r=s.json,o=s.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),void 0!==e.decay&&2!==e.decay&&pi.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),!e.target||e.target.parent===e&&0===e.target.position.x&&0===e.target.position.y&&-1===e.target.position.z||pi.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),o[this.name]||(r.extensions=r.extensions||{},r.extensions[this.name]={lights:[]},o[this.name]=!0);const l=r.extensions[this.name].lights;l.push(A),t.extensions=t.extensions||{},t.extensions[this.name]={light:l.length-1}}}class GLTFExporter_GLTFMaterialsUnlitExtension{constructor(e){this.writer=e,this.name="KHR_materials_unlit"}writeMaterial(e,t){if(!e.isMeshBasicMaterial)return;const s=this.writer.extensionsUsed;t.extensions=t.extensions||{},t.extensions[this.name]={},s[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9}}class GLTFExporter_GLTFMaterialsClearcoatExtension{constructor(e){this.writer=e,this.name="KHR_materials_clearcoat"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0===e.clearcoat)return;const s=this.writer,r=s.extensionsUsed,o={};if(o.clearcoatFactor=e.clearcoat,e.clearcoatMap){const t={index:s.processTexture(e.clearcoatMap),texCoord:e.clearcoatMap.channel};s.applyTextureTransform(t,e.clearcoatMap),o.clearcoatTexture=t}if(o.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap){const t={index:s.processTexture(e.clearcoatRoughnessMap),texCoord:e.clearcoatRoughnessMap.channel};s.applyTextureTransform(t,e.clearcoatRoughnessMap),o.clearcoatRoughnessTexture=t}if(e.clearcoatNormalMap){const t={index:s.processTexture(e.clearcoatNormalMap),texCoord:e.clearcoatNormalMap.channel};s.applyTextureTransform(t,e.clearcoatNormalMap),o.clearcoatNormalTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=o,r[this.name]=!0}}class GLTFExporter_GLTFMaterialsIridescenceExtension{constructor(e){this.writer=e,this.name="KHR_materials_iridescence"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0===e.iridescence)return;const s=this.writer,r=s.extensionsUsed,o={};if(o.iridescenceFactor=e.iridescence,e.iridescenceMap){const t={index:s.processTexture(e.iridescenceMap),texCoord:e.iridescenceMap.channel};s.applyTextureTransform(t,e.iridescenceMap),o.iridescenceTexture=t}if(o.iridescenceIor=e.iridescenceIOR,o.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],o.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap){const t={index:s.processTexture(e.iridescenceThicknessMap),texCoord:e.iridescenceThicknessMap.channel};s.applyTextureTransform(t,e.iridescenceThicknessMap),o.iridescenceThicknessTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=o,r[this.name]=!0}}class GLTFExporter_GLTFMaterialsTransmissionExtension{constructor(e){this.writer=e,this.name="KHR_materials_transmission"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0===e.transmission)return;const s=this.writer,r=s.extensionsUsed,o={};if(o.transmissionFactor=e.transmission,e.transmissionMap){const t={index:s.processTexture(e.transmissionMap),texCoord:e.transmissionMap.channel};s.applyTextureTransform(t,e.transmissionMap),o.transmissionTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=o,r[this.name]=!0}}class GLTFExporter_GLTFMaterialsVolumeExtension{constructor(e){this.writer=e,this.name="KHR_materials_volume"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0===e.transmission)return;const s=this.writer,r=s.extensionsUsed,o={};if(o.thicknessFactor=e.thickness,e.thicknessMap){const t={index:s.processTexture(e.thicknessMap),texCoord:e.thicknessMap.channel};s.applyTextureTransform(t,e.thicknessMap),o.thicknessTexture=t}o.attenuationDistance=e.attenuationDistance,o.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=o,r[this.name]=!0}}class GLTFExporter_GLTFMaterialsIorExtension{constructor(e){this.writer=e,this.name="KHR_materials_ior"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||1.5===e.ior)return;const s=this.writer.extensionsUsed,r={};r.ior=e.ior,t.extensions=t.extensions||{},t.extensions[this.name]=r,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsSpecularExtension{constructor(e){this.writer=e,this.name="KHR_materials_specular"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||1===e.specularIntensity&&e.specularColor.equals(Ki)&&!e.specularIntensityMap&&!e.specularColorMap)return;const s=this.writer,r=s.extensionsUsed,o={};if(e.specularIntensityMap){const t={index:s.processTexture(e.specularIntensityMap),texCoord:e.specularIntensityMap.channel};s.applyTextureTransform(t,e.specularIntensityMap),o.specularTexture=t}if(e.specularColorMap){const t={index:s.processTexture(e.specularColorMap),texCoord:e.specularColorMap.channel};s.applyTextureTransform(t,e.specularColorMap),o.specularColorTexture=t}o.specularFactor=e.specularIntensity,o.specularColorFactor=e.specularColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=o,r[this.name]=!0}}class GLTFExporter_GLTFMaterialsSheenExtension{constructor(e){this.writer=e,this.name="KHR_materials_sheen"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0==e.sheen)return;const s=this.writer,r=s.extensionsUsed,o={};if(e.sheenRoughnessMap){const t={index:s.processTexture(e.sheenRoughnessMap),texCoord:e.sheenRoughnessMap.channel};s.applyTextureTransform(t,e.sheenRoughnessMap),o.sheenRoughnessTexture=t}if(e.sheenColorMap){const t={index:s.processTexture(e.sheenColorMap),texCoord:e.sheenColorMap.channel};s.applyTextureTransform(t,e.sheenColorMap),o.sheenColorTexture=t}o.sheenRoughnessFactor=e.sheenRoughness,o.sheenColorFactor=e.sheenColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=o,r[this.name]=!0}}class GLTFExporter_GLTFMaterialsAnisotropyExtension{constructor(e){this.writer=e,this.name="KHR_materials_anisotropy"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0==e.anisotropy)return;const s=this.writer,r=s.extensionsUsed,o={};if(e.anisotropyMap){const t={index:s.processTexture(e.anisotropyMap)};s.applyTextureTransform(t,e.anisotropyMap),o.anisotropyTexture=t}o.anisotropyStrength=e.anisotropy,o.anisotropyRotation=e.anisotropyRotation,t.extensions=t.extensions||{},t.extensions[this.name]=o,r[this.name]=!0}}class GLTFExporter_GLTFMaterialsEmissiveStrengthExtension{constructor(e){this.writer=e,this.name="KHR_materials_emissive_strength"}writeMaterial(e,t){if(!e.isMeshStandardMaterial||1===e.emissiveIntensity)return;const s=this.writer.extensionsUsed,r={};r.emissiveStrength=e.emissiveIntensity,t.extensions=t.extensions||{},t.extensions[this.name]=r,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsBumpExtension{constructor(e){this.writer=e,this.name="EXT_materials_bump"}writeMaterial(e,t){if(!e.isMeshStandardMaterial||1===e.bumpScale&&!e.bumpMap)return;const s=this.writer,r=s.extensionsUsed,o={};if(e.bumpMap){const t={index:s.processTexture(e.bumpMap),texCoord:e.bumpMap.channel};s.applyTextureTransform(t,e.bumpMap),o.bumpTexture=t}o.bumpFactor=e.bumpScale,t.extensions=t.extensions||{},t.extensions[this.name]=o,r[this.name]=!0}}class GLTFExporter_GLTFMeshGpuInstancing{constructor(e){this.writer=e,this.name="EXT_mesh_gpu_instancing"}writeNode(e,t){if(!e.isInstancedMesh)return;const s=this.writer,r=e,A=new Float32Array(3*r.count),l=new Float32Array(4*r.count),h=new Float32Array(3*r.count),c=new o.kn4,d=new o.Pq0,g=new o.PTz,p=new o.Pq0;for(let e=0;e<r.count;e++)r.getMatrixAt(e,c),c.decompose(d,g,p),d.toArray(A,3*e),g.toArray(l,4*e),p.toArray(h,3*e);const m={TRANSLATION:s.processAccessor(new o.THS(A,3)),ROTATION:s.processAccessor(new o.THS(l,4)),SCALE:s.processAccessor(new o.THS(h,3))};r.instanceColor&&(m._COLOR_0=s.processAccessor(r.instanceColor)),t.extensions=t.extensions||{},t.extensions[this.name]={attributes:m},s.extensionsUsed[this.name]=!0,s.extensionsRequired[this.name]=!0}}GLTFExporter.Utils={insertKeyframe:function(e,t){const s=.001,r=e.getValueSize(),o=new e.TimeBufferType(e.times.length+1),A=new e.ValueBufferType(e.values.length+r),l=e.createInterpolant(new e.ValueBufferType(r));let h;if(0===e.times.length){o[0]=t;for(let e=0;e<r;e++)A[e]=0;h=0}else if(t<e.times[0]){if(Math.abs(e.times[0]-t)<s)return 0;o[0]=t,o.set(e.times,1),A.set(l.evaluate(t),0),A.set(e.values,r),h=0}else if(t>e.times[e.times.length-1]){if(Math.abs(e.times[e.times.length-1]-t)<s)return e.times.length-1;o[o.length-1]=t,o.set(e.times,0),A.set(e.values,0),A.set(l.evaluate(t),e.values.length),h=o.length-1}else for(let c=0;c<e.times.length;c++){if(Math.abs(e.times[c]-t)<s)return c;if(e.times[c]<t&&e.times[c+1]>t){o.set(e.times.slice(0,c+1),0),o[c+1]=t,o.set(e.times.slice(c+1),c+2),A.set(e.values.slice(0,(c+1)*r),0),A.set(l.evaluate(t),(c+1)*r),A.set(e.values.slice((c+1)*r),(c+2)*r),h=c+1;break}}return e.times=o,e.values=A,h},mergeMorphTargetTracks:function(e,t){const s=[],r={},A=e.tracks;for(let e=0;e<A.length;++e){let l=A[e];const h=o.Nwf.parseTrackName(l.name),c=o.Nwf.findNode(t,h.nodeName);if("morphTargetInfluences"!==h.propertyName||void 0===h.propertyIndex){s.push(l);continue}if(l.createInterpolant!==l.InterpolantFactoryMethodDiscrete&&l.createInterpolant!==l.InterpolantFactoryMethodLinear){if(l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");pi.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),l=l.clone(),l.setInterpolation(o.PJ3)}const d=c.morphTargetInfluences.length,g=c.morphTargetDictionary[h.propertyIndex];if(void 0===g)throw new Error("THREE.GLTFExporter: Morph target name not found: "+h.propertyIndex);let p;if(void 0===r[c.uuid]){p=l.clone();const e=new p.ValueBufferType(d*p.times.length);for(let t=0;t<p.times.length;t++)e[t*d+g]=p.values[t];p.name=(h.nodeName||"")+".morphTargetInfluences",p.values=e,r[c.uuid]=p,s.push(p);continue}const m=l.createInterpolant(new l.ValueBufferType(1));p=r[c.uuid];for(let e=0;e<p.times.length;e++)p.values[e*d+g]=m.evaluate(p.times[e]);for(let e=0;e<l.times.length;e++){const t=this.insertKeyframe(p,l.times[e]);p.values[t*d+g]=l.values[e]}}return e.tracks=s,e}};const compatibleObject=e=>void 0!==e.material&&e.userData&&e.userData.variantMaterials&&!!Array.from(e.userData.variantMaterials.values()).filter((e=>compatibleMaterial(e.material))),compatibleMaterial=e=>e&&e.isMaterial&&!Array.isArray(e);class GLTFExporterMaterialsVariantsExtension{constructor(e){this.writer=e,this.name="KHR_materials_variants",this.variantNames=[]}beforeParse(e){const t=new Set;for(const s of e)s.traverse((e=>{if(!compatibleObject(e))return;const s=e.userData.variantMaterials,r=e.userData.variantData;for(const[e,o]of r){const r=s.get(o.index);r&&compatibleMaterial(r.material)&&t.add(e)}}));t.forEach((e=>this.variantNames.push(e)))}writeMesh(e,t){if(!compatibleObject(e))return;const s=e.userData,r=s.variantMaterials,o=s.variantData,A=new Map,l=new Map,h=Array.from(o.values()).sort(((e,t)=>e.index-t.index));for(const[e,t]of h.entries())l.set(t.index,e);for(const e of o.values()){const t=r.get(e.index);if(!t||!compatibleMaterial(t.material))continue;const s=this.writer.processMaterial(t.material);A.has(s)||A.set(s,{material:s,variants:[]}),A.get(s).variants.push(l.get(e.index))}const c=Array.from(A.values()).map((e=>e.variants.sort(((e,t)=>e-t))&&e)).sort(((e,t)=>e.material-t.material));if(0===c.length)return;const d=compatibleMaterial(s.originalMaterial)?this.writer.processMaterial(s.originalMaterial):-1;for(const e of t.primitives)d>=0&&(e.material=d),e.extensions=e.extensions||{},e.extensions[this.name]={mappings:c}}afterParse(){if(0===this.variantNames.length)return;const e=this.writer.json;e.extensions=e.extensions||{};const t=this.variantNames.map((e=>({name:e})));e.extensions[this.name]={variants:t},this.writer.extensionsUsed[this.name]=!0}}class SessionLightProbe{constructor(e,t,s,r,A){this.xrLight=e,this.renderer=t,this.lightProbe=s,this.xrWebGLBinding=null,this.estimationStartCallback=A,this.frameCallback=this.onXRFrame.bind(this);const l=t.xr.getSession();if(r&&"XRWebGLBinding"in window){const s=new o.o6l(16);e.environment=s.texture;const r=t.getContext();switch(l.preferredReflectionFormat){case"srgba8":r.getExtension("EXT_sRGB");break;case"rgba16f":r.getExtension("OES_texture_half_float")}this.xrWebGLBinding=new XRWebGLBinding(l,r),this.lightProbe.addEventListener("reflectionchange",(()=>{this.updateReflection()}))}l.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 s=t.getLightEstimate(this.lightProbe);if(s){this.xrLight.lightProbe.sh.fromArray(s.sphericalHarmonicsCoefficients),this.xrLight.lightProbe.intensity=1;const e=Math.max(1,Math.max(s.primaryLightIntensity.x,Math.max(s.primaryLightIntensity.y,s.primaryLightIntensity.z)));this.xrLight.directionalLight.color.setRGB(s.primaryLightIntensity.x/e,s.primaryLightIntensity.y/e,s.primaryLightIntensity.z/e),this.xrLight.directionalLight.intensity=e,this.xrLight.directionalLight.position.copy(s.primaryLightDirection),this.estimationStartCallback&&(this.estimationStartCallback(),this.estimationStartCallback=null)}}dispose(){this.xrLight=null,this.renderer=null,this.lightProbe=null,this.xrWebGLBinding=null}}class XREstimatedLight extends o.YJl{constructor(e,t=!0){super(),this.lightProbe=new o.FZo,this.lightProbe.intensity=0,this.add(this.lightProbe),this.directionalLight=new o.ZyN,this.directionalLight.intensity=0,this.add(this.directionalLight),this.environment=null;let s=null,r=!1;e.xr.addEventListener("sessionstart",(()=>{const o=e.xr.getSession();"requestLightProbe"in o&&o.requestLightProbe({reflectionFormat:o.preferredReflectionFormat}).then((o=>{s=new SessionLightProbe(this,e,o,t,(()=>{r=!0,this.dispatchEvent({type:"estimationstart"})}))}))})),e.xr.addEventListener("sessionend",(()=>{s&&(s.dispose(),s=null),r&&this.dispatchEvent({type:"estimationend"})})),this.dispose=()=>{s&&(s.dispose(),s=null),this.remove(this.lightProbe),this.lightProbe=null,this.remove(this.directionalLight),this.directionalLight=null,this.environment=null}}}class Damper{constructor(e=50){this.velocity=0,this.naturalFrequency=0,this.setDecayTime(e)}setDecayTime(e){this.naturalFrequency=1/Math.max(.001,e)}update(e,t,s,r){const o=2e-4*this.naturalFrequency;if(null==e||0===r)return t;if(e===t&&0===this.velocity)return t;if(s<0)return e;const A=e-t,l=this.velocity+this.naturalFrequency*A,h=A+s*l,c=Math.exp(-this.naturalFrequency*s),d=(l-this.naturalFrequency*h)*c,g=-this.naturalFrequency*(d+l*c);return Math.abs(d)<o*Math.abs(r)&&g*A>=0?(this.velocity=0,t):(this.velocity=d,t+h*c)}}const Yi=.2,zi=Math.PI/24,ji=new o.I9Y,addCorner=(e,t,s)=>{let r=t>0?s>0?0:-Math.PI/2:s>0?Math.PI/2:Math.PI;for(let o=0;o<=12;++o)e.push(t+.17*Math.cos(r),s+.17*Math.sin(r),0,t+Yi*Math.cos(r),s+Yi*Math.sin(r),0),r+=zi};class PlacementBox extends o.eaF{constructor(e,t){const s=new o.LoY,r=[],A=[],{size:l,boundingBox:h}=e,c=l.x/2,d=("back"===t?l.y:l.z)/2;addCorner(A,c,d),addCorner(A,-c,d),addCorner(A,-c,-d),addCorner(A,c,-d);const g=A.length/3;for(let e=0;e<g-2;e+=2)r.push(e,e+1,e+3,e,e+3,e+2);const p=g-2;r.push(p,p+1,1,p,1,0),s.setAttribute("position",new o.qtW(A,3)),s.setIndex(r),super(s),this.side=t;const m=this.material;switch(m.side=o.$EB,m.transparent=!0,m.opacity=0,this.goalOpacity=0,this.opacityDamper=new Damper,this.hitPlane=new o.eaF(new o.bdM(2*(c+Yi),2*(d+Yi))),this.hitPlane.visible=!1,this.hitPlane.material.side=o.$EB,this.add(this.hitPlane),h.getCenter(this.position),t){case"bottom":this.rotateX(-Math.PI/2),this.shadowHeight=h.min.y,this.position.y=this.shadowHeight;break;case"back":this.shadowHeight=h.min.z,this.position.z=this.shadowHeight}e.target.add(this),this.offsetHeight=0}getHit(e,t,s){ji.set(t,-s),this.hitPlane.visible=!0;const r=e.positionAndNormalFromPoint(ji,this.hitPlane);return this.hitPlane.visible=!1,null==r?null:r.position}getExpandedHit(e,t,s){this.hitPlane.scale.set(1e3,1e3,1e3),this.hitPlane.updateMatrixWorld();const r=this.getHit(e,t,s);return this.hitPlane.scale.set(1,1,1),r}set offsetHeight(e){e-=.001,"back"===this.side?this.position.z=this.shadowHeight+e:this.position.y=this.shadowHeight+e}get offsetHeight(){return"back"===this.side?this.position.z-this.shadowHeight:this.position.y-this.shadowHeight}set show(e){this.goalOpacity=e?.75:0}updateOpacity(e){const t=this.material;t.opacity=this.opacityDamper.update(t.opacity,this.goalOpacity,e,1),this.visible=t.opacity>0}dispose(){var e;const{geometry:t,material:s}=this.hitPlane;t.dispose(),s.dispose(),this.geometry.dispose(),this.material.dispose(),null===(e=this.parent)||void 0===e||e.remove(this)}}const numberNode=(e,t)=>({type:"number",number:e,unit:t}),Wi=(()=>{const e={};return t=>{const s=t;if(s in e)return e[s];const r=[];let o=0;for(;t;){if(++o>1e3){t="";break}const e=Xi(t),s=e.nodes[0];if(null==s||0===s.terms.length)break;r.push(s),t=e.remainingInput}return e[s]=r}})(),Xi=(()=>{const e=/^(\-\-|[a-z\u0240-\uffff])/i,t=/^([\*\+\/]|[\-]\s)/i,s=/^[\),]/;return r=>{const o=[];for(;r.length&&(r=r.trim(),!s.test(r));)if("("===r[0]){const{nodes:e,remainingInput:t}=parseFunctionArguments(r);r=t,o.push({type:"function",name:{type:"ident",value:"calc"},arguments:e})}else if(e.test(r)){const e=Zi(r),t=e.nodes[0];if("("===(r=e.remainingInput)[0]){const{nodes:e,remainingInput:s}=parseFunctionArguments(r);o.push({type:"function",name:t,arguments:e}),r=s}else o.push(t)}else if(t.test(r))o.push({type:"operator",value:r[0]}),r=r.slice(1);else{const{nodes:e,remainingInput:t}="#"===r[0]?ts(r):es(r);if(0===e.length)break;o.push(e[0]),r=t}return{nodes:[{type:"expression",terms:o}],remainingInput:r}}})(),Zi=(()=>{const e=/[^a-z0-9_\-\u0240-\uffff]/i;return t=>{const s=t.match(e);return{nodes:[{type:"ident",value:null==s?t:t.substr(0,s.index)}],remainingInput:null==s?"":t.substr(s.index)}}})(),es=(()=>{const e=/[\+\-]?(\d+[\.]\d+|\d+|[\.]\d+)([eE][\+\-]?\d+)?/,t=/^[a-z%]+/i,s=/^(m|mm|cm|rad|deg|[%])$/;return r=>{const o=r.match(e),A=null==o?"0":o[0],l=(r=null==A?r:r.slice(A.length)).match(t);let h=null!=l&&""!==l[0]?l[0]:null;const c=null==l?r:r.slice(h.length);return null==h||s.test(h)||(h=null),{nodes:[{type:"number",number:parseFloat(A)||0,unit:h}],remainingInput:c}}})(),ts=(()=>{const e=/^[a-f0-9]*/i;return t=>{const s=(t=t.slice(1).trim()).match(e);return{nodes:null==s?[]:[{type:"hex",value:s[0]}],remainingInput:null==s?t:t.slice(s[0].length)}}})(),parseFunctionArguments=e=>{const t=[];for(e=e.slice(1).trim();e.length;){const s=Xi(e);if(t.push(s.nodes[0]),","===(e=s.remainingInput.trim())[0])e=e.slice(1).trim();else if(")"===e[0]){e=e.slice(1);break}}return{nodes:t,remainingInput:e}},is=Symbol("visitedTypes");class ASTWalker{constructor(e){this[is]=e}walk(e,t){const s=e.slice();for(;s.length;){const e=s.shift();switch(this[is].indexOf(e.type)>-1&&t(e),e.type){case"expression":s.unshift(...e.terms);break;case"function":s.unshift(e.name,...e.arguments)}}}}const ss=Object.freeze({type:"number",number:0,unit:null}),degreesToRadians=(e,t=0)=>{let{number:s,unit:r}=e;if(isFinite(s)){if("rad"===e.unit||null==e.unit)return e}else s=t,r="rad";return{type:"number",number:("deg"===r&&null!=s?s:0)*Math.PI/180,unit:"rad"}},lengthToBaseMeters=(e,t=0)=>{let s,{number:r,unit:o}=e;if(isFinite(r)){if("m"===e.unit)return e}else r=t,o="m";switch(o){default:s=1;break;case"cm":s=.01;break;case"mm":s=.001}return{type:"number",number:s*r,unit:"m"}},ns=(()=>{const identity=e=>e,e={rad:identity,deg:degreesToRadians,m:identity,mm:lengthToBaseMeters,cm:lengthToBaseMeters};return(t,s=ss)=>{isFinite(t.number)||(t.number=s.number,t.unit=s.unit);const{unit:r}=t;if(null==r)return t;const o=e[r];return null==o?s:o(t)}})();var rs,as,os;const As=Symbol("evaluate"),ls=Symbol("lastValue");class Evaluator{constructor(){this[rs]=null}static evaluatableFor(e,t=ss){if(e instanceof Evaluator)return e;if("number"===e.type)return"%"===e.unit?new PercentageEvaluator(e,t):e;switch(e.name.value){case"calc":return new CalcEvaluator(e,t);case"env":return new EnvEvaluator(e)}return ss}static evaluate(e){return e instanceof Evaluator?e.evaluate():e}static isConstant(e){return!(e instanceof Evaluator)||e.isConstant}static applyIntrinsics(e,t){const{basis:s,keywords:r}=t,{auto:o}=r;return s.map(((t,s)=>{const A=null==o[s]?t:o[s];let l=e[s]?e[s]:A;if("ident"===l.type){const e=l.value;e in r&&(l=r[e][s])}return null!=l&&"ident"!==l.type||(l=A),"%"===l.unit?numberNode(l.number/100*t.number,t.unit):(l=ns(l,t),l.unit!==t.unit?t:l)}))}get isConstant(){return!1}evaluate(){return this.isConstant&&null!=this[ls]||(this[ls]=this[As]()),this[ls]}}rs=ls;const hs=Symbol("percentage"),cs=Symbol("basis");class PercentageEvaluator extends Evaluator{constructor(e,t){super(),this[hs]=e,this[cs]=t}get isConstant(){return!0}[As](){return numberNode(this[hs].number/100*this[cs].number,this[cs].unit)}}const us=Symbol("identNode");class EnvEvaluator extends Evaluator{constructor(e){super(),this[as]=null;const t=e.arguments.length?e.arguments[0].terms[0]:null;null!=t&&"ident"===t.type&&(this[us]=t)}get isConstant(){return!1}[(as=us,As)](){if(null!=this[us]&&"window-scroll-y"===this[us].value){return{type:"number",number:window.pageYOffset/(Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight)-window.innerHeight)||0,unit:null}}return ss}}const ds=/[\*\/]/,gs=Symbol("evaluator");class CalcEvaluator extends Evaluator{constructor(e,t=ss){if(super(),this[os]=null,1!==e.arguments.length)return;const s=e.arguments[0].terms.slice(),r=[];for(;s.length;){const e=s.shift();if(r.length>0){const s=r[r.length-1];if("operator"===s.type&&ds.test(s.value)){const s=r.pop(),o=r.pop();if(null==o)return;r.push(new OperatorEvaluator(s,Evaluator.evaluatableFor(o,t),Evaluator.evaluatableFor(e,t)));continue}}r.push("operator"===e.type?e:Evaluator.evaluatableFor(e,t))}for(;r.length>2;){const[e,s,o]=r.splice(0,3);if("operator"!==s.type)return;r.unshift(new OperatorEvaluator(s,Evaluator.evaluatableFor(e,t),Evaluator.evaluatableFor(o,t)))}1===r.length&&(this[gs]=r[0])}get isConstant(){return null==this[gs]||Evaluator.isConstant(this[gs])}[(os=gs,As)](){return null!=this[gs]?Evaluator.evaluate(this[gs]):ss}}const ps=Symbol("operator"),ms=Symbol("left"),fs=Symbol("right");class OperatorEvaluator extends Evaluator{constructor(e,t,s){super(),this[ps]=e,this[ms]=t,this[fs]=s}get isConstant(){return Evaluator.isConstant(this[ms])&&Evaluator.isConstant(this[fs])}[As](){const e=ns(Evaluator.evaluate(this[ms])),t=ns(Evaluator.evaluate(this[fs])),{number:s,unit:r}=e,{number:o,unit:A}=t;if(null!=A&&null!=r&&A!=r)return ss;const l=r||A;let h;switch(this[ps].value){case"+":h=s+o;break;case"-":h=s-o;break;case"/":h=s/o;break;case"*":h=s*o;break;default:return ss}return{type:"number",number:h,unit:l}}}const Is=Symbol("evaluatables"),Es=Symbol("intrinsics");class StyleEvaluator extends Evaluator{constructor(e,t){super(),this[Es]=t;const s=e[0],r=null!=s?s.terms:[];this[Is]=t.basis.map(((e,t)=>{const s=r[t];return null==s?{type:"ident",value:"auto"}:"ident"===s.type?s:Evaluator.evaluatableFor(s,e)}))}get isConstant(){for(const e of this[Is])if(!Evaluator.isConstant(e))return!1;return!0}[As](){const e=this[Is].map((e=>Evaluator.evaluate(e)));return Evaluator.applyIntrinsics(e,this[Es]).map((e=>e.number))}}var Cs,Bs,ys,ws;const vs=Symbol("instances"),Qs=Symbol("activateListener"),xs=Symbol("deactivateListener"),bs=Symbol("notifyInstances"),Ss=Symbol("notify"),Ms=Symbol("callback");class ScrollObserver{constructor(e){this[Ms]=e}static[bs](){for(const e of ScrollObserver[vs])e[Ss]()}static[(Cs=vs,Qs)](){window.addEventListener("scroll",this[bs],{passive:!0})}static[xs](){window.removeEventListener("scroll",this[bs])}observe(){0===ScrollObserver[vs].size&&ScrollObserver[Qs](),ScrollObserver[vs].add(this)}disconnect(){ScrollObserver[vs].delete(this),0===ScrollObserver[vs].size&&ScrollObserver[xs]()}[Ss](){this[Ms]()}}ScrollObserver[Cs]=new Set;const Ts=Symbol("computeStyleCallback"),Rs=Symbol("astWalker"),Ds=Symbol("dependencies"),Ls=Symbol("onScroll");class StyleEffector{constructor(e){this[Bs]={},this[ys]=new ASTWalker(["function"]),this[ws]=()=>{this[Ts]({relatedState:"window-scroll"})},this[Ts]=e}observeEffectsFor(e){const t={},s=this[Ds];this[Rs].walk(e,(e=>{const{name:r}=e,o=e.arguments[0].terms[0];if("env"===r.value&&null!=o&&"ident"===o.type&&"window-scroll-y"===o.value)if(null==t["window-scroll"]){const e="window-scroll"in s?s["window-scroll"]:new ScrollObserver(this[Ls]);e.observe(),delete s["window-scroll"],t["window-scroll"]=e}}));for(const e in s){s[e].disconnect()}this[Ds]=t}dispose(){for(const e in this[Ds]){this[Ds][e].disconnect()}}}Bs=Ds,ys=Rs,ws=Ls;const style=e=>{const t=e.observeEffects||!1,s=e.intrinsics instanceof Function?e.intrinsics:()=>e.intrinsics;return(r,o)=>{const A=r.updated,l=r.connectedCallback,h=r.disconnectedCallback,c=Symbol(`${o}StyleEffector`),d=Symbol(`${o}StyleEvaluator`),g=Symbol(`${o}UpdateEvaluator`),p=Symbol(`${o}EvaluateAndSync`);Object.defineProperties(r,{[c]:{value:null,writable:!0},[d]:{value:null,writable:!0},[g]:{value:function(){const e=Wi(this[o]);this[d]=new StyleEvaluator(e,s(this)),null==this[c]&&t&&(this[c]=new StyleEffector((()=>this[p]()))),null!=this[c]&&this[c].observeEffectsFor(e)}},[p]:{value:function(){if(null==this[d])return;const t=this[d].evaluate();this[e.updateHandler](t)}},updated:{value:function(e){e.has(o)&&(this[g](),this[p]()),A.call(this,e)}},connectedCallback:{value:function(){l.call(this),this.requestUpdate(o,this[o])}},disconnectedCallback:{value:function(){h.call(this),null!=this[c]&&(this[c].dispose(),this[c]=null)}}})}},easeInOutQuad=e=>e<.5?2*e*e:(4-2*e)*e-1,interpolate=(e,t,s=easeInOutQuad)=>r=>e+(t-e)*s(r),timeline=e=>{const t=[],s=[];let r=e.initialValue;for(let o=0;o<e.keyframes.length;++o){const A=e.keyframes[o],{value:l,frames:h}=A,c=A.ease||easeInOutQuad,d=interpolate(r,l,c);t.push(d),s.push(h),r=l}return((e,t)=>{const s=t.map((r=0,e=>r+=e));var r;return t=>{t=clamp(t,0,1),t*=s[s.length-1];const r=s.findIndex((e=>e>=t)),o=r<1?0:s[r-1],A=s[r];return e[r]((t-o)/(A-o))}})(t,s)};var Fs=s(96763),controls_decorate=function(e,t,s,r){var o,A=arguments.length,l=A<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,s,r);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(l=(A<3?o(l):A>3?o(t,s,l):o(t,s))||l);return A>3&&l&&Object.defineProperty(t,s,l),l};const _s=timeline({initialValue:0,keyframes:[{frames:5,value:-1},{frames:1,value:-1},{frames:8,value:1},{frames:1,value:1},{frames:5,value:0},{frames:18,value:0}]}),ks=timeline({initialValue:0,keyframes:[{frames:1,value:1},{frames:5,value:1},{frames:1,value:0},{frames:6,value:0}]}),Us="0deg 75deg 105%",Gs=["front","right","back","left"],Ps=["upper-","","lower-"],Ns="auto",Os="basic",Hs="wiggle",qs="none",fieldOfViewIntrinsics=()=>({basis:[degreesToRadians(numberNode(30,"deg"))],keywords:{auto:[null]}}),minFieldOfViewIntrinsics=()=>({basis:[degreesToRadians(numberNode(12,"deg"))],keywords:{auto:[null]}}),Vs=(()=>{const e=Wi(Us)[0].terms,t=ns(e[0]),s=ns(e[1]);return e=>{const r=e[Po].idealCameraDistance();return{basis:[t,s,numberNode(r,"m")],keywords:{auto:[null,null,numberNode(105,"%")]}}}})(),minCameraOrbitIntrinsics=e=>{const t=2.2*e[Po].boundingSphere.radius;return{basis:[numberNode(-1/0,"rad"),numberNode(Math.PI/8,"rad"),numberNode(t,"m")],keywords:{auto:[null,null,null]}}},maxCameraOrbitIntrinsics=e=>{const t=Vs(e),s=new StyleEvaluator([],t).evaluate()[2];return{basis:[numberNode(1/0,"rad"),numberNode(Math.PI-Math.PI/8,"rad"),numberNode(s,"m")],keywords:{auto:[null,null,null]}}},cameraTargetIntrinsics=e=>{const t=e[Po].boundingBox.getCenter(new o.Pq0);return{basis:[numberNode(t.x,"m"),numberNode(t.y,"m"),numberNode(t.z,"m")],keywords:{auto:[null,null,null]}}},$s=Math.PI/2,Js=Math.PI/3,Ks=$s/2,Ys=2*Math.PI,zs=Symbol("controls"),js=Symbol("panElement"),Ws=Symbol("promptElement"),Xs=Symbol("promptAnimatedContainer"),Zs=Symbol("fingerAnimatedContainers"),en=Symbol("deferInteractionPrompt"),tn=Symbol("updateAria"),sn=Symbol("updateCameraForRadius"),nn=Symbol("cancelPrompts"),rn=Symbol("onChange"),an=Symbol("onPointerChange"),on=Symbol("waitingToPromptUser"),An=Symbol("userHasInteracted"),ln=Symbol("promptElementVisibleTime"),hn=Symbol("lastPromptOffset"),cn=Symbol("cancellationSource"),un=Symbol("lastSpherical"),dn=Symbol("jumpCamera"),gn=Symbol("initialized"),pn=Symbol("maintainThetaPhi"),mn=Symbol("syncCameraOrbit"),fn=Symbol("syncFieldOfView"),In=Symbol("syncCameraTarget"),En=Symbol("syncMinCameraOrbit"),Cn=Symbol("syncMaxCameraOrbit"),Bn=Symbol("syncMinFieldOfView"),yn=Symbol("syncMaxFieldOfView"),wn=new o.I9Y,vn=new o.Pq0,Qn=Object.freeze({minimumRadius:0,maximumRadius:1/0,minimumPolarAngle:Math.PI/8,maximumPolarAngle:Math.PI-Math.PI/8,minimumAzimuthalAngle:-1/0,maximumAzimuthalAngle:1/0,minimumFieldOfView:10,maximumFieldOfView:45,touchAction:"none"}),xn=Math.PI/8,bn=.04,Sn={USER_INTERACTION:"user-interaction",NONE:"none",AUTOMATIC:"automatic"};class SmoothControls extends o.Qev{constructor(e,t,s){super(),this.camera=e,this.element=t,this.scene=s,this.orbitSensitivity=1,this.zoomSensitivity=1,this.panSensitivity=1,this.inputSensitivity=1,this.changeSource=Sn.NONE,this._interactionEnabled=!1,this._disableZoom=!1,this.isUserPointing=!1,this.enablePan=!0,this.enableTap=!0,this.panProjection=new o.dwI,this.panPerPixel=0,this.spherical=new o.YHV,this.goalSpherical=new o.YHV,this.thetaDamper=new Damper,this.phiDamper=new Damper,this.radiusDamper=new Damper,this.logFov=Math.log(Qn.maximumFieldOfView),this.goalLogFov=this.logFov,this.fovDamper=new Damper,this.touchMode=null,this.pointers=[],this.startTime=0,this.startPointerPosition={clientX:0,clientY:0},this.lastSeparation=0,this.touchDecided=!1,this.onContext=e=>{if(this.enablePan)e.preventDefault();else for(const e of this.pointers)this.onPointerUp(new PointerEvent("pointercancel",Object.assign(Object.assign({},this.startPointerPosition),{pointerId:e.id})))},this.touchModeZoom=(e,t)=>{if(!this._disableZoom){const e=this.twoTouchDistance(this.pointers[0],this.pointers[1]),t=bn*this.zoomSensitivity*(this.lastSeparation-e)*50/this.scene.height;this.lastSeparation=e,this.userAdjustOrbit(0,0,t)}this.panPerPixel>0&&this.movePan(e,t)},this.disableScroll=e=>{e.preventDefault()},this.touchModeRotate=(e,t)=>{const{touchAction:s}=this._options;if(!this.touchDecided&&"none"!==s){this.touchDecided=!0;const r=Math.abs(e),o=Math.abs(t);if(this.changeSource===Sn.USER_INTERACTION&&("pan-y"===s&&o>r||"pan-x"===s&&r>o))return void(this.touchMode=null);this.element.addEventListener("touchmove",this.disableScroll,{passive:!1})}this.handleSinglePointerMove(e,t)},this.onPointerDown=e=>{if(this.pointers.length>2)return;const{element:t}=this;0===this.pointers.length&&(t.addEventListener("pointermove",this.onPointerMove),t.addEventListener("pointerup",this.onPointerUp),this.touchMode=null,this.touchDecided=!1,this.startPointerPosition.clientX=e.clientX,this.startPointerPosition.clientY=e.clientY,this.startTime=performance.now());try{t.setPointerCapture(e.pointerId)}catch(e){}this.pointers.push({clientX:e.clientX,clientY:e.clientY,id:e.pointerId}),this.isUserPointing=!1,"touch"===e.pointerType?(this.changeSource=e.altKey?Sn.AUTOMATIC:Sn.USER_INTERACTION,this.onTouchChange(e)):(this.changeSource=Sn.USER_INTERACTION,this.onMouseDown(e)),this.changeSource===Sn.USER_INTERACTION&&this.dispatchEvent({type:"user-interaction"})},this.onPointerMove=e=>{const t=this.pointers.find((t=>t.id===e.pointerId));if(null==t)return;if("mouse"===e.pointerType&&0===e.buttons)return void this.onPointerUp(e);const s=this.pointers.length,r=(e.clientX-t.clientX)/s,o=(e.clientY-t.clientY)/s;0===r&&0===o||(t.clientX=e.clientX,t.clientY=e.clientY,"touch"===e.pointerType?(this.changeSource=e.altKey?Sn.AUTOMATIC:Sn.USER_INTERACTION,null!==this.touchMode&&this.touchMode(r,o)):(this.changeSource=Sn.USER_INTERACTION,this.panPerPixel>0?this.movePan(r,o):this.handleSinglePointerMove(r,o)))},this.onPointerUp=e=>{const{element:t}=this,s=this.pointers.findIndex((t=>t.id===e.pointerId));-1!==s&&this.pointers.splice(s,1),this.panPerPixel>0&&!e.altKey&&this.resetRadius(),0===this.pointers.length?(t.removeEventListener("pointermove",this.onPointerMove),t.removeEventListener("pointerup",this.onPointerUp),t.removeEventListener("touchmove",this.disableScroll),this.enablePan&&this.enableTap&&this.recenter(e)):null!==this.touchMode&&this.onTouchChange(e),this.scene.element[js].style.opacity=0,t.style.cursor="grab",this.panPerPixel=0,this.isUserPointing&&this.dispatchEvent({type:"pointer-change-end"})},this.onWheel=e=>{this.changeSource=Sn.USER_INTERACTION;const t=e.deltaY*(1==e.deltaMode?18:1)*bn*this.zoomSensitivity/30;this.userAdjustOrbit(0,0,t),e.preventDefault(),this.dispatchEvent({type:"user-interaction"})},this.onKeyDown=e=>{const{changeSource:t}=this;this.changeSource=Sn.USER_INTERACTION;(e.shiftKey&&this.enablePan?this.panKeyCodeHandler(e):this.orbitZoomKeyCodeHandler(e))?(e.preventDefault(),this.dispatchEvent({type:"user-interaction"})):this.changeSource=t},this._options=Object.assign({},Qn),this.setOrbit(0,Math.PI/2,1),this.setFieldOfView(100),this.jumpToGoal()}get interactionEnabled(){return this._interactionEnabled}enableInteraction(){if(!1===this._interactionEnabled){const{element:e}=this;e.addEventListener("pointerdown",this.onPointerDown),e.addEventListener("pointercancel",this.onPointerUp),this._disableZoom||e.addEventListener("wheel",this.onWheel),e.addEventListener("keydown",this.onKeyDown),e.addEventListener("touchmove",(()=>{}),{passive:!1}),e.addEventListener("contextmenu",this.onContext),this.element.style.cursor="grab",this._interactionEnabled=!0,this.updateTouchActionStyle()}}disableInteraction(){if(!0===this._interactionEnabled){const{element:e}=this;e.removeEventListener("pointerdown",this.onPointerDown),e.removeEventListener("pointermove",this.onPointerMove),e.removeEventListener("pointerup",this.onPointerUp),e.removeEventListener("pointercancel",this.onPointerUp),e.removeEventListener("wheel",this.onWheel),e.removeEventListener("keydown",this.onKeyDown),e.removeEventListener("contextmenu",this.onContext),e.style.cursor="",this.touchMode=null,this._interactionEnabled=!1,this.updateTouchActionStyle()}}get options(){return this._options}set disableZoom(e){this._disableZoom!=e&&(this._disableZoom=e,!0===e?this.element.removeEventListener("wheel",this.onWheel):this.element.addEventListener("wheel",this.onWheel),this.updateTouchActionStyle())}getCameraSpherical(e=new o.YHV){return e.copy(this.spherical)}getFieldOfView(){return this.camera.fov}applyOptions(e){Object.assign(this._options,e),this.setOrbit(),this.setFieldOfView(Math.exp(this.goalLogFov))}updateNearFar(e,t){this.camera.far=0===t?2:t,this.camera.near=Math.max(e,this.camera.far/1e3),this.camera.updateProjectionMatrix()}updateAspect(e){this.camera.aspect=e,this.camera.updateProjectionMatrix()}setOrbit(e=this.goalSpherical.theta,t=this.goalSpherical.phi,s=this.goalSpherical.radius){const{minimumAzimuthalAngle:r,maximumAzimuthalAngle:o,minimumPolarAngle:A,maximumPolarAngle:l,minimumRadius:h,maximumRadius:c}=this._options,{theta:d,phi:g,radius:p}=this.goalSpherical,m=clamp(e,r,o);isFinite(r)||isFinite(o)||(this.spherical.theta=this.wrapAngle(this.spherical.theta-m)+m);const f=clamp(t,A,l),I=clamp(s,h,c);return(m!==d||f!==g||I!==p)&&(!!(isFinite(m)&&isFinite(f)&&isFinite(I))&&(this.goalSpherical.theta=m,this.goalSpherical.phi=f,this.goalSpherical.radius=I,this.goalSpherical.makeSafe(),!0))}setRadius(e){this.goalSpherical.radius=e,this.setOrbit()}setFieldOfView(e){const{minimumFieldOfView:t,maximumFieldOfView:s}=this._options;e=clamp(e,t,s),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,s){const{theta:r,phi:o,radius:A}=this.goalSpherical,{minimumRadius:l,maximumRadius:h,minimumFieldOfView:c,maximumFieldOfView:d}=this._options,g=this.spherical.theta-r,p=Math.PI-.001,m=r-clamp(e,-p-g,p-g),f=o-t,I=0===s?0:((s>0?h:l)-A)/(Math.log(s>0?d:c)-this.goalLogFov),E=A+s*(isFinite(I)?I:2*(h-l));if(this.setOrbit(m,f,E),0!==s){const e=this.goalLogFov+s;this.setFieldOfView(Math.exp(e))}}jumpToGoal(){this.update(0,1e4)}update(e,t){if(this.isStationary())return!1;const{maximumPolarAngle:s,maximumRadius:r}=this._options,o=this.spherical.theta-this.goalSpherical.theta;return Math.abs(o)>Math.PI&&!isFinite(this._options.minimumAzimuthalAngle)&&!isFinite(this._options.maximumAzimuthalAngle)&&(this.spherical.theta-=2*Math.sign(o)*Math.PI),this.spherical.theta=this.thetaDamper.update(this.spherical.theta,this.goalSpherical.theta,t,Math.PI),this.spherical.phi=this.phiDamper.update(this.spherical.phi,this.goalSpherical.phi,t,s),this.spherical.radius=this.radiusDamper.update(this.spherical.radius,this.goalSpherical.radius,t,r),this.logFov=this.fovDamper.update(this.logFov,this.goalLogFov,t,1),this.moveCamera(),!0}updateTouchActionStyle(){const{style:e}=this.element;if(this._interactionEnabled){const{touchAction:t}=this._options;this._disableZoom&&"none"!==t?e.touchAction="manipulation":e.touchAction=t}else e.touchAction=""}isStationary(){return this.goalSpherical.theta===this.spherical.theta&&this.goalSpherical.phi===this.spherical.phi&&this.goalSpherical.radius===this.spherical.radius&&this.goalLogFov===this.logFov}moveCamera(){this.spherical.makeSafe(),this.camera.position.setFromSpherical(this.spherical),this.camera.setRotationFromEuler(new o.O9p(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,s){this.adjustOrbit(e*this.orbitSensitivity*this.inputSensitivity,t*this.orbitSensitivity*this.inputSensitivity,s*this.inputSensitivity)}wrapAngle(e){const t=(e+Math.PI)/(2*Math.PI);return 2*(t-Math.floor(t))*Math.PI-Math.PI}pixelLengthToSphericalAngle(e){return 2*Math.PI*e/this.scene.height}twoTouchDistance(e,t){const{clientX:s,clientY:r}=e,{clientX:o,clientY:A}=t,l=o-s,h=A-r;return Math.sqrt(l*l+h*h)}handleSinglePointerMove(e,t){const s=this.pixelLengthToSphericalAngle(e),r=this.pixelLengthToSphericalAngle(t);!1===this.isUserPointing&&(this.isUserPointing=!0,this.dispatchEvent({type:"pointer-change-start"})),this.userAdjustOrbit(s,r,0)}initializePan(){const{theta:e,phi:t}=this.spherical,s=e-this.scene.yaw;this.panPerPixel=.018*this.panSensitivity/this.scene.height,this.panProjection.set(-Math.cos(s),-Math.cos(t)*Math.sin(s),0,0,Math.sin(t),0,Math.sin(s),-Math.cos(t)*Math.cos(s),0)}movePan(e,t){const{scene:s}=this,r=vn.set(e,t,0).multiplyScalar(this.inputSensitivity),o=this.spherical.radius*Math.exp(this.logFov)*this.panPerPixel;r.multiplyScalar(o);const A=s.getTarget();A.add(r.applyMatrix3(this.panProjection)),s.boundingSphere.clampPoint(A,A),s.setTarget(A.x,A.y,A.z)}recenter(e){if(performance.now()>this.startTime+300||Math.abs(e.clientX-this.startPointerPosition.clientX)>2||Math.abs(e.clientY-this.startPointerPosition.clientY)>2)return;const{scene:t}=this,s=t.positionAndNormalFromPoint(t.getNDC(e.clientX,e.clientY));if(null==s){const{cameraTarget:e}=t.element;t.element.cameraTarget="",t.element.cameraTarget=e,this.userAdjustOrbit(0,0,1)}else t.target.worldToLocal(s.position),t.setTarget(s.position.x,s.position.y,s.position.z)}resetRadius(){const{scene:e}=this,t=e.positionAndNormalFromPoint(wn.set(0,0));if(null==t)return;e.target.worldToLocal(t.position);const s=e.getTarget(),{theta:r,phi:o}=this.spherical,A=r-e.yaw,l=vn.set(Math.sin(o)*Math.sin(A),Math.cos(o),Math.sin(o)*Math.cos(A)),h=l.dot(t.position.sub(s));s.add(l.multiplyScalar(h)),e.setTarget(s.x,s.y,s.z),this.setOrbit(void 0,void 0,this.goalSpherical.radius-h)}onTouchChange(e){if(1===this.pointers.length)this.touchMode=this.touchModeRotate;else{if(this._disableZoom)return this.touchMode=null,void this.element.removeEventListener("touchmove",this.disableScroll);this.touchMode=this.touchDecided&&null===this.touchMode?null:this.touchModeZoom,this.touchDecided=!0,this.element.addEventListener("touchmove",this.disableScroll,{passive:!1}),this.lastSeparation=this.twoTouchDistance(this.pointers[0],this.pointers[1]),this.enablePan&&null!=this.touchMode&&(this.initializePan(),e.altKey||(this.scene.element[js].style.opacity=1))}}onMouseDown(e){this.panPerPixel=0,this.enablePan&&(2===e.button||e.ctrlKey||e.metaKey||e.shiftKey)&&(this.initializePan(),this.scene.element[js].style.opacity=1),this.element.style.cursor="grabbing"}orbitZoomKeyCodeHandler(e){let t=!0;switch(e.key){case"PageUp":this.userAdjustOrbit(0,0,bn*this.zoomSensitivity);break;case"PageDown":this.userAdjustOrbit(0,0,-.04*this.zoomSensitivity);break;case"ArrowUp":this.userAdjustOrbit(0,-xn,0);break;case"ArrowDown":this.userAdjustOrbit(0,xn,0);break;case"ArrowLeft":this.userAdjustOrbit(-xn,0,0);break;case"ArrowRight":this.userAdjustOrbit(xn,0,0);break;default:t=!1}return t}panKeyCodeHandler(e){this.initializePan();let t=!0;switch(e.key){case"ArrowUp":this.movePan(0,-10);break;case"ArrowDown":this.movePan(0,10);break;case"ArrowLeft":this.movePan(-10,0);break;case"ArrowRight":this.movePan(10,0);break;default:t=!1}return t}}var Mn=s(96763);const Tn=1/1.3,Rn="not-presenting",Dn="session-started",Ln="object-placed",Fn="failed",_n="tracking",kn="not-tracking",Un=new o.Pq0,Gn=new o.kn4,Pn=new o.Pq0,Nn=new o.ubm(45,1,.1,100);class ARRenderer extends o.Qev{constructor(e){super(),this.renderer=e,this.currentSession=null,this.placeOnWall=!1,this.placementBox=null,this.lastTick=null,this.turntableRotation=null,this.oldShadowIntensity=null,this.frame=null,this.initialHitSource=null,this.transientHitTestSource=null,this.inputSource=null,this._presentedScene=null,this.resolveCleanup=null,this.exitWebXRButtonContainer=null,this.overlay=null,this.xrLight=null,this.tracking=!0,this.frames=0,this.initialized=!1,this.oldTarget=new o.Pq0,this.placementComplete=!1,this.isTranslating=!1,this.isRotating=!1,this.isTwoFingering=!1,this.lastDragPosition=new o.Pq0,this.firstRatio=0,this.lastAngle=0,this.goalPosition=new o.Pq0,this.goalYaw=0,this.goalScale=1,this.xDamper=new Damper,this.yDamper=new Damper,this.zDamper=new Damper,this.yawDamper=new Damper,this.scaleDamper=new Damper,this.onExitWebXRButtonContainerClick=()=>this.stopPresenting(),this.onUpdateScene=()=>{null!=this.placementBox&&this.isPresenting&&(this.placementBox.dispose(),this.placementBox=new PlacementBox(this.presentedScene,this.placeOnWall?"back":"bottom"))},this.onSelectStart=e=>{const t=this.transientHitTestSource;if(null==t)return;const s=this.frame.getHitTestResultsForTransientInput(t),r=this.presentedScene,o=this.placementBox;if(1===s.length){this.inputSource=e.inputSource;const{axes:t}=this.inputSource.gamepad,s=o.getHit(this.presentedScene,t[0],t[1]);o.show=!0,null!=s?(this.isTranslating=!0,this.lastDragPosition.copy(s)):!1===this.placeOnWall&&(this.isRotating=!0,this.lastAngle=1.5*t[0])}else if(2===s.length){o.show=!0,this.isTwoFingering=!0;const{separation:e}=this.fingerPolar(s);this.firstRatio=e/r.scale.x}},this.onSelectEnd=()=>{this.isTranslating=!1,this.isRotating=!1,this.isTwoFingering=!1,this.inputSource=null,this.goalPosition.y+=this.placementBox.offsetHeight*this.presentedScene.scale.x,this.placementBox.show=!1},this.threeRenderer=e.threeRenderer,this.threeRenderer.xr.enabled=!0}async resolveARSession(){assertIsArCandidate();const e=await navigator.xr.requestSession("immersive-ar",{requiredFeatures:["hit-test"],optionalFeatures:["dom-overlay","light-estimation"],domOverlay:this.overlay?{root:this.overlay}:void 0});return this.threeRenderer.xr.setReferenceSpaceType("local"),await this.threeRenderer.xr.setSession(e),this.threeRenderer.xr.cameraAutoUpdate=!1,e}get presentedScene(){return this._presentedScene}async supportsPresentation(){try{return assertIsArCandidate(),await navigator.xr.isSessionSupported("immersive-ar")}catch(e){return Mn.warn("Request to present in WebXR denied:"),Mn.warn(e),Mn.warn("Falling back to next ar-mode"),!1}}async present(e,t=!1){this.isPresenting&&Mn.warn("Cannot present while a model is already presenting");let s=new Promise(((e,t)=>{requestAnimationFrame((()=>e()))}));e.setHotspotsVisibility(!1),e.queueRender(),await s,this._presentedScene=e,this.overlay=e.element.shadowRoot.querySelector("div.default"),!0===t&&(this.xrLight=new XREstimatedLight(this.threeRenderer),this.xrLight.addEventListener("estimationstart",(()=>{if(!this.isPresenting||null==this.xrLight)return;const e=this.presentedScene;e.add(this.xrLight),e.environment=this.xrLight.environment})));const r=await this.resolveARSession();r.addEventListener("end",(()=>{this.postSessionCleanup()}),{once:!0});const o=e.element.shadowRoot.querySelector(".slot.exit-webxr-ar-button");o.classList.add("enabled"),o.addEventListener("click",this.onExitWebXRButtonContainerClick),this.exitWebXRButtonContainer=o;const A=await r.requestReferenceSpace("viewer");this.tracking=!0,this.frames=0,this.initialized=!1,this.turntableRotation=e.yaw,this.goalYaw=e.yaw,this.goalScale=1,e.setBackground(null),this.oldShadowIntensity=e.shadowIntensity,e.setShadowIntensity(.01),this.oldTarget.copy(e.getTarget()),e.element.addEventListener("load",this.onUpdateScene);const l=20*Math.PI/180,h=!0===this.placeOnWall?void 0:new XRRay(new DOMPoint(0,0,0),{x:0,y:-Math.sin(l),z:-Math.cos(l)});r.requestHitTestSource({space:A,offsetRay:h}).then((e=>{this.initialHitSource=e})),this.currentSession=r,this.placementBox=new PlacementBox(e,this.placeOnWall?"back":"bottom"),this.placementComplete=!1,this.lastTick=performance.now(),this.dispatchEvent({type:"status",status:Dn})}async stopPresenting(){if(!this.isPresenting)return;const e=new Promise((e=>{this.resolveCleanup=e}));try{await this.currentSession.end(),await e}catch(e){Mn.warn("Error while trying to end WebXR AR session"),Mn.warn(e),this.postSessionCleanup()}}get isPresenting(){return null!=this.presentedScene}get target(){return this.oldTarget}updateTarget(){const e=this.presentedScene;if(null!=e){const t=e.getTarget();this.oldTarget.copy(t),this.placeOnWall?t.z=e.boundingBox.min.z:t.y=e.boundingBox.min.y,e.setTarget(t.x,t.y,t.z)}}postSessionCleanup(){const e=this.currentSession;null!=e&&(e.removeEventListener("selectstart",this.onSelectStart),e.removeEventListener("selectend",this.onSelectEnd),this.currentSession=null);const t=this.presentedScene;if(this._presentedScene=null,null!=t){const{element:e}=t;null!=this.xrLight&&(t.remove(this.xrLight),this.xrLight.dispose(),this.xrLight=null),t.position.set(0,0,0),t.scale.set(1,1,1),t.setShadowOffset(0);const s=this.turntableRotation;null!=s&&(t.yaw=s);const r=this.oldShadowIntensity;null!=r&&t.setShadowIntensity(r),t.setEnvironmentAndSkybox(e[Fe],e[_e]);const o=this.oldTarget;t.setTarget(o.x,o.y,o.z),t.xrCamera=null,t.element.removeEventListener("load",this.onUpdateScene),t.orientHotspots(0),e.requestUpdate("cameraTarget"),e.requestUpdate("maxCameraOrbit"),e[qo](e.getBoundingClientRect()),requestAnimationFrame((()=>{t.element.dispatchEvent(new CustomEvent("camera-change",{detail:{source:Sn.NONE}}))}))}this.renderer.height=0;const s=this.exitWebXRButtonContainer;null!=s&&(s.classList.remove("enabled"),s.removeEventListener("click",this.onExitWebXRButtonContainerClick),this.exitWebXRButtonContainer=null);const r=this.transientHitTestSource;null!=r&&(r.cancel(),this.transientHitTestSource=null);const o=this.initialHitSource;null!=o&&(o.cancel(),this.initialHitSource=null),null!=this.placementBox&&(this.placementBox.dispose(),this.placementBox=null),this.lastTick=null,this.turntableRotation=null,this.oldShadowIntensity=null,this.frame=null,this.inputSource=null,this.overlay=null,null!=this.resolveCleanup&&this.resolveCleanup(),this.dispatchEvent({type:"status",status:Rn})}updateView(e){const t=this.presentedScene,s=this.threeRenderer.xr;s.updateCamera(Nn),t.xrCamera=s.getCamera();const{elements:r}=t.getCamera().matrixWorld;if(t.orientHotspots(Math.atan2(r[1],r[5])),this.initialized||(this.placeInitially(),this.initialized=!0),e.requestViewportScale&&e.recommendedViewportScale){const t=e.recommendedViewportScale;e.requestViewportScale(Math.max(t,.25))}const o=s.getBaseLayer();if(null!=o){const t=o instanceof XRWebGLLayer?o.getViewport(e):s.getBinding().getViewSubImage(o,e).viewport;this.threeRenderer.setViewport(t.x,t.y,t.width,t.height)}}placeInitially(){const e=this.presentedScene,{position:t,element:s}=e,r=e.getCamera(),{width:o,height:A}=this.overlay.getBoundingClientRect();e.setSize(o,A),r.projectionMatrixInverse.copy(r.projectionMatrix).invert();const{theta:l,radius:h}=s.getCameraOrbit(),c=r.getWorldDirection(Un);e.yaw=Math.atan2(-c.x,-c.z)-l,this.goalYaw=e.yaw,t.copy(r.position).add(c.multiplyScalar(h)),this.updateTarget();const d=e.getTarget();t.add(d).sub(this.oldTarget),this.goalPosition.copy(t),e.setHotspotsVisibility(!0);const{session:g}=this.frame;g.addEventListener("selectstart",this.onSelectStart),g.addEventListener("selectend",this.onSelectEnd),g.requestHitTestSourceForTransientInput({profile:"generic-touchscreen"}).then((e=>{this.transientHitTestSource=e}))}getTouchLocation(){const{axes:e}=this.inputSource.gamepad;let t=this.placementBox.getExpandedHit(this.presentedScene,e[0],e[1]);return null!=t&&(Un.copy(t).sub(this.presentedScene.getCamera().position),Un.length()>10)?null:t}getHitPoint(e){const t=this.threeRenderer.xr.getReferenceSpace(),s=e.getPose(t);if(null==s)return null;const r=Gn.fromArray(s.transform.matrix);return!0===this.placeOnWall&&(this.goalYaw=Math.atan2(r.elements[4],r.elements[6])),r.elements[5]>.75!==this.placeOnWall?Pn.setFromMatrixPosition(r):null}moveToFloor(e){const t=this.initialHitSource;if(null==t)return;const s=e.getHitTestResults(t);if(0==s.length)return;const r=s[0],o=this.getHitPoint(r);null!=o&&(this.placementBox.show=!0,this.isTranslating||(this.placeOnWall?this.goalPosition.copy(o):this.goalPosition.y=o.y),t.cancel(),this.initialHitSource=null,this.dispatchEvent({type:"status",status:Ln}))}fingerPolar(e){const t=e[0].inputSource.gamepad.axes,s=e[1].inputSource.gamepad.axes,r=s[0]-t[0],o=s[1]-t[1],A=Math.atan2(o,r);let l=this.lastAngle-A;return l>Math.PI?l-=2*Math.PI:l<-Math.PI&&(l+=2*Math.PI),this.lastAngle=A,{separation:Math.sqrt(r*r+o*o),deltaYaw:l}}processInput(e){const t=this.transientHitTestSource;if(null==t)return;if(!this.isTranslating&&!this.isTwoFingering&&!this.isRotating)return;const s=e.getHitTestResultsForTransientInput(t),r=this.presentedScene,o=r.scale.x;if(this.isTwoFingering)if(s.length<2)this.isTwoFingering=!1;else{const{separation:e,deltaYaw:t}=this.fingerPolar(s);if(!1===this.placeOnWall&&(this.goalYaw+=t),r.canScale){const t=e/this.firstRatio;this.goalScale=t<1.3&&t>Tn?1:t}}else if(2!==s.length)if(this.isRotating){const e=1.5*this.inputSource.gamepad.axes[0];this.goalYaw+=e-this.lastAngle,this.lastAngle=e}else this.isTranslating&&s.forEach((e=>{if(e.inputSource!==this.inputSource)return;let t=null;if(e.results.length>0&&(t=this.getHitPoint(e.results[0])),null==t&&(t=this.getTouchLocation()),null!=t){if(this.goalPosition.sub(this.lastDragPosition),!1===this.placeOnWall){const e=t.y-this.lastDragPosition.y;if(e<0){this.placementBox.offsetHeight=e/o,this.presentedScene.setShadowOffset(e);const s=Un.copy(r.getCamera().position),A=-e/(s.y-t.y);s.multiplyScalar(A),t.multiplyScalar(1-A).add(s)}}this.goalPosition.add(t),this.lastDragPosition.copy(t)}}));else{this.isTranslating=!1,this.isRotating=!1,this.isTwoFingering=!0;const{separation:e}=this.fingerPolar(s);this.firstRatio=e/o}}moveScene(e){const t=this.presentedScene,{position:s,yaw:r}=t,o=t.boundingSphere.radius,A=this.goalPosition,l=t.scale.x,h=this.placementBox;let c=Sn.NONE;if(!A.equals(s)||this.goalScale!==l){c=Sn.USER_INTERACTION;let{x:r,y:d,z:g}=s;r=this.xDamper.update(r,A.x,e,o),d=this.yDamper.update(d,A.y,e,o),g=this.zDamper.update(g,A.z,e,o),s.set(r,d,g);const p=this.scaleDamper.update(l,this.goalScale,e,1);if(t.scale.set(p,p,p),!this.isTranslating){const e=A.y-d;this.placementComplete&&!1===this.placeOnWall?(h.offsetHeight=e/p,t.setShadowOffset(e)):0===e&&(this.placementComplete=!0,h.show=!1,t.setShadowIntensity(.8))}}h.updateOpacity(e),t.updateTarget(e),t.yaw=this.yawDamper.update(r,this.goalYaw,e,Math.PI),t.element.dispatchEvent(new CustomEvent("camera-change",{detail:{source:c}}))}onWebXRFrame(e,t){this.frame=t,++this.frames;const s=this.threeRenderer.xr.getReferenceSpace(),r=t.getViewerPose(s);null==r&&!0===this.tracking&&this.frames>30&&(this.tracking=!1,this.dispatchEvent({type:"tracking",status:kn}));const o=this.presentedScene;if(null==r||null==o||!o.element.loaded)return void this.threeRenderer.clear();!1===this.tracking&&(this.tracking=!0,this.dispatchEvent({type:"tracking",status:_n}));let A=!0;for(const s of r.views){if(this.updateView(s),A){this.moveToFloor(t),this.processInput(t);const s=e-this.lastTick;this.moveScene(s),this.renderer.preRender(o,e,s),this.lastTick=e,o.renderShadow(this.threeRenderer)}this.threeRenderer.render(o,o.getCamera()),A=!1}}}function clone(e){const t=new Map,s=new Map,r=e.clone();return parallelTraverse(e,r,(function(e,r){t.set(r,e),s.set(e,r)})),r.traverse((function(e){if(!e.isSkinnedMesh)return;const r=e,o=t.get(e),A=o.skeleton.bones;r.skeleton=o.skeleton.clone(),r.bindMatrix.copy(o.bindMatrix),r.skeleton.bones=A.map((function(e){return s.get(e)})),r.bind(r.skeleton,r.bindMatrix)})),r}function parallelTraverse(e,t,s){s(e,t);for(let r=0;r<e.children.length;r++)parallelTraverse(e.children[r],t.children[r],s)}const On=Symbol("prepared"),Hn=Symbol("prepare"),qn=Symbol("preparedGLTF"),Vn=Symbol("clone");class GLTFInstance{constructor(e){this[qn]=e}static prepare(e){if(null==e.scene)throw new Error("Model does not have a scene");if(e[On])return e;const t=this[Hn](e);return t[On]=!0,t}static[Hn](e){const{scene:t}=e,s=[t];return Object.assign(Object.assign({},e),{scene:t,scenes:s})}get parser(){return this[qn].parser}get animations(){return this[qn].animations}get scene(){return this[qn].scene}get scenes(){return this[qn].scenes}get cameras(){return this[qn].cameras}get asset(){return this[qn].asset}get userData(){return this[qn].userData}clone(){return new(0,this.constructor)(this[Vn]())}dispose(){this.scenes.forEach((e=>{e.traverse((e=>{const t=e;if(!t.material)return;(Array.isArray(t.material)?t.material:[t.material]).forEach((e=>{for(const t in e){const s=e[t];if(s instanceof o.gPd){const e=s.source.data;null!=e.close&&e.close(),s.dispose()}}e.dispose()})),t.geometry.dispose()}))}))}[Vn](){const e=this[qn],t=clone(this.scene);cloneVariantMaterials(t,this.scene);const s=[t],r=e.userData?Object.assign({},e.userData):{};return Object.assign(Object.assign({},e),{scene:t,scenes:s,userData:r})}}const cloneVariantMaterials=(e,t)=>{traversePair(e,t,((e,t)=>{void 0!==t.userData.variantMaterials&&(e.userData.variantMaterials=new Map(t.userData.variantMaterials)),void 0!==t.userData.variantData&&(e.userData.variantData=t.userData.variantData),void 0!==t.userData.originalMaterial&&(e.userData.originalMaterial=t.userData.originalMaterial)}))},traversePair=(e,t,s)=>{s(e,t);for(let r=0;r<e.children.length;r++)traversePair(e.children[r],t.children[r],s)},$n=Symbol("threeGLTF"),Jn=Symbol("gltf"),Kn=Symbol("gltfElementMap"),Yn=Symbol("threeObjectMap"),zn=Symbol("parallelTraverseThreeScene"),jn=Symbol("correlateOriginalThreeGLTF"),Wn=Symbol("correlateCloneThreeGLTF");class CorrelatedSceneGraph{constructor(e,t,s,r){this[$n]=e,this[Jn]=t,this[Kn]=r,this[Yn]=s}static from(e,t){return null!=t?this[Wn](e,t):this[jn](e)}static[jn](e){const t=e.parser.json,s=e.parser.associations,r=new Map,A={name:"Default"},l={type:"materials",index:-1};for(const e of s.keys())e instanceof o.imn&&null==s.get(e)&&(l.index<0&&(null==t.materials&&(t.materials=[]),l.index=t.materials.length,t.materials.push(A)),e.name=A.name,s.set(e,{materials:l.index}));for(const[e,o]of s){o&&(e.userData=e.userData||{},e.userData.associations=o);for(const s in o)if(null!=s&&"primitives"!==s){const A=s,l=(t[A]||[])[o[A]];if(null==l)continue;let h=r.get(l);null==h&&(h=new Set,r.set(l,h)),h.add(e)}}return new CorrelatedSceneGraph(e,t,s,r)}static[Wn](e,t){const s=t.threeGLTF,r=t.gltf,o=JSON.parse(JSON.stringify(r)),A=new Map,l=new Map;for(let r=0;r<s.scenes.length;r++)this[zn](s.scenes[r],e.scenes[r],((e,s)=>{const r=t.threeObjectMap.get(e);if(null!=r)for(const e in r)if(null!=e&&"primitives"!==e){const t=e,h=r[t],c=o[t][h],d=A.get(s)||{};d[t]=h,A.set(s,d);const g=l.get(c)||new Set;g.add(s),l.set(c,g)}}));return new CorrelatedSceneGraph(e,o,A,l)}static[zn](e,t,s){const traverse=(e,t)=>{if(s(e,t),e.isObject3D){const r=e,o=t;if(r.material)if(Array.isArray(r.material))for(let e=0;e<r.material.length;++e)s(r.material[e],o.material[e]);else s(r.material,o.material);for(let s=0;s<e.children.length;++s)traverse(e.children[s],t.children[s])}};traverse(e,t)}get threeGLTF(){return this[$n]}get gltf(){return this[Jn]}get gltfElementMap(){return this[Kn]}get threeObjectMap(){return this[Yn]}}const Xn=Symbol("correlatedSceneGraph");class ModelViewerGLTFInstance extends GLTFInstance{static[Hn](e){const t=super[Hn](e);null==t[Xn]&&(t[Xn]=CorrelatedSceneGraph.from(t));const{scene:s}=t,r=new o.iyt(void 0,1/0);return s.traverse((e=>{e.renderOrder=1e3,e.frustumCulled=!1,e.name||(e.name=e.uuid);const s=e;if(s.material){const{geometry:e}=s;s.castShadow=!0,s.isSkinnedMesh&&(e.boundingSphere=r,e.boundingBox=null);const A=s.material;if(!0===A.isMeshBasicMaterial&&(A.toneMapped=!1),A.shadowSide=o.hB5,A.aoMap){const{gltf:s,threeObjectMap:r}=t[Xn],o=r.get(A);if(null!=s.materials&&null!=o&&null!=o.materials){const t=s.materials[o.materials];t.occlusionTexture&&0===t.occlusionTexture.texCoord&&null!=e.attributes.uv&&e.setAttribute("uv2",e.attributes.uv)}}}})),t}get correlatedSceneGraph(){return this[qn][Xn]}[Vn](){const e=super[Vn](),t=new Map;return e.scene.traverse((e=>{const s=e;if(s.material){const e=s.material;if(null!=e){if(t.has(e.uuid))return void(s.material=t.get(e.uuid));s.material=e.clone(),t.set(e.uuid,s.material)}}const r=e;void 0!==r.target&&r.add(r.target)})),e[Xn]=CorrelatedSceneGraph.from(e,this.correlatedSceneGraph),e}}var Zn=s(96763);const getBufferForType=(e,t,s)=>{let r;switch(e){case o.OUM:r=new Uint8ClampedArray(t*s*4);break;case o.ix0:r=new Uint16Array(t*s*4);break;case o.bkx:r=new Uint32Array(t*s*4);break;case o.tJf:r=new Int8Array(t*s*4);break;case o.fBL:r=new Int16Array(t*s*4);break;case o.Yuy:r=new Int32Array(t*s*4);break;case o.RQf:r=new Float32Array(t*s*4);break;default:throw new Error("Unsupported data type")}return r};let er;class QuadRenderer_vDmOC3x_QuadRenderer{constructor(e){var t,s,r,A,l,h,c,d,g,p,m,f,I,E,C,B;this._rendererIsDisposable=!1,this._supportsReadPixels=!0,this.render=()=>{this._renderer.setRenderTarget(this._renderTarget);try{this._renderer.render(this._scene,this._camera)}catch(e){throw this._renderer.setRenderTarget(null),e}this._renderer.setRenderTarget(null)},this._width=e.width,this._height=e.height,this._type=e.type,this._colorSpace=e.colorSpace;const y={format:o.GWd,depthBuffer:!1,stencilBuffer:!1,type:this._type,colorSpace:this._colorSpace,anisotropy:void 0!==(null===(t=e.renderTargetOptions)||void 0===t?void 0:t.anisotropy)?null===(s=e.renderTargetOptions)||void 0===s?void 0:s.anisotropy:1,generateMipmaps:void 0!==(null===(r=e.renderTargetOptions)||void 0===r?void 0:r.generateMipmaps)&&(null===(A=e.renderTargetOptions)||void 0===A?void 0:A.generateMipmaps),magFilter:void 0!==(null===(l=e.renderTargetOptions)||void 0===l?void 0:l.magFilter)?null===(h=e.renderTargetOptions)||void 0===h?void 0:h.magFilter:o.k6q,minFilter:void 0!==(null===(c=e.renderTargetOptions)||void 0===c?void 0:c.minFilter)?null===(d=e.renderTargetOptions)||void 0===d?void 0:d.minFilter:o.k6q,samples:void 0!==(null===(g=e.renderTargetOptions)||void 0===g?void 0:g.samples)?null===(p=e.renderTargetOptions)||void 0===p?void 0:p.samples:void 0,wrapS:void 0!==(null===(m=e.renderTargetOptions)||void 0===m?void 0:m.wrapS)?null===(f=e.renderTargetOptions)||void 0===f?void 0:f.wrapS:o.ghU,wrapT:void 0!==(null===(I=e.renderTargetOptions)||void 0===I?void 0:I.wrapT)?null===(E=e.renderTargetOptions)||void 0===E?void 0:E.wrapT:o.ghU};if(this._material=e.material,e.renderer?this._renderer=e.renderer:(this._renderer=QuadRenderer_vDmOC3x_QuadRenderer.instantiateRenderer(),this._rendererIsDisposable=!0),this._scene=new o.Z58,this._camera=new o.qUd,this._camera.position.set(0,0,10),this._camera.left=-.5,this._camera.right=.5,this._camera.top=.5,this._camera.bottom=-.5,this._camera.updateProjectionMatrix(),!((e,t,s,r)=>{if(void 0!==er)return er;const A=new o.nWS(1,1,r);t.setRenderTarget(A);const l=new o.eaF(new o.bdM,new o.V9B({color:16777215}));t.render(l,s),t.setRenderTarget(null);const h=getBufferForType(e,A.width,A.height);return t.readRenderTargetPixels(A,0,0,A.width,A.height,h),A.dispose(),l.geometry.dispose(),l.material.dispose(),er=0!==h[0],er})(this._type,this._renderer,this._camera,y)){let e;if(this._type===o.ix0)e=this._renderer.extensions.has("EXT_color_buffer_float")?o.RQf:void 0;void 0!==e?(Zn.warn(`This browser does not support reading pixels from ${this._type} RenderTargets, switching to ${o.RQf}`),this._type=e):(this._supportsReadPixels=!1,Zn.warn("This browser dos not support toArray or toDataTexture, calls to those methods will result in an error thrown"))}this._quad=new o.eaF(new o.bdM,this._material),this._quad.geometry.computeBoundingBox(),this._scene.add(this._quad),this._renderTarget=new o.nWS(this.width,this.height,y),this._renderTarget.texture.mapping=void 0!==(null===(C=e.renderTargetOptions)||void 0===C?void 0:C.mapping)?null===(B=e.renderTargetOptions)||void 0===B?void 0:B.mapping:o.UTZ}static instantiateRenderer(){const e=new o.JeP;return e.setSize(128,128),e}toArray(){if(!this._supportsReadPixels)throw new Error("Can't read pixels in this browser");const e=getBufferForType(this._type,this._width,this._height);return this._renderer.readRenderTargetPixels(this._renderTarget,0,0,this._width,this._height,e),e}toDataTexture(e){const t=new o.GYF(this.toArray(),this.width,this.height,o.GWd,this._type,(null==e?void 0:e.mapping)||o.UTZ,(null==e?void 0:e.wrapS)||o.ghU,(null==e?void 0:e.wrapT)||o.ghU,(null==e?void 0:e.magFilter)||o.k6q,(null==e?void 0:e.minFilter)||o.k6q,(null==e?void 0:e.anisotropy)||1,o.Zr2);return t.generateMipmaps=void 0!==(null==e?void 0:e.generateMipmaps)&&(null==e?void 0:e.generateMipmaps),t}disposeOnDemandRenderer(){this._renderer.setRenderTarget(null),this._rendererIsDisposable&&(this._renderer.dispose(),this._renderer.forceContextLoss())}dispose(e){this.disposeOnDemandRenderer(),e&&this.renderTarget.dispose(),this.material instanceof o.BKk&&Object.values(this.material.uniforms).forEach((e=>{e.value instanceof o.gPd&&e.value.dispose()})),Object.values(this.material).forEach((e=>{e instanceof o.gPd&&e.dispose()})),this.material.dispose(),this._quad.geometry.dispose()}get width(){return this._width}set width(e){this._width=e,this._renderTarget.setSize(this._width,this._height)}get height(){return this._height}set height(e){this._height=e,this._renderTarget.setSize(this._width,this._height)}get renderer(){return this._renderer}get renderTarget(){return this._renderTarget}set renderTarget(e){this._renderTarget=e,this._width=e.width,this._height=e.height}get material(){return this._material}get type(){return this._type}get colorSpace(){return this._colorSpace}}var tr=s(96763);class GainMapDecoderMaterial extends o.BKk{constructor({gamma:e,offsetHdr:t,offsetSdr:s,gainMapMin:r,gainMapMax:A,maxDisplayBoost:l,hdrCapacityMin:h,hdrCapacityMax:c,sdr:d,gainMap:g}){super({name:"GainMapDecoderMaterial",vertexShader:"\nvarying vec2 vUv;\n\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",fragmentShader:"\n// min half float value\n#define HALF_FLOAT_MIN vec3( -65504, -65504, -65504 )\n// max half float value\n#define HALF_FLOAT_MAX vec3( 65504, 65504, 65504 )\n\nuniform sampler2D sdr;\nuniform sampler2D gainMap;\nuniform vec3 gamma;\nuniform vec3 offsetHdr;\nuniform vec3 offsetSdr;\nuniform vec3 gainMapMin;\nuniform vec3 gainMapMax;\nuniform float weightFactor;\n\nvarying vec2 vUv;\n\nvoid main() {\n vec3 rgb = texture2D( sdr, vUv ).rgb;\n vec3 recovery = texture2D( gainMap, vUv ).rgb;\n vec3 logRecovery = pow( recovery, gamma );\n vec3 logBoost = gainMapMin * ( 1.0 - logRecovery ) + gainMapMax * logRecovery;\n vec3 hdrColor = (rgb + offsetSdr) * exp2( logBoost * weightFactor ) - offsetHdr;\n vec3 clampedHdrColor = max( HALF_FLOAT_MIN, min( HALF_FLOAT_MAX, hdrColor ));\n gl_FragColor = vec4( clampedHdrColor , 1.0 );\n}\n",uniforms:{sdr:{value:d},gainMap:{value:g},gamma:{value:new o.Pq0(1/e[0],1/e[1],1/e[2])},offsetHdr:{value:(new o.Pq0).fromArray(t)},offsetSdr:{value:(new o.Pq0).fromArray(s)},gainMapMin:{value:(new o.Pq0).fromArray(r)},gainMapMax:{value:(new o.Pq0).fromArray(A)},weightFactor:{value:(Math.log2(l)-h)/(c-h)}},blending:o.XIg,depthTest:!1,depthWrite:!1}),this._maxDisplayBoost=l,this._hdrCapacityMin=h,this._hdrCapacityMax=c,this.needsUpdate=!0,this.uniformsNeedUpdate=!0}get sdr(){return this.uniforms.sdr.value}set sdr(e){this.uniforms.sdr.value=e}get gainMap(){return this.uniforms.gainMap.value}set gainMap(e){this.uniforms.gainMap.value=e}get offsetHdr(){return this.uniforms.offsetHdr.value.toArray()}set offsetHdr(e){this.uniforms.offsetHdr.value.fromArray(e)}get offsetSdr(){return this.uniforms.offsetSdr.value.toArray()}set offsetSdr(e){this.uniforms.offsetSdr.value.fromArray(e)}get gainMapMin(){return this.uniforms.gainMapMin.value.toArray()}set gainMapMin(e){this.uniforms.gainMapMin.value.fromArray(e)}get gainMapMax(){return this.uniforms.gainMapMax.value.toArray()}set gainMapMax(e){this.uniforms.gainMapMax.value.fromArray(e)}get gamma(){const e=this.uniforms.gamma.value;return[1/e.x,1/e.y,1/e.z]}set gamma(e){const t=this.uniforms.gamma.value;t.x=1/e[0],t.y=1/e[1],t.z=1/e[2]}get hdrCapacityMin(){return this._hdrCapacityMin}set hdrCapacityMin(e){this._hdrCapacityMin=e,this.calculateWeight()}get hdrCapacityMax(){return this._hdrCapacityMax}set hdrCapacityMax(e){this._hdrCapacityMax=e,this.calculateWeight()}get maxDisplayBoost(){return this._maxDisplayBoost}set maxDisplayBoost(e){this._maxDisplayBoost=Math.max(1,Math.min(65504,e)),this.calculateWeight()}calculateWeight(){const e=(Math.log2(this._maxDisplayBoost)-this._hdrCapacityMin)/(this._hdrCapacityMax-this._hdrCapacityMin);this.uniforms.weightFactor.value=Math.max(0,Math.min(1,e))}}class GainMapNotFoundError extends Error{}class XMPMetadataNotFoundError extends Error{}const getAttribute=(e,t,s)=>{var r;let o;const A=null===(r=e.attributes.getNamedItem(t))||void 0===r?void 0:r.nodeValue;if(A)o=A;else{const r=e.getElementsByTagName(t)[0];if(!r){if(s)return s;throw new Error(`Can't find ${t} in gainmap metadata`)}{const e=r.getElementsByTagName("rdf:li");if(3!==e.length)throw new Error(`Gainmap metadata contains an array of items for ${t} but its length is not 3`);o=Array.from(e).map((e=>e.innerHTML))}}return o};class MPFExtractor{constructor(e){this.options={debug:!(!e||void 0===e.debug)&&e.debug,extractFII:!e||void 0===e.extractFII||e.extractFII,extractNonFII:!e||void 0===e.extractNonFII||e.extractNonFII}}extract(e){return new Promise(((t,s)=>{const r=this.options.debug,o=new DataView(e.buffer);if(65496!==o.getUint16(0))return void s(new Error("Not a valid jpeg"));const A=o.byteLength;let l,h=2,c=0;for(;h<A;){if(++c>250)return void s(new Error(`Found no marker after ${c} loops 😵`));if(255!==o.getUint8(h))return void s(new Error(`Not a valid marker at offset 0x${h.toString(16)}, found: 0x${o.getUint8(h).toString(16)}`));if(l=o.getUint8(h+1),r&&tr.log(`Marker: ${l.toString(16)}`),226===l){r&&tr.log("Found APP2 marker (0xffe2)");const e=h+4;if(1297106432===o.getUint32(e)){const r=e+4;let A;if(18761===o.getUint16(r))A=!1;else{if(19789!==o.getUint16(r))return void s(new Error("No valid endianness marker found in TIFF header"));A=!0}if(42!==o.getUint16(r+2,!A))return void s(new Error("Not valid TIFF data! (no 0x002A marker)"));const l=o.getUint32(r+4,!A);if(l<8)return void s(new Error("Not valid TIFF data! (First offset less than 8)"));const h=r+l,c=o.getUint16(h,!A),d=h+2;let g=0;for(let e=d;e<d+12*c;e+=12)45057===o.getUint16(e,!A)&&(g=o.getUint32(e+8,!A));const p=h+2+12*c+4,m=[];for(let e=p;e<p+16*g;e+=16){const t={MPType:o.getUint32(e,!A),size:o.getUint32(e+4,!A),dataOffset:o.getUint32(e+8,!A),dependantImages:o.getUint32(e+12,!A),start:-1,end:-1,isFII:!1};t.dataOffset?(t.start=r+t.dataOffset,t.isFII=!1):(t.start=0,t.isFII=!0),t.end=t.start+t.size,m.push(t)}if(this.options.extractNonFII&&m.length){const e=new Blob([o]),s=[];for(const t of m){if(t.isFII&&!this.options.extractFII)continue;const r=e.slice(t.start,t.end+1,"image/jpeg");s.push(r)}t(s)}}}h+=2+o.getUint16(h+2)}}))}}const extractGainmapFromJPEG=async e=>{const t=(e=>{var t,s;let r;r="undefined"!=typeof TextDecoder?(new TextDecoder).decode(e):e.toString();let o=r.indexOf("<x:xmpmeta");const A=new DOMParser;for(;-1!==o;){const e=r.indexOf("x:xmpmeta>",o);r.slice(o,e+10);const l=r.slice(o,e+10);try{const e=A.parseFromString(l,"text/xml").getElementsByTagName("rdf:Description")[0],r=getAttribute(e,"hdrgm:GainMapMin","0"),o=getAttribute(e,"hdrgm:GainMapMax"),h=getAttribute(e,"hdrgm:Gamma","1"),c=getAttribute(e,"hdrgm:OffsetSDR","0.015625"),d=getAttribute(e,"hdrgm:OffsetHDR","0.015625");let g=null===(t=e.attributes.getNamedItem("hdrgm:HDRCapacityMin"))||void 0===t?void 0:t.nodeValue;g||(g="0");const p=null===(s=e.attributes.getNamedItem("hdrgm:HDRCapacityMax"))||void 0===s?void 0:s.nodeValue;if(!p)throw new Error("Incomplete gainmap metadata");return{gainMapMin:Array.isArray(r)?r.map((e=>parseFloat(e))):[parseFloat(r),parseFloat(r),parseFloat(r)],gainMapMax:Array.isArray(o)?o.map((e=>parseFloat(e))):[parseFloat(o),parseFloat(o),parseFloat(o)],gamma:Array.isArray(h)?h.map((e=>parseFloat(e))):[parseFloat(h),parseFloat(h),parseFloat(h)],offsetSdr:Array.isArray(c)?c.map((e=>parseFloat(e))):[parseFloat(c),parseFloat(c),parseFloat(c)],offsetHdr:Array.isArray(d)?d.map((e=>parseFloat(e))):[parseFloat(d),parseFloat(d),parseFloat(d)],hdrCapacityMin:parseFloat(g),hdrCapacityMax:parseFloat(p)}}catch(e){}o=r.indexOf("<x:xmpmeta",e)}})(e);if(!t)throw new XMPMetadataNotFoundError("Gain map XMP metadata not found");const s=new MPFExtractor({extractFII:!0,extractNonFII:!0}),r=await s.extract(e);if(2!==r.length)throw new GainMapNotFoundError("Gain map recovery image not found");return{sdr:new Uint8Array(await r[0].arrayBuffer()),gainMap:new Uint8Array(await r[1].arrayBuffer()),metadata:t}},getHTMLImageFromBlob=e=>new Promise(((t,s)=>{const r=document.createElement("img");r.onload=()=>{t(r)},r.onerror=e=>{s(e)},r.src=URL.createObjectURL(e)}));class LoaderBase extends o.aHM{constructor(e,t){super(t),this._renderer=e,this._internalLoadingManager=new o.KPJ}setRenderTargetOptions(e){return this._renderTargetOptions=e,this}prepareQuadRenderer(){const e=new GainMapDecoderMaterial({gainMapMax:[1,1,1],gainMapMin:[0,0,0],gamma:[1,1,1],offsetHdr:[1,1,1],offsetSdr:[1,1,1],hdrCapacityMax:1,hdrCapacityMin:0,maxDisplayBoost:1,gainMap:new o.gPd,sdr:new o.gPd});return new QuadRenderer_vDmOC3x_QuadRenderer({width:16,height:16,type:o.ix0,colorSpace:o.Zr2,material:e,renderer:this._renderer,renderTargetOptions:this._renderTargetOptions})}async render(e,t,s,r){const A=r?new Blob([r],{type:"image/jpeg"}):void 0,l=new Blob([s],{type:"image/jpeg"});let h,c,d=!1;if("undefined"==typeof createImageBitmap){const e=await Promise.all([A?getHTMLImageFromBlob(A):Promise.resolve(void 0),getHTMLImageFromBlob(l)]);c=e[0],h=e[1],d=!0}else{const e=await Promise.all([A?createImageBitmap(A,{imageOrientation:"flipY"}):Promise.resolve(void 0),createImageBitmap(l,{imageOrientation:"flipY"})]);c=e[0],h=e[1]}const g=new o.gPd(c||new ImageData(2,2),o.UTZ,o.ghU,o.ghU,o.k6q,o.NZq,o.GWd,o.OUM,1,o.Zr2);g.flipY=d,g.needsUpdate=!0;const p=new o.gPd(h,o.UTZ,o.ghU,o.ghU,o.k6q,o.NZq,o.GWd,o.OUM,1,o.er$);p.flipY=d,p.needsUpdate=!0,e.width=h.width,e.height=h.height,e.material.gainMap=g,e.material.sdr=p,e.material.gainMapMin=t.gainMapMin,e.material.gainMapMax=t.gainMapMax,e.material.offsetHdr=t.offsetHdr,e.material.offsetSdr=t.offsetSdr,e.material.gamma=t.gamma,e.material.hdrCapacityMin=t.hdrCapacityMin,e.material.hdrCapacityMax=t.hdrCapacityMax,e.material.maxDisplayBoost=Math.pow(2,t.hdrCapacityMax),e.material.needsUpdate=!0,e.render()}}class HDRJPGLoader extends LoaderBase{load(e,t,s,r){const A=this.prepareQuadRenderer(),l=new o.Y9S(this._internalLoadingManager);return l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setPath(this.path),l.setWithCredentials(this.withCredentials),this.manager.itemStart(e),l.load(e,(async s=>{if("string"==typeof s)throw new Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");const o=new Uint8Array(s);let l,h,c;try{const e=await extractGainmapFromJPEG(o);l=e.sdr,h=e.gainMap,c=e.metadata}catch(t){if(!(t instanceof XMPMetadataNotFoundError||t instanceof GainMapNotFoundError))throw t;tr.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),c={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=o}try{await this.render(A,c,l,h)}catch(t){return this.manager.itemError(e),"function"==typeof r&&r(t),void A.disposeOnDemandRenderer()}"function"==typeof t&&t(A),this.manager.itemEnd(e),A.disposeOnDemandRenderer()}),s,(t=>{this.manager.itemError(e),"function"==typeof r&&r(t)})),A}}class RGBELoader extends o.BRH{constructor(e){super(e),this.type=o.ix0}parse(e){const rgbe_error=function(e,t){switch(e){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(t||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(t||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(t||""));default:throw new Error("THREE.RGBELoader: Memory Error: "+(t||""))}},fgets=function(e,t,s){t=t||1024;let r=e.pos,o=-1,A=0,l="",h=String.fromCharCode.apply(null,new Uint16Array(e.subarray(r,r+128)));for(;0>(o=h.indexOf("\n"))&&A<t&&r<e.byteLength;)l+=h,A+=h.length,r+=128,h+=String.fromCharCode.apply(null,new Uint16Array(e.subarray(r,r+128)));return-1<o&&(!1!==s&&(e.pos+=A+o+1),l+h.slice(0,o))},RGBEByteToRGBFloat=function(e,t,s,r){const o=e[t+3],A=Math.pow(2,o-128)/255;s[r+0]=e[t+0]*A,s[r+1]=e[t+1]*A,s[r+2]=e[t+2]*A,s[r+3]=1},RGBEByteToRGBHalf=function(e,t,s,r){const A=e[t+3],l=Math.pow(2,A-128)/255;s[r+0]=o.GxU.toHalfFloat(Math.min(e[t+0]*l,65504)),s[r+1]=o.GxU.toHalfFloat(Math.min(e[t+1]*l,65504)),s[r+2]=o.GxU.toHalfFloat(Math.min(e[t+2]*l,65504)),s[r+3]=o.GxU.toHalfFloat(1)},t=new Uint8Array(e);t.pos=0;const s=function(e){const t=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,s=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,r=/^\s*FORMAT=(\S+)\s*$/,o=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,A={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let l,h;for((e.pos>=e.byteLength||!(l=fgets(e)))&&rgbe_error(1,"no header found"),(h=l.match(/^#\?(\S+)/))||rgbe_error(3,"bad initial token"),A.valid|=1,A.programtype=h[1],A.string+=l+"\n";l=fgets(e),!1!==l;)if(A.string+=l+"\n","#"!==l.charAt(0)){if((h=l.match(t))&&(A.gamma=parseFloat(h[1])),(h=l.match(s))&&(A.exposure=parseFloat(h[1])),(h=l.match(r))&&(A.valid|=2,A.format=h[1]),(h=l.match(o))&&(A.valid|=4,A.height=parseInt(h[1],10),A.width=parseInt(h[2],10)),2&A.valid&&4&A.valid)break}else A.comments+=l+"\n";return 2&A.valid||rgbe_error(3,"missing format specifier"),4&A.valid||rgbe_error(3,"missing image size specifier"),A}(t),r=s.width,A=s.height,l=function(e,t,s){const r=t;if(r<8||r>32767||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);r!==(e[2]<<8|e[3])&&rgbe_error(3,"wrong scanline width");const o=new Uint8Array(4*t*s);o.length||rgbe_error(4,"unable to allocate buffer space");let A=0,l=0;const h=4*r,c=new Uint8Array(4),d=new Uint8Array(h);let g=s;for(;g>0&&l<e.byteLength;){l+4>e.byteLength&&rgbe_error(1),c[0]=e[l++],c[1]=e[l++],c[2]=e[l++],c[3]=e[l++],2==c[0]&&2==c[1]&&(c[2]<<8|c[3])==r||rgbe_error(3,"bad rgbe scanline format");let t,s=0;for(;s<h&&l<e.byteLength;){t=e[l++];const r=t>128;if(r&&(t-=128),(0===t||s+t>h)&&rgbe_error(3,"bad scanline data"),r){const r=e[l++];for(let e=0;e<t;e++)d[s++]=r}else d.set(e.subarray(l,l+t),s),s+=t,l+=t}const p=r;for(let e=0;e<p;e++){let t=0;o[A]=d[e+t],t+=r,o[A+1]=d[e+t],t+=r,o[A+2]=d[e+t],t+=r,o[A+3]=d[e+t],A+=4}g--}return o}(t.subarray(t.pos),r,A);let h,c,d;switch(this.type){case o.RQf:d=l.length/4;const e=new Float32Array(4*d);for(let t=0;t<d;t++)RGBEByteToRGBFloat(l,4*t,e,4*t);h=e,c=o.RQf;break;case o.ix0:d=l.length/4;const t=new Uint16Array(4*d);for(let e=0;e<d;e++)RGBEByteToRGBHalf(l,4*e,t,4*e);h=t,c=o.ix0;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:r,height:A,data:h,header:s.string,gamma:s.gamma,exposure:s.exposure,type:c}}setDataType(e){return this.type=e,this}load(e,t,s,r){return super.load(e,(function onLoadCallback(e,s){switch(e.type){case o.RQf:case o.ix0:e.colorSpace=o.Zr2,e.minFilter=o.k6q,e.magFilter=o.k6q,e.generateMipmaps=!1,e.flipY=!0}t&&t(e,s)}),s,r)}}const ir={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]}]},sr={topLight:{intensity:400,position:[.5,14,.5]},room:{position:[0,13.2,0],scale:[31.5,28.5,31.5]},boxes:[{position:[-10.906,-1,1.846],rotation:-.195,scale:[2.328,7.905,4.651]},{position:[-5.607,-.754,-.758],rotation:.994,scale:[1.97,1.534,3.955]},{position:[6.167,-.16,7.803],rotation:.561,scale:[3.927,6.285,3.687]},{position:[-2.017,.018,6.124],rotation:.333,scale:[2.002,4.566,2.064]},{position:[2.291,-.756,-2.621],rotation:-.286,scale:[1.546,1.552,1.496]},{position:[-2.193,-.369,-5.547],rotation:.516,scale:[3.875,3.487,2.986]}],lights:[{intensity:80,position:[-14,10,8],scale:[.1,2.5,2.5]},{intensity:80,position:[-14,14,-4],scale:[.1,2.5,2.5]},{intensity:23,position:[14,12,0],scale:[.1,5,5]},{intensity:16,position:[0,9,14],scale:[5,5,.1]},{intensity:80,position:[7,8,-14],scale:[2.5,2.5,.1]},{intensity:80,position:[-7,16,-14],scale:[2.5,2.5,.1]},{intensity:1,position:[0,20,0],scale:[.1,.1,.1]}]};class EnvironmentScene extends o.Z58{constructor(e){super(),this.position.y=-3.5;const t=new o.iNn;t.deleteAttribute("uv");const s=new o._4j({metalness:0,side:o.hsX}),r=new o._4j({metalness:0}),A="legacy"==e?ir:sr,l=new o.HiM(16777215,A.topLight.intensity,28,2);l.position.set(...A.topLight.position),this.add(l);const h=new o.eaF(t,s);h.position.set(...A.room.position),h.scale.set(...A.room.scale),this.add(h);for(const e of A.boxes){const s=new o.eaF(t,r);s.position.set(...e.position),s.rotation.set(0,e.rotation,0),s.scale.set(...e.scale),this.add(s)}for(const e of A.lights){const s=new o.eaF(t,this.createAreaLightMaterial(e.intensity));s.position.set(...e.position),s.scale.set(...e.scale),this.add(s)}}createAreaLightMaterial(e){const t=new o.V9B;return t.color.setScalar(e),t}}var nr=s(96763);const rr=20,ar=/\.hdr(\.js)?$/;class TextureUtils{constructor(e){this.threeRenderer=e,this.lottieLoaderUrl="",this.withCredentials=!1,this._ldrLoader=null,this._imageLoader=null,this._hdrLoader=null,this._lottieLoader=null,this.generatedEnvironmentMap=null,this.generatedEnvironmentMapAlt=null,this.skyboxCache=new Map,this.blurMaterial=null,this.blurScene=null}get ldrLoader(){return null==this._ldrLoader&&(this._ldrLoader=new o.Tap),this._ldrLoader.setWithCredentials(this.withCredentials),this._ldrLoader}get imageLoader(){return null==this._imageLoader&&(this._imageLoader=new HDRJPGLoader(this.threeRenderer)),this._imageLoader.setWithCredentials(this.withCredentials),this._imageLoader}get hdrLoader(){return null==this._hdrLoader&&(this._hdrLoader=new RGBELoader,this._hdrLoader.setDataType(o.ix0)),this._hdrLoader.setWithCredentials(this.withCredentials),this._hdrLoader}async getLottieLoader(){if(null==this._lottieLoader){const{LottieLoader:e}=await import(this.lottieLoaderUrl);this._lottieLoader=new e}return this._lottieLoader.setWithCredentials(this.withCredentials),this._lottieLoader}async loadImage(e){const t=await new Promise(((t,s)=>this.ldrLoader.load(e,t,(()=>{}),s)));return t.name=e,t.flipY=!1,t}async loadLottie(e,t){const s=await this.getLottieLoader();s.setQuality(t);const r=await new Promise(((t,r)=>s.load(e,t,(()=>{}),r)));return r.name=e,r}async loadEquirect(e,t=()=>{}){try{const s=ar.test(e),r=s?this.hdrLoader:this.imageLoader,A=await new Promise(((s,o)=>r.load(e,(e=>{const{renderTarget:t}=e;if(null!=t){const{texture:r}=t;e.dispose(!1),s(r)}else s(e)}),(e=>{t(e.loaded/e.total*.9)}),o)));return t(1),A.name=e,A.mapping=o.wfO,s||(A.colorSpace=o.er$),A}finally{t&&t(1)}}async generateEnvironmentMapAndSkybox(e=null,t=null,s=()=>{}){const r="legacy"!==t;"legacy"!==t&&"neutral"!==t||(t=null),t=deserializeUrl(t);let o,A=Promise.resolve(null);e&&(A=this.loadEquirectFromUrl(e,s)),o=t?this.loadEquirectFromUrl(t,s):e?this.loadEquirectFromUrl(e,s):r?this.loadGeneratedEnvironmentMapAlt():this.loadGeneratedEnvironmentMap();const[l,h]=await Promise.all([o,A]);if(null==l)throw new Error("Failed to load environment map.");return{environmentMap:l,skybox:h}}async loadEquirectFromUrl(e,t){if(!this.skyboxCache.has(e)){const s=this.loadEquirect(e,t);this.skyboxCache.set(e,s)}return this.skyboxCache.get(e)}async GenerateEnvironmentMap(e,t){await((e=0)=>new Promise((t=>setTimeout(t,e))))();const s=this.threeRenderer,r=new o.o6l(256,{generateMipmaps:!1,type:o.ix0,format:o.GWd,colorSpace:o.Zr2,depthBuffer:!0}),A=new o.F1T(.1,100,r),l=A.renderTarget.texture;l.name=t;const h=s.outputColorSpace,c=s.toneMapping;return s.toneMapping=o.y_p,s.outputColorSpace=o.Zr2,A.update(s,e),this.blurCubemap(r,.04),s.toneMapping=c,s.outputColorSpace=h,l}async loadGeneratedEnvironmentMap(){return null==this.generatedEnvironmentMap&&(this.generatedEnvironmentMap=this.GenerateEnvironmentMap(new EnvironmentScene("legacy"),"legacy")),this.generatedEnvironmentMap}async loadGeneratedEnvironmentMapAlt(){return null==this.generatedEnvironmentMapAlt&&(this.generatedEnvironmentMapAlt=this.GenerateEnvironmentMap(new EnvironmentScene("neutral"),"neutral")),this.generatedEnvironmentMapAlt}blurCubemap(e,t){if(null==this.blurMaterial){this.blurMaterial=this.getBlurShader(rr);const e=new o.iNn,t=new o.eaF(e,this.blurMaterial);this.blurScene=new o.Z58,this.blurScene.add(t)}const s=e.clone();this.halfblur(e,s,t,"latitudinal"),this.halfblur(s,e,t,"longitudinal")}halfblur(e,t,s,r){const A=e.width,l=isFinite(s)?Math.PI/(2*A):2*Math.PI/39,h=s/l,c=isFinite(s)?1+Math.floor(3*h):rr;c>rr&&nr.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${c} samples when the maximum is set to 20`);const d=[];let g=0;for(let e=0;e<rr;++e){const t=e/h,s=Math.exp(-t*t/2);d.push(s),0==e?g+=s:e<c&&(g+=2*s)}for(let e=0;e<d.length;e++)d[e]=d[e]/g;const p=this.blurMaterial.uniforms;p.envMap.value=e.texture,p.samples.value=c,p.weights.value=d,p.latitudinal.value="latitudinal"===r,p.dTheta.value=l;new o.F1T(.1,100,t).update(this.threeRenderer,this.blurScene)}getBlurShader(e){const t=new Float32Array(e),s=new o.Pq0(0,1,0);return new o.BKk({name:"SphericalGaussianBlur",defines:{n:e},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:t},latitudinal:{value:!1},dTheta:{value:0},poleAxis:{value:s}},vertexShader:"\n \n varying vec3 vOutputDirection;\n \n void main() {\n \n vOutputDirection = vec3( position );\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n \n }\n ",fragmentShader:"\n varying vec3 vOutputDirection;\n \n uniform samplerCube envMap;\n uniform int samples;\n uniform float weights[ n ];\n uniform bool latitudinal;\n uniform float dTheta;\n uniform vec3 poleAxis;\n \n vec3 getSample( float theta, vec3 axis ) {\n \n float cosTheta = cos( theta );\n // Rodrigues' axis-angle rotation\n vec3 sampleDirection = vOutputDirection * cosTheta\n + cross( axis, vOutputDirection ) * sin( theta )\n + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n \n return vec3( textureCube( envMap, sampleDirection ) );\n \n }\n \n void main() {\n \n vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n \n if ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n \n axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n \n }\n \n axis = normalize( axis );\n \n gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n \n for ( int i = 1; i < n; i++ ) {\n \n if ( i >= samples ) {\n \n break;\n \n }\n \n float theta = dTheta * float( i );\n gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n \n }\n }\n ",blending:o.XIg,depthTest:!1,depthWrite:!1,side:o.hsX})}async dispose(){for(const[,e]of this.skyboxCache){(await e).dispose()}null!=this.generatedEnvironmentMap&&((await this.generatedEnvironmentMap).dispose(),this.generatedEnvironmentMap=null),null!=this.generatedEnvironmentMapAlt&&((await this.generatedEnvironmentMapAlt).dispose(),this.generatedEnvironmentMapAlt=null),null!=this.blurMaterial&&this.blurMaterial.dispose()}}var or=s(96763);const Ar=[1,.79,.62,.5,.4,.31,.25],lr="high-performance";class Renderer extends o.Qev{constructor(e){super(),this.loader=new CachingGLTFLoader(ModelViewerGLTFInstance),this.width=0,this.height=0,this.dpr=1,this.scenes=new Set,this.multipleScenesVisible=!1,this.lastTick=performance.now(),this.renderedLastFrame=!1,this.scaleStep=0,this.lastStep=3,this.avgFrameDuration=50,this.onWebGLContextLost=e=>{this.dispatchEvent({type:"contextlost",sourceEvent:e})},this.onWebGLContextRestored=()=>{var e;null===(e=this.textureUtils)||void 0===e||e.dispose(),this.textureUtils=new TextureUtils(this.threeRenderer);for(const e of this.scenes)e.element[ke]()},this.dpr=De(),this.canvas3D=document.createElement("canvas"),this.canvas3D.id="webgl-canvas",this.canvas3D.classList.add("show"),o.vxI.tonemapping_pars_fragment=o.vxI.tonemapping_pars_fragment.replace("vec3 CustomToneMapping( vec3 color ) { return color; }","\n float startCompression = 0.8 - 0.04;\n float desaturation = 0.15;\n vec3 CustomToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n\n float x = min(color.r, min(color.g, color.b));\n float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n color -= offset;\n\n float peak = max(color.r, max(color.g, color.b));\n if (peak < startCompression) return color;\n\n float d = 1. - startCompression;\n float newPeak = 1. - d * d / (peak + d - startCompression);\n color *= newPeak / peak;\n\n float g = 1. - 1. / (desaturation * (peak - newPeak) + 1.);\n return mix(color, vec3(1, 1, 1), g);\n }");try{this.threeRenderer=new o.JeP({canvas:this.canvas3D,alpha:!0,antialias:!0,powerPreference:e.powerPreference,preserveDrawingBuffer:!0}),this.threeRenderer.autoClear=!0,this.threeRenderer.setPixelRatio(1),this.threeRenderer.debug={checkShaderErrors:!!e.debug,onShaderError:null},this.threeRenderer.toneMapping=o.FV}catch(e){or.warn(e)}this.arRenderer=new ARRenderer(this),this.textureUtils=this.canRender?new TextureUtils(this.threeRenderer):null,CachingGLTFLoader.initializeKTX2Loader(this.threeRenderer),this.canvas3D.addEventListener("webglcontextlost",this.onWebGLContextLost),this.canvas3D.addEventListener("webglcontextrestored",this.onWebGLContextRestored),this.updateRendererSize()}static get singleton(){return this._singleton}static resetSingleton(){const e=this._singleton.dispose();for(const t of e)t.disconnectedCallback();this._singleton=new Renderer({powerPreference:(self.ModelViewerElement||{}).powerPreference||lr,debug:Le()});for(const t of e)t.connectedCallback()}get canRender(){return null!=this.threeRenderer}get scaleFactor(){return Ar[this.scaleStep]}set minScale(e){let t=1;for(;t<Ar.length&&!(Ar[t]<e);)++t;this.lastStep=t-1}registerScene(e){this.scenes.add(e),e.forceRescale();const t=new o.I9Y;this.threeRenderer.getSize(t),e.canvas.width=t.x,e.canvas.height=t.y,this.canRender&&this.scenes.size>0&&this.threeRenderer.setAnimationLoop(((e,t)=>this.render(e,t)))}unregisterScene(e){this.scenes.delete(e),this.canvas3D.parentElement===e.canvas.parentElement&&e.canvas.parentElement.removeChild(this.canvas3D),this.canRender&&0===this.scenes.size&&this.threeRenderer.setAnimationLoop(null)}displayCanvas(e){return this.multipleScenesVisible?e.element[Go]:this.canvas3D}countVisibleScenes(){const{canvas3D:e}=this;let t=0,s=null;for(const r of this.scenes){const{element:o}=r;o.modelIsVisible&&null==r.externalRenderer&&++t,e.parentElement===r.canvas.parentElement&&(s=r)}const r=t>1;if(null!=s){const t=r&&!this.multipleScenesVisible,o=!s.element.modelIsVisible;if(t||o){const{width:t,height:r}=this.sceneSize(s);this.copyPixels(s,t,r),e.parentElement.removeChild(e)}}this.multipleScenesVisible=r}updateRendererSize(){var e;const t=De();if(t!==this.dpr)for(const e of this.scenes){const{element:t}=e;t[Qo](t.getBoundingClientRect())}let s=0,r=0;for(const e of this.scenes)s=Math.max(s,e.width),r=Math.max(r,e.height);if(s!==this.width||r!==this.height||t!==this.dpr){this.width=s,this.height=r,this.dpr=t,s=Math.ceil(s*t),r=Math.ceil(r*t),this.canRender&&this.threeRenderer.setSize(s,r,!1);for(const t of this.scenes){const{canvas:o}=t;o.width=s,o.height=r,t.forceRescale(),null===(e=t.effectRenderer)||void 0===e||e.setSize(s,r)}}}updateRendererScale(e){const t=this.scaleStep;this.avgFrameDuration+=clamp(.2*(e-this.avgFrameDuration),-5,5),this.avgFrameDuration>60?++this.scaleStep:this.avgFrameDuration<40&&this.scaleStep>0&&--this.scaleStep,this.scaleStep=Math.min(this.scaleStep,this.lastStep),t!==this.scaleStep&&(this.avgFrameDuration=50)}shouldRender(e){if(e.shouldRender())e.scaleStep!=this.scaleStep&&(e.scaleStep=this.scaleStep,this.rescaleCanvas(e));else{if(0==e.scaleStep)return!1;e.scaleStep=0,this.rescaleCanvas(e)}return!0}rescaleCanvas(e){const t=Ar[e.scaleStep],s=Math.ceil(this.width/t),r=Math.ceil(this.height/t),{style:o}=e.canvas;o.width=`${s}px`,o.height=`${r}px`,this.canvas3D.style.width=`${s}px`,this.canvas3D.style.height=`${r}px`;const A=this.dpr*t,l=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*Ar[this.lastStep],pixelWidth:Math.ceil(e.width*A),pixelHeight:Math.ceil(e.height*A),reason:l}}))}sceneSize(e){const{dpr:t}=this,s=Ar[e.scaleStep];return{width:Math.min(Math.ceil(e.width*s*t),this.canvas3D.width),height:Math.min(Math.ceil(e.height*s*t),this.canvas3D.height)}}copyPixels(e,t,s){const r=e.context;null!=r?(r.clearRect(0,0,t,s),r.drawImage(this.canvas3D,0,0,t,s,0,0,t,s),e.canvas.classList.add("show")):or.log("could not acquire 2d context")}orderedScenes(){const e=[];for(const t of[!1,!0])for(const s of this.scenes)s.element.modelIsVisible===t&&e.push(s);return e}get isPresenting(){return this.arRenderer.isPresenting}preRender(e,t,s){const{element:r,exposure:A,toneMapping:l}=e;r[Oo](t,s);const h="number"==typeof A&&!Number.isNaN(A),c=r.environmentImage,d=r.skyboxImage,g=l===o.g7M&&("neutral"===c||"legacy"===c||!c&&!d);this.threeRenderer.toneMappingExposure=(h?A:1)*(g?1.3:1)}render(e,t){if(null!=t)return void this.arRenderer.onWebXRFrame(e,t);const s=e-this.lastTick;if(this.lastTick=e,!this.canRender||this.isPresenting)return;this.countVisibleScenes(),this.updateRendererSize(),this.renderedLastFrame&&(this.updateRendererScale(s),this.renderedLastFrame=!1);const{canvas3D:r}=this;for(const t of this.orderedScenes()){const{element:o}=t;if(!o.loaded||!o.modelIsVisible&&t.renderCount>0)continue;if(this.preRender(t,e,s),!this.shouldRender(t))continue;if(null!=t.externalRenderer){const e=t.getCamera();e.updateMatrix();const{matrix:s,projectionMatrix:r}=e,o=s.elements.slice(),A=t.getTarget();o[12]+=A.x,o[13]+=A.y,o[14]+=A.z,t.externalRenderer.render({viewMatrix:o,projectionMatrix:r.elements});continue}if(!o.modelIsVisible&&!this.multipleScenesVisible)for(const e of this.scenes)e.element.modelIsVisible&&e.queueRender();const{width:A,height:l}=this.sceneSize(t);t.renderShadow(this.threeRenderer),this.threeRenderer.setRenderTarget(null),this.threeRenderer.setViewport(0,Math.ceil(this.height*this.dpr)-l,A,l),null!=t.effectRenderer?t.effectRenderer.render(s):(this.threeRenderer.autoClear=!0,this.threeRenderer.toneMapping=t.toneMapping,this.threeRenderer.render(t,t.camera)),this.multipleScenesVisible||!t.element.modelIsVisible&&0===t.renderCount?this.copyPixels(t,A,l):r.parentElement!==t.canvas.parentElement&&(t.canvas.parentElement.appendChild(r),t.canvas.classList.remove("show")),t.hasRendered(),++t.renderCount,this.renderedLastFrame=!0}}dispose(){null!=this.textureUtils&&this.textureUtils.dispose(),null!=this.threeRenderer&&this.threeRenderer.dispose(),this.textureUtils=null,this.threeRenderer=null;const e=[];for(const t of this.scenes)e.push(t.element);return this.canvas3D.removeEventListener("webglcontextlost",this.onWebGLContextLost),this.canvas3D.removeEventListener("webglcontextrestored",this.onWebGLContextRestored),e}}Renderer._singleton=new Renderer({powerPreference:(self.ModelViewerElement||{}).powerPreference||lr,debug:Le()});const hr=Symbol("correlatedObjects"),cr=Symbol("onUpdate");class ThreeDOMElement{constructor(e,t=null){this[cr]=e,this[hr]=t}}const ur=new o.V9B,dr=new o.bdM(2,2);let gr=0;const pr=Symbol("threeTexture"),mr=Symbol("threeTextures");Symbol("applyTexture");class image_Image extends ThreeDOMElement{get[pr](){var e;return null===(e=this[hr])||void 0===e?void 0:e.values().next().value}get[mr](){return this[hr]}constructor(e,t){super(e,new Set(t?[t]:[])),this[pr].image.src||(this[pr].image.src=t.name?t.name:"adhoc_image"+gr++),this[pr].image.name||(this[pr].image.name=t&&t.image&&t.image.src?t.image.src.split("/").pop():"adhoc_image")}get name(){return this[pr].image.name||""}get uri(){return this[pr].image.src}get bufferView(){return this[pr].image.bufferView}get element(){const e=this[pr];if(e&&(e.isCanvasTexture||e.isVideoTexture))return e.image}get animation(){const e=this[pr];if(e&&e.isCanvasTexture&&e.animation)return e.animation}get type(){return null!=this.uri?"external":"embedded"}set name(e){for(const t of this[mr])t.image.name=e}update(){const e=this[pr];e&&e.isCanvasTexture&&!e.animation&&(this[pr].needsUpdate=!0,this[cr]())}async createThumbnail(e,t){const s=new o.Z58;ur.map=this[pr];const r=new o.eaF(dr,ur);s.add(r);const A=new o.qUd(-1,1,1,-1,0,1),{threeRenderer:l}=Renderer.singleton,h=new o.nWS(e,t);l.setRenderTarget(h),l.render(s,A),l.setRenderTarget(null);const c=new Uint8Array(e*t*4);l.readRenderTargetPixels(h,0,0,e,t,c),po.width=e,po.height=t;const d=po.getContext("2d"),g=d.createImageData(e,t);return g.data.set(c),d.putImageData(g,0,0),new Promise((async(e,t)=>{po.toBlob((s=>{if(!s)return t("Failed to capture thumbnail.");e(URL.createObjectURL(s))}),"image/png")}))}}var fr,Ir;!function(e){e[e.Nearest=9728]="Nearest",e[e.Linear=9729]="Linear",e[e.NearestMipmapNearest=9984]="NearestMipmapNearest",e[e.LinearMipmapNearest=9985]="LinearMipmapNearest",e[e.NearestMipmapLinear=9986]="NearestMipmapLinear",e[e.LinearMipmapLinear=9987]="LinearMipmapLinear"}(fr||(fr={})),function(e){e[e.ClampToEdge=33071]="ClampToEdge",e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.Repeat=10497]="Repeat"}(Ir||(Ir={}));const Er=new Map([[Ir.Repeat,o.GJx],[Ir.ClampToEdge,o.ghU],[Ir.MirroredRepeat,o.kTW]]),Cr=new Map([[o.GJx,Ir.Repeat],[o.ghU,Ir.ClampToEdge],[o.kTW,Ir.MirroredRepeat]]),Br=new Map([[fr.Nearest,o.hxR],[fr.Linear,o.k6q],[fr.NearestMipmapNearest,o.pHI],[fr.LinearMipmapNearest,o.kRr],[fr.NearestMipmapLinear,o.Cfg],[fr.LinearMipmapLinear,o.$_I]]),yr=new Map([[o.hxR,fr.Nearest],[o.k6q,fr.Linear],[o.pHI,fr.NearestMipmapNearest],[o.kRr,fr.LinearMipmapNearest],[o.Cfg,fr.NearestMipmapLinear],[o.$_I,fr.LinearMipmapLinear]]),wr=new Map([[fr.Nearest,o.hxR],[fr.Linear,o.k6q]]),vr=new Map([[o.hxR,fr.Nearest],[o.k6q,fr.Linear]]),isMinFilter=e=>yr.has(e),isMagFilter=e=>vr.has(e),isWrapping=e=>Cr.has(e),Qr=Symbol("threeTexture"),xr=Symbol("threeTextures"),br=Symbol("setProperty");class Sampler extends ThreeDOMElement{get[Qr](){var e;return null===(e=this[hr])||void 0===e?void 0:e.values().next().value}get[xr](){return this[hr]}constructor(e,t){super(e,new Set(t?[t]:[]))}get name(){return this[Qr].name||""}get minFilter(){return yr.get(this[Qr].minFilter)}get magFilter(){return vr.get(this[Qr].magFilter)}get wrapS(){return Cr.get(this[Qr].wrapS)}get wrapT(){return Cr.get(this[Qr].wrapT)}get rotation(){return this[Qr].rotation}get scale(){return toVector2D(this[Qr].repeat)}get offset(){return toVector2D(this[Qr].offset)}setMinFilter(e){this[br]("minFilter",Br.get(e))}setMagFilter(e){this[br]("magFilter",wr.get(e))}setWrapS(e){this[br]("wrapS",Er.get(e))}setWrapT(e){this[br]("wrapT",Er.get(e))}setRotation(e){null==e&&(e=0),this[br]("rotation",e)}setScale(e){null==e&&(e={u:1,v:1}),this[br]("repeat",new o.I9Y(e.u,e.v))}setOffset(e){null==e&&(e={u:0,v:0}),this[br]("offset",new o.I9Y(e.u,e.v))}[br](e,t){if(((e,t)=>{switch(e){case"minFilter":return isMinFilter(t);case"magFilter":return isMagFilter(t);case"wrapS":case"wrapT":return isWrapping(t);case"rotation":case"repeat":case"offset":return!0;default:throw new Error(`Cannot configure property "${e}" on Sampler`)}})(e,t))for(const s of this[xr])s[e]=t,s.needsUpdate=!0;this[cr]()}}const Sr=Symbol("image"),Mr=Symbol("sampler"),Tr=Symbol("threeTexture");class Texture extends ThreeDOMElement{constructor(e,t){super(e,new Set(t?[t]:[])),this[Mr]=new Sampler(e,t),this[Sr]=new image_Image(e,t)}get[Tr](){var e;return null===(e=this[hr])||void 0===e?void 0:e.values().next().value}get name(){return this[Tr].name||""}set name(e){for(const t of this[hr])t.name=e}get sampler(){return this[Mr]}get source(){return this[Sr]}}var Rr,Dr,Lr;const Fr=Symbol("texture"),_r=Symbol("transform"),kr=Symbol("materials"),Ur=Symbol("usage"),Gr=Symbol("onUpdate"),Pr=Symbol("activeVideo");var Nr;!function(e){e[e.Base=0]="Base",e[e.MetallicRoughness=1]="MetallicRoughness",e[e.Normal=2]="Normal",e[e.Occlusion=3]="Occlusion",e[e.Emissive=4]="Emissive",e[e.Clearcoat=5]="Clearcoat",e[e.ClearcoatRoughness=6]="ClearcoatRoughness",e[e.ClearcoatNormal=7]="ClearcoatNormal",e[e.SheenColor=8]="SheenColor",e[e.SheenRoughness=9]="SheenRoughness",e[e.Transmission=10]="Transmission",e[e.Thickness=11]="Thickness",e[e.Specular=12]="Specular",e[e.SpecularColor=13]="SpecularColor",e[e.Iridescence=14]="Iridescence",e[e.IridescenceThickness=15]="IridescenceThickness",e[e.Anisotropy=16]="Anisotropy"}(Nr||(Nr={}));class TextureInfo{constructor(e,t,s,r){this[Rr]=null,this[Dr]={rotation:0,scale:new o.I9Y(1,1),offset:new o.I9Y(0,0)},this[Lr]=!1,s&&(this[_r].rotation=s.rotation,this[_r].scale.copy(s.repeat),this[_r].offset.copy(s.offset),this[Fr]=new Texture(e,s)),this[Gr]=e,this[kr]=r,this[Ur]=t}get texture(){return this[Fr]}setTexture(e){var t,s;const r=null!=e?e.source[pr]:null,A=null===(t=this[Fr])||void 0===t?void 0:t.source[pr];if(null!=A&&A.isVideoTexture?this[Pr]=!1:(null===(s=this[Fr])||void 0===s?void 0:s.source.animation)&&this[Fr].source.animation.removeEventListener("enterFrame",this[Gr]),this[Fr]=e,null!=r&&r.isVideoTexture){const e=r.image;if(this[Pr]=!0,null!=e.requestVideoFrameCallback){const update=()=>{this[Pr]&&(this[Gr](),e.requestVideoFrameCallback(update))};e.requestVideoFrameCallback(update)}else{const update=()=>{this[Pr]&&(this[Gr](),requestAnimationFrame(update))};requestAnimationFrame(update)}}else null!=(null==e?void 0:e.source.animation)&&e.source.animation.addEventListener("enterFrame",this[Gr]);let l=o.er$;if(this[kr])for(const e of this[kr]){switch(this[Ur]){case Nr.Base:e.map=r;break;case Nr.MetallicRoughness:l=o.Zr2,e.metalnessMap=r,e.roughnessMap=r;break;case Nr.Normal:l=o.Zr2,e.normalMap=r;break;case Nr.Occlusion:l=o.Zr2,e.aoMap=r;break;case Nr.Emissive:e.emissiveMap=r;break;case Nr.Clearcoat:e.clearcoatMap=r;break;case Nr.ClearcoatRoughness:e.clearcoatRoughnessMap=r;break;case Nr.ClearcoatNormal:e.clearcoatNormalMap=r;break;case Nr.SheenColor:e.sheenColorMap=r;break;case Nr.SheenRoughness:e.sheenRoughnessMap=r;break;case Nr.Transmission:e.transmissionMap=r;break;case Nr.Thickness:e.thicknessMap=r;break;case Nr.Specular:e.specularIntensityMap=r;break;case Nr.SpecularColor:e.specularColorMap=r;break;case Nr.Iridescence:e.iridescenceMap=r;break;case Nr.IridescenceThickness:e.iridescenceThicknessMap=r;break;case Nr.Anisotropy:e.anisotropyMap=r}e.needsUpdate=!0}r&&(r.colorSpace=l,r.rotation=this[_r].rotation,r.repeat=this[_r].scale,r.offset=this[_r].offset),this[Gr]()}}Rr=Fr,Dr=_r,Lr=Pr;const Or=Symbol("threeMaterial"),Hr=Symbol("threeMaterials"),qr=Symbol("baseColorTexture"),Vr=Symbol("metallicRoughnessTexture");class PBRMetallicRoughness extends ThreeDOMElement{constructor(e,t){super(e,t);const{map:s,metalnessMap:r}=t.values().next().value;this[qr]=new TextureInfo(e,Nr.Base,s,t),this[Vr]=new TextureInfo(e,Nr.MetallicRoughness,r,t)}get[Hr](){return this[hr]}get[Or](){var e;return null===(e=this[hr])||void 0===e?void 0:e.values().next().value}get baseColorFactor(){const e=[0,0,0,this[Or].opacity];return this[Or].color.toArray(e),e}get metallicFactor(){return this[Or].metalness}get roughnessFactor(){return this[Or].roughness}get baseColorTexture(){return this[qr]}get metallicRoughnessTexture(){return this[Vr]}setBaseColorFactor(e){const t=new o.Q1f;e instanceof Array?t.fromArray(e):t.set(e);for(const s of this[Hr])s.color.set(t),e instanceof Array?s.opacity=e[3]:(e=[0,0,0,s.opacity],t.toArray(e));this[cr]()}setMetallicFactor(e){for(const t of this[Hr])t.metalness=e;this[cr]()}setRoughnessFactor(e){for(const t of this[Hr])t.roughness=e;this[cr]()}}var $r,Jr;const Kr=Symbol("pbrMetallicRoughness"),Yr=Symbol("normalTexture"),zr=Symbol("occlusionTexture"),jr=Symbol("emissiveTexture"),Wr=Symbol("backingThreeMaterial"),Xr=Symbol("applyAlphaCutoff"),Zr=Symbol("getAlphaMode"),ea=Symbol("lazyLoadGLTFInfo"),ta=Symbol("initialize"),ia=Symbol("getLoadedMaterial"),sa=Symbol("ensureMaterialIsLoaded"),na=Symbol("gltfIndex"),ra=Symbol("setActive"),aa=Symbol("variantIndices"),oa=Symbol("isActive"),Aa=Symbol("variantSet"),la=Symbol("modelVariants"),ha=Symbol("name"),ca=Symbol("pbrTextures");class Material extends ThreeDOMElement{constructor(e,t,s,r,o,A,l=void 0){super(e,o),this[$r]=new Set,this[Jr]=new Map,this[na]=t,this[oa]=s,this[la]=r,this[ha]=A,null==l?this[ta]():this[ea]=l}get[($r=Aa,Jr=ca,Wr)](){return this[hr].values().next().value}[ta](){const e=this[cr],t=this[hr];this[Kr]=new PBRMetallicRoughness(e,t);const{normalMap:s,aoMap:r,emissiveMap:o}=t.values().next().value;this[Yr]=new TextureInfo(e,Nr.Normal,s,t),this[zr]=new TextureInfo(e,Nr.Occlusion,r,t),this[jr]=new TextureInfo(e,Nr.Emissive,o,t);const createTextureInfo=s=>{this[ca].set(s,new TextureInfo(e,s,null,t))};createTextureInfo(Nr.Clearcoat),createTextureInfo(Nr.ClearcoatRoughness),createTextureInfo(Nr.ClearcoatNormal),createTextureInfo(Nr.SheenColor),createTextureInfo(Nr.SheenRoughness),createTextureInfo(Nr.Transmission),createTextureInfo(Nr.Thickness),createTextureInfo(Nr.Specular),createTextureInfo(Nr.SpecularColor),createTextureInfo(Nr.Iridescence),createTextureInfo(Nr.IridescenceThickness),createTextureInfo(Nr.Anisotropy)}async[ia](){if(null!=this[ea]){const{set:e,material:t}=await this[ea].doLazyLoad();return this[hr]=e,this[ta](),this[ea]=void 0,this.ensureLoaded=async()=>{},t}return this[hr].values().next().value}colorFromRgb(e){const t=new o.Q1f;return e instanceof Array?t.fromArray(e):t.set(e),t}[sa](){if(null!=this[ea])throw new Error(`Material "${this.name}" has not been loaded, call 'await\n myMaterial.ensureLoaded()' before using an unloaded material.`)}async ensureLoaded(){await this[ia]()}get isLoaded(){return null==this[ea]}get isActive(){return this[oa]}[ra](e){this[oa]=e}get name(){return this[ha]||""}set name(e){if(this[ha]=e,null!=this[hr])for(const t of this[hr])t.name=e}get pbrMetallicRoughness(){return this[sa](),this[Kr]}get normalTexture(){return this[sa](),this[Yr]}get occlusionTexture(){return this[sa](),this[zr]}get emissiveTexture(){return this[sa](),this[jr]}get emissiveFactor(){return this[sa](),this[Wr].emissive.toArray()}get index(){return this[na]}[aa](){return this[Aa]}hasVariant(e){const t=this[la].get(e);return null!=t&&this[Aa].has(t.index)}setEmissiveFactor(e){this[sa]();const t=this.colorFromRgb(e);for(const e of this[hr])e.emissive.set(t);this[cr]()}[Zr](){return this[Wr].transparent?"BLEND":this[Wr].alphaTest>0?"MASK":"OPAQUE"}[Xr](){this[sa]();for(const e of this[hr])"MASK"===this[Zr]()?null==e.alphaTest&&(e.alphaTest=.5):e.alphaTest=void 0,e.needsUpdate=!0}setAlphaCutoff(e){this[sa]();for(const t of this[hr])t.alphaTest=e,t.needsUpdate=!0;this[Xr](),this[cr]()}getAlphaCutoff(){return this[sa](),this[Wr].alphaTest}setDoubleSided(e){this[sa]();for(const t of this[hr])t.side=e?o.$EB:o.hB5,t.needsUpdate=!0;this[cr]()}getDoubleSided(){return this[sa](),this[Wr].side==o.$EB}setAlphaMode(e){this[sa]();const enableTransparency=(e,t)=>{e.transparent=t,e.depthWrite=!t};for(const t of this[hr])enableTransparency(t,"BLEND"===e),t.alphaTest="MASK"===e?.5:void 0,t.needsUpdate=!0;this[cr]()}getAlphaMode(){return this[sa](),this[Zr]()}get emissiveStrength(){return this[sa](),this[Wr].emissiveIntensity}setEmissiveStrength(e){this[sa]();for(const t of this[hr])t.emissiveIntensity=e;this[cr]()}get clearcoatFactor(){return this[sa](),this[Wr].clearcoat}get clearcoatRoughnessFactor(){return this[sa](),this[Wr].clearcoatRoughness}get clearcoatTexture(){return this[sa](),this[ca].get(Nr.Clearcoat)}get clearcoatRoughnessTexture(){return this[sa](),this[ca].get(Nr.ClearcoatRoughness)}get clearcoatNormalTexture(){return this[sa](),this[ca].get(Nr.ClearcoatNormal)}get clearcoatNormalScale(){return this[sa](),this[Wr].clearcoatNormalScale.x}setClearcoatFactor(e){this[sa]();for(const t of this[hr])t.clearcoat=e;this[cr]()}setClearcoatRoughnessFactor(e){this[sa]();for(const t of this[hr])t.clearcoatRoughness=e;this[cr]()}setClearcoatNormalScale(e){this[sa]();for(const t of this[hr])t.clearcoatNormalScale=new o.I9Y(e,e);this[cr]()}get ior(){return this[sa](),this[Wr].ior}setIor(e){this[sa]();for(const t of this[hr])t.ior=e;this[cr]()}get sheenColorFactor(){return this[sa](),this[Wr].sheenColor.toArray()}get sheenColorTexture(){return this[sa](),this[ca].get(Nr.SheenColor)}get sheenRoughnessFactor(){return this[sa](),this[Wr].sheenRoughness}get sheenRoughnessTexture(){return this[sa](),this[ca].get(Nr.SheenRoughness)}setSheenColorFactor(e){this[sa]();const t=this.colorFromRgb(e);for(const e of this[hr])e.sheenColor.set(t),e.sheen=1;this[cr]()}setSheenRoughnessFactor(e){this[sa]();for(const t of this[hr])t.sheenRoughness=e,t.sheen=1;this[cr]()}get transmissionFactor(){return this[sa](),this[Wr].transmission}get transmissionTexture(){return this[sa](),this[ca].get(Nr.Transmission)}setTransmissionFactor(e){this[sa]();for(const t of this[hr])t.transmission=e;this[cr]()}get thicknessFactor(){return this[sa](),this[Wr].thickness}get thicknessTexture(){return this[sa](),this[ca].get(Nr.Thickness)}get attenuationDistance(){return this[sa](),this[Wr].attenuationDistance}get attenuationColor(){return this[sa](),this[Wr].attenuationColor.toArray()}setThicknessFactor(e){this[sa]();for(const t of this[hr])t.thickness=e;this[cr]()}setAttenuationDistance(e){this[sa]();for(const t of this[hr])t.attenuationDistance=e;this[cr]()}setAttenuationColor(e){this[sa]();const t=this.colorFromRgb(e);for(const e of this[hr])e.attenuationColor.set(t);this[cr]()}get specularFactor(){return this[sa](),this[Wr].specularIntensity}get specularTexture(){return this[sa](),this[ca].get(Nr.Specular)}get specularColorFactor(){return this[sa](),this[Wr].specularColor.toArray()}get specularColorTexture(){return this[sa](),this[ca].get(Nr.SheenColor)}setSpecularFactor(e){this[sa]();for(const t of this[hr])t.specularIntensity=e;this[cr]()}setSpecularColorFactor(e){this[sa]();const t=this.colorFromRgb(e);for(const e of this[hr])e.specularColor.set(t);this[cr]()}get iridescenceFactor(){return this[sa](),this[Wr].iridescence}get iridescenceTexture(){return this[sa](),this[ca].get(Nr.Iridescence)}get iridescenceIor(){return this[sa](),this[Wr].iridescenceIOR}get iridescenceThicknessMinimum(){return this[sa](),this[Wr].iridescenceThicknessRange[0]}get iridescenceThicknessMaximum(){return this[sa](),this[Wr].iridescenceThicknessRange[1]}get iridescenceThicknessTexture(){return this[sa](),this[ca].get(Nr.IridescenceThickness)}setIridescenceFactor(e){this[sa]();for(const t of this[hr])t.iridescence=e;this[cr]()}setIridescenceIor(e){this[sa]();for(const t of this[hr])t.iridescenceIOR=e;this[cr]()}setIridescenceThicknessMinimum(e){this[sa]();for(const t of this[hr])t.iridescenceThicknessRange[0]=e;this[cr]()}setIridescenceThicknessMaximum(e){this[sa]();for(const t of this[hr])t.iridescenceThicknessRange[1]=e;this[cr]()}get anisotropyStrength(){return this[sa](),this[Wr].anisotropy}get anisotropyRotation(){return this[sa](),this[Wr].anisotropyRotation}get anisotropyTexture(){return this[sa](),this[ca].get(Nr.Anisotropy)}setAnisotropyStrength(e){this[sa]();for(const t of this[hr])t.anisotropy=e;this[cr]()}setAnisotropyRotation(e){this[sa]();for(const t of this[hr])t.anisotropyRotation=e;this[cr]()}}var ua=s(96763);class primitive_node_Node{constructor(e){this.name="",this.children=new Array,this.name=e}}class PrimitiveNode extends primitive_node_Node{constructor(e,t,s,r){super(e.name),this.materials=new Map,this.variantToMaterialMap=new Map,this.initialMaterialIdx=0,this.activeMaterialIdx=0,this.mesh=e;const{gltf:o,threeGLTF:A,threeObjectMap:l}=r;this.parser=A.parser,this.modelVariants=s,this.mesh.userData.variantData=s;const h=l.get(e.material);null!=h.materials?this.initialMaterialIdx=this.activeMaterialIdx=h.materials:ua.error(`Primitive (${e.name}) missing initial material reference.`);const c=e.userData.associations||{};if(null==c.meshes)return void ua.error("Mesh is missing primitive index association");const d=((o.meshes||[])[c.meshes].primitives||[])[c.primitives];if(null!=d){if(null!=d.material)this.materials.set(d.material,t[d.material]);else{const e=t.findIndex((e=>"Default"===e.name));e>=0?this.materials.set(e,t[e]):ua.warn("gltfPrimitive has no material!")}if(d.extensions&&d.extensions.KHR_materials_variants){const e=d.extensions.KHR_materials_variants,r=A.parser.json.extensions.KHR_materials_variants.variants;for(const o of e.mappings){const e=t[o.material];this.materials.set(o.material,e);for(const t of o.variants){const{name:o}=r[t];this.variantToMaterialMap.set(t,e),e[aa]().add(t),s.has(o)||s.set(o,{name:o,index:t})}}}}else ua.error("Mesh primitive definition is missing.")}async setActiveMaterial(e){const t=this.materials.get(e);if(null!=t&&e!==this.activeMaterialIdx){this.mesh.material=await t[ia]();const{normalScale:s}=this.mesh.material;null!=s&&s.y*s.x<0!=(null==this.mesh.geometry.attributes.tangent)&&this.parser.assignFinalMaterial(this.mesh),this.activeMaterialIdx=e}return this.mesh.material}getActiveMaterial(){return this.materials.get(this.activeMaterialIdx)}getMaterial(e){return this.materials.get(e)}async enableVariant(e){if(null==e)return this.setActiveMaterial(this.initialMaterialIdx);if(null!=this.variantToMaterialMap&&this.modelVariants.has(e)){const t=this.modelVariants.get(e);return this.enableVariantHelper(t.index)}return null}async enableVariantHelper(e){if(null!=this.variantToMaterialMap&&null!=e){const t=this.variantToMaterialMap.get(e);if(null!=t)return this.setActiveMaterial(t.index)}return null}async instantiateVariants(){if(null!=this.variantToMaterialMap)for(const e of this.variantToMaterialMap.keys()){const t=this.mesh.userData.variantMaterials.get(e);if(null!=t.material)continue;const s=await this.enableVariantHelper(e);null!=s&&(t.material=s)}}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 s=this.modelVariants.get(t).index;return e[aa]().add(s),this.variantToMaterialMap.set(s,e),this.materials.set(e.index,e),this.updateVariantUserData(s,e),!0}deleteVariant(e){if(this.variantInfo.has(e)){this.variantInfo.delete(e);const t=this.mesh.userData.variantMaterials;null!=t&&t.delete(e)}}updateVariantUserData(e,t){t[aa]().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[hr].values().next().value,gltfMaterialIndex:t.index})}ensureVariantIsUnused(e){const t=this.modelVariants.get(e);return null==t||!this.variantInfo.has(t.index)||(ua.warn(`Primitive cannot add variant '${e}' for this material, it already exists.`),!1)}}var da,ga,pa,ma,fa,Ia,Ea=s(96763);const Ca=Symbol("materials"),Ba=Symbol("hierarchy"),ya=Symbol("roots"),wa=Symbol("primitives"),va=(Symbol("loadVariant"),Symbol("prepareVariantsForExport")),Qa=Symbol("switchVariant"),xa=Symbol("materialFromPoint"),ba=Symbol("nodeFromPoint"),Sa=Symbol("nodeFromIndex"),Ma=Symbol("variantData"),Ta=Symbol("availableVariants"),Ra=Symbol("modelOnUpdate"),Da=Symbol("cloneMaterial");class LazyLoader{constructor(e,t,s,r){this.gltf=e,this.gltfElementMap=t,this.mapKey=s,this.doLazyLoad=r}}class Model{constructor(e,t=()=>{}){this[da]=new Array,this[ga]=new Array,this[pa]=new Array,this[ma]=new Array,this[fa]=()=>{},this[Ia]=new Map,this[Ra]=t;const{gltf:s,threeGLTF:r,gltfElementMap:A}=e;for(const[e,o]of s.materials.entries()){const l=A.get(o);if(null!=l)this[Ca].push(new Material(t,e,!0,this[Ma],l,o.name));else{const h=(s.materials||[])[e],c=e,materialLoadCallback=async()=>{const e=await r.parser.getDependency("material",c),t=new Set;return A.set(h,t),t.add(e),{set:t,material:e}};this[Ca].push(new Material(t,e,!1,this[Ma],l,o.name,new LazyLoader(s,A,h,materialLoadCallback)))}}const l=new Map,h=new Array;for(const e of r.scene.children)h.push(e);for(;h.length>0;){const t=h.pop();let s=null;t instanceof o.eaF?(s=new PrimitiveNode(t,this.materials,this[Ma],e),this[wa].push(s)):s=new primitive_node_Node(t.name);const r=l.get(t);null!=r?r.children.push(s):this[ya].push(s),this[Ba].push(s);for(const e of t.children)h.push(e),l.set(t,s)}}get materials(){return this[Ca]}[(da=Ca,ga=Ba,pa=ya,ma=wa,fa=Ra,Ia=Ma,Ta)](){const e=Array.from(this[Ma].values());return e.sort(((e,t)=>e.index-t.index)),e.map((e=>e.name))}getMaterialByName(e){const t=this[Ca].filter((t=>t.name===e));return t.length>0?t[0]:null}[Sa](e,t){const s=this[Ba].find((s=>{if(s instanceof PrimitiveNode){const{meshes:r,primitives:o}=s.mesh.userData.associations;if(r==e&&o==t)return!0}return!1}));return null==s?null:s}[ba](e){return this[Ba].find((t=>{if(t instanceof PrimitiveNode){if(t.mesh===e.object)return!0}return!1}))}[xa](e){return this[ba](e).getActiveMaterial()}async[Qa](e){for(const t of this[wa])await t.enableVariant(e);for(const e of this.materials)e[ra](!1);for(const e of this[wa])this.materials[e.getActiveMaterial().index][ra](!0)}async[va](){const e=new Array;for(const t of this[wa])e.push(t.instantiateVariants());await Promise.all(e)}[Da](e,t){const s=this.materials[e];s.isLoaded||Ea.error("Cloning an unloaded material,\n call 'material.ensureLoaded() before cloning the material.");const r=s[hr],o=new Set;for(const[e,s]of r.entries()){const A=s.clone();A.name=t+(r.size>1?"_inst"+e:""),o.add(A)}const A=new Material(this[Ra],this[Ca].length,!1,this[Ma],o,t);return this[Ca].push(A),A}createMaterialInstanceForVariant(e,t,s,r=!0){let o=null;for(const r of this[wa]){const A=this[Ma].get(s);null!=A&&r.variantInfo.has(A.index)||null!=r.getMaterial(e)&&(this.hasVariant(s)||this.createVariant(s),null==o&&(o=this[Da](e,t)),r.addVariant(o,s))}if(r&&null!=o){o[ra](!0),this.materials[e][ra](!1);for(const e of this[wa])e.enableVariant(s)}return o}createVariant(e){this[Ma].has(e)?Ea.warn(`Variant '${e}'' already exists`):this[Ma].set(e,{name:e,index:this[Ma].size})}hasVariant(e){return this[Ma].has(e)}setMaterialToVariant(e,t){if(null!=this[Ta]().find((e=>e===t)))if(e<0||e>=this.materials.length)Ea.error("setMaterialToVariant(): materialIndex is out of bounds.");else for(const s of this[wa]){const r=s.getMaterial(e);null!=r&&s.addVariant(r,t)}else Ea.warn(`Can't add material to '${t}', the variant does not exist.'`)}updateVariantName(e,t){const s=this[Ma].get(e);null!=s&&(s.name=t,this[Ma].set(t,s),this[Ma].delete(e))}deleteVariant(e){const t=this[Ma].get(e);if(null!=t){for(const s of this.materials)s.hasVariant(e)&&s[Aa].delete(t.index);for(const e of this[wa])e.deleteVariant(t.index);this[Ma].delete(e)}}}var scene_graph_decorate=function(e,t,s,r){var o,A=arguments.length,l=A<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,s,r);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(l=(A<3?o(l):A>3?o(t,s,l):o(t,s))||l);return A>3&&l&&Object.defineProperty(t,s,l),l};const La=Symbol("currentGLTF"),Fa=Symbol("originalGltfJson"),_a=Symbol("model"),ka=Symbol("getOnUpdateMethod"),Ua=Symbol("buildTexture");class GroundedSkybox extends o.eaF{constructor(){super(void 0,new o.V9B({depthWrite:!1})),this.height=0,this.radius=0,this.resolution=0,this.userData.noHit=!0}get map(){return this.material.map}set map(e){this.material.map=e}isUsable(){return this.height>0&&this.radius>0&&null!=this.geometry&&null!=this.map}updateGeometry(e=this.height,t=this.radius,s=128){e==this.height&&t==this.radius&&s==this.resolution||(this.height=e,this.radius=t,this.resolution=s,e>0&&t>0&&(this.geometry.dispose(),this.geometry=function makeGeometry(e,t,s){const r=new o.Gu$(t,2*s,s);r.scale(1,1,-1);const A=r.getAttribute("position"),l=new o.Pq0;for(let t=0;t<A.count;++t)if(l.fromBufferAttribute(A,t),l.y<0){const s=3*-e/2,r=l.y<s?-e/l.y:1-l.y*l.y/(3*s*s);l.multiplyScalar(r),l.toArray(A.array,3*t)}return A.needsUpdate=!0,r}(e,t,s)))}}const Ga=new o.Pq0,Pa=new o.Pq0,Na=new o.Pq0,Oa=new o.dwI,Ha=new o.lMl,qa=new o.PTz;class Hotspot extends CSS2DObject{constructor(e){super(document.createElement("div")),this.normal=new o.Pq0(0,1,0),this.initialized=!1,this.referenceCount=1,this.pivot=document.createElement("div"),this.slot=document.createElement("slot"),this.element.classList.add("annotation-wrapper"),this.slot.name=e.name,this.element.appendChild(this.pivot),this.pivot.appendChild(this.slot),this.updatePosition(e.position),this.updateNormal(e.normal),this.surface=e.surface}get facingCamera(){return!this.element.classList.contains("hide")}show(){this.facingCamera&&this.initialized||this.updateVisibility(!0)}hide(){!this.facingCamera&&this.initialized||this.updateVisibility(!1)}increment(){this.referenceCount++}decrement(){return this.referenceCount>0&&--this.referenceCount,0===this.referenceCount}updatePosition(e){if(null==e)return;const t=Wi(e)[0].terms;for(let e=0;e<3;++e)this.position.setComponent(e,ns(t[e]).number);this.updateMatrixWorld()}updateNormal(e){if(null==e)return;const t=Wi(e)[0].terms;for(let e=0;e<3;++e)this.normal.setComponent(e,t[e].number)}updateSurface(e){if(!e&&this.initialized)return;const{mesh:t,tri:s,bary:r}=this;if(null==t||null==s||null==r)return;t.getVertexPosition(s.x,Ga),t.getVertexPosition(s.y,Pa),t.getVertexPosition(s.z,Na),Ga.toArray(Oa.elements,0),Pa.toArray(Oa.elements,3),Na.toArray(Oa.elements,6),this.position.copy(r).applyMatrix3(Oa);const o=this.parent;o.worldToLocal(t.localToWorld(this.position)),Ha.set(Ga,Pa,Na),Ha.getNormal(this.normal).transformDirection(t.matrixWorld);const A=o.parent;qa.setFromAxisAngle(Ga.set(0,1,0),-A.yaw),this.normal.applyQuaternion(qa)}orient(e){this.pivot.style.transform=`rotate(${e}rad)`}updateVisibility(e){this.element.classList.toggle("hide",!e),this.slot.assignedNodes().forEach((t=>{if(t.nodeType!==Node.ELEMENT_NODE)return;const s=t,r=s.dataset.visibilityAttribute;if(null!=r){const t=`data-${r}`;s.toggleAttribute(t,e)}s.dispatchEvent(new CustomEvent("hotspot-visibility",{detail:{visible:e}}))})),this.initialized=!0}}const Va={name:"HorizontalBlurShader",uniforms:{tDiffuse:{value:null},h:{value:1/512}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float h;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 sum = vec4( 0.0 );\n\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;\n\n\t\t\tgl_FragColor = sum;\n\n\t\t}"},$a={name:"VerticalBlurShader",uniforms:{tDiffuse:{value:null},v:{value:1/512}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float v;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 sum = vec4( 0.0 );\n\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;\n\n\t\t\tgl_FragColor = sum;\n\n\t\t}"};var Ja=s(51163);class Shadow extends o.B69{constructor(e,t,s){super(),this.camera=new o.qUd,this.renderTarget=null,this.renderTargetBlur=null,this.depthMaterial=new o.CSG,this.horizontalBlurMaterial=new o.BKk(Va),this.verticalBlurMaterial=new o.BKk($a),this.intensity=0,this.softness=1,this.boundingBox=new o.NRn,this.size=new o.Pq0,this.maxDimension=0,this.isAnimated=!1,this.needsUpdate=!1;const{camera:r}=this;r.rotation.x=Math.PI/2,r.left=-.5,r.right=.5,r.bottom=-.5,r.top=.5,this.add(r);const A=new o.bdM,l=new o.V9B({opacity:1,transparent:!0,side:o.hsX});this.floor=new o.eaF(A,l),this.floor.userData.noHit=!0,r.add(this.floor),this.blurPlane=new o.eaF(A),this.blurPlane.visible=!1,r.add(this.blurPlane),e.target.add(this),this.depthMaterial.onBeforeCompile=function(e){e.fragmentShader=e.fragmentShader.replace("gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );","gl_FragColor = vec4( vec3( 0.0 ), ( 1.0 - fragCoordZ ) * opacity );")},this.horizontalBlurMaterial.depthTest=!1,this.verticalBlurMaterial.depthTest=!1,this.setScene(e,t,s)}setScene(e,t,s){const{boundingBox:r,size:o,rotation:A,position:l}=this;if(this.isAnimated=e.animationNames.length>0,this.boundingBox.copy(e.boundingBox),this.size.copy(e.size),this.maxDimension=Math.max(o.x,o.y,o.z)*(this.isAnimated?2:1),this.boundingBox.getCenter(l),"back"===s){const{min:e,max:t}=r;[e.y,e.z]=[e.z,e.y],[t.y,t.z]=[t.z,t.y],[o.y,o.z]=[o.z,o.y],A.x=Math.PI/2,A.y=Math.PI}else A.x=0,A.y=0;if(this.isAnimated){const e=r.min.y,t=r.max.y;o.y=this.maxDimension,r.expandByVector(o.subScalar(this.maxDimension).multiplyScalar(-.5)),r.min.y=e,r.max.y=t,o.set(this.maxDimension,t-e,this.maxDimension)}"bottom"===s?l.y=r.min.y:l.z=r.min.y,this.setSoftness(t)}setSoftness(e){this.softness=e;const{size:t,camera:s}=this,r=this.isAnimated?2:1,o=r*Math.pow(2,9-3*e);this.setMapSize(o);const A=t.y/2,l=t.y*r;s.near=0,s.far=(0,Ja.Cc)(l,A,e),this.depthMaterial.opacity=1/e,s.updateProjectionMatrix(),this.setIntensity(this.intensity),this.setOffset(0)}setMapSize(e){const{size:t}=this;this.isAnimated&&(e*=2);const s=Math.floor(t.x>t.z?e:e*t.x/t.z),r=Math.floor(t.x>t.z?e*t.z/t.x:e),A=10+s,l=10+r;if(null==this.renderTarget||this.renderTarget.width===A&&this.renderTarget.height===l||(this.renderTarget.dispose(),this.renderTarget=null,this.renderTargetBlur.dispose(),this.renderTargetBlur=null),null==this.renderTarget){const e={format:o.GWd};this.renderTarget=new o.nWS(A,l,e),this.renderTargetBlur=new o.nWS(A,l,e),this.floor.material.map=this.renderTarget.texture}this.camera.scale.set(t.x*(1+10/s),t.z*(1+10/r),1),this.needsUpdate=!0}setIntensity(e){this.intensity=e,e>0?(this.visible=!0,this.floor.visible=!0,this.floor.material.opacity=e*(0,Ja.Cc)(.3,1,this.softness*this.softness)):(this.visible=!1,this.floor.visible=!1)}getIntensity(){return this.intensity}setOffset(e){this.floor.position.z=-e+this.gap()}gap(){return.001*this.maxDimension}render(e,t){t.overrideMaterial=this.depthMaterial;const s=e.getClearAlpha();e.setClearAlpha(0),this.floor.visible=!1;const r=e.xr.enabled;e.xr.enabled=!1;const o=e.getRenderTarget();e.setRenderTarget(this.renderTarget),e.render(t,this.camera),t.overrideMaterial=null,this.floor.visible=!0,this.blurShadow(e),e.xr.enabled=r,e.setRenderTarget(o),e.setClearAlpha(s)}blurShadow(e){const{camera:t,horizontalBlurMaterial:s,verticalBlurMaterial:r,renderTarget:o,renderTargetBlur:A,blurPlane:l}=this;l.visible=!0,l.material=s,s.uniforms.h.value=1/this.renderTarget.width,s.uniforms.tDiffuse.value=this.renderTarget.texture,e.setRenderTarget(A),e.render(l,t),l.material=r,r.uniforms.v.value=1/this.renderTarget.height,r.uniforms.tDiffuse.value=this.renderTargetBlur.texture,e.setRenderTarget(o),e.render(l,t),l.visible=!1}dispose(){null!=this.renderTarget&&this.renderTarget.dispose(),null!=this.renderTargetBlur&&this.renderTargetBlur.dispose(),this.depthMaterial.dispose(),this.horizontalBlurMaterial.dispose(),this.verticalBlurMaterial.dispose(),this.floor.material.dispose(),this.floor.geometry.dispose(),this.blurPlane.geometry.dispose(),this.removeFromParent()}}var Ka=s(96763);const Ya=new o.Pq0,za=new o.Pq0,ja=new o.Pq0,Wa=new o.tBo,Xa=new o.Pq0,Za=new o.I9Y;class ModelScene extends o.Z58{constructor({canvas:e,element:t,width:s,height:r}){super(),this.annotationRenderer=new CSS2DRenderer,this.effectRenderer=null,this.schemaElement=document.createElement("script"),this.width=1,this.height=1,this.aspect=1,this.scaleStep=0,this.renderCount=0,this.externalRenderer=null,this.camera=new o.ubm(45,1,.1,100),this.xrCamera=null,this.url=null,this.target=new o.B69,this.animationNames=[],this.boundingBox=new o.NRn,this.boundingSphere=new o.iyt,this.size=new o.Pq0,this.idealAspect=0,this.framedFoVDeg=0,this.shadow=null,this.shadowIntensity=0,this.shadowSoftness=1,this.bakedShadows=new Set,this.exposure=1,this.toneMapping=o.FV,this.canScale=!0,this.isDirty=!1,this.goalTarget=new o.Pq0,this.targetDamperX=new Damper,this.targetDamperY=new Damper,this.targetDamperZ=new Damper,this._currentGLTF=null,this._model=null,this.cancelPendingSourceChange=null,this.animationsByName=new Map,this.currentAnimationAction=null,this.groundedSkybox=new GroundedSkybox,this.name="ModelScene",this.element=t,this.canvas=e,this.camera=new o.ubm(45,1,.1,100),this.camera.name="MainCamera",this.add(this.target),this.setSize(s,r),this.target.name="Target",this.mixer=new o.Iw4(this.target);const{domElement:A}=this.annotationRenderer,{style:l}=A;l.display="none",l.pointerEvents="none",l.position="absolute",l.top="0",this.element.shadowRoot.querySelector(".default").appendChild(A),this.schemaElement.setAttribute("type","application/ld+json")}get context(){return this.canvas.getContext("2d")}getCamera(){return null!=this.xrCamera?this.xrCamera:this.camera}queueRender(){this.isDirty=!0}shouldRender(){return this.isDirty}hasRendered(){this.isDirty=!1}forceRescale(){this.scaleStep=-1,this.queueRender()}async setObject(e){this.reset(),this._model=e,this.target.add(e),await this.setupScene()}async setSource(e,t=()=>{}){if(!e||e===this.url)return void t(1);if(this.reset(),this.url=e,null!=this.externalRenderer){const e=await this.externalRenderer.load(t);return this.boundingSphere.radius=e.framedRadius,void(this.idealAspect=e.fieldOfViewAspect)}let s;null!=this.cancelPendingSourceChange&&(this.cancelPendingSourceChange(),this.cancelPendingSourceChange=null);try{s=await new Promise((async(s,r)=>{this.cancelPendingSourceChange=()=>r();try{s(await this.element[Vo].loader.load(e,this.element,t))}catch(e){r(e)}}))}catch(e){if(null==e)return;throw e}this.cancelPendingSourceChange=null,this.reset(),this.url=e,this._currentGLTF=s,null!=s&&(this._model=s.scene,this.target.add(s.scene));const{animations:r}=s,o=new Map,A=[];for(const e of r)o.set(e.name,e),A.push(e.name);this.animations=r,this.animationsByName=o,this.animationNames=A,await this.setupScene()}async setupScene(){this.applyTransform(),this.updateBoundingBox(),await this.updateFraming(),this.updateShadow(),this.setShadowIntensity(this.shadowIntensity),this.setGroundedSkybox()}reset(){this.url=null,this.renderCount=0,this.queueRender(),null!=this.shadow&&this.shadow.setIntensity(0),this.bakedShadows.clear();const{_model:e}=this;null!=e&&(e.removeFromParent(),this._model=null);const t=this._currentGLTF;null!=t&&(t.dispose(),this._currentGLTF=null),null!=this.currentAnimationAction&&(this.currentAnimationAction.stop(),this.currentAnimationAction=null),this.mixer.stopAllAction(),this.mixer.uncacheRoot(this)}dispose(){this.reset(),null!=this.shadow&&(this.shadow.dispose(),this.shadow=null),this.element[La]=null,this.element[Fa]=null,this.element[_a]=null}get currentGLTF(){return this._currentGLTF}setSize(e,t){if(this.width!==e||this.height!==t){if(this.width=Math.max(e,1),this.height=Math.max(t,1),this.annotationRenderer.setSize(e,t),this.aspect=this.width/this.height,null!=this.externalRenderer){const s=De();this.externalRenderer.resize(e*s,t*s)}this.queueRender()}}markBakedShadow(e){e.userData.noHit=!0,this.bakedShadows.add(e)}unmarkBakedShadow(e){e.userData.noHit=!1,e.visible=!0,this.bakedShadows.delete(e),this.boundingBox.expandByObject(e)}findBakedShadows(e){const t=new o.NRn;e.traverse((e=>{const s=e;if(!s.material)return;if(!s.material.transparent)return;t.setFromObject(s);const r=t.getSize(Xa),o=Math.min(r.x,r.y,r.z);Math.max(r.x,r.y,r.z)<100*o||this.markBakedShadow(s)}))}checkBakedShadows(){const{min:e,max:t}=this.boundingBox,s=new o.NRn;this.boundingBox.getSize(this.size);for(const r of this.bakedShadows)s.setFromObject(r),s.min.y<e.y+this.size.y/100&&s.min.x<=e.x&&s.max.x>=t.x&&s.min.z<=e.z&&s.max.z>=t.z||s.min.z<e.z+this.size.z/100&&s.min.x<=e.x&&s.max.x>=t.x&&s.min.y<=e.y&&s.max.y>=t.y||this.unmarkBakedShadow(r)}applyTransform(){const{model:e}=this;if(null==e)return;const t=Wi(this.element.orientation)[0].terms,s=ns(t[0]).number,r=ns(t[1]).number,A=ns(t[2]).number;e.quaternion.setFromEuler(new o.O9p(r,A,s,"YXZ"));const l=Wi(this.element.scale)[0].terms;e.scale.set(l[0].number,l[1].number,l[2].number)}updateBoundingBox(){const{model:e}=this;if(null==e)return;this.target.remove(e),this.findBakedShadows(e);const bound=(e,t)=>e.expandByPoint(t);this.setBakedShadowVisibility(!1),this.boundingBox=reduceVertices(e,bound,new o.NRn),this.boundingBox.isEmpty()&&(this.setBakedShadowVisibility(!0),this.bakedShadows.forEach((e=>this.unmarkBakedShadow(e))),this.boundingBox=reduceVertices(e,bound,new o.NRn)),this.checkBakedShadows(),this.setBakedShadowVisibility(),this.boundingBox.getSize(this.size),this.target.add(e)}async updateFraming(){const{model:e}=this;if(null==e)return;this.target.remove(e),this.setBakedShadowVisibility(!1);const{center:t}=this.boundingSphere;this.element.requestUpdate("cameraTarget"),await this.element.updateComplete,t.copy(this.getTarget());this.boundingSphere.radius=Math.sqrt(reduceVertices(e,((e,s)=>Math.max(e,t.distanceToSquared(s))),0));this.idealAspect=reduceVertices(e,((e,s)=>{s.sub(t);const r=Math.sqrt(s.x*s.x+s.z*s.z);return Math.max(e,r/(this.idealCameraDistance()-Math.abs(s.y)))}),0)/Math.tan(this.framedFoVDeg/2*Math.PI/180),this.setBakedShadowVisibility(),this.target.add(e)}setBakedShadowVisibility(e=this.shadowIntensity<=0){for(const t of this.bakedShadows)t.visible=e}idealCameraDistance(){const e=this.framedFoVDeg/2*Math.PI/180;return this.boundingSphere.radius/Math.sin(e)}adjustedFoV(e){const t=Math.tan(e/2*Math.PI/180)*Math.max(1,this.idealAspect/this.aspect);return 2*Math.atan(t)*180/Math.PI}getNDC(e,t){if(null!=this.xrCamera)Za.set(e/window.screen.width,t/window.screen.height);else{const s=this.element.getBoundingClientRect();Za.set((e-s.x)/this.width,(t-s.y)/this.height)}return Za.multiplyScalar(2).subScalar(1),Za.y*=-1,Za}getSize(){return{width:this.width,height:this.height}}setEnvironmentAndSkybox(e,t){this.element[Vo].arRenderer.presentedScene!==this&&(this.environment=e,this.setBackground(t),this.queueRender())}setBackground(e){this.groundedSkybox.map=e,this.groundedSkybox.isUsable()?(this.target.add(this.groundedSkybox),this.background=null):(this.target.remove(this.groundedSkybox),this.background=e)}farRadius(){return this.boundingSphere.radius*(null!=this.groundedSkybox.parent?10:1)}setGroundedSkybox(){const e=Wi(this.element.skyboxHeight)[0].terms[0],t=ns(e).number,s=10*this.boundingSphere.radius;this.groundedSkybox.updateGeometry(t,s),this.groundedSkybox.position.y=t-(this.shadow?2*this.shadow.gap():0),this.setBackground(this.groundedSkybox.map)}setTarget(e,t,s){this.goalTarget.set(-e,-t,-s)}setTargetDamperDecayTime(e){this.targetDamperX.setDecayTime(e),this.targetDamperY.setDecayTime(e),this.targetDamperZ.setDecayTime(e)}getTarget(){return this.goalTarget.clone().multiplyScalar(-1)}jumpToGoal(){this.updateTarget(1e4)}updateTarget(e){const t=this.goalTarget,s=this.target.position;if(t.equals(s))return!1;{const r=this.boundingSphere.radius/10;let{x:o,y:A,z:l}=s;return o=this.targetDamperX.update(o,t.x,e,r),A=this.targetDamperY.update(A,t.y,e,r),l=this.targetDamperZ.update(l,t.z,e,r),this.target.position.set(o,A,l),this.target.updateMatrixWorld(),this.queueRender(),!0}}pointTowards(e,t){const{x:s,z:r}=this.position;this.yaw=Math.atan2(e-s,t-r)}get model(){return this._model}set yaw(e){this.rotation.y=e,this.queueRender()}get yaw(){return this.rotation.y}set animationTime(e){this.mixer.setTime(e),this.queueShadowRender()}get animationTime(){if(null!=this.currentAnimationAction){const e=Math.max(this.currentAnimationAction._loopCount,0);return this.currentAnimationAction.loop!==o.lc7||1&~e?this.currentAnimationAction.time:this.duration-this.currentAnimationAction.time}return 0}set animationTimeScale(e){this.mixer.timeScale=e}get animationTimeScale(){return this.mixer.timeScale}get duration(){return null!=this.currentAnimationAction&&this.currentAnimationAction.getClip()?this.currentAnimationAction.getClip().duration:0}get hasActiveAnimation(){return null!=this.currentAnimationAction}playAnimation(e=null,t=0,s=o.aMy,r=1/0){if(null==this._currentGLTF)return;const{animations:A}=this;if(null==A||0===A.length)return;let l=null;if(null!=e&&(l=this.animationsByName.get(e),null==l)){const t=parseInt(e);!isNaN(t)&&t>=0&&t<A.length&&(l=A[t])}null==l&&(l=A[0]);try{const{currentAnimationAction:e}=this,o=this.mixer.clipAction(l,this);this.currentAnimationAction=o,this.element.paused?this.mixer.stopAllAction():(o.paused=!1,null!=e&&o!==e?o.crossFadeFrom(e,t,!1):this.animationTimeScale>0&&this.animationTime==this.duration&&(this.animationTime=0)),o.setLoop(s,r),o.enabled=!0,o.clampWhenFinished=!0,o.play()}catch(e){Ka.error(e)}}stopAnimation(){this.currentAnimationAction=null,this.mixer.stopAllAction()}updateAnimation(e){this.mixer.update(e),this.queueShadowRender()}subscribeMixerEvent(e,t){this.mixer.addEventListener(e,t)}updateShadow(){const e=this.shadow;if(null!=e){const t="wall"===this.element.arPlacement?"back":"bottom";e.setScene(this,this.shadowSoftness,t),e.needsUpdate=!0}}renderShadow(e){const t=this.shadow;null!=t&&1==t.needsUpdate&&(t.render(e,this),t.needsUpdate=!1)}queueShadowRender(){null!=this.shadow&&(this.shadow.needsUpdate=!0)}setShadowIntensity(e){if(this.shadowIntensity=e,null!=this._currentGLTF&&(this.setBakedShadowVisibility(),!(e<=0&&null==this.shadow))){if(null==this.shadow){const e="wall"===this.element.arPlacement?"back":"bottom";this.shadow=new Shadow(this,this.shadowSoftness,e)}this.shadow.setIntensity(e)}}setShadowSoftness(e){this.shadowSoftness=e;const t=this.shadow;null!=t&&t.setSoftness(e)}setShadowOffset(e){const t=this.shadow;null!=t&&t.setOffset(e)}hitFromPoint(e,t=this){Wa.setFromCamera(e,this.getCamera());return Wa.intersectObject(t,!0).find((e=>e.object.visible&&!e.object.userData.noHit))}positionAndNormalFromPoint(e,t=this){var s;const r=this.hitFromPoint(e,t);if(null==r)return null;return{position:r.point,normal:null!=r.face?r.face.normal.clone().applyNormalMatrix((new o.dwI).getNormalMatrix(r.object.matrixWorld)):Wa.ray.direction.clone().multiplyScalar(-1),uv:null!==(s=r.uv)&&void 0!==s?s:null}}surfaceFromPoint(e,t=this){const s=this.element.model;if(null==s)return null;const r=this.hitFromPoint(e,t);if(null==r||null==r.face)return null;const A=s[ba](r),{meshes:l,primitives:h}=A.mesh.userData.associations,c=new o.Pq0,d=new o.Pq0,g=new o.Pq0,{a:p,b:m,c:f}=r.face,I=r.object;I.getVertexPosition(p,c),I.getVertexPosition(m,d),I.getVertexPosition(f,g);const E=new o.lMl(c,d,g),C=new o.Pq0;return E.getBarycoord(I.worldToLocal(r.point),C),`${l} ${h} ${p} ${m} ${f} ${C.x.toFixed(3)} ${C.y.toFixed(3)} ${C.z.toFixed(3)}`}addHotspot(e){this.target.add(e),this.annotationRenderer.domElement.appendChild(e.element)}removeHotspot(e){this.target.remove(e)}forHotspots(e){const{children:t}=this.target;for(let s=0,r=t.length;s<r;s++){const r=t[s];r instanceof Hotspot&&e(r)}}initializeSurface(e){if(null!=e.surface&&null==e.mesh){const t=Wi(e.surface)[0].terms;if(8!=t.length)return void Ka.warn(e.surface+" does not have exactly 8 numbers.");const s=this.element.model[Sa](t[0].number,t[1].number),r=new o.Pq0(t[2].number,t[3].number,t[4].number);if(null==s)return void Ka.warn(e.surface+" does not match a node/primitive in this glTF! Skipping this hotspot.");const A=s.mesh.geometry.attributes.position.count;if(r.x>=A||r.y>=A||r.z>=A)return void Ka.warn(e.surface+" vertex indices out of range in this glTF! Skipping this hotspot.");const l=new o.Pq0(t[5].number,t[6].number,t[7].number);e.mesh=s.mesh,e.tri=r,e.bary=l}}updateSurfaceHotspots(){const e=!this.element.paused;this.forHotspots((t=>{this.initializeSurface(t),t.updateSurface(e)}))}updateHotspotsVisibility(e){this.forHotspots((t=>{Ya.copy(e),za.setFromMatrixPosition(t.matrixWorld),Ya.sub(za),ja.copy(t.normal).transformDirection(this.target.matrixWorld),Ya.dot(ja)<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:s,element:r}=this,{alt:o,poster:A,iosSrc:l}=r;if(null!=e){const r=[{"@type":"MediaObject",contentUrl:e,encodingFormat:"gltf"===(null===(t=e.split(".").pop())||void 0===t?void 0:t.toLowerCase())?"model/gltf+json":"model/gltf-binary"}];l&&r.push({"@type":"MediaObject",contentUrl:l,encodingFormat:"model/vnd.usdz+zip"});const h={"@context":"http://schema.org/","@type":"3DModel",image:null!=A?A:void 0,name:null!=o?o:void 0,encoding:r};s.textContent=JSON.stringify(h),document.head.appendChild(s)}else null!=s.parentElement&&s.parentElement.removeChild(s)}}class ProgressTracker extends EventTarget{constructor(){super(...arguments),this.ongoingActivities=new Set,this.totalProgress=0}get ongoingActivityCount(){return this.ongoingActivities.size}beginActivity(e){const t={progress:0,completed:!1};return this.ongoingActivities.add(t),1===this.ongoingActivityCount&&this.announceTotalProgress(t,0,e),s=>{let r;return r=Math.max(clamp(s,0,1),t.progress),r!==t.progress&&this.announceTotalProgress(t,r,e),t.progress}}announceTotalProgress(e,t,s){let r=0,o=0;1==t&&(e.completed=!0);for(const e of this.ongoingActivities){const{progress:t}=e;r+=1-t,e.completed&&o++}const A=e.progress;e.progress=t,this.totalProgress+=(t-A)*(1-this.totalProgress)/r;const l=o===this.ongoingActivityCount?1:this.totalProgress;this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:l,reason:s}})),o===this.ongoingActivityCount&&(this.totalProgress=0,this.ongoingActivities.clear())}}var eo,to,io,so,no,ro,ao,oo,Ao,lo,ho,co,uo,go=s(96763),model_viewer_base_decorate=function(e,t,s,r){var o,A=arguments.length,l=A<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,s,r);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(l=(A<3?o(l):A>3?o(t,s,l):o(t,s))||l);return A>3&&l&&Object.defineProperty(t,s,l),l};const po=document.createElement("canvas"),mo=Symbol("fallbackResizeHandler"),fo=Symbol("defaultAriaLabel"),Io=Symbol("resizeObserver"),Eo=Symbol("clearModelTimeout"),Co=Symbol("onContextLost"),Bo=Symbol("loaded"),yo=Symbol("status"),wo=Symbol("onFocus"),vo=Symbol("onBlur"),Qo=Symbol("updateSize"),xo=Symbol("intersectionObserver"),bo=Symbol("isElementInViewport"),So=Symbol("announceModelVisibility"),Mo=Symbol("ariaLabel"),To=Symbol("altDefaulted"),Ro=Symbol("statusElement"),Do=Symbol("updateStatus"),Lo=Symbol("loadedTime"),Fo=Symbol("updateSource"),_o=Symbol("markLoaded"),ko=Symbol("container"),Uo=Symbol("input"),Go=Symbol("canvas"),Po=Symbol("scene"),No=Symbol("needsRender"),Oo=Symbol("tick"),Ho=Symbol("onModelLoad"),qo=Symbol("onResize"),Vo=Symbol("renderer"),$o=Symbol("progressTracker"),Jo=Symbol("getLoaded"),Ko=Symbol("getModelIsVisible"),Yo=Symbol("shouldAttemptPreload"),toVector3D=e=>({x:e.x,y:e.y,z:e.z,toString(){return`${this.x}m ${this.y}m ${this.z}m`}}),toVector2D=e=>({u:e.x,v:e.y,toString(){return`${this.u} ${this.v}`}});class ModelViewerElementBase extends reactive_element_a{constructor(){super(),this.alt=null,this.src=null,this.withCredentials=!1,this.generateSchema=!1,this[eo]=!1,this[to]=!1,this[io]=0,this[so]="",this[no]=null,this[ro]=debounce((()=>{const e=this.getBoundingClientRect();this[Qo](e)}),50),this[ao]=debounce((e=>{const t=this.modelIsVisible;t!==e&&this.dispatchEvent(new CustomEvent("model-visibility",{detail:{visible:t}}))}),0),this[oo]=null,this[Ao]=null,this[lo]=new ProgressTracker,this[ho]=()=>{this[Ro].textContent=this[yo]},this[co]=()=>{this[Ro].textContent=""},this[uo]=e=>{this.dispatchEvent(new CustomEvent("error",{detail:{type:"webglcontextlost",sourceError:e.sourceEvent}}))},this.attachShadow({mode:"open"});const e=this.shadowRoot;let t,s;if((e=>{D(Ge,e)})(e),this[ko]=e.querySelector(".container"),this[Uo]=e.querySelector(".userInput"),this[Go]=e.querySelector("canvas"),this[Ro]=e.querySelector("#status"),this[fo]=this[Uo].getAttribute("aria-label"),this.isConnected){const e=this.getBoundingClientRect();t=e.width,s=e.height}else t=300,s=150;this[Po]=new ModelScene({canvas:this[Go],element:this,width:t,height:s}),Promise.resolve().then((()=>{this[Qo](this.getBoundingClientRect())})),Be&&(this[Io]=new ResizeObserver((e=>{if(!this[Vo].isPresenting)for(let t of e)t.target===this&&this[Qo](t.contentRect)}))),ye?this[xo]=new IntersectionObserver((e=>{for(let t of e)if(t.target===this){const e=this.modelIsVisible;this[bo]=t.isIntersecting,this[So](e),this[bo]&&!this.loaded&&this[Fo]()}}),{root:null,rootMargin:"0px",threshold:1e-5}):this[bo]=!0}static get is(){return"model-viewer"}static set modelCacheSize(e){CachingGLTFLoader[ni].evictionThreshold=e}static get modelCacheSize(){return CachingGLTFLoader[ni].evictionThreshold}static set minimumRenderScale(e){e>1&&go.warn("<model-viewer> minimumRenderScale has been clamped to a maximum value of 1."),e<=0&&go.warn("<model-viewer> minimumRenderScale has been clamped to a minimum value of 0.25."),Renderer.singleton.minScale=e}static get minimumRenderScale(){return Renderer.singleton.minScale}get loaded(){return this[Jo]()}get[(eo=bo,to=Bo,io=Lo,so=yo,no=Eo,ro=mo,ao=So,oo=Io,Ao=xo,lo=$o,Vo)](){return Renderer.singleton}get modelIsVisible(){return this[Ko]()}connectedCallback(){super.connectedCallback&&super.connectedCallback(),Be?this[Io].observe(this):self.addEventListener("resize",this[mo]),ye&&this[xo].observe(this),this.addEventListener("focus",this[wo]),this.addEventListener("blur",this[vo]);const e=this[Vo];e.addEventListener("contextlost",this[Co]),e.registerScene(this[Po]),null!=this[Eo]&&(self.clearTimeout(this[Eo]),this[Eo]=null,this.requestUpdate("src",null))}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback(),Be?this[Io].unobserve(this):self.removeEventListener("resize",this[mo]),ye&&this[xo].unobserve(this),this.removeEventListener("focus",this[wo]),this.removeEventListener("blur",this[vo]);const e=this[Vo];e.removeEventListener("contextlost",this[Co]),e.unregisterScene(this[Po]),this[Eo]=self.setTimeout((()=>{this[Po].dispose(),this[Eo]=null}),10)}updated(e){super.updated(e),e.has("src")&&(null==this.src?(this[Bo]=!1,this[Lo]=0,this[Po].reset()):this.src!==this[Po].url&&(this[Bo]=!1,this[Lo]=0,this[Fo]())),e.has("alt")&&this[Uo].setAttribute("aria-label",this[Mo]),e.has("withCredentials")&&(CachingGLTFLoader.withCredentials=this.withCredentials,this[Vo].textureUtils.withCredentials=this.withCredentials),e.has("generateSchema")&&(this.generateSchema?this[Po].updateSchema(this.src):this[Po].updateSchema(null))}toDataURL(e,t){return this[Vo].displayCanvas(this[Po]).toDataURL(e,t)}async toBlob(e){const t=e?e.mimeType:void 0,s=e?e.qualityArgument:void 0,r=e?e.idealAspect:void 0,{width:o,height:A,idealAspect:l,aspect:h}=this[Po],{dpr:c,scaleFactor:d}=this[Vo];let g=o*d*c,p=A*d*c,m=0,f=0;if(!0===r)if(l>h){const e=p;p=Math.round(g/l),f=(e-p)/2}else{const e=g;g=Math.round(p*l),m=(e-g)/2}po.width=g,po.height=p;try{return new Promise((async(e,r)=>{po.getContext("2d").drawImage(this[Vo].displayCanvas(this[Po]),m,f,g,p,0,0,g,p),po.toBlob((t=>{if(!t)return r(new Error("Unable to retrieve canvas blob"));e(t)}),t,s)}))}finally{this[Qo]({width:o,height:A})}}registerEffectComposer(e){e.setRenderer(this[Vo].threeRenderer),e.setMainCamera(this[Po].getCamera()),e.setMainScene(this[Po]),this[Po].effectRenderer=e}unregisterEffectComposer(){this[Po].effectRenderer=null}registerRenderer(e){this[Po].externalRenderer=e}unregisterRenderer(){this[Po].externalRenderer=null}get[Mo](){return this[To]}get[To](){return null==this.alt||"null"===this.alt?this[fo]:this.alt}[Jo](){return this[Bo]}[Ko](){return this.loaded&&this[bo]}[Yo](){return!!this.src&&this[bo]}[Qo]({width:e,height:t}){0!==e&&0!==t&&(this[ko].style.width=`${e}px`,this[ko].style.height=`${t}px`,this[qo]({width:e,height:t}))}[Oo](e,t){var s;null===(s=this[Po].effectRenderer)||void 0===s||s.beforeRender(e,t)}[_o](){this[Bo]||(this[Bo]=!0,this[Lo]=performance.now())}[No](){this[Po].queueRender()}[Ho](){}[Do](e){this[yo]=e;const t=this.getRootNode();null!=t&&t.activeElement===this&&this[Ro].textContent!=e&&(this[Ro].textContent=e)}[(ho=wo,co=vo,qo)](e){this[Po].setSize(e.width,e.height)}async[(uo=Co,Fo)](){const e=this[Po];if(this.loaded||!this[Yo]()||this.src===e.url)return;this.generateSchema&&e.updateSchema(this.src),this[Do]("Loading"),e.stopAnimation();const t=this[$o].beginActivity("model-load"),s=this.src;try{const r=e.setSource(s,(e=>t(.95*clamp(e,0,1)))),o=this[ke]();await Promise.all([r,o]),this[_o](),this[Ho](),this.updateComplete.then((()=>{this.dispatchEvent(new CustomEvent("before-render"))})),await new Promise((e=>{requestAnimationFrame((()=>{requestAnimationFrame((()=>{this.dispatchEvent(new CustomEvent("load",{detail:{url:s}})),e()}))}))}))}catch(e){this.dispatchEvent(new CustomEvent("error",{detail:{type:"loadfailure",sourceError:e}}))}finally{t(1)}}}model_viewer_base_decorate([n({type:String})],ModelViewerElementBase.prototype,"alt",void 0),model_viewer_base_decorate([n({type:String})],ModelViewerElementBase.prototype,"src",void 0),model_viewer_base_decorate([n({type:Boolean,attribute:"with-credentials"})],ModelViewerElementBase.prototype,"withCredentials",void 0),model_viewer_base_decorate([n({type:Boolean,attribute:"generate-schema"})],ModelViewerElementBase.prototype,"generateSchema",void 0);var animation_decorate=function(e,t,s,r){var o,A=arguments.length,l=A<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,s,r);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(l=(A<3?o(l):A>3?o(t,s,l):o(t,s))||l);return A>3&&l&&Object.defineProperty(t,s,l),l};const zo=Symbol("changeAnimation"),jo=Symbol("paused"),Wo={repetitions:1/0,pingpong:!1},Xo=Symbol("hotspotMap"),Zo=Symbol("mutationCallback"),eA=Symbol("observer"),tA=Symbol("addHotspot"),iA=Symbol("removeHotspot"),sA=new o.kn4;var durl=function(e){return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))};try{URL.revokeObjectURL(durl(""))}catch(e){durl=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)},function(e){return new Worker(e,{type:"module"})}}var nA=Uint8Array,rA=Uint16Array,aA=Uint32Array,oA=new nA([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]),AA=new nA([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]),lA=new nA([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),freb=function(e,t){for(var s=new rA(31),r=0;r<31;++r)s[r]=t+=1<<e[r-1];var o=new aA(s[30]);for(r=1;r<30;++r)for(var A=s[r];A<s[r+1];++A)o[A]=A-s[r]<<5|r;return[s,o]},hA=freb(oA,2),cA=hA[0],uA=hA[1];cA[28]=258,uA[258]=28;for(var dA=freb(AA,0),gA=(dA[0],dA[1]),pA=new rA(32768),mA=0;mA<32768;++mA){var fA=(43690&mA)>>>1|(21845&mA)<<1;fA=(61680&(fA=(52428&fA)>>>2|(13107&fA)<<2))>>>4|(3855&fA)<<4,pA[mA]=((65280&fA)>>>8|(255&fA)<<8)>>>1}var hMap=function(e,t,s){for(var r=e.length,o=0,A=new rA(t);o<r;++o)++A[e[o]-1];var l,h=new rA(t);for(o=0;o<t;++o)h[o]=h[o-1]+A[o-1]<<1;if(s){l=new rA(1<<t);var c=15-t;for(o=0;o<r;++o)if(e[o])for(var d=o<<4|e[o],g=t-e[o],p=h[e[o]-1]++<<g,m=p|(1<<g)-1;p<=m;++p)l[pA[p]>>>c]=d}else for(l=new rA(r),o=0;o<r;++o)e[o]&&(l[o]=pA[h[e[o]-1]++]>>>15-e[o]);return l},IA=new nA(288);for(mA=0;mA<144;++mA)IA[mA]=8;for(mA=144;mA<256;++mA)IA[mA]=9;for(mA=256;mA<280;++mA)IA[mA]=7;for(mA=280;mA<288;++mA)IA[mA]=8;var EA=new nA(32);for(mA=0;mA<32;++mA)EA[mA]=5;var CA=hMap(IA,9,0),BA=hMap(EA,5,0),shft=function(e){return(e/8|0)+(7&e&&1)},slc=function(e,t,s){(null==t||t<0)&&(t=0),(null==s||s>e.length)&&(s=e.length);var r=new(e instanceof rA?rA:e instanceof aA?aA:nA)(s-t);return r.set(e.subarray(t,s)),r},wbits=function(e,t,s){s<<=7&t;var r=t/8|0;e[r]|=s,e[r+1]|=s>>>8},wbits16=function(e,t,s){s<<=7&t;var r=t/8|0;e[r]|=s,e[r+1]|=s>>>8,e[r+2]|=s>>>16},hTree=function(e,t){for(var s=[],r=0;r<e.length;++r)e[r]&&s.push({s:r,f:e[r]});var o=s.length,A=s.slice();if(!o)return[wA,0];if(1==o){var l=new nA(s[0].s+1);return l[s[0].s]=1,[l,1]}s.sort((function(e,t){return e.f-t.f})),s.push({s:-1,f:25001});var h=s[0],c=s[1],d=0,g=1,p=2;for(s[0]={s:-1,f:h.f+c.f,l:h,r:c};g!=o-1;)h=s[s[d].f<s[p].f?d++:p++],c=s[d!=g&&s[d].f<s[p].f?d++:p++],s[g++]={s:-1,f:h.f+c.f,l:h,r:c};var m=A[0].s;for(r=1;r<o;++r)A[r].s>m&&(m=A[r].s);var f=new rA(m+1),I=fflate_module_ln(s[g-1],f,0);if(I>t){r=0;var E=0,C=I-t,B=1<<C;for(A.sort((function(e,t){return f[t.s]-f[e.s]||e.f-t.f}));r<o;++r){var y=A[r].s;if(!(f[y]>t))break;E+=B-(1<<I-f[y]),f[y]=t}for(E>>>=C;E>0;){var Q=A[r].s;f[Q]<t?E-=1<<t-f[Q]++-1:++r}for(;r>=0&&E;--r){var x=A[r].s;f[x]==t&&(--f[x],++E)}I=t}return[new nA(f),I]},fflate_module_ln=function(e,t,s){return-1==e.s?Math.max(fflate_module_ln(e.l,t,s+1),fflate_module_ln(e.r,t,s+1)):t[e.s]=s},lc=function(e){for(var t=e.length;t&&!e[--t];);for(var s=new rA(++t),r=0,o=e[0],A=1,w=function(e){s[r++]=e},l=1;l<=t;++l)if(e[l]==o&&l!=t)++A;else{if(!o&&A>2){for(;A>138;A-=138)w(32754);A>2&&(w(A>10?A-11<<5|28690:A-3<<5|12305),A=0)}else if(A>3){for(w(o),--A;A>6;A-=6)w(8304);A>2&&(w(A-3<<5|8208),A=0)}for(;A--;)w(o);A=1,o=e[l]}return[s.subarray(0,r),t]},clen=function(e,t){for(var s=0,r=0;r<t.length;++r)s+=e[r]*t[r];return s},wfblk=function(e,t,s){var r=s.length,o=shft(t+2);e[o]=255&r,e[o+1]=r>>>8,e[o+2]=255^e[o],e[o+3]=255^e[o+1];for(var A=0;A<r;++A)e[o+A+4]=s[A];return 8*(o+4+r)},wblk=function(e,t,s,r,o,A,l,h,c,d,g){wbits(t,g++,s),++o[256];for(var p=hTree(o,15),m=p[0],f=p[1],I=hTree(A,15),E=I[0],C=I[1],B=lc(m),y=B[0],Q=B[1],x=lc(E),b=x[0],S=x[1],T=new rA(19),F=0;F<y.length;++F)T[31&y[F]]++;for(F=0;F<b.length;++F)T[31&b[F]]++;for(var _=hTree(T,7),U=_[0],G=_[1],O=19;O>4&&!U[lA[O-1]];--O);var q,$,J,K,Y=d+5<<3,j=clen(o,IA)+clen(A,EA)+l,W=clen(o,m)+clen(A,E)+l+14+3*O+clen(T,U)+(2*T[16]+3*T[17]+7*T[18]);if(Y<=j&&Y<=W)return wfblk(t,g,e.subarray(c,c+d));if(wbits(t,g,1+(W<j)),g+=2,W<j){q=hMap(m,f,0),$=m,J=hMap(E,C,0),K=E;var X=hMap(U,G,0);wbits(t,g,Q-257),wbits(t,g+5,S-1),wbits(t,g+10,O-4),g+=14;for(F=0;F<O;++F)wbits(t,g+3*F,U[lA[F]]);g+=3*O;for(var ee=[y,b],te=0;te<2;++te){var ie=ee[te];for(F=0;F<ie.length;++F){var se=31&ie[F];wbits(t,g,X[se]),g+=U[se],se>15&&(wbits(t,g,ie[F]>>>5&127),g+=ie[F]>>>12)}}}else q=CA,$=IA,J=BA,K=EA;for(F=0;F<h;++F)if(r[F]>255){se=r[F]>>>18&31;wbits16(t,g,q[se+257]),g+=$[se+257],se>7&&(wbits(t,g,r[F]>>>23&31),g+=oA[se]);var ne=31&r[F];wbits16(t,g,J[ne]),g+=K[ne],ne>3&&(wbits16(t,g,r[F]>>>5&8191),g+=AA[ne])}else wbits16(t,g,q[r[F]]),g+=$[r[F]];return wbits16(t,g,q[256]),g+$[256]},yA=new aA([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),wA=new nA(0),dflt=function(e,t,s,r,o,A){var l=e.length,h=new nA(r+l+5*(1+Math.ceil(l/7e3))+o),c=h.subarray(r,h.length-o),d=0;if(!t||l<8)for(var g=0;g<=l;g+=65535){var p=g+65535;p<l?d=wfblk(c,d,e.subarray(g,p)):(c[g]=A,d=wfblk(c,d,e.subarray(g,l)))}else{for(var m=yA[t-1],f=m>>>13,I=8191&m,E=(1<<s)-1,C=new rA(32768),B=new rA(E+1),y=Math.ceil(s/3),Q=2*y,hsh=function(t){return(e[t]^e[t+1]<<y^e[t+2]<<Q)&E},x=new aA(25e3),b=new rA(288),S=new rA(32),T=0,F=0,_=(g=0,0),U=0,G=0;g<l;++g){var O=hsh(g),q=32767&g,$=B[O];if(C[q]=$,B[O]=q,U<=g){var J=l-g;if((T>7e3||_>24576)&&J>423){d=wblk(e,c,0,x,b,S,F,_,G,g-G,d),_=T=F=0,G=g;for(var K=0;K<286;++K)b[K]=0;for(K=0;K<30;++K)S[K]=0}var Y=2,j=0,W=I,X=q-$&32767;if(J>2&&O==hsh(g-X))for(var ee=Math.min(f,J)-1,te=Math.min(32767,g),ie=Math.min(258,J);X<=te&&--W&&q!=$;){if(e[g+Y]==e[g+Y-X]){for(var se=0;se<ie&&e[g+se]==e[g+se-X];++se);if(se>Y){if(Y=se,j=X,se>ee)break;var ne=Math.min(X,se-2),re=0;for(K=0;K<ne;++K){var ae=g-X+K+32768&32767,oe=ae-C[ae]+32768&32767;oe>re&&(re=oe,$=ae)}}}X+=(q=$)-($=C[q])+32768&32767}if(j){x[_++]=268435456|uA[Y]<<18|gA[j];var Ae=31&uA[Y],le=31&gA[j];F+=oA[Ae]+AA[le],++b[257+Ae],++S[le],U=g+Y,++T}else x[_++]=e[g],++b[e[g]]}}d=wblk(e,c,A,x,b,S,F,_,G,g-G,d),!A&&7&d&&(d=wfblk(c,d+1,wA))}return slc(h,0,r+shft(d)+o)},vA=function(){for(var e=new aA(256),t=0;t<256;++t){for(var s=t,r=9;--r;)s=(1&s&&3988292384)^s>>>1;e[t]=s}return e}(),crc=function(){var e=-1;return{p:function(t){for(var s=e,r=0;r<t.length;++r)s=vA[255&s^t[r]]^s>>>8;e=s},d:function(){return~e}}},dopt=function(e,t,s,r,o){return dflt(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,s,r,!o)},mrg=function(e,t){var s={};for(var r in e)s[r]=e[r];for(var r in t)s[r]=t[r];return s},wbytes=function(e,t,s){for(;s;++t)e[t]=s,s>>>=8};function deflateSync(e,t){return dopt(e,t||{},0,0)}var fltn=function(e,t,s,r){for(var o in e){var A=e[o],l=t+o;A instanceof nA?s[l]=[A,r]:Array.isArray(A)?s[l]=[A[0],mrg(r,A[1])]:fltn(A,l+"/",s,r)}},QA="undefined"!=typeof TextEncoder&&new TextEncoder,xA="undefined"!=typeof TextDecoder&&new TextDecoder;try{xA.decode(wA,{stream:!0}),1}catch(e){}function strToU8(e,t){if(t){for(var s=new nA(e.length),r=0;r<e.length;++r)s[r]=e.charCodeAt(r);return s}if(QA)return QA.encode(e);var o=e.length,A=new nA(e.length+(e.length>>1)),l=0,w=function(e){A[l++]=e};for(r=0;r<o;++r){if(l+5>A.length){var h=new nA(l+8+(o-r<<1));h.set(A),A=h}var c=e.charCodeAt(r);c<128||t?w(c):c<2048?(w(192|c>>6),w(128|63&c)):c>55295&&c<57344?(w(240|(c=65536+(1047552&c)|1023&e.charCodeAt(++r))>>18),w(128|c>>12&63),w(128|c>>6&63),w(128|63&c)):(w(224|c>>12),w(128|c>>6&63),w(128|63&c))}return slc(A,0,l)}var exfl=function(e){var t=0;if(e)for(var s in e){var r=e[s].length;if(r>65535)throw"extra field too long";t+=r+4}return t},wzh=function(e,t,s,r,o,A,l,h){var c=r.length,d=s.extra,g=h&&h.length,p=exfl(d);wbytes(e,t,null!=l?33639248:67324752),t+=4,null!=l&&(e[t++]=20,e[t++]=s.os),e[t]=20,t+=2,e[t++]=s.flag<<1|(null==A&&8),e[t++]=o&&8,e[t++]=255&s.compression,e[t++]=s.compression>>8;var m=new Date(null==s.mtime?Date.now():s.mtime),f=m.getFullYear()-1980;if(f<0||f>119)throw"date not in range 1980-2099";if(wbytes(e,t,f<<25|m.getMonth()+1<<21|m.getDate()<<16|m.getHours()<<11|m.getMinutes()<<5|m.getSeconds()>>>1),t+=4,null!=A&&(wbytes(e,t,s.crc),wbytes(e,t+4,A),wbytes(e,t+8,s.size)),wbytes(e,t+12,c),wbytes(e,t+14,p),t+=16,null!=l&&(wbytes(e,t,g),wbytes(e,t+6,s.attrs),wbytes(e,t+10,l),t+=14),e.set(r,t),t+=c,p)for(var I in d){var E=d[I],C=E.length;wbytes(e,t,+I),wbytes(e,t+2,C),e.set(E,t+4),t+=4+C}return g&&(e.set(h,t),t+=g),t},wzf=function(e,t,s,r,o){wbytes(e,t,101010256),wbytes(e,t+8,s),wbytes(e,t+10,s),wbytes(e,t+12,r),wbytes(e,t+16,o)};var bA=s(96763);class USDZExporter{async parse(e,t={}){t=Object.assign({ar:{anchoring:{type:"plane"},planeAnchoring:{alignment:"horizontal"}},quickLookCompatible:!1},t);const s={},r="model.usda";s[r]=null;let o=buildHeader();o+=function buildSceneStart(e){return`def Xform "Root"\n{\n\tdef Scope "Scenes" (\n\t\tkind = "sceneLibrary"\n\t)\n\t{\n\t\tdef Xform "Scene" (\n\t\t\tcustomData = {\n\t\t\t\tbool preliminary_collidesWithEnvironment = 0\n\t\t\t\tstring sceneName = "Scene"\n\t\t\t}\n\t\t\tsceneName = "Scene"\n\t\t)\n\t\t{\n\t\ttoken preliminary:anchoring:type = "${e.ar.anchoring.type}"\n\t\ttoken preliminary:planeAnchoring:alignment = "${e.ar.planeAnchoring.alignment}"\n\n`}(t);const A={},l={};e.traverseVisible((e=>{if(e.isMesh){const t=e.geometry,r=e.material;if(r.isMeshStandardMaterial){const l="geometries/Geometry_"+t.id+".usda";if(!(l in s)){const e=function buildMeshObject(e){const t=function buildMesh(e){const t="Geometry",s=e.attributes,r=s.position.count;return`\n\tdef Mesh "${t}"\n\t{\n\t\tint[] faceVertexCounts = [${function buildMeshVertexCount(e){const t=null!==e.index?e.index.count:e.attributes.position.count;return Array(t/3).fill(3).join(", ")}(e)}]\n\t\tint[] faceVertexIndices = [${function buildMeshVertexIndices(e){const t=e.index,s=[];if(null!==t)for(let e=0;e<t.count;e++)s.push(t.getX(e));else{const t=e.attributes.position.count;for(let e=0;e<t;e++)s.push(e)}return s.join(", ")}(e)}]\n\t\tnormal3f[] normals = [${buildVector3Array(s.normal,r)}] (\n\t\t\tinterpolation = "vertex"\n\t\t)\n\t\tpoint3f[] points = [${buildVector3Array(s.position,r)}]\n${function buildPrimvars(e){let t="";for(let s=0;s<4;s++){const r=s>0?s:"",o=e["uv"+r];void 0!==o&&(t+=`\n\t\ttexCoord2f[] primvars:st${r} = [${buildVector2Array(o)}] (\n\t\t\tinterpolation = "vertex"\n\t\t)`)}return t}(s)}\n\t\tuniform token subdivisionScheme = "none"\n\t}\n`}(e);return`\ndef "Geometry"\n{\n${t}\n}\n`}(t);s[l]=function buildUSDFileAsString(e){let t=buildHeader();return t+=e,strToU8(t)}(e)}r.uuid in A||(A[r.uuid]=r),o+=function buildXform(e,t,s){const r="Object_"+e.id,o=buildMatrix(e.matrixWorld);e.matrixWorld.determinant()<0&&bA.warn("THREE.USDZExporter: USDZ does not support negative scales",e);return`def Xform "${r}" (\n\tprepend references = @./geometries/Geometry_${t.id}.usda@</Geometry>\n\tprepend apiSchemas = ["MaterialBindingAPI"]\n)\n{\n\tmatrix4d xformOp:transform = ${o}\n\tuniform token[] xformOpOrder = ["xformOp:transform"]\n\n\trel material:binding = </Materials/Material_${s.id}>\n}\n\n`}(e,t,r)}else bA.warn("THREE.USDZExporter: Unsupported material type (USDZ only supports MeshStandardMaterial)",e)}else e.isCamera&&(o+=function buildCamera(e){const t=e.name?e.name:"Camera_"+e.id,s=buildMatrix(e.matrixWorld);e.matrixWorld.determinant()<0&&bA.warn("THREE.USDZExporter: USDZ does not support negative scales",e);return e.isOrthographicCamera?`def Camera "${t}"\n\t\t{\n\t\t\tmatrix4d xformOp:transform = ${s}\n\t\t\tuniform token[] xformOpOrder = ["xformOp:transform"]\n\n\t\t\tfloat2 clippingRange = (${e.near.toPrecision(SA)}, ${e.far.toPrecision(SA)})\n\t\t\tfloat horizontalAperture = ${(10*(Math.abs(e.left)+Math.abs(e.right))).toPrecision(SA)}\n\t\t\tfloat verticalAperture = ${(10*(Math.abs(e.top)+Math.abs(e.bottom))).toPrecision(SA)}\n\t\t\ttoken projection = "orthographic"\n\t\t}\n\t\n\t`:`def Camera "${t}"\n\t\t{\n\t\t\tmatrix4d xformOp:transform = ${s}\n\t\t\tuniform token[] xformOpOrder = ["xformOp:transform"]\n\n\t\t\tfloat2 clippingRange = (${e.near.toPrecision(SA)}, ${e.far.toPrecision(SA)})\n\t\t\tfloat focalLength = ${e.getFocalLength().toPrecision(SA)}\n\t\t\tfloat focusDistance = ${e.focus.toPrecision(SA)}\n\t\t\tfloat horizontalAperture = ${e.getFilmWidth().toPrecision(SA)}\n\t\t\ttoken projection = "perspective"\n\t\t\tfloat verticalAperture = ${e.getFilmHeight().toPrecision(SA)}\n\t\t}\n\t\n\t`}(e))})),o+="\n\t\t}\n\t}\n}\n\n",o+=function buildMaterials(e,t,s=!1){const r=[];for(const o in e){const A=e[o];r.push(buildMaterial(A,t,s))}return`def "Materials"\n{\n${r.join("")}\n}\n\n`}(A,l,t.quickLookCompatible),s[r]=strToU8(o),o=null;for(const e in l){let t=l[e];!0===t.isCompressedTexture&&(t=decompress(t));const r=imageToCanvas(t.image,t.flipY),o=await new Promise((e=>r.toBlob(e,"image/png",1)));s[`textures/Texture_${e}.png`]=new Uint8Array(await o.arrayBuffer())}let h=0;for(const e in s){const t=s[e];h+=34+e.length;const r=63&h;if(4!==r){const o=new Uint8Array(64-r);s[e]=[t,{extra:{12345:o}}]}h=t.length}return function zipSync(e,t){t||(t={});var s={},r=[];fltn(e,"",s,t);var o=0,A=0;for(var l in s){var h=s[l],c=h[0],d=h[1],g=0==d.level?0:8,p=(T=strToU8(l)).length,m=d.comment,f=m&&strToU8(m),I=f&&f.length,E=exfl(d.extra);if(p>65535)throw"filename too long";var C=g?deflateSync(c,d):c,B=C.length,y=crc();y.p(c),r.push(mrg(d,{size:c.length,crc:y.d(),c:C,f:T,m:f,u:p!=l.length||f&&m.length!=I,o,compression:g})),o+=30+p+E+B,A+=76+2*(p+E)+(I||0)+B}for(var Q=new nA(A+22),x=o,b=A-o,S=0;S<r.length;++S){var T=r[S];wzh(Q,T.o,T,T.f,T.u,T.c.length);var F=30+T.f.length+exfl(T.extra);Q.set(T.c,T.o+F),wzh(Q,o,T,T.f,T.u,T.c.length,T.o,T.m),o+=16+F+(T.m?T.m.length:0)}return wzf(Q,o,r.length,b,x),Q}(s,{level:0})}}function imageToCanvas(e,t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const s=1024/Math.max(e.width,e.height),r=document.createElement("canvas");r.width=e.width*Math.min(1,s),r.height=e.height*Math.min(1,s);const o=r.getContext("2d");return!0===t&&(o.translate(0,r.height),o.scale(1,-1)),o.drawImage(e,0,0,r.width,r.height),r}throw new Error("THREE.USDZExporter: No valid image data found. Unable to process texture.")}const SA=7;function buildHeader(){return'#usda 1.0\n(\n\tcustomLayerData = {\n\t\tstring creator = "Three.js USDZExporter"\n\t}\n\tdefaultPrim = "Root"\n\tmetersPerUnit = 1\n\tupAxis = "Y"\n)\n\n'}function buildMatrix(e){const t=e.elements;return`( ${buildMatrixRow(t,0)}, ${buildMatrixRow(t,4)}, ${buildMatrixRow(t,8)}, ${buildMatrixRow(t,12)} )`}function buildMatrixRow(e,t){return`(${e[t+0]}, ${e[t+1]}, ${e[t+2]}, ${e[t+3]})`}function buildVector3Array(e,t){if(void 0===e)return bA.warn("USDZExporter: Normals missing."),Array(t).fill("(0, 0, 0)").join(", ");const s=[];for(let t=0;t<e.count;t++){const r=e.getX(t),o=e.getY(t),A=e.getZ(t);s.push(`(${r.toPrecision(SA)}, ${o.toPrecision(SA)}, ${A.toPrecision(SA)})`)}return s.join(", ")}function buildVector2Array(e){const t=[];for(let s=0;s<e.count;s++){const r=e.getX(s),o=e.getY(s);t.push(`(${r.toPrecision(SA)}, ${1-o.toPrecision(SA)})`)}return t.join(", ")}function buildMaterial(e,t,s=!1){const r="\t\t\t",A=[],l=[];function buildTexture(r,A,l){const h=r.source.id+"_"+r.flipY;t[h]=r;const c=r.channel>0?"st"+r.channel:"st",d={1e3:"repeat",1001:"clamp",1002:"mirror"},g=r.repeat.clone(),p=r.offset.clone(),m=r.rotation,f=Math.sin(m),I=Math.cos(m);return p.y=1-p.y-g.y,s?(p.x=p.x/g.x,p.y=p.y/g.y,p.x+=f/g.x,p.y+=I-1):(p.x+=f*g.x,p.y+=(1-I)*g.y),`\n\t\tdef Shader "PrimvarReader_${A}"\n\t\t{\n\t\t\tuniform token info:id = "UsdPrimvarReader_float2"\n\t\t\tfloat2 inputs:fallback = (0.0, 0.0)\n\t\t\ttoken inputs:varname = "${c}"\n\t\t\tfloat2 outputs:result\n\t\t}\n\n\t\tdef Shader "Transform2d_${A}"\n\t\t{\n\t\t\tuniform token info:id = "UsdTransform2d"\n\t\t\ttoken inputs:in.connect = </Materials/Material_${e.id}/PrimvarReader_${A}.outputs:result>\n\t\t\tfloat inputs:rotation = ${(m*(180/Math.PI)).toFixed(SA)}\n\t\t\tfloat2 inputs:scale = ${buildVector2(g)}\n\t\t\tfloat2 inputs:translation = ${buildVector2(p)}\n\t\t\tfloat2 outputs:result\n\t\t}\n\n\t\tdef Shader "Texture_${r.id}_${A}"\n\t\t{\n\t\t\tuniform token info:id = "UsdUVTexture"\n\t\t\tasset inputs:file = @textures/Texture_${h}.png@\n\t\t\tfloat2 inputs:st.connect = </Materials/Material_${e.id}/Transform2d_${A}.outputs:result>\n\t\t\t${void 0!==l?"float4 inputs:scale = "+function buildColor4(e){return`(${e.r}, ${e.g}, ${e.b}, 1.0)`}(l):""}\n\t\t\ttoken inputs:sourceColorSpace = "${r.colorSpace===o.jf0?"raw":"sRGB"}"\n\t\t\ttoken inputs:wrapS = "${d[r.wrapS]}"\n\t\t\ttoken inputs:wrapT = "${d[r.wrapT]}"\n\t\t\tfloat outputs:r\n\t\t\tfloat outputs:g\n\t\t\tfloat outputs:b\n\t\t\tfloat3 outputs:rgb\n\t\t\t${e.transparent||e.alphaTest>0?"float outputs:a":""}\n\t\t}`}return e.side===o.$EB&&bA.warn("THREE.USDZExporter: USDZ does not support double sided materials",e),null!==e.map?(A.push(`${r}color3f inputs:diffuseColor.connect = </Materials/Material_${e.id}/Texture_${e.map.id}_diffuse.outputs:rgb>`),e.transparent?A.push(`${r}float inputs:opacity.connect = </Materials/Material_${e.id}/Texture_${e.map.id}_diffuse.outputs:a>`):e.alphaTest>0&&(A.push(`${r}float inputs:opacity.connect = </Materials/Material_${e.id}/Texture_${e.map.id}_diffuse.outputs:a>`),A.push(`${r}float inputs:opacityThreshold = ${e.alphaTest}`)),l.push(buildTexture(e.map,"diffuse",e.color))):A.push(`${r}color3f inputs:diffuseColor = ${buildColor(e.color)}`),null!==e.emissiveMap?(A.push(`${r}color3f inputs:emissiveColor.connect = </Materials/Material_${e.id}/Texture_${e.emissiveMap.id}_emissive.outputs:rgb>`),l.push(buildTexture(e.emissiveMap,"emissive"))):e.emissive.getHex()>0&&A.push(`${r}color3f inputs:emissiveColor = ${buildColor(e.emissive)}`),null!==e.normalMap&&(A.push(`${r}normal3f inputs:normal.connect = </Materials/Material_${e.id}/Texture_${e.normalMap.id}_normal.outputs:rgb>`),l.push(buildTexture(e.normalMap,"normal"))),null!==e.aoMap&&(A.push(`${r}float inputs:occlusion.connect = </Materials/Material_${e.id}/Texture_${e.aoMap.id}_occlusion.outputs:r>`),l.push(buildTexture(e.aoMap,"occlusion"))),null!==e.roughnessMap&&1===e.roughness?(A.push(`${r}float inputs:roughness.connect = </Materials/Material_${e.id}/Texture_${e.roughnessMap.id}_roughness.outputs:g>`),l.push(buildTexture(e.roughnessMap,"roughness"))):A.push(`${r}float inputs:roughness = ${e.roughness}`),null!==e.metalnessMap&&1===e.metalness?(A.push(`${r}float inputs:metallic.connect = </Materials/Material_${e.id}/Texture_${e.metalnessMap.id}_metallic.outputs:b>`),l.push(buildTexture(e.metalnessMap,"metallic"))):A.push(`${r}float inputs:metallic = ${e.metalness}`),null!==e.alphaMap?(A.push(`${r}float inputs:opacity.connect = </Materials/Material_${e.id}/Texture_${e.alphaMap.id}_opacity.outputs:r>`),A.push(`${r}float inputs:opacityThreshold = 0.0001`),l.push(buildTexture(e.alphaMap,"opacity"))):A.push(`${r}float inputs:opacity = ${e.opacity}`),e.isMeshPhysicalMaterial&&(A.push(`${r}float inputs:clearcoat = ${e.clearcoat}`),A.push(`${r}float inputs:clearcoatRoughness = ${e.clearcoatRoughness}`),A.push(`${r}float inputs:ior = ${e.ior}`)),`\n\tdef Material "Material_${e.id}"\n\t{\n\t\tdef Shader "PreviewSurface"\n\t\t{\n\t\t\tuniform token info:id = "UsdPreviewSurface"\n${A.join("\n")}\n\t\t\tint inputs:useSpecularWorkflow = 0\n\t\t\ttoken outputs:surface\n\t\t}\n\n\t\ttoken outputs:surface.connect = </Materials/Material_${e.id}/PreviewSurface.outputs:surface>\n\n${l.join("\n")}\n\n\t}\n`}function buildColor(e){return`(${e.r}, ${e.g}, ${e.b})`}function buildVector2(e){return`(${e.x}, ${e.y})`}var MA=s(96763),ar_decorate=function(e,t,s,r){var o,A=arguments.length,l=A<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,s,r);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(l=(A<3?o(l):A>3?o(t,s,l):o(t,s))||l);return A>3&&l&&Object.defineProperty(t,s,l),l};let TA=!1,RA=!1;const DA="#model-viewer-no-ar-fallback",LA=(FA=["quick-look","scene-viewer","webxr","none"],e=>{try{const t=Wi(e),s=(t.length?t[0].terms:[]).filter((e=>e&&"ident"===e.type)).map((e=>e.value)).filter((e=>FA.indexOf(e)>-1));return new Set(s)}catch(e){}return new Set});var FA;const _A="quick-look",kA="scene-viewer",UA="webxr",GA="none",PA=Symbol("arButtonContainer"),NA=Symbol("enterARWithWebXR"),OA=Symbol("openSceneViewer"),HA=Symbol("openIOSARQuickLook"),qA=Symbol("canActivateAR"),VA=Symbol("arMode"),$A=Symbol("arModes"),JA=Symbol("arAnchor"),KA=Symbol("preload"),YA=Symbol("onARButtonContainerClick"),zA=Symbol("onARStatus"),jA=Symbol("onARTracking"),WA=Symbol("onARTap"),XA=Symbol("selectARMode"),ZA=Symbol("triggerLoad");var loading_decorate=function(e,t,s,r){var o,A=arguments.length,l=A<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,s,r);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(l=(A<3?o(l):A>3?o(t,s,l):o(t,s))||l);return A>3&&l&&Object.defineProperty(t,s,l),l};const el="auto",tl="auto",il="eager",sl=Symbol("defaultProgressBarElement"),nl=Symbol("posterContainerElement"),rl=Symbol("defaultPosterElement"),al=Symbol("shouldDismissPoster"),ol=Symbol("hidePoster"),Al=Symbol("modelIsRevealed"),ll=Symbol("updateProgressBar"),hl=Symbol("ariaLabelCallToAction"),cl=Symbol("onProgress");var staging_decorate=function(e,t,s,r){var o,A=arguments.length,l=A<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,s,r);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(l=(A<3?o(l):A>3?o(t,s,l):o(t,s))||l);return A>3&&l&&Object.defineProperty(t,s,l),l};const ul=Math.PI/32,dl={basis:[degreesToRadians(numberNode(ul,"rad"))],keywords:{auto:[null]}},gl=Symbol("autoRotateStartTime"),pl=Symbol("radiansPerSecond"),ml=Symbol("syncRotationRate"),fl=Symbol("onCameraChange"),Il=(e=>{var t,s,r;class AnnotationModelViewerElement extends e{constructor(){super(...arguments),this[t]=new Map,this[s]=e=>{e.forEach((e=>{e instanceof MutationRecord&&"childList"!==e.type||(e.addedNodes.forEach((e=>{this[tA](e)})),e.removedNodes.forEach((e=>{this[iA](e)})),this[No]())}))},this[r]=new MutationObserver(this[Zo])}connectedCallback(){super.connectedCallback();for(let e=0;e<this.children.length;++e)this[tA](this.children[e]);const{ShadyDOM:e}=self;null==e?this[eA].observe(this,{childList:!0}):this[eA]=e.observeChildren(this,this[Zo])}disconnectedCallback(){super.disconnectedCallback();const{ShadyDOM:e}=self;null==e?this[eA].disconnect():e.unobserveChildren(this[eA])}[(t=Xo,s=Zo,r=eA,Oo)](e,t){super[Oo](e,t);const s=this[Po],{annotationRenderer:r}=s,o=s.getCamera();s.shouldRender()&&(s.updateSurfaceHotspots(),s.updateHotspotsVisibility(o.position),r.domElement.style.display="",r.render(s,o))}updateHotspot(e){const t=this[Xo].get(e.name);null!=t&&(t.updatePosition(e.position),t.updateNormal(e.normal),t.surface=e.surface,this[No]())}queryHotspot(e){const t=this[Xo].get(e);if(null==t)return null;const s=toVector3D(t.position),r=toVector3D(t.normal),A=t.facingCamera,l=this[Po],h=l.getCamera(),c=new o.Pq0;c.setFromMatrixPosition(t.matrixWorld),c.project(h);const d=l.width/2,g=l.height/2;c.x=c.x*d+d,c.y=-c.y*g+g;const p=toVector3D(new o.Pq0(c.x,c.y,c.z));return Number.isFinite(p.x)&&Number.isFinite(p.y)?{position:s,normal:r,canvasPosition:p,facingCamera:A}:null}positionAndNormalFromPoint(e,t){const s=this[Po],r=s.getNDC(e,t),o=s.positionAndNormalFromPoint(r);if(null==o)return null;sA.copy(s.target.matrixWorld).invert();const A=toVector3D(o.position.applyMatrix4(sA)),l=toVector3D(o.normal.transformDirection(sA));let h=null;return null!=o.uv&&(h=toVector2D(o.uv)),{position:A,normal:l,uv:h}}surfaceFromPoint(e,t){const s=this[Po],r=s.getNDC(e,t);return s.surfaceFromPoint(r)}[tA](e){if(!(e instanceof HTMLElement&&0===e.slot.indexOf("hotspot")))return;let t=this[Xo].get(e.slot);null!=t?t.increment():(t=new Hotspot({name:e.slot,position:e.dataset.position,normal:e.dataset.normal,surface:e.dataset.surface}),this[Xo].set(e.slot,t),this[Po].addHotspot(t)),this[Po].queueRender()}[iA](e){if(!(e instanceof HTMLElement))return;const t=this[Xo].get(e.slot);t&&(t.decrement()&&(this[Po].removeHotspot(t),this[Xo].delete(e.slot)),this[Po].queueRender())}}return AnnotationModelViewerElement})((e=>{var t,s,r;class SceneGraphModelViewerElement extends e{constructor(){super(...arguments),this[t]=void 0,this[s]=null,this[r]=null,this.variantName=null,this.orientation="0 0 0",this.scale="1 1 1"}get model(){return this[_a]}get availableVariants(){return this.model?this.model[Ta]():[]}get originalGltfJson(){return this[Fa]}[(t=_a,s=La,r=Fa,ka)](){return()=>{this[No]()}}[Ua](e){return e.colorSpace=o.er$,e.wrapS=o.GJx,e.wrapT=o.GJx,new Texture(this[ka](),e)}async createTexture(e,t="image/png"){const{textureUtils:s}=this[Vo],r=await s.loadImage(e);return r.userData.mimeType=t,this[Ua](r)}async createLottieTexture(e,t=1){const{textureUtils:s}=this[Vo],r=await s.loadLottie(e,t);return this[Ua](r)}createVideoTexture(e){const t=document.createElement("video");t.crossOrigin=this.withCredentials?"use-credentials":"anonymous",t.src=e,t.muted=!0,t.playsInline=!0,t.loop=!0,t.play();const s=new o.Nv2(t);return this[Ua](s)}createCanvasTexture(){const e=document.createElement("canvas"),t=new o.GOR(e);return this[Ua](t)}async updated(e){if(super.updated(e),e.has("variantName")){const e=this[$o].beginActivity("variant-update");e(.1);const t=this[_a],{variantName:s}=this;null!=t&&(await t[Qa](s),this[No](),this.dispatchEvent(new CustomEvent("variant-applied"))),e(1)}if(e.has("orientation")||e.has("scale")){if(!this.loaded)return;const e=this[Po];e.applyTransform(),e.updateBoundingBox(),e.updateShadow(),this[Vo].arRenderer.onUpdateScene(),this[No]()}}[Ho](){super[Ho]();const{currentGLTF:e}=this[Po];if(null!=e){const{correlatedSceneGraph:t}=e;null!=t&&e!==this[La]&&(this[_a]=new Model(t,this[ka]()),this[Fa]=JSON.parse(JSON.stringify(t.gltf))),"variants"in e.userData&&this.requestUpdate("variantName")}this[La]=e}async exportScene(e){const t=this[Po];return new Promise((async(s,r)=>{const o={binary:!0,onlyVisible:!0,maxTextureSize:1/0,includeCustomExtensions:!1,forceIndices:!1};Object.assign(o,e),o.animations=t.animations,o.truncateDrawRange=!0;const A=t.shadow;let l=!1;null!=A&&(l=A.visible,A.visible=!1),await this[_a][va]();(new GLTFExporter).register((e=>new GLTFExporterMaterialsVariantsExtension(e))).parse(t.model,(e=>s(new Blob([o.binary?e:JSON.stringify(e)],{type:o.binary?"application/octet-stream":"application/json"}))),(()=>r("glTF export failed")),o),null!=A&&(A.visible=l)}))}materialFromPoint(e,t){const s=this[_a];if(null==s)return null;const r=this[Po],o=r.getNDC(e,t),A=r.hitFromPoint(o);return null==A||null==A.face?null:s[xa](A)}}return scene_graph_decorate([n({type:String,attribute:"variant-name"})],SceneGraphModelViewerElement.prototype,"variantName",void 0),scene_graph_decorate([n({type:String,attribute:"orientation"})],SceneGraphModelViewerElement.prototype,"orientation",void 0),scene_graph_decorate([n({type:String,attribute:"scale"})],SceneGraphModelViewerElement.prototype,"scale",void 0),SceneGraphModelViewerElement})((e=>{var t,s,r;class StagingModelViewerElement extends e{constructor(){super(...arguments),this.autoRotate=!1,this.autoRotateDelay=3e3,this.rotationPerSecond="auto",this[t]=performance.now(),this[s]=0,this[r]=e=>{this.autoRotate&&"user-interaction"===e.detail.source&&(this[gl]=performance.now())}}connectedCallback(){super.connectedCallback(),this.addEventListener("camera-change",this[fl]),this[gl]=performance.now()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("camera-change",this[fl]),this[gl]=performance.now()}updated(e){super.updated(e),e.has("autoRotate")&&(this[gl]=performance.now())}[(t=gl,s=pl,ml)](e){this[pl]=e[0]}[Oo](e,t){if(super[Oo](e,t),!this.autoRotate||!this[Ko]()||this[Vo].isPresenting)return;const s=Math.min(t,e-this[gl]-this.autoRotateDelay);s>0&&(this[Po].yaw=this.turntableRotation+this[pl]*s*.001)}get turntableRotation(){return this[Po].yaw}resetTurntableRotation(e=0){this[Po].yaw=e}}return r=fl,staging_decorate([n({type:Boolean,attribute:"auto-rotate"})],StagingModelViewerElement.prototype,"autoRotate",void 0),staging_decorate([n({type:Number,attribute:"auto-rotate-delay"})],StagingModelViewerElement.prototype,"autoRotateDelay",void 0),staging_decorate([style({intrinsics:dl,updateHandler:ml}),n({type:String,attribute:"rotation-per-second"})],StagingModelViewerElement.prototype,"rotationPerSecond",void 0),StagingModelViewerElement})((e=>{var t,s,r;class EnvironmentModelViewerElement extends e{constructor(){super(...arguments),this.environmentImage=null,this.skyboxImage=null,this.shadowIntensity=0,this.shadowSoftness=1,this.exposure=1,this.toneMapping="auto",this.skyboxHeight="0",this[t]=null,this[s]=null,this[r]=null}updated(e){super.updated(e),e.has("shadowIntensity")&&(this[Po].setShadowIntensity(.5*this.shadowIntensity),this[No]()),e.has("shadowSoftness")&&(this[Po].setShadowSoftness(this.shadowSoftness),this[No]()),e.has("exposure")&&(this[Po].exposure=this.exposure,this[No]()),e.has("toneMapping")&&(this[Po].toneMapping="commerce"===this.toneMapping?o.g7M:"agx"===this.toneMapping?o.LAk:o.FV,this[No]()),(e.has("environmentImage")||e.has("skyboxImage"))&&this[Yo]()&&this[ke](),e.has("skyboxHeight")&&(this[Po].setGroundedSkybox(),this[No]())}hasBakedShadow(){return this[Po].bakedShadows.size>0}async[(t=Fe,s=_e,r=Ue,ke)](){const{skyboxImage:e,environmentImage:t}=this;null!=this[Ue]&&(this[Ue](),this[Ue]=null);const{textureUtils:s}=this[Vo];if(null==s)return;const r=this[$o].beginActivity("environment-update");try{const{environmentMap:o,skybox:A}=await s.generateEnvironmentMapAndSkybox(deserializeUrl(e),t,(e=>r(clamp(e,0,1))));this[Fe]!==o&&(this[Fe]=o,this.dispatchEvent(new CustomEvent("environment-change"))),this[_e]=null!=A?A.name===o.name?o:A:null,this[Po].setEnvironmentAndSkybox(this[Fe],this[_e])}catch(e){if(e instanceof Error)throw this[Po].setEnvironmentAndSkybox(null,null),e}finally{r(1)}}}return __decorate([n({type:String,attribute:"environment-image"})],EnvironmentModelViewerElement.prototype,"environmentImage",void 0),__decorate([n({type:String,attribute:"skybox-image"})],EnvironmentModelViewerElement.prototype,"skyboxImage",void 0),__decorate([n({type:Number,attribute:"shadow-intensity"})],EnvironmentModelViewerElement.prototype,"shadowIntensity",void 0),__decorate([n({type:Number,attribute:"shadow-softness"})],EnvironmentModelViewerElement.prototype,"shadowSoftness",void 0),__decorate([n({type:Number})],EnvironmentModelViewerElement.prototype,"exposure",void 0),__decorate([n({type:String,attribute:"tone-mapping"})],EnvironmentModelViewerElement.prototype,"toneMapping",void 0),__decorate([n({type:String,attribute:"skybox-height"})],EnvironmentModelViewerElement.prototype,"skyboxHeight",void 0),EnvironmentModelViewerElement})((e=>{var t,s,r,A,l,h,c,d,g,p,m,f,I,E,C,B,y;class ControlsModelViewerElement extends e{constructor(){super(...arguments),this.cameraControls=!1,this.cameraOrbit=Us,this.cameraTarget="auto auto auto",this.fieldOfView="auto",this.minCameraOrbit="auto",this.maxCameraOrbit="auto",this.minFieldOfView="auto",this.maxFieldOfView="auto",this.interactionPromptThreshold=3e3,this.interactionPrompt=Ns,this.interactionPromptStyle=Hs,this.orbitSensitivity=1,this.zoomSensitivity=1,this.panSensitivity=1,this.touchAction=qs,this.disableZoom=!1,this.disablePan=!1,this.disableTap=!1,this.interpolationDecay=50,this[t]=this.shadowRoot.querySelector(".interaction-prompt"),this[s]=this.shadowRoot.querySelector("#prompt"),this[r]=[this.shadowRoot.querySelector("#finger0"),this.shadowRoot.querySelector("#finger1")],this[A]=this.shadowRoot.querySelector(".pan-target"),this[l]=0,this[h]=1/0,this[c]=!1,this[d]=!1,this[g]=Sn.AUTOMATIC,this[p]=new SmoothControls(this[Po].camera,this[Uo],this[Po]),this[m]=new o.YHV,this[f]=!1,this[I]=!1,this[E]=!1,this[C]=()=>{const e=this[zs].changeSource;this[cn]=e,e===Sn.USER_INTERACTION&&(this[An]=!0,this[en]())},this[B]=()=>{this[tn](),this[No]();const e=this[zs].changeSource;this.dispatchEvent(new CustomEvent("camera-change",{detail:{source:e}}))},this[y]=e=>{this[ko].classList.toggle("pointer-tumbling","pointer-change-start"===e.type)}}get inputSensitivity(){return this[zs].inputSensitivity}set inputSensitivity(e){this[zs].inputSensitivity=e}getCameraOrbit(){const{theta:e,phi:t,radius:s}=this[un];return{theta:e,phi:t,radius:s,toString(){return`${this.theta}rad ${this.phi}rad ${this.radius}m`}}}getCameraTarget(){return toVector3D(this[Vo].isPresenting?this[Vo].arRenderer.target:this[Po].getTarget())}getFieldOfView(){return this[zs].getFieldOfView()}getMinimumFieldOfView(){return this[zs].options.minimumFieldOfView}getMaximumFieldOfView(){return this[zs].options.maximumFieldOfView}getIdealAspect(){return this[Po].idealAspect}jumpCameraToGoal(){this[dn]=!0,this.requestUpdate(dn,!1)}resetInteractionPrompt(){this[hn]=0,this[ln]=1/0,this[An]=!1,this[on]=this.interactionPrompt===Ns&&this.cameraControls}zoom(e){const t=new WheelEvent("wheel",{deltaY:-30*e});this[Uo].dispatchEvent(t)}connectedCallback(){super.connectedCallback(),this[zs].addEventListener("user-interaction",this[nn]),this[zs].addEventListener("pointer-change-start",this[an]),this[zs].addEventListener("pointer-change-end",this[an])}disconnectedCallback(){super.disconnectedCallback(),this[zs].removeEventListener("user-interaction",this[nn]),this[zs].removeEventListener("pointer-change-start",this[an]),this[zs].removeEventListener("pointer-change-end",this[an])}updated(e){super.updated(e);const t=this[zs],s=this[Po];if(e.has("cameraControls")&&(this.cameraControls?(t.enableInteraction(),this.interactionPrompt===Ns&&(this[on]=!0)):(t.disableInteraction(),this[en]()),this[Uo].setAttribute("aria-label",this[Mo])),e.has("disableZoom")&&(t.disableZoom=this.disableZoom),e.has("disablePan")&&(t.enablePan=!this.disablePan),e.has("disableTap")&&(t.enableTap=!this.disableTap),(e.has("interactionPrompt")||e.has("cameraControls")||e.has("src"))&&(this.interactionPrompt===Ns&&this.cameraControls&&!this[An]?this[on]=!0:this[en]()),e.has("interactionPromptStyle")&&(this[Xs].style.opacity=this.interactionPromptStyle==Os?"1":"0"),e.has("touchAction")){const e=this.touchAction;t.applyOptions({touchAction:e}),t.updateTouchActionStyle()}e.has("orbitSensitivity")&&(t.orbitSensitivity=this.orbitSensitivity),e.has("zoomSensitivity")&&(t.zoomSensitivity=this.zoomSensitivity),e.has("panSensitivity")&&(t.panSensitivity=this.panSensitivity),e.has("interpolationDecay")&&(t.setDamperDecayTime(this.interpolationDecay),s.setTargetDamperDecayTime(this.interpolationDecay)),!0===this[dn]&&Promise.resolve().then((()=>{t.jumpToGoal(),s.jumpToGoal(),this[rn](),this[dn]=!1}))}async updateFraming(){const e=this[Po],t=e.adjustedFoV(e.framedFoVDeg);await e.updateFraming();const s=e.adjustedFoV(e.framedFoVDeg),r=this[zs].getFieldOfView()/t;this[zs].setFieldOfView(s*r),this[pn]=!0,this.requestUpdate("maxFieldOfView"),this.requestUpdate("fieldOfView"),this.requestUpdate("minCameraOrbit"),this.requestUpdate("maxCameraOrbit"),this.requestUpdate("cameraOrbit"),await this.updateComplete}interact(e,t,s){const r=this[Uo],o=this[Zs];if("1"===o[0].style.opacity)return void Fs.warn("interact() failed because an existing interaction is running.");const A=new Array;A.push({x:timeline(t.x),y:timeline(t.y)});const l=[{x:A[0].x(0),y:A[0].y(0)}];null!=s&&(A.push({x:timeline(s.x),y:timeline(s.y)}),l.push({x:A[1].x(0),y:A[1].y(0)}));let h=performance.now();const{width:c,height:d}=this[Po],g=this.getBoundingClientRect(),dispatchTouches=e=>{for(const[t,s]of l.entries()){const{style:A}=o[t];A.transform=`translateX(${c*s.x}px) translateY(${d*s.y}px)`,"pointerdown"===e?A.opacity="1":"pointerup"===e&&(A.opacity="0");const l={pointerId:t-5678,pointerType:"touch",target:r,clientX:c*s.x+g.x,clientY:d*s.y+g.y,altKey:!0};r.dispatchEvent(new PointerEvent(e,l))}},moveTouches=()=>{const t=this[cn];if(t!==Sn.AUTOMATIC||!r.isConnected){for(const e of this[Zs])e.style.opacity="0";return dispatchTouches("pointercancel"),this.dispatchEvent(new CustomEvent("interact-stopped",{detail:{source:t}})),void document.removeEventListener("visibilitychange",onVisibilityChange)}const s=Math.min(1,(performance.now()-h)/e);for(const[e,t]of l.entries())t.x=A[e].x(s),t.y=A[e].y(s);dispatchTouches("pointermove"),s<1?requestAnimationFrame(moveTouches):(dispatchTouches("pointerup"),this.dispatchEvent(new CustomEvent("interact-stopped",{detail:{source:Sn.AUTOMATIC}})),document.removeEventListener("visibilitychange",onVisibilityChange))},onVisibilityChange=()=>{let e=0;"hidden"===document.visibilityState?e=performance.now()-h:h=performance.now()-e};document.addEventListener("visibilitychange",onVisibilityChange),dispatchTouches("pointerdown"),this[cn]=Sn.AUTOMATIC,requestAnimationFrame(moveTouches)}[(t=Ws,s=Xs,r=Zs,A=js,l=hn,h=ln,c=An,d=on,g=cn,p=zs,m=un,f=dn,I=gn,E=pn,fn)](e){const t=this[zs],s=this[Po];s.framedFoVDeg=180*e[0]/Math.PI,t.changeSource=Sn.NONE,t.setFieldOfView(s.adjustedFoV(s.framedFoVDeg)),this[nn]()}[mn](e){const t=this[zs];if(this[pn]){const{theta:t,phi:s}=this.getCameraOrbit();e[0]=t,e[1]=s,this[pn]=!1}t.changeSource=Sn.NONE,t.setOrbit(e[0],e[1],e[2]),this[nn]()}[En](e){this[zs].applyOptions({minimumAzimuthalAngle:e[0],minimumPolarAngle:e[1],minimumRadius:e[2]}),this.jumpCameraToGoal()}[Cn](e){this[zs].applyOptions({maximumAzimuthalAngle:e[0],maximumPolarAngle:e[1],maximumRadius:e[2]}),this[sn](e[2]),this.jumpCameraToGoal()}[Bn](e){this[zs].applyOptions({minimumFieldOfView:180*e[0]/Math.PI}),this.jumpCameraToGoal()}[yn](e){const t=this[Po].adjustedFoV(180*e[0]/Math.PI);this[zs].applyOptions({maximumFieldOfView:t}),this.jumpCameraToGoal()}[In](e){const[t,s,r]=e;this[Vo].arRenderer.isPresenting||this[Po].setTarget(t,s,r),this[zs].changeSource=Sn.NONE,this[Vo].arRenderer.updateTarget(),this[nn]()}[Oo](e,t){if(super[Oo](e,t),this[Vo].isPresenting||!this[Ko]())return;const s=this[zs],r=this[Po],o=performance.now();if(this[on]&&this.loaded&&o>this[Lo]+this.interactionPromptThreshold&&(this[on]=!1,this[ln]=o,this[Ws].classList.add("visible")),isFinite(this[ln])&&this.interactionPromptStyle===Hs){const e=(o-this[ln])/5e3%1,t=_s(e),A=ks(e);if(this[Xs].style.opacity=`${A}`,t!==this[hn]){const e=t*r.width*.05,o=(t-this[hn])*Math.PI/16;this[Xs].style.transform=`translateX(${e}px)`,s.changeSource=Sn.AUTOMATIC,s.adjustOrbit(o,0,0),this[hn]=t}}const A=s.update(e,t),l=r.updateTarget(t);(A||l)&&this[rn]()}[en](){this[on]=!1,this[Ws].classList.remove("visible"),this[ln]=1/0}[sn](e){const t=Math.max(this[Po].farRadius(),e),s=Math.abs(2*t);this[zs].updateNearFar(0,s)}[tn](){const{theta:e,phi:t}=this[zs].getCameraSpherical(this[un]),s=(4+Math.floor((e%Ys+Ks)/$s))%4,r=Math.floor(t/Js),o=Gs[s],A=Ps[r];this[Do](`View from stage ${A}${o}`)}get[Mo](){return super[Mo].replace(/\.$/,"")+(this.cameraControls?". Use mouse, touch or arrow keys to move.":"")}async[qo](e){const t=this[zs],s=this[Po],r=s.adjustedFoV(s.framedFoVDeg);super[qo](e);const o=s.adjustedFoV(s.framedFoVDeg)/r,A=t.getFieldOfView()*(isFinite(o)?o:1);t.updateAspect(this[Po].aspect),this.requestUpdate("maxFieldOfView",this.maxFieldOfView),await this.updateComplete,this[zs].setFieldOfView(A),this.jumpCameraToGoal()}[Ho](){super[Ho](),this[gn]?this[pn]=!0:this[gn]=!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()}}return C=nn,B=rn,y=an,controls_decorate([n({type:Boolean,attribute:"camera-controls"})],ControlsModelViewerElement.prototype,"cameraControls",void 0),controls_decorate([style({intrinsics:Vs,observeEffects:!0,updateHandler:mn}),n({type:String,attribute:"camera-orbit",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"cameraOrbit",void 0),controls_decorate([style({intrinsics:cameraTargetIntrinsics,observeEffects:!0,updateHandler:In}),n({type:String,attribute:"camera-target",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"cameraTarget",void 0),controls_decorate([style({intrinsics:fieldOfViewIntrinsics,observeEffects:!0,updateHandler:fn}),n({type:String,attribute:"field-of-view",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"fieldOfView",void 0),controls_decorate([style({intrinsics:minCameraOrbitIntrinsics,updateHandler:En}),n({type:String,attribute:"min-camera-orbit",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"minCameraOrbit",void 0),controls_decorate([style({intrinsics:maxCameraOrbitIntrinsics,updateHandler:Cn}),n({type:String,attribute:"max-camera-orbit",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"maxCameraOrbit",void 0),controls_decorate([style({intrinsics:minFieldOfViewIntrinsics,updateHandler:Bn}),n({type:String,attribute:"min-field-of-view",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"minFieldOfView",void 0),controls_decorate([style({intrinsics:fieldOfViewIntrinsics,updateHandler:yn}),n({type:String,attribute:"max-field-of-view",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"maxFieldOfView",void 0),controls_decorate([n({type:Number,attribute:"interaction-prompt-threshold"})],ControlsModelViewerElement.prototype,"interactionPromptThreshold",void 0),controls_decorate([n({type:String,attribute:"interaction-prompt"})],ControlsModelViewerElement.prototype,"interactionPrompt",void 0),controls_decorate([n({type:String,attribute:"interaction-prompt-style"})],ControlsModelViewerElement.prototype,"interactionPromptStyle",void 0),controls_decorate([n({type:Number,attribute:"orbit-sensitivity"})],ControlsModelViewerElement.prototype,"orbitSensitivity",void 0),controls_decorate([n({type:Number,attribute:"zoom-sensitivity"})],ControlsModelViewerElement.prototype,"zoomSensitivity",void 0),controls_decorate([n({type:Number,attribute:"pan-sensitivity"})],ControlsModelViewerElement.prototype,"panSensitivity",void 0),controls_decorate([n({type:String,attribute:"touch-action"})],ControlsModelViewerElement.prototype,"touchAction",void 0),controls_decorate([n({type:Boolean,attribute:"disable-zoom"})],ControlsModelViewerElement.prototype,"disableZoom",void 0),controls_decorate([n({type:Boolean,attribute:"disable-pan"})],ControlsModelViewerElement.prototype,"disablePan",void 0),controls_decorate([n({type:Boolean,attribute:"disable-tap"})],ControlsModelViewerElement.prototype,"disableTap",void 0),controls_decorate([n({type:Number,attribute:"interpolation-decay"})],ControlsModelViewerElement.prototype,"interpolationDecay",void 0),ControlsModelViewerElement})((e=>{var t,s,r,o,A,l,h,c,d,g;class ARModelViewerElement extends e{constructor(){super(...arguments),this.ar=!1,this.arScale="auto",this.arPlacement="floor",this.arModes="webxr scene-viewer quick-look",this.iosSrc=null,this.xrEnvironment=!1,this[t]=!1,this[s]=this.shadowRoot.querySelector(".ar-button"),this[r]=document.createElement("a"),this[o]=new Set,this[A]=GA,this[l]=!1,this[h]=e=>{e.preventDefault(),this.activateAR()},this[c]=({status:e})=>{e!==Rn&&this[Vo].arRenderer.presentedScene!==this[Po]||(this.setAttribute("ar-status",e),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:e}})),e===Rn?this.removeAttribute("ar-tracking"):e===Dn&&this.setAttribute("ar-tracking",_n))},this[d]=({status:e})=>{this.setAttribute("ar-tracking",e),this.dispatchEvent(new CustomEvent("ar-tracking",{detail:{status:e}}))},this[g]=e=>{"_apple_ar_quicklook_button_tapped"==e.data&&this.dispatchEvent(new CustomEvent("quick-look-button-tapped"))}}get canActivateAR(){return this[VA]!==GA}connectedCallback(){super.connectedCallback(),this[Vo].arRenderer.addEventListener("status",this[zA]),this.setAttribute("ar-status",Rn),this[Vo].arRenderer.addEventListener("tracking",this[jA]),this[JA].addEventListener("message",this[WA])}disconnectedCallback(){super.disconnectedCallback(),this[Vo].arRenderer.removeEventListener("status",this[zA]),this[Vo].arRenderer.removeEventListener("tracking",this[jA]),this[JA].removeEventListener("message",this[WA])}update(e){super.update(e),e.has("arScale")&&(this[Po].canScale="fixed"!==this.arScale),e.has("arPlacement")&&(this[Po].updateShadow(),this[No]()),e.has("arModes")&&(this[$A]=LA(this.arModes)),(e.has("ar")||e.has("arModes")||e.has("src")||e.has("iosSrc"))&&this[XA]()}async activateAR(){switch(this[VA]){case _A:await this[HA]();break;case UA:await this[NA]();break;case kA:this[OA]();break;default:MA.warn("No AR Mode can be activated. This is probably due to missing configuration or device capabilities")}}async[(t=qA,s=PA,r=JA,o=$A,A=VA,l=KA,h=YA,c=zA,d=jA,g=WA,XA)](){let e=GA;if(this.ar){if(null!=this.src)for(const t of this[$A]){if("webxr"===t&&we&&!TA&&await this[Vo].arRenderer.supportsPresentation()){e=UA;break}if("scene-viewer"===t&&Se&&!RA){e=kA;break}if("quick-look"===t&&Te){e=_A;break}}e===GA&&null!=this.iosSrc&&Te&&(e=_A)}if(e!==GA)this[PA].classList.add("enabled"),this[PA].addEventListener("click",this[YA]);else if(this[PA].classList.contains("enabled")){this[PA].removeEventListener("click",this[YA]),this[PA].classList.remove("enabled");const e=Fn;this.setAttribute("ar-status",e),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:e}}))}this[VA]=e}async[NA](){MA.log("Attempting to present in AR with WebXR..."),await this[ZA]();try{this[PA].removeEventListener("click",this[YA]);const{arRenderer:e}=this[Vo];e.placeOnWall="wall"===this.arPlacement,await e.present(this[Po],this.xrEnvironment)}catch(e){MA.warn("Error while trying to present in AR with WebXR"),MA.error(e),await this[Vo].arRenderer.stopPresenting(),TA=!0,MA.warn("Falling back to next ar-mode"),await this[XA](),this.activateAR()}finally{this[XA]()}}async[ZA](){this.loaded||(this[KA]=!0,this[Fo](),await((e,t,s=null)=>new Promise((r=>{e.addEventListener(t,(function handler(o){s&&!s(o)||(r(o),e.removeEventListener(t,handler))}))})))(this,"load"),this[KA]=!1)}[Yo](){return super[Yo]()||this[KA]}[OA](){const e=self.location.toString(),t=new URL(e),s=new URL(this.src,e);s.hash&&(s.hash="");const r=new URLSearchParams(s.search);if(t.hash=DA,r.set("mode","ar_preferred"),r.has("disable_occlusion")||r.set("disable_occlusion","true"),"fixed"===this.arScale&&r.set("resizable","false"),"wall"===this.arPlacement&&r.set("enable_vertical_placement","true"),r.has("sound")){const t=new URL(r.get("sound"),e);r.set("sound",t.toString())}if(r.has("link")){const t=new URL(r.get("link"),e);r.set("link",t.toString())}const o=`intent://arvr.google.com/scene-viewer/1.0?${r.toString()+"&file="+encodeURIComponent(s.toString())}#Intent;scheme=https;package=com.google.ar.core;action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(t.toString())};end;`;self.addEventListener("hashchange",(()=>{self.location.hash===DA&&(RA=!0,self.history.back(),MA.warn("Error while trying to present in AR with Scene Viewer"),MA.warn("Falling back to next ar-mode"),this[XA]())}),{once:!0}),this[JA].setAttribute("href",o),MA.log("Attempting to present in AR with Scene Viewer..."),this[JA].click()}async[HA](){const e=!this.iosSrc;this[PA].classList.remove("enabled");const t=e?await this.prepareUSDZ():this.iosSrc,s=new URL(t,self.location.toString());if(e){const e=self.location.toString(),t=new URL(e),r=new URL(this.src,t);r.hash&&(s.hash=r.hash)}"fixed"===this.arScale&&(s.hash&&(s.hash+="&"),s.hash+="allowsContentScaling=0");const r=this[JA];r.setAttribute("rel","ar");const o=document.createElement("img");r.appendChild(o),r.setAttribute("href",s.toString()),e&&r.setAttribute("download","model.usdz"),r.style.display="none",r.isConnected||this.shadowRoot.appendChild(r),MA.log("Attempting to present in AR with Quick Look..."),r.click(),r.removeChild(o),e&&URL.revokeObjectURL(t),this[PA].classList.add("enabled")}async prepareUSDZ(){const e=this[$o].beginActivity("usdz-conversion");await this[ZA]();const{model:t,shadow:s}=this[Po];if(null==t)return"";let r=!1;null!=s&&(r=s.visible,s.visible=!1),e(.2);const o=new USDZExporter,A=await o.parse(t),l=new Blob([A],{type:"model/vnd.usdz+zip"}),h=URL.createObjectURL(l);return e(1),null!=s&&(s.visible=r),h}}return ar_decorate([n({type:Boolean,attribute:"ar"})],ARModelViewerElement.prototype,"ar",void 0),ar_decorate([n({type:String,attribute:"ar-scale"})],ARModelViewerElement.prototype,"arScale",void 0),ar_decorate([n({type:String,attribute:"ar-placement"})],ARModelViewerElement.prototype,"arPlacement",void 0),ar_decorate([n({type:String,attribute:"ar-modes"})],ARModelViewerElement.prototype,"arModes",void 0),ar_decorate([n({type:String,attribute:"ios-src"})],ARModelViewerElement.prototype,"iosSrc",void 0),ar_decorate([n({type:Boolean,attribute:"xr-environment"})],ARModelViewerElement.prototype,"xrEnvironment",void 0),ARModelViewerElement})((e=>{var t,s,r,A,l,h,c,d;class LoadingModelViewerElement extends e{constructor(...e){super(...e),this.poster=null,this.reveal=el,this.loading=tl,this[t]=!1,this[s]=!1,this[r]=this.shadowRoot.querySelector(".slot.poster"),this[A]=this.shadowRoot.querySelector("#default-poster"),this[l]=this.shadowRoot.querySelector("#default-progress-bar > .bar"),this[h]=this[rl].getAttribute("aria-label"),this[c]=((e,t)=>{let s=null;const throttled=(...r)=>{null==s&&(e(...r),s=self.setTimeout((()=>s=null),t))};return throttled.flush=()=>{null!=s&&(self.clearTimeout(s),s=null)},throttled})((e=>{const t=this[sl].parentNode;requestAnimationFrame((()=>{this[sl].style.transform=`scaleX(${e})`,0===e&&(t.removeChild(this[sl]),t.appendChild(this[sl])),this[sl].classList.toggle("hide",1===e)}))}),100),this[d]=e=>{const t=e.detail.totalProgress;1===t&&(this[ll].flush(),this.loaded&&(this[al]||this.reveal===el)&&this[ol]()),this[ll](t),this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:t}}))};const o=self.ModelViewerElement||{},g=o.dracoDecoderLocation||"https://www.gstatic.com/draco/versioned/decoders/1.5.6/";CachingGLTFLoader.setDRACODecoderLocation(g);const p=o.ktx2TranscoderLocation||"https://www.gstatic.com/basis-universal/versioned/2021-04-15-ba1c3e4/";CachingGLTFLoader.setKTX2TranscoderLocation(p),o.meshoptDecoderLocation&&CachingGLTFLoader.setMeshoptDecoderLocation(o.meshoptDecoderLocation);const m=o.lottieLoaderLocation||"https://cdn.jsdelivr.net/npm/three@0.149.0/examples/jsm/loaders/LottieLoader.js";Renderer.singleton.textureUtils.lottieLoaderUrl=m}static set dracoDecoderLocation(e){CachingGLTFLoader.setDRACODecoderLocation(e)}static get dracoDecoderLocation(){return CachingGLTFLoader.getDRACODecoderLocation()}static set ktx2TranscoderLocation(e){CachingGLTFLoader.setKTX2TranscoderLocation(e)}static get ktx2TranscoderLocation(){return CachingGLTFLoader.getKTX2TranscoderLocation()}static set meshoptDecoderLocation(e){CachingGLTFLoader.setMeshoptDecoderLocation(e)}static get meshoptDecoderLocation(){return CachingGLTFLoader.getMeshoptDecoderLocation()}static set lottieLoaderLocation(e){Renderer.singleton.textureUtils.lottieLoaderUrl=e}static get lottieLoaderLocation(){return Renderer.singleton.textureUtils.lottieLoaderUrl}static mapURLs(e){Renderer.singleton.loader[si].manager.setURLModifier(e)}dismissPoster(){this.loaded?this[ol]():(this[al]=!0,this[Fo]())}showPoster(){const e=this[nl];if(e.classList.contains("show"))return;e.classList.add("show"),this[Uo].classList.remove("show");const t=this[rl];t.removeAttribute("tabindex"),t.removeAttribute("aria-hidden");const s=this.modelIsVisible;this[Al]=!1,this[So](s)}getDimensions(){return toVector3D(this[Po].size)}getBoundingBoxCenter(){return toVector3D(this[Po].boundingBox.getCenter(new o.Pq0))}connectedCallback(){super.connectedCallback(),this.loaded||this.showPoster(),this[$o].addEventListener("progress",this[cl])}disconnectedCallback(){super.disconnectedCallback(),this[$o].removeEventListener("progress",this[cl])}async updated(e){super.updated(e),e.has("poster")&&null!=this.poster&&(this[rl].style.backgroundImage=`url(${this.poster})`),e.has("alt")&&this[rl].setAttribute("aria-label",this[To]),(e.has("reveal")||e.has("loading"))&&this[Fo]()}[(t=Al,s=al,r=nl,A=rl,l=sl,h=hl,c=ll,d=cl,Yo)](){return!!this.src&&(this[al]||this.loading===il||this.reveal===el&&this[bo])}[ol](){this[al]=!1;const e=this[nl];if(!e.classList.contains("show"))return;e.classList.remove("show"),this[Uo].classList.add("show");const t=this.modelIsVisible;this[Al]=!0,this[So](t);const s=this.getRootNode();s&&s.activeElement===this&&this[Uo].focus();const r=this[rl];r.setAttribute("aria-hidden","true"),r.tabIndex=-1,this.dispatchEvent(new CustomEvent("poster-dismissed"))}[Ko](){return super[Ko]()&&this[Al]}}return loading_decorate([n({type:String})],LoadingModelViewerElement.prototype,"poster",void 0),loading_decorate([n({type:String})],LoadingModelViewerElement.prototype,"reveal",void 0),loading_decorate([n({type:String})],LoadingModelViewerElement.prototype,"loading",void 0),LoadingModelViewerElement})((e=>{var t;class AnimationModelViewerElement extends e{constructor(...e){super(e),this.autoplay=!1,this.animationName=void 0,this.animationCrossfadeDuration=300,this[t]=!0,this[Po].subscribeMixerEvent("loop",(e=>{const t=e.action._loopCount;this.dispatchEvent(new CustomEvent("loop",{detail:{count:t}}))})),this[Po].subscribeMixerEvent("finished",(()=>{this[jo]=!0,this.dispatchEvent(new CustomEvent("finished"))}))}get availableAnimations(){return this.loaded?this[Po].animationNames:[]}get duration(){return this[Po].duration}get paused(){return this[jo]}get currentTime(){return this[Po].animationTime}set currentTime(e){this[Po].animationTime=e,this[No]()}get timeScale(){return this[Po].animationTimeScale}set timeScale(e){this[Po].animationTimeScale=e}pause(){this[jo]||(this[jo]=!0,this.dispatchEvent(new CustomEvent("pause")))}play(e){this.availableAnimations.length>0&&(this[jo]=!1,this[zo](e),this.dispatchEvent(new CustomEvent("play")))}[(t=jo,Ho)](){super[Ho](),this[jo]=!0,null!=this.animationName&&this[zo](),this.autoplay&&this.play()}[Oo](e,t){super[Oo](e,t),this[jo]||!this[Ko]()&&!this[Vo].isPresenting||(this[Po].updateAnimation(t/1e3),this[No]())}updated(e){super.updated(e),e.has("autoplay")&&this.autoplay&&this.play(),e.has("animationName")&&this[zo]()}[zo](e=Wo){var t;const s=null!==(t=e.repetitions)&&void 0!==t?t:1/0,r=e.pingpong?o.lc7:1===s?o.G3T:o.aMy;this[Po].playAnimation(this.animationName,this.animationCrossfadeDuration/1e3,r,s),this[jo]&&(this[Po].updateAnimation(0),this[No]())}}return animation_decorate([n({type:Boolean})],AnimationModelViewerElement.prototype,"autoplay",void 0),animation_decorate([n({type:String,attribute:"animation-name"})],AnimationModelViewerElement.prototype,"animationName",void 0),animation_decorate([n({type:Number,attribute:"animation-crossfade-duration"})],AnimationModelViewerElement.prototype,"animationCrossfadeDuration",void 0),AnimationModelViewerElement})(ModelViewerElementBase))))))));customElements.define("model-viewer",Il)}}]);
|
|
408
|
+
</div>`;var Pe=s(96763);const Ne=new WeakMap;class DRACOLoader extends o.aHM{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,s,r){const A=new o.Y9S(this.manager);A.setPath(this.path),A.setResponseType("arraybuffer"),A.setRequestHeader(this.requestHeader),A.setWithCredentials(this.withCredentials),A.load(e,(e=>{this.parse(e,t,r)}),s,r)}parse(e,t,s=()=>{}){this.decodeDracoFile(e,t,null,null,o.er$).catch(s)}decodeDracoFile(e,t,s,r,A=o.Zr2,l=()=>{}){const h={attributeIDs:s||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!s,vertexColorSpace:A};return this.decodeGeometry(e,h).then(t).catch(l)}decodeGeometry(e,t){const s=JSON.stringify(t);if(Ne.has(e)){const t=Ne.get(e);if(t.key===s)return t.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let r;const o=this.workerNextTaskID++,A=e.byteLength,l=this._getWorker(o,A).then((s=>(r=s,new Promise(((s,A)=>{r._callbacks[o]={resolve:s,reject:A},r.postMessage({type:"decode",id:o,taskConfig:t,buffer:e},[e])}))))).then((e=>this._createGeometry(e.geometry)));return l.catch((()=>!0)).then((()=>{r&&o&&this._releaseTask(r,o)})),Ne.set(e,{key:s,promise:l}),l}_createGeometry(e){const t=new o.LoY;e.index&&t.setIndex(new o.THS(e.index.array,1));for(let s=0;s<e.attributes.length;s++){const r=e.attributes[s],A=r.name,l=r.array,h=r.itemSize,c=new o.THS(l,h);"color"===A&&(this._assignVertexColorSpace(c,r.vertexColorSpace),c.normalized=l instanceof Float32Array==!1),t.setAttribute(A,c)}return t}_assignVertexColorSpace(e,t){if(t!==o.er$)return;const s=new o.Q1f;for(let t=0,r=e.count;t<r;t++)s.fromBufferAttribute(e,t).convertSRGBToLinear(),e.setXYZ(t,s.r,s.g,s.b)}_loadLibrary(e,t){const s=new o.Y9S(this.manager);return s.setPath(this.decoderPath),s.setResponseType(t),s.setWithCredentials(this.withCredentials),new Promise(((t,r)=>{s.load(e,t,void 0,r)}))}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then((t=>{const s=t[0];e||(this.decoderConfig.wasmBinary=t[1]);const r=DRACOWorker.toString(),o=["/* draco decoder */",s,"","/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([o]))})),this.decoderPending}_getWorker(e,t){return this._initDecoder().then((()=>{if(this.workerPool.length<this.workerLimit){const e=new Worker(this.workerSourceURL);e._callbacks={},e._taskCosts={},e._taskLoad=0,e.postMessage({type:"init",decoderConfig:this.decoderConfig}),e.onmessage=function(t){const s=t.data;switch(s.type){case"decode":e._callbacks[s.id].resolve(s);break;case"error":e._callbacks[s.id].reject(s);break;default:Pe.error('THREE.DRACOLoader: Unexpected message, "'+s.type+'"')}},this.workerPool.push(e)}else this.workerPool.sort((function(e,t){return e._taskLoad>t._taskLoad?-1:1}));const s=this.workerPool[this.workerPool.length-1];return s._taskCosts[e]=t,s._taskLoad+=t,s}))}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){Pe.log("Task load: ",this.workerPool.map((e=>e._taskLoad)))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,""!==this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),this}}function DRACOWorker(){let e,t;function decodeAttribute(e,t,s,r,o,A){const l=A.num_components(),h=s.num_points()*l,c=h*o.BYTES_PER_ELEMENT,d=function getDracoDataType(e,t){switch(t){case Float32Array:return e.DT_FLOAT32;case Int8Array:return e.DT_INT8;case Int16Array:return e.DT_INT16;case Int32Array:return e.DT_INT32;case Uint8Array:return e.DT_UINT8;case Uint16Array:return e.DT_UINT16;case Uint32Array:return e.DT_UINT32}}(e,o),g=e._malloc(c);t.GetAttributeDataArrayForAllPoints(s,A,d,c,g);const p=new o(e.HEAPF32.buffer,g,h).slice();return e._free(g),{name:r,array:p,itemSize:l}}onmessage=function(s){const r=s.data;switch(r.type){case"init":e=r.decoderConfig,t=new Promise((function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)}));break;case"decode":const s=r.buffer,o=r.taskConfig;t.then((e=>{const t=e.draco,A=new t.Decoder;try{const e=function decodeGeometry(e,t,s,r){const o=r.attributeIDs,A=r.attributeTypes;let l,h;const c=t.GetEncodedGeometryType(s);if(c===e.TRIANGULAR_MESH)l=new e.Mesh,h=t.DecodeArrayToMesh(s,s.byteLength,l);else{if(c!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");l=new e.PointCloud,h=t.DecodeArrayToPointCloud(s,s.byteLength,l)}if(!h.ok()||0===l.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+h.error_msg());const d={index:null,attributes:[]};for(const s in o){const h=self[A[s]];let c,g;if(r.useUniqueIDs)g=o[s],c=t.GetAttributeByUniqueId(l,g);else{if(g=t.GetAttributeId(l,e[o[s]]),-1===g)continue;c=t.GetAttribute(l,g)}const p=decodeAttribute(e,t,l,s,h,c);"color"===s&&(p.vertexColorSpace=r.vertexColorSpace),d.attributes.push(p)}c===e.TRIANGULAR_MESH&&(d.index=function decodeIndex(e,t,s){const r=s.num_faces(),o=3*r,A=4*o,l=e._malloc(A);t.GetTrianglesUInt32Array(s,A,l);const h=new Uint32Array(e.HEAPF32.buffer,l,o).slice();return e._free(l),{array:h,itemSize:1}}(e,t,l));return e.destroy(l),d}(t,A,new Int8Array(s),o),l=e.attributes.map((e=>e.array.buffer));e.index&&l.push(e.index.array.buffer),self.postMessage({type:"decode",id:r.id,geometry:e},l)}catch(e){Pe.error(e),self.postMessage({type:"error",id:r.id,error:e.message})}finally{t.destroy(A)}}))}}}var Oe=s(96763);function toTrianglesDrawMode(e,t){if(t===o.RJ4)return Oe.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(t===o.rYR||t===o.O49){let s=e.getIndex();if(null===s){const t=[],r=e.getAttribute("position");if(void 0===r)return Oe.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e<r.count;e++)t.push(e);e.setIndex(t),s=e.getIndex()}const r=s.count-2,A=[];if(t===o.rYR)for(let e=1;e<=r;e++)A.push(s.getX(0)),A.push(s.getX(e)),A.push(s.getX(e+1));else for(let e=0;e<r;e++)e%2==0?(A.push(s.getX(e)),A.push(s.getX(e+1)),A.push(s.getX(e+2))):(A.push(s.getX(e+2)),A.push(s.getX(e+1)),A.push(s.getX(e)));A.length/3!==r&&Oe.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const l=e.clone();return l.setIndex(A),l.clearGroups(),l}return Oe.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e}var He=s(96763);class GLTFLoader extends o.aHM{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register((function(e){return new GLTFMaterialsClearcoatExtension(e)})),this.register((function(e){return new GLTFTextureBasisUExtension(e)})),this.register((function(e){return new GLTFTextureWebPExtension(e)})),this.register((function(e){return new GLTFTextureAVIFExtension(e)})),this.register((function(e){return new GLTFMaterialsSheenExtension(e)})),this.register((function(e){return new GLTFMaterialsTransmissionExtension(e)})),this.register((function(e){return new GLTFMaterialsVolumeExtension(e)})),this.register((function(e){return new GLTFMaterialsIorExtension(e)})),this.register((function(e){return new GLTFMaterialsEmissiveStrengthExtension(e)})),this.register((function(e){return new GLTFMaterialsSpecularExtension(e)})),this.register((function(e){return new GLTFMaterialsIridescenceExtension(e)})),this.register((function(e){return new GLTFMaterialsAnisotropyExtension(e)})),this.register((function(e){return new GLTFMaterialsBumpExtension(e)})),this.register((function(e){return new GLTFLightsExtension(e)})),this.register((function(e){return new GLTFMeshoptCompression(e)})),this.register((function(e){return new GLTFMeshGpuInstancing(e)}))}load(e,t,s,r){const A=this;let l;if(""!==this.resourcePath)l=this.resourcePath;else if(""!==this.path){const t=o.r6x.extractUrlBase(e);l=o.r6x.resolveURL(t,this.path)}else l=o.r6x.extractUrlBase(e);this.manager.itemStart(e);const _onError=function(t){r?r(t):He.error(t),A.manager.itemError(e),A.manager.itemEnd(e)},h=new o.Y9S(this.manager);h.setPath(this.path),h.setResponseType("arraybuffer"),h.setRequestHeader(this.requestHeader),h.setWithCredentials(this.withCredentials),h.load(e,(function(s){try{A.parse(s,l,(function(s){t(s),A.manager.itemEnd(e)}),_onError)}catch(e){_onError(e)}}),s,_onError)}setDRACOLoader(e){return this.dracoLoader=e,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,s,r){let o;const A={},l={},h=new TextDecoder;if("string"==typeof e)o=JSON.parse(e);else if(e instanceof ArrayBuffer){if(h.decode(new Uint8Array(e,0,4))===Ve){try{A[qe.KHR_BINARY_GLTF]=new GLTFBinaryExtension(e)}catch(e){return void(r&&r(e))}o=JSON.parse(A[qe.KHR_BINARY_GLTF].content)}else o=JSON.parse(h.decode(e))}else o=e;if(void 0===o.asset||o.asset.version[0]<2)return void(r&&r(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")));const c=new GLTFParser(o,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e<this.pluginCallbacks.length;e++){const t=this.pluginCallbacks[e](c);t.name||He.error("THREE.GLTFLoader: Invalid plugin found: missing name"),l[t.name]=t,A[t.name]=!0}if(o.extensionsUsed)for(let e=0;e<o.extensionsUsed.length;++e){const t=o.extensionsUsed[e],s=o.extensionsRequired||[];switch(t){case qe.KHR_MATERIALS_UNLIT:A[t]=new GLTFMaterialsUnlitExtension;break;case qe.KHR_DRACO_MESH_COMPRESSION:A[t]=new GLTFDracoMeshCompressionExtension(o,this.dracoLoader);break;case qe.KHR_TEXTURE_TRANSFORM:A[t]=new GLTFTextureTransformExtension;break;case qe.KHR_MESH_QUANTIZATION:A[t]=new GLTFMeshQuantizationExtension;break;default:s.indexOf(t)>=0&&void 0===l[t]&&He.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}c.setExtensions(A),c.setPlugins(l),c.parse(s,r)}parseAsync(e,t){const s=this;return new Promise((function(r,o){s.parse(e,t,r,o)}))}}function GLTFRegistry(){let e={};return{get:function(t){return e[t]},add:function(t,s){e[t]=s},remove:function(t){delete e[t]},removeAll:function(){e={}}}}const qe={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_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class GLTFLightsExtension{constructor(e){this.parser=e,this.name=qe.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let s=0,r=t.length;s<r;s++){const r=t[s];r.extensions&&r.extensions[this.name]&&void 0!==r.extensions[this.name].light&&e._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(e){const t=this.parser,s="light:"+e;let r=t.cache.get(s);if(r)return r;const A=t.json,l=((A.extensions&&A.extensions[this.name]||{}).lights||[])[e];let h;const c=new o.Q1f(16777215);void 0!==l.color&&c.setRGB(l.color[0],l.color[1],l.color[2],o.Zr2);const d=void 0!==l.range?l.range:0;switch(l.type){case"directional":h=new o.ZyN(c),h.target.position.set(0,0,-1),h.add(h.target);break;case"point":h=new o.HiM(c),h.distance=d;break;case"spot":h=new o.nCl(c),h.distance=d,l.spot=l.spot||{},l.spot.innerConeAngle=void 0!==l.spot.innerConeAngle?l.spot.innerConeAngle:0,l.spot.outerConeAngle=void 0!==l.spot.outerConeAngle?l.spot.outerConeAngle:Math.PI/4,h.angle=l.spot.outerConeAngle,h.penumbra=1-l.spot.innerConeAngle/l.spot.outerConeAngle,h.target.position.set(0,0,-1),h.add(h.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+l.type)}return h.position.set(0,0,0),h.decay=2,assignExtrasToUserData(h,l),void 0!==l.intensity&&(h.intensity=l.intensity),h.name=t.createUniqueName(l.name||"light_"+e),r=Promise.resolve(h),t.cache.add(s,r),r}getDependency(e,t){if("light"===e)return this._loadLight(t)}createNodeAttachment(e){const t=this,s=this.parser,r=s.json.nodes[e],o=(r.extensions&&r.extensions[this.name]||{}).light;return void 0===o?null:this._loadLight(o).then((function(e){return s._getNodeRef(t.cache,o,e)}))}}class GLTFMaterialsUnlitExtension{constructor(){this.name=qe.KHR_MATERIALS_UNLIT}getMaterialType(){return o.V9B}extendParams(e,t,s){const r=[];e.color=new o.Q1f(1,1,1),e.opacity=1;const A=t.pbrMetallicRoughness;if(A){if(Array.isArray(A.baseColorFactor)){const t=A.baseColorFactor;e.color.setRGB(t[0],t[1],t[2],o.Zr2),e.opacity=t[3]}void 0!==A.baseColorTexture&&r.push(s.assignTexture(e,"map",A.baseColorTexture,o.er$))}return Promise.all(r)}}class GLTFMaterialsEmissiveStrengthExtension{constructor(e){this.parser=e,this.name=qe.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const s=this.parser.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=s.extensions[this.name].emissiveStrength;return void 0!==r&&(t.emissiveIntensity=r),Promise.resolve()}}class GLTFMaterialsClearcoatExtension{constructor(e){this.parser=e,this.name=qe.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.uSd:null}extendMaterialParams(e,t){const s=this.parser,r=s.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const A=[],l=r.extensions[this.name];if(void 0!==l.clearcoatFactor&&(t.clearcoat=l.clearcoatFactor),void 0!==l.clearcoatTexture&&A.push(s.assignTexture(t,"clearcoatMap",l.clearcoatTexture)),void 0!==l.clearcoatRoughnessFactor&&(t.clearcoatRoughness=l.clearcoatRoughnessFactor),void 0!==l.clearcoatRoughnessTexture&&A.push(s.assignTexture(t,"clearcoatRoughnessMap",l.clearcoatRoughnessTexture)),void 0!==l.clearcoatNormalTexture&&(A.push(s.assignTexture(t,"clearcoatNormalMap",l.clearcoatNormalTexture)),void 0!==l.clearcoatNormalTexture.scale)){const e=l.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new o.I9Y(e,e)}return Promise.all(A)}}class GLTFMaterialsIridescenceExtension{constructor(e){this.parser=e,this.name=qe.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.uSd:null}extendMaterialParams(e,t){const s=this.parser,r=s.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const o=[],A=r.extensions[this.name];return void 0!==A.iridescenceFactor&&(t.iridescence=A.iridescenceFactor),void 0!==A.iridescenceTexture&&o.push(s.assignTexture(t,"iridescenceMap",A.iridescenceTexture)),void 0!==A.iridescenceIor&&(t.iridescenceIOR=A.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==A.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=A.iridescenceThicknessMinimum),void 0!==A.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=A.iridescenceThicknessMaximum),void 0!==A.iridescenceThicknessTexture&&o.push(s.assignTexture(t,"iridescenceThicknessMap",A.iridescenceThicknessTexture)),Promise.all(o)}}class GLTFMaterialsSheenExtension{constructor(e){this.parser=e,this.name=qe.KHR_MATERIALS_SHEEN}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.uSd:null}extendMaterialParams(e,t){const s=this.parser,r=s.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const A=[];t.sheenColor=new o.Q1f(0,0,0),t.sheenRoughness=0,t.sheen=1;const l=r.extensions[this.name];if(void 0!==l.sheenColorFactor){const e=l.sheenColorFactor;t.sheenColor.setRGB(e[0],e[1],e[2],o.Zr2)}return void 0!==l.sheenRoughnessFactor&&(t.sheenRoughness=l.sheenRoughnessFactor),void 0!==l.sheenColorTexture&&A.push(s.assignTexture(t,"sheenColorMap",l.sheenColorTexture,o.er$)),void 0!==l.sheenRoughnessTexture&&A.push(s.assignTexture(t,"sheenRoughnessMap",l.sheenRoughnessTexture)),Promise.all(A)}}class GLTFMaterialsTransmissionExtension{constructor(e){this.parser=e,this.name=qe.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.uSd:null}extendMaterialParams(e,t){const s=this.parser,r=s.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const o=[],A=r.extensions[this.name];return void 0!==A.transmissionFactor&&(t.transmission=A.transmissionFactor),void 0!==A.transmissionTexture&&o.push(s.assignTexture(t,"transmissionMap",A.transmissionTexture)),Promise.all(o)}}class GLTFMaterialsVolumeExtension{constructor(e){this.parser=e,this.name=qe.KHR_MATERIALS_VOLUME}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.uSd:null}extendMaterialParams(e,t){const s=this.parser,r=s.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const A=[],l=r.extensions[this.name];t.thickness=void 0!==l.thicknessFactor?l.thicknessFactor:0,void 0!==l.thicknessTexture&&A.push(s.assignTexture(t,"thicknessMap",l.thicknessTexture)),t.attenuationDistance=l.attenuationDistance||1/0;const h=l.attenuationColor||[1,1,1];return t.attenuationColor=(new o.Q1f).setRGB(h[0],h[1],h[2],o.Zr2),Promise.all(A)}}class GLTFMaterialsIorExtension{constructor(e){this.parser=e,this.name=qe.KHR_MATERIALS_IOR}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.uSd:null}extendMaterialParams(e,t){const s=this.parser.json.materials[e];if(!s.extensions||!s.extensions[this.name])return Promise.resolve();const r=s.extensions[this.name];return t.ior=void 0!==r.ior?r.ior:1.5,Promise.resolve()}}class GLTFMaterialsSpecularExtension{constructor(e){this.parser=e,this.name=qe.KHR_MATERIALS_SPECULAR}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.uSd:null}extendMaterialParams(e,t){const s=this.parser,r=s.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const A=[],l=r.extensions[this.name];t.specularIntensity=void 0!==l.specularFactor?l.specularFactor:1,void 0!==l.specularTexture&&A.push(s.assignTexture(t,"specularIntensityMap",l.specularTexture));const h=l.specularColorFactor||[1,1,1];return t.specularColor=(new o.Q1f).setRGB(h[0],h[1],h[2],o.Zr2),void 0!==l.specularColorTexture&&A.push(s.assignTexture(t,"specularColorMap",l.specularColorTexture,o.er$)),Promise.all(A)}}class GLTFMaterialsBumpExtension{constructor(e){this.parser=e,this.name=qe.EXT_MATERIALS_BUMP}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.uSd:null}extendMaterialParams(e,t){const s=this.parser,r=s.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const o=[],A=r.extensions[this.name];return t.bumpScale=void 0!==A.bumpFactor?A.bumpFactor:1,void 0!==A.bumpTexture&&o.push(s.assignTexture(t,"bumpMap",A.bumpTexture)),Promise.all(o)}}class GLTFMaterialsAnisotropyExtension{constructor(e){this.parser=e,this.name=qe.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){const t=this.parser.json.materials[e];return t.extensions&&t.extensions[this.name]?o.uSd:null}extendMaterialParams(e,t){const s=this.parser,r=s.json.materials[e];if(!r.extensions||!r.extensions[this.name])return Promise.resolve();const o=[],A=r.extensions[this.name];return void 0!==A.anisotropyStrength&&(t.anisotropy=A.anisotropyStrength),void 0!==A.anisotropyRotation&&(t.anisotropyRotation=A.anisotropyRotation),void 0!==A.anisotropyTexture&&o.push(s.assignTexture(t,"anisotropyMap",A.anisotropyTexture)),Promise.all(o)}}class GLTFTextureBasisUExtension{constructor(e){this.parser=e,this.name=qe.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,s=t.json,r=s.textures[e];if(!r.extensions||!r.extensions[this.name])return null;const o=r.extensions[this.name],A=t.options.ktx2Loader;if(!A){if(s.extensionsRequired&&s.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,o.source,A)}}class GLTFTextureWebPExtension{constructor(e){this.parser=e,this.name=qe.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,s=this.parser,r=s.json,o=r.textures[e];if(!o.extensions||!o.extensions[t])return null;const A=o.extensions[t],l=r.images[A.source];let h=s.textureLoader;if(l.uri){const e=s.options.manager.getHandler(l.uri);null!==e&&(h=e)}return this.detectSupport().then((function(o){if(o)return s.loadTextureImage(e,A.source,h);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return s.loadTexture(e)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}class GLTFTextureAVIFExtension{constructor(e){this.parser=e,this.name=qe.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,s=this.parser,r=s.json,o=r.textures[e];if(!o.extensions||!o.extensions[t])return null;const A=o.extensions[t],l=r.images[A.source];let h=s.textureLoader;if(l.uri){const e=s.options.manager.getHandler(l.uri);null!==e&&(h=e)}return this.detectSupport().then((function(o){if(o)return s.loadTextureImage(e,A.source,h);if(r.extensionsRequired&&r.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return s.loadTexture(e)}))}detectSupport(){return this.isSupported||(this.isSupported=new Promise((function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(1===t.height)}}))),this.isSupported}}class GLTFMeshoptCompression{constructor(e){this.name=qe.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,s=t.bufferViews[e];if(s.extensions&&s.extensions[this.name]){const e=s.extensions[this.name],r=this.parser.getDependency("buffer",e.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return r.then((function(t){const s=e.byteOffset||0,r=e.byteLength||0,A=e.count,l=e.byteStride,h=new Uint8Array(t,s,r);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(A,l,h,e.mode,e.filter).then((function(e){return e.buffer})):o.ready.then((function(){const t=new ArrayBuffer(A*l);return o.decodeGltfBuffer(new Uint8Array(t),A,l,h,e.mode,e.filter),t}))}))}return null}}class GLTFMeshGpuInstancing{constructor(e){this.name=qe.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,s=t.nodes[e];if(!s.extensions||!s.extensions[this.name]||void 0===s.mesh)return null;const r=t.meshes[s.mesh];for(const e of r.primitives)if(e.mode!==Ye.TRIANGLES&&e.mode!==Ye.TRIANGLE_STRIP&&e.mode!==Ye.TRIANGLE_FAN&&void 0!==e.mode)return null;const A=s.extensions[this.name].attributes,l=[],h={};for(const e in A)l.push(this.parser.getDependency("accessor",A[e]).then((t=>(h[e]=t,h[e]))));return l.length<1?null:(l.push(this.parser.createNodeMesh(e)),Promise.all(l).then((e=>{const t=e.pop(),s=t.isGroup?t.children:[t],r=e[0].count,A=[];for(const e of s){const t=new o.kn4,s=new o.Pq0,l=new o.PTz,c=new o.Pq0(1,1,1),d=new o.ZLX(e.geometry,e.material,r);for(let e=0;e<r;e++)h.TRANSLATION&&s.fromBufferAttribute(h.TRANSLATION,e),h.ROTATION&&l.fromBufferAttribute(h.ROTATION,e),h.SCALE&&c.fromBufferAttribute(h.SCALE,e),d.setMatrixAt(e,t.compose(s,l,c));for(const t in h)if("_COLOR_0"===t){const e=h[t];d.instanceColor=new o.uWO(e.array,e.itemSize,e.normalized)}else"TRANSLATION"!==t&&"ROTATION"!==t&&"SCALE"!==t&&e.geometry.setAttribute(t,h[t]);o.B69.prototype.copy.call(d,e),this.parser.assignFinalMaterial(d),A.push(d)}return t.isGroup?(t.clear(),t.add(...A),t):A[0]})))}}const Ve="glTF",$e=1313821514,Je=5130562;class GLTFBinaryExtension{constructor(e){this.name=qe.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,12),s=new TextDecoder;if(this.header={magic:s.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==Ve)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const r=this.header.length-12,o=new DataView(e,12);let A=0;for(;A<r;){const t=o.getUint32(A,!0);A+=4;const r=o.getUint32(A,!0);if(A+=4,r===$e){const r=new Uint8Array(e,12+A,t);this.content=s.decode(r)}else if(r===Je){const s=12+A;this.body=e.slice(s,s+t)}A+=t}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class GLTFDracoMeshCompressionExtension{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=qe.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const s=this.json,r=this.dracoLoader,A=e.extensions[this.name].bufferView,l=e.extensions[this.name].attributes,h={},c={},d={};for(const e in l){const t=Ze[e]||e.toLowerCase();h[t]=l[e]}for(const t in e.attributes){const r=Ze[t]||t.toLowerCase();if(void 0!==l[t]){const o=s.accessors[e.attributes[t]],A=ze[o.componentType];d[r]=A.name,c[r]=!0===o.normalized}}return t.getDependency("bufferView",A).then((function(e){return new Promise((function(t,s){r.decodeDracoFile(e,(function(e){for(const t in e.attributes){const s=e.attributes[t],r=c[t];void 0!==r&&(s.normalized=r)}t(e)}),h,d,o.Zr2,s)}))}))}}class GLTFTextureTransformExtension{constructor(){this.name=qe.KHR_TEXTURE_TRANSFORM}extendTexture(e,t){return void 0!==t.texCoord&&t.texCoord!==e.channel||void 0!==t.offset||void 0!==t.rotation||void 0!==t.scale?(e=e.clone(),void 0!==t.texCoord&&(e.channel=t.texCoord),void 0!==t.offset&&e.offset.fromArray(t.offset),void 0!==t.rotation&&(e.rotation=t.rotation),void 0!==t.scale&&e.repeat.fromArray(t.scale),e.needsUpdate=!0,e):e}}class GLTFMeshQuantizationExtension{constructor(){this.name=qe.KHR_MESH_QUANTIZATION}}class GLTFCubicSplineInterpolant extends o.lGw{constructor(e,t,s,r){super(e,t,s,r)}copySampleValue_(e){const t=this.resultBuffer,s=this.sampleValues,r=this.valueSize,o=e*r*3+r;for(let e=0;e!==r;e++)t[e]=s[o+e];return t}interpolate_(e,t,s,r){const o=this.resultBuffer,A=this.sampleValues,l=this.valueSize,h=2*l,c=3*l,d=r-t,g=(s-t)/d,p=g*g,m=p*g,f=e*c,I=f-c,E=-2*m+3*p,C=m-p,B=1-E,y=C-p+g;for(let e=0;e!==l;e++){const t=A[I+e+l],s=A[I+e+h]*d,r=A[f+e+l],c=A[f+e]*d;o[e]=B*t+y*s+E*r+C*c}return o}}const Ke=new o.PTz;class GLTFCubicSplineQuaternionInterpolant extends GLTFCubicSplineInterpolant{interpolate_(e,t,s,r){const o=super.interpolate_(e,t,s,r);return Ke.fromArray(o).normalize().toArray(o),o}}const Ye={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},ze={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},je={9728:o.hxR,9729:o.k6q,9984:o.pHI,9985:o.kRr,9986:o.Cfg,9987:o.$_I},We={33071:o.ghU,33648:o.kTW,10497:o.GJx},Xe={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Ze={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"},et={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},tt={CUBICSPLINE:void 0,LINEAR:o.PJ3,STEP:o.ljd},it="OPAQUE",st="MASK",nt="BLEND";function createDefaultMaterial(e){return void 0===e.DefaultMaterial&&(e.DefaultMaterial=new o._4j({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:o.hB5})),e.DefaultMaterial}function addUnknownExtensionsToUserData(e,t,s){for(const r in s.extensions)void 0===e[r]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[r]=s.extensions[r])}function assignExtrasToUserData(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):He.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function updateMorphTargets(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let s=0,r=t.weights.length;s<r;s++)e.morphTargetInfluences[s]=t.weights[s];if(t.extras&&Array.isArray(t.extras.targetNames)){const s=t.extras.targetNames;if(e.morphTargetInfluences.length===s.length){e.morphTargetDictionary={};for(let t=0,r=s.length;t<r;t++)e.morphTargetDictionary[s[t]]=t}else He.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function createPrimitiveKey(e){let t;const s=e.extensions&&e.extensions[qe.KHR_DRACO_MESH_COMPRESSION];if(t=s?"draco:"+s.bufferView+":"+s.indices+":"+createAttributesKey(s.attributes):e.indices+":"+createAttributesKey(e.attributes)+":"+e.mode,void 0!==e.targets)for(let s=0,r=e.targets.length;s<r;s++)t+=":"+createAttributesKey(e.targets[s]);return t}function createAttributesKey(e){let t="";const s=Object.keys(e).sort();for(let r=0,o=s.length;r<o;r++)t+=s[r]+":"+e[s[r]]+";";return t}function getNormalizedComponentScale(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}const rt=new o.kn4;class GLTFParser{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new GLTFRegistry,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let s=!1,r=!1,A=-1;"undefined"!=typeof navigator&&(s=!0===/^((?!chrome|android).)*safari/i.test(navigator.userAgent),r=navigator.userAgent.indexOf("Firefox")>-1,A=r?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),"undefined"==typeof createImageBitmap||s||r&&A<98?this.textureLoader=new o.Tap(this.options.manager):this.textureLoader=new o.Kzg(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new o.Y9S(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),"use-credentials"===this.options.crossOrigin&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const s=this,r=this.json,o=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll((function(e){return e._markDefs&&e._markDefs()})),Promise.all(this._invokeAll((function(e){return e.beforeRoot&&e.beforeRoot()}))).then((function(){return Promise.all([s.getDependencies("scene"),s.getDependencies("animation"),s.getDependencies("camera")])})).then((function(t){const A={scene:t[0][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:s,userData:{}};return addUnknownExtensionsToUserData(o,A,r),assignExtrasToUserData(A,r),Promise.all(s._invokeAll((function(e){return e.afterRoot&&e.afterRoot(A)}))).then((function(){e(A)}))})).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],s=this.json.meshes||[];for(let s=0,r=t.length;s<r;s++){const r=t[s].joints;for(let t=0,s=r.length;t<s;t++)e[r[t]].isBone=!0}for(let t=0,r=e.length;t<r;t++){const r=e[t];void 0!==r.mesh&&(this._addNodeRef(this.meshCache,r.mesh),void 0!==r.skin&&(s[r.mesh].isSkinnedMesh=!0)),void 0!==r.camera&&this._addNodeRef(this.cameraCache,r.camera)}}_addNodeRef(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,s){if(e.refs[t]<=1)return s;const r=s.clone(),updateMappings=(e,t)=>{const s=this.associations.get(e);null!=s&&this.associations.set(t,s);for(const[s,r]of e.children.entries())updateMappings(r,t.children[s])};return updateMappings(s,r),r.name+="_instance_"+e.uses[t]++,r}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let s=0;s<t.length;s++){const r=e(t[s]);if(r)return r}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const s=[];for(let r=0;r<t.length;r++){const o=e(t[r]);o&&s.push(o)}return s}getDependency(e,t){const s=e+":"+t;let r=this.cache.get(s);if(!r){switch(e){case"scene":r=this.loadScene(t);break;case"node":r=this._invokeOne((function(e){return e.loadNode&&e.loadNode(t)}));break;case"mesh":r=this._invokeOne((function(e){return e.loadMesh&&e.loadMesh(t)}));break;case"accessor":r=this.loadAccessor(t);break;case"bufferView":r=this._invokeOne((function(e){return e.loadBufferView&&e.loadBufferView(t)}));break;case"buffer":r=this.loadBuffer(t);break;case"material":r=this._invokeOne((function(e){return e.loadMaterial&&e.loadMaterial(t)}));break;case"texture":r=this._invokeOne((function(e){return e.loadTexture&&e.loadTexture(t)}));break;case"skin":r=this.loadSkin(t);break;case"animation":r=this._invokeOne((function(e){return e.loadAnimation&&e.loadAnimation(t)}));break;case"camera":r=this.loadCamera(t);break;default:if(r=this._invokeOne((function(s){return s!=this&&s.getDependency&&s.getDependency(e,t)})),!r)throw new Error("Unknown type: "+e)}this.cache.add(s,r)}return r}getDependencies(e){let t=this.cache.get(e);if(!t){const s=this,r=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(r.map((function(t,r){return s.getDependency(e,r)}))),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],s=this.fileLoader;if(t.type&&"arraybuffer"!==t.type)throw new Error("THREE.GLTFLoader: "+t.type+" buffer type is not supported.");if(void 0===t.uri&&0===e)return Promise.resolve(this.extensions[qe.KHR_BINARY_GLTF].body);const r=this.options;return new Promise((function(e,A){s.load(o.r6x.resolveURL(t.uri,r.path),e,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(e){const s=t.byteLength||0,r=t.byteOffset||0;return e.slice(r,r+s)}))}loadAccessor(e){const t=this,s=this.json,r=this.json.accessors[e];if(void 0===r.bufferView&&void 0===r.sparse){const e=Xe[r.type],t=ze[r.componentType],s=!0===r.normalized,A=new t(r.count*e);return Promise.resolve(new o.THS(A,e,s))}const A=[];return void 0!==r.bufferView?A.push(this.getDependency("bufferView",r.bufferView)):A.push(null),void 0!==r.sparse&&(A.push(this.getDependency("bufferView",r.sparse.indices.bufferView)),A.push(this.getDependency("bufferView",r.sparse.values.bufferView))),Promise.all(A).then((function(e){const A=e[0],l=Xe[r.type],h=ze[r.componentType],c=h.BYTES_PER_ELEMENT,d=c*l,g=r.byteOffset||0,p=void 0!==r.bufferView?s.bufferViews[r.bufferView].byteStride:void 0,m=!0===r.normalized;let f,I;if(p&&p!==d){const e=Math.floor(g/p),s="InterleavedBuffer:"+r.bufferView+":"+r.componentType+":"+e+":"+r.count;let d=t.cache.get(s);d||(f=new h(A,e*p,r.count*p/c),d=new o.eB$(f,p/c),t.cache.add(s,d)),I=new o.eHs(d,l,g%p/c,m)}else f=null===A?new h(r.count*l):new h(A,g,r.count*l),I=new o.THS(f,l,m);if(void 0!==r.sparse){const t=Xe.SCALAR,s=ze[r.sparse.indices.componentType],c=r.sparse.indices.byteOffset||0,d=r.sparse.values.byteOffset||0,g=new s(e[1],c,r.sparse.count*t),p=new h(e[2],d,r.sparse.count*l);null!==A&&(I=new o.THS(I.array.slice(),I.itemSize,I.normalized));for(let e=0,t=g.length;e<t;e++){const t=g[e];if(I.setX(t,p[e*l]),l>=2&&I.setY(t,p[e*l+1]),l>=3&&I.setZ(t,p[e*l+2]),l>=4&&I.setW(t,p[e*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return I}))}loadTexture(e){const t=this.json,s=this.options,r=t.textures[e].source,o=t.images[r];let A=this.textureLoader;if(o.uri){const e=s.manager.getHandler(o.uri);null!==e&&(A=e)}return this.loadTextureImage(e,r,A)}loadTextureImage(e,t,s){const r=this,A=this.json,l=A.textures[e],h=A.images[t],c=(h.uri||h.bufferView)+":"+l.sampler;if(this.textureCache[c])return this.textureCache[c];const d=this.loadImageSource(t,s).then((function(t){t.flipY=!1,t.name=l.name||h.name||"",""===t.name&&"string"==typeof h.uri&&!1===h.uri.startsWith("data:image/")&&(t.name=h.uri);const s=(A.samplers||{})[l.sampler]||{};return t.magFilter=je[s.magFilter]||o.k6q,t.minFilter=je[s.minFilter]||o.$_I,t.wrapS=We[s.wrapS]||o.GJx,t.wrapT=We[s.wrapT]||o.GJx,r.associations.set(t,{textures:e}),t})).catch((function(){return null}));return this.textureCache[c]=d,d}loadImageSource(e,t){const s=this,r=this.json,A=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then((e=>e.clone()));const l=r.images[e],h=self.URL||self.webkitURL;let c=l.uri||"",d=!1;if(void 0!==l.bufferView)c=s.getDependency("bufferView",l.bufferView).then((function(e){d=!0;const t=new Blob([e],{type:l.mimeType});return c=h.createObjectURL(t),c}));else if(void 0===l.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const g=Promise.resolve(c).then((function(e){return new Promise((function(s,r){let l=s;!0===t.isImageBitmapLoader&&(l=function(e){const t=new o.gPd(e);t.needsUpdate=!0,s(t)}),t.load(o.r6x.resolveURL(e,A.path),l,void 0,r)}))})).then((function(e){return!0===d&&h.revokeObjectURL(c),e.userData.mimeType=l.mimeType||function getImageURIMimeType(e){return e.search(/\.jpe?g($|\?)/i)>0||0===e.search(/^data\:image\/jpeg/)?"image/jpeg":e.search(/\.webp($|\?)/i)>0||0===e.search(/^data\:image\/webp/)?"image/webp":"image/png"}(l.uri),e})).catch((function(e){throw He.error("THREE.GLTFLoader: Couldn't load texture",c),e}));return this.sourceCache[e]=g,g}assignTexture(e,t,s,r){const o=this;return this.getDependency("texture",s.index).then((function(A){if(!A)return null;if(void 0!==s.texCoord&&s.texCoord>0&&((A=A.clone()).channel=s.texCoord),o.extensions[qe.KHR_TEXTURE_TRANSFORM]){const e=void 0!==s.extensions?s.extensions[qe.KHR_TEXTURE_TRANSFORM]:void 0;if(e){const t=o.associations.get(A);A=o.extensions[qe.KHR_TEXTURE_TRANSFORM].extendTexture(A,e),o.associations.set(A,t)}}return void 0!==r&&(A.colorSpace=r),e[t]=A,A}))}assignFinalMaterial(e){const t=e.geometry;let s=e.material;const r=void 0===t.attributes.tangent,A=void 0!==t.attributes.color,l=void 0===t.attributes.normal;if(e.isPoints){const e="PointsMaterial:"+s.uuid;let t=this.cache.get(e);t||(t=new o.BH$,o.imn.prototype.copy.call(t,s),t.color.copy(s.color),t.map=s.map,t.sizeAttenuation=!1,this.cache.add(e,t)),s=t}else if(e.isLine){const e="LineBasicMaterial:"+s.uuid;let t=this.cache.get(e);t||(t=new o.mrM,o.imn.prototype.copy.call(t,s),t.color.copy(s.color),t.map=s.map,this.cache.add(e,t)),s=t}if(r||A||l){let e="ClonedMaterial:"+s.uuid+":";r&&(e+="derivative-tangents:"),A&&(e+="vertex-colors:"),l&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=s.clone(),A&&(t.vertexColors=!0),l&&(t.flatShading=!0),r&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(s))),s=t}e.material=s}getMaterialType(){return o._4j}loadMaterial(e){const t=this,s=this.json,r=this.extensions,A=s.materials[e];let l;const h={},c=[];if((A.extensions||{})[qe.KHR_MATERIALS_UNLIT]){const e=r[qe.KHR_MATERIALS_UNLIT];l=e.getMaterialType(),c.push(e.extendParams(h,A,t))}else{const s=A.pbrMetallicRoughness||{};if(h.color=new o.Q1f(1,1,1),h.opacity=1,Array.isArray(s.baseColorFactor)){const e=s.baseColorFactor;h.color.setRGB(e[0],e[1],e[2],o.Zr2),h.opacity=e[3]}void 0!==s.baseColorTexture&&c.push(t.assignTexture(h,"map",s.baseColorTexture,o.er$)),h.metalness=void 0!==s.metallicFactor?s.metallicFactor:1,h.roughness=void 0!==s.roughnessFactor?s.roughnessFactor:1,void 0!==s.metallicRoughnessTexture&&(c.push(t.assignTexture(h,"metalnessMap",s.metallicRoughnessTexture)),c.push(t.assignTexture(h,"roughnessMap",s.metallicRoughnessTexture))),l=this._invokeOne((function(t){return t.getMaterialType&&t.getMaterialType(e)})),c.push(Promise.all(this._invokeAll((function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,h)}))))}!0===A.doubleSided&&(h.side=o.$EB);const d=A.alphaMode||it;if(d===nt?(h.transparent=!0,h.depthWrite=!1):(h.transparent=!1,d===st&&(h.alphaTest=void 0!==A.alphaCutoff?A.alphaCutoff:.5)),void 0!==A.normalTexture&&l!==o.V9B&&(c.push(t.assignTexture(h,"normalMap",A.normalTexture)),h.normalScale=new o.I9Y(1,1),void 0!==A.normalTexture.scale)){const e=A.normalTexture.scale;h.normalScale.set(e,e)}if(void 0!==A.occlusionTexture&&l!==o.V9B&&(c.push(t.assignTexture(h,"aoMap",A.occlusionTexture)),void 0!==A.occlusionTexture.strength&&(h.aoMapIntensity=A.occlusionTexture.strength)),void 0!==A.emissiveFactor&&l!==o.V9B){const e=A.emissiveFactor;h.emissive=(new o.Q1f).setRGB(e[0],e[1],e[2],o.Zr2)}return void 0!==A.emissiveTexture&&l!==o.V9B&&c.push(t.assignTexture(h,"emissiveMap",A.emissiveTexture,o.er$)),Promise.all(c).then((function(){const s=new l(h);return A.name&&(s.name=A.name),assignExtrasToUserData(s,A),t.associations.set(s,{materials:e}),A.extensions&&addUnknownExtensionsToUserData(r,s,A),s}))}createUniqueName(e){const t=o.Nwf.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,s=this.extensions,r=this.primitiveCache;function createDracoPrimitive(e){return s[qe.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then((function(s){return addPrimitiveAttributes(s,e,t)}))}const A=[];for(let s=0,l=e.length;s<l;s++){const l=e[s],h=createPrimitiveKey(l),c=r[h];if(c)A.push(c.promise);else{let e;e=l.extensions&&l.extensions[qe.KHR_DRACO_MESH_COMPRESSION]?createDracoPrimitive(l):addPrimitiveAttributes(new o.LoY,l,t),r[h]={primitive:l,promise:e},A.push(e)}}return Promise.all(A)}loadMesh(e){const t=this,s=this.json,r=this.extensions,A=s.meshes[e],l=A.primitives,h=[];for(let e=0,t=l.length;e<t;e++){const t=void 0===l[e].material?createDefaultMaterial(this.cache):this.getDependency("material",l[e].material);h.push(t)}return h.push(t.loadGeometries(l)),Promise.all(h).then((function(s){const h=s.slice(0,s.length-1),c=s[s.length-1],d=[];for(let s=0,g=c.length;s<g;s++){const g=c[s],p=l[s];let m;const f=h[s];if(p.mode===Ye.TRIANGLES||p.mode===Ye.TRIANGLE_STRIP||p.mode===Ye.TRIANGLE_FAN||void 0===p.mode)m=!0===A.isSkinnedMesh?new o.I46(g,f):new o.eaF(g,f),!0===m.isSkinnedMesh&&m.normalizeSkinWeights(),p.mode===Ye.TRIANGLE_STRIP?m.geometry=toTrianglesDrawMode(m.geometry,o.O49):p.mode===Ye.TRIANGLE_FAN&&(m.geometry=toTrianglesDrawMode(m.geometry,o.rYR));else if(p.mode===Ye.LINES)m=new o.DXC(g,f);else if(p.mode===Ye.LINE_STRIP)m=new o.N1A(g,f);else if(p.mode===Ye.LINE_LOOP)m=new o.FCc(g,f);else{if(p.mode!==Ye.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+p.mode);m=new o.ONl(g,f)}Object.keys(m.geometry.morphAttributes).length>0&&updateMorphTargets(m,A),m.name=t.createUniqueName(A.name||"mesh_"+e),assignExtrasToUserData(m,A),p.extensions&&addUnknownExtensionsToUserData(r,m,p),t.assignFinalMaterial(m),d.push(m)}for(let s=0,r=d.length;s<r;s++)t.associations.set(d[s],{meshes:e,primitives:s});if(1===d.length)return A.extensions&&addUnknownExtensionsToUserData(r,d[0],A),d[0];const g=new o.YJl;A.extensions&&addUnknownExtensionsToUserData(r,g,A),t.associations.set(g,{meshes:e});for(let e=0,t=d.length;e<t;e++)g.add(d[e]);return g}))}loadCamera(e){let t;const s=this.json.cameras[e],r=s[s.type];if(r)return"perspective"===s.type?t=new o.ubm(o.cj9.radToDeg(r.yfov),r.aspectRatio||1,r.znear||1,r.zfar||2e6):"orthographic"===s.type&&(t=new o.qUd(-r.xmag,r.xmag,r.ymag,-r.ymag,r.znear,r.zfar)),s.name&&(t.name=this.createUniqueName(s.name)),assignExtrasToUserData(t,s),Promise.resolve(t);He.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(e){const t=this.json.skins[e],s=[];for(let e=0,r=t.joints.length;e<r;e++)s.push(this._loadNodeShallow(t.joints[e]));return void 0!==t.inverseBindMatrices?s.push(this.getDependency("accessor",t.inverseBindMatrices)):s.push(null),Promise.all(s).then((function(e){const s=e.pop(),r=e,A=[],l=[];for(let e=0,h=r.length;e<h;e++){const h=r[e];if(h){A.push(h);const t=new o.kn4;null!==s&&t.fromArray(s.array,16*e),l.push(t)}else He.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[e])}return new o.EAD(A,l)}))}loadAnimation(e){const t=this.json,s=this,r=t.animations[e],A=r.name?r.name:"animation_"+e,l=[],h=[],c=[],d=[],g=[];for(let e=0,t=r.channels.length;e<t;e++){const t=r.channels[e],s=r.samplers[t.sampler],o=t.target,A=o.node,p=void 0!==r.parameters?r.parameters[s.input]:s.input,m=void 0!==r.parameters?r.parameters[s.output]:s.output;void 0!==o.node&&(l.push(this.getDependency("node",A)),h.push(this.getDependency("accessor",p)),c.push(this.getDependency("accessor",m)),d.push(s),g.push(o))}return Promise.all([Promise.all(l),Promise.all(h),Promise.all(c),Promise.all(d),Promise.all(g)]).then((function(e){const t=e[0],r=e[1],l=e[2],h=e[3],c=e[4],d=[];for(let e=0,o=t.length;e<o;e++){const o=t[e],A=r[e],g=l[e],p=h[e],m=c[e];if(void 0===o)continue;o.updateMatrix&&o.updateMatrix();const f=s._createAnimationTracks(o,A,g,p,m);if(f)for(let e=0;e<f.length;e++)d.push(f[e])}return new o.tz3(A,void 0,d)}))}createNodeMesh(e){const t=this.json,s=this,r=t.nodes[e];return void 0===r.mesh?null:s.getDependency("mesh",r.mesh).then((function(e){const t=s._getNodeRef(s.meshCache,r.mesh,e);return void 0!==r.weights&&t.traverse((function(e){if(e.isMesh)for(let t=0,s=r.weights.length;t<s;t++)e.morphTargetInfluences[t]=r.weights[t]})),t}))}loadNode(e){const t=this,s=this.json.nodes[e],r=t._loadNodeShallow(e),o=[],A=s.children||[];for(let e=0,s=A.length;e<s;e++)o.push(t.getDependency("node",A[e]));const l=void 0===s.skin?Promise.resolve(null):t.getDependency("skin",s.skin);return Promise.all([r,Promise.all(o),l]).then((function(e){const t=e[0],s=e[1],r=e[2];null!==r&&t.traverse((function(e){e.isSkinnedMesh&&e.bind(r,rt)}));for(let e=0,r=s.length;e<r;e++)t.add(s[e]);return t}))}_loadNodeShallow(e){const t=this.json,s=this.extensions,r=this;if(void 0!==this.nodeCache[e])return this.nodeCache[e];const A=t.nodes[e],l=A.name?r.createUniqueName(A.name):"",h=[],c=r._invokeOne((function(t){return t.createNodeMesh&&t.createNodeMesh(e)}));return c&&h.push(c),void 0!==A.camera&&h.push(r.getDependency("camera",A.camera).then((function(e){return r._getNodeRef(r.cameraCache,A.camera,e)}))),r._invokeAll((function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)})).forEach((function(e){h.push(e)})),this.nodeCache[e]=Promise.all(h).then((function(t){let h;if(h=!0===A.isBone?new o.$Kf:t.length>1?new o.YJl:1===t.length?t[0]:new o.B69,h!==t[0])for(let e=0,s=t.length;e<s;e++)h.add(t[e]);if(A.name&&(h.userData.name=A.name,h.name=l),assignExtrasToUserData(h,A),A.extensions&&addUnknownExtensionsToUserData(s,h,A),void 0!==A.matrix){const e=new o.kn4;e.fromArray(A.matrix),h.applyMatrix4(e)}else void 0!==A.translation&&h.position.fromArray(A.translation),void 0!==A.rotation&&h.quaternion.fromArray(A.rotation),void 0!==A.scale&&h.scale.fromArray(A.scale);return r.associations.has(h)||r.associations.set(h,{}),r.associations.get(h).nodes=e,h})),this.nodeCache[e]}loadScene(e){const t=this.extensions,s=this.json.scenes[e],r=this,A=new o.YJl;s.name&&(A.name=r.createUniqueName(s.name)),assignExtrasToUserData(A,s),s.extensions&&addUnknownExtensionsToUserData(t,A,s);const l=s.nodes||[],h=[];for(let e=0,t=l.length;e<t;e++)h.push(r.getDependency("node",l[e]));return Promise.all(h).then((function(e){for(let t=0,s=e.length;t<s;t++)A.add(e[t]);return r.associations=(e=>{const t=new Map;for(const[e,s]of r.associations)(e instanceof o.imn||e instanceof o.gPd)&&t.set(e,s);return e.traverse((e=>{const s=r.associations.get(e);null!=s&&t.set(e,s)})),t})(A),A}))}_createAnimationTracks(e,t,s,r,A){const l=[],h=e.name?e.name:e.uuid,c=[];let d;switch(et[A.path]===et.weights?e.traverse((function(e){e.morphTargetInfluences&&c.push(e.name?e.name:e.uuid)})):c.push(h),et[A.path]){case et.weights:d=o.Hit;break;case et.rotation:d=o.MBL;break;case et.position:case et.scale:d=o.RiT;break;default:if(1===s.itemSize)d=o.Hit;else d=o.RiT}const g=void 0!==r.interpolation?tt[r.interpolation]:o.PJ3,p=this._getArrayFromAccessor(s);for(let e=0,s=c.length;e<s;e++){const s=new d(c[e]+"."+et[A.path],t.array,p,g);"CUBICSPLINE"===r.interpolation&&this._createCubicSplineTrackInterpolant(s),l.push(s)}return l}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const e=getNormalizedComponentScale(t.constructor),s=new Float32Array(t.length);for(let r=0,o=t.length;r<o;r++)s[r]=t[r]*e;t=s}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function InterpolantFactoryMethodGLTFCubicSpline(e){return new(this instanceof o.MBL?GLTFCubicSplineQuaternionInterpolant:GLTFCubicSplineInterpolant)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function addPrimitiveAttributes(e,t,s){const r=t.attributes,A=[];function assignAttributeAccessor(t,r){return s.getDependency("accessor",t).then((function(t){e.setAttribute(r,t)}))}for(const t in r){const s=Ze[t]||t.toLowerCase();s in e.attributes||A.push(assignAttributeAccessor(r[t],s))}if(void 0!==t.indices&&!e.index){const r=s.getDependency("accessor",t.indices).then((function(t){e.setIndex(t)}));A.push(r)}return o.ppV.workingColorSpace!==o.Zr2&&"COLOR_0"in r&&He.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${o.ppV.workingColorSpace}" not supported.`),assignExtrasToUserData(e,t),function computeBounds(e,t,s){const r=t.attributes,A=new o.NRn;if(void 0===r.POSITION)return;{const e=s.json.accessors[r.POSITION],t=e.min,l=e.max;if(void 0===t||void 0===l)return void He.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(A.set(new o.Pq0(t[0],t[1],t[2]),new o.Pq0(l[0],l[1],l[2])),e.normalized){const t=getNormalizedComponentScale(ze[e.componentType]);A.min.multiplyScalar(t),A.max.multiplyScalar(t)}}const l=t.targets;if(void 0!==l){const e=new o.Pq0,t=new o.Pq0;for(let r=0,o=l.length;r<o;r++){const o=l[r];if(void 0!==o.POSITION){const r=s.json.accessors[o.POSITION],A=r.min,l=r.max;if(void 0!==A&&void 0!==l){if(t.setX(Math.max(Math.abs(A[0]),Math.abs(l[0]))),t.setY(Math.max(Math.abs(A[1]),Math.abs(l[1]))),t.setZ(Math.max(Math.abs(A[2]),Math.abs(l[2]))),r.normalized){const e=getNormalizedComponentScale(ze[r.componentType]);t.multiplyScalar(e)}e.max(t)}else He.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}A.expandByVector(e)}e.boundingBox=A;const h=new o.iyt;A.getCenter(h.center),h.radius=A.min.distanceTo(A.max)/2,e.boundingSphere=h}(e,t,s),Promise.all(A).then((function(){return void 0!==t.targets?function addMorphTargets(e,t,s){let r=!1,o=!1,A=!1;for(let e=0,s=t.length;e<s;e++){const s=t[e];if(void 0!==s.POSITION&&(r=!0),void 0!==s.NORMAL&&(o=!0),void 0!==s.COLOR_0&&(A=!0),r&&o&&A)break}if(!r&&!o&&!A)return Promise.resolve(e);const l=[],h=[],c=[];for(let d=0,g=t.length;d<g;d++){const g=t[d];if(r){const t=void 0!==g.POSITION?s.getDependency("accessor",g.POSITION):e.attributes.position;l.push(t)}if(o){const t=void 0!==g.NORMAL?s.getDependency("accessor",g.NORMAL):e.attributes.normal;h.push(t)}if(A){const t=void 0!==g.COLOR_0?s.getDependency("accessor",g.COLOR_0):e.attributes.color;c.push(t)}}return Promise.all([Promise.all(l),Promise.all(h),Promise.all(c)]).then((function(t){const s=t[0],l=t[1],h=t[2];return r&&(e.morphAttributes.position=s),o&&(e.morphAttributes.normal=l),A&&(e.morphAttributes.color=h),e.morphTargetsRelative=!0,e}))}(e,t.targets,s):e}))}class WorkerPool{constructor(e=4){this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0}_initWorker(e){if(!this.workers[e]){const t=this.workerCreator();t.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=t}}_getIdleWorker(){for(let e=0;e<this.pool;e++)if(!(this.workerStatus&1<<e))return e;return-1}_onMessage(e,t){const s=this.workersResolve[e];if(s&&s(t),this.queue.length){const{resolve:t,msg:s,transfer:r}=this.queue.shift();this.workersResolve[e]=t,this.workers[e].postMessage(s,r)}else this.workerStatus^=1<<e}setWorkerCreator(e){this.workerCreator=e}setWorkerLimit(e){this.pool=e}postMessage(e,t){return new Promise((s=>{const r=this._getIdleWorker();-1!==r?(this._initWorker(r),this.workerStatus|=1<<r,this.workersResolve[r]=s,this.workers[r].postMessage(e,t)):this.queue.push({resolve:s,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}}var at=s(48287).hp;const ot=9,At=15,lt=16,ht=22,ct=37,ut=43,dt=76,gt=83,pt=97,mt=100,ft=103,It=109,Et=165,Ct=166;class Si{constructor(){this.vkFormat=0,this.typeSize=1,this.pixelWidth=0,this.pixelHeight=0,this.pixelDepth=0,this.layerCount=0,this.faceCount=1,this.supercompressionScheme=0,this.levels=[],this.dataFormatDescriptor=[{vendorId:0,descriptorType:0,descriptorBlockSize:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],this.keyValue={},this.globalData=null}}class Ii{constructor(e,t,s,r){this._dataView=new DataView(e.buffer,e.byteOffset+t,s),this._littleEndian=r,this._offset=0}_nextUint8(){const e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){const e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){const e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){const e=this._dataView.getUint32(this._offset,this._littleEndian)+2**32*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,e}_nextInt32(){const e=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,e}_skip(e){return this._offset+=e,this}_scan(e,t=0){const s=this._offset;let r=0;for(;this._dataView.getUint8(this._offset)!==t&&r<e;)r++,this._offset++;return r<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+s,r)}}new Uint8Array([0]);const Bt=[171,75,84,88,32,50,48,187,13,10,26,10];function Ei(e){return"undefined"!=typeof TextDecoder?(new TextDecoder).decode(e):at.from(e).toString("utf8")}var yt=s(48287).hp;let wt,vt,Qt;const xt={env:{emscripten_notify_memory_growth:function(e){Qt=new Uint8Array(vt.exports.memory.buffer)}}};class zstddec_module_Q{init(){return wt||(wt="undefined"!=typeof fetch?fetch("data:application/wasm;base64,"+bt).then((e=>e.arrayBuffer())).then((e=>WebAssembly.instantiate(e,xt))).then(this._init):WebAssembly.instantiate(yt.from(bt,"base64"),xt).then(this._init),wt)}_init(e){vt=e.instance,xt.env.emscripten_notify_memory_growth(0)}decode(e,t=0){if(!vt)throw new Error("ZSTDDecoder: Await .init() before decoding.");const s=e.byteLength,r=vt.exports.malloc(s);Qt.set(e,r),t=t||Number(vt.exports.ZSTD_findDecompressedSize(r,s));const o=vt.exports.malloc(t),A=vt.exports.ZSTD_decompress(o,t,r,s),l=Qt.slice(o,o+A);return vt.exports.free(r),vt.exports.free(o),l}}const bt="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/DwsgACABNgIMIAAgAUEEajYCECACQQRPBEAgACABIAJqIgFBfGoiAzYCCCAAIA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HakF4cSIAIAJHBEAgACACaxAdQX9GDQMLAkBBhCAoAgAiAUUEQEGAICAANgIADAELIAAgATYCBAtBhCAgADYCACAAIANBAXRBAXI2AgAMAQsgAEUNAQsgAEEIaiEBCyABC7kDAQJ/IAAgA2ohBQJAIANBB0wEQANAIAAgBU8NAiAAIAItAAA6AAAgAEEBaiEAIAJBAWohAgwAAAsACyAEQQFGBEACQCAAIAJrIgZBB00EQCAAIAItAAA6AAAgACACLQABOgABIAAgAi0AAjoAAiAAIAItAAM6AAMgAEEEaiACIAZBAnQiBkHAHmooAgBqIgIQFyACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDAkAgAUEDSQ0AIAIgABAhIgFBA3YiADYCCCACIAFBAXE2AgQgAiABQQF2QQNxIgM2AgACQCADQX9qIgFBAksNAAJAIA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gRAQQIhAiAEQQhqDAILIAMgBUsNBSABIARBCGogBEEYahASOgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEjoAACABIAJqIABrIQIMAwsgAyAEQRBqIARBGGoQEjoAAiADIARBCGogBEEYahASOgADIANBBGohAwwAAAsACyAEQRhqIAEgAhAGIgIQAw0AIARBEGogBEEYaiADEBwgBEEIaiAEQRhqIAMQHCAAIQMDQAJAIARBGGoQBCADIAZPckUEQCADIARBEGogBEEYahAROgAAIAMgBEEIaiAEQRhqEBE6AAEgBEEYahAERQ0BIANBAmohAwsgBUF+aiEFAn8DQEG6fyECIAMiASAFSw0EIAEgBEEQaiAEQRhqEBE6AAAgAUEBaiEDIARBGGoQBEEDRgRAQQIhAiAEQQhqDAILIAMgBUsNBCABIARBCGogBEEYahAROgABIAFBAmohA0EDIQIgBEEYahAEQQNHDQALIARBEGoLIQUgAyAFIARBGGoQEToAACABIAJqIABrIQIMAgsgAyAEQRBqIARBGGoQEToAAiADIARBCGogBEEYahAROgADIANBBGohAwwAAAsACyAEQTBqJAAgAgtpAQF/An8CQAJAIAJBB00NACABKAAAQbfIwuF+Rw0AIAAgASgABDYCmOIBQWIgAEEQaiABIAIQPiIDEAMNAhogAEKBgICAEDcDiOEBIAAgASADaiACIANrECoMAQsgACABIAIQKgtBAAsLrQMBBn8jAEGAAWsiAyQAQWIhCAJAIAJBCUkNACAAQZjQAGogAUEIaiIEIAJBeGogAEGY0AAQMyIFEAMiBg0AIANBHzYCfCADIANB/ABqIANB+ABqIAQgBCAFaiAGGyIEIAEgAmoiAiAEaxAVIgUQAw0AIAMoAnwiBkEfSw0AIAMoAngiB0EJTw0AIABBiCBqIAMgBkGAC0GADCAHEBggA0E0NgJ8IAMgA0H8AGogA0H4AGogBCAFaiIEIAIgBGsQFSIFEAMNACADKAJ8IgZBNEsNACADKAJ4IgdBCk8NACAAQZAwaiADIAZBgA1B4A4gBxAYIANBIzYCfCADIANB/ABqIANB+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ghBAwBCwsgBiADNgIMIAYgBDYCCEG4fyEHIAQNASAIIAFrIQcMAQsgBiADNgIMIAYgBDYCCAsgBkEQaiQAIAcLRgECfyABIAAoArjgASICRwRAIAAgAjYCxOABIAAgATYCuOABIAAoArzgASEDIAAgATYCvOABIAAgASADIAJrajYCwOABCwutAgIEfwF+IwBBQGoiBCQAAkACQCACQQhJDQAgASgAAEFwcUHQ1LTCAUcNACABIAIQIiEBIABCADcDCCAAQQA2AgQgACABNgIADAELIARBGGogASACEC0iAxADBEAgACADEBoMAQsgAwRAIABBuH8QGgwBCyACIAQoAjAiA2shAiABIANqIQMDQAJAIAAgAyACIARBCGoQLCIFEAMEfyAFBSACIAVBA2oiBU8NAUG4fwsQGgwCCyAGQQFqIQYgAiAFayECIAMgBWohAyAEKAIMRQ0ACyAEKAI4BEAgAkEDTQRAIABBuH8QGgwCCyADQQRqIQMLIAQoAighAiAEKQMYIQcgAEEANgIEIAAgAyABazYCACAAIAIgBmytIAcgB0J/URs3AwgLIARBQGskAAslAQF/IwBBEGsiAiQAIAIgACABEFEgAigCACEAIAJBEGokACAAC30BBH8jAEGQBGsiBCQAIARB/wE2AggCQCAEQRBqIARBCGogBEEMaiABIAIQFSIGEAMEQCAGIQUMAQtBVCEFIAQoAgwiB0EGSw0AIAMgBEEQaiAEKAIIIAcQQSIFEAMNACAAIAEgBmogAiAGayADEDwhBQsgBEGQBGokACAFC4cBAgJ/An5BABAWIQMCQANAIAEgA08EQAJAIAAoAABBcHFB0NS0wgFGBEAgACABECIiAhADRQ0BQn4PCyAAIAEQVSIEQn1WDQMgBCAFfCIFIARUIQJCfiEEIAINAyAAIAEQUiICEAMNAwsgASACayEBIAAgAmohAAwBCwtCfiAFIAEbIQQLIAQLPwIBfwF+IwBBMGsiAiQAAn5CfiACQQhqIAAgARAtDQAaQgAgAigCHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jhAQs7ACACRQRAQbp/DwsgBEUEQEFsDwsgAiAEEGAEQCAAIAEgAiADIAQgBRBhDwsgACABIAIgAyAEIAUQZQtGAQF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AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ";var St=s(96763);const Mt=new WeakMap;let Tt,Rt=0;class KTX2Loader extends o.aHM{constructor(e){super(e),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new WorkerPool,this.workerSourceURL="",this.workerConfig=null,"undefined"!=typeof MSC_TRANSCODER&&St.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}detectSupport(e){return!0===e.isWebGPURenderer?this.workerConfig={astcSupported:e.hasFeature("texture-compression-astc"),etc1Supported:!1,etc2Supported:e.hasFeature("texture-compression-etc2"),dxtSupported:e.hasFeature("texture-compression-bc"),bptcSupported:!1,pvrtcSupported:!1}:(this.workerConfig={astcSupported:e.extensions.has("WEBGL_compressed_texture_astc"),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")},e.capabilities.isWebGL2&&(this.workerConfig.etc1Supported=!1)),this}init(){if(!this.transcoderPending){const e=new o.Y9S(this.manager);e.setPath(this.transcoderPath),e.setWithCredentials(this.withCredentials);const t=e.loadAsync("basis_transcoder.js"),s=new o.Y9S(this.manager);s.setPath(this.transcoderPath),s.setResponseType("arraybuffer"),s.setWithCredentials(this.withCredentials);const r=s.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([t,r]).then((([e,t])=>{const s=KTX2Loader.BasisWorker.toString(),r=["/* constants */","let _EngineFormat = "+JSON.stringify(KTX2Loader.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(KTX2Loader.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(KTX2Loader.BasisFormat),"/* basis_transcoder.js */",e,"/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([r])),this.transcoderBinary=t,this.workerPool.setWorkerCreator((()=>{const e=new Worker(this.workerSourceURL),t=this.transcoderBinary.slice(0);return e.postMessage({type:"init",config:this.workerConfig,transcoderBinary:t},[t]),e}))})),Rt>0&&St.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),Rt++}return this.transcoderPending}load(e,t,s,r){if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");const A=new o.Y9S(this.manager);A.setResponseType("arraybuffer"),A.setWithCredentials(this.withCredentials),A.load(e,(e=>{if(Mt.has(e)){return Mt.get(e).promise.then(t).catch(r)}this._createTexture(e).then((e=>t?t(e):null)).catch(r)}),s,r)}_createTextureFrom(e,t){const{faces:s,width:r,height:A,format:l,type:h,error:c,dfdFlags:d}=e;if("error"===h)return Promise.reject(c);let g;if(6===t.faceCount)g=new o.c5h(s,l,o.OUM);else{const e=s[0].mipmaps;g=t.layerCount>1?new o.iOZ(e,r,A,t.layerCount,l,o.OUM):new o.FvD(e,r,A,l,o.OUM)}return g.minFilter=1===s[0].mipmaps.length?o.k6q:o.$_I,g.magFilter=o.k6q,g.generateMipmaps=!1,g.needsUpdate=!0,g.colorSpace=parseColorSpace(t),g.premultiplyAlpha=!!(1&d),g}async _createTexture(e,t={}){const s=function Pi(e){const t=new Uint8Array(e.buffer,e.byteOffset,Bt.length);if(t[0]!==Bt[0]||t[1]!==Bt[1]||t[2]!==Bt[2]||t[3]!==Bt[3]||t[4]!==Bt[4]||t[5]!==Bt[5]||t[6]!==Bt[6]||t[7]!==Bt[7]||t[8]!==Bt[8]||t[9]!==Bt[9]||t[10]!==Bt[10]||t[11]!==Bt[11])throw new Error("Missing KTX 2.0 identifier.");const s=new Si,r=17*Uint32Array.BYTES_PER_ELEMENT,o=new Ii(e,Bt.length,r,!0);s.vkFormat=o._nextUint32(),s.typeSize=o._nextUint32(),s.pixelWidth=o._nextUint32(),s.pixelHeight=o._nextUint32(),s.pixelDepth=o._nextUint32(),s.layerCount=o._nextUint32(),s.faceCount=o._nextUint32();const A=o._nextUint32();s.supercompressionScheme=o._nextUint32();const l=o._nextUint32(),h=o._nextUint32(),c=o._nextUint32(),d=o._nextUint32(),g=o._nextUint64(),p=o._nextUint64(),m=new Ii(e,Bt.length+r,3*A*8,!0);for(let t=0;t<A;t++)s.levels.push({levelData:new Uint8Array(e.buffer,e.byteOffset+m._nextUint64(),m._nextUint64()),uncompressedByteLength:m._nextUint64()});const f=new Ii(e,l,h,!0),I={vendorId:f._skip(4)._nextUint16(),descriptorType:f._nextUint16(),versionNumber:f._nextUint16(),descriptorBlockSize:f._nextUint16(),colorModel:f._nextUint8(),colorPrimaries:f._nextUint8(),transferFunction:f._nextUint8(),flags:f._nextUint8(),texelBlockDimension:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],bytesPlane:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],samples:[]},E=(I.descriptorBlockSize/4-6)/4;for(let e=0;e<E;e++){const t={bitOffset:f._nextUint16(),bitLength:f._nextUint8(),channelType:f._nextUint8(),samplePosition:[f._nextUint8(),f._nextUint8(),f._nextUint8(),f._nextUint8()],sampleLower:-1/0,sampleUpper:1/0};64&t.channelType?(t.sampleLower=f._nextInt32(),t.sampleUpper=f._nextInt32()):(t.sampleLower=f._nextUint32(),t.sampleUpper=f._nextUint32()),I.samples[e]=t}s.dataFormatDescriptor.length=0,s.dataFormatDescriptor.push(I);const C=new Ii(e,c,d,!0);for(;C._offset<d;){const e=C._nextUint32(),t=C._scan(e),r=Ei(t),o=C._scan(e-t.byteLength);s.keyValue[r]=r.match(/^ktx/i)?Ei(o):o,C._offset%4&&C._skip(4-C._offset%4)}if(p<=0)return s;const B=new Ii(e,g,p,!0),y=B._nextUint16(),Q=B._nextUint16(),x=B._nextUint32(),b=B._nextUint32(),S=B._nextUint32(),T=B._nextUint32(),F=[];for(let e=0;e<A;e++)F.push({imageFlags:B._nextUint32(),rgbSliceByteOffset:B._nextUint32(),rgbSliceByteLength:B._nextUint32(),alphaSliceByteOffset:B._nextUint32(),alphaSliceByteLength:B._nextUint32()});const _=g+B._offset,U=_+x,G=U+b,O=G+S,q=new Uint8Array(e.buffer,e.byteOffset+_,x),$=new Uint8Array(e.buffer,e.byteOffset+U,b),J=new Uint8Array(e.buffer,e.byteOffset+G,S),K=new Uint8Array(e.buffer,e.byteOffset+O,T);return s.globalData={endpointCount:y,selectorCount:Q,imageDescs:F,endpointsData:q,selectorsData:$,tablesData:J,extendedData:K},s}(new Uint8Array(e));if(0!==s.vkFormat)return async function createRawTexture(e){const{vkFormat:t}=e;if(void 0===Lt[t])throw new Error("THREE.KTX2Loader: Unsupported vkFormat.");let s;2===e.supercompressionScheme&&(Tt||(Tt=new Promise((async e=>{const t=new zstddec_module_Q;await t.init(),e(t)}))),s=await Tt);const r=[];for(let A=0;A<e.levels.length;A++){const l=Math.max(1,e.pixelWidth>>A),h=Math.max(1,e.pixelHeight>>A),c=e.pixelDepth?Math.max(1,e.pixelDepth>>A):0,d=e.levels[A];let g,p;if(0===e.supercompressionScheme)g=d.levelData;else{if(2!==e.supercompressionScheme)throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");g=s.decode(d.levelData,d.uncompressedByteLength)}p=Ft[t]===o.RQf?new Float32Array(g.buffer,g.byteOffset,g.byteLength/Float32Array.BYTES_PER_ELEMENT):Ft[t]===o.ix0?new Uint16Array(g.buffer,g.byteOffset,g.byteLength/Uint16Array.BYTES_PER_ELEMENT):g,r.push({data:p,width:l,height:h,depth:c})}let A;if(Dt.has(Lt[t]))A=0===e.pixelDepth?new o.GYF(r[0].data,e.pixelWidth,e.pixelHeight):new o.dYF(r[0].data,e.pixelWidth,e.pixelHeight,e.pixelDepth);else{if(e.pixelDepth>0)throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");A=new o.FvD(r,e.pixelWidth,e.pixelHeight)}return A.mipmaps=r,A.type=Ft[t],A.format=Lt[t],A.colorSpace=parseColorSpace(e),A.needsUpdate=!0,Promise.resolve(A)}(s);const r=t,A=this.init().then((()=>this.workerPool.postMessage({type:"transcode",buffer:e,taskConfig:r},[e]))).then((e=>this._createTextureFrom(e.data,s)));return Mt.set(e,{promise:A}),A}dispose(){return this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),Rt--,this}}KTX2Loader.BasisFormat={ETC1S:0,UASTC_4x4:1},KTX2Loader.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16},KTX2Loader.EngineFormat={RGBAFormat:o.GWd,RGBA_ASTC_4x4_Format:o.qa3,RGBA_BPTC_Format:o.Fn,RGBA_ETC2_EAC_Format:o.KDk,RGBA_PVRTC_4BPPV1_Format:o.HXV,RGBA_S3TC_DXT5_Format:o.BXX,RGB_ETC1_Format:o.CVz,RGB_ETC2_Format:o.Riy,RGB_PVRTC_4BPPV1_Format:o.k6Q,RGB_S3TC_DXT1_Format:o.IE4},KTX2Loader.BasisWorker=function(){let e,t,s;const r=_EngineFormat,o=_TranscoderFormat,A=_BasisFormat;self.addEventListener("message",(function(l){const d=l.data;switch(d.type){case"init":e=d.config,function init(e){t=new Promise((t=>{s={wasmBinary:e,onRuntimeInitialized:t},BASIS(s)})).then((()=>{s.initializeBasis(),void 0===s.KTX2File&&St.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")}))}(d.transcoderBinary);break;case"transcode":t.then((()=>{try{const{faces:t,buffers:l,width:g,height:p,hasAlpha:m,format:f,dfdFlags:I}=function transcode(t){const l=new s.KTX2File(new Uint8Array(t));function cleanup(){l.close(),l.delete()}if(!l.isValid())throw cleanup(),new Error("THREE.KTX2Loader:\tInvalid or unsupported .ktx2 file");const d=l.isUASTC()?A.UASTC_4x4:A.ETC1S,g=l.getWidth(),p=l.getHeight(),m=l.getLayers()||1,f=l.getLevels(),I=l.getFaces(),E=l.getHasAlpha(),C=l.getDFDFlags(),{transcoderFormat:B,engineFormat:y}=function getTranscoderFormat(t,s,l,d){let g,p;const m=t===A.ETC1S?h:c;for(let r=0;r<m.length;r++){const o=m[r];if(e[o.if]&&(o.basisFormat.includes(t)&&!(d&&o.transcoderFormat.length<2)&&(!o.needsPowerOfTwo||isPowerOfTwo(s)&&isPowerOfTwo(l))))return g=o.transcoderFormat[d?1:0],p=o.engineFormat[d?1:0],{transcoderFormat:g,engineFormat:p}}return St.warn("THREE.KTX2Loader: No suitable compressed texture format found. Decoding to RGBA32."),g=o.RGBA32,p=r.RGBAFormat,{transcoderFormat:g,engineFormat:p}}(d,g,p,E);if(!g||!p||!f)throw cleanup(),new Error("THREE.KTX2Loader:\tInvalid texture");if(!l.startTranscoding())throw cleanup(),new Error("THREE.KTX2Loader: .startTranscoding failed");const Q=[],x=[];for(let e=0;e<I;e++){const t=[];for(let s=0;s<f;s++){const r=[];let o,A;for(let t=0;t<m;t++){const h=l.getImageLevelInfo(s,t,e);0!==e||0!==s||0!==t||h.origWidth%4==0&&h.origHeight%4==0||St.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."),f>1?(o=h.origWidth,A=h.origHeight):(o=h.width,A=h.height);const c=new Uint8Array(l.getImageTranscodedSizeInBytes(s,t,0,B));if(!l.transcodeImage(c,s,t,e,B,0,-1,-1))throw cleanup(),new Error("THREE.KTX2Loader: .transcodeImage failed.");r.push(c)}const h=concat(r);t.push({data:h,width:o,height:A}),x.push(h.buffer)}Q.push({mipmaps:t,width:g,height:p,format:y})}return cleanup(),{faces:Q,buffers:x,width:g,height:p,hasAlpha:E,format:y,dfdFlags:C}}(d.buffer);self.postMessage({type:"transcode",id:d.id,faces:t,width:g,height:p,hasAlpha:m,format:f,dfdFlags:I},l)}catch(e){St.error(e),self.postMessage({type:"error",id:d.id,error:e.message})}}))}}));const l=[{if:"astcSupported",basisFormat:[A.UASTC_4x4],transcoderFormat:[o.ASTC_4x4,o.ASTC_4x4],engineFormat:[r.RGBA_ASTC_4x4_Format,r.RGBA_ASTC_4x4_Format],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[A.ETC1S,A.UASTC_4x4],transcoderFormat:[o.BC7_M5,o.BC7_M5],engineFormat:[r.RGBA_BPTC_Format,r.RGBA_BPTC_Format],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[A.ETC1S,A.UASTC_4x4],transcoderFormat:[o.BC1,o.BC3],engineFormat:[r.RGB_S3TC_DXT1_Format,r.RGBA_S3TC_DXT5_Format],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[A.ETC1S,A.UASTC_4x4],transcoderFormat:[o.ETC1,o.ETC2],engineFormat:[r.RGB_ETC2_Format,r.RGBA_ETC2_EAC_Format],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[A.ETC1S,A.UASTC_4x4],transcoderFormat:[o.ETC1],engineFormat:[r.RGB_ETC1_Format],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[A.ETC1S,A.UASTC_4x4],transcoderFormat:[o.PVRTC1_4_RGB,o.PVRTC1_4_RGBA],engineFormat:[r.RGB_PVRTC_4BPPV1_Format,r.RGBA_PVRTC_4BPPV1_Format],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0}],h=l.sort((function(e,t){return e.priorityETC1S-t.priorityETC1S})),c=l.sort((function(e,t){return e.priorityUASTC-t.priorityUASTC}));function isPowerOfTwo(e){return e<=2||!(e&e-1)&&0!==e}function concat(e){if(1===e.length)return e[0];let t=0;for(let s=0;s<e.length;s++){t+=e[s].byteLength}const s=new Uint8Array(t);let r=0;for(let t=0;t<e.length;t++){const o=e[t];s.set(o,r),r+=o.byteLength}return s}};const Dt=new Set([o.GWd,o.paN,o.VT0]),Lt={[It]:o.GWd,[pt]:o.GWd,[ct]:o.GWd,[ut]:o.GWd,[ft]:o.paN,[gt]:o.paN,[lt]:o.paN,[ht]:o.paN,[mt]:o.VT0,[dt]:o.VT0,[At]:o.VT0,[ot]:o.VT0,[Ct]:o.Qrf,[Et]:o.Qrf},Ft={[It]:o.RQf,[pt]:o.ix0,[ct]:o.OUM,[ut]:o.OUM,[ft]:o.RQf,[gt]:o.ix0,[lt]:o.OUM,[ht]:o.OUM,[mt]:o.RQf,[dt]:o.ix0,[At]:o.OUM,[ot]:o.OUM,[Ct]:o.OUM,[Et]:o.OUM};function parseColorSpace(e){const t=e.dataFormatDescriptor[0];return 1===t.colorPrimaries?2===t.transferFunction?o.er$:o.Zr2:10===t.colorPrimaries?2===t.transferFunction?o.V5c:o.qIQ:(0===t.colorPrimaries||St.warn(`THREE.KTX2Loader: Unsupported color primaries, "${t.colorPrimaries}"`),o.jf0)}var _t,kt;const Ut=Symbol("retainerCount"),Gt=Symbol("recentlyUsed"),Pt=Symbol("evict"),Nt=Symbol("evictionThreshold"),Ot=Symbol("cache");class CacheEvictionPolicy{constructor(e,t=5){this[_t]=new Map,this[kt]=[],this[Ot]=e,this[Nt]=t}set evictionThreshold(e){this[Nt]=e,this[Pt]()}get evictionThreshold(){return this[Nt]}get cache(){return this[Ot]}retainerCount(e){return this[Ut].get(e)||0}reset(){this[Ut].clear(),this[Gt]=[]}retain(e){this[Ut].has(e)||this[Ut].set(e,0),this[Ut].set(e,this[Ut].get(e)+1);const t=this[Gt].indexOf(e);-1!==t&&this[Gt].splice(t,1),this[Gt].unshift(e),this[Pt]()}release(e){this[Ut].has(e)&&this[Ut].set(e,Math.max(this[Ut].get(e)-1,0)),this[Pt]()}[(_t=Ut,kt=Gt,Pt)](){if(!(this[Gt].length<this[Nt]))for(let e=this[Gt].length-1;e>=this[Nt];--e){const t=this[Gt][e];0===this[Ut].get(t)&&(this[Ot].delete(t),this[Gt].splice(e,1))}}}const mappingsArrayToTable=e=>{const t=new Map;for(const s of e.mappings)for(const e of s.variants)t.set(e,{material:null,gltfMaterialIndex:s.material});return t};class GLTFMaterialsVariantsExtension{constructor(e){this.parser=e,this.name="KHR_materials_variants"}afterRoot(e){const t=this.parser,s=t.json;if(void 0===s.extensions||void 0===s.extensions[this.name])return null;const r=(e=>{const t=[],s=new Set;for(const r of e){let e=r,o=0;for(;s.has(e);)e=r+"."+ ++o;s.add(e),t.push(e)}return t})((s.extensions[this.name].variants||[]).map((e=>e.name)));for(const r of e.scenes)r.traverse((e=>{const r=e;if(!r.material)return;const o=t.associations.get(r);if(null==o||null==o.meshes||null==o.primitives)return;const A=s.meshes[o.meshes].primitives[o.primitives].extensions;A&&A[this.name]&&(r.userData.variantMaterials=mappingsArrayToTable(A[this.name]))}));return e.userData.variants=r,Promise.resolve()}}var Ht,qt,Vt=s(96763);o.gPd.DEFAULT_ANISOTROPY=4;const $t=new Map,Jt=new Map;let Kt;const Yt=new DRACOLoader;let zt;const jt=new KTX2Loader;let Wt,Xt;const Zt=Symbol("loader"),ei=Symbol("evictionPolicy"),ti=Symbol("GLTFInstance");class CachingGLTFLoader extends o.Qev{constructor(e){super(),this[qt]=(new GLTFLoader).register((e=>new GLTFMaterialsVariantsExtension(e))),this[ti]=e,this[Zt].setDRACOLoader(Yt),this[Zt].setKTX2Loader(jt)}static setDRACODecoderLocation(e){Kt=e,Yt.setDecoderPath(e)}static getDRACODecoderLocation(){return Kt}static setKTX2TranscoderLocation(e){zt=e,jt.setTranscoderPath(e)}static getKTX2TranscoderLocation(){return zt}static setMeshoptDecoderLocation(e){var t;Wt!==e&&(Wt=e,Xt=(t=e,new Promise(((e,s)=>{const r=document.createElement("script");document.body.appendChild(r),r.onload=e,r.onerror=s,r.async=!0,r.src=t}))).then((()=>MeshoptDecoder.ready)).then((()=>MeshoptDecoder)))}static getMeshoptDecoderLocation(){return Wt}static initializeKTX2Loader(e){jt.detectSupport(e)}static get cache(){return $t}static clearCache(){$t.forEach(((e,t)=>{this.delete(t)})),this[ei].reset()}static has(e){return $t.has(e)}static async delete(e){if(!this.has(e))return;const t=$t.get(e);Jt.delete(e),$t.delete(e);(await t).dispose()}static hasFinishedLoading(e){return!!Jt.get(e)}get[(Ht=ei,qt=Zt,ei)](){return this.constructor[ei]}async preload(e,t,s=()=>{}){if(this[Zt].setWithCredentials(CachingGLTFLoader.withCredentials),this.dispatchEvent({type:"preload",element:t,src:e}),!$t.has(e)){null!=Xt&&this[Zt].setMeshoptDecoder(await Xt);const t=((e,t,s=()=>{})=>{const onProgress=e=>{const t=e.loaded/e.total;s(Math.max(0,Math.min(1,isFinite(t)?t:1)))};return new Promise(((s,r)=>{t.load(e,s,onProgress,r)}))})(e,this[Zt],(e=>{s(.8*e)})),r=this[ti],o=t.then((e=>r.prepare(e))).then((e=>(s(.9),new r(e)))).catch((e=>(Vt.error(e),new r)));$t.set(e,o)}await $t.get(e),Jt.set(e,!0),s&&s(1)}async load(e,t,s=()=>{}){await this.preload(e,t,s);const r=await $t.get(e),o=await r.clone();return this[ei].retain(e),o.dispose=()=>{this[ei].release(e)},o}}CachingGLTFLoader[Ht]=new CacheEvictionPolicy(CachingGLTFLoader);class CSS2DObject extends o.B69{constructor(e=document.createElement("div")){super(),this.isCSS2DObject=!0,this.element=e,this.element.style.position="absolute",this.element.style.userSelect="none",this.element.setAttribute("draggable",!1),this.center=new o.I9Y(.5,.5),this.addEventListener("removed",(function(){this.traverse((function(e){e.element instanceof Element&&null!==e.element.parentNode&&e.element.parentNode.removeChild(e.element)}))}))}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this.center=e.center,this}}const ii=new o.Pq0,si=new o.kn4,ni=new o.kn4,ri=new o.Pq0,ai=new o.Pq0;class CSS2DRenderer{constructor(e={}){const t=this;let s,r,o,A;const l={objects:new WeakMap},h=void 0!==e.element?e.element:document.createElement("div");function renderObject(e,s,r){if(e.isCSS2DObject){ii.setFromMatrixPosition(e.matrixWorld),ii.applyMatrix4(ni);const c=!0===e.visible&&ii.z>=-1&&ii.z<=1&&!0===e.layers.test(r.layers);if(e.element.style.display=!0===c?"":"none",!0===c){e.onBeforeRender(t,s,r);const l=e.element;l.style.transform="translate("+-100*e.center.x+"%,"+-100*e.center.y+"%)translate("+(ii.x*o+o)+"px,"+(-ii.y*A+A)+"px)",l.parentNode!==h&&h.appendChild(l),e.onAfterRender(t,s,r)}const d={distanceToCameraSquared:getDistanceToSquared(r,e)};l.objects.set(e,d)}for(let t=0,o=e.children.length;t<o;t++)renderObject(e.children[t],s,r)}function getDistanceToSquared(e,t){return ri.setFromMatrixPosition(e.matrixWorld),ai.setFromMatrixPosition(t.matrixWorld),ri.distanceToSquared(ai)}h.style.overflow="hidden",this.domElement=h,this.getSize=function(){return{width:s,height:r}},this.render=function(e,t){!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),si.copy(t.matrixWorldInverse),ni.multiplyMatrices(t.projectionMatrix,si),renderObject(e,e,t),function zOrder(e){const t=function filterAndFlatten(e){const t=[];return e.traverse((function(e){e.isCSS2DObject&&t.push(e)})),t}(e).sort((function(e,t){if(e.renderOrder!==t.renderOrder)return t.renderOrder-e.renderOrder;return l.objects.get(e).distanceToCameraSquared-l.objects.get(t).distanceToCameraSquared})),s=t.length;for(let e=0,r=t.length;e<r;e++)t[e].element.style.zIndex=s-e}(e)},this.setSize=function(e,t){s=e,r=t,o=s/2,A=r/2,h.style.width=e+"px",h.style.height=t+"px"}}}s(96763);function reduceVertices(e,t,s){let r=s;const A=new o.Pq0;return e.updateWorldMatrix(!0,!0),e.traverseVisible((e=>{const{geometry:s}=e;if(void 0!==s){const{position:o}=s.attributes;if(void 0!==o)for(let s=0,l=o.count;s<l;s++)e.isMesh?e.getVertexPosition(s,A):A.fromBufferAttribute(o,s),e.isSkinnedMesh||A.applyMatrix4(e.matrixWorld),r=t(r,A)}})),r}let oi,Ai,li,hi;function decompress(e,t=1/0,s=null){Ai||(Ai=new o.bdM(2,2,1,1)),li||(li=new o.BKk({uniforms:{blitTexture:new o.nc$(e)},vertexShader:"\n\t\t\tvarying vec2 vUv;\n\t\t\tvoid main(){\n\t\t\t\tvUv = uv;\n\t\t\t\tgl_Position = vec4(position.xy * 1.0,0.,.999999);\n\t\t\t}",fragmentShader:"\n\t\t\tuniform sampler2D blitTexture; \n\t\t\tvarying vec2 vUv;\n\n\t\t\tvoid main(){ \n\t\t\t\tgl_FragColor = vec4(vUv.xy, 0, 1);\n\t\t\t\t\n\t\t\t\t#ifdef IS_SRGB\n\t\t\t\tgl_FragColor = LinearTosRGB( texture2D( blitTexture, vUv) );\n\t\t\t\t#else\n\t\t\t\tgl_FragColor = texture2D( blitTexture, vUv);\n\t\t\t\t#endif\n\t\t\t}"})),li.uniforms.blitTexture.value=e,li.defines.IS_SRGB=e.colorSpace==o.er$,li.needsUpdate=!0,hi||(hi=new o.eaF(Ai,li),hi.frustrumCulled=!1);const r=new o.ubm,A=new o.Z58;A.add(hi),null===s&&(s=oi=new o.JeP({antialias:!1}));const l=Math.min(e.image.width,t),h=Math.min(e.image.height,t);s.setSize(l,h),s.clear(),s.render(A,r);const c=document.createElement("canvas"),d=c.getContext("2d");c.width=l,c.height=h,d.drawImage(s.domElement,0,0,l,h);const g=new o.GOR(c);return g.minFilter=e.minFilter,g.magFilter=e.magFilter,g.wrapS=e.wrapS,g.wrapT=e.wrapT,g.name=e.name,oi&&(oi.forceContextLoss(),oi.dispose(),oi=null),g}var ci=s(96763);const ui={POSITION:["byte","byte normalized","unsigned byte","unsigned byte normalized","short","short normalized","unsigned short","unsigned short normalized"],NORMAL:["byte normalized","short normalized"],TANGENT:["byte normalized","short normalized"],TEXCOORD:["byte","byte normalized","unsigned byte","short","short normalized","unsigned short"]};class GLTFExporter{constructor(){this.pluginCallbacks=[],this.register((function(e){return new GLTFLightExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsUnlitExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsTransmissionExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsVolumeExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsIorExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsSpecularExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsClearcoatExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsIridescenceExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsSheenExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsAnisotropyExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsEmissiveStrengthExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMaterialsBumpExtension(e)})),this.register((function(e){return new GLTFExporter_GLTFMeshGpuInstancing(e)}))}register(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,s,r){const o=new GLTFWriter,A=[];for(let e=0,t=this.pluginCallbacks.length;e<t;e++)A.push(this.pluginCallbacks[e](o));o.setPlugins(A),o.write(e,t,r).catch(s)}parseAsync(e,t){const s=this;return new Promise((function(r,o){s.parse(e,r,o,t)}))}}const di=0,gi=1,pi=2,mi=3,fi=4,Ci=5120,Bi=5121,yi=5122,wi=5123,vi=5124,Qi=5125,xi=5126,bi=34962,Mi=34963,Ti=9728,Ri=9729,Di=9984,Li=9985,Fi=9986,_i=9987,ki=33071,Ui=33648,Gi=10497,Ni="KHR_mesh_quantization",Oi={};Oi[o.hxR]=Ti,Oi[o.pHI]=Di,Oi[o.Cfg]=Fi,Oi[o.k6q]=Ri,Oi[o.kRr]=Li,Oi[o.$_I]=_i,Oi[o.ghU]=ki,Oi[o.GJx]=Gi,Oi[o.kTW]=Ui;const Hi={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"},qi=new o.Q1f;function equalArray(e,t){return e.length===t.length&&e.every((function(e,s){return e===t[s]}))}function getPaddedBufferSize(e){return 4*Math.ceil(e/4)}function getPaddedArrayBuffer(e,t=0){const s=getPaddedBufferSize(e.byteLength);if(s!==e.byteLength){const r=new Uint8Array(s);if(r.set(new Uint8Array(e)),0!==t)for(let o=e.byteLength;o<s;o++)r[o]=t;return r.buffer}return e}function getCanvas(){return"undefined"==typeof document&&"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas")}function getToBlobPromise(e,t){if(void 0!==e.toBlob)return new Promise((s=>e.toBlob(s,t)));let s;return"image/jpeg"===t?s=.92:"image/webp"===t&&(s=.8),e.convertToBlob({type:t,quality:s})}class GLTFWriter{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}setPlugins(e){this.plugins=e}async write(e,t,s={}){this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},s),this.options.animations.length>0&&(this.options.trs=!0),this.processInput(e),await Promise.all(this.pending);const r=this,o=r.buffers,A=r.json;s=r.options;const l=r.extensionsUsed,h=r.extensionsRequired,c=new Blob(o,{type:"application/octet-stream"}),d=Object.keys(l),g=Object.keys(h);if(d.length>0&&(A.extensionsUsed=d),g.length>0&&(A.extensionsRequired=g),A.buffers&&A.buffers.length>0&&(A.buffers[0].byteLength=c.size),!0===s.binary){const e=new FileReader;e.readAsArrayBuffer(c),e.onloadend=function(){const s=getPaddedArrayBuffer(e.result),r=new DataView(new ArrayBuffer(8));r.setUint32(0,s.byteLength,!0),r.setUint32(4,5130562,!0);const o=getPaddedArrayBuffer(function stringToArrayBuffer(e){return(new TextEncoder).encode(e).buffer}(JSON.stringify(A)),32),l=new DataView(new ArrayBuffer(8));l.setUint32(0,o.byteLength,!0),l.setUint32(4,1313821514,!0);const h=new ArrayBuffer(12),c=new DataView(h);c.setUint32(0,1179937895,!0),c.setUint32(4,2,!0);const d=12+l.byteLength+o.byteLength+r.byteLength+s.byteLength;c.setUint32(8,d,!0);const g=new Blob([h,l,o,r,s],{type:"application/octet-stream"}),p=new FileReader;p.readAsArrayBuffer(g),p.onloadend=function(){t(p.result)}}}else if(A.buffers&&A.buffers.length>0){const e=new FileReader;e.readAsDataURL(c),e.onloadend=function(){const s=e.result;A.buffers[0].uri=s,t(A)}}else t(A)}serializeUserData(e,t){if(0===Object.keys(e.userData).length)return;const s=this.options,r=this.extensionsUsed;try{const o=JSON.parse(JSON.stringify(e.userData));if(s.includeCustomExtensions&&o.gltfExtensions){void 0===t.extensions&&(t.extensions={});for(const e in o.gltfExtensions)t.extensions[e]=o.gltfExtensions[e],r[e]=!0;delete o.gltfExtensions}Object.keys(o).length>0&&(t.extras=o)}catch(t){ci.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+t.message)}}getUID(e,t=!1){if(!1===this.uids.has(e)){const t=new Map;t.set(!0,this.uid++),t.set(!1,this.uid++),this.uids.set(e,t)}return this.uids.get(e).get(t)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;const t=new o.Pq0;for(let s=0,r=e.count;s<r;s++)if(Math.abs(t.fromBufferAttribute(e,s).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 s=e.clone(),r=new o.Pq0;for(let e=0,t=s.count;e<t;e++)r.fromBufferAttribute(s,e),0===r.x&&0===r.y&&0===r.z?r.setX(1):r.normalize(),s.setXYZ(e,r.x,r.y,r.z);return t.attributesNormalized.set(e,s),s}applyTextureTransform(e,t){let s=!1;const r={};0===t.offset.x&&0===t.offset.y||(r.offset=t.offset.toArray(),s=!0),0!==t.rotation&&(r.rotation=t.rotation,s=!0),1===t.repeat.x&&1===t.repeat.y||(r.scale=t.repeat.toArray(),s=!0),s&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=r,this.extensionsUsed.KHR_texture_transform=!0)}buildMetalRoughTexture(e,t){if(e===t)return e;function getEncodingConversion(e){return e.colorSpace===o.er$?function SRGBToLinear(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}:function LinearToLinear(e){return e}}ci.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures."),e instanceof o.FvD&&(e=decompress(e)),t instanceof o.FvD&&(t=decompress(t));const s=e?e.image:null,r=t?t.image:null,A=Math.max(s?s.width:0,r?r.width:0),l=Math.max(s?s.height:0,r?r.height:0),h=getCanvas();h.width=A,h.height=l;const c=h.getContext("2d");c.fillStyle="#00ffff",c.fillRect(0,0,A,l);const d=c.getImageData(0,0,A,l);if(s){c.drawImage(s,0,0,A,l);const t=getEncodingConversion(e),r=c.getImageData(0,0,A,l).data;for(let e=2;e<r.length;e+=4)d.data[e]=256*t(r[e]/256)}if(r){c.drawImage(r,0,0,A,l);const e=getEncodingConversion(t),s=c.getImageData(0,0,A,l).data;for(let t=1;t<s.length;t+=4)d.data[t]=256*e(s[t]/256)}c.putImageData(d,0,0);const g=(e||t).clone();return g.source=new o.kLi(h),g.colorSpace=o.jf0,g.channel=(e||t).channel,e&&t&&e.channel!==t.channel&&ci.warn("THREE.GLTFExporter: UV channels for metalnessMap and roughnessMap textures must match."),g}processBuffer(e){const t=this.json,s=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),s.push(e),0}processBufferView(e,t,s,r,A){const l=this.json;let h;switch(l.bufferViews||(l.bufferViews=[]),t){case Ci:case Bi:h=1;break;case yi:case wi:h=2;break;default:h=4}const c=getPaddedBufferSize(r*e.itemSize*h),d=new DataView(new ArrayBuffer(c));let g=0;for(let A=s;A<s+r;A++)for(let s=0;s<e.itemSize;s++){let r;e.itemSize>4?r=e.array[A*e.itemSize+s]:(0===s?r=e.getX(A):1===s?r=e.getY(A):2===s?r=e.getZ(A):3===s&&(r=e.getW(A)),!0===e.normalized&&(r=o.cj9.normalize(r,e.array))),t===xi?d.setFloat32(g,r,!0):t===vi?d.setInt32(g,r,!0):t===Qi?d.setUint32(g,r,!0):t===yi?d.setInt16(g,r,!0):t===wi?d.setUint16(g,r,!0):t===Ci?d.setInt8(g,r):t===Bi&&d.setUint8(g,r),g+=h}const p={buffer:this.processBuffer(d.buffer),byteOffset:this.byteOffset,byteLength:c};void 0!==A&&(p.target=A),A===bi&&(p.byteStride=e.itemSize*h),this.byteOffset+=c,l.bufferViews.push(p);return{id:l.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){const t=this,s=t.json;return s.bufferViews||(s.bufferViews=[]),new Promise((function(r){const o=new FileReader;o.readAsArrayBuffer(e),o.onloadend=function(){const e=getPaddedArrayBuffer(o.result),A={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,r(s.bufferViews.push(A)-1)}}))}processAccessor(e,t,s,r){const A=this.json;let l;if(e.array.constructor===Float32Array)l=xi;else if(e.array.constructor===Int32Array)l=vi;else if(e.array.constructor===Uint32Array)l=Qi;else if(e.array.constructor===Int16Array)l=yi;else if(e.array.constructor===Uint16Array)l=wi;else if(e.array.constructor===Int8Array)l=Ci;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: "+e.array.constructor.name);l=Bi}if(void 0===s&&(s=0),void 0!==r&&r!==1/0||(r=e.count),0===r)return null;const h=function getMinMax(e,t,s){const r={min:new Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)};for(let A=t;A<t+s;A++)for(let t=0;t<e.itemSize;t++){let s;e.itemSize>4?s=e.array[A*e.itemSize+t]:(0===t?s=e.getX(A):1===t?s=e.getY(A):2===t?s=e.getZ(A):3===t&&(s=e.getW(A)),!0===e.normalized&&(s=o.cj9.normalize(s,e.array))),r.min[t]=Math.min(r.min[t],s),r.max[t]=Math.max(r.max[t],s)}return r}(e,s,r);let c;void 0!==t&&(c=e===t.index?Mi:bi);const d=this.processBufferView(e,l,s,r,c),g={bufferView:d.id,byteOffset:d.byteOffset,componentType:l,count:r,max:h.max,min:h.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",9:"MAT3",16:"MAT4"}[e.itemSize]};return!0===e.normalized&&(g.normalized=!0),A.accessors||(A.accessors=[]),A.accessors.push(g)-1}processImage(e,t,s,r="image/png"){if(null!==e){const A=this,l=A.cache,h=A.json,c=A.options,d=A.pending;l.images.has(e)||l.images.set(e,{});const g=l.images.get(e),p=r+":flipY/"+s.toString();if(void 0!==g[p])return g[p];h.images||(h.images=[]);const m={mimeType:r},f=getCanvas();f.width=Math.min(e.width,c.maxTextureSize),f.height=Math.min(e.height,c.maxTextureSize);const I=f.getContext("2d");if(!0===s&&(I.translate(0,f.height),I.scale(1,-1)),void 0!==e.data){t!==o.GWd&&ci.error("GLTFExporter: Only RGBAFormat is supported.",t),(e.width>c.maxTextureSize||e.height>c.maxTextureSize)&&ci.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);const s=new Uint8ClampedArray(e.height*e.width*4);for(let t=0;t<s.length;t+=4)s[t+0]=e.data[t+0],s[t+1]=e.data[t+1],s[t+2]=e.data[t+2],s[t+3]=e.data[t+3];I.putImageData(new ImageData(s,e.width,e.height),0,0)}else I.drawImage(e,0,0,f.width,f.height);!0===c.binary?d.push(getToBlobPromise(f,r).then((e=>A.processBufferViewImage(e))).then((e=>{m.bufferView=e}))):void 0!==f.toDataURL?m.uri=f.toDataURL(r):d.push(getToBlobPromise(f,r).then((e=>(new FileReader).readAsDataURL(e))).then((e=>{m.uri=e})));const E=h.images.push(m)-1;return g[p]=E,E}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 s={magFilter:Oi[e.magFilter],minFilter:Oi[e.minFilter],wrapS:Oi[e.wrapS],wrapT:Oi[e.wrapT]};return t.samplers.push(s)-1}processTexture(e){const t=this.options,s=this.cache,r=this.json;if(s.textures.has(e))return s.textures.get(e);r.textures||(r.textures=[]),e instanceof o.FvD&&(e=decompress(e,t.maxTextureSize));let A=e.userData.mimeType;"image/webp"===A&&(A="image/png");const l={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,A)};e.name&&(l.name=e.name),this._invokeAll((function(t){t.writeTexture&&t.writeTexture(e,l)}));const h=r.textures.push(l)-1;return s.textures.set(e,h),h}processMaterial(e){const t=this.cache,s=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return ci.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;s.materials||(s.materials=[]);const r={pbrMetallicRoughness:{}};!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&ci.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");const A=e.color.toArray().concat([e.opacity]);if(equalArray(A,[1,1,1,1])||(r.pbrMetallicRoughness.baseColorFactor=A),e.isMeshStandardMaterial?(r.pbrMetallicRoughness.metallicFactor=e.metalness,r.pbrMetallicRoughness.roughnessFactor=e.roughness):(r.pbrMetallicRoughness.metallicFactor=.5,r.pbrMetallicRoughness.roughnessFactor=.5),e.metalnessMap||e.roughnessMap){const t=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),s={index:this.processTexture(t),channel:t.channel};this.applyTextureTransform(s,t),r.pbrMetallicRoughness.metallicRoughnessTexture=s}if(e.map){const t={index:this.processTexture(e.map),texCoord:e.map.channel};this.applyTextureTransform(t,e.map),r.pbrMetallicRoughness.baseColorTexture=t}if(e.emissive){const t=e.emissive;if(Math.max(t.r,t.g,t.b)>0&&(r.emissiveFactor=e.emissive.toArray()),e.emissiveMap){const t={index:this.processTexture(e.emissiveMap),texCoord:e.emissiveMap.channel};this.applyTextureTransform(t,e.emissiveMap),r.emissiveTexture=t}}if(e.normalMap){const t={index:this.processTexture(e.normalMap),texCoord:e.normalMap.channel};e.normalScale&&1!==e.normalScale.x&&(t.scale=e.normalScale.x),this.applyTextureTransform(t,e.normalMap),r.normalTexture=t}if(e.aoMap){const t={index:this.processTexture(e.aoMap),texCoord:e.aoMap.channel};1!==e.aoMapIntensity&&(t.strength=e.aoMapIntensity),this.applyTextureTransform(t,e.aoMap),r.occlusionTexture=t}e.transparent?r.alphaMode="BLEND":e.alphaTest>0&&(r.alphaMode="MASK",r.alphaCutoff=e.alphaTest),e.side===o.$EB&&(r.doubleSided=!0),""!==e.name&&(r.name=e.name),this.serializeUserData(e,r),this._invokeAll((function(t){t.writeMaterial&&t.writeMaterial(e,r)}));const l=s.materials.push(r)-1;return t.materials.set(e,l),l}processMesh(e){const t=this.cache,s=this.json,r=[e.geometry.uuid];if(Array.isArray(e.material))for(let t=0,s=e.material.length;t<s;t++)r.push(e.material[t].uuid);else r.push(e.material.uuid);const A=r.join(":");if(t.meshes.has(A))return t.meshes.get(A);const l=e.geometry;let h;h=e.isLineSegments?gi:e.isLineLoop?pi:e.isLine?mi:e.isPoints?di:e.material.wireframe?gi:fi;const c={},d={},g=[],p=[],m={uv:"TEXCOORD_0",uv1:"TEXCOORD_1",uv2:"TEXCOORD_2",uv3:"TEXCOORD_3",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},f=l.getAttribute("normal");void 0===f||this.isNormalizedNormalAttribute(f)||(ci.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),l.setAttribute("normal",this.createNormalizedNormalAttribute(f)));let I=null;for(let e in l.attributes){if("morph"===e.slice(0,5))continue;const s=l.attributes[e];e=m[e]||e.toUpperCase();if(/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(e)||(e="_"+e),t.attributes.has(this.getUID(s))){d[e]=t.attributes.get(this.getUID(s));continue}I=null;const r=s.array;"JOINTS_0"!==e||r instanceof Uint16Array||r instanceof Uint8Array||(ci.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),I=new o.THS(new Uint16Array(r),s.itemSize,s.normalized));const A=this.processAccessor(I||s,l);null!==A&&(e.startsWith("_")||this.detectMeshQuantization(e,s),d[e]=A,t.attributes.set(this.getUID(s),A))}if(void 0!==f&&l.setAttribute("normal",f),0===Object.keys(d).length)return null;if(void 0!==e.morphTargetInfluences&&e.morphTargetInfluences.length>0){const s=[],r=[],o={};if(void 0!==e.morphTargetDictionary)for(const t in e.morphTargetDictionary)o[e.morphTargetDictionary[t]]=t;for(let A=0;A<e.morphTargetInfluences.length;++A){const h={};let c=!1;for(const e in l.morphAttributes){if("position"!==e&&"normal"!==e){c||(ci.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),c=!0);continue}const s=l.morphAttributes[e][A],r=e.toUpperCase(),o=l.attributes[e];if(t.attributes.has(this.getUID(s,!0))){h[r]=t.attributes.get(this.getUID(s,!0));continue}const d=s.clone();if(!l.morphTargetsRelative)for(let e=0,t=s.count;e<t;e++)for(let t=0;t<s.itemSize;t++)0===t&&d.setX(e,s.getX(e)-o.getX(e)),1===t&&d.setY(e,s.getY(e)-o.getY(e)),2===t&&d.setZ(e,s.getZ(e)-o.getZ(e)),3===t&&d.setW(e,s.getW(e)-o.getW(e));h[r]=this.processAccessor(d,l),t.attributes.set(this.getUID(o,!0),h[r])}p.push(h),s.push(e.morphTargetInfluences[A]),void 0!==e.morphTargetDictionary&&r.push(o[A])}c.weights=s,r.length>0&&(c.extras={},c.extras.targetNames=r)}const E=Array.isArray(e.material);if(E&&0===l.groups.length)return null;let C=!1;if(E&&null===l.index){const e=[];for(let t=0,s=l.attributes.position.count;t<s;t++)e[t]=t;l.setIndex(e),C=!0}const B=E?e.material:[e.material],y=E?l.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let e=0,s=y.length;e<s;e++){const s={mode:h,attributes:d};if(this.serializeUserData(l,s),p.length>0&&(s.targets=p),null!==l.index){let r=this.getUID(l.index);void 0===y[e].start&&void 0===y[e].count||(r+=":"+y[e].start+":"+y[e].count),t.attributes.has(r)?s.indices=t.attributes.get(r):(s.indices=this.processAccessor(l.index,l,y[e].start,y[e].count),t.attributes.set(r,s.indices)),null===s.indices&&delete s.indices}const r=this.processMaterial(B[y[e].materialIndex]);null!==r&&(s.material=r),g.push(s)}!0===C&&l.setIndex(null),c.primitives=g,s.meshes||(s.meshes=[]),this._invokeAll((function(t){t.writeMesh&&t.writeMesh(e,c)}));const Q=s.meshes.push(c)-1;return t.meshes.set(A,Q),Q}detectMeshQuantization(e,t){if(this.extensionsUsed[Ni])return;let s;switch(t.array.constructor){case Int8Array:s="byte";break;case Uint8Array:s="unsigned byte";break;case Int16Array:s="short";break;case Uint16Array:s="unsigned short";break;default:return}t.normalized&&(s+=" normalized");const r=e.split("_",1)[0];ui[r]&&ui[r].includes(s)&&(this.extensionsUsed[Ni]=!0,this.extensionsRequired[Ni]=!0)}processCamera(e){const t=this.json;t.cameras||(t.cameras=[]);const s=e.isOrthographicCamera,r={type:s?"orthographic":"perspective"};return s?r.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:r.perspective={aspectRatio:e.aspect,yfov:o.cj9.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(r.name=e.type),t.cameras.push(r)-1}processAnimation(e,t){const s=this.json,r=this.nodeMap;s.animations||(s.animations=[]);const A=(e=GLTFExporter.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks,l=[],h=[];for(let e=0;e<A.length;++e){const s=A[e],c=o.Nwf.parseTrackName(s.name);let d=o.Nwf.findNode(t,c.nodeName);const g=Hi[c.propertyName];if("bones"===c.objectName&&(d=!0===d.isSkinnedMesh?d.skeleton.getBoneByName(c.objectIndex):void 0),!d||!g)return ci.warn('THREE.GLTFExporter: Could not export animation track "%s".',s.name),null;const p=1;let m,f=s.values.length/s.times.length;g===Hi.morphTargetInfluences&&(f/=d.morphTargetInfluences.length),!0===s.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(m="CUBICSPLINE",f/=3):m=s.getInterpolation()===o.ljd?"STEP":"LINEAR",h.push({input:this.processAccessor(new o.THS(s.times,p)),output:this.processAccessor(new o.THS(s.values,f)),interpolation:m}),l.push({sampler:h.length-1,target:{node:r.get(d),path:g}})}return s.animations.push({name:e.name||"clip_"+s.animations.length,samplers:h,channels:l}),s.animations.length-1}processSkin(e){const t=this.json,s=this.nodeMap,r=t.nodes[s.get(e)],A=e.skeleton;if(void 0===A)return null;const l=e.skeleton.bones[0];if(void 0===l)return null;const h=[],c=new Float32Array(16*A.bones.length),d=new o.kn4;for(let t=0;t<A.bones.length;++t)h.push(s.get(A.bones[t])),d.copy(A.boneInverses[t]),d.multiply(e.bindMatrix).toArray(c,16*t);void 0===t.skins&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new o.THS(c,16)),joints:h,skeleton:s.get(l)});return r.skin=t.skins.length-1}processNode(e){const t=this.json,s=this.options,r=this.nodeMap;t.nodes||(t.nodes=[]);const o={};if(s.trs){const t=e.quaternion.toArray(),s=e.position.toArray(),r=e.scale.toArray();equalArray(t,[0,0,0,1])||(o.rotation=t),equalArray(s,[0,0,0])||(o.translation=s),equalArray(r,[1,1,1])||(o.scale=r)}else e.matrixAutoUpdate&&e.updateMatrix(),!1===function isIdentityMatrix(e){return equalArray(e.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}(e.matrix)&&(o.matrix=e.matrix.elements);if(""!==e.name&&(o.name=String(e.name)),this.serializeUserData(e,o),e.isMesh||e.isLine||e.isPoints){const t=this.processMesh(e);null!==t&&(o.mesh=t)}else e.isCamera&&(o.camera=this.processCamera(e));if(e.isSkinnedMesh&&this.skins.push(e),e.children.length>0){const t=[];for(let r=0,o=e.children.length;r<o;r++){const o=e.children[r];if(o.visible||!1===s.onlyVisible){const e=this.processNode(o);null!==e&&t.push(e)}}t.length>0&&(o.children=t)}this._invokeAll((function(t){t.writeNode&&t.writeNode(e,o)}));const A=t.nodes.push(o)-1;return r.set(e,A),A}processScene(e){const t=this.json,s=this.options;t.scenes||(t.scenes=[],t.scene=0);const r={};""!==e.name&&(r.name=e.name),t.scenes.push(r);const o=[];for(let t=0,r=e.children.length;t<r;t++){const r=e.children[t];if(r.visible||!1===s.onlyVisible){const e=this.processNode(r);null!==e&&o.push(e)}}o.length>0&&(r.nodes=o),this.serializeUserData(e,r)}processObjects(e){const t=new o.Z58;t.name="AuxScene";for(let s=0;s<e.length;s++)t.children.push(e[s]);this.processScene(t)}processInput(e){const t=this.options;e=e instanceof Array?e:[e],this._invokeAll((function(t){t.beforeParse&&t.beforeParse(e)}));const s=[];for(let t=0;t<e.length;t++)e[t]instanceof o.Z58?this.processScene(e[t]):s.push(e[t]);s.length>0&&this.processObjects(s);for(let e=0;e<this.skins.length;++e)this.processSkin(this.skins[e]);for(let s=0;s<t.animations.length;++s)this.processAnimation(t.animations[s],e[0]);this._invokeAll((function(t){t.afterParse&&t.afterParse(e)}))}_invokeAll(e){for(let t=0,s=this.plugins.length;t<s;t++)e(this.plugins[t])}}class GLTFLightExtension{constructor(e){this.writer=e,this.name="KHR_lights_punctual"}writeNode(e,t){if(!e.isLight)return;if(!e.isDirectionalLight&&!e.isPointLight&&!e.isSpotLight)return void ci.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e);const s=this.writer,r=s.json,o=s.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),void 0!==e.decay&&2!==e.decay&&ci.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),!e.target||e.target.parent===e&&0===e.target.position.x&&0===e.target.position.y&&-1===e.target.position.z||ci.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),o[this.name]||(r.extensions=r.extensions||{},r.extensions[this.name]={lights:[]},o[this.name]=!0);const l=r.extensions[this.name].lights;l.push(A),t.extensions=t.extensions||{},t.extensions[this.name]={light:l.length-1}}}class GLTFExporter_GLTFMaterialsUnlitExtension{constructor(e){this.writer=e,this.name="KHR_materials_unlit"}writeMaterial(e,t){if(!e.isMeshBasicMaterial)return;const s=this.writer.extensionsUsed;t.extensions=t.extensions||{},t.extensions[this.name]={},s[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9}}class GLTFExporter_GLTFMaterialsClearcoatExtension{constructor(e){this.writer=e,this.name="KHR_materials_clearcoat"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0===e.clearcoat)return;const s=this.writer,r=s.extensionsUsed,o={};if(o.clearcoatFactor=e.clearcoat,e.clearcoatMap){const t={index:s.processTexture(e.clearcoatMap),texCoord:e.clearcoatMap.channel};s.applyTextureTransform(t,e.clearcoatMap),o.clearcoatTexture=t}if(o.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap){const t={index:s.processTexture(e.clearcoatRoughnessMap),texCoord:e.clearcoatRoughnessMap.channel};s.applyTextureTransform(t,e.clearcoatRoughnessMap),o.clearcoatRoughnessTexture=t}if(e.clearcoatNormalMap){const t={index:s.processTexture(e.clearcoatNormalMap),texCoord:e.clearcoatNormalMap.channel};s.applyTextureTransform(t,e.clearcoatNormalMap),o.clearcoatNormalTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=o,r[this.name]=!0}}class GLTFExporter_GLTFMaterialsIridescenceExtension{constructor(e){this.writer=e,this.name="KHR_materials_iridescence"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0===e.iridescence)return;const s=this.writer,r=s.extensionsUsed,o={};if(o.iridescenceFactor=e.iridescence,e.iridescenceMap){const t={index:s.processTexture(e.iridescenceMap),texCoord:e.iridescenceMap.channel};s.applyTextureTransform(t,e.iridescenceMap),o.iridescenceTexture=t}if(o.iridescenceIor=e.iridescenceIOR,o.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],o.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap){const t={index:s.processTexture(e.iridescenceThicknessMap),texCoord:e.iridescenceThicknessMap.channel};s.applyTextureTransform(t,e.iridescenceThicknessMap),o.iridescenceThicknessTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=o,r[this.name]=!0}}class GLTFExporter_GLTFMaterialsTransmissionExtension{constructor(e){this.writer=e,this.name="KHR_materials_transmission"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0===e.transmission)return;const s=this.writer,r=s.extensionsUsed,o={};if(o.transmissionFactor=e.transmission,e.transmissionMap){const t={index:s.processTexture(e.transmissionMap),texCoord:e.transmissionMap.channel};s.applyTextureTransform(t,e.transmissionMap),o.transmissionTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=o,r[this.name]=!0}}class GLTFExporter_GLTFMaterialsVolumeExtension{constructor(e){this.writer=e,this.name="KHR_materials_volume"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0===e.transmission)return;const s=this.writer,r=s.extensionsUsed,o={};if(o.thicknessFactor=e.thickness,e.thicknessMap){const t={index:s.processTexture(e.thicknessMap),texCoord:e.thicknessMap.channel};s.applyTextureTransform(t,e.thicknessMap),o.thicknessTexture=t}o.attenuationDistance=e.attenuationDistance,o.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=o,r[this.name]=!0}}class GLTFExporter_GLTFMaterialsIorExtension{constructor(e){this.writer=e,this.name="KHR_materials_ior"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||1.5===e.ior)return;const s=this.writer.extensionsUsed,r={};r.ior=e.ior,t.extensions=t.extensions||{},t.extensions[this.name]=r,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsSpecularExtension{constructor(e){this.writer=e,this.name="KHR_materials_specular"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||1===e.specularIntensity&&e.specularColor.equals(qi)&&!e.specularIntensityMap&&!e.specularColorMap)return;const s=this.writer,r=s.extensionsUsed,o={};if(e.specularIntensityMap){const t={index:s.processTexture(e.specularIntensityMap),texCoord:e.specularIntensityMap.channel};s.applyTextureTransform(t,e.specularIntensityMap),o.specularTexture=t}if(e.specularColorMap){const t={index:s.processTexture(e.specularColorMap),texCoord:e.specularColorMap.channel};s.applyTextureTransform(t,e.specularColorMap),o.specularColorTexture=t}o.specularFactor=e.specularIntensity,o.specularColorFactor=e.specularColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=o,r[this.name]=!0}}class GLTFExporter_GLTFMaterialsSheenExtension{constructor(e){this.writer=e,this.name="KHR_materials_sheen"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0==e.sheen)return;const s=this.writer,r=s.extensionsUsed,o={};if(e.sheenRoughnessMap){const t={index:s.processTexture(e.sheenRoughnessMap),texCoord:e.sheenRoughnessMap.channel};s.applyTextureTransform(t,e.sheenRoughnessMap),o.sheenRoughnessTexture=t}if(e.sheenColorMap){const t={index:s.processTexture(e.sheenColorMap),texCoord:e.sheenColorMap.channel};s.applyTextureTransform(t,e.sheenColorMap),o.sheenColorTexture=t}o.sheenRoughnessFactor=e.sheenRoughness,o.sheenColorFactor=e.sheenColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=o,r[this.name]=!0}}class GLTFExporter_GLTFMaterialsAnisotropyExtension{constructor(e){this.writer=e,this.name="KHR_materials_anisotropy"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||0==e.anisotropy)return;const s=this.writer,r=s.extensionsUsed,o={};if(e.anisotropyMap){const t={index:s.processTexture(e.anisotropyMap)};s.applyTextureTransform(t,e.anisotropyMap),o.anisotropyTexture=t}o.anisotropyStrength=e.anisotropy,o.anisotropyRotation=e.anisotropyRotation,t.extensions=t.extensions||{},t.extensions[this.name]=o,r[this.name]=!0}}class GLTFExporter_GLTFMaterialsEmissiveStrengthExtension{constructor(e){this.writer=e,this.name="KHR_materials_emissive_strength"}writeMaterial(e,t){if(!e.isMeshStandardMaterial||1===e.emissiveIntensity)return;const s=this.writer.extensionsUsed,r={};r.emissiveStrength=e.emissiveIntensity,t.extensions=t.extensions||{},t.extensions[this.name]=r,s[this.name]=!0}}class GLTFExporter_GLTFMaterialsBumpExtension{constructor(e){this.writer=e,this.name="EXT_materials_bump"}writeMaterial(e,t){if(!e.isMeshStandardMaterial||1===e.bumpScale&&!e.bumpMap)return;const s=this.writer,r=s.extensionsUsed,o={};if(e.bumpMap){const t={index:s.processTexture(e.bumpMap),texCoord:e.bumpMap.channel};s.applyTextureTransform(t,e.bumpMap),o.bumpTexture=t}o.bumpFactor=e.bumpScale,t.extensions=t.extensions||{},t.extensions[this.name]=o,r[this.name]=!0}}class GLTFExporter_GLTFMeshGpuInstancing{constructor(e){this.writer=e,this.name="EXT_mesh_gpu_instancing"}writeNode(e,t){if(!e.isInstancedMesh)return;const s=this.writer,r=e,A=new Float32Array(3*r.count),l=new Float32Array(4*r.count),h=new Float32Array(3*r.count),c=new o.kn4,d=new o.Pq0,g=new o.PTz,p=new o.Pq0;for(let e=0;e<r.count;e++)r.getMatrixAt(e,c),c.decompose(d,g,p),d.toArray(A,3*e),g.toArray(l,4*e),p.toArray(h,3*e);const m={TRANSLATION:s.processAccessor(new o.THS(A,3)),ROTATION:s.processAccessor(new o.THS(l,4)),SCALE:s.processAccessor(new o.THS(h,3))};r.instanceColor&&(m._COLOR_0=s.processAccessor(r.instanceColor)),t.extensions=t.extensions||{},t.extensions[this.name]={attributes:m},s.extensionsUsed[this.name]=!0,s.extensionsRequired[this.name]=!0}}GLTFExporter.Utils={insertKeyframe:function(e,t){const s=.001,r=e.getValueSize(),o=new e.TimeBufferType(e.times.length+1),A=new e.ValueBufferType(e.values.length+r),l=e.createInterpolant(new e.ValueBufferType(r));let h;if(0===e.times.length){o[0]=t;for(let e=0;e<r;e++)A[e]=0;h=0}else if(t<e.times[0]){if(Math.abs(e.times[0]-t)<s)return 0;o[0]=t,o.set(e.times,1),A.set(l.evaluate(t),0),A.set(e.values,r),h=0}else if(t>e.times[e.times.length-1]){if(Math.abs(e.times[e.times.length-1]-t)<s)return e.times.length-1;o[o.length-1]=t,o.set(e.times,0),A.set(e.values,0),A.set(l.evaluate(t),e.values.length),h=o.length-1}else for(let c=0;c<e.times.length;c++){if(Math.abs(e.times[c]-t)<s)return c;if(e.times[c]<t&&e.times[c+1]>t){o.set(e.times.slice(0,c+1),0),o[c+1]=t,o.set(e.times.slice(c+1),c+2),A.set(e.values.slice(0,(c+1)*r),0),A.set(l.evaluate(t),(c+1)*r),A.set(e.values.slice((c+1)*r),(c+2)*r),h=c+1;break}}return e.times=o,e.values=A,h},mergeMorphTargetTracks:function(e,t){const s=[],r={},A=e.tracks;for(let e=0;e<A.length;++e){let l=A[e];const h=o.Nwf.parseTrackName(l.name),c=o.Nwf.findNode(t,h.nodeName);if("morphTargetInfluences"!==h.propertyName||void 0===h.propertyIndex){s.push(l);continue}if(l.createInterpolant!==l.InterpolantFactoryMethodDiscrete&&l.createInterpolant!==l.InterpolantFactoryMethodLinear){if(l.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");ci.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),l=l.clone(),l.setInterpolation(o.PJ3)}const d=c.morphTargetInfluences.length,g=c.morphTargetDictionary[h.propertyIndex];if(void 0===g)throw new Error("THREE.GLTFExporter: Morph target name not found: "+h.propertyIndex);let p;if(void 0===r[c.uuid]){p=l.clone();const e=new p.ValueBufferType(d*p.times.length);for(let t=0;t<p.times.length;t++)e[t*d+g]=p.values[t];p.name=(h.nodeName||"")+".morphTargetInfluences",p.values=e,r[c.uuid]=p,s.push(p);continue}const m=l.createInterpolant(new l.ValueBufferType(1));p=r[c.uuid];for(let e=0;e<p.times.length;e++)p.values[e*d+g]=m.evaluate(p.times[e]);for(let e=0;e<l.times.length;e++){const t=this.insertKeyframe(p,l.times[e]);p.values[t*d+g]=l.values[e]}}return e.tracks=s,e}};const compatibleObject=e=>void 0!==e.material&&e.userData&&e.userData.variantMaterials&&!!Array.from(e.userData.variantMaterials.values()).filter((e=>compatibleMaterial(e.material))),compatibleMaterial=e=>e&&e.isMaterial&&!Array.isArray(e);class GLTFExporterMaterialsVariantsExtension{constructor(e){this.writer=e,this.name="KHR_materials_variants",this.variantNames=[]}beforeParse(e){const t=new Set;for(const s of e)s.traverse((e=>{if(!compatibleObject(e))return;const s=e.userData.variantMaterials,r=e.userData.variantData;for(const[e,o]of r){const r=s.get(o.index);r&&compatibleMaterial(r.material)&&t.add(e)}}));t.forEach((e=>this.variantNames.push(e)))}writeMesh(e,t){if(!compatibleObject(e))return;const s=e.userData,r=s.variantMaterials,o=s.variantData,A=new Map,l=new Map,h=Array.from(o.values()).sort(((e,t)=>e.index-t.index));for(const[e,t]of h.entries())l.set(t.index,e);for(const e of o.values()){const t=r.get(e.index);if(!t||!compatibleMaterial(t.material))continue;const s=this.writer.processMaterial(t.material);A.has(s)||A.set(s,{material:s,variants:[]}),A.get(s).variants.push(l.get(e.index))}const c=Array.from(A.values()).map((e=>e.variants.sort(((e,t)=>e-t))&&e)).sort(((e,t)=>e.material-t.material));if(0===c.length)return;const d=compatibleMaterial(s.originalMaterial)?this.writer.processMaterial(s.originalMaterial):-1;for(const e of t.primitives)d>=0&&(e.material=d),e.extensions=e.extensions||{},e.extensions[this.name]={mappings:c}}afterParse(){if(0===this.variantNames.length)return;const e=this.writer.json;e.extensions=e.extensions||{};const t=this.variantNames.map((e=>({name:e})));e.extensions[this.name]={variants:t},this.writer.extensionsUsed[this.name]=!0}}class SessionLightProbe{constructor(e,t,s,r,A){this.xrLight=e,this.renderer=t,this.lightProbe=s,this.xrWebGLBinding=null,this.estimationStartCallback=A,this.frameCallback=this.onXRFrame.bind(this);const l=t.xr.getSession();if(r&&"XRWebGLBinding"in window){const s=new o.o6l(16);e.environment=s.texture;const r=t.getContext();switch(l.preferredReflectionFormat){case"srgba8":r.getExtension("EXT_sRGB");break;case"rgba16f":r.getExtension("OES_texture_half_float")}this.xrWebGLBinding=new XRWebGLBinding(l,r),this.lightProbe.addEventListener("reflectionchange",(()=>{this.updateReflection()}))}l.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 s=t.getLightEstimate(this.lightProbe);if(s){this.xrLight.lightProbe.sh.fromArray(s.sphericalHarmonicsCoefficients),this.xrLight.lightProbe.intensity=1;const e=Math.max(1,Math.max(s.primaryLightIntensity.x,Math.max(s.primaryLightIntensity.y,s.primaryLightIntensity.z)));this.xrLight.directionalLight.color.setRGB(s.primaryLightIntensity.x/e,s.primaryLightIntensity.y/e,s.primaryLightIntensity.z/e),this.xrLight.directionalLight.intensity=e,this.xrLight.directionalLight.position.copy(s.primaryLightDirection),this.estimationStartCallback&&(this.estimationStartCallback(),this.estimationStartCallback=null)}}dispose(){this.xrLight=null,this.renderer=null,this.lightProbe=null,this.xrWebGLBinding=null}}class XREstimatedLight extends o.YJl{constructor(e,t=!0){super(),this.lightProbe=new o.FZo,this.lightProbe.intensity=0,this.add(this.lightProbe),this.directionalLight=new o.ZyN,this.directionalLight.intensity=0,this.add(this.directionalLight),this.environment=null;let s=null,r=!1;e.xr.addEventListener("sessionstart",(()=>{const o=e.xr.getSession();"requestLightProbe"in o&&o.requestLightProbe({reflectionFormat:o.preferredReflectionFormat}).then((o=>{s=new SessionLightProbe(this,e,o,t,(()=>{r=!0,this.dispatchEvent({type:"estimationstart"})}))}))})),e.xr.addEventListener("sessionend",(()=>{s&&(s.dispose(),s=null),r&&this.dispatchEvent({type:"estimationend"})})),this.dispose=()=>{s&&(s.dispose(),s=null),this.remove(this.lightProbe),this.lightProbe=null,this.remove(this.directionalLight),this.directionalLight=null,this.environment=null}}}class Damper{constructor(e=50){this.velocity=0,this.naturalFrequency=0,this.setDecayTime(e)}setDecayTime(e){this.naturalFrequency=1/Math.max(.001,e)}update(e,t,s,r){const o=2e-4*this.naturalFrequency;if(null==e||0===r)return t;if(e===t&&0===this.velocity)return t;if(s<0)return e;const A=e-t,l=this.velocity+this.naturalFrequency*A,h=A+s*l,c=Math.exp(-this.naturalFrequency*s),d=(l-this.naturalFrequency*h)*c,g=-this.naturalFrequency*(d+l*c);return Math.abs(d)<o*Math.abs(r)&&g*A>=0?(this.velocity=0,t):(this.velocity=d,t+h*c)}}const Vi=.2,$i=Math.PI/24,Ji=new o.I9Y,addCorner=(e,t,s)=>{let r=t>0?s>0?0:-Math.PI/2:s>0?Math.PI/2:Math.PI;for(let o=0;o<=12;++o)e.push(t+.17*Math.cos(r),s+.17*Math.sin(r),0,t+Vi*Math.cos(r),s+Vi*Math.sin(r),0),r+=$i};class PlacementBox extends o.eaF{constructor(e,t){const s=new o.LoY,r=[],A=[],{size:l,boundingBox:h}=e,c=l.x/2,d=("back"===t?l.y:l.z)/2;addCorner(A,c,d),addCorner(A,-c,d),addCorner(A,-c,-d),addCorner(A,c,-d);const g=A.length/3;for(let e=0;e<g-2;e+=2)r.push(e,e+1,e+3,e,e+3,e+2);const p=g-2;r.push(p,p+1,1,p,1,0),s.setAttribute("position",new o.qtW(A,3)),s.setIndex(r),super(s),this.side=t;const m=this.material;switch(m.side=o.$EB,m.transparent=!0,m.opacity=0,this.goalOpacity=0,this.opacityDamper=new Damper,this.hitPlane=new o.eaF(new o.bdM(2*(c+Vi),2*(d+Vi))),this.hitPlane.visible=!1,this.hitPlane.material.side=o.$EB,this.add(this.hitPlane),h.getCenter(this.position),t){case"bottom":this.rotateX(-Math.PI/2),this.shadowHeight=h.min.y,this.position.y=this.shadowHeight;break;case"back":this.shadowHeight=h.min.z,this.position.z=this.shadowHeight}e.target.add(this),this.offsetHeight=0}getHit(e,t,s){Ji.set(t,-s),this.hitPlane.visible=!0;const r=e.positionAndNormalFromPoint(Ji,this.hitPlane);return this.hitPlane.visible=!1,null==r?null:r.position}getExpandedHit(e,t,s){this.hitPlane.scale.set(1e3,1e3,1e3),this.hitPlane.updateMatrixWorld();const r=this.getHit(e,t,s);return this.hitPlane.scale.set(1,1,1),r}set offsetHeight(e){e-=.001,"back"===this.side?this.position.z=this.shadowHeight+e:this.position.y=this.shadowHeight+e}get offsetHeight(){return"back"===this.side?this.position.z-this.shadowHeight:this.position.y-this.shadowHeight}set show(e){this.goalOpacity=e?.75:0}updateOpacity(e){const t=this.material;t.opacity=this.opacityDamper.update(t.opacity,this.goalOpacity,e,1),this.visible=t.opacity>0}dispose(){var e;const{geometry:t,material:s}=this.hitPlane;t.dispose(),s.dispose(),this.geometry.dispose(),this.material.dispose(),null===(e=this.parent)||void 0===e||e.remove(this)}}const numberNode=(e,t)=>({type:"number",number:e,unit:t}),Ki=(()=>{const e={};return t=>{const s=t;if(s in e)return e[s];const r=[];let o=0;for(;t;){if(++o>1e3){t="";break}const e=Yi(t),s=e.nodes[0];if(null==s||0===s.terms.length)break;r.push(s),t=e.remainingInput}return e[s]=r}})(),Yi=(()=>{const e=/^(\-\-|[a-z\u0240-\uffff])/i,t=/^([\*\+\/]|[\-]\s)/i,s=/^[\),]/;return r=>{const o=[];for(;r.length&&(r=r.trim(),!s.test(r));)if("("===r[0]){const{nodes:e,remainingInput:t}=parseFunctionArguments(r);r=t,o.push({type:"function",name:{type:"ident",value:"calc"},arguments:e})}else if(e.test(r)){const e=zi(r),t=e.nodes[0];if("("===(r=e.remainingInput)[0]){const{nodes:e,remainingInput:s}=parseFunctionArguments(r);o.push({type:"function",name:t,arguments:e}),r=s}else o.push(t)}else if(t.test(r))o.push({type:"operator",value:r[0]}),r=r.slice(1);else{const{nodes:e,remainingInput:t}="#"===r[0]?Wi(r):ji(r);if(0===e.length)break;o.push(e[0]),r=t}return{nodes:[{type:"expression",terms:o}],remainingInput:r}}})(),zi=(()=>{const e=/[^a-z0-9_\-\u0240-\uffff]/i;return t=>{const s=t.match(e);return{nodes:[{type:"ident",value:null==s?t:t.substr(0,s.index)}],remainingInput:null==s?"":t.substr(s.index)}}})(),ji=(()=>{const e=/[\+\-]?(\d+[\.]\d+|\d+|[\.]\d+)([eE][\+\-]?\d+)?/,t=/^[a-z%]+/i,s=/^(m|mm|cm|rad|deg|[%])$/;return r=>{const o=r.match(e),A=null==o?"0":o[0],l=(r=null==A?r:r.slice(A.length)).match(t);let h=null!=l&&""!==l[0]?l[0]:null;const c=null==l?r:r.slice(h.length);return null==h||s.test(h)||(h=null),{nodes:[{type:"number",number:parseFloat(A)||0,unit:h}],remainingInput:c}}})(),Wi=(()=>{const e=/^[a-f0-9]*/i;return t=>{const s=(t=t.slice(1).trim()).match(e);return{nodes:null==s?[]:[{type:"hex",value:s[0]}],remainingInput:null==s?t:t.slice(s[0].length)}}})(),parseFunctionArguments=e=>{const t=[];for(e=e.slice(1).trim();e.length;){const s=Yi(e);if(t.push(s.nodes[0]),","===(e=s.remainingInput.trim())[0])e=e.slice(1).trim();else if(")"===e[0]){e=e.slice(1);break}}return{nodes:t,remainingInput:e}},Xi=Symbol("visitedTypes");class ASTWalker{constructor(e){this[Xi]=e}walk(e,t){const s=e.slice();for(;s.length;){const e=s.shift();switch(this[Xi].indexOf(e.type)>-1&&t(e),e.type){case"expression":s.unshift(...e.terms);break;case"function":s.unshift(e.name,...e.arguments)}}}}const Zi=Object.freeze({type:"number",number:0,unit:null}),degreesToRadians=(e,t=0)=>{let{number:s,unit:r}=e;if(isFinite(s)){if("rad"===e.unit||null==e.unit)return e}else s=t,r="rad";return{type:"number",number:("deg"===r&&null!=s?s:0)*Math.PI/180,unit:"rad"}},lengthToBaseMeters=(e,t=0)=>{let s,{number:r,unit:o}=e;if(isFinite(r)){if("m"===e.unit)return e}else r=t,o="m";switch(o){default:s=1;break;case"cm":s=.01;break;case"mm":s=.001}return{type:"number",number:s*r,unit:"m"}},es=(()=>{const identity=e=>e,e={rad:identity,deg:degreesToRadians,m:identity,mm:lengthToBaseMeters,cm:lengthToBaseMeters};return(t,s=Zi)=>{isFinite(t.number)||(t.number=s.number,t.unit=s.unit);const{unit:r}=t;if(null==r)return t;const o=e[r];return null==o?s:o(t)}})();var ts,is,ss;const ns=Symbol("evaluate"),rs=Symbol("lastValue");class Evaluator{constructor(){this[ts]=null}static evaluatableFor(e,t=Zi){if(e instanceof Evaluator)return e;if("number"===e.type)return"%"===e.unit?new PercentageEvaluator(e,t):e;switch(e.name.value){case"calc":return new CalcEvaluator(e,t);case"env":return new EnvEvaluator(e)}return Zi}static evaluate(e){return e instanceof Evaluator?e.evaluate():e}static isConstant(e){return!(e instanceof Evaluator)||e.isConstant}static applyIntrinsics(e,t){const{basis:s,keywords:r}=t,{auto:o}=r;return s.map(((t,s)=>{const A=null==o[s]?t:o[s];let l=e[s]?e[s]:A;if("ident"===l.type){const e=l.value;e in r&&(l=r[e][s])}return null!=l&&"ident"!==l.type||(l=A),"%"===l.unit?numberNode(l.number/100*t.number,t.unit):(l=es(l,t),l.unit!==t.unit?t:l)}))}get isConstant(){return!1}evaluate(){return this.isConstant&&null!=this[rs]||(this[rs]=this[ns]()),this[rs]}}ts=rs;const as=Symbol("percentage"),os=Symbol("basis");class PercentageEvaluator extends Evaluator{constructor(e,t){super(),this[as]=e,this[os]=t}get isConstant(){return!0}[ns](){return numberNode(this[as].number/100*this[os].number,this[os].unit)}}const As=Symbol("identNode");class EnvEvaluator extends Evaluator{constructor(e){super(),this[is]=null;const t=e.arguments.length?e.arguments[0].terms[0]:null;null!=t&&"ident"===t.type&&(this[As]=t)}get isConstant(){return!1}[(is=As,ns)](){if(null!=this[As]&&"window-scroll-y"===this[As].value){return{type:"number",number:window.pageYOffset/(Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.clientHeight,document.documentElement.scrollHeight,document.documentElement.offsetHeight)-window.innerHeight)||0,unit:null}}return Zi}}const ls=/[\*\/]/,hs=Symbol("evaluator");class CalcEvaluator extends Evaluator{constructor(e,t=Zi){if(super(),this[ss]=null,1!==e.arguments.length)return;const s=e.arguments[0].terms.slice(),r=[];for(;s.length;){const e=s.shift();if(r.length>0){const s=r[r.length-1];if("operator"===s.type&&ls.test(s.value)){const s=r.pop(),o=r.pop();if(null==o)return;r.push(new OperatorEvaluator(s,Evaluator.evaluatableFor(o,t),Evaluator.evaluatableFor(e,t)));continue}}r.push("operator"===e.type?e:Evaluator.evaluatableFor(e,t))}for(;r.length>2;){const[e,s,o]=r.splice(0,3);if("operator"!==s.type)return;r.unshift(new OperatorEvaluator(s,Evaluator.evaluatableFor(e,t),Evaluator.evaluatableFor(o,t)))}1===r.length&&(this[hs]=r[0])}get isConstant(){return null==this[hs]||Evaluator.isConstant(this[hs])}[(ss=hs,ns)](){return null!=this[hs]?Evaluator.evaluate(this[hs]):Zi}}const cs=Symbol("operator"),us=Symbol("left"),ds=Symbol("right");class OperatorEvaluator extends Evaluator{constructor(e,t,s){super(),this[cs]=e,this[us]=t,this[ds]=s}get isConstant(){return Evaluator.isConstant(this[us])&&Evaluator.isConstant(this[ds])}[ns](){const e=es(Evaluator.evaluate(this[us])),t=es(Evaluator.evaluate(this[ds])),{number:s,unit:r}=e,{number:o,unit:A}=t;if(null!=A&&null!=r&&A!=r)return Zi;const l=r||A;let h;switch(this[cs].value){case"+":h=s+o;break;case"-":h=s-o;break;case"/":h=s/o;break;case"*":h=s*o;break;default:return Zi}return{type:"number",number:h,unit:l}}}const gs=Symbol("evaluatables"),ps=Symbol("intrinsics");class StyleEvaluator extends Evaluator{constructor(e,t){super(),this[ps]=t;const s=e[0],r=null!=s?s.terms:[];this[gs]=t.basis.map(((e,t)=>{const s=r[t];return null==s?{type:"ident",value:"auto"}:"ident"===s.type?s:Evaluator.evaluatableFor(s,e)}))}get isConstant(){for(const e of this[gs])if(!Evaluator.isConstant(e))return!1;return!0}[ns](){const e=this[gs].map((e=>Evaluator.evaluate(e)));return Evaluator.applyIntrinsics(e,this[ps]).map((e=>e.number))}}var ms,fs,Is,Es;const Cs=Symbol("instances"),Bs=Symbol("activateListener"),ys=Symbol("deactivateListener"),ws=Symbol("notifyInstances"),vs=Symbol("notify"),Qs=Symbol("callback");class ScrollObserver{constructor(e){this[Qs]=e}static[ws](){for(const e of ScrollObserver[Cs])e[vs]()}static[(ms=Cs,Bs)](){window.addEventListener("scroll",this[ws],{passive:!0})}static[ys](){window.removeEventListener("scroll",this[ws])}observe(){0===ScrollObserver[Cs].size&&ScrollObserver[Bs](),ScrollObserver[Cs].add(this)}disconnect(){ScrollObserver[Cs].delete(this),0===ScrollObserver[Cs].size&&ScrollObserver[ys]()}[vs](){this[Qs]()}}ScrollObserver[ms]=new Set;const xs=Symbol("computeStyleCallback"),bs=Symbol("astWalker"),Ss=Symbol("dependencies"),Ms=Symbol("onScroll");class StyleEffector{constructor(e){this[fs]={},this[Is]=new ASTWalker(["function"]),this[Es]=()=>{this[xs]({relatedState:"window-scroll"})},this[xs]=e}observeEffectsFor(e){const t={},s=this[Ss];this[bs].walk(e,(e=>{const{name:r}=e,o=e.arguments[0].terms[0];if("env"===r.value&&null!=o&&"ident"===o.type&&"window-scroll-y"===o.value)if(null==t["window-scroll"]){const e="window-scroll"in s?s["window-scroll"]:new ScrollObserver(this[Ms]);e.observe(),delete s["window-scroll"],t["window-scroll"]=e}}));for(const e in s){s[e].disconnect()}this[Ss]=t}dispose(){for(const e in this[Ss]){this[Ss][e].disconnect()}}}fs=Ss,Is=bs,Es=Ms;const style=e=>{const t=e.observeEffects||!1,s=e.intrinsics instanceof Function?e.intrinsics:()=>e.intrinsics;return(r,o)=>{const A=r.updated,l=r.connectedCallback,h=r.disconnectedCallback,c=Symbol(`${o}StyleEffector`),d=Symbol(`${o}StyleEvaluator`),g=Symbol(`${o}UpdateEvaluator`),p=Symbol(`${o}EvaluateAndSync`);Object.defineProperties(r,{[c]:{value:null,writable:!0},[d]:{value:null,writable:!0},[g]:{value:function(){const e=Ki(this[o]);this[d]=new StyleEvaluator(e,s(this)),null==this[c]&&t&&(this[c]=new StyleEffector((()=>this[p]()))),null!=this[c]&&this[c].observeEffectsFor(e)}},[p]:{value:function(){if(null==this[d])return;const t=this[d].evaluate();this[e.updateHandler](t)}},updated:{value:function(e){e.has(o)&&(this[g](),this[p]()),A.call(this,e)}},connectedCallback:{value:function(){l.call(this),this.requestUpdate(o,this[o])}},disconnectedCallback:{value:function(){h.call(this),null!=this[c]&&(this[c].dispose(),this[c]=null)}}})}},easeInOutQuad=e=>e<.5?2*e*e:(4-2*e)*e-1,interpolate=(e,t,s=easeInOutQuad)=>r=>e+(t-e)*s(r),timeline=e=>{const t=[],s=[];let r=e.initialValue;for(let o=0;o<e.keyframes.length;++o){const A=e.keyframes[o],{value:l,frames:h}=A,c=A.ease||easeInOutQuad,d=interpolate(r,l,c);t.push(d),s.push(h),r=l}return((e,t)=>{const s=t.map((r=0,e=>r+=e));var r;return t=>{t=clamp(t,0,1),t*=s[s.length-1];const r=s.findIndex((e=>e>=t)),o=r<1?0:s[r-1],A=s[r];return e[r]((t-o)/(A-o))}})(t,s)};var Ts=s(96763),controls_decorate=function(e,t,s,r){var o,A=arguments.length,l=A<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,s,r);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(l=(A<3?o(l):A>3?o(t,s,l):o(t,s))||l);return A>3&&l&&Object.defineProperty(t,s,l),l};const Rs=timeline({initialValue:0,keyframes:[{frames:5,value:-1},{frames:1,value:-1},{frames:8,value:1},{frames:1,value:1},{frames:5,value:0},{frames:18,value:0}]}),Ds=timeline({initialValue:0,keyframes:[{frames:1,value:1},{frames:5,value:1},{frames:1,value:0},{frames:6,value:0}]}),Ls="0deg 75deg 105%",Fs=["front","right","back","left"],_s=["upper-","","lower-"],ks="auto",Us="basic",Gs="wiggle",Ps="none",fieldOfViewIntrinsics=()=>({basis:[degreesToRadians(numberNode(30,"deg"))],keywords:{auto:[null]}}),minFieldOfViewIntrinsics=()=>({basis:[degreesToRadians(numberNode(12,"deg"))],keywords:{auto:[null]}}),Ns=(()=>{const e=Ki(Ls)[0].terms,t=es(e[0]),s=es(e[1]);return e=>{const r=e[_o].idealCameraDistance();return{basis:[t,s,numberNode(r,"m")],keywords:{auto:[null,null,numberNode(105,"%")]}}}})(),minCameraOrbitIntrinsics=e=>{const t=2.2*e[_o].boundingSphere.radius;return{basis:[numberNode(-1/0,"rad"),numberNode(Math.PI/8,"rad"),numberNode(t,"m")],keywords:{auto:[null,null,null]}}},maxCameraOrbitIntrinsics=e=>{const t=Ns(e),s=new StyleEvaluator([],t).evaluate()[2];return{basis:[numberNode(1/0,"rad"),numberNode(Math.PI-Math.PI/8,"rad"),numberNode(s,"m")],keywords:{auto:[null,null,null]}}},cameraTargetIntrinsics=e=>{const t=e[_o].boundingBox.getCenter(new o.Pq0);return{basis:[numberNode(t.x,"m"),numberNode(t.y,"m"),numberNode(t.z,"m")],keywords:{auto:[null,null,null]}}},Os=Math.PI/2,Hs=Math.PI/3,qs=Os/2,Vs=2*Math.PI,$s=Symbol("controls"),Js=Symbol("panElement"),Ks=Symbol("promptElement"),Ys=Symbol("promptAnimatedContainer"),zs=Symbol("fingerAnimatedContainers"),js=Symbol("deferInteractionPrompt"),Ws=Symbol("updateAria"),Xs=Symbol("updateCameraForRadius"),Zs=Symbol("cancelPrompts"),en=Symbol("onChange"),tn=Symbol("onPointerChange"),sn=Symbol("waitingToPromptUser"),nn=Symbol("userHasInteracted"),rn=Symbol("promptElementVisibleTime"),an=Symbol("lastPromptOffset"),on=Symbol("cancellationSource"),An=Symbol("lastSpherical"),ln=Symbol("jumpCamera"),hn=Symbol("initialized"),cn=Symbol("maintainThetaPhi"),un=Symbol("syncCameraOrbit"),dn=Symbol("syncFieldOfView"),gn=Symbol("syncCameraTarget"),pn=Symbol("syncMinCameraOrbit"),mn=Symbol("syncMaxCameraOrbit"),fn=Symbol("syncMinFieldOfView"),In=Symbol("syncMaxFieldOfView"),En=new o.I9Y,Cn=new o.Pq0,Bn=Object.freeze({minimumRadius:0,maximumRadius:1/0,minimumPolarAngle:Math.PI/8,maximumPolarAngle:Math.PI-Math.PI/8,minimumAzimuthalAngle:-1/0,maximumAzimuthalAngle:1/0,minimumFieldOfView:10,maximumFieldOfView:45,touchAction:"none"}),yn=Math.PI/8,wn=.04,vn={USER_INTERACTION:"user-interaction",NONE:"none",AUTOMATIC:"automatic"};class SmoothControls extends o.Qev{constructor(e,t,s){super(),this.camera=e,this.element=t,this.scene=s,this.orbitSensitivity=1,this.zoomSensitivity=1,this.panSensitivity=1,this.inputSensitivity=1,this.changeSource=vn.NONE,this._interactionEnabled=!1,this._disableZoom=!1,this.isUserPointing=!1,this.enablePan=!0,this.enableTap=!0,this.panProjection=new o.dwI,this.panPerPixel=0,this.spherical=new o.YHV,this.goalSpherical=new o.YHV,this.thetaDamper=new Damper,this.phiDamper=new Damper,this.radiusDamper=new Damper,this.logFov=Math.log(Bn.maximumFieldOfView),this.goalLogFov=this.logFov,this.fovDamper=new Damper,this.touchMode=null,this.pointers=[],this.startTime=0,this.startPointerPosition={clientX:0,clientY:0},this.lastSeparation=0,this.touchDecided=!1,this.onContext=e=>{if(this.enablePan)e.preventDefault();else for(const e of this.pointers)this.onPointerUp(new PointerEvent("pointercancel",Object.assign(Object.assign({},this.startPointerPosition),{pointerId:e.id})))},this.touchModeZoom=(e,t)=>{if(!this._disableZoom){const e=this.twoTouchDistance(this.pointers[0],this.pointers[1]),t=wn*this.zoomSensitivity*(this.lastSeparation-e)*50/this.scene.height;this.lastSeparation=e,this.userAdjustOrbit(0,0,t)}this.panPerPixel>0&&this.movePan(e,t)},this.disableScroll=e=>{e.preventDefault()},this.touchModeRotate=(e,t)=>{const{touchAction:s}=this._options;if(!this.touchDecided&&"none"!==s){this.touchDecided=!0;const r=Math.abs(e),o=Math.abs(t);if(this.changeSource===vn.USER_INTERACTION&&("pan-y"===s&&o>r||"pan-x"===s&&r>o))return void(this.touchMode=null);this.element.addEventListener("touchmove",this.disableScroll,{passive:!1})}this.handleSinglePointerMove(e,t)},this.onPointerDown=e=>{if(this.pointers.length>2)return;const{element:t}=this;0===this.pointers.length&&(t.addEventListener("pointermove",this.onPointerMove),t.addEventListener("pointerup",this.onPointerUp),this.touchMode=null,this.touchDecided=!1,this.startPointerPosition.clientX=e.clientX,this.startPointerPosition.clientY=e.clientY,this.startTime=performance.now());try{t.setPointerCapture(e.pointerId)}catch(e){}this.pointers.push({clientX:e.clientX,clientY:e.clientY,id:e.pointerId}),this.isUserPointing=!1,"touch"===e.pointerType?(this.changeSource=e.altKey?vn.AUTOMATIC:vn.USER_INTERACTION,this.onTouchChange(e)):(this.changeSource=vn.USER_INTERACTION,this.onMouseDown(e)),this.changeSource===vn.USER_INTERACTION&&this.dispatchEvent({type:"user-interaction"})},this.onPointerMove=e=>{const t=this.pointers.find((t=>t.id===e.pointerId));if(null==t)return;if("mouse"===e.pointerType&&0===e.buttons)return void this.onPointerUp(e);const s=this.pointers.length,r=(e.clientX-t.clientX)/s,o=(e.clientY-t.clientY)/s;0===r&&0===o||(t.clientX=e.clientX,t.clientY=e.clientY,"touch"===e.pointerType?(this.changeSource=e.altKey?vn.AUTOMATIC:vn.USER_INTERACTION,null!==this.touchMode&&this.touchMode(r,o)):(this.changeSource=vn.USER_INTERACTION,this.panPerPixel>0?this.movePan(r,o):this.handleSinglePointerMove(r,o)))},this.onPointerUp=e=>{const{element:t}=this,s=this.pointers.findIndex((t=>t.id===e.pointerId));-1!==s&&this.pointers.splice(s,1),this.panPerPixel>0&&!e.altKey&&this.resetRadius(),0===this.pointers.length?(t.removeEventListener("pointermove",this.onPointerMove),t.removeEventListener("pointerup",this.onPointerUp),t.removeEventListener("touchmove",this.disableScroll),this.enablePan&&this.enableTap&&this.recenter(e)):null!==this.touchMode&&this.onTouchChange(e),this.scene.element[Js].style.opacity=0,t.style.cursor="grab",this.panPerPixel=0,this.isUserPointing&&this.dispatchEvent({type:"pointer-change-end"})},this.onWheel=e=>{this.changeSource=vn.USER_INTERACTION;const t=e.deltaY*(1==e.deltaMode?18:1)*wn*this.zoomSensitivity/30;this.userAdjustOrbit(0,0,t),e.preventDefault(),this.dispatchEvent({type:"user-interaction"})},this.onKeyDown=e=>{const{changeSource:t}=this;this.changeSource=vn.USER_INTERACTION;(e.shiftKey&&this.enablePan?this.panKeyCodeHandler(e):this.orbitZoomKeyCodeHandler(e))?(e.preventDefault(),this.dispatchEvent({type:"user-interaction"})):this.changeSource=t},this._options=Object.assign({},Bn),this.setOrbit(0,Math.PI/2,1),this.setFieldOfView(100),this.jumpToGoal()}get interactionEnabled(){return this._interactionEnabled}enableInteraction(){if(!1===this._interactionEnabled){const{element:e}=this;e.addEventListener("pointerdown",this.onPointerDown),e.addEventListener("pointercancel",this.onPointerUp),this._disableZoom||e.addEventListener("wheel",this.onWheel),e.addEventListener("keydown",this.onKeyDown),e.addEventListener("touchmove",(()=>{}),{passive:!1}),e.addEventListener("contextmenu",this.onContext),this.element.style.cursor="grab",this._interactionEnabled=!0,this.updateTouchActionStyle()}}disableInteraction(){if(!0===this._interactionEnabled){const{element:e}=this;e.removeEventListener("pointerdown",this.onPointerDown),e.removeEventListener("pointermove",this.onPointerMove),e.removeEventListener("pointerup",this.onPointerUp),e.removeEventListener("pointercancel",this.onPointerUp),e.removeEventListener("wheel",this.onWheel),e.removeEventListener("keydown",this.onKeyDown),e.removeEventListener("contextmenu",this.onContext),e.style.cursor="",this.touchMode=null,this._interactionEnabled=!1,this.updateTouchActionStyle()}}get options(){return this._options}set disableZoom(e){this._disableZoom!=e&&(this._disableZoom=e,!0===e?this.element.removeEventListener("wheel",this.onWheel):this.element.addEventListener("wheel",this.onWheel),this.updateTouchActionStyle())}getCameraSpherical(e=new o.YHV){return e.copy(this.spherical)}getFieldOfView(){return this.camera.fov}applyOptions(e){Object.assign(this._options,e),this.setOrbit(),this.setFieldOfView(Math.exp(this.goalLogFov))}updateNearFar(e,t){this.camera.far=0===t?2:t,this.camera.near=Math.max(e,this.camera.far/1e3),this.camera.updateProjectionMatrix()}updateAspect(e){this.camera.aspect=e,this.camera.updateProjectionMatrix()}setOrbit(e=this.goalSpherical.theta,t=this.goalSpherical.phi,s=this.goalSpherical.radius){const{minimumAzimuthalAngle:r,maximumAzimuthalAngle:o,minimumPolarAngle:A,maximumPolarAngle:l,minimumRadius:h,maximumRadius:c}=this._options,{theta:d,phi:g,radius:p}=this.goalSpherical,m=clamp(e,r,o);isFinite(r)||isFinite(o)||(this.spherical.theta=this.wrapAngle(this.spherical.theta-m)+m);const f=clamp(t,A,l),I=clamp(s,h,c);return(m!==d||f!==g||I!==p)&&(!!(isFinite(m)&&isFinite(f)&&isFinite(I))&&(this.goalSpherical.theta=m,this.goalSpherical.phi=f,this.goalSpherical.radius=I,this.goalSpherical.makeSafe(),!0))}setRadius(e){this.goalSpherical.radius=e,this.setOrbit()}setFieldOfView(e){const{minimumFieldOfView:t,maximumFieldOfView:s}=this._options;e=clamp(e,t,s),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,s){const{theta:r,phi:o,radius:A}=this.goalSpherical,{minimumRadius:l,maximumRadius:h,minimumFieldOfView:c,maximumFieldOfView:d}=this._options,g=this.spherical.theta-r,p=Math.PI-.001,m=r-clamp(e,-p-g,p-g),f=o-t,I=0===s?0:((s>0?h:l)-A)/(Math.log(s>0?d:c)-this.goalLogFov),E=A+s*(isFinite(I)?I:2*(h-l));if(this.setOrbit(m,f,E),0!==s){const e=this.goalLogFov+s;this.setFieldOfView(Math.exp(e))}}jumpToGoal(){this.update(0,1e4)}update(e,t){if(this.isStationary())return!1;const{maximumPolarAngle:s,maximumRadius:r}=this._options,o=this.spherical.theta-this.goalSpherical.theta;return Math.abs(o)>Math.PI&&!isFinite(this._options.minimumAzimuthalAngle)&&!isFinite(this._options.maximumAzimuthalAngle)&&(this.spherical.theta-=2*Math.sign(o)*Math.PI),this.spherical.theta=this.thetaDamper.update(this.spherical.theta,this.goalSpherical.theta,t,Math.PI),this.spherical.phi=this.phiDamper.update(this.spherical.phi,this.goalSpherical.phi,t,s),this.spherical.radius=this.radiusDamper.update(this.spherical.radius,this.goalSpherical.radius,t,r),this.logFov=this.fovDamper.update(this.logFov,this.goalLogFov,t,1),this.moveCamera(),!0}updateTouchActionStyle(){const{style:e}=this.element;if(this._interactionEnabled){const{touchAction:t}=this._options;this._disableZoom&&"none"!==t?e.touchAction="manipulation":e.touchAction=t}else e.touchAction=""}isStationary(){return this.goalSpherical.theta===this.spherical.theta&&this.goalSpherical.phi===this.spherical.phi&&this.goalSpherical.radius===this.spherical.radius&&this.goalLogFov===this.logFov}moveCamera(){this.spherical.makeSafe(),this.camera.position.setFromSpherical(this.spherical),this.camera.setRotationFromEuler(new o.O9p(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,s){this.adjustOrbit(e*this.orbitSensitivity*this.inputSensitivity,t*this.orbitSensitivity*this.inputSensitivity,s*this.inputSensitivity)}wrapAngle(e){const t=(e+Math.PI)/(2*Math.PI);return 2*(t-Math.floor(t))*Math.PI-Math.PI}pixelLengthToSphericalAngle(e){return 2*Math.PI*e/this.scene.height}twoTouchDistance(e,t){const{clientX:s,clientY:r}=e,{clientX:o,clientY:A}=t,l=o-s,h=A-r;return Math.sqrt(l*l+h*h)}handleSinglePointerMove(e,t){const s=this.pixelLengthToSphericalAngle(e),r=this.pixelLengthToSphericalAngle(t);!1===this.isUserPointing&&(this.isUserPointing=!0,this.dispatchEvent({type:"pointer-change-start"})),this.userAdjustOrbit(s,r,0)}initializePan(){const{theta:e,phi:t}=this.spherical,s=e-this.scene.yaw;this.panPerPixel=.018*this.panSensitivity/this.scene.height,this.panProjection.set(-Math.cos(s),-Math.cos(t)*Math.sin(s),0,0,Math.sin(t),0,Math.sin(s),-Math.cos(t)*Math.cos(s),0)}movePan(e,t){const{scene:s}=this,r=Cn.set(e,t,0).multiplyScalar(this.inputSensitivity),o=this.spherical.radius*Math.exp(this.logFov)*this.panPerPixel;r.multiplyScalar(o);const A=s.getTarget();A.add(r.applyMatrix3(this.panProjection)),s.boundingSphere.clampPoint(A,A),s.setTarget(A.x,A.y,A.z)}recenter(e){if(performance.now()>this.startTime+300||Math.abs(e.clientX-this.startPointerPosition.clientX)>2||Math.abs(e.clientY-this.startPointerPosition.clientY)>2)return;const{scene:t}=this,s=t.positionAndNormalFromPoint(t.getNDC(e.clientX,e.clientY));if(null==s){const{cameraTarget:e}=t.element;t.element.cameraTarget="",t.element.cameraTarget=e,this.userAdjustOrbit(0,0,1)}else t.target.worldToLocal(s.position),t.setTarget(s.position.x,s.position.y,s.position.z)}resetRadius(){const{scene:e}=this,t=e.positionAndNormalFromPoint(En.set(0,0));if(null==t)return;e.target.worldToLocal(t.position);const s=e.getTarget(),{theta:r,phi:o}=this.spherical,A=r-e.yaw,l=Cn.set(Math.sin(o)*Math.sin(A),Math.cos(o),Math.sin(o)*Math.cos(A)),h=l.dot(t.position.sub(s));s.add(l.multiplyScalar(h)),e.setTarget(s.x,s.y,s.z),this.setOrbit(void 0,void 0,this.goalSpherical.radius-h)}onTouchChange(e){if(1===this.pointers.length)this.touchMode=this.touchModeRotate;else{if(this._disableZoom)return this.touchMode=null,void this.element.removeEventListener("touchmove",this.disableScroll);this.touchMode=this.touchDecided&&null===this.touchMode?null:this.touchModeZoom,this.touchDecided=!0,this.element.addEventListener("touchmove",this.disableScroll,{passive:!1}),this.lastSeparation=this.twoTouchDistance(this.pointers[0],this.pointers[1]),this.enablePan&&null!=this.touchMode&&(this.initializePan(),e.altKey||(this.scene.element[Js].style.opacity=1))}}onMouseDown(e){this.panPerPixel=0,this.enablePan&&(2===e.button||e.ctrlKey||e.metaKey||e.shiftKey)&&(this.initializePan(),this.scene.element[Js].style.opacity=1),this.element.style.cursor="grabbing"}orbitZoomKeyCodeHandler(e){let t=!0;switch(e.key){case"PageUp":this.userAdjustOrbit(0,0,wn*this.zoomSensitivity);break;case"PageDown":this.userAdjustOrbit(0,0,-.04*this.zoomSensitivity);break;case"ArrowUp":this.userAdjustOrbit(0,-yn,0);break;case"ArrowDown":this.userAdjustOrbit(0,yn,0);break;case"ArrowLeft":this.userAdjustOrbit(-yn,0,0);break;case"ArrowRight":this.userAdjustOrbit(yn,0,0);break;default:t=!1}return t}panKeyCodeHandler(e){this.initializePan();let t=!0;switch(e.key){case"ArrowUp":this.movePan(0,-10);break;case"ArrowDown":this.movePan(0,10);break;case"ArrowLeft":this.movePan(-10,0);break;case"ArrowRight":this.movePan(10,0);break;default:t=!1}return t}}var Qn=s(96763);const xn=1/1.3,bn="not-presenting",Sn="session-started",Mn="object-placed",Tn="failed",Rn="tracking",Dn="not-tracking",Ln=new o.Pq0,Fn=new o.kn4,_n=new o.Pq0,kn=new o.ubm(45,1,.1,100);class ARRenderer extends o.Qev{constructor(e){super(),this.renderer=e,this.currentSession=null,this.placeOnWall=!1,this.placementBox=null,this.lastTick=null,this.turntableRotation=null,this.oldShadowIntensity=null,this.frame=null,this.initialHitSource=null,this.transientHitTestSource=null,this.inputSource=null,this._presentedScene=null,this.resolveCleanup=null,this.exitWebXRButtonContainer=null,this.overlay=null,this.xrLight=null,this.tracking=!0,this.frames=0,this.initialized=!1,this.oldTarget=new o.Pq0,this.placementComplete=!1,this.isTranslating=!1,this.isRotating=!1,this.isTwoFingering=!1,this.lastDragPosition=new o.Pq0,this.firstRatio=0,this.lastAngle=0,this.goalPosition=new o.Pq0,this.goalYaw=0,this.goalScale=1,this.xDamper=new Damper,this.yDamper=new Damper,this.zDamper=new Damper,this.yawDamper=new Damper,this.scaleDamper=new Damper,this.onExitWebXRButtonContainerClick=()=>this.stopPresenting(),this.onUpdateScene=()=>{null!=this.placementBox&&this.isPresenting&&(this.placementBox.dispose(),this.placementBox=new PlacementBox(this.presentedScene,this.placeOnWall?"back":"bottom"))},this.onSelectStart=e=>{const t=this.transientHitTestSource;if(null==t)return;const s=this.frame.getHitTestResultsForTransientInput(t),r=this.presentedScene,o=this.placementBox;if(1===s.length){this.inputSource=e.inputSource;const{axes:t}=this.inputSource.gamepad,s=o.getHit(this.presentedScene,t[0],t[1]);o.show=!0,null!=s?(this.isTranslating=!0,this.lastDragPosition.copy(s)):!1===this.placeOnWall&&(this.isRotating=!0,this.lastAngle=1.5*t[0])}else if(2===s.length){o.show=!0,this.isTwoFingering=!0;const{separation:e}=this.fingerPolar(s);this.firstRatio=e/r.scale.x}},this.onSelectEnd=()=>{this.isTranslating=!1,this.isRotating=!1,this.isTwoFingering=!1,this.inputSource=null,this.goalPosition.y+=this.placementBox.offsetHeight*this.presentedScene.scale.x,this.placementBox.show=!1},this.threeRenderer=e.threeRenderer,this.threeRenderer.xr.enabled=!0}async resolveARSession(){assertIsArCandidate();const e=await navigator.xr.requestSession("immersive-ar",{requiredFeatures:["hit-test"],optionalFeatures:["dom-overlay","light-estimation"],domOverlay:this.overlay?{root:this.overlay}:void 0});return this.threeRenderer.xr.setReferenceSpaceType("local"),await this.threeRenderer.xr.setSession(e),this.threeRenderer.xr.cameraAutoUpdate=!1,e}get presentedScene(){return this._presentedScene}async supportsPresentation(){try{return assertIsArCandidate(),await navigator.xr.isSessionSupported("immersive-ar")}catch(e){return Qn.warn("Request to present in WebXR denied:"),Qn.warn(e),Qn.warn("Falling back to next ar-mode"),!1}}async present(e,t=!1){this.isPresenting&&Qn.warn("Cannot present while a model is already presenting");let s=new Promise(((e,t)=>{requestAnimationFrame((()=>e()))}));e.setHotspotsVisibility(!1),e.queueRender(),await s,this._presentedScene=e,this.overlay=e.element.shadowRoot.querySelector("div.default"),!0===t&&(this.xrLight=new XREstimatedLight(this.threeRenderer),this.xrLight.addEventListener("estimationstart",(()=>{if(!this.isPresenting||null==this.xrLight)return;const e=this.presentedScene;e.add(this.xrLight),e.environment=this.xrLight.environment})));const r=await this.resolveARSession();r.addEventListener("end",(()=>{this.postSessionCleanup()}),{once:!0});const o=e.element.shadowRoot.querySelector(".slot.exit-webxr-ar-button");o.classList.add("enabled"),o.addEventListener("click",this.onExitWebXRButtonContainerClick),this.exitWebXRButtonContainer=o;const A=await r.requestReferenceSpace("viewer");this.tracking=!0,this.frames=0,this.initialized=!1,this.turntableRotation=e.yaw,this.goalYaw=e.yaw,this.goalScale=1,e.setBackground(null),this.oldShadowIntensity=e.shadowIntensity,e.setShadowIntensity(.01),this.oldTarget.copy(e.getTarget()),e.element.addEventListener("load",this.onUpdateScene);const l=20*Math.PI/180,h=!0===this.placeOnWall?void 0:new XRRay(new DOMPoint(0,0,0),{x:0,y:-Math.sin(l),z:-Math.cos(l)});r.requestHitTestSource({space:A,offsetRay:h}).then((e=>{this.initialHitSource=e})),this.currentSession=r,this.placementBox=new PlacementBox(e,this.placeOnWall?"back":"bottom"),this.placementComplete=!1,this.lastTick=performance.now(),this.dispatchEvent({type:"status",status:Sn})}async stopPresenting(){if(!this.isPresenting)return;const e=new Promise((e=>{this.resolveCleanup=e}));try{await this.currentSession.end(),await e}catch(e){Qn.warn("Error while trying to end WebXR AR session"),Qn.warn(e),this.postSessionCleanup()}}get isPresenting(){return null!=this.presentedScene}get target(){return this.oldTarget}updateTarget(){const e=this.presentedScene;if(null!=e){const t=e.getTarget();this.oldTarget.copy(t),this.placeOnWall?t.z=e.boundingBox.min.z:t.y=e.boundingBox.min.y,e.setTarget(t.x,t.y,t.z)}}postSessionCleanup(){const e=this.currentSession;null!=e&&(e.removeEventListener("selectstart",this.onSelectStart),e.removeEventListener("selectend",this.onSelectEnd),this.currentSession=null);const t=this.presentedScene;if(this._presentedScene=null,null!=t){const{element:e}=t;null!=this.xrLight&&(t.remove(this.xrLight),this.xrLight.dispose(),this.xrLight=null),t.position.set(0,0,0),t.scale.set(1,1,1),t.setShadowOffset(0);const s=this.turntableRotation;null!=s&&(t.yaw=s);const r=this.oldShadowIntensity;null!=r&&t.setShadowIntensity(r),t.setEnvironmentAndSkybox(e[Fe],e[_e]);const o=this.oldTarget;t.setTarget(o.x,o.y,o.z),t.xrCamera=null,t.element.removeEventListener("load",this.onUpdateScene),t.orientHotspots(0),e.requestUpdate("cameraTarget"),e.requestUpdate("maxCameraOrbit"),e[Po](e.getBoundingClientRect()),requestAnimationFrame((()=>{t.element.dispatchEvent(new CustomEvent("camera-change",{detail:{source:vn.NONE}}))}))}this.renderer.height=0;const s=this.exitWebXRButtonContainer;null!=s&&(s.classList.remove("enabled"),s.removeEventListener("click",this.onExitWebXRButtonContainerClick),this.exitWebXRButtonContainer=null);const r=this.transientHitTestSource;null!=r&&(r.cancel(),this.transientHitTestSource=null);const o=this.initialHitSource;null!=o&&(o.cancel(),this.initialHitSource=null),null!=this.placementBox&&(this.placementBox.dispose(),this.placementBox=null),this.lastTick=null,this.turntableRotation=null,this.oldShadowIntensity=null,this.frame=null,this.inputSource=null,this.overlay=null,null!=this.resolveCleanup&&this.resolveCleanup(),this.dispatchEvent({type:"status",status:bn})}updateView(e){const t=this.presentedScene,s=this.threeRenderer.xr;s.updateCamera(kn),t.xrCamera=s.getCamera();const{elements:r}=t.getCamera().matrixWorld;if(t.orientHotspots(Math.atan2(r[1],r[5])),this.initialized||(this.placeInitially(),this.initialized=!0),e.requestViewportScale&&e.recommendedViewportScale){const t=e.recommendedViewportScale;e.requestViewportScale(Math.max(t,.25))}const o=s.getBaseLayer();if(null!=o){const t=o instanceof XRWebGLLayer?o.getViewport(e):s.getBinding().getViewSubImage(o,e).viewport;this.threeRenderer.setViewport(t.x,t.y,t.width,t.height)}}placeInitially(){const e=this.presentedScene,{position:t,element:s}=e,r=e.getCamera(),{width:o,height:A}=this.overlay.getBoundingClientRect();e.setSize(o,A),r.projectionMatrixInverse.copy(r.projectionMatrix).invert();const{theta:l,radius:h}=s.getCameraOrbit(),c=r.getWorldDirection(Ln);e.yaw=Math.atan2(-c.x,-c.z)-l,this.goalYaw=e.yaw,t.copy(r.position).add(c.multiplyScalar(h)),this.updateTarget();const d=e.getTarget();t.add(d).sub(this.oldTarget),this.goalPosition.copy(t),e.setHotspotsVisibility(!0);const{session:g}=this.frame;g.addEventListener("selectstart",this.onSelectStart),g.addEventListener("selectend",this.onSelectEnd),g.requestHitTestSourceForTransientInput({profile:"generic-touchscreen"}).then((e=>{this.transientHitTestSource=e}))}getTouchLocation(){const{axes:e}=this.inputSource.gamepad;let t=this.placementBox.getExpandedHit(this.presentedScene,e[0],e[1]);return null!=t&&(Ln.copy(t).sub(this.presentedScene.getCamera().position),Ln.length()>10)?null:t}getHitPoint(e){const t=this.threeRenderer.xr.getReferenceSpace(),s=e.getPose(t);if(null==s)return null;const r=Fn.fromArray(s.transform.matrix);return!0===this.placeOnWall&&(this.goalYaw=Math.atan2(r.elements[4],r.elements[6])),r.elements[5]>.75!==this.placeOnWall?_n.setFromMatrixPosition(r):null}moveToFloor(e){const t=this.initialHitSource;if(null==t)return;const s=e.getHitTestResults(t);if(0==s.length)return;const r=s[0],o=this.getHitPoint(r);null!=o&&(this.placementBox.show=!0,this.isTranslating||(this.placeOnWall?this.goalPosition.copy(o):this.goalPosition.y=o.y),t.cancel(),this.initialHitSource=null,this.dispatchEvent({type:"status",status:Mn}))}fingerPolar(e){const t=e[0].inputSource.gamepad.axes,s=e[1].inputSource.gamepad.axes,r=s[0]-t[0],o=s[1]-t[1],A=Math.atan2(o,r);let l=this.lastAngle-A;return l>Math.PI?l-=2*Math.PI:l<-Math.PI&&(l+=2*Math.PI),this.lastAngle=A,{separation:Math.sqrt(r*r+o*o),deltaYaw:l}}processInput(e){const t=this.transientHitTestSource;if(null==t)return;if(!this.isTranslating&&!this.isTwoFingering&&!this.isRotating)return;const s=e.getHitTestResultsForTransientInput(t),r=this.presentedScene,o=r.scale.x;if(this.isTwoFingering)if(s.length<2)this.isTwoFingering=!1;else{const{separation:e,deltaYaw:t}=this.fingerPolar(s);if(!1===this.placeOnWall&&(this.goalYaw+=t),r.canScale){const t=e/this.firstRatio;this.goalScale=t<1.3&&t>xn?1:t}}else if(2!==s.length)if(this.isRotating){const e=1.5*this.inputSource.gamepad.axes[0];this.goalYaw+=e-this.lastAngle,this.lastAngle=e}else this.isTranslating&&s.forEach((e=>{if(e.inputSource!==this.inputSource)return;let t=null;if(e.results.length>0&&(t=this.getHitPoint(e.results[0])),null==t&&(t=this.getTouchLocation()),null!=t){if(this.goalPosition.sub(this.lastDragPosition),!1===this.placeOnWall){const e=t.y-this.lastDragPosition.y;if(e<0){this.placementBox.offsetHeight=e/o,this.presentedScene.setShadowOffset(e);const s=Ln.copy(r.getCamera().position),A=-e/(s.y-t.y);s.multiplyScalar(A),t.multiplyScalar(1-A).add(s)}}this.goalPosition.add(t),this.lastDragPosition.copy(t)}}));else{this.isTranslating=!1,this.isRotating=!1,this.isTwoFingering=!0;const{separation:e}=this.fingerPolar(s);this.firstRatio=e/o}}moveScene(e){const t=this.presentedScene,{position:s,yaw:r}=t,o=t.boundingSphere.radius,A=this.goalPosition,l=t.scale.x,h=this.placementBox;let c=vn.NONE;if(!A.equals(s)||this.goalScale!==l){c=vn.USER_INTERACTION;let{x:r,y:d,z:g}=s;r=this.xDamper.update(r,A.x,e,o),d=this.yDamper.update(d,A.y,e,o),g=this.zDamper.update(g,A.z,e,o),s.set(r,d,g);const p=this.scaleDamper.update(l,this.goalScale,e,1);if(t.scale.set(p,p,p),!this.isTranslating){const e=A.y-d;this.placementComplete&&!1===this.placeOnWall?(h.offsetHeight=e/p,t.setShadowOffset(e)):0===e&&(this.placementComplete=!0,h.show=!1,t.setShadowIntensity(.8))}}h.updateOpacity(e),t.updateTarget(e),t.yaw=this.yawDamper.update(r,this.goalYaw,e,Math.PI),t.element.dispatchEvent(new CustomEvent("camera-change",{detail:{source:c}}))}onWebXRFrame(e,t){this.frame=t,++this.frames;const s=this.threeRenderer.xr.getReferenceSpace(),r=t.getViewerPose(s);null==r&&!0===this.tracking&&this.frames>30&&(this.tracking=!1,this.dispatchEvent({type:"tracking",status:Dn}));const o=this.presentedScene;if(null==r||null==o||!o.element.loaded)return void this.threeRenderer.clear();!1===this.tracking&&(this.tracking=!0,this.dispatchEvent({type:"tracking",status:Rn}));let A=!0;for(const s of r.views){if(this.updateView(s),A){this.moveToFloor(t),this.processInput(t);const s=e-this.lastTick;this.moveScene(s),this.renderer.preRender(o,e,s),this.lastTick=e,o.renderShadow(this.threeRenderer)}this.threeRenderer.render(o,o.getCamera()),A=!1}}}function clone(e){const t=new Map,s=new Map,r=e.clone();return parallelTraverse(e,r,(function(e,r){t.set(r,e),s.set(e,r)})),r.traverse((function(e){if(!e.isSkinnedMesh)return;const r=e,o=t.get(e),A=o.skeleton.bones;r.skeleton=o.skeleton.clone(),r.bindMatrix.copy(o.bindMatrix),r.skeleton.bones=A.map((function(e){return s.get(e)})),r.bind(r.skeleton,r.bindMatrix)})),r}function parallelTraverse(e,t,s){s(e,t);for(let r=0;r<e.children.length;r++)parallelTraverse(e.children[r],t.children[r],s)}const Un=Symbol("prepared"),Gn=Symbol("prepare"),Pn=Symbol("preparedGLTF"),Nn=Symbol("clone");class GLTFInstance{constructor(e){this[Pn]=e}static prepare(e){if(null==e.scene)throw new Error("Model does not have a scene");if(e[Un])return e;const t=this[Gn](e);return t[Un]=!0,t}static[Gn](e){const{scene:t}=e,s=[t];return Object.assign(Object.assign({},e),{scene:t,scenes:s})}get parser(){return this[Pn].parser}get animations(){return this[Pn].animations}get scene(){return this[Pn].scene}get scenes(){return this[Pn].scenes}get cameras(){return this[Pn].cameras}get asset(){return this[Pn].asset}get userData(){return this[Pn].userData}clone(){return new(0,this.constructor)(this[Nn]())}dispose(){this.scenes.forEach((e=>{e.traverse((e=>{const t=e;if(!t.material)return;(Array.isArray(t.material)?t.material:[t.material]).forEach((e=>{for(const t in e){const s=e[t];if(s instanceof o.gPd){const e=s.source.data;null!=e.close&&e.close(),s.dispose()}}e.dispose()})),t.geometry.dispose()}))}))}[Nn](){const e=this[Pn],t=clone(this.scene);cloneVariantMaterials(t,this.scene);const s=[t],r=e.userData?Object.assign({},e.userData):{};return Object.assign(Object.assign({},e),{scene:t,scenes:s,userData:r})}}const cloneVariantMaterials=(e,t)=>{traversePair(e,t,((e,t)=>{void 0!==t.userData.variantMaterials&&(e.userData.variantMaterials=new Map(t.userData.variantMaterials)),void 0!==t.userData.variantData&&(e.userData.variantData=t.userData.variantData),void 0!==t.userData.originalMaterial&&(e.userData.originalMaterial=t.userData.originalMaterial)}))},traversePair=(e,t,s)=>{s(e,t);for(let r=0;r<e.children.length;r++)traversePair(e.children[r],t.children[r],s)},On=Symbol("threeGLTF"),Hn=Symbol("gltf"),qn=Symbol("gltfElementMap"),Vn=Symbol("threeObjectMap"),$n=Symbol("parallelTraverseThreeScene"),Jn=Symbol("correlateOriginalThreeGLTF"),Kn=Symbol("correlateCloneThreeGLTF");class CorrelatedSceneGraph{constructor(e,t,s,r){this[On]=e,this[Hn]=t,this[qn]=r,this[Vn]=s}static from(e,t){return null!=t?this[Kn](e,t):this[Jn](e)}static[Jn](e){const t=e.parser.json,s=e.parser.associations,r=new Map,A={name:"Default"},l={type:"materials",index:-1};for(const e of s.keys())e instanceof o.imn&&null==s.get(e)&&(l.index<0&&(null==t.materials&&(t.materials=[]),l.index=t.materials.length,t.materials.push(A)),e.name=A.name,s.set(e,{materials:l.index}));for(const[e,o]of s){o&&(e.userData=e.userData||{},e.userData.associations=o);for(const s in o)if(null!=s&&"primitives"!==s){const A=s,l=(t[A]||[])[o[A]];if(null==l)continue;let h=r.get(l);null==h&&(h=new Set,r.set(l,h)),h.add(e)}}return new CorrelatedSceneGraph(e,t,s,r)}static[Kn](e,t){const s=t.threeGLTF,r=t.gltf,o=JSON.parse(JSON.stringify(r)),A=new Map,l=new Map;for(let r=0;r<s.scenes.length;r++)this[$n](s.scenes[r],e.scenes[r],((e,s)=>{const r=t.threeObjectMap.get(e);if(null!=r)for(const e in r)if(null!=e&&"primitives"!==e){const t=e,h=r[t],c=o[t][h],d=A.get(s)||{};d[t]=h,A.set(s,d);const g=l.get(c)||new Set;g.add(s),l.set(c,g)}}));return new CorrelatedSceneGraph(e,o,A,l)}static[$n](e,t,s){const traverse=(e,t)=>{if(s(e,t),e.isObject3D){const r=e,o=t;if(r.material)if(Array.isArray(r.material))for(let e=0;e<r.material.length;++e)s(r.material[e],o.material[e]);else s(r.material,o.material);for(let s=0;s<e.children.length;++s)traverse(e.children[s],t.children[s])}};traverse(e,t)}get threeGLTF(){return this[On]}get gltf(){return this[Hn]}get gltfElementMap(){return this[qn]}get threeObjectMap(){return this[Vn]}}const Yn=Symbol("correlatedSceneGraph");class ModelViewerGLTFInstance extends GLTFInstance{static[Gn](e){const t=super[Gn](e);null==t[Yn]&&(t[Yn]=CorrelatedSceneGraph.from(t));const{scene:s}=t,r=new o.iyt(void 0,1/0);return s.traverse((e=>{e.renderOrder=1e3,e.frustumCulled=!1,e.name||(e.name=e.uuid);const s=e;if(s.material){const{geometry:e}=s;s.castShadow=!0,s.isSkinnedMesh&&(e.boundingSphere=r,e.boundingBox=null);const A=s.material;if(!0===A.isMeshBasicMaterial&&(A.toneMapped=!1),A.shadowSide=o.hB5,A.aoMap){const{gltf:s,threeObjectMap:r}=t[Yn],o=r.get(A);if(null!=s.materials&&null!=o&&null!=o.materials){const t=s.materials[o.materials];t.occlusionTexture&&0===t.occlusionTexture.texCoord&&null!=e.attributes.uv&&e.setAttribute("uv2",e.attributes.uv)}}}})),t}get correlatedSceneGraph(){return this[Pn][Yn]}[Nn](){const e=super[Nn](),t=new Map;return e.scene.traverse((e=>{const s=e;if(s.material){const e=s.material;if(null!=e){if(t.has(e.uuid))return void(s.material=t.get(e.uuid));s.material=e.clone(),t.set(e.uuid,s.material)}}const r=e;void 0!==r.target&&r.add(r.target)})),e[Yn]=CorrelatedSceneGraph.from(e,this.correlatedSceneGraph),e}}var zn=s(96763);const getBufferForType=(e,t,s)=>{let r;switch(e){case o.OUM:r=new Uint8ClampedArray(t*s*4);break;case o.ix0:r=new Uint16Array(t*s*4);break;case o.bkx:r=new Uint32Array(t*s*4);break;case o.tJf:r=new Int8Array(t*s*4);break;case o.fBL:r=new Int16Array(t*s*4);break;case o.Yuy:r=new Int32Array(t*s*4);break;case o.RQf:r=new Float32Array(t*s*4);break;default:throw new Error("Unsupported data type")}return r};let jn;class QuadRenderer_vDmOC3x_QuadRenderer{constructor(e){var t,s,r,A,l,h,c,d,g,p,m,f,I,E,C,B;this._rendererIsDisposable=!1,this._supportsReadPixels=!0,this.render=()=>{this._renderer.setRenderTarget(this._renderTarget);try{this._renderer.render(this._scene,this._camera)}catch(e){throw this._renderer.setRenderTarget(null),e}this._renderer.setRenderTarget(null)},this._width=e.width,this._height=e.height,this._type=e.type,this._colorSpace=e.colorSpace;const y={format:o.GWd,depthBuffer:!1,stencilBuffer:!1,type:this._type,colorSpace:this._colorSpace,anisotropy:void 0!==(null===(t=e.renderTargetOptions)||void 0===t?void 0:t.anisotropy)?null===(s=e.renderTargetOptions)||void 0===s?void 0:s.anisotropy:1,generateMipmaps:void 0!==(null===(r=e.renderTargetOptions)||void 0===r?void 0:r.generateMipmaps)&&(null===(A=e.renderTargetOptions)||void 0===A?void 0:A.generateMipmaps),magFilter:void 0!==(null===(l=e.renderTargetOptions)||void 0===l?void 0:l.magFilter)?null===(h=e.renderTargetOptions)||void 0===h?void 0:h.magFilter:o.k6q,minFilter:void 0!==(null===(c=e.renderTargetOptions)||void 0===c?void 0:c.minFilter)?null===(d=e.renderTargetOptions)||void 0===d?void 0:d.minFilter:o.k6q,samples:void 0!==(null===(g=e.renderTargetOptions)||void 0===g?void 0:g.samples)?null===(p=e.renderTargetOptions)||void 0===p?void 0:p.samples:void 0,wrapS:void 0!==(null===(m=e.renderTargetOptions)||void 0===m?void 0:m.wrapS)?null===(f=e.renderTargetOptions)||void 0===f?void 0:f.wrapS:o.ghU,wrapT:void 0!==(null===(I=e.renderTargetOptions)||void 0===I?void 0:I.wrapT)?null===(E=e.renderTargetOptions)||void 0===E?void 0:E.wrapT:o.ghU};if(this._material=e.material,e.renderer?this._renderer=e.renderer:(this._renderer=QuadRenderer_vDmOC3x_QuadRenderer.instantiateRenderer(),this._rendererIsDisposable=!0),this._scene=new o.Z58,this._camera=new o.qUd,this._camera.position.set(0,0,10),this._camera.left=-.5,this._camera.right=.5,this._camera.top=.5,this._camera.bottom=-.5,this._camera.updateProjectionMatrix(),!((e,t,s,r)=>{if(void 0!==jn)return jn;const A=new o.nWS(1,1,r);t.setRenderTarget(A);const l=new o.eaF(new o.bdM,new o.V9B({color:16777215}));t.render(l,s),t.setRenderTarget(null);const h=getBufferForType(e,A.width,A.height);return t.readRenderTargetPixels(A,0,0,A.width,A.height,h),A.dispose(),l.geometry.dispose(),l.material.dispose(),jn=0!==h[0],jn})(this._type,this._renderer,this._camera,y)){let e;if(this._type===o.ix0)e=this._renderer.extensions.has("EXT_color_buffer_float")?o.RQf:void 0;void 0!==e?(zn.warn(`This browser does not support reading pixels from ${this._type} RenderTargets, switching to ${o.RQf}`),this._type=e):(this._supportsReadPixels=!1,zn.warn("This browser dos not support toArray or toDataTexture, calls to those methods will result in an error thrown"))}this._quad=new o.eaF(new o.bdM,this._material),this._quad.geometry.computeBoundingBox(),this._scene.add(this._quad),this._renderTarget=new o.nWS(this.width,this.height,y),this._renderTarget.texture.mapping=void 0!==(null===(C=e.renderTargetOptions)||void 0===C?void 0:C.mapping)?null===(B=e.renderTargetOptions)||void 0===B?void 0:B.mapping:o.UTZ}static instantiateRenderer(){const e=new o.JeP;return e.setSize(128,128),e}toArray(){if(!this._supportsReadPixels)throw new Error("Can't read pixels in this browser");const e=getBufferForType(this._type,this._width,this._height);return this._renderer.readRenderTargetPixels(this._renderTarget,0,0,this._width,this._height,e),e}toDataTexture(e){const t=new o.GYF(this.toArray(),this.width,this.height,o.GWd,this._type,(null==e?void 0:e.mapping)||o.UTZ,(null==e?void 0:e.wrapS)||o.ghU,(null==e?void 0:e.wrapT)||o.ghU,(null==e?void 0:e.magFilter)||o.k6q,(null==e?void 0:e.minFilter)||o.k6q,(null==e?void 0:e.anisotropy)||1,o.Zr2);return t.generateMipmaps=void 0!==(null==e?void 0:e.generateMipmaps)&&(null==e?void 0:e.generateMipmaps),t}disposeOnDemandRenderer(){this._renderer.setRenderTarget(null),this._rendererIsDisposable&&(this._renderer.dispose(),this._renderer.forceContextLoss())}dispose(e){this.disposeOnDemandRenderer(),e&&this.renderTarget.dispose(),this.material instanceof o.BKk&&Object.values(this.material.uniforms).forEach((e=>{e.value instanceof o.gPd&&e.value.dispose()})),Object.values(this.material).forEach((e=>{e instanceof o.gPd&&e.dispose()})),this.material.dispose(),this._quad.geometry.dispose()}get width(){return this._width}set width(e){this._width=e,this._renderTarget.setSize(this._width,this._height)}get height(){return this._height}set height(e){this._height=e,this._renderTarget.setSize(this._width,this._height)}get renderer(){return this._renderer}get renderTarget(){return this._renderTarget}set renderTarget(e){this._renderTarget=e,this._width=e.width,this._height=e.height}get material(){return this._material}get type(){return this._type}get colorSpace(){return this._colorSpace}}var Wn=s(96763);class GainMapDecoderMaterial extends o.BKk{constructor({gamma:e,offsetHdr:t,offsetSdr:s,gainMapMin:r,gainMapMax:A,maxDisplayBoost:l,hdrCapacityMin:h,hdrCapacityMax:c,sdr:d,gainMap:g}){super({name:"GainMapDecoderMaterial",vertexShader:"\nvarying vec2 vUv;\n\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",fragmentShader:"\n// min half float value\n#define HALF_FLOAT_MIN vec3( -65504, -65504, -65504 )\n// max half float value\n#define HALF_FLOAT_MAX vec3( 65504, 65504, 65504 )\n\nuniform sampler2D sdr;\nuniform sampler2D gainMap;\nuniform vec3 gamma;\nuniform vec3 offsetHdr;\nuniform vec3 offsetSdr;\nuniform vec3 gainMapMin;\nuniform vec3 gainMapMax;\nuniform float weightFactor;\n\nvarying vec2 vUv;\n\nvoid main() {\n vec3 rgb = texture2D( sdr, vUv ).rgb;\n vec3 recovery = texture2D( gainMap, vUv ).rgb;\n vec3 logRecovery = pow( recovery, gamma );\n vec3 logBoost = gainMapMin * ( 1.0 - logRecovery ) + gainMapMax * logRecovery;\n vec3 hdrColor = (rgb + offsetSdr) * exp2( logBoost * weightFactor ) - offsetHdr;\n vec3 clampedHdrColor = max( HALF_FLOAT_MIN, min( HALF_FLOAT_MAX, hdrColor ));\n gl_FragColor = vec4( clampedHdrColor , 1.0 );\n}\n",uniforms:{sdr:{value:d},gainMap:{value:g},gamma:{value:new o.Pq0(1/e[0],1/e[1],1/e[2])},offsetHdr:{value:(new o.Pq0).fromArray(t)},offsetSdr:{value:(new o.Pq0).fromArray(s)},gainMapMin:{value:(new o.Pq0).fromArray(r)},gainMapMax:{value:(new o.Pq0).fromArray(A)},weightFactor:{value:(Math.log2(l)-h)/(c-h)}},blending:o.XIg,depthTest:!1,depthWrite:!1}),this._maxDisplayBoost=l,this._hdrCapacityMin=h,this._hdrCapacityMax=c,this.needsUpdate=!0,this.uniformsNeedUpdate=!0}get sdr(){return this.uniforms.sdr.value}set sdr(e){this.uniforms.sdr.value=e}get gainMap(){return this.uniforms.gainMap.value}set gainMap(e){this.uniforms.gainMap.value=e}get offsetHdr(){return this.uniforms.offsetHdr.value.toArray()}set offsetHdr(e){this.uniforms.offsetHdr.value.fromArray(e)}get offsetSdr(){return this.uniforms.offsetSdr.value.toArray()}set offsetSdr(e){this.uniforms.offsetSdr.value.fromArray(e)}get gainMapMin(){return this.uniforms.gainMapMin.value.toArray()}set gainMapMin(e){this.uniforms.gainMapMin.value.fromArray(e)}get gainMapMax(){return this.uniforms.gainMapMax.value.toArray()}set gainMapMax(e){this.uniforms.gainMapMax.value.fromArray(e)}get gamma(){const e=this.uniforms.gamma.value;return[1/e.x,1/e.y,1/e.z]}set gamma(e){const t=this.uniforms.gamma.value;t.x=1/e[0],t.y=1/e[1],t.z=1/e[2]}get hdrCapacityMin(){return this._hdrCapacityMin}set hdrCapacityMin(e){this._hdrCapacityMin=e,this.calculateWeight()}get hdrCapacityMax(){return this._hdrCapacityMax}set hdrCapacityMax(e){this._hdrCapacityMax=e,this.calculateWeight()}get maxDisplayBoost(){return this._maxDisplayBoost}set maxDisplayBoost(e){this._maxDisplayBoost=Math.max(1,Math.min(65504,e)),this.calculateWeight()}calculateWeight(){const e=(Math.log2(this._maxDisplayBoost)-this._hdrCapacityMin)/(this._hdrCapacityMax-this._hdrCapacityMin);this.uniforms.weightFactor.value=Math.max(0,Math.min(1,e))}}class GainMapNotFoundError extends Error{}class XMPMetadataNotFoundError extends Error{}const getAttribute=(e,t,s)=>{var r;let o;const A=null===(r=e.attributes.getNamedItem(t))||void 0===r?void 0:r.nodeValue;if(A)o=A;else{const r=e.getElementsByTagName(t)[0];if(!r){if(s)return s;throw new Error(`Can't find ${t} in gainmap metadata`)}{const e=r.getElementsByTagName("rdf:li");if(3!==e.length)throw new Error(`Gainmap metadata contains an array of items for ${t} but its length is not 3`);o=Array.from(e).map((e=>e.innerHTML))}}return o};class MPFExtractor{constructor(e){this.options={debug:!(!e||void 0===e.debug)&&e.debug,extractFII:!e||void 0===e.extractFII||e.extractFII,extractNonFII:!e||void 0===e.extractNonFII||e.extractNonFII}}extract(e){return new Promise(((t,s)=>{const r=this.options.debug,o=new DataView(e.buffer);if(65496!==o.getUint16(0))return void s(new Error("Not a valid jpeg"));const A=o.byteLength;let l,h=2,c=0;for(;h<A;){if(++c>250)return void s(new Error(`Found no marker after ${c} loops 😵`));if(255!==o.getUint8(h))return void s(new Error(`Not a valid marker at offset 0x${h.toString(16)}, found: 0x${o.getUint8(h).toString(16)}`));if(l=o.getUint8(h+1),r&&Wn.log(`Marker: ${l.toString(16)}`),226===l){r&&Wn.log("Found APP2 marker (0xffe2)");const e=h+4;if(1297106432===o.getUint32(e)){const r=e+4;let A;if(18761===o.getUint16(r))A=!1;else{if(19789!==o.getUint16(r))return void s(new Error("No valid endianness marker found in TIFF header"));A=!0}if(42!==o.getUint16(r+2,!A))return void s(new Error("Not valid TIFF data! (no 0x002A marker)"));const l=o.getUint32(r+4,!A);if(l<8)return void s(new Error("Not valid TIFF data! (First offset less than 8)"));const h=r+l,c=o.getUint16(h,!A),d=h+2;let g=0;for(let e=d;e<d+12*c;e+=12)45057===o.getUint16(e,!A)&&(g=o.getUint32(e+8,!A));const p=h+2+12*c+4,m=[];for(let e=p;e<p+16*g;e+=16){const t={MPType:o.getUint32(e,!A),size:o.getUint32(e+4,!A),dataOffset:o.getUint32(e+8,!A),dependantImages:o.getUint32(e+12,!A),start:-1,end:-1,isFII:!1};t.dataOffset?(t.start=r+t.dataOffset,t.isFII=!1):(t.start=0,t.isFII=!0),t.end=t.start+t.size,m.push(t)}if(this.options.extractNonFII&&m.length){const e=new Blob([o]),s=[];for(const t of m){if(t.isFII&&!this.options.extractFII)continue;const r=e.slice(t.start,t.end+1,"image/jpeg");s.push(r)}t(s)}}}h+=2+o.getUint16(h+2)}}))}}const extractGainmapFromJPEG=async e=>{const t=(e=>{var t,s;let r;r="undefined"!=typeof TextDecoder?(new TextDecoder).decode(e):e.toString();let o=r.indexOf("<x:xmpmeta");const A=new DOMParser;for(;-1!==o;){const e=r.indexOf("x:xmpmeta>",o);r.slice(o,e+10);const l=r.slice(o,e+10);try{const e=A.parseFromString(l,"text/xml").getElementsByTagName("rdf:Description")[0],r=getAttribute(e,"hdrgm:GainMapMin","0"),o=getAttribute(e,"hdrgm:GainMapMax"),h=getAttribute(e,"hdrgm:Gamma","1"),c=getAttribute(e,"hdrgm:OffsetSDR","0.015625"),d=getAttribute(e,"hdrgm:OffsetHDR","0.015625");let g=null===(t=e.attributes.getNamedItem("hdrgm:HDRCapacityMin"))||void 0===t?void 0:t.nodeValue;g||(g="0");const p=null===(s=e.attributes.getNamedItem("hdrgm:HDRCapacityMax"))||void 0===s?void 0:s.nodeValue;if(!p)throw new Error("Incomplete gainmap metadata");return{gainMapMin:Array.isArray(r)?r.map((e=>parseFloat(e))):[parseFloat(r),parseFloat(r),parseFloat(r)],gainMapMax:Array.isArray(o)?o.map((e=>parseFloat(e))):[parseFloat(o),parseFloat(o),parseFloat(o)],gamma:Array.isArray(h)?h.map((e=>parseFloat(e))):[parseFloat(h),parseFloat(h),parseFloat(h)],offsetSdr:Array.isArray(c)?c.map((e=>parseFloat(e))):[parseFloat(c),parseFloat(c),parseFloat(c)],offsetHdr:Array.isArray(d)?d.map((e=>parseFloat(e))):[parseFloat(d),parseFloat(d),parseFloat(d)],hdrCapacityMin:parseFloat(g),hdrCapacityMax:parseFloat(p)}}catch(e){}o=r.indexOf("<x:xmpmeta",e)}})(e);if(!t)throw new XMPMetadataNotFoundError("Gain map XMP metadata not found");const s=new MPFExtractor({extractFII:!0,extractNonFII:!0}),r=await s.extract(e);if(2!==r.length)throw new GainMapNotFoundError("Gain map recovery image not found");return{sdr:new Uint8Array(await r[0].arrayBuffer()),gainMap:new Uint8Array(await r[1].arrayBuffer()),metadata:t}},getHTMLImageFromBlob=e=>new Promise(((t,s)=>{const r=document.createElement("img");r.onload=()=>{t(r)},r.onerror=e=>{s(e)},r.src=URL.createObjectURL(e)}));class LoaderBase extends o.aHM{constructor(e,t){super(t),this._renderer=e,this._internalLoadingManager=new o.KPJ}setRenderTargetOptions(e){return this._renderTargetOptions=e,this}prepareQuadRenderer(){const e=new GainMapDecoderMaterial({gainMapMax:[1,1,1],gainMapMin:[0,0,0],gamma:[1,1,1],offsetHdr:[1,1,1],offsetSdr:[1,1,1],hdrCapacityMax:1,hdrCapacityMin:0,maxDisplayBoost:1,gainMap:new o.gPd,sdr:new o.gPd});return new QuadRenderer_vDmOC3x_QuadRenderer({width:16,height:16,type:o.ix0,colorSpace:o.Zr2,material:e,renderer:this._renderer,renderTargetOptions:this._renderTargetOptions})}async render(e,t,s,r){const A=r?new Blob([r],{type:"image/jpeg"}):void 0,l=new Blob([s],{type:"image/jpeg"});let h,c,d=!1;if("undefined"==typeof createImageBitmap){const e=await Promise.all([A?getHTMLImageFromBlob(A):Promise.resolve(void 0),getHTMLImageFromBlob(l)]);c=e[0],h=e[1],d=!0}else{const e=await Promise.all([A?createImageBitmap(A,{imageOrientation:"flipY"}):Promise.resolve(void 0),createImageBitmap(l,{imageOrientation:"flipY"})]);c=e[0],h=e[1]}const g=new o.gPd(c||new ImageData(2,2),o.UTZ,o.ghU,o.ghU,o.k6q,o.NZq,o.GWd,o.OUM,1,o.Zr2);g.flipY=d,g.needsUpdate=!0;const p=new o.gPd(h,o.UTZ,o.ghU,o.ghU,o.k6q,o.NZq,o.GWd,o.OUM,1,o.er$);p.flipY=d,p.needsUpdate=!0,e.width=h.width,e.height=h.height,e.material.gainMap=g,e.material.sdr=p,e.material.gainMapMin=t.gainMapMin,e.material.gainMapMax=t.gainMapMax,e.material.offsetHdr=t.offsetHdr,e.material.offsetSdr=t.offsetSdr,e.material.gamma=t.gamma,e.material.hdrCapacityMin=t.hdrCapacityMin,e.material.hdrCapacityMax=t.hdrCapacityMax,e.material.maxDisplayBoost=Math.pow(2,t.hdrCapacityMax),e.material.needsUpdate=!0,e.render()}}class HDRJPGLoader extends LoaderBase{load(e,t,s,r){const A=this.prepareQuadRenderer(),l=new o.Y9S(this._internalLoadingManager);return l.setResponseType("arraybuffer"),l.setRequestHeader(this.requestHeader),l.setPath(this.path),l.setWithCredentials(this.withCredentials),this.manager.itemStart(e),l.load(e,(async s=>{if("string"==typeof s)throw new Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");const o=new Uint8Array(s);let l,h,c;try{const e=await extractGainmapFromJPEG(o);l=e.sdr,h=e.gainMap,c=e.metadata}catch(t){if(!(t instanceof XMPMetadataNotFoundError||t instanceof GainMapNotFoundError))throw t;Wn.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),c={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=o}try{await this.render(A,c,l,h)}catch(t){return this.manager.itemError(e),"function"==typeof r&&r(t),void A.disposeOnDemandRenderer()}"function"==typeof t&&t(A),this.manager.itemEnd(e),A.disposeOnDemandRenderer()}),s,(t=>{this.manager.itemError(e),"function"==typeof r&&r(t)})),A}}class RGBELoader extends o.BRH{constructor(e){super(e),this.type=o.ix0}parse(e){const rgbe_error=function(e,t){switch(e){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(t||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(t||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(t||""));default:throw new Error("THREE.RGBELoader: Memory Error: "+(t||""))}},fgets=function(e,t,s){t=t||1024;let r=e.pos,o=-1,A=0,l="",h=String.fromCharCode.apply(null,new Uint16Array(e.subarray(r,r+128)));for(;0>(o=h.indexOf("\n"))&&A<t&&r<e.byteLength;)l+=h,A+=h.length,r+=128,h+=String.fromCharCode.apply(null,new Uint16Array(e.subarray(r,r+128)));return-1<o&&(!1!==s&&(e.pos+=A+o+1),l+h.slice(0,o))},RGBEByteToRGBFloat=function(e,t,s,r){const o=e[t+3],A=Math.pow(2,o-128)/255;s[r+0]=e[t+0]*A,s[r+1]=e[t+1]*A,s[r+2]=e[t+2]*A,s[r+3]=1},RGBEByteToRGBHalf=function(e,t,s,r){const A=e[t+3],l=Math.pow(2,A-128)/255;s[r+0]=o.GxU.toHalfFloat(Math.min(e[t+0]*l,65504)),s[r+1]=o.GxU.toHalfFloat(Math.min(e[t+1]*l,65504)),s[r+2]=o.GxU.toHalfFloat(Math.min(e[t+2]*l,65504)),s[r+3]=o.GxU.toHalfFloat(1)},t=new Uint8Array(e);t.pos=0;const s=function(e){const t=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,s=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,r=/^\s*FORMAT=(\S+)\s*$/,o=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,A={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let l,h;for((e.pos>=e.byteLength||!(l=fgets(e)))&&rgbe_error(1,"no header found"),(h=l.match(/^#\?(\S+)/))||rgbe_error(3,"bad initial token"),A.valid|=1,A.programtype=h[1],A.string+=l+"\n";l=fgets(e),!1!==l;)if(A.string+=l+"\n","#"!==l.charAt(0)){if((h=l.match(t))&&(A.gamma=parseFloat(h[1])),(h=l.match(s))&&(A.exposure=parseFloat(h[1])),(h=l.match(r))&&(A.valid|=2,A.format=h[1]),(h=l.match(o))&&(A.valid|=4,A.height=parseInt(h[1],10),A.width=parseInt(h[2],10)),2&A.valid&&4&A.valid)break}else A.comments+=l+"\n";return 2&A.valid||rgbe_error(3,"missing format specifier"),4&A.valid||rgbe_error(3,"missing image size specifier"),A}(t),r=s.width,A=s.height,l=function(e,t,s){const r=t;if(r<8||r>32767||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);r!==(e[2]<<8|e[3])&&rgbe_error(3,"wrong scanline width");const o=new Uint8Array(4*t*s);o.length||rgbe_error(4,"unable to allocate buffer space");let A=0,l=0;const h=4*r,c=new Uint8Array(4),d=new Uint8Array(h);let g=s;for(;g>0&&l<e.byteLength;){l+4>e.byteLength&&rgbe_error(1),c[0]=e[l++],c[1]=e[l++],c[2]=e[l++],c[3]=e[l++],2==c[0]&&2==c[1]&&(c[2]<<8|c[3])==r||rgbe_error(3,"bad rgbe scanline format");let t,s=0;for(;s<h&&l<e.byteLength;){t=e[l++];const r=t>128;if(r&&(t-=128),(0===t||s+t>h)&&rgbe_error(3,"bad scanline data"),r){const r=e[l++];for(let e=0;e<t;e++)d[s++]=r}else d.set(e.subarray(l,l+t),s),s+=t,l+=t}const p=r;for(let e=0;e<p;e++){let t=0;o[A]=d[e+t],t+=r,o[A+1]=d[e+t],t+=r,o[A+2]=d[e+t],t+=r,o[A+3]=d[e+t],A+=4}g--}return o}(t.subarray(t.pos),r,A);let h,c,d;switch(this.type){case o.RQf:d=l.length/4;const e=new Float32Array(4*d);for(let t=0;t<d;t++)RGBEByteToRGBFloat(l,4*t,e,4*t);h=e,c=o.RQf;break;case o.ix0:d=l.length/4;const t=new Uint16Array(4*d);for(let e=0;e<d;e++)RGBEByteToRGBHalf(l,4*e,t,4*e);h=t,c=o.ix0;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:r,height:A,data:h,header:s.string,gamma:s.gamma,exposure:s.exposure,type:c}}setDataType(e){return this.type=e,this}load(e,t,s,r){return super.load(e,(function onLoadCallback(e,s){switch(e.type){case o.RQf:case o.ix0:e.colorSpace=o.Zr2,e.minFilter=o.k6q,e.magFilter=o.k6q,e.generateMipmaps=!1,e.flipY=!0}t&&t(e,s)}),s,r)}}const Xn={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]}]},Zn={topLight:{intensity:400,position:[.5,14,.5]},room:{position:[0,13.2,0],scale:[31.5,28.5,31.5]},boxes:[{position:[-10.906,-1,1.846],rotation:-.195,scale:[2.328,7.905,4.651]},{position:[-5.607,-.754,-.758],rotation:.994,scale:[1.97,1.534,3.955]},{position:[6.167,-.16,7.803],rotation:.561,scale:[3.927,6.285,3.687]},{position:[-2.017,.018,6.124],rotation:.333,scale:[2.002,4.566,2.064]},{position:[2.291,-.756,-2.621],rotation:-.286,scale:[1.546,1.552,1.496]},{position:[-2.193,-.369,-5.547],rotation:.516,scale:[3.875,3.487,2.986]}],lights:[{intensity:80,position:[-14,10,8],scale:[.1,2.5,2.5]},{intensity:80,position:[-14,14,-4],scale:[.1,2.5,2.5]},{intensity:23,position:[14,12,0],scale:[.1,5,5]},{intensity:16,position:[0,9,14],scale:[5,5,.1]},{intensity:80,position:[7,8,-14],scale:[2.5,2.5,.1]},{intensity:80,position:[-7,16,-14],scale:[2.5,2.5,.1]},{intensity:1,position:[0,20,0],scale:[.1,.1,.1]}]};class EnvironmentScene extends o.Z58{constructor(e){super(),this.position.y=-3.5;const t=new o.iNn;t.deleteAttribute("uv");const s=new o._4j({metalness:0,side:o.hsX}),r=new o._4j({metalness:0}),A="legacy"==e?Xn:Zn,l=new o.HiM(16777215,A.topLight.intensity,28,2);l.position.set(...A.topLight.position),this.add(l);const h=new o.eaF(t,s);h.position.set(...A.room.position),h.scale.set(...A.room.scale),this.add(h);for(const e of A.boxes){const s=new o.eaF(t,r);s.position.set(...e.position),s.rotation.set(0,e.rotation,0),s.scale.set(...e.scale),this.add(s)}for(const e of A.lights){const s=new o.eaF(t,this.createAreaLightMaterial(e.intensity));s.position.set(...e.position),s.scale.set(...e.scale),this.add(s)}}createAreaLightMaterial(e){const t=new o.V9B;return t.color.setScalar(e),t}}var er=s(96763);const tr=20,ir=/\.hdr(\.js)?$/;class TextureUtils{constructor(e){this.threeRenderer=e,this.lottieLoaderUrl="",this.withCredentials=!1,this._ldrLoader=null,this._imageLoader=null,this._hdrLoader=null,this._lottieLoader=null,this.generatedEnvironmentMap=null,this.generatedEnvironmentMapAlt=null,this.skyboxCache=new Map,this.blurMaterial=null,this.blurScene=null}get ldrLoader(){return null==this._ldrLoader&&(this._ldrLoader=new o.Tap),this._ldrLoader.setWithCredentials(this.withCredentials),this._ldrLoader}get imageLoader(){return null==this._imageLoader&&(this._imageLoader=new HDRJPGLoader(this.threeRenderer)),this._imageLoader.setWithCredentials(this.withCredentials),this._imageLoader}get hdrLoader(){return null==this._hdrLoader&&(this._hdrLoader=new RGBELoader,this._hdrLoader.setDataType(o.ix0)),this._hdrLoader.setWithCredentials(this.withCredentials),this._hdrLoader}async getLottieLoader(){if(null==this._lottieLoader){const{LottieLoader:e}=await import(this.lottieLoaderUrl);this._lottieLoader=new e}return this._lottieLoader.setWithCredentials(this.withCredentials),this._lottieLoader}async loadImage(e){const t=await new Promise(((t,s)=>this.ldrLoader.load(e,t,(()=>{}),s)));return t.name=e,t.flipY=!1,t}async loadLottie(e,t){const s=await this.getLottieLoader();s.setQuality(t);const r=await new Promise(((t,r)=>s.load(e,t,(()=>{}),r)));return r.name=e,r}async loadEquirect(e,t=()=>{}){try{const s=ir.test(e),r=s?this.hdrLoader:this.imageLoader,A=await new Promise(((s,o)=>r.load(e,(e=>{const{renderTarget:t}=e;if(null!=t){const{texture:r}=t;e.dispose(!1),s(r)}else s(e)}),(e=>{t(e.loaded/e.total*.9)}),o)));return t(1),A.name=e,A.mapping=o.wfO,s||(A.colorSpace=o.er$),A}finally{t&&t(1)}}async generateEnvironmentMapAndSkybox(e=null,t=null,s=()=>{}){const r="legacy"!==t;"legacy"!==t&&"neutral"!==t||(t=null),t=deserializeUrl(t);let o,A=Promise.resolve(null);e&&(A=this.loadEquirectFromUrl(e,s)),o=t?this.loadEquirectFromUrl(t,s):e?this.loadEquirectFromUrl(e,s):r?this.loadGeneratedEnvironmentMapAlt():this.loadGeneratedEnvironmentMap();const[l,h]=await Promise.all([o,A]);if(null==l)throw new Error("Failed to load environment map.");return{environmentMap:l,skybox:h}}async loadEquirectFromUrl(e,t){if(!this.skyboxCache.has(e)){const s=this.loadEquirect(e,t);this.skyboxCache.set(e,s)}return this.skyboxCache.get(e)}async GenerateEnvironmentMap(e,t){await((e=0)=>new Promise((t=>setTimeout(t,e))))();const s=this.threeRenderer,r=new o.o6l(256,{generateMipmaps:!1,type:o.ix0,format:o.GWd,colorSpace:o.Zr2,depthBuffer:!0}),A=new o.F1T(.1,100,r),l=A.renderTarget.texture;l.name=t;const h=s.outputColorSpace,c=s.toneMapping;return s.toneMapping=o.y_p,s.outputColorSpace=o.Zr2,A.update(s,e),this.blurCubemap(r,.04),s.toneMapping=c,s.outputColorSpace=h,l}async loadGeneratedEnvironmentMap(){return null==this.generatedEnvironmentMap&&(this.generatedEnvironmentMap=this.GenerateEnvironmentMap(new EnvironmentScene("legacy"),"legacy")),this.generatedEnvironmentMap}async loadGeneratedEnvironmentMapAlt(){return null==this.generatedEnvironmentMapAlt&&(this.generatedEnvironmentMapAlt=this.GenerateEnvironmentMap(new EnvironmentScene("neutral"),"neutral")),this.generatedEnvironmentMapAlt}blurCubemap(e,t){if(null==this.blurMaterial){this.blurMaterial=this.getBlurShader(tr);const e=new o.iNn,t=new o.eaF(e,this.blurMaterial);this.blurScene=new o.Z58,this.blurScene.add(t)}const s=e.clone();this.halfblur(e,s,t,"latitudinal"),this.halfblur(s,e,t,"longitudinal")}halfblur(e,t,s,r){const A=e.width,l=isFinite(s)?Math.PI/(2*A):2*Math.PI/39,h=s/l,c=isFinite(s)?1+Math.floor(3*h):tr;c>tr&&er.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${c} samples when the maximum is set to 20`);const d=[];let g=0;for(let e=0;e<tr;++e){const t=e/h,s=Math.exp(-t*t/2);d.push(s),0==e?g+=s:e<c&&(g+=2*s)}for(let e=0;e<d.length;e++)d[e]=d[e]/g;const p=this.blurMaterial.uniforms;p.envMap.value=e.texture,p.samples.value=c,p.weights.value=d,p.latitudinal.value="latitudinal"===r,p.dTheta.value=l;new o.F1T(.1,100,t).update(this.threeRenderer,this.blurScene)}getBlurShader(e){const t=new Float32Array(e),s=new o.Pq0(0,1,0);return new o.BKk({name:"SphericalGaussianBlur",defines:{n:e},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:t},latitudinal:{value:!1},dTheta:{value:0},poleAxis:{value:s}},vertexShader:"\n \n varying vec3 vOutputDirection;\n \n void main() {\n \n vOutputDirection = vec3( position );\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n \n }\n ",fragmentShader:"\n varying vec3 vOutputDirection;\n \n uniform samplerCube envMap;\n uniform int samples;\n uniform float weights[ n ];\n uniform bool latitudinal;\n uniform float dTheta;\n uniform vec3 poleAxis;\n \n vec3 getSample( float theta, vec3 axis ) {\n \n float cosTheta = cos( theta );\n // Rodrigues' axis-angle rotation\n vec3 sampleDirection = vOutputDirection * cosTheta\n + cross( axis, vOutputDirection ) * sin( theta )\n + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n \n return vec3( textureCube( envMap, sampleDirection ) );\n \n }\n \n void main() {\n \n vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n \n if ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n \n axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n \n }\n \n axis = normalize( axis );\n \n gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n \n for ( int i = 1; i < n; i++ ) {\n \n if ( i >= samples ) {\n \n break;\n \n }\n \n float theta = dTheta * float( i );\n gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n \n }\n }\n ",blending:o.XIg,depthTest:!1,depthWrite:!1,side:o.hsX})}async dispose(){for(const[,e]of this.skyboxCache){(await e).dispose()}null!=this.generatedEnvironmentMap&&((await this.generatedEnvironmentMap).dispose(),this.generatedEnvironmentMap=null),null!=this.generatedEnvironmentMapAlt&&((await this.generatedEnvironmentMapAlt).dispose(),this.generatedEnvironmentMapAlt=null),null!=this.blurMaterial&&this.blurMaterial.dispose()}}var sr=s(96763);const nr=[1,.79,.62,.5,.4,.31,.25],rr="high-performance";class Renderer extends o.Qev{constructor(e){super(),this.loader=new CachingGLTFLoader(ModelViewerGLTFInstance),this.width=0,this.height=0,this.dpr=1,this.scenes=new Set,this.multipleScenesVisible=!1,this.lastTick=performance.now(),this.renderedLastFrame=!1,this.scaleStep=0,this.lastStep=3,this.avgFrameDuration=50,this.onWebGLContextLost=e=>{this.dispatchEvent({type:"contextlost",sourceEvent:e})},this.onWebGLContextRestored=()=>{var e;null===(e=this.textureUtils)||void 0===e||e.dispose(),this.textureUtils=new TextureUtils(this.threeRenderer);for(const e of this.scenes)e.element[ke]()},this.dpr=De(),this.canvas3D=document.createElement("canvas"),this.canvas3D.id="webgl-canvas",this.canvas3D.classList.add("show"),o.vxI.tonemapping_pars_fragment=o.vxI.tonemapping_pars_fragment.replace("vec3 CustomToneMapping( vec3 color ) { return color; }","\n float startCompression = 0.8 - 0.04;\n float desaturation = 0.15;\n vec3 CustomToneMapping( vec3 color ) {\n color *= toneMappingExposure;\n\n float x = min(color.r, min(color.g, color.b));\n float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n color -= offset;\n\n float peak = max(color.r, max(color.g, color.b));\n if (peak < startCompression) return color;\n\n float d = 1. - startCompression;\n float newPeak = 1. - d * d / (peak + d - startCompression);\n color *= newPeak / peak;\n\n float g = 1. - 1. / (desaturation * (peak - newPeak) + 1.);\n return mix(color, vec3(1, 1, 1), g);\n }");try{this.threeRenderer=new o.JeP({canvas:this.canvas3D,alpha:!0,antialias:!0,powerPreference:e.powerPreference,preserveDrawingBuffer:!0}),this.threeRenderer.autoClear=!0,this.threeRenderer.setPixelRatio(1),this.threeRenderer.debug={checkShaderErrors:!!e.debug,onShaderError:null},this.threeRenderer.toneMapping=o.FV}catch(e){sr.warn(e)}this.arRenderer=new ARRenderer(this),this.textureUtils=this.canRender?new TextureUtils(this.threeRenderer):null,CachingGLTFLoader.initializeKTX2Loader(this.threeRenderer),this.canvas3D.addEventListener("webglcontextlost",this.onWebGLContextLost),this.canvas3D.addEventListener("webglcontextrestored",this.onWebGLContextRestored),this.updateRendererSize()}static get singleton(){return this._singleton}static resetSingleton(){const e=this._singleton.dispose();for(const t of e)t.disconnectedCallback();this._singleton=new Renderer({powerPreference:(self.ModelViewerElement||{}).powerPreference||rr,debug:Le()});for(const t of e)t.connectedCallback()}get canRender(){return null!=this.threeRenderer}get scaleFactor(){return nr[this.scaleStep]}set minScale(e){let t=1;for(;t<nr.length&&!(nr[t]<e);)++t;this.lastStep=t-1}registerScene(e){this.scenes.add(e),e.forceRescale();const t=new o.I9Y;this.threeRenderer.getSize(t),e.canvas.width=t.x,e.canvas.height=t.y,this.canRender&&this.scenes.size>0&&this.threeRenderer.setAnimationLoop(((e,t)=>this.render(e,t)))}unregisterScene(e){this.scenes.delete(e),this.canvas3D.parentElement===e.canvas.parentElement&&e.canvas.parentElement.removeChild(this.canvas3D),this.canRender&&0===this.scenes.size&&this.threeRenderer.setAnimationLoop(null)}displayCanvas(e){return this.multipleScenesVisible?e.element[Fo]:this.canvas3D}countVisibleScenes(){const{canvas3D:e}=this;let t=0,s=null;for(const r of this.scenes){const{element:o}=r;o.modelIsVisible&&null==r.externalRenderer&&++t,e.parentElement===r.canvas.parentElement&&(s=r)}const r=t>1;if(null!=s){const t=r&&!this.multipleScenesVisible,o=!s.element.modelIsVisible;if(t||o){const{width:t,height:r}=this.sceneSize(s);this.copyPixels(s,t,r),e.parentElement.removeChild(e)}}this.multipleScenesVisible=r}updateRendererSize(){var e;const t=De();if(t!==this.dpr)for(const e of this.scenes){const{element:t}=e;t[Bo](t.getBoundingClientRect())}let s=0,r=0;for(const e of this.scenes)s=Math.max(s,e.width),r=Math.max(r,e.height);if(s!==this.width||r!==this.height||t!==this.dpr){this.width=s,this.height=r,this.dpr=t,s=Math.ceil(s*t),r=Math.ceil(r*t),this.canRender&&this.threeRenderer.setSize(s,r,!1);for(const t of this.scenes){const{canvas:o}=t;o.width=s,o.height=r,t.forceRescale(),null===(e=t.effectRenderer)||void 0===e||e.setSize(s,r)}}}updateRendererScale(e){const t=this.scaleStep;this.avgFrameDuration+=clamp(.2*(e-this.avgFrameDuration),-5,5),this.avgFrameDuration>60?++this.scaleStep:this.avgFrameDuration<40&&this.scaleStep>0&&--this.scaleStep,this.scaleStep=Math.min(this.scaleStep,this.lastStep),t!==this.scaleStep&&(this.avgFrameDuration=50)}shouldRender(e){if(e.shouldRender())e.scaleStep!=this.scaleStep&&(e.scaleStep=this.scaleStep,this.rescaleCanvas(e));else{if(0==e.scaleStep)return!1;e.scaleStep=0,this.rescaleCanvas(e)}return!0}rescaleCanvas(e){const t=nr[e.scaleStep],s=Math.ceil(this.width/t),r=Math.ceil(this.height/t),{style:o}=e.canvas;o.width=`${s}px`,o.height=`${r}px`,this.canvas3D.style.width=`${s}px`,this.canvas3D.style.height=`${r}px`;const A=this.dpr*t,l=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*nr[this.lastStep],pixelWidth:Math.ceil(e.width*A),pixelHeight:Math.ceil(e.height*A),reason:l}}))}sceneSize(e){const{dpr:t}=this,s=nr[e.scaleStep];return{width:Math.min(Math.ceil(e.width*s*t),this.canvas3D.width),height:Math.min(Math.ceil(e.height*s*t),this.canvas3D.height)}}copyPixels(e,t,s){const r=e.context;null!=r?(r.clearRect(0,0,t,s),r.drawImage(this.canvas3D,0,0,t,s,0,0,t,s),e.canvas.classList.add("show")):sr.log("could not acquire 2d context")}orderedScenes(){const e=[];for(const t of[!1,!0])for(const s of this.scenes)s.element.modelIsVisible===t&&e.push(s);return e}get isPresenting(){return this.arRenderer.isPresenting}preRender(e,t,s){const{element:r,exposure:A,toneMapping:l}=e;r[Uo](t,s);const h="number"==typeof A&&!Number.isNaN(A),c=r.environmentImage,d=r.skyboxImage,g=l===o.g7M&&("neutral"===c||"legacy"===c||!c&&!d);this.threeRenderer.toneMappingExposure=(h?A:1)*(g?1.3:1)}render(e,t){if(null!=t)return void this.arRenderer.onWebXRFrame(e,t);const s=e-this.lastTick;if(this.lastTick=e,!this.canRender||this.isPresenting)return;this.countVisibleScenes(),this.updateRendererSize(),this.renderedLastFrame&&(this.updateRendererScale(s),this.renderedLastFrame=!1);const{canvas3D:r}=this;for(const t of this.orderedScenes()){const{element:o}=t;if(!o.loaded||!o.modelIsVisible&&t.renderCount>0)continue;if(this.preRender(t,e,s),!this.shouldRender(t))continue;if(null!=t.externalRenderer){const e=t.getCamera();e.updateMatrix();const{matrix:s,projectionMatrix:r}=e,o=s.elements.slice(),A=t.getTarget();o[12]+=A.x,o[13]+=A.y,o[14]+=A.z,t.externalRenderer.render({viewMatrix:o,projectionMatrix:r.elements});continue}if(!o.modelIsVisible&&!this.multipleScenesVisible)for(const e of this.scenes)e.element.modelIsVisible&&e.queueRender();const{width:A,height:l}=this.sceneSize(t);t.renderShadow(this.threeRenderer),this.threeRenderer.setRenderTarget(null),this.threeRenderer.setViewport(0,Math.ceil(this.height*this.dpr)-l,A,l),null!=t.effectRenderer?t.effectRenderer.render(s):(this.threeRenderer.autoClear=!0,this.threeRenderer.toneMapping=t.toneMapping,this.threeRenderer.render(t,t.camera)),this.multipleScenesVisible||!t.element.modelIsVisible&&0===t.renderCount?this.copyPixels(t,A,l):r.parentElement!==t.canvas.parentElement&&(t.canvas.parentElement.appendChild(r),t.canvas.classList.remove("show")),t.hasRendered(),++t.renderCount,this.renderedLastFrame=!0}}dispose(){null!=this.textureUtils&&this.textureUtils.dispose(),null!=this.threeRenderer&&this.threeRenderer.dispose(),this.textureUtils=null,this.threeRenderer=null;const e=[];for(const t of this.scenes)e.push(t.element);return this.canvas3D.removeEventListener("webglcontextlost",this.onWebGLContextLost),this.canvas3D.removeEventListener("webglcontextrestored",this.onWebGLContextRestored),e}}Renderer._singleton=new Renderer({powerPreference:(self.ModelViewerElement||{}).powerPreference||rr,debug:Le()});const ar=Symbol("correlatedObjects"),or=Symbol("onUpdate");class ThreeDOMElement{constructor(e,t=null){this[or]=e,this[ar]=t}}const Ar=new o.V9B,lr=new o.bdM(2,2);let hr=0;const cr=Symbol("threeTexture"),ur=Symbol("threeTextures");Symbol("applyTexture");class image_Image extends ThreeDOMElement{get[cr](){var e;return null===(e=this[ar])||void 0===e?void 0:e.values().next().value}get[ur](){return this[ar]}constructor(e,t){super(e,new Set(t?[t]:[])),this[cr].image.src||(this[cr].image.src=t.name?t.name:"adhoc_image"+hr++),this[cr].image.name||(this[cr].image.name=t&&t.image&&t.image.src?t.image.src.split("/").pop():"adhoc_image")}get name(){return this[cr].image.name||""}get uri(){return this[cr].image.src}get bufferView(){return this[cr].image.bufferView}get element(){const e=this[cr];if(e&&(e.isCanvasTexture||e.isVideoTexture))return e.image}get animation(){const e=this[cr];if(e&&e.isCanvasTexture&&e.animation)return e.animation}get type(){return null!=this.uri?"external":"embedded"}set name(e){for(const t of this[ur])t.image.name=e}update(){const e=this[cr];e&&e.isCanvasTexture&&!e.animation&&(this[cr].needsUpdate=!0,this[or]())}async createThumbnail(e,t){const s=new o.Z58;Ar.map=this[cr];const r=new o.eaF(lr,Ar);s.add(r);const A=new o.qUd(-1,1,1,-1,0,1),{threeRenderer:l}=Renderer.singleton,h=new o.nWS(e,t);l.setRenderTarget(h),l.render(s,A),l.setRenderTarget(null);const c=new Uint8Array(e*t*4);l.readRenderTargetPixels(h,0,0,e,t,c),ho.width=e,ho.height=t;const d=ho.getContext("2d"),g=d.createImageData(e,t);return g.data.set(c),d.putImageData(g,0,0),new Promise((async(e,t)=>{ho.toBlob((s=>{if(!s)return t("Failed to capture thumbnail.");e(URL.createObjectURL(s))}),"image/png")}))}}var dr,gr;!function(e){e[e.Nearest=9728]="Nearest",e[e.Linear=9729]="Linear",e[e.NearestMipmapNearest=9984]="NearestMipmapNearest",e[e.LinearMipmapNearest=9985]="LinearMipmapNearest",e[e.NearestMipmapLinear=9986]="NearestMipmapLinear",e[e.LinearMipmapLinear=9987]="LinearMipmapLinear"}(dr||(dr={})),function(e){e[e.ClampToEdge=33071]="ClampToEdge",e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.Repeat=10497]="Repeat"}(gr||(gr={}));const pr=new Map([[gr.Repeat,o.GJx],[gr.ClampToEdge,o.ghU],[gr.MirroredRepeat,o.kTW]]),mr=new Map([[o.GJx,gr.Repeat],[o.ghU,gr.ClampToEdge],[o.kTW,gr.MirroredRepeat]]),fr=new Map([[dr.Nearest,o.hxR],[dr.Linear,o.k6q],[dr.NearestMipmapNearest,o.pHI],[dr.LinearMipmapNearest,o.kRr],[dr.NearestMipmapLinear,o.Cfg],[dr.LinearMipmapLinear,o.$_I]]),Ir=new Map([[o.hxR,dr.Nearest],[o.k6q,dr.Linear],[o.pHI,dr.NearestMipmapNearest],[o.kRr,dr.LinearMipmapNearest],[o.Cfg,dr.NearestMipmapLinear],[o.$_I,dr.LinearMipmapLinear]]),Er=new Map([[dr.Nearest,o.hxR],[dr.Linear,o.k6q]]),Cr=new Map([[o.hxR,dr.Nearest],[o.k6q,dr.Linear]]),isMinFilter=e=>Ir.has(e),isMagFilter=e=>Cr.has(e),isWrapping=e=>mr.has(e),Br=Symbol("threeTexture"),yr=Symbol("threeTextures"),wr=Symbol("setProperty");class Sampler extends ThreeDOMElement{get[Br](){var e;return null===(e=this[ar])||void 0===e?void 0:e.values().next().value}get[yr](){return this[ar]}constructor(e,t){super(e,new Set(t?[t]:[]))}get name(){return this[Br].name||""}get minFilter(){return Ir.get(this[Br].minFilter)}get magFilter(){return Cr.get(this[Br].magFilter)}get wrapS(){return mr.get(this[Br].wrapS)}get wrapT(){return mr.get(this[Br].wrapT)}get rotation(){return this[Br].rotation}get scale(){return toVector2D(this[Br].repeat)}get offset(){return toVector2D(this[Br].offset)}setMinFilter(e){this[wr]("minFilter",fr.get(e))}setMagFilter(e){this[wr]("magFilter",Er.get(e))}setWrapS(e){this[wr]("wrapS",pr.get(e))}setWrapT(e){this[wr]("wrapT",pr.get(e))}setRotation(e){null==e&&(e=0),this[wr]("rotation",e)}setScale(e){null==e&&(e={u:1,v:1}),this[wr]("repeat",new o.I9Y(e.u,e.v))}setOffset(e){null==e&&(e={u:0,v:0}),this[wr]("offset",new o.I9Y(e.u,e.v))}[wr](e,t){if(((e,t)=>{switch(e){case"minFilter":return isMinFilter(t);case"magFilter":return isMagFilter(t);case"wrapS":case"wrapT":return isWrapping(t);case"rotation":case"repeat":case"offset":return!0;default:throw new Error(`Cannot configure property "${e}" on Sampler`)}})(e,t))for(const s of this[yr])s[e]=t,s.needsUpdate=!0;this[or]()}}const vr=Symbol("image"),Qr=Symbol("sampler"),xr=Symbol("threeTexture");class Texture extends ThreeDOMElement{constructor(e,t){super(e,new Set(t?[t]:[])),this[Qr]=new Sampler(e,t),this[vr]=new image_Image(e,t)}get[xr](){var e;return null===(e=this[ar])||void 0===e?void 0:e.values().next().value}get name(){return this[xr].name||""}set name(e){for(const t of this[ar])t.name=e}get sampler(){return this[Qr]}get source(){return this[vr]}}var br,Sr,Mr;const Tr=Symbol("texture"),Rr=Symbol("transform"),Dr=Symbol("materials"),Lr=Symbol("usage"),Fr=Symbol("onUpdate"),_r=Symbol("activeVideo");var kr;!function(e){e[e.Base=0]="Base",e[e.MetallicRoughness=1]="MetallicRoughness",e[e.Normal=2]="Normal",e[e.Occlusion=3]="Occlusion",e[e.Emissive=4]="Emissive",e[e.Clearcoat=5]="Clearcoat",e[e.ClearcoatRoughness=6]="ClearcoatRoughness",e[e.ClearcoatNormal=7]="ClearcoatNormal",e[e.SheenColor=8]="SheenColor",e[e.SheenRoughness=9]="SheenRoughness",e[e.Transmission=10]="Transmission",e[e.Thickness=11]="Thickness",e[e.Specular=12]="Specular",e[e.SpecularColor=13]="SpecularColor",e[e.Iridescence=14]="Iridescence",e[e.IridescenceThickness=15]="IridescenceThickness",e[e.Anisotropy=16]="Anisotropy"}(kr||(kr={}));class TextureInfo{constructor(e,t,s,r){this[br]=null,this[Sr]={rotation:0,scale:new o.I9Y(1,1),offset:new o.I9Y(0,0)},this[Mr]=!1,s&&(this[Rr].rotation=s.rotation,this[Rr].scale.copy(s.repeat),this[Rr].offset.copy(s.offset),this[Tr]=new Texture(e,s)),this[Fr]=e,this[Dr]=r,this[Lr]=t}get texture(){return this[Tr]}setTexture(e){var t,s;const r=null!=e?e.source[cr]:null,A=null===(t=this[Tr])||void 0===t?void 0:t.source[cr];if(null!=A&&A.isVideoTexture?this[_r]=!1:(null===(s=this[Tr])||void 0===s?void 0:s.source.animation)&&this[Tr].source.animation.removeEventListener("enterFrame",this[Fr]),this[Tr]=e,null!=r&&r.isVideoTexture){const e=r.image;if(this[_r]=!0,null!=e.requestVideoFrameCallback){const update=()=>{this[_r]&&(this[Fr](),e.requestVideoFrameCallback(update))};e.requestVideoFrameCallback(update)}else{const update=()=>{this[_r]&&(this[Fr](),requestAnimationFrame(update))};requestAnimationFrame(update)}}else null!=(null==e?void 0:e.source.animation)&&e.source.animation.addEventListener("enterFrame",this[Fr]);let l=o.er$;if(this[Dr])for(const e of this[Dr]){switch(this[Lr]){case kr.Base:e.map=r;break;case kr.MetallicRoughness:l=o.Zr2,e.metalnessMap=r,e.roughnessMap=r;break;case kr.Normal:l=o.Zr2,e.normalMap=r;break;case kr.Occlusion:l=o.Zr2,e.aoMap=r;break;case kr.Emissive:e.emissiveMap=r;break;case kr.Clearcoat:e.clearcoatMap=r;break;case kr.ClearcoatRoughness:e.clearcoatRoughnessMap=r;break;case kr.ClearcoatNormal:e.clearcoatNormalMap=r;break;case kr.SheenColor:e.sheenColorMap=r;break;case kr.SheenRoughness:e.sheenRoughnessMap=r;break;case kr.Transmission:e.transmissionMap=r;break;case kr.Thickness:e.thicknessMap=r;break;case kr.Specular:e.specularIntensityMap=r;break;case kr.SpecularColor:e.specularColorMap=r;break;case kr.Iridescence:e.iridescenceMap=r;break;case kr.IridescenceThickness:e.iridescenceThicknessMap=r;break;case kr.Anisotropy:e.anisotropyMap=r}e.needsUpdate=!0}r&&(r.colorSpace=l,r.rotation=this[Rr].rotation,r.repeat=this[Rr].scale,r.offset=this[Rr].offset),this[Fr]()}}br=Tr,Sr=Rr,Mr=_r;const Ur=Symbol("threeMaterial"),Gr=Symbol("threeMaterials"),Pr=Symbol("baseColorTexture"),Nr=Symbol("metallicRoughnessTexture");class PBRMetallicRoughness extends ThreeDOMElement{constructor(e,t){super(e,t);const{map:s,metalnessMap:r}=t.values().next().value;this[Pr]=new TextureInfo(e,kr.Base,s,t),this[Nr]=new TextureInfo(e,kr.MetallicRoughness,r,t)}get[Gr](){return this[ar]}get[Ur](){var e;return null===(e=this[ar])||void 0===e?void 0:e.values().next().value}get baseColorFactor(){const e=[0,0,0,this[Ur].opacity];return this[Ur].color.toArray(e),e}get metallicFactor(){return this[Ur].metalness}get roughnessFactor(){return this[Ur].roughness}get baseColorTexture(){return this[Pr]}get metallicRoughnessTexture(){return this[Nr]}setBaseColorFactor(e){const t=new o.Q1f;e instanceof Array?t.fromArray(e):t.set(e);for(const s of this[Gr])s.color.set(t),e instanceof Array?s.opacity=e[3]:(e=[0,0,0,s.opacity],t.toArray(e));this[or]()}setMetallicFactor(e){for(const t of this[Gr])t.metalness=e;this[or]()}setRoughnessFactor(e){for(const t of this[Gr])t.roughness=e;this[or]()}}var Or,Hr;const qr=Symbol("pbrMetallicRoughness"),Vr=Symbol("normalTexture"),$r=Symbol("occlusionTexture"),Jr=Symbol("emissiveTexture"),Kr=Symbol("backingThreeMaterial"),Yr=Symbol("applyAlphaCutoff"),zr=Symbol("getAlphaMode"),jr=Symbol("lazyLoadGLTFInfo"),Wr=Symbol("initialize"),Xr=Symbol("getLoadedMaterial"),Zr=Symbol("ensureMaterialIsLoaded"),ea=Symbol("gltfIndex"),ta=Symbol("setActive"),ia=Symbol("variantIndices"),sa=Symbol("isActive"),na=Symbol("variantSet"),ra=Symbol("modelVariants"),aa=Symbol("name"),oa=Symbol("pbrTextures");class Material extends ThreeDOMElement{constructor(e,t,s,r,o,A,l=void 0){super(e,o),this[Or]=new Set,this[Hr]=new Map,this[ea]=t,this[sa]=s,this[ra]=r,this[aa]=A,null==l?this[Wr]():this[jr]=l}get[(Or=na,Hr=oa,Kr)](){return this[ar].values().next().value}[Wr](){const e=this[or],t=this[ar];this[qr]=new PBRMetallicRoughness(e,t);const{normalMap:s,aoMap:r,emissiveMap:o}=t.values().next().value;this[Vr]=new TextureInfo(e,kr.Normal,s,t),this[$r]=new TextureInfo(e,kr.Occlusion,r,t),this[Jr]=new TextureInfo(e,kr.Emissive,o,t);const createTextureInfo=s=>{this[oa].set(s,new TextureInfo(e,s,null,t))};createTextureInfo(kr.Clearcoat),createTextureInfo(kr.ClearcoatRoughness),createTextureInfo(kr.ClearcoatNormal),createTextureInfo(kr.SheenColor),createTextureInfo(kr.SheenRoughness),createTextureInfo(kr.Transmission),createTextureInfo(kr.Thickness),createTextureInfo(kr.Specular),createTextureInfo(kr.SpecularColor),createTextureInfo(kr.Iridescence),createTextureInfo(kr.IridescenceThickness),createTextureInfo(kr.Anisotropy)}async[Xr](){if(null!=this[jr]){const{set:e,material:t}=await this[jr].doLazyLoad();return this[ar]=e,this[Wr](),this[jr]=void 0,this.ensureLoaded=async()=>{},t}return this[ar].values().next().value}colorFromRgb(e){const t=new o.Q1f;return e instanceof Array?t.fromArray(e):t.set(e),t}[Zr](){if(null!=this[jr])throw new Error(`Material "${this.name}" has not been loaded, call 'await\n myMaterial.ensureLoaded()' before using an unloaded material.`)}async ensureLoaded(){await this[Xr]()}get isLoaded(){return null==this[jr]}get isActive(){return this[sa]}[ta](e){this[sa]=e}get name(){return this[aa]||""}set name(e){if(this[aa]=e,null!=this[ar])for(const t of this[ar])t.name=e}get pbrMetallicRoughness(){return this[Zr](),this[qr]}get normalTexture(){return this[Zr](),this[Vr]}get occlusionTexture(){return this[Zr](),this[$r]}get emissiveTexture(){return this[Zr](),this[Jr]}get emissiveFactor(){return this[Zr](),this[Kr].emissive.toArray()}get index(){return this[ea]}[ia](){return this[na]}hasVariant(e){const t=this[ra].get(e);return null!=t&&this[na].has(t.index)}setEmissiveFactor(e){this[Zr]();const t=this.colorFromRgb(e);for(const e of this[ar])e.emissive.set(t);this[or]()}[zr](){return this[Kr].transparent?"BLEND":this[Kr].alphaTest>0?"MASK":"OPAQUE"}[Yr](){this[Zr]();for(const e of this[ar])"MASK"===this[zr]()?null==e.alphaTest&&(e.alphaTest=.5):e.alphaTest=void 0,e.needsUpdate=!0}setAlphaCutoff(e){this[Zr]();for(const t of this[ar])t.alphaTest=e,t.needsUpdate=!0;this[Yr](),this[or]()}getAlphaCutoff(){return this[Zr](),this[Kr].alphaTest}setDoubleSided(e){this[Zr]();for(const t of this[ar])t.side=e?o.$EB:o.hB5,t.needsUpdate=!0;this[or]()}getDoubleSided(){return this[Zr](),this[Kr].side==o.$EB}setAlphaMode(e){this[Zr]();const enableTransparency=(e,t)=>{e.transparent=t,e.depthWrite=!t};for(const t of this[ar])enableTransparency(t,"BLEND"===e),t.alphaTest="MASK"===e?.5:void 0,t.needsUpdate=!0;this[or]()}getAlphaMode(){return this[Zr](),this[zr]()}get emissiveStrength(){return this[Zr](),this[Kr].emissiveIntensity}setEmissiveStrength(e){this[Zr]();for(const t of this[ar])t.emissiveIntensity=e;this[or]()}get clearcoatFactor(){return this[Zr](),this[Kr].clearcoat}get clearcoatRoughnessFactor(){return this[Zr](),this[Kr].clearcoatRoughness}get clearcoatTexture(){return this[Zr](),this[oa].get(kr.Clearcoat)}get clearcoatRoughnessTexture(){return this[Zr](),this[oa].get(kr.ClearcoatRoughness)}get clearcoatNormalTexture(){return this[Zr](),this[oa].get(kr.ClearcoatNormal)}get clearcoatNormalScale(){return this[Zr](),this[Kr].clearcoatNormalScale.x}setClearcoatFactor(e){this[Zr]();for(const t of this[ar])t.clearcoat=e;this[or]()}setClearcoatRoughnessFactor(e){this[Zr]();for(const t of this[ar])t.clearcoatRoughness=e;this[or]()}setClearcoatNormalScale(e){this[Zr]();for(const t of this[ar])t.clearcoatNormalScale=new o.I9Y(e,e);this[or]()}get ior(){return this[Zr](),this[Kr].ior}setIor(e){this[Zr]();for(const t of this[ar])t.ior=e;this[or]()}get sheenColorFactor(){return this[Zr](),this[Kr].sheenColor.toArray()}get sheenColorTexture(){return this[Zr](),this[oa].get(kr.SheenColor)}get sheenRoughnessFactor(){return this[Zr](),this[Kr].sheenRoughness}get sheenRoughnessTexture(){return this[Zr](),this[oa].get(kr.SheenRoughness)}setSheenColorFactor(e){this[Zr]();const t=this.colorFromRgb(e);for(const e of this[ar])e.sheenColor.set(t),e.sheen=1;this[or]()}setSheenRoughnessFactor(e){this[Zr]();for(const t of this[ar])t.sheenRoughness=e,t.sheen=1;this[or]()}get transmissionFactor(){return this[Zr](),this[Kr].transmission}get transmissionTexture(){return this[Zr](),this[oa].get(kr.Transmission)}setTransmissionFactor(e){this[Zr]();for(const t of this[ar])t.transmission=e;this[or]()}get thicknessFactor(){return this[Zr](),this[Kr].thickness}get thicknessTexture(){return this[Zr](),this[oa].get(kr.Thickness)}get attenuationDistance(){return this[Zr](),this[Kr].attenuationDistance}get attenuationColor(){return this[Zr](),this[Kr].attenuationColor.toArray()}setThicknessFactor(e){this[Zr]();for(const t of this[ar])t.thickness=e;this[or]()}setAttenuationDistance(e){this[Zr]();for(const t of this[ar])t.attenuationDistance=e;this[or]()}setAttenuationColor(e){this[Zr]();const t=this.colorFromRgb(e);for(const e of this[ar])e.attenuationColor.set(t);this[or]()}get specularFactor(){return this[Zr](),this[Kr].specularIntensity}get specularTexture(){return this[Zr](),this[oa].get(kr.Specular)}get specularColorFactor(){return this[Zr](),this[Kr].specularColor.toArray()}get specularColorTexture(){return this[Zr](),this[oa].get(kr.SheenColor)}setSpecularFactor(e){this[Zr]();for(const t of this[ar])t.specularIntensity=e;this[or]()}setSpecularColorFactor(e){this[Zr]();const t=this.colorFromRgb(e);for(const e of this[ar])e.specularColor.set(t);this[or]()}get iridescenceFactor(){return this[Zr](),this[Kr].iridescence}get iridescenceTexture(){return this[Zr](),this[oa].get(kr.Iridescence)}get iridescenceIor(){return this[Zr](),this[Kr].iridescenceIOR}get iridescenceThicknessMinimum(){return this[Zr](),this[Kr].iridescenceThicknessRange[0]}get iridescenceThicknessMaximum(){return this[Zr](),this[Kr].iridescenceThicknessRange[1]}get iridescenceThicknessTexture(){return this[Zr](),this[oa].get(kr.IridescenceThickness)}setIridescenceFactor(e){this[Zr]();for(const t of this[ar])t.iridescence=e;this[or]()}setIridescenceIor(e){this[Zr]();for(const t of this[ar])t.iridescenceIOR=e;this[or]()}setIridescenceThicknessMinimum(e){this[Zr]();for(const t of this[ar])t.iridescenceThicknessRange[0]=e;this[or]()}setIridescenceThicknessMaximum(e){this[Zr]();for(const t of this[ar])t.iridescenceThicknessRange[1]=e;this[or]()}get anisotropyStrength(){return this[Zr](),this[Kr].anisotropy}get anisotropyRotation(){return this[Zr](),this[Kr].anisotropyRotation}get anisotropyTexture(){return this[Zr](),this[oa].get(kr.Anisotropy)}setAnisotropyStrength(e){this[Zr]();for(const t of this[ar])t.anisotropy=e;this[or]()}setAnisotropyRotation(e){this[Zr]();for(const t of this[ar])t.anisotropyRotation=e;this[or]()}}var Aa=s(96763);class primitive_node_Node{constructor(e){this.name="",this.children=new Array,this.name=e}}class PrimitiveNode extends primitive_node_Node{constructor(e,t,s,r){super(e.name),this.materials=new Map,this.variantToMaterialMap=new Map,this.initialMaterialIdx=0,this.activeMaterialIdx=0,this.mesh=e;const{gltf:o,threeGLTF:A,threeObjectMap:l}=r;this.parser=A.parser,this.modelVariants=s,this.mesh.userData.variantData=s;const h=l.get(e.material);null!=h.materials?this.initialMaterialIdx=this.activeMaterialIdx=h.materials:Aa.error(`Primitive (${e.name}) missing initial material reference.`);const c=e.userData.associations||{};if(null==c.meshes)return void Aa.error("Mesh is missing primitive index association");const d=((o.meshes||[])[c.meshes].primitives||[])[c.primitives];if(null!=d){if(null!=d.material)this.materials.set(d.material,t[d.material]);else{const e=t.findIndex((e=>"Default"===e.name));e>=0?this.materials.set(e,t[e]):Aa.warn("gltfPrimitive has no material!")}if(d.extensions&&d.extensions.KHR_materials_variants){const e=d.extensions.KHR_materials_variants,r=A.parser.json.extensions.KHR_materials_variants.variants;for(const o of e.mappings){const e=t[o.material];this.materials.set(o.material,e);for(const t of o.variants){const{name:o}=r[t];this.variantToMaterialMap.set(t,e),e[ia]().add(t),s.has(o)||s.set(o,{name:o,index:t})}}}}else Aa.error("Mesh primitive definition is missing.")}async setActiveMaterial(e){const t=this.materials.get(e);if(null!=t&&e!==this.activeMaterialIdx){this.mesh.material=await t[Xr]();const{normalScale:s}=this.mesh.material;null!=s&&s.y*s.x<0!=(null==this.mesh.geometry.attributes.tangent)&&this.parser.assignFinalMaterial(this.mesh),this.activeMaterialIdx=e}return this.mesh.material}getActiveMaterial(){return this.materials.get(this.activeMaterialIdx)}getMaterial(e){return this.materials.get(e)}async enableVariant(e){if(null==e)return this.setActiveMaterial(this.initialMaterialIdx);if(null!=this.variantToMaterialMap&&this.modelVariants.has(e)){const t=this.modelVariants.get(e);return this.enableVariantHelper(t.index)}return null}async enableVariantHelper(e){if(null!=this.variantToMaterialMap&&null!=e){const t=this.variantToMaterialMap.get(e);if(null!=t)return this.setActiveMaterial(t.index)}return null}async instantiateVariants(){if(null!=this.variantToMaterialMap)for(const e of this.variantToMaterialMap.keys()){const t=this.mesh.userData.variantMaterials.get(e);if(null!=t.material)continue;const s=await this.enableVariantHelper(e);null!=s&&(t.material=s)}}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 s=this.modelVariants.get(t).index;return e[ia]().add(s),this.variantToMaterialMap.set(s,e),this.materials.set(e.index,e),this.updateVariantUserData(s,e),!0}deleteVariant(e){if(this.variantInfo.has(e)){this.variantInfo.delete(e);const t=this.mesh.userData.variantMaterials;null!=t&&t.delete(e)}}updateVariantUserData(e,t){t[ia]().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[ar].values().next().value,gltfMaterialIndex:t.index})}ensureVariantIsUnused(e){const t=this.modelVariants.get(e);return null==t||!this.variantInfo.has(t.index)||(Aa.warn(`Primitive cannot add variant '${e}' for this material, it already exists.`),!1)}}var la,ha,ca,ua,da,ga,pa=s(96763);const ma=Symbol("materials"),fa=Symbol("hierarchy"),Ia=Symbol("roots"),Ea=Symbol("primitives"),Ca=(Symbol("loadVariant"),Symbol("prepareVariantsForExport")),Ba=Symbol("switchVariant"),ya=Symbol("materialFromPoint"),wa=Symbol("nodeFromPoint"),va=Symbol("nodeFromIndex"),Qa=Symbol("variantData"),xa=Symbol("availableVariants"),ba=Symbol("modelOnUpdate"),Sa=Symbol("cloneMaterial");class LazyLoader{constructor(e,t,s,r){this.gltf=e,this.gltfElementMap=t,this.mapKey=s,this.doLazyLoad=r}}class Model{constructor(e,t=()=>{}){this[la]=new Array,this[ha]=new Array,this[ca]=new Array,this[ua]=new Array,this[da]=()=>{},this[ga]=new Map,this[ba]=t;const{gltf:s,threeGLTF:r,gltfElementMap:A}=e;for(const[e,o]of s.materials.entries()){const l=A.get(o);if(null!=l)this[ma].push(new Material(t,e,!0,this[Qa],l,o.name));else{const h=(s.materials||[])[e],c=e,materialLoadCallback=async()=>{const e=await r.parser.getDependency("material",c),t=new Set;return A.set(h,t),t.add(e),{set:t,material:e}};this[ma].push(new Material(t,e,!1,this[Qa],l,o.name,new LazyLoader(s,A,h,materialLoadCallback)))}}const l=new Map,h=new Array;for(const e of r.scene.children)h.push(e);for(;h.length>0;){const t=h.pop();let s=null;t instanceof o.eaF?(s=new PrimitiveNode(t,this.materials,this[Qa],e),this[Ea].push(s)):s=new primitive_node_Node(t.name);const r=l.get(t);null!=r?r.children.push(s):this[Ia].push(s),this[fa].push(s);for(const e of t.children)h.push(e),l.set(t,s)}}get materials(){return this[ma]}[(la=ma,ha=fa,ca=Ia,ua=Ea,da=ba,ga=Qa,xa)](){const e=Array.from(this[Qa].values());return e.sort(((e,t)=>e.index-t.index)),e.map((e=>e.name))}getMaterialByName(e){const t=this[ma].filter((t=>t.name===e));return t.length>0?t[0]:null}[va](e,t){const s=this[fa].find((s=>{if(s instanceof PrimitiveNode){const{meshes:r,primitives:o}=s.mesh.userData.associations;if(r==e&&o==t)return!0}return!1}));return null==s?null:s}[wa](e){return this[fa].find((t=>{if(t instanceof PrimitiveNode){if(t.mesh===e.object)return!0}return!1}))}[ya](e){return this[wa](e).getActiveMaterial()}async[Ba](e){for(const t of this[Ea])await t.enableVariant(e);for(const e of this.materials)e[ta](!1);for(const e of this[Ea])this.materials[e.getActiveMaterial().index][ta](!0)}async[Ca](){const e=new Array;for(const t of this[Ea])e.push(t.instantiateVariants());await Promise.all(e)}[Sa](e,t){const s=this.materials[e];s.isLoaded||pa.error("Cloning an unloaded material,\n call 'material.ensureLoaded() before cloning the material.");const r=s[ar],o=new Set;for(const[e,s]of r.entries()){const A=s.clone();A.name=t+(r.size>1?"_inst"+e:""),o.add(A)}const A=new Material(this[ba],this[ma].length,!1,this[Qa],o,t);return this[ma].push(A),A}createMaterialInstanceForVariant(e,t,s,r=!0){let o=null;for(const r of this[Ea]){const A=this[Qa].get(s);null!=A&&r.variantInfo.has(A.index)||null!=r.getMaterial(e)&&(this.hasVariant(s)||this.createVariant(s),null==o&&(o=this[Sa](e,t)),r.addVariant(o,s))}if(r&&null!=o){o[ta](!0),this.materials[e][ta](!1);for(const e of this[Ea])e.enableVariant(s)}return o}createVariant(e){this[Qa].has(e)?pa.warn(`Variant '${e}'' already exists`):this[Qa].set(e,{name:e,index:this[Qa].size})}hasVariant(e){return this[Qa].has(e)}setMaterialToVariant(e,t){if(null!=this[xa]().find((e=>e===t)))if(e<0||e>=this.materials.length)pa.error("setMaterialToVariant(): materialIndex is out of bounds.");else for(const s of this[Ea]){const r=s.getMaterial(e);null!=r&&s.addVariant(r,t)}else pa.warn(`Can't add material to '${t}', the variant does not exist.'`)}updateVariantName(e,t){const s=this[Qa].get(e);null!=s&&(s.name=t,this[Qa].set(t,s),this[Qa].delete(e))}deleteVariant(e){const t=this[Qa].get(e);if(null!=t){for(const s of this.materials)s.hasVariant(e)&&s[na].delete(t.index);for(const e of this[Ea])e.deleteVariant(t.index);this[Qa].delete(e)}}}var scene_graph_decorate=function(e,t,s,r){var o,A=arguments.length,l=A<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,s,r);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(l=(A<3?o(l):A>3?o(t,s,l):o(t,s))||l);return A>3&&l&&Object.defineProperty(t,s,l),l};const Ma=Symbol("currentGLTF"),Ta=Symbol("originalGltfJson"),Ra=Symbol("model"),Da=Symbol("getOnUpdateMethod"),La=Symbol("buildTexture");class GroundedSkybox extends o.eaF{constructor(){super(void 0,new o.V9B({depthWrite:!1})),this.height=0,this.radius=0,this.resolution=0,this.userData.noHit=!0}get map(){return this.material.map}set map(e){this.material.map=e}isUsable(){return this.height>0&&this.radius>0&&null!=this.geometry&&null!=this.map}updateGeometry(e=this.height,t=this.radius,s=128){e==this.height&&t==this.radius&&s==this.resolution||(this.height=e,this.radius=t,this.resolution=s,e>0&&t>0&&(this.geometry.dispose(),this.geometry=function makeGeometry(e,t,s){const r=new o.Gu$(t,2*s,s);r.scale(1,1,-1);const A=r.getAttribute("position"),l=new o.Pq0;for(let t=0;t<A.count;++t)if(l.fromBufferAttribute(A,t),l.y<0){const s=3*-e/2,r=l.y<s?-e/l.y:1-l.y*l.y/(3*s*s);l.multiplyScalar(r),l.toArray(A.array,3*t)}return A.needsUpdate=!0,r}(e,t,s)))}}const Fa=new o.Pq0,_a=new o.Pq0,ka=new o.Pq0,Ua=new o.dwI,Ga=new o.lMl,Pa=new o.PTz;class Hotspot extends CSS2DObject{constructor(e){super(document.createElement("div")),this.normal=new o.Pq0(0,1,0),this.initialized=!1,this.referenceCount=1,this.pivot=document.createElement("div"),this.slot=document.createElement("slot"),this.element.classList.add("annotation-wrapper"),this.slot.name=e.name,this.element.appendChild(this.pivot),this.pivot.appendChild(this.slot),this.updatePosition(e.position),this.updateNormal(e.normal),this.surface=e.surface}get facingCamera(){return!this.element.classList.contains("hide")}show(){this.facingCamera&&this.initialized||this.updateVisibility(!0)}hide(){!this.facingCamera&&this.initialized||this.updateVisibility(!1)}increment(){this.referenceCount++}decrement(){return this.referenceCount>0&&--this.referenceCount,0===this.referenceCount}updatePosition(e){if(null==e)return;const t=Ki(e)[0].terms;for(let e=0;e<3;++e)this.position.setComponent(e,es(t[e]).number);this.updateMatrixWorld()}updateNormal(e){if(null==e)return;const t=Ki(e)[0].terms;for(let e=0;e<3;++e)this.normal.setComponent(e,t[e].number)}updateSurface(e){if(!e&&this.initialized)return;const{mesh:t,tri:s,bary:r}=this;if(null==t||null==s||null==r)return;t.getVertexPosition(s.x,Fa),t.getVertexPosition(s.y,_a),t.getVertexPosition(s.z,ka),Fa.toArray(Ua.elements,0),_a.toArray(Ua.elements,3),ka.toArray(Ua.elements,6),this.position.copy(r).applyMatrix3(Ua);const o=this.parent;o.worldToLocal(t.localToWorld(this.position)),Ga.set(Fa,_a,ka),Ga.getNormal(this.normal).transformDirection(t.matrixWorld);const A=o.parent;Pa.setFromAxisAngle(Fa.set(0,1,0),-A.yaw),this.normal.applyQuaternion(Pa)}orient(e){this.pivot.style.transform=`rotate(${e}rad)`}updateVisibility(e){this.element.classList.toggle("hide",!e),this.slot.assignedNodes().forEach((t=>{if(t.nodeType!==Node.ELEMENT_NODE)return;const s=t,r=s.dataset.visibilityAttribute;if(null!=r){const t=`data-${r}`;s.toggleAttribute(t,e)}s.dispatchEvent(new CustomEvent("hotspot-visibility",{detail:{visible:e}}))})),this.initialized=!0}}const Na={name:"HorizontalBlurShader",uniforms:{tDiffuse:{value:null},h:{value:1/512}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float h;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 sum = vec4( 0.0 );\n\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;\n\n\t\t\tgl_FragColor = sum;\n\n\t\t}"},Oa={name:"VerticalBlurShader",uniforms:{tDiffuse:{value:null},v:{value:1/512}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float v;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 sum = vec4( 0.0 );\n\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;\n\n\t\t\tgl_FragColor = sum;\n\n\t\t}"};var Ha=s(51163);class Shadow extends o.B69{constructor(e,t,s){super(),this.camera=new o.qUd,this.renderTarget=null,this.renderTargetBlur=null,this.depthMaterial=new o.CSG,this.horizontalBlurMaterial=new o.BKk(Na),this.verticalBlurMaterial=new o.BKk(Oa),this.intensity=0,this.softness=1,this.boundingBox=new o.NRn,this.size=new o.Pq0,this.maxDimension=0,this.isAnimated=!1,this.needsUpdate=!1;const{camera:r}=this;r.rotation.x=Math.PI/2,r.left=-.5,r.right=.5,r.bottom=-.5,r.top=.5,this.add(r);const A=new o.bdM,l=new o.V9B({opacity:1,transparent:!0,side:o.hsX});this.floor=new o.eaF(A,l),this.floor.userData.noHit=!0,r.add(this.floor),this.blurPlane=new o.eaF(A),this.blurPlane.visible=!1,r.add(this.blurPlane),e.target.add(this),this.depthMaterial.onBeforeCompile=function(e){e.fragmentShader=e.fragmentShader.replace("gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );","gl_FragColor = vec4( vec3( 0.0 ), ( 1.0 - fragCoordZ ) * opacity );")},this.horizontalBlurMaterial.depthTest=!1,this.verticalBlurMaterial.depthTest=!1,this.setScene(e,t,s)}setScene(e,t,s){const{boundingBox:r,size:o,rotation:A,position:l}=this;if(this.isAnimated=e.animationNames.length>0,this.boundingBox.copy(e.boundingBox),this.size.copy(e.size),this.maxDimension=Math.max(o.x,o.y,o.z)*(this.isAnimated?2:1),this.boundingBox.getCenter(l),"back"===s){const{min:e,max:t}=r;[e.y,e.z]=[e.z,e.y],[t.y,t.z]=[t.z,t.y],[o.y,o.z]=[o.z,o.y],A.x=Math.PI/2,A.y=Math.PI}else A.x=0,A.y=0;if(this.isAnimated){const e=r.min.y,t=r.max.y;o.y=this.maxDimension,r.expandByVector(o.subScalar(this.maxDimension).multiplyScalar(-.5)),r.min.y=e,r.max.y=t,o.set(this.maxDimension,t-e,this.maxDimension)}"bottom"===s?l.y=r.min.y:l.z=r.min.y,this.setSoftness(t)}setSoftness(e){this.softness=e;const{size:t,camera:s}=this,r=this.isAnimated?2:1,o=r*Math.pow(2,9-3*e);this.setMapSize(o);const A=t.y/2,l=t.y*r;s.near=0,s.far=(0,Ha.Cc)(l,A,e),this.depthMaterial.opacity=1/e,s.updateProjectionMatrix(),this.setIntensity(this.intensity),this.setOffset(0)}setMapSize(e){const{size:t}=this;this.isAnimated&&(e*=2);const s=Math.floor(t.x>t.z?e:e*t.x/t.z),r=Math.floor(t.x>t.z?e*t.z/t.x:e),A=10+s,l=10+r;if(null==this.renderTarget||this.renderTarget.width===A&&this.renderTarget.height===l||(this.renderTarget.dispose(),this.renderTarget=null,this.renderTargetBlur.dispose(),this.renderTargetBlur=null),null==this.renderTarget){const e={format:o.GWd};this.renderTarget=new o.nWS(A,l,e),this.renderTargetBlur=new o.nWS(A,l,e),this.floor.material.map=this.renderTarget.texture}this.camera.scale.set(t.x*(1+10/s),t.z*(1+10/r),1),this.needsUpdate=!0}setIntensity(e){this.intensity=e,e>0?(this.visible=!0,this.floor.visible=!0,this.floor.material.opacity=e*(0,Ha.Cc)(.3,1,this.softness*this.softness)):(this.visible=!1,this.floor.visible=!1)}getIntensity(){return this.intensity}setOffset(e){this.floor.position.z=-e+this.gap()}gap(){return.001*this.maxDimension}render(e,t){t.overrideMaterial=this.depthMaterial;const s=e.getClearAlpha();e.setClearAlpha(0),this.floor.visible=!1;const r=e.xr.enabled;e.xr.enabled=!1;const o=e.getRenderTarget();e.setRenderTarget(this.renderTarget),e.render(t,this.camera),t.overrideMaterial=null,this.floor.visible=!0,this.blurShadow(e),e.xr.enabled=r,e.setRenderTarget(o),e.setClearAlpha(s)}blurShadow(e){const{camera:t,horizontalBlurMaterial:s,verticalBlurMaterial:r,renderTarget:o,renderTargetBlur:A,blurPlane:l}=this;l.visible=!0,l.material=s,s.uniforms.h.value=1/this.renderTarget.width,s.uniforms.tDiffuse.value=this.renderTarget.texture,e.setRenderTarget(A),e.render(l,t),l.material=r,r.uniforms.v.value=1/this.renderTarget.height,r.uniforms.tDiffuse.value=this.renderTargetBlur.texture,e.setRenderTarget(o),e.render(l,t),l.visible=!1}dispose(){null!=this.renderTarget&&this.renderTarget.dispose(),null!=this.renderTargetBlur&&this.renderTargetBlur.dispose(),this.depthMaterial.dispose(),this.horizontalBlurMaterial.dispose(),this.verticalBlurMaterial.dispose(),this.floor.material.dispose(),this.floor.geometry.dispose(),this.blurPlane.geometry.dispose(),this.removeFromParent()}}var qa=s(96763);const Va=new o.Pq0,$a=new o.Pq0,Ja=new o.Pq0,Ka=new o.tBo,Ya=new o.Pq0,za=new o.I9Y;class ModelScene extends o.Z58{constructor({canvas:e,element:t,width:s,height:r}){super(),this.annotationRenderer=new CSS2DRenderer,this.effectRenderer=null,this.schemaElement=document.createElement("script"),this.width=1,this.height=1,this.aspect=1,this.scaleStep=0,this.renderCount=0,this.externalRenderer=null,this.camera=new o.ubm(45,1,.1,100),this.xrCamera=null,this.url=null,this.target=new o.B69,this.animationNames=[],this.boundingBox=new o.NRn,this.boundingSphere=new o.iyt,this.size=new o.Pq0,this.idealAspect=0,this.framedFoVDeg=0,this.shadow=null,this.shadowIntensity=0,this.shadowSoftness=1,this.bakedShadows=new Set,this.exposure=1,this.toneMapping=o.FV,this.canScale=!0,this.isDirty=!1,this.goalTarget=new o.Pq0,this.targetDamperX=new Damper,this.targetDamperY=new Damper,this.targetDamperZ=new Damper,this._currentGLTF=null,this._model=null,this.cancelPendingSourceChange=null,this.animationsByName=new Map,this.currentAnimationAction=null,this.groundedSkybox=new GroundedSkybox,this.name="ModelScene",this.element=t,this.canvas=e,this.camera=new o.ubm(45,1,.1,100),this.camera.name="MainCamera",this.add(this.target),this.setSize(s,r),this.target.name="Target",this.mixer=new o.Iw4(this.target);const{domElement:A}=this.annotationRenderer,{style:l}=A;l.display="none",l.pointerEvents="none",l.position="absolute",l.top="0",this.element.shadowRoot.querySelector(".default").appendChild(A),this.schemaElement.setAttribute("type","application/ld+json")}get context(){return this.canvas.getContext("2d")}getCamera(){return null!=this.xrCamera?this.xrCamera:this.camera}queueRender(){this.isDirty=!0}shouldRender(){return this.isDirty}hasRendered(){this.isDirty=!1}forceRescale(){this.scaleStep=-1,this.queueRender()}async setObject(e){this.reset(),this._model=e,this.target.add(e),await this.setupScene()}async setSource(e,t=()=>{}){if(!e||e===this.url)return void t(1);if(this.reset(),this.url=e,null!=this.externalRenderer){const e=await this.externalRenderer.load(t);return this.boundingSphere.radius=e.framedRadius,void(this.idealAspect=e.fieldOfViewAspect)}let s;null!=this.cancelPendingSourceChange&&(this.cancelPendingSourceChange(),this.cancelPendingSourceChange=null);try{s=await new Promise((async(s,r)=>{this.cancelPendingSourceChange=()=>r();try{s(await this.element[No].loader.load(e,this.element,t))}catch(e){r(e)}}))}catch(e){if(null==e)return;throw e}this.cancelPendingSourceChange=null,this.reset(),this.url=e,this._currentGLTF=s,null!=s&&(this._model=s.scene,this.target.add(s.scene));const{animations:r}=s,o=new Map,A=[];for(const e of r)o.set(e.name,e),A.push(e.name);this.animations=r,this.animationsByName=o,this.animationNames=A,await this.setupScene()}async setupScene(){this.applyTransform(),this.updateBoundingBox(),await this.updateFraming(),this.updateShadow(),this.setShadowIntensity(this.shadowIntensity),this.setGroundedSkybox()}reset(){this.url=null,this.renderCount=0,this.queueRender(),null!=this.shadow&&this.shadow.setIntensity(0),this.bakedShadows.clear();const{_model:e}=this;null!=e&&(e.removeFromParent(),this._model=null);const t=this._currentGLTF;null!=t&&(t.dispose(),this._currentGLTF=null),null!=this.currentAnimationAction&&(this.currentAnimationAction.stop(),this.currentAnimationAction=null),this.mixer.stopAllAction(),this.mixer.uncacheRoot(this)}dispose(){this.reset(),null!=this.shadow&&(this.shadow.dispose(),this.shadow=null),this.element[Ma]=null,this.element[Ta]=null,this.element[Ra]=null}get currentGLTF(){return this._currentGLTF}setSize(e,t){if(this.width!==e||this.height!==t){if(this.width=Math.max(e,1),this.height=Math.max(t,1),this.annotationRenderer.setSize(e,t),this.aspect=this.width/this.height,null!=this.externalRenderer){const s=De();this.externalRenderer.resize(e*s,t*s)}this.queueRender()}}markBakedShadow(e){e.userData.noHit=!0,this.bakedShadows.add(e)}unmarkBakedShadow(e){e.userData.noHit=!1,e.visible=!0,this.bakedShadows.delete(e),this.boundingBox.expandByObject(e)}findBakedShadows(e){const t=new o.NRn;e.traverse((e=>{const s=e;if(!s.material)return;if(!s.material.transparent)return;t.setFromObject(s);const r=t.getSize(Ya),o=Math.min(r.x,r.y,r.z);Math.max(r.x,r.y,r.z)<100*o||this.markBakedShadow(s)}))}checkBakedShadows(){const{min:e,max:t}=this.boundingBox,s=new o.NRn;this.boundingBox.getSize(this.size);for(const r of this.bakedShadows)s.setFromObject(r),s.min.y<e.y+this.size.y/100&&s.min.x<=e.x&&s.max.x>=t.x&&s.min.z<=e.z&&s.max.z>=t.z||s.min.z<e.z+this.size.z/100&&s.min.x<=e.x&&s.max.x>=t.x&&s.min.y<=e.y&&s.max.y>=t.y||this.unmarkBakedShadow(r)}applyTransform(){const{model:e}=this;if(null==e)return;const t=Ki(this.element.orientation)[0].terms,s=es(t[0]).number,r=es(t[1]).number,A=es(t[2]).number;e.quaternion.setFromEuler(new o.O9p(r,A,s,"YXZ"));const l=Ki(this.element.scale)[0].terms;e.scale.set(l[0].number,l[1].number,l[2].number)}updateBoundingBox(){const{model:e}=this;if(null==e)return;this.target.remove(e),this.findBakedShadows(e);const bound=(e,t)=>e.expandByPoint(t);this.setBakedShadowVisibility(!1),this.boundingBox=reduceVertices(e,bound,new o.NRn),this.boundingBox.isEmpty()&&(this.setBakedShadowVisibility(!0),this.bakedShadows.forEach((e=>this.unmarkBakedShadow(e))),this.boundingBox=reduceVertices(e,bound,new o.NRn)),this.checkBakedShadows(),this.setBakedShadowVisibility(),this.boundingBox.getSize(this.size),this.target.add(e)}async updateFraming(){const{model:e}=this;if(null==e)return;this.target.remove(e),this.setBakedShadowVisibility(!1);const{center:t}=this.boundingSphere;this.element.requestUpdate("cameraTarget"),await this.element.updateComplete,t.copy(this.getTarget());this.boundingSphere.radius=Math.sqrt(reduceVertices(e,((e,s)=>Math.max(e,t.distanceToSquared(s))),0));this.idealAspect=reduceVertices(e,((e,s)=>{s.sub(t);const r=Math.sqrt(s.x*s.x+s.z*s.z);return Math.max(e,r/(this.idealCameraDistance()-Math.abs(s.y)))}),0)/Math.tan(this.framedFoVDeg/2*Math.PI/180),this.setBakedShadowVisibility(),this.target.add(e)}setBakedShadowVisibility(e=this.shadowIntensity<=0){for(const t of this.bakedShadows)t.visible=e}idealCameraDistance(){const e=this.framedFoVDeg/2*Math.PI/180;return this.boundingSphere.radius/Math.sin(e)}adjustedFoV(e){const t=Math.tan(e/2*Math.PI/180)*Math.max(1,this.idealAspect/this.aspect);return 2*Math.atan(t)*180/Math.PI}getNDC(e,t){if(null!=this.xrCamera)za.set(e/window.screen.width,t/window.screen.height);else{const s=this.element.getBoundingClientRect();za.set((e-s.x)/this.width,(t-s.y)/this.height)}return za.multiplyScalar(2).subScalar(1),za.y*=-1,za}getSize(){return{width:this.width,height:this.height}}setEnvironmentAndSkybox(e,t){this.element[No].arRenderer.presentedScene!==this&&(this.environment=e,this.setBackground(t),this.queueRender())}setBackground(e){this.groundedSkybox.map=e,this.groundedSkybox.isUsable()?(this.target.add(this.groundedSkybox),this.background=null):(this.target.remove(this.groundedSkybox),this.background=e)}farRadius(){return this.boundingSphere.radius*(null!=this.groundedSkybox.parent?10:1)}setGroundedSkybox(){const e=Ki(this.element.skyboxHeight)[0].terms[0],t=es(e).number,s=10*this.boundingSphere.radius;this.groundedSkybox.updateGeometry(t,s),this.groundedSkybox.position.y=t-(this.shadow?2*this.shadow.gap():0),this.setBackground(this.groundedSkybox.map)}setTarget(e,t,s){this.goalTarget.set(-e,-t,-s)}setTargetDamperDecayTime(e){this.targetDamperX.setDecayTime(e),this.targetDamperY.setDecayTime(e),this.targetDamperZ.setDecayTime(e)}getTarget(){return this.goalTarget.clone().multiplyScalar(-1)}jumpToGoal(){this.updateTarget(1e4)}updateTarget(e){const t=this.goalTarget,s=this.target.position;if(t.equals(s))return!1;{const r=this.boundingSphere.radius/10;let{x:o,y:A,z:l}=s;return o=this.targetDamperX.update(o,t.x,e,r),A=this.targetDamperY.update(A,t.y,e,r),l=this.targetDamperZ.update(l,t.z,e,r),this.target.position.set(o,A,l),this.target.updateMatrixWorld(),this.queueRender(),!0}}pointTowards(e,t){const{x:s,z:r}=this.position;this.yaw=Math.atan2(e-s,t-r)}get model(){return this._model}set yaw(e){this.rotation.y=e,this.queueRender()}get yaw(){return this.rotation.y}set animationTime(e){this.mixer.setTime(e),this.queueShadowRender()}get animationTime(){if(null!=this.currentAnimationAction){const e=Math.max(this.currentAnimationAction._loopCount,0);return this.currentAnimationAction.loop!==o.lc7||1&~e?this.currentAnimationAction.time:this.duration-this.currentAnimationAction.time}return 0}set animationTimeScale(e){this.mixer.timeScale=e}get animationTimeScale(){return this.mixer.timeScale}get duration(){return null!=this.currentAnimationAction&&this.currentAnimationAction.getClip()?this.currentAnimationAction.getClip().duration:0}get hasActiveAnimation(){return null!=this.currentAnimationAction}playAnimation(e=null,t=0,s=o.aMy,r=1/0){if(null==this._currentGLTF)return;const{animations:A}=this;if(null==A||0===A.length)return;let l=null;if(null!=e&&(l=this.animationsByName.get(e),null==l)){const t=parseInt(e);!isNaN(t)&&t>=0&&t<A.length&&(l=A[t])}null==l&&(l=A[0]);try{const{currentAnimationAction:e}=this,o=this.mixer.clipAction(l,this);this.currentAnimationAction=o,this.element.paused?this.mixer.stopAllAction():(o.paused=!1,null!=e&&o!==e?o.crossFadeFrom(e,t,!1):this.animationTimeScale>0&&this.animationTime==this.duration&&(this.animationTime=0)),o.setLoop(s,r),o.enabled=!0,o.clampWhenFinished=!0,o.play()}catch(e){qa.error(e)}}stopAnimation(){this.currentAnimationAction=null,this.mixer.stopAllAction()}updateAnimation(e){this.mixer.update(e),this.queueShadowRender()}subscribeMixerEvent(e,t){this.mixer.addEventListener(e,t)}updateShadow(){const e=this.shadow;if(null!=e){const t="wall"===this.element.arPlacement?"back":"bottom";e.setScene(this,this.shadowSoftness,t),e.needsUpdate=!0}}renderShadow(e){const t=this.shadow;null!=t&&1==t.needsUpdate&&(t.render(e,this),t.needsUpdate=!1)}queueShadowRender(){null!=this.shadow&&(this.shadow.needsUpdate=!0)}setShadowIntensity(e){if(this.shadowIntensity=e,null!=this._currentGLTF&&(this.setBakedShadowVisibility(),!(e<=0&&null==this.shadow))){if(null==this.shadow){const e="wall"===this.element.arPlacement?"back":"bottom";this.shadow=new Shadow(this,this.shadowSoftness,e)}this.shadow.setIntensity(e)}}setShadowSoftness(e){this.shadowSoftness=e;const t=this.shadow;null!=t&&t.setSoftness(e)}setShadowOffset(e){const t=this.shadow;null!=t&&t.setOffset(e)}hitFromPoint(e,t=this){Ka.setFromCamera(e,this.getCamera());return Ka.intersectObject(t,!0).find((e=>e.object.visible&&!e.object.userData.noHit))}positionAndNormalFromPoint(e,t=this){var s;const r=this.hitFromPoint(e,t);if(null==r)return null;return{position:r.point,normal:null!=r.face?r.face.normal.clone().applyNormalMatrix((new o.dwI).getNormalMatrix(r.object.matrixWorld)):Ka.ray.direction.clone().multiplyScalar(-1),uv:null!==(s=r.uv)&&void 0!==s?s:null}}surfaceFromPoint(e,t=this){const s=this.element.model;if(null==s)return null;const r=this.hitFromPoint(e,t);if(null==r||null==r.face)return null;const A=s[wa](r),{meshes:l,primitives:h}=A.mesh.userData.associations,c=new o.Pq0,d=new o.Pq0,g=new o.Pq0,{a:p,b:m,c:f}=r.face,I=r.object;I.getVertexPosition(p,c),I.getVertexPosition(m,d),I.getVertexPosition(f,g);const E=new o.lMl(c,d,g),C=new o.Pq0;return E.getBarycoord(I.worldToLocal(r.point),C),`${l} ${h} ${p} ${m} ${f} ${C.x.toFixed(3)} ${C.y.toFixed(3)} ${C.z.toFixed(3)}`}addHotspot(e){this.target.add(e),this.annotationRenderer.domElement.appendChild(e.element)}removeHotspot(e){this.target.remove(e)}forHotspots(e){const{children:t}=this.target;for(let s=0,r=t.length;s<r;s++){const r=t[s];r instanceof Hotspot&&e(r)}}initializeSurface(e){if(null!=e.surface&&null==e.mesh){const t=Ki(e.surface)[0].terms;if(8!=t.length)return void qa.warn(e.surface+" does not have exactly 8 numbers.");const s=this.element.model[va](t[0].number,t[1].number),r=new o.Pq0(t[2].number,t[3].number,t[4].number);if(null==s)return void qa.warn(e.surface+" does not match a node/primitive in this glTF! Skipping this hotspot.");const A=s.mesh.geometry.attributes.position.count;if(r.x>=A||r.y>=A||r.z>=A)return void qa.warn(e.surface+" vertex indices out of range in this glTF! Skipping this hotspot.");const l=new o.Pq0(t[5].number,t[6].number,t[7].number);e.mesh=s.mesh,e.tri=r,e.bary=l}}updateSurfaceHotspots(){const e=!this.element.paused;this.forHotspots((t=>{this.initializeSurface(t),t.updateSurface(e)}))}updateHotspotsVisibility(e){this.forHotspots((t=>{Va.copy(e),$a.setFromMatrixPosition(t.matrixWorld),Va.sub($a),Ja.copy(t.normal).transformDirection(this.target.matrixWorld),Va.dot(Ja)<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:s,element:r}=this,{alt:o,poster:A,iosSrc:l}=r;if(null!=e){const r=[{"@type":"MediaObject",contentUrl:e,encodingFormat:"gltf"===(null===(t=e.split(".").pop())||void 0===t?void 0:t.toLowerCase())?"model/gltf+json":"model/gltf-binary"}];l&&r.push({"@type":"MediaObject",contentUrl:l,encodingFormat:"model/vnd.usdz+zip"});const h={"@context":"http://schema.org/","@type":"3DModel",image:null!=A?A:void 0,name:null!=o?o:void 0,encoding:r};s.textContent=JSON.stringify(h),document.head.appendChild(s)}else null!=s.parentElement&&s.parentElement.removeChild(s)}}class ProgressTracker extends EventTarget{constructor(){super(...arguments),this.ongoingActivities=new Set,this.totalProgress=0}get ongoingActivityCount(){return this.ongoingActivities.size}beginActivity(e){const t={progress:0,completed:!1};return this.ongoingActivities.add(t),1===this.ongoingActivityCount&&this.announceTotalProgress(t,0,e),s=>{let r;return r=Math.max(clamp(s,0,1),t.progress),r!==t.progress&&this.announceTotalProgress(t,r,e),t.progress}}announceTotalProgress(e,t,s){let r=0,o=0;1==t&&(e.completed=!0);for(const e of this.ongoingActivities){const{progress:t}=e;r+=1-t,e.completed&&o++}const A=e.progress;e.progress=t,this.totalProgress+=(t-A)*(1-this.totalProgress)/r;const l=o===this.ongoingActivityCount?1:this.totalProgress;this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:l,reason:s}})),o===this.ongoingActivityCount&&(this.totalProgress=0,this.ongoingActivities.clear())}}var ja,Wa,Xa,Za,eo,to,io,so,no,ro,ao,oo,Ao,lo=s(96763),model_viewer_base_decorate=function(e,t,s,r){var o,A=arguments.length,l=A<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,s,r);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(l=(A<3?o(l):A>3?o(t,s,l):o(t,s))||l);return A>3&&l&&Object.defineProperty(t,s,l),l};const ho=document.createElement("canvas"),co=Symbol("fallbackResizeHandler"),uo=Symbol("defaultAriaLabel"),go=Symbol("resizeObserver"),po=Symbol("clearModelTimeout"),mo=Symbol("onContextLost"),fo=Symbol("loaded"),Io=Symbol("status"),Eo=Symbol("onFocus"),Co=Symbol("onBlur"),Bo=Symbol("updateSize"),yo=Symbol("intersectionObserver"),wo=Symbol("isElementInViewport"),vo=Symbol("announceModelVisibility"),Qo=Symbol("ariaLabel"),xo=Symbol("altDefaulted"),bo=Symbol("statusElement"),So=Symbol("updateStatus"),Mo=Symbol("loadedTime"),To=Symbol("updateSource"),Ro=Symbol("markLoaded"),Do=Symbol("container"),Lo=Symbol("input"),Fo=Symbol("canvas"),_o=Symbol("scene"),ko=Symbol("needsRender"),Uo=Symbol("tick"),Go=Symbol("onModelLoad"),Po=Symbol("onResize"),No=Symbol("renderer"),Oo=Symbol("progressTracker"),Ho=Symbol("getLoaded"),qo=Symbol("getModelIsVisible"),Vo=Symbol("shouldAttemptPreload"),toVector3D=e=>({x:e.x,y:e.y,z:e.z,toString(){return`${this.x}m ${this.y}m ${this.z}m`}}),toVector2D=e=>({u:e.x,v:e.y,toString(){return`${this.u} ${this.v}`}});class ModelViewerElementBase extends reactive_element_a{constructor(){super(),this.alt=null,this.src=null,this.withCredentials=!1,this.generateSchema=!1,this[ja]=!1,this[Wa]=!1,this[Xa]=0,this[Za]="",this[eo]=null,this[to]=debounce((()=>{const e=this.getBoundingClientRect();this[Bo](e)}),50),this[io]=debounce((e=>{const t=this.modelIsVisible;t!==e&&this.dispatchEvent(new CustomEvent("model-visibility",{detail:{visible:t}}))}),0),this[so]=null,this[no]=null,this[ro]=new ProgressTracker,this[ao]=()=>{this[bo].textContent=this[Io]},this[oo]=()=>{this[bo].textContent=""},this[Ao]=e=>{this.dispatchEvent(new CustomEvent("error",{detail:{type:"webglcontextlost",sourceError:e.sourceEvent}}))},this.attachShadow({mode:"open"});const e=this.shadowRoot;let t,s;if((e=>{D(Ge,e)})(e),this[Do]=e.querySelector(".container"),this[Lo]=e.querySelector(".userInput"),this[Fo]=e.querySelector("canvas"),this[bo]=e.querySelector("#status"),this[uo]=this[Lo].getAttribute("aria-label"),this.isConnected){const e=this.getBoundingClientRect();t=e.width,s=e.height}else t=300,s=150;this[_o]=new ModelScene({canvas:this[Fo],element:this,width:t,height:s}),Promise.resolve().then((()=>{this[Bo](this.getBoundingClientRect())})),Be&&(this[go]=new ResizeObserver((e=>{if(!this[No].isPresenting)for(let t of e)t.target===this&&this[Bo](t.contentRect)}))),ye?this[yo]=new IntersectionObserver((e=>{for(let t of e)if(t.target===this){const e=this.modelIsVisible;this[wo]=t.isIntersecting,this[vo](e),this[wo]&&!this.loaded&&this[To]()}}),{root:null,rootMargin:"0px",threshold:1e-5}):this[wo]=!0}static get is(){return"model-viewer"}static set modelCacheSize(e){CachingGLTFLoader[ei].evictionThreshold=e}static get modelCacheSize(){return CachingGLTFLoader[ei].evictionThreshold}static set minimumRenderScale(e){e>1&&lo.warn("<model-viewer> minimumRenderScale has been clamped to a maximum value of 1."),e<=0&&lo.warn("<model-viewer> minimumRenderScale has been clamped to a minimum value of 0.25."),Renderer.singleton.minScale=e}static get minimumRenderScale(){return Renderer.singleton.minScale}get loaded(){return this[Ho]()}get[(ja=wo,Wa=fo,Xa=Mo,Za=Io,eo=po,to=co,io=vo,so=go,no=yo,ro=Oo,No)](){return Renderer.singleton}get modelIsVisible(){return this[qo]()}connectedCallback(){super.connectedCallback&&super.connectedCallback(),Be?this[go].observe(this):self.addEventListener("resize",this[co]),ye&&this[yo].observe(this),this.addEventListener("focus",this[Eo]),this.addEventListener("blur",this[Co]);const e=this[No];e.addEventListener("contextlost",this[mo]),e.registerScene(this[_o]),null!=this[po]&&(self.clearTimeout(this[po]),this[po]=null,this.requestUpdate("src",null))}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback(),Be?this[go].unobserve(this):self.removeEventListener("resize",this[co]),ye&&this[yo].unobserve(this),this.removeEventListener("focus",this[Eo]),this.removeEventListener("blur",this[Co]);const e=this[No];e.removeEventListener("contextlost",this[mo]),e.unregisterScene(this[_o]),this[po]=self.setTimeout((()=>{this[_o].dispose(),this[po]=null}),10)}updated(e){super.updated(e),e.has("src")&&(null==this.src?(this[fo]=!1,this[Mo]=0,this[_o].reset()):this.src!==this[_o].url&&(this[fo]=!1,this[Mo]=0,this[To]())),e.has("alt")&&this[Lo].setAttribute("aria-label",this[Qo]),e.has("withCredentials")&&(CachingGLTFLoader.withCredentials=this.withCredentials,this[No].textureUtils.withCredentials=this.withCredentials),e.has("generateSchema")&&(this.generateSchema?this[_o].updateSchema(this.src):this[_o].updateSchema(null))}toDataURL(e,t){return this[No].displayCanvas(this[_o]).toDataURL(e,t)}async toBlob(e){const t=e?e.mimeType:void 0,s=e?e.qualityArgument:void 0,r=e?e.idealAspect:void 0,{width:o,height:A,idealAspect:l,aspect:h}=this[_o],{dpr:c,scaleFactor:d}=this[No];let g=o*d*c,p=A*d*c,m=0,f=0;if(!0===r)if(l>h){const e=p;p=Math.round(g/l),f=(e-p)/2}else{const e=g;g=Math.round(p*l),m=(e-g)/2}ho.width=g,ho.height=p;try{return new Promise((async(e,r)=>{ho.getContext("2d").drawImage(this[No].displayCanvas(this[_o]),m,f,g,p,0,0,g,p),ho.toBlob((t=>{if(!t)return r(new Error("Unable to retrieve canvas blob"));e(t)}),t,s)}))}finally{this[Bo]({width:o,height:A})}}registerEffectComposer(e){e.setRenderer(this[No].threeRenderer),e.setMainCamera(this[_o].getCamera()),e.setMainScene(this[_o]),this[_o].effectRenderer=e}unregisterEffectComposer(){this[_o].effectRenderer=null}registerRenderer(e){this[_o].externalRenderer=e}unregisterRenderer(){this[_o].externalRenderer=null}get[Qo](){return this[xo]}get[xo](){return null==this.alt||"null"===this.alt?this[uo]:this.alt}[Ho](){return this[fo]}[qo](){return this.loaded&&this[wo]}[Vo](){return!!this.src&&this[wo]}[Bo]({width:e,height:t}){0!==e&&0!==t&&(this[Do].style.width=`${e}px`,this[Do].style.height=`${t}px`,this[Po]({width:e,height:t}))}[Uo](e,t){var s;null===(s=this[_o].effectRenderer)||void 0===s||s.beforeRender(e,t)}[Ro](){this[fo]||(this[fo]=!0,this[Mo]=performance.now())}[ko](){this[_o].queueRender()}[Go](){}[So](e){this[Io]=e;const t=this.getRootNode();null!=t&&t.activeElement===this&&this[bo].textContent!=e&&(this[bo].textContent=e)}[(ao=Eo,oo=Co,Po)](e){this[_o].setSize(e.width,e.height)}async[(Ao=mo,To)](){const e=this[_o];if(this.loaded||!this[Vo]()||this.src===e.url)return;this.generateSchema&&e.updateSchema(this.src),this[So]("Loading"),e.stopAnimation();const t=this[Oo].beginActivity("model-load"),s=this.src;try{const r=e.setSource(s,(e=>t(.95*clamp(e,0,1)))),o=this[ke]();await Promise.all([r,o]),this[Ro](),this[Go](),this.updateComplete.then((()=>{this.dispatchEvent(new CustomEvent("before-render"))})),await new Promise((e=>{requestAnimationFrame((()=>{requestAnimationFrame((()=>{this.dispatchEvent(new CustomEvent("load",{detail:{url:s}})),e()}))}))}))}catch(e){this.dispatchEvent(new CustomEvent("error",{detail:{type:"loadfailure",sourceError:e}}))}finally{t(1)}}}model_viewer_base_decorate([n({type:String})],ModelViewerElementBase.prototype,"alt",void 0),model_viewer_base_decorate([n({type:String})],ModelViewerElementBase.prototype,"src",void 0),model_viewer_base_decorate([n({type:Boolean,attribute:"with-credentials"})],ModelViewerElementBase.prototype,"withCredentials",void 0),model_viewer_base_decorate([n({type:Boolean,attribute:"generate-schema"})],ModelViewerElementBase.prototype,"generateSchema",void 0);var animation_decorate=function(e,t,s,r){var o,A=arguments.length,l=A<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,s,r);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(l=(A<3?o(l):A>3?o(t,s,l):o(t,s))||l);return A>3&&l&&Object.defineProperty(t,s,l),l};const $o=Symbol("changeAnimation"),Jo=Symbol("paused"),Ko={repetitions:1/0,pingpong:!1},Yo=Symbol("hotspotMap"),zo=Symbol("mutationCallback"),jo=Symbol("observer"),Wo=Symbol("addHotspot"),Xo=Symbol("removeHotspot"),Zo=new o.kn4;var durl=function(e){return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))};try{URL.revokeObjectURL(durl(""))}catch(e){durl=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)},function(e){return new Worker(e,{type:"module"})}}var eA=Uint8Array,tA=Uint16Array,iA=Uint32Array,sA=new eA([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]),nA=new eA([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]),rA=new eA([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),freb=function(e,t){for(var s=new tA(31),r=0;r<31;++r)s[r]=t+=1<<e[r-1];var o=new iA(s[30]);for(r=1;r<30;++r)for(var A=s[r];A<s[r+1];++A)o[A]=A-s[r]<<5|r;return[s,o]},aA=freb(sA,2),oA=aA[0],AA=aA[1];oA[28]=258,AA[258]=28;for(var lA=freb(nA,0),hA=(lA[0],lA[1]),cA=new tA(32768),uA=0;uA<32768;++uA){var dA=(43690&uA)>>>1|(21845&uA)<<1;dA=(61680&(dA=(52428&dA)>>>2|(13107&dA)<<2))>>>4|(3855&dA)<<4,cA[uA]=((65280&dA)>>>8|(255&dA)<<8)>>>1}var hMap=function(e,t,s){for(var r=e.length,o=0,A=new tA(t);o<r;++o)++A[e[o]-1];var l,h=new tA(t);for(o=0;o<t;++o)h[o]=h[o-1]+A[o-1]<<1;if(s){l=new tA(1<<t);var c=15-t;for(o=0;o<r;++o)if(e[o])for(var d=o<<4|e[o],g=t-e[o],p=h[e[o]-1]++<<g,m=p|(1<<g)-1;p<=m;++p)l[cA[p]>>>c]=d}else for(l=new tA(r),o=0;o<r;++o)e[o]&&(l[o]=cA[h[e[o]-1]++]>>>15-e[o]);return l},gA=new eA(288);for(uA=0;uA<144;++uA)gA[uA]=8;for(uA=144;uA<256;++uA)gA[uA]=9;for(uA=256;uA<280;++uA)gA[uA]=7;for(uA=280;uA<288;++uA)gA[uA]=8;var pA=new eA(32);for(uA=0;uA<32;++uA)pA[uA]=5;var mA=hMap(gA,9,0),fA=hMap(pA,5,0),shft=function(e){return(e/8|0)+(7&e&&1)},slc=function(e,t,s){(null==t||t<0)&&(t=0),(null==s||s>e.length)&&(s=e.length);var r=new(e instanceof tA?tA:e instanceof iA?iA:eA)(s-t);return r.set(e.subarray(t,s)),r},wbits=function(e,t,s){s<<=7&t;var r=t/8|0;e[r]|=s,e[r+1]|=s>>>8},wbits16=function(e,t,s){s<<=7&t;var r=t/8|0;e[r]|=s,e[r+1]|=s>>>8,e[r+2]|=s>>>16},hTree=function(e,t){for(var s=[],r=0;r<e.length;++r)e[r]&&s.push({s:r,f:e[r]});var o=s.length,A=s.slice();if(!o)return[EA,0];if(1==o){var l=new eA(s[0].s+1);return l[s[0].s]=1,[l,1]}s.sort((function(e,t){return e.f-t.f})),s.push({s:-1,f:25001});var h=s[0],c=s[1],d=0,g=1,p=2;for(s[0]={s:-1,f:h.f+c.f,l:h,r:c};g!=o-1;)h=s[s[d].f<s[p].f?d++:p++],c=s[d!=g&&s[d].f<s[p].f?d++:p++],s[g++]={s:-1,f:h.f+c.f,l:h,r:c};var m=A[0].s;for(r=1;r<o;++r)A[r].s>m&&(m=A[r].s);var f=new tA(m+1),I=fflate_module_ln(s[g-1],f,0);if(I>t){r=0;var E=0,C=I-t,B=1<<C;for(A.sort((function(e,t){return f[t.s]-f[e.s]||e.f-t.f}));r<o;++r){var y=A[r].s;if(!(f[y]>t))break;E+=B-(1<<I-f[y]),f[y]=t}for(E>>>=C;E>0;){var Q=A[r].s;f[Q]<t?E-=1<<t-f[Q]++-1:++r}for(;r>=0&&E;--r){var x=A[r].s;f[x]==t&&(--f[x],++E)}I=t}return[new eA(f),I]},fflate_module_ln=function(e,t,s){return-1==e.s?Math.max(fflate_module_ln(e.l,t,s+1),fflate_module_ln(e.r,t,s+1)):t[e.s]=s},lc=function(e){for(var t=e.length;t&&!e[--t];);for(var s=new tA(++t),r=0,o=e[0],A=1,w=function(e){s[r++]=e},l=1;l<=t;++l)if(e[l]==o&&l!=t)++A;else{if(!o&&A>2){for(;A>138;A-=138)w(32754);A>2&&(w(A>10?A-11<<5|28690:A-3<<5|12305),A=0)}else if(A>3){for(w(o),--A;A>6;A-=6)w(8304);A>2&&(w(A-3<<5|8208),A=0)}for(;A--;)w(o);A=1,o=e[l]}return[s.subarray(0,r),t]},clen=function(e,t){for(var s=0,r=0;r<t.length;++r)s+=e[r]*t[r];return s},wfblk=function(e,t,s){var r=s.length,o=shft(t+2);e[o]=255&r,e[o+1]=r>>>8,e[o+2]=255^e[o],e[o+3]=255^e[o+1];for(var A=0;A<r;++A)e[o+A+4]=s[A];return 8*(o+4+r)},wblk=function(e,t,s,r,o,A,l,h,c,d,g){wbits(t,g++,s),++o[256];for(var p=hTree(o,15),m=p[0],f=p[1],I=hTree(A,15),E=I[0],C=I[1],B=lc(m),y=B[0],Q=B[1],x=lc(E),b=x[0],S=x[1],T=new tA(19),F=0;F<y.length;++F)T[31&y[F]]++;for(F=0;F<b.length;++F)T[31&b[F]]++;for(var _=hTree(T,7),U=_[0],G=_[1],O=19;O>4&&!U[rA[O-1]];--O);var q,$,J,K,Y=d+5<<3,j=clen(o,gA)+clen(A,pA)+l,W=clen(o,m)+clen(A,E)+l+14+3*O+clen(T,U)+(2*T[16]+3*T[17]+7*T[18]);if(Y<=j&&Y<=W)return wfblk(t,g,e.subarray(c,c+d));if(wbits(t,g,1+(W<j)),g+=2,W<j){q=hMap(m,f,0),$=m,J=hMap(E,C,0),K=E;var X=hMap(U,G,0);wbits(t,g,Q-257),wbits(t,g+5,S-1),wbits(t,g+10,O-4),g+=14;for(F=0;F<O;++F)wbits(t,g+3*F,U[rA[F]]);g+=3*O;for(var ee=[y,b],te=0;te<2;++te){var ie=ee[te];for(F=0;F<ie.length;++F){var se=31&ie[F];wbits(t,g,X[se]),g+=U[se],se>15&&(wbits(t,g,ie[F]>>>5&127),g+=ie[F]>>>12)}}}else q=mA,$=gA,J=fA,K=pA;for(F=0;F<h;++F)if(r[F]>255){se=r[F]>>>18&31;wbits16(t,g,q[se+257]),g+=$[se+257],se>7&&(wbits(t,g,r[F]>>>23&31),g+=sA[se]);var ne=31&r[F];wbits16(t,g,J[ne]),g+=K[ne],ne>3&&(wbits16(t,g,r[F]>>>5&8191),g+=nA[ne])}else wbits16(t,g,q[r[F]]),g+=$[r[F]];return wbits16(t,g,q[256]),g+$[256]},IA=new iA([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),EA=new eA(0),dflt=function(e,t,s,r,o,A){var l=e.length,h=new eA(r+l+5*(1+Math.ceil(l/7e3))+o),c=h.subarray(r,h.length-o),d=0;if(!t||l<8)for(var g=0;g<=l;g+=65535){var p=g+65535;p<l?d=wfblk(c,d,e.subarray(g,p)):(c[g]=A,d=wfblk(c,d,e.subarray(g,l)))}else{for(var m=IA[t-1],f=m>>>13,I=8191&m,E=(1<<s)-1,C=new tA(32768),B=new tA(E+1),y=Math.ceil(s/3),Q=2*y,hsh=function(t){return(e[t]^e[t+1]<<y^e[t+2]<<Q)&E},x=new iA(25e3),b=new tA(288),S=new tA(32),T=0,F=0,_=(g=0,0),U=0,G=0;g<l;++g){var O=hsh(g),q=32767&g,$=B[O];if(C[q]=$,B[O]=q,U<=g){var J=l-g;if((T>7e3||_>24576)&&J>423){d=wblk(e,c,0,x,b,S,F,_,G,g-G,d),_=T=F=0,G=g;for(var K=0;K<286;++K)b[K]=0;for(K=0;K<30;++K)S[K]=0}var Y=2,j=0,W=I,X=q-$&32767;if(J>2&&O==hsh(g-X))for(var ee=Math.min(f,J)-1,te=Math.min(32767,g),ie=Math.min(258,J);X<=te&&--W&&q!=$;){if(e[g+Y]==e[g+Y-X]){for(var se=0;se<ie&&e[g+se]==e[g+se-X];++se);if(se>Y){if(Y=se,j=X,se>ee)break;var ne=Math.min(X,se-2),re=0;for(K=0;K<ne;++K){var ae=g-X+K+32768&32767,oe=ae-C[ae]+32768&32767;oe>re&&(re=oe,$=ae)}}}X+=(q=$)-($=C[q])+32768&32767}if(j){x[_++]=268435456|AA[Y]<<18|hA[j];var Ae=31&AA[Y],le=31&hA[j];F+=sA[Ae]+nA[le],++b[257+Ae],++S[le],U=g+Y,++T}else x[_++]=e[g],++b[e[g]]}}d=wblk(e,c,A,x,b,S,F,_,G,g-G,d),!A&&7&d&&(d=wfblk(c,d+1,EA))}return slc(h,0,r+shft(d)+o)},CA=function(){for(var e=new iA(256),t=0;t<256;++t){for(var s=t,r=9;--r;)s=(1&s&&3988292384)^s>>>1;e[t]=s}return e}(),crc=function(){var e=-1;return{p:function(t){for(var s=e,r=0;r<t.length;++r)s=CA[255&s^t[r]]^s>>>8;e=s},d:function(){return~e}}},dopt=function(e,t,s,r,o){return dflt(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,s,r,!o)},mrg=function(e,t){var s={};for(var r in e)s[r]=e[r];for(var r in t)s[r]=t[r];return s},wbytes=function(e,t,s){for(;s;++t)e[t]=s,s>>>=8};function deflateSync(e,t){return dopt(e,t||{},0,0)}var fltn=function(e,t,s,r){for(var o in e){var A=e[o],l=t+o;A instanceof eA?s[l]=[A,r]:Array.isArray(A)?s[l]=[A[0],mrg(r,A[1])]:fltn(A,l+"/",s,r)}},BA="undefined"!=typeof TextEncoder&&new TextEncoder,yA="undefined"!=typeof TextDecoder&&new TextDecoder;try{yA.decode(EA,{stream:!0}),1}catch(e){}function strToU8(e,t){if(t){for(var s=new eA(e.length),r=0;r<e.length;++r)s[r]=e.charCodeAt(r);return s}if(BA)return BA.encode(e);var o=e.length,A=new eA(e.length+(e.length>>1)),l=0,w=function(e){A[l++]=e};for(r=0;r<o;++r){if(l+5>A.length){var h=new eA(l+8+(o-r<<1));h.set(A),A=h}var c=e.charCodeAt(r);c<128||t?w(c):c<2048?(w(192|c>>6),w(128|63&c)):c>55295&&c<57344?(w(240|(c=65536+(1047552&c)|1023&e.charCodeAt(++r))>>18),w(128|c>>12&63),w(128|c>>6&63),w(128|63&c)):(w(224|c>>12),w(128|c>>6&63),w(128|63&c))}return slc(A,0,l)}var exfl=function(e){var t=0;if(e)for(var s in e){var r=e[s].length;if(r>65535)throw"extra field too long";t+=r+4}return t},wzh=function(e,t,s,r,o,A,l,h){var c=r.length,d=s.extra,g=h&&h.length,p=exfl(d);wbytes(e,t,null!=l?33639248:67324752),t+=4,null!=l&&(e[t++]=20,e[t++]=s.os),e[t]=20,t+=2,e[t++]=s.flag<<1|(null==A&&8),e[t++]=o&&8,e[t++]=255&s.compression,e[t++]=s.compression>>8;var m=new Date(null==s.mtime?Date.now():s.mtime),f=m.getFullYear()-1980;if(f<0||f>119)throw"date not in range 1980-2099";if(wbytes(e,t,f<<25|m.getMonth()+1<<21|m.getDate()<<16|m.getHours()<<11|m.getMinutes()<<5|m.getSeconds()>>>1),t+=4,null!=A&&(wbytes(e,t,s.crc),wbytes(e,t+4,A),wbytes(e,t+8,s.size)),wbytes(e,t+12,c),wbytes(e,t+14,p),t+=16,null!=l&&(wbytes(e,t,g),wbytes(e,t+6,s.attrs),wbytes(e,t+10,l),t+=14),e.set(r,t),t+=c,p)for(var I in d){var E=d[I],C=E.length;wbytes(e,t,+I),wbytes(e,t+2,C),e.set(E,t+4),t+=4+C}return g&&(e.set(h,t),t+=g),t},wzf=function(e,t,s,r,o){wbytes(e,t,101010256),wbytes(e,t+8,s),wbytes(e,t+10,s),wbytes(e,t+12,r),wbytes(e,t+16,o)};var wA=s(96763);class USDZExporter{async parse(e,t={}){t=Object.assign({ar:{anchoring:{type:"plane"},planeAnchoring:{alignment:"horizontal"}},quickLookCompatible:!1},t);const s={},r="model.usda";s[r]=null;let o=buildHeader();o+=function buildSceneStart(e){return`def Xform "Root"\n{\n\tdef Scope "Scenes" (\n\t\tkind = "sceneLibrary"\n\t)\n\t{\n\t\tdef Xform "Scene" (\n\t\t\tcustomData = {\n\t\t\t\tbool preliminary_collidesWithEnvironment = 0\n\t\t\t\tstring sceneName = "Scene"\n\t\t\t}\n\t\t\tsceneName = "Scene"\n\t\t)\n\t\t{\n\t\ttoken preliminary:anchoring:type = "${e.ar.anchoring.type}"\n\t\ttoken preliminary:planeAnchoring:alignment = "${e.ar.planeAnchoring.alignment}"\n\n`}(t);const A={},l={};e.traverseVisible((e=>{if(e.isMesh){const t=e.geometry,r=e.material;if(r.isMeshStandardMaterial){const l="geometries/Geometry_"+t.id+".usda";if(!(l in s)){const e=function buildMeshObject(e){const t=function buildMesh(e){const t="Geometry",s=e.attributes,r=s.position.count;return`\n\tdef Mesh "${t}"\n\t{\n\t\tint[] faceVertexCounts = [${function buildMeshVertexCount(e){const t=null!==e.index?e.index.count:e.attributes.position.count;return Array(t/3).fill(3).join(", ")}(e)}]\n\t\tint[] faceVertexIndices = [${function buildMeshVertexIndices(e){const t=e.index,s=[];if(null!==t)for(let e=0;e<t.count;e++)s.push(t.getX(e));else{const t=e.attributes.position.count;for(let e=0;e<t;e++)s.push(e)}return s.join(", ")}(e)}]\n\t\tnormal3f[] normals = [${buildVector3Array(s.normal,r)}] (\n\t\t\tinterpolation = "vertex"\n\t\t)\n\t\tpoint3f[] points = [${buildVector3Array(s.position,r)}]\n${function buildPrimvars(e){let t="";for(let s=0;s<4;s++){const r=s>0?s:"",o=e["uv"+r];void 0!==o&&(t+=`\n\t\ttexCoord2f[] primvars:st${r} = [${buildVector2Array(o)}] (\n\t\t\tinterpolation = "vertex"\n\t\t)`)}return t}(s)}\n\t\tuniform token subdivisionScheme = "none"\n\t}\n`}(e);return`\ndef "Geometry"\n{\n${t}\n}\n`}(t);s[l]=function buildUSDFileAsString(e){let t=buildHeader();return t+=e,strToU8(t)}(e)}r.uuid in A||(A[r.uuid]=r),o+=function buildXform(e,t,s){const r="Object_"+e.id,o=buildMatrix(e.matrixWorld);e.matrixWorld.determinant()<0&&wA.warn("THREE.USDZExporter: USDZ does not support negative scales",e);return`def Xform "${r}" (\n\tprepend references = @./geometries/Geometry_${t.id}.usda@</Geometry>\n\tprepend apiSchemas = ["MaterialBindingAPI"]\n)\n{\n\tmatrix4d xformOp:transform = ${o}\n\tuniform token[] xformOpOrder = ["xformOp:transform"]\n\n\trel material:binding = </Materials/Material_${s.id}>\n}\n\n`}(e,t,r)}else wA.warn("THREE.USDZExporter: Unsupported material type (USDZ only supports MeshStandardMaterial)",e)}else e.isCamera&&(o+=function buildCamera(e){const t=e.name?e.name:"Camera_"+e.id,s=buildMatrix(e.matrixWorld);e.matrixWorld.determinant()<0&&wA.warn("THREE.USDZExporter: USDZ does not support negative scales",e);return e.isOrthographicCamera?`def Camera "${t}"\n\t\t{\n\t\t\tmatrix4d xformOp:transform = ${s}\n\t\t\tuniform token[] xformOpOrder = ["xformOp:transform"]\n\n\t\t\tfloat2 clippingRange = (${e.near.toPrecision(vA)}, ${e.far.toPrecision(vA)})\n\t\t\tfloat horizontalAperture = ${(10*(Math.abs(e.left)+Math.abs(e.right))).toPrecision(vA)}\n\t\t\tfloat verticalAperture = ${(10*(Math.abs(e.top)+Math.abs(e.bottom))).toPrecision(vA)}\n\t\t\ttoken projection = "orthographic"\n\t\t}\n\t\n\t`:`def Camera "${t}"\n\t\t{\n\t\t\tmatrix4d xformOp:transform = ${s}\n\t\t\tuniform token[] xformOpOrder = ["xformOp:transform"]\n\n\t\t\tfloat2 clippingRange = (${e.near.toPrecision(vA)}, ${e.far.toPrecision(vA)})\n\t\t\tfloat focalLength = ${e.getFocalLength().toPrecision(vA)}\n\t\t\tfloat focusDistance = ${e.focus.toPrecision(vA)}\n\t\t\tfloat horizontalAperture = ${e.getFilmWidth().toPrecision(vA)}\n\t\t\ttoken projection = "perspective"\n\t\t\tfloat verticalAperture = ${e.getFilmHeight().toPrecision(vA)}\n\t\t}\n\t\n\t`}(e))})),o+="\n\t\t}\n\t}\n}\n\n",o+=function buildMaterials(e,t,s=!1){const r=[];for(const o in e){const A=e[o];r.push(buildMaterial(A,t,s))}return`def "Materials"\n{\n${r.join("")}\n}\n\n`}(A,l,t.quickLookCompatible),s[r]=strToU8(o),o=null;for(const e in l){let t=l[e];!0===t.isCompressedTexture&&(t=decompress(t));const r=imageToCanvas(t.image,t.flipY),o=await new Promise((e=>r.toBlob(e,"image/png",1)));s[`textures/Texture_${e}.png`]=new Uint8Array(await o.arrayBuffer())}let h=0;for(const e in s){const t=s[e];h+=34+e.length;const r=63&h;if(4!==r){const o=new Uint8Array(64-r);s[e]=[t,{extra:{12345:o}}]}h=t.length}return function zipSync(e,t){t||(t={});var s={},r=[];fltn(e,"",s,t);var o=0,A=0;for(var l in s){var h=s[l],c=h[0],d=h[1],g=0==d.level?0:8,p=(T=strToU8(l)).length,m=d.comment,f=m&&strToU8(m),I=f&&f.length,E=exfl(d.extra);if(p>65535)throw"filename too long";var C=g?deflateSync(c,d):c,B=C.length,y=crc();y.p(c),r.push(mrg(d,{size:c.length,crc:y.d(),c:C,f:T,m:f,u:p!=l.length||f&&m.length!=I,o,compression:g})),o+=30+p+E+B,A+=76+2*(p+E)+(I||0)+B}for(var Q=new eA(A+22),x=o,b=A-o,S=0;S<r.length;++S){var T=r[S];wzh(Q,T.o,T,T.f,T.u,T.c.length);var F=30+T.f.length+exfl(T.extra);Q.set(T.c,T.o+F),wzh(Q,o,T,T.f,T.u,T.c.length,T.o,T.m),o+=16+F+(T.m?T.m.length:0)}return wzf(Q,o,r.length,b,x),Q}(s,{level:0})}}function imageToCanvas(e,t){if("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap){const s=1024/Math.max(e.width,e.height),r=document.createElement("canvas");r.width=e.width*Math.min(1,s),r.height=e.height*Math.min(1,s);const o=r.getContext("2d");return!0===t&&(o.translate(0,r.height),o.scale(1,-1)),o.drawImage(e,0,0,r.width,r.height),r}throw new Error("THREE.USDZExporter: No valid image data found. Unable to process texture.")}const vA=7;function buildHeader(){return'#usda 1.0\n(\n\tcustomLayerData = {\n\t\tstring creator = "Three.js USDZExporter"\n\t}\n\tdefaultPrim = "Root"\n\tmetersPerUnit = 1\n\tupAxis = "Y"\n)\n\n'}function buildMatrix(e){const t=e.elements;return`( ${buildMatrixRow(t,0)}, ${buildMatrixRow(t,4)}, ${buildMatrixRow(t,8)}, ${buildMatrixRow(t,12)} )`}function buildMatrixRow(e,t){return`(${e[t+0]}, ${e[t+1]}, ${e[t+2]}, ${e[t+3]})`}function buildVector3Array(e,t){if(void 0===e)return wA.warn("USDZExporter: Normals missing."),Array(t).fill("(0, 0, 0)").join(", ");const s=[];for(let t=0;t<e.count;t++){const r=e.getX(t),o=e.getY(t),A=e.getZ(t);s.push(`(${r.toPrecision(vA)}, ${o.toPrecision(vA)}, ${A.toPrecision(vA)})`)}return s.join(", ")}function buildVector2Array(e){const t=[];for(let s=0;s<e.count;s++){const r=e.getX(s),o=e.getY(s);t.push(`(${r.toPrecision(vA)}, ${1-o.toPrecision(vA)})`)}return t.join(", ")}function buildMaterial(e,t,s=!1){const r="\t\t\t",A=[],l=[];function buildTexture(r,A,l){const h=r.source.id+"_"+r.flipY;t[h]=r;const c=r.channel>0?"st"+r.channel:"st",d={1e3:"repeat",1001:"clamp",1002:"mirror"},g=r.repeat.clone(),p=r.offset.clone(),m=r.rotation,f=Math.sin(m),I=Math.cos(m);return p.y=1-p.y-g.y,s?(p.x=p.x/g.x,p.y=p.y/g.y,p.x+=f/g.x,p.y+=I-1):(p.x+=f*g.x,p.y+=(1-I)*g.y),`\n\t\tdef Shader "PrimvarReader_${A}"\n\t\t{\n\t\t\tuniform token info:id = "UsdPrimvarReader_float2"\n\t\t\tfloat2 inputs:fallback = (0.0, 0.0)\n\t\t\ttoken inputs:varname = "${c}"\n\t\t\tfloat2 outputs:result\n\t\t}\n\n\t\tdef Shader "Transform2d_${A}"\n\t\t{\n\t\t\tuniform token info:id = "UsdTransform2d"\n\t\t\ttoken inputs:in.connect = </Materials/Material_${e.id}/PrimvarReader_${A}.outputs:result>\n\t\t\tfloat inputs:rotation = ${(m*(180/Math.PI)).toFixed(vA)}\n\t\t\tfloat2 inputs:scale = ${buildVector2(g)}\n\t\t\tfloat2 inputs:translation = ${buildVector2(p)}\n\t\t\tfloat2 outputs:result\n\t\t}\n\n\t\tdef Shader "Texture_${r.id}_${A}"\n\t\t{\n\t\t\tuniform token info:id = "UsdUVTexture"\n\t\t\tasset inputs:file = @textures/Texture_${h}.png@\n\t\t\tfloat2 inputs:st.connect = </Materials/Material_${e.id}/Transform2d_${A}.outputs:result>\n\t\t\t${void 0!==l?"float4 inputs:scale = "+function buildColor4(e){return`(${e.r}, ${e.g}, ${e.b}, 1.0)`}(l):""}\n\t\t\ttoken inputs:sourceColorSpace = "${r.colorSpace===o.jf0?"raw":"sRGB"}"\n\t\t\ttoken inputs:wrapS = "${d[r.wrapS]}"\n\t\t\ttoken inputs:wrapT = "${d[r.wrapT]}"\n\t\t\tfloat outputs:r\n\t\t\tfloat outputs:g\n\t\t\tfloat outputs:b\n\t\t\tfloat3 outputs:rgb\n\t\t\t${e.transparent||e.alphaTest>0?"float outputs:a":""}\n\t\t}`}return e.side===o.$EB&&wA.warn("THREE.USDZExporter: USDZ does not support double sided materials",e),null!==e.map?(A.push(`${r}color3f inputs:diffuseColor.connect = </Materials/Material_${e.id}/Texture_${e.map.id}_diffuse.outputs:rgb>`),e.transparent?A.push(`${r}float inputs:opacity.connect = </Materials/Material_${e.id}/Texture_${e.map.id}_diffuse.outputs:a>`):e.alphaTest>0&&(A.push(`${r}float inputs:opacity.connect = </Materials/Material_${e.id}/Texture_${e.map.id}_diffuse.outputs:a>`),A.push(`${r}float inputs:opacityThreshold = ${e.alphaTest}`)),l.push(buildTexture(e.map,"diffuse",e.color))):A.push(`${r}color3f inputs:diffuseColor = ${buildColor(e.color)}`),null!==e.emissiveMap?(A.push(`${r}color3f inputs:emissiveColor.connect = </Materials/Material_${e.id}/Texture_${e.emissiveMap.id}_emissive.outputs:rgb>`),l.push(buildTexture(e.emissiveMap,"emissive"))):e.emissive.getHex()>0&&A.push(`${r}color3f inputs:emissiveColor = ${buildColor(e.emissive)}`),null!==e.normalMap&&(A.push(`${r}normal3f inputs:normal.connect = </Materials/Material_${e.id}/Texture_${e.normalMap.id}_normal.outputs:rgb>`),l.push(buildTexture(e.normalMap,"normal"))),null!==e.aoMap&&(A.push(`${r}float inputs:occlusion.connect = </Materials/Material_${e.id}/Texture_${e.aoMap.id}_occlusion.outputs:r>`),l.push(buildTexture(e.aoMap,"occlusion"))),null!==e.roughnessMap&&1===e.roughness?(A.push(`${r}float inputs:roughness.connect = </Materials/Material_${e.id}/Texture_${e.roughnessMap.id}_roughness.outputs:g>`),l.push(buildTexture(e.roughnessMap,"roughness"))):A.push(`${r}float inputs:roughness = ${e.roughness}`),null!==e.metalnessMap&&1===e.metalness?(A.push(`${r}float inputs:metallic.connect = </Materials/Material_${e.id}/Texture_${e.metalnessMap.id}_metallic.outputs:b>`),l.push(buildTexture(e.metalnessMap,"metallic"))):A.push(`${r}float inputs:metallic = ${e.metalness}`),null!==e.alphaMap?(A.push(`${r}float inputs:opacity.connect = </Materials/Material_${e.id}/Texture_${e.alphaMap.id}_opacity.outputs:r>`),A.push(`${r}float inputs:opacityThreshold = 0.0001`),l.push(buildTexture(e.alphaMap,"opacity"))):A.push(`${r}float inputs:opacity = ${e.opacity}`),e.isMeshPhysicalMaterial&&(A.push(`${r}float inputs:clearcoat = ${e.clearcoat}`),A.push(`${r}float inputs:clearcoatRoughness = ${e.clearcoatRoughness}`),A.push(`${r}float inputs:ior = ${e.ior}`)),`\n\tdef Material "Material_${e.id}"\n\t{\n\t\tdef Shader "PreviewSurface"\n\t\t{\n\t\t\tuniform token info:id = "UsdPreviewSurface"\n${A.join("\n")}\n\t\t\tint inputs:useSpecularWorkflow = 0\n\t\t\ttoken outputs:surface\n\t\t}\n\n\t\ttoken outputs:surface.connect = </Materials/Material_${e.id}/PreviewSurface.outputs:surface>\n\n${l.join("\n")}\n\n\t}\n`}function buildColor(e){return`(${e.r}, ${e.g}, ${e.b})`}function buildVector2(e){return`(${e.x}, ${e.y})`}var QA=s(96763),ar_decorate=function(e,t,s,r){var o,A=arguments.length,l=A<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,s,r);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(l=(A<3?o(l):A>3?o(t,s,l):o(t,s))||l);return A>3&&l&&Object.defineProperty(t,s,l),l};let xA=!1,bA=!1;const SA="#model-viewer-no-ar-fallback",MA=(TA=["quick-look","scene-viewer","webxr","none"],e=>{try{const t=Ki(e),s=(t.length?t[0].terms:[]).filter((e=>e&&"ident"===e.type)).map((e=>e.value)).filter((e=>TA.indexOf(e)>-1));return new Set(s)}catch(e){}return new Set});var TA;const RA="quick-look",DA="scene-viewer",LA="webxr",FA="none",_A=Symbol("arButtonContainer"),kA=Symbol("enterARWithWebXR"),UA=Symbol("openSceneViewer"),GA=Symbol("openIOSARQuickLook"),PA=Symbol("canActivateAR"),NA=Symbol("arMode"),OA=Symbol("arModes"),HA=Symbol("arAnchor"),qA=Symbol("preload"),VA=Symbol("onARButtonContainerClick"),$A=Symbol("onARStatus"),JA=Symbol("onARTracking"),KA=Symbol("onARTap"),YA=Symbol("selectARMode"),zA=Symbol("triggerLoad");var loading_decorate=function(e,t,s,r){var o,A=arguments.length,l=A<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,s,r);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(l=(A<3?o(l):A>3?o(t,s,l):o(t,s))||l);return A>3&&l&&Object.defineProperty(t,s,l),l};const jA="auto",WA="auto",XA="eager",ZA=Symbol("defaultProgressBarElement"),el=Symbol("posterContainerElement"),tl=Symbol("defaultPosterElement"),il=Symbol("shouldDismissPoster"),sl=Symbol("hidePoster"),nl=Symbol("modelIsRevealed"),rl=Symbol("updateProgressBar"),al=Symbol("ariaLabelCallToAction"),ol=Symbol("onProgress");var staging_decorate=function(e,t,s,r){var o,A=arguments.length,l=A<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,s,r);else for(var h=e.length-1;h>=0;h--)(o=e[h])&&(l=(A<3?o(l):A>3?o(t,s,l):o(t,s))||l);return A>3&&l&&Object.defineProperty(t,s,l),l};const Al=Math.PI/32,ll={basis:[degreesToRadians(numberNode(Al,"rad"))],keywords:{auto:[null]}},hl=Symbol("autoRotateStartTime"),cl=Symbol("radiansPerSecond"),ul=Symbol("syncRotationRate"),dl=Symbol("onCameraChange"),gl=(e=>{var t,s,r;class AnnotationModelViewerElement extends e{constructor(){super(...arguments),this[t]=new Map,this[s]=e=>{e.forEach((e=>{e instanceof MutationRecord&&"childList"!==e.type||(e.addedNodes.forEach((e=>{this[Wo](e)})),e.removedNodes.forEach((e=>{this[Xo](e)})),this[ko]())}))},this[r]=new MutationObserver(this[zo])}connectedCallback(){super.connectedCallback();for(let e=0;e<this.children.length;++e)this[Wo](this.children[e]);const{ShadyDOM:e}=self;null==e?this[jo].observe(this,{childList:!0}):this[jo]=e.observeChildren(this,this[zo])}disconnectedCallback(){super.disconnectedCallback();const{ShadyDOM:e}=self;null==e?this[jo].disconnect():e.unobserveChildren(this[jo])}[(t=Yo,s=zo,r=jo,Uo)](e,t){super[Uo](e,t);const s=this[_o],{annotationRenderer:r}=s,o=s.getCamera();s.shouldRender()&&(s.updateSurfaceHotspots(),s.updateHotspotsVisibility(o.position),r.domElement.style.display="",r.render(s,o))}updateHotspot(e){const t=this[Yo].get(e.name);null!=t&&(t.updatePosition(e.position),t.updateNormal(e.normal),t.surface=e.surface,this[ko]())}queryHotspot(e){const t=this[Yo].get(e);if(null==t)return null;const s=toVector3D(t.position),r=toVector3D(t.normal),A=t.facingCamera,l=this[_o],h=l.getCamera(),c=new o.Pq0;c.setFromMatrixPosition(t.matrixWorld),c.project(h);const d=l.width/2,g=l.height/2;c.x=c.x*d+d,c.y=-c.y*g+g;const p=toVector3D(new o.Pq0(c.x,c.y,c.z));return Number.isFinite(p.x)&&Number.isFinite(p.y)?{position:s,normal:r,canvasPosition:p,facingCamera:A}:null}positionAndNormalFromPoint(e,t){const s=this[_o],r=s.getNDC(e,t),o=s.positionAndNormalFromPoint(r);if(null==o)return null;Zo.copy(s.target.matrixWorld).invert();const A=toVector3D(o.position.applyMatrix4(Zo)),l=toVector3D(o.normal.transformDirection(Zo));let h=null;return null!=o.uv&&(h=toVector2D(o.uv)),{position:A,normal:l,uv:h}}surfaceFromPoint(e,t){const s=this[_o],r=s.getNDC(e,t);return s.surfaceFromPoint(r)}[Wo](e){if(!(e instanceof HTMLElement&&0===e.slot.indexOf("hotspot")))return;let t=this[Yo].get(e.slot);null!=t?t.increment():(t=new Hotspot({name:e.slot,position:e.dataset.position,normal:e.dataset.normal,surface:e.dataset.surface}),this[Yo].set(e.slot,t),this[_o].addHotspot(t)),this[_o].queueRender()}[Xo](e){if(!(e instanceof HTMLElement))return;const t=this[Yo].get(e.slot);t&&(t.decrement()&&(this[_o].removeHotspot(t),this[Yo].delete(e.slot)),this[_o].queueRender())}}return AnnotationModelViewerElement})((e=>{var t,s,r;class SceneGraphModelViewerElement extends e{constructor(){super(...arguments),this[t]=void 0,this[s]=null,this[r]=null,this.variantName=null,this.orientation="0 0 0",this.scale="1 1 1"}get model(){return this[Ra]}get availableVariants(){return this.model?this.model[xa]():[]}get originalGltfJson(){return this[Ta]}[(t=Ra,s=Ma,r=Ta,Da)](){return()=>{this[ko]()}}[La](e){return e.colorSpace=o.er$,e.wrapS=o.GJx,e.wrapT=o.GJx,new Texture(this[Da](),e)}async createTexture(e,t="image/png"){const{textureUtils:s}=this[No],r=await s.loadImage(e);return r.userData.mimeType=t,this[La](r)}async createLottieTexture(e,t=1){const{textureUtils:s}=this[No],r=await s.loadLottie(e,t);return this[La](r)}createVideoTexture(e){const t=document.createElement("video");t.crossOrigin=this.withCredentials?"use-credentials":"anonymous",t.src=e,t.muted=!0,t.playsInline=!0,t.loop=!0,t.play();const s=new o.Nv2(t);return this[La](s)}createCanvasTexture(){const e=document.createElement("canvas"),t=new o.GOR(e);return this[La](t)}async updated(e){if(super.updated(e),e.has("variantName")){const e=this[Oo].beginActivity("variant-update");e(.1);const t=this[Ra],{variantName:s}=this;null!=t&&(await t[Ba](s),this[ko](),this.dispatchEvent(new CustomEvent("variant-applied"))),e(1)}if(e.has("orientation")||e.has("scale")){if(!this.loaded)return;const e=this[_o];e.applyTransform(),e.updateBoundingBox(),e.updateShadow(),this[No].arRenderer.onUpdateScene(),this[ko]()}}[Go](){super[Go]();const{currentGLTF:e}=this[_o];if(null!=e){const{correlatedSceneGraph:t}=e;null!=t&&e!==this[Ma]&&(this[Ra]=new Model(t,this[Da]()),this[Ta]=JSON.parse(JSON.stringify(t.gltf))),"variants"in e.userData&&this.requestUpdate("variantName")}this[Ma]=e}async exportScene(e){const t=this[_o];return new Promise((async(s,r)=>{const o={binary:!0,onlyVisible:!0,maxTextureSize:1/0,includeCustomExtensions:!1,forceIndices:!1};Object.assign(o,e),o.animations=t.animations,o.truncateDrawRange=!0;const A=t.shadow;let l=!1;null!=A&&(l=A.visible,A.visible=!1),await this[Ra][Ca]();(new GLTFExporter).register((e=>new GLTFExporterMaterialsVariantsExtension(e))).parse(t.model,(e=>s(new Blob([o.binary?e:JSON.stringify(e)],{type:o.binary?"application/octet-stream":"application/json"}))),(()=>r("glTF export failed")),o),null!=A&&(A.visible=l)}))}materialFromPoint(e,t){const s=this[Ra];if(null==s)return null;const r=this[_o],o=r.getNDC(e,t),A=r.hitFromPoint(o);return null==A||null==A.face?null:s[ya](A)}}return scene_graph_decorate([n({type:String,attribute:"variant-name"})],SceneGraphModelViewerElement.prototype,"variantName",void 0),scene_graph_decorate([n({type:String,attribute:"orientation"})],SceneGraphModelViewerElement.prototype,"orientation",void 0),scene_graph_decorate([n({type:String,attribute:"scale"})],SceneGraphModelViewerElement.prototype,"scale",void 0),SceneGraphModelViewerElement})((e=>{var t,s,r;class StagingModelViewerElement extends e{constructor(){super(...arguments),this.autoRotate=!1,this.autoRotateDelay=3e3,this.rotationPerSecond="auto",this[t]=performance.now(),this[s]=0,this[r]=e=>{this.autoRotate&&"user-interaction"===e.detail.source&&(this[hl]=performance.now())}}connectedCallback(){super.connectedCallback(),this.addEventListener("camera-change",this[dl]),this[hl]=performance.now()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("camera-change",this[dl]),this[hl]=performance.now()}updated(e){super.updated(e),e.has("autoRotate")&&(this[hl]=performance.now())}[(t=hl,s=cl,ul)](e){this[cl]=e[0]}[Uo](e,t){if(super[Uo](e,t),!this.autoRotate||!this[qo]()||this[No].isPresenting)return;const s=Math.min(t,e-this[hl]-this.autoRotateDelay);s>0&&(this[_o].yaw=this.turntableRotation+this[cl]*s*.001)}get turntableRotation(){return this[_o].yaw}resetTurntableRotation(e=0){this[_o].yaw=e}}return r=dl,staging_decorate([n({type:Boolean,attribute:"auto-rotate"})],StagingModelViewerElement.prototype,"autoRotate",void 0),staging_decorate([n({type:Number,attribute:"auto-rotate-delay"})],StagingModelViewerElement.prototype,"autoRotateDelay",void 0),staging_decorate([style({intrinsics:ll,updateHandler:ul}),n({type:String,attribute:"rotation-per-second"})],StagingModelViewerElement.prototype,"rotationPerSecond",void 0),StagingModelViewerElement})((e=>{var t,s,r;class EnvironmentModelViewerElement extends e{constructor(){super(...arguments),this.environmentImage=null,this.skyboxImage=null,this.shadowIntensity=0,this.shadowSoftness=1,this.exposure=1,this.toneMapping="auto",this.skyboxHeight="0",this[t]=null,this[s]=null,this[r]=null}updated(e){super.updated(e),e.has("shadowIntensity")&&(this[_o].setShadowIntensity(.5*this.shadowIntensity),this[ko]()),e.has("shadowSoftness")&&(this[_o].setShadowSoftness(this.shadowSoftness),this[ko]()),e.has("exposure")&&(this[_o].exposure=this.exposure,this[ko]()),e.has("toneMapping")&&(this[_o].toneMapping="commerce"===this.toneMapping?o.g7M:"agx"===this.toneMapping?o.LAk:o.FV,this[ko]()),(e.has("environmentImage")||e.has("skyboxImage"))&&this[Vo]()&&this[ke](),e.has("skyboxHeight")&&(this[_o].setGroundedSkybox(),this[ko]())}hasBakedShadow(){return this[_o].bakedShadows.size>0}async[(t=Fe,s=_e,r=Ue,ke)](){const{skyboxImage:e,environmentImage:t}=this;null!=this[Ue]&&(this[Ue](),this[Ue]=null);const{textureUtils:s}=this[No];if(null==s)return;const r=this[Oo].beginActivity("environment-update");try{const{environmentMap:o,skybox:A}=await s.generateEnvironmentMapAndSkybox(deserializeUrl(e),t,(e=>r(clamp(e,0,1))));this[Fe]!==o&&(this[Fe]=o,this.dispatchEvent(new CustomEvent("environment-change"))),this[_e]=null!=A?A.name===o.name?o:A:null,this[_o].setEnvironmentAndSkybox(this[Fe],this[_e])}catch(e){if(e instanceof Error)throw this[_o].setEnvironmentAndSkybox(null,null),e}finally{r(1)}}}return __decorate([n({type:String,attribute:"environment-image"})],EnvironmentModelViewerElement.prototype,"environmentImage",void 0),__decorate([n({type:String,attribute:"skybox-image"})],EnvironmentModelViewerElement.prototype,"skyboxImage",void 0),__decorate([n({type:Number,attribute:"shadow-intensity"})],EnvironmentModelViewerElement.prototype,"shadowIntensity",void 0),__decorate([n({type:Number,attribute:"shadow-softness"})],EnvironmentModelViewerElement.prototype,"shadowSoftness",void 0),__decorate([n({type:Number})],EnvironmentModelViewerElement.prototype,"exposure",void 0),__decorate([n({type:String,attribute:"tone-mapping"})],EnvironmentModelViewerElement.prototype,"toneMapping",void 0),__decorate([n({type:String,attribute:"skybox-height"})],EnvironmentModelViewerElement.prototype,"skyboxHeight",void 0),EnvironmentModelViewerElement})((e=>{var t,s,r,A,l,h,c,d,g,p,m,f,I,E,C,B,y;class ControlsModelViewerElement extends e{constructor(){super(...arguments),this.cameraControls=!1,this.cameraOrbit=Ls,this.cameraTarget="auto auto auto",this.fieldOfView="auto",this.minCameraOrbit="auto",this.maxCameraOrbit="auto",this.minFieldOfView="auto",this.maxFieldOfView="auto",this.interactionPromptThreshold=3e3,this.interactionPrompt=ks,this.interactionPromptStyle=Gs,this.orbitSensitivity=1,this.zoomSensitivity=1,this.panSensitivity=1,this.touchAction=Ps,this.disableZoom=!1,this.disablePan=!1,this.disableTap=!1,this.interpolationDecay=50,this[t]=this.shadowRoot.querySelector(".interaction-prompt"),this[s]=this.shadowRoot.querySelector("#prompt"),this[r]=[this.shadowRoot.querySelector("#finger0"),this.shadowRoot.querySelector("#finger1")],this[A]=this.shadowRoot.querySelector(".pan-target"),this[l]=0,this[h]=1/0,this[c]=!1,this[d]=!1,this[g]=vn.AUTOMATIC,this[p]=new SmoothControls(this[_o].camera,this[Lo],this[_o]),this[m]=new o.YHV,this[f]=!1,this[I]=!1,this[E]=!1,this[C]=()=>{const e=this[$s].changeSource;this[on]=e,e===vn.USER_INTERACTION&&(this[nn]=!0,this[js]())},this[B]=()=>{this[Ws](),this[ko]();const e=this[$s].changeSource;this.dispatchEvent(new CustomEvent("camera-change",{detail:{source:e}}))},this[y]=e=>{this[Do].classList.toggle("pointer-tumbling","pointer-change-start"===e.type)}}get inputSensitivity(){return this[$s].inputSensitivity}set inputSensitivity(e){this[$s].inputSensitivity=e}getCameraOrbit(){const{theta:e,phi:t,radius:s}=this[An];return{theta:e,phi:t,radius:s,toString(){return`${this.theta}rad ${this.phi}rad ${this.radius}m`}}}getCameraTarget(){return toVector3D(this[No].isPresenting?this[No].arRenderer.target:this[_o].getTarget())}getFieldOfView(){return this[$s].getFieldOfView()}getMinimumFieldOfView(){return this[$s].options.minimumFieldOfView}getMaximumFieldOfView(){return this[$s].options.maximumFieldOfView}getIdealAspect(){return this[_o].idealAspect}jumpCameraToGoal(){this[ln]=!0,this.requestUpdate(ln,!1)}resetInteractionPrompt(){this[an]=0,this[rn]=1/0,this[nn]=!1,this[sn]=this.interactionPrompt===ks&&this.cameraControls}zoom(e){const t=new WheelEvent("wheel",{deltaY:-30*e});this[Lo].dispatchEvent(t)}connectedCallback(){super.connectedCallback(),this[$s].addEventListener("user-interaction",this[Zs]),this[$s].addEventListener("pointer-change-start",this[tn]),this[$s].addEventListener("pointer-change-end",this[tn])}disconnectedCallback(){super.disconnectedCallback(),this[$s].removeEventListener("user-interaction",this[Zs]),this[$s].removeEventListener("pointer-change-start",this[tn]),this[$s].removeEventListener("pointer-change-end",this[tn])}updated(e){super.updated(e);const t=this[$s],s=this[_o];if(e.has("cameraControls")&&(this.cameraControls?(t.enableInteraction(),this.interactionPrompt===ks&&(this[sn]=!0)):(t.disableInteraction(),this[js]()),this[Lo].setAttribute("aria-label",this[Qo])),e.has("disableZoom")&&(t.disableZoom=this.disableZoom),e.has("disablePan")&&(t.enablePan=!this.disablePan),e.has("disableTap")&&(t.enableTap=!this.disableTap),(e.has("interactionPrompt")||e.has("cameraControls")||e.has("src"))&&(this.interactionPrompt===ks&&this.cameraControls&&!this[nn]?this[sn]=!0:this[js]()),e.has("interactionPromptStyle")&&(this[Ys].style.opacity=this.interactionPromptStyle==Us?"1":"0"),e.has("touchAction")){const e=this.touchAction;t.applyOptions({touchAction:e}),t.updateTouchActionStyle()}e.has("orbitSensitivity")&&(t.orbitSensitivity=this.orbitSensitivity),e.has("zoomSensitivity")&&(t.zoomSensitivity=this.zoomSensitivity),e.has("panSensitivity")&&(t.panSensitivity=this.panSensitivity),e.has("interpolationDecay")&&(t.setDamperDecayTime(this.interpolationDecay),s.setTargetDamperDecayTime(this.interpolationDecay)),!0===this[ln]&&Promise.resolve().then((()=>{t.jumpToGoal(),s.jumpToGoal(),this[en](),this[ln]=!1}))}async updateFraming(){const e=this[_o],t=e.adjustedFoV(e.framedFoVDeg);await e.updateFraming();const s=e.adjustedFoV(e.framedFoVDeg),r=this[$s].getFieldOfView()/t;this[$s].setFieldOfView(s*r),this[cn]=!0,this.requestUpdate("maxFieldOfView"),this.requestUpdate("fieldOfView"),this.requestUpdate("minCameraOrbit"),this.requestUpdate("maxCameraOrbit"),this.requestUpdate("cameraOrbit"),await this.updateComplete}interact(e,t,s){const r=this[Lo],o=this[zs];if("1"===o[0].style.opacity)return void Ts.warn("interact() failed because an existing interaction is running.");const A=new Array;A.push({x:timeline(t.x),y:timeline(t.y)});const l=[{x:A[0].x(0),y:A[0].y(0)}];null!=s&&(A.push({x:timeline(s.x),y:timeline(s.y)}),l.push({x:A[1].x(0),y:A[1].y(0)}));let h=performance.now();const{width:c,height:d}=this[_o],g=this.getBoundingClientRect(),dispatchTouches=e=>{for(const[t,s]of l.entries()){const{style:A}=o[t];A.transform=`translateX(${c*s.x}px) translateY(${d*s.y}px)`,"pointerdown"===e?A.opacity="1":"pointerup"===e&&(A.opacity="0");const l={pointerId:t-5678,pointerType:"touch",target:r,clientX:c*s.x+g.x,clientY:d*s.y+g.y,altKey:!0};r.dispatchEvent(new PointerEvent(e,l))}},moveTouches=()=>{const t=this[on];if(t!==vn.AUTOMATIC||!r.isConnected){for(const e of this[zs])e.style.opacity="0";return dispatchTouches("pointercancel"),this.dispatchEvent(new CustomEvent("interact-stopped",{detail:{source:t}})),void document.removeEventListener("visibilitychange",onVisibilityChange)}const s=Math.min(1,(performance.now()-h)/e);for(const[e,t]of l.entries())t.x=A[e].x(s),t.y=A[e].y(s);dispatchTouches("pointermove"),s<1?requestAnimationFrame(moveTouches):(dispatchTouches("pointerup"),this.dispatchEvent(new CustomEvent("interact-stopped",{detail:{source:vn.AUTOMATIC}})),document.removeEventListener("visibilitychange",onVisibilityChange))},onVisibilityChange=()=>{let e=0;"hidden"===document.visibilityState?e=performance.now()-h:h=performance.now()-e};document.addEventListener("visibilitychange",onVisibilityChange),dispatchTouches("pointerdown"),this[on]=vn.AUTOMATIC,requestAnimationFrame(moveTouches)}[(t=Ks,s=Ys,r=zs,A=Js,l=an,h=rn,c=nn,d=sn,g=on,p=$s,m=An,f=ln,I=hn,E=cn,dn)](e){const t=this[$s],s=this[_o];s.framedFoVDeg=180*e[0]/Math.PI,t.changeSource=vn.NONE,t.setFieldOfView(s.adjustedFoV(s.framedFoVDeg)),this[Zs]()}[un](e){const t=this[$s];if(this[cn]){const{theta:t,phi:s}=this.getCameraOrbit();e[0]=t,e[1]=s,this[cn]=!1}t.changeSource=vn.NONE,t.setOrbit(e[0],e[1],e[2]),this[Zs]()}[pn](e){this[$s].applyOptions({minimumAzimuthalAngle:e[0],minimumPolarAngle:e[1],minimumRadius:e[2]}),this.jumpCameraToGoal()}[mn](e){this[$s].applyOptions({maximumAzimuthalAngle:e[0],maximumPolarAngle:e[1],maximumRadius:e[2]}),this[Xs](e[2]),this.jumpCameraToGoal()}[fn](e){this[$s].applyOptions({minimumFieldOfView:180*e[0]/Math.PI}),this.jumpCameraToGoal()}[In](e){const t=this[_o].adjustedFoV(180*e[0]/Math.PI);this[$s].applyOptions({maximumFieldOfView:t}),this.jumpCameraToGoal()}[gn](e){const[t,s,r]=e;this[No].arRenderer.isPresenting||this[_o].setTarget(t,s,r),this[$s].changeSource=vn.NONE,this[No].arRenderer.updateTarget(),this[Zs]()}[Uo](e,t){if(super[Uo](e,t),this[No].isPresenting||!this[qo]())return;const s=this[$s],r=this[_o],o=performance.now();if(this[sn]&&this.loaded&&o>this[Mo]+this.interactionPromptThreshold&&(this[sn]=!1,this[rn]=o,this[Ks].classList.add("visible")),isFinite(this[rn])&&this.interactionPromptStyle===Gs){const e=(o-this[rn])/5e3%1,t=Rs(e),A=Ds(e);if(this[Ys].style.opacity=`${A}`,t!==this[an]){const e=t*r.width*.05,o=(t-this[an])*Math.PI/16;this[Ys].style.transform=`translateX(${e}px)`,s.changeSource=vn.AUTOMATIC,s.adjustOrbit(o,0,0),this[an]=t}}const A=s.update(e,t),l=r.updateTarget(t);(A||l)&&this[en]()}[js](){this[sn]=!1,this[Ks].classList.remove("visible"),this[rn]=1/0}[Xs](e){const t=Math.max(this[_o].farRadius(),e),s=Math.abs(2*t);this[$s].updateNearFar(0,s)}[Ws](){const{theta:e,phi:t}=this[$s].getCameraSpherical(this[An]),s=(4+Math.floor((e%Vs+qs)/Os))%4,r=Math.floor(t/Hs),o=Fs[s],A=_s[r];this[So](`View from stage ${A}${o}`)}get[Qo](){return super[Qo].replace(/\.$/,"")+(this.cameraControls?". Use mouse, touch or arrow keys to move.":"")}async[Po](e){const t=this[$s],s=this[_o],r=s.adjustedFoV(s.framedFoVDeg);super[Po](e);const o=s.adjustedFoV(s.framedFoVDeg)/r,A=t.getFieldOfView()*(isFinite(o)?o:1);t.updateAspect(this[_o].aspect),this.requestUpdate("maxFieldOfView",this.maxFieldOfView),await this.updateComplete,this[$s].setFieldOfView(A),this.jumpCameraToGoal()}[Go](){super[Go](),this[hn]?this[cn]=!0:this[hn]=!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()}}return C=Zs,B=en,y=tn,controls_decorate([n({type:Boolean,attribute:"camera-controls"})],ControlsModelViewerElement.prototype,"cameraControls",void 0),controls_decorate([style({intrinsics:Ns,observeEffects:!0,updateHandler:un}),n({type:String,attribute:"camera-orbit",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"cameraOrbit",void 0),controls_decorate([style({intrinsics:cameraTargetIntrinsics,observeEffects:!0,updateHandler:gn}),n({type:String,attribute:"camera-target",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"cameraTarget",void 0),controls_decorate([style({intrinsics:fieldOfViewIntrinsics,observeEffects:!0,updateHandler:dn}),n({type:String,attribute:"field-of-view",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"fieldOfView",void 0),controls_decorate([style({intrinsics:minCameraOrbitIntrinsics,updateHandler:pn}),n({type:String,attribute:"min-camera-orbit",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"minCameraOrbit",void 0),controls_decorate([style({intrinsics:maxCameraOrbitIntrinsics,updateHandler:mn}),n({type:String,attribute:"max-camera-orbit",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"maxCameraOrbit",void 0),controls_decorate([style({intrinsics:minFieldOfViewIntrinsics,updateHandler:fn}),n({type:String,attribute:"min-field-of-view",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"minFieldOfView",void 0),controls_decorate([style({intrinsics:fieldOfViewIntrinsics,updateHandler:In}),n({type:String,attribute:"max-field-of-view",hasChanged:()=>!0})],ControlsModelViewerElement.prototype,"maxFieldOfView",void 0),controls_decorate([n({type:Number,attribute:"interaction-prompt-threshold"})],ControlsModelViewerElement.prototype,"interactionPromptThreshold",void 0),controls_decorate([n({type:String,attribute:"interaction-prompt"})],ControlsModelViewerElement.prototype,"interactionPrompt",void 0),controls_decorate([n({type:String,attribute:"interaction-prompt-style"})],ControlsModelViewerElement.prototype,"interactionPromptStyle",void 0),controls_decorate([n({type:Number,attribute:"orbit-sensitivity"})],ControlsModelViewerElement.prototype,"orbitSensitivity",void 0),controls_decorate([n({type:Number,attribute:"zoom-sensitivity"})],ControlsModelViewerElement.prototype,"zoomSensitivity",void 0),controls_decorate([n({type:Number,attribute:"pan-sensitivity"})],ControlsModelViewerElement.prototype,"panSensitivity",void 0),controls_decorate([n({type:String,attribute:"touch-action"})],ControlsModelViewerElement.prototype,"touchAction",void 0),controls_decorate([n({type:Boolean,attribute:"disable-zoom"})],ControlsModelViewerElement.prototype,"disableZoom",void 0),controls_decorate([n({type:Boolean,attribute:"disable-pan"})],ControlsModelViewerElement.prototype,"disablePan",void 0),controls_decorate([n({type:Boolean,attribute:"disable-tap"})],ControlsModelViewerElement.prototype,"disableTap",void 0),controls_decorate([n({type:Number,attribute:"interpolation-decay"})],ControlsModelViewerElement.prototype,"interpolationDecay",void 0),ControlsModelViewerElement})((e=>{var t,s,r,o,A,l,h,c,d,g;class ARModelViewerElement extends e{constructor(){super(...arguments),this.ar=!1,this.arScale="auto",this.arPlacement="floor",this.arModes="webxr scene-viewer quick-look",this.iosSrc=null,this.xrEnvironment=!1,this[t]=!1,this[s]=this.shadowRoot.querySelector(".ar-button"),this[r]=document.createElement("a"),this[o]=new Set,this[A]=FA,this[l]=!1,this[h]=e=>{e.preventDefault(),this.activateAR()},this[c]=({status:e})=>{e!==bn&&this[No].arRenderer.presentedScene!==this[_o]||(this.setAttribute("ar-status",e),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:e}})),e===bn?this.removeAttribute("ar-tracking"):e===Sn&&this.setAttribute("ar-tracking",Rn))},this[d]=({status:e})=>{this.setAttribute("ar-tracking",e),this.dispatchEvent(new CustomEvent("ar-tracking",{detail:{status:e}}))},this[g]=e=>{"_apple_ar_quicklook_button_tapped"==e.data&&this.dispatchEvent(new CustomEvent("quick-look-button-tapped"))}}get canActivateAR(){return this[NA]!==FA}connectedCallback(){super.connectedCallback(),this[No].arRenderer.addEventListener("status",this[$A]),this.setAttribute("ar-status",bn),this[No].arRenderer.addEventListener("tracking",this[JA]),this[HA].addEventListener("message",this[KA])}disconnectedCallback(){super.disconnectedCallback(),this[No].arRenderer.removeEventListener("status",this[$A]),this[No].arRenderer.removeEventListener("tracking",this[JA]),this[HA].removeEventListener("message",this[KA])}update(e){super.update(e),e.has("arScale")&&(this[_o].canScale="fixed"!==this.arScale),e.has("arPlacement")&&(this[_o].updateShadow(),this[ko]()),e.has("arModes")&&(this[OA]=MA(this.arModes)),(e.has("ar")||e.has("arModes")||e.has("src")||e.has("iosSrc"))&&this[YA]()}async activateAR(){switch(this[NA]){case RA:await this[GA]();break;case LA:await this[kA]();break;case DA:this[UA]();break;default:QA.warn("No AR Mode can be activated. This is probably due to missing configuration or device capabilities")}}async[(t=PA,s=_A,r=HA,o=OA,A=NA,l=qA,h=VA,c=$A,d=JA,g=KA,YA)](){let e=FA;if(this.ar){if(null!=this.src)for(const t of this[OA]){if("webxr"===t&&we&&!xA&&await this[No].arRenderer.supportsPresentation()){e=LA;break}if("scene-viewer"===t&&Se&&!bA){e=DA;break}if("quick-look"===t&&Te){e=RA;break}}e===FA&&null!=this.iosSrc&&Te&&(e=RA)}if(e!==FA)this[_A].classList.add("enabled"),this[_A].addEventListener("click",this[VA]);else if(this[_A].classList.contains("enabled")){this[_A].removeEventListener("click",this[VA]),this[_A].classList.remove("enabled");const e=Tn;this.setAttribute("ar-status",e),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:e}}))}this[NA]=e}async[kA](){QA.log("Attempting to present in AR with WebXR..."),await this[zA]();try{this[_A].removeEventListener("click",this[VA]);const{arRenderer:e}=this[No];e.placeOnWall="wall"===this.arPlacement,await e.present(this[_o],this.xrEnvironment)}catch(e){QA.warn("Error while trying to present in AR with WebXR"),QA.error(e),await this[No].arRenderer.stopPresenting(),xA=!0,QA.warn("Falling back to next ar-mode"),await this[YA](),this.activateAR()}finally{this[YA]()}}async[zA](){this.loaded||(this[qA]=!0,this[To](),await((e,t,s=null)=>new Promise((r=>{e.addEventListener(t,(function handler(o){s&&!s(o)||(r(o),e.removeEventListener(t,handler))}))})))(this,"load"),this[qA]=!1)}[Vo](){return super[Vo]()||this[qA]}[UA](){const e=self.location.toString(),t=new URL(e),s=new URL(this.src,e);s.hash&&(s.hash="");const r=new URLSearchParams(s.search);if(t.hash=SA,r.set("mode","ar_preferred"),r.has("disable_occlusion")||r.set("disable_occlusion","true"),"fixed"===this.arScale&&r.set("resizable","false"),"wall"===this.arPlacement&&r.set("enable_vertical_placement","true"),r.has("sound")){const t=new URL(r.get("sound"),e);r.set("sound",t.toString())}if(r.has("link")){const t=new URL(r.get("link"),e);r.set("link",t.toString())}const o=`intent://arvr.google.com/scene-viewer/1.0?${r.toString()+"&file="+encodeURIComponent(s.toString())}#Intent;scheme=https;package=com.google.ar.core;action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(t.toString())};end;`;self.addEventListener("hashchange",(()=>{self.location.hash===SA&&(bA=!0,self.history.back(),QA.warn("Error while trying to present in AR with Scene Viewer"),QA.warn("Falling back to next ar-mode"),this[YA]())}),{once:!0}),this[HA].setAttribute("href",o),QA.log("Attempting to present in AR with Scene Viewer..."),this[HA].click()}async[GA](){const e=!this.iosSrc;this[_A].classList.remove("enabled");const t=e?await this.prepareUSDZ():this.iosSrc,s=new URL(t,self.location.toString());if(e){const e=self.location.toString(),t=new URL(e),r=new URL(this.src,t);r.hash&&(s.hash=r.hash)}"fixed"===this.arScale&&(s.hash&&(s.hash+="&"),s.hash+="allowsContentScaling=0");const r=this[HA];r.setAttribute("rel","ar");const o=document.createElement("img");r.appendChild(o),r.setAttribute("href",s.toString()),e&&r.setAttribute("download","model.usdz"),r.style.display="none",r.isConnected||this.shadowRoot.appendChild(r),QA.log("Attempting to present in AR with Quick Look..."),r.click(),r.removeChild(o),e&&URL.revokeObjectURL(t),this[_A].classList.add("enabled")}async prepareUSDZ(){const e=this[Oo].beginActivity("usdz-conversion");await this[zA]();const{model:t,shadow:s}=this[_o];if(null==t)return"";let r=!1;null!=s&&(r=s.visible,s.visible=!1),e(.2);const o=new USDZExporter,A=await o.parse(t),l=new Blob([A],{type:"model/vnd.usdz+zip"}),h=URL.createObjectURL(l);return e(1),null!=s&&(s.visible=r),h}}return ar_decorate([n({type:Boolean,attribute:"ar"})],ARModelViewerElement.prototype,"ar",void 0),ar_decorate([n({type:String,attribute:"ar-scale"})],ARModelViewerElement.prototype,"arScale",void 0),ar_decorate([n({type:String,attribute:"ar-placement"})],ARModelViewerElement.prototype,"arPlacement",void 0),ar_decorate([n({type:String,attribute:"ar-modes"})],ARModelViewerElement.prototype,"arModes",void 0),ar_decorate([n({type:String,attribute:"ios-src"})],ARModelViewerElement.prototype,"iosSrc",void 0),ar_decorate([n({type:Boolean,attribute:"xr-environment"})],ARModelViewerElement.prototype,"xrEnvironment",void 0),ARModelViewerElement})((e=>{var t,s,r,A,l,h,c,d;class LoadingModelViewerElement extends e{constructor(...e){super(...e),this.poster=null,this.reveal=jA,this.loading=WA,this[t]=!1,this[s]=!1,this[r]=this.shadowRoot.querySelector(".slot.poster"),this[A]=this.shadowRoot.querySelector("#default-poster"),this[l]=this.shadowRoot.querySelector("#default-progress-bar > .bar"),this[h]=this[tl].getAttribute("aria-label"),this[c]=((e,t)=>{let s=null;const throttled=(...r)=>{null==s&&(e(...r),s=self.setTimeout((()=>s=null),t))};return throttled.flush=()=>{null!=s&&(self.clearTimeout(s),s=null)},throttled})((e=>{const t=this[ZA].parentNode;requestAnimationFrame((()=>{this[ZA].style.transform=`scaleX(${e})`,0===e&&(t.removeChild(this[ZA]),t.appendChild(this[ZA])),this[ZA].classList.toggle("hide",1===e)}))}),100),this[d]=e=>{const t=e.detail.totalProgress;1===t&&(this[rl].flush(),this.loaded&&(this[il]||this.reveal===jA)&&this[sl]()),this[rl](t),this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:t}}))};const o=self.ModelViewerElement||{},g=o.dracoDecoderLocation||"https://www.gstatic.com/draco/versioned/decoders/1.5.6/";CachingGLTFLoader.setDRACODecoderLocation(g);const p=o.ktx2TranscoderLocation||"https://www.gstatic.com/basis-universal/versioned/2021-04-15-ba1c3e4/";CachingGLTFLoader.setKTX2TranscoderLocation(p),o.meshoptDecoderLocation&&CachingGLTFLoader.setMeshoptDecoderLocation(o.meshoptDecoderLocation);const m=o.lottieLoaderLocation||"https://cdn.jsdelivr.net/npm/three@0.149.0/examples/jsm/loaders/LottieLoader.js";Renderer.singleton.textureUtils.lottieLoaderUrl=m}static set dracoDecoderLocation(e){CachingGLTFLoader.setDRACODecoderLocation(e)}static get dracoDecoderLocation(){return CachingGLTFLoader.getDRACODecoderLocation()}static set ktx2TranscoderLocation(e){CachingGLTFLoader.setKTX2TranscoderLocation(e)}static get ktx2TranscoderLocation(){return CachingGLTFLoader.getKTX2TranscoderLocation()}static set meshoptDecoderLocation(e){CachingGLTFLoader.setMeshoptDecoderLocation(e)}static get meshoptDecoderLocation(){return CachingGLTFLoader.getMeshoptDecoderLocation()}static set lottieLoaderLocation(e){Renderer.singleton.textureUtils.lottieLoaderUrl=e}static get lottieLoaderLocation(){return Renderer.singleton.textureUtils.lottieLoaderUrl}static mapURLs(e){Renderer.singleton.loader[Zt].manager.setURLModifier(e)}dismissPoster(){this.loaded?this[sl]():(this[il]=!0,this[To]())}showPoster(){const e=this[el];if(e.classList.contains("show"))return;e.classList.add("show"),this[Lo].classList.remove("show");const t=this[tl];t.removeAttribute("tabindex"),t.removeAttribute("aria-hidden");const s=this.modelIsVisible;this[nl]=!1,this[vo](s)}getDimensions(){return toVector3D(this[_o].size)}getBoundingBoxCenter(){return toVector3D(this[_o].boundingBox.getCenter(new o.Pq0))}connectedCallback(){super.connectedCallback(),this.loaded||this.showPoster(),this[Oo].addEventListener("progress",this[ol])}disconnectedCallback(){super.disconnectedCallback(),this[Oo].removeEventListener("progress",this[ol])}async updated(e){super.updated(e),e.has("poster")&&null!=this.poster&&(this[tl].style.backgroundImage=`url(${this.poster})`),e.has("alt")&&this[tl].setAttribute("aria-label",this[xo]),(e.has("reveal")||e.has("loading"))&&this[To]()}[(t=nl,s=il,r=el,A=tl,l=ZA,h=al,c=rl,d=ol,Vo)](){return!!this.src&&(this[il]||this.loading===XA||this.reveal===jA&&this[wo])}[sl](){this[il]=!1;const e=this[el];if(!e.classList.contains("show"))return;e.classList.remove("show"),this[Lo].classList.add("show");const t=this.modelIsVisible;this[nl]=!0,this[vo](t);const s=this.getRootNode();s&&s.activeElement===this&&this[Lo].focus();const r=this[tl];r.setAttribute("aria-hidden","true"),r.tabIndex=-1,this.dispatchEvent(new CustomEvent("poster-dismissed"))}[qo](){return super[qo]()&&this[nl]}}return loading_decorate([n({type:String})],LoadingModelViewerElement.prototype,"poster",void 0),loading_decorate([n({type:String})],LoadingModelViewerElement.prototype,"reveal",void 0),loading_decorate([n({type:String})],LoadingModelViewerElement.prototype,"loading",void 0),LoadingModelViewerElement})((e=>{var t;class AnimationModelViewerElement extends e{constructor(...e){super(e),this.autoplay=!1,this.animationName=void 0,this.animationCrossfadeDuration=300,this[t]=!0,this[_o].subscribeMixerEvent("loop",(e=>{const t=e.action._loopCount;this.dispatchEvent(new CustomEvent("loop",{detail:{count:t}}))})),this[_o].subscribeMixerEvent("finished",(()=>{this[Jo]=!0,this.dispatchEvent(new CustomEvent("finished"))}))}get availableAnimations(){return this.loaded?this[_o].animationNames:[]}get duration(){return this[_o].duration}get paused(){return this[Jo]}get currentTime(){return this[_o].animationTime}set currentTime(e){this[_o].animationTime=e,this[ko]()}get timeScale(){return this[_o].animationTimeScale}set timeScale(e){this[_o].animationTimeScale=e}pause(){this[Jo]||(this[Jo]=!0,this.dispatchEvent(new CustomEvent("pause")))}play(e){this.availableAnimations.length>0&&(this[Jo]=!1,this[$o](e),this.dispatchEvent(new CustomEvent("play")))}[(t=Jo,Go)](){super[Go](),this[Jo]=!0,null!=this.animationName&&this[$o](),this.autoplay&&this.play()}[Uo](e,t){super[Uo](e,t),this[Jo]||!this[qo]()&&!this[No].isPresenting||(this[_o].updateAnimation(t/1e3),this[ko]())}updated(e){super.updated(e),e.has("autoplay")&&this.autoplay&&this.play(),e.has("animationName")&&this[$o]()}[$o](e=Ko){var t;const s=null!==(t=e.repetitions)&&void 0!==t?t:1/0,r=e.pingpong?o.lc7:1===s?o.G3T:o.aMy;this[_o].playAnimation(this.animationName,this.animationCrossfadeDuration/1e3,r,s),this[Jo]&&(this[_o].updateAnimation(0),this[ko]())}}return animation_decorate([n({type:Boolean})],AnimationModelViewerElement.prototype,"autoplay",void 0),animation_decorate([n({type:String,attribute:"animation-name"})],AnimationModelViewerElement.prototype,"animationName",void 0),animation_decorate([n({type:Number,attribute:"animation-crossfade-duration"})],AnimationModelViewerElement.prototype,"animationCrossfadeDuration",void 0),AnimationModelViewerElement})(ModelViewerElementBase))))))));customElements.define("model-viewer",gl)}}]);
|