@mappedin/mappedin-js 6.0.1-alpha.34 → 6.0.1-alpha.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/esm/index.js CHANGED
@@ -1 +1 @@
1
- import{a,b,c,d,e,f,g,h,i,j,k,l,m,o as n,p as o,q as p,r as q,s as r}from"./chunk-HZV2KXXK.js";import"./chunk-E5S56D7B.js";import"./chunk-ENEOOXQO.js";import"./chunk-CYBYPK2K.js";import"./chunk-LDHLD3E3.js";export{l as Annotation,h as Connection,c as Coordinate,e as Door,g as Floor,d as Hyperlink,j as Image,i as MapObject,k as PointOfInterest,f as Space,p as createMapLibreOverlay,m as enableTestMode,o as getMapData,n as hydrateMapDataFromMVF,a as parseMVF,r as show3dMap,q as show3dMapGeojson,b as unzipMVF};
1
+ import{a,b,c,d,e,f,g,h,i,j,k,l,m,o as n,p as o,q as p,r as q,s as r}from"./chunk-N6B6EOQT.js";import"./chunk-5QDDUDQO.js";import"./chunk-3A3IZSQH.js";import"./chunk-J3F43M4Z.js";import"./chunk-N7QS5LVF.js";export{l as Annotation,h as Connection,c as Coordinate,e as Door,g as Floor,d as Hyperlink,j as Image,i as MapObject,k as PointOfInterest,f as Space,p as createMapLibreOverlay,m as enableTestMode,o as getMapData,n as hydrateMapDataFromMVF,a as parseMVF,r as show3dMap,q as show3dMapGeojson,b as unzipMVF};
@@ -1,4 +1,4 @@
1
- import{c as N,n as X}from"./chunk-HZV2KXXK.js";import"./chunk-E5S56D7B.js";import"./chunk-ENEOOXQO.js";import{J as W}from"./chunk-CYBYPK2K.js";import{a as o,j as A}from"./chunk-LDHLD3E3.js";A();A();A();A();var E=class E{constructor(t,e,i,r,s="div"){this.parent=t,this.object=e,this.property=i,this._disabled=!1,this._hidden=!1,this.initialValue=this.getValue(),this.domElement=document.createElement(s),this.domElement.classList.add("controller"),this.domElement.classList.add(r),this.$name=document.createElement("div"),this.$name.classList.add("name"),E.nextNameID=E.nextNameID||0,this.$name.id=`lil-gui-name-${++E.nextNameID}`,this.$widget=document.createElement("div"),this.$widget.classList.add("widget"),this.$disable=this.$widget,this.domElement.appendChild(this.$name),this.domElement.appendChild(this.$widget),this.domElement.addEventListener("keydown",a=>a.stopPropagation()),this.domElement.addEventListener("keyup",a=>a.stopPropagation()),this.parent.children.push(this),this.parent.controllers.push(this),this.parent.$children.appendChild(this.domElement),this._listenCallback=this._listenCallback.bind(this),this.name(i)}name(t){return this._name=t,this.$name.textContent=t,this}onChange(t){return this._onChange=t,this}_callOnChange(){this.parent._callOnChange(this),this._onChange!==void 0&&this._onChange.call(this,this.getValue()),this._changed=!0}onFinishChange(t){return this._onFinishChange=t,this}_callOnFinishChange(){this._changed&&(this.parent._callOnFinishChange(this),this._onFinishChange!==void 0&&this._onFinishChange.call(this,this.getValue())),this._changed=!1}reset(){return this.setValue(this.initialValue),this._callOnFinishChange(),this}enable(t=!0){return this.disable(!t)}disable(t=!0){return t===this._disabled?this:(this._disabled=t,this.domElement.classList.toggle("disabled",t),this.$disable.toggleAttribute("disabled",t),this)}show(t=!0){return this._hidden=!t,this.domElement.style.display=this._hidden?"none":"",this}hide(){return this.show(!1)}options(t){let e=this.parent.add(this.object,this.property,t);return e.name(this._name),this.destroy(),e}min(t){return this}max(t){return this}step(t){return this}decimals(t){return this}listen(t=!0){return this._listening=t,this._listenCallbackID!==void 0&&(cancelAnimationFrame(this._listenCallbackID),this._listenCallbackID=void 0),this._listening&&this._listenCallback(),this}_listenCallback(){this._listenCallbackID=requestAnimationFrame(this._listenCallback);let t=this.save();t!==this._listenPrevValue&&this.updateDisplay(),this._listenPrevValue=t}getValue(){return this.object[this.property]}setValue(t){return this.getValue()!==t&&(this.object[this.property]=t,this._callOnChange(),this.updateDisplay()),this}updateDisplay(){return this}load(t){return this.setValue(t),this._callOnFinishChange(),this}save(){return this.getValue()}destroy(){this.listen(!1),this.parent.children.splice(this.parent.children.indexOf(this),1),this.parent.controllers.splice(this.parent.controllers.indexOf(this),1),this.parent.$children.removeChild(this.domElement)}};o(E,"Controller");var _=E,G=class G extends _{constructor(t,e,i){super(t,e,i,"boolean","label"),this.$input=document.createElement("input"),this.$input.setAttribute("type","checkbox"),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$widget.appendChild(this.$input),this.$input.addEventListener("change",()=>{this.setValue(this.$input.checked),this._callOnFinishChange()}),this.$disable=this.$input,this.updateDisplay()}updateDisplay(){return this.$input.checked=this.getValue(),this}};o(G,"BooleanController");var S=G;function F(n){let t,e;return(t=n.match(/(#|0x)?([a-f0-9]{6})/i))?e=t[2]:(t=n.match(/rgb\(\s*(\d*)\s*,\s*(\d*)\s*,\s*(\d*)\s*\)/))?e=parseInt(t[1]).toString(16).padStart(2,0)+parseInt(t[2]).toString(16).padStart(2,0)+parseInt(t[3]).toString(16).padStart(2,0):(t=n.match(/^#?([a-f0-9])([a-f0-9])([a-f0-9])$/i))&&(e=t[1]+t[1]+t[2]+t[2]+t[3]+t[3]),e?"#"+e:!1}o(F,"normalizeColorString");var dt={isPrimitive:!0,match:n=>typeof n=="string",fromHexString:F,toHexString:F},k={isPrimitive:!0,match:n=>typeof n=="number",fromHexString:n=>parseInt(n.substring(1),16),toHexString:n=>"#"+n.toString(16).padStart(6,0)},ht={isPrimitive:!1,match:n=>Array.isArray(n),fromHexString(n,t,e=1){let i=k.fromHexString(n);t[0]=(i>>16&255)/255*e,t[1]=(i>>8&255)/255*e,t[2]=(i&255)/255*e},toHexString([n,t,e],i=1){i=255/i;let r=n*i<<16^t*i<<8^e*i<<0;return k.toHexString(r)}},ct={isPrimitive:!1,match:n=>Object(n)===n,fromHexString(n,t,e=1){let i=k.fromHexString(n);t.r=(i>>16&255)/255*e,t.g=(i>>8&255)/255*e,t.b=(i&255)/255*e},toHexString({r:n,g:t,b:e},i=1){i=255/i;let r=n*i<<16^t*i<<8^e*i<<0;return k.toHexString(r)}},ut=[dt,k,ht,ct];function pt(n){return ut.find(t=>t.match(n))}o(pt,"getColorFormat");var H=class H extends _{constructor(t,e,i,r){super(t,e,i,"color"),this.$input=document.createElement("input"),this.$input.setAttribute("type","color"),this.$input.setAttribute("tabindex",-1),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$text=document.createElement("input"),this.$text.setAttribute("type","text"),this.$text.setAttribute("spellcheck","false"),this.$text.setAttribute("aria-labelledby",this.$name.id),this.$display=document.createElement("div"),this.$display.classList.add("display"),this.$display.appendChild(this.$input),this.$widget.appendChild(this.$display),this.$widget.appendChild(this.$text),this._format=pt(this.initialValue),this._rgbScale=r,this._initialValueHexString=this.save(),this._textFocused=!1,this.$input.addEventListener("input",()=>{this._setValueFromHexString(this.$input.value)}),this.$input.addEventListener("blur",()=>{this._callOnFinishChange()}),this.$text.addEventListener("input",()=>{let s=F(this.$text.value);s&&this._setValueFromHexString(s)}),this.$text.addEventListener("focus",()=>{this._textFocused=!0,this.$text.select()}),this.$text.addEventListener("blur",()=>{this._textFocused=!1,this.updateDisplay(),this._callOnFinishChange()}),this.$disable=this.$text,this.updateDisplay()}reset(){return this._setValueFromHexString(this._initialValueHexString),this}_setValueFromHexString(t){if(this._format.isPrimitive){let e=this._format.fromHexString(t);this.setValue(e)}else this._format.fromHexString(t,this.getValue(),this._rgbScale),this._callOnChange(),this.updateDisplay()}save(){return this._format.toHexString(this.getValue(),this._rgbScale)}load(t){return this._setValueFromHexString(t),this._callOnFinishChange(),this}updateDisplay(){return this.$input.value=this._format.toHexString(this.getValue(),this._rgbScale),this._textFocused||(this.$text.value=this.$input.value.substring(1)),this.$display.style.backgroundColor=this.$input.value,this}};o(H,"ColorController");var D=H,T=class T extends _{constructor(t,e,i){super(t,e,i,"function"),this.$button=document.createElement("button"),this.$button.appendChild(this.$name),this.$widget.appendChild(this.$button),this.$button.addEventListener("click",r=>{r.preventDefault(),this.getValue().call(this.object),this._callOnChange()}),this.$button.addEventListener("touchstart",()=>{},{passive:!0}),this.$disable=this.$button}};o(T,"FunctionController");var $=T,U=class U extends _{constructor(t,e,i,r,s,a){super(t,e,i,"number"),this._initInput(),this.min(r),this.max(s);let u=a!==void 0;this.step(u?a:this._getImplicitStep(),u),this.updateDisplay()}decimals(t){return this._decimals=t,this.updateDisplay(),this}min(t){return this._min=t,this._onUpdateMinMax(),this}max(t){return this._max=t,this._onUpdateMinMax(),this}step(t,e=!0){return this._step=t,this._stepExplicit=e,this}updateDisplay(){let t=this.getValue();if(this._hasSlider){let e=(t-this._min)/(this._max-this._min);e=Math.max(0,Math.min(e,1)),this.$fill.style.width=e*100+"%"}return this._inputFocused||(this.$input.value=this._decimals===void 0?t:t.toFixed(this._decimals)),this}_initInput(){this.$input=document.createElement("input"),this.$input.setAttribute("type","text"),this.$input.setAttribute("aria-labelledby",this.$name.id),window.matchMedia("(pointer: coarse)").matches&&(this.$input.setAttribute("type","number"),this.$input.setAttribute("step","any")),this.$widget.appendChild(this.$input),this.$disable=this.$input;let e=o(()=>{let h=parseFloat(this.$input.value);isNaN(h)||(this._stepExplicit&&(h=this._snap(h)),this.setValue(this._clamp(h)))},"onInput"),i=o(h=>{let x=parseFloat(this.$input.value);isNaN(x)||(this._snapClampSetValue(x+h),this.$input.value=this.getValue())},"increment"),r=o(h=>{h.key==="Enter"&&this.$input.blur(),h.code==="ArrowUp"&&(h.preventDefault(),i(this._step*this._arrowKeyMultiplier(h))),h.code==="ArrowDown"&&(h.preventDefault(),i(this._step*this._arrowKeyMultiplier(h)*-1))},"onKeyDown"),s=o(h=>{this._inputFocused&&(h.preventDefault(),i(this._step*this._normalizeMouseWheel(h)))},"onWheel"),a=!1,u,g,v,f,d,c=5,l=o(h=>{u=h.clientX,g=v=h.clientY,a=!0,f=this.getValue(),d=0,window.addEventListener("mousemove",p),window.addEventListener("mouseup",b)},"onMouseDown"),p=o(h=>{if(a){let x=h.clientX-u,L=h.clientY-g;Math.abs(L)>c?(h.preventDefault(),this.$input.blur(),a=!1,this._setDraggingStyle(!0,"vertical")):Math.abs(x)>c&&b()}if(!a){let x=h.clientY-v;d-=x*this._step*this._arrowKeyMultiplier(h),f+d>this._max?d=this._max-f:f+d<this._min&&(d=this._min-f),this._snapClampSetValue(f+d)}v=h.clientY},"onMouseMove"),b=o(()=>{this._setDraggingStyle(!1,"vertical"),this._callOnFinishChange(),window.removeEventListener("mousemove",p),window.removeEventListener("mouseup",b)},"onMouseUp"),y=o(()=>{this._inputFocused=!0},"onFocus"),m=o(()=>{this._inputFocused=!1,this.updateDisplay(),this._callOnFinishChange()},"onBlur");this.$input.addEventListener("input",e),this.$input.addEventListener("keydown",r),this.$input.addEventListener("wheel",s,{passive:!1}),this.$input.addEventListener("mousedown",l),this.$input.addEventListener("focus",y),this.$input.addEventListener("blur",m)}_initSlider(){this._hasSlider=!0,this.$slider=document.createElement("div"),this.$slider.classList.add("slider"),this.$fill=document.createElement("div"),this.$fill.classList.add("fill"),this.$slider.appendChild(this.$fill),this.$widget.insertBefore(this.$slider,this.$input),this.domElement.classList.add("hasSlider");let t=o((m,h,x,L,lt)=>(m-h)/(x-h)*(lt-L)+L,"map"),e=o(m=>{let h=this.$slider.getBoundingClientRect(),x=t(m,h.left,h.right,this._min,this._max);this._snapClampSetValue(x)},"setValueFromX"),i=o(m=>{this._setDraggingStyle(!0),e(m.clientX),window.addEventListener("mousemove",r),window.addEventListener("mouseup",s)},"mouseDown"),r=o(m=>{e(m.clientX)},"mouseMove"),s=o(()=>{this._callOnFinishChange(),this._setDraggingStyle(!1),window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",s)},"mouseUp"),a=!1,u,g,v=o(m=>{m.preventDefault(),this._setDraggingStyle(!0),e(m.touches[0].clientX),a=!1},"beginTouchDrag"),f=o(m=>{m.touches.length>1||(this._hasScrollBar?(u=m.touches[0].clientX,g=m.touches[0].clientY,a=!0):v(m),window.addEventListener("touchmove",d,{passive:!1}),window.addEventListener("touchend",c))},"onTouchStart"),d=o(m=>{if(a){let h=m.touches[0].clientX-u,x=m.touches[0].clientY-g;Math.abs(h)>Math.abs(x)?v(m):(window.removeEventListener("touchmove",d),window.removeEventListener("touchend",c))}else m.preventDefault(),e(m.touches[0].clientX)},"onTouchMove"),c=o(()=>{this._callOnFinishChange(),this._setDraggingStyle(!1),window.removeEventListener("touchmove",d),window.removeEventListener("touchend",c)},"onTouchEnd"),l=this._callOnFinishChange.bind(this),p=400,b,y=o(m=>{if(Math.abs(m.deltaX)<Math.abs(m.deltaY)&&this._hasScrollBar)return;m.preventDefault();let x=this._normalizeMouseWheel(m)*this._step;this._snapClampSetValue(this.getValue()+x),this.$input.value=this.getValue(),clearTimeout(b),b=setTimeout(l,p)},"onWheel");this.$slider.addEventListener("mousedown",i),this.$slider.addEventListener("touchstart",f,{passive:!1}),this.$slider.addEventListener("wheel",y,{passive:!1})}_setDraggingStyle(t,e="horizontal"){this.$slider&&this.$slider.classList.toggle("active",t),document.body.classList.toggle("lil-gui-dragging",t),document.body.classList.toggle(`lil-gui-${e}`,t)}_getImplicitStep(){return this._hasMin&&this._hasMax?(this._max-this._min)/1e3:.1}_onUpdateMinMax(){!this._hasSlider&&this._hasMin&&this._hasMax&&(this._stepExplicit||this.step(this._getImplicitStep(),!1),this._initSlider(),this.updateDisplay())}_normalizeMouseWheel(t){let{deltaX:e,deltaY:i}=t;return Math.floor(t.deltaY)!==t.deltaY&&t.wheelDelta&&(e=0,i=-t.wheelDelta/120,i*=this._stepExplicit?1:10),e+-i}_arrowKeyMultiplier(t){let e=this._stepExplicit?1:10;return t.shiftKey?e*=10:t.altKey&&(e/=10),e}_snap(t){let e=Math.round(t/this._step)*this._step;return parseFloat(e.toPrecision(15))}_clamp(t){return t<this._min&&(t=this._min),t>this._max&&(t=this._max),t}_snapClampSetValue(t){this.setValue(this._clamp(this._snap(t)))}get _hasScrollBar(){let t=this.parent.root.$children;return t.scrollHeight>t.clientHeight}get _hasMin(){return this._min!==void 0}get _hasMax(){return this._max!==void 0}};o(U,"NumberController");var I=U,V=class V extends _{constructor(t,e,i,r){super(t,e,i,"option"),this.$select=document.createElement("select"),this.$select.setAttribute("aria-labelledby",this.$name.id),this.$display=document.createElement("div"),this.$display.classList.add("display"),this.$select.addEventListener("change",()=>{this.setValue(this._values[this.$select.selectedIndex]),this._callOnFinishChange()}),this.$select.addEventListener("focus",()=>{this.$display.classList.add("focus")}),this.$select.addEventListener("blur",()=>{this.$display.classList.remove("focus")}),this.$widget.appendChild(this.$select),this.$widget.appendChild(this.$display),this.$disable=this.$select,this.options(r)}options(t){return this._values=Array.isArray(t)?t:Object.values(t),this._names=Array.isArray(t)?t:Object.keys(t),this.$select.replaceChildren(),this._names.forEach(e=>{let i=document.createElement("option");i.textContent=e,this.$select.appendChild(i)}),this.updateDisplay(),this}updateDisplay(){let t=this.getValue(),e=this._values.indexOf(t);return this.$select.selectedIndex=e,this.$display.textContent=e===-1?t:this._names[e],this}};o(V,"OptionController");var O=V,P=class P extends _{constructor(t,e,i){super(t,e,i,"string"),this.$input=document.createElement("input"),this.$input.setAttribute("type","text"),this.$input.setAttribute("spellcheck","false"),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$input.addEventListener("input",()=>{this.setValue(this.$input.value)}),this.$input.addEventListener("keydown",r=>{r.code==="Enter"&&this.$input.blur()}),this.$input.addEventListener("blur",()=>{this._callOnFinishChange()}),this.$widget.appendChild(this.$input),this.$disable=this.$input,this.updateDisplay()}updateDisplay(){return this.$input.value=this.getValue(),this}};o(P,"StringController");var z=P,gt=`.lil-gui {
1
+ import{c as W,n as R}from"./chunk-N6B6EOQT.js";import"./chunk-5QDDUDQO.js";import"./chunk-3A3IZSQH.js";import{J as X}from"./chunk-J3F43M4Z.js";import{a as o,j as y}from"./chunk-N7QS5LVF.js";y();y();y();y();var E=class E{constructor(t,e,i,r,s="div"){this.parent=t,this.object=e,this.property=i,this._disabled=!1,this._hidden=!1,this.initialValue=this.getValue(),this.domElement=document.createElement(s),this.domElement.classList.add("controller"),this.domElement.classList.add(r),this.$name=document.createElement("div"),this.$name.classList.add("name"),E.nextNameID=E.nextNameID||0,this.$name.id=`lil-gui-name-${++E.nextNameID}`,this.$widget=document.createElement("div"),this.$widget.classList.add("widget"),this.$disable=this.$widget,this.domElement.appendChild(this.$name),this.domElement.appendChild(this.$widget),this.domElement.addEventListener("keydown",a=>a.stopPropagation()),this.domElement.addEventListener("keyup",a=>a.stopPropagation()),this.parent.children.push(this),this.parent.controllers.push(this),this.parent.$children.appendChild(this.domElement),this._listenCallback=this._listenCallback.bind(this),this.name(i)}name(t){return this._name=t,this.$name.textContent=t,this}onChange(t){return this._onChange=t,this}_callOnChange(){this.parent._callOnChange(this),this._onChange!==void 0&&this._onChange.call(this,this.getValue()),this._changed=!0}onFinishChange(t){return this._onFinishChange=t,this}_callOnFinishChange(){this._changed&&(this.parent._callOnFinishChange(this),this._onFinishChange!==void 0&&this._onFinishChange.call(this,this.getValue())),this._changed=!1}reset(){return this.setValue(this.initialValue),this._callOnFinishChange(),this}enable(t=!0){return this.disable(!t)}disable(t=!0){return t===this._disabled?this:(this._disabled=t,this.domElement.classList.toggle("disabled",t),this.$disable.toggleAttribute("disabled",t),this)}show(t=!0){return this._hidden=!t,this.domElement.style.display=this._hidden?"none":"",this}hide(){return this.show(!1)}options(t){let e=this.parent.add(this.object,this.property,t);return e.name(this._name),this.destroy(),e}min(t){return this}max(t){return this}step(t){return this}decimals(t){return this}listen(t=!0){return this._listening=t,this._listenCallbackID!==void 0&&(cancelAnimationFrame(this._listenCallbackID),this._listenCallbackID=void 0),this._listening&&this._listenCallback(),this}_listenCallback(){this._listenCallbackID=requestAnimationFrame(this._listenCallback);let t=this.save();t!==this._listenPrevValue&&this.updateDisplay(),this._listenPrevValue=t}getValue(){return this.object[this.property]}setValue(t){return this.getValue()!==t&&(this.object[this.property]=t,this._callOnChange(),this.updateDisplay()),this}updateDisplay(){return this}load(t){return this.setValue(t),this._callOnFinishChange(),this}save(){return this.getValue()}destroy(){this.listen(!1),this.parent.children.splice(this.parent.children.indexOf(this),1),this.parent.controllers.splice(this.parent.controllers.indexOf(this),1),this.parent.$children.removeChild(this.domElement)}};o(E,"Controller");var _=E,G=class G extends _{constructor(t,e,i){super(t,e,i,"boolean","label"),this.$input=document.createElement("input"),this.$input.setAttribute("type","checkbox"),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$widget.appendChild(this.$input),this.$input.addEventListener("change",()=>{this.setValue(this.$input.checked),this._callOnFinishChange()}),this.$disable=this.$input,this.updateDisplay()}updateDisplay(){return this.$input.checked=this.getValue(),this}};o(G,"BooleanController");var M=G;function I(n){let t,e;return(t=n.match(/(#|0x)?([a-f0-9]{6})/i))?e=t[2]:(t=n.match(/rgb\(\s*(\d*)\s*,\s*(\d*)\s*,\s*(\d*)\s*\)/))?e=parseInt(t[1]).toString(16).padStart(2,0)+parseInt(t[2]).toString(16).padStart(2,0)+parseInt(t[3]).toString(16).padStart(2,0):(t=n.match(/^#?([a-f0-9])([a-f0-9])([a-f0-9])$/i))&&(e=t[1]+t[1]+t[2]+t[2]+t[3]+t[3]),e?"#"+e:!1}o(I,"normalizeColorString");var ht={isPrimitive:!0,match:n=>typeof n=="string",fromHexString:I,toHexString:I},k={isPrimitive:!0,match:n=>typeof n=="number",fromHexString:n=>parseInt(n.substring(1),16),toHexString:n=>"#"+n.toString(16).padStart(6,0)},ct={isPrimitive:!1,match:n=>Array.isArray(n),fromHexString(n,t,e=1){let i=k.fromHexString(n);t[0]=(i>>16&255)/255*e,t[1]=(i>>8&255)/255*e,t[2]=(i&255)/255*e},toHexString([n,t,e],i=1){i=255/i;let r=n*i<<16^t*i<<8^e*i<<0;return k.toHexString(r)}},ut={isPrimitive:!1,match:n=>Object(n)===n,fromHexString(n,t,e=1){let i=k.fromHexString(n);t.r=(i>>16&255)/255*e,t.g=(i>>8&255)/255*e,t.b=(i&255)/255*e},toHexString({r:n,g:t,b:e},i=1){i=255/i;let r=n*i<<16^t*i<<8^e*i<<0;return k.toHexString(r)}},pt=[ht,k,ct,ut];function gt(n){return pt.find(t=>t.match(n))}o(gt,"getColorFormat");var H=class H extends _{constructor(t,e,i,r){super(t,e,i,"color"),this.$input=document.createElement("input"),this.$input.setAttribute("type","color"),this.$input.setAttribute("tabindex",-1),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$text=document.createElement("input"),this.$text.setAttribute("type","text"),this.$text.setAttribute("spellcheck","false"),this.$text.setAttribute("aria-labelledby",this.$name.id),this.$display=document.createElement("div"),this.$display.classList.add("display"),this.$display.appendChild(this.$input),this.$widget.appendChild(this.$display),this.$widget.appendChild(this.$text),this._format=gt(this.initialValue),this._rgbScale=r,this._initialValueHexString=this.save(),this._textFocused=!1,this.$input.addEventListener("input",()=>{this._setValueFromHexString(this.$input.value)}),this.$input.addEventListener("blur",()=>{this._callOnFinishChange()}),this.$text.addEventListener("input",()=>{let s=I(this.$text.value);s&&this._setValueFromHexString(s)}),this.$text.addEventListener("focus",()=>{this._textFocused=!0,this.$text.select()}),this.$text.addEventListener("blur",()=>{this._textFocused=!1,this.updateDisplay(),this._callOnFinishChange()}),this.$disable=this.$text,this.updateDisplay()}reset(){return this._setValueFromHexString(this._initialValueHexString),this}_setValueFromHexString(t){if(this._format.isPrimitive){let e=this._format.fromHexString(t);this.setValue(e)}else this._format.fromHexString(t,this.getValue(),this._rgbScale),this._callOnChange(),this.updateDisplay()}save(){return this._format.toHexString(this.getValue(),this._rgbScale)}load(t){return this._setValueFromHexString(t),this._callOnFinishChange(),this}updateDisplay(){return this.$input.value=this._format.toHexString(this.getValue(),this._rgbScale),this._textFocused||(this.$text.value=this.$input.value.substring(1)),this.$display.style.backgroundColor=this.$input.value,this}};o(H,"ColorController");var F=H,V=class V extends _{constructor(t,e,i){super(t,e,i,"function"),this.$button=document.createElement("button"),this.$button.appendChild(this.$name),this.$widget.appendChild(this.$button),this.$button.addEventListener("click",r=>{r.preventDefault(),this.getValue().call(this.object),this._callOnChange()}),this.$button.addEventListener("touchstart",()=>{},{passive:!0}),this.$disable=this.$button}};o(V,"FunctionController");var $=V,T=class T extends _{constructor(t,e,i,r,s,a){super(t,e,i,"number"),this._initInput(),this.min(r),this.max(s);let u=a!==void 0;this.step(u?a:this._getImplicitStep(),u),this.updateDisplay()}decimals(t){return this._decimals=t,this.updateDisplay(),this}min(t){return this._min=t,this._onUpdateMinMax(),this}max(t){return this._max=t,this._onUpdateMinMax(),this}step(t,e=!0){return this._step=t,this._stepExplicit=e,this}updateDisplay(){let t=this.getValue();if(this._hasSlider){let e=(t-this._min)/(this._max-this._min);e=Math.max(0,Math.min(e,1)),this.$fill.style.width=e*100+"%"}return this._inputFocused||(this.$input.value=this._decimals===void 0?t:t.toFixed(this._decimals)),this}_initInput(){this.$input=document.createElement("input"),this.$input.setAttribute("type","text"),this.$input.setAttribute("aria-labelledby",this.$name.id),window.matchMedia("(pointer: coarse)").matches&&(this.$input.setAttribute("type","number"),this.$input.setAttribute("step","any")),this.$widget.appendChild(this.$input),this.$disable=this.$input;let e=o(()=>{let p=parseFloat(this.$input.value);isNaN(p)||(this._stepExplicit&&(p=this._snap(p)),this.setValue(this._clamp(p)))},"onInput"),i=o(p=>{let C=parseFloat(this.$input.value);isNaN(C)||(this._snapClampSetValue(C+p),this.$input.value=this.getValue())},"increment"),r=o(p=>{p.key==="Enter"&&this.$input.blur(),p.code==="ArrowUp"&&(p.preventDefault(),i(this._step*this._arrowKeyMultiplier(p))),p.code==="ArrowDown"&&(p.preventDefault(),i(this._step*this._arrowKeyMultiplier(p)*-1))},"onKeyDown"),s=o(p=>{this._inputFocused&&(p.preventDefault(),i(this._step*this._normalizeMouseWheel(p)))},"onWheel"),a=!1,u,g,b,f,c,d=5,l=o(p=>{u=p.clientX,g=b=p.clientY,a=!0,f=this.getValue(),c=0,window.addEventListener("mousemove",h),window.addEventListener("mouseup",v)},"onMouseDown"),h=o(p=>{if(a){let C=p.clientX-u,L=p.clientY-g;Math.abs(L)>d?(p.preventDefault(),this.$input.blur(),a=!1,this._setDraggingStyle(!0,"vertical")):Math.abs(C)>d&&v()}if(!a){let C=p.clientY-b;c-=C*this._step*this._arrowKeyMultiplier(p),f+c>this._max?c=this._max-f:f+c<this._min&&(c=this._min-f),this._snapClampSetValue(f+c)}b=p.clientY},"onMouseMove"),v=o(()=>{this._setDraggingStyle(!1,"vertical"),this._callOnFinishChange(),window.removeEventListener("mousemove",h),window.removeEventListener("mouseup",v)},"onMouseUp"),A=o(()=>{this._inputFocused=!0},"onFocus"),m=o(()=>{this._inputFocused=!1,this.updateDisplay(),this._callOnFinishChange()},"onBlur");this.$input.addEventListener("input",e),this.$input.addEventListener("keydown",r),this.$input.addEventListener("wheel",s,{passive:!1}),this.$input.addEventListener("mousedown",l),this.$input.addEventListener("focus",A),this.$input.addEventListener("blur",m)}_initSlider(){this._hasSlider=!0,this.$slider=document.createElement("div"),this.$slider.classList.add("slider"),this.$fill=document.createElement("div"),this.$fill.classList.add("fill"),this.$slider.appendChild(this.$fill),this.$widget.insertBefore(this.$slider,this.$input),this.domElement.classList.add("hasSlider");let t=o((m,p,C,L,dt)=>(m-p)/(C-p)*(dt-L)+L,"map"),e=o(m=>{let p=this.$slider.getBoundingClientRect(),C=t(m,p.left,p.right,this._min,this._max);this._snapClampSetValue(C)},"setValueFromX"),i=o(m=>{this._setDraggingStyle(!0),e(m.clientX),window.addEventListener("mousemove",r),window.addEventListener("mouseup",s)},"mouseDown"),r=o(m=>{e(m.clientX)},"mouseMove"),s=o(()=>{this._callOnFinishChange(),this._setDraggingStyle(!1),window.removeEventListener("mousemove",r),window.removeEventListener("mouseup",s)},"mouseUp"),a=!1,u,g,b=o(m=>{m.preventDefault(),this._setDraggingStyle(!0),e(m.touches[0].clientX),a=!1},"beginTouchDrag"),f=o(m=>{m.touches.length>1||(this._hasScrollBar?(u=m.touches[0].clientX,g=m.touches[0].clientY,a=!0):b(m),window.addEventListener("touchmove",c,{passive:!1}),window.addEventListener("touchend",d))},"onTouchStart"),c=o(m=>{if(a){let p=m.touches[0].clientX-u,C=m.touches[0].clientY-g;Math.abs(p)>Math.abs(C)?b(m):(window.removeEventListener("touchmove",c),window.removeEventListener("touchend",d))}else m.preventDefault(),e(m.touches[0].clientX)},"onTouchMove"),d=o(()=>{this._callOnFinishChange(),this._setDraggingStyle(!1),window.removeEventListener("touchmove",c),window.removeEventListener("touchend",d)},"onTouchEnd"),l=this._callOnFinishChange.bind(this),h=400,v,A=o(m=>{if(Math.abs(m.deltaX)<Math.abs(m.deltaY)&&this._hasScrollBar)return;m.preventDefault();let C=this._normalizeMouseWheel(m)*this._step;this._snapClampSetValue(this.getValue()+C),this.$input.value=this.getValue(),clearTimeout(v),v=setTimeout(l,h)},"onWheel");this.$slider.addEventListener("mousedown",i),this.$slider.addEventListener("touchstart",f,{passive:!1}),this.$slider.addEventListener("wheel",A,{passive:!1})}_setDraggingStyle(t,e="horizontal"){this.$slider&&this.$slider.classList.toggle("active",t),document.body.classList.toggle("lil-gui-dragging",t),document.body.classList.toggle(`lil-gui-${e}`,t)}_getImplicitStep(){return this._hasMin&&this._hasMax?(this._max-this._min)/1e3:.1}_onUpdateMinMax(){!this._hasSlider&&this._hasMin&&this._hasMax&&(this._stepExplicit||this.step(this._getImplicitStep(),!1),this._initSlider(),this.updateDisplay())}_normalizeMouseWheel(t){let{deltaX:e,deltaY:i}=t;return Math.floor(t.deltaY)!==t.deltaY&&t.wheelDelta&&(e=0,i=-t.wheelDelta/120,i*=this._stepExplicit?1:10),e+-i}_arrowKeyMultiplier(t){let e=this._stepExplicit?1:10;return t.shiftKey?e*=10:t.altKey&&(e/=10),e}_snap(t){let e=Math.round(t/this._step)*this._step;return parseFloat(e.toPrecision(15))}_clamp(t){return t<this._min&&(t=this._min),t>this._max&&(t=this._max),t}_snapClampSetValue(t){this.setValue(this._clamp(this._snap(t)))}get _hasScrollBar(){let t=this.parent.root.$children;return t.scrollHeight>t.clientHeight}get _hasMin(){return this._min!==void 0}get _hasMax(){return this._max!==void 0}};o(T,"NumberController");var D=T,U=class U extends _{constructor(t,e,i,r){super(t,e,i,"option"),this.$select=document.createElement("select"),this.$select.setAttribute("aria-labelledby",this.$name.id),this.$display=document.createElement("div"),this.$display.classList.add("display"),this.$select.addEventListener("change",()=>{this.setValue(this._values[this.$select.selectedIndex]),this._callOnFinishChange()}),this.$select.addEventListener("focus",()=>{this.$display.classList.add("focus")}),this.$select.addEventListener("blur",()=>{this.$display.classList.remove("focus")}),this.$widget.appendChild(this.$select),this.$widget.appendChild(this.$display),this.$disable=this.$select,this.options(r)}options(t){return this._values=Array.isArray(t)?t:Object.values(t),this._names=Array.isArray(t)?t:Object.keys(t),this.$select.replaceChildren(),this._names.forEach(e=>{let i=document.createElement("option");i.textContent=e,this.$select.appendChild(i)}),this.updateDisplay(),this}updateDisplay(){let t=this.getValue(),e=this._values.indexOf(t);return this.$select.selectedIndex=e,this.$display.textContent=e===-1?t:this._names[e],this}};o(U,"OptionController");var O=U,P=class P extends _{constructor(t,e,i){super(t,e,i,"string"),this.$input=document.createElement("input"),this.$input.setAttribute("type","text"),this.$input.setAttribute("spellcheck","false"),this.$input.setAttribute("aria-labelledby",this.$name.id),this.$input.addEventListener("input",()=>{this.setValue(this.$input.value)}),this.$input.addEventListener("keydown",r=>{r.code==="Enter"&&this.$input.blur()}),this.$input.addEventListener("blur",()=>{this._callOnFinishChange()}),this.$widget.appendChild(this.$input),this.$disable=this.$input,this.updateDisplay()}updateDisplay(){return this.$input.value=this.getValue(),this}};o(P,"StringController");var z=P,mt=`.lil-gui {
2
2
  font-family: var(--font-family);
3
3
  font-size: var(--font-size);
4
4
  line-height: 1;
@@ -419,7 +419,7 @@ import{c as N,n as X}from"./chunk-HZV2KXXK.js";import"./chunk-E5S56D7B.js";impor
419
419
  @font-face {
420
420
  font-family: "lil-gui";
421
421
  src: url("data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAAUsAAsAAAAACJwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAAH4AAADAImwmYE9TLzIAAAGIAAAAPwAAAGBKqH5SY21hcAAAAcgAAAD0AAACrukyyJBnbHlmAAACvAAAAF8AAACEIZpWH2hlYWQAAAMcAAAAJwAAADZfcj2zaGhlYQAAA0QAAAAYAAAAJAC5AHhobXR4AAADXAAAABAAAABMAZAAAGxvY2EAAANsAAAAFAAAACgCEgIybWF4cAAAA4AAAAAeAAAAIAEfABJuYW1lAAADoAAAASIAAAIK9SUU/XBvc3QAAATEAAAAZgAAAJCTcMc2eJxVjbEOgjAURU+hFRBK1dGRL+ALnAiToyMLEzFpnPz/eAshwSa97517c/MwwJmeB9kwPl+0cf5+uGPZXsqPu4nvZabcSZldZ6kfyWnomFY/eScKqZNWupKJO6kXN3K9uCVoL7iInPr1X5baXs3tjuMqCtzEuagm/AAlzQgPAAB4nGNgYRBlnMDAysDAYM/gBiT5oLQBAwuDJAMDEwMrMwNWEJDmmsJwgCFeXZghBcjlZMgFCzOiKOIFAB71Bb8AeJy1kjFuwkAQRZ+DwRAwBtNQRUGKQ8OdKCAWUhAgKLhIuAsVSpWz5Bbkj3dEgYiUIszqWdpZe+Z7/wB1oCYmIoboiwiLT2WjKl/jscrHfGg/pKdMkyklC5Zs2LEfHYpjcRoPzme9MWWmk3dWbK9ObkWkikOetJ554fWyoEsmdSlt+uR0pCJR34b6t/TVg1SY3sYvdf8vuiKrpyaDXDISiegp17p7579Gp3p++y7HPAiY9pmTibljrr85qSidtlg4+l25GLCaS8e6rRxNBmsnERunKbaOObRz7N72ju5vdAjYpBXHgJylOAVsMseDAPEP8LYoUHicY2BiAAEfhiAGJgZWBgZ7RnFRdnVJELCQlBSRlATJMoLV2DK4glSYs6ubq5vbKrJLSbGrgEmovDuDJVhe3VzcXFwNLCOILB/C4IuQ1xTn5FPilBTj5FPmBAB4WwoqAHicY2BkYGAA4sk1sR/j+W2+MnAzpDBgAyEMQUCSg4EJxAEAwUgFHgB4nGNgZGBgSGFggJMhDIwMqEAYAByHATJ4nGNgAIIUNEwmAABl3AGReJxjYAACIQYlBiMGJ3wQAEcQBEV4nGNgZGBgEGZgY2BiAAEQyQWEDAz/wXwGAAsPATIAAHicXdBNSsNAHAXwl35iA0UQXYnMShfS9GPZA7T7LgIu03SSpkwzYTIt1BN4Ak/gKTyAeCxfw39jZkjymzcvAwmAW/wgwHUEGDb36+jQQ3GXGot79L24jxCP4gHzF/EIr4jEIe7wxhOC3g2TMYy4Q7+Lu/SHuEd/ivt4wJd4wPxbPEKMX3GI5+DJFGaSn4qNzk8mcbKSR6xdXdhSzaOZJGtdapd4vVPbi6rP+cL7TGXOHtXKll4bY1Xl7EGnPtp7Xy2n00zyKLVHfkHBa4IcJ2oD3cgggWvt/V/FbDrUlEUJhTn/0azVWbNTNr0Ens8de1tceK9xZmfB1CPjOmPH4kitmvOubcNpmVTN3oFJyjzCvnmrwhJTzqzVj9jiSX911FjeAAB4nG3HMRKCMBBA0f0giiKi4DU8k0V2GWbIZDOh4PoWWvq6J5V8If9NVNQcaDhyouXMhY4rPTcG7jwYmXhKq8Wz+p762aNaeYXom2n3m2dLTVgsrCgFJ7OTmIkYbwIbC6vIB7WmFfAAAA==") format("woff");
422
- }`;function mt(n){let t=document.createElement("style");t.innerHTML=n;let e=document.querySelector("head link[rel=stylesheet], head style");e?document.head.insertBefore(t,e):document.head.appendChild(t)}o(mt,"_injectStyles");var R=!1,M=class M{constructor({parent:t,autoPlace:e=t===void 0,container:i,width:r,title:s="Controls",closeFolders:a=!1,injectStyles:u=!0,touchStyles:g=!0}={}){if(this.parent=t,this.root=t?t.root:this,this.children=[],this.controllers=[],this.folders=[],this._closed=!1,this._hidden=!1,this.domElement=document.createElement("div"),this.domElement.classList.add("lil-gui"),this.$title=document.createElement("div"),this.$title.classList.add("title"),this.$title.setAttribute("role","button"),this.$title.setAttribute("aria-expanded",!0),this.$title.setAttribute("tabindex",0),this.$title.addEventListener("click",()=>this.openAnimated(this._closed)),this.$title.addEventListener("keydown",v=>{(v.code==="Enter"||v.code==="Space")&&(v.preventDefault(),this.$title.click())}),this.$title.addEventListener("touchstart",()=>{},{passive:!0}),this.$children=document.createElement("div"),this.$children.classList.add("children"),this.domElement.appendChild(this.$title),this.domElement.appendChild(this.$children),this.title(s),this.parent){this.parent.children.push(this),this.parent.folders.push(this),this.parent.$children.appendChild(this.domElement);return}this.domElement.classList.add("root"),g&&this.domElement.classList.add("allow-touch-styles"),!R&&u&&(mt(gt),R=!0),i?i.appendChild(this.domElement):e&&(this.domElement.classList.add("autoPlace"),document.body.appendChild(this.domElement)),r&&this.domElement.style.setProperty("--width",r+"px"),this._closeFolders=a}add(t,e,i,r,s){if(Object(i)===i)return new O(this,t,e,i);let a=t[e];switch(typeof a){case"number":return new I(this,t,e,i,r,s);case"boolean":return new S(this,t,e);case"string":return new z(this,t,e);case"function":return new $(this,t,e)}console.error(`gui.add failed
422
+ }`;function ft(n){let t=document.createElement("style");t.innerHTML=n;let e=document.querySelector("head link[rel=stylesheet], head style");e?document.head.insertBefore(t,e):document.head.appendChild(t)}o(ft,"_injectStyles");var K=!1,S=class S{constructor({parent:t,autoPlace:e=t===void 0,container:i,width:r,title:s="Controls",closeFolders:a=!1,injectStyles:u=!0,touchStyles:g=!0}={}){if(this.parent=t,this.root=t?t.root:this,this.children=[],this.controllers=[],this.folders=[],this._closed=!1,this._hidden=!1,this.domElement=document.createElement("div"),this.domElement.classList.add("lil-gui"),this.$title=document.createElement("div"),this.$title.classList.add("title"),this.$title.setAttribute("role","button"),this.$title.setAttribute("aria-expanded",!0),this.$title.setAttribute("tabindex",0),this.$title.addEventListener("click",()=>this.openAnimated(this._closed)),this.$title.addEventListener("keydown",b=>{(b.code==="Enter"||b.code==="Space")&&(b.preventDefault(),this.$title.click())}),this.$title.addEventListener("touchstart",()=>{},{passive:!0}),this.$children=document.createElement("div"),this.$children.classList.add("children"),this.domElement.appendChild(this.$title),this.domElement.appendChild(this.$children),this.title(s),this.parent){this.parent.children.push(this),this.parent.folders.push(this),this.parent.$children.appendChild(this.domElement);return}this.domElement.classList.add("root"),g&&this.domElement.classList.add("allow-touch-styles"),!K&&u&&(ft(mt),K=!0),i?i.appendChild(this.domElement):e&&(this.domElement.classList.add("autoPlace"),document.body.appendChild(this.domElement)),r&&this.domElement.style.setProperty("--width",r+"px"),this._closeFolders=a}add(t,e,i,r,s){if(Object(i)===i)return new O(this,t,e,i);let a=t[e];switch(typeof a){case"number":return new D(this,t,e,i,r,s);case"boolean":return new M(this,t,e);case"string":return new z(this,t,e);case"function":return new $(this,t,e)}console.error(`gui.add failed
423
423
  property:`,e,`
424
424
  object:`,t,`
425
- value:`,a)}addColor(t,e,i=1){return new D(this,t,e,i)}addFolder(t){let e=new M({parent:this,title:t});return this.root._closeFolders&&e.close(),e}load(t,e=!0){return t.controllers&&this.controllers.forEach(i=>{i instanceof $||i._name in t.controllers&&i.load(t.controllers[i._name])}),e&&t.folders&&this.folders.forEach(i=>{i._title in t.folders&&i.load(t.folders[i._title])}),this}save(t=!0){let e={controllers:{},folders:{}};return this.controllers.forEach(i=>{if(!(i instanceof $)){if(i._name in e.controllers)throw new Error(`Cannot save GUI with duplicate property "${i._name}"`);e.controllers[i._name]=i.save()}}),t&&this.folders.forEach(i=>{if(i._title in e.folders)throw new Error(`Cannot save GUI with duplicate folder "${i._title}"`);e.folders[i._title]=i.save()}),e}open(t=!0){return this._setClosed(!t),this.$title.setAttribute("aria-expanded",!this._closed),this.domElement.classList.toggle("closed",this._closed),this}close(){return this.open(!1)}_setClosed(t){this._closed!==t&&(this._closed=t,this._callOnOpenClose(this))}show(t=!0){return this._hidden=!t,this.domElement.style.display=this._hidden?"none":"",this}hide(){return this.show(!1)}openAnimated(t=!0){return this._setClosed(!t),this.$title.setAttribute("aria-expanded",!this._closed),requestAnimationFrame(()=>{let e=this.$children.clientHeight;this.$children.style.height=e+"px",this.domElement.classList.add("transition");let i=o(s=>{s.target===this.$children&&(this.$children.style.height="",this.domElement.classList.remove("transition"),this.$children.removeEventListener("transitionend",i))},"onTransitionEnd");this.$children.addEventListener("transitionend",i);let r=t?this.$children.scrollHeight:0;this.domElement.classList.toggle("closed",!t),requestAnimationFrame(()=>{this.$children.style.height=r+"px"})}),this}title(t){return this._title=t,this.$title.textContent=t,this}reset(t=!0){return(t?this.controllersRecursive():this.controllers).forEach(i=>i.reset()),this}onChange(t){return this._onChange=t,this}_callOnChange(t){this.parent&&this.parent._callOnChange(t),this._onChange!==void 0&&this._onChange.call(this,{object:t.object,property:t.property,value:t.getValue(),controller:t})}onFinishChange(t){return this._onFinishChange=t,this}_callOnFinishChange(t){this.parent&&this.parent._callOnFinishChange(t),this._onFinishChange!==void 0&&this._onFinishChange.call(this,{object:t.object,property:t.property,value:t.getValue(),controller:t})}onOpenClose(t){return this._onOpenClose=t,this}_callOnOpenClose(t){this.parent&&this.parent._callOnOpenClose(t),this._onOpenClose!==void 0&&this._onOpenClose.call(this,t)}destroy(){this.parent&&(this.parent.children.splice(this.parent.children.indexOf(this),1),this.parent.folders.splice(this.parent.folders.indexOf(this),1)),this.domElement.parentElement&&this.domElement.parentElement.removeChild(this.domElement),Array.from(this.children).forEach(t=>t.destroy())}controllersRecursive(){let t=Array.from(this.controllers);return this.folders.forEach(e=>{t=t.concat(e.controllersRecursive())}),t}foldersRecursive(){let t=Array.from(this.folders);return this.folders.forEach(e=>{t=t.concat(e.foldersRecursive())}),t}};o(M,"GUI");var B=M,K=B;A();A();var C=(()=>{let n=new W;return o(function(e){return n.set(e),`#${n.getHexString()}`},"normalize")})();function Z(n){let t;for(t of n)t()}o(Z,"runAll");function Q(n,t){let e=window.location.href,i=new URL(e),r=new URLSearchParams(i.search);for(let s in n)if(n.hasOwnProperty(s)){let a=`${t}.${s}`;r.set(a,n[s])}i.search=r.toString(),history.pushState({path:i.toString()},"",i.toString())}o(Q,"updateCurrentUrlParamsWithNamespace");function q(n,t){let e=new URLSearchParams(window.location.search),i={};for(let[r,s]of e)if(r.startsWith(`${n}.`)){let a=r.slice(n.length+1);s==="true"||s==="false"?i[a]=s==="true":typeof t[a]=="number"?i[a]=Number(s):i[a]=s}return{namespace:n,params:i}}o(q,"getUrlParamsWithNamespace");function tt(n,t,e){let i={labels:{},all(){e.Labels.all().forEach(l=>{this.labels[l.id]=l}),g()},removeAllLabels(){e.Labels.removeAll().forEach(l=>{delete this.labels[l.id]}),g()}},{addLabel:r,destroy:s}=ft(n,e);n.add(i,"all"),n.add(i,"removeAllLabels");let a=n.addFolder("Label List");n.close();let u=new Map,{rerender:g}=v();function v(){function c(b){var y;delete i.labels[b.id],(y=u.get(b.id))==null||y.destroy()}o(c,"remove");function l(b){let y=j(e,b,a,{onRemove:h=>{c(h)}});if(!y)return;let{labelItemFolder:m}=y;u.set(b.id,m)}o(l,"add");function p(){a.destroy(),a=n.addFolder("Label");for(let b in i.labels){let y=i.labels[b];l(y)}}return o(p,"rerender"),{rerender:p,add:l,remove:c}}o(v,"createLabelControls"),n.domElement.classList.add("list-items");let f;e.on("click",({labels:c,coordinate:l})=>{if(!n._closed)if(c[0]){f==null||f.close();let p=u.get(c[0].id);if(n.open(),!p)return;p==null||p.open(),p==null||p.domElement.scrollIntoView({block:"start"}),p==null||p.domElement.focus(),f=p}else r(l)});function d(c){for(let l of c)i.labels[l.id]=l;g()}return o(d,"populatelabels"),{populatelabels:d,destroy(){s()}}}o(tt,"createLabelControls");function j(n,t,e,{onRemove:i}={}){var v,f,d;let r=e.addFolder(`${t.text.substring(0,8)}`);r.onChange(c=>{n.updateState(t,{appearance:g.appearance,interactive:g.interactive})}),r.close();let s=n.getState(t);if((s==null?void 0:s.type)!=="label")throw new Error(`error getting state for label: ${t.id}`);let{appearance:a,interactive:u}=s;if(!a||a.margin==null||u==null)throw new Error("incomplte label state");let g={text:t.text,interactive:u,appearance:{...a,margin:a.margin||0,marker:{foregroundColor:(f=(v=a.marker)==null?void 0:v.foregroundColor)!=null&&f.active?C((d=a.marker.foregroundColor)==null?void 0:d.active):"black"},text:{foregroundColor:C(a.text.foregroundColor)}},remove(){n.Labels.remove(t),i==null||i(t),r.destroy()}};return r.add(g.appearance,"margin",0,20).name("margin"),r.add(g,"text"),r.add(g,"interactive"),r.addColor(g.appearance.marker,"foregroundColor").name("marker foreground"),r.addColor(g.appearance.text,"foregroundColor").name("text forground"),r.add(g,"remove"),{labelItemFolder:r,destroy(){r.destroy()}}}o(j,"addLabelControlToFolder");function ft(n,t){let e=n.addFolder("Add"),i={onClick:!1,margin:0,text:"New Label!",interactive:!0,marginForegroundColor:C("skyblue"),marginBackgroundColor:C("coral"),textForegroundColor:C("slategray"),textBackgroundColor:C("white")};return e.add(i,"onClick"),e.add(i,"margin"),e.add(i,"interactive"),e.add(i,"text"),e.addColor(i,"marginForegroundColor"),e.addColor(i,"marginBackgroundColor"),e.addColor(i,"textForegroundColor"),e.addColor(i,"textBackgroundColor"),{destroy(){e.destroy()},addLabel(r){return e._closed||!i.onClick?void 0:t.Labels.add(r,i.text,{appearance:{margin:i.margin,marker:{foregroundColor:{active:i.marginForegroundColor,inactive:i.marginForegroundColor},backgroundColor:{active:i.marginBackgroundColor,inactive:i.marginBackgroundColor}},text:{foregroundColor:i.textForegroundColor,backgroundColor:i.marginBackgroundColor}},interactive:i.interactive})}}}o(ft,"createAddControl");A();function et(n,t){t.domElement.id="interactionPanel";let e=t.addFolder("Click \u{1F447}");vt(n,e);let i=t.addFolder("Hover \u{1F681}");yt(n,i)}o(et,"createInteractionControls");function vt(n,t){let e={position:"",hoverColor:C(n.getHoverColor())},i=t.add(e,"position").disable(),r=[];function s(){r.forEach(a=>a()),r.length=0}o(s,"reset"),n.on("click",a=>{var f;let{labels:u,coordinate:g}=a;if(s(),i.load(JSON.stringify([g.longitude,g.latitude])),u[0]){let d=j(n,u[0],t);if(!d)return;r.push(d.destroy),d.labelItemFolder.openAnimated()}let v=(f=a.spaces[0])!=null?f:a.objects[0];if(v){let{cleanup:d}=At(n,{id:v.id,...n.getState(v.id),type:v.type},t);r.push(d)}})}o(vt,"createClickControls");var bt=["interactive"];function At(n,t,e){let i=e.addFolder(`${t.type}-${t.id}`);for(let r in t){if(r==="visible"&&i.add(t,r).onChange(s=>{n.updateState(t.id,{[r]:s})}),r==="color"||r==="hoverColor"){t[r]=C(t[r]),i.addColor(t,r).onChange(s=>{n.updateState(t.id,{[r]:s})});continue}if(r==="height"){i.add(t,r,0,20,1).onChange(s=>{n.updateState(t.id,{[r]:s})});continue}bt.includes(r)&&i.add(t,r).onChange(s=>{n.updateState(t.id,{[r]:s})})}return{cleanup(){i.destroy()}}}o(At,"renderByProp");function yt(n,t){n.setHoverColor("#1f3a7a");let e={position:"",hoverColor:C(n.getHoverColor()),intersected:""},i=t.add(e,"position").disable();t.addColor(e,"hoverColor").onChange(a=>{n.setHoverColor(a)});let r=[];function s(){r.forEach(a=>a()),r.length=0}o(s,"reset"),n.on("hover",({coordinate:a})=>{s(),i.load(JSON.stringify([a.longitude,a.latitude]))})}o(yt,"createHoverControls");var it={};A();function nt(n,t){let e=n.addFolder("Camera \u{1F4F7}").close(),i=t.Camera.center.toJSON(),r=document.createElement("div");Object.assign(r.style,{display:"none",position:"absolute",left:"0px",top:"0px",bottom:"0px",right:"0px",backgroundColor:"aqua",pointerEvents:"none",opacity:.5,zIndex:99999}),document.body.appendChild(r);let s={center_lat:i.latitude,center_lon:i.longitude,zoomLevel:t.Camera.zoomLevel,pitch:t.Camera.pitch,bearing:t.Camera.bearing,minZoomLevel:t.Camera.minZoomLevel,maxZoomLevel:t.Camera.maxZoomLevel,inset_top:0,inset_left:0,inset_right:0,inset_bottom:0,animateOnLoad:!0,share:()=>{Q(e.save().controllers,"camera"),navigator.clipboard.writeText(window.location.href)},visualizeInset:!1};function a(){Object.assign(r.style,{left:s.inset_left+"px",top:s.inset_top+"px",bottom:s.inset_bottom+"px",right:s.inset_right+"px"})}o(a,"updateInsetVisualizer"),e.add(s,"center_lat").listen().disable(),e.add(s,"center_lon").listen().disable(),e.add(s,"zoomLevel",16,22,.5).listen().disable(),e.add(s,"pitch").listen().disable(),e.add(s,"bearing").listen().disable(),e.add(s,"minZoomLevel",5,22,.5).onChange(l=>{t.Camera.setMinZoomLevel(l)}),e.add(s,"maxZoomLevel",10,22,.5).onChange(l=>{t.Camera.setMaxZoomLevel(l)}),e.add(s,"animateOnLoad"),e.add(s,"visualizeInset").onChange(l=>{l?r.style.display="block":r.style.display="none"});let{innerHeight:u,innerWidth:g}=window;e.add(s,"inset_top",0,u,1).onChange(c),e.add(s,"inset_bottom",0,u,1).onChange(c),e.add(s,"inset_left",0,g,1).onChange(c),e.add(s,"inset_right",0,g,1).onChange(c),e.add(s,"share");let v=o(l=>{e._closed||(s.center_lat=l.center.latitude,s.center_lon=l.center.longitude,s.zoomLevel=l.zoomLevel,s.bearing=l.bearing,s.pitch=l.pitch)},"onCameraChanged");t.on("camera-change",v);let{params:f}=q("camera",s);if(Object.keys(f).length>0){let l=f;t.Camera.setScreenOffsets({top:l.inset_top,left:l.inset_left,right:l.inset_right,bottom:l.inset_bottom});let p={pitch:l.pitch,center:new N(l.center_lat,l.center_lon),bearing:l.bearing,zoomLevel:l.zoomLevel};l.animateOnLoad?t.Camera.animateTo(p):t.Camera.set(p),e.load({controllers:l,folders:{}}),a()}let d=[()=>{t.off("camera-change",v)}];function c(){t.Camera.setScreenOffsets({top:s.inset_top,left:s.inset_left,right:s.inset_right,bottom:s.inset_bottom}),a()}return o(c,"updateInset"),()=>({destroy(){e.destroy(),Z(d)}})}o(nt,"createCameraControls");A();function rt(n,t,e){let i={markers:{},removeAllMarkers(){e.Markers.removeAll().forEach(l=>{delete this.markers[l.id]}),g()}},{addMarker:r,destroy:s}=wt(n,e);n.add(i,"removeAllMarkers");let a=n.addFolder("Marker List");n.close();let u=new Map,{rerender:g}=v();function v(){function c(b){var y;delete i.markers[b.id],(y=u.get(b.id))==null||y.destroy()}o(c,"remove");function l(b){let y=Ct(e,b,a,{onRemove:h=>{c(h)}});if(!y)return;let{markerItemFolder:m}=y;u.set(b.id,m)}o(l,"add");function p(){a.destroy(),a=n.addFolder("marker");for(let b in i.markers){let y=i.markers[b];l(y)}}return o(p,"rerender"),{rerender:p,add:l,remove:c}}o(v,"createMarkerControls"),n.domElement.classList.add("list-items");let f;e.on("click",({markers:c,coordinate:l})=>{if(!n._closed)if(c[0]){f==null||f.close();let p=u.get(c[0].id);if(n.open(),!p)return;p==null||p.open(),p==null||p.domElement.scrollIntoView({block:"start"}),p==null||p.domElement.focus(),f=p}else r(l)});function d(c){for(let l of c)i.markers[l.id]=l;g()}return o(d,"populateMarkers"),{populateMarkers:d,destroy(){s()}}}o(rt,"createMarkerControls");function Ct(n,t,e,{onRemove:i}={}){let r=e.addFolder(`${t.id.toString().substring(0,8)}`);r.onChange(g=>{n.updateState(t,{interactive:u.interactive})}),r.close();let s=n.getState(t);if((s==null?void 0:s.type)!=="marker")throw new Error(`error getting state for marker: ${t.id}`);let{interactive:a}=s;if(a==null)throw new Error("incomplte label state");let u={interactive:a,remove(){n.Markers.remove(t),i==null||i(t),r.destroy()}};return r.add(u,"interactive"),r.add(u,"remove"),{markerItemFolder:r,destroy(){r.destroy()}}}o(Ct,"addMarkerControlToFolder");function wt(n,t){let e=n.addFolder("Add"),i={onClick:!1,interactive:!0};return e.add(i,"onClick"),e.add(i,"interactive"),{destroy(){e.destroy()},addMarker(r){return e._closed||!i.onClick?void 0:t.Markers.add(r,"<div>New Marker</div>",{interactive:i.interactive})}}}o(wt,"createAddControl");A();function st(n,t){let e=n.addFolder("Geometries").close(),i={walls:!0};e.add(i,"walls").onChange(r=>{t.updateState("walls",{visible:r})})}o(st,"createGeometryControl");function at(n,t){_t();let e=new K({title:"SDK Controls"});e.domElement.classList.add("mappedin-js-inspector"),et(t,e),nt(e,t);let i=e.addFolder("Levels").close(),r=e.addFolder("Scene Controls"),s=e.addFolder("Labels"),a=e.addFolder("Markers");st(e,t);let u={level:t.currentFloor.id,load:()=>{let d=localStorage.getItem("mappedin-debug"),c=d?JSON.parse(d):{};for(let l in c)t.updateState(l,c[l])},clear(){localStorage.removeItem("mappedin-debug")}};e.add(u,"load"),e.add(u,"clear");let{populatelabels:g}=tt(s,n,t),{populateMarkers:v}=rt(a,n,t),f=n.getByType("floor").reduce((d,c)=>(d[c.name]=c.id,d),{});return i.add(u,"level",f).onChange(d=>{t.setFloor(d)}),t.on("floor-change-start",d=>{i.controllers[0].setValue(d.floor.id)}),n.getByType("space").forEach(d=>{t.updateState(d,{interactive:!0})}),n.getByType("object").forEach(d=>{t.updateState(d,{interactive:!0})}),n.getByType("object").forEach(d=>{t.updateState(d,{interactive:!0})}),t.setHoverColor("#a2b7e6"),{populatelabels:g,sceneFolder:r,populateMarkers:v}}o(at,"createUi");var ot="mappedin-sdk-debug-css";function _t(){if(document.getElementById(ot))return;let n=document.createElement("style");n.id=ot,n.textContent=it,document.head.appendChild(n)}o(_t,"injectCss");var J=class J{_enabled=!1;mv;api;mapData;storeStateToLocalStorageEnabled=!1;constructor(t,e){this.mv=t,this.api=e,this.mapData=this.api.getMapData()}setMapData(t){this.mapData=t}async enable(){var e;if(this._enabled)return;if(this._enabled=!0,!this.mapData)throw new Error("Please set mapData before enable debug.");let{sceneFolder:t}=at(this.mapData,this.mv);X(this.api.core,t),(e=this.api.getMapDataInternal())==null||e.spaces.forEach(i=>{this.mv.updateState(i.id,{interactive:!0})})}get enabled(){return this._enabled}storeState(t,e){if(!this.storeStateToLocalStorageEnabled)return;let i=localStorage.getItem("mappedin-debug"),r=i?JSON.parse(i):{};r[t]={...r[t],...e},localStorage.setItem("mappedin-debug",JSON.stringify(r))}};o(J,"Inspector");var Y=J;export{Y as Inspector};
425
+ value:`,a)}addColor(t,e,i=1){return new F(this,t,e,i)}addFolder(t){let e=new S({parent:this,title:t});return this.root._closeFolders&&e.close(),e}load(t,e=!0){return t.controllers&&this.controllers.forEach(i=>{i instanceof $||i._name in t.controllers&&i.load(t.controllers[i._name])}),e&&t.folders&&this.folders.forEach(i=>{i._title in t.folders&&i.load(t.folders[i._title])}),this}save(t=!0){let e={controllers:{},folders:{}};return this.controllers.forEach(i=>{if(!(i instanceof $)){if(i._name in e.controllers)throw new Error(`Cannot save GUI with duplicate property "${i._name}"`);e.controllers[i._name]=i.save()}}),t&&this.folders.forEach(i=>{if(i._title in e.folders)throw new Error(`Cannot save GUI with duplicate folder "${i._title}"`);e.folders[i._title]=i.save()}),e}open(t=!0){return this._setClosed(!t),this.$title.setAttribute("aria-expanded",!this._closed),this.domElement.classList.toggle("closed",this._closed),this}close(){return this.open(!1)}_setClosed(t){this._closed!==t&&(this._closed=t,this._callOnOpenClose(this))}show(t=!0){return this._hidden=!t,this.domElement.style.display=this._hidden?"none":"",this}hide(){return this.show(!1)}openAnimated(t=!0){return this._setClosed(!t),this.$title.setAttribute("aria-expanded",!this._closed),requestAnimationFrame(()=>{let e=this.$children.clientHeight;this.$children.style.height=e+"px",this.domElement.classList.add("transition");let i=o(s=>{s.target===this.$children&&(this.$children.style.height="",this.domElement.classList.remove("transition"),this.$children.removeEventListener("transitionend",i))},"onTransitionEnd");this.$children.addEventListener("transitionend",i);let r=t?this.$children.scrollHeight:0;this.domElement.classList.toggle("closed",!t),requestAnimationFrame(()=>{this.$children.style.height=r+"px"})}),this}title(t){return this._title=t,this.$title.textContent=t,this}reset(t=!0){return(t?this.controllersRecursive():this.controllers).forEach(i=>i.reset()),this}onChange(t){return this._onChange=t,this}_callOnChange(t){this.parent&&this.parent._callOnChange(t),this._onChange!==void 0&&this._onChange.call(this,{object:t.object,property:t.property,value:t.getValue(),controller:t})}onFinishChange(t){return this._onFinishChange=t,this}_callOnFinishChange(t){this.parent&&this.parent._callOnFinishChange(t),this._onFinishChange!==void 0&&this._onFinishChange.call(this,{object:t.object,property:t.property,value:t.getValue(),controller:t})}onOpenClose(t){return this._onOpenClose=t,this}_callOnOpenClose(t){this.parent&&this.parent._callOnOpenClose(t),this._onOpenClose!==void 0&&this._onOpenClose.call(this,t)}destroy(){this.parent&&(this.parent.children.splice(this.parent.children.indexOf(this),1),this.parent.folders.splice(this.parent.folders.indexOf(this),1)),this.domElement.parentElement&&this.domElement.parentElement.removeChild(this.domElement),Array.from(this.children).forEach(t=>t.destroy())}controllersRecursive(){let t=Array.from(this.controllers);return this.folders.forEach(e=>{t=t.concat(e.controllersRecursive())}),t}foldersRecursive(){let t=Array.from(this.folders);return this.folders.forEach(e=>{t=t.concat(e.foldersRecursive())}),t}};o(S,"GUI");var B=S,Z=B;y();y();var w=(()=>{let n=new X;return o(function(e){return n.set(e),`#${n.getHexString()}`},"normalize")})();function Q(n){let t;for(t of n)t()}o(Q,"runAll");function q(n,t){let e=window.location.href,i=new URL(e),r=new URLSearchParams(i.search);for(let s in n)if(n.hasOwnProperty(s)){let a=`${t}.${s}`;r.set(a,n[s])}i.search=r.toString(),history.pushState({path:i.toString()},"",i.toString())}o(q,"updateCurrentUrlParamsWithNamespace");function tt(n,t){let e=new URLSearchParams(window.location.search),i={};for(let[r,s]of e)if(r.startsWith(`${n}.`)){let a=r.slice(n.length+1);s==="true"||s==="false"?i[a]=s==="true":typeof t[a]=="number"?i[a]=Number(s):i[a]=s}return{namespace:n,params:i}}o(tt,"getUrlParamsWithNamespace");y();function et(n,t){t.domElement.id="interactionPanel";let e=t.addFolder("Click \u{1F447}");vt(n,e);let i=t.addFolder("Hover \u{1F681}");yt(n,i)}o(et,"createInteractionControls");function vt(n,t){let e={position:"",hoverColor:w(n.getHoverColor())},i=t.add(e,"position").disable(),r=[];function s(){r.forEach(u=>u()),r.length=0}o(s,"reset");let a=0;n.on("click",u=>{var l;let{labels:g,markers:b,coordinate:f}=u;s(),clearInterval(a),i.load(JSON.stringify([f.longitude,f.latitude]));let c=g[0]||b[0];if(c){let h=Y(n,c,t);if(!h)return;r.push(h.destroy),h.labelItemFolder.openAnimated()}let d=(l=u.spaces[0])!=null?l:u.objects[0];if(d){let h={id:d.id,...n.getState(d.id),type:d.type,isInView:!1,isInViewCheck:j(n,d.id)},{cleanup:v}=At(n,h,t);a=setInterval(()=>{h.isInView=n.isInView(c||d)},500),r.push(v)}})}o(vt,"createClickControls");var bt=["interactive"];function At(n,t,e){let i=e.addFolder(`${t.type}-${t.id}`);for(let r in t){if(r==="visible"&&i.add(t,r).onChange(s=>{n.updateState(t.id,{[r]:s})}),r==="color"||r==="hoverColor"){t[r]=w(t[r]),i.addColor(t,r).onChange(s=>{n.updateState(t.id,{[r]:s})});continue}if(r==="height"){i.add(t,r,0,20,1).onChange(s=>{n.updateState(t.id,{[r]:s})});continue}bt.includes(r)&&i.add(t,r).onChange(s=>{n.updateState(t.id,{[r]:s})})}return i.add(t,"isInView").listen().disable(),i.add(t,"isInViewCheck"),{cleanup(){i.destroy()}}}o(At,"renderByProp");function yt(n,t){n.setHoverColor("#1f3a7a");let e={position:"",hoverColor:w(n.getHoverColor()),intersected:"",type:"",id:""},i=t.add(e,"position").disable();t.add(e,"id").disable().listen(),t.add(e,"type").disable().listen(),t.addColor(e,"hoverColor").onChange(a=>{n.setHoverColor(a)});let r=[];function s(){r.forEach(a=>a()),r.length=0}o(s,"reset"),n.on("hover",a=>{var h,v,A;let{coordinate:u,spaces:g,objects:b,markers:f,labels:c}=a;s(),i.load(JSON.stringify([u.longitude,u.latitude]));let d=(A=(v=(h=g[0])!=null?h:b[0])!=null?v:f[0])!=null?A:c[0];if(!d)return;let l=n.getState(d);l&&(e.type=l.type,e.id=d.id)})}o(yt,"createHoverControls");function j(n,t){return o(function(){console.log("isInView",n.isInView(t))},"isInView")}o(j,"createIsInViewHandler");function it(n,t,e){let i={labels:{},all(){e.Labels.all().forEach(l=>{this.labels[l.id]=l}),g()},removeAllLabels(){e.Labels.removeAll().forEach(l=>{delete this.labels[l.id]}),g()}},{addLabel:r,destroy:s}=Ct(n,e);n.add(i,"all"),n.add(i,"removeAllLabels");let a=n.addFolder("Label List");n.close();let u=new Map,{rerender:g}=b();function b(){function d(v){var A;delete i.labels[v.id],(A=u.get(v.id))==null||A.destroy()}o(d,"remove");function l(v){let A=Y(e,v,a,{onRemove:p=>{d(p)}});if(!A)return;let{labelItemFolder:m}=A;u.set(v.id,m)}o(l,"add");function h(){a.destroy(),a=n.addFolder("Label");for(let v in i.labels){let A=i.labels[v];l(A)}}return o(h,"rerender"),{rerender:h,add:l,remove:d}}o(b,"createLabelControls"),n.domElement.classList.add("list-items");let f;e.on("click",({labels:d,coordinate:l})=>{if(!n._closed)if(d[0]){f==null||f.close();let h=u.get(d[0].id);if(n.open(),!h)return;h==null||h.open(),h==null||h.domElement.scrollIntoView({block:"start"}),h==null||h.domElement.focus(),f=h}else r(l)});function c(d){for(let l of d)i.labels[l.id]=l;g()}return o(c,"populatelabels"),{populatelabels:c,destroy(){s()}}}o(it,"createLabelControls");function Y(n,t,e,{onRemove:i}={}){var b,f,c,d;let r=e.addFolder(`${(b=t.text)==null?void 0:b.substring(0,12)}`);r.onChange(l=>{n.updateState(t,{appearance:g.appearance,interactive:g.interactive})}),r.close();let s=n.getState(t);if((s==null?void 0:s.type)!=="label")throw new Error(`error getting state for label: ${t.id}`);let{appearance:a,interactive:u}=s;if(!a||a.margin==null||u==null)throw new Error("incomplte label state");let g={text:t.text,interactive:u,appearance:{...a,margin:a.margin||0,marker:{foregroundColor:(c=(f=a.marker)==null?void 0:f.foregroundColor)!=null&&c.active?w((d=a.marker.foregroundColor)==null?void 0:d.active):"black"},text:{foregroundColor:w(a.text.foregroundColor)}},remove(){n.Labels.remove(t),i==null||i(t),r.destroy()},isInView:j(n,t.id)};return r.add(g.appearance,"margin",0,20).name("margin"),r.add(g,"text"),r.add(g,"interactive"),r.addColor(g.appearance.marker,"foregroundColor").name("marker foreground"),r.addColor(g.appearance.text,"foregroundColor").name("text forground"),r.add(g,"isInView"),r.add(g,"remove"),{labelItemFolder:r,destroy(){r.destroy()}}}o(Y,"addLabelControlToFolder");function Ct(n,t){let e=n.addFolder("Add"),i={onClick:!1,margin:0,text:"New Label!",interactive:!0,marginForegroundColor:w("skyblue"),marginBackgroundColor:w("coral"),textForegroundColor:w("slategray"),textBackgroundColor:w("white")};return e.add(i,"onClick"),e.add(i,"margin"),e.add(i,"interactive"),e.add(i,"text"),e.addColor(i,"marginForegroundColor"),e.addColor(i,"marginBackgroundColor"),e.addColor(i,"textForegroundColor"),e.addColor(i,"textBackgroundColor"),{destroy(){e.destroy()},addLabel(r){return e._closed||!i.onClick?void 0:t.Labels.add(r,i.text,{appearance:{margin:i.margin,marker:{foregroundColor:{active:i.marginForegroundColor,inactive:i.marginForegroundColor},backgroundColor:{active:i.marginBackgroundColor,inactive:i.marginBackgroundColor}},text:{foregroundColor:i.textForegroundColor,backgroundColor:i.marginBackgroundColor}},interactive:i.interactive})}}}o(Ct,"createAddControl");var nt={};y();function rt(n,t){let e=n.addFolder("Camera \u{1F4F7}").close(),i=t.Camera.center.toJSON(),r=document.createElement("div");Object.assign(r.style,{display:"none",position:"absolute",left:"0px",top:"0px",bottom:"0px",right:"0px",backgroundColor:"aqua",pointerEvents:"none",opacity:.5,zIndex:99999}),document.body.appendChild(r);let s={center_lat:i.latitude,center_lon:i.longitude,zoomLevel:t.Camera.zoomLevel,pitch:t.Camera.pitch,bearing:t.Camera.bearing,minZoomLevel:t.Camera.minZoomLevel,maxZoomLevel:t.Camera.maxZoomLevel,inset_top:0,inset_left:0,inset_right:0,inset_bottom:0,animateOnLoad:!0,share:()=>{q(e.save().controllers,"camera"),navigator.clipboard.writeText(window.location.href)},visualizeInset:!1};function a(){Object.assign(r.style,{left:s.inset_left+"px",top:s.inset_top+"px",bottom:s.inset_bottom+"px",right:s.inset_right+"px"})}o(a,"updateInsetVisualizer"),e.add(s,"center_lat").listen().disable(),e.add(s,"center_lon").listen().disable(),e.add(s,"zoomLevel",16,22,.5).listen().disable(),e.add(s,"pitch").listen().disable(),e.add(s,"bearing").listen().disable(),e.add(s,"minZoomLevel",5,22,.5).onChange(l=>{t.Camera.setMinZoomLevel(l)}),e.add(s,"maxZoomLevel",10,22,.5).onChange(l=>{t.Camera.setMaxZoomLevel(l)}),e.add(s,"animateOnLoad"),e.add(s,"visualizeInset").onChange(l=>{l?r.style.display="block":r.style.display="none"});let{innerHeight:u,innerWidth:g}=window;e.add(s,"inset_top",0,u,1).onChange(d),e.add(s,"inset_bottom",0,u,1).onChange(d),e.add(s,"inset_left",0,g,1).onChange(d),e.add(s,"inset_right",0,g,1).onChange(d),e.add(s,"share");let b=o(l=>{e._closed||(s.center_lat=l.center.latitude,s.center_lon=l.center.longitude,s.zoomLevel=l.zoomLevel,s.bearing=l.bearing,s.pitch=l.pitch)},"onCameraChanged");t.on("camera-change",b);let{params:f}=tt("camera",s);if(Object.keys(f).length>0){let l=f;t.Camera.setScreenOffsets({top:l.inset_top,left:l.inset_left,right:l.inset_right,bottom:l.inset_bottom});let h={pitch:l.pitch,center:new W(l.center_lat,l.center_lon),bearing:l.bearing,zoomLevel:l.zoomLevel};l.animateOnLoad?t.Camera.animateTo(h):t.Camera.set(h),e.load({controllers:l,folders:{}}),a()}let c=[()=>{t.off("camera-change",b)}];function d(){t.Camera.setScreenOffsets({top:s.inset_top,left:s.inset_left,right:s.inset_right,bottom:s.inset_bottom}),a()}return o(d,"updateInset"),()=>({destroy(){e.destroy(),Q(c)}})}o(rt,"createCameraControls");y();function st(n,t,e){let i={markers:{},removeAllMarkers(){e.Markers.removeAll().forEach(l=>{delete this.markers[l.id]}),g()}},{addMarker:r,destroy:s}=_t(n,e);n.add(i,"removeAllMarkers");let a=n.addFolder("Marker List");n.close();let u=new Map,{rerender:g}=b();function b(){function d(v){var A;delete i.markers[v.id],(A=u.get(v.id))==null||A.destroy()}o(d,"remove");function l(v){let A=xt(e,v,a,{onRemove:p=>{d(p)}});if(!A)return;let{markerItemFolder:m}=A;u.set(v.id,m)}o(l,"add");function h(){a.destroy(),a=n.addFolder("marker");for(let v in i.markers){let A=i.markers[v];l(A)}}return o(h,"rerender"),{rerender:h,add:l,remove:d}}o(b,"createMarkerControls"),n.domElement.classList.add("list-items");let f;e.on("click",({markers:d,coordinate:l})=>{if(!n._closed)if(d[0]){f==null||f.close();let h=u.get(d[0].id);if(n.open(),!h)return;h==null||h.open(),h==null||h.domElement.scrollIntoView({block:"start"}),h==null||h.domElement.focus(),f=h}else r(l)});function c(d){for(let l of d)i.markers[l.id]=l;g()}return o(c,"populateMarkers"),{populateMarkers:c,destroy(){s()}}}o(st,"createMarkerControls");function xt(n,t,e,{onRemove:i}={}){let r=e.addFolder(`${t.id.toString().substring(0,8)}`);r.onChange(g=>{n.updateState(t,{interactive:u.interactive})}),r.close();let s=n.getState(t);if((s==null?void 0:s.type)!=="marker")throw new Error(`error getting state for marker: ${t.id}`);let{interactive:a}=s;if(a==null)throw new Error("incomplte label state");let u={interactive:a,remove(){n.Markers.remove(t),i==null||i(t),r.destroy()}};return r.add(u,"interactive"),r.add(u,"remove"),{markerItemFolder:r,destroy(){r.destroy()}}}o(xt,"addMarkerControlToFolder");function _t(n,t){let e=n.addFolder("Add"),i={onClick:!1,interactive:!0};return e.add(i,"onClick"),e.add(i,"interactive"),{destroy(){e.destroy()},addMarker(r){return e._closed||!i.onClick?void 0:t.Markers.add(r,"<div>New Marker</div>",{interactive:i.interactive})}}}o(_t,"createAddControl");y();function ot(n,t){let e=n.addFolder("Walls").close(),i={visible:!0,topColor:"#3269a8"};e.add(i,"visible").onChange(r=>{t.updateState("walls",{visible:r})}),e.addColor(i,"topColor").onChange(r=>{t.updateState("walls",{topColor:r})}),t.updateState("walls",{topColor:i.topColor})}o(ot,"createGeometryControl");function lt(n,t){Et();let e=new Z({title:"SDK Controls"});e.domElement.classList.add("mappedin-js-inspector"),et(t,e),rt(e,t);let i=e.addFolder("Levels").close(),r=e.addFolder("Scene Controls"),s=e.addFolder("Labels"),a=e.addFolder("Markers");ot(e,t);let u={level:t.currentFloor.id,load:()=>{let c=localStorage.getItem("mappedin-debug"),d=c?JSON.parse(c):{};for(let l in d)t.updateState(l,d[l])},clear(){localStorage.removeItem("mappedin-debug")}};e.add(u,"load"),e.add(u,"clear");let{populatelabels:g}=it(s,n,t),{populateMarkers:b}=st(a,n,t),f=n.getByType("floor").reduce((c,d)=>(c[d.name]=d.id,c),{});return i.add(u,"level",f).onChange(c=>{t.setFloor(c)}),t.on("floor-change-start",c=>{i.controllers[0].setValue(c.floor.id)}),n.getByType("space").forEach(c=>{t.updateState(c,{interactive:!0})}),n.getByType("object").forEach(c=>{t.updateState(c,{interactive:!0})}),n.getByType("object").forEach(c=>{t.updateState(c,{interactive:!0})}),t.setHoverColor("#a2b7e6"),{populatelabels:g,sceneFolder:r,populateMarkers:b}}o(lt,"createUi");var at="mappedin-sdk-debug-css";function Et(){if(document.getElementById(at))return;let n=document.createElement("style");n.id=at,n.textContent=nt,document.head.appendChild(n)}o(Et,"injectCss");var N=class N{_enabled=!1;mv;api;mapData;storeStateToLocalStorageEnabled=!1;constructor(t,e){this.mv=t,this.api=e,this.mapData=this.api.getMapData()}setMapData(t){this.mapData=t}async enable(){var e;if(this._enabled)return;if(this._enabled=!0,!this.mapData)throw new Error("Please set mapData before enable debug.");let{sceneFolder:t}=lt(this.mapData,this.mv);R(this.api.core,t),(e=this.api.getMapDataInternal())==null||e.spaces.forEach(i=>{this.mv.updateState(i.id,{interactive:!0})})}get enabled(){return this._enabled}storeState(t,e){if(!this.storeStateToLocalStorageEnabled)return;let i=localStorage.getItem("mappedin-debug"),r=i?JSON.parse(i):{};r[t]={...r[t],...e},localStorage.setItem("mappedin-debug",JSON.stringify(r))}};o(N,"Inspector");var J=N;export{J as Inspector};
@@ -1 +1 @@
1
- import{$,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,_,a,aa,b,ba,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-E5S56D7B.js";import"./chunk-LDHLD3E3.js";var export_Point=T.default;export{d as AJAXError,J as AttributionControl,y as BoxZoomHandler,q as CanvasSource,I as CooperativeGesturesHandler,E as DoubleClickZoomHandler,F as DragPanHandler,G as DragRotateHandler,t as EdgeInsets,e as Evented,Q as FullscreenControl,n as GeoJSONSource,O as GeolocateControl,u as Hash,o as ImageSource,C as KeyboardHandler,h as LngLat,i as LngLatBounds,K as LogoControl,L as Map,v as MapMouseEvent,w as MapTouchEvent,x as MapWheelEvent,N as Marker,j as MercatorCoordinate,M as NavigationControl,export_Point as Point,S as Popup,m as RasterDEMTileSource,l as RasterTileSource,P as ScaleControl,D as ScrollZoomHandler,s as Style,R as TerrainControl,B as TwoFingersTouchPitchHandler,A as TwoFingersTouchRotateHandler,z as TwoFingersTouchZoomHandler,H as TwoFingersTouchZoomRotateHandler,k as VectorTileSource,p as VideoSource,b as addProtocol,r as addSourceType,g as clearPrewarmedResources,a as config,Z as getMaxParallelImageRequests,V as getRTLTextPluginStatus,W as getVersion,X as getWorkerCount,$ as getWorkerUrl,ba as importScriptInWorkers,f as prewarm,c as removeProtocol,_ as setMaxParallelImageRequests,U as setRTLTextPlugin,Y as setWorkerCount,aa as setWorkerUrl};
1
+ import{$,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,_,a,aa,b,ba,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-5QDDUDQO.js";import"./chunk-N7QS5LVF.js";var export_Point=T.default;export{d as AJAXError,J as AttributionControl,y as BoxZoomHandler,q as CanvasSource,I as CooperativeGesturesHandler,E as DoubleClickZoomHandler,F as DragPanHandler,G as DragRotateHandler,t as EdgeInsets,e as Evented,Q as FullscreenControl,n as GeoJSONSource,O as GeolocateControl,u as Hash,o as ImageSource,C as KeyboardHandler,h as LngLat,i as LngLatBounds,K as LogoControl,L as Map,v as MapMouseEvent,w as MapTouchEvent,x as MapWheelEvent,N as Marker,j as MercatorCoordinate,M as NavigationControl,export_Point as Point,S as Popup,m as RasterDEMTileSource,l as RasterTileSource,P as ScaleControl,D as ScrollZoomHandler,s as Style,R as TerrainControl,B as TwoFingersTouchPitchHandler,A as TwoFingersTouchRotateHandler,z as TwoFingersTouchZoomHandler,H as TwoFingersTouchZoomRotateHandler,k as VectorTileSource,p as VideoSource,b as addProtocol,r as addSourceType,g as clearPrewarmedResources,a as config,Z as getMaxParallelImageRequests,V as getRTLTextPluginStatus,W as getVersion,X as getWorkerCount,$ as getWorkerUrl,ba as importScriptInWorkers,f as prewarm,c as removeProtocol,_ as setMaxParallelImageRequests,U as setRTLTextPlugin,Y as setWorkerCount,aa as setWorkerUrl};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mappedin/mappedin-js",
3
- "version": "6.0.1-alpha.34",
3
+ "version": "6.0.1-alpha.36",
4
4
  "private": false,
5
5
  "main": "lib/esm/index.js",
6
6
  "module": "lib/esm/index.js",
@@ -27,7 +27,7 @@
27
27
  "types": "tsc -b ./tsconfig.build.json",
28
28
  "test": "NODE_ENV=test jest",
29
29
  "test:cov": "NODE_ENV=test jest --coverage",
30
- "typecheck": "tsc --noEmit",
30
+ "typecheck": "tsc --noEmit --project tsconfig.json",
31
31
  "copy-styles": "cp lib/esm/index.css lib/index.css",
32
32
  "clean": "rm -rf lib/** && rm -rf examples/dist/**",
33
33
  "docs": "yarn build && typedoc"
@@ -35,5 +35,5 @@
35
35
  "volta": {
36
36
  "extends": "../../package.json"
37
37
  },
38
- "gitHead": "fc617def4360fec47a1dd4cbe27bb6ef0aa047ef"
38
+ "gitHead": "ff4378fd02176f8514aeb404bc49742383f61e13"
39
39
  }
@@ -1 +0,0 @@
1
- import{b as ae}from"./chunk-ENEOOXQO.js";import{$ as Mt,A as $,Aa as re,Ba as ie,C as ee,Ca as jt,D,Da as Kt,E as _t,Ea as oe,F as Et,Fa as Ft,G as j,Ga as Vt,Ha as Xt,I as te,Ia as Gt,J as L,K as V,Ka as B,L as H,La as zt,M as X,N as xt,Na as qt,O as St,S as yt,U as wt,V as G,Z as Nt,_ as bt,aa as It,b as ct,c as ut,ca as Lt,d as F,da as Ot,e as lt,ea as Ct,f as ft,g as dt,ga as Dt,h as ht,ha as Pt,i as pt,ia as kt,j as W,ja as Ht,k as mt,ka as Bt,l as Y,la as vt,o as At,p as Q,r as gt,s as Tt,u as k,v as N,va as ne,w as Rt,wa as b,x as Z,y as J,ya as Ut,za as se}from"./chunk-CYBYPK2K.js";import{a as p,j as at}from"./chunk-LDHLD3E3.js";at();var He=class He extends Kt{constructor(t){super(t),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new pe(e)}),this.register(function(e){return new Se(e)}),this.register(function(e){return new ye(e)}),this.register(function(e){return new we(e)}),this.register(function(e){return new Ae(e)}),this.register(function(e){return new ge(e)}),this.register(function(e){return new Te(e)}),this.register(function(e){return new Re(e)}),this.register(function(e){return new he(e)}),this.register(function(e){return new _e(e)}),this.register(function(e){return new me(e)}),this.register(function(e){return new xe(e)}),this.register(function(e){return new Ee(e)}),this.register(function(e){return new fe(e)}),this.register(function(e){return new Ne(e)}),this.register(function(e){return new be(e)})}load(t,e,r,n){let s=this,i;if(this.resourcePath!=="")i=this.resourcePath;else if(this.path!==""){let c=B.extractUrlBase(t);i=B.resolveURL(c,this.path)}else i=B.extractUrlBase(t);this.manager.itemStart(t);let a=p(function(c){n?n(c):console.error(c),s.manager.itemError(t),s.manager.itemEnd(t)},"_onError"),o=new oe(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,function(c){try{s.parse(c,i,function(l){e(l),s.manager.itemEnd(t)},a)}catch(l){a(l)}},r,a)}setDRACOLoader(t){return this.dracoLoader=t,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(t){return this.ktx2Loader=t,this}setMeshoptDecoder(t){return this.meshoptDecoder=t,this}register(t){return this.pluginCallbacks.indexOf(t)===-1&&this.pluginCallbacks.push(t),this}unregister(t){return this.pluginCallbacks.indexOf(t)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t),1),this}parse(t,e,r,n){let s,i={},a={},o=new TextDecoder;if(typeof t=="string")s=JSON.parse(t);else if(t instanceof ArrayBuffer)if(o.decode(new Uint8Array(t,0,4))===$t){try{i[g.KHR_BINARY_GLTF]=new Me(t)}catch(u){n&&n(u);return}s=JSON.parse(i[g.KHR_BINARY_GLTF].content)}else s=JSON.parse(o.decode(t));else s=t;if(s.asset===void 0||s.asset.version[0]<2){n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}let c=new ke(s,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let l=0;l<this.pluginCallbacks.length;l++){let u=this.pluginCallbacks[l](c);u.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),a[u.name]=u,i[u.name]=!0}if(s.extensionsUsed)for(let l=0;l<s.extensionsUsed.length;++l){let u=s.extensionsUsed[l],f=s.extensionsRequired||[];switch(u){case g.KHR_MATERIALS_UNLIT:i[u]=new de;break;case g.KHR_DRACO_MESH_COMPRESSION:i[u]=new Ie(s,this.dracoLoader);break;case g.KHR_TEXTURE_TRANSFORM:i[u]=new Le;break;case g.KHR_MESH_QUANTIZATION:i[u]=new Oe;break;default:f.indexOf(u)>=0&&a[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}c.setExtensions(i),c.setPlugins(a),c.parse(r,n)}parseAsync(t,e){let r=this;return new Promise(function(n,s){r.parse(t,e,n,s)})}};p(He,"GLTFLoader");var Wt=He;function en(){let h={};return{get:function(t){return h[t]},add:function(t,e){h[t]=e},remove:function(t){delete h[t]},removeAll:function(){h={}}}}p(en,"GLTFRegistry");var g={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"},Be=class Be{constructor(t){this.parser=t,this.name=g.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let t=this.parser,e=this.parser.json.nodes||[];for(let r=0,n=e.length;r<n;r++){let s=e[r];s.extensions&&s.extensions[this.name]&&s.extensions[this.name].light!==void 0&&t._addNodeRef(this.cache,s.extensions[this.name].light)}}_loadLight(t){let e=this.parser,r="light:"+t,n=e.cache.get(r);if(n)return n;let s=e.json,o=((s.extensions&&s.extensions[this.name]||{}).lights||[])[t],c,l=new L(16777215);o.color!==void 0&&l.setRGB(o.color[0],o.color[1],o.color[2],N);let u=o.range!==void 0?o.range:0;switch(o.type){case"directional":c=new Gt(l),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new Xt(l),c.distance=u;break;case"spot":c=new Vt(l),c.distance=u,o.spot=o.spot||{},o.spot.innerConeAngle=o.spot.innerConeAngle!==void 0?o.spot.innerConeAngle:0,o.spot.outerConeAngle=o.spot.outerConeAngle!==void 0?o.spot.outerConeAngle:Math.PI/4,c.angle=o.spot.outerConeAngle,c.penumbra=1-o.spot.innerConeAngle/o.spot.outerConeAngle,c.target.position.set(0,0,-1),c.add(c.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}return c.position.set(0,0,0),c.decay=2,C(c,o),o.intensity!==void 0&&(c.intensity=o.intensity),c.name=e.createUniqueName(o.name||"light_"+t),n=Promise.resolve(c),e.cache.add(r,n),n}getDependency(t,e){if(t==="light")return this._loadLight(e)}createNodeAttachment(t){let e=this,r=this.parser,s=r.json.nodes[t],a=(s.extensions&&s.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(o){return r._getNodeRef(e.cache,a,o)})}};p(Be,"GLTFLightsExtension");var fe=Be,ve=class ve{constructor(){this.name=g.KHR_MATERIALS_UNLIT}getMaterialType(){return H}extendParams(t,e,r){let n=[];t.color=new L(1,1,1),t.opacity=1;let s=e.pbrMetallicRoughness;if(s){if(Array.isArray(s.baseColorFactor)){let i=s.baseColorFactor;t.color.setRGB(i[0],i[1],i[2],N),t.opacity=i[3]}s.baseColorTexture!==void 0&&n.push(r.assignTexture(t,"map",s.baseColorTexture,k))}return Promise.all(n)}};p(ve,"GLTFMaterialsUnlitExtension");var de=ve,Ue=class Ue{constructor(t){this.parser=t,this.name=g.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(t,e){let n=this.parser.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();let s=n.extensions[this.name].emissiveStrength;return s!==void 0&&(e.emissiveIntensity=s),Promise.resolve()}};p(Ue,"GLTFMaterialsEmissiveStrengthExtension");var he=Ue,je=class je{constructor(t){this.parser=t,this.name=g.KHR_MATERIALS_CLEARCOAT}getMaterialType(t){let r=this.parser.json.materials[t];return!r.extensions||!r.extensions[this.name]?null:b}extendMaterialParams(t,e){let r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();let s=[],i=n.extensions[this.name];if(i.clearcoatFactor!==void 0&&(e.clearcoat=i.clearcoatFactor),i.clearcoatTexture!==void 0&&s.push(r.assignTexture(e,"clearcoatMap",i.clearcoatTexture)),i.clearcoatRoughnessFactor!==void 0&&(e.clearcoatRoughness=i.clearcoatRoughnessFactor),i.clearcoatRoughnessTexture!==void 0&&s.push(r.assignTexture(e,"clearcoatRoughnessMap",i.clearcoatRoughnessTexture)),i.clearcoatNormalTexture!==void 0&&(s.push(r.assignTexture(e,"clearcoatNormalMap",i.clearcoatNormalTexture)),i.clearcoatNormalTexture.scale!==void 0)){let a=i.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new Z(a,a)}return Promise.all(s)}};p(je,"GLTFMaterialsClearcoatExtension");var pe=je,Ke=class Ke{constructor(t){this.parser=t,this.name=g.KHR_MATERIALS_IRIDESCENCE}getMaterialType(t){let r=this.parser.json.materials[t];return!r.extensions||!r.extensions[this.name]?null:b}extendMaterialParams(t,e){let r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();let s=[],i=n.extensions[this.name];return i.iridescenceFactor!==void 0&&(e.iridescence=i.iridescenceFactor),i.iridescenceTexture!==void 0&&s.push(r.assignTexture(e,"iridescenceMap",i.iridescenceTexture)),i.iridescenceIor!==void 0&&(e.iridescenceIOR=i.iridescenceIor),e.iridescenceThicknessRange===void 0&&(e.iridescenceThicknessRange=[100,400]),i.iridescenceThicknessMinimum!==void 0&&(e.iridescenceThicknessRange[0]=i.iridescenceThicknessMinimum),i.iridescenceThicknessMaximum!==void 0&&(e.iridescenceThicknessRange[1]=i.iridescenceThicknessMaximum),i.iridescenceThicknessTexture!==void 0&&s.push(r.assignTexture(e,"iridescenceThicknessMap",i.iridescenceThicknessTexture)),Promise.all(s)}};p(Ke,"GLTFMaterialsIridescenceExtension");var me=Ke,Fe=class Fe{constructor(t){this.parser=t,this.name=g.KHR_MATERIALS_SHEEN}getMaterialType(t){let r=this.parser.json.materials[t];return!r.extensions||!r.extensions[this.name]?null:b}extendMaterialParams(t,e){let r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();let s=[];e.sheenColor=new L(0,0,0),e.sheenRoughness=0,e.sheen=1;let i=n.extensions[this.name];if(i.sheenColorFactor!==void 0){let a=i.sheenColorFactor;e.sheenColor.setRGB(a[0],a[1],a[2],N)}return i.sheenRoughnessFactor!==void 0&&(e.sheenRoughness=i.sheenRoughnessFactor),i.sheenColorTexture!==void 0&&s.push(r.assignTexture(e,"sheenColorMap",i.sheenColorTexture,k)),i.sheenRoughnessTexture!==void 0&&s.push(r.assignTexture(e,"sheenRoughnessMap",i.sheenRoughnessTexture)),Promise.all(s)}};p(Fe,"GLTFMaterialsSheenExtension");var Ae=Fe,Ve=class Ve{constructor(t){this.parser=t,this.name=g.KHR_MATERIALS_TRANSMISSION}getMaterialType(t){let r=this.parser.json.materials[t];return!r.extensions||!r.extensions[this.name]?null:b}extendMaterialParams(t,e){let r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();let s=[],i=n.extensions[this.name];return i.transmissionFactor!==void 0&&(e.transmission=i.transmissionFactor),i.transmissionTexture!==void 0&&s.push(r.assignTexture(e,"transmissionMap",i.transmissionTexture)),Promise.all(s)}};p(Ve,"GLTFMaterialsTransmissionExtension");var ge=Ve,Xe=class Xe{constructor(t){this.parser=t,this.name=g.KHR_MATERIALS_VOLUME}getMaterialType(t){let r=this.parser.json.materials[t];return!r.extensions||!r.extensions[this.name]?null:b}extendMaterialParams(t,e){let r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();let s=[],i=n.extensions[this.name];e.thickness=i.thicknessFactor!==void 0?i.thicknessFactor:0,i.thicknessTexture!==void 0&&s.push(r.assignTexture(e,"thicknessMap",i.thicknessTexture)),e.attenuationDistance=i.attenuationDistance||1/0;let a=i.attenuationColor||[1,1,1];return e.attenuationColor=new L().setRGB(a[0],a[1],a[2],N),Promise.all(s)}};p(Xe,"GLTFMaterialsVolumeExtension");var Te=Xe,Ge=class Ge{constructor(t){this.parser=t,this.name=g.KHR_MATERIALS_IOR}getMaterialType(t){let r=this.parser.json.materials[t];return!r.extensions||!r.extensions[this.name]?null:b}extendMaterialParams(t,e){let n=this.parser.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();let s=n.extensions[this.name];return e.ior=s.ior!==void 0?s.ior:1.5,Promise.resolve()}};p(Ge,"GLTFMaterialsIorExtension");var Re=Ge,ze=class ze{constructor(t){this.parser=t,this.name=g.KHR_MATERIALS_SPECULAR}getMaterialType(t){let r=this.parser.json.materials[t];return!r.extensions||!r.extensions[this.name]?null:b}extendMaterialParams(t,e){let r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();let s=[],i=n.extensions[this.name];e.specularIntensity=i.specularFactor!==void 0?i.specularFactor:1,i.specularTexture!==void 0&&s.push(r.assignTexture(e,"specularIntensityMap",i.specularTexture));let a=i.specularColorFactor||[1,1,1];return e.specularColor=new L().setRGB(a[0],a[1],a[2],N),i.specularColorTexture!==void 0&&s.push(r.assignTexture(e,"specularColorMap",i.specularColorTexture,k)),Promise.all(s)}};p(ze,"GLTFMaterialsSpecularExtension");var _e=ze,qe=class qe{constructor(t){this.parser=t,this.name=g.EXT_MATERIALS_BUMP}getMaterialType(t){let r=this.parser.json.materials[t];return!r.extensions||!r.extensions[this.name]?null:b}extendMaterialParams(t,e){let r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();let s=[],i=n.extensions[this.name];return e.bumpScale=i.bumpFactor!==void 0?i.bumpFactor:1,i.bumpTexture!==void 0&&s.push(r.assignTexture(e,"bumpMap",i.bumpTexture)),Promise.all(s)}};p(qe,"GLTFMaterialsBumpExtension");var Ee=qe,We=class We{constructor(t){this.parser=t,this.name=g.KHR_MATERIALS_ANISOTROPY}getMaterialType(t){let r=this.parser.json.materials[t];return!r.extensions||!r.extensions[this.name]?null:b}extendMaterialParams(t,e){let r=this.parser,n=r.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();let s=[],i=n.extensions[this.name];return i.anisotropyStrength!==void 0&&(e.anisotropy=i.anisotropyStrength),i.anisotropyRotation!==void 0&&(e.anisotropyRotation=i.anisotropyRotation),i.anisotropyTexture!==void 0&&s.push(r.assignTexture(e,"anisotropyMap",i.anisotropyTexture)),Promise.all(s)}};p(We,"GLTFMaterialsAnisotropyExtension");var xe=We,Ye=class Ye{constructor(t){this.parser=t,this.name=g.KHR_TEXTURE_BASISU}loadTexture(t){let e=this.parser,r=e.json,n=r.textures[t];if(!n.extensions||!n.extensions[this.name])return null;let s=n.extensions[this.name],i=e.options.ktx2Loader;if(!i){if(r.extensionsRequired&&r.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(t,s.source,i)}};p(Ye,"GLTFTextureBasisUExtension");var Se=Ye,Qe=class Qe{constructor(t){this.parser=t,this.name=g.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(t){let e=this.name,r=this.parser,n=r.json,s=n.textures[t];if(!s.extensions||!s.extensions[e])return null;let i=s.extensions[e],a=n.images[i.source],o=r.textureLoader;if(a.uri){let c=r.options.manager.getHandler(a.uri);c!==null&&(o=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(t,i.source,o);if(n.extensionsRequired&&n.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.loadTexture(t)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(t){let e=new Image;e.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",e.onload=e.onerror=function(){t(e.height===1)}})),this.isSupported}};p(Qe,"GLTFTextureWebPExtension");var ye=Qe,Ze=class Ze{constructor(t){this.parser=t,this.name=g.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(t){let e=this.name,r=this.parser,n=r.json,s=n.textures[t];if(!s.extensions||!s.extensions[e])return null;let i=s.extensions[e],a=n.images[i.source],o=r.textureLoader;if(a.uri){let c=r.options.manager.getHandler(a.uri);c!==null&&(o=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(t,i.source,o);if(n.extensionsRequired&&n.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.loadTexture(t)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(t){let e=new Image;e.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",e.onload=e.onerror=function(){t(e.height===1)}})),this.isSupported}};p(Ze,"GLTFTextureAVIFExtension");var we=Ze,Je=class Je{constructor(t){this.name=g.EXT_MESHOPT_COMPRESSION,this.parser=t}loadBufferView(t){let e=this.parser.json,r=e.bufferViews[t];if(r.extensions&&r.extensions[this.name]){let n=r.extensions[this.name],s=this.parser.getDependency("buffer",n.buffer),i=this.parser.options.meshoptDecoder;if(!i||!i.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return s.then(function(a){let o=n.byteOffset||0,c=n.byteLength||0,l=n.count,u=n.byteStride,f=new Uint8Array(a,o,c);return i.decodeGltfBufferAsync?i.decodeGltfBufferAsync(l,u,f,n.mode,n.filter).then(function(d){return d.buffer}):i.ready.then(function(){let d=new ArrayBuffer(l*u);return i.decodeGltfBuffer(new Uint8Array(d),l,u,f,n.mode,n.filter),d})})}else return null}};p(Je,"GLTFMeshoptCompression");var Ne=Je,$e=class $e{constructor(t){this.name=g.EXT_MESH_GPU_INSTANCING,this.parser=t}createNodeMesh(t){let e=this.parser.json,r=e.nodes[t];if(!r.extensions||!r.extensions[this.name]||r.mesh===void 0)return null;let n=e.meshes[r.mesh];for(let c of n.primitives)if(c.mode!==S.TRIANGLES&&c.mode!==S.TRIANGLE_STRIP&&c.mode!==S.TRIANGLE_FAN&&c.mode!==void 0)return null;let i=r.extensions[this.name].attributes,a=[],o={};for(let c in i)a.push(this.parser.getDependency("accessor",i[c]).then(l=>(o[c]=l,o[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(t)),Promise.all(a).then(c=>{let l=c.pop(),u=l.isGroup?l.children:[l],f=c[0].count,d=[];for(let m of u){let R=new j,A=new D,T=new ee,E=new D(1,1,1),x=new Ct(m.geometry,m.material,f);for(let _=0;_<f;_++)o.TRANSLATION&&A.fromBufferAttribute(o.TRANSLATION,_),o.ROTATION&&T.fromBufferAttribute(o.ROTATION,_),o.SCALE&&E.fromBufferAttribute(o.SCALE,_),x.setMatrixAt(_,R.compose(A,T,E));for(let _ in o)if(_==="_COLOR_0"){let w=o[_];x.instanceColor=new Ot(w.array,w.itemSize,w.normalized)}else _!=="TRANSLATION"&&_!=="ROTATION"&&_!=="SCALE"&&m.geometry.setAttribute(_,o[_]);te.prototype.copy.call(x,m),this.parser.assignFinalMaterial(x),d.push(x)}return l.isGroup?(l.clear(),l.add(...d),l):d[0]}))}};p($e,"GLTFMeshGpuInstancing");var be=$e,$t="glTF",K=12,Yt={JSON:1313821514,BIN:5130562},et=class et{constructor(t){this.name=g.KHR_BINARY_GLTF,this.content=null,this.body=null;let e=new DataView(t,0,K),r=new TextDecoder;if(this.header={magic:r.decode(new Uint8Array(t.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==$t)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");let n=this.header.length-K,s=new DataView(t,K),i=0;for(;i<n;){let a=s.getUint32(i,!0);i+=4;let o=s.getUint32(i,!0);if(i+=4,o===Yt.JSON){let c=new Uint8Array(t,K+i,a);this.content=r.decode(c)}else if(o===Yt.BIN){let c=K+i;this.body=t.slice(c,c+a)}i+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}};p(et,"GLTFBinaryExtension");var Me=et,tt=class tt{constructor(t,e){if(!e)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=g.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=e,this.dracoLoader.preload()}decodePrimitive(t,e){let r=this.json,n=this.dracoLoader,s=t.extensions[this.name].bufferView,i=t.extensions[this.name].attributes,a={},o={},c={};for(let l in i){let u=De[l]||l.toLowerCase();a[u]=i[l]}for(let l in t.attributes){let u=De[l]||l.toLowerCase();if(i[l]!==void 0){let f=r.accessors[t.attributes[l]],d=v[f.componentType];c[u]=d.name,o[u]=f.normalized===!0}}return e.getDependency("bufferView",s).then(function(l){return new Promise(function(u,f){n.decodeDracoFile(l,function(d){for(let m in d.attributes){let R=d.attributes[m],A=o[m];A!==void 0&&(R.normalized=A)}u(d)},a,c,N,f)})})}};p(tt,"GLTFDracoMeshCompressionExtension");var Ie=tt,nt=class nt{constructor(){this.name=g.KHR_TEXTURE_TRANSFORM}extendTexture(t,e){return(e.texCoord===void 0||e.texCoord===t.channel)&&e.offset===void 0&&e.rotation===void 0&&e.scale===void 0||(t=t.clone(),e.texCoord!==void 0&&(t.channel=e.texCoord),e.offset!==void 0&&t.offset.fromArray(e.offset),e.rotation!==void 0&&(t.rotation=e.rotation),e.scale!==void 0&&t.repeat.fromArray(e.scale),t.needsUpdate=!0),t}};p(nt,"GLTFTextureTransformExtension");var Le=nt,st=class st{constructor(){this.name=g.KHR_MESH_QUANTIZATION}};p(st,"GLTFMeshQuantizationExtension");var Oe=st,rt=class rt extends Ut{constructor(t,e,r,n){super(t,e,r,n)}copySampleValue_(t){let e=this.resultBuffer,r=this.sampleValues,n=this.valueSize,s=t*n*3+n;for(let i=0;i!==n;i++)e[i]=r[s+i];return e}interpolate_(t,e,r,n){let s=this.resultBuffer,i=this.sampleValues,a=this.valueSize,o=a*2,c=a*3,l=n-e,u=(r-e)/l,f=u*u,d=f*u,m=t*c,R=m-c,A=-2*d+3*f,T=d-f,E=1-A,x=T-f+u;for(let _=0;_!==a;_++){let w=i[R+_+a],M=i[R+_+o]*l,y=i[m+_+a],U=i[m+_]*l;s[_]=E*w+x*M+A*y+T*U}return s}};p(rt,"GLTFCubicSplineInterpolant");var z=rt,tn=new ee,it=class it extends z{interpolate_(t,e,r,n){let s=super.interpolate_(t,e,r,n);return tn.fromArray(s).normalize().toArray(s),s}};p(it,"GLTFCubicSplineQuaternionInterpolant");var Ce=it,S={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},v={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Qt={9728:dt,9729:W,9984:ht,9985:mt,9986:pt,9987:Y},Zt={33071:lt,33648:ft,10497:F},ce={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},De={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"},O={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},nn={CUBICSPLINE:void 0,LINEAR:Q,STEP:At},ue={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function sn(h){return h.DefaultMaterial===void 0&&(h.DefaultMaterial=new ne({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:ct})),h.DefaultMaterial}p(sn,"createDefaultMaterial");function P(h,t,e){for(let r in e.extensions)h[r]===void 0&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[r]=e.extensions[r])}p(P,"addUnknownExtensionsToUserData");function C(h,t){t.extras!==void 0&&(typeof t.extras=="object"?Object.assign(h.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}p(C,"assignExtrasToUserData");function rn(h,t,e){let r=!1,n=!1,s=!1;for(let c=0,l=t.length;c<l;c++){let u=t[c];if(u.POSITION!==void 0&&(r=!0),u.NORMAL!==void 0&&(n=!0),u.COLOR_0!==void 0&&(s=!0),r&&n&&s)break}if(!r&&!n&&!s)return Promise.resolve(h);let i=[],a=[],o=[];for(let c=0,l=t.length;c<l;c++){let u=t[c];if(r){let f=u.POSITION!==void 0?e.getDependency("accessor",u.POSITION):h.attributes.position;i.push(f)}if(n){let f=u.NORMAL!==void 0?e.getDependency("accessor",u.NORMAL):h.attributes.normal;a.push(f)}if(s){let f=u.COLOR_0!==void 0?e.getDependency("accessor",u.COLOR_0):h.attributes.color;o.push(f)}}return Promise.all([Promise.all(i),Promise.all(a),Promise.all(o)]).then(function(c){let l=c[0],u=c[1],f=c[2];return r&&(h.morphAttributes.position=l),n&&(h.morphAttributes.normal=u),s&&(h.morphAttributes.color=f),h.morphTargetsRelative=!0,h})}p(rn,"addMorphTargets");function on(h,t){if(h.updateMorphTargets(),t.weights!==void 0)for(let e=0,r=t.weights.length;e<r;e++)h.morphTargetInfluences[e]=t.weights[e];if(t.extras&&Array.isArray(t.extras.targetNames)){let e=t.extras.targetNames;if(h.morphTargetInfluences.length===e.length){h.morphTargetDictionary={};for(let r=0,n=e.length;r<n;r++)h.morphTargetDictionary[e[r]]=r}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}p(on,"updateMorphTargets");function an(h){let t,e=h.extensions&&h.extensions[g.KHR_DRACO_MESH_COMPRESSION];if(e?t="draco:"+e.bufferView+":"+e.indices+":"+le(e.attributes):t=h.indices+":"+le(h.attributes)+":"+h.mode,h.targets!==void 0)for(let r=0,n=h.targets.length;r<n;r++)t+=":"+le(h.targets[r]);return t}p(an,"createPrimitiveKey");function le(h){let t="",e=Object.keys(h).sort();for(let r=0,n=e.length;r<n;r++)t+=e[r]+":"+h[e[r]]+";";return t}p(le,"createAttributesKey");function Pe(h){switch(h){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.")}}p(Pe,"getNormalizedComponentScale");function cn(h){return h.search(/\.jpe?g($|\?)/i)>0||h.search(/^data\:image\/jpeg/)===0?"image/jpeg":h.search(/\.webp($|\?)/i)>0||h.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}p(cn,"getImageURIMimeType");var un=new j,ot=class ot{constructor(t={},e={}){this.json=t,this.extensions={},this.plugins={},this.options=e,this.cache=new en,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let r=!1,n=!1,s=-1;typeof navigator<"u"&&(r=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,n=navigator.userAgent.indexOf("Firefox")>-1,s=n?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||r||n&&s<98?this.textureLoader=new Ft(this.options.manager):this.textureLoader=new zt(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new oe(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(t){this.extensions=t}setPlugins(t){this.plugins=t}parse(t,e){let r=this,n=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(i){return i._markDefs&&i._markDefs()}),Promise.all(this._invokeAll(function(i){return i.beforeRoot&&i.beforeRoot()})).then(function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])}).then(function(i){let a={scene:i[0][n.scene||0],scenes:i[0],animations:i[1],cameras:i[2],asset:n.asset,parser:r,userData:{}};return P(s,a,n),C(a,n),Promise.all(r._invokeAll(function(o){return o.afterRoot&&o.afterRoot(a)})).then(function(){t(a)})}).catch(e)}_markDefs(){let t=this.json.nodes||[],e=this.json.skins||[],r=this.json.meshes||[];for(let n=0,s=e.length;n<s;n++){let i=e[n].joints;for(let a=0,o=i.length;a<o;a++)t[i[a]].isBone=!0}for(let n=0,s=t.length;n<s;n++){let i=t[n];i.mesh!==void 0&&(this._addNodeRef(this.meshCache,i.mesh),i.skin!==void 0&&(r[i.mesh].isSkinnedMesh=!0)),i.camera!==void 0&&this._addNodeRef(this.cameraCache,i.camera)}}_addNodeRef(t,e){e!==void 0&&(t.refs[e]===void 0&&(t.refs[e]=t.uses[e]=0),t.refs[e]++)}_getNodeRef(t,e,r){if(t.refs[e]<=1)return r;let n=r.clone(),s=p((i,a)=>{let o=this.associations.get(i);o!=null&&this.associations.set(a,o);for(let[c,l]of i.children.entries())s(l,a.children[c])},"updateMappings");return s(r,n),n.name+="_instance_"+t.uses[e]++,n}_invokeOne(t){let e=Object.values(this.plugins);e.push(this);for(let r=0;r<e.length;r++){let n=t(e[r]);if(n)return n}return null}_invokeAll(t){let e=Object.values(this.plugins);e.unshift(this);let r=[];for(let n=0;n<e.length;n++){let s=t(e[n]);s&&r.push(s)}return r}getDependency(t,e){let r=t+":"+e,n=this.cache.get(r);if(!n){switch(t){case"scene":n=this.loadScene(e);break;case"node":n=this._invokeOne(function(s){return s.loadNode&&s.loadNode(e)});break;case"mesh":n=this._invokeOne(function(s){return s.loadMesh&&s.loadMesh(e)});break;case"accessor":n=this.loadAccessor(e);break;case"bufferView":n=this._invokeOne(function(s){return s.loadBufferView&&s.loadBufferView(e)});break;case"buffer":n=this.loadBuffer(e);break;case"material":n=this._invokeOne(function(s){return s.loadMaterial&&s.loadMaterial(e)});break;case"texture":n=this._invokeOne(function(s){return s.loadTexture&&s.loadTexture(e)});break;case"skin":n=this.loadSkin(e);break;case"animation":n=this._invokeOne(function(s){return s.loadAnimation&&s.loadAnimation(e)});break;case"camera":n=this.loadCamera(e);break;default:if(n=this._invokeOne(function(s){return s!=this&&s.getDependency&&s.getDependency(t,e)}),!n)throw new Error("Unknown type: "+t);break}this.cache.add(r,n)}return n}getDependencies(t){let e=this.cache.get(t);if(!e){let r=this,n=this.json[t+(t==="mesh"?"es":"s")]||[];e=Promise.all(n.map(function(s,i){return r.getDependency(t,i)})),this.cache.add(t,e)}return e}loadBuffer(t){let e=this.json.buffers[t],r=this.fileLoader;if(e.type&&e.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+e.type+" buffer type is not supported.");if(e.uri===void 0&&t===0)return Promise.resolve(this.extensions[g.KHR_BINARY_GLTF].body);let n=this.options;return new Promise(function(s,i){r.load(B.resolveURL(e.uri,n.path),s,void 0,function(){i(new Error('THREE.GLTFLoader: Failed to load buffer "'+e.uri+'".'))})})}loadBufferView(t){let e=this.json.bufferViews[t];return this.getDependency("buffer",e.buffer).then(function(r){let n=e.byteLength||0,s=e.byteOffset||0;return r.slice(s,s+n)})}loadAccessor(t){let e=this,r=this.json,n=this.json.accessors[t];if(n.bufferView===void 0&&n.sparse===void 0){let i=ce[n.type],a=v[n.componentType],o=n.normalized===!0,c=new a(n.count*i);return Promise.resolve(new X(c,i,o))}let s=[];return n.bufferView!==void 0?s.push(this.getDependency("bufferView",n.bufferView)):s.push(null),n.sparse!==void 0&&(s.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),s.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(s).then(function(i){let a=i[0],o=ce[n.type],c=v[n.componentType],l=c.BYTES_PER_ELEMENT,u=l*o,f=n.byteOffset||0,d=n.bufferView!==void 0?r.bufferViews[n.bufferView].byteStride:void 0,m=n.normalized===!0,R,A;if(d&&d!==u){let T=Math.floor(f/d),E="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+T+":"+n.count,x=e.cache.get(E);x||(R=new c(a,T*d,n.count*d/l),x=new Nt(R,d/l),e.cache.add(E,x)),A=new bt(x,o,f%d/l,m)}else a===null?R=new c(n.count*o):R=new c(a,f,n.count*o),A=new X(R,o,m);if(n.sparse!==void 0){let T=ce.SCALAR,E=v[n.sparse.indices.componentType],x=n.sparse.indices.byteOffset||0,_=n.sparse.values.byteOffset||0,w=new E(i[1],x,n.sparse.count*T),M=new c(i[2],_,n.sparse.count*o);a!==null&&(A=new X(A.array.slice(),A.itemSize,A.normalized));for(let y=0,U=w.length;y<U;y++){let I=w[y];if(A.setX(I,M[y*o]),o>=2&&A.setY(I,M[y*o+1]),o>=3&&A.setZ(I,M[y*o+2]),o>=4&&A.setW(I,M[y*o+3]),o>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return A})}loadTexture(t){let e=this.json,r=this.options,s=e.textures[t].source,i=e.images[s],a=this.textureLoader;if(i.uri){let o=r.manager.getHandler(i.uri);o!==null&&(a=o)}return this.loadTextureImage(t,s,a)}loadTextureImage(t,e,r){let n=this,s=this.json,i=s.textures[t],a=s.images[e],o=(a.uri||a.bufferView)+":"+i.sampler;if(this.textureCache[o])return this.textureCache[o];let c=this.loadImageSource(e,r).then(function(l){l.flipY=!1,l.name=i.name||a.name||"",l.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(l.name=a.uri);let f=(s.samplers||{})[i.sampler]||{};return l.magFilter=Qt[f.magFilter]||W,l.minFilter=Qt[f.minFilter]||Y,l.wrapS=Zt[f.wrapS]||F,l.wrapT=Zt[f.wrapT]||F,n.associations.set(l,{textures:t}),l}).catch(function(){return null});return this.textureCache[o]=c,c}loadImageSource(t,e){let r=this,n=this.json,s=this.options;if(this.sourceCache[t]!==void 0)return this.sourceCache[t].then(u=>u.clone());let i=n.images[t],a=self.URL||self.webkitURL,o=i.uri||"",c=!1;if(i.bufferView!==void 0)o=r.getDependency("bufferView",i.bufferView).then(function(u){c=!0;let f=new Blob([u],{type:i.mimeType});return o=a.createObjectURL(f),o});else if(i.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+t+" is missing URI and bufferView");let l=Promise.resolve(o).then(function(u){return new Promise(function(f,d){let m=f;e.isImageBitmapLoader===!0&&(m=p(function(R){let A=new $(R);A.needsUpdate=!0,f(A)},"onLoad")),e.load(B.resolveURL(u,s.path),m,void 0,d)})}).then(function(u){return c===!0&&a.revokeObjectURL(o),u.userData.mimeType=i.mimeType||cn(i.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",o),u});return this.sourceCache[t]=l,l}assignTexture(t,e,r,n){let s=this;return this.getDependency("texture",r.index).then(function(i){if(!i)return null;if(r.texCoord!==void 0&&r.texCoord>0&&(i=i.clone(),i.channel=r.texCoord),s.extensions[g.KHR_TEXTURE_TRANSFORM]){let a=r.extensions!==void 0?r.extensions[g.KHR_TEXTURE_TRANSFORM]:void 0;if(a){let o=s.associations.get(i);i=s.extensions[g.KHR_TEXTURE_TRANSFORM].extendTexture(i,a),s.associations.set(i,o)}}return n!==void 0&&(i.colorSpace=n),t[e]=i,i})}assignFinalMaterial(t){let e=t.geometry,r=t.material,n=e.attributes.tangent===void 0,s=e.attributes.color!==void 0,i=e.attributes.normal===void 0;if(t.isPoints){let a="PointsMaterial:"+r.uuid,o=this.cache.get(a);o||(o=new Bt,V.prototype.copy.call(o,r),o.color.copy(r.color),o.map=r.map,o.sizeAttenuation=!1,this.cache.add(a,o)),r=o}else if(t.isLine){let a="LineBasicMaterial:"+r.uuid,o=this.cache.get(a);o||(o=new Dt,V.prototype.copy.call(o,r),o.color.copy(r.color),o.map=r.map,this.cache.add(a,o)),r=o}if(n||s||i){let a="ClonedMaterial:"+r.uuid+":";n&&(a+="derivative-tangents:"),s&&(a+="vertex-colors:"),i&&(a+="flat-shading:");let o=this.cache.get(a);o||(o=r.clone(),s&&(o.vertexColors=!0),i&&(o.flatShading=!0),n&&(o.normalScale&&(o.normalScale.y*=-1),o.clearcoatNormalScale&&(o.clearcoatNormalScale.y*=-1)),this.cache.add(a,o),this.associations.set(o,this.associations.get(r))),r=o}t.material=r}getMaterialType(){return ne}loadMaterial(t){let e=this,r=this.json,n=this.extensions,s=r.materials[t],i,a={},o=s.extensions||{},c=[];if(o[g.KHR_MATERIALS_UNLIT]){let u=n[g.KHR_MATERIALS_UNLIT];i=u.getMaterialType(),c.push(u.extendParams(a,s,e))}else{let u=s.pbrMetallicRoughness||{};if(a.color=new L(1,1,1),a.opacity=1,Array.isArray(u.baseColorFactor)){let f=u.baseColorFactor;a.color.setRGB(f[0],f[1],f[2],N),a.opacity=f[3]}u.baseColorTexture!==void 0&&c.push(e.assignTexture(a,"map",u.baseColorTexture,k)),a.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,a.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(c.push(e.assignTexture(a,"metalnessMap",u.metallicRoughnessTexture)),c.push(e.assignTexture(a,"roughnessMap",u.metallicRoughnessTexture))),i=this._invokeOne(function(f){return f.getMaterialType&&f.getMaterialType(t)}),c.push(Promise.all(this._invokeAll(function(f){return f.extendMaterialParams&&f.extendMaterialParams(t,a)})))}s.doubleSided===!0&&(a.side=ut);let l=s.alphaMode||ue.OPAQUE;if(l===ue.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,l===ue.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&i!==H&&(c.push(e.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new Z(1,1),s.normalTexture.scale!==void 0)){let u=s.normalTexture.scale;a.normalScale.set(u,u)}if(s.occlusionTexture!==void 0&&i!==H&&(c.push(e.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&i!==H){let u=s.emissiveFactor;a.emissive=new L().setRGB(u[0],u[1],u[2],N)}return s.emissiveTexture!==void 0&&i!==H&&c.push(e.assignTexture(a,"emissiveMap",s.emissiveTexture,k)),Promise.all(c).then(function(){let u=new i(a);return s.name&&(u.name=s.name),C(u,s),e.associations.set(u,{materials:t}),s.extensions&&P(n,u,s),u})}createUniqueName(t){let e=qt.sanitizeNodeName(t||"");return e in this.nodeNamesUsed?e+"_"+ ++this.nodeNamesUsed[e]:(this.nodeNamesUsed[e]=0,e)}loadGeometries(t){let e=this,r=this.extensions,n=this.primitiveCache;function s(a){return r[g.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,e).then(function(o){return Jt(o,a,e)})}p(s,"createDracoPrimitive");let i=[];for(let a=0,o=t.length;a<o;a++){let c=t[a],l=an(c),u=n[l];if(u)i.push(u.promise);else{let f;c.extensions&&c.extensions[g.KHR_DRACO_MESH_COMPRESSION]?f=s(c):f=Jt(new xt,c,e),n[l]={primitive:c,promise:f},i.push(f)}}return Promise.all(i)}loadMesh(t){let e=this,r=this.json,n=this.extensions,s=r.meshes[t],i=s.primitives,a=[];for(let o=0,c=i.length;o<c;o++){let l=i[o].material===void 0?sn(this.cache):this.getDependency("material",i[o].material);a.push(l)}return a.push(e.loadGeometries(i)),Promise.all(a).then(function(o){let c=o.slice(0,o.length-1),l=o[o.length-1],u=[];for(let d=0,m=l.length;d<m;d++){let R=l[d],A=i[d],T,E=c[d];if(A.mode===S.TRIANGLES||A.mode===S.TRIANGLE_STRIP||A.mode===S.TRIANGLE_FAN||A.mode===void 0)T=s.isSkinnedMesh===!0?new Mt(R,E):new St(R,E),T.isSkinnedMesh===!0&&T.normalizeSkinWeights(),A.mode===S.TRIANGLE_STRIP?T.geometry=ae(T.geometry,gt):A.mode===S.TRIANGLE_FAN&&(T.geometry=ae(T.geometry,Tt));else if(A.mode===S.LINES)T=new kt(R,E);else if(A.mode===S.LINE_STRIP)T=new Pt(R,E);else if(A.mode===S.LINE_LOOP)T=new Ht(R,E);else if(A.mode===S.POINTS)T=new vt(R,E);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+A.mode);Object.keys(T.geometry.morphAttributes).length>0&&on(T,s),T.name=e.createUniqueName(s.name||"mesh_"+t),C(T,s),A.extensions&&P(n,T,A),e.assignFinalMaterial(T),u.push(T)}for(let d=0,m=u.length;d<m;d++)e.associations.set(u[d],{meshes:t,primitives:d});if(u.length===1)return s.extensions&&P(n,u[0],s),u[0];let f=new G;s.extensions&&P(n,f,s),e.associations.set(f,{meshes:t});for(let d=0,m=u.length;d<m;d++)f.add(u[d]);return f})}loadCamera(t){let e,r=this.json.cameras[t],n=r[r.type];if(!n){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return r.type==="perspective"?e=new yt(Rt.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):r.type==="orthographic"&&(e=new wt(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),r.name&&(e.name=this.createUniqueName(r.name)),C(e,r),Promise.resolve(e)}loadSkin(t){let e=this.json.skins[t],r=[];for(let n=0,s=e.joints.length;n<s;n++)r.push(this._loadNodeShallow(e.joints[n]));return e.inverseBindMatrices!==void 0?r.push(this.getDependency("accessor",e.inverseBindMatrices)):r.push(null),Promise.all(r).then(function(n){let s=n.pop(),i=n,a=[],o=[];for(let c=0,l=i.length;c<l;c++){let u=i[c];if(u){a.push(u);let f=new j;s!==null&&f.fromArray(s.array,c*16),o.push(f)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',e.joints[c])}return new Lt(a,o)})}loadAnimation(t){let e=this.json,r=this,n=e.animations[t],s=n.name?n.name:"animation_"+t,i=[],a=[],o=[],c=[],l=[];for(let u=0,f=n.channels.length;u<f;u++){let d=n.channels[u],m=n.samplers[d.sampler],R=d.target,A=R.node,T=n.parameters!==void 0?n.parameters[m.input]:m.input,E=n.parameters!==void 0?n.parameters[m.output]:m.output;R.node!==void 0&&(i.push(this.getDependency("node",A)),a.push(this.getDependency("accessor",T)),o.push(this.getDependency("accessor",E)),c.push(m),l.push(R))}return Promise.all([Promise.all(i),Promise.all(a),Promise.all(o),Promise.all(c),Promise.all(l)]).then(function(u){let f=u[0],d=u[1],m=u[2],R=u[3],A=u[4],T=[];for(let E=0,x=f.length;E<x;E++){let _=f[E],w=d[E],M=m[E],y=R[E],U=A[E];if(_===void 0)continue;_.updateMatrix&&_.updateMatrix();let I=r._createAnimationTracks(_,w,M,y,U);if(I)for(let q=0;q<I.length;q++)T.push(I[q])}return new jt(s,void 0,T)})}createNodeMesh(t){let e=this.json,r=this,n=e.nodes[t];return n.mesh===void 0?null:r.getDependency("mesh",n.mesh).then(function(s){let i=r._getNodeRef(r.meshCache,n.mesh,s);return n.weights!==void 0&&i.traverse(function(a){if(a.isMesh)for(let o=0,c=n.weights.length;o<c;o++)a.morphTargetInfluences[o]=n.weights[o]}),i})}loadNode(t){let e=this.json,r=this,n=e.nodes[t],s=r._loadNodeShallow(t),i=[],a=n.children||[];for(let c=0,l=a.length;c<l;c++)i.push(r.getDependency("node",a[c]));let o=n.skin===void 0?Promise.resolve(null):r.getDependency("skin",n.skin);return Promise.all([s,Promise.all(i),o]).then(function(c){let l=c[0],u=c[1],f=c[2];f!==null&&l.traverse(function(d){d.isSkinnedMesh&&d.bind(f,un)});for(let d=0,m=u.length;d<m;d++)l.add(u[d]);return l})}_loadNodeShallow(t){let e=this.json,r=this.extensions,n=this;if(this.nodeCache[t]!==void 0)return this.nodeCache[t];let s=e.nodes[t],i=s.name?n.createUniqueName(s.name):"",a=[],o=n._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(t)});return o&&a.push(o),s.camera!==void 0&&a.push(n.getDependency("camera",s.camera).then(function(c){return n._getNodeRef(n.cameraCache,s.camera,c)})),n._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(t)}).forEach(function(c){a.push(c)}),this.nodeCache[t]=Promise.all(a).then(function(c){let l;if(s.isBone===!0?l=new It:c.length>1?l=new G:c.length===1?l=c[0]:l=new te,l!==c[0])for(let u=0,f=c.length;u<f;u++)l.add(c[u]);if(s.name&&(l.userData.name=s.name,l.name=i),C(l,s),s.extensions&&P(r,l,s),s.matrix!==void 0){let u=new j;u.fromArray(s.matrix),l.applyMatrix4(u)}else s.translation!==void 0&&l.position.fromArray(s.translation),s.rotation!==void 0&&l.quaternion.fromArray(s.rotation),s.scale!==void 0&&l.scale.fromArray(s.scale);return n.associations.has(l)||n.associations.set(l,{}),n.associations.get(l).nodes=t,l}),this.nodeCache[t]}loadScene(t){let e=this.extensions,r=this.json.scenes[t],n=this,s=new G;r.name&&(s.name=n.createUniqueName(r.name)),C(s,r),r.extensions&&P(e,s,r);let i=r.nodes||[],a=[];for(let o=0,c=i.length;o<c;o++)a.push(n.getDependency("node",i[o]));return Promise.all(a).then(function(o){for(let l=0,u=o.length;l<u;l++)s.add(o[l]);let c=p(l=>{let u=new Map;for(let[f,d]of n.associations)(f instanceof V||f instanceof $)&&u.set(f,d);return l.traverse(f=>{let d=n.associations.get(f);d!=null&&u.set(f,d)}),u},"reduceAssociations");return n.associations=c(s),s})}_createAnimationTracks(t,e,r,n,s){let i=[],a=t.name?t.name:t.uuid,o=[];O[s.path]===O.weights?t.traverse(function(f){f.morphTargetInfluences&&o.push(f.name?f.name:f.uuid)}):o.push(a);let c;switch(O[s.path]){case O.weights:c=se;break;case O.rotation:c=re;break;case O.position:case O.scale:c=ie;break;default:switch(r.itemSize){case 1:c=se;break;case 2:case 3:default:c=ie;break}break}let l=n.interpolation!==void 0?nn[n.interpolation]:Q,u=this._getArrayFromAccessor(r);for(let f=0,d=o.length;f<d;f++){let m=new c(o[f]+"."+O[s.path],e.array,u,l);n.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(m),i.push(m)}return i}_getArrayFromAccessor(t){let e=t.array;if(t.normalized){let r=Pe(e.constructor),n=new Float32Array(e.length);for(let s=0,i=e.length;s<i;s++)n[s]=e[s]*r;e=n}return e}_createCubicSplineTrackInterpolant(t){t.createInterpolant=p(function(r){let n=this instanceof re?Ce:z;return new n(this.times,this.values,this.getValueSize()/3,r)},"InterpolantFactoryMethodGLTFCubicSpline"),t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}};p(ot,"GLTFParser");var ke=ot;function ln(h,t,e){let r=t.attributes,n=new _t;if(r.POSITION!==void 0){let a=e.json.accessors[r.POSITION],o=a.min,c=a.max;if(o!==void 0&&c!==void 0){if(n.set(new D(o[0],o[1],o[2]),new D(c[0],c[1],c[2])),a.normalized){let l=Pe(v[a.componentType]);n.min.multiplyScalar(l),n.max.multiplyScalar(l)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;let s=t.targets;if(s!==void 0){let a=new D,o=new D;for(let c=0,l=s.length;c<l;c++){let u=s[c];if(u.POSITION!==void 0){let f=e.json.accessors[u.POSITION],d=f.min,m=f.max;if(d!==void 0&&m!==void 0){if(o.setX(Math.max(Math.abs(d[0]),Math.abs(m[0]))),o.setY(Math.max(Math.abs(d[1]),Math.abs(m[1]))),o.setZ(Math.max(Math.abs(d[2]),Math.abs(m[2]))),f.normalized){let R=Pe(v[f.componentType]);o.multiplyScalar(R)}a.max(o)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}n.expandByVector(a)}h.boundingBox=n;let i=new Et;n.getCenter(i.center),i.radius=n.min.distanceTo(n.max)/2,h.boundingSphere=i}p(ln,"computeBounds");function Jt(h,t,e){let r=t.attributes,n=[];function s(i,a){return e.getDependency("accessor",i).then(function(o){h.setAttribute(a,o)})}p(s,"assignAttributeAccessor");for(let i in r){let a=De[i]||i.toLowerCase();a in h.attributes||n.push(s(r[i],a))}if(t.indices!==void 0&&!h.index){let i=e.getDependency("accessor",t.indices).then(function(a){h.setIndex(a)});n.push(i)}return J.workingColorSpace!==N&&"COLOR_0"in r&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${J.workingColorSpace}" not supported.`),C(h,t),ln(h,t,e),Promise.all(n).then(function(){return t.targets!==void 0?rn(h,t.targets,e):h})}p(Jt,"addPrimitiveAttributes");export{Wt as GLTFLoader};