UNPKG

@google/model-viewer

Version:

Easily display interactive 3D models on the web and in AR!

1,108 lines • 475 kB
import{NeutralToneMapping as e,ACESFilmicToneMapping as t,AgXToneMapping as i,ReinhardToneMapping as s,CineonToneMapping as a,LinearToneMapping as n,NoToneMapping as r,Loader as o,FileLoader as A,SRGBColorSpace as l,LinearSRGBColorSpace as c,BufferGeometry as h,BufferAttribute as d,InterleavedBuffer as g,InterleavedBufferAttribute as u,Color as p,ColorManagement as m,TrianglesDrawMode as b,TriangleFanDrawMode as f,TriangleStripDrawMode as I,LoaderUtils as E,MeshPhysicalMaterial as C,Vector2 as y,SpotLight as w,PointLight as B,DirectionalLight as x,Matrix4 as v,Vector3 as S,Quaternion as Q,InstancedMesh as M,InstancedBufferAttribute as D,Object3D as R,TextureLoader as T,ImageBitmapLoader as F,LinearMipmapLinearFilter as k,NearestMipmapLinearFilter as L,LinearMipmapNearestFilter as P,NearestMipmapNearestFilter as _,LinearFilter as U,NearestFilter as G,RepeatWrapping as N,MirroredRepeatWrapping as O,ClampToEdgeWrapping as q,PointsMaterial as H,Material as j,LineBasicMaterial as z,MeshStandardMaterial as K,DoubleSide as V,MeshBasicMaterial as J,PropertyBinding as Y,SkinnedMesh as W,Mesh as X,LineSegments as $,Line as Z,LineLoop as ee,Points as te,Group as ie,PerspectiveCamera as se,MathUtils as ae,OrthographicCamera as ne,Skeleton as re,AnimationClip as oe,Bone as Ae,InterpolateDiscrete as le,InterpolateLinear as ce,Texture as he,VectorKeyframeTrack as de,NumberKeyframeTrack as ge,QuaternionKeyframeTrack as ue,FrontSide as pe,Interpolant as me,Box3 as be,Sphere as fe,CompressedCubeTexture as Ie,CompressedArrayTexture as Ee,CompressedTexture as Ce,NoColorSpace as ye,RGBA_PVRTC_2BPPV1_Format as we,RGBA_PVRTC_4BPPV1_Format as Be,RGBA_BPTC_Format as xe,RED_GREEN_RGTC2_Format as ve,SIGNED_RED_GREEN_RGTC2_Format as Se,RED_RGTC1_Format as Qe,SIGNED_RED_RGTC1_Format as Me,RGBA_S3TC_DXT5_Format as De,RGB_S3TC_DXT1_Format as Re,RGBA_S3TC_DXT1_Format as Te,RGBA_ASTC_6x6_Format as Fe,RGBA_ASTC_4x4_Format as ke,SIGNED_RG11_EAC_Format as Le,RG11_EAC_Format as Pe,SIGNED_R11_EAC_Format as _e,R11_EAC_Format as Ue,RGB_ETC2_Format as Ge,RGBA_ETC2_EAC_Format as Ne,RGBFormat as Oe,RedFormat as qe,RGFormat as He,RGBAFormat as je,UnsignedByteType as ze,HalfFloatType as Ke,UnsignedInt101111Type as Ve,UnsignedInt5999Type as Je,FloatType as Ye,DataTexture as We,Data3DTexture as Xe,RGB_PVRTC_4BPPV1_Format as $e,RGB_ETC1_Format as Ze,RGB_BPTC_UNSIGNED_Format as et,EventDispatcher as tt,REVISION as it,Source as st,ImageUtils as at,Scene as nt,PlaneGeometry as rt,ShaderMaterial as ot,Uniform as At,WebGLRenderer as lt,CanvasTexture as ct,LightProbe as ht,WebGLCubeRenderTarget as dt,AdditiveBlending as gt,NormalBlending as ut,Float32BufferAttribute as pt,BoxGeometry as mt,Spherical as bt,Matrix3 as ft,Euler as It,ShapeGeometry as Et,Shape as Ct,WebGLRenderTarget as yt,UVMapping as wt,IntType as Bt,ShortType as xt,ByteType as vt,UnsignedIntType as St,LoadingManager as Qt,LinearMipMapLinearFilter as Mt,NoBlending as Dt,DataTextureLoader as Rt,DataUtils as Tt,BackSide as Ft,EquirectangularReflectionMapping as kt,CubeCamera as Lt,VideoTexture as Pt,SphereGeometry as _t,Triangle as Ut,MeshDepthMaterial as Gt,Raycaster as Nt,LoopPingPong as Ot,LoopRepeat as qt,AnimationMixer as Ht,LoopOnce as jt}from"three";export{CanvasTexture,FileLoader,Loader,NearestFilter}from"three";
/**
 * @license
 * Copyright 2019 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */const zt=globalThis,Kt=zt.ShadowRoot&&(void 0===zt.ShadyCSS||zt.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Vt=Symbol(),Jt=new WeakMap;let Yt=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==Vt)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(Kt&&void 0===e){const i=void 0!==t&&1===t.length;i&&(e=Jt.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&Jt.set(t,e))}return e}toString(){return this.cssText}};const Wt=Kt?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return(e=>new Yt("string"==typeof e?e:e+"",void 0,Vt))(t)})(e):e,{is:Xt,defineProperty:$t,getOwnPropertyDescriptor:Zt,getOwnPropertyNames:ei,getOwnPropertySymbols:ti,getPrototypeOf:ii}=Object,si=globalThis,ai=si.trustedTypes,ni=ai?ai.emptyScript:"",ri=si.reactiveElementPolyfillSupport,oi=(e,t)=>e,Ai={toAttribute(e,t){switch(t){case Boolean:e=e?ni:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let i=e;switch(t){case Boolean:i=null!==e;break;case Number:i=null===e?null:Number(e);break;case Object:case Array:try{i=JSON.parse(e)}catch(e){i=null}}return i}},li=(e,t)=>!Xt(e,t),ci={attribute:!0,type:String,converter:Ai,reflect:!1,useDefault:!1,hasChanged:li};
/**
 * @license
 * Copyright 2017 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */Symbol.metadata??=Symbol("metadata"),si.litPropertyMetadata??=new WeakMap;let hi=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=ci){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const i=Symbol(),s=this.getPropertyDescriptor(e,i,t);void 0!==s&&$t(this.prototype,e,s)}}static getPropertyDescriptor(e,t,i){const{get:s,set:a}=Zt(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:s,set(t){const n=s?.call(this);a?.call(this,t),this.requestUpdate(e,n,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??ci}static _$Ei(){if(this.hasOwnProperty(oi("elementProperties")))return;const e=ii(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(oi("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(oi("properties"))){const e=this.properties,t=[...ei(e),...ti(e)];for(const i of t)this.createProperty(i,e[i])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,i]of t)this.elementProperties.set(e,i)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const i=this._$Eu(e,t);void 0!==i&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const e of i)t.unshift(Wt(e))}else void 0!==e&&t.push(Wt(e));return t}static _$Eu(e,t){const i=t.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{if(Kt)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const i of t){const t=document.createElement("style"),s=zt.litNonce;void 0!==s&&t.setAttribute("nonce",s),t.textContent=i.cssText,e.appendChild(t)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$ET(e,t){const i=this.constructor.elementProperties.get(e),s=this.constructor._$Eu(e,i);if(void 0!==s&&!0===i.reflect){const a=(void 0!==i.converter?.toAttribute?i.converter:Ai).toAttribute(t,i.type);this._$Em=e,null==a?this.removeAttribute(s):this.setAttribute(s,a),this._$Em=null}}_$AK(e,t){const i=this.constructor,s=i._$Eh.get(e);if(void 0!==s&&this._$Em!==s){const e=i.getPropertyOptions(s),a="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:Ai;this._$Em=s;const n=a.fromAttribute(t,e.type);this[s]=n??this._$Ej?.get(s)??n,this._$Em=null}}requestUpdate(e,t,i,s=!1,a){if(void 0!==e){const n=this.constructor;if(!1===s&&(a=this[e]),i??=n.getPropertyOptions(e),!((i.hasChanged??li)(a,t)||i.useDefault&&i.reflect&&a===this._$Ej?.get(e)&&!this.hasAttribute(n._$Eu(e,i))))return;this.C(e,t,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:i,reflect:s,wrapped:a},n){i&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,n??t??this[e]),!0!==a||void 0!==n)||(this._$AL.has(e)||(this.hasUpdated||i||(t=void 0),this._$AL.set(e,t)),!0===s&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,i]of e){const{wrapped:e}=i,s=this[t];!0!==e||this._$AL.has(t)||void 0===s||this.C(t,void 0,i,s)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}};hi.elementStyles=[],hi.shadowRootOptions={mode:"open"},hi[oi("elementProperties")]=new Map,hi[oi("finalized")]=new Map,ri?.({ReactiveElement:hi}),(si.reactiveElementVersions??=[]).push("2.1.2");
/**
 * @license
 * Copyright 2017 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */
const di=globalThis,gi=e=>e,ui=di.trustedTypes,pi=ui?ui.createPolicy("lit-html",{createHTML:e=>e}):void 0,mi="$lit$",bi=`lit$${Math.random().toFixed(9).slice(2)}$`,fi="?"+bi,Ii=`<${fi}>`,Ei=document,Ci=()=>Ei.createComment(""),yi=e=>null===e||"object"!=typeof e&&"function"!=typeof e,wi=Array.isArray,Bi="[ \t\n\f\r]",xi=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,vi=/-->/g,Si=/>/g,Qi=RegExp(`>|${Bi}(?:([^\\s"'>=/]+)(${Bi}*=${Bi}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),Mi=/'/g,Di=/"/g,Ri=/^(?:script|style|textarea|title)$/i,Ti=(e=>(t,...i)=>({_$litType$:e,strings:t,values:i}))(1),Fi=Symbol.for("lit-noChange"),ki=Symbol.for("lit-nothing"),Li=new WeakMap,Pi=Ei.createTreeWalker(Ei,129);function _i(e,t){if(!wi(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==pi?pi.createHTML(t):t}const Ui=(e,t)=>{const i=e.length-1,s=[];let a,n=2===t?"<svg>":3===t?"<math>":"",r=xi;for(let t=0;t<i;t++){const i=e[t];let o,A,l=-1,c=0;for(;c<i.length&&(r.lastIndex=c,A=r.exec(i),null!==A);)c=r.lastIndex,r===xi?"!--"===A[1]?r=vi:void 0!==A[1]?r=Si:void 0!==A[2]?(Ri.test(A[2])&&(a=RegExp("</"+A[2],"g")),r=Qi):void 0!==A[3]&&(r=Qi):r===Qi?">"===A[0]?(r=a??xi,l=-1):void 0===A[1]?l=-2:(l=r.lastIndex-A[2].length,o=A[1],r=void 0===A[3]?Qi:'"'===A[3]?Di:Mi):r===Di||r===Mi?r=Qi:r===vi||r===Si?r=xi:(r=Qi,a=void 0);const h=r===Qi&&e[t+1].startsWith("/>")?" ":"";n+=r===xi?i+Ii:l>=0?(s.push(o),i.slice(0,l)+mi+i.slice(l)+bi+h):i+bi+(-2===l?t:h)}return[_i(e,n+(e[i]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),s]};let Gi=class e{constructor({strings:t,_$litType$:i},s){let a;this.parts=[];let n=0,r=0;const o=t.length-1,A=this.parts,[l,c]=Ui(t,i);if(this.el=e.createElement(l,s),Pi.currentNode=this.el.content,2===i||3===i){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(a=Pi.nextNode())&&A.length<o;){if(1===a.nodeType){if(a.hasAttributes())for(const e of a.getAttributeNames())if(e.endsWith(mi)){const t=c[r++],i=a.getAttribute(e).split(bi),s=/([.?@])?(.*)/.exec(t);A.push({type:1,index:n,name:s[2],strings:i,ctor:"."===s[1]?ji:"?"===s[1]?zi:"@"===s[1]?Ki:Hi}),a.removeAttribute(e)}else e.startsWith(bi)&&(A.push({type:6,index:n}),a.removeAttribute(e));if(Ri.test(a.tagName)){const e=a.textContent.split(bi),t=e.length-1;if(t>0){a.textContent=ui?ui.emptyScript:"";for(let i=0;i<t;i++)a.append(e[i],Ci()),Pi.nextNode(),A.push({type:2,index:++n});a.append(e[t],Ci())}}}else if(8===a.nodeType)if(a.data===fi)A.push({type:2,index:n});else{let e=-1;for(;-1!==(e=a.data.indexOf(bi,e+1));)A.push({type:7,index:n}),e+=bi.length-1}n++}}static createElement(e,t){const i=Ei.createElement("template");return i.innerHTML=e,i}};function Ni(e,t,i=e,s){if(t===Fi)return t;let a=void 0!==s?i._$Co?.[s]:i._$Cl;const n=yi(t)?void 0:t._$litDirective$;return a?.constructor!==n&&(a?._$AO?.(!1),void 0===n?a=void 0:(a=new n(e),a._$AT(e,i,s)),void 0!==s?(i._$Co??=[])[s]=a:i._$Cl=a),void 0!==a&&(t=Ni(e,a._$AS(e,t.values),a,s)),t}class Oi{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:i}=this._$AD,s=(e?.creationScope??Ei).importNode(t,!0);Pi.currentNode=s;let a=Pi.nextNode(),n=0,r=0,o=i[0];for(;void 0!==o;){if(n===o.index){let t;2===o.type?t=new qi(a,a.nextSibling,this,e):1===o.type?t=new o.ctor(a,o.name,o.strings,this,e):6===o.type&&(t=new Vi(a,this,e)),this._$AV.push(t),o=i[++r]}n!==o?.index&&(a=Pi.nextNode(),n++)}return Pi.currentNode=Ei,s}p(e){let t=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}}class qi{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,i,s){this.type=2,this._$AH=ki,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Ni(this,e,t),yi(e)?e===ki||null==e||""===e?(this._$AH!==ki&&this._$AR(),this._$AH=ki):e!==this._$AH&&e!==Fi&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>wi(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==ki&&yi(this._$AH)?this._$AA.nextSibling.data=e:this.T(Ei.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:i}=e,s="number"==typeof i?this._$AC(e):(void 0===i.el&&(i.el=Gi.createElement(_i(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===s)this._$AH.p(t);else{const e=new Oi(s,this),i=e.u(this.options);e.p(t),this.T(i),this._$AH=e}}_$AC(e){let t=Li.get(e.strings);return void 0===t&&Li.set(e.strings,t=new Gi(e)),t}k(e){wi(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,s=0;for(const a of e)s===t.length?t.push(i=new qi(this.O(Ci()),this.O(Ci()),this,this.options)):i=t[s],i._$AI(a),s++;s<t.length&&(this._$AR(i&&i._$AB.nextSibling,s),t.length=s)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const t=gi(e).nextSibling;gi(e).remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}}class Hi{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,s,a){this.type=1,this._$AH=ki,this._$AN=void 0,this.element=e,this.name=t,this._$AM=s,this.options=a,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=ki}_$AI(e,t=this,i,s){const a=this.strings;let n=!1;if(void 0===a)e=Ni(this,e,t,0),n=!yi(e)||e!==this._$AH&&e!==Fi,n&&(this._$AH=e);else{const s=e;let r,o;for(e=a[0],r=0;r<a.length-1;r++)o=Ni(this,s[i+r],t,r),o===Fi&&(o=this._$AH[r]),n||=!yi(o)||o!==this._$AH[r],o===ki?e=ki:e!==ki&&(e+=(o??"")+a[r+1]),this._$AH[r]=o}n&&!s&&this.j(e)}j(e){e===ki?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}let ji=class extends Hi{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===ki?void 0:e}};class zi extends Hi{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==ki)}}class Ki extends Hi{constructor(e,t,i,s,a){super(e,t,i,s,a),this.type=5}_$AI(e,t=this){if((e=Ni(this,e,t,0)??ki)===Fi)return;const i=this._$AH,s=e===ki&&i!==ki||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,a=e!==ki&&(i===ki||s);s&&this.element.removeEventListener(this.name,this,i),a&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class Vi{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){Ni(this,e)}}const Ji=di.litHtmlPolyfillSupport;Ji?.(Gi,qi),(di.litHtmlVersions??=[]).push("3.3.3");const Yi=(e,t,i)=>{const s=i?.renderBefore??t;let a=s._$litPart$;if(void 0===a){const e=i?.renderBefore??null;s._$litPart$=a=new qi(t.insertBefore(Ci(),e),e,void 0,i??{})}return a._$AI(e),a
/**
 * @license
 * Copyright 2017 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */},Wi=globalThis;let Xi=class extends hi{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Yi(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Fi}};Xi._$litElement$=!0,Xi.finalized=!0,Wi.litElementHydrateSupport?.({LitElement:Xi});const $i=Wi.litElementPolyfillSupport;$i?.({LitElement:Xi}),(Wi.litElementVersions??=[]).push("4.2.2");
/**
 * @license
 * Copyright 2017 Google LLC
 * SPDX-License-Identifier: BSD-3-Clause
 */
const Zi={attribute:!0,type:String,converter:Ai,reflect:!1,hasChanged:li},es=(e=Zi,t,i)=>{const{kind:s,metadata:a}=i;let n=globalThis.litPropertyMetadata.get(a);if(void 0===n&&globalThis.litPropertyMetadata.set(a,n=new Map),"setter"===s&&((e=Object.create(e)).wrapped=!0),n.set(i.name,e),"accessor"===s){const{name:s}=i;return{set(i){const a=t.get.call(this);t.set.call(this,i),this.requestUpdate(s,a,e,!0,i)},init(t){return void 0!==t&&this.C(s,void 0,e,t),t}}}if("setter"===s){const{name:s}=i;return function(i){const a=this[s];t.call(this,i),this.requestUpdate(s,a,e,!0,i)}}throw Error("Unsupported decorator location: "+s)};function ts(e){return(t,i)=>"object"==typeof i?es(e,t,i):((e,t,i)=>{const s=t.hasOwnProperty(i);return t.constructor.createProperty(i,e),s?Object.getOwnPropertyDescriptor(t,i):void 0})(e,t,i)}
/* @license
 * Copyright 2026 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */var is=function(e,t,i,s){for(var a,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s,o=e.length-1;o>=0;o--)(a=e[o])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};class ss extends hi{constructor(){super(...arguments),this.src=null,this.offset=null,this.orientation=null,this.scale=null,this.background=!1}static get is(){return"extra-model"}updated(e){if(super.updated(e),e.has("src")||e.has("offset")||e.has("orientation")||e.has("scale")||e.has("background")){const t=e.has("src");this.dispatchEvent(new CustomEvent("extra-model-changed",{bubbles:!0,composed:!0,detail:{srcChanged:t,src:this.src,offset:this.offset,orientation:this.orientation,scale:this.scale,background:this.background}}))}}}is([ts({type:String})],ss.prototype,"src",void 0),is([ts({type:String})],ss.prototype,"offset",void 0),is([ts({type:String})],ss.prototype,"orientation",void 0),is([ts({type:String})],ss.prototype,"scale",void 0),is([ts({type:Boolean})],ss.prototype,"background",void 0),customElements.define("extra-model",ss);
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const as=null!=navigator.xr&&null!=self.XRSession&&null!=navigator.xr.isSessionSupported,ns=as&&null!=self.XRSession.prototype.requestHitTestSource,rs=null!=self.ResizeObserver,os=null!=self.IntersectionObserver,As=ns;(()=>{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)})();const ls=/android/i.test(navigator.userAgent),cs=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!self.MSStream||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1,hs=/firefox/i.test(navigator.userAgent),ds=/OculusBrowser/.test(navigator.userAgent),gs=cs&&/CriOS\/|EdgiOS\/|FxiOS\/|GSA\/|DuckDuckGo\//.test(navigator.userAgent),us=cs&&/GSA\//.test(navigator.userAgent),ps=ls&&!hs&&!ds;Boolean(window.webkit&&window.webkit.messageHandlers);const ms=(()=>{if(cs){if(gs)return!0;const e=document.createElement("a");return Boolean(e.relList&&e.relList.supports&&e.relList.supports("ar"))}return!1})(),bs=e=>e&&"null"!==e?Is(e):null,fs=()=>{if(As)return;const e=[];throw as||e.push("WebXR Device API"),ns||e.push("WebXR Hit Test API"),new Error(`The following APIs are required for AR, but are missing in this browser: ${e.join(", ")}`)},Is=e=>new URL(e,window.location.toString()).toString(),Es=(e,t)=>{let i=null;return(...s)=>{null!=i&&self.clearTimeout(i),i=self.setTimeout(()=>{i=null,e(...s)},t)}},Cs=(e,t,i)=>Math.max(t,Math.min(i,e)),ys=(()=>{const e=new RegExp("[?&]model-viewer-debug-mode(&|$)");return()=>self.ModelViewerElement&&self.ModelViewerElement.debugMode||self.location&&self.location.search&&self.location.search.match(e)})();
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
var ws=function(e,t,i,s){for(var a,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s,o=e.length-1;o>=0;o--)(a=e[o])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};const Bs=Symbol("currentEnvironmentMap"),xs=Symbol("currentBackground"),vs=Symbol("updateEnvironment"),Ss=Symbol("cancelEnvironmentUpdate");
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const Qs=Ti`
<style>
:host {
  display: block;
  position: relative;
  contain: strict;
  width: 300px;
  height: 150px;
}

.container {
  position: relative;
  overflow: hidden;
}

.userInput {
  width: 100%;
  height: 100%;
  display: none;
  position: relative;
  outline-offset: -1px;
  outline-width: 1px;
}

canvas {
  position: absolute;
  display: none;
  pointer-events: none;
  /* NOTE(cdata): Chrome 76 and below apparently have a bug
   * that causes our canvas not to display pixels unless it is
   * on its own render layer
   * @see https://github.com/google/model-viewer/pull/755#issuecomment-536597893
   */
  transform: translateZ(0);
}

.show {
  display: block;
}

/* Adapted from HTML5 Boilerplate
 *
 * @see https://github.com/h5bp/html5-boilerplate/blob/ceb4620c78fc82e13534fc44202a3f168754873f/dist/css/main.css#L122-L133 */
.screen-reader-only {
  border: 0;
  left: 0;
  top: 0;
  clip: rect(0, 0, 0, 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
  pointer-events: none;
}

.slot {
  position: absolute;
  pointer-events: none;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.slot > * {
  pointer-events: initial;
}

.annotation-wrapper ::slotted(*) {
  opacity: var(--max-hotspot-opacity, 1);
  transition: opacity 0.3s;
}

.pointer-tumbling .annotation-wrapper ::slotted(*) {
  pointer-events: none;
}

.annotation-wrapper ::slotted(*) {
  pointer-events: initial;
}

.annotation-wrapper.hide:not(:focus-within) ::slotted(*) {
  opacity: var(--min-hotspot-opacity, 0.25);
}

.slot.poster {
  display: none;
  background-color: inherit;
}

.slot.poster.show {
  display: inherit;
}

.slot.poster > * {
  pointer-events: initial;
}

.slot.poster:not(.show) > * {
  pointer-events: none;
}

#default-poster {
  width: 100%;
  height: 100%;
  /* The default poster is a <button> so we need to set display
   * to prevent it from being affected by text-align: */
  display: block;
  position: absolute;
  border: none;
  padding: 0;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  background-color: #fff0;
}

#default-progress-bar {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
}

#default-progress-bar > .bar {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--progress-bar-height, 5px);
  background-color: var(--progress-bar-color, rgba(0, 0, 0, 0.4));
  transition: transform 0.09s;
  transform-origin: top left;
  transform: scaleX(0);
  overflow: hidden;
}

#default-progress-bar > .bar.hide {
  transition: opacity 0.3s 1s;
  opacity: 0;
}

.centered {
  align-items: center;
  justify-content: center;
}

.cover {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.slot.interaction-prompt {
  display: var(--interaction-prompt-display, flex);
  overflow: hidden;
  opacity: 0;
  will-change: opacity;
  transition: opacity 0.3s;
}

.slot.interaction-prompt.visible {
  opacity: 1;
}

.animated-container {
  will-change: transform, opacity;
  opacity: 0;
  transition: opacity 0.3s;
}

.slot.interaction-prompt > * {
  pointer-events: none;
}

.slot.ar-button {
  -moz-user-select: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;

  display: var(--ar-button-display, block);
}

.slot.ar-button:not(.enabled) {
  display: none;
}

.fab {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 40px;
  height: 40px;
  cursor: pointer;
  background-color: #fff;
  box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.15);
  border-radius: 100px;
}

.fab > * {
  opacity: 0.87;
}

#default-ar-button {
  position: absolute;
  bottom: 16px;
  right: 16px;
  transform: scale(var(--ar-button-scale, 1));
  transform-origin: bottom right;
}

.slot.pan-target {
  display: block;
  position: absolute;
  width: 0;
  height: 0;
  left: 50%;
  top: 50%;
  transform: translate3d(-50%, -50%, 0);
  background-color: transparent;
  opacity: 0;
  transition: opacity 0.3s;
}

#default-pan-target {
  width: 6px;
  height: 6px;
  border-radius: 6px;
  border: 1px solid white;
  box-shadow: 0px 0px 2px 1px rgba(0, 0, 0, 0.8);
}

.slot.default {
  pointer-events: none;
}

.slot.progress-bar {
  pointer-events: none;
}

.slot.exit-webxr-ar-button {
  pointer-events: none;
}

.slot.exit-webxr-ar-button > slot,
.slot.exit-webxr-ar-button ::slotted(*) {
  pointer-events: auto;
}

.slot.exit-webxr-ar-button:not(.enabled) {
  display: none;
}

#default-exit-webxr-ar-button {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: env(safe-area-inset-top, 16px);
  right: 16px;
  width: 40px;
  height: 40px;
  box-sizing: border-box;
}

#default-exit-webxr-ar-button > svg {
  fill: #fff;
}
</style>
<div class="container">
  <div class="userInput" tabindex="0" role="img"
      aria-label="3D model">
      <div class="slot canvas">
        <slot name="canvas">
          <canvas></canvas>
        </slot>
      </div>

  </div>

  <!-- NOTE(cdata): We need to wrap slots because browsers without ShadowDOM
        will have their <slot> elements removed by ShadyCSS -->
  <div class="slot poster">
    <slot name="poster">
      <button type="button" id="default-poster" aria-hidden="true" aria-label="Loading 3D model"></button>
    </slot>
  </div>

  <div class="slot ar-button">
    <slot name="ar-button">
      <a id="default-ar-button" part="default-ar-button" class="fab"
          tabindex="2"
          role="button"
          href="javascript:void(0);"
          aria-label="View in your space">
        ${Ti`
<svg version="1.1" id="view_x5F_in_x5F_AR_x5F_icon"
	 xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px"
	 viewBox="0 0 24 24" enable-background="new 0 0 24 24" xml:space="preserve">
<rect id="Bounding_Box" x="0" y="0" fill="none" width="24" height="24"/>
<g id="Art_layer">
	<path d="M3,4c0-0.55,0.45-1,1-1h2V1H4C2.35,1,1,2.35,1,4v2h2V4z"/>
	<path d="M20,3c0.55,0,1,0.45,1,1v2h2V4c0-1.65-1.35-3-3-3h-2v2H20z"/>
	<path d="M4,21c-0.55,0-1-0.45-1-1v-2H1v2c0,1.65,1.35,3,3,3h2v-2H4z"/>
	<path d="M20,21c0.55,0,1-0.45,1-1v-2h2v2c0,1.65-1.35,3-3,3h-2v-2H20z"/>
	<g>
		<path d="M18.25,7.6l-5.5-3.18c-0.46-0.27-1.04-0.27-1.5,0L5.75,7.6C5.29,7.87,5,8.36,5,8.9v6.35c0,0.54,0.29,1.03,0.75,1.3
			l5.5,3.18c0.46,0.27,1.04,0.27,1.5,0l5.5-3.18c0.46-0.27,0.75-0.76,0.75-1.3V8.9C19,8.36,18.71,7.87,18.25,7.6z M7,14.96v-4.62
			l4,2.32v4.61L7,14.96z M12,10.93L8,8.61l4-2.31l4,2.31L12,10.93z M13,17.27v-4.61l4-2.32v4.62L13,17.27z"/>
	</g>
</g>
</svg>`}
      </a>
    </slot>
  </div>

  <div class="slot pan-target">
    <slot name="pan-target">
      <div id="default-pan-target">
      </div>
    </slot>
  </div>

  <div class="slot interaction-prompt cover centered">
    <div id="prompt" class="animated-container">
      <slot name="interaction-prompt" aria-hidden="true">
        ${Ti`
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="25" height="36">
    <defs>
        <path id="A" d="M.001.232h24.997V36H.001z" />
    </defs>
    <g transform="translate(-11 -4)" fill="none" fill-rule="evenodd">
        <path fill-opacity="0" fill="#fff" d="M0 0h44v44H0z" />
        <g transform="translate(11 3)">
            <path d="M8.733 11.165c.04-1.108.766-2.027 1.743-2.307a2.54 2.54 0 0 1 .628-.089c.16 0 .314.017.463.044 1.088.2 1.9 1.092 1.9 2.16v8.88h1.26c2.943-1.39 5-4.45 5-8.025a9.01 9.01 0 0 0-1.9-5.56l-.43-.5c-.765-.838-1.683-1.522-2.712-2-1.057-.49-2.226-.77-3.46-.77s-2.4.278-3.46.77c-1.03.478-1.947 1.162-2.71 2l-.43.5a9.01 9.01 0 0 0-1.9 5.56 9.04 9.04 0 0 0 .094 1.305c.03.21.088.41.13.617l.136.624c.083.286.196.56.305.832l.124.333a8.78 8.78 0 0 0 .509.953l.065.122a8.69 8.69 0 0 0 3.521 3.191l1.11.537v-9.178z" fill-opacity=".5" fill="#e4e4e4" />
            <path d="M22.94 26.218l-2.76 7.74c-.172.485-.676.8-1.253.8H12.24c-1.606 0-3.092-.68-3.98-1.82-1.592-2.048-3.647-3.822-6.11-5.27-.095-.055-.15-.137-.152-.23-.004-.1.046-.196.193-.297.56-.393 1.234-.6 1.926-.6a3.43 3.43 0 0 1 .691.069l4.922.994V10.972c0-.663.615-1.203 1.37-1.203s1.373.54 1.373 1.203v9.882h2.953c.273 0 .533.073.757.21l6.257 3.874c.027.017.045.042.07.06.41.296.586.77.426 1.22M4.1 16.614c-.024-.04-.042-.083-.065-.122a8.69 8.69 0 0 1-.509-.953c-.048-.107-.08-.223-.124-.333l-.305-.832c-.058-.202-.09-.416-.136-.624l-.13-.617a9.03 9.03 0 0 1-.094-1.305c0-2.107.714-4.04 1.9-5.56l.43-.5c.764-.84 1.682-1.523 2.71-2 1.058-.49 2.226-.77 3.46-.77s2.402.28 3.46.77c1.03.477 1.947 1.16 2.712 2l.428.5a9 9 0 0 1 1.901 5.559c0 3.577-2.056 6.636-5 8.026h-1.26v-8.882c0-1.067-.822-1.96-1.9-2.16-.15-.028-.304-.044-.463-.044-.22 0-.427.037-.628.09-.977.28-1.703 1.198-1.743 2.306v9.178l-1.11-.537C6.18 19.098 4.96 18 4.1 16.614M22.97 24.09l-6.256-3.874c-.102-.063-.218-.098-.33-.144 2.683-1.8 4.354-4.855 4.354-8.243 0-.486-.037-.964-.104-1.43a9.97 9.97 0 0 0-1.57-4.128l-.295-.408-.066-.092a10.05 10.05 0 0 0-.949-1.078c-.342-.334-.708-.643-1.094-.922-1.155-.834-2.492-1.412-3.94-1.65l-.732-.088-.748-.03a9.29 9.29 0 0 0-1.482.119c-1.447.238-2.786.816-3.94 1.65a9.33 9.33 0 0 0-.813.686 9.59 9.59 0 0 0-.845.877l-.385.437-.36.5-.288.468-.418.778-.04.09c-.593 1.28-.93 2.71-.93 4.222 0 3.832 2.182 7.342 5.56 8.938l1.437.68v4.946L5 25.64a4.44 4.44 0 0 0-.888-.086c-.017 0-.034.003-.05.003-.252.004-.503.033-.75.08a5.08 5.08 0 0 0-.237.056c-.193.046-.382.107-.568.18-.075.03-.15.057-.225.1-.25.114-.494.244-.723.405a1.31 1.31 0 0 0-.566 1.122 1.28 1.28 0 0 0 .645 1.051C4 29.925 5.96 31.614 7.473 33.563a5.06 5.06 0 0 0 .434.491c1.086 1.082 2.656 1.713 4.326 1.715h6.697c.748-.001 1.43-.333 1.858-.872.142-.18.256-.38.336-.602l2.757-7.74c.094-.26.13-.53.112-.794s-.088-.52-.203-.76a2.19 2.19 0 0 0-.821-.91" fill-opacity=".6" fill="#000" />
            <path d="M22.444 24.94l-6.257-3.874a1.45 1.45 0 0 0-.757-.211h-2.953v-9.88c0-.663-.616-1.203-1.373-1.203s-1.37.54-1.37 1.203v16.643l-4.922-.994a3.44 3.44 0 0 0-.692-.069 3.35 3.35 0 0 0-1.925.598c-.147.102-.198.198-.194.298.004.094.058.176.153.23 2.462 1.448 4.517 3.22 6.11 5.27.887 1.14 2.373 1.82 3.98 1.82h6.686c.577 0 1.08-.326 1.253-.8l2.76-7.74c.16-.448-.017-.923-.426-1.22-.025-.02-.043-.043-.07-.06z" fill="#fff" />
            <g transform="translate(0 .769)">
                <mask id="B" fill="#fff">
                    <use xlink:href="#A" />
                </mask>
                <path d="M23.993 24.992a1.96 1.96 0 0 1-.111.794l-2.758 7.74c-.08.22-.194.423-.336.602-.427.54-1.11.87-1.857.872h-6.698c-1.67-.002-3.24-.633-4.326-1.715-.154-.154-.3-.318-.434-.49C5.96 30.846 4 29.157 1.646 27.773c-.385-.225-.626-.618-.645-1.05a1.31 1.31 0 0 1 .566-1.122 4.56 4.56 0 0 1 .723-.405l.225-.1a4.3 4.3 0 0 1 .568-.18l.237-.056c.248-.046.5-.075.75-.08.018 0 .034-.003.05-.003.303-.001.597.027.89.086l3.722.752V20.68l-1.436-.68c-3.377-1.596-5.56-5.106-5.56-8.938 0-1.51.336-2.94.93-4.222.015-.03.025-.06.04-.09.127-.267.268-.525.418-.778.093-.16.186-.316.288-.468.063-.095.133-.186.2-.277L3.773 5c.118-.155.26-.29.385-.437.266-.3.544-.604.845-.877a9.33 9.33 0 0 1 .813-.686C6.97 2.167 8.31 1.59 9.757 1.35a9.27 9.27 0 0 1 1.481-.119 8.82 8.82 0 0 1 .748.031c.247.02.49.05.733.088 1.448.238 2.786.816 3.94 1.65.387.28.752.588 1.094.922a9.94 9.94 0 0 1 .949 1.078l.066.092c.102.133.203.268.295.408a9.97 9.97 0 0 1 1.571 4.128c.066.467.103.945.103 1.43 0 3.388-1.67 6.453-4.353 8.243.11.046.227.08.33.144l6.256 3.874c.37.23.645.55.82.9.115.24.185.498.203.76m.697-1.195c-.265-.55-.677-1.007-1.194-1.326l-5.323-3.297c2.255-2.037 3.564-4.97 3.564-8.114 0-2.19-.637-4.304-1.84-6.114-.126-.188-.26-.37-.4-.552-.645-.848-1.402-1.6-2.252-2.204C15.472.91 13.393.232 11.238.232A10.21 10.21 0 0 0 5.23 2.19c-.848.614-1.606 1.356-2.253 2.205-.136.18-.272.363-.398.55C1.374 6.756.737 8.87.737 11.06c0 4.218 2.407 8.08 6.133 9.842l.863.41v3.092l-2.525-.51c-.356-.07-.717-.106-1.076-.106a5.45 5.45 0 0 0-3.14.996c-.653.46-1.022 1.202-.99 1.983a2.28 2.28 0 0 0 1.138 1.872c2.24 1.318 4.106 2.923 5.543 4.772 1.26 1.62 3.333 2.59 5.55 2.592h6.698c1.42-.001 2.68-.86 3.134-2.138l2.76-7.74c.272-.757.224-1.584-.134-2.325" fill-opacity=".05" fill="#000" mask="url(#B)" />
            </g>
        </g>
    </g>
</svg>`
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */}
      </slot>
    </div>
  </div>

  <div id="finger0" class="animated-container cover">
    <slot name="finger0" aria-hidden="true">
    </slot>
  </div>
  <div id="finger1" class="animated-container cover">
    <slot name="finger1" aria-hidden="true">
    </slot>
  </div>

  <div class="slot default">
    <slot></slot>

    <div class="slot progress-bar">
      <slot name="progress-bar">
        <div id="default-progress-bar" aria-hidden="true">
          <div class="bar" part="default-progress-bar"></div>
        </div>
      </slot>
    </div>

    <div class="slot exit-webxr-ar-button">
      <slot name="exit-webxr-ar-button">
        <a id="default-exit-webxr-ar-button" part="default-exit-webxr-ar-button"
            tabindex="3"
            aria-label="Exit AR"
            aria-hidden="true">
          ${Ti`
<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="#000000">
    <!-- NOTE(cdata): This SVG filter is a stop-gap until we can implement
         support for dynamic re-coloring of UI components -->
    <defs>
      <filter id="drop-shadow" x="-100%" y="-100%" width="300%" height="300%">
        <feGaussianBlur in="SourceAlpha" stdDeviation="1"/>
        <feOffset dx="0" dy="0" result="offsetblur"/>
        <feFlood flood-color="#000000"/>
        <feComposite in2="offsetblur" operator="in"/>
        <feMerge>
          <feMergeNode/>
          <feMergeNode in="SourceGraphic"/>
        </feMerge>
      </filter>
    </defs>
    <path filter="url(#drop-shadow)" d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/>
    <path d="M0 0h24v24H0z" fill="none"/>
</svg>`
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */}
        </a>
      </slot>
    </div>
  </div>
</div>
<div class="screen-reader-only" role="region" aria-label="Live announcements">
  <span id="status" role="status"></span>
</div>`;var Ms=function(){var e=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),t=new Uint8Array([32,0,65,2,1,106,34,33,3,128,11,4,13,64,6,253,10,7,15,116,127,5,8,12,40,16,19,54,20,9,27,255,113,17,42,67,24,23,146,148,18,14,22,45,70,69,56,114,101,21,25,63,75,136,108,28,118,29,73,115]);if("object"!=typeof WebAssembly)return{supported:!1};var i,s=WebAssembly.validate(e)?n("b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuixkbbebeeddddilve9Weeeviebeoweuec:q:6dkr;Neqo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949WbwY9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVJ9V29VVbDl79IV9Rbqq:Ctklbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk:183lYud97dur978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnalTmbcuhoaiRbbgrc;WeGc:Ge9hmbarcsGgwce0mbc9:hoalcufadcd4cbawEgDadfgrcKcaawEgqaraq0Egk6mbaicefhxavaialfgmar9Rgoad;8qbbcj;abad9Uc;WFbGcjdadca0EhPdndndnadTmbaoadfhscbhzinaeaz9nmdamax9RaD6miabazad2fhHaxaDfhOaPaeaz9RazaPfae6EgAcsfgocl4cifcd4hCavcj;cbfaoc9WGgXcetfhQavcj;cbfaXci2fhLavcj;cbfaXfhKcbhYaoc;ab6h8AincbhodnawTmbaxaYcd4fRbbhokaocFeGhEcbh3avcj;cbfh5indndndndnaEa3cet4ciGgoc9:fPdebdkamaO9RaX6mwavcj;cbfa3aX2faOaX;8qbbaOaAfhOxdkavcj;cbfa3aX2fcbaX;8kbxekamaO9RaC6moaoclVcbawEhraOaCfhocbhidna8Ambamao9Rc;Gb6mbcbhlina5alfhidndndndndndnaOalco4fRbbgqciGarfPDbedibledibkaipxbbbbbbbbbbbbbbbbpklbxlkaiaopbblaopbbbg8Eclp:mea8EpmbzeHdOiAlCvXoQrLg8Ecdp:mea8EpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9og8Fpxiiiiiiiiiiiiiiiip8Jg8Ep5b9cjF;8;4;W;G;ab9:9cU1:Ngacitc:q1jjbfpbibaac:q:yjjbfRbbgapsa8Ep5e9cjF;8;4;W;G;ab9:9cU1:Nghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPa8Fa8Ep9spklbaaaoclffahc:q:yjjbfRbbfhoxikaiaopbbwaopbbbg8Eclp:mea8EpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9og8Fpxssssssssssssssssp8Jg8Ep5b9cjF;8;4;W;G;ab9:9cU1:Ngacitc:q1jjbfpbibaac:q:yjjbfRbbgapsa8Ep5e9cjF;8;4;W;G;ab9:9cU1:Nghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPa8Fa8Ep9spklbaaaocwffahc:q:yjjbfRbbfhoxdkaiaopbbbpklbaoczfhoxekaiaopbbdaoRbbgacitc:q1jjbfpbibaac:q:yjjbfRbbgapsaoRbeghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPpklbaaaocdffahc:q:yjjbfRbbfhokdndndndndndnaqcd4ciGarfPDbedibledibkaiczfpxbbbbbbbbbbbbbbbbpklbxlkaiczfaopbblaopbbbg8Eclp:mea8EpmbzeHdOiAlCvXoQrLg8Ecdp:mea8EpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9og8Fpxiiiiiiiiiiiiiiiip8Jg8Ep5b9cjF;8;4;W;G;ab9:9cU1:Ngacitc:q1jjbfpbibaac:q:yjjbfRbbgapsa8Ep5e9cjF;8;4;W;G;ab9:9cU1:Nghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPa8Fa8Ep9spklbaaaoclffahc:q:yjjbfRbbfhoxikaiczfaopbbwaopbbbg8Eclp:mea8EpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9og8Fpxssssssssssssssssp8Jg8Ep5b9cjF;8;4;W;G;ab9:9cU1:Ngacitc:q1jjbfpbibaac:q:yjjbfRbbgapsa8Ep5e9cjF;8;4;W;G;ab9:9cU1:Nghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPa8Fa8Ep9spklbaaaocwffahc:q:yjjbfRbbfhoxdkaiczfaopbbbpklbaoczfhoxekaiczfaopbbdaoRbbgacitc:q1jjbfpbibaac:q:yjjbfRbbgapsaoRbeghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPpklbaaaocdffahc:q:yjjbfRbbfhokdndndndndndnaqcl4ciGarfPDbedibledibkaicafpxbbbbbbbbbbbbbbbbpklbxlkaicafaopbblaopbbbg8Eclp:mea8EpmbzeHdOiAlCvXoQrLg8Ecdp:mea8EpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9og8Fpxiiiiiiiiiiiiiiiip8Jg8Ep5b9cjF;8;4;W;G;ab9:9cU1:Ngacitc:q1jjbfpbibaac:q:yjjbfRbbgapsa8Ep5e9cjF;8;4;W;G;ab9:9cU1:Nghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPa8Fa8Ep9spklbaaaoclffahc:q:yjjbfRbbfhoxikaicafaopbbwaopbbbg8Eclp:mea8EpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9og8Fpxssssssssssssssssp8Jg8Ep5b9cjF;8;4;W;G;ab9:9cU1:Ngacitc:q1jjbfpbibaac:q:yjjbfRbbgapsa8Ep5e9cjF;8;4;W;G;ab9:9cU1:Nghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPa8Fa8Ep9spklbaaaocwffahc:q:yjjbfRbbfhoxdkaicafaopbbbpklbaoczfhoxekaicafaopbbdaoRbbgacitc:q1jjbfpbibaac:q:yjjbfRbbgapsaoRbeghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPpklbaaaocdffahc:q:yjjbfRbbfhokdndndndndndnaqco4arfPDbedibledibkaic8Wfpxbbbbbbbbbbbbbbbbpklbxlkaic8Wfaopbblaopbbbg8Eclp:mea8EpmbzeHdOiAlCvXoQrLg8Ecdp:mea8EpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9og8Fpxiiiiiiiiiiiiiiiip8Jg8Ep5b9cjF;8;4;W;G;ab9:9cU1:Ngicitc:q1jjbfpbibaic:q:yjjbfRbbgipsa8Ep5e9cjF;8;4;W;G;ab9:9cU1:Ngqcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPa8Fa8Ep9spklbaiaoclffaqc:q:yjjbfRbbfhoxikaic8Wfaopbbwaopbbbg8Eclp:mea8EpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9og8Fpxssssssssssssssssp8Jg8Ep5b9cjF;8;4;W;G;ab9:9cU1:Ngicitc:q1jjbfpbibaic:q:yjjbfRbbgipsa8Ep5e9cjF;8;4;W;G;ab9:9cU1:Ngqcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPa8Fa8Ep9spklbaiaocwffaqc:q:yjjbfRbbfhoxdkaic8Wfaopbbbpklbaoczfhoxekaic8WfaopbbdaoRbbgicitc:q1jjbfpbibaic:q:yjjbfRbbgipsaoRbegqcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPpklbaiaocdffaqc:q:yjjbfRbbfhokalc;abfhialcjefaX0meaihlamao9Rc;Fb0mbkkdnaiaX9pmbaici4hlinamao9RcK6mwa5aifhqdndndndndndnaOaico4fRbbalcoG4ciGarfPDbedibledibkaqpxbbbbbbbbbbbbbbbbpkbbxlkaqaopbblaopbbbg8Eclp:mea8EpmbzeHdOiAlCvXoQrLg8Ecdp:mea8EpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9og8Fpxiiiiiiiiiiiiiiiip8Jg8Ep5b9cjF;8;4;W;G;ab9:9cU1:Ngacitc:q1jjbfpbibaac:q:yjjbfRbbgapsa8Ep5e9cjF;8;4;W;G;ab9:9cU1:Nghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPa8Fa8Ep9spkbbaaaoclffahc:q:yjjbfRbbfhoxikaqaopbbwaopbbbg8Eclp:mea8EpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9og8Fpxssssssssssssssssp8Jg8Ep5b9cjF;8;4;W;G;ab9:9cU1:Ngacitc:q1jjbfpbibaac:q:yjjbfRbbgapsa8Ep5e9cjF;8;4;W;G;ab9:9cU1:Nghcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPa8Fa8Ep9spkbbaaaocwffahc:q:yjjbfRbbfhoxdkaqaopbbbpkbbaoczfhoxekaqaopbbdaoRbbgacitc:q1jjbfpbibaac:q:yjjbfRbbgapsaoRbeghcitc:q1jjbfpbibp9UpmbedilvorzH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2;8qbbavavcjdfaAcufad2fad;8qbbaAazfhzc9:hoaOhxaOmbxlkkaeTmbaDalfhrcbhocuhlinaralaD9RglfaD6mdaPaeao9RaoaPfae6Eaofgoae6mbkaial9Rhxkcbc99amax9RakSEhoxekc9:hokavcj;kbf8Kjjjjbaokwbz:bjjjbk:TseHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhldnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhoindnalaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfaoaDcu7gPcl4fcsGcitfgsydlhzasydbhHdndnaDcsGgsak9pmbavaiaPfcsGcdtfydbaxasEhDaxasTgOfhxxekdndnascsSmbcehOasc987asamffcefhDxekalcefhDal8SbbgscFeGhPdndnascu9mmbaDhlxekalcvfhlaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhlkcehOaPce4cbaPceG9R7amfhDkaDhmkavc;abfaocitfgsaDBdbasazBdlavaicdtfaDBdbavc;abfaocefcsGcitfgsaHBdbasaDBdlaocdfhoaOaifhidnadcd9hmbabarcetfgsaH87ebasclfaD87ebascdfaz87ebxdkabarcdtfgsaHBdbascwfaDBdbasclfazBdbxekdnaDcpe0mbaxcefgOavaiaqaDcsGfRbbgscl49RcsGcdtfydbascz6gPEhDavaias9RcsGcdtfydbaOaPfgzascsGgOEhsaOThOdndnadcd9hmbabarcetfgHax87ebaHclfas87ebaHcdfaD87ebxekabarcdtfgHaxBdbaHcwfasBdbaHclfaDBdbkavaicdtfaxBdbavc;abfaocitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfaocefcsGcitfgHasBdbaHaDBdlavaiaPfgicsGcdtfasBdbavc;abfaocdfcsGcitfgDaxBdbaDasBdlaocifhoaiaOfhiazaOfhxxekaxcbalRbbgHEgAaDc;:eSgDfhzaHcsGhCaHcl4hXdndnaHcs0mbazcefhOxekazhOavaiaX9RcsGcdtfydbhzkdndnaCmbaOcefhxxekaOhxavaiaH9RcsGcdtfydbhOkdndnaDTmbalcefhDxekalcdfhDal8SbegPcFeGhsdnaPcu9kmbalcofhAascFbGhscrhldninaD8SbbgPcFbGaltasVhsaPcu9kmeaDcefhDalcrfglc8J9hmbkaAhDxekaDcefhDkasce4cbasceG9R7amfgmhAkdndnaXcsSmbaDhsxekaDcefhsaD8SbbglcFeGhPdnalcu9kmbaDcvfhzaPcFbGhPcrhldninas8SbbgDcFbGaltaPVhPaDcu9kmeascefhsalcrfglc8J9hmbkazhsxekascefhskaPce4cbaPceG9R7amfgmhzkdndnaCcsSmbashlxekascefhlas8SbbgDcFeGhPdnaDcu9kmbascvfhOaPcFbGhPcrhDdninal8SbbgscFbGaDtaPVhPascu9kmealcefhlaDcrfgDc8J9hmbkaOhlxekalcefhlkaPce4cbaPceG9R7amfgmhOkdndnadcd9hmbabarcetfgDaA87ebaDclfaO87ebaDcdfaz87ebxekabarcdtfgDaABdbaDcwfaOBdbaDclfazBdbkavc;abfaocitfgDazBdbaDaABdlavaicdtfaABdbavc;abfaocefcsGcitfgDaOBdbaDazBdlavaicefgicsGcdtfazBdbavc;abfaocdfcsGcitfgDaABdbaDaOBdlavaiaHcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhiaocifhokawcefhwaocsGhoaicsGhiarcifgrae6mbkkcbc99alaqSEhokavc;aef8Kjjjjbaok:clevu8Jjjjjbcz9Rhvdnaecvfal9nmbc9:skdnaiRbbc;:eGc;qeSmbcuskav9cb83iwaicefhoaialfc98fhrdnaeTmbdnadcdSmbcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcdtfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgiBdbalaiBdbawcefgwae9hmbxdkkcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcetfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgi87ebalaiBdbawcefgwae9hmbkkcbc99aoarSEk:2Pliur97eue978Jjjjjbc8W9Rhiaec98Ghldndnadcl9hmbdnalTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalaeSmeaipxbbbbbbbbbbbbbbbbgqpklbaiabalcdtfgdaeciGglcdtgv;8qbbdnalTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDaqp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkadaiav;8qbbskaipxFubbFubbFubbFubbgxpklbdnalTmbcbhvabhdinadczfgmampbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmbediwDqkzHOAKY8AEgwczp:Reczp:Sep;6egraipblbaDaopmlvorxmPsCXQL358E8Fp9op;6eawczp:Sep;6egwp;Gearp;Gep;Kep;Legopxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgPp9op9rp;Kegrpxb;:FSb;:FSb;:FSb;:FSararp;Meaoaop;MeawaqawaPp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFFbbFFbbFFbbFFbbp9oaoawp;Meaqp;Keczp:Rep9qgoarawp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogrpmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oaoarpmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgval6mbkkalaeSmbaiczfpxbbbbbbbbbbbbbbbbgopklbaiaopklbaiabalcitfgdaeciGglcitgv;8qbbaiaxpkladnalTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmbediwDqkzHOAKY8AEgwczp:Reczp:Sep;6egraipblaaDaopmlvorxmPsCXQL358E8Fp9op;6eawczp:Sep;6egwp;Gearp;Gep;Kep;Legopxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgPp9op9rp;Kegrpxb;:FSb;:FSb;:FSb;:FSararp;Meaoaop;MeawaqawaPp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFFbbFFbbFFbbFFbbp9oaoawp;Meaqp;Keczp:Rep9qgoarawp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogrpmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oaoarpmbezHdiOAlvCXorQLp9qpklbkadaiav;8qbbkk:Iwllue97euo978Jjjjjbca9Rhidnaec98GglTmbcbhvabhoinaocKfpx:ji:1S:ji:1S:ji:1S:ji:1SaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkpxibbbibbbibbbibbbp9qgxp;6ep;Negmaxaxp:1ep;7egxaxp;KearaDpmbediwDqkzHOAKY8AEgxczp:Reczp:Sep;6egrarp;Meaxczp:Sep;6egDaDp;Meaqczp:Reczp:Sep;6egqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jep;Mepxbbn0bbn0bbn0bbn0gxp;KepxFFbbFFbbFFbbFFbbgPp9oamaDp;Meaxp;Keczp:Rep9qgDamarp;Meaxp;KeaPp9oamaqp;Meaxp;Keczp:Rep9qgxpmwDKYqk8AExm35Ps8E8Fgrp5eakclp:RegmpEi:T:j83ibawarp5bampEd:T:j83ibaocwfaDaxpmbezHdiOAlvCXorQLgxp5eampEe:T:j83ibaoaxp5bampEb:T:j83ibaocafhoavclfgval6mbkkdnalaeSmbaiczfpxbbbbbbbbbbbbbbbbgmpklbaiampklbaiabalcitfgoaeciGgvcitgw;8qbbdnavTmbaipx:ji:1S:ji:1S:ji:1S:ji:1SaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkpxibbbibbbibbbibbbp9qgxp;6ep;Negmaxaxp:1ep;7egxaxp;KearaDpmbediwDqkzHOAKY8AEgxczp:Reczp:Sep;6egrarp;Meaxczp:Sep;6egDaDp;Meaqczp:Reczp:Sep;6egqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jep;Mepxbbn0bbn0bbn0bbn0gxp;KepxFFbbFFbbFFbbFFbbgPp9oamaDp;Meaxp;Keczp:Rep9qgDamarp;Meaxp;KeaPp9oamaqp;Meaxp;Keczp:Rep9qgxpmwDKYqk8AExm35Ps8E8Fgrp5eakclp:RegmpEi:T:j83iKaiarp5bampEd:T:j83izaiaDaxpmbezHdiOAlvCXorQLgxp5eampEe:T:j83iwaiaxp5bampEb:T:j83ibkaoaiaw;8qbbkk;uddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbheabhdinadadpbbbgocwp:Recwp:Sep;6eaocep:SepxbbjFbbjFbbjFbbjFp9opxbbjZbbjZbbjZbbjZp:Uep;Mepkbbadczfhdaeclfgeav6mbkkdnavalSmbaic8WfpxbbbbbbbbbbbbbbbbgopklbaicafaopklbaiczfaopklbaiaopklbaiabavcdtfgdalciGgecdtgv;8qbbdnaeTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjFbbjFbbjFbbjFp9opxbbjZbbjZbbjZbbjZp:Uep;Mepklbkadaiav;8qbbkk:CPvdue97euw97eu8Jjjjjbc8W9Rhiaec98Ghldndnadcl9hmbaipxbbbbbbbbbbbbbbbbgvpklbdnalTmbcbhoabhdinadpbbbhradpxbbuJbbuJbbuJbbuJaipblbarcKp:Tep9qgwcep:Seawp9qgDcdp:SeaDp9qgDclp:SeaDp9qgqp;6ep;NegDarcwp:RecKp:SegkarpxFbbbFbbbFbbbFbbbgxp9ogmp:Uep;6ep;Mepxbbn0bbn0bbn0bbn0gPp;Kecwp:RepxbFbbbFbbbFbbbFbbp9oaDamakp:Xearczp:RecKp:Segrp:Uep;6ep;MeaPp;Keaxp9op9qaDamakarp:Uep:Xep;6ep;MeaPp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qaDaqawcep:Rep9oawpxebbbebbbebbbebbbp9op9qp;6ep;MeaPp;KecKp:Rep9qpkbbadczfhdaoclfgoal6mbkkalaeSmeaiavpklaaicafabalcdtfgdaeciGglcdtgo;8qbbaiavpklbdnalTmbaipblahraipxbbuJbbuJbbuJbbuJaipblbarcKp:Tep9qgwcep:Seawp9qgDcdp:SeaDp9qgDclp:SeaDp9qgqp;6ep;NegDarcwp:RecKp:SegkarpxFbbbFbbbFbbbFbbbgxp9ogmp:Uep;6ep;Mepxbbn0bbn0bbn0bbn0gPp;Kecwp:RepxbFbbbFbbbFbbbFbbp9oaDamakp:Xearczp:RecKp:Segrp:Uep;6ep;MeaPp;Keaxp9op9qaDamakarp:Uep:Xep;6ep;MeaPp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qaDaqawcep:Rep9oawpxebbbebbbebbbebbbp9op9qp;6ep;MeaPp;KecKp:Rep9qpklakadaicafao;8qbbskaipxbbbbbbbbbbbbbbbbgvpklbdnalTmbcbhoabhdinadczfgspxbFu9hbFu9hbFu9hbFu9hadpbbbgDaspbbbgPpmlvorxmPsCXQL358E8Fgmczp:Teaipblbp9qgrcep:Searp9qgwcdp:Seawp9qgwclp:Seawp9qgwcwp:Seawp9qgqp;6ep;NegwaDaPpmbediwDqkzHOAKY8AEgDpxFFbbFFbbFFbbFFbbgPp9ogkaDczp:Segxp:Ueamczp:Reczp:Segmp:Xep;6ep;Mepxbbn0bbn0bbn0bbn0gDp;KeaPp9oawakaxamp:Uep:Xep;6ep;MeaDp;Keczp:Rep9qgxawaqarcep:Rep9oarpxebbbebbbebbbebbbp9op9qp;6ep;MeaDp;Keczp:Reawamakp:Uep;6ep;MeaDp;KeaPp9op9qgrpmwDKYqk8AExm35Ps8E8FpkbbadaxarpmbezHdiOAlvCXorQLpkbbadcafhdaoclfgoal6mbkkalaeSmbaiczfpxbbbbbbbbbbbbbbbbgrpklbaiarpklbaiabalcitfgdaeciGglcitgo;8qbbaiavpkladnalTmbaipxbFu9hbFu9hbFu9hbFu9haipblbgDaipblzgPpmlvorxmPsCXQL358E8Fgmczp:Teaipblap9qgrcep:Searp9qgwcdp:Seawp9qgwclp:Seawp9qgwcwp:Seawp9qgqp;6ep;NegwaDaPpmbediwDqkzHOAKY8AEgDpxFFbbFFbbFFbbFFbbgPp9ogkaDczp:Segxp:Ueamczp:Reczp:Segmp:Xep;6ep;Mepxbbn0bbn0bbn0bbn0gDp;KeaPp9oawakaxamp:Uep:Xep;6ep;MeaDp;Keczp:Rep9qgxawaqarcep:Rep9oarpxebbbebbbebbbebbbp9op9qp;6ep;MeaDp;Keczp:Reawamakp:Uep;6ep;MeaDp;KeaPp9op9qgrpmwDKYqk8AExm35Ps8E8FpklzaiaxarpmbezHdiOAlvCXorQLpklbkadaiao;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz:Dbb"):n("b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuixkbeeeddddillviebeoweuec:W:Odkr;Neqo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949WboY9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVJ9V29VVbrl79IV9Rbwq;lZkdbk;jYi5ud9:du8Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnalTmbcuhoaiRbbgrc;WeGc:Ge9hmbarcsGgwce0mbc9:hoalcufadcd4cbawEgDadfgrcKcaawEgqaraq0Egk6mbaicefhxcj;abad9Uc;WFbGcjdadca0EhmaialfgPar9Rgoadfhsavaoadz:jjjjbgzceVhHcbhOdndninaeaO9nmeaPax9RaD6mdamaeaO9RaOamfgoae6EgAcsfglc9WGhCabaOad2fhXaAcethQaxaDfhiaOaeaoaeao6E9RhLalcl4cifcd4hKazcj;cbfaAfhYcbh8AazcjdfhEaHh3incbhodnawTmbaxa8Acd4fRbbhokaocFeGh5cbh8Eazcj;cbfhqinaih8Fdndndndna5a8Ecet4ciGgoc9:fPdebdkaPa8F9RaA6mrazcj;cbfa8EaA2fa8FaAz:jjjjb8Aa8FaAfhixdkazcj;cbfa8EaA2fcbaAz:kjjjb8Aa8FhixekaPa8F9RaK6mva8FaKfhidnaCTmbaPai9RcK6mbaocdtc:q1jjbfcj1jjbawEhaczhrcbhlinargoc9Wfghaqfhrdndndndndndnaaa8Fahco4fRbbalcoG4ciGcdtfydbPDbedvivvvlvkar9cb83bbarcwf9cb83bbxlkarcbaiRbdai8Xbb9c:c:qj:bw9:9c:q;c1:I1e:d9c:b:c:e1z9:gg9cjjjjjz:dg8J9qE86bbaqaofgrcGfag9c8F1:NghcKtc8F91aicdfa8J9c8N1:Nfg8KRbbG86bbarcVfcba8KahcjeGcr4fghRbbag9cjjjjjl:dg8J9qE86bbarc7fcbaha8J9c8L1:NfghRbbag9cjjjjjd:dg8J9qE86bbarctfcbaha8J9c8K1:NfghRbbag9cjjjjje:dg8J9qE86bbarc91fcbaha8J9c8J1:NfghRbbag9cjjjj;ab:dg8J9qE86bbarc4fcbaha8J9cg1:NfghRbbag9cjjjja:dg8J9qE86bbarc93fcbaha8J9ch1:NfghRbbag9cjjjjz:dgg9qE86bbarc94fcbahag9ca1:NfghRbbai8Xbe9c:c:qj:bw9:9c:q;c1:I1e:d9c:b:c:e1z9:gg9cjjjjjz:dg8J9qE86bbarc95fag9c8F1:NgicKtc8F91aha8J9c8N1:NfghRbbG86bbarc96fcbahaicjeGcr4fgiRbbag9cjjjjjl:dg8J9qE86bbarc97fcbaia8J9c8L1:NfgiRbbag9cjjjjjd:dg8J9qE86bbarc98fcbaia8J9c8K1:NfgiRbbag9cjjjjje:dg8J9qE86bbarc99fcbaia8J9c8J1:NfgiRbbag9cjjjj;ab:dg8J9qE86bbarc9:fcbaia8J9cg1:NfgiRbbag9cjjjja:dg8J9qE86bbarcufcbaia8J9ch1:NfgiRbbag9cjjjjz:dgg9qE86bbaiag9ca1:NfhixikaraiRblaiRbbghco4g8Ka8KciSg8KE86bbaqaofgrcGfaiclfa8Kfg8KRbbahcl4ciGg8La8LciSg8LE86bbarcVfa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc7fa8Ka8Lfg8KRbbahciGghahciSghE86bbarctfa8Kahfg8KRbbaiRbeghco4g8La8LciSg8LE86bbarc91fa8Ka8Lfg8KRbbahcl4ciGg8La8LciSg8LE86bbarc4fa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc93fa8Ka8Lfg8KRbbahciGghahciSghE86bbarc94fa8Kahfg8KRbbaiRbdghco4g8La8LciSg8LE86bbarc95fa8Ka8Lfg8KRbbahcl4ciGg8La8LciSg8LE86bbarc96fa8Ka8Lfg8KRbbahcd4ciGg8La8LciSg8LE86bbarc97fa8Ka8Lfg8KRbbahciGghahciSghE86bbarc98fa8KahfghRbbaiRbigico4g8Ka8KciSg8KE86bbarc99faha8KfghRbbaicl4ciGg8Ka8KciSg8KE86bbarc9:faha8KfghRbbaicd4ciGg8Ka8KciSg8KE86bbarcufaha8KfgrRbbaiciGgiaiciSgiE86bbaraifhixdkaraiRbwaiRbbghcl4g8Ka8KcsSg8KE86bbaqaofgrcGfaicwfa8Kfg8KRbbahcsGghahcsSghE86bbarcVfa8KahfghRbbaiRbeg8Kcl4g8La8LcsSg8LE86bbarc7faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarctfaha8KfghRbbaiRbdg8Kcl4g8La8LcsSg8LE86bbarc91faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc4faha8KfghRbbaiRbig8Kcl4g8La8LcsSg8LE86bbarc93faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc94faha8KfghRbbaiRblg8Kcl4g8La8LcsSg8LE86bbarc95faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc96faha8KfghRbbaiRbvg8Kcl4g8La8LcsSg8LE86bbarc97faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc98faha8KfghRbbaiRbog8Kcl4g8La8LcsSg8LE86bbarc99faha8LfghRbba8KcsGg8Ka8KcsSg8KE86bbarc9:faha8KfghRbbaiRbrgicl4g8Ka8KcsSg8KE86bbarcufaha8KfgrRbbaicsGgiaicsSgiE86bbaraifhixekarai8Pbb83bbarcwfaicwf8Pbb83bbaiczfhikdnaoaC9pmbalcdfhlaoczfhraPai9RcL0mekkaoaC6moaimexokaCmva8FTmvkaqaAfhqa8Ecefg8Ecl9hmbkdndndndnawTmbasa8Acd4fRbbgociGPlbedrbkaATmdaza8Afh8Fazcj;cbfhhcbh8EaEhaina8FRbbhraahocbhlinaoahalfRbbgqce4cbaqceG9R7arfgr86bbaoadfhoaAalcefgl9hmbkaacefhaa8Fcefh8FahaAfhha8Ecefg8Ecl9hmbxikkaATmeaza8Afhaazcj;cbfhhcbhoceh8EaYh8FinaEaofhlaa8Vbbhrcbhoinala8FaofRbbcwtahaofRbbgqVc;:FiGce4cbaqceG9R7arfgr87bbaladfhlaLaocefgofmbka8FaQfh8FcdhoaacdfhaahaQfhha8EceGhlcbh8EalmbxdkkaATmbcbaocl49Rh8Eaza8AfRbbhqcwhoa3hlinalRbbaotaqVhqalcefhlaocwfgoca9hmbkcbhhaEh8FaYhainazcj;cbfahfRbbhrcwhoaahlinalRbbaotarVhralaAfhlaocwfgoca9hmbkara8E93aq7hqcbhoa8Fhlinalaqao486bbalcefhlaocwfgoca9hmbka8Fadfh8FaacefhaahcefghaA9hmbkkaEclfhEa3clfh3a8Aclfg8Aad6mbkaXazcjdfaAad2z:jjjjb8AazazcjdfaAcufad2fadz:jjjjb8AaAaOfhOaihxaimbkc9:hoxdkcbc99aPax9RakSEhoxekc9:hokavcj;kbf8Kjjjjbaok:XseHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:kjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhldnaeTmbcmcsaDceSEhkcbhxcbhmcbhrcbhicbhoindnalaq9nmbc9:hoxikdndnawRbbgDc;Ve0mbavc;abfaoaDcu7gPcl4fcsGcitfgsydlhzasydbhHdndnaDcsGgsak9pmbavaiaPfcsGcdtfydbaxasEhDaxasTgOfhxxekdndnascsSmbcehOasc987asamffcefhDxekalcefhDal8SbbgscFeGhPdndnascu9mmbaDhlxekalcvfhlaPcFbGhPcrhsdninaD8SbbgOcFbGastaPVhPaOcu9kmeaDcefhDascrfgsc8J9hmbxdkkaDcefhlkcehOaPce4cbaPceG9R7amfhDkaDhmkavc;abfaocitfgsaDBdbasazBdlavaicdtfaDBdbavc;abfaocefcsGcitfgsaHBdbasaDBdlaocdfhoaOaifhidnadcd9hmbabarcetfgsaH87ebasclfaD87ebascdfaz87ebxdkabarcdtfgsaHBdbascwfaDBdbasclfazBdbxekdnaDcpe0mbaxcefgOavaiaqaDcsGfRbbgscl49RcsGcdtfydbascz6gPEhDavaias9RcsGcdtfydbaOaPfgzascsGgOEhsaOThOdndnadcd9hmbabarcetfgHax87ebaHclfas87ebaHcdfaD87ebxekabarcdtfgHaxBdbaHcwfasBdbaHclfaDBdbkavaicdtfaxBdbavc;abfaocitfgHaDBdbaHaxBdlavaicefgicsGcdtfaDBdbavc;abfaocefcsGcitfgHasBdbaHaDBdlavaiaPfgicsGcdtfasBdbavc;abfaocdfcsGcitfgDaxBdbaDasBdlaocifhoaiaOfhiazaOfhxxekaxcbalRbbgHEgAaDc;:eSgDfhzaHcsGhCaHcl4hXdndnaHcs0mbazcefhOxekazhOavaiaX9RcsGcdtfydbhzkdndnaCmbaOcefhxxekaOhxavaiaH9RcsGcdtfydbhOkdndnaDTmbalcefhDxekalcdfhDal8SbegPcFeGhsdnaPcu9kmbalcofhAascFbGhscrhldninaD8SbbgPcFbGaltasVhsaPcu9kmeaDcefhDalcrfglc8J9hmbkaAhDxekaDcefhDkasce4cbasceG9R7amfgmhAkdndnaXcsSmbaDhsxekaDcefhsaD8SbbglcFeGhPdnalcu9kmbaDcvfhzaPcFbGhPcrhldninas8SbbgDcFbGaltaPVhPaDcu9kmeascefhsalcrfglc8J9hmbkazhsxekascefhskaPce4cbaPceG9R7amfgmhzkdndnaCcsSmbashlxekascefhlas8SbbgDcFeGhPdnaDcu9kmbascvfhOaPcFbGhPcrhDdninal8SbbgscFbGaDtaPVhPascu9kmealcefhlaDcrfgDc8J9hmbkaOhlxekalcefhlkaPce4cbaPceG9R7amfgmhOkdndnadcd9hmbabarcetfgDaA87ebaDclfaO87ebaDcdfaz87ebxekabarcdtfgDaABdbaDcwfaOBdbaDclfazBdbkavc;abfaocitfgDazBdbaDaABdlavaicdtfaABdbavc;abfaocefcsGcitfgDaOBdbaDazBdlavaicefgicsGcdtfazBdbavc;abfaocdfcsGcitfgDaABdbaDaOBdlavaiaHcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhiaocifhokawcefhwaocsGhoaicsGhiarcifgrae6mbkkcbc99alaqSEhokavc;aef8Kjjjjbaok:clevu8Jjjjjbcz9Rhvdnaecvfal9nmbc9:skdnaiRbbc;:eGc;qeSmbcuskav9cb83iwaicefhoaialfc98fhrdnaeTmbdnadcdSmbcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcdtfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgiBdbalaiBdbawcefgwae9hmbxdkkcbhwindnaoar6mbc9:skaocefhlao8SbbgicFeGhddndnaicu9mmbalhoxekaocvfhoadcFbGhdcrhidninal8SbbgDcFbGaitadVhdaDcu9kmealcefhlaicrfgic8J9hmbxdkkalcefhokabawcetfadc8Etc8F91adcd47avcwfadceGcdtVglydbfgi87ebalaiBdbawcefgwae9hmbkkcbc99aoarSEk:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk::ioiue99dud99dud99dnaeTmbcbhiabhlindndnal8Uebgv:YgoJ:ji:1Salcof8UebgrciVgw:Y:vgDNJbbbZJbbb:;avcu9kEMgq:lJbbb9p9DTmbaq:Ohkxekcjjjj94hkkalclf8Uebhvalcdf8UebhxabaiarcefciGfcetfak87ebdndnax:YgqaDNJbbbZJbbb:;axcu9kEMgm:lJbbb9p9DTmbam:Ohxxekcjjjj94hxkabaiarciGfgkcd7cetfax87ebdndnav:YgmaDNJbbbZJbbb:;avcu9kEMgP:lJbbb9p9DTmbaP:Ohvxekcjjjj94hvkabaiarcufciGfcetfav87ebdndnawaw2:ZgPaPMaoaoN:taqaqN:tamamN:tgoJbbbbaoJbbbb9GE:raDNJbbbZMgD:lJbbb9p9DTmbaD:Ohrxekcjjjj94hrkabakcetfar87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2gdTmbinababydbgecwtcw91:Yaece91cjjj98Gcjjj;8if::NUdbabclfhbadcufgdmbkkk:Tvirud99eudndnadcl9hmbaeTmeindndnabRbbgiabcefgl8Sbbgvabcdfgo8Sbbgrf9R:YJbbuJabcifgwRbbgdce4adVgDcd4aDVgDcl4aDVgD:Z:vgqNJbbbZMgk:lJbbb9p9DTmbak:Ohxxekcjjjj94hxkaoax86bbdndnaraif:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohoxekcjjjj94hokalao86bbdndnavaifar9R:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohixekcjjjj94hikabai86bbdndnaDadcetGadceGV:ZaqNJbbbZMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkawad86bbabclfhbaecufgembxdkkaeTmbindndnab8Vebgiabcdfgl8Uebgvabclfgo8Uebgrf9R:YJbFu9habcofgw8Vebgdce4adVgDcd4aDVgDcl4aDVgDcw4aDVgD:Z:vgqNJbbbZMgk:lJbbb9p9DTmbak:Ohxxekcjjjj94hxkaoax87ebdndnaraif:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohoxekcjjjj94hokalao87ebdndnavaifar9R:YaqNJbbbZMgk:lJbbb9p9DTmbak:Ohixekcjjjj94hikabai87ebdndnaDadcetGadceGV:ZaqNJbbbZMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkawad87ebabcwfhbaecufgembkkk9teiucbcbyd:K1jjbgeabcifc98GfgbBd:K1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;teeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiaeydlBdlaiaeydwBdwaiaeydxBdxaeczfheaiczfhiadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk:3eedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdxaialBdwaialBdlaialBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkk81dbcjwk8Kbbbbdbbblbbbwbbbbbbbebbbdbbblbbbwbbbbc:Kwkl8WNbb"),a=WebAssembly.instantiate(s,{}).then(function(e){(i=e.instance).exports.__wasm_call_ctors()});function n(e){for(var i=new Uint8Array(e.length),s=0;s<e.length;++s){var a=e.charCodeAt(s);i[s]=a>96?a-97:a>64?a-39:a+4}var n=0;for(s=0;s<e.length;++s)i[n++]=i[s]<60?t[i[s]]:64*(i[s]-60)+i[++s];return i.buffer.slice(0,n)}function r(e,t,i,s,a,n,r){var o=e.exports.sbrk,A=s+3&-4,l=o(A*a),c=o(n.length),h=new Uint8Array(e.exports.memory.buffer);h.set(n,c);var d=t(l,s,a,c,n.length);if(0==d&&r&&r(l,A,a),i.set(h.subarray(l,l+s*a)),o(l-o(0)),0!=d)throw new Error("Malformed buffer data: "+d)}var o={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp",COLOR:"meshopt_decodeFilterColor"},A={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"},l=[],c=0;function h(e){var t={object:new Worker(e),pending:0,requests:{}};return t.object.onmessage=function(e){var i=e.data;t.pending-=i.count,t.requests[i.id][i.action](i.value),delete t.requests[i.id]},t}function d(e){var t=e.data;if(!t.id)return self.close();self.ready.then(function(e){try{var i=new Uint8Array(t.count*t.size);r(e,e.exports[t.mode],i,t.count,t.size,t.source,e.exports[t.filter]),self.postMessage({id:t.id,count:t.count,action:"resolve",value:i},[i.buffer])}catch(e){self.postMessage({id:t.id,count:t.count,action:"reject",value:e})}})}return{ready:a,supported:!0,useWorkers:function(e){!function(e){for(var t="self.ready = WebAssembly.instantiate(new Uint8Array(["+new Uint8Array(s)+"]), {}).then(function(result) { result.instance.exports.__wasm_call_ctors(); return result.instance; });self.onmessage = "+d.name+";"+r.toString()+d.toString(),i=new Blob([t],{type:"text/javascript"}),a=URL.createObjectURL(i),n=l.length;n<e;++n)l[n]=h(a);for(n=e;n<l.length;++n)l[n].object.postMessage({});l.length=e,URL.revokeObjectURL(a)}(e)},decodeVertexBuffer:function(e,t,s,a,n){r(i,i.exports.meshopt_decodeVertexBuffer,e,t,s,a,i.exports[o[n]])},decodeIndexBuffer:function(e,t,s,a){r(i,i.exports.meshopt_decodeIndexBuffer,e,t,s,a)},decodeIndexSequence:function(e,t,s,a){r(i,i.exports.meshopt_decodeIndexSequence,e,t,s,a)},decodeGltfBuffer:function(e,t,s,a,n,l){r(i,i.exports[A[n]],e,t,s,a,i.exports[o[l]])},decodeGltfBufferAsync:function(e,t,s,n,h){return l.length>0?function(e,t,i,s,a){for(var n=l[0],r=1;r<l.length;++r)l[r].pending<n.pending&&(n=l[r]);return new Promise(function(r,o){var A=new Uint8Array(i),l=++c;n.pending+=e,n.requests[l]={resolve:r,reject:o},n.object.postMessage({id:l,count:e,size:t,source:A,mode:s,filter:a},[A.buffer])})}(e,t,s,A[n],o[h]):a.then(function(){var a=new Uint8Array(e*t);return r(i,i.exports[A[n]],a,e,t,s,i.exports[o[h]]),a})}}}();const Ds=new WeakMap;function Rs(){let e,t;function i(e,t,i,s,a,n){const r=i.num_points(),o=n.num_components(),A=function(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,a),l=o*a.BYTES_PER_ELEMENT,c=4*Math.ceil(l/4),h=c/a.BYTES_PER_ELEMENT,d=r*l,g=r*c,u=e._malloc(d);t.GetAttributeDataArrayForAllPoints(i,n,A,d,u);const p=new a(e.HEAPF32.buffer,u,d/a.BYTES_PER_ELEMENT);let m;if(l===c)m=p.slice();else{m=new a(g/a.BYTES_PER_ELEMENT);let e=0;for(let t=0,i=p.length;t<i;t++){for(let i=0;i<o;i++)m[e+i]=p[t*o+i];e+=h}}return e._free(u),{name:s,count:r,itemSize:o,array:m,stride:h}}onmessage=function(s){const a=s.data;switch(a.type){case"init":e=a.decoderConfig,t=new Promise(function(t){e.onModuleLoaded=function(e){t({draco:e})},DracoDecoderModule(e)});break;case"decode":const s=a.buffer,n=a.taskConfig;t.then(e=>{const t=e.draco,r=new t.Decoder;try{const e=function(e,t,s,a){const n=a.attributeIDs,r=a.attributeTypes;let o,A;const l=t.GetEncodedGeometryType(s);if(l===e.TRIANGULAR_MESH)o=new e.Mesh,A=t.DecodeArrayToMesh(s,s.byteLength,o);else{if(l!==e.POINT_CLOUD)throw new Error("THREE.DRACOLoader: Unexpected geometry type.");o=new e.PointCloud,A=t.DecodeArrayToPointCloud(s,s.byteLength,o)}if(!A.ok()||0===o.ptr)throw new Error("THREE.DRACOLoader: Decoding failed: "+A.error_msg());const c={index:null,attributes:[]};for(const s in n){const A=self[r[s]];let l,h;if(a.useUniqueIDs)h=n[s],l=t.GetAttributeByUniqueId(o,h);else{if(h=t.GetAttributeId(o,e[n[s]]),-1===h)continue;l=t.GetAttribute(o,h)}const d=i(e,t,o,s,A,l);"color"===s&&(d.vertexColorSpace=a.vertexColorSpace),c.attributes.push(d)}l===e.TRIANGULAR_MESH&&(c.index=function(e,t,i){const s=i.num_faces(),a=3*s,n=4*a,r=e._malloc(n);t.GetTrianglesUInt32Array(i,n,r);const o=new Uint32Array(e.HEAPF32.buffer,r,a).slice();return e._free(r),{array:o,itemSize:1}}(e,t,o));return e.destroy(o),c}(t,r,new Int8Array(s),n),o=e.attributes.map(e=>e.array.buffer);e.index&&o.push(e.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:e},o)}catch(e){console.error(e),self.postMessage({type:"error",id:a.id,error:e.message})}finally{t.destroy(r)}})}}}function Ts(e,t){if(t===b)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),e;if(t===f||t===I){let i=e.getIndex();if(null===i){const t=[],s=e.getAttribute("position");if(void 0===s)return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),e;for(let e=0;e<s.count;e++)t.push(e);e.setIndex(t),i=e.getIndex()}const s=i.count-2,a=[];if(t===f)for(let e=1;e<=s;e++)a.push(i.getX(0)),a.push(i.getX(e)),a.push(i.getX(e+1));else for(let e=0;e<s;e++)e%2==0?(a.push(i.getX(e)),a.push(i.getX(e+1)),a.push(i.getX(e+2))):(a.push(i.getX(e+2)),a.push(i.getX(e+1)),a.push(i.getX(e)));a.length/3!==s&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const n=e.clone();return n.setIndex(a),n.clearGroups(),n}return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),e}function Fs(e){const t=new Map,i=new Map,s=e.clone();return ks(e,s,function(e,s){t.set(s,e),i.set(e,s)}),s.traverse(function(e){if(!e.isSkinnedMesh)return;const s=e,a=t.get(e),n=a.skeleton.bones;s.skeleton=a.skeleton.clone(),s.bindMatrix.copy(a.bindMatrix),s.skeleton.bones=n.map(function(e){return i.get(e)}),s.bind(s.skeleton,s.bindMatrix)}),s}function ks(e,t,i){i(e,t);for(let s=0;s<e.children.length;s++)ks(e.children[s],t.children[s],i)}class Ls extends o{constructor(e){super(e),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new qs(e)}),this.register(function(e){return new Hs(e)}),this.register(function(e){return new $s(e)}),this.register(function(e){return new Zs(e)}),this.register(function(e){return new ea(e)}),this.register(function(e){return new zs(e)}),this.register(function(e){return new Ks(e)}),this.register(function(e){return new Vs(e)}),this.register(function(e){return new Js(e)}),this.register(function(e){return new Os(e)}),this.register(function(e){return new Ys(e)}),this.register(function(e){return new js(e)}),this.register(function(e){return new Xs(e)}),this.register(function(e){return new Ws(e)}),this.register(function(e){return new Gs(e)}),this.register(function(e){return new ta(e,Us.EXT_MESHOPT_COMPRESSION)}),this.register(function(e){return new ta(e,Us.KHR_MESHOPT_COMPRESSION)}),this.register(function(e){return new ia(e)})}load(e,t,i,s){const a=this;let n;if(""!==this.resourcePath)n=this.resourcePath;else if(""!==this.path){const t=E.extractUrlBase(e);n=E.resolveURL(t,this.path)}else n=E.extractUrlBase(e);this.manager.itemStart(e);const r=function(t){s?s(t):console.error(t),a.manager.itemError(e),a.manager.itemEnd(e)},o=new A(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(e,function(i){try{a.parse(i,n,function(i){t(i),a.manager.itemEnd(e)},r)}catch(e){r(e)}},i,r)}setDRACOLoader(e){return this.dracoLoader=e,this}setKTX2Loader(e){return this.ktx2Loader=e,this}setMeshoptDecoder(e){return this.meshoptDecoder=e,this}register(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,i,s){let a;const n={},r={},o=new TextDecoder;if("string"==typeof e)a=JSON.parse(e);else if(e instanceof ArrayBuffer){if(o.decode(new Uint8Array(e,0,4))===sa){try{n[Us.KHR_BINARY_GLTF]=new ra(e)}catch(e){return void(s&&s(e))}a=JSON.parse(n[Us.KHR_BINARY_GLTF].content)}else a=JSON.parse(o.decode(e))}else a=e;if(void 0===a.asset||a.asset.version[0]<2)return void(s&&s(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported.")));const A=new Ta(a,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});A.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e<this.pluginCallbacks.length;e++){const t=this.pluginCallbacks[e](A);t.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),r[t.name]=t,n[t.name]=!0}if(a.extensionsUsed)for(let e=0;e<a.extensionsUsed.length;++e){const t=a.extensionsUsed[e],i=a.extensionsRequired||[];switch(t){case Us.KHR_MATERIALS_UNLIT:n[t]=new Ns;break;case Us.KHR_DRACO_MESH_COMPRESSION:n[t]=new oa(a,this.dracoLoader);break;case Us.KHR_TEXTURE_TRANSFORM:n[t]=new Aa;break;case Us.KHR_MESH_QUANTIZATION:n[t]=new la;break;default:i.indexOf(t)>=0&&void 0===r[t]&&console.warn('THREE.GLTFLoader: Unknown extension "'+t+'".')}}A.setExtensions(n),A.setPlugins(r),A.parse(i,s)}parseAsync(e,t){const i=this;return new Promise(function(s,a){i.parse(e,t,s,a)})}}function Ps(){let e={};return{get:function(t){return e[t]},add:function(t,i){e[t]=i},remove:function(t){delete e[t]},removeAll:function(){e={}}}}function _s(e,t,i){const s=e.json.materials[t];return s.extensions&&s.extensions[i]?s.extensions[i]:null}const Us={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",KHR_MESHOPT_COMPRESSION:"KHR_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class Gs{constructor(e){this.parser=e,this.name=Us.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let i=0,s=t.length;i<s;i++){const s=t[i];s.extensions&&s.extensions[this.name]&&void 0!==s.extensions[this.name].light&&e._addNodeRef(this.cache,s.extensions[this.name].light)}}_loadLight(e){const t=this.parser,i="light:"+e;let s=t.cache.get(i);if(s)return s;const a=t.json,n=((a.extensions&&a.extensions[this.name]||{}).lights||[])[e];let r;const o=new p(16777215);void 0!==n.color&&o.setRGB(n.color[0],n.color[1],n.color[2],c);const A=void 0!==n.range?n.range:0;switch(n.type){case"directional":r=new x(o),r.target.position.set(0,0,-1),r.add(r.target);break;case"point":r=new B(o),r.distance=A;break;case"spot":r=new w(o),r.distance=A,n.spot=n.spot||{},n.spot.innerConeAngle=void 0!==n.spot.innerConeAngle?n.spot.innerConeAngle:0,n.spot.outerConeAngle=void 0!==n.spot.outerConeAngle?n.spot.outerConeAngle:Math.PI/4,r.angle=n.spot.outerConeAngle,r.penumbra=1-n.spot.innerConeAngle/n.spot.outerConeAngle,r.target.position.set(0,0,-1),r.add(r.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+n.type)}return r.position.set(0,0,0),va(r,n),void 0!==n.intensity&&(r.intensity=n.intensity),r.name=t.createUniqueName(n.name||"light_"+e),s=Promise.resolve(r),t.cache.add(i,s),s}getDependency(e,t){if("light"===e)return this._loadLight(t)}createNodeAttachment(e){const t=this,i=this.parser,s=i.json.nodes[e],a=(s.extensions&&s.extensions[this.name]||{}).light;return void 0===a?null:this._loadLight(a).then(function(e){return i._getNodeRef(t.cache,a,e)})}}let Ns=class{constructor(){this.name=Us.KHR_MATERIALS_UNLIT}getMaterialType(){return J}extendParams(e,t,i){const s=[];e.color=new p(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],c),e.opacity=t[3]}void 0!==a.baseColorTexture&&s.push(i.assignTexture(e,"map",a.baseColorTexture,l))}return Promise.all(s)}},Os=class{constructor(e){this.parser=e,this.name=Us.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(e,t){const i=_s(this.parser,e,this.name);return null===i||void 0!==i.emissiveStrength&&(t.emissiveIntensity=i.emissiveStrength),Promise.resolve()}},qs=class{constructor(e){this.parser=e,this.name=Us.KHR_MATERIALS_CLEARCOAT}getMaterialType(e){return null!==_s(this.parser,e,this.name)?C:null}extendMaterialParams(e,t){const i=_s(this.parser,e,this.name);if(null===i)return Promise.resolve();const s=[];if(void 0!==i.clearcoatFactor&&(t.clearcoat=i.clearcoatFactor),void 0!==i.clearcoatTexture&&s.push(this.parser.assignTexture(t,"clearcoatMap",i.clearcoatTexture)),void 0!==i.clearcoatRoughnessFactor&&(t.clearcoatRoughness=i.clearcoatRoughnessFactor),void 0!==i.clearcoatRoughnessTexture&&s.push(this.parser.assignTexture(t,"clearcoatRoughnessMap",i.clearcoatRoughnessTexture)),void 0!==i.clearcoatNormalTexture&&(s.push(this.parser.assignTexture(t,"clearcoatNormalMap",i.clearcoatNormalTexture)),void 0!==i.clearcoatNormalTexture.scale)){const e=i.clearcoatNormalTexture.scale;t.clearcoatNormalScale=new y(e,e)}return Promise.all(s)}},Hs=class{constructor(e){this.parser=e,this.name=Us.KHR_MATERIALS_DISPERSION}getMaterialType(e){return null!==_s(this.parser,e,this.name)?C:null}extendMaterialParams(e,t){const i=_s(this.parser,e,this.name);return null===i||(t.dispersion=void 0!==i.dispersion?i.dispersion:0),Promise.resolve()}},js=class{constructor(e){this.parser=e,this.name=Us.KHR_MATERIALS_IRIDESCENCE}getMaterialType(e){return null!==_s(this.parser,e,this.name)?C:null}extendMaterialParams(e,t){const i=_s(this.parser,e,this.name);if(null===i)return Promise.resolve();const s=[];return void 0!==i.iridescenceFactor&&(t.iridescence=i.iridescenceFactor),void 0!==i.iridescenceTexture&&s.push(this.parser.assignTexture(t,"iridescenceMap",i.iridescenceTexture)),void 0!==i.iridescenceIor&&(t.iridescenceIOR=i.iridescenceIor),void 0===t.iridescenceThicknessRange&&(t.iridescenceThicknessRange=[100,400]),void 0!==i.iridescenceThicknessMinimum&&(t.iridescenceThicknessRange[0]=i.iridescenceThicknessMinimum),void 0!==i.iridescenceThicknessMaximum&&(t.iridescenceThicknessRange[1]=i.iridescenceThicknessMaximum),void 0!==i.iridescenceThicknessTexture&&s.push(this.parser.assignTexture(t,"iridescenceThicknessMap",i.iridescenceThicknessTexture)),Promise.all(s)}},zs=class{constructor(e){this.parser=e,this.name=Us.KHR_MATERIALS_SHEEN}getMaterialType(e){return null!==_s(this.parser,e,this.name)?C:null}extendMaterialParams(e,t){const i=_s(this.parser,e,this.name);if(null===i)return Promise.resolve();const s=[];if(t.sheenColor=new p(0,0,0),t.sheenRoughness=0,t.sheen=1,void 0!==i.sheenColorFactor){const e=i.sheenColorFactor;t.sheenColor.setRGB(e[0],e[1],e[2],c)}return void 0!==i.sheenRoughnessFactor&&(t.sheenRoughness=i.sheenRoughnessFactor),void 0!==i.sheenColorTexture&&s.push(this.parser.assignTexture(t,"sheenColorMap",i.sheenColorTexture,l)),void 0!==i.sheenRoughnessTexture&&s.push(this.parser.assignTexture(t,"sheenRoughnessMap",i.sheenRoughnessTexture)),Promise.all(s)}},Ks=class{constructor(e){this.parser=e,this.name=Us.KHR_MATERIALS_TRANSMISSION}getMaterialType(e){return null!==_s(this.parser,e,this.name)?C:null}extendMaterialParams(e,t){const i=_s(this.parser,e,this.name);if(null===i)return Promise.resolve();const s=[];return void 0!==i.transmissionFactor&&(t.transmission=i.transmissionFactor),void 0!==i.transmissionTexture&&s.push(this.parser.assignTexture(t,"transmissionMap",i.transmissionTexture)),Promise.all(s)}},Vs=class{constructor(e){this.parser=e,this.name=Us.KHR_MATERIALS_VOLUME}getMaterialType(e){return null!==_s(this.parser,e,this.name)?C:null}extendMaterialParams(e,t){const i=_s(this.parser,e,this.name);if(null===i)return Promise.resolve();const s=[];t.thickness=void 0!==i.thicknessFactor?i.thicknessFactor:0,void 0!==i.thicknessTexture&&s.push(this.parser.assignTexture(t,"thicknessMap",i.thicknessTexture)),t.attenuationDistance=i.attenuationDistance||1/0;const a=i.attenuationColor||[1,1,1];return t.attenuationColor=(new p).setRGB(a[0],a[1],a[2],c),Promise.all(s)}},Js=class{constructor(e){this.parser=e,this.name=Us.KHR_MATERIALS_IOR}getMaterialType(e){return null!==_s(this.parser,e,this.name)?C:null}extendMaterialParams(e,t){const i=_s(this.parser,e,this.name);return null===i||(t.ior=void 0!==i.ior?i.ior:1.5),Promise.resolve()}},Ys=class{constructor(e){this.parser=e,this.name=Us.KHR_MATERIALS_SPECULAR}getMaterialType(e){return null!==_s(this.parser,e,this.name)?C:null}extendMaterialParams(e,t){const i=_s(this.parser,e,this.name);if(null===i)return Promise.resolve();const s=[];t.specularIntensity=void 0!==i.specularFactor?i.specularFactor:1,void 0!==i.specularTexture&&s.push(this.parser.assignTexture(t,"specularIntensityMap",i.specularTexture));const a=i.specularColorFactor||[1,1,1];return t.specularColor=(new p).setRGB(a[0],a[1],a[2],c),void 0!==i.specularColorTexture&&s.push(this.parser.assignTexture(t,"specularColorMap",i.specularColorTexture,l)),Promise.all(s)}},Ws=class{constructor(e){this.parser=e,this.name=Us.EXT_MATERIALS_BUMP}getMaterialType(e){return null!==_s(this.parser,e,this.name)?C:null}extendMaterialParams(e,t){const i=_s(this.parser,e,this.name);if(null===i)return Promise.resolve();const s=[];return t.bumpScale=void 0!==i.bumpFactor?i.bumpFactor:1,void 0!==i.bumpTexture&&s.push(this.parser.assignTexture(t,"bumpMap",i.bumpTexture)),Promise.all(s)}},Xs=class{constructor(e){this.parser=e,this.name=Us.KHR_MATERIALS_ANISOTROPY}getMaterialType(e){return null!==_s(this.parser,e,this.name)?C:null}extendMaterialParams(e,t){const i=_s(this.parser,e,this.name);if(null===i)return Promise.resolve();const s=[];return void 0!==i.anisotropyStrength&&(t.anisotropy=i.anisotropyStrength),void 0!==i.anisotropyRotation&&(t.anisotropyRotation=i.anisotropyRotation),void 0!==i.anisotropyTexture&&s.push(this.parser.assignTexture(t,"anisotropyMap",i.anisotropyTexture)),Promise.all(s)}};class $s{constructor(e){this.parser=e,this.name=Us.KHR_TEXTURE_BASISU}loadTexture(e){const t=this.parser,i=t.json,s=i.textures[e];if(!s.extensions||!s.extensions[this.name])return null;const a=s.extensions[this.name],n=t.options.ktx2Loader;if(!n){if(i.extensionsRequired&&i.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,a.source,n)}}class Zs{constructor(e){this.parser=e,this.name=Us.EXT_TEXTURE_WEBP}loadTexture(e){const t=this.name,i=this.parser,s=i.json,a=s.textures[e];if(!a.extensions||!a.extensions[t])return null;const n=a.extensions[t],r=s.images[n.source];let o=i.textureLoader;if(r.uri){const e=i.options.manager.getHandler(r.uri);null!==e&&(o=e)}return i.loadTextureImage(e,n.source,o)}}class ea{constructor(e){this.parser=e,this.name=Us.EXT_TEXTURE_AVIF}loadTexture(e){const t=this.name,i=this.parser,s=i.json,a=s.textures[e];if(!a.extensions||!a.extensions[t])return null;const n=a.extensions[t],r=s.images[n.source];let o=i.textureLoader;if(r.uri){const e=i.options.manager.getHandler(r.uri);null!==e&&(o=e)}return i.loadTextureImage(e,n.source,o)}}class ta{constructor(e,t){this.name=t,this.parser=e}loadBufferView(e){const t=this.parser.json,i=t.bufferViews[e];if(i.extensions&&i.extensions[this.name]){const e=i.extensions[this.name],s=this.parser.getDependency("buffer",e.buffer),a=this.parser.options.meshoptDecoder;if(!a||!a.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(t){const i=e.byteOffset||0,s=e.byteLength||0,n=e.count,r=e.byteStride,o=new Uint8Array(t,i,s);return a.decodeGltfBufferAsync?a.decodeGltfBufferAsync(n,r,o,e.mode,e.filter).then(function(e){return e.buffer}):a.ready.then(function(){const t=new ArrayBuffer(n*r);return a.decodeGltfBuffer(new Uint8Array(t),n,r,o,e.mode,e.filter),t})})}return null}}let ia=class{constructor(e){this.name=Us.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,i=t.nodes[e];if(!i.extensions||!i.extensions[this.name]||void 0===i.mesh)return null;const s=t.meshes[i.mesh];for(const e of s.primitives)if(e.mode!==ga.TRIANGLES&&e.mode!==ga.TRIANGLE_STRIP&&e.mode!==ga.TRIANGLE_FAN&&void 0!==e.mode)return null;const a=i.extensions[this.name].attributes,n=[],r={};for(const e in a)n.push(this.parser.getDependency("accessor",a[e]).then(t=>(r[e]=t,r[e])));return n.length<1?null:(n.push(this.parser.createNodeMesh(e)),Promise.all(n).then(e=>{const t=e.pop(),i=t.isGroup?t.children:[t],s=e[0].count,a=[];for(const e of i){const t=new v,i=new S,n=new Q,o=new S(1,1,1),A=new M(e.geometry,e.material,s);for(let e=0;e<s;e++)r.TRANSLATION&&i.fromBufferAttribute(r.TRANSLATION,e),r.ROTATION&&n.fromBufferAttribute(r.ROTATION,e),r.SCALE&&o.fromBufferAttribute(r.SCALE,e),A.setMatrixAt(e,t.compose(i,n,o));for(const t in r)if("_COLOR_0"===t){const e=r[t];A.instanceColor=new D(e.array,e.itemSize,e.normalized)}else"TRANSLATION"!==t&&"ROTATION"!==t&&"SCALE"!==t&&e.geometry.setAttribute(t,r[t]);R.prototype.copy.call(A,e),this.parser.assignFinalMaterial(A),a.push(A)}return t.isGroup?(t.clear(),t.add(...a),t):a[0]}))}};const sa="glTF",aa=1313821514,na=5130562;class ra{constructor(e){this.name=Us.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,12),i=new TextDecoder;if(this.header={magic:i.decode(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==sa)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const s=this.header.length-12,a=new DataView(e,12);let n=0;for(;n<s;){const t=a.getUint32(n,!0);n+=4;const s=a.getUint32(n,!0);if(n+=4,s===aa){const s=new Uint8Array(e,12+n,t);this.content=i.decode(s)}else if(s===na){const i=12+n;this.body=e.slice(i,i+t)}n+=t}if(null===this.content)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class oa{constructor(e,t){if(!t)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=Us.KHR_DRACO_MESH_COMPRESSION,this.json=e,this.dracoLoader=t,this.dracoLoader.preload()}decodePrimitive(e,t){const i=this.json,s=this.dracoLoader,a=e.extensions[this.name].bufferView,n=e.extensions[this.name].attributes,r={},o={},A={};for(const e in n){const t=fa[e]||e.toLowerCase();r[t]=n[e]}for(const t in e.attributes){const s=fa[t]||t.toLowerCase();if(void 0!==n[t]){const a=i.accessors[e.attributes[t]],n=ua[a.componentType];A[s]=n.name,o[s]=!0===a.normalized}}return t.getDependency("bufferView",a).then(function(e){return new Promise(function(t,i){s.decodeDracoFile(e,function(e){for(const t in e.attributes){const i=e.attributes[t],s=o[t];void 0!==s&&(i.normalized=s)}t(e)},r,A,c,i)})})}}class Aa{constructor(){this.name=Us.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 la{constructor(){this.name=Us.KHR_MESH_QUANTIZATION}}class ca extends me{constructor(e,t,i,s){super(e,t,i,s)}copySampleValue_(e){const t=this.resultBuffer,i=this.sampleValues,s=this.valueSize,a=e*s*3+s;for(let e=0;e!==s;e++)t[e]=i[a+e];return t}interpolate_(e,t,i,s){const a=this.resultBuffer,n=this.sampleValues,r=this.valueSize,o=2*r,A=3*r,l=s-t,c=(i-t)/l,h=c*c,d=h*c,g=e*A,u=g-A,p=-2*d+3*h,m=d-h,b=1-p,f=m-h+c;for(let e=0;e!==r;e++){const t=n[u+e+r],i=n[u+e+o]*l,s=n[g+e+r],A=n[g+e]*l;a[e]=b*t+f*i+p*s+m*A}return a}}const ha=new Q;class da extends ca{interpolate_(e,t,i,s){const a=super.interpolate_(e,t,i,s);return ha.fromArray(a).normalize().toArray(a),a}}const ga={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},ua={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},pa={9728:G,9729:U,9984:_,9985:P,9986:L,9987:k},ma={33071:q,33648:O,10497:N},ba={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},fa={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"},Ia={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Ea={CUBICSPLINE:void 0,LINEAR:ce,STEP:le},Ca="OPAQUE",ya="MASK",wa="BLEND";function Ba(e){return void 0===e.DefaultMaterial&&(e.DefaultMaterial=new K({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:pe})),e.DefaultMaterial}function xa(e,t,i){for(const s in i.extensions)void 0===e[s]&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[s]=i.extensions[s])}function va(e,t){void 0!==t.extras&&("object"==typeof t.extras?Object.assign(e.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function Sa(e,t){if(e.updateMorphTargets(),void 0!==t.weights)for(let i=0,s=t.weights.length;i<s;i++)e.morphTargetInfluences[i]=t.weights[i];if(t.extras&&Array.isArray(t.extras.targetNames)){const i=t.extras.targetNames;if(e.morphTargetInfluences.length===i.length){e.morphTargetDictionary={};for(let t=0,s=i.length;t<s;t++)e.morphTargetDictionary[i[t]]=t}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Qa(e){let t;const i=e.extensions&&e.extensions[Us.KHR_DRACO_MESH_COMPRESSION];if(t=i?"draco:"+i.bufferView+":"+i.indices+":"+Ma(i.attributes):e.indices+":"+Ma(e.attributes)+":"+e.mode,void 0!==e.targets)for(let i=0,s=e.targets.length;i<s;i++)t+=":"+Ma(e.targets[i]);return t}function Ma(e){let t="";const i=Object.keys(e).sort();for(let s=0,a=i.length;s<a;s++)t+=i[s]+":"+e[i[s]]+";";return t}function Da(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 Ra=new v;class Ta{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new Ps,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let i=!1,s=-1,a=!1,n=-1;if("undefined"!=typeof navigator&&void 0!==navigator.userAgent){const e=navigator.userAgent;i=!0===/^((?!chrome|android).)*safari/i.test(e);const t=e.match(/Version\/(\d+)/);s=i&&t?parseInt(t[1],10):-1,a=e.indexOf("Firefox")>-1,n=a?e.match(/Firefox\/([0-9]+)\./)[1]:-1}"undefined"==typeof createImageBitmap||i&&s<17||a&&n<98?this.textureLoader=new T(this.options.manager):this.textureLoader=new F(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new A(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 i=this,s=this.json,a=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([i.getDependencies("scene"),i.getDependencies("animation"),i.getDependencies("camera")])}).then(function(t){const n={scene:t[0][s.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:s.asset,parser:i,userData:{}};return xa(a,n,s),va(n,s),Promise.all(i._invokeAll(function(e){return e.afterRoot&&e.afterRoot(n)})).then(function(){for(const e of n.scenes)e.updateMatrixWorld();e(n)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],i=this.json.meshes||[];for(let i=0,s=t.length;i<s;i++){const s=t[i].joints;for(let t=0,i=s.length;t<i;t++)e[s[t]].isBone=!0}for(let t=0,s=e.length;t<s;t++){const s=e[t];void 0!==s.mesh&&(this._addNodeRef(this.meshCache,s.mesh),void 0!==s.skin&&(i[s.mesh].isSkinnedMesh=!0)),void 0!==s.camera&&this._addNodeRef(this.cameraCache,s.camera)}}_addNodeRef(e,t){void 0!==t&&(void 0===e.refs[t]&&(e.refs[t]=e.uses[t]=0),e.refs[t]++)}_getNodeRef(e,t,i){if(e.refs[t]<=1)return i;const s=i.clone(),a=(e,t)=>{const i=this.associations.get(e);null!=i&&this.associations.set(t,i);for(const[i,s]of e.children.entries())a(s,t.children[i])};return a(i,s),s.name+="_instance_"+e.uses[t]++,s}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let i=0;i<t.length;i++){const s=e(t[i]);if(s)return s}return null}_invokeAll(e){const t=Object.values(this.plugins);t.unshift(this);const i=[];for(let s=0;s<t.length;s++){const a=e(t[s]);a&&i.push(a)}return i}getDependency(e,t){const i=e+":"+t;let s=this.cache.get(i);if(!s){switch(e){case"scene":s=this.loadScene(t);break;case"node":s=this._invokeOne(function(e){return e.loadNode&&e.loadNode(t)});break;case"mesh":s=this._invokeOne(function(e){return e.loadMesh&&e.loadMesh(t)});break;case"accessor":s=this.loadAccessor(t);break;case"bufferView":s=this._invokeOne(function(e){return e.loadBufferView&&e.loadBufferView(t)});break;case"buffer":s=this.loadBuffer(t);break;case"material":s=this._invokeOne(function(e){return e.loadMaterial&&e.loadMaterial(t)});break;case"texture":s=this._invokeOne(function(e){return e.loadTexture&&e.loadTexture(t)});break;case"skin":s=this.loadSkin(t);break;case"animation":s=this._invokeOne(function(e){return e.loadAnimation&&e.loadAnimation(t)});break;case"camera":s=this.loadCamera(t);break;default:if(s=this._invokeOne(function(i){return i!=this&&i.getDependency&&i.getDependency(e,t)}),!s)throw new Error("Unknown type: "+e)}this.cache.add(i,s)}return s}getDependencies(e){let t=this.cache.get(e);if(!t){const i=this,s=this.json[e+("mesh"===e?"es":"s")]||[];t=Promise.all(s.map(function(t,s){return i.getDependency(e,s)})),this.cache.add(e,t)}return t}loadBuffer(e){const t=this.json.buffers[e],i=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[Us.KHR_BINARY_GLTF].body);const s=this.options;return new Promise(function(e,a){i.load(E.resolveURL(t.uri,s.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 i=t.byteLength||0,s=t.byteOffset||0;return e.slice(s,s+i)})}loadAccessor(e){const t=this,i=this.json,s=this.json.accessors[e];if(void 0===s.bufferView&&void 0===s.sparse){const e=ba[s.type],t=ua[s.componentType],i=!0===s.normalized,a=new t(s.count*e);return Promise.resolve(new d(a,e,i))}const a=[];return void 0!==s.bufferView?a.push(this.getDependency("bufferView",s.bufferView)):a.push(null),void 0!==s.sparse&&(a.push(this.getDependency("bufferView",s.sparse.indices.bufferView)),a.push(this.getDependency("bufferView",s.sparse.values.bufferView))),Promise.all(a).then(function(e){const a=e[0],n=ba[s.type],r=ua[s.componentType],o=r.BYTES_PER_ELEMENT,A=o*n,l=s.byteOffset||0,c=void 0!==s.bufferView?i.bufferViews[s.bufferView].byteStride:void 0,h=!0===s.normalized;let p,m;if(c&&c!==A){const e=Math.floor(l/c),i="InterleavedBuffer:"+s.bufferView+":"+s.componentType+":"+e+":"+s.count;let A=t.cache.get(i);A||(p=new r(a,e*c,s.count*c/o),A=new g(p,c/o),t.cache.add(i,A)),m=new u(A,n,l%c/o,h)}else p=null===a?new r(s.count*n):new r(a,l,s.count*n),m=new d(p,n,h);if(void 0!==s.sparse){const t=ba.SCALAR,i=ua[s.sparse.indices.componentType],o=s.sparse.indices.byteOffset||0,A=s.sparse.values.byteOffset||0,l=new i(e[1],o,s.sparse.count*t),c=new r(e[2],A,s.sparse.count*n);null!==a&&(m=new d(m.array.slice(),m.itemSize,m.normalized)),m.normalized=!1;for(let e=0,t=l.length;e<t;e++){const t=l[e];if(m.setX(t,c[e*n]),n>=2&&m.setY(t,c[e*n+1]),n>=3&&m.setZ(t,c[e*n+2]),n>=4&&m.setW(t,c[e*n+3]),n>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}m.normalized=h}return m})}loadTexture(e){const t=this.json,i=this.options,s=t.textures[e].source,a=t.images[s];let n=this.textureLoader;if(a.uri){const e=i.manager.getHandler(a.uri);null!==e&&(n=e)}return this.loadTextureImage(e,s,n)}loadTextureImage(e,t,i){const s=this,a=this.json,n=a.textures[e],r=a.images[t],o=(r.uri||r.bufferView)+":"+n.sampler;if(this.textureCache[o])return this.textureCache[o];const A=this.loadImageSource(t,i).then(function(t){t.flipY=!1,t.name=n.name||r.name||"",""===t.name&&"string"==typeof r.uri&&!1===r.uri.startsWith("data:image/")&&(t.name=r.uri);const i=(a.samplers||{})[n.sampler]||{};return t.magFilter=pa[i.magFilter]||U,t.minFilter=pa[i.minFilter]||k,t.wrapS=ma[i.wrapS]||N,t.wrapT=ma[i.wrapT]||N,t.generateMipmaps=!t.isCompressedTexture&&t.minFilter!==G&&t.minFilter!==U,s.associations.set(t,{textures:e}),t}).catch(function(){return null});return this.textureCache[o]=A,A}loadImageSource(e,t){const i=this,s=this.json,a=this.options;if(void 0!==this.sourceCache[e])return this.sourceCache[e].then(e=>e.clone());const n=s.images[e],r=self.URL||self.webkitURL;let o=n.uri||"",A=!1;if(void 0!==n.bufferView)o=i.getDependency("bufferView",n.bufferView).then(function(e){A=!0;const t=new Blob([e],{type:n.mimeType});return o=r.createObjectURL(t),o});else if(void 0===n.uri)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const l=Promise.resolve(o).then(function(e){return new Promise(function(i,s){let n=i;!0===t.isImageBitmapLoader&&(n=function(e){const t=new he(e);t.needsUpdate=!0,i(t)}),t.load(E.resolveURL(e,a.path),n,void 0,s)})}).then(function(e){var t;return!0===A&&r.revokeObjectURL(o),va(e,n),e.userData.mimeType=n.mimeType||((t=n.uri).search(/\.jpe?g($|\?)/i)>0||0===t.search(/^data\:image\/jpeg/)?"image/jpeg":t.search(/\.webp($|\?)/i)>0||0===t.search(/^data\:image\/webp/)?"image/webp":t.search(/\.ktx2($|\?)/i)>0||0===t.search(/^data\:image\/ktx2/)?"image/ktx2":"image/png"),e}).catch(function(e){throw console.error("THREE.GLTFLoader: Couldn't load texture",o),e});return this.sourceCache[e]=l,l}assignTexture(e,t,i,s){const a=this;return this.getDependency("texture",i.index).then(function(n){if(!n)return null;if(void 0!==i.texCoord&&i.texCoord>0&&((n=n.clone()).channel=i.texCoord),a.extensions[Us.KHR_TEXTURE_TRANSFORM]){const e=void 0!==i.extensions?i.extensions[Us.KHR_TEXTURE_TRANSFORM]:void 0;if(e){const t=a.associations.get(n);n=a.extensions[Us.KHR_TEXTURE_TRANSFORM].extendTexture(n,e),a.associations.set(n,t)}}return void 0!==s&&(n.colorSpace=s),e[t]=n,n})}assignFinalMaterial(e){const t=e.geometry;let i=e.material;const s=void 0===t.attributes.tangent,a=void 0!==t.attributes.color,n=void 0===t.attributes.normal;if(e.isPoints){const e="PointsMaterial:"+i.uuid;let t=this.cache.get(e);t||(t=new H,j.prototype.copy.call(t,i),t.color.copy(i.color),t.map=i.map,t.sizeAttenuation=!1,this.cache.add(e,t)),i=t}else if(e.isLine){const e="LineBasicMaterial:"+i.uuid;let t=this.cache.get(e);t||(t=new z,j.prototype.copy.call(t,i),t.color.copy(i.color),t.map=i.map,this.cache.add(e,t)),i=t}if(s||a||n){let e="ClonedMaterial:"+i.uuid+":";s&&(e+="derivative-tangents:"),a&&(e+="vertex-colors:"),n&&(e+="flat-shading:");let t=this.cache.get(e);t||(t=i.clone(),a&&(t.vertexColors=!0),n&&(t.flatShading=!0),s&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(i))),i=t}e.material=i}getMaterialType(){return K}loadMaterial(e){const t=this,i=this.json,s=this.extensions,a=i.materials[e];let n;const r={},o=[];if((a.extensions||{})[Us.KHR_MATERIALS_UNLIT]){const e=s[Us.KHR_MATERIALS_UNLIT];n=e.getMaterialType(),o.push(e.extendParams(r,a,t))}else{const i=a.pbrMetallicRoughness||{};if(r.color=new p(1,1,1),r.opacity=1,Array.isArray(i.baseColorFactor)){const e=i.baseColorFactor;r.color.setRGB(e[0],e[1],e[2],c),r.opacity=e[3]}void 0!==i.baseColorTexture&&o.push(t.assignTexture(r,"map",i.baseColorTexture,l)),r.metalness=void 0!==i.metallicFactor?i.metallicFactor:1,r.roughness=void 0!==i.roughnessFactor?i.roughnessFactor:1,void 0!==i.metallicRoughnessTexture&&(o.push(t.assignTexture(r,"metalnessMap",i.metallicRoughnessTexture)),o.push(t.assignTexture(r,"roughnessMap",i.metallicRoughnessTexture))),n=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),o.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,r)})))}!0===a.doubleSided&&(r.side=V);const A=a.alphaMode||Ca;if(A===wa?(r.transparent=!0,r.depthWrite=!1):(r.transparent=!1,A===ya&&(r.alphaTest=void 0!==a.alphaCutoff?a.alphaCutoff:.5)),void 0!==a.normalTexture&&n!==J&&(o.push(t.assignTexture(r,"normalMap",a.normalTexture)),r.normalScale=new y(1,1),void 0!==a.normalTexture.scale)){const e=a.normalTexture.scale;r.normalScale.set(e,e)}if(void 0!==a.occlusionTexture&&n!==J&&(o.push(t.assignTexture(r,"aoMap",a.occlusionTexture)),void 0!==a.occlusionTexture.strength&&(r.aoMapIntensity=a.occlusionTexture.strength)),void 0!==a.emissiveFactor&&n!==J){const e=a.emissiveFactor;r.emissive=(new p).setRGB(e[0],e[1],e[2],c)}return void 0!==a.emissiveTexture&&n!==J&&o.push(t.assignTexture(r,"emissiveMap",a.emissiveTexture,l)),Promise.all(o).then(function(){const i=new n(r);return a.name&&(i.name=a.name),va(i,a),t.associations.set(i,{materials:e}),a.extensions&&xa(s,i,a),i})}createUniqueName(e){const t=Y.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,i=this.extensions,s=this.primitiveCache;function a(e){return i[Us.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then(function(i){return Fa(i,e,t)})}const n=[];for(let i=0,r=e.length;i<r;i++){const r=e[i],o=Qa(r),A=s[o];if(A)n.push(A.promise);else{let e;e=r.extensions&&r.extensions[Us.KHR_DRACO_MESH_COMPRESSION]?a(r):Fa(new h,r,t),s[o]={primitive:r,promise:e},n.push(e)}}return Promise.all(n)}loadMesh(e){const t=this,i=this.json,s=this.extensions,a=i.meshes[e],n=a.primitives,r=[];for(let e=0,t=n.length;e<t;e++){const t=void 0===n[e].material?Ba(this.cache):this.getDependency("material",n[e].material);r.push(t)}return r.push(t.loadGeometries(n)),Promise.all(r).then(function(i){const r=i.slice(0,i.length-1),o=i[i.length-1],A=[];for(let i=0,l=o.length;i<l;i++){const l=o[i],c=n[i];let h;const d=r[i];if(c.mode===ga.TRIANGLES||c.mode===ga.TRIANGLE_STRIP||c.mode===ga.TRIANGLE_FAN||void 0===c.mode)h=!0===a.isSkinnedMesh?new W(l,d):new X(l,d),!0===h.isSkinnedMesh&&h.normalizeSkinWeights(),c.mode===ga.TRIANGLE_STRIP?h.geometry=Ts(h.geometry,I):c.mode===ga.TRIANGLE_FAN&&(h.geometry=Ts(h.geometry,f));else if(c.mode===ga.LINES)h=new $(l,d);else if(c.mode===ga.LINE_STRIP)h=new Z(l,d);else if(c.mode===ga.LINE_LOOP)h=new ee(l,d);else{if(c.mode!==ga.POINTS)throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+c.mode);h=new te(l,d)}Object.keys(h.geometry.morphAttributes).length>0&&Sa(h,a),h.name=t.createUniqueName(a.name||"mesh_"+e),va(h,a),c.extensions&&xa(s,h,c),t.assignFinalMaterial(h),A.push(h)}for(let i=0,s=A.length;i<s;i++)t.associations.set(A[i],{meshes:e,primitives:i});if(1===A.length)return a.extensions&&xa(s,A[0],a),A[0];const l=new ie;a.extensions&&xa(s,l,a),t.associations.set(l,{meshes:e});for(let e=0,t=A.length;e<t;e++)l.add(A[e]);return l})}loadCamera(e){let t;const i=this.json.cameras[e],s=i[i.type];if(s)return"perspective"===i.type?t=new se(ae.radToDeg(s.yfov),s.aspectRatio||1,s.znear||1,s.zfar||2e6):"orthographic"===i.type&&(t=new ne(-s.xmag,s.xmag,s.ymag,-s.ymag,s.znear,s.zfar)),i.name&&(t.name=this.createUniqueName(i.name)),va(t,i),Promise.resolve(t);console.warn("THREE.GLTFLoader: Missing camera parameters.")}loadSkin(e){const t=this.json.skins[e],i=[];for(let e=0,s=t.joints.length;e<s;e++)i.push(this._loadNodeShallow(t.joints[e]));return void 0!==t.inverseBindMatrices?i.push(this.getDependency("accessor",t.inverseBindMatrices)):i.push(null),Promise.all(i).then(function(e){const i=e.pop(),s=e,a=[],n=[];for(let e=0,r=s.length;e<r;e++){const r=s[e];if(r){a.push(r);const t=new v;null!==i&&t.fromArray(i.array,16*e),n.push(t)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',t.joints[e])}return new re(a,n)})}loadAnimation(e){const t=this.json,i=this,s=t.animations[e],a=s.name?s.name:"animation_"+e,n=[],r=[],o=[],A=[],l=[];for(let e=0,t=s.channels.length;e<t;e++){const t=s.channels[e],i=s.samplers[t.sampler],a=t.target,c=a.node,h=void 0!==s.parameters?s.parameters[i.input]:i.input,d=void 0!==s.parameters?s.parameters[i.output]:i.output;void 0!==a.node&&(n.push(this.getDependency("node",c)),r.push(this.getDependency("accessor",h)),o.push(this.getDependency("accessor",d)),A.push(i),l.push(a))}return Promise.all([Promise.all(n),Promise.all(r),Promise.all(o),Promise.all(A),Promise.all(l)]).then(function(e){const t=e[0],n=e[1],r=e[2],o=e[3],A=e[4],l=[];for(let e=0,s=t.length;e<s;e++){const s=t[e],a=n[e],c=r[e],h=o[e],d=A[e];if(void 0===s)continue;s.updateMatrix&&s.updateMatrix();const g=i._createAnimationTracks(s,a,c,h,d);if(g)for(let e=0;e<g.length;e++)l.push(g[e])}const c=new oe(a,void 0,l);return va(c,s),c})}createNodeMesh(e){const t=this.json,i=this,s=t.nodes[e];return void 0===s.mesh?null:i.getDependency("mesh",s.mesh).then(function(e){const t=i._getNodeRef(i.meshCache,s.mesh,e);return void 0!==s.weights&&t.traverse(function(e){if(e.isMesh)for(let t=0,i=s.weights.length;t<i;t++)e.morphTargetInfluences[t]=s.weights[t]}),t})}loadNode(e){const t=this,i=this.json.nodes[e],s=t._loadNodeShallow(e),a=[],n=i.children||[];for(let e=0,i=n.length;e<i;e++)a.push(t.getDependency("node",n[e]));const r=void 0===i.skin?Promise.resolve(null):t.getDependency("skin",i.skin);return Promise.all([s,Promise.all(a),r]).then(function(e){const t=e[0],i=e[1],s=e[2];null!==s&&t.traverse(function(e){e.isSkinnedMesh&&e.bind(s,Ra)});for(let e=0,s=i.length;e<s;e++)t.add(i[e]);if(void 0!==t.userData.pivot&&i.length>0){const e=t.userData.pivot,s=i[0];t.pivot=(new S).fromArray(e),t.position.x-=e[0],t.position.y-=e[1],t.position.z-=e[2],s.position.set(0,0,0),delete t.userData.pivot}return t})}_loadNodeShallow(e){const t=this.json,i=this.extensions,s=this;if(void 0!==this.nodeCache[e])return this.nodeCache[e];const a=t.nodes[e],n=a.name?s.createUniqueName(a.name):"",r=[],o=s._invokeOne(function(t){return t.createNodeMesh&&t.createNodeMesh(e)});return o&&r.push(o),void 0!==a.camera&&r.push(s.getDependency("camera",a.camera).then(function(e){return s._getNodeRef(s.cameraCache,a.camera,e)})),s._invokeAll(function(t){return t.createNodeAttachment&&t.createNodeAttachment(e)}).forEach(function(e){r.push(e)}),this.nodeCache[e]=Promise.all(r).then(function(t){let r;if(r=!0===a.isBone?new Ae:t.length>1?new ie:1===t.length?t[0]:new R,r!==t[0])for(let e=0,i=t.length;e<i;e++)r.add(t[e]);if(a.name&&(r.userData.name=a.name,r.name=n),va(r,a),a.extensions&&xa(i,r,a),void 0!==a.matrix){const e=new v;e.fromArray(a.matrix),r.applyMatrix4(e)}else void 0!==a.translation&&r.position.fromArray(a.translation),void 0!==a.rotation&&r.quaternion.fromArray(a.rotation),void 0!==a.scale&&r.scale.fromArray(a.scale);if(s.associations.has(r)){if(void 0!==a.mesh&&s.meshCache.refs[a.mesh]>1){const e=s.associations.get(r);s.associations.set(r,{...e})}}else s.associations.set(r,{});return s.associations.get(r).nodes=e,r}),this.nodeCache[e]}loadScene(e){const t=this.extensions,i=this.json.scenes[e],s=this,a=new ie;i.name&&(a.name=s.createUniqueName(i.name)),va(a,i),i.extensions&&xa(t,a,i);const n=i.nodes||[],r=[];for(let e=0,t=n.length;e<t;e++)r.push(s.getDependency("node",n[e]));return Promise.all(r).then(function(e){for(let t=0,i=e.length;t<i;t++){const i=e[t];null!==i.parent?a.add(Fs(i)):a.add(i)}return s.associations=(e=>{const t=new Map;for(const[e,i]of s.associations)(e instanceof j||e instanceof he)&&t.set(e,i);return e.traverse(e=>{const i=s.associations.get(e);null!=i&&t.set(e,i)}),t})(a),a})}_createAnimationTracks(e,t,i,s,a){const n=[],r=e.name?e.name:e.uuid,o=[];let A;switch(Ia[a.path]===Ia.weights?e.traverse(function(e){e.morphTargetInfluences&&o.push(e.name?e.name:e.uuid)}):o.push(r),Ia[a.path]){case Ia.weights:A=ge;break;case Ia.rotation:A=ue;break;case Ia.translation:case Ia.scale:A=de;break;default:if(1===i.itemSize)A=ge;else A=de}const l=void 0!==s.interpolation?Ea[s.interpolation]:ce,c=this._getArrayFromAccessor(i);for(let e=0,i=o.length;e<i;e++){const i=new A(o[e]+"."+Ia[a.path],t.array,c,l);"CUBICSPLINE"===s.interpolation&&this._createCubicSplineTrackInterpolant(i),n.push(i)}return n}_getArrayFromAccessor(e){let t=e.array;if(e.normalized){const e=Da(t.constructor),i=new Float32Array(t.length);for(let s=0,a=t.length;s<a;s++)i[s]=t[s]*e;t=i}return t}_createCubicSplineTrackInterpolant(e){e.createInterpolant=function(e){return new(this instanceof ue?da:ca)(this.times,this.values,this.getValueSize()/3,e)},e.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function Fa(e,t,i){const s=t.attributes,a=[];function n(t,s){return i.getDependency("accessor",t).then(function(t){e.setAttribute(s,t)})}for(const t in s){const i=fa[t]||t.toLowerCase();i in e.attributes||a.push(n(s[t],i))}if(void 0!==t.indices&&!e.index){const s=i.getDependency("accessor",t.indices).then(function(t){e.setIndex(t)});a.push(s)}return m.workingColorSpace!==c&&"COLOR_0"in s&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${m.workingColorSpace}" not supported.`),va(e,t),function(e,t,i){const s=t.attributes,a=new be;if(void 0===s.POSITION)return;{const e=i.json.accessors[s.POSITION],t=e.min,n=e.max;if(void 0===t||void 0===n)return void console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");if(a.set(new S(t[0],t[1],t[2]),new S(n[0],n[1],n[2])),e.normalized){const t=Da(ua[e.componentType]);a.min.multiplyScalar(t),a.max.multiplyScalar(t)}}const n=t.targets;if(void 0!==n){const e=new S,t=new S;for(let s=0,a=n.length;s<a;s++){const a=n[s];if(void 0!==a.POSITION){const s=i.json.accessors[a.POSITION],n=s.min,r=s.max;if(void 0!==n&&void 0!==r){if(t.setX(Math.max(Math.abs(n[0]),Math.abs(r[0]))),t.setY(Math.max(Math.abs(n[1]),Math.abs(r[1]))),t.setZ(Math.max(Math.abs(n[2]),Math.abs(r[2]))),s.normalized){const e=Da(ua[s.componentType]);t.multiplyScalar(e)}e.max(t)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}a.expandByVector(e)}e.boundingBox=a;const r=new fe;a.getCenter(r.center),r.radius=a.min.distanceTo(a.max)/2,e.boundingSphere=r}(e,t,i),Promise.all(a).then(function(){return void 0!==t.targets?function(e,t,i){let s=!1,a=!1,n=!1;for(let e=0,i=t.length;e<i;e++){const i=t[e];if(void 0!==i.POSITION&&(s=!0),void 0!==i.NORMAL&&(a=!0),void 0!==i.COLOR_0&&(n=!0),s&&a&&n)break}if(!s&&!a&&!n)return Promise.resolve(e);const r=[],o=[],A=[];for(let l=0,c=t.length;l<c;l++){const c=t[l];if(s){const t=void 0!==c.POSITION?i.getDependency("accessor",c.POSITION):e.attributes.position;r.push(t)}if(a){const t=void 0!==c.NORMAL?i.getDependency("accessor",c.NORMAL):e.attributes.normal;o.push(t)}if(n){const t=void 0!==c.COLOR_0?i.getDependency("accessor",c.COLOR_0):e.attributes.color;A.push(t)}}return Promise.all([Promise.all(r),Promise.all(o),Promise.all(A)]).then(function(t){const i=t[0],r=t[1],o=t[2];return s&&(e.morphAttributes.position=i),a&&(e.morphAttributes.normal=r),n&&(e.morphAttributes.color=o),e.morphTargetsRelative=!0,e})}(e,t.targets,i):e})}class ka{constructor(e=4){this.pool=e,this.queue=[],this.workers=[],this.workersResolve=[],this.workerStatus=0,this.workerCreator=null}_initWorker(e){if(!this.workers[e]){const t=this.workerCreator();t.addEventListener("message",this._onMessage.bind(this,e)),this.workers[e]=t}}_getIdleWorker(){for(let e=0;e<this.pool;e++)if(!(this.workerStatus&1<<e))return e;return-1}_onMessage(e,t){const i=this.workersResolve[e];if(i&&i(t),this.queue.length){const{resolve:t,msg:i,transfer:s}=this.queue.shift();this.workersResolve[e]=t,this.workers[e].postMessage(i,s)}else this.workerStatus^=1<<e}setWorkerCreator(e){this.workerCreator=e}setWorkerLimit(e){this.pool=e}postMessage(e,t){return new Promise(i=>{const s=this._getIdleWorker();-1!==s?(this._initWorker(s),this.workerStatus|=1<<s,this.workersResolve[s]=i,this.workers[s].postMessage(e,t)):this.queue.push({resolve:i,msg:e,transfer:t})})}dispose(){this.workers.forEach(e=>e.terminate()),this.workersResolve.length=0,this.workers.length=0,this.queue.length=0,this.workerStatus=0}}const La=9,Pa=15,_a=16,Ua=22,Ga=37,Na=43,Oa=76,qa=83,Ha=97,ja=100,za=103,Ka=109,Va=122,Ja=123,Ya=131,Wa=132,Xa=133,$a=134,Za=137,en=138,tn=139,sn=140,an=141,nn=142,rn=145,on=146,An=148,ln=152,cn=153,hn=154,dn=155,gn=156,un=157,pn=158,mn=165,bn=166,fn=1000054e3,In=1000054001,En=1000054004,Cn=1000054005,yn=1000066e3,wn=1000066004;class Bn{constructor(e,t,i,s){this._dataView=void 0,this._littleEndian=void 0,this._offset=void 0,this._dataView=new DataView(e.buffer,e.byteOffset+t,i),this._littleEndian=s,this._offset=0}_nextUint8(){const e=this._dataView.getUint8(this._offset);return this._offset+=1,e}_nextUint16(){const e=this._dataView.getUint16(this._offset,this._littleEndian);return this._offset+=2,e}_nextUint32(){const e=this._dataView.getUint32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint64(){const e=this._dataView.getUint32(this._offset,this._littleEndian)+2**32*this._dataView.getUint32(this._offset+4,this._littleEndian);return this._offset+=8,e}_nextInt32(){const e=this._dataView.getInt32(this._offset,this._littleEndian);return this._offset+=4,e}_nextUint8Array(e){const t=new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+this._offset,e);return this._offset+=e,t}_skip(e){return this._offset+=e,this}_scan(e,t=0){const i=this._offset;let s=0;for(;this._dataView.getUint8(this._offset)!==t&&s<e;)s++,this._offset++;return s<e&&this._offset++,new Uint8Array(this._dataView.buffer,this._dataView.byteOffset+i,s)}}const xn=[171,75,84,88,32,50,48,187,13,10,26,10];function vn(e){return(new TextDecoder).decode(e)}let Sn,Qn,Mn;const Dn={env:{emscripten_notify_memory_growth:function(e){Mn=new Uint8Array(Qn.exports.memory.buffer)}}};class Rn{init(){return Sn||(Sn="undefined"!=typeof fetch?fetch("data:application/wasm;base64,"+Tn).then(e=>e.arrayBuffer()).then(e=>WebAssembly.instantiate(e,Dn)).then(this._init):WebAssembly.instantiate(Buffer.from(Tn,"base64"),Dn).then(this._init),Sn)}_init(e){Qn=e.instance,Dn.env.emscripten_notify_memory_growth(0)}decode(e,t=0){if(!Qn)throw new Error("ZSTDDecoder: Await .init() before decoding.");const i=e.byteLength,s=Qn.exports.malloc(i);Mn.set(e,s),t=t||Number(Qn.exports.ZSTD_findDecompressedSize(s,i));const a=Qn.exports.malloc(t),n=Qn.exports.ZSTD_decompress(a,t,s,i),r=Mn.slice(a,a+n);return Qn.exports.free(s),Qn.exports.free(a),r}}const Tn="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/IAAgARACIQIgACABEAEgAgv3AQECfyACRQRA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AKAIINgIACyACECchAkEAIQFBhCAoAgAhACACDQEgACAAKAIAQX5xNgIAQQAPCyACQQ9qQXhxIgMQHSICQX9GDQIgAkEHakF4cSIAIAJHBEAgACACaxAdQX9GDQMLAkBBhCAoAgAiAUUEQEGAICAANgIADAELIAAgATYCBAtBhCAgADYCACAAIANBAXRBAXI2AgAMAQsgAEUNAQsgAEEIaiEBCyABC7kDAQJ/IAAgA2ohBQJAIANBB0wEQANAIAAgBU8NAiAAIAItAAA6AAAgAEEBaiEAIAJBAWohAgwAAAsACyAEQQFGBEACQCAAIAJrIgZBB00EQCAAIAItAAA6AAAgACACLQABOgABIAAgAi0AAjoAAiAAIAItAAM6AAMgAEEEaiACIAZBAnQiBkHAHmooAgBqIgIQFyACIAZB4B5qKAIAayECDAELIAAgAhAMCyACQQhqIQIgAEEIaiEACwJAAkACQAJAIAUgAU0EQCAAIANqIQEgBEEBRyAAIAJrQQ9Kcg0BA0AgACACEAwgAkEIaiECIABBCGoiACABSQ0ACwwFCyAAIAFLBEAgACEBDAQLIARBAUcgACACa0EPSnINASAAIQMgAiEEA0AgAyAEEAwgBEEIaiEEIANBCGoiAyABSQ0ACwwCCwNAIAAgAhAHIAJBEGohAiAAQRBqIgAgAUkNAAsMAwsgACEDIAIhBANAIAMgBBAHIARBEGohBCADQRBqIgMgAUkNAAsLIAIgASAAa2ohAgsDQCABIAVPDQEgASACLQAAOgAAIAFBAWohASACQQFqIQIMAAALAAsLQQECfyAAIAAoArjgASIDNgLE4AEgACgCvOABIQQgACABNgK84AEgACABIAJqNgK44AEgACABIAQgA2tqNgLA4AELpgEBAX8gACAAKALs4QEQFjYCyOABIABCADcD+OABIABCADcDuOABIABBwOABakIANwMAIABBqNAAaiIBQYyAgOAANgIAIABBADYCmOIBIABCADcDiOEBIABCAzcDgOEBIABBrNABakHgEikCADcCACAAQbTQAWpB6BIoAgA2AgAgACABNgIMIAAgAEGYIGo2AgggACAAQaAwajYCBCAAIABBEGo2AgALYQEBf0G4fyEDA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GogASACECAgACgCSCACaiEEDAELIAEgAmohAgJ/IAMEQCAAQShqIgQgA2ogAUEgIANrECAgACAAKQMIIAQpAAAQCTcDCCAAIAApAxAgACkAMBAJNwMQIAAgACkDGCAAKQA4EAk3AxggACAAKQMgIABBQGspAAAQCTcDICAAKAJIIQMgAEEANgJIIAEgA2tBIGohAQsgAUEgaiACTQsEQCACQWBqIQMgACkDICEFIAApAxghBiAAKQMQIQcgACkDCCEIA0AgCCABKQAAEAkhCCAHIAEpAAgQCSEHIAYgASkAEBAJIQYgBSABKQAYEAkhBSABQSBqIgEgA00NAAsgACAFNwMgIAAgBjcDGCAAIAc3AxAgACAINwMICyABIAJPDQEgAEEoaiABIAIgAWsiBBAgCyAAIAQ2AkgLCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQEBogAwVBun8LCy8BAX8gAEUEQEG2f0EAIAMbDwtBun8hBCADIAFNBH8gACACIAMQCxogAwVBun8LC6gCAQZ/IwBBEGsiByQAIABB2OABaikDAEKAgIAQViEIQbh/IQUCQCAEQf//B0sNACAAIAMgBBBCIgUQAyIGDQAgACgCnOIBIQkgACAHQQxqIAMgAyAFaiAGGyIKIARBACAFIAYbayIGEEAiAxADBEAgAyEFDAELIAcoAgwhBCABRQRAQbp/IQUgBEEASg0BCyAGIANrIQUgAyAKaiEDAkAgCQRAIABBADYCnOIBDAELAkACQAJAIARBBUgNACAAQdjgAWopAwBCgICACFgNAAwBCyAAQQA2ApziAQwBCyAAKAIIED8hBiAAQQA2ApziASAGQRRPDQELIAAgASACIAMgBSAEIAgQOSEFDAELIAAgASACIAMgBSAEIAgQOiEFCyAHQRBqJAAgBQtnACAAQdDgAWogASACIAAoAuzhARAuIgEQAwRAIAEPC0G4fyECAkAgAQ0AIABB7OABaigCACIBBEBBYCECIAAoApjiASABRw0BC0EAIQIgAEHw4AFqKAIARQ0AIABBkOEBahBDCyACCycBAX8QVyIERQRAQUAPCyAEIAAgASACIAMgBBBLEE8hACA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CHEEBRg0AGiACKQMICyEDIAJBMGokACADC40BAQJ/IwBBMGsiASQAAkAgAEUNACAAKAKI4gENACABIABB/OEBaigCADYCKCABIAApAvThATcDICAAEDAgACgCqOIBIQIgASABKAIoNgIYIAEgASkDIDcDECACIAFBEGoQGyAAQQA2AqjiASABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALKgECfyMAQRBrIgAkACAAQQA2AgggAEIANwMAIAAQWCEBIABBEGokACABC4cBAQN/IwBBEGsiAiQAAkAgACgCAEUgACgCBEVzDQAgAiAAKAIINgIIIAIgACkCADcDAAJ/IAIoAgAiAQRAIAIoAghBqOMJIAERBQAMAQtBqOMJECgLIgFFDQAgASAAKQIANwL04QEgAUH84QFqIAAoAgg2AgAgARBZIAEhAwsgAkEQaiQAIAMLywEBAn8jAEEgayIBJAAgAEGBgIDAADYCtOIBIABBADYCiOIBIABBADYC7OEBIABCADcDkOIBIABBADYCpOMJIABBADYC3OIBIABCADcCzOIBIABBADYCvOIBIABBADYCxOABIABCADcCnOIBIABBpOIBakIANwIAIABBrOIBakEANgIAIAFCADcCECABQgA3AhggASABKQMYNwMIIAEgASkDEDcDACABKAIIQQh2QQFxIQIgAEEANgLg4gEgACACNgKM4gEgAUEgaiQAC3YBA38jAEEwayIBJAAgAARAIAEgAEHE0AFqIgIoAgA2AiggASAAKQK80AE3AyAgACgCACEDIAEgAigCADYCGCABIAApArzQATcDECADIAFBEGoQGyABIAEoAig2AgggASABKQMgNwMAIAAgARAbCyABQTBqJAALzAEBAX8gACABKAK00AE2ApjiASAAIAEoAgQiAjYCwOABIAAgAjYCvOABIAAgAiABKAIIaiICNgK44AEgACACNgLE4AEgASgCuNABBEAgAEKBgICAEDcDiOEBIAAgAUGk0ABqNgIMIAAgAUGUIGo2AgggACABQZwwajYCBCAAIAFBDGo2AgAgAEGs0AFqIAFBqNABaigCADYCACAAQbDQAWogAUGs0AFqKAIANgIAIABBtNABaiABQbDQAWooAgA2AgAPCyAAQgA3A4jh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AAAAcAAAAPAAAAHwAAAD8AAAB/AAAA/wAAAP8BAAD/AwAA/wcAAP8PAAD/HwAA/z8AAP9/AAD//wAA//8BAP//AwD//wcA//8PAP//HwD//z8A//9/AP///wD///8B////A////wf///8P////H////z////9/AAAAAAEAAAACAAAABAAAAAAAAAACAAAABAAAAAgAAAAAAAAAAQAAAAIAAAABAAAABAAAAAQAAAAEAAAABAAAAAgAAAAIAAAACAAAAAcAAAAIAAAACQAAAAoAAAALAEGgIAsDwBBQ";m.spaces[l];const Fn=new WeakMap;let kn,Ln=0;class Pn extends o{constructor(e){super(e),this.transcoderPath="",this.transcoderBinary=null,this.transcoderPending=null,this.workerPool=new ka,this.workerSourceURL="",this.workerConfig=null,"undefined"!=typeof MSC_TRANSCODER&&console.warn('THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.')}setTranscoderPath(e){return this.transcoderPath=e,this}setWorkerLimit(e){return this.workerPool.setWorkerLimit(e),this}async detectSupportAsync(e){return console.warn('KTX2Loader: "detectSupportAsync()" has been deprecated. Use "detectSupport()" and "await renderer.init();" when creating the renderer.'),await e.init(),this.detectSupport(e)}detectSupport(e){return!0===e.isWebGPURenderer?this.workerConfig={astcSupported:e.hasFeature("texture-compression-astc"),astcHDRSupported:!1,etc1Supported:e.hasFeature("texture-compression-etc1"),etc2Supported:e.hasFeature("texture-compression-etc2"),dxtSupported:e.hasFeature("texture-compression-s3tc"),bptcSupported:e.hasFeature("texture-compression-bc"),pvrtcSupported:e.hasFeature("texture-compression-pvrtc")}:(this.workerConfig={astcSupported:e.extensions.has("WEBGL_compressed_texture_astc"),astcHDRSupported:e.extensions.has("WEBGL_compressed_texture_astc")&&e.extensions.get("WEBGL_compressed_texture_astc").getSupportedProfiles().includes("hdr"),etc1Supported:e.extensions.has("WEBGL_compressed_texture_etc1"),etc2Supported:e.extensions.has("WEBGL_compressed_texture_etc"),dxtSupported:e.extensions.has("WEBGL_compressed_texture_s3tc"),bptcSupported:e.extensions.has("EXT_texture_compression_bptc"),pvrtcSupported:e.extensions.has("WEBGL_compressed_texture_pvrtc")||e.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")},"undefined"!=typeof navigator&&void 0!==navigator.platform&&void 0!==navigator.userAgent&&navigator.platform.indexOf("Linux")>=0&&navigator.userAgent.indexOf("Firefox")>=0&&this.workerConfig.astcSupported&&this.workerConfig.etc2Supported&&this.workerConfig.bptcSupported&&this.workerConfig.dxtSupported&&(this.workerConfig.astcSupported=!1,this.workerConfig.etc2Supported=!1)),this}init(){if(!this.transcoderPending){const e=new A(this.manager);e.setPath(this.transcoderPath),e.setWithCredentials(this.withCredentials);const t=e.loadAsync("basis_transcoder.js"),i=new A(this.manager);i.setPath(this.transcoderPath),i.setResponseType("arraybuffer"),i.setWithCredentials(this.withCredentials);const s=i.loadAsync("basis_transcoder.wasm");this.transcoderPending=Promise.all([t,s]).then(([e,t])=>{const i=Pn.BasisWorker.toString(),s=["/* constants */","let _EngineFormat = "+JSON.stringify(Pn.EngineFormat),"let _EngineType = "+JSON.stringify(Pn.EngineType),"let _TranscoderFormat = "+JSON.stringify(Pn.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(Pn.BasisFormat),"/* basis_transcoder.js */",e,"/* worker */",i.substring(i.indexOf("{")+1,i.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([s])),this.transcoderBinary=t,this.workerPool.setWorkerCreator(()=>{const e=new Worker(this.workerSourceURL),t=this.transcoderBinary.slice(0);return e.postMessage({type:"init",config:this.workerConfig,transcoderBinary:t},[t]),e})}),Ln>0&&console.warn("THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."),Ln++}return this.transcoderPending}load(e,t,i,s){if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");const a=new A(this.manager);a.setPath(this.path),a.setCrossOrigin(this.crossOrigin),a.setWithCredentials(this.withCredentials),a.setRequestHeader(this.requestHeader),a.setResponseType("arraybuffer"),a.load(e,e=>{this.parse(e,t,s)},i,s)}parse(e,t,i){if(null===this.workerConfig)throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");if(Fn.has(e)){return Fn.get(e).promise.then(t).catch(i)}this._createTexture(e).then(e=>t?t(e):null).catch(i)}_createTextureFrom(e,t){const{type:i,error:s,data:{faces:a,width:n,height:r,format:o,type:A,dfdFlags:l}}=e;if("error"===i)return Promise.reject(s);let c;if(6===t.faceCount)c=new Ie(a,o,A);else{const e=a[0].mipmaps;c=t.layerCount>1?new Ee(e,n,r,t.layerCount,o,A):new Ce(e,n,r,o,A)}return c.minFilter=1===a[0].mipmaps.length?U:k,c.magFilter=U,c.generateMipmaps=!1,c.needsUpdate=!0,c.colorSpace=Nn(t),c.premultiplyAlpha=!!(1&l),c}async _createTexture(e,t={}){const i=function(e){const t=new Uint8Array(e.buffer,e.byteOffset,xn.length);if(t[0]!==xn[0]||t[1]!==xn[1]||t[2]!==xn[2]||t[3]!==xn[3]||t[4]!==xn[4]||t[5]!==xn[5]||t[6]!==xn[6]||t[7]!==xn[7]||t[8]!==xn[8]||t[9]!==xn[9]||t[10]!==xn[10]||t[11]!==xn[11])throw new Error("Missing KTX 2.0 identifier.");const i={vkFormat:0,typeSize:1,pixelWidth:0,pixelHeight:0,pixelDepth:0,layerCount:0,faceCount:1,levelCount:0,supercompressionScheme:0,levels:[],dataFormatDescriptor:[{vendorId:0,descriptorType:0,versionNumber:2,colorModel:0,colorPrimaries:1,transferFunction:2,flags:0,texelBlockDimension:[0,0,0,0],bytesPlane:[0,0,0,0,0,0,0,0],samples:[]}],keyValue:{},globalData:null},s=17*Uint32Array.BYTES_PER_ELEMENT,a=new Bn(e,xn.length,s,!0);i.vkFormat=a._nextUint32(),i.typeSize=a._nextUint32(),i.pixelWidth=a._nextUint32(),i.pixelHeight=a._nextUint32(),i.pixelDepth=a._nextUint32(),i.layerCount=a._nextUint32(),i.faceCount=a._nextUint32(),i.levelCount=a._nextUint32(),i.supercompressionScheme=a._nextUint32();const n=a._nextUint32(),r=a._nextUint32(),o=a._nextUint32(),A=a._nextUint32(),l=a._nextUint64(),c=a._nextUint64(),h=3*Math.max(i.levelCount,1)*8,d=new Bn(e,xn.length+s,h,!0);for(let t=0,s=Math.max(i.levelCount,1);t<s;t++)i.levels.push({levelData:new Uint8Array(e.buffer,e.byteOffset+d._nextUint64(),d._nextUint64()),uncompressedByteLength:d._nextUint64()});const g=new Bn(e,n,r,!0);g._skip(4);const u=g._nextUint16(),p=g._nextUint16(),m=g._nextUint16(),b=g._nextUint16(),f={vendorId:u,descriptorType:p,versionNumber:m,colorModel:g._nextUint8(),colorPrimaries:g._nextUint8(),transferFunction:g._nextUint8(),flags:g._nextUint8(),texelBlockDimension:[g._nextUint8(),g._nextUint8(),g._nextUint8(),g._nextUint8()],bytesPlane:[g._nextUint8(),g._nextUint8(),g._nextUint8(),g._nextUint8(),g._nextUint8(),g._nextUint8(),g._nextUint8(),g._nextUint8()],samples:[]},I=(b/4-6)/4;for(let e=0;e<I;e++){const t={bitOffset:g._nextUint16(),bitLength:g._nextUint8(),channelType:g._nextUint8(),samplePosition:[g._nextUint8(),g._nextUint8(),g._nextUint8(),g._nextUint8()],sampleLower:Number.NEGATIVE_INFINITY,sampleUpper:Number.POSITIVE_INFINITY};64&t.channelType?(t.sampleLower=g._nextInt32(),t.sampleUpper=g._nextInt32()):(t.sampleLower=g._nextUint32(),t.sampleUpper=g._nextUint32()),f.samples[e]=t}i.dataFormatDescriptor.length=0,i.dataFormatDescriptor.push(f);const E=new Bn(e,o,A,!0);for(;E._offset<A;){const e=E._nextUint32(),t=E._scan(e),s=vn(t);if(i.keyValue[s]=E._nextUint8Array(e-t.byteLength-1),s.match(/^ktx/i)){const e=vn(i.keyValue[s]);i.keyValue[s]=e.substring(0,e.lastIndexOf("\0"))}E._skip(e%4?4-e%4:0)}if(c<=0)return i;const C=new Bn(e,l,c,!0),y=C._nextUint16(),w=C._nextUint16(),B=C._nextUint32(),x=C._nextUint32(),v=C._nextUint32(),S=C._nextUint32(),Q=[];for(let e=0,t=Math.max(i.levelCount,1);e<t;e++)Q.push({imageFlags:C._nextUint32(),rgbSliceByteOffset:C._nextUint32(),rgbSliceByteLength:C._nextUint32(),alphaSliceByteOffset:C._nextUint32(),alphaSliceByteLength:C._nextUint32()});const M=l+C._offset,D=M+B,R=D+x,T=R+v,F=new Uint8Array(e.buffer,e.byteOffset+M,B),k=new Uint8Array(e.buffer,e.byteOffset+D,x),L=new Uint8Array(e.buffer,e.byteOffset+R,v),P=new Uint8Array(e.buffer,e.byteOffset+T,S);return i.globalData={endpointCount:y,selectorCount:w,imageDescs:Q,endpointsData:F,selectorsData:k,tablesData:L,extendedData:P},i}(new Uint8Array(e)),s=i.vkFormat===yn&&167===i.dataFormatDescriptor[0].colorModel;if(!(0===i.vkFormat||s&&!this.workerConfig.astcHDRSupported))return async function(e){const{vkFormat:t}=e;if(void 0===Un[t])throw new Error("THREE.KTX2Loader: Unsupported vkFormat: "+t);void 0===Gn[t]&&console.warn('THREE.KTX2Loader: Missing ".type" for vkFormat: '+t);let i;2===e.supercompressionScheme&&(kn||(kn=new Promise(async e=>{const t=new Rn;await t.init(),e(t)})),i=await kn);const s=[];for(let a=0;a<e.levels.length;a++){const n=Math.max(1,e.pixelWidth>>a),r=Math.max(1,e.pixelHeight>>a),o=e.pixelDepth?Math.max(1,e.pixelDepth>>a):0,A=e.levels[a];let l,c;if(0===e.supercompressionScheme)l=A.levelData;else{if(2!==e.supercompressionScheme)throw new Error("THREE.KTX2Loader: Unsupported supercompressionScheme.");l=i.decode(A.levelData,A.uncompressedByteLength)}c=Gn[t]===Ye?new Float32Array(l.buffer,l.byteOffset,l.byteLength/Float32Array.BYTES_PER_ELEMENT):Gn[t]===Ke?new Uint16Array(l.buffer,l.byteOffset,l.byteLength/Uint16Array.BYTES_PER_ELEMENT):Gn[t]===Je||Gn[t]===Ve?new Uint32Array(l.buffer,l.byteOffset,l.byteLength/Uint32Array.BYTES_PER_ELEMENT):l,s.push({data:c,width:n,height:r,depth:o})}const a=0===e.levelCount||s.length>1;let n;if(_n.has(Un[t]))n=0===e.pixelDepth?new We(s[0].data,e.pixelWidth,e.pixelHeight):new Xe(s[0].data,e.pixelWidth,e.pixelHeight,e.pixelDepth),n.minFilter=a?_:G,n.magFilter=G,n.generateMipmaps=0===e.levelCount;else{if(e.pixelDepth>0)throw new Error("THREE.KTX2Loader: Unsupported pixelDepth.");n=new Ce(s,e.pixelWidth,e.pixelHeight),n.minFilter=a?k:U,n.magFilter=U}return n.mipmaps=s,n.type=Gn[t],n.format=Un[t],n.colorSpace=Nn(e),n.needsUpdate=!0,Promise.resolve(n)}(i);const a=t,n=this.init().then(()=>this.workerPool.postMessage({type:"transcode",buffer:e,taskConfig:a},[e])).then(e=>this._createTextureFrom(e.data,i));return Fn.set(e,{promise:n}),n}dispose(){this.workerPool.dispose(),this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),Ln--}}Pn.BasisFormat={ETC1S:0,UASTC:1,UASTC_HDR:2},Pn.TranscoderFormat={ETC1:0,ETC2:1,BC1:2,BC3:3,BC4:4,BC5:5,BC7_M6_OPAQUE_ONLY:6,BC7_M5:7,PVRTC1_4_RGB:8,PVRTC1_4_RGBA:9,ASTC_4x4:10,ATC_RGB:11,ATC_RGBA_INTERPOLATED_ALPHA:12,RGBA32:13,RGB565:14,BGR565:15,RGBA4444:16,BC6H:22,RGB_HALF:24,RGBA_HALF:25},Pn.EngineFormat={RGBAFormat:je,RGBA_ASTC_4x4_Format:ke,RGB_BPTC_UNSIGNED_Format:et,RGBA_BPTC_Format:xe,RGBA_ETC2_EAC_Format:Ne,RGBA_PVRTC_4BPPV1_Format:Be,RGBA_S3TC_DXT5_Format:De,RGB_ETC1_Format:Ze,RGB_ETC2_Format:Ge,RGB_PVRTC_4BPPV1_Format:$e,RGBA_S3TC_DXT1_Format:Te},Pn.EngineType={UnsignedByteType:ze,HalfFloatType:Ke,FloatType:Ye},Pn.BasisWorker=function(){let e,t,i;const s=_EngineFormat,a=_EngineType,n=_TranscoderFormat,r=_BasisFormat;self.addEventListener("message",function(s){const n=s.data;switch(n.type){case"init":e=n.config,o=n.transcoderBinary,t=new Promise(e=>{i={wasmBinary:o,onRuntimeInitialized:e},BASIS(i)}).then(()=>{i.initializeBasis(),void 0===i.KTX2File&&console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.")});break;case"transcode":t.then(()=>{try{const{faces:t,buffers:s,width:o,height:h,hasAlpha:d,format:g,type:u,dfdFlags:p}=function(t){const s=new i.KTX2File(new Uint8Array(t));function n(){s.close(),s.delete()}if(!s.isValid())throw n(),new Error("THREE.KTX2Loader:\tInvalid or unsupported .ktx2 file");let o;if(s.isUASTC())o=r.UASTC;else if(s.isETC1S())o=r.ETC1S;else{if(!s.isHDR())throw new Error("THREE.KTX2Loader: Unknown Basis encoding");o=r.UASTC_HDR}const h=s.getWidth(),d=s.getHeight(),g=s.getLayers()||1,u=s.getLevels(),p=s.getFaces(),m=s.getHasAlpha(),b=s.getDFDFlags(),{transcoderFormat:f,engineFormat:I,engineType:E}=function(t,i,s,a){const n=A[t];for(let r=0;r<n.length;r++){const o=n[r];if(o.if&&!e[o.if])continue;if(!o.basisFormat.includes(t))continue;if(a&&o.transcoderFormat.length<2)continue;if(o.needsPowerOfTwo&&(!l(i)||!l(s)))continue;return{transcoderFormat:o.transcoderFormat[a?1:0],engineFormat:o.engineFormat[a?1:0],engineType:o.engineType[0]}}throw new Error("THREE.KTX2Loader: Failed to identify transcoding target.")}(o,h,d,m);if(!h||!d||!u)throw n(),new Error("THREE.KTX2Loader:\tInvalid texture");if(!s.startTranscoding())throw n(),new Error("THREE.KTX2Loader: .startTranscoding failed");const C=[],y=[];for(let e=0;e<p;e++){const t=[];for(let i=0;i<u;i++){const r=[];let o,A;for(let t=0;t<g;t++){const l=s.getImageLevelInfo(i,t,e);0!==e||0!==i||0!==t||l.origWidth%4==0&&l.origHeight%4==0||console.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions."),u>1?(o=l.origWidth,A=l.origHeight):(o=l.width,A=l.height);let c=new Uint8Array(s.getImageTranscodedSizeInBytes(i,t,0,f));const h=s.transcodeImage(c,i,t,e,f,0,-1,-1);if(E===a.HalfFloatType&&(c=new Uint16Array(c.buffer,c.byteOffset,c.byteLength/Uint16Array.BYTES_PER_ELEMENT)),!h)throw n(),new Error("THREE.KTX2Loader: .transcodeImage failed.");r.push(c)}const l=c(r);t.push({data:l,width:o,height:A}),y.push(l.buffer)}C.push({mipmaps:t,width:h,height:d,format:I,type:E})}return n(),{faces:C,buffers:y,width:h,height:d,hasAlpha:m,dfdFlags:b,format:I,type:E}}(n.buffer);self.postMessage({type:"transcode",id:n.id,data:{faces:t,width:o,height:h,hasAlpha:d,format:g,type:u,dfdFlags:p}},s)}catch(e){console.error(e),self.postMessage({type:"error",id:n.id,error:e.message})}})}var o});const o=[{if:"astcSupported",basisFormat:[r.UASTC],transcoderFormat:[n.ASTC_4x4,n.ASTC_4x4],engineFormat:[s.RGBA_ASTC_4x4_Format,s.RGBA_ASTC_4x4_Format],engineType:[a.UnsignedByteType],priorityETC1S:1/0,priorityUASTC:1,needsPowerOfTwo:!1},{if:"bptcSupported",basisFormat:[r.ETC1S,r.UASTC],transcoderFormat:[n.BC7_M5,n.BC7_M5],engineFormat:[s.RGBA_BPTC_Format,s.RGBA_BPTC_Format],engineType:[a.UnsignedByteType],priorityETC1S:3,priorityUASTC:2,needsPowerOfTwo:!1},{if:"dxtSupported",basisFormat:[r.ETC1S,r.UASTC],transcoderFormat:[n.BC1,n.BC3],engineFormat:[s.RGBA_S3TC_DXT1_Format,s.RGBA_S3TC_DXT5_Format],engineType:[a.UnsignedByteType],priorityETC1S:4,priorityUASTC:5,needsPowerOfTwo:!1},{if:"etc2Supported",basisFormat:[r.ETC1S,r.UASTC],transcoderFormat:[n.ETC1,n.ETC2],engineFormat:[s.RGB_ETC2_Format,s.RGBA_ETC2_EAC_Format],engineType:[a.UnsignedByteType],priorityETC1S:1,priorityUASTC:3,needsPowerOfTwo:!1},{if:"etc1Supported",basisFormat:[r.ETC1S,r.UASTC],transcoderFormat:[n.ETC1],engineFormat:[s.RGB_ETC1_Format],engineType:[a.UnsignedByteType],priorityETC1S:2,priorityUASTC:4,needsPowerOfTwo:!1},{if:"pvrtcSupported",basisFormat:[r.ETC1S,r.UASTC],transcoderFormat:[n.PVRTC1_4_RGB,n.PVRTC1_4_RGBA],engineFormat:[s.RGB_PVRTC_4BPPV1_Format,s.RGBA_PVRTC_4BPPV1_Format],engineType:[a.UnsignedByteType],priorityETC1S:5,priorityUASTC:6,needsPowerOfTwo:!0},{if:"bptcSupported",basisFormat:[r.UASTC_HDR],transcoderFormat:[n.BC6H],engineFormat:[s.RGB_BPTC_UNSIGNED_Format],engineType:[a.HalfFloatType],priorityHDR:1,needsPowerOfTwo:!1},{basisFormat:[r.ETC1S,r.UASTC],transcoderFormat:[n.RGBA32,n.RGBA32],engineFormat:[s.RGBAFormat,s.RGBAFormat],engineType:[a.UnsignedByteType,a.UnsignedByteType],priorityETC1S:100,priorityUASTC:100,needsPowerOfTwo:!1},{basisFormat:[r.UASTC_HDR],transcoderFormat:[n.RGBA_HALF],engineFormat:[s.RGBAFormat],engineType:[a.HalfFloatType],priorityHDR:100,needsPowerOfTwo:!1}],A={[r.ETC1S]:o.filter(e=>e.basisFormat.includes(r.ETC1S)).sort((e,t)=>e.priorityETC1S-t.priorityETC1S),[r.UASTC]:o.filter(e=>e.basisFormat.includes(r.UASTC)).sort((e,t)=>e.priorityUASTC-t.priorityUASTC),[r.UASTC_HDR]:o.filter(e=>e.basisFormat.includes(r.UASTC_HDR)).sort((e,t)=>e.priorityHDR-t.priorityHDR)};function l(e){return e<=2||!(e&e-1)&&0!==e}function c(e){if(1===e.length)return e[0];let t=0;for(let i=0;i<e.length;i++){t+=e[i].byteLength}const i=new Uint8Array(t);let s=0;for(let t=0;t<e.length;t++){const a=e[t];i.set(a,s),s+=a.byteLength}return i}};const _n=new Set([je,Oe,He,qe]),Un={[Ka]:je,[za]:He,[ja]:qe,[Ha]:je,[qa]:He,[Oa]:qe,[Na]:je,[Ga]:je,[Ua]:He,[_a]:He,[Pa]:qe,[La]:qe,[Ja]:Oe,[Va]:Oe,[ln]:Ne,[An]:Ge,[cn]:Ue,[hn]:_e,[dn]:Pe,[gn]:Le,[yn]:ke,[pn]:ke,[un]:ke,[wn]:Fe,[bn]:Fe,[mn]:Fe,[$a]:Te,[Xa]:Te,[Wa]:Re,[Ya]:Re,[en]:De,[Za]:De,[sn]:Me,[tn]:Qe,[nn]:Se,[an]:ve,[on]:xe,[rn]:xe,[Cn]:Be,[In]:Be,[En]:we,[fn]:we},Gn={[Ka]:Ye,[za]:Ye,[ja]:Ye,[Ha]:Ke,[qa]:Ke,[Oa]:Ke,[Na]:ze,[Ga]:ze,[Ua]:ze,[_a]:ze,[Pa]:ze,[La]:ze,[Ja]:Je,[Va]:Ve,[ln]:ze,[An]:ze,[cn]:ze,[hn]:ze,[dn]:ze,[gn]:ze,[yn]:Ke,[pn]:ze,[un]:ze,[wn]:Ke,[bn]:ze,[mn]:ze,[$a]:ze,[Xa]:ze,[Wa]:ze,[Ya]:ze,[en]:ze,[Za]:ze,[sn]:ze,[tn]:ze,[nn]:ze,[an]:ze,[on]:ze,[rn]:ze,[Cn]:ze,[In]:ze,[En]:ze,[fn]:ze};function Nn(e){const t=e.dataFormatDescriptor[0];return 1===t.colorPrimaries?2===t.transferFunction?l:c:10===t.colorPrimaries?2===t.transferFunction?"display-p3":"display-p3-linear":(0===t.colorPrimaries||console.warn(`THREE.KTX2Loader: Unsupported color primaries, "${t.colorPrimaries}"`),ye)}
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */var On,qn;const Hn=Symbol("retainerCount"),jn=Symbol("recentlyUsed"),zn=Symbol("evict"),Kn=Symbol("evictionThreshold"),Vn=Symbol("cache");class Jn{constructor(e,t=5){this[On]=new Map,this[qn]=[],this[Vn]=e,this[Kn]=t}set evictionThreshold(e){this[Kn]=e,this[zn]()}get evictionThreshold(){return this[Kn]}get cache(){return this[Vn]}retainerCount(e){return this[Hn].get(e)||0}reset(){this[Hn].clear(),this[jn]=[]}retain(e){this[Hn].has(e)||this[Hn].set(e,0),this[Hn].set(e,this[Hn].get(e)+1);const t=this[jn].indexOf(e);-1!==t&&this[jn].splice(t,1),this[jn].unshift(e),this[zn]()}release(e){this[Hn].has(e)&&this[Hn].set(e,Math.max(this[Hn].get(e)-1,0)),this[zn]()}[(On=Hn,qn=jn,zn)](){if(!(this[jn].length<this[Kn]))for(let e=this[jn].length-1;e>=this[Kn];--e){const t=this[jn][e];0===this[Hn].get(t)&&(this[Vn].delete(t),this[jn].splice(e,1))}}}
/* @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Yn=e=>{const t=new Map;for(const i of e.mappings)for(const e of i.variants)t.set(e,{material:null,gltfMaterialIndex:i.material});return t};class Wn{constructor(e){this.parser=e,this.name="KHR_materials_variants"}afterRoot(e){const t=this.parser,i=t.json;if(void 0===i.extensions||void 0===i.extensions[this.name])return null;const s=(e=>{const t=[],i=new Set;for(const s of e){let e=s,a=0;for(;i.has(e);)e=s+"."+ ++a;i.add(e),t.push(e)}return t})((i.extensions[this.name].variants||[]).map(e=>e.name));for(const s of e.scenes)s.traverse(e=>{const s=e;if(!s.material)return;const a=t.associations.get(s);if(null==a||null==a.meshes||null==a.primitives)return;const n=i.meshes[a.meshes].primitives[a.primitives].extensions;n&&n[this.name]&&(s.userData.variantMaterials=Yn(n[this.name]))});return e.userData.variants=s,Promise.resolve()}}
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */var Xn,$n;he.DEFAULT_ANISOTROPY=4;const Zn=new Map,er=new Map;let tr;const ir=new class extends o{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,i,s){const a=new A(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,s)},i,s)}parse(e,t,i=()=>{}){this.decodeDracoFile(e,t,null,null,l,i).catch(i)}decodeDracoFile(e,t,i,s,a=c,n=()=>{}){const r={attributeIDs:i||this.defaultAttributeIDs,attributeTypes:s||this.defaultAttributeTypes,useUniqueIDs:!!i,vertexColorSpace:a};return this.decodeGeometry(e,r).then(t).catch(n)}decodeGeometry(e,t){const i=JSON.stringify(t);if(Ds.has(e)){const t=Ds.get(e);if(t.key===i)return t.promise;if(0===e.byteLength)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let s;const a=this.workerNextTaskID++,n=e.byteLength,r=this._getWorker(a,n).then(i=>(s=i,new Promise((i,n)=>{s._callbacks[a]={resolve:i,reject:n},s.postMessage({type:"decode",id:a,taskConfig:t,buffer:e},[e])}))).then(e=>this._createGeometry(e.geometry));return r.catch(()=>!0).then(()=>{s&&a&&this._releaseTask(s,a)}),Ds.set(e,{key:i,promise:r}),r}_createGeometry(e){const t=new h;e.index&&t.setIndex(new d(e.index.array,1));for(let i=0;i<e.attributes.length;i++){const{name:s,array:a,itemSize:n,stride:r,vertexColorSpace:o}=e.attributes[i];let A;if(n===r)A=new d(a,n);else{const e=new g(a,r);A=new u(e,n,0)}"color"===s&&(this._assignVertexColorSpace(A,o),A.normalized=a instanceof Float32Array==!1),t.setAttribute(s,A)}return t}_assignVertexColorSpace(e,t){if(t!==l)return;const i=new p;for(let t=0,s=e.count;t<s;t++)i.fromBufferAttribute(e,t),m.colorSpaceToWorking(i,l),e.setXYZ(t,i.r,i.g,i.b)}_loadLibrary(e,t){const i=new A(this.manager);return i.setPath(this.decoderPath),i.setResponseType(t),i.setWithCredentials(this.withCredentials),new Promise((t,s)=>{i.load(e,t,void 0,s)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e="object"!=typeof WebAssembly||"js"===this.decoderConfig.type,t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(t=>{const i=t[0];e||(this.decoderConfig.wasmBinary=t[1]);const s=Rs.toString(),a=["/* draco decoder */",i,"","/* worker */",s.substring(s.indexOf("{")+1,s.lastIndexOf("}"))].join("\n");this.workerSourceURL=URL.createObjectURL(new Blob([a]))}),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 i=t.data;switch(i.type){case"decode":e._callbacks[i.id].resolve(i);break;case"error":e._callbacks[i.id].reject(i);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+i.type+'"')}},this.workerPool.push(e)}else this.workerPool.sort(function(e,t){return e._taskLoad>t._taskLoad?-1:1});const i=this.workerPool[this.workerPool.length-1];return i._taskCosts[e]=t,i._taskLoad+=t,i})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e<this.workerPool.length;++e)this.workerPool[e].terminate();return this.workerPool.length=0,""!==this.workerSourceURL&&URL.revokeObjectURL(this.workerSourceURL),this}};let sr;const ar=new Pn;let nr,rr;const or=Symbol("loader"),Ar=Symbol("evictionPolicy"),lr=Symbol("GLTFInstance");class cr extends tt{static setDRACODecoderLocation(e){tr=e,ir.setDecoderPath(e)}static getDRACODecoderLocation(){return tr}static setKTX2TranscoderLocation(e){sr=e,ar.setTranscoderPath(e)}static getKTX2TranscoderLocation(){return sr}static setMeshoptDecoderLocation(e){var t;nr!==e&&(nr=e,rr=(t=e,new Promise((e,i)=>{const s=document.createElement("script");document.body.appendChild(s),s.onload=e,s.onerror=i,s.async=!0,s.src=t})).then(()=>Ms.ready).then(()=>Ms))}static getMeshoptDecoderLocation(){return nr}static initializeKTX2Loader(e){ar.detectSupport(e)}static get cache(){return Zn}static clearCache(){Zn.forEach((e,t)=>{this.delete(t)}),this[Ar].reset()}static has(e){return Zn.has(e)}static async delete(e){if(!this.has(e))return;const t=Zn.get(e);er.delete(e),Zn.delete(e);(await t).dispose()}static hasFinishedLoading(e){return!!er.get(e)}constructor(e){super(),this[$n]=(new Ls).register(e=>new Wn(e)),this[lr]=e,this[or].setDRACOLoader(ir),this[or].setKTX2Loader(ar)}get[(Xn=Ar,$n=or,Ar)](){return this.constructor[Ar]}async preload(e,t,i=()=>{}){if(this[or].setWithCredentials(t.withCredentials),this.dispatchEvent({type:"preload",element:t,src:e}),!Zn.has(e)){null!=rr&&this[or].setMeshoptDecoder(await rr);const t=((e,t,i=()=>{})=>{const s=e=>{const t=e.loaded/e.total;i(Math.max(0,Math.min(1,isFinite(t)?t:1)))};return new Promise((i,a)=>{t.load(e,i,s,a)})})(e,this[or],e=>{i(.8*e)}),s=this[lr],a=t.then(e=>s.prepare(e)).then(e=>(i(.9),new s(e))).catch(e=>(console.error(e),new s));Zn.set(e,a)}await Zn.get(e),er.set(e,!0),i&&i(1)}async load(e,t,i=()=>{}){await this.preload(e,t,i);const s=await Zn.get(e),a=await s.clone();return this[Ar].retain(e),a.dispose=()=>{this[Ar].release(e)},a}}cr[Xn]=new Jn(cr);class hr extends R{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 y(.5,.5),this.addEventListener("removed",function(){this.traverse(function(e){e.element&&e.element instanceof e.element.ownerDocument.defaultView.Element&&null!==e.element.parentNode&&e.element.remove()})})}copy(e,t){return super.copy(e,t),this.element=e.element.cloneNode(!0),this.center=e.center,this}}const dr=new S,gr=new v,ur=new v,pr=new S,mr=new S;class br{constructor(e={}){const t=this;let i,s,a,n;const r={objects:new WeakMap},o=void 0!==e.element?e.element:document.createElement("div");function A(e){e.isCSS2DObject&&(e.element.style.display="none");for(let t=0,i=e.children.length;t<i;t++)A(e.children[t])}function l(e,i,s){if(!1!==e.visible){if(e.isCSS2DObject){dr.setFromMatrixPosition(e.matrixWorld),dr.applyMatrix4(ur);const A=dr.z>=-1&&dr.z<=1&&!0===e.layers.test(s.layers),l=e.element;l.style.display=!0===A?"":"none",!0===A&&(e.onBeforeRender(t,i,s),l.style.transform="translate("+-100*e.center.x+"%,"+-100*e.center.y+"%)translate("+(dr.x*a+a)+"px,"+(-dr.y*n+n)+"px)",l.parentNode!==o&&o.appendChild(l),e.onAfterRender(t,i,s));const h={distanceToCameraSquared:c(s,e)};r.objects.set(e,h)}for(let t=0,a=e.children.length;t<a;t++)l(e.children[t],i,s)}else A(e)}function c(e,t){return pr.setFromMatrixPosition(e.matrixWorld),mr.setFromMatrixPosition(t.matrixWorld),pr.distanceToSquared(mr)}o.style.overflow="hidden",this.domElement=o,this.sortObjects=!0,this.getSize=function(){return{width:i,height:s}},this.render=function(e,t){!0===e.matrixWorldAutoUpdate&&e.updateMatrixWorld(),null===t.parent&&!0===t.matrixWorldAutoUpdate&&t.updateMatrixWorld(),gr.copy(t.matrixWorldInverse),ur.multiplyMatrices(t.projectionMatrix,gr),l(e,e,t),this.sortObjects&&function(e){const t=function(e){const t=[];return e.traverseVisible(function(e){e.isCSS2DObject&&t.push(e)}),t}(e).sort(function(e,t){if(e.renderOrder!==t.renderOrder)return t.renderOrder-e.renderOrder;return r.objects.get(e).distanceToCameraSquared-r.objects.get(t).distanceToCameraSquared}),i=t.length;for(let e=0,s=t.length;e<s;e++)t[e].element.style.zIndex=i-e}(e)},this.setSize=function(e,t){i=e,s=t,a=i/2,n=s/2,o.style.width=e+"px",o.style.height=t+"px"}}}function fr(e,t,i){let s=i;const a=new S;return e.updateWorldMatrix(!0,!0),e.traverseVisible(e=>{const{geometry:i}=e;if(void 0!==i){const{position:n}=i.attributes;if(void 0!==n)for(let i=0,r=n.count;i<r;i++)e.isMesh?e.getVertexPosition(i,a):a.fromBufferAttribute(n,i),e.isSkinnedMesh||a.applyMatrix4(e.matrixWorld),s=t(s,a)}}),s}const Ir={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 Er{constructor(){this.textureUtils=null,this.pluginCallbacks=[],this.register(function(e){return new Zr(e)}),this.register(function(e){return new eo(e)}),this.register(function(e){return new ao(e)}),this.register(function(e){return new no(e)}),this.register(function(e){return new ro(e)}),this.register(function(e){return new oo(e)}),this.register(function(e){return new to(e)}),this.register(function(e){return new io(e)}),this.register(function(e){return new so(e)}),this.register(function(e){return new Ao(e)}),this.register(function(e){return new lo(e)}),this.register(function(e){return new co(e)}),this.register(function(e){return new ho(e)}),this.register(function(e){return new go(e)})}register(e){return-1===this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.push(e),this}unregister(e){return-1!==this.pluginCallbacks.indexOf(e)&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}setTextureUtils(e){return this.textureUtils=e,this}parse(e,t,i,s){const a=new $r,n=[];for(let e=0,t=this.pluginCallbacks.length;e<t;e++)n.push(this.pluginCallbacks[e](a));a.setPlugins(n),a.setTextureUtils(this.textureUtils),a.writeAsync(e,t,s).catch(i)}parseAsync(e,t){const i=this;return new Promise(function(s,a){i.parse(e,s,a,t)})}}const Cr=0,yr=1,wr=2,Br=3,xr=4,vr=5120,Sr=5121,Qr=5122,Mr=5123,Dr=5124,Rr=5125,Tr=5126,Fr=34962,kr=34963,Lr=9728,Pr=9729,_r=9984,Ur=9985,Gr=9986,Nr=9987,Or=33071,qr=33648,Hr=10497,jr="KHR_mesh_quantization",zr={};zr[G]=Lr,zr[_]=_r,zr[L]=Gr,zr[U]=Pr,zr[P]=Ur,zr[k]=Nr,zr[q]=Or,zr[N]=Hr,zr[O]=qr;const Kr={scale:"scale",position:"translation",quaternion:"rotation",morphTargetInfluences:"weights"},Vr=new p;function Jr(e,t){return e.length===t.length&&e.every(function(e,i){return e===t[i]})}function Yr(e){return 4*Math.ceil(e/4)}function Wr(e,t=0){const i=Yr(e.byteLength);if(i!==e.byteLength){const s=new Uint8Array(i);if(s.set(new Uint8Array(e)),0!==t)for(let a=e.byteLength;a<i;a++)s[a]=t;return s.buffer}return e}function Xr(){return"undefined"==typeof document&&"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(1,1):document.createElement("canvas")}class $r{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter r"+it}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map},this.textureUtils=null}setPlugins(e){this.plugins=e}setTextureUtils(e){this.textureUtils=e}async writeAsync(e,t,i={}){this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},i),this.options.animations.length>0&&(this.options.trs=!0),await this.processInputAsync(e),await Promise.all(this.pending);const s=this,a=s.buffers,n=s.json;i=s.options;const r=s.extensionsUsed,o=s.extensionsRequired,A=new Blob(a,{type:"application/octet-stream"}),l=Object.keys(r),c=Object.keys(o);if(l.length>0&&(n.extensionsUsed=l),c.length>0&&(n.extensionsRequired=c),n.buffers&&n.buffers.length>0&&(n.buffers[0].byteLength=A.size),!0===i.binary){const e=new FileReader;e.readAsArrayBuffer(A),e.onloadend=function(){const i=Wr(e.result),s=new DataView(new ArrayBuffer(8));s.setUint32(0,i.byteLength,!0),s.setUint32(4,5130562,!0);const a=Wr((r=JSON.stringify(n),(new TextEncoder).encode(r).buffer),32);var r;const o=new DataView(new ArrayBuffer(8));o.setUint32(0,a.byteLength,!0),o.setUint32(4,1313821514,!0);const A=new ArrayBuffer(12),l=new DataView(A);l.setUint32(0,1179937895,!0),l.setUint32(4,2,!0);const c=12+o.byteLength+a.byteLength+s.byteLength+i.byteLength;l.setUint32(8,c,!0);const h=new Blob([A,o,a,s,i],{type:"application/octet-stream"}),d=new FileReader;d.readAsArrayBuffer(h),d.onloadend=function(){t(d.result)}}}else if(n.buffers&&n.buffers.length>0){const e=new FileReader;e.readAsDataURL(A),e.onloadend=function(){const i=e.result;n.buffers[0].uri=i,t(n)}}else t(n)}serializeUserData(e,t){if(0===Object.keys(e.userData).length)return;const i=this.options,s=this.extensionsUsed;try{const a=JSON.parse(JSON.stringify(e.userData));if(i.includeCustomExtensions&&a.gltfExtensions){void 0===t.extensions&&(t.extensions={});for(const e in a.gltfExtensions)t.extensions[e]=a.gltfExtensions[e],s[e]=!0;delete a.gltfExtensions}Object.keys(a).length>0&&(t.extras=a)}catch(t){console.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 S;for(let i=0,s=e.count;i<s;i++)if(Math.abs(t.fromBufferAttribute(e,i).length()-1)>5e-4)return!1;return!0}createNormalizedNormalAttribute(e){const t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);const i=e.clone(),s=new S;for(let e=0,t=i.count;e<t;e++)s.fromBufferAttribute(i,e),0===s.x&&0===s.y&&0===s.z?s.setX(1):s.normalize(),i.setXYZ(e,s.x,s.y,s.z);return t.attributesNormalized.set(e,i),i}applyTextureTransform(e,t){let i=!1;const s={};0===t.offset.x&&0===t.offset.y||(s.offset=t.offset.toArray(),i=!0),0!==t.rotation&&(s.rotation=t.rotation,i=!0),1===t.repeat.x&&1===t.repeat.y||(s.scale=t.repeat.toArray(),i=!0),i&&(e.extensions=e.extensions||{},e.extensions.KHR_texture_transform=s,this.extensionsUsed.KHR_texture_transform=!0)}async buildMetalRoughTextureAsync(e,t){if(e===t)return e;function i(e){return e.colorSpace===l?function(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}:function(e){return e}}e instanceof Ce&&(e=await this.decompressTextureAsync(e)),t instanceof Ce&&(t=await this.decompressTextureAsync(t));const s=e?e.image:null,a=t?t.image:null,n=Math.max(s?s.width:0,a?a.width:0),r=Math.max(s?s.height:0,a?a.height:0),o=Xr();o.width=n,o.height=r;const A=o.getContext("2d",{willReadFrequently:!0});A.fillStyle="#00ffff",A.fillRect(0,0,n,r);const c=A.getImageData(0,0,n,r);if(s){A.drawImage(s,0,0,n,r);const t=i(e),a=A.getImageData(0,0,n,r).data;for(let e=2;e<a.length;e+=4)c.data[e]=256*t(a[e]/256)}if(a){A.drawImage(a,0,0,n,r);const e=i(t),s=A.getImageData(0,0,n,r).data;for(let t=1;t<s.length;t+=4)c.data[t]=256*e(s[t]/256)}A.putImageData(c,0,0);const h=(e||t).clone();return h.source=new st(o),h.colorSpace=ye,h.channel=(e||t).channel,e&&t&&e.channel!==t.channel&&console.warn("THREE.GLTFExporter: UV channels for metalnessMap and roughnessMap textures must match."),console.warn("THREE.GLTFExporter: Merged metalnessMap and roughnessMap textures."),h}async decompressTextureAsync(e,t=1/0){if(null===this.textureUtils)throw new Error("THREE.GLTFExporter: setTextureUtils() must be called to process compressed textures.");return await this.textureUtils.decompress(e,t)}processBuffer(e){const t=this.json,i=this.buffers;return t.buffers||(t.buffers=[{byteLength:0}]),i.push(e),0}processBufferView(e,t,i,s,a){const n=this.json;let r;switch(n.bufferViews||(n.bufferViews=[]),t){case vr:case Sr:r=1;break;case Qr:case Mr:r=2;break;default:r=4}let o=e.itemSize*r;a===Fr&&(o=4*Math.ceil(o/4));const A=Yr(s*o),l=new DataView(new ArrayBuffer(A));let c=0;for(let a=i;a<i+s;a++){for(let i=0;i<e.itemSize;i++){let s;e.itemSize>4?s=e.array[a*e.itemSize+i]:(0===i?s=e.getX(a):1===i?s=e.getY(a):2===i?s=e.getZ(a):3===i&&(s=e.getW(a)),!0===e.normalized&&(s=ae.normalize(s,e.array))),t===Tr?l.setFloat32(c,s,!0):t===Dr?l.setInt32(c,s,!0):t===Rr?l.setUint32(c,s,!0):t===Qr?l.setInt16(c,s,!0):t===Mr?l.setUint16(c,s,!0):t===vr?l.setInt8(c,s):t===Sr&&l.setUint8(c,s),c+=r}c%o!==0&&(c+=o-c%o)}const h={buffer:this.processBuffer(l.buffer),byteOffset:this.byteOffset,byteLength:A};void 0!==a&&(h.target=a),a===Fr&&(h.byteStride=o),this.byteOffset+=A,n.bufferViews.push(h);return{id:n.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){const t=this,i=t.json;return i.bufferViews||(i.bufferViews=[]),new Promise(function(s){const a=new FileReader;a.readAsArrayBuffer(e),a.onloadend=function(){const e=Wr(a.result),n={buffer:t.processBuffer(e),byteOffset:t.byteOffset,byteLength:e.byteLength};t.byteOffset+=e.byteLength,s(i.bufferViews.push(n)-1)}})}processAccessor(e,t,i,s){const a=this.json;let n;if(e.array.constructor===Float32Array)n=Tr;else if(e.array.constructor===Int32Array)n=Dr;else if(e.array.constructor===Uint32Array)n=Rr;else if(e.array.constructor===Int16Array)n=Qr;else if(e.array.constructor===Uint16Array)n=Mr;else if(e.array.constructor===Int8Array)n=vr;else{if(e.array.constructor!==Uint8Array)throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: "+e.array.constructor.name);n=Sr}if(void 0===i&&(i=0),void 0!==s&&s!==1/0||(s=e.count),0===s)return null;const r=function(e,t,i){const s={min:new Array(e.itemSize).fill(Number.POSITIVE_INFINITY),max:new Array(e.itemSize).fill(Number.NEGATIVE_INFINITY)};for(let a=t;a<t+i;a++)for(let t=0;t<e.itemSize;t++){let i;e.itemSize>4?i=e.array[a*e.itemSize+t]:(0===t?i=e.getX(a):1===t?i=e.getY(a):2===t?i=e.getZ(a):3===t&&(i=e.getW(a)),!0===e.normalized&&(i=ae.normalize(i,e.array))),s.min[t]=Math.min(s.min[t],i),s.max[t]=Math.max(s.max[t],i)}return s}(e,i,s);let o;void 0!==t&&(o=e===t.index?kr:Fr);const A=this.processBufferView(e,n,i,s,o),l={bufferView:A.id,byteOffset:A.byteOffset,componentType:n,count:s,max:r.max,min:r.min,type:{1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",9:"MAT3",16:"MAT4"}[e.itemSize]};return!0===e.normalized&&(l.normalized=!0),a.accessors||(a.accessors=[]),a.accessors.push(l)-1}processImage(e,t,i,s="image/png"){if(null!==e){const a=this,n=a.cache,r=a.json,o=a.options,A=a.pending;n.images.has(e)||n.images.set(e,{});const l=n.images.get(e),c=s+":flipY/"+i.toString();if(void 0!==l[c])return l[c];r.images||(r.images=[]);const h={mimeType:s},d=Xr();d.width=Math.min(e.width,o.maxTextureSize),d.height=Math.min(e.height,o.maxTextureSize);const g=d.getContext("2d",{willReadFrequently:!0});if(!0===i&&(g.translate(0,d.height),g.scale(1,-1)),void 0!==e.data){t!==je&&console.error("GLTFExporter: Only RGBAFormat is supported.",t),(e.width>o.maxTextureSize||e.height>o.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);const i=new Uint8ClampedArray(e.height*e.width*4);for(let t=0;t<i.length;t+=4)i[t+0]=e.data[t+0],i[t+1]=e.data[t+1],i[t+2]=e.data[t+2],i[t+3]=e.data[t+3];g.putImageData(new ImageData(i,e.width,e.height),0,0)}else{if(!("undefined"!=typeof HTMLImageElement&&e instanceof HTMLImageElement||"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"undefined"!=typeof ImageBitmap&&e instanceof ImageBitmap||"undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas))throw new Error("THREE.GLTFExporter: Invalid image type. Use HTMLImageElement, HTMLCanvasElement, ImageBitmap or OffscreenCanvas.");g.drawImage(e,0,0,d.width,d.height)}!0===o.binary?A.push(function(e,t){if("undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas){let i;return"image/jpeg"===t?i=.92:"image/webp"===t&&(i=.8),e.convertToBlob({type:t,quality:i})}return new Promise(i=>e.toBlob(i,t))}(d,s).then(e=>a.processBufferViewImage(e)).then(e=>{h.bufferView=e})):h.uri=at.getDataURL(d,s);const u=r.images.push(h)-1;return l[c]=u,u}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 i={magFilter:zr[e.magFilter],minFilter:zr[e.minFilter],wrapS:zr[e.wrapS],wrapT:zr[e.wrapT]};return t.samplers.push(i)-1}async processTextureAsync(e){const t=this.options,i=this.cache,s=this.json;if(i.textures.has(e))return i.textures.get(e);s.textures||(s.textures=[]),e instanceof Ce&&(e=await this.decompressTextureAsync(e,t.maxTextureSize));let a=e.userData.mimeType;"image/webp"===a&&(a="image/png");const n={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,a)};e.name&&(n.name=e.name),await this._invokeAllAsync(async function(t){t.writeTexture&&await t.writeTexture(e,n)});const r=s.textures.push(n)-1;return i.textures.set(e,r),r}async processMaterialAsync(e){const t=this.cache,i=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;i.materials||(i.materials=[]);const s={pbrMetallicRoughness:{}};!0!==e.isMeshStandardMaterial&&!0!==e.isMeshBasicMaterial&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");const a=e.color.toArray().concat([e.opacity]);if(Jr(a,[1,1,1,1])||(s.pbrMetallicRoughness.baseColorFactor=a),e.isMeshStandardMaterial?(s.pbrMetallicRoughness.metallicFactor=e.metalness,s.pbrMetallicRoughness.roughnessFactor=e.roughness):(s.pbrMetallicRoughness.metallicFactor=0,s.pbrMetallicRoughness.roughnessFactor=1),e.metalnessMap||e.roughnessMap){const t=await this.buildMetalRoughTextureAsync(e.metalnessMap,e.roughnessMap),i={index:await this.processTextureAsync(t),texCoord:t.channel};this.applyTextureTransform(i,t),s.pbrMetallicRoughness.metallicRoughnessTexture=i}if(e.map){const t={index:await this.processTextureAsync(e.map),texCoord:e.map.channel};this.applyTextureTransform(t,e.map),s.pbrMetallicRoughness.baseColorTexture=t}if(e.emissive){const t=e.emissive;if(Math.max(t.r,t.g,t.b)>0&&(s.emissiveFactor=e.emissive.toArray()),e.emissiveMap){const t={index:await this.processTextureAsync(e.emissiveMap),texCoord:e.emissiveMap.channel};this.applyTextureTransform(t,e.emissiveMap),s.emissiveTexture=t}}if(e.normalMap){const t={index:await this.processTextureAsync(e.normalMap),texCoord:e.normalMap.channel};e.normalScale&&1!==e.normalScale.x&&(t.scale=e.normalScale.x),this.applyTextureTransform(t,e.normalMap),s.normalTexture=t}if(e.aoMap){const t={index:await this.processTextureAsync(e.aoMap),texCoord:e.aoMap.channel};1!==e.aoMapIntensity&&(t.strength=e.aoMapIntensity),this.applyTextureTransform(t,e.aoMap),s.occlusionTexture=t}e.transparent?s.alphaMode="BLEND":e.alphaTest>0&&(s.alphaMode="MASK",s.alphaCutoff=e.alphaTest),e.side===V&&(s.doubleSided=!0),""!==e.name&&(s.name=e.name),this.serializeUserData(e,s),await this._invokeAllAsync(async function(t){t.writeMaterialAsync&&await t.writeMaterialAsync(e,s)});const n=i.materials.push(s)-1;return t.materials.set(e,n),n}async processMeshAsync(e){const t=this.cache,i=this.json,s=[e.geometry.uuid];if(Array.isArray(e.material))for(let t=0,i=e.material.length;t<i;t++)s.push(e.material[t].uuid);else s.push(e.material.uuid);const a=s.join(":");if(t.meshes.has(a))return t.meshes.get(a);const n=e.geometry;let r;r=e.isLineSegments?yr:e.isLineLoop?wr:e.isLine?Br:e.isPoints?Cr:e.material.wireframe?yr:xr;const o={},A={},l=[],c=[],h={uv:"TEXCOORD_0",uv1:"TEXCOORD_1",uv2:"TEXCOORD_2",uv3:"TEXCOORD_3",color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},d=n.getAttribute("normal");void 0===d||this.isNormalizedNormalAttribute(d)||(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),n.setAttribute("normal",this.createNormalizedNormalAttribute(d)));let g=null;for(let e in n.attributes){if("morph"===e.slice(0,5))continue;const i=n.attributes[e];e=h[e]||e.toUpperCase();if(/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(e)||(e="_"+e),t.attributes.has(this.getUID(i))){A[e]=t.attributes.get(this.getUID(i));continue}g=null;const s=i.array;"JOINTS_0"!==e||s instanceof Uint16Array||s instanceof Uint8Array?(s instanceof Uint32Array||s instanceof Int32Array)&&!e.startsWith("_")&&(console.warn(`GLTFExporter: Attribute "${e}" converted to type FLOAT.`),g=Er.Utils.toTypedBufferAttribute(i,Float32Array)):(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),g=Er.Utils.toTypedBufferAttribute(i,Uint16Array));const a=this.processAccessor(g||i,n);null!==a&&(e.startsWith("_")||this.detectMeshQuantization(e,i),A[e]=a,t.attributes.set(this.getUID(i),a))}if(void 0!==d&&n.setAttribute("normal",d),0===Object.keys(A).length)return null;if(void 0!==e.morphTargetInfluences&&e.morphTargetInfluences.length>0){const i=[],s=[],a={};if(void 0!==e.morphTargetDictionary)for(const t in e.morphTargetDictionary)a[e.morphTargetDictionary[t]]=t;for(let r=0;r<e.morphTargetInfluences.length;++r){const o={};let A=!1;for(const e in n.morphAttributes){if("position"!==e&&"normal"!==e){A||(console.warn("GLTFExporter: Only POSITION and NORMAL morph are supported."),A=!0);continue}const i=n.morphAttributes[e][r],s=e.toUpperCase(),a=n.attributes[e];if(t.attributes.has(this.getUID(i,!0))){o[s]=t.attributes.get(this.getUID(i,!0));continue}const l=i.clone();if(!n.morphTargetsRelative)for(let e=0,t=i.count;e<t;e++)for(let t=0;t<i.itemSize;t++)0===t&&l.setX(e,i.getX(e)-a.getX(e)),1===t&&l.setY(e,i.getY(e)-a.getY(e)),2===t&&l.setZ(e,i.getZ(e)-a.getZ(e)),3===t&&l.setW(e,i.getW(e)-a.getW(e));o[s]=this.processAccessor(l,n),t.attributes.set(this.getUID(a,!0),o[s])}c.push(o),i.push(e.morphTargetInfluences[r]),void 0!==e.morphTargetDictionary&&s.push(a[r])}o.weights=i,s.length>0&&(o.extras={},o.extras.targetNames=s)}const u=Array.isArray(e.material);if(u&&0===n.groups.length)return null;let p=!1;if(u&&null===n.index){const e=[];for(let t=0,i=n.attributes.position.count;t<i;t++)e[t]=t;n.setIndex(e),p=!0}const m=u?e.material:[e.material],b=u?n.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let e=0,i=b.length;e<i;e++){const i={mode:r,attributes:A};if(this.serializeUserData(n,i),c.length>0&&(i.targets=c),null!==n.index){let s=this.getUID(n.index);void 0===b[e].start&&void 0===b[e].count||(s+=":"+b[e].start+":"+b[e].count),t.attributes.has(s)?i.indices=t.attributes.get(s):(i.indices=this.processAccessor(n.index,n,b[e].start,b[e].count),t.attributes.set(s,i.indices)),null===i.indices&&delete i.indices}const s=await this.processMaterialAsync(m[b[e].materialIndex]);null!==s&&(i.material=s),l.push(i)}!0===p&&n.setIndex(null),o.primitives=l,i.meshes||(i.meshes=[]),await this._invokeAllAsync(function(t){t.writeMesh&&t.writeMesh(e,o)});const f=i.meshes.push(o)-1;return t.meshes.set(a,f),f}detectMeshQuantization(e,t){if(this.extensionsUsed[jr])return;let i;switch(t.array.constructor){case Int8Array:i="byte";break;case Uint8Array:i="unsigned byte";break;case Int16Array:i="short";break;case Uint16Array:i="unsigned short";break;default:return}t.normalized&&(i+=" normalized");const s=e.split("_",1)[0];Ir[s]&&Ir[s].includes(i)&&(this.extensionsUsed[jr]=!0,this.extensionsRequired[jr]=!0)}processCamera(e){const t=this.json;t.cameras||(t.cameras=[]);const i=e.isOrthographicCamera,s={type:i?"orthographic":"perspective"};return i?s.orthographic={xmag:2*e.right,ymag:2*e.top,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:s.perspective={aspectRatio:e.aspect,yfov:ae.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},""!==e.name&&(s.name=e.type),t.cameras.push(s)-1}processAnimation(e,t){const i=this.json,s=this.nodeMap;i.animations||(i.animations=[]);const a=(e=Er.Utils.mergeMorphTargetTracks(e.clone(),t)).tracks,n=[],r=[];for(let e=0;e<a.length;++e){const i=a[e],o=Y.parseTrackName(i.name);let A=Y.findNode(t,o.nodeName);const l=Kr[o.propertyName];if("bones"===o.objectName&&(A=!0===A.isSkinnedMesh?A.skeleton.getBoneByName(o.objectIndex):void 0),!A||!l){console.warn('THREE.GLTFExporter: Could not export animation track "%s".',i.name);continue}const c=1;let h,g=i.values.length/i.times.length;l===Kr.morphTargetInfluences&&(g/=A.morphTargetInfluences.length),!0===i.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline?(h="CUBICSPLINE",g/=3):h=i.getInterpolation()===le?"STEP":"LINEAR",r.push({input:this.processAccessor(new d(i.times,c)),output:this.processAccessor(new d(i.values,g)),interpolation:h}),n.push({sampler:r.length-1,target:{node:s.get(A),path:l}})}const o={name:e.name||"clip_"+i.animations.length,samplers:r,channels:n};return this.serializeUserData(e,o),i.animations.push(o),i.animations.length-1}processSkin(e){const t=this.json,i=this.nodeMap,s=t.nodes[i.get(e)],a=e.skeleton;if(void 0===a)return null;const n=e.skeleton.bones[0];if(void 0===n)return null;const r=[],o=new Float32Array(16*a.bones.length),A=new v;for(let t=0;t<a.bones.length;++t)r.push(i.get(a.bones[t])),A.copy(a.boneInverses[t]),A.multiply(e.bindMatrix).toArray(o,16*t);void 0===t.skins&&(t.skins=[]),t.skins.push({inverseBindMatrices:this.processAccessor(new d(o,16)),joints:r,skeleton:i.get(n)});return s.skin=t.skins.length-1}async processNodeAsync(e){const t=this.json,i=this.options,s=this.nodeMap;if(t.nodes||(t.nodes=[]),null!==e.pivot)return await this._processNodeWithPivotAsync(e);const a={};if(i.trs){const t=e.quaternion.toArray(),i=e.position.toArray(),s=e.scale.toArray();Jr(t,[0,0,0,1])||(a.rotation=t),Jr(i,[0,0,0])||(a.translation=i),Jr(s,[1,1,1])||(a.scale=s)}else e.matrixAutoUpdate&&e.updateMatrix(),!1===Jr(e.matrix.elements,[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])&&(a.matrix=e.matrix.elements);if(""!==e.name&&(a.name=String(e.name)),this.serializeUserData(e,a),e.isMesh||e.isLine||e.isPoints){const t=await this.processMeshAsync(e);null!==t&&(a.mesh=t)}else e.isCamera&&(a.camera=this.processCamera(e));e.isSkinnedMesh&&this.skins.push(e);const n=t.nodes.push(a)-1;if(s.set(e,n),e.children.length>0){const t=[];for(let s=0,a=e.children.length;s<a;s++){const a=e.children[s];if(a.visible||!1===i.onlyVisible){const e=await this.processNodeAsync(a);null!==e&&t.push(e)}}t.length>0&&(a.children=t)}return await this._invokeAllAsync(function(t){t.writeNode&&t.writeNode(e,a)}),n}async _processNodeWithPivotAsync(e){const t=this.json,i=this.options,s=this.nodeMap,a=e.pivot,n={},r=e.quaternion.toArray(),o=[e.position.x+a.x,e.position.y+a.y,e.position.z+a.z],A=e.scale.toArray();Jr(r,[0,0,0,1])||(n.rotation=r),Jr(o,[0,0,0])||(n.translation=o),Jr(A,[1,1,1])||(n.scale=A),n.extras={pivot:a.toArray()},""!==e.name&&(n.name=String(e.name)),this.serializeUserData(e,n);const l=t.nodes.push(n)-1;s.set(e,l);const c={},h=[-a.x,-a.y,-a.z];if(Jr(h,[0,0,0])||(c.translation=h),e.isMesh||e.isLine||e.isPoints){const t=await this.processMeshAsync(e);null!==t&&(c.mesh=t)}else e.isCamera&&(c.camera=this.processCamera(e));e.isSkinnedMesh&&this.skins.push(e);const d=[t.nodes.push(c)-1];if(e.children.length>0){const t=[];for(let s=0,a=e.children.length;s<a;s++){const a=e.children[s];if(a.visible||!1===i.onlyVisible){const e=await this.processNodeAsync(a);null!==e&&t.push(e)}}t.length>0&&(c.children=t)}return n.children=d,await this._invokeAllAsync(function(t){t.writeNode&&t.writeNode(e,n)}),l}async processSceneAsync(e){const t=this.json,i=this.options;t.scenes||(t.scenes=[],t.scene=0);const s={};""!==e.name&&(s.name=e.name),t.scenes.push(s);const a=[];for(let t=0,s=e.children.length;t<s;t++){const s=e.children[t];if(s.visible||!1===i.onlyVisible){const e=await this.processNodeAsync(s);null!==e&&a.push(e)}}a.length>0&&(s.nodes=a),this.serializeUserData(e,s)}async processObjectsAsync(e){const t=new nt;t.name="AuxScene";for(let i=0;i<e.length;i++)t.children.push(e[i]);await this.processSceneAsync(t)}async processInputAsync(e){const t=this.options;e=e instanceof Array?e:[e],await this._invokeAllAsync(function(t){t.beforeParse&&t.beforeParse(e)});const i=[];for(let t=0;t<e.length;t++)e[t]instanceof nt?await this.processSceneAsync(e[t]):i.push(e[t]);i.length>0&&await this.processObjectsAsync(i);for(let e=0;e<this.skins.length;++e)this.processSkin(this.skins[e]);for(let i=0;i<t.animations.length;++i)this.processAnimation(t.animations[i],e[0]);await this._invokeAllAsync(function(t){t.afterParse&&t.afterParse(e)})}async _invokeAllAsync(e){for(let t=0,i=this.plugins.length;t<i;t++)await e(this.plugins[t])}}class Zr{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 console.warn("THREE.GLTFExporter: Only directional, point, and spot lights are supported.",e);const i=this.writer,s=i.json,a=i.extensionsUsed,n={};e.name&&(n.name=e.name),n.color=e.color.toArray(),n.intensity=e.intensity,e.isDirectionalLight?n.type="directional":e.isPointLight?(n.type="point",e.distance>0&&(n.range=e.distance)):e.isSpotLight&&(n.type="spot",e.distance>0&&(n.range=e.distance),n.spot={},n.spot.innerConeAngle=(1-e.penumbra)*e.angle,n.spot.outerConeAngle=e.angle),void 0!==e.decay&&2!==e.decay&&console.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||console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),a[this.name]||(s.extensions=s.extensions||{},s.extensions[this.name]={lights:[]},a[this.name]=!0);const r=s.extensions[this.name].lights;r.push(n),t.extensions=t.extensions||{},t.extensions[this.name]={light:r.length-1}}}class eo{constructor(e){this.writer=e,this.name="KHR_materials_unlit"}async writeMaterialAsync(e,t){if(!e.isMeshBasicMaterial)return;const i=this.writer.extensionsUsed;t.extensions=t.extensions||{},t.extensions[this.name]={},i[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9}}class to{constructor(e){this.writer=e,this.name="KHR_materials_clearcoat"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||0===e.clearcoat)return;const i=this.writer,s=i.extensionsUsed,a={};if(a.clearcoatFactor=e.clearcoat,e.clearcoatMap){const t={index:await i.processTextureAsync(e.clearcoatMap),texCoord:e.clearcoatMap.channel};i.applyTextureTransform(t,e.clearcoatMap),a.clearcoatTexture=t}if(a.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap){const t={index:await i.processTextureAsync(e.clearcoatRoughnessMap),texCoord:e.clearcoatRoughnessMap.channel};i.applyTextureTransform(t,e.clearcoatRoughnessMap),a.clearcoatRoughnessTexture=t}if(e.clearcoatNormalMap){const t={index:await i.processTextureAsync(e.clearcoatNormalMap),texCoord:e.clearcoatNormalMap.channel};1!==e.clearcoatNormalScale.x&&(t.scale=e.clearcoatNormalScale.x),i.applyTextureTransform(t,e.clearcoatNormalMap),a.clearcoatNormalTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=a,s[this.name]=!0}}class io{constructor(e){this.writer=e,this.name="KHR_materials_dispersion"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||0===e.dispersion)return;const i=this.writer.extensionsUsed,s={};s.dispersion=e.dispersion,t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class so{constructor(e){this.writer=e,this.name="KHR_materials_iridescence"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||0===e.iridescence)return;const i=this.writer,s=i.extensionsUsed,a={};if(a.iridescenceFactor=e.iridescence,e.iridescenceMap){const t={index:await i.processTextureAsync(e.iridescenceMap),texCoord:e.iridescenceMap.channel};i.applyTextureTransform(t,e.iridescenceMap),a.iridescenceTexture=t}if(a.iridescenceIor=e.iridescenceIOR,a.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],a.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap){const t={index:await i.processTextureAsync(e.iridescenceThicknessMap),texCoord:e.iridescenceThicknessMap.channel};i.applyTextureTransform(t,e.iridescenceThicknessMap),a.iridescenceThicknessTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=a,s[this.name]=!0}}class ao{constructor(e){this.writer=e,this.name="KHR_materials_transmission"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||0===e.transmission)return;const i=this.writer,s=i.extensionsUsed,a={};if(a.transmissionFactor=e.transmission,e.transmissionMap){const t={index:await i.processTextureAsync(e.transmissionMap),texCoord:e.transmissionMap.channel};i.applyTextureTransform(t,e.transmissionMap),a.transmissionTexture=t}t.extensions=t.extensions||{},t.extensions[this.name]=a,s[this.name]=!0}}class no{constructor(e){this.writer=e,this.name="KHR_materials_volume"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||0===e.transmission)return;const i=this.writer,s=i.extensionsUsed,a={};if(a.thicknessFactor=e.thickness,e.thicknessMap){const t={index:await i.processTextureAsync(e.thicknessMap),texCoord:e.thicknessMap.channel};i.applyTextureTransform(t,e.thicknessMap),a.thicknessTexture=t}e.attenuationDistance!==1/0&&(a.attenuationDistance=e.attenuationDistance),a.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=a,s[this.name]=!0}}class ro{constructor(e){this.writer=e,this.name="KHR_materials_ior"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||1.5===e.ior)return;const i=this.writer.extensionsUsed,s={};s.ior=e.ior,t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class oo{constructor(e){this.writer=e,this.name="KHR_materials_specular"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||1===e.specularIntensity&&e.specularColor.equals(Vr)&&!e.specularIntensityMap&&!e.specularColorMap)return;const i=this.writer,s=i.extensionsUsed,a={};if(e.specularIntensityMap){const t={index:await i.processTextureAsync(e.specularIntensityMap),texCoord:e.specularIntensityMap.channel};i.applyTextureTransform(t,e.specularIntensityMap),a.specularTexture=t}if(e.specularColorMap){const t={index:await i.processTextureAsync(e.specularColorMap),texCoord:e.specularColorMap.channel};i.applyTextureTransform(t,e.specularColorMap),a.specularColorTexture=t}a.specularFactor=e.specularIntensity,a.specularColorFactor=e.specularColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=a,s[this.name]=!0}}class Ao{constructor(e){this.writer=e,this.name="KHR_materials_sheen"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||0==e.sheen)return;const i=this.writer,s=i.extensionsUsed,a={};if(e.sheenRoughnessMap){const t={index:await i.processTextureAsync(e.sheenRoughnessMap),texCoord:e.sheenRoughnessMap.channel};i.applyTextureTransform(t,e.sheenRoughnessMap),a.sheenRoughnessTexture=t}if(e.sheenColorMap){const t={index:await i.processTextureAsync(e.sheenColorMap),texCoord:e.sheenColorMap.channel};i.applyTextureTransform(t,e.sheenColorMap),a.sheenColorTexture=t}a.sheenRoughnessFactor=e.sheenRoughness,a.sheenColorFactor=e.sheenColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=a,s[this.name]=!0}}class lo{constructor(e){this.writer=e,this.name="KHR_materials_anisotropy"}async writeMaterialAsync(e,t){if(!e.isMeshPhysicalMaterial||0==e.anisotropy)return;const i=this.writer,s=i.extensionsUsed,a={};if(e.anisotropyMap){const t={index:await i.processTextureAsync(e.anisotropyMap)};i.applyTextureTransform(t,e.anisotropyMap),a.anisotropyTexture=t}a.anisotropyStrength=e.anisotropy,a.anisotropyRotation=e.anisotropyRotation,t.extensions=t.extensions||{},t.extensions[this.name]=a,s[this.name]=!0}}class co{constructor(e){this.writer=e,this.name="KHR_materials_emissive_strength"}async writeMaterialAsync(e,t){if(!e.isMeshStandardMaterial||1===e.emissiveIntensity)return;const i=this.writer.extensionsUsed,s={};s.emissiveStrength=e.emissiveIntensity,t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class ho{constructor(e){this.writer=e,this.name="EXT_materials_bump"}async writeMaterialAsync(e,t){if(!e.isMeshStandardMaterial||1===e.bumpScale&&!e.bumpMap)return;const i=this.writer,s=i.extensionsUsed,a={};if(e.bumpMap){const t={index:await i.processTextureAsync(e.bumpMap),texCoord:e.bumpMap.channel};i.applyTextureTransform(t,e.bumpMap),a.bumpTexture=t}a.bumpFactor=e.bumpScale,t.extensions=t.extensions||{},t.extensions[this.name]=a,s[this.name]=!0}}class go{constructor(e){this.writer=e,this.name="EXT_mesh_gpu_instancing"}writeNode(e,t){if(!e.isInstancedMesh)return;const i=this.writer,s=e,a=new Float32Array(3*s.count),n=new Float32Array(4*s.count),r=new Float32Array(3*s.count),o=new v,A=new S,l=new Q,c=new S;for(let e=0;e<s.count;e++)s.getMatrixAt(e,o),o.decompose(A,l,c),A.toArray(a,3*e),l.toArray(n,4*e),c.toArray(r,3*e);const h={TRANSLATION:i.processAccessor(new d(a,3)),ROTATION:i.processAccessor(new d(n,4)),SCALE:i.processAccessor(new d(r,3))};s.instanceColor&&(h._COLOR_0=i.processAccessor(s.instanceColor)),t.extensions=t.extensions||{},t.extensions[this.name]={attributes:h},i.extensionsUsed[this.name]=!0,i.extensionsRequired[this.name]=!0}}let uo,po,mo,bo;Er.Utils={insertKeyframe:function(e,t){const i=.001,s=e.getValueSize(),a=new e.TimeBufferType(e.times.length+1),n=new e.ValueBufferType(e.values.length+s),r=e.createInterpolant(new e.ValueBufferType(s));let o;if(0===e.times.length){a[0]=t;for(let e=0;e<s;e++)n[e]=0;o=0}else if(t<e.times[0]){if(Math.abs(e.times[0]-t)<i)return 0;a[0]=t,a.set(e.times,1),n.set(r.evaluate(t),0),n.set(e.values,s),o=0}else if(t>e.times[e.times.length-1]){if(Math.abs(e.times[e.times.length-1]-t)<i)return e.times.length-1;a[a.length-1]=t,a.set(e.times,0),n.set(e.values,0),n.set(r.evaluate(t),e.values.length),o=a.length-1}else for(let A=0;A<e.times.length;A++){if(Math.abs(e.times[A]-t)<i)return A;if(e.times[A]<t&&e.times[A+1]>t){a.set(e.times.slice(0,A+1),0),a[A+1]=t,a.set(e.times.slice(A+1),A+2),n.set(e.values.slice(0,(A+1)*s),0),n.set(r.evaluate(t),(A+1)*s),n.set(e.values.slice((A+1)*s),(A+2)*s),o=A+1;break}}return e.times=a,e.values=n,o},mergeMorphTargetTracks:function(e,t){const i=[],s={},a=e.tracks;for(let e=0;e<a.length;++e){let n=a[e];const r=Y.parseTrackName(n.name),o=Y.findNode(t,r.nodeName);if("morphTargetInfluences"!==r.propertyName||void 0===r.propertyIndex){i.push(n);continue}if(n.createInterpolant!==n.InterpolantFactoryMethodDiscrete&&n.createInterpolant!==n.InterpolantFactoryMethodLinear){if(n.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline)throw new Error("THREE.GLTFExporter: Cannot merge tracks with glTF CUBICSPLINE interpolation.");console.warn("THREE.GLTFExporter: Morph target interpolation mode not yet supported. Using LINEAR instead."),n=n.clone(),n.setInterpolation(ce)}const A=o.morphTargetInfluences.length,l=o.morphTargetDictionary[r.propertyIndex];if(void 0===l)throw new Error("THREE.GLTFExporter: Morph target name not found: "+r.propertyIndex);let c;if(void 0===s[o.uuid]){c=n.clone();const e=new c.ValueBufferType(A*c.times.length);for(let t=0;t<c.times.length;t++)e[t*A+l]=c.values[t];c.name=(r.nodeName||"")+".morphTargetInfluences",c.values=e,s[o.uuid]=c,i.push(c);continue}const h=n.createInterpolant(new n.ValueBufferType(1));c=s[o.uuid];for(let e=0;e<c.times.length;e++)c.values[e*A+l]=h.evaluate(c.times[e]);for(let e=0;e<n.times.length;e++){const t=this.insertKeyframe(c,n.times[e]);c.values[t*A+l]=n.values[e]}}return e.tracks=i,e},toTypedBufferAttribute:function(e,t){const i=new d(new t(e.count*e.itemSize),e.itemSize,!1);if(!e.normalized&&!e.isInterleavedBufferAttribute)return i.array.set(e.array),i;for(let t=0,s=e.count;t<s;t++)for(let s=0;s<e.itemSize;s++)i.setComponent(t,s,e.getComponent(t,s));return i}};
/* @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const fo=e=>void 0!==e.material&&e.userData&&e.userData.variantMaterials&&!!Array.from(e.userData.variantMaterials.values()).filter(e=>Io(e.material)),Io=e=>!(!e||!e.isMaterial||Array.isArray(e));class Eo{constructor(e){this.writer=e,this.name="KHR_materials_variants",this.variantNames=[]}beforeParse(e){const t=new Set,i=e=>{if(!fo(e))return;const i=e.userData.variantMaterials,s=e.userData.variantData;for(const[e,a]of s){const s=i.get(a.index);s&&Io(s.material)&&t.add(e)}};if(Array.isArray(e))for(const t of e)t.traverse(i);else e.traverse(i);t.forEach(e=>this.variantNames.push(e))}async writeMesh(e,t){if(!fo(e))return;const i=e.userData,s=i.variantMaterials,a=i.variantData,n=new Map,r=new Map,o=Array.from(a.values()).sort((e,t)=>e.index-t.index);for(const[e,t]of o.entries())r.set(t.index,e);for(const e of a.values()){const t=s.get(e.index);if(!t||!Io(t.material))continue;const i=await this.writer.processMaterialAsync(t.material);n.has(i)||n.set(i,{material:i,variants:[]}),n.get(i).variants.push(r.get(e.index))}const A=Array.from(n.values()).map(e=>e.variants.sort((e,t)=>e-t)&&e).sort((e,t)=>e.material-t.material);if(0===A.length)return;const l=Io(i.originalMaterial)?await this.writer.processMaterialAsync(i.originalMaterial):-1;for(const e of t.primitives)l>=0&&(e.material=l),e.extensions=e.extensions||{},e.extensions[this.name]={mappings:A}}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 Co{constructor(e,t,i,s,a){this.xrLight=e,this.renderer=t,this.lightProbe=i,this.xrWebGLBinding=null,this.estimationStartCallback=a,this.frameCallback=this.onXRFrame.bind(this);const n=t.xr.getSession();if(s&&"XRWebGLBinding"in window){const i=new dt(16);e.environment=i.texture;const s=t.getContext();switch(n.preferredReflectionFormat){case"srgba8":s.getExtension("EXT_sRGB");break;case"rgba16f":s.getExtension("OES_texture_half_float")}this.xrWebGLBinding=new XRWebGLBinding(n,s),this.lightProbe.addEventListener("reflectionchange",()=>{this.updateReflection()})}n.requestAnimationFrame(this.frameCallback)}updateReflection(){const e=this.renderer.properties.get(this.xrLight.environment);if(e){const t=this.xrWebGLBinding.getReflectionCubeMap(this.lightProbe);t&&(e.__webglTexture=t,this.xrLight.environment.needsPMREMUpdate=!0)}}onXRFrame(e,t){if(!this.xrLight)return;t.session.requestAnimationFrame(this.frameCallback);const i=t.getLightEstimate(this.lightProbe);if(i){this.xrLight.lightProbe.sh.fromArray(i.sphericalHarmonicsCoefficients),this.xrLight.lightProbe.intensity=1;const e=Math.max(1,Math.max(i.primaryLightIntensity.x,Math.max(i.primaryLightIntensity.y,i.primaryLightIntensity.z)));this.xrLight.directionalLight.color.setRGB(i.primaryLightIntensity.x/e,i.primaryLightIntensity.y/e,i.primaryLightIntensity.z/e),this.xrLight.directionalLight.intensity=e,this.xrLight.directionalLight.position.copy(i.primaryLightDirection),this.estimationStartCallback&&(this.estimationStartCallback(),this.estimationStartCallback=null)}}dispose(){this.xrLight=null,this.renderer=null,this.lightProbe=null,this.xrWebGLBinding=null}}class yo extends ie{constructor(e,t=!0){super(),this.lightProbe=new ht,this.lightProbe.intensity=0,this.add(this.lightProbe),this.directionalLight=new x,this.directionalLight.intensity=0,this.add(this.directionalLight),this.environment=null;let i=null,s=!1;e.xr.addEventListener("sessionstart",()=>{const a=e.xr.getSession();"requestLightProbe"in a&&a.requestLightProbe({reflectionFormat:a.preferredReflectionFormat}).then(a=>{i=new Co(this,e,a,t,()=>{s=!0,this.dispatchEvent({type:"estimationstart"})})})}),e.xr.addEventListener("sessionend",()=>{i&&(i.dispose(),i=null),s&&this.dispatchEvent({type:"estimationend"})}),this.dispose=()=>{i&&(i.dispose(),i=null),this.remove(this.lightProbe),this.lightProbe=null,this.remove(this.directionalLight),this.directionalLight=null,this.environment=null}}}
/* @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class wo{constructor(e=50){this.velocity=0,this.naturalFrequency=0,this.setDecayTime(e)}setDecayTime(e){this.naturalFrequency=1/Math.max(.001,e)}update(e,t,i,s){const a=2e-4*this.naturalFrequency;if(null==e||0===s)return t;if(e===t&&0===this.velocity)return t;if(i<0)return e;const n=e-t,r=this.velocity+this.naturalFrequency*n,o=n+i*r,A=Math.exp(-this.naturalFrequency*i),l=(r-this.naturalFrequency*o)*A,c=-this.naturalFrequency*(l+r*A);return Math.abs(l)<a*Math.abs(s)&&c*n>=0?(this.velocity=0,t):(this.velocity=l,t+o*A)}}
/* @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Bo={MIN_TOUCH_AREA:.05,BASE_RADIUS:.15,LINE_WIDTH:.02,SEGMENTS:16,DELTA_PHI:Math.PI/32,COLORS:{EDGE_FALLOFF:new p(.98,.98,.98),EDGE_CUTOFF:new p(.8,.8,.8),FILL_FALLOFF:new p(.4,.4,.4),FILL_CUTOFF:new p(.4,.4,.4),ACTIVE_EDGE:new p(1,1,1),ACTIVE_FILL:new p(.6,.6,.6)},MAX_OPACITY:.75,FILL_OPACITY_MULTIPLIER:.5,INTERACTIVE_OPACITY_MULTIPLIER:1.2,MIN_DISTANCE:.5,MAX_DISTANCE:10,BASE_SCALE:1,DISTANCE_SCALE_FACTOR:.3,COLOR_LERP_FACTOR:.15,SCREEN_SPACE_SCALE:1.2,SIZE_UPDATE_THRESHOLD:.001,GEOMETRY_UPDATE_DEBOUNCE:100},xo=new y,vo=(e,t,i,s,a)=>{let n=t>0?i>0?0:-Math.PI/2:i>0?Math.PI/2:Math.PI;for(let r=0;r<=Bo.SEGMENTS;++r)e.push(t+(s-a)*Math.cos(n),i+(s-a)*Math.sin(n),0,t+s*Math.cos(n),i+s*Math.sin(n),0),n+=Bo.DELTA_PHI};class So extends X{constructor(e,t){super(new h),this.shadowHeight=0,this.isActive=!1,this.isHovered=!1,this.lastGeometryUpdateTime=0,this.needsGeometryUpdate=!1,this.scene=e,this.side=t,this.currentSize=new S,this.goalSize=new S,this.sizeDamper=new wo,this.updateSizeFromScene(),this.edgeMaterial=new J({color:Bo.COLORS.EDGE_FALLOFF,transparent:!0,opacity:0,side:V,depthWrite:!1,blending:gt}),this.fillMaterial=new J({color:Bo.COLORS.FILL_FALLOFF,transparent:!0,opacity:0,side:V,depthWrite:!1,blending:ut}),this.material=this.edgeMaterial,this.goalOpacity=0,this.opacityDamper=new wo,this.createHitMeshes(),this.updatePositionFromScene(),e.target.add(this),e.target.add(this.hitBox),this.offsetHeight=0}updateSizeFromScene(){const{size:e}=this.scene;this.goalSize.copy(e);const t=Math.sqrt(e.x*e.x+e.z*e.z),i=Math.max(Bo.MIN_TOUCH_AREA,.4*t);this.goalSize.x<i&&(this.goalSize.x=i),this.goalSize.z<i&&(this.goalSize.z=i),this.updateGeometry()}updateGeometry(){const e=this.geometry,t=[],i=[],s=this.goalSize.x/2,a=("back"===this.side?this.goalSize.y:this.goalSize.z)/2,n=Math.min(s,a),r=Math.max(.7*Bo.BASE_RADIUS,.2*n),o=Math.max(.7*Bo.LINE_WIDTH,.025*n);vo(i,s,a,r,o),vo(i,-s,a,r,o),vo(i,-s,-a,r,o),vo(i,s,-a,r,o);const A=i.length/3;for(let e=0;e<A-2;e+=2)t.push(e,e+1,e+3,e,e+3,e+2);const l=A-2;t.push(l,l+1,1,l,1,0),e.setAttribute("position",new pt(i,3)),e.setIndex(t),e.computeBoundingSphere()}createHitMeshes(){const e=this.goalSize.x/2,t=("back"===this.side?this.goalSize.y:this.goalSize.z)/2,i=Math.min(e,t),s=Math.max(.7*Bo.BASE_RADIUS,.2*i);this.hitPlane=new X(new rt(2*(e+s),2*(t+s))),this.hitPlane.visible=!1,this.hitPlane.material.side=V,this.add(this.hitPlane),this.hitBox=new X(new mt(this.goalSize.x+2*s,this.goalSize.y+s,this.goalSize.z+2*s)),this.hitBox.visible=!1,this.hitBox.material.side=V,this.add(this.hitBox)}updatePositionFromScene(){const{boundingBox:e}=this.scene;switch(e.getCenter(this.position),this.rotation.set(0,0,0),this.side){case"bottom":this.rotateX(-Math.PI/2),this.shadowHeight=e.min.y,this.position.y=this.shadowHeight;break;case"back":this.shadowHeight=e.min.z,this.position.z=this.shadowHeight}if(this.hitBox){const t=(this.side,(this.goalSize.y+Bo.BASE_RADIUS)/2);this.hitBox.position.y=t+e.min.y}}updateFromModelChanges(){this.updateSizeFromScene(),this.updatePositionFromScene(),this.updateGeometry(),this.updateHitMeshes(),this.ensureProperOrientation(),this.needsGeometryUpdate=!1,this.lastGeometryUpdateTime=performance.now()}ensureProperOrientation(){"bottom"===this.side?(this.rotation.x=-Math.PI/2,this.rotation.y=0,this.rotation.z=0):"back"===this.side&&(this.rotation.x=0,this.rotation.y=0,this.rotation.z=0)}setScreenSpaceMode(e){e?this.scale.set(Bo.SCREEN_SPACE_SCALE,Bo.SCREEN_SPACE_SCALE,Bo.SCREEN_SPACE_SCALE):this.scale.set(1,1,1)}updateHitMeshes(){if(this.hitPlane&&this.hitBox){const e=this.goalSize.x/2,t=("back"===this.side?this.goalSize.y:this.goalSize.z)/2,i=Math.min(e,t),s=Math.max(.7*Bo.BASE_RADIUS,.2*i),a=new rt(2*(e+s),2*(t+s));this.hitPlane.geometry.dispose(),this.hitPlane.geometry=a;const n=new mt(this.goalSize.x+2*s,this.goalSize.y+s,this.goalSize.z+2*s);this.hitBox.geometry.dispose(),this.hitBox.geometry=n}}setInteractionState(e,t=!1){this.isActive=e,this.isHovered=t,this.updateVisualState()}updateVisualState(){let e,t;this.isActive?(e=Bo.COLORS.ACTIVE_EDGE,t=Bo.COLORS.ACTIVE_FILL):this.isHovered?(e=Bo.COLORS.EDGE_FALLOFF,t=Bo.COLORS.FILL_FALLOFF):(e=Bo.COLORS.EDGE_CUTOFF,t=Bo.COLORS.FILL_CUTOFF),this.edgeMaterial.color.lerp(e,Bo.COLOR_LERP_FACTOR),this.fillMaterial.color.lerp(t,Bo.COLOR_LERP_FACTOR)}applyDistanceScaling(e){const t=e.distanceTo(this.position),i=Math.max(Bo.MIN_DISTANCE,Math.min(Bo.MAX_DISTANCE,t)),s=Bo.BASE_SCALE+(i-Bo.MIN_DISTANCE)*Bo.DISTANCE_SCALE_FACTOR;this.scale.set(s,s,s)}getHit(e,t,i){xo.set(t,-i),this.hitPlane.visible=!0;const s=e.positionAndNormalFromPoint(xo,this.hitPlane);return this.hitPlane.visible=!1,null==s?null:s.position}getExpandedHit(e,t,i){this.hitPlane.scale.set(1e3,1e3,1e3),this.hitPlane.updateMatrixWorld();const s=this.getHit(e,t,i);return this.hitPlane.scale.set(1,1,1),s}controllerIntersection(e,t){this.hitBox.visible=!0;const i=e.hitFromController(t,this.hitBox);return this.hitBox.visible=!1,i}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?Bo.MAX_OPACITY:0}updateOpacity(e){const t=this.material,i=this.opacityDamper.update(t.opacity,this.goalOpacity,e,1);this.edgeMaterial.opacity=i,this.fillMaterial.opacity=i*Bo.FILL_OPACITY_MULTIPLIER,(this.isActive||this.isHovered)&&(this.edgeMaterial.opacity=i*Bo.INTERACTIVE_OPACITY_MULTIPLIER),this.visible=i>0}update(e,t){if(this.updateOpacity(e),!this.currentSize.equals(this.goalSize)){const t=new S;t.x=this.sizeDamper.update(this.currentSize.x,this.goalSize.x,e,1),t.y=this.sizeDamper.update(this.currentSize.y,this.goalSize.y,e,1),t.z=this.sizeDamper.update(this.currentSize.z,this.goalSize.z,e,1);t.distanceTo(this.currentSize)>Bo.SIZE_UPDATE_THRESHOLD&&(this.currentSize.copy(t),this.needsGeometryUpdate=!0)}const i=performance.now();this.needsGeometryUpdate&&i-this.lastGeometryUpdateTime>Bo.GEOMETRY_UPDATE_DEBOUNCE&&(this.updateGeometry(),this.updateHitMeshes(),this.needsGeometryUpdate=!1,this.lastGeometryUpdateTime=i),t&&this.applyDistanceScaling(t),this.updateVisualState()}getSize(){return this.goalSize.clone()}dispose(){const{geometry:e,material:t}=this.hitPlane;e.dispose(),t.dispose(),this.hitBox.geometry.dispose(),this.hitBox.material.dispose(),this.geometry.dispose(),this.edgeMaterial.dispose(),this.fillMaterial.dispose(),this.hitBox.removeFromParent(),this.removeFromParent()}}
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Qo=(e,t)=>({type:"number",number:e,unit:t}),Mo=(()=>{const e={};return t=>{const i=t;if(i in e)return e[i];const s=[];let a=0;for(;t;){if(++a>1e3){t="";break}const e=Do(t),i=e.nodes[0];if(null==i||0===i.terms.length)break;s.push(i),t=e.remainingInput}return e[i]=s}})(),Do=(()=>{const e=/^(\-\-|[a-z\u0240-\uffff])/i,t=/^([\*\+\/]|[\-]\s)/i,i=/^[\),]/;return s=>{const a=[];for(;s.length&&(s=s.trim(),!i.test(s));)if("("===s[0]){const{nodes:e,remainingInput:t}=ko(s);s=t,a.push({type:"function",name:{type:"ident",value:"calc"},arguments:e})}else if(e.test(s)){const e=Ro(s),t=e.nodes[0];if("("===(s=e.remainingInput)[0]){const{nodes:e,remainingInput:i}=ko(s);a.push({type:"function",name:t,arguments:e}),s=i}else a.push(t)}else if(t.test(s))a.push({type:"operator",value:s[0]}),s=s.slice(1);else{const{nodes:e,remainingInput:t}="#"===s[0]?Fo(s):To(s);if(0===e.length)break;a.push(e[0]),s=t}return{nodes:[{type:"expression",terms:a}],remainingInput:s}}})(),Ro=(()=>{const e=/[^a-z0-9_\-\u0240-\uffff]/i;return t=>{const i=t.match(e);return{nodes:[{type:"ident",value:null==i?t:t.substr(0,i.index)}],remainingInput:null==i?"":t.substr(i.index)}}})(),To=(()=>{const e=/[\+\-]?(\d+[\.]\d+|\d+|[\.]\d+)([eE][\+\-]?\d+)?/,t=/^[a-z%]+/i,i=/^(m|mm|cm|rad|deg|[%])$/;return s=>{const a=s.match(e),n=null==a?"0":a[0],r=(s=null==n?s:s.slice(n.length)).match(t);let o=null!=r&&""!==r[0]?r[0]:null;const A=null==r?s:s.slice(o.length);return null==o||i.test(o)||(o=null),{nodes:[{type:"number",number:parseFloat(n)||0,unit:o}],remainingInput:A}}})(),Fo=(()=>{const e=/^([a-f0-9]{8}|[a-f0-9]{6}|[a-f0-9]{4}|[a-f0-9]{3})(?![a-f0-9])/i;return t=>{const i=(t=t.slice(1).trim()).match(e);return{nodes:null==i?[]:[{type:"hex",value:i[0]}],remainingInput:null==i?t:t.slice(i[0].length)}}})(),ko=e=>{const t=[];for(e=e.slice(1).trim();e.length;){const i=Do(e);if(t.push(i.nodes[0]),","===(e=i.remainingInput.trim())[0])e=e.slice(1).trim();else if(")"===e[0]){e=e.slice(1);break}}return{nodes:t,remainingInput:e}},Lo=Symbol("visitedTypes");class Po{constructor(e){this[Lo]=e}walk(e,t){const i=e.slice();for(;i.length;){const e=i.shift();switch(this[Lo].indexOf(e.type)>-1&&t(e),e.type){case"expression":i.unshift(...e.terms);break;case"function":i.unshift(e.name,...e.arguments)}}}}const _o=Object.freeze({type:"number",number:0,unit:null}),Uo=(e,t=0)=>{const{number:i,unit:s}=e;if(!isFinite(i))return{type:"number",number:t,unit:"rad"};if("rad"===e.unit||null==e.unit)return e;return{type:"number",number:("deg"===s&&null!=i?i:0)*Math.PI/180,unit:"rad"}},Go=(e,t=0)=>{let i,{number:s,unit:a}=e;if(isFinite(s)){if("m"===e.unit)return e}else s=t,a="m";switch(a){default:i=1;break;case"cm":i=.01;break;case"mm":i=.001}return{type:"number",number:i*s,unit:"m"}},No=(()=>{const e=e=>e,t={rad:e,deg:Uo,m:e,mm:Go,cm:Go};return(e,i=_o)=>{isFinite(e.number)||(e.number=i.number,e.unit=i.unit);const{unit:s}=e;if(null==s)return e;const a=t[s];return null==a?i:a(e)}})();
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
var Oo,qo,Ho;const jo=Symbol("evaluate"),zo=Symbol("lastValue");class Ko{constructor(){this[Oo]=null}static evaluatableFor(e,t=_o){if(e instanceof Ko)return e;if("number"===e.type)return"%"===e.unit?new Yo(e,t):e;switch(e.name.value){case"calc":return new eA(e,t);case"env":return new Xo(e)}return _o}static evaluate(e){return e instanceof Ko?e.evaluate():e}static isConstant(e){return!(e instanceof Ko)||e.isConstant}static applyIntrinsics(e,t){const{basis:i,keywords:s}=t,{auto:a}=s;return i.map((t,i)=>{const n=null==a[i]?t:a[i];let r=e[i]?e[i]:n;if("ident"===r.type){const e=r.value;e in s&&(r=s[e][i])}return null!=r&&"ident"!==r.type||(r=n),"%"===r.unit?Qo(r.number/100*t.number,t.unit):(r=No(r,t),r.unit!==t.unit?t:r)})}get isConstant(){return!1}evaluate(){return this.isConstant&&null!=this[zo]||(this[zo]=this[jo]()),this[zo]}}Oo=zo;const Vo=Symbol("percentage"),Jo=Symbol("basis");class Yo extends Ko{constructor(e,t){super(),this[Vo]=e,this[Jo]=t}get isConstant(){return!0}[jo](){return Qo(this[Vo].number/100*this[Jo].number,this[Jo].unit)}}const Wo=Symbol("identNode");class Xo extends Ko{constructor(e){super(),this[qo]=null;const t=e.arguments.length?e.arguments[0].terms[0]:null;null!=t&&"ident"===t.type&&(this[Wo]=t)}get isConstant(){return!1}[(qo=Wo,jo)](){if(null!=this[Wo]&&"window-scroll-y"===this[Wo].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 _o}}const $o=/[\*\/]/,Zo=Symbol("evaluator");class eA extends Ko{constructor(e,t=_o){if(super(),this[Ho]=null,1!==e.arguments.length)return;const i=e.arguments[0].terms.slice(),s=[];for(;i.length;){const e=i.shift();if(s.length>0){const i=s[s.length-1];if("operator"===i.type&&$o.test(i.value)){const i=s.pop(),a=s.pop();if(null==a)return;s.push(new aA(i,Ko.evaluatableFor(a,t),Ko.evaluatableFor(e,t)));continue}}s.push("operator"===e.type?e:Ko.evaluatableFor(e,t))}for(;s.length>2;){const[e,i,a]=s.splice(0,3);if("operator"!==i.type)return;s.unshift(new aA(i,Ko.evaluatableFor(e,t),Ko.evaluatableFor(a,t)))}1===s.length&&(this[Zo]=s[0])}get isConstant(){return null==this[Zo]||Ko.isConstant(this[Zo])}[(Ho=Zo,jo)](){return null!=this[Zo]?Ko.evaluate(this[Zo]):_o}}const tA=Symbol("operator"),iA=Symbol("left"),sA=Symbol("right");class aA extends Ko{constructor(e,t,i){super(),this[tA]=e,this[iA]=t,this[sA]=i}get isConstant(){return Ko.isConstant(this[iA])&&Ko.isConstant(this[sA])}[jo](){const e=No(Ko.evaluate(this[iA])),t=No(Ko.evaluate(this[sA])),{number:i,unit:s}=e,{number:a,unit:n}=t;if(null!=n&&null!=s&&n!=s)return _o;const r=s||n;let o;switch(this[tA].value){case"+":o=i+a;break;case"-":o=i-a;break;case"/":o=i/a;break;case"*":o=i*a;break;default:return _o}return{type:"number",number:o,unit:r}}}const nA=Symbol("evaluatables"),rA=Symbol("intrinsics");class oA extends Ko{constructor(e,t){super(),this[rA]=t;const i=e[0],s=null!=i?i.terms:[];this[nA]=t.basis.map((e,t)=>{const i=s[t];return null==i?{type:"ident",value:"auto"}:"ident"===i.type?i:Ko.evaluatableFor(i,e)})}get isConstant(){for(const e of this[nA])if(!Ko.isConstant(e))return!1;return!0}[jo](){const e=this[nA].map(e=>Ko.evaluate(e));return Ko.applyIntrinsics(e,this[rA]).map(e=>e.number)}}
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */var AA,lA,cA,hA;const dA=Symbol("instances"),gA=Symbol("activateListener"),uA=Symbol("deactivateListener"),pA=Symbol("notifyInstances"),mA=Symbol("notify"),bA=Symbol("callback");class fA{static[pA](){for(const e of fA[dA])e[mA]()}static[(AA=dA,gA)](){window.addEventListener("scroll",this[pA],{passive:!0})}static[uA](){window.removeEventListener("scroll",this[pA])}constructor(e){this[bA]=e}observe(){0===fA[dA].size&&fA[gA](),fA[dA].add(this)}disconnect(){fA[dA].delete(this),0===fA[dA].size&&fA[uA]()}[mA](){this[bA]()}}fA[AA]=new Set;const IA=Symbol("computeStyleCallback"),EA=Symbol("astWalker"),CA=Symbol("dependencies"),yA=Symbol("onScroll");class wA{constructor(e){this[lA]={},this[cA]=new Po(["function"]),this[hA]=()=>{this[IA]({relatedState:"window-scroll"})},this[IA]=e}observeEffectsFor(e){const t={},i=this[CA];this[EA].walk(e,e=>{const{name:s}=e,a=e.arguments[0].terms[0];if("env"===s.value&&null!=a&&"ident"===a.type&&"window-scroll-y"===a.value)if(null==t["window-scroll"]){const e="window-scroll"in i?i["window-scroll"]:new fA(this[yA]);e.observe(),delete i["window-scroll"],t["window-scroll"]=e}});for(const e in i){i[e].disconnect()}this[CA]=t}dispose(){for(const e in this[CA]){this[CA][e].disconnect()}}}lA=CA,cA=EA,hA=yA;
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const BA=e=>{const t=e.observeEffects||!1,i=e.intrinsics instanceof Function?e.intrinsics:()=>e.intrinsics;return(s,a)=>{const n=s.updated,r=s.connectedCallback,o=s.disconnectedCallback,A=Symbol(`${a}StyleEffector`),l=Symbol(`${a}StyleEvaluator`),c=Symbol(`${a}UpdateEvaluator`),h=Symbol(`${a}EvaluateAndSync`);Object.defineProperties(s,{[A]:{value:null,writable:!0},[l]:{value:null,writable:!0},[c]:{value:function(){const e=Mo(this[a]);this[l]=new oA(e,i(this)),null==this[A]&&t&&(this[A]=new wA(()=>this[h]())),null!=this[A]&&this[A].observeEffectsFor(e)}},[h]:{value:function(){if(null==this[l])return;const t=this[l].evaluate();this[e.updateHandler](t)}},updated:{value:function(e){e.has(a)&&(this[c](),this[h]()),n.call(this,e)}},connectedCallback:{value:function(){r.call(this),this.requestUpdate(a,this[a])}},disconnectedCallback:{value:function(){o.call(this),null!=this[A]&&(this[A].dispose(),this[A]=null)}}})}},xA=e=>e<.5?2*e*e:(4-2*e)*e-1,vA=(e,t,i=xA)=>s=>e+(t-e)*i(s),SA=e=>{const t=[],i=[];let s=e.initialValue;for(let a=0;a<e.keyframes.length;++a){const n=e.keyframes[a],{value:r,frames:o}=n,A=n.ease||xA,l=vA(s,r,A);t.push(l),i.push(o),s=r}return((e,t)=>{const i=t.map((s=0,e=>s+=e));var s;return t=>{t=Cs(t,0,1),t*=i[i.length-1];const s=i.findIndex(e=>e>=t),a=s<1?0:i[s-1],n=i[s];return e[s]((t-a)/(n-a))}})(t,i)};
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
var QA=function(e,t,i,s){for(var a,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s,o=e.length-1;o>=0;o--)(a=e[o])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};const MA=SA({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}]}),DA=SA({initialValue:0,keyframes:[{frames:1,value:1},{frames:5,value:1},{frames:1,value:0},{frames:6,value:0}]}),RA="0deg 75deg 105%",TA=["front","right","back","left"],FA=["upper-","","lower-"],kA="auto",LA="basic",PA="wiggle",_A="none",UA=()=>({basis:[Uo(Qo(30,"deg"))],keywords:{auto:[null]}}),GA=()=>({basis:[Uo(Qo(12,"deg"))],keywords:{auto:[null]}}),NA=(()=>{const e=Mo(RA)[0].terms,t=No(e[0]),i=No(e[1]);return e=>{const s=e[qg].idealCameraDistance();return{basis:[t,i,Qo(s,"m")],keywords:{auto:[null,null,Qo(105,"%")]}}}})(),OA=e=>{const t=2.2*e[qg].boundingSphere.radius;return{basis:[Qo(-1/0,"rad"),Qo(0,"rad"),Qo(t,"m")],keywords:{auto:[null,null,null]}}},qA=e=>{const t=NA(e),i=new oA([],t).evaluate()[2];return{basis:[Qo(1/0,"rad"),Qo(Math.PI,"rad"),Qo(i,"m")],keywords:{auto:[null,null,null]}}},HA=e=>{e[qg].updateBoundingBoxAndShadowIfDirty();const t=e[qg].boundingBox.getCenter(new S);return{basis:[Qo(t.x,"m"),Qo(t.y,"m"),Qo(t.z,"m")],keywords:{auto:[null,null,null]}}},jA=Math.PI/2,zA=Math.PI/3,KA=jA/2,VA=2*Math.PI,JA=Symbol("controls"),YA=Symbol("panElement"),WA=Symbol("promptElement"),XA=Symbol("promptAnimatedContainer"),$A=Symbol("fingerAnimatedContainers"),ZA=Symbol("deferInteractionPrompt"),el=Symbol("updateAria"),tl=Symbol("a11y"),il=Symbol("updateA11y"),sl=Symbol("updateCameraForRadius"),al=Symbol("cancelPrompts"),nl=Symbol("onChange"),rl=Symbol("onPointerChange"),ol=Symbol("waitingToPromptUser"),Al=Symbol("userHasInteracted"),ll=Symbol("promptElementVisibleTime"),cl=Symbol("lastPromptOffset"),hl=Symbol("cancellationSource"),dl=Symbol("lastSpherical"),gl=Symbol("jumpCamera"),ul=Symbol("initialized"),pl=Symbol("maintainThetaPhi"),ml=Symbol("syncCameraOrbit"),bl=Symbol("syncFieldOfView"),fl=Symbol("syncCameraTarget"),Il=Symbol("syncMinCameraOrbit"),El=Symbol("syncMaxCameraOrbit"),Cl=Symbol("syncMinFieldOfView"),yl=Symbol("syncMaxFieldOfView"),wl=new y,Bl=new S,xl=Object.freeze({minimumRadius:0,maximumRadius:1/0,minimumPolarAngle:0,maximumPolarAngle:Math.PI,minimumAzimuthalAngle:-1/0,maximumAzimuthalAngle:1/0,minimumFieldOfView:10,maximumFieldOfView:45,touchAction:"none"}),vl=Math.PI/8,Sl=.04,Ql={USER_INTERACTION:"user-interaction",NONE:"none",AUTOMATIC:"automatic"};class Ml extends tt{constructor(e,t,i){super(),this.camera=e,this.element=t,this.scene=i,this.orbitSensitivity=1,this.zoomSensitivity=1,this.panSensitivity=1,this.inputSensitivity=1,this.changeSource=Ql.NONE,this._interactionEnabled=!1,this._disableZoom=!1,this.isUserPointing=!1,this.enablePan=!0,this.enableTap=!0,this.panProjection=new ft,this.panPerPixel=0,this.spherical=new bt,this.goalSpherical=new bt,this.thetaDamper=new wo,this.phiDamper=new wo,this.radiusDamper=new wo,this.logFov=Math.log(xl.maximumFieldOfView),this.goalLogFov=this.logFov,this.fovDamper=new wo,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=Sl*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:i}=this._options;if(!this.touchDecided&&"none"!==i){this.touchDecided=!0;const s=Math.abs(e),a=Math.abs(t);if(this.changeSource===Ql.USER_INTERACTION&&("pan-y"===i&&a>s||"pan-x"===i&&s>a))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?Ql.AUTOMATIC:Ql.USER_INTERACTION,this.onTouchChange(e)):(this.changeSource=Ql.USER_INTERACTION,this.onMouseDown(e)),this.changeSource===Ql.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 i=this.pointers.length,s=(e.clientX-t.clientX)/i,a=(e.clientY-t.clientY)/i;0===s&&0===a||(t.clientX=e.clientX,t.clientY=e.clientY,"touch"===e.pointerType?(this.changeSource=e.altKey?Ql.AUTOMATIC:Ql.USER_INTERACTION,null!==this.touchMode&&this.touchMode(s,a)):(this.changeSource=Ql.USER_INTERACTION,this.panPerPixel>0?this.movePan(s,a):this.handleSinglePointerMove(s,a)))},this.onPointerUp=e=>{const{element:t}=this,i=this.pointers.findIndex(t=>t.id===e.pointerId);-1!==i&&this.pointers.splice(i,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[YA].style.opacity=0,t.style.cursor="grab",this.panPerPixel=0,this.isUserPointing&&this.dispatchEvent({type:"pointer-change-end"})},this.onWheel=e=>{this.changeSource=Ql.USER_INTERACTION;const t=e.deltaY*(1==e.deltaMode?18:1)*Sl*this.zoomSensitivity/30;this.userAdjustOrbit(0,0,t),e.preventDefault(),this.dispatchEvent({type:"user-interaction"})},this.onKeyDown=e=>{const{changeSource:t}=this;this.changeSource=Ql.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({},xl),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 bt){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,i=this.goalSpherical.radius){const{minimumAzimuthalAngle:s,maximumAzimuthalAngle:a,minimumPolarAngle:n,maximumPolarAngle:r,minimumRadius:o,maximumRadius:A}=this._options,{theta:l,phi:c,radius:h}=this.goalSpherical,d=Cs(e,s,a);isFinite(s)||isFinite(a)||(this.spherical.theta=this.wrapAngle(this.spherical.theta-d)+d);const g=Cs(t,n,r),u=Cs(i,o,A);return(d!==l||g!==c||u!==h)&&(!!(isFinite(d)&&isFinite(g)&&isFinite(u))&&(this.goalSpherical.theta=d,this.goalSpherical.phi=g,this.goalSpherical.radius=u,this.goalSpherical.makeSafe(),!0))}setRadius(e){this.goalSpherical.radius=e,this.setOrbit()}setFieldOfView(e){const{minimumFieldOfView:t,maximumFieldOfView:i}=this._options;e=Cs(e,t,i),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,i){const{theta:s,phi:a,radius:n}=this.goalSpherical,{minimumRadius:r,maximumRadius:o,minimumFieldOfView:A,maximumFieldOfView:l}=this._options,c=this.spherical.theta-s,h=Math.PI-.001,d=s-Cs(e,-h-c,h-c),g=a-t,u=0===i?0:((i>0?o:r)-n)/(Math.log(i>0?l:A)-this.goalLogFov),p=n+i*(isFinite(u)?u:2*(o-r));if(this.setOrbit(d,g,p),0!==i){const e=this.goalLogFov+i;this.setFieldOfView(Math.exp(e))}}jumpToGoal(){this.update(0,1e4)}update(e,t){if(this.isStationary())return!1;const{maximumPolarAngle:i,maximumRadius:s}=this._options,a=this.spherical.theta-this.goalSpherical.theta;return Math.abs(a)>Math.PI&&!isFinite(this._options.minimumAzimuthalAngle)&&!isFinite(this._options.maximumAzimuthalAngle)&&(this.spherical.theta-=2*Math.sign(a)*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,i),this.spherical.radius=this.radiusDamper.update(this.spherical.radius,this.goalSpherical.radius,t,s),this.logFov=this.fovDamper.update(this.logFov,this.goalLogFov,t,1),this.moveCamera(),!0}updateTouchActionStyle(){const{style:e}=this.element;if(this._interactionEnabled){const{touchAction:t}=this._options;this._disableZoom&&"none"!==t?e.touchAction="manipulation":e.touchAction=t}else e.touchAction=""}isStationary(){return this.goalSpherical.theta===this.spherical.theta&&this.goalSpherical.phi===this.spherical.phi&&this.goalSpherical.radius===this.spherical.radius&&this.goalLogFov===this.logFov}moveCamera(){this.spherical.makeSafe(),this.camera.position.setFromSpherical(this.spherical),this.camera.setRotationFromEuler(new It(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,i){this.adjustOrbit(e*this.orbitSensitivity*this.inputSensitivity,t*this.orbitSensitivity*this.inputSensitivity,i*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:i,clientY:s}=e,{clientX:a,clientY:n}=t,r=a-i,o=n-s;return Math.sqrt(r*r+o*o)}handleSinglePointerMove(e,t){const i=this.pixelLengthToSphericalAngle(e),s=this.pixelLengthToSphericalAngle(t);!1===this.isUserPointing&&(this.isUserPointing=!0,this.dispatchEvent({type:"pointer-change-start"})),this.userAdjustOrbit(i,s,0)}initializePan(){const{theta:e,phi:t}=this.spherical,i=e-this.scene.yaw;this.panPerPixel=.018*this.panSensitivity/this.scene.height,this.panProjection.set(-Math.cos(i),-Math.cos(t)*Math.sin(i),0,0,Math.sin(t),0,Math.sin(i),-Math.cos(t)*Math.cos(i),0)}movePan(e,t){const{scene:i}=this,s=Bl.set(e,t,0).multiplyScalar(this.inputSensitivity),a=this.spherical.radius*Math.exp(this.logFov)*this.panPerPixel;s.multiplyScalar(a);const n=i.getTarget();n.add(s.applyMatrix3(this.panProjection)),i.boundingSphere.clampPoint(n,n),i.setTarget(n.x,n.y,n.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,i=t.positionAndNormalFromPoint(t.getNDC(e.clientX,e.clientY));if(null==i){const{cameraTarget:e}=t.element;t.element.cameraTarget="",t.element.cameraTarget=e,this.userAdjustOrbit(0,0,1)}else t.target.worldToLocal(i.position),t.setTarget(i.position.x,i.position.y,i.position.z)}resetRadius(){const{scene:e}=this,t=e.positionAndNormalFromPoint(wl.set(0,0));if(null==t)return;e.target.worldToLocal(t.position);const i=e.getTarget(),{theta:s,phi:a}=this.spherical,n=s-e.yaw,r=Bl.set(Math.sin(a)*Math.sin(n),Math.cos(a),Math.sin(a)*Math.cos(n)),o=r.dot(t.position.sub(i));i.add(r.multiplyScalar(o)),e.setTarget(i.x,i.y,i.z),this.setOrbit(void 0,void 0,this.goalSpherical.radius-o)}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[YA].style.opacity=1))}}onMouseDown(e){this.panPerPixel=0,this.enablePan&&(2===e.button||e.ctrlKey||e.metaKey||e.shiftKey)&&(this.initializePan(),this.scene.element[YA].style.opacity=1),this.element.style.cursor="grabbing"}orbitZoomKeyCodeHandler(e){let t=!0;switch(e.key){case"PageUp":this.userAdjustOrbit(0,0,Sl*this.zoomSensitivity);break;case"PageDown":this.userAdjustOrbit(0,0,-.04*this.zoomSensitivity);break;case"ArrowUp":this.userAdjustOrbit(0,-vl,0);break;case"ArrowDown":this.userAdjustOrbit(0,vl,0);break;case"ArrowLeft":this.userAdjustOrbit(-vl,0,0);break;case"ArrowRight":this.userAdjustOrbit(vl,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}}const Dl='<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="#e8eaed">\n   <path d="M6.4,19L5,17.6L10.6,12L5,6.4L6.4,5L12,10.6L17.6,5L19,6.4L13.4,12L19,17.6L17.6,19L12,13.4L6.4,19Z"/>\n</svg>',Rl='<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="#e8eaed">\n   <path d="M7,17V9H5V7H9V17H7ZM11,17V15H13V17H11ZM16,17V9H14V7H18V17H16ZM11,13V11H13V13H11Z"/>\n</svg>',Tl='<svg xmlns="http://www.w3.org/2000/svg" width="24px" height="24px" viewBox="0 0 24 24" fill="#E1E2E8">\n   <defs>\n       <clipPath id="clip0">\n           <path d="M0,0h24v24h-24z"/>\n       </clipPath>\n   </defs>\n   <g clip-path="url(#clip0)">\n       <path d="M12,22C10.75,22 9.575,21.767 8.475,21.3C7.392,20.817 6.442,20.175 5.625,19.375C4.825,18.558 4.183,17.608 3.7,16.525C3.233,15.425 3,14.25 3,13H5C5,14.95 5.675,16.608 7.025,17.975C8.392,19.325 10.05,20 12,20C13.95,20 15.6,19.325 16.95,17.975C18.317,16.608 19,14.95 19,13C19,11.05 18.317,9.4 16.95,8.05C15.6,6.683 13.95,6 12,6H11.85L13.4,7.55L12,9L8,5L12,1L13.4,2.45L11.85,4H12C13.25,4 14.417,4.242 15.5,4.725C16.6,5.192 17.55,5.833 18.35,6.65C19.167,7.45 19.808,8.4 20.275,9.5C20.758,10.583 21,11.75 21,13C21,14.25 20.758,15.425 20.275,16.525C19.808,17.608 19.167,18.558 18.35,19.375C17.55,20.175 16.6,20.817 15.5,21.3C14.417,21.767 13.25,22 12,22Z"/>\n   </g>\n</svg>',Fl={width:.16,height:.07,cornerRadius:.03,opacity:1,color:0,minDistance:.5,maxDistance:10,baseScale:1,distanceScaleFactor:.3},kl=.05,Ll=.01,Pl=.07,_l={canvasSize:128,filter:U};class Ul extends R{constructor(){super(),this.isActualSize=!1,this.preRenderIcons(),this.createPanel(),this.createButtons(),this.opacityDamper=new wo,this.goalOpacity=Fl.opacity}createPanel(){const e=this.createPanelShape(),t=new Et(e),i=new J({color:Fl.color,opacity:Fl.opacity,transparent:!0});this.panelMesh=new X(t,i),this.panelMesh.name="MenuPanel",this.add(this.panelMesh)}createButtons(){this.exitButton=this.createButton("close"),this.exitButton.name="ExitButton",this.exitButton.position.set(Pl/2,0,Ll),this.add(this.exitButton),this.toggleButton=this.createButton("view-real-size"),this.toggleButton.name="ToggleButton",this.toggleButton.position.set(-.035,0,Ll),this.add(this.toggleButton)}createPanelShape(){const e=new Ct,{width:t,height:i,cornerRadius:s}=Fl;return e.moveTo(-t/2+s,-i/2),e.lineTo(t/2-s,-i/2),e.quadraticCurveTo(t/2,-i/2,t/2,-i/2+s),e.lineTo(t/2,i/2-s),e.quadraticCurveTo(t/2,i/2,t/2-s,i/2),e.lineTo(-t/2+s,i/2),e.quadraticCurveTo(-t/2,i/2,-t/2,i/2-s),e.lineTo(-t/2,-i/2+s),e.quadraticCurveTo(-t/2,-i/2,-t/2+s,-i/2),e}preRenderIcons(){[{key:"close",svg:Dl},{key:"view-real-size",svg:Rl},{key:"replay",svg:Tl}].forEach(({key:e,svg:t})=>{Ul.iconTextures.has(e)||this.createTextureFromSvg(t,e)})}createTextureFromSvg(e,t){const i=document.createElement("canvas");i.width=_l.canvasSize,i.height=_l.canvasSize;const s=i.getContext("2d"),a=new Image,n=new Blob([e],{type:"image/svg+xml"}),r=URL.createObjectURL(n);a.onload=()=>{s.drawImage(a,0,0,_l.canvasSize,_l.canvasSize);const e=new ct(i);e.needsUpdate=!0,e.minFilter=_l.filter,Ul.iconTextures.set(t,e),URL.revokeObjectURL(r)},a.src=r}createButton(e){const t=new J({transparent:!0}),i=new rt(kl,kl),s=new X(i,t),a=Ul.iconTextures.get(e);if(a)s.material.map=a,s.material.needsUpdate=!0;else{this.createTextureFromSvg("close"===e?Dl:"view-real-size"===e?Rl:Tl,e);const t=()=>{const i=Ul.iconTextures.get(e);i?(s.material.map=i,s.material.needsUpdate=!0):setTimeout(t,10)};t()}return s}exitButtonControllerIntersection(e,t){return e.hitFromController(t,this.exitButton)}scaleModeButtonControllerIntersection(e,t){return e.hitFromController(t,this.toggleButton)}handleScaleToggle(e,t,i,s){if(!e)return null;this.isActualSize=!this.isActualSize;const a=this.isActualSize?"replay":"view-real-size";this.updateScaleModeButtonLabel(a);const n=this.isActualSize?1:t;return Math.max(i,Math.min(s,n))}updateScaleModeButtonLabel(e){const t=Ul.iconTextures.get(e);t&&(this.toggleButton.material.map=t,this.toggleButton.material.needsUpdate=!0)}updatePosition(e,t){if(!t)return;const i=new S;t.getWorldPosition(i);const s=t.getSize(),a=Math.min(s.x,s.z),n=Math.max(.5,Math.min(2,a/1)),r=-.2*n,o=.9*n,A=(new S).copy(e.position).sub(i);A.y=0,A.normalize();const l=(new S).copy(i).add(new S(0,r,0)).add(A.multiplyScalar(o));this.position.copy(l);const c=e.position.distanceTo(l),h=Math.max(Fl.minDistance,Math.min(Fl.maxDistance,c)),d=Fl.baseScale+(h-Fl.minDistance)*Fl.distanceScaleFactor;this.scale.set(d,d,d),this.lookAt(e.position)}set show(e){this.goalOpacity=e?Fl.opacity:0}updateOpacity(e){const t=this.panelMesh.material.opacity,i=this.opacityDamper.update(t,this.goalOpacity,e,1);this.traverse(e=>{if(e instanceof X){const t=e.material;t.transparent&&(t.opacity=i)}}),this.visible=i>0}dispose(){var e;this.children.forEach(e=>{if(e instanceof X){e.geometry&&e.geometry.dispose();(Array.isArray(e.material)?e.material:[e.material]).forEach(e=>{e&&("map"in e&&e.map instanceof ct&&e.map.dispose(),e.dispose())})}}),null===(e=this.parent)||void 0===e||e.remove(this)}}Ul.iconTextures=new Map;
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const Gl=.8,Nl=150,Ol=new S(0,1,0),ql=.01,Hl=.001,jl="not-presenting",zl="session-started",Kl="object-placed",Vl="failed",Jl="tracking",Yl="not-tracking",Wl=new S,Xl=new Q,$l=new v,Zl=new S,ec=new se(45,1,.1,100),tc=(new h).setFromPoints([new S(0,0,0),new S(0,0,-1)]),ic="screen-space",sc="world-space";class ac extends tt{isWorldSpaceReady(){return this.xrMode===sc&&this.worldSpaceInitialPlacementDone}constructor(e){super(),this.renderer=e,this.currentSession=null,this.placeOnWall=!1,this.placementBox=null,this.menuPanel=null,this.lastTick=null,this.turntableRotation=null,this.oldShadowIntensity=null,this.frame=null,this.initialHitSource=null,this.transientHitTestSource=null,this.inputSource=null,this._presentedScene=null,this.resolveCleanup=null,this.exitWebXRButtonContainer=null,this.overlay=null,this.xrLight=null,this.xrMode=null,this.xrController1=null,this.xrController2=null,this.selectedXRController=null,this.tracking=!0,this.frames=0,this.initialized=!1,this.oldTarget=new S,this.placementComplete=!1,this.isTranslating=!1,this.isRotating=!1,this.isTwoHandInteraction=!1,this.lastDragPosition=new S,this.deltaRotation=new Q,this.scaleLine=new Z(tc),this.firstRatio=0,this.lastAngle=0,this.goalPosition=new S,this.goalYaw=0,this.goalScale=1,this.xDamper=new wo,this.yDamper=new wo,this.zDamper=new wo,this.yawDamper=new wo,this.pitchDamper=new wo,this.rollDamper=new wo,this.scaleDamper=new wo,this.wasTwoFingering=!1,this.worldSpaceInitialPlacementDone=!1,this.initialModelScale=1,this.minScale=1,this.maxScale=1,this.onExitWebXRButtonContainerClick=()=>this.stopPresenting(),this.onControllerSelectStart=e=>{var t,i,s;const a=this.presentedScene,n=e.target,r=this.menuPanel;if(null!=this.menuPanel.exitButtonControllerIntersection(a,n))return null===(t=this.menuPanel)||void 0===t||t.dispose(),void this.stopPresenting();if(null!=this.menuPanel.scaleModeButtonControllerIntersection(a,n)){const e=this.menuPanel.handleScaleToggle(this.worldSpaceInitialPlacementDone,this.initialModelScale,this.minScale,this.maxScale);return void(null!==e&&(this.goalScale=e))}r&&(r.show=!1);const o=this.placementBox.controllerIntersection(a,n);if(null!=o){const e=(new be).setFromObject(a.scenePivot).min.y+.2;if(o.point.y<=e)null!=this.selectedXRController?(this.selectedXRController.userData.line.visible=!1,a.canScale&&this.isWorldSpaceReady()&&(this.isTwoHandInteraction=!0,this.firstRatio=this.controllerSeparation()/a.scenePivot.scale.x,this.scaleLine.visible=!0)):n.attach(a.scenePivot),this.selectedXRController=n,a.setShadowIntensity(.01);else if(n==this.xrController1?this.xrController1.userData.isSelected=!0:n==this.xrController2&&(this.xrController2.userData.isSelected=!0),(null===(i=this.xrController1)||void 0===i?void 0:i.userData.isSelected)&&(null===(s=this.xrController2)||void 0===s?void 0:s.userData.isSelected))a.canScale&&this.isWorldSpaceReady()&&(this.isTwoHandInteraction=!0,this.firstRatio=this.controllerSeparation()/a.scenePivot.scale.x,this.scaleLine.visible=!0);else{const e=n===this.xrController1?this.xrController2:this.xrController1;n.userData.initialX=n.position.x,e.userData.turning=!1,n.userData.turning=!0,n.userData.line.visible=!1}}},this.onControllerSelectEnd=e=>{const t=e.target;if(t.userData.turning=!1,t.userData.line.visible=!0,this.isTwoHandInteraction=!1,this.scaleLine.visible=!1,t==this.xrController1?this.xrController1.userData.isSelected=!1:t==this.xrController2&&(this.xrController2.userData.isSelected=!1),null!=this.selectedXRController&&this.selectedXRController!=t)return;const i=this.presentedScene;i.attach(i.scenePivot),this.selectedXRController=null,this.goalYaw=Math.atan2(i.scenePivot.matrix.elements[8],i.scenePivot.matrix.elements[10]),this.goalPosition.x=i.scenePivot.position.x,this.goalPosition.z=i.scenePivot.position.z,this.isWorldSpaceReady()&&(this.goalPosition.y=i.scenePivot.position.y);this.menuPanel.show=!0},this.onUpdateScene=()=>{null!=this.placementBox&&this.isPresenting&&(this.placementBox.updateFromModelChanges(),this.placementBox.setScreenSpaceMode(this.xrMode===ic)),this.xrMode!==ic&&(this.menuPanel&&(this.menuPanel.dispose(),this.menuPanel=null),this.menuPanel=new Ul,this.presentedScene.add(this.menuPanel),this.menuPanel.updatePosition(this.presentedScene.getCamera(),this.placementBox))},this.onSelectStart=e=>{const t=this.transientHitTestSource;if(null==t)return;const i=this.frame.getHitTestResultsForTransientInput(t),s=this.presentedScene,a=this.placementBox;if(1===i.length){this.inputSource=e.inputSource;const{axes:t}=this.inputSource.gamepad,i=a.getHit(this.presentedScene,t[0],t[1]);a.show=!0,null!=i?(this.isTranslating=!0,this.lastDragPosition.copy(i)):!1===this.placeOnWall&&(this.isRotating=!0,this.lastAngle=1.5*t[0])}else if(2===i.length){a.show=!0,this.isTwoHandInteraction=!0;const{separation:e,angle:t}=this.fingerPolar(i);return this.lastAngle=t,0===this.firstRatio&&(this.firstRatio=e/s.scenePivot.scale.x),void(s.canScale&&this.setScale(e))}},this.onSelectEnd=()=>{this.isTranslating=!1,this.isRotating=!1,this.isTwoHandInteraction=!1,this.inputSource=null,this.goalPosition.y+=this.placementBox.offsetHeight*this.presentedScene.scale.x,this.placementBox.show=!1},this.onBeforeXRSelect=e=>{const t=e.composedPath();for(const i of t)if(i instanceof HTMLElement){const t=i.tagName.toLowerCase();if("input"===t||"button"===t||"select"===t||"textarea"===t||"a"===t||i.hasAttribute("data-pointer-coalesce")||i.classList.contains("interactive")){e.preventDefault();break}}},this.threeRenderer=e.threeRenderer,this.threeRenderer.xr.enabled=!0}async resolveARSession(){fs();const e=await navigator.xr.requestSession("immersive-ar",{requiredFeatures:[],optionalFeatures:["hit-test","dom-overlay","light-estimation"],domOverlay:this.overlay?{root:this.overlay}:void 0});return this.threeRenderer.xr.setReferenceSpaceType("local"),await this.threeRenderer.xr.setSession(e),this.threeRenderer.xr.cameraAutoUpdate=!1,e}get presentedScene(){return this._presentedScene}async supportsPresentation(){try{return fs(),await navigator.xr.isSessionSupported("immersive-ar")}catch(e){return console.warn("Request to present in WebXR denied:"),console.warn(e),console.warn("Falling back to next ar-mode"),!1}}async present(e,t=!1){this.isPresenting&&console.warn("Cannot present while a model is already presenting");let i=new Promise((e,t)=>{requestAnimationFrame(()=>e())});e.setHotspotsVisibility(!1),e.queueRender(),await i,this._presentedScene=e,this.overlay=e.element.shadowRoot.querySelector("div.default"),null!=this.overlay&&this.overlay.addEventListener("beforexrselect",this.onBeforeXRSelect),!0===t&&(this.xrLight=new yo(this.threeRenderer),this.xrLight.addEventListener("estimationstart",()=>{if(!this.isPresenting||null==this.xrLight)return;const e=this.presentedScene;e.add(this.xrLight),e.environment=this.xrLight.environment}));const s=await this.resolveARSession();s.addEventListener("end",()=>{this.postSessionCleanup()},{once:!0});const a=e.element.shadowRoot.querySelector(".slot.exit-webxr-ar-button");a.classList.add("enabled"),a.addEventListener("click",this.onExitWebXRButtonContainerClick),this.exitWebXRButtonContainer=a;const n=await s.requestReferenceSpace("viewer");this.xrMode=s.interactionMode,this.tracking=!0,this.frames=0,this.initialized=!1,this.turntableRotation=e.yaw,this.goalYaw=e.yaw,this.goalScale=1,e.setBackground(null),this.oldShadowIntensity=e.shadowIntensity,e.setShadowIntensity(.01),this.oldTarget.copy(e.getTarget()),e.element.addEventListener("load",this.onUpdateScene);const r=20*Math.PI/180,o=!0===this.placeOnWall?void 0:new XRRay(new DOMPoint(0,0,0),{x:0,y:-Math.sin(r),z:-Math.cos(r)});s.requestHitTestSource({space:n,offsetRay:o}).then(e=>{this.initialHitSource=e}),this.xrMode!==ic&&(this.setupXRControllers(),this.xDamper.setDecayTime(Nl),this.yDamper.setDecayTime(Nl),this.zDamper.setDecayTime(Nl),this.yawDamper.setDecayTime(Nl),this.pitchDamper.setDecayTime(Nl),this.rollDamper.setDecayTime(Nl),this.scaleDamper.setDecayTime(Nl)),this.currentSession=s,this.placementBox=new So(e,this.placeOnWall?"back":"bottom"),this.placementBox&&this.placementBox.setScreenSpaceMode(this.xrMode===ic),this.placementComplete=!1,this.xrMode!==ic&&(this.menuPanel=new Ul,e.add(this.menuPanel),this.menuPanel.updatePosition(e.getCamera(),this.placementBox)),this.lastTick=performance.now(),this.dispatchEvent({type:"status",status:zl})}setupXRControllerLine(e){if(!e.userData.line){const t=new Z(tc);t.name="line",t.scale.z=5,e.userData.turning=!1,e.userData.line=t,e.add(t)}}setupController(e){this.setupXRControllerLine(e),e.addEventListener("selectstart",this.onControllerSelectStart),e.addEventListener("selectend",this.onControllerSelectEnd)}setupXRControllers(){this.xrController1=this.threeRenderer.xr.getController(0),this.xrController2=this.threeRenderer.xr.getController(1),this.setupController(this.xrController1),this.setupController(this.xrController2),this.scaleLine.name="scale line",this.scaleLine.visible=!1,this.xrController1.add(this.scaleLine);const e=this.presentedScene;e.add(this.xrController1),e.add(this.xrController2)}hover(e){if(this.xrMode===ic||this.selectedXRController==e)return!1;const t=this.presentedScene,i=this.placementBox.controllerIntersection(t,e);return e.userData.line.scale.z=null==i?5:i.distance,null!=i}controllerSeparation(){return this.xrController1.position.distanceTo(this.xrController2.position)}async stopPresenting(){if(!this.isPresenting)return;const e=new Promise(e=>{this.resolveCleanup=e});try{await this.currentSession.end(),await e}catch(e){console.warn("Error while trying to end WebXR AR session"),console.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)}}cleanupXRController(e){e.userData.turning=!1,e.userData.line.visible=!0,e.removeEventListener("selectstart",this.onControllerSelectStart),e.removeEventListener("selectend",this.onControllerSelectEnd),e.removeFromParent()}postSessionCleanup(){const e=this.currentSession;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),null!=this.menuPanel&&(this.menuPanel.dispose(),this.menuPanel=null),t.add(t.scenePivot),t.scenePivot.quaternion.set(0,0,0,1),t.scenePivot.position.set(0,0,0),t.scenePivot.scale.set(1,1,1),t.setShadowOffset(0);const i=this.turntableRotation;null!=i&&(t.yaw=i);const s=this.oldShadowIntensity;null!=s&&t.setShadowIntensity(s),t.setEnvironmentAndSkybox(e[Bs],e[xs]);const a=this.oldTarget;t.setTarget(a.x,a.y,a.z),t.xrCamera=null,t.element.removeEventListener("load",this.onUpdateScene),t.orientHotspots(0);const{width:n,height:r}=e.getBoundingClientRect();t.setSize(n,r),requestAnimationFrame(()=>{t.element.dispatchEvent(new CustomEvent("camera-change",{detail:{source:Ql.NONE}}))})}this.renderer.height=0;const i=this.exitWebXRButtonContainer;null!=i&&(i.classList.remove("enabled"),i.removeEventListener("click",this.onExitWebXRButtonContainerClick),this.exitWebXRButtonContainer=null);const s=this.transientHitTestSource;null!=s&&(s.cancel(),this.transientHitTestSource=null);const a=this.initialHitSource;null!=a&&(a.cancel(),this.initialHitSource=null),null!=this.placementBox&&(this.placementBox.dispose(),this.placementBox=null),this.xrMode!==ic&&(null!=this.xrController1&&(this.cleanupXRController(this.xrController1),this.xrController1=null),null!=this.xrController2&&(this.cleanupXRController(this.xrController2),this.xrController2=null),this.selectedXRController=null,this.scaleLine.visible=!1),this.isTranslating=!1,this.isRotating=!1,this.isTwoHandInteraction=!1,this.lastTick=null,this.turntableRotation=null,this.oldShadowIntensity=null,this.frame=null,this.inputSource=null,null!=this.overlay&&(this.overlay.removeEventListener("beforexrselect",this.onBeforeXRSelect),this.overlay=null),this.worldSpaceInitialPlacementDone=!1,null!=this.resolveCleanup&&this.resolveCleanup(),this.dispatchEvent({type:"status",status:jl})}updateView(e){const t=this.presentedScene,i=this.threeRenderer.xr;i.updateCamera(ec),t.xrCamera=i.getCamera();const{elements:s}=t.getCamera().matrixWorld;if(t.orientHotspots(Math.atan2(s[1],s[5])),this.initialized||(this.placeInitially(),this.initialized=!0),e.requestViewportScale&&e.recommendedViewportScale){const t=e.recommendedViewportScale;e.requestViewportScale(Math.max(t,.25))}const a=i.getBaseLayer();if(null!=a){const t=a instanceof XRWebGLLayer?a.getViewport(e):i.getBinding().getViewSubImage(a,e).viewport;this.threeRenderer.setViewport(t.x,t.y,t.width,t.height)}}placeInitially(){const e=this.presentedScene,{scenePivot:t,element:i}=e,{position:s}=t,a=e.getCamera(),{width:n,height:r}=this.overlay.getBoundingClientRect();e.setSize(n,r),a.projectionMatrixInverse.copy(a.projectionMatrix).invert();const{theta:o}=i.getCameraOrbit(),A=a.getWorldDirection(Wl);if(e.yaw=Math.atan2(-A.x,-A.z)-o,this.goalYaw=e.yaw,this.xrMode!==sc||this.worldSpaceInitialPlacementDone){if(this.xrMode===ic){const t=Math.max(1,2*e.boundingSphere.radius);s.copy(a.position).add(A.multiplyScalar(t)),this.updateTarget();const i=e.getTarget();s.add(i).sub(this.oldTarget),this.goalPosition.copy(s)}}else{const{position:i,scale:n}=this.calculateWorldSpaceOptimalPlacement(e,a);this.goalPosition.copy(i),this.goalScale=n,this.initialModelScale=n,s.copy(i),t.scale.set(n,n,n),this.worldSpaceInitialPlacementDone=!0,this.calculateWorldSpaceScaleLimits(e),this.enableWorldSpaceUserInteraction()}if(e.setHotspotsVisibility(!0),this.xrMode===ic){const{session:e}=this.frame;e.addEventListener("selectstart",this.onSelectStart),e.addEventListener("selectend",this.onSelectEnd),e.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&&(Wl.copy(t).sub(this.presentedScene.getCamera().position),Wl.length()>10)?null:t}getHitPoint(e){const t=this.threeRenderer.xr.getReferenceSpace(),i=e.getPose(t);if(null==i)return null;const s=$l.fromArray(i.transform.matrix);return!0===this.placeOnWall&&(this.goalYaw=Math.atan2(s.elements[4],s.elements[6])),s.elements[5]>.75!==this.placeOnWall?Zl.setFromMatrixPosition(s):null}moveToFloor(e){if(this.xrMode===sc&&!this.worldSpaceInitialPlacementDone)return this.placementBox.show=!1,void this.dispatchEvent({type:"status",status:Kl});const t=this.initialHitSource;if(null==t)return;const i=e.getHitTestResults(t);if(0==i.length)return;const s=i[0],a=this.getHitPoint(s);null!=a&&(this.placementBox.show=!0,this.isTranslating||(this.placeOnWall?this.goalPosition.copy(a):this.goalPosition.y=a.y),t.cancel(),this.initialHitSource=null,this.dispatchEvent({type:"status",status:Kl}))}fingerPolar(e){const t=e[0].inputSource.gamepad.axes,i=e[1].inputSource.gamepad.axes,s=i[0]-t[0],a=i[1]-t[1],n=Math.atan2(a,s);let r=this.lastAngle-n;return r>Math.PI?r-=2*Math.PI:r<-Math.PI&&(r+=2*Math.PI),{separation:Math.sqrt(s*s+a*a),deltaYaw:r,angle:n}}setScale(e){let t=e/this.firstRatio;t=Math.abs(t-1)<.2?1:t,this.isWorldSpaceReady()&&(t=Math.max(this.minScale,Math.min(this.maxScale,t))),this.goalScale=t}processInput(e){const t=this.transientHitTestSource;if(null==t)return;const i=e.getHitTestResultsForTransientInput(t),s=this.presentedScene,a=s.scenePivot.scale.x;if(2===i.length){if(!this.wasTwoFingering){const{separation:e,angle:t}=this.fingerPolar(i);return this.firstRatio=e/a,this.lastAngle=t,this.wasTwoFingering=!0,void(this.isTwoHandInteraction=!0)}const{separation:e,deltaYaw:t,angle:n}=this.fingerPolar(i);return this.goalYaw+=t,this.lastAngle=n,s.canScale&&this.setScale(e),void(this.isTwoHandInteraction=!0)}if(this.wasTwoFingering&&(this.wasTwoFingering=!1,this.isTwoHandInteraction=!1,this.firstRatio=0),this.isTranslating||this.isTwoHandInteraction||this.isRotating)if(this.isRotating){const e=1.5*this.inputSource.gamepad.axes[0];this.goalYaw+=e-this.lastAngle,this.lastAngle=e}else this.isTranslating&&i.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),this.isWorldSpaceReady())this.goalPosition.add(t);else if(!1===this.placeOnWall){const e=t.y-this.lastDragPosition.y;if(e<0){this.placementBox.offsetHeight=e/a,this.presentedScene.setShadowOffset(e);const i=Wl.copy(s.getCamera().position),n=-e/(i.y-t.y);i.multiplyScalar(n),t.multiplyScalar(1-n).add(i)}this.goalPosition.add(t)}else this.goalPosition.add(t);this.lastDragPosition.copy(t)}})}applyXRControllerRotation(e,t){if(!e.userData.turning)return;const i=.3*(e.position.x-e.userData.initialX);this.deltaRotation.setFromAxisAngle(Ol,i),t.quaternion.multiplyQuaternions(this.deltaRotation,t.quaternion)}handleScalingInXR(e,t){if(this.xrMode===sc&&!this.worldSpaceInitialPlacementDone)return;if(this.xrController1&&this.xrController2&&this.isTwoHandInteraction){const e=this.controllerSeparation();this.setScale(e),this.scaleLine.scale.z=-e,this.scaleLine.lookAt(this.xrController2.position)}const i=e.scenePivot.scale.x;if(this.goalScale!==i){const s=this.scaleDamper.update(i,this.goalScale,t,1);e.scenePivot.scale.set(s,s,s)}}updatePivotPosition(e,t){const{scenePivot:i}=e,s=this.placementBox,a=e.boundingSphere.radius,n=this.goalPosition,r=i.position;let o=Ql.NONE;if(!n.equals(r)){o=Ql.USER_INTERACTION;let{x:i,y:A,z:l}=r;if(i=this.xDamper.update(i,n.x,t,a),A=this.yDamper.update(A,n.y,t,a),l=this.zDamper.update(l,n.z,t,a),r.set(i,A,l),this.xrMode===ic&&!this.isTranslating){const t=n.y-A;this.placementComplete&&!1===this.placeOnWall?(s.offsetHeight=t/e.scenePivot.scale.x,e.setShadowOffset(t)):0===t&&(this.placementComplete=!0,s.show=!1,e.setShadowIntensity(Gl))}this.xrMode!==ic&&n.equals(r)&&e.setShadowIntensity(Gl),this.isWorldSpaceReady()&&e.setShadowIntensity(Gl)}if(this.xrMode===sc&&!this.worldSpaceInitialPlacementDone&&this.goalScale!==i.scale.x){const e=this.scaleDamper.update(i.scale.x,this.goalScale,t,1);i.scale.set(e,e,e)}return e.updateTarget(t),o}updateYaw(e,t){Xl.setFromAxisAngle(Wl.set(0,1,0),this.goalYaw);const i=e.scenePivot.quaternion.angleTo(Xl),s=i-this.yawDamper.update(i,0,t,Math.PI);e.scenePivot.quaternion.rotateTowards(Xl,s)}updateMenuPanel(e,t,i){this.menuPanel&&(this.menuPanel.updateOpacity(i),this.menuPanel.updatePosition(e.getCamera(),t))}applyXRInputToScene(e){const t=this.presentedScene,i=t.scenePivot,s=this.placementBox;if(this.updatePlacementBoxOpacity(s,e),this.updateTwoHandInteractionState(),this.applyXRControllerRotations(i),this.handleScalingInXR(t,e),i.parent!==t)return void this.updateMenuPanel(t,s,e);const a=this.updatePivotPosition(t,e);this.updateYaw(t,e),this.dispatchCameraChangeEvent(t,a),this.updateMenuPanel(t,s,e)}updatePlacementBoxOpacity(e,t){const i=this.presentedScene.getCamera();e.update(t,i.position);const s=this.hover(this.xrController1),a=this.hover(this.xrController2),n=(s||a)&&!this.isTwoHandInteraction;e.setInteractionState(this.isTranslating||this.isRotating,n)}updateTwoHandInteractionState(){var e,t;const i=(null===(e=this.xrController1)||void 0===e?void 0:e.userData.isSelected)&&(null===(t=this.xrController2)||void 0===t?void 0:t.userData.isSelected);this.isTwoHandInteraction=!!i}applyXRControllerRotations(e){this.isTwoHandInteraction||(this.xrController1&&this.applyXRControllerRotation(this.xrController1,e),this.xrController2&&this.applyXRControllerRotation(this.xrController2,e))}dispatchCameraChangeEvent(e,t){e.element.dispatchEvent(new CustomEvent("camera-change",{detail:{source:t}}))}updateXRControllerHover(){const e=this.hover(this.xrController1),t=this.hover(this.xrController2),i=(e||t)&&!this.isTwoHandInteraction;this.placementBox&&(this.placementBox.setInteractionState(this.isTranslating||this.isRotating,i),this.placementBox.show=i)}enableWorldSpaceUserInteraction(){this.placementBox&&(this.placementBox.show=!0),this.presentedScene&&this.presentedScene.setShadowIntensity(Gl)}handleFirstView(e,t){this.xrMode===sc&&this.worldSpaceInitialPlacementDone||this.moveToFloor(e),this.processInput(e);const i=t-this.lastTick;this.applyXRInputToScene(i),this.renderer.preRender(this.presentedScene,t,i),this.lastTick=t,this.presentedScene.renderShadow(this.threeRenderer)}onWebXRFrame(e,t){this.xrMode!==ic&&this.updateXRControllerHover(),this.frame=t,++this.frames;const i=this.threeRenderer.xr.getReferenceSpace(),s=t.getViewerPose(i);null==s&&!0===this.tracking&&this.frames>30&&(this.tracking=!1,this.dispatchEvent({type:"tracking",status:Yl}));const a=this.presentedScene;if(null==s||null==a||!a.element.loaded)return void this.threeRenderer.clear();!1===this.tracking&&(this.tracking=!0,this.dispatchEvent({type:"tracking",status:Jl}));let n=!0;for(const i of s.views)this.updateView(i),n&&(this.handleFirstView(t,e),n=!1),this.threeRenderer.render(a,a.getCamera())}calculateWorldSpaceOptimalPlacement(e,t){const i=e.boundingBox,s={x:(i.max.x-i.min.x)/2,y:(i.max.y-i.min.y)/2,z:(i.max.z-i.min.z)/2},a=.15,n=Math.max(1.65,2*Math.max(s.x,s.z)+a),r=15*Math.PI/180,o=new S(0,-n*Math.sin(r),-n*Math.cos(r)),A=t.matrixWorld,l=o.clone().applyMatrix4(A),c=Math.max(s.x,s.z)+a,h=s.y,d=.3*n,g=.3*n/Math.max(h,ql),u=d/Math.max(c,ql),p=Math.min(g,u);return{position:l.clone().sub(new S(0,p*s.y,0)),scale:p}}calculateWorldSpaceScaleLimits(e){const t=e.size,i=Math.max(t.x,t.y,t.z),s=Math.max(Math.min(t.x,t.y,t.z),Hl),a=ql/Math.max(i,Hl),n=70/Math.max(s,Hl);this.minScale=Math.min(a,n,this.goalScale),this.maxScale=Math.max(a,n,this.goalScale)}}
/* @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const nc=Symbol("prepared"),rc=Symbol("prepare"),oc=Symbol("preparedGLTF"),Ac=Symbol("clone");class lc{static prepare(e){if(null==e.scene)throw new Error("Model does not have a scene");if(e[nc])return e;const t=this[rc](e);return t[nc]=!0,t}static[rc](e){const{scene:t}=e,i=[t];return Object.assign(Object.assign({},e),{scene:t,scenes:i})}get parser(){return this[oc].parser}get animations(){return this[oc].animations}get scene(){return this[oc].scene}get scenes(){return this[oc].scenes}get cameras(){return this[oc].cameras}get asset(){return this[oc].asset}get userData(){return this[oc].userData}constructor(e){this[oc]=e}clone(){return new(0,this.constructor)(this[Ac]())}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 i=e[t];if(i instanceof he){const e=i.source.data;null!=e.close&&e.close(),i.dispose()}}e.dispose()}),t.geometry.dispose()})})}[Ac](){const e=this[oc],t=Fs(this.scene);cc(t,this.scene);const i=[t],s=e.userData?Object.assign({},e.userData):{};return Object.assign(Object.assign({},e),{scene:t,scenes:i,userData:s})}}const cc=(e,t)=>{hc(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)})},hc=(e,t,i)=>{i(e,t);for(let s=0;s<e.children.length;s++)hc(e.children[s],t.children[s],i)},dc=Symbol("threeGLTF"),gc=Symbol("gltf"),uc=Symbol("gltfElementMap"),pc=Symbol("threeObjectMap"),mc=Symbol("parallelTraverseThreeScene"),bc=Symbol("correlateOriginalThreeGLTF"),fc=Symbol("correlateCloneThreeGLTF");class Ic{static from(e,t){return null!=t?this[fc](e,t):this[bc](e)}static[bc](e){const t=e.parser.json,i=e.parser.associations,s=new Map,a={name:"Default"},n={index:-1};for(const e of i.keys())e instanceof j&&null==i.get(e)&&(n.index<0&&(null==t.materials&&(t.materials=[]),n.index=t.materials.length,t.materials.push(a)),e.name=a.name,i.set(e,{materials:n.index}));for(const[e,a]of i){a&&(e.userData=e.userData||{},e.userData.associations=a);for(const i in a)if(null!=i&&"primitives"!==i){const n=i,r=(t[n]||[])[a[n]];if(null==r)continue;let o=s.get(r);null==o&&(o=new Set,s.set(r,o)),o.add(e)}}return new Ic(e,t,i,s)}static[fc](e,t){const i=t.threeGLTF,s=t.gltf,a=JSON.parse(JSON.stringify(s)),n=new Map,r=new Map;for(let s=0;s<i.scenes.length;s++)this[mc](i.scenes[s],e.scenes[s],(e,i)=>{const s=t.threeObjectMap.get(e);if(null!=s)for(const e in s)if(null!=e&&"primitives"!==e){const t=e,o=s[t],A=a[t][o],l=n.get(i)||{};l[t]=o,n.set(i,l);const c=r.get(A)||new Set;c.add(i),r.set(A,c)}});return new Ic(e,a,n,r)}static[mc](e,t,i){const s=(e,t)=>{if(i(e,t),e.isObject3D){const a=e,n=t;if(a.material)if(Array.isArray(a.material))for(let e=0;e<a.material.length;++e)i(a.material[e],n.material[e]);else i(a.material,n.material);for(let i=0;i<e.children.length;++i)s(e.children[i],t.children[i])}};s(e,t)}get threeGLTF(){return this[dc]}get gltf(){return this[gc]}get gltfElementMap(){return this[uc]}get threeObjectMap(){return this[pc]}constructor(e,t,i,s){this[dc]=e,this[gc]=t,this[uc]=s,this[pc]=i}}
/* @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Ec=Symbol("correlatedSceneGraph");class Cc extends lc{static[rc](e){const t=super[rc](e);null==t[Ec]&&(t[Ec]=Ic.from(t));const{scene:i}=t,s=new fe(void 0,1/0);return i.traverse(e=>{e.renderOrder=1e3,e.frustumCulled=!1,e.name||(e.name=e.uuid);const i=e;if(i.material){const{geometry:e}=i;i.castShadow=!0,i.isSkinnedMesh&&(e.boundingSphere=s,e.boundingBox=null);const a=i.material;if(!0===a.isMeshBasicMaterial&&(a.toneMapped=!1),a.shadowSide=pe,a.aoMap){const{gltf:i,threeObjectMap:s}=t[Ec],n=s.get(a);if(null!=i.materials&&null!=n&&null!=n.materials){const t=i.materials[n.materials];t.occlusionTexture&&0===t.occlusionTexture.texCoord&&null!=e.attributes.uv&&e.setAttribute("uv2",e.attributes.uv)}}}}),t}get correlatedSceneGraph(){return this[oc][Ec]}[Ac](){const e=super[Ac](),t=new Map;return e.scene.traverse(e=>{const i=e;if(i.material){const e=i.material;if(null!=e){if(t.has(e.uuid))return void(i.material=t.get(e.uuid));i.material=e.clone(),t.set(e.uuid,i.material)}}const s=e;void 0!==s.target&&s.add(s.target)}),e[Ec]=Ic.from(e,this.correlatedSceneGraph),e}}const yc=(e,t,i)=>{let s;switch(e){case ze:s=new Uint8ClampedArray(t*i*4);break;case Ke:s=new Uint16Array(t*i*4);break;case St:s=new Uint32Array(t*i*4);break;case vt:s=new Int8Array(t*i*4);break;case xt:s=new Int16Array(t*i*4);break;case Bt:s=new Int32Array(t*i*4);break;case Ye:s=new Float32Array(t*i*4);break;default:throw new Error("Unsupported data type")}return s};let wc;class Bc{_renderer;_rendererIsDisposable=!1;_material;_scene;_camera;_quad;_renderTarget;_width;_height;_type;_colorSpace;_supportsReadPixels=!0;constructor(e){this._width=e.width,this._height=e.height,this._type=e.type,this._colorSpace=e.colorSpace;const t={format:je,depthBuffer:!1,stencilBuffer:!1,type:this._type,colorSpace:this._colorSpace,anisotropy:void 0!==e.renderTargetOptions?.anisotropy?e.renderTargetOptions?.anisotropy:1,generateMipmaps:void 0!==e.renderTargetOptions?.generateMipmaps&&e.renderTargetOptions?.generateMipmaps,magFilter:void 0!==e.renderTargetOptions?.magFilter?e.renderTargetOptions?.magFilter:U,minFilter:void 0!==e.renderTargetOptions?.minFilter?e.renderTargetOptions?.minFilter:U,samples:void 0!==e.renderTargetOptions?.samples?e.renderTargetOptions?.samples:void 0,wrapS:void 0!==e.renderTargetOptions?.wrapS?e.renderTargetOptions?.wrapS:q,wrapT:void 0!==e.renderTargetOptions?.wrapT?e.renderTargetOptions?.wrapT:q};if(this._material=e.material,e.renderer?this._renderer=e.renderer:(this._renderer=Bc.instantiateRenderer(),this._rendererIsDisposable=!0),this._scene=new nt,this._camera=new ne,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,i,s)=>{if(void 0!==wc)return wc;const a=new yt(1,1,s);t.setRenderTarget(a);const n=new X(new rt,new J({color:16777215}));t.render(n,i),t.setRenderTarget(null);const r=yc(e,a.width,a.height);return t.readRenderTargetPixels(a,0,0,a.width,a.height,r),a.dispose(),n.geometry.dispose(),n.material.dispose(),wc=0!==r[0],wc})(this._type,this._renderer,this._camera,t)){let e;if(this._type===Ke)e=this._renderer.extensions.has("EXT_color_buffer_float")?Ye:void 0;void 0!==e?(console.warn(`This browser does not support reading pixels from ${this._type} RenderTargets, switching to ${Ye}`),this._type=e):(this._supportsReadPixels=!1,console.warn("This browser dos not support toArray or toDataTexture, calls to those methods will result in an error thrown"))}this._quad=new X(new rt,this._material),this._quad.geometry.computeBoundingBox(),this._scene.add(this._quad),this._renderTarget=new yt(this.width,this.height,t),this._renderTarget.texture.mapping=void 0!==e.renderTargetOptions?.mapping?e.renderTargetOptions?.mapping:wt}static instantiateRenderer(){const e=new lt;return e.setSize(128,128),e}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)};toArray(){if(!this._supportsReadPixels)throw new Error("Can't read pixels in this browser");const e=yc(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 We(this.toArray(),this.width,this.height,je,this._type,e?.mapping||wt,e?.wrapS||q,e?.wrapT||q,e?.magFilter||U,e?.minFilter||U,e?.anisotropy||1,c);return t.generateMipmaps=void 0!==e?.generateMipmaps&&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 ot&&Object.values(this.material.uniforms).forEach(e=>{e.value instanceof he&&e.value.dispose()}),Object.values(this.material).forEach(e=>{e instanceof he&&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}}class xc extends Error{}class vc extends Error{}const Sc=(e,t,i)=>{const s=new RegExp(`${t}="([^"]*)"`,"i").exec(e);if(s)return s[1];const a=new RegExp(`<${t}[^>]*>([\\s\\S]*?)</${t}>`,"i").exec(e);if(a){const e=a[1].match(/<rdf:li>([^<]*)<\/rdf:li>/g);return e&&3===e.length?e.map(e=>e.replace(/<\/?rdf:li>/g,"")):a[1].trim()}if(void 0!==i)return i;throw new Error(`Can't find ${t} in gainmap metadata`)};class Qc{options;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,i)=>{const s=this.options.debug,a=new DataView(e.buffer);if(65496!==a.getUint16(0))return void i(new Error("Not a valid jpeg"));const n=a.byteLength;let r,o=2,A=0;for(;o<n;){if(++A>250)return void i(new Error(`Found no marker after ${A} loops 😵`));if(255!==a.getUint8(o))return void i(new Error(`Not a valid marker at offset 0x${o.toString(16)}, found: 0x${a.getUint8(o).toString(16)}`));if(r=a.getUint8(o+1),s&&console.log(`Marker: ${r.toString(16)}`),226===r){s&&console.log("Found APP2 marker (0xffe2)");const e=o+4;if(1297106432===a.getUint32(e)){const s=e+4;let n;if(18761===a.getUint16(s))n=!1;else{if(19789!==a.getUint16(s))return void i(new Error("No valid endianness marker found in TIFF header"));n=!0}if(42!==a.getUint16(s+2,!n))return void i(new Error("Not valid TIFF data! (no 0x002A marker)"));const r=a.getUint32(s+4,!n);if(r<8)return void i(new Error("Not valid TIFF data! (First offset less than 8)"));const o=s+r,A=a.getUint16(o,!n),l=o+2;let c=0;for(let e=l;e<l+12*A;e+=12)45057===a.getUint16(e,!n)&&(c=a.getUint32(e+8,!n));const h=o+2+12*A+4,d=[];for(let e=h;e<h+16*c;e+=16){const t={MPType:a.getUint32(e,!n),size:a.getUint32(e+4,!n),dataOffset:a.getUint32(e+8,!n),dependantImages:a.getUint32(e+12,!n),start:-1,end:-1,isFII:!1};t.dataOffset?(t.start=s+t.dataOffset,t.isFII=!1):(t.start=0,t.isFII=!0),t.end=t.start+t.size,d.push(t)}if(this.options.extractNonFII&&d.length){const e=new Blob([a]),i=[];for(const t of d){if(t.isFII&&!this.options.extractFII)continue;const s=e.slice(t.start,t.end+1,"image/jpeg");i.push(s)}t(i)}}}o+=2+a.getUint16(o+2)}})}}const Mc=async e=>{const t=(e=>{let t;t="undefined"!=typeof TextDecoder?(new TextDecoder).decode(e):e.toString();let i=t.indexOf("<x:xmpmeta");for(;-1!==i;){const e=t.indexOf("x:xmpmeta>",i),s=t.slice(i,e+10);try{const e=Sc(s,"hdrgm:GainMapMin","0"),t=Sc(s,"hdrgm:GainMapMax"),i=Sc(s,"hdrgm:Gamma","1"),a=Sc(s,"hdrgm:OffsetSDR","0.015625"),n=Sc(s,"hdrgm:OffsetHDR","0.015625"),r=/hdrgm:HDRCapacityMin="([^"]*)"/.exec(s),o=r?r[1]:"0",A=/hdrgm:HDRCapacityMax="([^"]*)"/.exec(s);if(!A)throw new Error("Incomplete gainmap metadata");const l=A[1];return{gainMapMin:Array.isArray(e)?e.map(e=>parseFloat(e)):[parseFloat(e),parseFloat(e),parseFloat(e)],gainMapMax:Array.isArray(t)?t.map(e=>parseFloat(e)):[parseFloat(t),parseFloat(t),parseFloat(t)],gamma:Array.isArray(i)?i.map(e=>parseFloat(e)):[parseFloat(i),parseFloat(i),parseFloat(i)],offsetSdr:Array.isArray(a)?a.map(e=>parseFloat(e)):[parseFloat(a),parseFloat(a),parseFloat(a)],offsetHdr:Array.isArray(n)?n.map(e=>parseFloat(e)):[parseFloat(n),parseFloat(n),parseFloat(n)],hdrCapacityMin:parseFloat(o),hdrCapacityMax:parseFloat(l)}}catch(e){}i=t.indexOf("<x:xmpmeta",e)}})(e);if(!t)throw new vc("Gain map XMP metadata not found");const i=new Qc({extractFII:!0,extractNonFII:!0}),s=await i.extract(e);if(2!==s.length)throw new xc("Gain map recovery image not found");return{sdr:new Uint8Array(await s[0].arrayBuffer()),gainMap:new Uint8Array(await s[1].arrayBuffer()),metadata:t}},Dc=e=>new Promise((t,i)=>{const s=document.createElement("img");s.onload=()=>{t(s)},s.onerror=e=>{i(e)},s.src=URL.createObjectURL(e)});class Rc extends o{_renderer;_renderTargetOptions;_internalLoadingManager;_config;constructor(e,t){super(t),this._config=e,e.renderer&&(this._renderer=e.renderer),this._internalLoadingManager=new Qt}setRenderer(e){return this._renderer=e,this}setRenderTargetOptions(e){return this._renderTargetOptions=e,this}prepareQuadRenderer(){this._renderer||console.warn("WARNING: A Renderer was not passed to this Loader constructor or in setRenderer, the result of this Loader will need to be converted to a Data Texture with toDataTexture() before you can use it in your renderer.");const e=this._config.createMaterial({gainMapMax:[1,1,1],gainMapMin:[0,0,0],gamma:[1,1,1],offsetHdr:[1,1,1],offsetSdr:[1,1,1],hdrCapacityMax:1,hdrCapacityMin:0,maxDisplayBoost:1,gainMap:new he,sdr:new he});return this._config.createQuadRenderer({width:16,height:16,type:Ke,colorSpace:c,material:e,renderer:this._renderer,renderTargetOptions:this._renderTargetOptions})}async processImages(e,t,i){const s=t?new Blob([t],{type:"image/jpeg"}):void 0,a=new Blob([e],{type:"image/jpeg"});let n,r,o=!1;if("undefined"==typeof createImageBitmap){const e=await Promise.all([s?Dc(s):Promise.resolve(void 0),Dc(a)]);r=e[0],n=e[1],o="flipY"===i}else{const e=await Promise.all([s?createImageBitmap(s,{imageOrientation:i||"flipY"}):Promise.resolve(void 0),createImageBitmap(a,{imageOrientation:i||"flipY"})]);r=e[0],n=e[1]}return{sdrImage:n,gainMapImage:r,needsFlip:o}}createTextures(e,t,i){const s=new he(t||new ImageData(2,2),wt,q,q,U,Mt,je,ze,1,c);s.flipY=i,s.needsUpdate=!0;const a=new he(e,wt,q,q,U,Mt,je,ze,1,l);return a.flipY=i,a.needsUpdate=!0,{gainMap:s,sdr:a}}updateQuadRenderer(e,t,i,s,a){e.width=t.width,e.height=t.height,e.material.gainMap=i,e.material.sdr=s,e.material.gainMapMin=a.gainMapMin,e.material.gainMapMax=a.gainMapMax,e.material.offsetHdr=a.offsetHdr,e.material.offsetSdr=a.offsetSdr,e.material.gamma=a.gamma,e.material.hdrCapacityMin=a.hdrCapacityMin,e.material.hdrCapacityMax=a.hdrCapacityMax,e.material.maxDisplayBoost=Math.pow(2,a.hdrCapacityMax),e.material.needsUpdate=!0}}class Tc extends ot{_maxDisplayBoost;_hdrCapacityMin;_hdrCapacityMax;constructor({gamma:e,offsetHdr:t,offsetSdr:i,gainMapMin:s,gainMapMax:a,maxDisplayBoost:n,hdrCapacityMin:r,hdrCapacityMax:o,sdr:A,gainMap:l}){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:A},gainMap:{value:l},gamma:{value:new S(1/e[0],1/e[1],1/e[2])},offsetHdr:{value:(new S).fromArray(t)},offsetSdr:{value:(new S).fromArray(i)},gainMapMin:{value:(new S).fromArray(s)},gainMapMax:{value:(new S).fromArray(a)},weightFactor:{value:(Math.log2(n)-r)/(o-r)}},blending:Dt,depthTest:!1,depthWrite:!1}),this._maxDisplayBoost=n,this._hdrCapacityMin=r,this._hdrCapacityMax=o,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 Fc extends Rc{constructor(e,t){super({renderer:e,createMaterial:e=>new Tc(e),createQuadRenderer:e=>new Bc(e)},t)}async render(e,t,i,s){const{sdrImage:a,gainMapImage:n,needsFlip:r}=await this.processImages(i,s,"flipY"),{gainMap:o,sdr:A}=this.createTextures(a,n,r);this.updateQuadRenderer(e,a,o,A,t),e.render()}}class kc extends Fc{load(e,t,i,s){const a=this.prepareQuadRenderer(),n=new A(this._internalLoadingManager);return n.setResponseType("arraybuffer"),n.setRequestHeader(this.requestHeader),n.setPath(this.path),n.setWithCredentials(this.withCredentials),this.manager.itemStart(e),n.load(e,async i=>{if("string"==typeof i)throw new Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");const n=new Uint8Array(i);let r,o,A;try{const e=await Mc(n);r=e.sdr,o=e.gainMap,A=e.metadata}catch(t){if(!(t instanceof vc||t instanceof xc))throw t;console.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),A={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},r=n}try{await this.render(a,A,r.buffer,o?.buffer)}catch(t){return this.manager.itemError(e),"function"==typeof s&&s(t),void a.disposeOnDemandRenderer()}"function"==typeof t&&t(a),this.manager.itemEnd(e),a.disposeOnDemandRenderer()},i,t=>{this.manager.itemError(e),"function"==typeof s&&s(t)}),a}}class Lc extends Rt{constructor(e){super(e),this.type=Ke}parse(e){const t=function(e,t){switch(e){case 1:throw new Error("THREE.HDRLoader: Read Error: "+(t||""));case 2:throw new Error("THREE.HDRLoader: Write Error: "+(t||""));case 3:throw new Error("THREE.HDRLoader: Bad File Format: "+(t||""));default:throw new Error("THREE.HDRLoader: Memory Error: "+(t||""))}},i=function(e,t,i){t=t||1024;let s=e.pos,a=-1,n=0,r="",o=String.fromCharCode.apply(null,new Uint16Array(e.subarray(s,s+128)));for(;0>(a=o.indexOf("\n"))&&n<t&&s<e.byteLength;)r+=o,n+=o.length,s+=128,o+=String.fromCharCode.apply(null,new Uint16Array(e.subarray(s,s+128)));return-1<a&&(e.pos+=n+a+1,r+o.slice(0,a))},s=function(e,t,i,s){const a=e[t+3],n=Math.pow(2,a-128)/255;i[s+0]=e[t+0]*n,i[s+1]=e[t+1]*n,i[s+2]=e[t+2]*n,i[s+3]=1},a=function(e,t,i,s){const a=e[t+3],n=Math.pow(2,a-128)/255;i[s+0]=Tt.toHalfFloat(Math.min(e[t+0]*n,65504)),i[s+1]=Tt.toHalfFloat(Math.min(e[t+1]*n,65504)),i[s+2]=Tt.toHalfFloat(Math.min(e[t+2]*n,65504)),i[s+3]=Tt.toHalfFloat(1)},n=new Uint8Array(e);n.pos=0;const r=function(e){const s=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,a=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,n=/^\s*FORMAT=(\S+)\s*$/,r=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,o={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let A,l;for((e.pos>=e.byteLength||!(A=i(e)))&&t(1,"no header found"),(l=A.match(/^#\?(\S+)/))||t(3,"bad initial token"),o.valid|=1,o.programtype=l[1],o.string+=A+"\n";A=i(e),!1!==A;)if(o.string+=A+"\n","#"!==A.charAt(0)){if((l=A.match(s))&&(o.gamma=parseFloat(l[1])),(l=A.match(a))&&(o.exposure=parseFloat(l[1])),(l=A.match(n))&&(o.valid|=2,o.format=l[1]),(l=A.match(r))&&(o.valid|=4,o.height=parseInt(l[1],10),o.width=parseInt(l[2],10)),2&o.valid&&4&o.valid)break}else o.comments+=A+"\n";return 2&o.valid||t(3,"missing format specifier"),4&o.valid||t(3,"missing image size specifier"),o}(n),o=r.width,A=r.height,l=function(e,i,s){const a=i;if(a<8||a>32767||2!==e[0]||2!==e[1]||128&e[2])return new Uint8Array(e);a!==(e[2]<<8|e[3])&&t(3,"wrong scanline width");const n=new Uint8Array(4*i*s);n.length||t(4,"unable to allocate buffer space");let r=0,o=0;const A=4*a,l=new Uint8Array(4),c=new Uint8Array(A);let h=s;for(;h>0&&o<e.byteLength;){o+4>e.byteLength&&t(1),l[0]=e[o++],l[1]=e[o++],l[2]=e[o++],l[3]=e[o++],2==l[0]&&2==l[1]&&(l[2]<<8|l[3])==a||t(3,"bad rgbe scanline format");let i,s=0;for(;s<A&&o<e.byteLength;){i=e[o++];const a=i>128;if(a&&(i-=128),(0===i||s+i>A)&&t(3,"bad scanline data"),a){const t=e[o++];for(let e=0;e<i;e++)c[s++]=t}else c.set(e.subarray(o,o+i),s),s+=i,o+=i}const d=a;for(let e=0;e<d;e++){let t=0;n[r]=c[e+t],t+=a,n[r+1]=c[e+t],t+=a,n[r+2]=c[e+t],t+=a,n[r+3]=c[e+t],r+=4}h--}return n}(n.subarray(n.pos),o,A);let c,h,d;switch(this.type){case Ye:d=l.length/4;const e=new Float32Array(4*d);for(let t=0;t<d;t++)s(l,4*t,e,4*t);c=e,h=Ye;break;case Ke:d=l.length/4;const t=new Uint16Array(4*d);for(let e=0;e<d;e++)a(l,4*e,t,4*e);c=t,h=Ke;break;default:throw new Error("THREE.HDRLoader: Unsupported type: "+this.type)}return{width:o,height:A,data:c,header:r.string,gamma:r.gamma,exposure:r.exposure,type:h}}setDataType(e){return this.type=e,this}load(e,t,i,s){return super.load(e,function(e,i){switch(e.type){case Ye:case Ke:e.colorSpace=c,e.minFilter=U,e.magFilter=U,e.generateMipmaps=!1,e.flipY=!0}t&&t(e,i)},i,s)}}class Pc extends Lc{constructor(e){console.warn("RGBELoader has been deprecated. Please use HDRLoader instead."),super(e)}}
/* @license
 * Copyright 2021 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const _c={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]}]},Uc={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 Gc extends nt{constructor(e){super(),this.position.y=-3.5;const t=new mt;t.deleteAttribute("uv");const i=new K({metalness:0,side:Ft}),s=new K({metalness:0}),a="legacy"==e?_c:Uc,n=new B(16777215,a.topLight.intensity,28,2);n.position.set(...a.topLight.position),this.add(n);const r=new X(t,i);r.position.set(...a.room.position),r.scale.set(...a.room.scale),this.add(r);for(const e of a.boxes){const i=new X(t,s);i.position.set(...e.position),i.rotation.set(0,e.rotation,0),i.scale.set(...e.scale),this.add(i)}for(const e of a.lights){const i=new X(t,this.createAreaLightMaterial(e.intensity));i.position.set(...e.position),i.scale.set(...e.scale),this.add(i)}}createAreaLightMaterial(e){const t=new J;return t.color.setScalar(e),t}}
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Nc=20,Oc=/\.hdr(\.js)?$/,qc=/\.ktx2(\?|#|$)/;class Hc{constructor(e){this.threeRenderer=e,this.lottieLoaderUrl="",this._ldrLoader=null,this._imageLoader=null,this._hdrLoader=null,this._lottieLoader=null,this.generatedEnvironmentMap=null,this.generatedEnvironmentMapAlt=null,this.skyboxCache=new Map,this.blurMaterial=null,this.blurScene=null}ldrLoader(e){return null==this._ldrLoader&&(this._ldrLoader=new T),this._ldrLoader.setWithCredentials(e),this._ldrLoader}imageLoader(e){return null==this._imageLoader&&(this._imageLoader=new kc(this.threeRenderer)),this._imageLoader.setWithCredentials(e),this._imageLoader}hdrLoader(e){return null==this._hdrLoader&&(this._hdrLoader=new Pc,this._hdrLoader.setDataType(Ke)),this._hdrLoader.setWithCredentials(e),this._hdrLoader}async getLottieLoader(e){if(null==this._lottieLoader){const{LottieLoader:e}=await import(this.lottieLoaderUrl);this._lottieLoader=new e}return this._lottieLoader.setWithCredentials(e),this._lottieLoader}async loadImage(e,t,i){if("image/ktx2"===i||qc.test(e))return this.loadKTX2(e,t);const s=await new Promise((i,s)=>this.ldrLoader(t).load(e,i,()=>{},s));return s.name=e,s.flipY=!1,s}async loadKTX2(e,t){ar.setWithCredentials(t);const i=await new Promise((t,i)=>ar.load(e,t,()=>{},i));return i.name=e,i.flipY=!1,i}async loadLottie(e,t,i){const s=await this.getLottieLoader(i);s.setQuality(t);const a=await new Promise((t,i)=>s.load(e,t,()=>{},i));return a.name=e,a}async loadEquirect(e,t=!1,i=()=>{}){try{const s=Oc.test(e),a=s?this.hdrLoader(t):this.imageLoader(t),n=await new Promise((t,s)=>a.load(e,e=>{const{renderTarget:i}=e;if(null!=i){let s;try{const t=e.toDataTexture();t.needsUpdate=!0;const a=t.image.data;let n=!1;const r=a.length;for(let e=0;e<r;e++)if(0!==a[e]){n=!0;break}n?(s=t,e.dispose(!0)):(console.warn("Decoded DataTexture is completely black, falling back to render target texture."),s=i.texture,e.dispose(!1))}catch(t){console.warn("Failed to convert gainmap to DataTexture, falling back to render target texture:",t),s=i.texture,e.dispose(!1)}t(s)}else t(e)},e=>{i(e.loaded/e.total*.9)},s));return i(1),n.name=e,n.mapping=kt,s||n.type===Ke||(n.colorSpace=l),n}finally{i&&i(1)}}async generateEnvironmentMapAndSkybox(e=null,t=null,i=()=>{},s=!1){const a="legacy"!==t;"legacy"!==t&&"neutral"!==t||(t=null),t=bs(t);let n,r=Promise.resolve(null);e&&(r=this.loadEquirectFromUrl(e,s,i)),n=t?this.loadEquirectFromUrl(t,s,i):e?this.loadEquirectFromUrl(e,s,i):a?this.loadGeneratedEnvironmentMapAlt():this.loadGeneratedEnvironmentMap();const[o,A]=await Promise.all([n,r]);if(null==o)throw new Error("Failed to load environment map.");return{environmentMap:o,skybox:A}}async loadEquirectFromUrl(e,t,i){if(!this.skyboxCache.has(e)){const s=this.loadEquirect(e,t,i);this.skyboxCache.set(e,s),s.catch(()=>{this.skyboxCache.get(e)===s&&this.skyboxCache.delete(e)})}return this.skyboxCache.get(e)}async GenerateEnvironmentMap(e,t){await((e=0)=>new Promise(t=>setTimeout(t,e)))();const i=this.threeRenderer,s=new dt(256,{generateMipmaps:!1,type:Ke,format:je,colorSpace:c,depthBuffer:!0}),a=new Lt(.1,100,s),n=a.renderTarget.texture;n.name=t;const o=i.outputColorSpace,A=i.toneMapping;return i.toneMapping=r,i.outputColorSpace=c,a.update(i,e),this.blurCubemap(s,.04),i.toneMapping=A,i.outputColorSpace=o,n}async loadGeneratedEnvironmentMap(){return null==this.generatedEnvironmentMap&&(this.generatedEnvironmentMap=this.GenerateEnvironmentMap(new Gc("legacy"),"legacy")),this.generatedEnvironmentMap}async loadGeneratedEnvironmentMapAlt(){return null==this.generatedEnvironmentMapAlt&&(this.generatedEnvironmentMapAlt=this.GenerateEnvironmentMap(new Gc("neutral"),"neutral")),this.generatedEnvironmentMapAlt}blurCubemap(e,t){if(null==this.blurMaterial){this.blurMaterial=this.getBlurShader(Nc);const e=new mt,t=new X(e,this.blurMaterial);this.blurScene=new nt,this.blurScene.add(t)}const i=e.clone();this.halfblur(e,i,t,"latitudinal"),this.halfblur(i,e,t,"longitudinal")}halfblur(e,t,i,s){const a=e.width,n=isFinite(i)?Math.PI/(2*a):2*Math.PI/39,r=i/n,o=isFinite(i)?1+Math.floor(3*r):Nc;o>Nc&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${o} samples when the maximum is set to 20`);const A=[];let l=0;for(let e=0;e<Nc;++e){const t=e/r,i=Math.exp(-t*t/2);A.push(i),0==e?l+=i:e<o&&(l+=2*i)}for(let e=0;e<A.length;e++)A[e]=A[e]/l;const c=this.blurMaterial.uniforms;c.envMap.value=e.texture,c.samples.value=o,c.weights.value=A,c.latitudinal.value="latitudinal"===s,c.dTheta.value=n;new Lt(.1,100,t).update(this.threeRenderer,this.blurScene)}getBlurShader(e){const t=new Float32Array(e),i=new S(0,1,0);return new ot({name:"SphericalGaussianBlur",defines:{n:e},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:t},latitudinal:{value:!1},dTheta:{value:0},poleAxis:{value:i}},vertexShader:"\n      \n      varying vec3 vOutputDirection;\n  \n      void main() {\n  \n        vOutputDirection = vec3( position );\n        gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n  \n      }\n    ",fragmentShader:"\n        varying vec3 vOutputDirection;\n  \n        uniform samplerCube envMap;\n        uniform int samples;\n        uniform float weights[ n ];\n        uniform bool latitudinal;\n        uniform float dTheta;\n        uniform vec3 poleAxis;\n  \n        vec3 getSample( float theta, vec3 axis ) {\n  \n          float cosTheta = cos( theta );\n          // Rodrigues' axis-angle rotation\n          vec3 sampleDirection = vOutputDirection * cosTheta\n            + cross( axis, vOutputDirection ) * sin( theta )\n            + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );\n  \n          return vec3( textureCube( envMap, sampleDirection ) );\n  \n        }\n  \n        void main() {\n  \n          vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );\n  \n          if ( all( equal( axis, vec3( 0.0 ) ) ) ) {\n  \n            axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );\n  \n          }\n  \n          axis = normalize( axis );\n  \n          gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n          gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );\n  \n          for ( int i = 1; i < n; i++ ) {\n  \n            if ( i >= samples ) {\n  \n              break;\n  \n            }\n  \n            float theta = dTheta * float( i );\n            gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );\n            gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );\n  \n          }\n        }\n      ",blending:Dt,depthTest:!1,depthWrite:!1,side:Ft})}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()}}
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const jc=[1,.79,.62,.5,.4,.31,.25],zc="high-performance";class Kc extends tt{static get singleton(){return this._singleton||(this._singleton=new Kc({powerPreference:(self.ModelViewerElement||{}).powerPreference||zc,debug:ys()})),this._singleton}static resetSingleton(){const e=this._singleton.dispose();for(const t of e)t.disconnectedCallback();this._singleton=new Kc({powerPreference:(self.ModelViewerElement||{}).powerPreference||zc,debug:ys()});for(const t of e)t.connectedCallback()}get canRender(){return null!=this.threeRenderer}get scaleFactor(){return jc[this.scaleStep]}set minScale(e){let t=1;for(;t<jc.length&&!(jc[t]<e);)++t;this.lastStep=t-1}constructor(t){super(),this.loader=new cr(Cc),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=this.canRender?new Hc(this.threeRenderer):null;for(const e of this.scenes)e.element[vs]()},this.dpr=window.devicePixelRatio,this.canvas3D=document.createElement("canvas"),this.canvas3D.id="webgl-canvas",this.canvas3D.classList.add("show");try{this.threeRenderer=new lt({canvas:this.canvas3D,alpha:!0,antialias:!0,powerPreference:t.powerPreference,preserveDrawingBuffer:!0}),this.threeRenderer.autoClear=!0,this.threeRenderer.setPixelRatio(1),this.threeRenderer.debug={checkShaderErrors:!!t.debug,onShaderError:null},this.threeRenderer.toneMapping=e}catch(e){console.warn(e)}this.arRenderer=this.canRender?new ac(this):null,this.textureUtils=this.canRender?new Hc(this.threeRenderer):null,this.canRender&&cr.initializeKTX2Loader(this.threeRenderer),this.canvas3D.addEventListener("webglcontextlost",this.onWebGLContextLost),this.canvas3D.addEventListener("webglcontextrestored",this.onWebGLContextRestored),this.updateRendererSize()}registerScene(e){if(this.scenes.add(e),e.forceRescale(),this.canRender){const t=new y;this.threeRenderer.getSize(t),e.canvas.width=t.x,e.canvas.height=t.y,this.scenes.size>0&&this.threeRenderer.setAnimationLoop((e,t)=>this.render(e,t))}}unregisterScene(e){this.scenes.delete(e),this.canvas3D.parentElement===e.canvas.parentElement&&e.canvas.parentElement.removeChild(this.canvas3D),this.canRender&&0===this.scenes.size&&this.threeRenderer.setAnimationLoop(null)}displayCanvas(e){return e.element.modelIsVisible&&!this.multipleScenesVisible?this.canvas3D:e.element[Og]}countVisibleScenes(){const{canvas3D:e}=this;let t=0,i=null;for(const s of this.scenes){const{element:a}=s;a.modelIsVisible&&null==s.externalRenderer&&++t,e.parentElement===s.canvas.parentElement&&(i=s)}const s=t>1;if(null!=i){const t=s&&!this.multipleScenesVisible,a=!i.element.modelIsVisible;if(t||a){const{width:t,height:s}=this.sceneSize(i);this.copyPixels(i,t,s),e.parentElement.removeChild(e)}}this.multipleScenesVisible=s}updateRendererSize(){var e;const t=window.devicePixelRatio;if(t!==this.dpr)for(const e of this.scenes){const{element:t}=e;t[Qg](t.getBoundingClientRect())}let i=0,s=0;for(const e of this.scenes)i=Math.max(i,e.width),s=Math.max(s,e.height);if(i!==this.width||s!==this.height||t!==this.dpr){this.width=i,this.height=s,this.dpr=t,i=Math.ceil(i*t),s=Math.ceil(s*t),this.canRender&&this.threeRenderer.setSize(i,s,!1);for(const t of this.scenes){const{canvas:a}=t;a.width=i,a.height=s,t.forceRescale(),null===(e=t.effectRenderer)||void 0===e||e.setSize(i,s)}}}updateRendererScale(e){const t=this.scaleStep;this.avgFrameDuration+=Cs(.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=jc[e.scaleStep],i=Math.ceil(this.width/t),s=Math.ceil(this.height/t),{style:a}=e.canvas;a.width=`${i}px`,a.height=`${s}px`,this.canvas3D.style.width=`${i}px`,this.canvas3D.style.height=`${s}px`;const n=this.dpr*t,r=t<1?"GPU throttling":this.dpr!==window.devicePixelRatio?"No meta viewport tag":"";e.element.dispatchEvent(new CustomEvent("render-scale",{detail:{reportedDpr:window.devicePixelRatio,renderedDpr:n,minimumDpr:this.dpr*jc[this.lastStep],pixelWidth:Math.ceil(e.width*n),pixelHeight:Math.ceil(e.height*n),reason:r}}))}sceneSize(e){const{dpr:t}=this,i=jc[e.scaleStep];return{width:Math.min(Math.ceil(e.width*i*t),this.canvas3D.width),height:Math.min(Math.ceil(e.height*i*t),this.canvas3D.height)}}copyPixels(e,t,i){const s=e.context;null!=s?(s.clearRect(0,0,t,i),s.drawImage(this.canvas3D,0,0,t,i,0,0,t,i),e.canvas.classList.add("show")):console.log("could not acquire 2d context")}orderedScenes(){const e=[];for(const t of[!1,!0])for(const i of this.scenes)i.element.modelIsVisible===t&&e.push(i);return e}get isPresenting(){var e;return!0===(null===(e=this.arRenderer)||void 0===e?void 0:e.isPresenting)}preRender(t,i,s){const{element:a,exposure:n,toneMapping:r}=t;a[jg](i,s);const o="number"==typeof n&&!Number.isNaN(n),A=a.environmentImage,l=a.skyboxImage,c=r===e&&("neutral"===A||"legacy"===A||!A&&!l);this.threeRenderer.toneMappingExposure=(o?n:1)*(c?1.3:1)}render(e,t){if(null!=t)return void(null!=this.arRenderer&&this.arRenderer.onWebXRFrame(e,t));const i=e-this.lastTick;if(this.lastTick=e,!this.canRender||this.isPresenting)return;this.countVisibleScenes(),this.updateRendererSize(),this.renderedLastFrame&&(this.updateRendererScale(i),this.renderedLastFrame=!1);const{canvas3D:s}=this;for(const t of this.orderedScenes()){const{element:a}=t;if(!a.loaded||!a.modelIsVisible&&t.renderCount>0)continue;if(this.preRender(t,e,i),!this.shouldRender(t))continue;if(null!=t.externalRenderer){const e=t.getCamera();e.updateMatrix();const{matrix:i,projectionMatrix:s}=e,a=i.elements.slice(),n=t.getTarget();a[12]+=n.x,a[13]+=n.y,a[14]+=n.z,t.externalRenderer.render({viewMatrix:a,projectionMatrix:s.elements});continue}if(!a.modelIsVisible&&!this.multipleScenesVisible)for(const e of this.scenes)e.element.modelIsVisible&&e.queueRender();const{width:n,height:r}=this.sceneSize(t);t.renderShadow(this.threeRenderer),this.threeRenderer.setRenderTarget(null),this.threeRenderer.setViewport(0,Math.ceil(this.height*this.dpr)-r,n,r),null!=t.effectRenderer?t.effectRenderer.render(i):(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,n,r):s.parentElement!==t.canvas.parentElement&&(t.canvas.parentElement.appendChild(s),t.canvas.classList.remove("show")),t.hasRendered(),++t.renderCount,this.renderedLastFrame=!0}}dispose(){null!=this.textureUtils&&this.textureUtils.dispose(),null!=this.threeRenderer&&this.threeRenderer.dispose(),this.textureUtils=null,this.threeRenderer=null;const e=[];for(const t of this.scenes)e.push(t.element);return this.canvas3D.removeEventListener("webglcontextlost",this.onWebGLContextLost),this.canvas3D.removeEventListener("webglcontextrestored",this.onWebGLContextRestored),e}}
/* @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Vc=Symbol("correlatedObjects"),Jc=Symbol("onUpdate");class Yc{constructor(e,t){this[Jc]=e,this[Vc]=t}}
/* @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Wc=new J,Xc=new rt(2,2);let $c=0;const Zc=Symbol("threeTexture"),eh=Symbol("threeTextures");let th=class extends Yc{get[Zc](){var e;return null===(e=this[Vc])||void 0===e?void 0:e.values().next().value}get[eh](){return this[Vc]}constructor(e,t){super(e,new Set(t?[t]:[]));const i=this[Zc].image;i.src||(i.src=t.name?t.name:"adhoc_image"+$c++),i.name||(i.name=t&&i&&i.src?i.src.split("/").pop():"adhoc_image")}get name(){return this[Zc].image.name||""}get uri(){return this[Zc].image.src}get bufferView(){return this[Zc].image.bufferView}get element(){const e=this[Zc];if(e&&(e.isCanvasTexture||e.isVideoTexture))return e.image}get animation(){const e=this[Zc];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[eh])t.image.name=e}update(){const e=this[Zc];e&&e.isCanvasTexture&&!e.animation&&(this[Zc].needsUpdate=!0,this[Jc]())}async createThumbnail(e,t){const i=new nt;Wc.map=this[Zc];const s=new X(Xc,Wc);i.add(s);const a=new ne(-1,1,1,-1,0,1),{threeRenderer:n}=Kc.singleton,r=new yt(e,t);n.setRenderTarget(r),n.render(i,a),n.setRenderTarget(null);const o=new Uint8Array(e*t*4);n.readRenderTargetPixels(r,0,0,e,t,o),mg.width=e,mg.height=t;const A=mg.getContext("2d"),l=A.createImageData(e,t);return l.data.set(o),A.putImageData(l,0,0),new Promise(async(e,t)=>{mg.toBlob(i=>{if(!i)return t("Failed to capture thumbnail.");e(URL.createObjectURL(i))},"image/png")})}};var ih,sh;!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"}(ih||(ih={})),function(e){e[e.ClampToEdge=33071]="ClampToEdge",e[e.MirroredRepeat=33648]="MirroredRepeat",e[e.Repeat=10497]="Repeat"}(sh||(sh={}));
/* @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const ah=new Map([[sh.Repeat,N],[sh.ClampToEdge,q],[sh.MirroredRepeat,O]]),nh=new Map([[N,sh.Repeat],[q,sh.ClampToEdge],[O,sh.MirroredRepeat]]),rh=new Map([[ih.Nearest,G],[ih.Linear,U],[ih.NearestMipmapNearest,_],[ih.LinearMipmapNearest,P],[ih.NearestMipmapLinear,L],[ih.LinearMipmapLinear,k]]),oh=new Map([[G,ih.Nearest],[U,ih.Linear],[_,ih.NearestMipmapNearest],[P,ih.LinearMipmapNearest],[L,ih.NearestMipmapLinear],[k,ih.LinearMipmapLinear]]),Ah=new Map([[ih.Nearest,G],[ih.Linear,U]]),lh=new Map([[G,ih.Nearest],[U,ih.Linear]]),ch=e=>oh.has(e),hh=e=>lh.has(e),dh=e=>nh.has(e),gh=Symbol("threeTexture"),uh=Symbol("threeTextures"),ph=Symbol("setProperty");class mh extends Yc{get[gh](){var e;return null===(e=this[Vc])||void 0===e?void 0:e.values().next().value}get[uh](){return this[Vc]}constructor(e,t){super(e,new Set(t?[t]:[]))}get name(){return this[gh].name||""}get minFilter(){return oh.get(this[gh].minFilter)}get magFilter(){return lh.get(this[gh].magFilter)}get wrapS(){return nh.get(this[gh].wrapS)}get wrapT(){return nh.get(this[gh].wrapT)}get rotation(){return this[gh].rotation}get scale(){return Zg(this[gh].repeat)}get offset(){return Zg(this[gh].offset)}setMinFilter(e){this[ph]("minFilter",rh.get(e))}setMagFilter(e){this[ph]("magFilter",Ah.get(e))}setWrapS(e){this[ph]("wrapS",ah.get(e))}setWrapT(e){this[ph]("wrapT",ah.get(e))}setRotation(e){null==e&&(e=0),this[ph]("rotation",e)}setScale(e){null==e&&(e={u:1,v:1}),this[ph]("repeat",new y(e.u,e.v))}setOffset(e){null==e&&(e={u:0,v:0}),this[ph]("offset",new y(e.u,e.v))}[ph](e,t){if(((e,t)=>{switch(e){case"minFilter":return ch(t);case"magFilter":return hh(t);case"wrapS":case"wrapT":return dh(t);case"rotation":case"repeat":case"offset":return!0;default:throw new Error(`Cannot configure property "${e}" on Sampler`)}})(e,t))for(const i of this[uh])i[e]=t,i.needsUpdate=!0;this[Jc]()}}
/* @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const bh=Symbol("image"),fh=Symbol("sampler"),Ih=Symbol("threeTexture");class Eh extends Yc{get[Ih](){var e;return null===(e=this[Vc])||void 0===e?void 0:e.values().next().value}constructor(e,t){super(e,new Set(t?[t]:[])),this[fh]=new mh(e,t),this[bh]=new th(e,t)}get name(){return this[Ih].name||""}set name(e){for(const t of this[Vc])t.name=e}get sampler(){return this[fh]}get source(){return this[bh]}}
/* @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */var Ch,yh,wh;const Bh=Symbol("texture"),xh=Symbol("transform"),vh=Symbol("materials"),Sh=Symbol("usage"),Qh=Symbol("onUpdate"),Mh=Symbol("activeVideo");var Dh;!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"}(Dh||(Dh={}));class Rh{constructor(e,t,i,s){this[Ch]=null,this[yh]={rotation:0,scale:new y(1,1),offset:new y(0,0)},this[wh]=!1,i&&(this[xh].rotation=i.rotation,this[xh].scale.copy(i.repeat),this[xh].offset.copy(i.offset),this[Bh]=new Eh(e,i)),this[Qh]=e,this[vh]=s,this[Sh]=t}get texture(){return this[Bh]}setTexture(e){var t,i;const s=null!=e?e.source[Zc]:null,a=null===(t=this[Bh])||void 0===t?void 0:t.source[Zc];if(null!=a&&a.isVideoTexture?this[Mh]=!1:(null===(i=this[Bh])||void 0===i?void 0:i.source.animation)&&this[Bh].source.animation.removeEventListener("enterFrame",this[Qh]),this[Bh]=e,null!=s&&s.isVideoTexture){const e=s.image;if(this[Mh]=!0,null!=e.requestVideoFrameCallback){const t=()=>{this[Mh]&&(this[Qh](),e.requestVideoFrameCallback(t))};e.requestVideoFrameCallback(t)}else{const e=()=>{this[Mh]&&(this[Qh](),requestAnimationFrame(e))};requestAnimationFrame(e)}}else null!=(null==e?void 0:e.source.animation)&&e.source.animation.addEventListener("enterFrame",this[Qh]);let n=l;if(this[vh])for(const e of this[vh]){switch(this[Sh]){case Dh.Base:e.map=s;break;case Dh.MetallicRoughness:n=c,e.metalnessMap=s,e.roughnessMap=s;break;case Dh.Normal:n=c,e.normalMap=s;break;case Dh.Occlusion:n=c,e.aoMap=s;break;case Dh.Emissive:e.emissiveMap=s;break;case Dh.Clearcoat:e.clearcoatMap=s;break;case Dh.ClearcoatRoughness:e.clearcoatRoughnessMap=s;break;case Dh.ClearcoatNormal:e.clearcoatNormalMap=s;break;case Dh.SheenColor:e.sheenColorMap=s;break;case Dh.SheenRoughness:e.sheenRoughnessMap=s;break;case Dh.Transmission:e.transmissionMap=s;break;case Dh.Thickness:e.thicknessMap=s;break;case Dh.Specular:e.specularIntensityMap=s;break;case Dh.SpecularColor:e.specularColorMap=s;break;case Dh.Iridescence:e.iridescenceMap=s;break;case Dh.IridescenceThickness:e.iridescenceThicknessMap=s;break;case Dh.Anisotropy:e.anisotropyMap=s}e.needsUpdate=!0}s&&(s.colorSpace=n,s.rotation=this[xh].rotation,s.repeat=this[xh].scale,s.offset=this[xh].offset),this[Qh]()}}Ch=Bh,yh=xh,wh=Mh;
/* @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
const Th=Symbol("threeMaterial"),Fh=Symbol("threeMaterials"),kh=Symbol("baseColorTexture"),Lh=Symbol("metallicRoughnessTexture");class Ph extends Yc{get[Fh](){return this[Vc]}get[Th](){var e;return null===(e=this[Vc])||void 0===e?void 0:e.values().next().value}constructor(e,t){super(e,t);const{map:i,metalnessMap:s}=t.values().next().value;this[kh]=new Rh(e,Dh.Base,i,t),this[Lh]=new Rh(e,Dh.MetallicRoughness,s,t)}get baseColorFactor(){const e=[0,0,0,this[Th].opacity];return this[Th].color.toArray(e),e}get metallicFactor(){return this[Th].metalness}get roughnessFactor(){return this[Th].roughness}get baseColorTexture(){return this[kh]}get metallicRoughnessTexture(){return this[Lh]}setBaseColorFactor(e){const t=new p;e instanceof Array?t.fromArray(e):t.set(e);for(const i of this[Fh])i.color.set(t),e instanceof Array&&e.length>3?i.opacity=e[3]:(e=[0,0,0,i.opacity],t.toArray(e));this[Jc]()}setMetallicFactor(e){for(const t of this[Fh])t.metalness=e;this[Jc]()}setRoughnessFactor(e){for(const t of this[Fh])t.roughness=e;this[Jc]()}}
/* @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */var _h,Uh;const Gh=Symbol("pbrMetallicRoughness"),Nh=Symbol("normalTexture"),Oh=Symbol("occlusionTexture"),qh=Symbol("emissiveTexture"),Hh=Symbol("backingThreeMaterial"),jh=Symbol("applyAlphaCutoff"),zh=Symbol("getAlphaMode"),Kh=Symbol("lazyLoadGLTFInfo"),Vh=Symbol("initialize"),Jh=Symbol("getLoadedMaterial"),Yh=Symbol("ensureMaterialIsLoaded"),Wh=Symbol("gltfIndex"),Xh=Symbol("setActive"),$h=Symbol("variantIndices"),Zh=Symbol("isActive"),ed=Symbol("modelVariants"),td=Symbol("name"),id=Symbol("pbrTextures");class sd extends Yc{get[(_h=$h,Uh=id,Hh)](){return this[Vc].values().next().value}constructor(e,t,i,s,a,n,r=void 0){super(e,a),this[_h]=new Set,this[Uh]=new Map,this[Wh]=t,this[Zh]=i,this[ed]=s,this[td]=n,null==r?this[Vh]():this[Kh]=r}[Vh](){const e=this[Jc],t=this[Vc];this[Gh]=new Ph(e,t);const{normalMap:i,aoMap:s,emissiveMap:a}=t.values().next().value;this[Nh]=new Rh(e,Dh.Normal,i,t),this[Oh]=new Rh(e,Dh.Occlusion,s,t),this[qh]=new Rh(e,Dh.Emissive,a,t);const n=i=>{this[id].set(i,new Rh(e,i,null,t))};n(Dh.Clearcoat),n(Dh.ClearcoatRoughness),n(Dh.ClearcoatNormal),n(Dh.SheenColor),n(Dh.SheenRoughness),n(Dh.Transmission),n(Dh.Thickness),n(Dh.Specular),n(Dh.SpecularColor),n(Dh.Iridescence),n(Dh.IridescenceThickness),n(Dh.Anisotropy)}async[Jh](){if(null!=this[Kh]){const e=await this[Kh].doLazyLoad();return this[Vh](),this[Kh]=void 0,this.ensureLoaded=async()=>{},e}return null}colorFromRgb(e){const t=new p;return e instanceof Array?t.fromArray(e):t.set(e),t}[Yh](){if(null!=this[Kh])throw new Error(`Material "${this.name}" has not been loaded, call 'await\n    myMaterial.ensureLoaded()' before using an unloaded material.`)}async ensureLoaded(){await this[Jh]()}get isLoaded(){return null==this[Kh]}get isActive(){return this[Zh]}[Xh](e){this[Zh]=e}get name(){return this[td]||""}set name(e){if(this[td]=e,null!=this[Vc])for(const t of this[Vc])t.name=e}get pbrMetallicRoughness(){return this[Yh](),this[Gh]}get normalTexture(){return this[Yh](),this[Nh]}get occlusionTexture(){return this[Yh](),this[Oh]}get emissiveTexture(){return this[Yh](),this[qh]}get emissiveFactor(){return this[Yh](),this[Hh].emissive.toArray()}get index(){return this[Wh]}hasVariant(e){const t=this[ed].get(e);return null!=t&&this[$h].has(t.index)}setEmissiveFactor(e){this[Yh]();const t=this.colorFromRgb(e);for(const e of this[Vc])e.emissive.set(t);this[Jc]()}[zh](){return this[Hh].transparent?"BLEND":this[Hh].alphaTest>0?"MASK":"OPAQUE"}[jh](){this[Yh]();for(const e of this[Vc])"MASK"===this[zh]()?null==e.alphaTest&&(e.alphaTest=.5):e.alphaTest=void 0,e.needsUpdate=!0}setAlphaCutoff(e){this[Yh]();for(const t of this[Vc])t.alphaTest=e,t.needsUpdate=!0;this[jh](),this[Jc]()}getAlphaCutoff(){return this[Yh](),this[Hh].alphaTest}setDoubleSided(e){this[Yh]();for(const t of this[Vc])t.side=e?V:pe,t.needsUpdate=!0;this[Jc]()}getDoubleSided(){return this[Yh](),this[Hh].side==V}setAlphaMode(e){this[Yh]();const t=(e,t)=>{e.transparent=t,e.depthWrite=!t};for(const i of this[Vc])t(i,"BLEND"===e),i.alphaTest="MASK"===e?.5:void 0,i.needsUpdate=!0;this[Jc]()}getAlphaMode(){return this[Yh](),this[zh]()}get emissiveStrength(){return this[Yh](),this[Hh].emissiveIntensity}setEmissiveStrength(e){this[Yh]();for(const t of this[Vc])t.emissiveIntensity=e;this[Jc]()}get clearcoatFactor(){return this[Yh](),this[Hh].clearcoat}get clearcoatRoughnessFactor(){return this[Yh](),this[Hh].clearcoatRoughness}get clearcoatTexture(){return this[Yh](),this[id].get(Dh.Clearcoat)}get clearcoatRoughnessTexture(){return this[Yh](),this[id].get(Dh.ClearcoatRoughness)}get clearcoatNormalTexture(){return this[Yh](),this[id].get(Dh.ClearcoatNormal)}get clearcoatNormalScale(){return this[Yh](),this[Hh].clearcoatNormalScale.x}setClearcoatFactor(e){this[Yh]();for(const t of this[Vc])t.clearcoat=e;this[Jc]()}setClearcoatRoughnessFactor(e){this[Yh]();for(const t of this[Vc])t.clearcoatRoughness=e;this[Jc]()}setClearcoatNormalScale(e){this[Yh]();for(const t of this[Vc])t.clearcoatNormalScale=new y(e,e);this[Jc]()}get ior(){return this[Yh](),this[Hh].ior}setIor(e){this[Yh]();for(const t of this[Vc])t.ior=e;this[Jc]()}get sheenColorFactor(){return this[Yh](),this[Hh].sheenColor.toArray()}get sheenColorTexture(){return this[Yh](),this[id].get(Dh.SheenColor)}get sheenRoughnessFactor(){return this[Yh](),this[Hh].sheenRoughness}get sheenRoughnessTexture(){return this[Yh](),this[id].get(Dh.SheenRoughness)}setSheenColorFactor(e){this[Yh]();const t=this.colorFromRgb(e);for(const e of this[Vc])e.sheenColor.set(t),e.sheen=1;this[Jc]()}setSheenRoughnessFactor(e){this[Yh]();for(const t of this[Vc])t.sheenRoughness=e,t.sheen=1;this[Jc]()}get transmissionFactor(){return this[Yh](),this[Hh].transmission}get transmissionTexture(){return this[Yh](),this[id].get(Dh.Transmission)}setTransmissionFactor(e){this[Yh]();for(const t of this[Vc])t.transmission=e;this[Jc]()}get thicknessFactor(){return this[Yh](),this[Hh].thickness}get thicknessTexture(){return this[Yh](),this[id].get(Dh.Thickness)}get attenuationDistance(){return this[Yh](),this[Hh].attenuationDistance}get attenuationColor(){return this[Yh](),this[Hh].attenuationColor.toArray()}setThicknessFactor(e){this[Yh]();for(const t of this[Vc])t.thickness=e;this[Jc]()}setAttenuationDistance(e){this[Yh]();for(const t of this[Vc])t.attenuationDistance=e;this[Jc]()}setAttenuationColor(e){this[Yh]();const t=this.colorFromRgb(e);for(const e of this[Vc])e.attenuationColor.set(t);this[Jc]()}get specularFactor(){return this[Yh](),this[Hh].specularIntensity}get specularTexture(){return this[Yh](),this[id].get(Dh.Specular)}get specularColorFactor(){return this[Yh](),this[Hh].specularColor.toArray()}get specularColorTexture(){return this[Yh](),this[id].get(Dh.SheenColor)}setSpecularFactor(e){this[Yh]();for(const t of this[Vc])t.specularIntensity=e;this[Jc]()}setSpecularColorFactor(e){this[Yh]();const t=this.colorFromRgb(e);for(const e of this[Vc])e.specularColor.set(t);this[Jc]()}get iridescenceFactor(){return this[Yh](),this[Hh].iridescence}get iridescenceTexture(){return this[Yh](),this[id].get(Dh.Iridescence)}get iridescenceIor(){return this[Yh](),this[Hh].iridescenceIOR}get iridescenceThicknessMinimum(){return this[Yh](),this[Hh].iridescenceThicknessRange[0]}get iridescenceThicknessMaximum(){return this[Yh](),this[Hh].iridescenceThicknessRange[1]}get iridescenceThicknessTexture(){return this[Yh](),this[id].get(Dh.IridescenceThickness)}setIridescenceFactor(e){this[Yh]();for(const t of this[Vc])t.iridescence=e;this[Jc]()}setIridescenceIor(e){this[Yh]();for(const t of this[Vc])t.iridescenceIOR=e;this[Jc]()}setIridescenceThicknessMinimum(e){this[Yh]();for(const t of this[Vc])t.iridescenceThicknessRange[0]=e;this[Jc]()}setIridescenceThicknessMaximum(e){this[Yh]();for(const t of this[Vc])t.iridescenceThicknessRange[1]=e;this[Jc]()}get anisotropyStrength(){return this[Yh](),this[Hh].anisotropy}get anisotropyRotation(){return this[Yh](),this[Hh].anisotropyRotation}get anisotropyTexture(){return this[Yh](),this[id].get(Dh.Anisotropy)}setAnisotropyStrength(e){this[Yh]();for(const t of this[Vc])t.anisotropy=e;this[Jc]()}setAnisotropyRotation(e){this[Yh]();for(const t of this[Vc])t.anisotropyRotation=e;this[Jc]()}}let ad=class{constructor(e){this.name="",this.children=new Array,this.name=e}};class nd extends ad{constructor(e,t,i,s){super(e.name),this.materials=new Map,this.variantToMaterialMap=new Map,this.initialMaterialIdx=0,this.activeMaterialIdx=0,this.mesh=e;const{gltf:a,threeGLTF:n,threeObjectMap:r}=s;this.parser=n.parser,this.modelVariants=i,this.mesh.userData.variantData=i;const o=r.get(e.material);null!=o.materials?this.initialMaterialIdx=this.activeMaterialIdx=o.materials:console.error(`Primitive (${e.name}) missing initial material reference.`);const A=e.userData.associations||{};if(null==A.meshes)return void console.error("Mesh is missing primitive index association");const l=((a.meshes||[])[A.meshes].primitives||[])[A.primitives];if(null!=l){if(null!=l.material)this.materials.set(l.material,t[l.material]);else{const e=t.findIndex(e=>"Default"===e.name);e>=0?this.materials.set(e,t[e]):console.warn("gltfPrimitive has no material!")}if(l.extensions&&l.extensions.KHR_materials_variants){const e=l.extensions.KHR_materials_variants,s=n.parser.json.extensions.KHR_materials_variants.variants;for(const a of e.mappings){const e=t[a.material];this.materials.set(a.material,e);for(const t of a.variants){const{name:a}=s[t];this.variantToMaterialMap.set(t,e),e[$h].add(t),i.has(a)||i.set(a,{name:a,index:t})}}}}else console.error("Mesh primitive definition is missing.")}async setActiveMaterial(e){const t=this.materials.get(e);if(e!==this.activeMaterialIdx){const i=t[Vc],s=await t[Jh]();this.mesh.material=null!=s?s:i.values().next().value,this.parser.assignFinalMaterial(this.mesh),i.add(this.mesh.material),this.activeMaterialIdx=e}return this.mesh.material}getActiveMaterial(){return this.materials.get(this.activeMaterialIdx)}getMaterial(e){return this.materials.get(e)}async enableVariant(e){if(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 i=await this.enableVariantHelper(e);null!=i&&(t.material=i)}}get variantInfo(){return this.variantToMaterialMap}addVariant(e,t){if(!this.ensureVariantIsUnused(t))return!1;this.modelVariants.has(t)||this.modelVariants.set(t,{name:t,index:this.modelVariants.size});const i=this.modelVariants.get(t).index;return e[$h].add(i),this.variantToMaterialMap.set(i,e),this.materials.set(e.index,e),this.updateVariantUserData(i,e),!0}deleteVariant(e){if(this.variantInfo.has(e)){this.variantInfo.delete(e);const t=this.mesh.userData.variantMaterials;null!=t&&t.delete(e)}}updateVariantUserData(e,t){t[$h].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[Vc].values().next().value,gltfMaterialIndex:t.index})}ensureVariantIsUnused(e){const t=this.modelVariants.get(e);return null==t||!this.variantInfo.has(t.index)||(console.warn(`Primitive cannot add variant '${e}' for this material, it already exists.`),!1)}}
/* @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */var rd,od,Ad,ld,cd,hd;const dd=Symbol("materials"),gd=Symbol("hierarchy"),ud=Symbol("roots"),pd=Symbol("primitives"),md=Symbol("prepareVariantsForExport"),bd=Symbol("switchVariant"),fd=Symbol("materialFromPoint"),Id=Symbol("nodeFromPoint"),Ed=Symbol("nodeFromIndex"),Cd=Symbol("variantData"),yd=Symbol("availableVariants"),wd=Symbol("modelOnUpdate"),Bd=Symbol("cloneMaterial");class xd{constructor(e,t,i,s){this.gltf=e,this.gltfElementMap=t,this.mapKey=i,this.doLazyLoad=s}}class vd{constructor(e,t=()=>{}){this[rd]=new Array,this[od]=new Array,this[Ad]=new Array,this[ld]=new Array,this[cd]=()=>{},this[hd]=new Map,this[wd]=t;const{gltf:i,threeGLTF:s,gltfElementMap:a}=e;for(const[e,n]of i.materials.entries()){const r=a.get(n);if(null!=r)this[dd].push(new sd(t,e,!0,this[Cd],r,n.name));else{const r=(i.materials||[])[e],o=new Set;a.set(r,o);const A=async()=>{const t=await s.parser.getDependency("material",e);return o.add(t),t};this[dd].push(new sd(t,e,!1,this[Cd],o,n.name,new xd(i,a,r,A)))}}const n=new Map,r=new Array;for(const e of s.scene.children)r.push(e);for(;r.length>0;){const t=r.pop();let i=null;t instanceof X?(i=new nd(t,this.materials,this[Cd],e),this[pd].push(i)):i=new ad(t.name);const s=n.get(t);null!=s?s.children.push(i):this[ud].push(i),this[gd].push(i);for(const e of t.children)r.push(e),n.set(t,i)}}get materials(){return this[dd]}[(rd=dd,od=gd,Ad=ud,ld=pd,cd=wd,hd=Cd,yd)](){const e=Array.from(this[Cd].values());return e.sort((e,t)=>e.index-t.index),e.map(e=>e.name)}getMaterialByName(e){const t=this[dd].filter(t=>t.name===e);return t.length>0?t[0]:null}[Ed](e,t){const i=this[gd].find(i=>{if(i instanceof nd){const{meshes:s,primitives:a}=i.mesh.userData.associations;if(s==e&&a==t)return!0}return!1});return null==i?null:i}[Id](e){const t=this[gd].find(t=>{if(t instanceof nd){if(t.mesh===e.object)return!0}return!1});return t||null}[fd](e){const t=this[Id](e);return t?t.getActiveMaterial():null}async[bd](e){for(const t of this[pd])await t.enableVariant(e);for(const e of this.materials)e[Xh](!1);for(const e of this[pd])this.materials[e.getActiveMaterial().index][Xh](!0)}async[md](){const e=new Array;for(const t of this[pd])e.push(t.instantiateVariants());await Promise.all(e)}[Bd](e,t){const i=this.materials[e];i.isLoaded||console.error("Cloning an unloaded material,\n           call 'material.ensureLoaded() before cloning the material.");const s=i[Vc],a=new Set;for(const[e,i]of s.entries()){const n=i.clone();n.name=t+(s.size>1?"_inst"+e:""),a.add(n)}const n=new sd(this[wd],this[dd].length,!1,this[Cd],a,t);return this[dd].push(n),n}createMaterialInstanceForVariant(e,t,i,s=!0){let a=null;for(const s of this[pd]){const n=this[Cd].get(i);null!=n&&s.variantInfo.has(n.index)||null!=s.getMaterial(e)&&(this.hasVariant(i)||this.createVariant(i),null==a&&(a=this[Bd](e,t)),s.addVariant(a,i))}if(s&&null!=a){a[Xh](!0),this.materials[e][Xh](!1);for(const e of this[pd])e.enableVariant(i)}return a}createVariant(e){this[Cd].has(e)?console.warn(`Variant '${e}'' already exists`):this[Cd].set(e,{name:e,index:this[Cd].size})}hasVariant(e){return this[Cd].has(e)}setMaterialToVariant(e,t){if(null!=this[yd]().find(e=>e===t))if(e<0||e>=this.materials.length)console.error("setMaterialToVariant(): materialIndex is out of bounds.");else for(const i of this[pd]){const s=i.getMaterial(e);null!=s&&i.addVariant(s,t)}else console.warn(`Can't add material to '${t}', the variant does not exist.'`)}updateVariantName(e,t){const i=this[Cd].get(e);null!=i&&(i.name=t,this[Cd].set(t,i),this[Cd].delete(e))}deleteVariant(e){const t=this[Cd].get(e);if(null!=t){for(const i of this.materials)i.hasVariant(e)&&i[$h].delete(t.index);for(const e of this[pd])e.deleteVariant(t.index);this[Cd].delete(e)}}}
/* @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */var Sd=function(e,t,i,s){for(var a,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s,o=e.length-1;o>=0;o--)(a=e[o])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};const Qd=Symbol("currentGLTF"),Md=Symbol("originalGltfJson"),Dd=Symbol("model"),Rd=Symbol("extraModels"),Td=Symbol("getOnUpdateMethod"),Fd=Symbol("buildTexture");
/* @license
 * Copyright 2023 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
class kd extends X{constructor(){super(void 0,new J({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,i=128){e==this.height&&t==this.radius&&i==this.resolution||(this.height=e,this.radius=t,this.resolution=i,e>0&&t>0&&(this.geometry.dispose(),this.geometry=function(e,t,i){const s=new _t(t,2*i,i);s.scale(1,1,-1);const a=s.getAttribute("position"),n=new S;for(let t=0;t<a.count;++t)if(n.fromBufferAttribute(a,t),n.y<0){const i=3*-e/2,s=n.y<i?-e/n.y:1-n.y*n.y/(3*i*i);n.multiplyScalar(s),n.toArray(a.array,3*t)}return a.needsUpdate=!0,s}
/* @license
 * Copyright 2020 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */(e,t,i)))}}const Ld=new S,Pd=new S,_d=new S,Ud=new ft,Gd=new Ut,Nd=new Q;class Od extends hr{constructor(e){super(document.createElement("div")),this.normal=new S(0,1,0),this.initialized=!1,this.referenceCount=1,this.pivotEl=document.createElement("div"),this.slot=document.createElement("slot"),this.element.classList.add("annotation-wrapper"),this.slot.name=e.name,this.element.appendChild(this.pivotEl),this.pivotEl.appendChild(this.slot),this.updatePosition(e.position),this.updateNormal(e.normal),this.surface=e.surface,null!=e.modelIndex&&(this.modelIndex=e.modelIndex)}get facingCamera(){return!this.element.classList.contains("hide")}show(){this.facingCamera&&this.initialized||this.updateVisibility(!0)}hide(){!this.facingCamera&&this.initialized||this.updateVisibility(!1)}increment(){this.referenceCount++}decrement(){return this.referenceCount>0&&--this.referenceCount,0===this.referenceCount}updatePosition(e){if(null==e)return;const t=Mo(e)[0].terms;for(let e=0;e<3;++e)this.position.setComponent(e,No(t[e]).number);this.updateMatrixWorld()}updateNormal(e){if(null==e)return;const t=Mo(e)[0].terms;for(let e=0;e<3;++e)this.normal.setComponent(e,t[e].number)}updateSurface(){const{mesh:e,tri:t,bary:i}=this;if(null==e||null==t||null==i)return;e.getVertexPosition(t.x,Ld),e.getVertexPosition(t.y,Pd),e.getVertexPosition(t.z,_d),Ld.toArray(Ud.elements,0),Pd.toArray(Ud.elements,3),_d.toArray(Ud.elements,6),this.position.copy(i).applyMatrix3(Ud);const s=this.parent;s.worldToLocal(e.localToWorld(this.position)),Gd.set(Ld,Pd,_d),Gd.getNormal(this.normal).transformDirection(e.matrixWorld);const a=s.parent;Nd.setFromAxisAngle(Ld.set(0,1,0),-a.rotation.y),this.normal.applyQuaternion(Nd)}orient(e){this.pivotEl.style.transform=`rotate(${e}rad)`}updateVisibility(e){this.element.classList.toggle("hide",!e),this.slot.assignedNodes().forEach(t=>{if(t.nodeType!==Node.ELEMENT_NODE)return;const i=t,s=i.dataset.visibilityAttribute;if(null!=s){const t=`data-${s}`;i.toggleAttribute(t,e)}i.dispatchEvent(new CustomEvent("hotspot-visibility",{detail:{visible:e}}))}),this.initialized=!0}}const qd={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}"},Hd={name:"VerticalBlurShader",uniforms:{tDiffuse:{value:null},v:{value:1/512}},vertexShader:"\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvUv = uv;\n\t\t\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\t\t}",fragmentShader:"\n\n\t\tuniform sampler2D tDiffuse;\n\t\tuniform float v;\n\n\t\tvarying vec2 vUv;\n\n\t\tvoid main() {\n\n\t\t\tvec4 sum = vec4( 0.0 );\n\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;\n\t\t\tsum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;\n\n\t\t\tgl_FragColor = sum;\n\n\t\t}"};function jd(e,t,i){return(1-i)*e+i*t}
/* @license
 * Copyright 2022 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class zd extends R{constructor(e,t,i){super(),this.camera=new ne,this.renderTarget=null,this.renderTargetBlur=null,this.depthMaterial=new Gt,this.horizontalBlurMaterial=new ot(qd),this.verticalBlurMaterial=new ot(Hd),this.intensity=0,this.softness=1,this.boundingBox=new be,this.size=new S,this.maxDimension=0,this.isAnimated=!1,this.needsUpdate=!1;const{camera:s}=this;s.rotation.x=Math.PI/2,s.left=-.5,s.right=.5,s.bottom=-.5,s.top=.5,this.add(s);const a=new rt,n=new J({opacity:1,transparent:!0,side:Ft});this.floor=new X(a,n),this.floor.userData.noHit=!0,s.add(this.floor),this.blurPlane=new X(a),this.blurPlane.visible=!1,s.add(this.blurPlane),e.target.add(this),this.depthMaterial.onBeforeCompile=function(e){e.fragmentShader=e.fragmentShader.replace(/gl_FragColor\s*=\s*vec4\(\s*vec3\(\s*1\.0\s*-\s*fragCoordZ\s*\),\s*opacity\s*\);/,"gl_FragColor = vec4( vec3( 0.0 ), ( 1.0 - fragCoordZ ) * opacity );")},this.depthMaterial.side=V,this.horizontalBlurMaterial.depthTest=!1,this.verticalBlurMaterial.depthTest=!1,this.setScene(e,t,i)}setScene(e,t,i){const{boundingBox:s,size:a,rotation:n,position:r}=this;if(this.isAnimated=e.animationNames.length>0,this.boundingBox.copy(e.boundingBox),this.size.copy(e.size),this.maxDimension=Math.max(a.x,a.y,a.z)*(this.isAnimated?2:1),this.boundingBox.getCenter(r),"back"===i){const{min:e,max:t}=s;[e.y,e.z]=[e.z,e.y],[t.y,t.z]=[t.z,t.y],[a.y,a.z]=[a.z,a.y],n.x=Math.PI/2,n.y=Math.PI}else n.x=0,n.y=0;if(this.isAnimated){const e=s.min.y,t=s.max.y;a.y=this.maxDimension,s.expandByVector(a.subScalar(this.maxDimension).multiplyScalar(-.5)),s.min.y=e,s.max.y=t,a.set(this.maxDimension,t-e,this.maxDimension)}"bottom"===i?r.y=s.min.y:r.z=s.min.y,this.setSoftness(t)}setSoftness(e){this.softness=e;const{size:t,camera:i}=this,s=this.isAnimated?2:1,a=s*Math.pow(2,9-3*e);this.setMapSize(a);const n=t.y/2,r=t.y*s;i.near=0,i.far=jd(r,n,e),this.depthMaterial.opacity=1/e,i.updateProjectionMatrix(),this.setIntensity(this.intensity),this.setOffset(0)}setMapSize(e){const{size:t}=this;this.isAnimated&&(e*=2);const i=Math.floor(t.x>t.z?e:e*t.x/t.z),s=Math.floor(t.x>t.z?e*t.z/t.x:e),a=10+i,n=10+s;if(null==this.renderTarget||this.renderTarget.width===a&&this.renderTarget.height===n||(this.renderTarget.dispose(),this.renderTarget=null,this.renderTargetBlur.dispose(),this.renderTargetBlur=null),null==this.renderTarget){const e={format:je};this.renderTarget=new yt(a,n,e),this.renderTargetBlur=new yt(a,n,e),this.floor.material.map=this.renderTarget.texture}const r=t.x*(1+10/i),o=t.z*(1+10/s);this.camera.left=-r/2,this.camera.right=r/2,this.camera.bottom=-o/2,this.camera.top=o/2,this.camera.scale.set(1,1,1),this.floor.scale.set(r,o,1),this.blurPlane.scale.set(r,o,1),this.needsUpdate=!0}setIntensity(e){this.intensity=e,e>0?(this.visible=!0,this.floor.visible=!0,this.floor.material.opacity=e*jd(.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,this.floor.visible=!1;const i=e.xr.enabled;e.xr.enabled=!1;const s=e.getRenderTarget();e.setRenderTarget(this.renderTarget);const a=e.getClearAlpha();e.setClearAlpha(0);const n=e.state;null!=n&&(n.buffers.color.setMask(!0),n.buffers.depth.setMask(!0)),e.clear();const r=e.autoClear;e.autoClear=!1,e.render(t,this.camera),e.autoClear=r,t.overrideMaterial=null,this.floor.visible=!0,this.blurShadow(e),e.xr.enabled=i,e.setRenderTarget(s),e.setClearAlpha(a)}blurShadow(e){const{camera:t,horizontalBlurMaterial:i,verticalBlurMaterial:s,renderTarget:a,renderTargetBlur:n,blurPlane:r}=this;r.visible=!0,r.material=i,i.uniforms.h.value=1/this.renderTarget.width,i.uniforms.tDiffuse.value=this.renderTarget.texture,e.setRenderTarget(n),e.render(r,t),r.material=s,s.uniforms.v.value=1/this.renderTarget.height,s.uniforms.tDiffuse.value=this.renderTargetBlur.texture,e.setRenderTarget(a),e.render(r,t),r.visible=!1}dispose(){null!=this.renderTarget&&this.renderTarget.dispose(),null!=this.renderTargetBlur&&this.renderTargetBlur.dispose(),this.depthMaterial.dispose(),this.horizontalBlurMaterial.dispose(),this.verticalBlurMaterial.dispose(),this.floor.material.dispose(),this.floor.geometry.dispose(),this.blurPlane.geometry.dispose(),this.removeFromParent()}}
/* @license
 * Copyright 2025 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */const Kd=new S,Vd=new S,Jd=new S,Yd=new Nt,Wd=new S,Xd=new y;class $d extends nt{constructor({canvas:t,element:i,width:s,height:a}){super(),this.annotationRenderer=new br,this.effectRenderer=null,this.schemaElement=document.createElement("script"),this.width=1,this.height=1,this.aspect=1,this.scaleStep=0,this.renderCount=0,this.externalRenderer=null,this.appendedAnimations=[],this.markedAnimations=[],this.camera=new se(45,1,.1,100),this.xrCamera=null,this.url=null,this.extraUrls=[],this.scenePivot=new R,this.target=new R,this.animationNames=[],this.boundingBox=new be,this.boundingSphere=new fe,this.size=new S,this.idealAspect=0,this.framedFoVDeg=0,this.shadow=null,this.shadowIntensity=0,this.shadowSoftness=1,this.bakedShadows=new Set,this.exposure=1,this.toneMapping=e,this.canScale=!0,this.isDirty=!1,this.goalTarget=new S,this.targetDamperX=new wo,this.targetDamperY=new wo,this.targetDamperZ=new wo,this._currentGLTFs=[],this._models=[],this.boundsAndShadowDirty=!1,this.mixers=[],this.mixerPausedStates=[],this.mixerEventSubscriptions=[],this.cancelPendingSourceChange=null,this.animationsByName=new Map,this.currentAnimationActions=[],this.groundedSkybox=new kd,this.name="ModelScene",this.element=i,this.canvas=t,this.camera=new se(45,1,.1,100),this.camera.name="MainCamera",this.add(this.scenePivot),this.scenePivot.name="Pivot",this.scenePivot.add(this.target),this.setSize(s,a),this.target.name="Target",this.mixers=[];const{domElement:n}=this.annotationRenderer,{style:r}=n;r.display="none",r.pointerEvents="none",r.position="absolute",r.top="0",this.element.shadowRoot.querySelector(".default").appendChild(n),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._models=[e],this.target.add(e),await this.setupScene()}async setSource(e,t=[],i=()=>{}){if((!e||e===this.url)&&t.join(",")===this.extraUrls.join(","))return void i(1);if(this.reset(),this.url=e,this.extraUrls=t,null!=this.externalRenderer){const e=await this.externalRenderer.load(i);return this.boundingSphere.radius=e.framedRadius,void(this.idealAspect=e.fieldOfViewAspect)}null!=this.cancelPendingSourceChange&&(this.cancelPendingSourceChange(),this.cancelPendingSourceChange=null);let s=[];try{const a=[];e&&a.push(e),t&&a.push(...t),a.length>0&&(s=await new Promise((e,t)=>{this.cancelPendingSourceChange=()=>t(),(async()=>{try{const t=await Promise.all(a.map(e=>this.element[Vg].loader.load(e,this.element,i)));e(t)}catch(e){t(e)}})()}))}catch(e){if(null==e)return;throw e}this.cancelPendingSourceChange=null,this.reset(),this.url=e,this.extraUrls=t,this._currentGLTFs=s;for(const e of s)null!=e?(this._models.push(e.scene),this.target.add(e.scene),this.mixers.push(this.createMixer(e.scene)),this.mixerPausedStates.push(!1),this.currentAnimationActions.push(null)):(this.mixers.push(this.createMixer(this.target)),this.mixerPausedStates.push(!1),this.currentAnimationActions.push(null));const a=new Map,n=[],r=[];for(const e of s)for(const t of e.animations||[])a.set(t.name,t),n.push(t.name),r.push(t);this.animations=r,this.animationsByName=a,this.animationNames=n,await this.setupScene()}async setupScene(){this.applyTransform(),this.updateBoundingBox(),await this.updateFraming(),this.updateShadow(),this.setShadowIntensity(this.shadowIntensity),this.setGroundedSkybox()}updateModelTransforms(e,t,i,s){const a=this._models[e];if(a){if(t){const e=Mo(t)[0].terms;if(e.length>=3){const t=No(e[0]).number,i=No(e[1]).number,s=No(e[2]).number;a.position.set(t,i,s)}}if(i){const e=Mo(i)[0].terms;if(e.length>=3){const t=No(e[0]).number,i=No(e[1]).number,s=No(e[2]).number;a.quaternion.setFromEuler(new It(i,s,t,"YXZ"))}}if(s){const e=s.split(" ").map(e=>e.trim()).filter(e=>e.length>0).map(Number);1!==e.length||isNaN(e[0])?3!==e.length||e.some(isNaN)||a.scale.set(e[0],e[1],e[2]):a.scale.setScalar(e[0])}a.updateMatrixWorld(!0),this.boundsAndShadowDirty=!0,this.queueRender()}}updateBoundingBoxAndShadowIfDirty(){this.boundsAndShadowDirty&&(this.boundsAndShadowDirty=!1,this.updateBoundingBox(),this.updateShadow())}reset(){this.url=null,this.extraUrls=[],this.renderCount=0,this.queueRender(),null!=this.shadow&&this.shadow.setIntensity(0),this.bakedShadows.clear();const{_models:e}=this;for(const t of e)null!=t&&t.removeFromParent();this._models=[];const t=this._currentGLTFs;for(const e of t)null!=e&&e.dispose();this._currentGLTFs=[];for(const e of this.currentAnimationActions)null!=e&&e.stop();this.currentAnimationActions=[];for(const e of this.mixers)e.stopAllAction(),e.uncacheRoot(this);this.mixers=[],this.mixerPausedStates=[]}dispose(){this.reset(),null!=this.shadow&&(this.shadow.dispose(),this.shadow=null),this.element[Qd]=null,this.element[Md]=null,this.element[Dd]=null}get currentGLTF(){return this._currentGLTFs[0]||null}get currentGLTFs(){return this._currentGLTFs}setSize(e,t){if(this.width!==e||this.height!==t){if(this.width=Math.max(e,1),this.height=Math.max(t,1),this.annotationRenderer.setSize(e,t),this.aspect=this.width/this.height,null!=this.externalRenderer){const i=window.devicePixelRatio;this.externalRenderer.resize(e*i,t*i)}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 be;e.traverse(e=>{const i=e;if(!i.material)return;if(!i.material.transparent)return;t.setFromObject(i);const s=t.getSize(Wd),a=Math.min(s.x,s.y,s.z);Math.max(s.x,s.y,s.z)<100*a||this.markBakedShadow(i)})}checkBakedShadows(){const{min:e,max:t}=this.boundingBox,i=new be;this.boundingBox.getSize(this.size);for(const s of this.bakedShadows)i.setFromObject(s),i.min.y<e.y+this.size.y/100&&i.min.x<=e.x&&i.max.x>=t.x&&i.min.z<=e.z&&i.max.z>=t.z||i.min.z<e.z+this.size.z/100&&i.min.x<=e.x&&i.max.x>=t.x&&i.min.y<=e.y&&i.max.y>=t.y||this.unmarkBakedShadow(s)}applyTransform(){const{models:e}=this;if(0===e.length)return;const t=Mo(this.element.orientation)[0].terms,i=No(t[0]).number,s=No(t[1]).number,a=No(t[2]).number,n=Mo(this.element.scale)[0].terms;for(const t of e)t.quaternion.setFromEuler(new It(s,a,i,"YXZ")),t.scale.set(n[0].number,n[1].number,n[2].number)}updateBoundingBox(){const{models:e}=this;if(0===e.length)return;for(const t of e)this.target.remove(t),this.findBakedShadows(t);const t=(e,t)=>e.expandByPoint(t);this.setBakedShadowVisibility(!1);let i=new be;for(const s of e)i=fr(s,t,i);if(this.boundingBox=i,this.boundingBox.isEmpty()){this.setBakedShadowVisibility(!0),this.bakedShadows.forEach(e=>this.unmarkBakedShadow(e)),i=new be;for(const s of e)i=fr(s,t,i);this.boundingBox=i}this.checkBakedShadows(),this.setBakedShadowVisibility(),this.boundingBox.getSize(this.size);for(const t of e)this.target.add(t)}async updateFraming(){const{models:e}=this;if(0===e.length)return;for(const t of e)this.target.remove(t);this.setBakedShadowVisibility(!1);const{center:t}=this.boundingSphere;this.element.requestUpdate("cameraTarget"),await this.element.updateComplete,t.copy(this.getTarget());const i=(e,i)=>Math.max(e,t.distanceToSquared(i));let s=0;for(const t of e)s=Math.max(s,fr(t,i,0));this.boundingSphere.radius=Math.sqrt(s);const a=(e,i)=>{i.sub(t);const s=Math.sqrt(i.x*i.x+i.z*i.z);return Math.max(e,s/(this.idealCameraDistance()-Math.abs(i.y)))};let n=0;for(const t of e)n=Math.max(n,fr(t,a,0));this.idealAspect=n/Math.tan(this.framedFoVDeg/2*Math.PI/180),this.setBakedShadowVisibility();for(const t of e)this.target.add(t)}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)Xd.set(e/window.screen.width,t/window.screen.height);else{const i=this.element.getBoundingClientRect();Xd.set((e-i.x)/this.width,(t-i.y)/this.height)}return Xd.multiplyScalar(2).subScalar(1),Xd.y*=-1,Xd}getSize(){return{width:this.width,height:this.height}}setEnvironmentAndSkybox(e,t){this.element[Vg].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=Mo(this.element.skyboxHeight)[0].terms[0],t=No(e).number,i=10*this.boundingSphere.radius;this.groundedSkybox.updateGeometry(t,i),this.groundedSkybox.position.y=t-(this.shadow?2*this.shadow.gap():0),this.setBackground(this.groundedSkybox.map)}setTarget(e,t,i){this.goalTarget.set(-e,-t,-i)}setTargetDamperDecayTime(e){this.targetDamperX.setDecayTime(e),this.targetDamperY.setDecayTime(e),this.targetDamperZ.setDecayTime(e)}getTarget(){return this.goalTarget.clone().multiplyScalar(-1)}getDynamicTarget(){return this.target.position.clone().multiplyScalar(-1)}jumpToGoal(){this.updateTarget(1e4)}updateTarget(e){const t=this.goalTarget,i=this.target.position;if(t.equals(i))return!1;{const s=this.boundingSphere.radius/10;let{x:a,y:n,z:r}=i;return a=this.targetDamperX.update(a,t.x,e,s),n=this.targetDamperY.update(n,t.y,e,s),r=this.targetDamperZ.update(r,t.z,e,s),this.groundedSkybox.position.x=-a,this.groundedSkybox.position.z=-r,this.target.position.set(a,n,r),this.target.updateMatrixWorld(),this.queueRender(),!0}}pointTowards(e,t){const{x:i,z:s}=this.position;this.yaw=Math.atan2(e-i,t-s)}get model(){return this._models[0]||null}get models(){return this._models}set yaw(e){this.scenePivot.rotation.y=e,this.groundedSkybox.rotation.y=-e,this.queueRender()}get yaw(){return this.scenePivot.rotation.y}set animationTime(e){for(const t of this.mixers)t.setTime(e);this.queueShadowRender()}get animationTime(){let e=0;for(const t of this.currentAnimationActions)if(null!=t){let i=t.time;const s=Math.max(t._loopCount,0);if(t.loop===Ot&&!(1&~s)){i=(t.getClip()?t.getClip().duration:0)-t.time}i>e&&(e=i)}return e}set animationTimeScale(e){for(const t of this.mixers)t.timeScale=e}get animationTimeScale(){return this.mixers.length>0?this.mixers[0].timeScale:1}get duration(){let e=0;for(const t of this.currentAnimationActions)if(null!=t&&t.getClip()){const i=t.getClip().duration;i>e&&(e=i)}return e}get hasActiveAnimation(){return this.currentAnimationActions.some(e=>null!=e)}playAnimation(e=null,t=0,i=qt,s=1/0,a=null){const n=null!=a?a:0,r=null!=a?a+1:this._models.length;for(let a=n;a<r;a++){const n=this._currentGLTFs[a];if(null==n)continue;const r=n.animations||[];if(0===r.length)continue;let o=null;if(null!=e){for(let t=r.length-1;t>=0;t--)if(r[t].name===e){o=r[t];break}if(null==o){const t=parseInt(e);!isNaN(t)&&t>=0&&t<r.length&&(o=r[t])}}null==o&&(o=r[0]);try{const e=this.currentAnimationActions[a],n=this.mixers[a],r=n.clipAction(o,this._models[a]);this.currentAnimationActions[a]=r,this.element.paused?(n.stopAllAction(),this.mixerPausedStates[a]=!0):(r.paused=!1,this.mixerPausedStates[a]=!1,null!=e&&r!==e?r.crossFadeFrom(e,t,!1):this.animationTimeScale>0&&this.animationTime==this.duration&&(this.animationTime=0)),r.setLoop(i,s),r.enabled=!0,r.clampWhenFinished=!0,r.play()}catch(e){console.error(e)}}}appendAnimation(e="",t=qt,i=1/0,s=1,a=1,n=!1,r=!1,o=!0,A=null,l=!1,c=null){if(null==this.currentGLTF||e===this.element.animationName)return;const{animations:h}=this;if(null==h||0===h.length)return;const d=e?this.animationsByName.get(e):null;if(null==d)return;if("string"==typeof i?isNaN(parseFloat(i))?(i=1/0,console.warn(`Invalid repetitionCount value: ${i}. Using default: Infinity`)):(parseInt(i)<1&&console.warn(`Invalid repetitionCount value: ${i}. Using 1 as minimum.`),i=Math.max(parseInt(i),1)):"number"!=typeof i||isNaN(i)?(console.warn(`Invalid repetitionCount value: ${i}. Using default: Infinity`),i=1/0):i<1&&(console.warn(`Invalid repetitionCount value: ${i}. Using 1 as minimum.`),i=1),1===i&&t!==jt&&(t=jt),"string"==typeof s){const e=parseFloat(s);isNaN(e)||e<0||e>1?(s=1,console.warn(`Invalid weight value: ${s}. Using default: 1`)):s=e}if("string"==typeof a){const e=parseFloat(a);isNaN(e)||e<0?(a=1,console.warn(`Invalid timeScale value: ${a}. Using default: 1`)):a=e}if("string"==typeof A){const e=parseFloat(A);isNaN(e)?(A=null,console.warn(`Invalid time value: ${A}. Using default: 0 or previous time`)):A=e}const{shouldFade:g,duration:u}=this.parseFadeValue(n,!1,1.25);let p=!1,m=0;"boolean"==typeof r?(p=r,m=r?1.25:0):"number"==typeof r?(p=r>0,m=Math.max(r,0),r<0&&console.warn(`Invalid warp value: ${r}. Using default: false`)):"string"==typeof r&&("true"===r.toLowerCase().trim()?(p=!0,m=1.25):"false"===r.toLowerCase().trim()?p=!1:isNaN(parseFloat(r))?console.warn(`Invalid warp value: ${r}. Using default: false`):(m=Math.max(parseFloat(r),0),p=m>0,m<=0&&console.warn(`Invalid warp value: ${r}. Using default: false`)));try{l&&this.appendedAnimations.includes(e)&&(this.markedAnimations.map(e=>e.name).includes(e)||this.markedAnimations.push({name:e,loopMode:t,repetitionCount:i}));const n=null!=c?c:0,r=null!=c?c+1:this.mixers.length;for(let e=n;e<r;e++){const n=this.mixers[e],r=n.existingAction(d)||n.clipAction(d,this._models[e]||this),l=r.timeScale;"number"==typeof A&&(r.time=Math.min(Math.max(A,0),d.duration)),g?r.fadeIn(u):s>=0&&(r.weight=Math.min(Math.max(s,0),1)),p?r.warp(o?l:0,a,m):r.timeScale=a,r.isRunning()||(r.time==d.duration&&r.stop(),r.setLoop(t,i),r.paused=!1,r.enabled=!0,r.clampWhenFinished=!0,r.play())}this.appendedAnimations.includes(e)||this.element[qg].appendedAnimations.push(e)}catch(e){console.error(e)}}parseFadeValue(e,t=!0,i=1.5){if("boolean"==typeof e)return{shouldFade:e,duration:e?i:0};if("number"==typeof e){const t=Math.max(e,0);return{shouldFade:t>0,duration:t}}if("string"==typeof e){const t=e.toLowerCase().trim();if("true"===t)return{shouldFade:!0,duration:i};if("false"===t)return{shouldFade:!1,duration:0};const s=parseFloat(t);if(!isNaN(s)){const e=Math.max(s,0);return{shouldFade:e>0,duration:e}}}return console.warn(`Invalid fade value: ${e}. Using default: ${t}`),{shouldFade:t,duration:t?i:0}}detachAnimation(e="",t=!0,i=null){if(null==this.currentGLTF||e===this.element.animationName)return;const{animations:s}=this;if(null==s||0===s.length)return;const a=e?this.animationsByName.get(e):null;if(null==a)return;const{shouldFade:n,duration:r}=this.parseFadeValue(t,!0,1.5);try{const t=null!=i?i:0,s=null!=i?i+1:this.mixers.length;for(let e=t;e<s;e++){const t=this.mixers[e],i=t.existingAction(a)||t.clipAction(a,this._models[e]||this);n?i.fadeOut(r):i.stop()}this.element[qg].appendedAnimations=this.element[qg].appendedAnimations.filter(t=>t!==e)}catch(e){console.error(e)}}updateAnimationLoop(e="",t=qt,i=1/0,s=null){if(null==this.currentGLTF||e===this.element.animationName)return;const{animations:a}=this;if(null==a||0===a.length)return;let n=null;if(e&&(n=this.animationsByName.get(e)),null!=n)try{const e=null!=s?s:0,a=null!=s?s+1:this.mixers.length;for(let s=e;s<a;s++){const e=this.mixers[s],a=e.existingAction(n)||e.clipAction(n,this._models[s]||this);a.stop(),a.setLoop(t,i),a.play()}}catch(e){console.error(e)}}stopAnimation(){this.currentAnimationActions.fill(null);for(const e of this.mixers)e.stopAllAction();this.mixerPausedStates.fill(!0)}isAllAnimationsPaused(){return this.mixerPausedStates.every(e=>e)}pauseAnimation(e=null){const t=null!=e?e:0,i=null!=e?e+1:this.mixers.length;for(let e=t;e<i;e++)this.mixerPausedStates[e]=!0}unpauseAnimation(e=null){const t=null!=e?e:0,i=null!=e?e+1:this.mixers.length;for(let e=t;e<i;e++)this.mixerPausedStates[e]=!1}updateAnimation(e){for(let t=0;t<this.mixers.length;t++)this.mixerPausedStates[t]||this.mixers[t].update(e);this.queueShadowRender()}subscribeMixerEvent(e,t){this.mixerEventSubscriptions.push({event:e,callback:t});for(const i of this.mixers)i.addEventListener(e,t)}createMixer(e){const t=new Ht(e);for(const{event:e,callback:i}of this.mixerEventSubscriptions)t.addEventListener(e,i);return 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){this.updateBoundingBoxAndShadowIfDirty();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 zd(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)}getHit(e=this){return Yd.intersectObject(e,!0).find(e=>e.object.visible&&!e.object.userData.noHit)}hitFromController(e,t=this){return Yd.setFromXRController(e),this.getHit(t)}hitFromPoint(e,t=this){return Yd.setFromCamera(e,this.getCamera()),this.getHit(t)}getModelIndexFromHit(e){let t=e.object;for(;null!=t;){const e=this.models.indexOf(t);if(-1!==e)return e;t=t.parent}return 0}positionAndNormalFromPoint(e,t=this){var i;const s=this.hitFromPoint(e,t);if(null==s)return null;const a=s.point,n=null!=s.face?s.face.normal.clone().applyNormalMatrix((new ft).getNormalMatrix(s.object.matrixWorld)):Yd.ray.direction.clone().multiplyScalar(-1),r=null!==(i=s.uv)&&void 0!==i?i:null,o=this.getModelIndexFromHit(s),A=this.models[o]||this.target;return{position:a,normal:n,uv:r,modelIndex:o,worldToModel:(new v).copy(A.matrixWorld).invert()}}surfaceFromPoint(e,t=this){var i;const s=this.hitFromPoint(e,t);if(null==s||null==s.face)return null;const a=this.getModelIndexFromHit(s),n=0===a?this.element.model:null===(i=this.element.extraModels)||void 0===i?void 0:i[a-1];if(null==n)return null;const r=n[Id](s);if(null==r)return null;const{meshes:o,primitives:A}=r.mesh.userData.associations,l=new S,c=new S,h=new S,{a:d,b:g,c:u}=s.face,p=s.object;p.getVertexPosition(d,l),p.getVertexPosition(g,c),p.getVertexPosition(u,h);const m=new Ut(l,c,h),b=new S;m.getBarycoord(p.worldToLocal(s.point),b),m.getBarycoord(p.worldToLocal(s.point),b);const f=`${o} ${A} ${d} ${g} ${u} ${b.x.toFixed(3)} ${b.y.toFixed(3)} ${b.z.toFixed(3)}`;return 0===a?f:`${a} ${f}`}updateHotspotAttachment(e){const t=null!=e.modelIndex&&e.modelIndex>0&&this._models[e.modelIndex]?this._models[e.modelIndex]:this.target;e.parent!==t&&(t.add(e),e.updatePosition(e.position.toArray().join(" ")+"m"),e.updateMatrixWorld(!0))}addHotspot(e){this.updateHotspotAttachment(e),this.annotationRenderer.domElement.appendChild(e.element),this.updateSurfaceHotspot(e)}removeHotspot(e){e.parent&&e.parent.remove(e)}forHotspots(e){const t=[...this.target.children];for(let i=0,s=t.length;i<s;i++){const s=t[i];s instanceof Od&&e(s)}for(const t of this._models)if(t&&t!==this.target){const i=[...t.children];for(let t=0,s=i.length;t<s;t++){const s=i[t];s instanceof Od&&e(s)}}}updateSurfaceHotspot(e){var t,i;if(null==e.surface)return;const s=Mo(e.surface)[0].terms;if(8!==s.length&&9!==s.length)return void console.warn(e.surface+" does not have exactly 8 or 9 numbers. Did you use an outdated string?");const a=8===s.length,n=a?0:s[0].number,r=a?0:1,o=null!==(t=e.modelIndex)&&void 0!==t?t:n;e.modelIndex=o,this.updateHotspotAttachment(e);const A=0===o?this.element.model:null===(i=this.element.extraModels)||void 0===i?void 0:i[o-1];if(null==A)return;const l=A[Ed](s[0+r].number,s[1+r].number);if(null==l)return void console.warn(e.surface+" does not match a node/primitive in this glTF! Skipping this hotspot.");const c=l.mesh.geometry.attributes.position.count,h=new S(s[2+r].number,s[3+r].number,s[4+r].number);if(h.x>=c||h.y>=c||h.z>=c)return void console.warn(e.surface+" vertex indices out of range in this glTF! Skipping this hotspot.");const d=new S(s[5+r].number,s[6+r].number,s[7+r].number);e.mesh=l.mesh,e.tri=h,e.bary=d,e.updateSurface()}animateSurfaceHotspots(){this.element.paused||this.forHotspots(e=>{e.updateSurface()})}updateHotspotsVisibility(e){this.forHotspots(t=>{Kd.copy(e),Vd.setFromMatrixPosition(t.matrixWorld),Kd.sub(Vd),Jd.copy(t.normal).transformDirection(this.target.matrixWorld),Kd.dot(Jd)<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:i,element:s}=this,{alt:a,poster:n,iosSrc:r}=s;if(null!=e){const s=[{"@type":"MediaObject",contentUrl:e,encodingFormat:"gltf"===(null===(t=e.split(".").pop())||void 0===t?void 0:t.toLowerCase())?"model/gltf+json":"model/gltf-binary"}];r&&s.push({"@type":"MediaObject",contentUrl:r,encodingFormat:"model/vnd.usdz+zip"});const o={"@context":"http://schema.org/","@type":"3DModel",image:null!=n?n:void 0,name:null!=a?a:void 0,encoding:s};i.textContent=JSON.stringify(o),document.head.appendChild(i)}else null!=i.parentElement&&i.parentElement.removeChild(i)}}
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */class Zd 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),i=>{let s;return s=Math.max(Cs(i,0,1),t.progress),s!==t.progress&&this.announceTotalProgress(t,s,e),t.progress}}announceTotalProgress(e,t,i){let s=0,a=0;1==t&&(e.completed=!0);for(const e of this.ongoingActivities){const{progress:t}=e;s+=1-t,e.completed&&a++}const n=e.progress;e.progress=t,this.totalProgress+=(t-n)*(1-this.totalProgress)/s;const r=a===this.ongoingActivityCount?1:this.totalProgress;this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:r,reason:i}})),a===this.ongoingActivityCount&&(this.totalProgress=0,this.ongoingActivities.clear())}}
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */var eg,tg,ig,sg,ag,ng,rg,og,Ag,lg,cg,hg,dg,gg,ug,pg=function(e,t,i,s){for(var a,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s,o=e.length-1;o>=0;o--)(a=e[o])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};const mg=document.createElement("canvas"),bg=Symbol("fallbackResizeHandler"),fg=Symbol("defaultAriaLabel"),Ig=Symbol("resizeObserver"),Eg=Symbol("clearModelTimeout"),Cg=Symbol("onContextLost"),yg=Symbol("loaded"),wg=Symbol("status"),Bg=Symbol("onFocus"),xg=Symbol("onBlur"),vg=Symbol("onSlotChange"),Sg=Symbol("onExtraModelChanged"),Qg=Symbol("updateSize"),Mg=Symbol("intersectionObserver"),Dg=Symbol("isElementInViewport"),Rg=Symbol("announceModelVisibility"),Tg=Symbol("ariaLabel"),Fg=Symbol("altDefaulted"),kg=Symbol("statusElement"),Lg=Symbol("updateStatus"),Pg=Symbol("loadedTime"),_g=Symbol("updateSource"),Ug=Symbol("markLoaded"),Gg=Symbol("container"),Ng=Symbol("input"),Og=Symbol("canvas"),qg=Symbol("scene"),Hg=Symbol("needsRender"),jg=Symbol("tick"),zg=Symbol("onModelLoad"),Kg=Symbol("onResize"),Vg=Symbol("renderer"),Jg=Symbol("progressTracker"),Yg=Symbol("getLoaded"),Wg=Symbol("getModelIsVisible"),Xg=Symbol("shouldAttemptPreload"),$g=e=>({x:e.x,y:e.y,z:e.z,toString(){return`${this.x}m ${this.y}m ${this.z}m`}}),Zg=e=>({u:e.x,v:e.y,toString(){return`${this.u} ${this.v}`}});class eu extends hi{static get is(){return"model-viewer"}static set modelCacheSize(e){cr[Ar].evictionThreshold=e}static get modelCacheSize(){return cr[Ar].evictionThreshold}static set minimumRenderScale(e){e>1&&console.warn("<model-viewer> minimumRenderScale has been clamped to a maximum value of 1."),e<=0&&console.warn("<model-viewer> minimumRenderScale has been clamped to a minimum value of 0.25."),Kc.singleton.minScale=e}static get minimumRenderScale(){return Kc.singleton.minScale}get loaded(){return this[Yg]()}get[(eg=Dg,tg=yg,ig=Pg,sg=wg,ag=Eg,ng=vg,rg=Sg,og=bg,Ag=Rg,lg=Ig,cg=Mg,hg=Jg,Vg)](){return Kc.singleton}get modelIsVisible(){return this[Wg]()}constructor(){super(),this.alt=null,this.src=null,this.withCredentials=!1,this.generateSchema=!1,this[eg]=!1,this[tg]=!1,this[ig]=0,this[sg]="",this[ag]=null,this[ng]=()=>{if(!this[qg])return;const e=Array.from(this.querySelectorAll("extra-model")),t=e.map(e=>e.src).filter(e=>null!=e),i=this[qg].extraUrls||[];t.join(",")===i.join(",")&&e.length===i.length||(null==this.src&&0===e.length?(this[yg]=!1,this[Pg]=0,this[qg].reset()):(this[yg]=!1,this[Pg]=0,this[_g]()))},this[rg]=e=>{const t=e,i=t.target,s=Array.from(this.querySelectorAll("extra-model")).indexOf(i);if(-1===s)return;const a=this.src?s+1:s;t.detail.srcChanged?(this[yg]=!1,this[Pg]=0,this[_g]()):this[qg]&&this[qg].updateModelTransforms(a,t.detail.offset,t.detail.orientation,t.detail.scale)},this[og]=Es(()=>{const e=this.getBoundingClientRect();this[Qg](e)},50),this[Ag]=Es(e=>{const t=this.modelIsVisible;t!==e&&this.dispatchEvent(new CustomEvent("model-visibility",{detail:{visible:t}}))},0),this[lg]=null,this[cg]=null,this[hg]=new Zd,this[dg]=()=>{this[kg].textContent=this[wg]},this[gg]=()=>{this[kg].textContent=""},this[ug]=e=>{this.dispatchEvent(new CustomEvent("error",{detail:{type:"webglcontextlost",sourceError:e.sourceEvent}}))},this.attachShadow({mode:"open"});const e=this.shadowRoot;let t,i;if((e=>{Yi(Qs,e)})(e),this[Gg]=e.querySelector(".container"),this[Ng]=e.querySelector(".userInput"),this[Og]=e.querySelector("canvas"),this[kg]=e.querySelector("#status"),this[fg]=this[Ng].getAttribute("aria-label"),this.isConnected){const e=this.getBoundingClientRect();t=e.width,i=e.height}else t=300,i=150;this[qg]=new $d({canvas:this[Og],element:this,width:t,height:i}),Promise.resolve().then(()=>{this[Qg](this.getBoundingClientRect())}),rs&&(this[Ig]=new ResizeObserver(e=>{if(!this[Vg].isPresenting)for(let t of e)t.target===this&&this[Qg](t.contentRect)})),os?this[Mg]=new IntersectionObserver(e=>{for(let t of e)if(t.target===this){const e=this.modelIsVisible;this[Dg]=t.isIntersecting,this[Rg](e),this[Dg]&&!this.loaded&&this[_g]()}},{root:null,rootMargin:"0px",threshold:1e-5}):this[Dg]=!0}connectedCallback(){super.connectedCallback&&super.connectedCallback(),rs?this[Ig].observe(this):self.addEventListener("resize",this[bg]),os&&this[Mg].observe(this),this.addEventListener("focus",this[Bg]),this.addEventListener("blur",this[xg]),this.addEventListener("extra-model-changed",this[Sg]);const e=this.shadowRoot.querySelector(".slot.default slot");e&&e.addEventListener("slotchange",this[vg]);const t=this[Vg];t.addEventListener("contextlost",this[Cg]),t.registerScene(this[qg]),null!=this[Eg]&&(self.clearTimeout(this[Eg]),this[Eg]=null,this.requestUpdate("src",null))}disconnectedCallback(){super.disconnectedCallback&&super.disconnectedCallback(),rs?this[Ig].unobserve(this):self.removeEventListener("resize",this[bg]),os&&this[Mg].unobserve(this),this.removeEventListener("focus",this[Bg]),this.removeEventListener("blur",this[xg]),this.removeEventListener("extra-model-changed",this[Sg]);const e=this.shadowRoot.querySelector(".slot.default slot");e&&e.removeEventListener("slotchange",this[vg]);const t=this[Vg];t.removeEventListener("contextlost",this[Cg]),t.unregisterScene(this[qg]),this[Eg]=self.setTimeout(()=>{this[qg].dispose(),this[Eg]=null},10)}updated(e){if(super.updated(e),e.has("src")){const e=Array.from(this.querySelectorAll("extra-model")),t=e.map(e=>e.src).filter(e=>null!=e),i=t.join(",")===(this[qg].extraUrls||[]).join(",");null==this.src&&0===e.length?(this[yg]=!1,this[Pg]=0,this[qg].reset()):this.src===this[qg].url&&i||(this[yg]=!1,this[Pg]=0,this[_g]())}if(e.has("alt")&&this[Ng].setAttribute("aria-label",this[Tg]),e.has("generateSchema"))if(this.generateSchema){const e=Array.from(this.querySelectorAll("extra-model")).map(e=>e.src).filter(e=>null!=e),t=this.src||e[0]||null;this[qg].updateSchema(t)}else this[qg].updateSchema(null)}toDataURL(e,t){return this[Vg].displayCanvas(this[qg]).toDataURL(e,t)}async toBlob(e){const t=e?e.mimeType:void 0,i=e?e.qualityArgument:void 0,s=e?e.idealAspect:void 0,{width:a,height:n,idealAspect:r,aspect:o}=this[qg],{dpr:A,scaleFactor:l}=this[Vg];let c=a*l*A,h=n*l*A,d=0,g=0;if(!0===s)if(r>o){const e=h;h=Math.round(c/r),g=(e-h)/2}else{const e=c;c=Math.round(h*r),d=(e-c)/2}mg.width=c,mg.height=h;try{return new Promise(async(e,s)=>{mg.getContext("2d").drawImage(this[Vg].displayCanvas(this[qg]),d,g,c,h,0,0,c,h),mg.toBlob(t=>{if(!t)return s(new Error("Unable to retrieve canvas blob"));e(t)},t,i)})}finally{this[Qg]({width:a,height:n})}}registerEffectComposer(e){e.setRenderer(this[Vg].threeRenderer),e.setMainCamera(this[qg].getCamera()),e.setMainScene(this[qg]),this[qg].effectRenderer=e}unregisterEffectComposer(){this[qg].effectRenderer=null}registerRenderer(e){this[qg].externalRenderer=e}unregisterRenderer(){this[qg].externalRenderer=null}get[Tg](){return this[Fg]}get[Fg](){return null==this.alt||"null"===this.alt?this[fg]:this.alt}[Yg](){return this[yg]}[Wg](){return this.loaded&&this[Dg]}[Xg](){const e=Array.from(this.querySelectorAll("extra-model"));return!!(this.src||e.length>0)&&this[Dg]}[Qg]({width:e,height:t}){0!==e&&0!==t&&(this[Gg].style.width=`${e}px`,this[Gg].style.height=`${t}px`,this[Kg]({width:e,height:t}))}[jg](e,t){var i;null===(i=this[qg].effectRenderer)||void 0===i||i.beforeRender(e,t)}[Ug](){this[yg]||(this[yg]=!0,this[Pg]=performance.now())}[Hg](){this[qg].queueRender()}[zg](){}[Lg](e){this[wg]=e;const t=this.getRootNode();null!=t&&t.activeElement===this&&this[kg].textContent!=e&&(this[kg].textContent=e)}[(dg=Bg,gg=xg,Kg)](e){this[qg].setSize(e.width,e.height)}async[(ug=Cg,_g)](){const e=this[qg],t=Array.from(this.querySelectorAll("extra-model")).map(e=>e.src).filter(e=>null!=e),i=t.join(",")===(e.extraUrls||[]).join(",");if(this.loaded||!this[Xg]()||this.src===e.url&&i)return;const s=this.src,a=s||t[0]||null;this.generateSchema&&e.updateSchema(a),this[Lg]("Loading"),e.stopAnimation();const n=this[Jg].beginActivity("model-load");try{const i=e.setSource(s,t,e=>n(.95*Cs(e,0,1))),r=this[vs]();await Promise.all([i,r]);Array.from(this.querySelectorAll("extra-model")).forEach((e,t)=>{const i=this.src?t+1:t;this[qg].updateModelTransforms(i,e.offset,e.orientation,e.scale)}),this[Ug](),this[zg](),this.updateComplete.then(()=>{this.dispatchEvent(new CustomEvent("before-render"))}),await new Promise(e=>{const t=setTimeout(()=>{console.warn("rAF timed out in updateSource"),e()},500);requestAnimationFrame(()=>{requestAnimationFrame(()=>{clearTimeout(t),e()})})}),this.dispatchEvent(new CustomEvent("load",{detail:{url:a}}))}catch(e){this.dispatchEvent(new CustomEvent("error",{detail:{type:"loadfailure",sourceError:e}}))}finally{n(1)}}}pg([ts({type:String})],eu.prototype,"alt",void 0),pg([ts({type:String})],eu.prototype,"src",void 0),pg([ts({type:Boolean,attribute:"with-credentials"})],eu.prototype,"withCredentials",void 0),pg([ts({type:Boolean,attribute:"generate-schema"})],eu.prototype,"generateSchema",void 0);
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
var tu=function(e,t,i,s){for(var a,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s,o=e.length-1;o>=0;o--)(a=e[o])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};const iu=Symbol("changeAnimation"),su=Symbol("appendAnimation"),au=Symbol("detachAnimation"),nu=Symbol("paused"),ru=Symbol("currentAnimationOptions"),ou={repetitions:1/0,pingpong:!1},Au={pingpong:!1,repetitions:null,weight:1,timeScale:1,fade:!1,warp:!1,relativeWarp:!0,time:null},lu={fade:!0},cu=Symbol("hotspotMap"),hu=Symbol("mutationCallback"),du=Symbol("observer"),gu=Symbol("addHotspot"),uu=Symbol("removeHotspot");
/*!
fflate - fast JavaScript compression/decompression
<https://101arrowz.github.io/fflate>
Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE
version 0.8.2
*/
var pu=Uint8Array,mu=Uint16Array,bu=Int32Array,fu=new pu([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]),Iu=new pu([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]),Eu=new pu([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Cu=function(e,t){for(var i=new mu(31),s=0;s<31;++s)i[s]=t+=1<<e[s-1];var a=new bu(i[30]);for(s=1;s<30;++s)for(var n=i[s];n<i[s+1];++n)a[n]=n-i[s]<<5|s;return{b:i,r:a}},yu=Cu(fu,2),wu=yu.b,Bu=yu.r;wu[28]=258,Bu[258]=28;for(var xu=Cu(Iu,0).r,vu=new mu(32768),Su=0;Su<32768;++Su){var Qu=(43690&Su)>>1|(21845&Su)<<1;Qu=(61680&(Qu=(52428&Qu)>>2|(13107&Qu)<<2))>>4|(3855&Qu)<<4,vu[Su]=((65280&Qu)>>8|(255&Qu)<<8)>>1}var Mu=function(e,t,i){for(var s=e.length,a=0,n=new mu(t);a<s;++a)e[a]&&++n[e[a]-1];var r,o=new mu(t);for(a=1;a<t;++a)o[a]=o[a-1]+n[a-1]<<1;if(i){r=new mu(1<<t);var A=15-t;for(a=0;a<s;++a)if(e[a])for(var l=a<<4|e[a],c=t-e[a],h=o[e[a]-1]++<<c,d=h|(1<<c)-1;h<=d;++h)r[vu[h]>>A]=l}else for(r=new mu(s),a=0;a<s;++a)e[a]&&(r[a]=vu[o[e[a]-1]++]>>15-e[a]);return r},Du=new pu(288);for(Su=0;Su<144;++Su)Du[Su]=8;for(Su=144;Su<256;++Su)Du[Su]=9;for(Su=256;Su<280;++Su)Du[Su]=7;for(Su=280;Su<288;++Su)Du[Su]=8;var Ru=new pu(32);for(Su=0;Su<32;++Su)Ru[Su]=5;var Tu=Mu(Du,9,0),Fu=Mu(Ru,5,0),ku=function(e){return(e+7)/8|0},Lu=function(e,t,i){return(null==i||i>e.length)&&(i=e.length),new pu(e.subarray(t,i))},Pu=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],_u=function(e,t,i){var s=new Error(t||Pu[e]);if(s.code=e,Error.captureStackTrace&&Error.captureStackTrace(s,_u),!i)throw s;return s},Uu=function(e,t,i){i<<=7&t;var s=t/8|0;e[s]|=i,e[s+1]|=i>>8},Gu=function(e,t,i){i<<=7&t;var s=t/8|0;e[s]|=i,e[s+1]|=i>>8,e[s+2]|=i>>16},Nu=function(e,t){for(var i=[],s=0;s<e.length;++s)e[s]&&i.push({s:s,f:e[s]});var a=i.length,n=i.slice();if(!a)return{t:Vu,l:0};if(1==a){var r=new pu(i[0].s+1);return r[i[0].s]=1,{t:r,l:1}}i.sort(function(e,t){return e.f-t.f}),i.push({s:-1,f:25001});var o=i[0],A=i[1],l=0,c=1,h=2;for(i[0]={s:-1,f:o.f+A.f,l:o,r:A};c!=a-1;)o=i[i[l].f<i[h].f?l++:h++],A=i[l!=c&&i[l].f<i[h].f?l++:h++],i[c++]={s:-1,f:o.f+A.f,l:o,r:A};var d=n[0].s;for(s=1;s<a;++s)n[s].s>d&&(d=n[s].s);var g=new mu(d+1),u=Ou(i[c-1],g,0);if(u>t){s=0;var p=0,m=u-t,b=1<<m;for(n.sort(function(e,t){return g[t.s]-g[e.s]||e.f-t.f});s<a;++s){var f=n[s].s;if(!(g[f]>t))break;p+=b-(1<<u-g[f]),g[f]=t}for(p>>=m;p>0;){var I=n[s].s;g[I]<t?p-=1<<t-g[I]++-1:++s}for(;s>=0&&p;--s){var E=n[s].s;g[E]==t&&(--g[E],++p)}u=t}return{t:new pu(g),l:u}},Ou=function(e,t,i){return-1==e.s?Math.max(Ou(e.l,t,i+1),Ou(e.r,t,i+1)):t[e.s]=i},qu=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new mu(++t),s=0,a=e[0],n=1,r=function(e){i[s++]=e},o=1;o<=t;++o)if(e[o]==a&&o!=t)++n;else{if(!a&&n>2){for(;n>138;n-=138)r(32754);n>2&&(r(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(r(a),--n;n>6;n-=6)r(8304);n>2&&(r(n-3<<5|8208),n=0)}for(;n--;)r(a);n=1,a=e[o]}return{c:i.subarray(0,s),n:t}},Hu=function(e,t){for(var i=0,s=0;s<t.length;++s)i+=e[s]*t[s];return i},ju=function(e,t,i){var s=i.length,a=ku(t+2);e[a]=255&s,e[a+1]=s>>8,e[a+2]=255^e[a],e[a+3]=255^e[a+1];for(var n=0;n<s;++n)e[a+n+4]=i[n];return 8*(a+4+s)},zu=function(e,t,i,s,a,n,r,o,A,l,c){Uu(t,c++,i),++a[256];for(var h=Nu(a,15),d=h.t,g=h.l,u=Nu(n,15),p=u.t,m=u.l,b=qu(d),f=b.c,I=b.n,E=qu(p),C=E.c,y=E.n,w=new mu(19),B=0;B<f.length;++B)++w[31&f[B]];for(B=0;B<C.length;++B)++w[31&C[B]];for(var x=Nu(w,7),v=x.t,S=x.l,Q=19;Q>4&&!v[Eu[Q-1]];--Q);var M,D,R,T,F=l+5<<3,k=Hu(a,Du)+Hu(n,Ru)+r,L=Hu(a,d)+Hu(n,p)+r+14+3*Q+Hu(w,v)+2*w[16]+3*w[17]+7*w[18];if(A>=0&&F<=k&&F<=L)return ju(t,c,e.subarray(A,A+l));if(Uu(t,c,1+(L<k)),c+=2,L<k){M=Mu(d,g,0),D=d,R=Mu(p,m,0),T=p;var P=Mu(v,S,0);Uu(t,c,I-257),Uu(t,c+5,y-1),Uu(t,c+10,Q-4),c+=14;for(B=0;B<Q;++B)Uu(t,c+3*B,v[Eu[B]]);c+=3*Q;for(var _=[f,C],U=0;U<2;++U){var G=_[U];for(B=0;B<G.length;++B){var N=31&G[B];Uu(t,c,P[N]),c+=v[N],N>15&&(Uu(t,c,G[B]>>5&127),c+=G[B]>>12)}}}else M=Tu,D=Du,R=Fu,T=Ru;for(B=0;B<o;++B){var O=s[B];if(O>255){Gu(t,c,M[(N=O>>18&31)+257]),c+=D[N+257],N>7&&(Uu(t,c,O>>23&31),c+=fu[N]);var q=31&O;Gu(t,c,R[q]),c+=T[q],q>3&&(Gu(t,c,O>>5&8191),c+=Iu[q])}else Gu(t,c,M[O]),c+=D[O]}return Gu(t,c,M[256]),c+D[256]},Ku=new bu([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Vu=new pu(0),Ju=function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var i=t,s=9;--s;)i=(1&i&&-306674912)^i>>>1;e[t]=i}return e}(),Yu=function(){var e=-1;return{p:function(t){for(var i=e,s=0;s<t.length;++s)i=Ju[255&i^t[s]]^i>>>8;e=i},d:function(){return~e}}},Wu=function(e,t,i,s,a){if(!a&&(a={l:1},t.dictionary)){var n=t.dictionary.subarray(-32768),r=new pu(n.length+e.length);r.set(n),r.set(e,n.length),e=r,a.w=n.length}return function(e,t,i,s,a,n){var r=n.z||e.length,o=new pu(s+r+5*(1+Math.ceil(r/7e3))+a),A=o.subarray(s,o.length-a),l=n.l,c=7&(n.r||0);if(t){c&&(A[0]=n.r>>3);for(var h=Ku[t-1],d=h>>13,g=8191&h,u=(1<<i)-1,p=n.p||new mu(32768),m=n.h||new mu(u+1),b=Math.ceil(i/3),f=2*b,I=function(t){return(e[t]^e[t+1]<<b^e[t+2]<<f)&u},E=new bu(25e3),C=new mu(288),y=new mu(32),w=0,B=0,x=n.i||0,v=0,S=n.w||0,Q=0;x+2<r;++x){var M=I(x),D=32767&x,R=m[M];if(p[D]=R,m[M]=D,S<=x){var T=r-x;if((w>7e3||v>24576)&&(T>423||!l)){c=zu(e,A,0,E,C,y,B,v,Q,x-Q,c),v=w=B=0,Q=x;for(var F=0;F<286;++F)C[F]=0;for(F=0;F<30;++F)y[F]=0}var k=2,L=0,P=g,_=D-R&32767;if(T>2&&M==I(x-_))for(var U=Math.min(d,T)-1,G=Math.min(32767,x),N=Math.min(258,T);_<=G&&--P&&D!=R;){if(e[x+k]==e[x+k-_]){for(var O=0;O<N&&e[x+O]==e[x+O-_];++O);if(O>k){if(k=O,L=_,O>U)break;var q=Math.min(_,O-2),H=0;for(F=0;F<q;++F){var j=x-_+F&32767,z=j-p[j]&32767;z>H&&(H=z,R=j)}}}_+=(D=R)-(R=p[D])&32767}if(L){E[v++]=268435456|Bu[k]<<18|xu[L];var K=31&Bu[k],V=31&xu[L];B+=fu[K]+Iu[V],++C[257+K],++y[V],S=x+k,++w}else E[v++]=e[x],++C[e[x]]}}for(x=Math.max(x,S);x<r;++x)E[v++]=e[x],++C[e[x]];c=zu(e,A,l,E,C,y,B,v,Q,x-Q,c),l||(n.r=7&c|A[c/8|0]<<3,c-=7,n.h=m,n.p=p,n.i=x,n.w=S)}else{for(x=n.w||0;x<r+l;x+=65535){var J=x+65535;J>=r&&(A[c/8|0]=l,J=r),c=ju(A,c+1,e.subarray(x,J))}n.i=r}return Lu(o,0,s+ku(c)+a)}(e,null==t.level?6:t.level,null==t.mem?a.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):20:12+t.mem,i,s,a)},Xu=function(e,t){var i={};for(var s in e)i[s]=e[s];for(var s in t)i[s]=t[s];return i},$u=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function Zu(e,t){return Wu(e,t||{},0,0)}var ep=function(e,t,i,s){for(var a in e){var n=e[a],r=t+a,o=s;Array.isArray(n)&&(o=Xu(s,n[1]),n=n[0]),n instanceof pu?i[r]=[n,o]:(i[r+="/"]=[new pu(0),o],ep(n,r,i,s))}},tp="undefined"!=typeof TextEncoder&&new TextEncoder,ip="undefined"!=typeof TextDecoder&&new TextDecoder;try{ip.decode(Vu,{stream:!0})}catch(pi){}function sp(e,t){if(tp)return tp.encode(e);for(var i=e.length,s=new pu(e.length+(e.length>>1)),a=0,n=function(e){s[a++]=e},r=0;r<i;++r){if(a+5>s.length){var o=new pu(a+8+(i-r<<1));o.set(s),s=o}var A=e.charCodeAt(r);A<128||t?n(A):A<2048?(n(192|A>>6),n(128|63&A)):A>55295&&A<57344?(n(240|(A=65536+(1047552&A)|1023&e.charCodeAt(++r))>>18),n(128|A>>12&63),n(128|A>>6&63),n(128|63&A)):(n(224|A>>12),n(128|A>>6&63),n(128|63&A))}return Lu(s,0,a)}var ap=function(e){var t=0;if(e)for(var i in e){var s=e[i].length;s>65535&&_u(9),t+=s+4}return t},np=function(e,t,i,s,a,n,r,o){var A=s.length,l=i.extra,c=o&&o.length,h=ap(l);$u(e,t,null!=r?33639248:67324752),t+=4,null!=r&&(e[t++]=20,e[t++]=i.os),e[t]=20,t+=2,e[t++]=i.flag<<1|(n<0&&8),e[t++]=a&&8,e[t++]=255&i.compression,e[t++]=i.compression>>8;var d=new Date(null==i.mtime?Date.now():i.mtime),g=d.getFullYear()-1980;if((g<0||g>119)&&_u(10),$u(e,t,g<<25|d.getMonth()+1<<21|d.getDate()<<16|d.getHours()<<11|d.getMinutes()<<5|d.getSeconds()>>1),t+=4,-1!=n&&($u(e,t,i.crc),$u(e,t+4,n<0?-n-2:n),$u(e,t+8,i.size)),$u(e,t+12,A),$u(e,t+14,h),t+=16,null!=r&&($u(e,t,c),$u(e,t+6,i.attrs),$u(e,t+10,r),t+=14),e.set(s,t),t+=A,h)for(var u in l){var p=l[u],m=p.length;$u(e,t,+u),$u(e,t+2,m),e.set(p,t+4),t+=4+m}return c&&(e.set(o,t),t+=c),t};function rp(e,t){t||(t={});var i={},s=[];ep(e,"",i,t);var a=0,n=0;for(var r in i){var o=i[r],A=o[0],l=o[1],c=0==l.level?0:8,h=(w=sp(r)).length,d=l.comment,g=d&&sp(d),u=g&&g.length,p=ap(l.extra);h>65535&&_u(11);var m=c?Zu(A,l):A,b=m.length,f=Yu();f.p(A),s.push(Xu(l,{size:A.length,crc:f.d(),c:m,f:w,m:g,u:h!=r.length||g&&d.length!=u,o:a,compression:c})),a+=30+h+p+b,n+=76+2*(h+p)+(u||0)+b}for(var I=new pu(n+22),E=a,C=n-a,y=0;y<s.length;++y){var w=s[y];np(I,w.o,w,w.f,w.u,w.c.length);var B=30+w.f.length+ap(w.extra);I.set(w.c,w.o+B),np(I,a,w,w.f,w.u,w.c.length,w.o,w.m),a+=16+B+(w.m?w.m.length:0)}return function(e,t,i,s,a){$u(e,t,101010256),$u(e,t+8,i),$u(e,t+10,i),$u(e,t+12,s),$u(e,t+16,a)}(I,a,s.length,C,E),I}class op{constructor(e,t="",i=[],s=[]){this.name=e,this.type=t,this.metadata=i,this.properties=s,this.children=[]}addMetadata(e,t){this.metadata.push({key:e,value:t})}addProperty(e,t=[]){this.properties.push({property:e,metadata:t})}addChild(e){this.children.push(e)}toString(e=0){const t="\t".repeat(e),i=this.metadata.map(e=>{const i=e.key,s=e.value;if(Array.isArray(s)){const e=[];return e.push(`${i} = {`),s.forEach(i=>{e.push(`${t}\t\t${i}`)}),e.push(`${t}\t}`),e.join("\n")}return`${i} = ${s}`}),s=i.length?` (\n${i.map(e=>`${t}\t${e}`).join("\n")}\n${t})`:"",a=this.properties.map(e=>{const i=e.property,s=e.metadata.length?` (\n${e.metadata.map(e=>`${t}\t\t${e}`).join("\n")}\n${t}\t)`:"";return`${t}\t${i}${s}`}),n=this.children.map(t=>t.toString(e+1)),r=[];if(a.length>0&&r.push(...a),n.length>0){a.length>0&&r.push("");for(let e=0;e<n.length;e++)r.push(n[e]),e<n.length-1&&r.push("")}const o=r.join("\n"),A=this.type?this.type+" ":"";return`${t}def ${A}"${this.name}"${s}\n${t}{\n${o}\n${t}}`}}class Ap{constructor(){this.textureUtils=null}setTextureUtils(e){this.textureUtils=e}parse(e,t,i,s){this.parseAsync(e,s).then(t).catch(i)}async parseAsync(e,t={}){t=Object.assign({ar:{anchoring:{type:"plane"},planeAnchoring:{alignment:"horizontal"}},includeAnchoringProperties:!0,onlyVisible:!0,quickLookCompatible:!1,maxTextureSize:1024},t);const i=new Set,s={},a="model.usda";s[a]=null;const n=new op("Root","Xform"),r=new op("Scenes","Scope");r.addMetadata("kind",'"sceneLibrary"'),n.addChild(r);const o="Scene",A=new op(o,"Xform");let l;A.addMetadata("customData",["bool preliminary_collidesWithEnvironment = 0",`string sceneName = "${o}"`]),A.addMetadata("sceneName",`"${o}"`),t.includeAnchoringProperties&&(A.addProperty(`token preliminary:anchoring:type = "${t.ar.anchoring.type}"`),A.addProperty(`token preliminary:planeAnchoring:alignment = "${t.ar.planeAnchoring.alignment}"`)),r.addChild(A);const c={},h={};gp(e,A,c,i,s,t);const d=function(e,t,i=!1){const s=new op("Materials");for(const a in e){const n=e[a];s.addChild(Cp(n,t,i))}return s}(c,h,t.quickLookCompatible);l=dp()+"\n"+n.toString()+"\n\n"+d.toString(),s[a]=sp(l),l=null;for(const e in h){let i=h[e];if(!0===i.isCompressedTexture){if(null===this.textureUtils)throw new Error("THREE.USDZExporter: setTextureUtils() must be called to process compressed textures.");i=await this.textureUtils.decompress(i)}const a=cp(i.image,i.flipY,t.maxTextureSize),n=await new Promise(e=>a.toBlob(e,"image/png",1));s[`textures/Texture_${e}.png`]=new Uint8Array(await n.arrayBuffer())}let g=0;for(const e in s){const t=s[e];g+=34+e.length;const i=63&g;if(4!==i){const a=new Uint8Array(64-i);s[e]=[t,{extra:{12345:a}}]}g=t.length}return rp(s,{level:0})}}function lp(e,t){let i=e.name;return i=i.replace(/[^A-Za-z0-9_]/g,""),/^[0-9]/.test(i)&&(i="_"+i),""===i&&(i=e.isCamera?"Camera":"Object"),t.has(i)&&(i=i+"_"+e.id),t.add(i),i}function cp(e,t,i){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=i/Math.max(e.width,e.height),a=document.createElement("canvas");a.width=e.width*Math.min(1,s),a.height=e.height*Math.min(1,s);const n=a.getContext("2d");return!0===t&&(n.translate(0,a.height),n.scale(1,-1)),n.drawImage(e,0,0,a.width,a.height),a}throw new Error("THREE.USDZExporter: No valid image data found. Unable to process texture.")}const hp=7;function dp(){return'#usda 1.0\n(\n\tcustomLayerData = {\n\t\tstring creator = "Three.js USDZExporter"\n\t}\n\tdefaultPrim = "Root"\n\tmetersPerUnit = 1\n\tupAxis = "Y"\n)\n'}function gp(e,t,i,s,a,n){for(let r=0,o=e.children.length;r<o;r++){const o=e.children[r];if(!1===o.visible&&!0===n.onlyVisible)continue;let A;if(o.isMesh){const e=o.geometry,t=o.material;if(t.isMeshStandardMaterial){const n="geometries/Geometry_"+e.id+".usda";if(!(n in a)){const t=fp(e);a[n]=sp(dp()+"\n"+t.toString())}t.uuid in i||(i[t.uuid]=t),A=pp(o,e,i[t.uuid],s)}else console.warn("THREE.USDZExporter: Unsupported material type (USDZ only supports MeshStandardMaterial)",o)}else A=o.isCamera?Bp(o,s):up(o,s);A&&(t.addChild(A),gp(o,A,i,s,a,n))}}function up(e,t){const i=lp(e,t);e.matrix.determinant()<0&&console.warn("THREE.USDZExporter: USDZ does not support negative scales",e);const s=new op(i,"Xform");if(null!==e.pivot){const t=e.position,i=e.quaternion,a=e.scale,n=e.pivot;s.addProperty(`float3 xformOp:translate = (${t.x.toPrecision(hp)}, ${t.y.toPrecision(hp)}, ${t.z.toPrecision(hp)})`),s.addProperty(`float3 xformOp:translate:pivot = (${n.x.toPrecision(hp)}, ${n.y.toPrecision(hp)}, ${n.z.toPrecision(hp)})`),s.addProperty(`quatf xformOp:orient = (${i.w.toPrecision(hp)}, ${i.x.toPrecision(hp)}, ${i.y.toPrecision(hp)}, ${i.z.toPrecision(hp)})`),s.addProperty(`float3 xformOp:scale = (${a.x.toPrecision(hp)}, ${a.y.toPrecision(hp)}, ${a.z.toPrecision(hp)})`),s.addProperty('uniform token[] xformOpOrder = ["xformOp:translate", "xformOp:translate:pivot", "xformOp:orient", "xformOp:scale", "!invert!xformOp:translate:pivot"]')}else{const t=mp(e.matrix);s.addProperty(`matrix4d xformOp:transform = ${t}`),s.addProperty('uniform token[] xformOpOrder = ["xformOp:transform"]')}return s}function pp(e,t,i,s){const a=up(e,s);return a.addMetadata("prepend references",`@./geometries/Geometry_${t.id}.usda@</Geometry>`),a.addMetadata("prepend apiSchemas",'["MaterialBindingAPI"]'),a.addProperty(`rel material:binding = </Materials/Material_${i.id}>`),a}function mp(e){const t=e.elements;return`( ${bp(t,0)}, ${bp(t,4)}, ${bp(t,8)}, ${bp(t,12)} )`}function bp(e,t){return`(${e[t+0]}, ${e[t+1]}, ${e[t+2]}, ${e[t+3]})`}function fp(e){const t=new op("Geometry"),i=function(e){const t="Geometry",i=e.attributes,s=i.position.count,a=new op(t,"Mesh");a.addProperty(`int[] faceVertexCounts = [${function(e){const t=null!==e.index?e.index.count:e.attributes.position.count;return Array(t/3).fill(3).join(", ")}(e)}]`),a.addProperty(`int[] faceVertexIndices = [${function(e){const t=e.index,i=[];if(null!==t)for(let e=0;e<t.count;e++)i.push(t.getX(e));else{const t=e.attributes.position.count;for(let e=0;e<t;e++)i.push(e)}return i.join(", ")}(e)}]`),a.addProperty(`normal3f[] normals = [${Ip(i.normal,s)}]`,['interpolation = "vertex"']),a.addProperty(`point3f[] points = [${Ip(i.position,s)}]`);for(let e=0;e<4;e++){const t=e>0?e:"",s=i["uv"+t];void 0!==s&&a.addProperty(`texCoord2f[] primvars:st${t} = [${Ep(s)}]`,['interpolation = "vertex"'])}const n=i.color;void 0!==n&&a.addProperty(`color3f[] primvars:displayColor = [${Ip(n,s)}]`,['interpolation = "vertex"']);return a.addProperty('uniform token subdivisionScheme = "none"'),a}(e);return t.addChild(i),t}function Ip(e,t){if(void 0===e)return console.warn("USDZExporter: Normals missing."),Array(t).fill("(0, 0, 0)").join(", ");const i=[];for(let t=0;t<e.count;t++){const s=e.getX(t),a=e.getY(t),n=e.getZ(t);i.push(`(${s.toPrecision(hp)}, ${a.toPrecision(hp)}, ${n.toPrecision(hp)})`)}return i.join(", ")}function Ep(e){const t=[];for(let i=0;i<e.count;i++){const s=e.getX(i),a=e.getY(i);t.push(`(${s.toPrecision(hp)}, ${1-a.toPrecision(hp)})`)}return t.join(", ")}function Cp(e,t,i=!1){const s=new op(`Material_${e.id}`,"Material");function a(s,a,n){const r=s.source.id+"_"+s.flipY;t[r]=s;const o=s.channel>0?"st"+s.channel:"st",A={1e3:"repeat",1001:"clamp",1002:"mirror"},l=s.repeat.clone(),c=s.offset.clone(),h=s.rotation,d=Math.sin(h),g=Math.cos(h);c.y=1-c.y-l.y,i?(c.x=c.x/l.x,c.y=c.y/l.y,c.x+=d/l.x,c.y+=g-1):(c.x+=d*l.x,c.y+=(1-g)*l.y);const u=new op(`PrimvarReader_${a}`,"Shader");u.addProperty('uniform token info:id = "UsdPrimvarReader_float2"'),u.addProperty("float2 inputs:fallback = (0.0, 0.0)"),u.addProperty(`string inputs:varname = "${o}"`),u.addProperty("float2 outputs:result");const p=new op(`Transform2d_${a}`,"Shader");p.addProperty('uniform token info:id = "UsdTransform2d"'),p.addProperty(`float2 inputs:in.connect = </Materials/Material_${e.id}/PrimvarReader_${a}.outputs:result>`),p.addProperty(`float inputs:rotation = ${(h*(180/Math.PI)).toFixed(hp)}`),p.addProperty(`float2 inputs:scale = ${wp(l)}`),p.addProperty(`float2 inputs:translation = ${wp(c)}`),p.addProperty("float2 outputs:result");const m=new op(`Texture_${s.id}_${a}`,"Shader");return m.addProperty('uniform token info:id = "UsdUVTexture"'),m.addProperty(`asset inputs:file = @textures/Texture_${r}.png@`),m.addProperty(`float2 inputs:st.connect = </Materials/Material_${e.id}/Transform2d_${a}.outputs:result>`),void 0!==n&&m.addProperty(`float4 inputs:scale = ${function(e){return`(${e.r}, ${e.g}, ${e.b}, 1.0)`}(n)}`),"normal"===a&&(m.addProperty("float4 inputs:scale = (2, 2, 2, 1)"),m.addProperty("float4 inputs:bias = (-1, -1, -1, 0)")),m.addProperty(`token inputs:sourceColorSpace = "${s.colorSpace===ye?"raw":"sRGB"}"`),m.addProperty(`token inputs:wrapS = "${A[s.wrapS]}"`),m.addProperty(`token inputs:wrapT = "${A[s.wrapT]}"`),m.addProperty("float outputs:r"),m.addProperty("float outputs:g"),m.addProperty("float outputs:b"),m.addProperty("float3 outputs:rgb"),(e.transparent||e.alphaTest>0)&&m.addProperty("float outputs:a"),[u,p,m]}e.side===V&&console.warn("THREE.USDZExporter: USDZ does not support double sided materials",e);const n=new op("PreviewSurface","Shader");if(n.addProperty('uniform token info:id = "UsdPreviewSurface"'),null!==e.map){n.addProperty(`color3f inputs:diffuseColor.connect = </Materials/Material_${e.id}/Texture_${e.map.id}_diffuse.outputs:rgb>`),e.transparent?n.addProperty(`float inputs:opacity.connect = </Materials/Material_${e.id}/Texture_${e.map.id}_diffuse.outputs:a>`):e.alphaTest>0&&(n.addProperty(`float inputs:opacity.connect = </Materials/Material_${e.id}/Texture_${e.map.id}_diffuse.outputs:a>`),n.addProperty(`float inputs:opacityThreshold = ${e.alphaTest}`));a(e.map,"diffuse",e.color).forEach(e=>s.addChild(e))}else n.addProperty(`color3f inputs:diffuseColor = ${yp(e.color)}`);if(null!==e.emissiveMap){n.addProperty(`color3f inputs:emissiveColor.connect = </Materials/Material_${e.id}/Texture_${e.emissiveMap.id}_emissive.outputs:rgb>`);const t=new p(e.emissive.r*e.emissiveIntensity,e.emissive.g*e.emissiveIntensity,e.emissive.b*e.emissiveIntensity);a(e.emissiveMap,"emissive",t).forEach(e=>s.addChild(e))}else e.emissive.getHex()>0&&n.addProperty(`color3f inputs:emissiveColor = ${yp(e.emissive)}`);if(null!==e.normalMap){n.addProperty(`normal3f inputs:normal.connect = </Materials/Material_${e.id}/Texture_${e.normalMap.id}_normal.outputs:rgb>`);a(e.normalMap,"normal").forEach(e=>s.addChild(e))}if(null!==e.aoMap){n.addProperty(`float inputs:occlusion.connect = </Materials/Material_${e.id}/Texture_${e.aoMap.id}_occlusion.outputs:r>`);const t=new p(e.aoMapIntensity,e.aoMapIntensity,e.aoMapIntensity);a(e.aoMap,"occlusion",t).forEach(e=>s.addChild(e))}if(null!==e.roughnessMap){n.addProperty(`float inputs:roughness.connect = </Materials/Material_${e.id}/Texture_${e.roughnessMap.id}_roughness.outputs:g>`);const t=new p(e.roughness,e.roughness,e.roughness);a(e.roughnessMap,"roughness",t).forEach(e=>s.addChild(e))}else n.addProperty(`float inputs:roughness = ${e.roughness}`);if(null!==e.metalnessMap){n.addProperty(`float inputs:metallic.connect = </Materials/Material_${e.id}/Texture_${e.metalnessMap.id}_metallic.outputs:b>`);const t=new p(e.metalness,e.metalness,e.metalness);a(e.metalnessMap,"metallic",t).forEach(e=>s.addChild(e))}else n.addProperty(`float inputs:metallic = ${e.metalness}`);if(null!==e.alphaMap){n.addProperty(`float inputs:opacity.connect = </Materials/Material_${e.id}/Texture_${e.alphaMap.id}_opacity.outputs:r>`),n.addProperty("float inputs:opacityThreshold = 0.0001");a(e.alphaMap,"opacity").forEach(e=>s.addChild(e))}else n.addProperty(`float inputs:opacity = ${e.opacity}`);if(e.isMeshPhysicalMaterial){if(null!==e.clearcoatMap){n.addProperty(`float inputs:clearcoat.connect = </Materials/Material_${e.id}/Texture_${e.clearcoatMap.id}_clearcoat.outputs:r>`);const t=new p(e.clearcoat,e.clearcoat,e.clearcoat);a(e.clearcoatMap,"clearcoat",t).forEach(e=>s.addChild(e))}else n.addProperty(`float inputs:clearcoat = ${e.clearcoat}`);if(null!==e.clearcoatRoughnessMap){n.addProperty(`float inputs:clearcoatRoughness.connect = </Materials/Material_${e.id}/Texture_${e.clearcoatRoughnessMap.id}_clearcoatRoughness.outputs:g>`);const t=new p(e.clearcoatRoughness,e.clearcoatRoughness,e.clearcoatRoughness);a(e.clearcoatRoughnessMap,"clearcoatRoughness",t).forEach(e=>s.addChild(e))}else n.addProperty(`float inputs:clearcoatRoughness = ${e.clearcoatRoughness}`);n.addProperty(`float inputs:ior = ${e.ior}`)}return n.addProperty("int inputs:useSpecularWorkflow = 0"),n.addProperty("token outputs:surface"),s.addChild(n),s.addProperty(`token outputs:surface.connect = </Materials/Material_${e.id}/PreviewSurface.outputs:surface>`),s}function yp(e){return`(${e.r}, ${e.g}, ${e.b})`}function wp(e){return`(${e.x}, ${e.y})`}function Bp(e,t){const i=lp(e,t),s=mp(e.matrix);e.matrix.determinant()<0&&console.warn("THREE.USDZExporter: USDZ does not support negative scales",e);const a=new op(i,"Camera");a.addProperty(`matrix4d xformOp:transform = ${s}`),a.addProperty('uniform token[] xformOpOrder = ["xformOp:transform"]');const n=e.isOrthographicCamera?"orthographic":"perspective";a.addProperty(`token projection = "${n}"`);const r=`(${e.near.toPrecision(hp)}, ${e.far.toPrecision(hp)})`;let o,A;if(a.addProperty(`float2 clippingRange = ${r}`),o=e.isOrthographicCamera?(10*(Math.abs(e.left)+Math.abs(e.right))).toPrecision(hp):e.getFilmWidth().toPrecision(hp),a.addProperty(`float horizontalAperture = ${o}`),A=e.isOrthographicCamera?(10*(Math.abs(e.top)+Math.abs(e.bottom))).toPrecision(hp):e.getFilmHeight().toPrecision(hp),a.addProperty(`float verticalAperture = ${A}`),e.isPerspectiveCamera){const t=e.getFocalLength().toPrecision(hp);a.addProperty(`float focalLength = ${t}`);const i=e.focus.toPrecision(hp);a.addProperty(`float focusDistance = ${i}`)}return a}
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
var xp=function(e,t,i,s){for(var a,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s,o=e.length-1;o>=0;o--)(a=e[o])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};let vp=!1,Sp=!1;const Qp="#model-viewer-no-ar-fallback",Mp=(Dp=["quick-look","scene-viewer","webxr","none"],e=>{try{const t=Mo(e),i=(t.length?t[0].terms:[]).filter(e=>e&&"ident"===e.type).map(e=>e.value).filter(e=>Dp.indexOf(e)>-1);return new Set(i)}catch(e){}return new Set});var Dp;const Rp="quick-look",Tp="scene-viewer",Fp="webxr",kp="none",Lp=Symbol("arButtonContainer"),Pp=Symbol("enterARWithWebXR"),_p=Symbol("openSceneViewer"),Up=Symbol("openIOSARQuickLook"),Gp=Symbol("canActivateAR"),Np=Symbol("arMode"),Op=Symbol("arModes"),qp=Symbol("arAnchor"),Hp=Symbol("preload"),jp=Symbol("onARButtonContainerClick"),zp=Symbol("onARStatus"),Kp=Symbol("onARTracking"),Vp=Symbol("onARTap"),Jp=Symbol("selectARMode"),Yp=Symbol("triggerLoad");
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
var Wp=function(e,t,i,s){for(var a,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s,o=e.length-1;o>=0;o--)(a=e[o])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};const Xp="auto",$p="auto",Zp="eager",em=Symbol("defaultProgressBarElement"),tm=Symbol("posterContainerElement"),im=Symbol("defaultPosterElement"),sm=Symbol("shouldDismissPoster"),am=Symbol("hidePoster"),nm=Symbol("modelIsRevealed"),rm=Symbol("updateProgressBar"),om=Symbol("ariaLabelCallToAction"),Am=Symbol("onProgress");
/* @license
 * Copyright 2019 Google LLC. All Rights Reserved.
 * Licensed under the Apache License, Version 2.0 (the 'License');
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an 'AS IS' BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
var lm=function(e,t,i,s){for(var a,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s,o=e.length-1;o>=0;o--)(a=e[o])&&(r=(n<3?a(r):n>3?a(t,i,r):a(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};const cm=Math.PI/32,hm={basis:[Uo(Qo(cm,"rad"))],keywords:{auto:[null]}},dm=Symbol("autoRotateStartTime"),gm=Symbol("radiansPerSecond"),um=Symbol("syncRotationRate"),pm=Symbol("onCameraChange"),mm=(e=>{var t,i,s;class a extends e{constructor(){super(...arguments),this[t]=new Map,this[i]=e=>{e.forEach(e=>{e instanceof MutationRecord&&"childList"!==e.type||(e.addedNodes.forEach(e=>{this[gu](e)}),e.removedNodes.forEach(e=>{this[uu](e)}),this[Hg]())})},this[s]=new MutationObserver(this[hu])}connectedCallback(){super.connectedCallback();for(let e=0;e<this.children.length;++e)this[gu](this.children[e]);const{ShadyDOM:e}=self;null==e?this[du].observe(this,{childList:!0}):this[du]=e.observeChildren(this,this[hu])}disconnectedCallback(){super.disconnectedCallback();const{ShadyDOM:e}=self;null==e?this[du].disconnect():e.unobserveChildren(this[du])}[(t=cu,i=hu,s=du,zg)](){super[zg]();const e=this[qg];e.forHotspots(t=>{e.updateHotspotAttachment(t),e.updateSurfaceHotspot(t)})}[jg](e,t){super[jg](e,t);const i=this[qg],{annotationRenderer:s}=i,a=i.getCamera();i.shouldRender()&&(i.animateSurfaceHotspots(),i.updateHotspotsVisibility(a.position),s.domElement.style.display="",s.render(i,a))}updateHotspot(e){const t=this[cu].get(e.name);null!=t&&(t.updatePosition(e.position),t.updateNormal(e.normal),t.surface=e.surface,void 0!==e.modelIndex&&null!==e.modelIndex&&(t.modelIndex=e.modelIndex),this[qg].updateSurfaceHotspot(t),this[Hg]())}queryHotspot(e){const t=this[cu].get(e);if(null==t)return null;const i=$g(t.position),s=$g(t.normal),a=t.facingCamera,n=this[qg],r=n.getCamera(),o=new S;o.setFromMatrixPosition(t.matrixWorld),o.project(r);const A=n.width/2,l=n.height/2;o.x=o.x*A+A,o.y=-o.y*l+l;const c=$g(new S(o.x,o.y,o.z));return Number.isFinite(c.x)&&Number.isFinite(c.y)?{position:i,normal:s,canvasPosition:c,facingCamera:a}:null}positionAndNormalFromPoint(e,t){const i=this[qg],s=i.getNDC(e,t),a=i.positionAndNormalFromPoint(s);if(null==a)return null;const n=a.worldToModel,r=$g(a.position.applyMatrix4(n)),o=$g(a.normal.transformDirection(n));let A=null;return null!=a.uv&&(A=Zg(a.uv)),{position:r,normal:o,uv:A,modelIndex:a.modelIndex}}surfaceFromPoint(e,t){const i=this[qg],s=i.getNDC(e,t);return i.surfaceFromPoint(s)}[gu](e){if(!(e instanceof HTMLElement&&0===e.slot.indexOf("hotspot")))return;let t=this[cu].get(e.slot);if(null!=t){t.increment();const i=e.dataset.visibilityAttribute;if(null!=i){const s=`data-${i}`;e.toggleAttribute(s,t.facingCamera)}e.dispatchEvent(new CustomEvent("hotspot-visibility",{detail:{visible:t.facingCamera}}))}else t=new Od({name:e.slot,position:e.dataset.position,normal:e.dataset.normal,surface:e.dataset.surface,modelIndex:null!=e.dataset.modelIndex?parseInt(e.dataset.modelIndex):null}),this[cu].set(e.slot,t),this[qg].addHotspot(t);this[qg].queueRender()}[uu](e){if(!(e instanceof HTMLElement))return;const t=this[cu].get(e.slot);t&&(t.decrement()&&(this[qg].removeHotspot(t),this[cu].delete(e.slot)),this[qg].queueRender())}}return a})((e=>{var t,i,s,a;class n extends e{constructor(){super(...arguments),this[t]=void 0,this[i]=[],this[s]=null,this[a]=null,this.variantName=null,this.orientation="0 0 0",this.scale="1 1 1"}get model(){return this[Dd]}get extraModels(){return this[Rd]}get availableVariants(){return this.model?this.model[yd]():[]}get originalGltfJson(){return this[Md]}[(t=Dd,i=Rd,s=Qd,a=Md,Td)](){return()=>{this[Hg]()}}[Fd](e){return e.colorSpace=l,e.wrapS=N,e.wrapT=N,new Eh(this[Td](),e)}async createTexture(e,t="image/png"){const{textureUtils:i}=this[Vg],s=await i.loadImage(e,this.withCredentials,t),a="image/ktx2"===t?"image/png":t;return s.userData.mimeType=a,this[Fd](s)}async createLottieTexture(e,t=1){const{textureUtils:i}=this[Vg],s=await i.loadLottie(e,t,this.withCredentials);return this[Fd](s)}createVideoTexture(e){const t=document.createElement("video");t.crossOrigin=this.withCredentials?"use-credentials":"anonymous",t.src=e,t.muted=!0,t.playsInline=!0,t.loop=!0,t.play();const i=new Pt(t);return this[Fd](i)}createCanvasTexture(){const e=document.createElement("canvas"),t=new ct(e);return this[Fd](t)}async updated(e){if(super.updated(e),e.has("variantName")){const e=this[Jg].beginActivity("variant-update");e(.1);const t=this[Dd],{variantName:i}=this;null!=t&&(await t[bd](i),this[Hg](),this.dispatchEvent(new CustomEvent("variant-applied"))),e(1)}if(e.has("orientation")||e.has("scale")){if(!this.loaded)return;const e=this[qg];e.applyTransform(),e.updateBoundingBox(),e.updateShadow(),this[Vg].arRenderer.onUpdateScene(),this[Hg]()}}[zg](){super[zg]();const{currentGLTFs:e}=this[qg],t=e.length>0?e[0]:null;if(null!=t){const{correlatedSceneGraph:e}=t;null!=e&&t!==this[Qd]&&(this[Dd]=new vd(e,this[Td]()),this[Md]=JSON.parse(JSON.stringify(e.gltf))),"variants"in t.userData&&this.requestUpdate("variantName")}this[Rd]=[];const i=Array.from(this.querySelectorAll("extra-model"));for(let t=1;t<e.length;t++){const s=e[t];if(null!=s&&null!=s.correlatedSceneGraph){const e=new vd(s.correlatedSceneGraph,this[Td]());this[Rd].push(e),i[t-1]&&(i[t-1].model=e)}}this[Qd]=t}async exportScene(e){const t=this[qg];return new Promise(async(i,s)=>{const a={binary:!0,onlyVisible:!0,maxTextureSize:1/0,includeCustomExtensions:!1,forceIndices:!1};Object.assign(a,e),a.animations=t.animations,a.truncateDrawRange=!0;const n=t.shadow;let r=!1;null!=n&&(r=n.visible,n.visible=!1),await this[Dd][md]();const o=(new Er).register(e=>new Eo(e));let A;if(o.setTextureUtils({decompress:(e,t)=>function(e,t=1/0,i=null){po||(po=new rt(2,2,1,1)),mo||(mo=new ot({uniforms:{blitTexture:new At(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 = sRGBTransferOETF( texture2D( blitTexture, vUv) );\n\t\t\t\t#else\n\t\t\t\tgl_FragColor = texture2D( blitTexture, vUv);\n\t\t\t\t#endif\n\t\t\t}"})),mo.uniforms.blitTexture.value=e,mo.defines.IS_SRGB=e.colorSpace==l,mo.needsUpdate=!0,bo||(bo=new X(po,mo),bo.frustumCulled=!1);const s=new se,a=new nt;a.add(bo),null===i&&(i=uo=new lt({antialias:!1}));const n=Math.min(e.image.width,t),r=Math.min(e.image.height,t);i.setSize(n,r),i.clear(),i.render(a,s);const o=document.createElement("canvas"),A=o.getContext("2d");o.width=n,o.height=r,A.drawImage(i.domElement,0,0,n,r);const c=new ct(o);return c.minFilter=e.minFilter,c.magFilter=e.magFilter,c.wrapS=e.wrapS,c.wrapT=e.wrapT,c.colorSpace=e.colorSpace,c.name=e.name,uo&&(uo.forceContextLoss(),uo.dispose(),uo=null),c}(e,null!=t?t:1/0,void 0)}),t.models.length>1){A=new R;for(const e of t.models)A.add(e)}else A=t.models[0];o.parse(A,e=>{if(t.models.length>1)for(const e of t.models)t.target.add(e);else t.target.add(t.models[0]);return i(new Blob([a.binary?e:JSON.stringify(e)],{type:a.binary?"application/octet-stream":"application/json"}))},()=>s("glTF export failed"),a),null!=n&&(n.visible=r)})}materialFromPoint(e,t){const i=this[qg],s=i.getNDC(e,t),a=i.hitFromPoint(s);if(null==a||null==a.face)return null;const n=this[Dd];if(null!=n){const e=n[fd](a);if(null!=e)return e}for(const e of this[Rd]){const t=e[fd](a);if(null!=t)return t}return null}}return Sd([ts({type:String,attribute:"variant-name"})],n.prototype,"variantName",void 0),Sd([ts({type:String,attribute:"orientation"})],n.prototype,"orientation",void 0),Sd([ts({type:String,attribute:"scale"})],n.prototype,"scale",void 0),n})((e=>{var t,i,s;class a extends e{constructor(){super(...arguments),this.autoRotate=!1,this.autoRotateDelay=3e3,this.rotationPerSecond="auto",this[t]=performance.now(),this[i]=0,this[s]=e=>{this.autoRotate&&"user-interaction"===e.detail.source&&(this[dm]=performance.now())}}connectedCallback(){super.connectedCallback(),this.addEventListener("camera-change",this[pm]),this[dm]=performance.now()}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("camera-change",this[pm]),this[dm]=performance.now()}updated(e){super.updated(e),e.has("autoRotate")&&(this[dm]=performance.now())}[(t=dm,i=gm,um)](e){this[gm]=e[0]}[jg](e,t){if(super[jg](e,t),!this.autoRotate||!this[Wg]()||this[Vg].isPresenting)return;const i=Math.min(t,e-this[dm]-this.autoRotateDelay);i>0&&(this[qg].yaw=this.turntableRotation+this[gm]*i*.001)}get turntableRotation(){return this[qg].yaw}resetTurntableRotation(e=0){this[qg].yaw=e}}return s=pm,lm([ts({type:Boolean,attribute:"auto-rotate"})],a.prototype,"autoRotate",void 0),lm([ts({type:Number,attribute:"auto-rotate-delay"})],a.prototype,"autoRotateDelay",void 0),lm([BA({intrinsics:hm,updateHandler:um}),ts({type:String,attribute:"rotation-per-second"})],a.prototype,"rotationPerSecond",void 0),a})((o=>{var A,l,c;class h extends o{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[A]=null,this[l]=null,this[c]=null}updated(o){var A;if(super.updated(o),o.has("shadowIntensity")&&(this[qg].setShadowIntensity(.5*this.shadowIntensity),this[Hg]()),o.has("shadowSoftness")&&(this[qg].setShadowSoftness(this.shadowSoftness),this[Hg]()),o.has("exposure")&&(this[qg].exposure=this.exposure,this[Hg]()),o.has("toneMapping")){const o=new Map([["aces",t],["agx",i],["reinhard",s],["cineon",a],["linear",n],["none",r]]);this[qg].toneMapping=null!==(A=o.get(this.toneMapping))&&void 0!==A?A:e,this[Hg]()}(o.has("environmentImage")||o.has("skyboxImage"))&&this[Xg]()&&this[vs](),o.has("skyboxHeight")&&(this[qg].setGroundedSkybox(),this[Hg]())}hasBakedShadow(){return this[qg].bakedShadows.size>0}async[(A=Bs,l=xs,c=Ss,vs)](){const{skyboxImage:e,environmentImage:t}=this;null!=this[Ss]&&(this[Ss](),this[Ss]=null);const{textureUtils:i}=this[Vg];if(null==i)return;const s=this[Jg].beginActivity("environment-update");try{const{environmentMap:a,skybox:n}=await i.generateEnvironmentMapAndSkybox(bs(e),t,e=>s(Cs(e,0,1)),this.withCredentials);this[Bs]!==a&&(this[Bs]=a,this.dispatchEvent(new CustomEvent("environment-change"))),this[xs]=null!=n?n.name===a.name?a:n:null,this[qg].setEnvironmentAndSkybox(this[Bs],this[xs])}catch(e){if(e instanceof Error)throw this[qg].setEnvironmentAndSkybox(null,null),e}finally{s(1)}}}return ws([ts({type:String,attribute:"environment-image"})],h.prototype,"environmentImage",void 0),ws([ts({type:String,attribute:"skybox-image"})],h.prototype,"skyboxImage",void 0),ws([ts({type:Number,attribute:"shadow-intensity"})],h.prototype,"shadowIntensity",void 0),ws([ts({type:Number,attribute:"shadow-softness"})],h.prototype,"shadowSoftness",void 0),ws([ts({type:Number})],h.prototype,"exposure",void 0),ws([ts({type:String,attribute:"tone-mapping"})],h.prototype,"toneMapping",void 0),ws([ts({type:String,attribute:"skybox-height"})],h.prototype,"skyboxHeight",void 0),h})((e=>{var t,i,s,a,n,r,o,A,l,c,h,d,g,u,p,m,b,f;class I extends e{constructor(){super(...arguments),this.cameraControls=!1,this.cameraOrbit=RA,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=kA,this.interactionPromptStyle=PA,this.orbitSensitivity=1,this.zoomSensitivity=1,this.panSensitivity=1,this.touchAction=_A,this.disableZoom=!1,this.disablePan=!1,this.disableTap=!1,this.interpolationDecay=50,this.a11y=null,this[t]=this.shadowRoot.querySelector(".interaction-prompt"),this[i]=this.shadowRoot.querySelector("#prompt"),this[s]=[this.shadowRoot.querySelector("#finger0"),this.shadowRoot.querySelector("#finger1")],this[a]=this.shadowRoot.querySelector(".pan-target"),this[n]=0,this[r]=1/0,this[o]=!1,this[A]=!1,this[l]=Ql.AUTOMATIC,this[c]=new Ml(this[qg].camera,this[Ng],this[qg]),this[h]=new bt,this[d]=!1,this[g]=!1,this[u]=!1,this[p]={},this[m]=()=>{const e=this[JA].changeSource;this[hl]=e,e===Ql.USER_INTERACTION&&(this[Al]=!0,this[ZA]())},this[b]=()=>{this[el](),this[Hg]();const e=this[JA].changeSource;this.dispatchEvent(new CustomEvent("camera-change",{detail:{source:e}}))},this[f]=e=>{this[Gg].classList.toggle("pointer-tumbling","pointer-change-start"===e.type)}}get inputSensitivity(){return this[JA].inputSensitivity}set inputSensitivity(e){this[JA].inputSensitivity=e}getCameraOrbit(){const{theta:e,phi:t,radius:i}=this[dl];return{theta:e,phi:t,radius:i,toString(){return`${this.theta}rad ${this.phi}rad ${this.radius}m`}}}getCameraTarget(){return $g(this[Vg].isPresenting?this[Vg].arRenderer.target:this[qg].getDynamicTarget())}getFieldOfView(){return this[JA].getFieldOfView()}getMinimumFieldOfView(){return this[JA].options.minimumFieldOfView}getMaximumFieldOfView(){return this[JA].options.maximumFieldOfView}getIdealAspect(){return this[qg].idealAspect}jumpCameraToGoal(){this[gl]=!0,this.requestUpdate(gl,!1)}resetInteractionPrompt(){this[cl]=0,this[ll]=1/0,this[Al]=!1,this[ol]=this.interactionPrompt===kA&&this.cameraControls}zoom(e){const t=new WheelEvent("wheel",{deltaY:-30*e});this[Ng].dispatchEvent(t)}connectedCallback(){super.connectedCallback(),this[JA].addEventListener("user-interaction",this[al]),this[JA].addEventListener("pointer-change-start",this[rl]),this[JA].addEventListener("pointer-change-end",this[rl])}disconnectedCallback(){super.disconnectedCallback(),this[JA].removeEventListener("user-interaction",this[al]),this[JA].removeEventListener("pointer-change-start",this[rl]),this[JA].removeEventListener("pointer-change-end",this[rl])}updated(e){super.updated(e);const t=this[JA],i=this[qg];if(e.has("cameraControls")&&(this.cameraControls?(t.enableInteraction(),this.interactionPrompt===kA&&(this[ol]=!0)):(t.disableInteraction(),this[ZA]()),this[Ng].setAttribute("aria-label",this[Tg])),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===kA&&this.cameraControls&&!this[Al]?this[ol]=!0:this[ZA]()),e.has("interactionPromptStyle")&&(this[XA].style.opacity=this.interactionPromptStyle==LA?"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),i.setTargetDamperDecayTime(this.interpolationDecay)),e.has("a11y")&&this[il](),!0===this[gl]&&Promise.resolve().then(()=>{t.jumpToGoal(),i.jumpToGoal(),this[nl](),this[gl]=!1})}async updateFraming(){const e=this[qg],t=e.adjustedFoV(e.framedFoVDeg);await e.updateFraming();const i=e.adjustedFoV(e.framedFoVDeg),s=this[JA].getFieldOfView()/t;this[JA].setFieldOfView(i*s),this[pl]=!0,this.requestUpdate("maxFieldOfView"),this.requestUpdate("fieldOfView"),this.requestUpdate("minCameraOrbit"),this.requestUpdate("maxCameraOrbit"),this.requestUpdate("cameraOrbit"),await this.updateComplete}interact(e,t,i){const s=this[Ng],a=this[$A];if("1"===a[0].style.opacity)return void console.warn("interact() failed because an existing interaction is running.");const n=new Array;n.push({x:SA(t.x),y:SA(t.y)});const r=[{x:n[0].x(0),y:n[0].y(0)}];null!=i&&(n.push({x:SA(i.x),y:SA(i.y)}),r.push({x:n[1].x(0),y:n[1].y(0)}));let o=performance.now();const{width:A,height:l}=this[qg],c=this.getBoundingClientRect(),h=e=>{for(const[t,i]of r.entries()){const{style:n}=a[t];n.transform=`translateX(${A*i.x}px) translateY(${l*i.y}px)`,"pointerdown"===e?n.opacity="1":"pointerup"===e&&(n.opacity="0");const r={pointerId:t-5678,pointerType:"touch",target:s,clientX:A*i.x+c.x,clientY:l*i.y+c.y,altKey:!0};s.dispatchEvent(new PointerEvent(e,r))}},d=()=>{const t=this[hl];if(t!==Ql.AUTOMATIC||!s.isConnected){for(const e of this[$A])e.style.opacity="0";return h("pointercancel"),this.dispatchEvent(new CustomEvent("interact-stopped",{detail:{source:t}})),void document.removeEventListener("visibilitychange",g)}const i=Math.min(1,(performance.now()-o)/e);for(const[e,t]of r.entries())t.x=n[e].x(i),t.y=n[e].y(i);h("pointermove"),i<1?requestAnimationFrame(d):(h("pointerup"),this.dispatchEvent(new CustomEvent("interact-stopped",{detail:{source:Ql.AUTOMATIC}})),document.removeEventListener("visibilitychange",g))},g=()=>{let e=0;"hidden"===document.visibilityState?e=performance.now()-o:o=performance.now()-e};document.addEventListener("visibilitychange",g),h("pointerdown"),this[hl]=Ql.AUTOMATIC,requestAnimationFrame(d)}[(t=WA,i=XA,s=$A,a=YA,n=cl,r=ll,o=Al,A=ol,l=hl,c=JA,h=dl,d=gl,g=ul,u=pl,p=tl,bl)](e){const t=this[JA],i=this[qg];i.framedFoVDeg=180*e[0]/Math.PI,t.changeSource=Ql.NONE,t.setFieldOfView(i.adjustedFoV(i.framedFoVDeg)),this[al]()}[ml](e){const t=this[JA];if(this[pl]){const{theta:t,phi:i}=this.getCameraOrbit();e[0]=t,e[1]=i,this[pl]=!1}t.changeSource=Ql.NONE,t.setOrbit(e[0],e[1],e[2]),this[al]()}[Il](e){this[JA].applyOptions({minimumAzimuthalAngle:e[0],minimumPolarAngle:e[1],minimumRadius:e[2]}),this.jumpCameraToGoal()}[El](e){this[JA].applyOptions({maximumAzimuthalAngle:e[0],maximumPolarAngle:e[1],maximumRadius:e[2]}),this[sl](e[2]),this.jumpCameraToGoal()}[Cl](e){this[JA].applyOptions({minimumFieldOfView:180*e[0]/Math.PI}),this.jumpCameraToGoal()}[yl](e){const t=this[qg].adjustedFoV(180*e[0]/Math.PI);this[JA].applyOptions({maximumFieldOfView:t}),this.jumpCameraToGoal()}[fl](e){var t;const[i,s,a]=e;this[Vg].isPresenting||this[qg].setTarget(i,s,a),this[JA].changeSource=Ql.NONE,null===(t=this[Vg].arRenderer)||void 0===t||t.updateTarget(),this[al]()}[jg](e,t){if(super[jg](e,t),this[Vg].isPresenting||!this[Wg]())return;const i=this[JA],s=this[qg],a=performance.now();if(this[ol]&&this.loaded&&a>this[Pg]+this.interactionPromptThreshold&&(this[ol]=!1,this[ll]=a,this[WA].classList.add("visible")),isFinite(this[ll])&&this.interactionPromptStyle===PA){const e=(a-this[ll])/5e3%1,t=MA(e),n=DA(e);if(this[XA].style.opacity=`${n}`,t!==this[cl]){const e=t*s.width*.05,a=(t-this[cl])*Math.PI/16;this[XA].style.transform=`translateX(${e}px)`,i.changeSource=Ql.AUTOMATIC,i.adjustOrbit(a,0,0),this[cl]=t}}const n=i.update(e,t),r=s.updateTarget(t);(n||r)&&this[nl]()}[ZA](){this[ol]=!1,this[WA].classList.remove("visible"),this[ll]=1/0}[sl](e){const t=Math.max(this[qg].farRadius(),e),i=Math.abs(2*t);this[JA].updateNearFar(0,i)}[el](){const{theta:e,phi:t}=this[JA].getCameraSpherical(this[dl]),i=(4+Math.floor((e%VA+KA)/jA))%4,s=Math.floor(t/zA),a=`${FA[s]}${TA[i]}`,n=a;n in this[tl]?this[Lg](this[tl][n]):this[Lg](`View from stage ${a}`)}get[Tg](){let e=". Use mouse, touch or arrow keys to move.";return"interaction-prompt"in this[tl]&&(e=`. ${this[tl]["interaction-prompt"]}`),super[Tg].replace(/\.$/,"")+(this.cameraControls?e:"")}async[Kg](e){const t=this[JA],i=this[qg],s=i.adjustedFoV(i.framedFoVDeg);super[Kg](e);const a=i.adjustedFoV(i.framedFoVDeg)/s,n=t.getFieldOfView()*(isFinite(a)?a:1);t.updateAspect(this[qg].aspect),this.requestUpdate("maxFieldOfView",this.maxFieldOfView),await this.updateComplete,this[JA].setFieldOfView(n),this.jumpCameraToGoal()}[zg](){super[zg](),this[ul]?this[pl]=!0:this[ul]=!0,this.requestUpdate("maxFieldOfView",this.maxFieldOfView),this.requestUpdate("fieldOfView",this.fieldOfView),this.requestUpdate("minCameraOrbit",this.minCameraOrbit),this.requestUpdate("maxCameraOrbit",this.maxCameraOrbit),this.requestUpdate("cameraOrbit",this.cameraOrbit),this.requestUpdate("cameraTarget",this.cameraTarget),this.jumpCameraToGoal()}[(m=al,b=nl,f=rl,il)](){if("string"==typeof this.a11y)if(this.a11y.startsWith("{"))try{this[tl]=JSON.parse(this.a11y)}catch(e){console.warn("Error parsing a11y JSON:",e)}else this.a11y.length>0?console.warn("Error not supported format, should be a JSON string:",this.a11y):this[tl]={};else"object"==typeof this.a11y&&null!=this.a11y?this[tl]=Object.assign({},this.a11y):this[tl]={};this[Ng].setAttribute("aria-label",this[Tg])}}return QA([ts({type:Boolean,attribute:"camera-controls"})],I.prototype,"cameraControls",void 0),QA([BA({intrinsics:NA,observeEffects:!0,updateHandler:ml}),ts({type:String,attribute:"camera-orbit",hasChanged:()=>!0})],I.prototype,"cameraOrbit",void 0),QA([BA({intrinsics:HA,observeEffects:!0,updateHandler:fl}),ts({type:String,attribute:"camera-target",hasChanged:()=>!0})],I.prototype,"cameraTarget",void 0),QA([BA({intrinsics:UA,observeEffects:!0,updateHandler:bl}),ts({type:String,attribute:"field-of-view",hasChanged:()=>!0})],I.prototype,"fieldOfView",void 0),QA([BA({intrinsics:OA,updateHandler:Il}),ts({type:String,attribute:"min-camera-orbit",hasChanged:()=>!0})],I.prototype,"minCameraOrbit",void 0),QA([BA({intrinsics:qA,updateHandler:El}),ts({type:String,attribute:"max-camera-orbit",hasChanged:()=>!0})],I.prototype,"maxCameraOrbit",void 0),QA([BA({intrinsics:GA,updateHandler:Cl}),ts({type:String,attribute:"min-field-of-view",hasChanged:()=>!0})],I.prototype,"minFieldOfView",void 0),QA([BA({intrinsics:UA,updateHandler:yl}),ts({type:String,attribute:"max-field-of-view",hasChanged:()=>!0})],I.prototype,"maxFieldOfView",void 0),QA([ts({type:Number,attribute:"interaction-prompt-threshold"})],I.prototype,"interactionPromptThreshold",void 0),QA([ts({type:String,attribute:"interaction-prompt"})],I.prototype,"interactionPrompt",void 0),QA([ts({type:String,attribute:"interaction-prompt-style"})],I.prototype,"interactionPromptStyle",void 0),QA([ts({type:Number,attribute:"orbit-sensitivity"})],I.prototype,"orbitSensitivity",void 0),QA([ts({type:Number,attribute:"zoom-sensitivity"})],I.prototype,"zoomSensitivity",void 0),QA([ts({type:Number,attribute:"pan-sensitivity"})],I.prototype,"panSensitivity",void 0),QA([ts({type:String,attribute:"touch-action"})],I.prototype,"touchAction",void 0),QA([ts({type:Boolean,attribute:"disable-zoom"})],I.prototype,"disableZoom",void 0),QA([ts({type:Boolean,attribute:"disable-pan"})],I.prototype,"disablePan",void 0),QA([ts({type:Boolean,attribute:"disable-tap"})],I.prototype,"disableTap",void 0),QA([ts({type:Number,attribute:"interpolation-decay"})],I.prototype,"interpolationDecay",void 0),QA([ts()],I.prototype,"a11y",void 0),I})((e=>{var t,i,s,a,n,r,o,A,l,c;class h extends e{constructor(){super(...arguments),this.ar=!1,this.arScale="auto",this.arUsdzMaxTextureSize="auto",this.arPlacement="floor",this.arModes="webxr scene-viewer quick-look",this.iosSrc=null,this.xrEnvironment=!1,this[t]=!1,this[i]=this.shadowRoot.querySelector(".ar-button"),this[s]=document.createElement("a"),this[a]=new Set,this[n]=kp,this[r]=!1,this[o]=e=>{e.preventDefault(),this.activateAR()},this[A]=({status:e})=>{e!==jl&&this[Vg].arRenderer.presentedScene!==this[qg]||(this.setAttribute("ar-status",e),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:e}})),e===jl?this.removeAttribute("ar-tracking"):e===zl&&this.setAttribute("ar-tracking",Jl))},this[l]=({status:e})=>{this.setAttribute("ar-tracking",e),this.dispatchEvent(new CustomEvent("ar-tracking",{detail:{status:e}}))},this[c]=e=>{"_apple_ar_quicklook_button_tapped"==e.data&&this.dispatchEvent(new CustomEvent("quick-look-button-tapped"))}}get canActivateAR(){return this[Np]!==kp}connectedCallback(){super.connectedCallback(),null!=this[Vg].arRenderer&&(this[Vg].arRenderer.addEventListener("status",this[zp]),this.setAttribute("ar-status",jl),this[Vg].arRenderer.addEventListener("tracking",this[Kp])),this[qp].addEventListener("message",this[Vp])}disconnectedCallback(){super.disconnectedCallback(),null!=this[Vg].arRenderer&&(this[Vg].arRenderer.removeEventListener("status",this[zp]),this[Vg].arRenderer.removeEventListener("tracking",this[Kp])),this[qp].removeEventListener("message",this[Vp])}update(e){super.update(e),e.has("arScale")&&(this[qg].canScale="fixed"!==this.arScale),e.has("arPlacement")&&(this[qg].updateShadow(),this[Hg]()),e.has("arModes")&&(this[Op]=Mp(this.arModes)),(e.has("ar")||e.has("arModes")||e.has("src")||e.has("iosSrc")||e.has("arUsdzMaxTextureSize"))&&this[Jp]()}async activateAR(){switch(this[Np]){case Rp:await this[Up]();break;case Fp:await this[Pp]();break;case Tp:await this[_p]();break;default:console.warn("No AR Mode can be activated. This is probably due to missing configuration or device capabilities")}}async[(t=Gp,i=Lp,s=qp,a=Op,n=Np,r=Hp,o=jp,A=zp,l=Kp,c=Vp,Jp)](){var e;let t=kp;if(this.ar){if(null!=this.src)for(const i of this[Op]){if("webxr"===i&&As&&!vp&&await this[Vg].arRenderer.supportsPresentation()){t=Fp;break}if("scene-viewer"===i&&!Sp&&(ps||navigator.userAgentData&&navigator.userAgentData.getHighEntropyValues&&(null===(e=(await navigator.userAgentData.getHighEntropyValues(["formFactor"])).formFactor)||void 0===e?void 0:e.includes("XR")))){t=Tp;break}if("quick-look"===i&&ms&&!us){t=Rp;break}}t===kp&&null!=this.iosSrc&&ms&&!us&&(t=Rp)}if(t!==kp)this[Lp].classList.add("enabled"),this[Lp].addEventListener("click",this[jp]);else if(this[Lp].classList.contains("enabled")){this[Lp].removeEventListener("click",this[jp]),this[Lp].classList.remove("enabled");const e=Vl;this.setAttribute("ar-status",e),this.dispatchEvent(new CustomEvent("ar-status",{detail:{status:e}}))}this[Np]=t}async[Pp](){await this[Yp]();try{this[Lp].removeEventListener("click",this[jp]);const{arRenderer:e}=this[Vg];e.placeOnWall="wall"===this.arPlacement,await e.present(this[qg],this.xrEnvironment)}catch(e){console.warn("Error while trying to present in AR with WebXR"),console.error(e),await this[Vg].arRenderer.stopPresenting(),vp=!0,console.warn("Falling back to next ar-mode"),await this[Jp](),this.activateAR()}finally{this[Jp]()}}async[Yp](){this.loaded||(this[Hp]=!0,this[_g](),await((e,t,i=null)=>new Promise(s=>{e.addEventListener(t,function a(n){i&&!i(n)||(s(n),e.removeEventListener(t,a))})}))(this,"load"),this[Hp]=!1)}[Xg](){return super[Xg]()||this[Hp]}async[_p](){const e=self.location.toString(),t=new URL(e),i=Array.from(this.querySelectorAll("extra-model")).map(e=>e.src).filter(e=>null!=e),s=this.src||i[0]||null;if(!s)return void console.warn("No src or extra-model provided for Scene Viewer fallback.");let a=new URL(s,e);a.hash&&(a.hash="");const n=new URLSearchParams(a.search);if(t.hash=Qp,n.set("mode","ar_preferred"),n.has("disable_occlusion")||n.set("disable_occlusion","true"),"fixed"===this.arScale&&n.set("resizable","false"),"wall"===this.arPlacement&&n.set("enable_vertical_placement","true"),n.has("sound")){const t=new URL(n.get("sound"),e);n.set("sound",t.toString())}if(n.has("link")){const t=new URL(n.get("link"),e);n.set("link",t.toString())}const r=`intent://arvr.google.com/scene-viewer/1.2?${n.toString()+"&file="+encodeURIComponent(a.toString())}#Intent;scheme=https;package=com.google.android.googlequicksearchbox;action=android.intent.action.VIEW;S.browser_fallback_url=${encodeURIComponent(t.toString())};end;`;self.addEventListener("hashchange",()=>{self.location.hash===Qp&&(Sp=!0,self.history.back(),console.warn("Error while trying to present in AR with Scene Viewer"),console.warn("Falling back to next ar-mode"),this[Jp]())},{once:!0}),this[qp].setAttribute("href",r),this[qp].click()}async[Up](){const e=!this.iosSrc;let t;this[Lp].classList.remove("enabled");try{t=e?await this.prepareUSDZ():this.iosSrc}catch(e){throw this[Lp].classList.add("enabled"),e}const i=new URL(t,self.location.toString());if(e){const e=self.location.toString(),t=new URL(e),s=Array.from(this.querySelectorAll("extra-model")).map(e=>e.src).filter(e=>null!=e),a=this.src||s[0]||null;if(a){const e=new URL(a,t);e.hash&&(i.hash=e.hash)}}"fixed"===this.arScale&&(i.hash&&(i.hash+="&"),i.hash+="allowsContentScaling=0");const s=this[qp];s.setAttribute("rel","ar");const a=document.createElement("img");s.appendChild(a),s.setAttribute("href",i.toString()),e&&s.setAttribute("download","model.usdz"),s.style.display="none",s.isConnected||this.shadowRoot.appendChild(s),s.click(),s.removeChild(a),e&&URL.revokeObjectURL(t),this[Lp].classList.add("enabled")}async prepareUSDZ(){const e=this[Jg].beginActivity("usdz-conversion");await this[Yp]();const{models:t,shadow:i,target:s}=this[qg];if(0===t.length||null==t[0])return"";let a=!1;null!=i&&(a=i.visible,i.visible=!1),e(.2);const n="wall"===this.arPlacement?{includeAnchoringProperties:!1}:{},r=new Ap,o=new R;o.position.copy(s.position);for(const e of t)s.remove(e),o.add(e);let A;o.updateWorldMatrix(!1,!0);try{A=await r.parseAsync(o,Object.assign(Object.assign({},n),{maxTextureSize:isNaN(this.arUsdzMaxTextureSize)?1/0:Math.max(parseInt(this.arUsdzMaxTextureSize),16)}))}finally{for(const e of t)o.remove(e),s.add(e);null!=i&&(i.visible=a),e(1)}const l=new Blob([A],{type:"model/vnd.usdz+zip"});return URL.createObjectURL(l)}}return xp([ts({type:Boolean,attribute:"ar"})],h.prototype,"ar",void 0),xp([ts({type:String,attribute:"ar-scale"})],h.prototype,"arScale",void 0),xp([ts({type:String,attribute:"ar-usdz-max-texture-size"})],h.prototype,"arUsdzMaxTextureSize",void 0),xp([ts({type:String,attribute:"ar-placement"})],h.prototype,"arPlacement",void 0),xp([ts({type:String,attribute:"ar-modes"})],h.prototype,"arModes",void 0),xp([ts({type:String,attribute:"ios-src"})],h.prototype,"iosSrc",void 0),xp([ts({type:Boolean,attribute:"xr-environment"})],h.prototype,"xrEnvironment",void 0),h})((e=>{var t,i,s,a,n,r,o,A;class l extends e{static set dracoDecoderLocation(e){cr.setDRACODecoderLocation(e)}static get dracoDecoderLocation(){return cr.getDRACODecoderLocation()}static set ktx2TranscoderLocation(e){cr.setKTX2TranscoderLocation(e)}static get ktx2TranscoderLocation(){return cr.getKTX2TranscoderLocation()}static set meshoptDecoderLocation(e){cr.setMeshoptDecoderLocation(e)}static get meshoptDecoderLocation(){return cr.getMeshoptDecoderLocation()}static set lottieLoaderLocation(e){Kc.singleton.textureUtils.lottieLoaderUrl=e}static get lottieLoaderLocation(){return Kc.singleton.textureUtils.lottieLoaderUrl}static mapURLs(e){Kc.singleton.loader[or].manager.setURLModifier(e)}dismissPoster(){this.loaded?this[am]():(this[sm]=!0,this[_g]())}showPoster(){const e=this[tm];if(e.classList.contains("show"))return;e.classList.add("show"),this[Ng].classList.remove("show");const t=this[im];t.removeAttribute("tabindex"),t.removeAttribute("aria-hidden");const i=this.modelIsVisible;this[nm]=!1,this[Rg](i)}getDimensions(){return this[qg].updateBoundingBoxAndShadowIfDirty(),$g(this[qg].size)}getBoundingBoxCenter(){return this[qg].updateBoundingBoxAndShadowIfDirty(),$g(this[qg].boundingBox.getCenter(new S))}constructor(...e){super(...e),this.poster=null,this.reveal=Xp,this.loading=$p,this[t]=!1,this[i]=!1,this[s]=this.shadowRoot.querySelector(".slot.poster"),this[a]=this.shadowRoot.querySelector("#default-poster"),this[n]=this.shadowRoot.querySelector("#default-progress-bar > .bar"),this[r]=this[im].getAttribute("aria-label"),this[o]=((e,t)=>{let i=null;const s=(...s)=>{null==i&&(e(...s),i=self.setTimeout(()=>i=null,t))};return s.flush=()=>{null!=i&&(self.clearTimeout(i),i=null)},s})(e=>{const t=this[em].parentNode;requestAnimationFrame(()=>{this[em].style.transform=`scaleX(${e})`,0===e&&(t.removeChild(this[em]),t.appendChild(this[em])),this[em].classList.toggle("hide",1===e)})},100),this[A]=e=>{const t=e.detail.totalProgress,i=e.detail.reason;1===t&&(this[rm].flush(),this.loaded&&(this[sm]||this.reveal===Xp)&&this[am]()),this[rm](t),this.dispatchEvent(new CustomEvent("progress",{detail:{totalProgress:t,reason:i}}))};const l=self.ModelViewerElement||{},c=l.dracoDecoderLocation||"https://www.gstatic.com/draco/versioned/decoders/1.5.6/";cr.setDRACODecoderLocation(c);const h=l.ktx2TranscoderLocation||"https://www.gstatic.com/basis-universal/versioned/2021-04-15-ba1c3e4/";cr.setKTX2TranscoderLocation(h),l.meshoptDecoderLocation&&cr.setMeshoptDecoderLocation(l.meshoptDecoderLocation);const d=l.lottieLoaderLocation||"https://cdn.jsdelivr.net/npm/three@0.149.0/examples/jsm/loaders/LottieLoader.js";null!=Kc.singleton.textureUtils&&(Kc.singleton.textureUtils.lottieLoaderUrl=d)}connectedCallback(){super.connectedCallback(),this.loaded||this.showPoster(),this[Jg].addEventListener("progress",this[Am])}disconnectedCallback(){super.disconnectedCallback(),this[Jg].removeEventListener("progress",this[Am])}async updated(e){super.updated(e),e.has("poster")&&null!=this.poster&&(this[im].style.backgroundImage=`url(${this.poster})`),e.has("alt")&&this[im].setAttribute("aria-label",this[Fg]),(e.has("reveal")||e.has("loading"))&&this[_g]()}[(t=nm,i=sm,s=tm,a=im,n=em,r=om,o=rm,A=Am,Xg)](){const e=Array.from(this.querySelectorAll("extra-model"));return!!(this.src||e.length>0)&&(this[sm]||this.loading===Zp||this.reveal===Xp&&this[Dg])}[am](){this[sm]=!1;const e=this[tm];if(!e.classList.contains("show"))return;e.classList.remove("show"),this[Ng].classList.add("show");const t=this.modelIsVisible;this[nm]=!0,this[Rg](t);const i=this.getRootNode();i&&i.activeElement===this&&this[Ng].focus();const s=this[im];s.setAttribute("aria-hidden","true"),s.tabIndex=-1,this.dispatchEvent(new CustomEvent("poster-dismissed"))}[Wg](){return super[Wg]()&&this[nm]}}return Wp([ts({type:String})],l.prototype,"poster",void 0),Wp([ts({type:String})],l.prototype,"reveal",void 0),Wp([ts({type:String})],l.prototype,"loading",void 0),l})((e=>{var t,i;class s extends e{constructor(...e){super(e),this.autoplay=!1,this.animationName=void 0,this.animationCrossfadeDuration=300,this[t]=!0,this[i]=ou,this[qg].subscribeMixerEvent("loop",e=>{const t=e.action._loopCount,i=e.action._clip.name,s=e.action._clip.uuid,a=this[qg].markedAnimations.find(e=>e.name===i);if(a){this[qg].updateAnimationLoop(a.name,a.loopMode,a.repetitionCount);const e=this[qg].markedAnimations.filter(e=>e.name!==i);this[qg].markedAnimations=e}this.dispatchEvent(new CustomEvent("loop",{detail:{count:t,name:i,uuid:s}}))}),this[qg].subscribeMixerEvent("finished",e=>{if(this[qg].appendedAnimations.includes(e.action._clip.name)){const t=this[qg].appendedAnimations.filter(t=>t!==e.action._clip.name);this[qg].appendedAnimations=t}else this[nu]=!0;this.dispatchEvent(new CustomEvent("finished"))})}get availableAnimations(){return this.loaded?this[qg].animationNames:[]}get duration(){return this[qg].duration}get paused(){return this[qg].isAllAnimationsPaused()}get currentTime(){return this[qg].animationTime}get appendedAnimations(){return this[qg].appendedAnimations}set currentTime(e){this[qg].animationTime=e,this[Hg]()}get timeScale(){return this[qg].animationTimeScale}set timeScale(e){this[qg].animationTimeScale=e}pause(e){var t;if(null==(null==e?void 0:e.modelIndex)&&this.paused)return;const i=null!==(t=null==e?void 0:e.modelIndex)&&void 0!==t?t:null;this[qg].pauseAnimation(i),this.dispatchEvent(new CustomEvent("pause"))}play(e){var t;if(this.availableAnimations.length>0){const i=null!==(t=null==e?void 0:e.modelIndex)&&void 0!==t?t:null;this[qg].unpauseAnimation(i),this[ru]=Object.assign(Object.assign({},ou),e),this[iu](this[ru]),this.dispatchEvent(new CustomEvent("play"))}}appendAnimation(e,t){var i;this.availableAnimations.length>0&&(this[nu]=!1,this[qg].unpauseAnimation(null!==(i=null==t?void 0:t.modelIndex)&&void 0!==i?i:null),this[su](e,t),this.dispatchEvent(new CustomEvent("append-animation")))}detachAnimation(e,t){var i;this.availableAnimations.length>0&&(this[nu]=!1,this[qg].unpauseAnimation(null!==(i=null==t?void 0:t.modelIndex)&&void 0!==i?i:null),this[au](e,t),this.dispatchEvent(new CustomEvent("detach-animation")))}[(t=nu,i=ru,zg)](){super[zg](),this[qg].pauseAnimation(),null!=this.animationName&&this[iu](),this.autoplay&&this.play()}[jg](e,t){super[jg](e,t),this.paused||!this[Wg]()&&!this[Vg].isPresenting||(this[qg].updateAnimation(t/1e3),this[Hg]())}updated(e){super.updated(e),e.has("autoplay")&&this.autoplay&&this.play(),e.has("animationName")&&this[iu]()}[iu](e){var t;const i=null!=e?e:this[ru],s=null!==(t=i.repetitions)&&void 0!==t?t:1/0,a=i.pingpong?Ot:1===s?jt:qt;this[qg].playAnimation(this.animationName,this.animationCrossfadeDuration/1e3,a,s,i.modelIndex),this[nu]&&(this[qg].updateAnimation(0),this[Hg]())}[su](e="",t={}){var i;const s=Object.assign(Object.assign({},Au),t),a=null!==(i=s.repetitions)&&void 0!==i?i:1/0,n=s.pingpong?Ot:1===a?jt:qt,r=!!t.repetitions||"pingpong"in t;this[qg].appendAnimation(e||this.animationName,n,a,s.weight,s.timeScale,s.fade,s.warp,s.relativeWarp,s.time,r,s.modelIndex),this[nu]&&(this[qg].updateAnimation(0),this[Hg]())}[au](e="",t={}){const i=Object.assign(Object.assign({},lu),t);this[qg].detachAnimation(e||this.animationName,i.fade,i.modelIndex),this[nu]&&(this[qg].updateAnimation(0),this[Hg]())}}return tu([ts({type:Boolean})],s.prototype,"autoplay",void 0),tu([ts({type:String,attribute:"animation-name"})],s.prototype,"animationName",void 0),tu([ts({type:Number,attribute:"animation-crossfade-duration"})],s.prototype,"animationCrossfadeDuration",void 0),s})(eu))))))));customElements.define("model-viewer",mm);export{mm as ModelViewerElement};
//# sourceMappingURL=model-viewer-module.min.js.map