UNPKG

@acdh-oeaw/universalviewer

Version:

The Universal Viewer is a community-developed open source project on a mission to help you share your 📚📜📰📽️📻🗿 with the 🌎

2,556 lines 884 kB
import{a as Il}from"./chunk-ENN6EEDW.js";import{a as Ol}from"./chunk-MYFOSXPU.js";import{a as Pl}from"./chunk-TVVVZZ43.js";import{a as Er,b as tn,d as Jo}from"./chunk-Y2TXPXZV.js";import{a as Ll,b as Cl,d as Rl}from"./chunk-MOC77MIC.js";import{b as Al,c as Ri,d as Na,e as zn,j as Ba}from"./chunk-4DAZ7WDM.js";import{a as Ye,b as Qo,c as Dl,e as T,f as ut,g as kl,i as ve,j as Nl,k as Bl,l as ht,m as za,n as Ln,o as dt}from"./chunk-JFPB5N6O.js";import"./chunk-L67DAW3A.js";var _h=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,r){i.__proto__=r}||function(i,r){for(var a in r)r.hasOwnProperty(a)&&(i[a]=r[a])},e(t,n)};return function(t,n){e(t,n);function i(){this.constructor=t}t.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)}}(),te=function(e,t,n,i){return new(n||(n=Promise))(function(r,a){function o(c){try{l(i.next(c))}catch(u){a(u)}}function s(c){try{l(i.throw(c))}catch(u){a(u)}}function l(c){c.done?r(c.value):new n(function(u){u(c.value)}).then(o,s)}l((i=i.apply(e,t||[])).next())})},ne=function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,r,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(c){return function(u){return l([c,u])}}function l(c){if(i)throw new TypeError("Generator is already executing.");for(;n;)try{if(i=1,r&&(a=c[0]&2?r.return:c[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,c[1])).done)return a;switch(r=0,a&&(c=[c[0]&2,a.value]),c[0]){case 0:case 1:a=c;break;case 4:return n.label++,{value:c[1],done:!1};case 5:n.label++,r=c[1],c=[0];continue;case 7:c=n.ops.pop(),n.trys.pop();continue;default:if(a=n.trys,!(a=a.length>0&&a[a.length-1])&&(c[0]===6||c[0]===2)){n=0;continue}if(c[0]===3&&(!a||c[1]>a[0]&&c[1]<a[3])){n.label=c[1];break}if(c[0]===6&&n.label<a[1]){n.label=a[1],a=c;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(c);break}a[2]&&n.ops.pop(),n.trys.pop();continue}c=t.call(e,n)}catch(u){c=[6,u],r=0}finally{i=a=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}},qe=void 0,Gs="data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgNTEyIDUxMiIgY2xhc3M9InMtaW9uLWljb24iPjxwYXRoIGQ9Ik05NiAyMzVoMzIwdjQySDk2eiI+PC9wYXRoPjwvc3ZnPgo=",Vs="data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgNTEyIDUxMiIgY2xhc3M9InMtaW9uLWljb24iPjxwYXRoIGQ9Ik0xODYuMzAxIDMzOS44OTNMOTYgMjQ5LjQ2MWwtMzIgMzAuNTA3TDE4Ni4zMDEgNDAyIDQ0OCAxNDAuNTA2IDQxNiAxMTB6Ij48L3BhdGg+PC9zdmc+Cg==",wh="Description",Eh="Title",Mh="Update",Sh={delete:"Delete",description:wh,title:Eh,update:Mh},m0=function(){function e(t){Ye(this,t),this._contentStrings=Sh,this.deleteAngle=ve(this,"deleteAngle",7),this.saveAngle=ve(this,"saveAngle",7)}return e.prototype.render=function(){var t=this;if(this.angle){var n=this.angle,i=n[0],r=n[1];return T("form",{onSubmit:function(a){return a.preventDefault()}},T("ion-item",null,T("ion-input",{id:"title",value:r.title,placeholder:this._contentStrings.title,required:!0,onIonChange:function(a){return r.title=a.detail.value},maxlength:20})),T("ion-item",null,T("ion-textarea",{id:"description",value:r.description,placeholder:this._contentStrings.description,rows:5,onIonChange:function(a){return r.description=a.detail.value},maxlength:280})),T("ion-item",null,T("ion-button",{size:"small",onClick:function(){t.deleteAngle.emit(i),t.angle=null}},T("ion-icon",{src:Gs}),"\xA0",this._contentStrings.delete),T("ion-button",{size:"small",type:"submit",onClick:function(){r.title&&t.saveAngle.emit([i,r])}},T("ion-icon",{src:Vs}),"\xA0",this._contentStrings.update)))}return null},Object.defineProperty(e,"style",{get:function(){return"#title{--background:var(--al-input-background-color);--color:var(--al-input-color);--padding-bottom:var(--al-input-padding-bottom);--padding-end:var(--al-input-padding-end);--padding-start:var(--al-input-padding-start);--padding-top:var(--al-input-padding-top);font-size:var(--al-input-font-size)}#description{--background:var(--al-textarea-background-color);--color:var(--al-textarea-color);--padding-bottom:var(--al-textarea-padding-bottom);--padding-end:var(--al-textarea-padding-end);--padding-start:var(--al-textarea-padding-start);--padding-top:var(--al-textarea-padding-top);font-size:var(--al-textarea-font-size)}"},enumerable:!0,configurable:!0}),e}(),Th="data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgNTEyIDUxMiIgY2xhc3M9InMtaW9uLWljb24iPjxwYXRoIGQ9Ik0xOTIgMTI4bDEyOCAxMjgtMTI4IDEyOHoiPjwvcGF0aD48L3N2Zz4K",Ah="Update",Lh={update:Ah},v0=function(){function e(t){Ye(this,t),this._contentStrings=Lh,this.graph=null,this.tabSize=2,this.graphSubmitted=ve(this,"graphSubmitted",7)}return e.prototype._getGraphJson=function(){var t="";try{t=JSON.stringify(JSON.parse(this.graph),void 0,this.tabSize)}catch{}return t},e.prototype.render=function(){var t=this;return T("form",{onSubmit:function(n){return n.preventDefault()}},T("ion-item",null,T("ion-textarea",{id:"graph",value:this._getGraphJson(),rows:10,required:!0,onIonChange:function(n){return t.graph=n.detail.value},ref:function(n){return t._graph=n}})),T("ion-item",null,T("ion-button",{size:"small",type:"submit",onClick:function(){t.graph&&t.graphSubmitted.emit(t._graph.value)}},T("ion-icon",{src:Th}),"\xA0",this._contentStrings.update)))},Object.defineProperty(e,"style",{get:function(){return"#graph{--background:var(--al-textarea-background-color);--color:var(--al-textarea-color);--padding-bottom:var(--al-textarea-padding-bottom);--padding-end:var(--al-textarea-padding-end);--padding-start:var(--al-textarea-padding-start);--padding-top:var(--al-textarea-padding-top);font-size:var(--al-console-font-size)}"},enumerable:!0,configurable:!0}),e}(),Ch="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDIzLjAuNiwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCA1MTIgNTEyIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA1MTIgNTEyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxwYXRoIGQ9Ik00MjQsNjRIODhjLTI2LjYsMC00OCwyMS42LTQ4LDQ4djI4OGMwLDI2LjQsMjEuNCw0OCw0OCw0OGgzMzZjMjYuNCwwLDQ4LTIxLjYsNDgtNDhWMTEyQzQ3Miw4NS42LDQ1MC42LDY0LDQyNCw2NHoKCSBNNDI0LDQwMEg4OFYxNzZoMzM2VjQwMHoiLz4KPHBhdGggZD0iTTIwMi42LDI4Ni40bC01OC4zLDU4LjNjLTIuOCwyLjgtNy40LDIuOC0xMC4yLDBsLTYuOC02LjhjLTIuOC0yLjgtMi44LTcuNCwwLTEwLjJsNDYuMi00Ni40bC00Ni4yLTQ2LjQKCWMtMi44LTIuOC0yLjgtNy40LDAtMTAuMmw2LjgtNi44YzIuOC0yLjgsNy40LTIuOCwxMC4yLDBsNTguMyw1OC4zQzIwNS40LDI3OSwyMDUuNCwyODMuNiwyMDIuNiwyODYuNHogTTM0My4yLDM0MS4zdi05LjYKCWMwLTQtMy4yLTcuMi03LjItNy4yaC05MS4yYy00LDAtNy4yLDMuMi03LjIsNy4ydjkuNmMwLDQsMy4yLDcuMiw3LjIsNy4ySDMzNkMzMzkuOSwzNDguNSwzNDMuMiwzNDUuMywzNDMuMiwzNDEuM3oiLz4KPC9zdmc+Cg==",Rh="data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgNTEyIDUxMiIgY2xhc3M9InMtaW9uLWljb24iPjxwYXRoIGQ9Ik0yNTYgNDhDMTQxLjEyNSA0OCA0OCAxNDEuMTI1IDQ4IDI1NnM5My4xMjUgMjA4IDIwOCAyMDggMjA4LTkzLjEyNSAyMDgtMjA4UzM3MC44NzUgNDggMjU2IDQ4em0xMDcgMjI5aC04NnY4NmgtNDJ2LTg2aC04NnYtNDJoODZ2LTg2aDQydjg2aDg2djQyeiI+PC9wYXRoPjwvc3ZnPgo=",Ih="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1MTIgNTEyIj48cGF0aCBkPSJNMzIgMzg0aDI3MnYzMkgzMnpNNDAwIDM4NGg4MHYzMmgtODB6TTM4NCA0NDcuNWMwIDE3Ljk0OS0xNC4zMjcgMzIuNS0zMiAzMi41LTE3LjY3MyAwLTMyLTE0LjU1MS0zMi0zMi41di05NWMwLTE3Ljk0OSAxNC4zMjctMzIuNSAzMi0zMi41IDE3LjY3MyAwIDMyIDE0LjU1MSAzMiAzMi41djk1eiIvPjxnPjxwYXRoIGQ9Ik0zMiAyNDBoODB2MzJIMzJ6TTIwOCAyNDBoMjcydjMySDIwOHpNMTkyIDMwMy41YzAgMTcuOTQ5LTE0LjMyNyAzMi41LTMyIDMyLjUtMTcuNjczIDAtMzItMTQuNTUxLTMyLTMyLjV2LTk1YzAtMTcuOTQ5IDE0LjMyNy0zMi41IDMyLTMyLjUgMTcuNjczIDAgMzIgMTQuNTUxIDMyIDMyLjV2OTV6Ii8+PC9nPjxnPjxwYXRoIGQ9Ik0zMiA5NmgyNzJ2MzJIMzJ6TTQwMCA5Nmg4MHYzMmgtODB6TTM4NCAxNTkuNWMwIDE3Ljk0OS0xNC4zMjcgMzIuNS0zMiAzMi41LTE3LjY3MyAwLTMyLTE0LjU1MS0zMi0zMi41di05NWMwLTE3Ljk0OSAxNC4zMjctMzIuNSAzMi0zMi41IDE3LjY3MyAwIDMyIDE0LjU1MSAzMiAzMi41djk1eiIvPjwvZz48L3N2Zz4=",Ph="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1MTIgNTEyIj48cGF0aCBkPSJNNDAzLjAwMiAyMTcuMDAxQzM4OC45OTggMTQ4LjAwMiAzMjguOTk4IDk2IDI1NiA5NmMtNTcuOTk4IDAtMTA3Ljk5OCAzMi45OTgtMTMyLjk5OCA4MS4wMDFDNjMuMDAyIDE4My4wMDIgMTYgMjMzLjk5OCAxNiAyOTZjMCA2NS45OTYgNTMuOTk5IDEyMCAxMjAgMTIwaDI2MGM1NSAwIDEwMC00NSAxMDAtMTAwIDAtNTIuOTk4LTQwLjk5Ni05Ni4wMDEtOTIuOTk4LTk4Ljk5OXpNMjg4IDI3NnY3NmgtNjR2LTc2aC02OGwxMDAtMTAwIDEwMCAxMDBoLTY4eiIvPjwvc3ZnPg==",$o=function(e,t){return T("div",{style:{"overflow-y":"auto",width:"100%","min-height":"0","max-height":"100%",height:e.height}},t)},Oh="Console",Dh="Nodes",kh="Settings",Nh="Source",Bh={console:Oh,graph:Dh,settings:kh,src:Nh},U=function(){function e(){}return e}();U.boundingBoxWidth=2;U.controllerName="-controller";U.edgeMinSize=75e-6;U.edgeSize=.0075;U.fov=45;U.fontSizeLarge=1;U.fontSizeMedium=.7;U.fontSizeSmall=.4;U.frustrumScaleFactor=.5;U.lightIntensity=.5;U.maxAnimationSteps=50;U.minLoadingMS=500;U.movedEventName="-moved";U.movingStepCount=2;U.nodeMinSize=2e-4;U.nodeSize=.02;U.stackSpaceMultiplier={x:10,y:10,z:10};U.stepPowerMinMax=[1,10];U.targetFrameTime=1e3/24;U.textUnitsDecimalPlaces=3;U.titleIdName="-title";U.topLayerRenderOrder=999;U.unitsDecimalPlaces=6;U.zoomFactor=3;U.volumeRaycastSensitivity=.05;U.volumeStepsDelay=800;U.textPadding={width:.03,height:.03};U.minFrameMS=15;U.minTimeForThrottle=U.minFrameMS*5;U.buttonColors={active:"#f50057",hover:"#f50057",up:"#00b0ff"};U.colors={red:"#f50057",blue:"#00b0ff",black:"#000000",grey:"#222222",white:"#ffffff",yellow:"#ffeb3b",green:"#76ff03",lightRed:"#f77777"};U.lights={ambientLightColor:13684944,ambientLightIntensity:.25,directionalLight1Color:16777215,directionalLight1Intensity:.75,directionalLight2Color:10584,directionalLight2Intensity:.5};U.camera={dampingFactor:.25,far:1e4,fov:U.fov,maxDistance:8e3,maxPolarAngle:175,minDistance:0,minPolarAngle:5,near:.05,nearFactor:.9,orbitPanSpeed:.3,orbitRotateSpeed:.5,orbitZoomSpeed:1,panSpeed:.9,trackballRotateSpeed:2.5,trackballZoomSpeed:5};var Jt;(function(e){e.NODE="node",e.EDGE="edge",e.ANGLE="angle"})(Jt||(Jt={}));var Ft;(function(e){e.ORBIT="orbit",e.TRACKBALL="trackball"})(Ft||(Ft={}));var Ve;(function(e){e.SLICES="slices",e.VOLUME="volume",e.MESH="mesh"})(Ve||(Ve={}));var ms;(function(e){e.DEFAULT="default",e.CLAY="clay",e.XRAY="xray",e.NORMALS="normals",e.WIREFRAME="wireframe"})(ms||(ms={}));var Ka;(function(e){e.GLTF="gltf",e.GLB="glb"})(Ka||(Ka={}));var yn;(function(e){e.CORONAL="coronal",e.SAGGITAL="saggital",e.AXIAL="axial"})(yn||(yn={}));var zl;(function(e){e.LOCK="LOCK",e.MESH="MESH"})(zl||(zl={}));var Wt;(function(e){e.MILLIMETERS="mm",e.METERS="m"})(Wt||(Wt={}));var eo;(function(e){e.DCM="dcm",e.DICOM="dicom"})(eo||(eo={}));var ge=function(){function e(){}return e.isWebGL2Available=function(){try{var t=document.createElement("canvas");return!!(window.WebGL2RenderingContext&&t.getContext("webgl2"))}catch{return!1}},e.enableControls=function(t,n,i){i===Ft.TRACKBALL?t.setAttribute("al-trackball-control","enabled: "+n):t.setAttribute("al-orbit-control","enabled: "+n)},e.waitOneFrame=function(t){window.setTimeout(function(){t()},U.minFrameMS)},e.objectToVector3=function(t){var n=new THREE.Vector3;return n.x=t.x,n.y=t.y,n.z=t.z,n},e.worldToScreen=function(t,n,i){var r=t.clone();return r.project(n),r.x=Math.round((r.x+1)*i.offsetWidth/2),r.y=Math.round((-r.y+1)*i.offsetHeight/2),r.z=0,r},e.normaliseNumber=function(t){return Number(t.toFixed(U.unitsDecimalPlaces))},e.vector3ToString=function(t){return t.toArray().join(" ")},e.vector3ToNormalisedString=function(t){var n=e.normaliseNumber(t.x),i=e.normaliseNumber(t.y),r=e.normaliseNumber(t.z);return n+" "+i+" "+r},e.stringToVector3=function(t){var n=t.split(" "),i=new THREE.Vector3;return i.x=Number(n[0]),i.y=Number(n[1]),i.z=Number(n[2]),i},e.normaliseStringVector3=function(t){return e.vector3ToNormalisedString(e.stringToVector3(t))},e.slerp=function(t,n,i){var r=i,a=t,o=n,s=a.angleTo(o);if(s){s=THREE.Math.clamp(s,-.99,.99);var l=Math.sin(1-r)*s,c=Math.sin(r*s),u=Math.sin(s),h=l/u,d=c/u,f=a.clone().multiplyScalar(h),p=o.clone().multiplyScalar(d),v=f.add(p);return v}else return null},e.easeInOutCubic=function(t){return t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1},e.getSlerpCameraPath=function(t,n,i,r){for(var a=[],o=t.position.clone().addScalar(Number.EPSILON),s=t.target.clone().addScalar(Number.EPSILON),l=n.position.clone().addScalar(Number.EPSILON),c=n.target.clone().addScalar(Number.EPSILON),u=0;u<=U.maxAnimationSteps;u++){var h=this.easeInOutCubic(u/U.maxAnimationSteps);a.push({position:i?e.slerp(o.clone(),l.clone(),h):l,target:r?e.slerp(s.clone(),c.clone(),h):c})}return a},e.getSlerp3Path=function(t,n){for(var i=[],r=t.clone().addScalar(Number.EPSILON),a=n.clone().addScalar(Number.EPSILON),o=0;o<=U.maxAnimationSteps;o++){var s=this.easeInOutCubic(o/U.maxAnimationSteps);i.push(e.slerp(r.clone(),a.clone(),s))}return i},e.lookToFrustrumSpace=function(t,n,i,r){var a=new THREE.Vector3;n.getWorldDirection(a);var o=r.distanceTo(new THREE.Vector3(0,0,0)),s=new THREE.Plane(a,o),l=new THREE.Vector3;s.projectPoint(i,l),t.lookAt(l)},e.getFrustrumSpaceDistance=function(t,n,i){var r=new THREE.Vector3;t.getWorldDirection(r);var a=i.distanceTo(new THREE.Vector3(0,0,0)),o=new THREE.Plane(r,a),s=new THREE.Vector3;o.projectPoint(n,s);var l=new THREE.Ray(n);l.lookAt(s);var c=l.distanceToPlane(o);return c},e}(),zh=function(){function e(){}return e._traceDataRay=function(t,n,i,r,a,o,s,l,c,u){var h=0,d=Math.floor,f=d(n)|0,p=d(i)|0,v=d(r)|0,m=a>0?1:-1,g=o>0?1:-1,y=s>0?1:-1,b=Math.abs(1/a),_=Math.abs(1/o),w=Math.abs(1/s),L=m>0?f+1-n:n-f,R=g>0?p+1-i:i-p,k=y>0?v+1-r:r-v,O=b<1/0?b*L:1/0,z=_<1/0?_*R:1/0,C=w<1/0?w*k:1/0,I=t.windowCenter-t.windowWidth*.5;I-=I*U.volumeRaycastSensitivity;for(var N=-1;h<=l;){var H=void 0,G=new THREE.Vector3(f,p,v),X=AMI.CoreUtils.worldToData(t.stack.lps2IJK,G),Z=AMI.CoreUtils.getPixelData(t.stack,X);if(Z!==null&&Z>I?H=1:H=0,H)return c&&(c.x=n+h*a,c.y=i+h*o,c.z=r+h*s),u&&(u.x=u.y=u.z=0,N===0&&(u.x=-m),N===1&&(u.y=-g),N===2&&(u.z=-y)),H;O<z?O<C?(f+=m,h=O,O+=b,N=0):(v+=y,h=C,C+=w,N=2):z<C?(p+=g,h=z,z+=_,N=1):(v+=y,h=C,C+=w,N=2)}return c&&(c.x=n+h*a,c.y=i+h*o,c.z=r+h*s),u&&(u.x=u.y=u.z=0),0},e.volumeRay=function(t,n,i,r,a,o){var s=+n.x,l=+n.y,c=+n.z,u=+i.x,h=+i.y,d=+i.z,f=Math.sqrt(u*u+h*h+d*d);if(f===0)throw new Error("Can't raycast along a zero vector");return u/=f,h/=f,d/=f,typeof r>"u"?r=64:r=+r,this._traceDataRay(t,s,l,c,u,h,d,r,a,o)},e.toAframeSpace=function(t){return t.divide(ge.objectToVector3(U.stackSpaceMultiplier))},e}(),vc=function(){function e(){}return e.debounce=function(t,n){return n=n||100,function(){if(!t.debouncing){var i=Array.prototype.slice.apply(arguments);t.lastReturnVal=t.apply(this,i),t.debouncing=!0}return clearTimeout(t.debounceTimeout),t.debounceTimeout=setTimeout(function(){t.debouncing=!1},n),t.lastReturnVal}},e}(),ot=function(){function e(){}return e}();ot.SELECTED="al-graph-selected";ot.POINTER_OVER="al-graph-pointer-over";ot.POINTER_OUT="al-graph-pointer-out";ot.DRAGGED="al-graph-dragged";ot.POINTER_DOWN="al-graph-pointer-down";ot.POINTER_UP="al-graph-pointer-up";var Fa=function(){function e(){}return e.getEntryWithHighestId=function(t){return t.size?Math.max.apply(Math,Array.from(t).map(function(n){var i=n[0];return Number(i.split(" ")[1])})):0},e.getNextId=function(t,n){return t.charAt(0).toUpperCase()+t.slice(1)+" "+Number(this.getEntryWithHighestId(n)+1)},e}(),rt=function(){function e(){}return e.addCssUnits=function(t){return this.cssUnits.some(function(n){return t.includes(n)})||(t+="px"),t},e.getFileExtension=function(t){return t.substring(t.lastIndexOf(".")+1)},e.getFileEndCharacters=function(t,n){return t.slice(t.length-n)},e.getGeometryCenter=function(t){var n;return t instanceof THREE.BufferGeometry?n=new THREE.Geometry().fromBufferGeometry(t):n=t,n.computeBoundingSphere(),n.boundingSphere.center},e.getSceneDistanceFromMesh=function(t,n,i){if(t){var r=t.geometry.boundingSphere;return n*r.radius/Math.tan(i*Math.PI/180)}return null},e.getSceneDistanceFromModel=function(t,n,i){if(t){var r=e.getBoundingBox(t),a=new THREE.Sphere;return r.getBoundingSphere(a),n*a.radius/Math.tan(i*Math.PI/180)}return null},e.getCameraStateFromMesh=function(t,n){if(t){var i=t.geometry,r=this.getGeometryCenter(i),a=new THREE.Vector3;return a.copy(r),a.z+=n,{target:r,position:a}}return null},e.getCameraStateFromModel=function(t,n){if(t){var i=e.getBoundingBox(t),r=new THREE.Vector3;i.getCenter(r);var a=new THREE.Vector3;return a.y=r.y,a.z+=n,{target:r,position:a}}return null},e.getCameraPositionFromNode=function(t,n,i){if(!t)return null;var r=new THREE.Vector3;r.copy(AFRAME.utils.coordinates.parse(t.position));var a=r.clone().sub(i.clone()).normalize(),o=new THREE.Vector3;return o.copy(r),o.add(a.clone().multiplyScalar(n*U.zoomFactor)),o},e.getNearFromSceneDistance=function(t){return t?t*(1-U.camera.nearFactor):null},e.getFarFromSceneDistance=function(t){return t?t*100:null},e.getBoundingBox=function(t){return new THREE.Box3().setFromObject(t)},e.normalise=function(t,n,i){return(t-n)/(i-n)},e.reverseNumber=function(t,n,i){return i+n-t},e}();rt.cssUnits=["%","ch","cm","em","ex","in","mm","pc","pt","px","rem","vh","vmax","vmin","vw"];var g0=function(){function e(t){Ye(this,t),this._contentStrings=Bh,this.angles=null,this.consoleTabEnabled=!0,this.edges=null,this.graphTabEnabled=!0,this.nodes=null,this.selected=null,this.settingsTabEnabled=!0,this.srcTabEnabled=!0,this.tabContentHeight=null,this.url=null,this.urls=null}return e.prototype._getGraphJson=function(){if(this.nodes&&this.edges&&this.angles){var t=Array.from(this.nodes),n={nodes:t.map(function(i){var r=i[0],a=i[1];return[r,{normal:a.normal?ge.normaliseStringVector3(a.normal):new THREE.Vector3,position:ge.normaliseStringVector3(a.position),scale:ge.normaliseNumber(a.scale),targetId:a.targetId,title:a.title,description:a.description}]}),edges:Array.from(this.edges),angles:Array.from(this.angles)};return JSON.stringify(n)}return""},e.prototype.render=function(){var t=this.tabContentHeight||this.el.parentElement.clientHeight+"px",n=[this.consoleTabEnabled,this.graphTabEnabled,this.settingsTabEnabled,this.srcTabEnabled].filter(Boolean).length;return T("ion-app",null,T("al-tabs",null,n>1?T("ion-tab-bar",null,this.srcTabEnabled?T("ion-tab-button",{tab:"src"},T("ion-icon",{src:Ph}),T("ion-label",null,this._contentStrings.src)):null,this.settingsTabEnabled?T("ion-tab-button",{tab:"settings"},T("ion-icon",{src:Ih}),T("ion-label",null,this._contentStrings.settings)):null,this.graphTabEnabled?T("ion-tab-button",{tab:"graph"},T("ion-icon",{src:Rh}),T("ion-label",null,this._contentStrings.graph)):null,this.consoleTabEnabled?T("ion-tab-button",{tab:"console"},T("ion-icon",{src:Ch}),T("ion-label",null,this._contentStrings.console)):null):null,this.srcTabEnabled?T("ion-tab",{tab:"src"},T("al-view-controls",{"bounding-box-enabled":this.boundingBoxEnabled,"controls-type":this.controlsType}),T("al-url-picker",{urls:this.urls,url:this.url})):null,this.settingsTabEnabled?T("ion-tab",{tab:"settings"},T($o,{height:t},T("al-view-controls",{"bounding-box-enabled":this.boundingBoxEnabled,"controls-type":this.controlsType}),T("al-settings",{"display-mode":this.displayMode,orientation:this.orientation,"slices-index":this.slicesIndex,"slices-max-index":this.slicesMaxIndex,"slices-brightness":this.slicesBrightness,"slices-contrast":this.slicesContrast,"volume-brightness":this.volumeBrightness,"volume-contrast":this.volumeContrast,"volume-steps":this.volumeSteps,"volume-steps-high-enabled":this.volumeStepsHighEnabled}))):null,this.graphTabEnabled?T("ion-tab",{tab:"graph"},T($o,{height:t},T("al-view-controls",{"bounding-box-enabled":this.boundingBoxEnabled,"controls-type":this.controlsType}),T("al-graph-editor",{selected:this.selected,nodes:this.nodes,angles:this.angles,edges:this.edges,"graph-enabled":this.graphEnabled,"graph-visible":this.graphTabEnabled,units:this.units}))):null,this.consoleTabEnabled?T("ion-tab",{tab:"console"},T($o,{height:t},T("al-view-controls",{"bounding-box-enabled":this.boundingBoxEnabled,"controls-type":this.controlsType}),T("al-console",{graph:this._getGraphJson()}))):null))},Object.defineProperty(e.prototype,"el",{get:function(){return ht(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e,"style",{get:function(){return"al-tabs{--ion-tab-bar-border-color:var(--al-item-border-color)}"},enumerable:!0,configurable:!0}),e}(),Fh="Description",Hh="Title",Uh="Update",Gh={delete:"Delete",description:Fh,title:Hh,update:Uh},y0=function(){function e(t){Ye(this,t),this._contentStrings=Gh,this.deleteEdge=ve(this,"deleteEdge",7),this.saveEdge=ve(this,"saveEdge",7)}return e.prototype.render=function(){var t=this;if(this.edge){var n=this.edge,i=n[0],r=n[1];return T("form",{onSubmit:function(a){return a.preventDefault()}},T("ion-item",null,T("ion-input",{id:"title",value:r.title,placeholder:this._contentStrings.title,required:!0,onIonChange:function(a){return r.title=a.detail.value},maxlength:20})),T("ion-item",null,T("ion-textarea",{id:"description",value:r.description,placeholder:this._contentStrings.description,rows:5,onIonChange:function(a){return r.description=a.detail.value},maxlength:280})),T("ion-item",null,T("ion-button",{size:"small",onClick:function(){t.deleteEdge.emit(i),t.edge=null}},T("ion-icon",{src:Gs}),"\xA0",this._contentStrings.delete),T("ion-button",{size:"small",type:"submit",onClick:function(){r.title&&t.saveEdge.emit([i,r])}},T("ion-icon",{src:Vs}),"\xA0",this._contentStrings.update)))}return null},Object.defineProperty(e,"style",{get:function(){return"#title{--background:var(--al-input-background-color);--color:var(--al-input-color);--padding-bottom:var(--al-input-padding-bottom);--padding-end:var(--al-input-padding-end);--padding-start:var(--al-input-padding-start);--padding-top:var(--al-input-padding-top);font-size:var(--al-input-font-size)}#description{--background:var(--al-textarea-background-color);--color:var(--al-textarea-color);--padding-bottom:var(--al-textarea-padding-bottom);--padding-end:var(--al-textarea-padding-end);--padding-start:var(--al-textarea-padding-start);--padding-top:var(--al-textarea-padding-top);font-size:var(--al-textarea-font-size)}"},enumerable:!0,configurable:!0}),e}(),b0=function(){function e(t){Ye(this,t),this.nodes=null,this.angles=null,this.edges=null,this.selected=null}return e.prototype._getSelectedNode=function(){if(this.selected&&this.nodes){var t=this.nodes.get(this.selected);if(t)return[this.selected,t]}return null},e.prototype._getSelectedEdge=function(){if(this.selected&&this.edges){var t=this.edges.get(this.selected);if(t)return[this.selected,t]}return null},e.prototype._getSelectedAngle=function(){if(this.selected&&this.angles){var t=this.angles.get(this.selected);if(t)return[this.selected,t]}return null},e.prototype.render=function(){return[T("al-graph-settings",{"graph-enabled":this.graphEnabled,"graph-visible":this.graphVisible,units:this.units}),T("al-node-list",{nodes:this.nodes,selected:this.selected}),T("ion-item-divider",null),T("al-node-editor",{node:this._getSelectedNode()}),T("al-edge-editor",{edge:this._getSelectedEdge()}),T("al-angle-editor",{angle:this._getSelectedAngle()})]},Object.defineProperty(e,"style",{get:function(){return""},enumerable:!0,configurable:!0}),e}(),Vh="Enable Nodes",Wh="Units",jh="Meters",Yh="Millimeters",Xh={graphEnabled:Vh,units:Wh,meters:jh,millimeters:Yh},x0=function(){function e(t){Ye(this,t),this._contentStrings=Xh,this.unitsChange=ve(this,"unitsChange",7),this.graphEnabledChange=ve(this,"graphEnabledChange",7)}return e.prototype._graphEnabled=function(t){this.graphEnabled=t,this.graphEnabledChange.emit(t)},e.prototype._units=function(t){this.units=t,this.unitsChange.emit(this.units)},e.prototype.renderGraphEnabled=function(){var t=this;return this.graphVisible?T("div",null,T("ion-item",{style:{display:"var(--graph-enabled-display, block)"}},T("span",{title:this._contentStrings.graphEnabled},this._contentStrings.graphEnabled),T("ion-toggle",{slot:"end",checked:this.graphEnabled,onIonChange:function(n){return t._graphEnabled(n.detail.checked)}})),T("ion-item",{style:{display:"var(--units-display, block)"}},T("span",{title:this._contentStrings.units},this._contentStrings.units),T("select",{slot:"end",onChange:function(n){return t._units(n.srcElement.value)}},T("option",{selected:this.units===Wt.MILLIMETERS,value:Wt.MILLIMETERS},this._contentStrings.millimeters),T("option",{selected:this.units===Wt.METERS,value:Wt.METERS},this._contentStrings.meters)))):T("span",null,"hello world")},e.prototype.render=function(){return T("div",{style:{"max-width":"100%","overflow-x":"hidden"}},this.renderGraphEnabled())},Object.defineProperty(e,"style",{get:function(){return"select{padding:5px;min-width:100px;background-color:var(--al-select-background-color);color:var(--al-item-color);border:none}@supports (-moz-appearance:none){select{background-color:#fff!important;color:#000!important}}ion-label{color:var(--al-item-color)}"},enumerable:!0,configurable:!0}),e}(),Zh="Description",qh="Title",Jh="Update",Qh={delete:"Delete",description:Zh,title:qh,update:Jh},_0=function(){function e(t){Ye(this,t),this._contentStrings=Qh,this.deleteNode=ve(this,"deleteNode",7),this.saveNode=ve(this,"saveNode",7)}return e.prototype.render=function(){var t=this;if(this.node){var n=this.node,i=n[0],r=n[1];return T("form",{onSubmit:function(a){return a.preventDefault()}},T("ion-item",null,T("ion-input",{id:"title",value:r.title,placeholder:this._contentStrings.title,required:!0,onIonChange:function(a){return r.title=a.detail.value},maxlength:128})),T("ion-item",null,T("ion-textarea",{id:"description",value:r.description,placeholder:this._contentStrings.description,rows:5,onIonChange:function(a){return r.description=a.detail.value},maxlength:1024})),T("ion-item",null,T("ion-button",{size:"small",onClick:function(){t.deleteNode.emit(i),t.node=null}},T("ion-icon",{src:Gs}),"\xA0",this._contentStrings.delete),T("ion-button",{size:"small",type:"submit",onClick:function(){r.title&&t.saveNode.emit([i,r])}},T("ion-icon",{src:Vs}),"\xA0",this._contentStrings.update)))}return null},Object.defineProperty(e,"style",{get:function(){return"#title{--background:var(--al-input-background-color);--color:var(--al-input-color);--padding-bottom:var(--al-input-padding-bottom);--padding-end:var(--al-input-padding-end);--padding-start:var(--al-input-padding-start);--padding-top:var(--al-input-padding-top);font-size:var(--al-input-font-size)}#description{--background:var(--al-textarea-background-color);--color:var(--al-textarea-color);--padding-bottom:var(--al-textarea-padding-bottom);--padding-end:var(--al-textarea-padding-end);--padding-start:var(--al-textarea-padding-start);--padding-top:var(--al-textarea-padding-top);font-size:var(--al-textarea-font-size)}"},enumerable:!0,configurable:!0}),e}(),$h="No nodes have been placed.",Kh={graphEmpty:$h},w0=function(){function e(t){Ye(this,t),this._contentStrings=Kh,this.nodes=null,this.selected=null,this.selectedChange=ve(this,"selectedChange",7)}return e.prototype.render=function(){var t=this;return this.nodes&&this.nodes.size?T("ion-list",{style:{color:"var(--al-item-color)","border-width":"1px 0 0 0","border-color":"var(--ion-list-header-border-color)","border-style":"solid","margin-top":"10px"}},Array.from(this.nodes).map(function(n){var i=n[0],r=n[1];return T("ion-item",{"data-selected":t.selected===i,onClick:function(){return t.selectedChange.emit(i)}},r.title)})):T("ion-item",{style:{color:"var(--al-item-color)","border-width":"1px 0 0 0","border-color":"var(--ion-list-header-border-color)","border-style":"solid","margin-top":"10px"}},T("p",null,this._contentStrings.graphEmpty))},Object.defineProperty(e,"style",{get:function(){return"ion-item{--color:var(--al-item-color);--border-color:var(--al-item-border-color);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}ion-item[data-selected]{--color:var(--al-item-selected-color)}"},enumerable:!0,configurable:!0}),e}(),ed="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1MTIgNTEyIj48cGF0aCBkPSJNMzIgNDY0aDQ0OEwyNTYgNDggMzIgNDY0em0yNDgtNjRoLTQ4di00OGg0OHY0OHptMC04MGgtNDh2LTk2aDQ4djk2eiIvPjwvc3ZnPg==",td="XY (Top)",nd="Bounds",id="Bounding Box",rd="Level",ad="Clay",od="Width",sd="Controls Type",ld="XZ (Front)",cd="Display Mode",ud="Enable Node Placement",hd="Material",dd="Normals",fd="Orbit",pd="Orientation",md="Origin",vd="Render Steps",gd="Rotate",yd="YZ (Side)",bd="Slice Index",xd="Slices",_d="Slice",wd="Trackball",Ed="Units",Md="Volume",Sd="Render Detail (only increase if you know your device is capable!)",Td="Enable High Res",Ad="Activate High Resolution Mode (Computationally Intensive!)",Ld="Windowing (Brightness/Contrast)",Cd="Wireframe",Rd="XRay",Id={axial:td,bounds:nd,boundingBoxEnabled:id,brightness:rd,clay:ad,contrast:od,controlsType:sd,coronal:ld,default:"Default",displayMode:cd,graphEnabled:ud,material:hd,normals:dd,orbit:fd,orientation:pd,recenter:md,renderSteps:vd,rotate:gd,saggital:yd,sliceIndex:bd,slices:xd,slice:_d,trackball:wd,units:Ed,volume:Md,volumeSteps:Sd,volumeStepsHighEnabled:Td,volumeStepsHighEnabledWarning:Ad,windowingTitle:Ld,wireframe:Cd,xray:Rd},E0=function(){function e(t){Ye(this,t),this._contentStrings=Id,this.displayModeChange=ve(this,"displayModeChange",7),this.orientationChange=ve(this,"orientationChange",7),this.slicesIndexChange=ve(this,"slicesIndexChange",7),this.slicesBrightnessChange=ve(this,"slicesBrightnessChange",7),this.slicesContrastChange=ve(this,"slicesContrastChange",7),this.volumeBrightnessChange=ve(this,"volumeBrightnessChange",7),this.volumeContrastChange=ve(this,"volumeContrastChange",7),this.volumeStepsChange=ve(this,"volumeStepsChange",7),this.volumeStepsHighEnabledChange=ve(this,"volumeStepsHighEnabledChange",7)}return e.prototype._displayMode=function(t){this.displayMode=t,this.displayModeChange.emit(t)},e.prototype._orientation=function(t){this.orientation=t,this.orientationChange.emit(t)},e.prototype._slicesIndex=function(t){this.slicesIndex=t,this.slicesIndexChange.emit(t)},e.prototype._slicesBrightness=function(t){this.slicesBrightness=t,this.slicesBrightnessChange.emit(t)},e.prototype._slicesContrast=function(t){this.slicesContrast=t,this.slicesContrastChange.emit(t)},e.prototype._volumeBrightness=function(t){this.volumeBrightness=t,this.volumeBrightnessChange.emit(t)},e.prototype._volumeContrast=function(t){this.volumeContrast=t,this.volumeContrastChange.emit(t)},e.prototype._volumeSteps=function(t){t=Math.round(t*10)/10,this.volumeSteps=t,this.volumeStepsChange.emit(t)},e.prototype._volumeStepsHighEnabled=function(t){t?this._volumeSteps(this.volumeSteps+.2):this._volumeSteps(this.volumeSteps-.2)},e.prototype.renderDisplayModeToggle=function(){var t=this;return this.displayMode!==Ve.MESH?T("ion-item",{style:{display:"var(--display-mode-display, block)","margin-top":"10px"}},T("span",{title:this._contentStrings.displayMode},"Mode"),T("select",{slot:"end",onChange:function(n){return t._displayMode(n.srcElement.value)}},T("option",{selected:this.displayMode===Ve.SLICES,value:Ve.SLICES},this._contentStrings.slices),T("option",{selected:this.displayMode===Ve.VOLUME,value:Ve.VOLUME},this._contentStrings.volume))):null},e.prototype.renderHiResEnabled=function(){var t=this;return T("ion-item",{style:{display:"var(--volume-steps-high-display, block)"}},T("span",{title:this._contentStrings.volumeStepsHighEnabledWarning},this._contentStrings.volumeStepsHighEnabled," ",T("ion-icon",{src:ed})),T("ion-toggle",{slot:"end",checked:this.volumeStepsHighEnabled,onIonChange:function(n){return t._volumeStepsHighEnabled(n.detail.checked)}}))},e.prototype.renderSlicesControls=function(){var t=this;return T("div",null,T("ion-item",{style:{display:"var(--slices-orientation-display, block)"}},T("span",{color:"primary"},"Plane"),T("select",{slot:"end",onChange:function(n){return t._orientation(n.srcElement.value)}},T("option",{selected:this.orientation===yn.CORONAL,value:yn.CORONAL},this._contentStrings.coronal),T("option",{selected:this.orientation===yn.SAGGITAL,value:yn.SAGGITAL},this._contentStrings.saggital),T("option",{selected:this.orientation===yn.AXIAL,value:yn.AXIAL},this._contentStrings.axial))),T("ion-item",{style:{display:"var(--slices-index-display, block)"}},T("span",null,this._contentStrings.slice),T("ion-range",{slot:"end",min:0,max:1,step:1/this.slicesMaxIndex,value:this.slicesIndex,onIonChange:function(n){return t._slicesIndex(n.detail.value)}})))},e.prototype.renderSlicesWindowingControls=function(){var t=this;return T("div",null,T("ion-list-header",{style:{color:"var(--al-item-color)","border-width":"1px 0 0 0","border-color":"var(--ion-list-header-border-color)","border-style":"solid","margin-top":"10px"}},T("span",null,this._contentStrings.windowingTitle)),T("ion-item",{style:{display:"var(--slices-brightness-display, block)"}},T("span",null,this._contentStrings.brightness),T("ion-range",{slot:"end",min:0,max:1,step:.05,snaps:!0,ticks:!1,value:this.slicesBrightness,onIonChange:function(n){t._slicesBrightness(n.detail.value)}})),T("ion-item",{style:{display:"var(--slices-contrast-display, block)"}},T("span",null,this._contentStrings.contrast),T("ion-range",{slot:"end",min:0,max:1,step:.05,snaps:!0,ticks:!1,value:this.slicesContrast,onIonChange:function(n){return t._slicesContrast(n.detail.value)}})))},e.prototype.renderVolumeWindowingControls=function(){var t=this;return T("div",null,T("ion-list-header",{style:{color:"var(--al-item-color)","border-width":"1px 0 0 0","border-color":"var(--ion-list-header-border-color)","border-style":"solid","margin-top":"10px"}},T("span",null,this._contentStrings.windowingTitle)),T("ion-item",{style:{display:"var(--volume-brightness-display, block)"}},T("span",null,this._contentStrings.brightness),T("ion-range",{slot:"end",min:0,max:1,step:.05,snaps:!0,ticks:!1,value:this.volumeBrightness,onIonChange:function(n){t._volumeBrightness(n.detail.value)}})),T("ion-item",{style:{display:"var(--volume-contrast-display, block)"}},T("span",null,this._contentStrings.contrast),T("ion-range",{slot:"end",min:0,max:1,step:.05,snaps:!0,ticks:!1,value:this.volumeContrast,onIonChange:function(n){return t._volumeContrast(n.detail.value)}})))},e.prototype.renderOptions=function(){switch(this.displayMode){case Ve.SLICES:return T("div",null,this.renderSlicesControls(),this.renderSlicesWindowingControls());case Ve.VOLUME:return T("div",null,this.renderHiResEnabled(),this.renderVolumeWindowingControls());default:return}},e.prototype.render=function(){return T("div",{style:{"max-width":"100%","overflow-x":"hidden"}},this.renderDisplayModeToggle(),this.renderOptions())},Object.defineProperty(e,"style",{get:function(){return"select{padding:5px;min-width:100px;background-color:var(--al-select-background-color);color:var(--al-item-color);border:none}@supports (-moz-appearance:none){select{background-color:#fff!important;color:#000!important}}ion-label{color:var(--al-item-color)}"},enumerable:!0,configurable:!0}),e}(),M0=function(){function e(t){var n=this;Ye(this,t),this.transitioning=!1,this.onTabClicked=function(i){var r=i.detail.tab;n.select(r)},this.ionNavWillLoad=ve(this,"ionNavWillLoad",7),this.ionTabsWillChange=ve(this,"ionTabsWillChange",3),this.ionTabsDidChange=ve(this,"ionTabsDidChange",3)}return e.prototype.componentWillLoad=function(){return te(this,void 0,void 0,function(){var t;return ne(this,function(n){switch(n.label){case 0:return t=this.tabs,[4,this.select(t[0])];case 1:return n.sent(),this.ionNavWillLoad.emit(),[2]}})})},e.prototype.componentWillRender=function(){var t=this.el.querySelector("ion-tab-bar");if(t){var n=this.selectedTab?this.selectedTab.tab:void 0;t.selectedTab=n}},e.prototype.select=function(t){return te(this,void 0,void 0,function(){var n;return ne(this,function(i){switch(i.label){case 0:return[4,this.getTab(t)];case 1:return n=i.sent(),n?this.shouldSwitch(n)?(this.setActive(n),this.tabSwitch(),[2,!0]):[2,!1]:[2,!1]}})})},e.prototype.getTab=function(t){return te(this,void 0,void 0,function(){var n;return ne(this,function(i){return n=typeof t=="string"?this.tabs.find(function(r){return r.tab===t}):t,[2,n]})})},e.prototype.getSelected=function(){return Promise.resolve(this.selectedTab?this.selectedTab.tab:void 0)},e.prototype.setActive=function(t){if(this.transitioning)return Promise.reject("transitioning already happening");this.transitioning=!0,this.leavingTab=this.selectedTab,this.selectedTab=t,this.ionTabsWillChange.emit({tab:t.tab});try{t.setActive()}catch{}return!0},e.prototype.tabSwitch=function(){var t=this.selectedTab,n=this.leavingTab;this.leavingTab=void 0,this.transitioning=!1,t&&n!==t&&(n&&(n.active=!1),this.ionTabsDidChange.emit({tab:t.tab}))},e.prototype.shouldSwitch=function(t){var n=this.selectedTab;return t!==void 0&&t!==n&&!this.transitioning},Object.defineProperty(e.prototype,"tabs",{get:function(){return Array.from(this.el.querySelectorAll("ion-tab"))},enumerable:!0,configurable:!0}),e.prototype.render=function(){return T(ut,{onIonTabButtonClick:this.onTabClicked},T("slot",{name:"top"}),T("div",{class:"tabs-inner"},T("slot",null)),T("slot",{name:"bottom"}))},Object.defineProperty(e.prototype,"el",{get:function(){return ht(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e,"style",{get:function(){return":host{z-index:var(--z-index-page-container);--ion-tab-bar-color:var(--al-item-color)}.tabs-inner{position:relative}"},enumerable:!0,configurable:!0}),e}(),Pd="data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgNTEyIDUxMiIgY2xhc3M9InMtaW9uLWljb24iPjxwYXRoIGQ9Ik0yNTYgMzg4Yy03Mi41OTcgMC0xMzItNTkuNDA1LTEzMi0xMzIgMC03Mi42MDEgNTkuNDAzLTEzMiAxMzItMTMyIDM2LjMgMCA2OS4yOTkgMTUuNCA5Mi40MDYgMzkuNjAxTDI3OCAyMzRoMTU0VjgwbC01MS42OTggNTEuNzAyQzM0OC40MDYgOTkuNzk4IDMwNC40MDYgODAgMjU2IDgwYy05Ni43OTcgMC0xNzYgNzkuMjAzLTE3NiAxNzZzNzguMDk0IDE3NiAxNzYgMTc2YzgxLjA0NSAwIDE0OC4yODctNTQuMTM0IDE2OS40MDEtMTI4SDM3OC44NWMtMTguNzQ1IDQ5LjU2MS02Ny4xMzggODQtMTIyLjg1IDg0eiI+PC9wYXRoPjwvc3ZnPgo=",S0=function(){function e(t){Ye(this,t),this.urls=null,this.url=null,this.urlChange=ve(this,"urlChange",7)}return e.prototype.render=function(){var t=this;return this.urls?T("form",{onSubmit:function(n){return n.preventDefault()}},T("ion-item",null,T("ion-select",{id:"select",value:this.url,interface:"popover",placeholder:"",onIonChange:function(n){return t.urlChange.emit(n.detail.value)}},Array.from(this.urls).map(function(n){var i=n[0],r=n[1];return T("ion-select-option",{value:i},r)}))),T("ion-item",null,T("ion-input",{id:"input",type:"url",size:100,placeholder:"src",required:!0,value:this.url,ref:function(n){return t._input=n}})),T("ion-item",null,T("ion-button",{id:"submit",size:"small",type:"submit",onClick:function(){return t.urlChange.emit(t._input.value)}},T("ion-icon",{src:Pd}),"\xA0Load"))):null},Object.defineProperty(e,"style",{get:function(){return"#select{--padding-start:0px;width:100%;max-width:100%!important}#input{--background:var(--al-input-background-color);--color:var(--al-input-color);--padding-start:var(--al-input-padding-start)}"},enumerable:!0,configurable:!0}),e}(),Od="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDIzLjAuNiwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCAzNjAgMzYwIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCAzNjAgMzYwOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxwYXRoIGQ9Ik0xOTcuNSwzNTIuNGgtMzVWMTgwLjlMOC40LDEwM2MtOC42LTQuNC0xMi4xLTE0LjktNy43LTIzLjVjNC40LTguNiwxNC45LTEyLjEsMjMuNS03LjdMMTgwLDE1MC41bDE1Ni43LTc4LjhsMTUuNywzMS4zCglsLTE1NC45LDc3LjlWMzUyLjR6Ii8+CjxjaXJjbGUgY2xhc3M9InN0MCIgY3g9IjE4MCIgY3k9IjE4MCIgcj0iNzUuOSIvPgo8cGF0aCBkPSJNMTgwLDM2OS45Yy0yLjcsMC01LjQtMC42LTcuOS0xLjlMOC40LDI4NS4zYy01LjktMy05LjYtOS05LjYtMTUuNlY4Ny40YzAtNi43LDMuOC0xMi44LDkuOS0xNS43TDE3Mi40LTcuOQoJYzQuOC0yLjMsMTAuNC0yLjMsMTUuMywwbDE2NC42LDc5LjVjNiwyLjksOS45LDksOS45LDE1Ljh2MTgxLjhjMCw2LjYtMy43LDEyLjYtOS42LDE1LjZsLTE2NC42LDgzLjMKCUMxODUuNCwzNjkuMywxODIuNywzNjkuOSwxODAsMzY5Ljl6IE0zMy44LDI1OC45TDE4MCwzMzIuOGwxNDcuMS03NC41di0xNjBMMTgwLDI3LjNsLTE0Ni4zLDcxVjI1OC45eiIvPgo8cGF0aCBjbGFzcz0ic3QxIiBkPSJNMTA0LjEsMTMxLjgiLz4KPHBhdGggY2xhc3M9InN0MiIgZD0iTTkyLjEsMTM5LjUiLz4KPC9zdmc+Cg==",Dd="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDIzLjAuNiwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkNhcGFfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiCgkgdmlld0JveD0iMCAwIDM2MCAzNjAiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDM2MCAzNjA7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4KPGNpcmNsZSBjbGFzcz0ic3QwIiBjeD0iMTgwIiBjeT0iMTgwIiByPSIxMDEuMiIvPgo8L3N2Zz4K",kd="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDIzLjAuNiwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCA1MTIgNTEyIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA1MTIgNTEyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxwYXRoIGQ9Ik0zOTMuMSwzMzcuN3YtNTljMC05LjMtNy44LTE2LjgtMTcuMy0xNi44SDE2Ni41Yy05LjUsMC0xNy4zLDcuNi0xNy4zLDE2Ljh2MTY4LjZjMCw5LjMsNy44LDE2LjksMTcuMywxNi45aDIwOS40CgljOS41LDAsMTcuMy03LjYsMTcuMy0xNi44di01OWw2Ni41LDY3LjRWMjcwLjNMMzkzLjEsMzM3Ljd6Ii8+CjxwYXRoIGQ9Ik05OS41LDMwNC4zYzAtODEuMyw2NS4zLTE0Ny44LDE0NS4yLTE0Ny44djczLjlsOTYuOC05OC42bC05Ni44LTk4LjZ2NzMuOWMtMTA2LjUsMC0xOTMuNiw4OC43LTE5My42LDE5Ny4xIi8+Cjwvc3ZnPgo=",Nd="data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgNTEyIDUxMiIgY2xhc3M9InMtaW9uLWljb24iPjxwYXRoIGQ9Ik0yNTYgNDhjLTQyLjkgMC04NC4yIDEzLTExOS4yIDM3LjUtMzQuMiAyNC02MC4yIDU3LjItNzUuMSA5Ni4xTDU4IDE5Mmg0NS43bDEuOS01YzguMi0xNy44IDE5LjQtMzMuOSAzMy41LTQ4IDMxLjItMzEuMiA3Mi43LTQ4LjQgMTE2LjktNDguNHM4NS43IDE3LjIgMTE2LjkgNDguNGMzMS4yIDMxLjIgNDguNCA3Mi43IDQ4LjQgMTE2LjkgMCA0NC4xLTE3LjIgODUuNy00OC40IDExNi45LTMxLjIgMzEuMi03Mi43IDQ4LjQtMTE2LjkgNDguNC00NC4xIDAtODUuNi0xNy4yLTExNi45LTQ4LjQtMTQtMTQtMjUuMy0zMC4xLTMzLjUtNDcuOWwtMS45LTVINThsMy42IDEwLjRjMTQuOSAzOC45IDQwLjkgNzIuMSA3NS4xIDk2LjFDMTcxLjggNDUxLjEgMjEzIDQ2NCAyNTYgNDY0YzExNC43IDAgMjA4LTkzLjMgMjA4LTIwOFMzNzAuNyA0OCAyNTYgNDh6Ij48L3BhdGg+PHBhdGggZD0iTTQ4IDI3Ny40aDE4OS43bC00My42IDQ0LjdMMjI0IDM1Mmw5Ni05Ni05Ni05Ni0zMSAyOS45IDQ0LjcgNDQuN0g0OHY0Mi44eiI+PC9wYXRoPjwvc3ZnPgo=",Bd="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDIzLjAuNiwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCA1MTIgNTEyIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA1MTIgNTEyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxwYXRoIGQ9Ik0xMDguMSwyODYuNGMwLTgxLjMsNjUuMy0xNDcuOCwxNDUuMi0xNDcuOHY3My45bDk2LjgtOTguNmwtOTYuOC05OC42djczLjlDMTQ2LjgsODkuMiw1OS43LDE3OCw1OS43LDI4Ni40Ii8+CjxjaXJjbGUgY3g9IjMwMyIgY3k9IjM1MS40IiByPSIxMDQiLz4KPC9zdmc+Cg==",zd="XY (Top)",Fd="Bounds",Hd="Bounding Box",Ud="Level",Gd="Clay",Vd="Width",Wd="Controls Type",jd="XZ (Front)",Yd="Display Mode",Xd="Enable Node Placement",Zd="Material",qd="Meters",Jd="Millimeters",Qd="Normals",$d="Orbit",Kd="Orientation",ef="Origin",tf="Render Steps",nf="Rotate",rf="YZ (Side)",af="Slice Index",of="Slices",sf="Slice",lf="Trackball",cf="Units",uf="Volume",hf="Render Detail (only increase if you know your device is capable!)",df="Enable High Res",ff="Activate High Resolution Mode (Computationally Intensive!)",pf="Windowing (Brightness/Contrast)",mf="Wireframe",vf="XRay",gf={axial:zd,bounds:Fd,boundingBoxEnabled:Hd,brightness:Ud,clay:Gd,contrast:Vd,controlsType:Wd,coronal:jd,default:"Default",displayMode:Yd,graphEnabled:Xd,material:Zd,meters:qd,millimeters:Jd,normals:Qd,orbit:$d,orientation:Kd,recenter:ef,renderSteps:tf,rotate:nf,saggital:rf,sliceIndex:af,slices:of,slice:sf,trackball:lf,units:cf,volume:uf,volumeSteps:hf,volumeStepsHighEnabled:df,volumeStepsHighEnabledWarning:ff,windowingTitle:pf,wireframe:mf,xray:vf},T0=function(){function e(t){Ye(this,t),this._contentStrings=gf,this.boundingBoxEnabledChange=ve(this,"boundingBoxEnabledChange",7),this.controlsTypeChange=ve(this,"controlsTypeChange",7),this.recenter=ve(this,"recenter",7)}return e.prototype._boundingBoxEnabled=function(t){this.boundingBoxEnabled=t,this.boundingBoxEnabledChange.emit(t)},e.prototype._controlsType=function(t){this.controlsType=t,this.controlsTypeChange.emit(t)},e.prototype._switchBoundingBoxEnabled=function(){this.boundingBoxEnabled?this._boundingBoxEnabled(!1):this._boundingBoxEnabled(!0)},e.prototype._switchControls=function(){this.controlsType===Ft.ORBIT?this._controlsType(Ft.TRACKBALL):this.controlsType===Ft.TRACKBALL&&this._controlsType(Ft.ORBIT)},e.prototype.renderControlsTypeSelect=function(){var t=this,n,i;this.controlsType===Ft.ORBIT?(n=kd,i=this._contentStrings.orbit):this.controlsType===Ft.TRACKBALL&&(n=Bd,i=this._contentStrings.rotate);var r;return this.boundingBoxEnabled?r=Od:r=Dd,T("div",{style:{"margin-top":"10px","text-align":"center"}},T("ion-button",{style:{width:"28%",height:"45px","margin-left":"5px","margin-right":"5px"},size:"small",onClick:function(){t._switchControls()}},T("div",{style:{"font-size":"10px",color:"white","margin-bottom":"2px"}},T("ion-icon",{style:{"min-width":"20px","min-height":"20px","margin-bottom":"2px"},src:n,title:i}),T("br",null),i)),T("ion-button",{style:{width:"28%",height:"45px","margin-left":"5px","margin-right":"5px"},size:"small",onClick:function(){t.recenter.emit()}},T("div",{style:{"font-size":"10px",color:"white","margin-bottom":"2px"}},T("ion-icon",{style:{"min-width":"20px","min-height":"20px","margin-bottom":"2px"},src:Nd,title:this._contentStrings.recenter}),T("br",null),this._contentStrings.recenter)),T("ion-button",{style:{width:"28%",height:"45px","margin-left":"5px","margin-right":"5px"},size:"small",onClick:function(){t._switchBoundingBoxEnabled()}},T("div",{style:{"font-size":"10px",color:"white","margin-bottom":"2px"}},T("ion-icon",{style:{"min-width":"20px","min-height":"20px","margin-bottom":"2px"},src:r,title:this._contentStrings.bounds}),T("br",null),this._contentStrings.bounds)))},e.prototype.render=function(){return T("div",{style:{"max-width":"100%","overflow-x":"hidden","border-width":"0 0 1px 0","border-color":"var(--ion-list-header-border-color)","border-style":"solid","padding-bottom":"10px","margin-bottom":"10px"}},this.renderControlsTypeSelect())},Object.defineProperty(e,"style",{get:function(){return"select{padding:5px;min-width:100px;background-color:var(--al-select-background-color);color:var(--al-item-color);border:none}@supports (-moz-appearance:none){select{background-color:#fff!important;color:#000!important}}ion-label{color:var(--al-item-color)}"},enumerable:!0,configurable:!0}),e}(),vs;(function(e){e[e.Backspace=8]="Backspace",e[e.Tab=9]="Tab",e[e.Enter=13]="Enter",e[e.Shift=16]="Shift",e[e.Ctrl=17]="Ctrl",e[e.Alt=18]="Alt",e[e.PauseBreak=19]="PauseBreak",e[e.CapsLock=20]="CapsLock",e[e.Escape=27]="Escape",e[e.Spacebar=32]="Spacebar",e[e.PageUp=33]="PageUp",e[e.PageDown=34]="PageDown",e[e.End=35]="End",e[e.Home=36]="Home",e[e.LeftArrow=37]="LeftArrow",e[e.UpArrow=38]="UpArrow",e[e.RightArrow=39]="RightArrow",e[e.DownArrow=40]="DownArrow",e[e.PrintScrn=44]="PrintScrn",e[e.Insert=45]="Insert",e[e.Delete=46]="Delete",e[e.Zero=48]="Zero",e[e.One=49]="One",e[e.Two=50]="Two",e[e.Three=51]="Three",e[e.Four=52]="Four",e[e.Five=53]="Five",e[e.Six=54]="Six",e[e.Seven=55]="Seven",e[e.Eight=56]="Eight",e[e.Nine=57]="Nine",e[e.a=65]="a",e[e.b=66]="b",e[e.c=67]="c",e[e.d=68]="d",e[e.e=69]="e",e[e.f=70]="f",e[e.g=71]="g",e[e.h=72]="h",e[e.i=73]="i",e[e.j=74]="j",e[e.k=75]="k",e[e.l=76]="l",e[e.m=77]="m",e[e.n=78]="n",e[e.o=79]="o",e[e.p=80]="p",e[e.q=81]="q",e[e.r=82]="r",e[e.s=83]="s",e[e.t=84]="t",e[e.u=85]="u",e[e.v=86]="v",e[e.w=87]="w",e[e.x=88]="x",e[e.y=89]="y",e[e.z=90]="z",e[e.LeftWindowKey=91]="LeftWindowKey",e[e.RightWindowKey=92]="RightWindowKey",e[e.SelectKey=93]="SelectKey",e[e.Numpad0=96]="Numpad0",e[e.Numpad1=97]="Numpad1",e[e.Numpad2=98]="Numpad2",e[e.Numpad3=99]="Numpad3",e[e.Numpad4=100]="Numpad4",e[e.Numpad5=101]="Numpad5",e[e.Numpad6=102]="Numpad6",e[e.Numpad7=103]="Numpad7",e[e.Numpad8=104]="Numpad8",e[e.Numpad9=105]="Numpad9",e[e.Multiply=106]="Multiply",e[e.NumpadPlus=107]="NumpadPlus",e[e.NumpadMinus=109]="NumpadMinus",e[e.DecimalPoint=110]="DecimalPoint",e[e.Divide=111]="Divide",e[e.F1=112]="F1",e[e.F2=113]="F2",e[e.F3=114]="F3",e[e.F4=115]="F4",e[e.F5=116]="F5",e[e.F6=117]="F6",e[e.F7=118]="F7",e[e.F8=119]="F8",e[e.F9=120]="F9",e[e.F10=121]="F10",e[e.F11=122]="F11",e[e.F12=123]="F12",e[e.NumLock=144]="NumLock",e[e.ScrollLock=145]="ScrollLock",e[e.Semicolon=186]="Semicolon",e[e.Equals=187]="Equals",e[e.Comma=188]="Comma",e[e.LessThan=188]="LessThan",e[e.Dash=189]="Dash",e[e.Period=190]="Period",e[e.GreaterThan=190]="GreaterThan",e[e.ForwardSlash=191]="ForwardSlash",e[e.QuestionMark=191]="QuestionMark",e[e.GraveAccent=192]="GraveAccent",e[e.Tilde=192]="Tilde",e[e.OpenCurlyBracket=219]="OpenCurlyBracket",e[e.OpenSquareBracket=219]="OpenSquareBracket",e[e.BackSlash=220]="BackSlash",e[e.VerticalPipe=220]="VerticalPipe",e[e.CloseCurlyBracket=221]="CloseCurlyBracket",e[e.CloseSquareBracket=221]="CloseSquareBracket",e[e.Quote=222]="Quote",e[e.CommandFF=224]="CommandFF"})(vs||(vs={}));var Fl;(function(e){e[e.Backspace=8]="Backspace",e[e.Enter=13]="Enter",e[e.Spacebar=32]="Spacebar",e[e.Hash=35]="Hash",e[e.GraveAccent=39]="GraveAccent",e[e.DoubleQuote=34]="DoubleQuote",e[e.Asterisk=42]="Asterisk",e[e.Plus=43]="Plus",e[e.Comma=44]="Comma",e[e.Minus=45]="Minus",e[e.Period=46]="Period",e[e.ForwardSlash=47]="ForwardSlash",e[e.Zero=48]="Zero",e[e.One=49]="One",e[e.Two=50]="Two",e[e.Three=51]="Three",e[e.Four=52]="Four",e[e.Five=53]="Five",e[e.Six=54]="Six",e[e.Seven=55]="Seven",e[e.Eight=56]="Eight",e[e.Nine=57]="Nine",e[e.Colon=58]="Colon",e[e.Semicolon=59]="Semicolon",e[e.LessThan=60]="LessThan",e[e.Equals=61]="Equals",e[e.GreaterThan=62]="GreaterThan",e[e.QuestionMark=63]="QuestionMark",e[e.At=64]="At",e[e.OpenSquareBracket=91]="OpenSquareBracket",e[e.BackSlash=92]="BackSlash",e[e.CloseSquareBracket=93]="CloseSquareBracket",e[e.a=97]="a",e[e.b=98]="b",e[e.c=99]="c",e[e.d=100]="d",e[e.e=101]="e",e[e.f=102]="f",e[e.g=103]="g",e[e.h=104]="h",e[e.i=105]="i",e[e.j=106]="j",e[e.k=107]="k",e[e.l=108]="l",e[e.m=109]="m",e[e.n=110]="n",e[e.o=111]="o",e[e.p=112]="p",e[e.q=113]="q",e[e.r=114]="r",e[e.s=115]="s",e[e.t=116]="t",e[e.u=117]="u",e[e.v=118]="v",e[e.w=119]="w",e[e.x=120]="x",e[e.y=121]="y",e[e.z=122]="z",e[e.OpenCurlyBracket=123]="OpenCurlyBracket",e[e.VerticalPipe=124]="VerticalPipe",e[e.CloseCurlyBracket=125]="CloseCurlyBracket",e[e.Tilde=126]="Tilde"})(Fl||(Fl={}));Number.EPSILON===void 0&&(Number.EPSILON=Math.pow(2,-52));Number.isInteger===void 0&&(Number.isInteger=function(e){return typeof e=="number"&&isFinite(e)&&Math.floor(e)===e});Math.sign===void 0&&(Math.sign=function(e){return e<0?-1:e>0?1:+e});"name"in Function.prototype||Object.defineProperty(Function.prototype,"name",{get:function(){return this.toString().match(/^\s*function\s*([^\(\s]*)/)[1]}});Object.assign===void 0&&function(){Object.assign=function(e){if(e==null)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n<arguments.length;n++){var i=arguments[n];if(i!=null)for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(t[r]=i[r])}return t}}();function pn(){}Object.assign(pn.prototype,{addEventListener:function(e,t){this._listeners===void 0&&(this._listeners={});var n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)},hasEventListener:function(e,t){if(this._listeners===void 0)return!1;var n=this._listeners;return n[e]!==void 0&&n[e].indexOf(t)!==-1},removeEventListener:function(e,t){if(this._listeners!==void 0){var n=this._listeners,i=n[e];if(i!==void 0){var r=i.indexOf(t);r!==-1&&i.splice(r,1)}}},dispatchEvent:function(e){if(this._listeners!==void 0){var t=this._listeners,n=t[e.type];if(n!==void 0){e.target=this;for(var i=n.slice(0),r=0,a=i.length;r<a;r++)i[r].call(this,e)}}}});var gc="107",yf={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},bf={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},yc=0,gs=1,bc=2,xf=3,_f=0,wf=1,Ef=0,Ws=1,xc=2,br=0,vt=1,xr=2,js=1,Mf=2,Ys=0,Xs=1,Si=2,ei=0,ti=1,to=2,no=3,io=4,Zs=5,Qn=100,_c=101,wc=102,Za=103,qa=104,Ec=200,Mc=201,Sc=202,Tc=203,qs=204,Js=205,Ac=206,Lc=207,Cc=208,Rc=209,Ic=210,Pc=0,Oc=1,Dc=2,ro=3,kc=4,Nc=5,Bc=6,zc=7,Ca=0,Fc=1,Hc=2,Ja=0,Qs=1,Uc=2,Gc=3,Vc=4,Wc=5,Po=300,Oo=301,ao=302,$s=303,oo=304,Ks=305,Do=306,ko=307,Rn=1e3,Ot=1001,ii=1002,Et=1003,No=1004,Sf=1004,Bo=1005,Tf=1005,Lt=1006,el=1007,Af=1007,Ra=1008,Lf=1008,zo=1009,jc=1010,Yc=1011,Pr=1012,Xc=1013,tl=1014,zi=1015,Fo=1016,Zc=1017,qc=1018,Jc=1019,Or=1020,Qc=1021,Gn=1022,_n=1023,$c=1024,Kc=1025,Cf=_n,ni=1026,Fi=1027,eu=1028,ys=33776,bs=33777,xs=33778,_s=33779,ws=35840,Es=35841,Ms=35842,Ss=35843,tu=36196,nu=37808,iu=37809,ru=37810,au=37811,ou=37812,su=37813,lu=37814,cu=37815,uu=37816,hu=37817,du=37818,fu=37819,pu=37820,mu=37821,vu=2200,gu=2201,yu=2202,Dr=2300,Lr=2301,Qa=2302,ri=2400,$n=2401,kr=2402,Ho=0,bu=1,xu=2,Nr=3e3,_u=3001,nl=3007,wu=3002,Rf=3003,Eu=3004,Mu=3005,Su=3006,Tu=3200,Au=3201,Ia=0,Lu=1,If=0,$a=7680,Pf=7681,Of=7682,Df=7683,kf=34055,Nf=34056,Bf=5386,zf=512,Ff=513,Hf=514,Uf=515,Gf=516,Vf=517,Wf=518,Cu=519,Pe={DEG2RAD:Math.PI/180,RAD2DEG:180/Math.PI,generateUUID:function(){for(var e=[],t=0;t<256;t++)e[t]=(t<16?"0":"")+t.toString(16);return function(){var i=Math.random()*4294967295|0,r=Math.random()*4294967295|0,a=Math.random()*4294967295|0,o=Math.random()*4294967295|0,s=e[i&255]+e[i>>8&255]+e[i>>16&255]+e[i>>24&255]+"-"+e[r&255]+e[r>>8&255]+"-"+e[r>>16&15|64]+e[r>>24&255]+"-"+e[a&63|128]+e[a>>8&255]+"-"+e[a>>16&255]+e[a>>24&255]+e[o&255]+e[o>>8&255]+e[o>>16&255]+e[o>>24&255];return s.toUpperCase()}}(),clamp:function(e,t,n){return Math.max(t,Math.min(n,e))},euclideanModulo:function(e,t){return(e%t+t)%t},mapLinear:function(e,t,n,i,r){return i+(e-t)*(r-i)/(n-t)},lerp:function(e,t,n){return(1-n)*e+n*t},smoothstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*(3-2*e))},smootherstep:function(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*e*(e*(e*6-15)+10))},randInt:function(e,t){return e+Math.floor(Math.random()*(t-e+1))},randFloat:function(e,t){return e+Math.random()*(t-e)},randFloatSpread:function(e){return e*(.5-Math.random())},degToRad:function(e){return e*Pe.DEG2RAD},radToDeg:function(e){return e*Pe.RAD2DEG},isPowerOfTwo:function(e){return(e&e-1)===0&&e!==0},ceilPowerOfTwo:function(e){return Math.pow(2,Math.ceil(Math.log(e)/Math.LN2))},floorPowerOfTwo:function(e){return Math.pow(2,Math.floor(Math.log(e)/Math.LN2))}};function j(e,t){this.x=e||0,this.y=t||0}Object.defineProperties(j.prototype,{width:{get:function(){return this.x},set:function(e){this.x=e}},height:{get:function(){return this.y},set:function(e){this.y=e}}});Object.assign(j.prototype,{isVector2:!0,set:function(e,t){return this.x=e,this.y=t,this},setScalar:function(e){return this.x=e,this.y=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y)},copy:function(e){return this.x=e.x,this.y=e.y,this},add:function(e,t){return t!==void 0?(console.warn("THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this)},addScalar:function(e){return this.x+=e,this.y+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this},sub:function(e,t){return t!==void 0?(console.warn("THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this)},subScalar:function(e){return this.x-=e,this.y-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this},multiply:function(e){return this.x*=e.x,this.y*=e.y,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this},divide:function(e){return this.x/=e.x,this.y/=e.y,this},divideScalar:function(e){return this.multiplyScalar(1/e)},applyMatrix3:function(e){var t=this.x,n=this.y,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6],this.y=i[1]*t+i[4]*n+i[7],this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this},negate:function(){return this.x=-this.x,this.y=-this.y,this},dot:function(e){return this.x*e.x+this.y*e.y},cross:function(e){return this.x*e.y-this.y*e.x},lengthSq:function(){return this.x*this.x+this.y*this.y},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)},normalize:function(){return this.divideScalar(this.length()||1)},angle:function(){var e=Math.atan2(this.y,this.x);return e<0&&(e+=2*Math.PI),e},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y;return t*t+n*n},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y},fromArray:function(e,t){return t===void 0&&(t=0),this.x=e[t],this.y=e[t+1],this},toArray:function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this.x,e[t+1]=this.y,e},fromBufferAttribute:function(e,t,n){return n!==void 0&&console.warn("THREE.Vector2: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this},rotateAround:function(e,t){var n=Math.cos(t),i=Math.sin(t),r=this.x-e.x,a=this.y-e.y;return this.x=r*n-a*i+e.x,this.y=r*i+a*n+e.y,this}});function pt(e,t,n,i){this._x=e||0,this._y=t||0,this._z=n||0,this._w=i!==void 0?i:1}Object.assign(pt,{slerp:function(e,t,n,i){return n.copy(e).slerp(t,i)},slerpFlat:function(e,t,n,i,r,a,o){var s=n[i+0],l=n[i+1],c=n[i+2],u=n[i+3],h=r[a+0],d=r[a+1],f=r[a+2],p=r[a+3];if(u!==p||s!==h||l!==d||c!==f){var v=1-o,m=s*h+l*d+c*f+u*p,g=m>=0?1:-1,y=1-m*m;if(y>Number.EPSILON){var b=Math.sqrt(y),_=Math.atan2(b,m*g);v=Math.sin(v*_)/b,o=Math.sin(o*_)/b}var w=o*g;if(s=s*v+h*w,l=l*v+d*w,c=c*v+f*w,u=u*v+p*w,v===1-o){var L=1/Math.sqrt(s*s+l*l+c*c+u*u);s*=L,l*=L,c*=L,u*=L}}e[t]=s,e[t+1]=l,e[t+2]=c,e[t+3]=u}});Object.defineProperties(pt.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},w:{get:function(){return this._w},set:function(e){this._w=e,this._onChangeCallback()}}});Object.assign(pt.prototype,{isQuaternion:!0,set:function(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._w=i,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._w)},copy:function(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this},setFromEuler:function(e,t){if(!(e&&e.isEuler))throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");var n=e._x,i=e._y,r=e._z,a=e.order,o=Math.cos,s=Math.sin,l=o(n/2),c=o(i/2),u=o(r/2),h=s(n/2),d=s(i/2),f=s(r/2);return a==="XYZ"?(this._x=h*c*u+l*d*f,this._y=l*d*u-h*c*f,this._z=l*c*f+h*d*u,this._w=l*c*u-h*d*f):a==="YXZ"?(this._x=h*c*u+l*d*f,this._y=l*d*u-h*c*f,this._z=l*c*f-h*d*u,this._w=l*c*u+h*d*f):a==="ZXY"?(this._x=h*c*u-l*d*f,this._y=l*d*u+h*c*f,this._z=l*c*f+h*d*u,this._w=l*c*u-h*d*f):a==="ZYX"?(this._x=h*c*u-l*d*f,this._y=l*d*u+h*c*f,this._z=l*c*f-h*d*u,this._w=l*c*u+h*d*f):a==="YZX"?(this._x=h*c*u+l*d*f,this._y=l*d*u+h*c*f,this._z=l*c*f-h*d*u,this._w=l*c*u-h*d*f):a==="XZY"&&(this._x=h*c*u-l*d*f,this._y=l*d*u-h*c*f,this._z=l*c*f+h*d*u,this._w=l*c*u+h*d*f),t!==!1&&this._onChangeCallback(),this},setFromAxisAngle:function(e,t){var n=t/2,i=Math.sin(n);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(n),this._onChangeCallback(),this},setFromRotationMatrix:function(e){var t=e.elements,n=t[0],i=t[4],r=t[8],a=t[1],o=t[5],s=t[9],l=t[2],c=t[6],u=t[10],h=n+o+u,d;return h>0?(d=.5/Math.sqrt(h+1),this._w=.25/d,this._x=(c-s)*d,this._y=(r-l)*d,this._z=(a-i)*d):n>o&&n>u?(d=2*Math.sqrt(1+n-o-u),this._w=(c-s)/d,this._x=.25*d,this._y=(i+a)/d,this._z=(r+l)/d):o>u?(d=2*Math.sqrt(1+o-n-u),this._w=(r-l)/d,this._x=(i+a)/d,this._y=.25*d,this._z=(s+c)/d):(d=2*Math.sqrt(1+u-n-o),this._w=(a-i)/d,this._x=(r+l)/d,this._y=(s+c)/d,this._z=.25*d),this._onChangeCallback(),this},setFromUnitVectors:function(e,t){var n=1e-6,i=e.dot(t)+1;return i<n?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()},angleTo:function(e){return 2*Math.acos(Math.abs(Pe.clamp(this.dot(e),-1,1)))},rotateTowards:function(e,t){var n=this.angleTo(e);if(n===0)return this;var i=Math.min(1,t/n);return this.slerp(e,i),this},inverse:function(){return this.conjugate()},conjugate:function(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this},dot:function(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w},lengthSq:function(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w},length:function(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)},normalize:function(){var e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this},multiply:function(e,t){return t!==void 0?(console.warn("THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead."),this.multiplyQuaternions(e,t)):this.multiplyQuaternions(this,e)},premultiply:function(e){return this.multiplyQuaternions(e,this)},multiplyQuaternions:function(e,t){var n=e._x,i=e._y,r=e._z,a=e._w,o=t._x,s=t._y,l=t._z,c=t._w;return this._x=n*c+a*o+i*l-r*s,this._y=i*c+a*s+r*o-n*l,this._z=r*c+a*l+n*s-i*o,this._w=a*c-n*o-i*s-r*l,this._onChangeCallback(),this},slerp:function(e,t){if(t===0)return this;if(t===1)return this.copy(e);var n=this._x,i=this._y,r=this._z,a=this._w,o=a*e._w+n*e._x+i*e._y+r*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=i,this._z=r,this;var s=1-o*o;if(s<=Number.EPSILON){var l=1-t;return this._w=l*a+t*this._w,this._x=l*n+t*this._x,this._y=l*i+t*this._y,this._z=l*r+t*this._z,this.normalize(),this._onChangeCallback(),this}var c=Math.sqrt(s),u=Math.atan2(c,o),h=Math.sin((1-t)*u)/c,d=Math.sin(t*u)/c;return this._w=a*h+this._w*d,this._x=n*h+this._x*d,this._y=i*h+this._y*d,this._z=r*h+this._z*d,this._onChangeCallback(),this},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w},fromArray:function(e,t){return t===void 0&&(t=0),this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this},toArray:function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e},_onChange:function(e){return this._onChangeCallback=e,this},_onChangeCallback:function(){}});function E(e,t,n){this.x=e||0,this.y=t||0,this.z=n||0}Object.assign(E.prototype,{isVector3:!0,set:function(e,t,n){return this.x=e,this.y=t,this.z=n,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},add:function(e,t){return t!==void 0?(console.warn("THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this},sub:function(e,t){return t!==void 0?(console.warn("THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this},multiply:function(e,t){return t!==void 0?(console.warn("THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead."),this.multiplyVectors(e,t)):(this.x*=e.x,this.y*=e.y,this.z*=e.z,this)},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this},multiplyVectors:function(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this},applyEuler:function(){var e=new pt;return function(n){return n&&n.isEuler||console.error("THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order."),this.applyQuaternion(e.setFromEuler(n))}}(),applyAxisAngle:function(){var e=new pt;return function(n,i){return this.applyQuaternion(e.setFromAxisAngle(n,i))}}(),applyMatrix3:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6]*i,this.y=r[1]*t+r[4]*n+r[7]*i,this.z=r[2]*t+r[5]*n+r[8]*i,this},applyMatrix4:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements,a=1/(r[3]*t+r[7]*n+r[11]*i+r[15]);return this.x=(r[0]*t+r[4]*n+r[8]*i+r[12])*a,this.y=(r[1]*t+r[5]*n+r[9]*i+r[13])*a,this.z=(r[2]*t+r[6]*n+r[10]*i+r[14])*a,this},applyQuaternion:function(e){var t=this.x,n=this.y,i=this.z,r=e.x,a=e.y,o=e.z,s=e.w,l=s*t+a*i-o*n,c=s*n+o*t-r*i,u=s*i+r*n-a*t,h=-r*t-a*n-o*i;return this.x=l*s+h*-r+c*-o-u*-a,this.y=c*s+h*-a+u*-r-l*-o,this.z=u*s+h*-o+l*-a-c*-r,this},project:function(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)},unproject:function(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)},transformDirection:function(e){var t=this.x,n=this.y,i=this.z,r=e.elements;return this.x=r[0]*t+r[4]*n+r[8]*i,this.y=r[1]*t+r[5]*n+r[9]*i,this.z=r[2]*t+r[6]*n+r[10]*i,this.normalize()},divide:function(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this},divideScalar:function(e){return this.multiplyScalar(1/e)},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},cross:function(e,t){return t!==void 0?(console.warn("THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead."),this.crossVectors(e,t)):this.crossVectors(this,e)},crossVectors:function(e,t){var n=e.x,i=e.y,r=e.z,a=t.x,o=t.y,s=t.z;return this.x=i*s-r*o,this.y=r*a-n*s,this.z=n*o-i*a,this},projectOnVector:function(e){var t=e.dot(this)/e.lengthSq();return this.copy(e).multiplyScalar(t)},projectOnPlane:function(){var e=new E;return function(n){return e.copy(this).projectOnVector(n),this.sub(e)}}(),reflect:function(){var e=new E;return function(n){return this.sub(e.copy(n).multiplyScalar(2*this.dot(n)))}}(),angleTo:function(e){var t=this.dot(e)/Math.sqrt(this.lengthSq()*e.lengthSq());return Math.acos(Pe.clamp(t,-1,1))},distanceTo:function(e){return Math.sqrt(this.distanceToSquared(e))},distanceToSquared:function(e){var t=this.x-e.x,n=this.y-e.y,i=this.z-e.z;return t*t+n*n+i*i},manhattanDistanceTo:function(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)},setFromSpherical:function(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)},setFromSphericalCoords:function(e,t,n){var i=Math.sin(t)*e;return this.x=i*Math.sin(n),this.y=Math.cos(t)*e,this.z=i*Math.cos(n),this},setFromCylindrical:function(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)},setFromCylindricalCoords:function(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this},setFromMatrixPosition:function(e){var t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this},setFromMatrixScale:function(e){var t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=i,this},setFromMatrixColumn:function(e,t){return this.fromArray(e.elements,t*4)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z},fromArray:function(e,t){return t===void 0&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this},toArray:function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e},fromBufferAttribute:function(e,t,n){return n!==void 0&&console.warn("THREE.Vector3: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}});var Cn;function xt(){this.elements=[1,0,0,0,1,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.")}Object.assign(xt.prototype,{isMatrix3:!0,set:function(e,t,n,i,r,a,o,s,l){var c=this.elements;return c[0]=e,c[1]=i,c[2]=o,c[3]=t,c[4]=r,c[5]=s,c[6]=n,c[7]=a,c[8]=l,this},identity:function(){return this.set(1,0,0,0,1,0,0,0,1),this},clone:function(){return new this.constructor().fromArray(this.elements)},copy:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this},setFromMatrix4:function(e){var t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this},applyToBufferAttribute:function(e){Cn===void 0&&(Cn=new E);for(var t=0,n=e.count;t<n;t++)Cn.x=e.getX(t),Cn.y=e.getY(t),Cn.z=e.getZ(t),Cn.applyMatrix3(this),e.setXYZ(t,Cn.x,Cn.y,Cn.z);return e},multiply:function(e){return this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,i=t.elements,r=this.elements,a=n[0],o=n[3],s=n[6],l=n[1],c=n[4],u=n[7],h=n[2],d=n[5],f=n[8],p=i[0],v=i[3],m=i[6],g=i[1],y=i[4],b=i[7],_=i[2],w=i[5],L=i[8];return r[0]=a*p+o*g+s*_,r[3]=a*v+o*y+s*w,r[6]=a*m+o*b+s*L,r[1]=l*p+c*g+u*_,r[4]=l*v+c*y+u*w,r[7]=l*m+c*b+u*L,r[2]=h*p+d*g+f*_,r[5]=h*v+d*y+f*w,r[8]=h*m+d*b+f*L,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this},determinant:function(){var e=this.elements,t=e[0],n=e[1],i=e[2],r=e[3],a=e[4],o=e[5],s=e[6],l=e[7],c=e[8];return t*a*c-t*o*l-n*r*c+n*o*s+i*r*l-i*a*s},getInverse:function(e,t){e&&e.isMatrix4&&console.error("THREE.Matrix3: .getInverse() no longer takes a Matrix4 argument.");var n=e.elements,i=this.elements,r=n[0],a=n[1],o=n[2],s=n[3],l=n[4],c=n[5],u=n[6],h=n[7],d=n[8],f=d*l-c*h,p=c*u-d*s,v=h*s-l*u,m=r*f+a*p+o*v;if(m===0){var g="THREE.Matrix3: .getInverse() can't invert matrix, determinant is 0";if(t===!0)throw new Error(g);return console.warn(g),this.identity()}var y=1/m;return i[0]=f*y,i[1]=(o*h-d*a)*y,i[2]=(c*a-o*l)*y,i[3]=p*y,i[4]=(d*r-o*u)*y,i[5]=(o*s-c*r)*y,i[6]=v*y,i[7]=(a*u-h*r)*y,i[8]=(l*r-a*s)*y,this},transpose:function(){var e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this},getNormalMatrix:function(e){return this.setFromMatrix4(e).getInverse(this).transpose()},transposeIntoArray:function(e){var t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this},setUvTransform:function(e,t,n,i,r,a,o){var s=Math.cos(r),l=Math.sin(r);this.set(n*s,n*l,-n*(s*a+l*o)+a+e,-i*l,i*s,-i*(-l*a+s*o)+o+t,0,0,1)},scale:function(e,t){var n=this.elements;return n[0]*=e,n[3]*=e,n[6]*=e,n[1]*=t,n[4]*=t,n[7]*=t,this},rotate:function(e){var t=Math.cos(e),n=Math.sin(e),i=this.elements,r=i[0],a=i[3],o=i[6],s=i[1],l=i[4],c=i[7];return i[0]=t*r+n*s,i[3]=t*a+n*l,i[6]=t*o+n*c,i[1]=-n*r+t*s,i[4]=-n*a+t*l,i[7]=-n*o+t*c,this},translate:function(e,t){var n=this.elements;return n[0]+=e*n[2],n[3]+=e*n[5],n[6]+=e*n[8],n[1]+=t*n[2],n[4]+=t*n[5],n[7]+=t*n[8],this},equals:function(e){for(var t=this.elements,n=e.elements,i=0;i<9;i++)if(t[i]!==n[i])return!1;return!0},fromArray:function(e,t){t===void 0&&(t=0);for(var n=0;n<9;n++)this.elements[n]=e[n+t];return this},toArray:function(e,t){e===void 0&&(e=[]),t===void 0&&(t=0);var n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}});var Ii,Vn={getDataURL:function(e){var t;if(typeof HTMLCanvasElement>"u")return e.src;if(e instanceof HTMLCanvasElement)t=e;else{Ii===void 0&&(Ii=document.createElementNS("http://www.w3.org/1999/xhtml","canvas")),Ii.width=e.width,Ii.height=e.height;var n=Ii.getContext("2d");e instanceof ImageData?n.putImageData(e,0,0):n.drawImage(e,0,0,e.width,e.height),t=Ii}return t.width>2048||t.height>2048?t.toDataURL("image/jpeg",.6):t.toDataURL("image/png")}},jf=0;function tt(e,t,n,i,r,a,o,s,l,c){Object.defineProperty(this,"id",{value:jf++}),this.uuid=Pe.generateUUID(),this.name="",this.image=e!==void 0?e:tt.DEFAULT_IMAGE,this.mipmaps=[],this.mapping=t!==void 0?t:tt.DEFAULT_MAPPING,this.wrapS=n!==void 0?n:Ot,this.wrapT=i!==void 0?i:Ot,this.magFilter=r!==void 0?r:Lt,this.minFilter=a!==void 0?a:Ra,this.anisotropy=l!==void 0?l:1,this.format=o!==void 0?o:_n,this.type=s!==void 0?s:zo,this.offset=new j(0,0),this.repeat=new j(1,1),this.center=new j(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new xt,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.encoding=c!==void 0?c:Nr,this.version=0,this.onUpdate=null}tt.DEFAULT_IMAGE=void 0;tt.DEFAULT_MAPPING=Po;tt.prototype=Object.assign(Object.create(pn.prototype),{constructor:tt,isTexture:!0,updateMatrix:function(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.name=e.name,this.image=e.image,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.encoding=e.encoding,this},toJSON:function(e){var t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];var n={metadata:{version:4.5,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,mapping:this.mapping,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,type:this.type,encoding:this.encoding,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};if(this.image!==void 0){var i=this.image;if(i.uuid===void 0&&(i.uuid=Pe.generateUUID()),!t&&e.images[i.uuid]===void 0){var r;if(Array.isArray(i)){r=[];for(var a=0,o=i.length;a<o;a++)r.push(Vn.getDataURL(i[a]))}else r=Vn.getDataURL(i);e.images[i.uuid]={uuid:i.uuid,url:r}}n.image=i.uuid}return t||(e.textures[this.uuid]=n),n},dispose:function(){this.dispatchEvent({type:"dispose"})},transformUv:function(e){if(this.mapping!==Po)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Rn:e.x=e.x-Math.floor(e.x);break;case Ot:e.x=e.x<0?0:1;break;case ii:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Rn:e.y=e.y-Math.floor(e.y);break;case Ot:e.y=e.y<0?0:1;break;case ii:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}});Object.defineProperty(tt.prototype,"needsUpdate",{set:function(e){e===!0&&this.version++}});function et(e,t,n,i){this.x=e||0,this.y=t||0,this.z=n||0,this.w=i!==void 0?i:1}Object.defineProperties(et.prototype,{width:{get:function(){return this.z},set:function(e){this.z=e}},height:{get:function(){return this.w},set:function(e){this.w=e}}});Object.assign(et.prototype,{isVector4:!0,set:function(e,t,n,i){return this.x=e,this.y=t,this.z=n,this.w=i,this},setScalar:function(e){return this.x=e,this.y=e,this.z=e,this.w=e,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setZ:function(e){return this.z=e,this},setW:function(e){return this.w=e,this},setComponent:function(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this},getComponent:function(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}},clone:function(){return new this.constructor(this.x,this.y,this.z,this.w)},copy:function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this},add:function(e,t){return t!==void 0?(console.warn("THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead."),this.addVectors(e,t)):(this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this)},addScalar:function(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this},addVectors:function(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this},addScaledVector:function(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this},sub:function(e,t){return t!==void 0?(console.warn("THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead."),this.subVectors(e,t)):(this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this)},subScalar:function(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this},subVectors:function(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this},multiplyScalar:function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},applyMatrix4:function(e){var t=this.x,n=this.y,i=this.z,r=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*i+a[12]*r,this.y=a[1]*t+a[5]*n+a[9]*i+a[13]*r,this.z=a[2]*t+a[6]*n+a[10]*i+a[14]*r,this.w=a[3]*t+a[7]*n+a[11]*i+a[15]*r,this},divideScalar:function(e){return this.multiplyScalar(1/e)},setAxisAngleFromQuaternion:function(e){this.w=2*Math.acos(e.w);var t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this},setAxisAngleFromRotationMatrix:function(e){var t,n,i,r,a=.01,o=.1,s=e.elements,l=s[0],c=s[4],u=s[8],h=s[1],d=s[5],f=s[9],p=s[2],v=s[6],m=s[10];if(Math.abs(c-h)<a&&Math.abs(u-p)<a&&Math.abs(f-v)<a){if(Math.abs(c+h)<o&&Math.abs(u+p)<o&&Math.abs(f+v)<o&&Math.abs(l+d+m-3)<o)return this.set(1,0,0,0),this;t=Math.PI;var g=(l+1)/2,y=(d+1)/2,b=(m+1)/2,_=(c+h)/4,w=(u+p)/4,L=(f+v)/4;return g>y&&g>b?g<a?(n=0,i=.707106781,r=.707106781):(n=Math.sqrt(g),i=_/n,r=w/n):y>b?y<a?(n=.707106781,i=0,r=.707106781):(i=Math.sqrt(y),n=_/i,r=L/i):b<a?(n=.707106781,i=.707106781,r=0):(r=Math.sqrt(b),n=w/r,i=L/r),this.set(n,i,r,t),this}var R=Math.sqrt((v-f)*(v-f)+(u-p)*(u-p)+(h-c)*(h-c));return Math.abs(R)<.001&&(R=1),this.x=(v-f)/R,this.y=(u-p)/R,this.z=(h-c)/R,this.w=Math.acos((l+d+m-1)/2),this},min:function(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this},max:function(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this},clamp:function(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this},clampScalar:function(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this},clampLength:function(e,t){var n=this.length();return this.divideScalar(n||1).multiplyScalar(Math.max(e,Math.min(t,n)))},floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this},ceil:function(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this},round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this},roundToZero:function(){return this.x=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(this.w),this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this},dot:function(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w},lengthSq:function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},manhattanLength:function(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)},normalize:function(){return this.divideScalar(this.length()||1)},setLength:function(e){return this.normalize().multiplyScalar(e)},lerp:function(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this},lerpVectors:function(e,t,n){return this.subVectors(t,e).multiplyScalar(n).add(e)},equals:function(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w},fromArray:function(e,t){return t===void 0&&(t=0),this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this},toArray:function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e},fromBufferAttribute:function(e,t,n){return n!==void 0&&console.warn("THREE.Vector4: offset has been removed from .fromBufferAttribute()."),this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}});function wn(e,t,n){this.width=e,this.height=t,this.scissor=new et(0,0,e,t),this.scissorTest=!1,this.viewport=new et(0,0,e,t),n=n||{},this.texture=new tt(void 0,void 0,n.wrapS,n.wrapT,n.magFilter,n.minFilter,n.format,n.type,n.anisotropy,n.encoding),this.texture.image={},this.texture.image.width=e,this.texture.image.height=t,this.texture.generateMipmaps=n.generateMipmaps!==void 0?n.generateMipmaps:!1,this.texture.minFilter=n.minFilter!==void 0?n.minFilter:Lt,this.depthBuffer=n.depthBuffer!==void 0?n.depthBuffer:!0,this.stencilBuffer=n.stencilBuffer!==void 0?n.stencilBuffer:!0,this.depthTexture=n.depthTexture!==void 0?n.depthTexture:null}wn.prototype=Object.assign(Object.create(pn.prototype),{constructor:wn,isWebGLRenderTarget:!0,setSize:function(e,t){(this.width!==e||this.height!==t)&&(this.width=e,this.height=t,this.texture.image.width=e,this.texture.image.height=t,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.width=e.width,this.height=e.height,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,this.depthTexture=e.depthTexture,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});function Ts(e,t,n){wn.call(this,e,t,n),this.samples=4}Ts.prototype=Object.assign(Object.create(wn.prototype),{constructor:Ts,isWebGLMultisampleRenderTarget:!0,copy:function(e){return wn.prototype.copy.call(this,e),this.samples=e.samples,this}});function Me(){this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],arguments.length>0&&console.error("THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.")}Object.assign(Me.prototype,{isMatrix4:!0,set:function(e,t,n,i,r,a,o,s,l,c,u,h,d,f,p,v){var m=this.elements;return m[0]=e,m[4]=t,m[8]=n,m[12]=i,m[1]=r,m[5]=a,m[9]=o,m[13]=s,m[2]=l,m[6]=c,m[10]=u,m[14]=h,m[3]=d,m[7]=f,m[11]=p,m[15]=v,this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},clone:function(){return new Me().fromArray(this.elements)},copy:function(e){var t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this},copyPosition:function(e){var t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this},extractBasis:function(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this},makeBasis:function(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this},extractRotation:function(){var e=new E;return function(n){var i=this.elements,r=n.elements,a=1/e.setFromMatrixColumn(n,0).length(),o=1/e.setFromMatrixColumn(n,1).length(),s=1/e.setFromMatrixColumn(n,2).length();return i[0]=r[0]*a,i[1]=r[1]*a,i[2]=r[2]*a,i[3]=0,i[4]=r[4]*o,i[5]=r[5]*o,i[6]=r[6]*o,i[7]=0,i[8]=r[8]*s,i[9]=r[9]*s,i[10]=r[10]*s,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,this}}(),makeRotationFromEuler:function(e){e&&e.isEuler||console.error("THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.");var t=this.elements,n=e.x,i=e.y,r=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(i),l=Math.sin(i),c=Math.cos(r),u=Math.sin(r);if(e.order==="XYZ"){var h=a*c,d=a*u,f=o*c,p=o*u;t[0]=s*c,t[4]=-s*u,t[8]=l,t[1]=d+f*l,t[5]=h-p*l,t[9]=-o*s,t[2]=p-h*l,t[6]=f+d*l,t[10]=a*s}else if(e.order==="YXZ"){var v=s*c,m=s*u,g=l*c,y=l*u;t[0]=v+y*o,t[4]=g*o-m,t[8]=a*l,t[1]=a*u,t[5]=a*c,t[9]=-o,t[2]=m*o-g,t[6]=y+v*o,t[10]=a*s}else if(e.order==="ZXY"){var v=s*c,m=s*u,g=l*c,y=l*u;t[0]=v-y*o,t[4]=-a*u,t[8]=g+m*o,t[1]=m+g*o,t[5]=a*c,t[9]=y-v*o,t[2]=-a*l,t[6]=o,t[10]=a*s}else if(e.order==="ZYX"){var h=a*c,d=a*u,f=o*c,p=o*u;t[0]=s*c,t[4]=f*l-d,t[8]=h*l+p,t[1]=s*u,t[5]=p*l+h,t[9]=d*l-f,t[2]=-l,t[6]=o*s,t[10]=a*s}else if(e.order==="YZX"){var b=a*s,_=a*l,w=o*s,L=o*l;t[0]=s*c,t[4]=L-b*u,t[8]=w*u+_,t[1]=u,t[5]=a*c,t[9]=-o*c,t[2]=-l*c,t[6]=_*u+w,t[10]=b-L*u}else if(e.order==="XZY"){var b=a*s,_=a*l,w=o*s,L=o*l;t[0]=s*c,t[4]=-u,t[8]=l*c,t[1]=b*u+L,t[5]=a*c,t[9]=_*u-w,t[2]=w*u-_,t[6]=o*c,t[10]=L*u+b}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this},makeRotationFromQuaternion:function(){var e=new E(0,0,0),t=new E(1,1,1);return function(i){return this.compose(e,i,t)}}(),lookAt:function(){var e=new E,t=new E,n=new E;return function(r,a,o){var s=this.elements;return n.subVectors(r,a),n.lengthSq()===0&&(n.z=1),n.normalize(),e.crossVectors(o,n),e.lengthSq()===0&&(Math.abs(o.z)===1?n.x+=1e-4:n.z+=1e-4,n.normalize(),e.crossVectors(o,n)),e.normalize(),t.crossVectors(n,e),s[0]=e.x,s[4]=t.x,s[8]=n.x,s[1]=e.y,s[5]=t.y,s[9]=n.y,s[2]=e.z,s[6]=t.z,s[10]=n.z,this}}(),multiply:function(e,t){return t!==void 0?(console.warn("THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead."),this.multiplyMatrices(e,t)):this.multiplyMatrices(this,e)},premultiply:function(e){return this.multiplyMatrices(e,this)},multiplyMatrices:function(e,t){var n=e.elements,i=t.elements,r=this.elements,a=n[0],o=n[4],s=n[8],l=n[12],c=n[1],u=n[5],h=n[9],d=n[13],f=n[2],p=n[6],v=n[10],m=n[14],g=n[3],y=n[7],b=n[11],_=n[15],w=i[0],L=i[4],R=i[8],k=i[12],O=i[1],z=i[5],C=i[9],I=i[13],N=i[2],H=i[6],G=i[10],X=i[14],Z=i[3],V=i[7],Y=i[11],J=i[15];return r[0]=a*w+o*O+s*N+l*Z,r[4]=a*L+o*z+s*H+l*V,r[8]=a*R+o*C+s*G+l*Y,r[12]=a*k+o*I+s*X+l*J,r[1]=c*w+u*O+h*N+d*Z,r[5]=c*L+u*z+h*H+d*V,r[9]=c*R+u*C+h*G+d*Y,r[13]=c*k+u*I+h*X+d*J,r[2]=f*w+p*O+v*N+m*Z,r[6]=f*L+p*z+v*H+m*V,r[10]=f*R+p*C+v*G+m*Y,r[14]=f*k+p*I+v*X+m*J,r[3]=g*w+y*O+b*N+_*Z,r[7]=g*L+y*z+b*H+_*V,r[11]=g*R+y*C+b*G+_*Y,r[15]=g*k+y*I+b*X+_*J,this},multiplyScalar:function(e){var t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this},applyToBufferAttribute:function(){var e=new E;return function(n){for(var i=0,r=n.count;i<r;i++)e.x=n.getX(i),e.y=n.getY(i),e.z=n.getZ(i),e.applyMatrix4(this),n.setXYZ(i,e.x,e.y,e.z);return n}}(),determinant:function(){var e=this.elements,t=e[0],n=e[4],i=e[8],r=e[12],a=e[1],o=e[5],s=e[9],l=e[13],c=e[2],u=e[6],h=e[10],d=e[14],f=e[3],p=e[7],v=e[11],m=e[15];return f*(+r*s*u-i*l*u-r*o*h+n*l*h+i*o*d-n*s*d)+p*(+t*s*d-t*l*h+r*a*h-i*a*d+i*l*c-r*s*c)+v*(+t*l*u-t*o*d-r*a*u+n*a*d+r*o*c-n*l*c)+m*(-i*o*c-t*s*u+t*o*h+i*a*u-n*a*h+n*s*c)},transpose:function(){var e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this},setPosition:function(e,t,n){var i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=n),this},getInverse:function(e,t){var n=this.elements,i=e.elements,r=i[0],a=i[1],o=i[2],s=i[3],l=i[4],c=i[5],u=i[6],h=i[7],d=i[8],f=i[9],p=i[10],v=i[11],m=i[12],g=i[13],y=i[14],b=i[15],_=f*y*h-g*p*h+g*u*v-c*y*v-f*u*b+c*p*b,w=m*p*h-d*y*h-m*u*v+l*y*v+d*u*b-l*p*b,L=d*g*h-m*f*h+m*c*v-l*g*v-d*c*b+l*f*b,R=m*f*u-d*g*u-m*c*p+l*g*p+d*c*y-l*f*y,k=r*_+a*w+o*L+s*R;if(k===0){var O="THREE.Matrix4: .getInverse() can't invert matrix, determinant is 0";if(t===!0)throw new Error(O);return console.warn(O),this.identity()}var z=1/k;return n[0]=_*z,n[1]=(g*p*s-f*y*s-g*o*v+a*y*v+f*o*b-a*p*b)*z,n[2]=(c*y*s-g*u*s+g*o*h-a*y*h-c*o*b+a*u*b)*z,n[3]=(f*u*s-c*p*s-f*o*h+a*p*h+c*o*v-a*u*v)*z,n[4]=w*z,n[5]=(d*y*s-m*p*s+m*o*v-r*y*v-d*o*b+r*p*b)*z,n[6]=(m*u*s-l*y*s-m*o*h+r*y*h+l*o*b-r*u*b)*z,n[7]=(l*p*s-d*u*s+d*o*h-r*p*h-l*o*v+r*u*v)*z,n[8]=L*z,n[9]=(m*f*s-d*g*s-m*a*v+r*g*v+d*a*b-r*f*b)*z,n[10]=(l*g*s-m*c*s+m*a*h-r*g*h-l*a*b+r*c*b)*z,n[11]=(d*c*s-l*f*s-d*a*h+r*f*h+l*a*v-r*c*v)*z,n[12]=R*z,n[13]=(d*g*o-m*f*o+m*a*p-r*g*p-d*a*y+r*f*y)*z,n[14]=(m*c*o-l*g*o-m*a*u+r*g*u+l*a*y-r*c*y)*z,n[15]=(l*f*o-d*c*o+d*a*u-r*f*u-l*a*p+r*c*p)*z,this},scale:function(e){var t=this.elements,n=e.x,i=e.y,r=e.z;return t[0]*=n,t[4]*=i,t[8]*=r,t[1]*=n,t[5]*=i,t[9]*=r,t[2]*=n,t[6]*=i,t[10]*=r,t[3]*=n,t[7]*=i,t[11]*=r,this},getMaxScaleOnAxis:function(){var e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,i))},makeTranslation:function(e,t,n){return this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this},makeRotationX:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this},makeRotationY:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this},makeRotationZ:function(e){var t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this},makeRotationAxis:function(e,t){var n=Math.cos(t),i=Math.sin(t),r=1-n,a=e.x,o=e.y,s=e.z,l=r*a,c=r*o;return this.set(l*a+n,l*o-i*s,l*s+i*o,0,l*o+i*s,c*o+n,c*s-i*a,0,l*s-i*o,c*s+i*a,r*s*s+n,0,0,0,0,1),this},makeScale:function(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this},makeShear:function(e,t,n){return this.set(1,t,n,0,e,1,n,0,e,t,1,0,0,0,0,1),this},compose:function(e,t,n){var i=this.elements,r=t._x,a=t._y,o=t._z,s=t._w,l=r+r,c=a+a,u=o+o,h=r*l,d=r*c,f=r*u,p=a*c,v=a*u,m=o*u,g=s*l,y=s*c,b=s*u,_=n.x,w=n.y,L=n.z;return i[0]=(1-(p+m))*_,i[1]=(d+b)*_,i[2]=(f-y)*_,i[3]=0,i[4]=(d-b)*w,i[5]=(1-(h+m))*w,i[6]=(v+g)*w,i[7]=0,i[8]=(f+y)*L,i[9]=(v-g)*L,i[10]=(1-(h+p))*L,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this},decompose:function(){var e=new E,t=new Me;return function(i,r,a){var o=this.elements,s=e.set(o[0],o[1],o[2]).length(),l=e.set(o[4],o[5],o[6]).length(),c=e.set(o[8],o[9],o[10]).length(),u=this.determinant();u<0&&(s=-s),i.x=o[12],i.y=o[13],i.z=o[14],t.copy(this);var h=1/s,d=1/l,f=1/c;return t.elements[0]*=h,t.elements[1]*=h,t.elements[2]*=h,t.elements[4]*=d,t.elements[5]*=d,t.elements[6]*=d,t.elements[8]*=f,t.elements[9]*=f,t.elements[10]*=f,r.setFromRotationMatrix(t),a.x=s,a.y=l,a.z=c,this}}(),makePerspective:function(e,t,n,i,r,a){a===void 0&&console.warn("THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.");var o=this.elements,s=2*r/(t-e),l=2*r/(n-i),c=(t+e)/(t-e),u=(n+i)/(n-i),h=-(a+r)/(a-r),d=-2*a*r/(a-r);return o[0]=s,o[4]=0,o[8]=c,o[12]=0,o[1]=0,o[5]=l,o[9]=u,o[13]=0,o[2]=0,o[6]=0,o[10]=h,o[14]=d,o[3]=0,o[7]=0,o[11]=-1,o[15]=0,this},makeOrthographic:function(e,t,n,i,r,a){var o=this.elements,s=1/(t-e),l=1/(n-i),c=1/(a-r),u=(t+e)*s,h=(n+i)*l,d=(a+r)*c;return o[0]=2*s,o[4]=0,o[8]=0,o[12]=-u,o[1]=0,o[5]=2*l,o[9]=0,o[13]=-h,o[2]=0,o[6]=0,o[10]=-2*c,o[14]=-d,o[3]=0,o[7]=0,o[11]=0,o[15]=1,this},equals:function(e){for(var t=this.elements,n=e.elements,i=0;i<16;i++)if(t[i]!==n[i])return!1;return!0},fromArray:function(e,t){t===void 0&&(t=0);for(var n=0;n<16;n++)this.elements[n]=e[n+t];return this},toArray:function(e,t){e===void 0&&(e=[]),t===void 0&&(t=0);var n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}});var Ha,Ua;function Ti(e,t,n,i){this._x=e||0,this._y=t||0,this._z=n||0,this._order=i||Ti.DefaultOrder}Ti.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];Ti.DefaultOrder="XYZ";Object.defineProperties(Ti.prototype,{x:{get:function(){return this._x},set:function(e){this._x=e,this._onChangeCallback()}},y:{get:function(){return this._y},set:function(e){this._y=e,this._onChangeCallback()}},z:{get:function(){return this._z},set:function(e){this._z=e,this._onChangeCallback()}},order:{get:function(){return this._order},set:function(e){this._order=e,this._onChangeCallback()}}});Object.assign(Ti.prototype,{isEuler:!0,set:function(e,t,n,i){return this._x=e,this._y=t,this._z=n,this._order=i||this._order,this._onChangeCallback(),this},clone:function(){return new this.constructor(this._x,this._y,this._z,this._order)},copy:function(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this},setFromRotationMatrix:function(e,t,n){var i=Pe.clamp,r=e.elements,a=r[0],o=r[4],s=r[8],l=r[1],c=r[5],u=r[9],h=r[2],d=r[6],f=r[10];return t=t||this._order,t==="XYZ"?(this._y=Math.asin(i(s,-1,1)),Math.abs(s)<.99999?(this._x=Math.atan2(-u,f),this._z=Math.atan2(-o,a)):(this._x=Math.atan2(d,c),this._z=0)):t==="YXZ"?(this._x=Math.asin(-i(u,-1,1)),Math.abs(u)<.99999?(this._y=Math.atan2(s,f),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,a),this._z=0)):t==="ZXY"?(this._x=Math.asin(i(d,-1,1)),Math.abs(d)<.99999?(this._y=Math.atan2(-h,f),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,a))):t==="ZYX"?(this._y=Math.asin(-i(h,-1,1)),Math.abs(h)<.99999?(this._x=Math.atan2(d,f),this._z=Math.atan2(l,a)):(this._x=0,this._z=Math.atan2(-o,c))):t==="YZX"?(this._z=Math.asin(i(l,-1,1)),Math.abs(l)<.99999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-h,a)):(this._x=0,this._y=Math.atan2(s,f))):t==="XZY"?(this._z=Math.asin(-i(o,-1,1)),Math.abs(o)<.99999?(this._x=Math.atan2(d,c),this._y=Math.atan2(s,a)):(this._x=Math.atan2(-u,f),this._y=0)):console.warn("THREE.Euler: .setFromRotationMatrix() given unsupported order: "+t),this._order=t,n!==!1&&this._onChangeCallback(),this},setFromQuaternion:function(e,t,n){return Ha===void 0&&(Ha=new Me),Ha.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Ha,t,n)},setFromVector3:function(e,t){return this.set(e.x,e.y,e.z,t||this._order)},reorder:function(e){return Ua===void 0&&(Ua=new pt),Ua.setFromEuler(this),this.setFromQuaternion(Ua,e)},equals:function(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order},fromArray:function(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this},toArray:function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e},toVector3:function(e){return e?e.set(this._x,this._y,this._z):new E(this._x,this._y,this._z)},_onChange:function(e){return this._onChangeCallback=e,this},_onChangeCallback:function(){}});function il(){this.mask=1}Object.assign(il.prototype,{set:function(e){this.mask=1<<e|0},enable:function(e){this.mask|=1<<e|0},toggle:function(e){this.mask^=1<<e|0},disable:function(e){this.mask&=~(1<<e|0)},test:function(e){return(this.mask&e.mask)!==0}});var Yf=0;function ae(){Object.defineProperty(this,"id",{value:Yf++}),this.uuid=Pe.generateUUID(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ae.DefaultUp.clone();var e=new E,t=new Ti,n=new pt,i=new E(1,1,1);function r(){n.setFromEuler(t,!1)}function a(){t.setFromQuaternion(n,void 0,!1)}t._onChange(r),n._onChange(a),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:n},scale:{configurable:!0,enumerable:!0,value:i},modelViewMatrix:{value:new Me},normalMatrix:{value:new xt}}),this.matrix=new Me,this.matrixWorld=new Me,this.matrixAutoUpdate=ae.DefaultMatrixAutoUpdate,this.matrixWorldNeedsUpdate=!1,this.layers=new il,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.userData={}}ae.DefaultUp=new E(0,1,0);ae.DefaultMatrixAutoUpdate=!0;ae.prototype=Object.assign(Object.create(pn.prototype),{constructor:ae,isObject3D:!0,onBeforeRender:function(){},onAfterRender:function(){},applyMatrix:function(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)},applyQuaternion:function(e){return this.quaternion.premultiply(e),this},setRotationFromAxisAngle:function(e,t){this.quaternion.setFromAxisAngle(e,t)},setRotationFromEuler:function(e){this.quaternion.setFromEuler(e,!0)},setRotationFromMatrix:function(e){this.quaternion.setFromRotationMatrix(e)},setRotationFromQuaternion:function(e){this.quaternion.copy(e)},rotateOnAxis:function(){var e=new pt;return function(n,i){return e.setFromAxisAngle(n,i),this.quaternion.multiply(e),this}}(),rotateOnWorldAxis:function(){var e=new pt;return function(n,i){return e.setFromAxisAngle(n,i),this.quaternion.premultiply(e),this}}(),rotateX:function(){var e=new E(1,0,0);return function(n){return this.rotateOnAxis(e,n)}}(),rotateY:function(){var e=new E(0,1,0);return function(n){return this.rotateOnAxis(e,n)}}(),rotateZ:function(){var e=new E(0,0,1);return function(n){return this.rotateOnAxis(e,n)}}(),translateOnAxis:function(){var e=new E;return function(n,i){return e.copy(n).applyQuaternion(this.quaternion),this.position.add(e.multiplyScalar(i)),this}}(),translateX:function(){var e=new E(1,0,0);return function(n){return this.translateOnAxis(e,n)}}(),translateY:function(){var e=new E(0,1,0);return function(n){return this.translateOnAxis(e,n)}}(),translateZ:function(){var e=new E(0,0,1);return function(n){return this.translateOnAxis(e,n)}}(),localToWorld:function(e){return e.applyMatrix4(this.matrixWorld)},worldToLocal:function(){var e=new Me;return function(n){return n.applyMatrix4(e.getInverse(this.matrixWorld))}}(),lookAt:function(){var e=new pt,t=new Me,n=new E,i=new E;return function(a,o,s){a.isVector3?n.copy(a):n.set(a,o,s);var l=this.parent;this.updateWorldMatrix(!0,!1),i.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?t.lookAt(i,n,this.up):t.lookAt(n,i,this.up),this.quaternion.setFromRotationMatrix(t),l&&(t.extractRotation(l.matrixWorld),e.setFromRotationMatrix(t),this.quaternion.premultiply(e.inverse()))}}(),add:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.parent!==null&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent({type:"added"})):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)},remove:function(e){if(arguments.length>1){for(var t=0;t<arguments.length;t++)this.remove(arguments[t]);return this}var n=this.children.indexOf(e);return n!==-1&&(e.parent=null,this.children.splice(n,1),e.dispatchEvent({type:"removed"})),this},attach:function(){var e=new Me;return function(n){return this.updateWorldMatrix(!0,!1),e.getInverse(this.matrixWorld),n.parent!==null&&(n.parent.updateWorldMatrix(!0,!1),e.multiply(n.parent.matrixWorld)),n.applyMatrix(e),n.updateWorldMatrix(!1,!1),this.add(n),this}}(),getObjectById:function(e){return this.getObjectByProperty("id",e)},getObjectByName:function(e){return this.getObjectByProperty("name",e)},getObjectByProperty:function(e,t){if(this[e]===t)return this;for(var n=0,i=this.children.length;n<i;n++){var r=this.children[n],a=r.getObjectByProperty(e,t);if(a!==void 0)return a}},getWorldPosition:function(e){return e===void 0&&(console.warn("THREE.Object3D: .getWorldPosition() target is now required"),e=new E),this.updateMatrixWorld(!0),e.setFromMatrixPosition(this.matrixWorld)},getWorldQuaternion:function(){var e=new E,t=new E;return function(i){return i===void 0&&(console.warn("THREE.Object3D: .getWorldQuaternion() target is now required"),i=new pt),this.updateMatrixWorld(!0),this.matrixWorld.decompose(e,i,t),i}}(),getWorldScale:function(){var e=new E,t=new pt;return function(i){return i===void 0&&(console.warn("THREE.Object3D: .getWorldScale() target is now required"),i=new E),this.updateMatrixWorld(!0),this.matrixWorld.decompose(e,t,i),i}}(),getWorldDirection:function(e){e===void 0&&(console.warn("THREE.Object3D: .getWorldDirection() target is now required"),e=new E),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()},raycast:function(){},traverse:function(e){e(this);for(var t=this.children,n=0,i=t.length;n<i;n++)t[n].traverse(e)},traverseVisible:function(e){if(this.visible!==!1){e(this);for(var t=this.children,n=0,i=t.length;n<i;n++)t[n].traverseVisible(e)}},traverseAncestors:function(e){var t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))},updateMatrix:function(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0},updateMatrixWorld:function(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);for(var t=this.children,n=0,i=t.length;n<i;n++)t[n].updateMatrixWorld(e)},updateWorldMatrix:function(e,t){var n=this.parent;if(e===!0&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t===!0)for(var i=this.children,r=0,a=i.length;r<a;r++)i[r].updateWorldMatrix(!1,!0)},toJSON:function(e){var t=e===void 0||typeof e=="string",n={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{}},n.metadata={version:4.5,type:"Object",generator:"Object3D.toJSON"});var i={};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.castShadow===!0&&(i.castShadow=!0),this.receiveShadow===!0&&(i.receiveShadow=!0),this.visible===!1&&(i.visible=!1),this.frustumCulled===!1&&(i.frustumCulled=!1),this.renderOrder!==0&&(i.renderOrder=this.renderOrder),JSON.stringify(this.userData)!=="{}"&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isMesh&&this.drawMode!==Ho&&(i.drawMode=this.drawMode);function r(m,g){return m[g.uuid]===void 0&&(m[g.uuid]=g.toJSON(e)),g.uuid}if(this.isMesh||this.isLine||this.isPoints){i.geometry=r(e.geometries,this.geometry);var a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){var o=a.shapes;if(Array.isArray(o))for(var s=0,l=o.length;s<l;s++){var c=o[s];r(e.shapes,c)}else r(e.shapes,o)}}if(this.material!==void 0)if(Array.isArray(this.material)){for(var u=[],s=0,l=this.material.length;s<l;s++)u.push(r(e.materials,this.material[s]));i.material=u}else i.material=r(e.materials,this.material);if(this.children.length>0){i.children=[];for(var s=0;s<this.children.length;s++)i.children.push(this.children[s].toJSON(e).object)}if(t){var h=v(e.geometries),d=v(e.materials),f=v(e.textures),p=v(e.images),o=v(e.shapes);h.length>0&&(n.geometries=h),d.length>0&&(n.materials=d),f.length>0&&(n.textures=f),p.length>0&&(n.images=p),o.length>0&&(n.shapes=o)}return n.object=i,n;function v(m){var g=[];for(var y in m){var b=m[y];delete b.metadata,g.push(b)}return g}},clone:function(e){return new this.constructor().copy(this,e)},copy:function(e,t){if(t===void 0&&(t=!0),this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(var n=0;n<e.children.length;n++){var i=e.children[n];this.add(i.clone())}return this}});function Br(){ae.call(this),this.type="Scene",this.background=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}Br.prototype=Object.assign(Object.create(ae.prototype),{constructor:Br,isScene:!0,copy:function(e,t){return ae.prototype.copy.call(this,e,t),e.background!==null&&(this.background=e.background.clone()),e.fog!==null&&(this.fog=e.fog.clone()),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this},toJSON:function(e){var t=ae.prototype.toJSON.call(this,e);return this.background!==null&&(t.object.background=this.background.toJSON(e)),this.fog!==null&&(t.object.fog=this.fog.toJSON()),t},dispose:function(){this.dispatchEvent({type:"dispose"})}});function an(e,t){this.min=e!==void 0?e:new E(1/0,1/0,1/0),this.max=t!==void 0?t:new E(-1/0,-1/0,-1/0)}Object.assign(an.prototype,{isBox3:!0,set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromArray:function(e){for(var t=1/0,n=1/0,i=1/0,r=-1/0,a=-1/0,o=-1/0,s=0,l=e.length;s<l;s+=3){var c=e[s],u=e[s+1],h=e[s+2];c<t&&(t=c),u<n&&(n=u),h<i&&(i=h),c>r&&(r=c),u>a&&(a=u),h>o&&(o=h)}return this.min.set(t,n,i),this.max.set(r,a,o),this},setFromBufferAttribute:function(e){for(var t=1/0,n=1/0,i=1/0,r=-1/0,a=-1/0,o=-1/0,s=0,l=e.count;s<l;s++){var c=e.getX(s),u=e.getY(s),h=e.getZ(s);c<t&&(t=c),u<n&&(n=u),h<i&&(i=h),c>r&&(r=c),u>a&&(a=u),h>o&&(o=h)}return this.min.set(t,n,i),this.max.set(r,a,o),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(){var e=new E;return function(n,i){var r=e.copy(i).multiplyScalar(.5);return this.min.copy(n).sub(r),this.max.copy(n).add(r),this}}(),setFromObject:function(e){return this.makeEmpty(),this.expandByObject(e)},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z},getCenter:function(e){return e===void 0&&(console.warn("THREE.Box3: .getCenter() target is now required"),e=new E),this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){return e===void 0&&(console.warn("THREE.Box3: .getSize() target is now required"),e=new E),this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},expandByObject:function(){var e,t,n,i=new E;function r(a){var o=a.geometry;if(o!==void 0){if(o.isGeometry){var s=o.vertices;for(t=0,n=s.length;t<n;t++)i.copy(s[t]),i.applyMatrix4(a.matrixWorld),e.expandByPoint(i)}else if(o.isBufferGeometry){var l=o.attributes.position;if(l!==void 0)for(t=0,n=l.count;t<n;t++)i.fromBufferAttribute(l,t).applyMatrix4(a.matrixWorld),e.expandByPoint(i)}}}return function(o){return e=this,o.updateMatrixWorld(!0),o.traverse(r),this}}(),containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z},getParameter:function(e,t){return t===void 0&&(console.warn("THREE.Box3: .getParameter() target is now required"),t=new E),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)},intersectsSphere:function(){var e=new E;return function(n){return this.clampPoint(n.center,e),e.distanceToSquared(n.center)<=n.radius*n.radius}}(),intersectsPlane:function(e){var t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant},intersectsTriangle:function(){var e=new E,t=new E,n=new E,i=new E,r=new E,a=new E,o=new E,s=new E,l=new E,c=new E;function u(h){var d,f;for(d=0,f=h.length-3;d<=f;d+=3){o.fromArray(h,d);var p=l.x*Math.abs(o.x)+l.y*Math.abs(o.y)+l.z*Math.abs(o.z),v=e.dot(o),m=t.dot(o),g=n.dot(o);if(Math.max(-Math.max(v,m,g),Math.min(v,m,g))>p)return!1}return!0}return function(d){if(this.isEmpty())return!1;this.getCenter(s),l.subVectors(this.max,s),e.subVectors(d.a,s),t.subVectors(d.b,s),n.subVectors(d.c,s),i.subVectors(t,e),r.subVectors(n,t),a.subVectors(e,n);var f=[0,-i.z,i.y,0,-r.z,r.y,0,-a.z,a.y,i.z,0,-i.x,r.z,0,-r.x,a.z,0,-a.x,-i.y,i.x,0,-r.y,r.x,0,-a.y,a.x,0];return!u(f)||(f=[1,0,0,0,1,0,0,0,1],!u(f))?!1:(c.crossVectors(i,r),f=[c.x,c.y,c.z],u(f))}}(),clampPoint:function(e,t){return t===void 0&&(console.warn("THREE.Box3: .clampPoint() target is now required"),t=new E),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new E;return function(n){var i=e.copy(n).clamp(this.min,this.max);return i.sub(n).length()}}(),getBoundingSphere:function(){var e=new E;return function(n){return n===void 0&&console.error("THREE.Box3: .getBoundingSphere() target is now required"),this.getCenter(n.center),n.radius=this.getSize(e).length()*.5,n}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},applyMatrix4:function(){var e=[new E,new E,new E,new E,new E,new E,new E,new E];return function(n){return this.isEmpty()?this:(e[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(n),e[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(n),e[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(n),e[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(n),e[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(n),e[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(n),e[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(n),e[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(n),this.setFromPoints(e),this)}}(),translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}});var Ko;function sn(e,t){this.center=e!==void 0?e:new E,this.radius=t!==void 0?t:0}Object.assign(sn.prototype,{set:function(e,t){return this.center.copy(e),this.radius=t,this},setFromPoints:function(e,t){Ko===void 0&&(Ko=new an);var n=this.center;t!==void 0?n.copy(t):Ko.setFromPoints(e).getCenter(n);for(var i=0,r=0,a=e.length;r<a;r++)i=Math.max(i,n.distanceToSquared(e[r]));return this.radius=Math.sqrt(i),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.center.copy(e.center),this.radius=e.radius,this},empty:function(){return this.radius<=0},containsPoint:function(e){return e.distanceToSquared(this.center)<=this.radius*this.radius},distanceToPoint:function(e){return e.distanceTo(this.center)-this.radius},intersectsSphere:function(e){var t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t},intersectsBox:function(e){return e.intersectsSphere(this)},intersectsPlane:function(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius},clampPoint:function(e,t){var n=this.center.distanceToSquared(e);return t===void 0&&(console.warn("THREE.Sphere: .clampPoint() target is now required"),t=new E),t.copy(e),n>this.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t},getBoundingBox:function(e){return e===void 0&&(console.warn("THREE.Sphere: .getBoundingBox() target is now required"),e=new an),e.set(this.center,this.center),e.expandByScalar(this.radius),e},applyMatrix4:function(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this},translate:function(e){return this.center.add(e),this},equals:function(e){return e.center.equals(this.center)&&e.radius===this.radius}});function Ai(e,t){this.origin=e!==void 0?e:new E,this.direction=t!==void 0?t:new E}Object.assign(Ai.prototype,{set:function(e,t){return this.origin.copy(e),this.direction.copy(t),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this},at:function(e,t){return t===void 0&&(console.warn("THREE.Ray: .at() target is now required"),t=new E),t.copy(this.direction).multiplyScalar(e).add(this.origin)},lookAt:function(e){return this.direction.copy(e).sub(this.origin).normalize(),this},recast:function(){var e=new E;return function(n){return this.origin.copy(this.at(n,e)),this}}(),closestPointToPoint:function(e,t){t===void 0&&(console.warn("THREE.Ray: .closestPointToPoint() target is now required"),t=new E),t.subVectors(e,this.origin);var n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(n).add(this.origin)},distanceToPoint:function(e){return Math.sqrt(this.distanceSqToPoint(e))},distanceSqToPoint:function(){var e=new E;return function(n){var i=e.subVectors(n,this.origin).dot(this.direction);return i<0?this.origin.distanceToSquared(n):(e.copy(this.direction).multiplyScalar(i).add(this.origin),e.distanceToSquared(n))}}(),distanceSqToSegment:function(){var e=new E,t=new E,n=new E;return function(r,a,o,s){e.copy(r).add(a).multiplyScalar(.5),t.copy(a).sub(r).normalize(),n.copy(this.origin).sub(e);var l=r.distanceTo(a)*.5,c=-this.direction.dot(t),u=n.dot(this.direction),h=-n.dot(t),d=n.lengthSq(),f=Math.abs(1-c*c),p,v,m,g;if(f>0)if(p=c*h-u,v=c*u-h,g=l*f,p>=0)if(v>=-g)if(v<=g){var y=1/f;p*=y,v*=y,m=p*(p+c*v+2*u)+v*(c*p+v+2*h)+d}else v=l,p=Math.max(0,-(c*v+u)),m=-p*p+v*(v+2*h)+d;else v=-l,p=Math.max(0,-(c*v+u)),m=-p*p+v*(v+2*h)+d;else v<=-g?(p=Math.max(0,-(-c*l+u)),v=p>0?-l:Math.min(Math.max(-l,-h),l),m=-p*p+v*(v+2*h)+d):v<=g?(p=0,v=Math.min(Math.max(-l,-h),l),m=v*(v+2*h)+d):(p=Math.max(0,-(c*l+u)),v=p>0?l:Math.min(Math.max(-l,-h),l),m=-p*p+v*(v+2*h)+d);else v=c>0?-l:l,p=Math.max(0,-(c*v+u)),m=-p*p+v*(v+2*h)+d;return o&&o.copy(this.direction).multiplyScalar(p).add(this.origin),s&&s.copy(t).multiplyScalar(v).add(e),m}}(),intersectSphere:function(){var e=new E;return function(n,i){e.subVectors(n.center,this.origin);var r=e.dot(this.direction),a=e.dot(e)-r*r,o=n.radius*n.radius;if(a>o)return null;var s=Math.sqrt(o-a),l=r-s,c=r+s;return l<0&&c<0?null:l<0?this.at(c,i):this.at(l,i)}}(),intersectsSphere:function(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius},distanceToPlane:function(e){var t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;var n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null},intersectPlane:function(e,t){var n=this.distanceToPlane(e);return n===null?null:this.at(n,t)},intersectsPlane:function(e){var t=e.distanceToPoint(this.origin);if(t===0)return!0;var n=e.normal.dot(this.direction);return n*t<0},intersectBox:function(e,t){var n,i,r,a,o,s,l=1/this.direction.x,c=1/this.direction.y,u=1/this.direction.z,h=this.origin;return l>=0?(n=(e.min.x-h.x)*l,i=(e.max.x-h.x)*l):(n=(e.max.x-h.x)*l,i=(e.min.x-h.x)*l),c>=0?(r=(e.min.y-h.y)*c,a=(e.max.y-h.y)*c):(r=(e.max.y-h.y)*c,a=(e.min.y-h.y)*c),n>a||r>i||((r>n||n!==n)&&(n=r),(a<i||i!==i)&&(i=a),u>=0?(o=(e.min.z-h.z)*u,s=(e.max.z-h.z)*u):(o=(e.max.z-h.z)*u,s=(e.min.z-h.z)*u),n>s||o>i)||((o>n||n!==n)&&(n=o),(s<i||i!==i)&&(i=s),i<0)?null:this.at(n>=0?n:i,t)},intersectsBox:function(){var e=new E;return function(n){return this.intersectBox(n,e)!==null}}(),intersectTriangle:function(){var e=new E,t=new E,n=new E,i=new E;return function(a,o,s,l,c){t.subVectors(o,a),n.subVectors(s,a),i.crossVectors(t,n);var u=this.direction.dot(i),h;if(u>0){if(l)return null;h=1}else if(u<0)h=-1,u=-u;else return null;e.subVectors(this.origin,a);var d=h*this.direction.dot(n.crossVectors(e,n));if(d<0)return null;var f=h*this.direction.dot(t.cross(e));if(f<0||d+f>u)return null;var p=-h*e.dot(i);return p<0?null:this.at(p/u,c)}}(),applyMatrix4:function(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this},equals:function(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}});function yt(e,t,n){this.a=e!==void 0?e:new E,this.b=t!==void 0?t:new E,this.c=n!==void 0?n:new E}Object.assign(yt,{getNormal:function(){var e=new E;return function(n,i,r,a){a===void 0&&(console.warn("THREE.Triangle: .getNormal() target is now required"),a=new E),a.subVectors(r,i),e.subVectors(n,i),a.cross(e);var o=a.lengthSq();return o>0?a.multiplyScalar(1/Math.sqrt(o)):a.set(0,0,0)}}(),getBarycoord:function(){var e=new E,t=new E,n=new E;return function(r,a,o,s,l){e.subVectors(s,a),t.subVectors(o,a),n.subVectors(r,a);var c=e.dot(e),u=e.dot(t),h=e.dot(n),d=t.dot(t),f=t.dot(n),p=c*d-u*u;if(l===void 0&&(console.warn("THREE.Triangle: .getBarycoord() target is now required"),l=new E),p===0)return l.set(-2,-1,-1);var v=1/p,m=(d*h-u*f)*v,g=(c*f-u*h)*v;return l.set(1-m-g,g,m)}}(),containsPoint:function(){var e=new E;return function(n,i,r,a){return yt.getBarycoord(n,i,r,a,e),e.x>=0&&e.y>=0&&e.x+e.y<=1}}(),getUV:function(){var e=new E;return function(n,i,r,a,o,s,l,c){return this.getBarycoord(n,i,r,a,e),c.set(0,0),c.addScaledVector(o,e.x),c.addScaledVector(s,e.y),c.addScaledVector(l,e.z),c}}(),isFrontFacing:function(){var e=new E,t=new E;return function(i,r,a,o){return e.subVectors(a,r),t.subVectors(i,r),e.cross(t).dot(o)<0}}()});Object.assign(yt.prototype,{set:function(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this},setFromPointsAndIndices:function(e,t,n,i){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[i]),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this},getArea:function(){var e=new E,t=new E;return function(){return e.subVectors(this.c,this.b),t.subVectors(this.a,this.b),e.cross(t).length()*.5}}(),getMidpoint:function(e){return e===void 0&&(console.warn("THREE.Triangle: .getMidpoint() target is now required"),e=new E),e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)},getNormal:function(e){return yt.getNormal(this.a,this.b,this.c,e)},getPlane:function(e){return e===void 0&&(console.warn("THREE.Triangle: .getPlane() target is now required"),e=new E),e.setFromCoplanarPoints(this.a,this.b,this.c)},getBarycoord:function(e,t){return yt.getBarycoord(e,this.a,this.b,this.c,t)},getUV:function(e,t,n,i,r){return yt.getUV(e,this.a,this.b,this.c,t,n,i,r)},containsPoint:function(e){return yt.containsPoint(e,this.a,this.b,this.c)},isFrontFacing:function(e){return yt.isFrontFacing(this.a,this.b,this.c,e)},intersectsBox:function(e){return e.intersectsTriangle(this)},closestPointToPoint:function(){var e=new E,t=new E,n=new E,i=new E,r=new E,a=new E;return function(s,l){l===void 0&&(console.warn("THREE.Triangle: .closestPointToPoint() target is now required"),l=new E);var c=this.a,u=this.b,h=this.c,d,f;e.subVectors(u,c),t.subVectors(h,c),i.subVectors(s,c);var p=e.dot(i),v=t.dot(i);if(p<=0&&v<=0)return l.copy(c);r.subVectors(s,u);var m=e.dot(r),g=t.dot(r);if(m>=0&&g<=m)return l.copy(u);var y=p*g-m*v;if(y<=0&&p>=0&&m<=0)return d=p/(p-m),l.copy(c).addScaledVector(e,d);a.subVectors(s,h);var b=e.dot(a),_=t.dot(a);if(_>=0&&b<=_)return l.copy(h);var w=b*v-p*_;if(w<=0&&v>=0&&_<=0)return f=v/(v-_),l.copy(c).addScaledVector(t,f);var L=m*_-b*g;if(L<=0&&g-m>=0&&b-_>=0)return n.subVectors(h,u),f=(g-m)/(g-m+(b-_)),l.copy(u).addScaledVector(n,f);var R=1/(L+w+y);return d=w*R,f=y*R,l.copy(c).addScaledVector(e,d).addScaledVector(t,f)}}(),equals:function(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}});var Xf={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function ye(e,t,n){return t===void 0&&n===void 0?this.set(e):this.setRGB(e,t,n)}function es(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*6*(2/3-n):e}function ts(e){return e<.04045?e*.0773993808:Math.pow(e*.9478672986+.0521327014,2.4)}function ns(e){return e<.0031308?e*12.92:1.055*Math.pow(e,.41666)-.055}Object.assign(ye.prototype,{isColor:!0,r:1,g:1,b:1,set:function(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this},setScalar:function(e){return this.r=e,this.g=e,this.b=e,this},setHex:function(e){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,this},setRGB:function(e,t,n){return this.r=e,this.g=t,this.b=n,this},setHSL:function(e,t,n){if(e=Pe.euclideanModulo(e,1),t=Pe.clamp(t,0,1),n=Pe.clamp(n,0,1),t===0)this.r=this.g=this.b=n;else{var i=n<=.5?n*(1+t):n+t-n*t,r=2*n-i;this.r=es(r,i,e+1/3),this.g=es(r,i,e),this.b=es(r,i,e-1/3)}return this},setStyle:function(e){function t(h){h!==void 0&&parseFloat(h)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}var n;if(n=/^((?:rgb|hsl)a?)\(\s*([^\)]*)\)/.exec(e)){var i,r=n[1],a=n[2];switch(r){case"rgb":case"rgba":if(i=/^(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(i[1],10))/255,this.g=Math.min(255,parseInt(i[2],10))/255,this.b=Math.min(255,parseInt(i[3],10))/255,t(i[5]),this;if(i=/^(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(i[1],10))/100,this.g=Math.min(100,parseInt(i[2],10))/100,this.b=Math.min(100,parseInt(i[3],10))/100,t(i[5]),this;break;case"hsl":case"hsla":if(i=/^([0-9]*\.?[0-9]+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(,\s*([0-9]*\.?[0-9]+)\s*)?$/.exec(a)){var o=parseFloat(i[1])/360,s=parseInt(i[2],10)/100,l=parseInt(i[3],10)/100;return t(i[5]),this.setHSL(o,s,l)}break}}else if(n=/^\#([A-Fa-f0-9]+)$/.exec(e)){var c=n[1],u=c.length;if(u===3)return this.r=parseInt(c.charAt(0)+c.charAt(0),16)/255,this.g=parseInt(c.charAt(1)+c.charAt(1),16)/255,this.b=parseInt(c.charAt(2)+c.charAt(2),16)/255,this;if(u===6)return this.r=parseInt(c.charAt(0)+c.charAt(1),16)/255,this.g=parseInt(c.charAt(2)+c.charAt(3),16)/255,this.b=parseInt(c.charAt(4)+c.charAt(5),16)/255,this}if(e&&e.length>0){var c=Xf[e];c!==void 0?this.setHex(c):console.warn("THREE.Color: Unknown color "+e)}return this},clone:function(){return new this.constructor(this.r,this.g,this.b)},copy:function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},copyGammaToLinear:function(e,t){return t===void 0&&(t=2),this.r=Math.pow(e.r,t),this.g=Math.pow(e.g,t),this.b=Math.pow(e.b,t),this},copyLinearToGamma:function(e,t){t===void 0&&(t=2);var n=t>0?1/t:1;return this.r=Math.pow(e.r,n),this.g=Math.pow(e.g,n),this.b=Math.pow(e.b,n),this},convertGammaToLinear:function(e){return this.copyGammaToLinear(this,e),this},convertLinearToGamma:function(e){return this.copyLinearToGamma(this,e),this},copySRGBToLinear:function(e){return this.r=ts(e.r),this.g=ts(e.g),this.b=ts(e.b),this},copyLinearToSRGB:function(e){return this.r=ns(e.r),this.g=ns(e.g),this.b=ns(e.b),this},convertSRGBToLinear:function(){return this.copySRGBToLinear(this),this},convertLinearToSRGB:function(){return this.copyLinearToSRGB(this),this},getHex:function(){return this.r*255<<16^this.g*255<<8^this.b*255<<0},getHexString:function(){return("000000"+this.getHex().toString(16)).slice(-6)},getHSL:function(e){e===void 0&&(console.warn("THREE.Color: .getHSL() target is now required"),e={h:0,s:0,l:0});var t=this.r,n=this.g,i=this.b,r=Math.max(t,n,i),a=Math.min(t,n,i),o,s,l=(a+r)/2;if(a===r)o=0,s=0;else{var c=r-a;switch(s=l<=.5?c/(r+a):c/(2-r-a),r){case t:o=(n-i)/c+(n<i?6:0);break;case n:o=(i-t)/c+2;break;case i:o=(t-n)/c+4;break}o/=6}return e.h=o,e.s=s,e.l=l,e},getStyle:function(){return"rgb("+(this.r*255|0)+","+(this.g*255|0)+","+(this.b*255|0)+")"},offsetHSL:function(){var e={};return function(t,n,i){return this.getHSL(e),e.h+=t,e.s+=n,e.l+=i,this.setHSL(e.h,e.s,e.l),this}}(),add:function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this},addColors:function(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this},addScalar:function(e){return this.r+=e,this.g+=e,this.b+=e,this},sub:function(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this},multiply:function(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this},multiplyScalar:function(e){return this.r*=e,this.g*=e,this.b*=e,this},lerp:function(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this},lerpHSL:function(){var e={h:0,s:0,l:0},t={h:0,s:0,l:0};return function(i,r){this.getHSL(e),i.getHSL(t);var a=Pe.lerp(e.h,t.h,r),o=Pe.lerp(e.s,t.s,r),s=Pe.lerp(e.l,t.l,r);return this.setHSL(a,o,s),this}}(),equals:function(e){return e.r===this.r&&e.g===this.g&&e.b===this.b},fromArray:function(e,t){return t===void 0&&(t=0),this.r=e[t],this.g=e[t+1],this.b=e[t+2],this},toArray:function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e},toJSON:function(){return this.getHex()}});function Hi(e,t,n,i,r,a){this.a=e,this.b=t,this.c=n,this.normal=i&&i.isVector3?i:new E,this.vertexNormals=Array.isArray(i)?i:[],this.color=r&&r.isColor?r:new ye,this.vertexColors=Array.isArray(r)?r:[],this.materialIndex=a!==void 0?a:0}Object.assign(Hi.prototype,{clone:function(){return new this.constructor().copy(this)},copy:function(e){this.a=e.a,this.b=e.b,this.c=e.c,this.normal.copy(e.normal),this.color.copy(e.color),this.materialIndex=e.materialIndex;for(var t=0,n=e.vertexNormals.length;t<n;t++)this.vertexNormals[t]=e.vertexNormals[t].clone();for(var t=0,n=e.vertexColors.length;t<n;t++)this.vertexColors[t]=e.vertexColors[t].clone();return this}});var Zf=0;function Oe(){Object.defineProperty(this,"id",{value:Zf++}),this.uuid=Pe.generateUUID(),this.name="",this.type="Material",this.fog=!0,this.lights=!0,this.blending=ti,this.side=br,this.flatShading=!1,this.vertexTangents=!1,this.vertexColors=Ys,this.opacity=1,this.transparent=!1,this.blendSrc=qs,this.blendDst=Js,this.blendEquation=Qn,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=ro,this.depthTest=!0,this.depthWrite=!0,this.stencilFunc=Cu,this.stencilRef=0,this.stencilMask=255,this.stencilFail=$a,this.stencilZFail=$a,this.stencilZPass=$a,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaTest=0,this.premultipliedAlpha=!1,this.visible=!0,this.userData={},this.needsUpdate=!0}Oe.prototype=Object.assign(Object.create(pn.prototype),{constructor:Oe,isMaterial:!0,onBeforeCompile:function(){},setValues:function(e){if(e!==void 0)for(var t in e){var n=e[t];if(n===void 0){console.warn("THREE.Material: '"+t+"' parameter is undefined.");continue}if(t==="shading"){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=n===js;continue}var i=this[t];if(i===void 0){console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.");continue}i&&i.isColor?i.set(n):i&&i.isVector3&&n&&n.isVector3?i.copy(n):this[t]=n}},toJSON:function(e){var t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});var n={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};n.uuid=this.uuid,n.type=this.type,this.name!==""&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearCoat!==void 0&&(n.clearCoat=this.clearCoat),this.clearCoatRoughness!==void 0&&(n.clearCoatRoughness=this.clearCoatRoughness),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,n.reflectivity=this.reflectivity,n.refractionRatio=this.refractionRatio,this.combine!==void 0&&(n.combine=this.combine),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity)),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.size!==void 0&&(n.size=this.size),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==ti&&(n.blending=this.blending),this.flatShading===!0&&(n.flatShading=this.flatShading),this.side!==br&&(n.side=this.side),this.vertexColors!==Ys&&(n.vertexColors=this.vertexColors),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=this.transparent),n.depthFunc=this.depthFunc,n.depthTest=this.depthTest,n.depthWrite=this.depthWrite,n.stencilWrite=this.stencilWrite,n.stencilFunc=this.stencilFunc,n.stencilRef=this.stencilRef,n.stencilMask=this.stencilMask,n.stencilFail=this.stencilFail,n.stencilZFail=this.stencilZFail,n.stencilZPass=this.stencilZPass,this.rotation&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(n.wireframe=this.wireframe),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(n.wireframeLinejoin=this.wireframeLinejoin),this.morphTargets===!0&&(n.morphTargets=!0),this.morphNormals===!0&&(n.morphNormals=!0),this.skinning===!0&&(n.skinning=!0),this.visible===!1&&(n.visible=!1),JSON.stringify(this.userData)!=="{}"&&(n.userData=this.userData);function i(o){var s=[];for(var l in o){var c=o[l];delete c.metadata,s.push(c)}return s}if(t){var r=i(e.textures),a=i(e.images);r.length>0&&(n.textures=r),a.length>0&&(n.images=a)}return n},clone:function(){return new this.constructor().copy(this)},copy:function(e){this.name=e.name,this.fog=e.fog,this.lights=e.lights,this.blending=e.blending,this.side=e.side,this.flatShading=e.flatShading,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWrite=e.stencilWrite,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilMask=e.stencilMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.userData=JSON.parse(JSON.stringify(e.userData)),this.clipShadows=e.clipShadows,this.clipIntersection=e.clipIntersection;var t=e.clippingPlanes,n=null;if(t!==null){var i=t.length;n=new Array(i);for(var r=0;r!==i;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.shadowSide=e.shadowSide,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});function Yt(e){Oe.call(this),this.type="MeshBasicMaterial",this.color=new ye(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Ca,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.lights=!1,this.setValues(e)}Yt.prototype=Object.create(Oe.prototype);Yt.prototype.constructor=Yt;Yt.prototype.isMeshBasicMaterial=!0;Yt.prototype.copy=function(e){return Oe.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this};function ke(e,t,n){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=n===!0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0}Object.defineProperty(ke.prototype,"needsUpdate",{set:function(e){e===!0&&this.version++}});Object.assign(ke.prototype,{isBufferAttribute:!0,onUploadCallback:function(){},setArray:function(e){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");return this.count=e!==void 0?e.length/this.itemSize:0,this.array=e,this},setDynamic:function(e){return this.dynamic=e,this},copy:function(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.dynamic=e.dynamic,this},copyAt:function(e,t,n){e*=this.itemSize,n*=t.itemSize;for(var i=0,r=this.itemSize;i<r;i++)this.array[e+i]=t.array[n+i];return this},copyArray:function(e){return this.array.set(e),this},copyColorsArray:function(e){for(var t=this.array,n=0,i=0,r=e.length;i<r;i++){var a=e[i];a===void 0&&(console.warn("THREE.BufferAttribute.copyColorsArray(): color is undefined",i),a=new ye),t[n++]=a.r,t[n++]=a.g,t[n++]=a.b}return this},copyVector2sArray:function(e){for(var t=this.array,n=0,i=0,r=e.length;i<r;i++){var a=e[i];a===void 0&&(console.warn("THREE.BufferAttribute.copyVector2sArray(): vector is undefined",i),a=new j),t[n++]=a.x,t[n++]=a.y}return this},copyVector3sArray:function(e){for(var t=this.array,n=0,i=0,r=e.length;i<r;i++){var a=e[i];a===void 0&&(console.warn("THREE.BufferAttribute.copyVector3sArray(): vector is undefined",i),a=new E),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z}return this},copyVector4sArray:function(e){for(var t=this.array,n=0,i=0,r=e.length;i<r;i++){var a=e[i];a===void 0&&(console.warn("THREE.BufferAttribute.copyVector4sArray(): vector is undefined",i),a=new et),t[n++]=a.x,t[n++]=a.y,t[n++]=a.z,t[n++]=a.w}return this},set:function(e,t){return t===void 0&&(t=0),this.array.set(e,t),this},getX:function(e){return this.array[e*this.itemSize]},setX:function(e,t){return this.array[e*this.itemSize]=t,this},getY:function(e){return this.array[e*this.itemSize+1]},setY:function(e,t){return this.array[e*this.itemSize+1]=t,this},getZ:function(e){return this.array[e*this.itemSize+2]},setZ:function(e,t){return this.array[e*this.itemSize+2]=t,this},getW:function(e){return this.array[e*this.itemSize+3]},setW:function(e,t){return this.array[e*this.itemSize+3]=t,this},setXY:function(e,t,n){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this},setXYZ:function(e,t,n,i){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this},setXYZW:function(e,t,n,i,r){return e*=this.itemSize,this.array[e+0]=t,this.array[e+1]=n,this.array[e+2]=i,this.array[e+3]=r,this},onUpload:function(e){return this.onUploadCallback=e,this},clone:function(){return new this.constructor(this.array,this.itemSize).copy(this)},toJSON:function(){return{itemSize:this.itemSize,type:this.array.constructor.name,array:Array.prototype.slice.call(this.array),normalized:this.normalized}}});function zr(e,t,n){ke.call(this,new Int8Array(e),t,n)}zr.prototype=Object.create(ke.prototype);zr.prototype.constructor=zr;function Fr(e,t,n){ke.call(this,new Uint8Array(e),t,n)}Fr.prototype=Object.create(ke.prototype);Fr.prototype.constructor=Fr;function Hr(e,t,n){ke.call(this,new Uint8ClampedArray(e),t,n)}Hr.prototype=Object.create(ke.prototype);Hr.prototype.constructor=Hr;function Ur(e,t,n){ke.call(this,new Int16Array(e),t,n)}Ur.prototype=Object.create(ke.prototype);Ur.prototype.constructor=Ur;function ai(e,t,n){ke.call(this,new Uint16Array(e),t,n)}ai.prototype=Object.create(ke.prototype);ai.prototype.constructor=ai;function Gr(e,t,n){ke.call(this,new Int32Array(e),t,n)}Gr.prototype=Object.create(ke.prototype);Gr.prototype.constructor=Gr;function oi(e,t,n){ke.call(this,new Uint32Array(e),t,n)}oi.prototype=Object.create(ke.prototype);oi.prototype.constructor=oi;function $(e,t,n){ke.call(this,new Float32Array(e),t,n)}$.prototype=Object.create(ke.prototype);$.prototype.constructor=$;function Vr(e,t,n){ke.call(this,new Float64Array(e),t,n)}Vr.prototype=Object.create(ke.prototype);Vr.prototype.constructor=Vr;function Ru(){this.vertices=[],this.normals=[],this.colors=[],this.uvs=[],this.uvs2=[],this.groups=[],this.morphTargets={},this.skinWeights=[],this.skinIndices=[],this.boundingBox=null,this.boundingSphere=null,this.verticesNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.uvsNeedUpdate=!1,this.groupsNeedUpdate=!1}Object.assign(Ru.prototype,{computeGroups:function(e){for(var t,n=[],i=void 0,r=e.faces,a=0;a<r.length;a++){var o=r[a];o.materialIndex!==i&&(i=o.materialIndex,t!==void 0&&(t.count=a*3-t.start,n.push(t)),t={start:a*3,materialIndex:i})}t!==void 0&&(t.count=a*3-t.start,n.push(t)),this.groups=n},fromGeometry:function(e){var t=e.faces,n=e.vertices,i=e.faceVertexUvs,r=i[0]&&i[0].length>0,a=i[1]&&i[1].length>0,o=e.morphTargets,s=o.length,l;if(s>0){l=[];for(var c=0;c<s;c++)l[c]={name:o[c].name,data:[]};this.morphTargets.position=l}var u=e.morphNormals,h=u.length,d;if(h>0){d=[];for(var c=0;c<h;c++)d[c]={name:u[c].name,data:[]};this.morphTargets.normal=d}var f=e.skinIndices,p=e.skinWeights,v=f.length===n.length,m=p.length===n.length;n.length>0&&t.length===0&&console.error("THREE.DirectGeometry: Faceless geometries are not supported.");for(var c=0;c<t.length;c++){var g=t[c];this.vertices.push(n[g.a],n[g.b],n[g.c]);var y=g.vertexNormals;if(y.length===3)this.normals.push(y[0],y[1],y[2]);else{var b=g.normal;this.normals.push(b,b,b)}var _=g.vertexColors;if(_.length===3)this.colors.push(_[0],_[1],_[2]);else{var w=g.color;this.colors.push(w,w,w)}if(r===!0){var L=i[0][c];L!==void 0?this.uvs.push(L[0],L[1],L[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv ",c),this.uvs.push(new j,new j,new j))}if(a===!0){var L=i[1][c];L!==void 0?this.uvs2.push(L[0],L[1],L[2]):(console.warn("THREE.DirectGeometry.fromGeometry(): Undefined vertexUv2 ",c),this.uvs2.push(new j,new j,new j))}for(var R=0;R<s;R++){var k=o[R].vertices;l[R].data.push(k[g.a],k[g.b],k[g.c])}for(var R=0;R<h;R++){var O=u[R].vertexNormals[c];d[R].data.push(O.a,O.b,O.c)}v&&this.skinIndices.push(f[g.a],f[g.b],f[g.c]),m&&this.skinWeights.push(p[g.a],p[g.b],p[g.c])}return this.computeGroups(e),this.verticesNeedUpdate=e.verticesNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),this}});function Iu(e){if(e.length===0)return-1/0;for(var t=e[0],n=1,i=e.length;n<i;++n)e[n]>t&&(t=e[n]);return t}var qf=1;function oe(){Object.defineProperty(this,"id",{value:qf+=2}),this.uuid=Pe.generateUUID(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}oe.prototype=Object.assign(Object.create(pn.prototype),{constructor:oe,isBufferGeometry:!0,getIndex:function(){return this.index},setIndex:function(e){Array.isArray(e)?this.index=new(Iu(e)>65535?oi:ai)(e,1):this.index=e},addAttribute:function(e,t){return!(t&&t.isBufferAttribute)&&!(t&&t.isInterleavedBufferAttribute)?(console.warn("THREE.BufferGeometry: .addAttribute() now expects ( name, attribute )."),this.addAttribute(e,new ke(arguments[1],arguments[2]))):e==="index"?(console.warn("THREE.BufferGeometry.addAttribute: Use .setIndex() for index attribute."),this.setIndex(t),this):(this.attributes[e]=t,this)},getAttribute:function(e){return this.attributes[e]},removeAttribute:function(e){return delete this.attributes[e],this},addGroup:function(e,t,n){this.groups.push({start:e,count:t,materialIndex:n!==void 0?n:0})},clearGroups:function(){this.groups=[]},setDrawRange:function(e,t){this.drawRange.start=e,this.drawRange.count=t},applyMatrix:function(e){var t=this.attributes.position;t!==void 0&&(e.applyToBufferAttribute(t),t.needsUpdate=!0);var n=this.attributes.normal;if(n!==void 0){var i=new xt().getNormalMatrix(e);i.applyToBufferAttribute(n),n.needsUpdate=!0}var r=this.attributes.tangent;if(r!==void 0){var i=new xt().getNormalMatrix(e);i.applyToBufferAttribute(r),r.needsUpdate=!0}return this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this},rotateX:function(){var e=new Me;return function(n){return e.makeRotationX(n),this.applyMatrix(e),this}}(),rotateY:function(){var e=new Me;return function(n){return e.makeRotationY(n),this.applyMatrix(e),this}}(),rotateZ:function(){var e=new Me;return function(n){return e.makeRotationZ(n),this.applyMatrix(e),this}}(),translate:function(){var e=new Me;return function(n,i,r){return e.makeTranslation(n,i,r),this.applyMatrix(e),this}}(),scale:function(){var e=new Me;return function(n,i,r){return e.makeScale(n,i,r),this.applyMatrix(e),this}}(),lookAt:function(){var e=new ae;return function(n){e.lookAt(n),e.updateMatrix(),this.applyMatrix(e.matrix)}}(),center:function(){var e=new E;return function(){return this.computeBoundingBox(),this.boundingBox.getCenter(e).negate(),this.translate(e.x,e.y,e.z),this}}(),setFromObject:function(e){var t=e.geometry;if(e.isPoints||e.isLine){var n=new $(t.vertices.length*3,3),i=new $(t.colors.length*3,3);if(this.addAttribute("position",n.copyVector3sArray(t.vertices)),this.addAttribute("color",i.copyColorsArray(t.colors)),t.lineDistances&&t.lineDistances.length===t.vertices.length){var r=new $(t.lineDistances.length,1);this.addAttribute("lineDistance",r.copyArray(t.lineDistances))}t.boundingSphere!==null&&(this.boundingSphere=t.boundingSphere.clone()),t.boundingBox!==null&&(this.boundingBox=t.boundingBox.clone())}else e.isMesh&&t&&t.isGeometry&&this.fromGeometry(t);return this},setFromPoints:function(e){for(var t=[],n=0,i=e.length;n<i;n++){var r=e[n];t.push(r.x,r.y,r.z||0)}return this.addAttribute("position",new $(t,3)),this},updateFromObject:function(e){var t=e.geometry;if(e.isMesh){var n=t.__directGeometry;if(t.elementsNeedUpdate===!0&&(n=void 0,t.elementsNeedUpdate=!1),n===void 0)return this.fromGeometry(t);n.verticesNeedUpdate=t.verticesNeedUpdate,n.normalsNeedUpdate=t.normalsNeedUpdate,n.colorsNeedUpdate=t.colorsNeedUpdate,n.uvsNeedUpdate=t.uvsNeedUpdate,n.groupsNeedUpdate=t.groupsNeedUpdate,t.verticesNeedUpdate=!1,t.normalsNeedUpdate=!1,t.colorsNeedUpdate=!1,t.uvsNeedUpdate=!1,t.groupsNeedUpdate=!1,t=n}var i;return t.verticesNeedUpdate===!0&&(i=this.attributes.position,i!==void 0&&(i.copyVector3sArray(t.vertices),i.needsUpdate=!0),t.verticesNeedUpdate=!1),t.normalsNeedUpdate===!0&&(i=this.attributes.normal,i!==void 0&&(i.copyVector3sArray(t.normals),i.needsUpdate=!0),t.normalsNeedUpdate=!1),t.colorsNeedUpdate===!0&&(i=this.attributes.color,i!==void 0&&(i.copyColorsArray(t.colors),i.needsUpdate=!0),t.colorsNeedUpdate=!1),t.uvsNeedUpdate&&(i=this.attributes.uv,i!==void 0&&(i.copyVector2sArray(t.uvs),i.needsUpdate=!0),t.uvsNeedUpdate=!1),t.lineDistancesNeedUpdate&&(i=this.attributes.lineDistance,i!==void 0&&(i.copyArray(t.lineDistances),i.needsUpdate=!0),t.lineDistancesNeedUpdate=!1),t.groupsNeedUpdate&&(t.computeGroups(e.geometry),this.groups=t.groups,t.groupsNeedUpdate=!1),this},fromGeometry:function(e){return e.__directGeometry=new Ru().fromGeometry(e),this.fromDirectGeometry(e.__directGeometry)},fromDirectGeometry:function(e){var t=new Float32Array(e.vertices.length*3);if(this.addAttribute("position",new ke(t,3).copyVector3sArray(e.vertices)),e.normals.length>0){var n=new Float32Array(e.normals.length*3);this.addAttribute("normal",new ke(n,3).copyVector3sArray(e.normals))}if(e.colors.length>0){var i=new Float32Array(e.colors.length*3);this.addAttribute("color",new ke(i,3).copyColorsArray(e.colors))}if(e.uvs.length>0){var r=new Float32Array(e.uvs.length*2);this.addAttribute("uv",new ke(r,2).copyVector2sArray(e.uvs))}if(e.uvs2.length>0){var a=new Float32Array(e.uvs2.length*2);this.addAttribute("uv2",new ke(a,2).copyVector2sArray(e.uvs2))}this.groups=e.groups;for(var o in e.morphTargets){for(var s=[],l=e.morphTargets[o],c=0,u=l.length;c<u;c++){var h=l[c],d=new $(h.data.length*3,3);d.name=h.name,s.push(d.copyVector3sArray(h.data))}this.morphAttributes[o]=s}if(e.skinIndices.length>0){var f=new $(e.skinIndices.length*4,4);this.addAttribute("skinIndex",f.copyVector4sArray(e.skinIndices))}if(e.skinWeights.length>0){var p=new $(e.skinWeights.length*4,4);this.addAttribute("skinWeight",p.copyVector4sArray(e.skinWeights))}return e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),this},computeBoundingBox:function(){var e=new an;return function(){this.boundingBox===null&&(this.boundingBox=new an);var n=this.attributes.position,i=this.morphAttributes.position;if(n!==void 0){if(this.boundingBox.setFromBufferAttribute(n),i)for(var r=0,a=i.length;r<a;r++){var o=i[r];e.setFromBufferAttribute(o),this.boundingBox.expandByPoint(e.min),this.boundingBox.expandByPoint(e.max)}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox: Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}}(),computeBoundingSphere:function(){var e=new an,t=new an,n=new E;return function(){this.boundingSphere===null&&(this.boundingSphere=new sn);var r=this.attributes.position,a=this.morphAttributes.position;if(r){var o=this.boundingSphere.center;if(e.setFromBufferAttribute(r),a)for(var s=0,l=a.length;s<l;s++){var c=a[s];t.setFromBufferAttribute(c),e.expandByPoint(t.min),e.expandByPoint(t.max)}e.getCenter(o);for(var u=0,s=0,l=r.count;s<l;s++)n.fromBufferAttribute(r,s),u=Math.max(u,o.distanceToSquared(n));if(a)for(var s=0,l=a.length;s<l;s++)for(var c=a[s],h=0,d=c.count;h<d;h++)n.fromBufferAttribute(c,h),u=Math.max(u,o.distanceToSquared(n));this.boundingSphere.radius=Math.sqrt(u),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}}(),computeFaceNormals:function(){},computeVertexNormals:function(){var e=this.index,t=this.attributes;if(t.position){var n=t.position.array;if(t.normal===void 0)this.addAttribute("normal",new ke(new Float32Array(n.length),3));else for(var i=t.normal.array,r=0,a=i.length;r<a;r++)i[r]=0;var o=t.normal.array,s,l,c,u=new E,h=new E,d=new E,f=new E,p=new E;if(e)for(var v=e.array,r=0,a=e.count;r<a;r+=3)s=v[r+0]*3,l=v[r+1]*3,c=v[r+2]*3,u.fromArray(n,s),h.fromArray(n,l),d.fromArray(n,c),f.subVectors(d,h),p.subVectors(u,h),f.cross(p),o[s]+=f.x,o[s+1]+=f.y,o[s+2]+=f.z,o[l]+=f.x,o[l+1]+=f.y,o[l+2]+=f.z,o[c]+=f.x,o[c+1]+=f.y,o[c+2]+=f.z;else for(var r=0,a=n.length;r<a;r+=9)u.fromArray(n,r),h.fromArray(n,r+3),d.fromArray(n,r+6),f.subVectors(d,h),p.subVectors(u,h),f.cross(p),o[r]=f.x,o[r+1]=f.y,o[r+2]=f.z,o[r+3]=f.x,o[r+4]=f.y,o[r+5]=f.z,o[r+6]=f.x,o[r+7]=f.y,o[r+8]=f.z;this.normalizeNormals(),t.normal.needsUpdate=!0}},merge:function(e,t){if(!(e&&e.isBufferGeometry)){console.error("THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.",e);return}t===void 0&&(t=0,console.warn("THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge."));var n=this.attributes;for(var i in n)if(e.attributes[i]!==void 0)for(var r=n[i],a=r.array,o=e.attributes[i],s=o.array,l=o.itemSize*t,c=Math.min(s.length,a.length-l),u=0,h=l;u<c;u++,h++)a[h]=s[u];return this},normalizeNormals:function(){var e=new E;return function(){for(var n=this.attributes.normal,i=0,r=n.count;i<r;i++)e.x=n.getX(i),e.y=n.getY(i),e.z=n.getZ(i),e.normalize(),n.setXYZ(i,e.x,e.y,e.z)}}(),toNonIndexed:function(){function e(v,m){for(var g=v.array,y=v.itemSize,b=new g.constructor(m.length*y),_=0,w=0,L=0,R=m.length;L<R;L++){_=m[L]*y;for(var k=0;k<y;k++)b[w++]=g[_++]}return new ke(b,y)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): Geometry is already non-indexed."),this;var t=new oe,n=this.index.array,i=this.attributes;for(var r in i){var a=i[r],o=e(a,n);t.addAttribute(r,o)}var s=this.morphAttributes;for(r in s){for(var l=[],c=s[r],u=0,h=c.length;u<h;u++){var a=c[u],o=e(a,n);l.push(o)}t.morphAttributes[r]=l}for(var d=this.groups,u=0,f=d.length;u<f;u++){var p=d[u];t.addGroup(p.start,p.count,p.materialIndex)}return t},toJSON:function(){var e={metadata:{version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){var t=this.parameters;for(var n in t)t[n]!==void 0&&(e[n]=t[n]);return e}e.data={attributes:{}};var i=this.index;i!==null&&(e.data.index={type:i.array.constructor.name,array:Array.prototype.slice.call(i.array)});var r=this.attributes;for(var n in r){var a=r[n],o=a.toJSON();a.name!==""&&(o.name=a.name),e.data.attributes[n]=o}var s={},l=!1;for(var n in this.morphAttributes){for(var c=this.morphAttributes[n],u=[],h=0,d=c.length;h<d;h++){var a=c[h],o=a.toJSON();a.name!==""&&(o.name=a.name),u.push(o)}u.length>0&&(s[n]=u,l=!0)}l&&(e.data.morphAttributes=s);var f=this.groups;f.length>0&&(e.data.groups=JSON.parse(JSON.stringify(f)));var p=this.boundingSphere;return p!==null&&(e.data.boundingSphere={center:p.center.toArray(),radius:p.radius}),e},clone:function(){return new oe().copy(this)},copy:function(e){var t,n,i;this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var r=e.index;r!==null&&this.setIndex(r.clone());var a=e.attributes;for(t in a){var o=a[t];this.addAttribute(t,o.clone())}var s=e.morphAttributes;for(t in s){var l=[],c=s[t];for(n=0,i=c.length;n<i;n++)l.push(c[n].clone());this.morphAttributes[t]=l}var u=e.groups;for(n=0,i=u.length;n<i;n++){var h=u[n];this.addGroup(h.start,h.count,h.materialIndex)}var d=e.boundingBox;d!==null&&(this.boundingBox=d.clone());var f=e.boundingSphere;return f!==null&&(this.boundingSphere=f.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});function _t(e,t){ae.call(this),this.type="Mesh",this.geometry=e!==void 0?e:new oe,this.material=t!==void 0?t:new Yt({color:Math.random()*16777215}),this.drawMode=Ho,this.updateMorphTargets()}_t.prototype=Object.assign(Object.create(ae.prototype),{constructor:_t,isMesh:!0,setDrawMode:function(e){this.drawMode=e},copy:function(e){return ae.prototype.copy.call(this,e),this.drawMode=e.drawMode,e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this},updateMorphTargets:function(){var e=this.geometry,t,n,i;if(e.isBufferGeometry){var r=e.morphAttributes,a=Object.keys(r);if(a.length>0){var o=r[a[0]];if(o!==void 0)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,n=o.length;t<n;t++)i=o[t].name||String(t),this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=t}}else{var s=e.morphTargets;s!==void 0&&s.length>0&&console.error("THREE.Mesh.updateMorphTargets() no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.")}},raycast:function(){var e=new Me,t=new Ai,n=new sn,i=new E,r=new E,a=new E,o=new E,s=new E,l=new E,c=new E,u=new E,h=new E,d=new j,f=new j,p=new j,v=new E,m=new E;function g(b,_,w,L,R,k,O,z){var C;if(_.side===vt?C=L.intersectTriangle(O,k,R,!0,z):C=L.intersectTriangle(R,k,O,_.side!==xr,z),C===null)return null;m.copy(z),m.applyMatrix4(b.matrixWorld);var I=w.ray.origin.distanceTo(m);return I<w.near||I>w.far?null:{distance:I,point:m.clone(),object:b}}function y(b,_,w,L,R,k,O,z,C,I,N){i.fromBufferAttribute(R,C),r.fromBufferAttribute(R,I),a.fromBufferAttribute(R,N);var H=b.morphTargetInfluences;if(_.morphTargets&&k&&H){c.set(0,0,0),u.set(0,0,0),h.set(0,0,0);for(var G=0,X=k.length;G<X;G++){var Z=H[G],V=k[G];Z!==0&&(o.fromBufferAttribute(V,C),s.fromBufferAttribute(V,I),l.fromBufferAttribute(V,N),c.addScaledVector(o.sub(i),Z),u.addScaledVector(s.sub(r),Z),h.addScaledVector(l.sub(a),Z))}i.add(c),r.add(u),a.add(h)}var Y=g(b,_,w,L,i,r,a,v);if(Y){O&&(d.fromBufferAttribute(O,C),f.fromBufferAttribute(O,I),p.fromBufferAttribute(O,N),Y.uv=yt.getUV(v,i,r,a,d,f,p,new j)),z&&(d.fromBufferAttribute(z,C),f.fromBufferAttribute(z,I),p.fromBufferAttribute(z,N),Y.uv2=yt.getUV(v,i,r,a,d,f,p,new j));var J=new Hi(C,I,N);yt.getNormal(i,r,a,J.normal),Y.face=J}return Y}return function(_,w){var L=this.geometry,R=this.material,k=this.matrixWorld;if(R!==void 0&&(L.boundingSphere===null&&L.computeBoundingSphere(),n.copy(L.boundingSphere),n.applyMatrix4(k),_.ray.intersectsSphere(n)!==!1&&(e.getInverse(k),t.copy(_.ray).applyMatrix4(e),!(L.boundingBox!==null&&t.intersectsBox(L.boundingBox)===!1)))){var O;if(L.isBufferGeometry){var z,C,I,N=L.index,H=L.attributes.position,G=L.morphAttributes.position,X=L.attributes.uv,Z=L.attributes.uv2,V=L.groups,Y=L.drawRange,J,ie,ce,Re,F,ue,K,be;if(N!==null)if(Array.isArray(R))for(J=0,ce=V.length;J<ce;J++)for(F=V[J],ue=R[F.materialIndex],K=Math.max(F.start,Y.start),be=Math.min(F.start+F.count,Y.start+Y.count),ie=K,Re=be;ie<Re;ie+=3)z=N.getX(ie),C=N.getX(ie+1),I=N.getX(ie+2),O=y(this,ue,_,t,H,G,X,Z,z,C,I),O&&(O.faceIndex=Math.floor(ie/3),O.face.materialIndex=F.materialIndex,w.push(O));else for(K=Math.max(0,Y.start),be=Math.min(N.count,Y.start+Y.count),J=K,ce=be;J<ce;J+=3)z=N.getX(J),C=N.getX(J+1),I=N.getX(J+2),O=y(this,R,_,t,H,G,X,Z,z,C,I),O&&(O.faceIndex=Math.floor(J/3),w.push(O));else if(H!==void 0)if(Array.isArray(R))for(J=0,ce=V.length;J<ce;J++)for(F=V[J],ue=R[F.materialIndex],K=Math.max(F.start,Y.start),be=Math.min(F.start+F.count,Y.start+Y.count),ie=K,Re=be;ie<Re;ie+=3)z=ie,C=ie+1,I=ie+2,O=y(this,ue,_,t,H,G,X,Z,z,C,I),O&&(O.faceIndex=Math.floor(ie/3),O.face.materialIndex=F.materialIndex,w.push(O));else for(K=Math.max(0,Y.start),be=Math.min(H.count,Y.start+Y.count),J=K,ce=be;J<ce;J+=3)z=J,C=J+1,I=J+2,O=y(this,R,_,t,H,G,X,Z,z,C,I),O&&(O.faceIndex=Math.floor(J/3),w.push(O))}else if(L.isGeometry){var xe,Ne,A,M=Array.isArray(R),W=L.vertices,Q=L.faces,_e,he=L.faceVertexUvs[0];he.length>0&&(_e=he);for(var ee=0,B=Q.length;ee<B;ee++){var re=Q[ee],Se=M?R[re.materialIndex]:R;if(Se!==void 0&&(xe=W[re.a],Ne=W[re.b],A=W[re.c],O=g(this,Se,_,t,xe,Ne,A,v),O)){if(_e&&_e[ee]){var Le=_e[ee];d.copy(Le[0]),f.copy(Le[1]),p.copy(Le[2]),O.uv=yt.getUV(v,xe,Ne,A,d,f,p,new j)}O.face=re,O.faceIndex=ee,w.push(O)}}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});var Jf=0;function Te(){Object.defineProperty(this,"id",{value:Jf+=2}),this.uuid=Pe.generateUUID(),this.name="",this.type="Geometry",this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.elementsNeedUpdate=!1,this.verticesNeedUpdate=!1,this.uvsNeedUpdate=!1,this.normalsNeedUpdate=!1,this.colorsNeedUpdate=!1,this.lineDistancesNeedUpdate=!1,this.groupsNeedUpdate=!1}Te.prototype=Object.assign(Object.create(pn.prototype),{constructor:Te,isGeometry:!0,applyMatrix:function(e){for(var t=new xt().getNormalMatrix(e),n=0,i=this.vertices.length;n<i;n++){var r=this.vertices[n];r.applyMatrix4(e)}for(var n=0,i=this.faces.length;n<i;n++){var a=this.faces[n];a.normal.applyMatrix3(t).normalize();for(var o=0,s=a.vertexNormals.length;o<s;o++)a.vertexNormals[o].applyMatrix3(t).normalize()}return this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this.verticesNeedUpdate=!0,this.normalsNeedUpdate=!0,this},rotateX:function(){var e=new Me;return function(n){return e.makeRotationX(n),this.applyMatrix(e),this}}(),rotateY:function(){var e=new Me;return function(n){return e.makeRotationY(n),this.applyMatrix(e),this}}(),rotateZ:function(){var e=new Me;return function(n){return e.makeRotationZ(n),this.applyMatrix(e),this}}(),translate:function(){var e=new Me;return function(n,i,r){return e.makeTranslation(n,i,r),this.applyMatrix(e),this}}(),scale:function(){var e=new Me;return function(n,i,r){return e.makeScale(n,i,r),this.applyMatrix(e),this}}(),lookAt:function(){var e=new ae;return function(n){e.lookAt(n),e.updateMatrix(),this.applyMatrix(e.matrix)}}(),fromBufferGeometry:function(e){var t=this,n=e.index!==null?e.index.array:void 0,i=e.attributes,r=i.position.array,a=i.normal!==void 0?i.normal.array:void 0,o=i.color!==void 0?i.color.array:void 0,s=i.uv!==void 0?i.uv.array:void 0,l=i.uv2!==void 0?i.uv2.array:void 0;l!==void 0&&(this.faceVertexUvs[1]=[]);for(var c=0;c<r.length;c+=3)t.vertices.push(new E().fromArray(r,c)),o!==void 0&&t.colors.push(new ye().fromArray(o,c));function u(g,y,b,_){var w=o===void 0?[]:[t.colors[g].clone(),t.colors[y].clone(),t.colors[b].clone()],L=a===void 0?[]:[new E().fromArray(a,g*3),new E().fromArray(a,y*3),new E().fromArray(a,b*3)],R=new Hi(g,y,b,L,w,_);t.faces.push(R),s!==void 0&&t.faceVertexUvs[0].push([new j().fromArray(s,g*2),new j().fromArray(s,y*2),new j().fromArray(s,b*2)]),l!==void 0&&t.faceVertexUvs[1].push([new j().fromArray(l,g*2),new j().fromArray(l,y*2),new j().fromArray(l,b*2)])}var h=e.groups;if(h.length>0)for(var c=0;c<h.length;c++)for(var d=h[c],f=d.start,p=d.count,v=f,m=f+p;v<m;v+=3)n!==void 0?u(n[v],n[v+1],n[v+2],d.materialIndex):u(v,v+1,v+2,d.materialIndex);else if(n!==void 0)for(var c=0;c<n.length;c+=3)u(n[c],n[c+1],n[c+2]);else for(var c=0;c<r.length/3;c+=3)u(c,c+1,c+2);return this.computeFaceNormals(),e.boundingBox!==null&&(this.boundingBox=e.boundingBox.clone()),e.boundingSphere!==null&&(this.boundingSphere=e.boundingSphere.clone()),this},center:function(){var e=new E;return function(){return this.computeBoundingBox(),this.boundingBox.getCenter(e).negate(),this.translate(e.x,e.y,e.z),this}}(),normalize:function(){this.computeBoundingSphere();var e=this.boundingSphere.center,t=this.boundingSphere.radius,n=t===0?1:1/t,i=new Me;return i.set(n,0,0,-n*e.x,0,n,0,-n*e.y,0,0,n,-n*e.z,0,0,0,1),this.applyMatrix(i),this},computeFaceNormals:function(){for(var e=new E,t=new E,n=0,i=this.faces.length;n<i;n++){var r=this.faces[n],a=this.vertices[r.a],o=this.vertices[r.b],s=this.vertices[r.c];e.subVectors(s,o),t.subVectors(a,o),e.cross(t),e.normalize(),r.normal.copy(e)}},computeVertexNormals:function(e){e===void 0&&(e=!0);var t,n,i,r,a,o;for(o=new Array(this.vertices.length),t=0,n=this.vertices.length;t<n;t++)o[t]=new E;if(e){var s,l,c,u=new E,h=new E;for(i=0,r=this.faces.length;i<r;i++)a=this.faces[i],s=this.vertices[a.a],l=this.vertices[a.b],c=this.vertices[a.c],u.subVectors(c,l),h.subVectors(s,l),u.cross(h),o[a.a].add(u),o[a.b].add(u),o[a.c].add(u)}else for(this.computeFaceNormals(),i=0,r=this.faces.length;i<r;i++)a=this.faces[i],o[a.a].add(a.normal),o[a.b].add(a.normal),o[a.c].add(a.normal);for(t=0,n=this.vertices.length;t<n;t++)o[t].normalize();for(i=0,r=this.faces.length;i<r;i++){a=this.faces[i];var d=a.vertexNormals;d.length===3?(d[0].copy(o[a.a]),d[1].copy(o[a.b]),d[2].copy(o[a.c])):(d[0]=o[a.a].clone(),d[1]=o[a.b].clone(),d[2]=o[a.c].clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeFlatVertexNormals:function(){var e,t,n;for(this.computeFaceNormals(),e=0,t=this.faces.length;e<t;e++){n=this.faces[e];var i=n.vertexNormals;i.length===3?(i[0].copy(n.normal),i[1].copy(n.normal),i[2].copy(n.normal)):(i[0]=n.normal.clone(),i[1]=n.normal.clone(),i[2]=n.normal.clone())}this.faces.length>0&&(this.normalsNeedUpdate=!0)},computeMorphNormals:function(){var e,t,n,i,r;for(n=0,i=this.faces.length;n<i;n++)for(r=this.faces[n],r.__originalFaceNormal?r.__originalFaceNormal.copy(r.normal):r.__originalFaceNormal=r.normal.clone(),r.__originalVertexNormals||(r.__originalVertexNormals=[]),e=0,t=r.vertexNormals.length;e<t;e++)r.__originalVertexNormals[e]?r.__originalVertexNormals[e].copy(r.vertexNormals[e]):r.__originalVertexNormals[e]=r.vertexNormals[e].clone();var a=new Te;for(a.faces=this.faces,e=0,t=this.morphTargets.length;e<t;e++){if(!this.morphNormals[e]){this.morphNormals[e]={},this.morphNormals[e].faceNormals=[],this.morphNormals[e].vertexNormals=[];var o=this.morphNormals[e].faceNormals,s=this.morphNormals[e].vertexNormals,c,u;for(n=0,i=this.faces.length;n<i;n++)c=new E,u={a:new E,b:new E,c:new E},o.push(c),s.push(u)}var l=this.morphNormals[e];a.vertices=this.morphTargets[e].vertices,a.computeFaceNormals(),a.computeVertexNormals();var c,u;for(n=0,i=this.faces.length;n<i;n++)r=this.faces[n],c=l.faceNormals[n],u=l.vertexNormals[n],c.copy(r.normal),u.a.copy(r.vertexNormals[0]),u.b.copy(r.vertexNormals[1]),u.c.copy(r.vertexNormals[2])}for(n=0,i=this.faces.length;n<i;n++)r=this.faces[n],r.normal=r.__originalFaceNormal,r.vertexNormals=r.__originalVertexNormals},computeBoundingBox:function(){this.boundingBox===null&&(this.boundingBox=new an),this.boundingBox.setFromPoints(this.vertices)},computeBoundingSphere:function(){this.boundingSphere===null&&(this.boundingSphere=new sn),this.boundingSphere.setFromPoints(this.vertices)},merge:function(e,t,n){if(!(e&&e.isGeometry)){console.error("THREE.Geometry.merge(): geometry not an instance of THREE.Geometry.",e);return}var i,r=this.vertices.length,a=this.vertices,o=e.vertices,s=this.faces,l=e.faces,c=this.colors,u=e.colors;n===void 0&&(n=0),t!==void 0&&(i=new xt().getNormalMatrix(t));for(var h=0,d=o.length;h<d;h++){var f=o[h],p=f.clone();t!==void 0&&p.applyMatrix4(t),a.push(p)}for(var h=0,d=u.length;h<d;h++)c.push(u[h].clone());for(h=0,d=l.length;h<d;h++){var v=l[h],m,g,y,b=v.vertexNormals,_=v.vertexColors;m=new Hi(v.a+r,v.b+r,v.c+r),m.normal.copy(v.normal),i!==void 0&&m.normal.applyMatrix3(i).normalize();for(var w=0,L=b.length;w<L;w++)g=b[w].clone(),i!==void 0&&g.applyMatrix3(i).normalize(),m.vertexNormals.push(g);m.color.copy(v.color);for(var w=0,L=_.length;w<L;w++)y=_[w],m.vertexColors.push(y.clone());m.materialIndex=v.materialIndex+n,s.push(m)}for(var h=0,d=e.faceVertexUvs.length;h<d;h++){var R=e.faceVertexUvs[h];this.faceVertexUvs[h]===void 0&&(this.faceVertexUvs[h]=[]);for(var w=0,L=R.length;w<L;w++){for(var k=R[w],O=[],z=0,C=k.length;z<C;z++)O.push(k[z].clone());this.faceVertexUvs[h].push(O)}}},mergeMesh:function(e){if(!(e&&e.isMesh)){console.error("THREE.Geometry.mergeMesh(): mesh not an instance of THREE.Mesh.",e);return}e.matrixAutoUpdate&&e.updateMatrix(),this.merge(e.geometry,e.matrix)},mergeVertices:function(){var e={},t=[],n=[],i,r,a=4,o=Math.pow(10,a),s,l,c,u,h,d;for(s=0,l=this.vertices.length;s<l;s++)i=this.vertices[s],r=Math.round(i.x*o)+"_"+Math.round(i.y*o)+"_"+Math.round(i.z*o),e[r]===void 0?(e[r]=s,t.push(this.vertices[s]),n[s]=t.length-1):n[s]=n[e[r]];var f=[];for(s=0,l=this.faces.length;s<l;s++){c=this.faces[s],c.a=n[c.a],c.b=n[c.b],c.c=n[c.c],u=[c.a,c.b,c.c];for(var p=0;p<3;p++)if(u[p]===u[(p+1)%3]){f.push(s);break}}for(s=f.length-1;s>=0;s--){var v=f[s];for(this.faces.splice(v,1),h=0,d=this.faceVertexUvs.length;h<d;h++)this.faceVertexUvs[h].splice(v,1)}var m=this.vertices.length-t.length;return this.vertices=t,m},setFromPoints:function(e){this.vertices=[];for(var t=0,n=e.length;t<n;t++){var i=e[t];this.vertices.push(new E(i.x,i.y,i.z||0))}return this},sortFacesByMaterialIndex:function(){for(var e=this.faces,t=e.length,n=0;n<t;n++)e[n]._id=n;function i(c,u){return c.materialIndex-u.materialIndex}e.sort(i);var r=this.faceVertexUvs[0],a=this.faceVertexUvs[1],o,s;r&&r.length===t&&(o=[]),a&&a.length===t&&(s=[]);for(var n=0;n<t;n++){var l=e[n]._id;o&&o.push(r[l]),s&&s.push(a[l])}o&&(this.faceVertexUvs[0]=o),s&&(this.faceVertexUvs[1]=s)},toJSON:function(){var e={metadata:{version:4.5,type:"Geometry",generator:"Geometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),this.parameters!==void 0){var t=this.parameters;for(var n in t)t[n]!==void 0&&(e[n]=t[n]);return e}for(var i=[],r=0;r<this.vertices.length;r++){var a=this.vertices[r];i.push(a.x,a.y,a.z)}for(var o=[],s=[],l={},c=[],u={},h=[],d={},r=0;r<this.faces.length;r++){var f=this.faces[r],p=!0,v=!1,m=this.faceVertexUvs[0][r]!==void 0,g=f.normal.length()>0,y=f.vertexNormals.length>0,b=f.color.r!==1||f.color.g!==1||f.color.b!==1,_=f.vertexColors.length>0,w=0;if(w=O(w,0,0),w=O(w,1,p),w=O(w,2,v),w=O(w,3,m),w=O(w,4,g),w=O(w,5,y),w=O(w,6,b),w=O(w,7,_),o.push(w),o.push(f.a,f.b,f.c),o.push(f.materialIndex),m){var L=this.faceVertexUvs[0][r];o.push(I(L[0]),I(L[1]),I(L[2]))}if(g&&o.push(z(f.normal)),y){var R=f.vertexNormals;o.push(z(R[0]),z(R[1]),z(R[2]))}if(b&&o.push(C(f.color)),_){var k=f.vertexColors;o.push(C(k[0]),C(k[1]),C(k[2]))}}function O(N,H,G){return G?N|1<<H:N&~(1<<H)}function z(N){var H=N.x.toString()+N.y.toString()+N.z.toString();return l[H]!==void 0||(l[H]=s.length/3,s.push(N.x,N.y,N.z)),l[H]}function C(N){var H=N.r.toString()+N.g.toString()+N.b.toString();return u[H]!==void 0||(u[H]=c.length,c.push(N.getHex())),u[H]}function I(N){var H=N.x.toString()+N.y.toString();return d[H]!==void 0||(d[H]=h.length/2,h.push(N.x,N.y)),d[H]}return e.data={},e.data.vertices=i,e.data.normals=s,c.length>0&&(e.data.colors=c),h.length>0&&(e.data.uvs=[h]),e.data.faces=o,e},clone:function(){return new Te().copy(this)},copy:function(e){var t,n,i,r,a,o;this.vertices=[],this.colors=[],this.faces=[],this.faceVertexUvs=[[]],this.morphTargets=[],this.morphNormals=[],this.skinWeights=[],this.skinIndices=[],this.lineDistances=[],this.boundingBox=null,this.boundingSphere=null,this.name=e.name;var s=e.vertices;for(t=0,n=s.length;t<n;t++)this.vertices.push(s[t].clone());var l=e.colors;for(t=0,n=l.length;t<n;t++)this.colors.push(l[t].clone());var c=e.faces;for(t=0,n=c.length;t<n;t++)this.faces.push(c[t].clone());for(t=0,n=e.faceVertexUvs.length;t<n;t++){var u=e.faceVertexUvs[t];for(this.faceVertexUvs[t]===void 0&&(this.faceVertexUvs[t]=[]),i=0,r=u.length;i<r;i++){var h=u[i],d=[];for(a=0,o=h.length;a<o;a++){var f=h[a];d.push(f.clone())}this.faceVertexUvs[t].push(d)}}var p=e.morphTargets;for(t=0,n=p.length;t<n;t++){var v={};if(v.name=p[t].name,p[t].vertices!==void 0)for(v.vertices=[],i=0,r=p[t].vertices.length;i<r;i++)v.vertices.push(p[t].vertices[i].clone());if(p[t].normals!==void 0)for(v.normals=[],i=0,r=p[t].normals.length;i<r;i++)v.normals.push(p[t].normals[i].clone());this.morphTargets.push(v)}var m=e.morphNormals;for(t=0,n=m.length;t<n;t++){var g={};if(m[t].vertexNormals!==void 0)for(g.vertexNormals=[],i=0,r=m[t].vertexNormals.length;i<r;i++){var y=m[t].vertexNormals[i],b={};b.a=y.a.clone(),b.b=y.b.clone(),b.c=y.c.clone(),g.vertexNormals.push(b)}if(m[t].faceNormals!==void 0)for(g.faceNormals=[],i=0,r=m[t].faceNormals.length;i<r;i++)g.faceNormals.push(m[t].faceNormals[i].clone());this.morphNormals.push(g)}var _=e.skinWeights;for(t=0,n=_.length;t<n;t++)this.skinWeights.push(_[t].clone());var w=e.skinIndices;for(t=0,n=w.length;t<n;t++)this.skinIndices.push(w[t].clone());var L=e.lineDistances;for(t=0,n=L.length;t<n;t++)this.lineDistances.push(L[t]);var R=e.boundingBox;R!==null&&(this.boundingBox=R.clone());var k=e.boundingSphere;return k!==null&&(this.boundingSphere=k.clone()),this.elementsNeedUpdate=e.elementsNeedUpdate,this.verticesNeedUpdate=e.verticesNeedUpdate,this.uvsNeedUpdate=e.uvsNeedUpdate,this.normalsNeedUpdate=e.normalsNeedUpdate,this.colorsNeedUpdate=e.colorsNeedUpdate,this.lineDistancesNeedUpdate=e.lineDistancesNeedUpdate,this.groupsNeedUpdate=e.groupsNeedUpdate,this},dispose:function(){this.dispatchEvent({type:"dispose"})}});function Ui(e,t,n,i,r,a){Te.call(this),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:a},this.fromBufferGeometry(new Wn(e,t,n,i,r,a)),this.mergeVertices()}Ui.prototype=Object.create(Te.prototype);Ui.prototype.constructor=Ui;function Wn(e,t,n,i,r,a){oe.call(this),this.type="BoxBufferGeometry",this.parameters={width:e,height:t,depth:n,widthSegments:i,heightSegments:r,depthSegments:a};var o=this;e=e||1,t=t||1,n=n||1,i=Math.floor(i)||1,r=Math.floor(r)||1,a=Math.floor(a)||1;var s=[],l=[],c=[],u=[],h=0,d=0;f("z","y","x",-1,-1,n,t,e,a,r,0),f("z","y","x",1,-1,n,t,-e,a,r,1),f("x","z","y",1,1,e,n,t,i,a,2),f("x","z","y",1,-1,e,n,-t,i,a,3),f("x","y","z",1,-1,e,t,n,i,r,4),f("x","y","z",-1,-1,e,t,-n,i,r,5),this.setIndex(s),this.addAttribute("position",new $(l,3)),this.addAttribute("normal",new $(c,3)),this.addAttribute("uv",new $(u,2));function f(p,v,m,g,y,b,_,w,L,R,k){var O=b/L,z=_/R,C=b/2,I=_/2,N=w/2,H=L+1,G=R+1,X=0,Z=0,V,Y,J=new E;for(Y=0;Y<G;Y++){var ie=Y*z-I;for(V=0;V<H;V++){var ce=V*O-C;J[p]=ce*g,J[v]=ie*y,J[m]=N,l.push(J.x,J.y,J.z),J[p]=0,J[v]=0,J[m]=w>0?1:-1,c.push(J.x,J.y,J.z),u.push(V/L),u.push(1-Y/R),X+=1}}for(Y=0;Y<R;Y++)for(V=0;V<L;V++){var Re=h+V+H*Y,F=h+V+H*(Y+1),ue=h+(V+1)+H*(Y+1),K=h+(V+1)+H*Y;s.push(Re,F,K),s.push(F,ue,K),Z+=6}o.addGroup(d,Z,k),d+=Z,h+=X}}Wn.prototype=Object.create(oe.prototype);Wn.prototype.constructor=Wn;function si(e){var t={};for(var n in e){t[n]={};for(var i in e[n]){var r=e[n][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture)?t[n][i]=r.clone():Array.isArray(r)?t[n][i]=r.slice():t[n][i]=r}}return t}function zt(e){for(var t={},n=0;n<e.length;n++){var i=si(e[n]);for(var r in i)t[r]=i[r]}return t}var Qf={clone:si,merge:zt},$f=`void main() {
	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,Kf=`void main() {
	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
}`;function Dt(e){Oe.call(this),this.type="ShaderMaterial",this.defines={},this.uniforms={},this.vertexShader=$f,this.fragmentShader=Kf,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,e!==void 0&&(e.attributes!==void 0&&console.error("THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead."),this.setValues(e))}Dt.prototype=Object.create(Oe.prototype);Dt.prototype.constructor=Dt;Dt.prototype.isShaderMaterial=!0;Dt.prototype.copy=function(e){return Oe.prototype.copy.call(this,e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=si(e.uniforms),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.lights=e.lights,this.clipping=e.clipping,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this.extensions=e.extensions,this};Dt.prototype.toJSON=function(e){var t=Oe.prototype.toJSON.call(this,e);t.uniforms={};for(var n in this.uniforms){var i=this.uniforms[n],r=i.value;r&&r.isTexture?t.uniforms[n]={type:"t",value:r.toJSON(e).uuid}:r&&r.isColor?t.uniforms[n]={type:"c",value:r.getHex()}:r&&r.isVector2?t.uniforms[n]={type:"v2",value:r.toArray()}:r&&r.isVector3?t.uniforms[n]={type:"v3",value:r.toArray()}:r&&r.isVector4?t.uniforms[n]={type:"v4",value:r.toArray()}:r&&r.isMatrix3?t.uniforms[n]={type:"m3",value:r.toArray()}:r&&r.isMatrix4?t.uniforms[n]={type:"m4",value:r.toArray()}:t.uniforms[n]={value:r}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;var a={};for(var o in this.extensions)this.extensions[o]===!0&&(a[o]=!0);return Object.keys(a).length>0&&(t.extensions=a),t};function En(){ae.call(this),this.type="Camera",this.matrixWorldInverse=new Me,this.projectionMatrix=new Me,this.projectionMatrixInverse=new Me}En.prototype=Object.assign(Object.create(ae.prototype),{constructor:En,isCamera:!0,copy:function(e,t){return ae.prototype.copy.call(this,e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this},getWorldDirection:function(e){e===void 0&&(console.warn("THREE.Camera: .getWorldDirection() target is now required"),e=new E),this.updateMatrixWorld(!0);var t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()},updateMatrixWorld:function(e){ae.prototype.updateMatrixWorld.call(this,e),this.matrixWorldInverse.getInverse(this.matrixWorld)},clone:function(){return new this.constructor().copy(this)}});function ct(e,t,n,i){En.call(this),this.type="PerspectiveCamera",this.fov=e!==void 0?e:50,this.zoom=1,this.near=n!==void 0?n:.1,this.far=i!==void 0?i:2e3,this.focus=10,this.aspect=t!==void 0?t:1,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}ct.prototype=Object.assign(Object.create(En.prototype),{constructor:ct,isPerspectiveCamera:!0,copy:function(e,t){return En.prototype.copy.call(this,e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this},setFocalLength:function(e){var t=.5*this.getFilmHeight()/e;this.fov=Pe.RAD2DEG*2*Math.atan(t),this.updateProjectionMatrix()},getFocalLength:function(){var e=Math.tan(Pe.DEG2RAD*.5*this.fov);return .5*this.getFilmHeight()/e},getEffectiveFOV:function(){return Pe.RAD2DEG*2*Math.atan(Math.tan(Pe.DEG2RAD*.5*this.fov)/this.zoom)},getFilmWidth:function(){return this.filmGauge*Math.min(this.aspect,1)},getFilmHeight:function(){return this.filmGauge/Math.max(this.aspect,1)},setViewOffset:function(e,t,n,i,r,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=this.near,t=e*Math.tan(Pe.DEG2RAD*.5*this.fov)/this.zoom,n=2*t,i=this.aspect*n,r=-.5*i,a=this.view;if(this.view!==null&&this.view.enabled){var o=a.fullWidth,s=a.fullHeight;r+=a.offsetX*i/o,t-=a.offsetY*n/s,i*=a.width/o,n*=a.height/s}var l=this.filmOffset;l!==0&&(r+=e*l/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+i,t,t-n,e,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=ae.prototype.toJSON.call(this,e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}});var Pi=90,Oi=1;function Gi(e,t,n,i){ae.call(this),this.type="CubeCamera";var r=new ct(Pi,Oi,e,t);r.up.set(0,-1,0),r.lookAt(new E(1,0,0)),this.add(r);var a=new ct(Pi,Oi,e,t);a.up.set(0,-1,0),a.lookAt(new E(-1,0,0)),this.add(a);var o=new ct(Pi,Oi,e,t);o.up.set(0,0,1),o.lookAt(new E(0,1,0)),this.add(o);var s=new ct(Pi,Oi,e,t);s.up.set(0,0,-1),s.lookAt(new E(0,-1,0)),this.add(s);var l=new ct(Pi,Oi,e,t);l.up.set(0,-1,0),l.lookAt(new E(0,0,1)),this.add(l);var c=new ct(Pi,Oi,e,t);c.up.set(0,-1,0),c.lookAt(new E(0,0,-1)),this.add(c),i=i||{format:Gn,magFilter:Lt,minFilter:Lt},this.renderTarget=new jn(n,n,i),this.renderTarget.texture.name="CubeCamera",this.update=function(u,h){this.parent===null&&this.updateMatrixWorld();var d=u.getRenderTarget(),f=this.renderTarget,p=f.texture.generateMipmaps;f.texture.generateMipmaps=!1,u.setRenderTarget(f,0),u.render(h,r),u.setRenderTarget(f,1),u.render(h,a),u.setRenderTarget(f,2),u.render(h,o),u.setRenderTarget(f,3),u.render(h,s),u.setRenderTarget(f,4),u.render(h,l),f.texture.generateMipmaps=p,u.setRenderTarget(f,5),u.render(h,c),u.setRenderTarget(d)},this.clear=function(u,h,d,f){for(var p=u.getRenderTarget(),v=this.renderTarget,m=0;m<6;m++)u.setRenderTarget(v,m),u.clear(h,d,f);u.setRenderTarget(p)}}Gi.prototype=Object.create(ae.prototype);Gi.prototype.constructor=Gi;function jn(e,t,n){wn.call(this,e,t,n)}jn.prototype=Object.create(wn.prototype);jn.prototype.constructor=jn;jn.prototype.isWebGLRenderTargetCube=!0;jn.prototype.fromEquirectangularTexture=function(e,t){this.texture.type=t.type,this.texture.format=t.format,this.texture.encoding=t.encoding;var n=new Br,i={uniforms:{tEquirect:{value:null}},vertexShader:["varying vec3 vWorldDirection;","vec3 transformDirection( in vec3 dir, in mat4 matrix ) {","	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );","}","void main() {","	vWorldDirection = transformDirection( position, modelMatrix );","	#include <begin_vertex>","	#include <project_vertex>","}"].join(`
`),fragmentShader:["uniform sampler2D tEquirect;","varying vec3 vWorldDirection;","#define RECIPROCAL_PI 0.31830988618","#define RECIPROCAL_PI2 0.15915494","void main() {","	vec3 direction = normalize( vWorldDirection );","	vec2 sampleUV;","	sampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;","	sampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;","	gl_FragColor = texture2D( tEquirect, sampleUV );","}"].join(`
`)},r=new Dt({type:"CubemapFromEquirect",uniforms:si(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:vt,blending:ei});r.uniforms.tEquirect.value=t;var a=new _t(new Wn(5,5,5),r);n.add(a);var o=new Gi(1,10,1);return o.renderTarget=this,o.renderTarget.texture.name="CubeCameraTexture",o.update(e,n),a.geometry.dispose(),a.material.dispose(),this};function li(e,t,n,i,r,a,o,s,l,c,u,h){tt.call(this,null,a,o,s,l,c,i,r,u,h),this.image={data:e,width:t,height:n},this.magFilter=l!==void 0?l:Et,this.minFilter=c!==void 0?c:Et,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}li.prototype=Object.create(tt.prototype);li.prototype.constructor=li;li.prototype.isDataTexture=!0;function bn(e,t){this.normal=e!==void 0?e:new E(1,0,0),this.constant=t!==void 0?t:0}Object.assign(bn.prototype,{isPlane:!0,set:function(e,t){return this.normal.copy(e),this.constant=t,this},setComponents:function(e,t,n,i){return this.normal.set(e,t,n),this.constant=i,this},setFromNormalAndCoplanarPoint:function(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this},setFromCoplanarPoints:function(){var e=new E,t=new E;return function(i,r,a){var o=e.subVectors(a,r).cross(t.subVectors(i,r)).normalize();return this.setFromNormalAndCoplanarPoint(o,i),this}}(),clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.normal.copy(e.normal),this.constant=e.constant,this},normalize:function(){var e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this},negate:function(){return this.constant*=-1,this.normal.negate(),this},distanceToPoint:function(e){return this.normal.dot(e)+this.constant},distanceToSphere:function(e){return this.distanceToPoint(e.center)-e.radius},projectPoint:function(e,t){return t===void 0&&(console.warn("THREE.Plane: .projectPoint() target is now required"),t=new E),t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)},intersectLine:function(){var e=new E;return function(n,i){i===void 0&&(console.warn("THREE.Plane: .intersectLine() target is now required"),i=new E);var r=n.delta(e),a=this.normal.dot(r);if(a===0)return this.distanceToPoint(n.start)===0?i.copy(n.start):void 0;var o=-(n.start.dot(this.normal)+this.constant)/a;if(!(o<0||o>1))return i.copy(r).multiplyScalar(o).add(n.start)}}(),intersectsLine:function(e){var t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0},intersectsBox:function(e){return e.intersectsPlane(this)},intersectsSphere:function(e){return e.intersectsPlane(this)},coplanarPoint:function(e){return e===void 0&&(console.warn("THREE.Plane: .coplanarPoint() target is now required"),e=new E),e.copy(this.normal).multiplyScalar(-this.constant)},applyMatrix4:function(){var e=new E,t=new xt;return function(i,r){var a=r||t.getNormalMatrix(i),o=this.coplanarPoint(e).applyMatrix4(i),s=this.normal.applyMatrix3(a).normalize();return this.constant=-o.dot(s),this}}(),translate:function(e){return this.constant-=e.dot(this.normal),this},equals:function(e){return e.normal.equals(this.normal)&&e.constant===this.constant}});function Uo(e,t,n,i,r,a){this.planes=[e!==void 0?e:new bn,t!==void 0?t:new bn,n!==void 0?n:new bn,i!==void 0?i:new bn,r!==void 0?r:new bn,a!==void 0?a:new bn]}Object.assign(Uo.prototype,{set:function(e,t,n,i,r,a){var o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(i),o[4].copy(r),o[5].copy(a),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){for(var t=this.planes,n=0;n<6;n++)t[n].copy(e.planes[n]);return this},setFromMatrix:function(e){var t=this.planes,n=e.elements,i=n[0],r=n[1],a=n[2],o=n[3],s=n[4],l=n[5],c=n[6],u=n[7],h=n[8],d=n[9],f=n[10],p=n[11],v=n[12],m=n[13],g=n[14],y=n[15];return t[0].setComponents(o-i,u-s,p-h,y-v).normalize(),t[1].setComponents(o+i,u+s,p+h,y+v).normalize(),t[2].setComponents(o+r,u+l,p+d,y+m).normalize(),t[3].setComponents(o-r,u-l,p-d,y-m).normalize(),t[4].setComponents(o-a,u-c,p-f,y-g).normalize(),t[5].setComponents(o+a,u+c,p+f,y+g).normalize(),this},intersectsObject:function(){var e=new sn;return function(n){var i=n.geometry;return i.boundingSphere===null&&i.computeBoundingSphere(),e.copy(i.boundingSphere).applyMatrix4(n.matrixWorld),this.intersectsSphere(e)}}(),intersectsSprite:function(){var e=new sn;return function(n){return e.center.set(0,0,0),e.radius=.7071067811865476,e.applyMatrix4(n.matrixWorld),this.intersectsSphere(e)}}(),intersectsSphere:function(e){for(var t=this.planes,n=e.center,i=-e.radius,r=0;r<6;r++){var a=t[r].distanceToPoint(n);if(a<i)return!1}return!0},intersectsBox:function(){var e=new E;return function(n){for(var i=this.planes,r=0;r<6;r++){var a=i[r];if(e.x=a.normal.x>0?n.max.x:n.min.x,e.y=a.normal.y>0?n.max.y:n.min.y,e.z=a.normal.z>0?n.max.z:n.min.z,a.distanceToPoint(e)<0)return!1}return!0}}(),containsPoint:function(e){for(var t=this.planes,n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}});var ep=`#ifdef USE_ALPHAMAP
	diffuseColor.a *= texture2D( alphaMap, vUv ).g;
#endif`,tp=`#ifdef USE_ALPHAMAP
	uniform sampler2D alphaMap;
#endif`,np=`#ifdef ALPHATEST
	if ( diffuseColor.a < ALPHATEST ) discard;
#endif`,ip=`#ifdef USE_AOMAP
	float ambientOcclusion = ( texture2D( aoMap, vUv2 ).r - 1.0 ) * aoMapIntensity + 1.0;
	reflectedLight.indirectDiffuse *= ambientOcclusion;
	#if defined( USE_ENVMAP ) && defined( PHYSICAL )
		float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.specularRoughness );
	#endif
#endif`,rp=`#ifdef USE_AOMAP
	uniform sampler2D aoMap;
	uniform float aoMapIntensity;
#endif`,ap="vec3 transformed = vec3( position );",op=`vec3 objectNormal = vec3( normal );
#ifdef USE_TANGENT
	vec3 objectTangent = vec3( tangent.xyz );
#endif`,sp=`vec2 integrateSpecularBRDF( const in float dotNV, const in float roughness ) {
	const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
	const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
	vec4 r = roughness * c0 + c1;
	float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
	return vec2( -1.04, 1.04 ) * a004 + r.zw;
}
float punctualLightIntensityToIrradianceFactor( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
#if defined ( PHYSICALLY_CORRECT_LIGHTS )
	float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
	if( cutoffDistance > 0.0 ) {
		distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
	}
	return distanceFalloff;
#else
	if( cutoffDistance > 0.0 && decayExponent > 0.0 ) {
		return pow( saturate( -lightDistance / cutoffDistance + 1.0 ), decayExponent );
	}
	return 1.0;
#endif
}
vec3 BRDF_Diffuse_Lambert( const in vec3 diffuseColor ) {
	return RECIPROCAL_PI * diffuseColor;
}
vec3 F_Schlick( const in vec3 specularColor, const in float dotLH ) {
	float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );
	return ( 1.0 - specularColor ) * fresnel + specularColor;
}
vec3 F_Schlick_RoughnessDependent( const in vec3 F0, const in float dotNV, const in float roughness ) {
	float fresnel = exp2( ( -5.55473 * dotNV - 6.98316 ) * dotNV );
	vec3 Fr = max( vec3( 1.0 - roughness ), F0 ) - F0;
	return Fr * fresnel + F0;
}
float G_GGX_Smith( const in float alpha, const in float dotNL, const in float dotNV ) {
	float a2 = pow2( alpha );
	float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
	float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
	return 1.0 / ( gl * gv );
}
float G_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
	float a2 = pow2( alpha );
	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
	return 0.5 / max( gv + gl, EPSILON );
}
float D_GGX( const in float alpha, const in float dotNH ) {
	float a2 = pow2( alpha );
	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
	return RECIPROCAL_PI * a2 / pow2( denom );
}
vec3 BRDF_Specular_GGX( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {
	float alpha = pow2( roughness );
	vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );
	float dotNL = saturate( dot( geometry.normal, incidentLight.direction ) );
	float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
	float dotNH = saturate( dot( geometry.normal, halfDir ) );
	float dotLH = saturate( dot( incidentLight.direction, halfDir ) );
	vec3 F = F_Schlick( specularColor, dotLH );
	float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );
	float D = D_GGX( alpha, dotNH );
	return F * ( G * D );
}
vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
	const float LUT_SIZE  = 64.0;
	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
	const float LUT_BIAS  = 0.5 / LUT_SIZE;
	float dotNV = saturate( dot( N, V ) );
	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
	uv = uv * LUT_SCALE + LUT_BIAS;
	return uv;
}
float LTC_ClippedSphereFormFactor( const in vec3 f ) {
	float l = length( f );
	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
}
vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
	float x = dot( v1, v2 );
	float y = abs( x );
	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
	float b = 3.4175940 + ( 4.1616724 + y ) * y;
	float v = a / b;
	float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
	return cross( v1, v2 ) * theta_sintheta;
}
vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
	vec3 lightNormal = cross( v1, v2 );
	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
	vec3 T1, T2;
	T1 = normalize( V - N * dot( V, N ) );
	T2 = - cross( N, T1 );
	mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
	vec3 coords[ 4 ];
	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
	coords[ 0 ] = normalize( coords[ 0 ] );
	coords[ 1 ] = normalize( coords[ 1 ] );
	coords[ 2 ] = normalize( coords[ 2 ] );
	coords[ 3 ] = normalize( coords[ 3 ] );
	vec3 vectorFormFactor = vec3( 0.0 );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
	return vec3( result );
}
vec3 BRDF_Specular_GGX_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness ) {
	float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
	vec2 brdf = integrateSpecularBRDF( dotNV, roughness );
	return specularColor * brdf.x + brdf.y;
}
void BRDF_Specular_Multiscattering_Environment( const in GeometricContext geometry, const in vec3 specularColor, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
	float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
	vec3 F = F_Schlick_RoughnessDependent( specularColor, dotNV, roughness );
	vec2 brdf = integrateSpecularBRDF( dotNV, roughness );
	vec3 FssEss = F * brdf.x + brdf.y;
	float Ess = brdf.x + brdf.y;
	float Ems = 1.0 - Ess;
	vec3 Favg = specularColor + ( 1.0 - specularColor ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
	singleScatter += FssEss;
	multiScatter += Fms * Ems;
}
float G_BlinnPhong_Implicit( ) {
	return 0.25;
}
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
}
vec3 BRDF_Specular_BlinnPhong( const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float shininess ) {
	vec3 halfDir = normalize( incidentLight.direction + geometry.viewDir );
	float dotNH = saturate( dot( geometry.normal, halfDir ) );
	float dotLH = saturate( dot( incidentLight.direction, halfDir ) );
	vec3 F = F_Schlick( specularColor, dotLH );
	float G = G_BlinnPhong_Implicit( );
	float D = D_BlinnPhong( shininess, dotNH );
	return F * ( G * D );
}
float GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {
	return ( 2.0 / pow2( ggxRoughness + 0.0001 ) - 2.0 );
}
float BlinnExponentToGGXRoughness( const in float blinnExponent ) {
	return sqrt( 2.0 / ( blinnExponent + 2.0 ) );
}`,lp=`#ifdef USE_BUMPMAP
	uniform sampler2D bumpMap;
	uniform float bumpScale;
	vec2 dHdxy_fwd() {
		vec2 dSTdx = dFdx( vUv );
		vec2 dSTdy = dFdy( vUv );
		float Hll = bumpScale * texture2D( bumpMap, vUv ).x;
		float dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;
		float dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;
		return vec2( dBx, dBy );
	}
	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy ) {
		vec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );
		vec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );
		vec3 vN = surf_norm;
		vec3 R1 = cross( vSigmaY, vN );
		vec3 R2 = cross( vN, vSigmaX );
		float fDet = dot( vSigmaX, R1 );
		fDet *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );
		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
		return normalize( abs( fDet ) * surf_norm - vGrad );
	}
#endif`,cp=`#if NUM_CLIPPING_PLANES > 0
	vec4 plane;
	#pragma unroll_loop
	for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
		plane = clippingPlanes[ i ];
		if ( dot( vViewPosition, plane.xyz ) > plane.w ) discard;
	}
	#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
		bool clipped = true;
		#pragma unroll_loop
		for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
			plane = clippingPlanes[ i ];
			clipped = ( dot( vViewPosition, plane.xyz ) > plane.w ) && clipped;
		}
		if ( clipped ) discard;
	#endif
#endif`,up=`#if NUM_CLIPPING_PLANES > 0
	#if ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )
		varying vec3 vViewPosition;
	#endif
	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
#endif`,hp=`#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )
	varying vec3 vViewPosition;
#endif`,dp=`#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )
	vViewPosition = - mvPosition.xyz;
#endif`,fp=`#ifdef USE_COLOR
	diffuseColor.rgb *= vColor;
#endif`,pp=`#ifdef USE_COLOR
	varying vec3 vColor;
#endif`,mp=`#ifdef USE_COLOR
	varying vec3 vColor;
#endif`,vp=`#ifdef USE_COLOR
	vColor.xyz = color.xyz;
#endif`,gp=`#define PI 3.14159265359
#define PI2 6.28318530718
#define PI_HALF 1.5707963267949
#define RECIPROCAL_PI 0.31830988618
#define RECIPROCAL_PI2 0.15915494
#define LOG2 1.442695
#define EPSILON 1e-6
#define saturate(a) clamp( a, 0.0, 1.0 )
#define whiteCompliment(a) ( 1.0 - saturate( a ) )
float pow2( const in float x ) { return x*x; }
float pow3( const in float x ) { return x*x*x; }
float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
float average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }
highp float rand( const in vec2 uv ) {
	const highp float a = 12.9898, b = 78.233, c = 43758.5453;
	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
	return fract(sin(sn) * c);
}
struct IncidentLight {
	vec3 color;
	vec3 direction;
	bool visible;
};
struct ReflectedLight {
	vec3 directDiffuse;
	vec3 directSpecular;
	vec3 indirectDiffuse;
	vec3 indirectSpecular;
};
struct GeometricContext {
	vec3 position;
	vec3 normal;
	vec3 viewDir;
};
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
}
vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
	return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
}
vec3 projectOnPlane(in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {
	float distance = dot( planeNormal, point - pointOnPlane );
	return - distance * planeNormal + point;
}
float sideOfPlane( in vec3 point, in vec3 pointOnPlane, in vec3 planeNormal ) {
	return sign( dot( point - pointOnPlane, planeNormal ) );
}
vec3 linePlaneIntersect( in vec3 pointOnLine, in vec3 lineDirection, in vec3 pointOnPlane, in vec3 planeNormal ) {
	return lineDirection * ( dot( planeNormal, pointOnPlane - pointOnLine ) / dot( planeNormal, lineDirection ) ) + pointOnLine;
}
mat3 transposeMat3( const in mat3 m ) {
	mat3 tmp;
	tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
	tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
	tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
	return tmp;
}
float linearToRelativeLuminance( const in vec3 color ) {
	vec3 weights = vec3( 0.2126, 0.7152, 0.0722 );
	return dot( weights, color.rgb );
}`,yp=`#ifdef ENVMAP_TYPE_CUBE_UV
#define cubeUV_textureSize (1024.0)
int getFaceFromDirection(vec3 direction) {
	vec3 absDirection = abs(direction);
	int face = -1;
	if( absDirection.x > absDirection.z ) {
		if(absDirection.x > absDirection.y )
			face = direction.x > 0.0 ? 0 : 3;
		else
			face = direction.y > 0.0 ? 1 : 4;
	}
	else {
		if(absDirection.z > absDirection.y )
			face = direction.z > 0.0 ? 2 : 5;
		else
			face = direction.y > 0.0 ? 1 : 4;
	}
	return face;
}
#define cubeUV_maxLods1  (log2(cubeUV_textureSize*0.25) - 1.0)
#define cubeUV_rangeClamp (exp2((6.0 - 1.0) * 2.0))
vec2 MipLevelInfo( vec3 vec, float roughnessLevel, float roughness ) {
	float scale = exp2(cubeUV_maxLods1 - roughnessLevel);
	float dxRoughness = dFdx(roughness);
	float dyRoughness = dFdy(roughness);
	vec3 dx = dFdx( vec * scale * dxRoughness );
	vec3 dy = dFdy( vec * scale * dyRoughness );
	float d = max( dot( dx, dx ), dot( dy, dy ) );
	d = clamp(d, 1.0, cubeUV_rangeClamp);
	float mipLevel = 0.5 * log2(d);
	return vec2(floor(mipLevel), fract(mipLevel));
}
#define cubeUV_maxLods2 (log2(cubeUV_textureSize*0.25) - 2.0)
#define cubeUV_rcpTextureSize (1.0 / cubeUV_textureSize)
vec2 getCubeUV(vec3 direction, float roughnessLevel, float mipLevel) {
	mipLevel = roughnessLevel > cubeUV_maxLods2 - 3.0 ? 0.0 : mipLevel;
	float a = 16.0 * cubeUV_rcpTextureSize;
	vec2 exp2_packed = exp2( vec2( roughnessLevel, mipLevel ) );
	vec2 rcp_exp2_packed = vec2( 1.0 ) / exp2_packed;
	float powScale = exp2_packed.x * exp2_packed.y;
	float scale = rcp_exp2_packed.x * rcp_exp2_packed.y * 0.25;
	float mipOffset = 0.75*(1.0 - rcp_exp2_packed.y) * rcp_exp2_packed.x;
	bool bRes = mipLevel == 0.0;
	scale =  bRes && (scale < a) ? a : scale;
	vec3 r;
	vec2 offset;
	int face = getFaceFromDirection(direction);
	float rcpPowScale = 1.0 / powScale;
	if( face == 0) {
		r = vec3(direction.x, -direction.z, direction.y);
		offset = vec2(0.0+mipOffset,0.75 * rcpPowScale);
		offset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;
	}
	else if( face == 1) {
		r = vec3(direction.y, direction.x, direction.z);
		offset = vec2(scale+mipOffset, 0.75 * rcpPowScale);
		offset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;
	}
	else if( face == 2) {
		r = vec3(direction.z, direction.x, direction.y);
		offset = vec2(2.0*scale+mipOffset, 0.75 * rcpPowScale);
		offset.y = bRes && (offset.y < 2.0*a) ? a : offset.y;
	}
	else if( face == 3) {
		r = vec3(direction.x, direction.z, direction.y);
		offset = vec2(0.0+mipOffset,0.5 * rcpPowScale);
		offset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;
	}
	else if( face == 4) {
		r = vec3(direction.y, direction.x, -direction.z);
		offset = vec2(scale+mipOffset, 0.5 * rcpPowScale);
		offset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;
	}
	else {
		r = vec3(direction.z, -direction.x, direction.y);
		offset = vec2(2.0*scale+mipOffset, 0.5 * rcpPowScale);
		offset.y = bRes && (offset.y < 2.0*a) ? 0.0 : offset.y;
	}
	r = normalize(r);
	float texelOffset = 0.5 * cubeUV_rcpTextureSize;
	vec2 s = ( r.yz / abs( r.x ) + vec2( 1.0 ) ) * 0.5;
	vec2 base = offset + vec2( texelOffset );
	return base + s * ( scale - 2.0 * texelOffset );
}
#define cubeUV_maxLods3 (log2(cubeUV_textureSize*0.25) - 3.0)
vec4 textureCubeUV( sampler2D envMap, vec3 reflectedDirection, float roughness ) {
	float roughnessVal = roughness* cubeUV_maxLods3;
	float r1 = floor(roughnessVal);
	float r2 = r1 + 1.0;
	float t = fract(roughnessVal);
	vec2 mipInfo = MipLevelInfo(reflectedDirection, r1, roughness);
	float s = mipInfo.y;
	float level0 = mipInfo.x;
	float level1 = level0 + 1.0;
	level1 = level1 > 5.0 ? 5.0 : level1;
	level0 += min( floor( s + 0.5 ), 5.0 );
	vec2 uv_10 = getCubeUV(reflectedDirection, r1, level0);
	vec4 color10 = envMapTexelToLinear(texture2D(envMap, uv_10));
	vec2 uv_20 = getCubeUV(reflectedDirection, r2, level0);
	vec4 color20 = envMapTexelToLinear(texture2D(envMap, uv_20));
	vec4 result = mix(color10, color20, t);
	return vec4(result.rgb, 1.0);
}
#endif`,bp=`vec3 transformedNormal = normalMatrix * objectNormal;
#ifdef FLIP_SIDED
	transformedNormal = - transformedNormal;
#endif
#ifdef USE_TANGENT
	vec3 transformedTangent = normalMatrix * objectTangent;
	#ifdef FLIP_SIDED
		transformedTangent = - transformedTangent;
	#endif
#endif`,xp=`#ifdef USE_DISPLACEMENTMAP
	uniform sampler2D displacementMap;
	uniform float displacementScale;
	uniform float displacementBias;
#endif`,_p=`#ifdef USE_DISPLACEMENTMAP
	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, uv ).x * displacementScale + displacementBias );
#endif`,wp=`#ifdef USE_EMISSIVEMAP
	vec4 emissiveColor = texture2D( emissiveMap, vUv );
	emissiveColor.rgb = emissiveMapTexelToLinear( emissiveColor ).rgb;
	totalEmissiveRadiance *= emissiveColor.rgb;
#endif`,Ep=`#ifdef USE_EMISSIVEMAP
	uniform sampler2D emissiveMap;
#endif`,Mp="gl_FragColor = linearToOutputTexel( gl_FragColor );",Sp=`
vec4 LinearToLinear( in vec4 value ) {
	return value;
}
vec4 GammaToLinear( in vec4 value, in float gammaFactor ) {
	return vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );
}
vec4 LinearToGamma( in vec4 value, in float gammaFactor ) {
	return vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );
}
vec4 sRGBToLinear( in vec4 value ) {
	return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );
}
vec4 LinearTosRGB( in vec4 value ) {
	return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
}
vec4 RGBEToLinear( in vec4 value ) {
	return vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );
}
vec4 LinearToRGBE( in vec4 value ) {
	float maxComponent = max( max( value.r, value.g ), value.b );
	float fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );
	return vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );
}
vec4 RGBMToLinear( in vec4 value, in float maxRange ) {
	return vec4( value.rgb * value.a * maxRange, 1.0 );
}
vec4 LinearToRGBM( in vec4 value, in float maxRange ) {
	float maxRGB = max( value.r, max( value.g, value.b ) );
	float M = clamp( maxRGB / maxRange, 0.0, 1.0 );
	M = ceil( M * 255.0 ) / 255.0;
	return vec4( value.rgb / ( M * maxRange ), M );
}
vec4 RGBDToLinear( in vec4 value, in float maxRange ) {
	return vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );
}
vec4 LinearToRGBD( in vec4 value, in float maxRange ) {
	float maxRGB = max( value.r, max( value.g, value.b ) );
	float D = max( maxRange / maxRGB, 1.0 );
	D = min( floor( D ) / 255.0, 1.0 );
	return vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );
}
const mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );
vec4 LinearToLogLuv( in vec4 value )  {
	vec3 Xp_Y_XYZp = cLogLuvM * value.rgb;
	Xp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );
	vec4 vResult;
	vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;
	float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;
	vResult.w = fract( Le );
	vResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;
	return vResult;
}
const mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );
vec4 LogLuvToLinear( in vec4 value ) {
	float Le = value.z * 255.0 + value.w;
	vec3 Xp_Y_XYZp;
	Xp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );
	Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;
	Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;
	vec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;
	return vec4( max( vRGB, 0.0 ), 1.0 );
}`,Tp=`#ifdef USE_ENVMAP
	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )
		vec3 cameraToVertex = normalize( vWorldPosition - cameraPosition );
		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
		#ifdef ENVMAP_MODE_REFLECTION
			vec3 reflectVec = reflect( cameraToVertex, worldNormal );
		#else
			vec3 reflectVec = refract( cameraToVertex, worldNormal, refractionRatio );
		#endif
	#else
		vec3 reflectVec = vReflect;
	#endif
	#ifdef ENVMAP_TYPE_CUBE
		vec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
	#elif defined( ENVMAP_TYPE_EQUIREC )
		vec2 sampleUV;
		reflectVec = normalize( reflectVec );
		sampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
		sampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;
		vec4 envColor = texture2D( envMap, sampleUV );
	#elif defined( ENVMAP_TYPE_SPHERE )
		reflectVec = normalize( reflectVec );
		vec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) );
		vec4 envColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5 );
	#else
		vec4 envColor = vec4( 0.0 );
	#endif
	envColor = envMapTexelToLinear( envColor );
	#ifdef ENVMAP_BLENDING_MULTIPLY
		outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
	#elif defined( ENVMAP_BLENDING_MIX )
		outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
	#elif defined( ENVMAP_BLENDING_ADD )
		outgoingLight += envColor.xyz * specularStrength * reflectivity;
	#endif
#endif`,Ap=`#if defined( USE_ENVMAP ) || defined( PHYSICAL )
	uniform float reflectivity;
	uniform float envMapIntensity;
#endif
#ifdef USE_ENVMAP
	#if ! defined( PHYSICAL ) && ( defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) )
		varying vec3 vWorldPosition;
	#endif
	#ifdef ENVMAP_TYPE_CUBE
		uniform samplerCube envMap;
	#else
		uniform sampler2D envMap;
	#endif
	uniform float flipEnvMap;
	uniform int maxMipLevel;
	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( PHYSICAL )
		uniform float refractionRatio;
	#else
		varying vec3 vReflect;
	#endif
#endif`,Lp=`#ifdef USE_ENVMAP
	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )
		varying vec3 vWorldPosition;
	#else
		varying vec3 vReflect;
		uniform float refractionRatio;
	#endif
#endif`,Cp=`#ifdef USE_ENVMAP
	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )
		vWorldPosition = worldPosition.xyz;
	#else
		vec3 cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
		vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
		#ifdef ENVMAP_MODE_REFLECTION
			vReflect = reflect( cameraToVertex, worldNormal );
		#else
			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
		#endif
	#endif
#endif`,Rp=`#ifdef USE_FOG
	fogDepth = -mvPosition.z;
#endif`,Ip=`#ifdef USE_FOG
	varying float fogDepth;
#endif`,Pp=`#ifdef USE_FOG
	#ifdef FOG_EXP2
		float fogFactor = whiteCompliment( exp2( - fogDensity * fogDensity * fogDepth * fogDepth * LOG2 ) );
	#else
		float fogFactor = smoothstep( fogNear, fogFar, fogDepth );
	#endif
	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
#endif`,Op=`#ifdef USE_FOG
	uniform vec3 fogColor;
	varying float fogDepth;
	#ifdef FOG_EXP2
		uniform float fogDensity;
	#else
		uniform float fogNear;
		uniform float fogFar;
	#endif
#endif`,Dp=`#ifdef TOON
	uniform sampler2D gradientMap;
	vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
		float dotNL = dot( normal, lightDirection );
		vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
		#ifdef USE_GRADIENTMAP
			return texture2D( gradientMap, coord ).rgb;
		#else
			return ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );
		#endif
	}
#endif`,kp=`#ifdef USE_LIGHTMAP
	reflectedLight.indirectDiffuse += PI * texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;
#endif`,Np=`#ifdef USE_LIGHTMAP
	uniform sampler2D lightMap;
	uniform float lightMapIntensity;
#endif`,Bp=`vec3 diffuse = vec3( 1.0 );
GeometricContext geometry;
geometry.position = mvPosition.xyz;
geometry.normal = normalize( transformedNormal );
geometry.viewDir = normalize( -mvPosition.xyz );
GeometricContext backGeometry;
backGeometry.position = geometry.position;
backGeometry.normal = -geometry.normal;
backGeometry.viewDir = geometry.viewDir;
vLightFront = vec3( 0.0 );
vIndirectFront = vec3( 0.0 );
#ifdef DOUBLE_SIDED
	vLightBack = vec3( 0.0 );
	vIndirectBack = vec3( 0.0 );
#endif
IncidentLight directLight;
float dotNL;
vec3 directLightColor_Diffuse;
#if NUM_POINT_LIGHTS > 0
	#pragma unroll_loop
	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
		getPointDirectLightIrradiance( pointLights[ i ], geometry, directLight );
		dotNL = dot( geometry.normal, directLight.direction );
		directLightColor_Diffuse = PI * directLight.color;
		vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
		#ifdef DOUBLE_SIDED
			vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
		#endif
	}
#endif
#if NUM_SPOT_LIGHTS > 0
	#pragma unroll_loop
	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
		getSpotDirectLightIrradiance( spotLights[ i ], geometry, directLight );
		dotNL = dot( geometry.normal, directLight.direction );
		directLightColor_Diffuse = PI * directLight.color;
		vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
		#ifdef DOUBLE_SIDED
			vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
		#endif
	}
#endif
#if NUM_DIR_LIGHTS > 0
	#pragma unroll_loop
	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
		getDirectionalDirectLightIrradiance( directionalLights[ i ], geometry, directLight );
		dotNL = dot( geometry.normal, directLight.direction );
		directLightColor_Diffuse = PI * directLight.color;
		vLightFront += saturate( dotNL ) * directLightColor_Diffuse;
		#ifdef DOUBLE_SIDED
			vLightBack += saturate( -dotNL ) * directLightColor_Diffuse;
		#endif
	}
#endif
#if NUM_HEMI_LIGHTS > 0
	#pragma unroll_loop
	for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
		vIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );
		#ifdef DOUBLE_SIDED
			vIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry );
		#endif
	}
#endif`,zp=`uniform vec3 ambientLightColor;
uniform vec3 lightProbe[ 9 ];
vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
	float x = normal.x, y = normal.y, z = normal.z;
	vec3 result = shCoefficients[ 0 ] * 0.886227;
	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
	return result;
}
vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in GeometricContext geometry ) {
	vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );
	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
	return irradiance;
}
vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
	vec3 irradiance = ambientLightColor;
	#ifndef PHYSICALLY_CORRECT_LIGHTS
		irradiance *= PI;
	#endif
	return irradiance;
}
#if NUM_DIR_LIGHTS > 0
	struct DirectionalLight {
		vec3 direction;
		vec3 color;
		int shadow;
		float shadowBias;
		float shadowRadius;
		vec2 shadowMapSize;
	};
	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
	void getDirectionalDirectLightIrradiance( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight directLight ) {
		directLight.color = directionalLight.color;
		directLight.direction = directionalLight.direction;
		directLight.visible = true;
	}
#endif
#if NUM_POINT_LIGHTS > 0
	struct PointLight {
		vec3 position;
		vec3 color;
		float distance;
		float decay;
		int shadow;
		float shadowBias;
		float shadowRadius;
		vec2 shadowMapSize;
		float shadowCameraNear;
		float shadowCameraFar;
	};
	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
	void getPointDirectLightIrradiance( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight directLight ) {
		vec3 lVector = pointLight.position - geometry.position;
		directLight.direction = normalize( lVector );
		float lightDistance = length( lVector );
		directLight.color = pointLight.color;
		directLight.color *= punctualLightIntensityToIrradianceFactor( lightDistance, pointLight.distance, pointLight.decay );
		directLight.visible = ( directLight.color != vec3( 0.0 ) );
	}
#endif
#if NUM_SPOT_LIGHTS > 0
	struct SpotLight {
		vec3 position;
		vec3 direction;
		vec3 color;
		float distance;
		float decay;
		float coneCos;
		float penumbraCos;
		int shadow;
		float shadowBias;
		float shadowRadius;
		vec2 shadowMapSize;
	};
	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
	void getSpotDirectLightIrradiance( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight directLight  ) {
		vec3 lVector = spotLight.position - geometry.position;
		directLight.direction = normalize( lVector );
		float lightDistance = length( lVector );
		float angleCos = dot( directLight.direction, spotLight.direction );
		if ( angleCos > spotLight.coneCos ) {
			float spotEffect = smoothstep( spotLight.coneCos, spotLight.penumbraCos, angleCos );
			directLight.color = spotLight.color;
			directLight.color *= spotEffect * punctualLightIntensityToIrradianceFactor( lightDistance, spotLight.distance, spotLight.decay );
			directLight.visible = true;
		} else {
			directLight.color = vec3( 0.0 );
			directLight.visible = false;
		}
	}
#endif
#if NUM_RECT_AREA_LIGHTS > 0
	struct RectAreaLight {
		vec3 color;
		vec3 position;
		vec3 halfWidth;
		vec3 halfHeight;
	};
	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;
	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
#endif
#if NUM_HEMI_LIGHTS > 0
	struct HemisphereLight {
		vec3 direction;
		vec3 skyColor;
		vec3 groundColor;
	};
	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in GeometricContext geometry ) {
		float dotNL = dot( geometry.normal, hemiLight.direction );
		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
		#ifndef PHYSICALLY_CORRECT_LIGHTS
			irradiance *= PI;
		#endif
		return irradiance;
	}
#endif`,Fp=`#if defined( USE_ENVMAP ) && defined( PHYSICAL )
	vec3 getLightProbeIndirectIrradiance( const in GeometricContext geometry, const in int maxMIPLevel ) {
		vec3 worldNormal = inverseTransformDirection( geometry.normal, viewMatrix );
		#ifdef ENVMAP_TYPE_CUBE
			vec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );
			#ifdef TEXTURE_LOD_EXT
				vec4 envMapColor = textureCubeLodEXT( envMap, queryVec, float( maxMIPLevel ) );
			#else
				vec4 envMapColor = textureCube( envMap, queryVec, float( maxMIPLevel ) );
			#endif
			envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;
		#elif defined( ENVMAP_TYPE_CUBE_UV )
			vec3 queryVec = vec3( flipEnvMap * worldNormal.x, worldNormal.yz );
			vec4 envMapColor = textureCubeUV( envMap, queryVec, 1.0 );
		#else
			vec4 envMapColor = vec4( 0.0 );
		#endif
		return PI * envMapColor.rgb * envMapIntensity;
	}
	float getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {
		float maxMIPLevelScalar = float( maxMIPLevel );
		float desiredMIPLevel = maxMIPLevelScalar + 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );
		return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );
	}
	vec3 getLightProbeIndirectRadiance( const in GeometricContext geometry, const in float blinnShininessExponent, const in int maxMIPLevel ) {
		#ifdef ENVMAP_MODE_REFLECTION
			vec3 reflectVec = reflect( -geometry.viewDir, geometry.normal );
		#else
			vec3 reflectVec = refract( -geometry.viewDir, geometry.normal, refractionRatio );
		#endif
		reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
		float specularMIPLevel = getSpecularMIPLevel( blinnShininessExponent, maxMIPLevel );
		#ifdef ENVMAP_TYPE_CUBE
			vec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );
			#ifdef TEXTURE_LOD_EXT
				vec4 envMapColor = textureCubeLodEXT( envMap, queryReflectVec, specularMIPLevel );
			#else
				vec4 envMapColor = textureCube( envMap, queryReflectVec, specularMIPLevel );
			#endif
			envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;
		#elif defined( ENVMAP_TYPE_CUBE_UV )
			vec3 queryReflectVec = vec3( flipEnvMap * reflectVec.x, reflectVec.yz );
			vec4 envMapColor = textureCubeUV( envMap, queryReflectVec, BlinnExponentToGGXRoughness(blinnShininessExponent ));
		#elif defined( ENVMAP_TYPE_EQUIREC )
			vec2 sampleUV;
			sampleUV.y = asin( clamp( reflectVec.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
			sampleUV.x = atan( reflectVec.z, reflectVec.x ) * RECIPROCAL_PI2 + 0.5;
			#ifdef TEXTURE_LOD_EXT
				vec4 envMapColor = texture2DLodEXT( envMap, sampleUV, specularMIPLevel );
			#else
				vec4 envMapColor = texture2D( envMap, sampleUV, specularMIPLevel );
			#endif
			envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;
		#elif defined( ENVMAP_TYPE_SPHERE )
			vec3 reflectView = normalize( ( viewMatrix * vec4( reflectVec, 0.0 ) ).xyz + vec3( 0.0,0.0,1.0 ) );
			#ifdef TEXTURE_LOD_EXT
				vec4 envMapColor = texture2DLodEXT( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );
			#else
				vec4 envMapColor = texture2D( envMap, reflectView.xy * 0.5 + 0.5, specularMIPLevel );
			#endif
			envMapColor.rgb = envMapTexelToLinear( envMapColor ).rgb;
		#endif
		return envMapColor.rgb * envMapIntensity;
	}
#endif`,Hp=`BlinnPhongMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
material.specularStrength = specularStrength;`,Up=`varying vec3 vViewPosition;
#ifndef FLAT_SHADED
	varying vec3 vNormal;
#endif
struct BlinnPhongMaterial {
	vec3	diffuseColor;
	vec3	specularColor;
	float	specularShininess;
	float	specularStrength;
};
void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
	#ifdef TOON
		vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;
	#else
		float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
		vec3 irradiance = dotNL * directLight.color;
	#endif
	#ifndef PHYSICALLY_CORRECT_LIGHTS
		irradiance *= PI;
	#endif
	reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
	reflectedLight.directSpecular += irradiance * BRDF_Specular_BlinnPhong( directLight, geometry, material.specularColor, material.specularShininess ) * material.specularStrength;
}
void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
}
#define RE_Direct				RE_Direct_BlinnPhong
#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong
#define Material_LightProbeLOD( material )	(0)`,Gp=`PhysicalMaterial material;
material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
material.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );
#ifdef STANDARD
	material.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor.rgb, metalnessFactor );
#else
	material.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( reflectivity ) ), diffuseColor.rgb, metalnessFactor );
	material.clearCoat = saturate( clearCoat );	material.clearCoatRoughness = clamp( clearCoatRoughness, 0.04, 1.0 );
#endif`,Vp=`struct PhysicalMaterial {
	vec3	diffuseColor;
	float	specularRoughness;
	vec3	specularColor;
	#ifndef STANDARD
		float clearCoat;
		float clearCoatRoughness;
	#endif
};
#define MAXIMUM_SPECULAR_COEFFICIENT 0.16
#define DEFAULT_SPECULAR_COEFFICIENT 0.04
float clearCoatDHRApprox( const in float roughness, const in float dotNL ) {
	return DEFAULT_SPECULAR_COEFFICIENT + ( 1.0 - DEFAULT_SPECULAR_COEFFICIENT ) * ( pow( 1.0 - dotNL, 5.0 ) * pow( 1.0 - roughness, 2.0 ) );
}
#if NUM_RECT_AREA_LIGHTS > 0
	void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
		vec3 normal = geometry.normal;
		vec3 viewDir = geometry.viewDir;
		vec3 position = geometry.position;
		vec3 lightPos = rectAreaLight.position;
		vec3 halfWidth = rectAreaLight.halfWidth;
		vec3 halfHeight = rectAreaLight.halfHeight;
		vec3 lightColor = rectAreaLight.color;
		float roughness = material.specularRoughness;
		vec3 rectCoords[ 4 ];
		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
		vec2 uv = LTC_Uv( normal, viewDir, roughness );
		vec4 t1 = texture2D( ltc_1, uv );
		vec4 t2 = texture2D( ltc_2, uv );
		mat3 mInv = mat3(
			vec3( t1.x, 0, t1.y ),
			vec3(    0, 1,    0 ),
			vec3( t1.z, 0, t1.w )
		);
		vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
		reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
	}
#endif
void RE_Direct_Physical( const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
	float dotNL = saturate( dot( geometry.normal, directLight.direction ) );
	vec3 irradiance = dotNL * directLight.color;
	#ifndef PHYSICALLY_CORRECT_LIGHTS
		irradiance *= PI;
	#endif
	#ifndef STANDARD
		float clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );
	#else
		float clearCoatDHR = 0.0;
	#endif
	reflectedLight.directSpecular += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Specular_GGX( directLight, geometry, material.specularColor, material.specularRoughness );
	reflectedLight.directDiffuse += ( 1.0 - clearCoatDHR ) * irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
	#ifndef STANDARD
		reflectedLight.directSpecular += irradiance * material.clearCoat * BRDF_Specular_GGX( directLight, geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );
	#endif
}
void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
	#ifndef ENVMAP_TYPE_CUBE_UV
		reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert( material.diffuseColor );
	#endif
}
void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearCoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
	#ifndef STANDARD
		float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
		float dotNL = dotNV;
		float clearCoatDHR = material.clearCoat * clearCoatDHRApprox( material.clearCoatRoughness, dotNL );
	#else
		float clearCoatDHR = 0.0;
	#endif
	float clearCoatInv = 1.0 - clearCoatDHR;
	#if defined( ENVMAP_TYPE_CUBE_UV )
		vec3 singleScattering = vec3( 0.0 );
		vec3 multiScattering = vec3( 0.0 );
		vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
		BRDF_Specular_Multiscattering_Environment( geometry, material.specularColor, material.specularRoughness, singleScattering, multiScattering );
		vec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );
		reflectedLight.indirectSpecular += clearCoatInv * radiance * singleScattering;
		reflectedLight.indirectDiffuse += multiScattering * cosineWeightedIrradiance;
		reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
	#else
		reflectedLight.indirectSpecular += clearCoatInv * radiance * BRDF_Specular_GGX_Environment( geometry, material.specularColor, material.specularRoughness );
	#endif
	#ifndef STANDARD
		reflectedLight.indirectSpecular += clearCoatRadiance * material.clearCoat * BRDF_Specular_GGX_Environment( geometry, vec3( DEFAULT_SPECULAR_COEFFICIENT ), material.clearCoatRoughness );
	#endif
}
#define RE_Direct				RE_Direct_Physical
#define RE_Direct_RectArea		RE_Direct_RectArea_Physical
#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical
#define RE_IndirectSpecular		RE_IndirectSpecular_Physical
#define Material_BlinnShininessExponent( material )   GGXRoughnessToBlinnExponent( material.specularRoughness )
#define Material_ClearCoat_BlinnShininessExponent( material )   GGXRoughnessToBlinnExponent( material.clearCoatRoughness )
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
}`,Wp=`
GeometricContext geometry;
geometry.position = - vViewPosition;
geometry.normal = normal;
geometry.viewDir = normalize( vViewPosition );
IncidentLight directLight;
#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
	PointLight pointLight;
	#pragma unroll_loop
	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
		pointLight = pointLights[ i ];
		getPointDirectLightIrradiance( pointLight, geometry, directLight );
		#ifdef USE_SHADOWMAP
		directLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
		#endif
		RE_Direct( directLight, geometry, material, reflectedLight );
	}
#endif
#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
	SpotLight spotLight;
	#pragma unroll_loop
	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
		spotLight = spotLights[ i ];
		getSpotDirectLightIrradiance( spotLight, geometry, directLight );
		#ifdef USE_SHADOWMAP
		directLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;
		#endif
		RE_Direct( directLight, geometry, material, reflectedLight );
	}
#endif
#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
	DirectionalLight directionalLight;
	#pragma unroll_loop
	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
		directionalLight = directionalLights[ i ];
		getDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );
		#ifdef USE_SHADOWMAP
		directLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
		#endif
		RE_Direct( directLight, geometry, material, reflectedLight );
	}
#endif
#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
	RectAreaLight rectAreaLight;
	#pragma unroll_loop
	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
		rectAreaLight = rectAreaLights[ i ];
		RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );
	}
#endif
#if defined( RE_IndirectDiffuse )
	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
	irradiance += getLightProbeIrradiance( lightProbe, geometry );
	#if ( NUM_HEMI_LIGHTS > 0 )
		#pragma unroll_loop
		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );
		}
	#endif
#endif
#if defined( RE_IndirectSpecular )
	vec3 radiance = vec3( 0.0 );
	vec3 clearCoatRadiance = vec3( 0.0 );
#endif`,jp=`#if defined( RE_IndirectDiffuse )
	#ifdef USE_LIGHTMAP
		vec3 lightMapIrradiance = texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;
		#ifndef PHYSICALLY_CORRECT_LIGHTS
			lightMapIrradiance *= PI;
		#endif
		irradiance += lightMapIrradiance;
	#endif
	#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV )
		irradiance += getLightProbeIndirectIrradiance( geometry, maxMipLevel );
	#endif
#endif
#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
	radiance += getLightProbeIndirectRadiance( geometry, Material_BlinnShininessExponent( material ), maxMipLevel );
	#ifndef STANDARD
		clearCoatRadiance += getLightProbeIndirectRadiance( geometry, Material_ClearCoat_BlinnShininessExponent( material ), maxMipLevel );
	#endif
#endif`,Yp=`#if defined( RE_IndirectDiffuse )
	RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );
#endif
#if defined( RE_IndirectSpecular )
	RE_IndirectSpecular( radiance, irradiance, clearCoatRadiance, geometry, material, reflectedLight );
#endif`,Xp=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
	gl_FragDepthEXT = log2( vFragDepth ) * logDepthBufFC * 0.5;
#endif`,Zp=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )
	uniform float logDepthBufFC;
	varying float vFragDepth;
#endif`,qp=`#ifdef USE_LOGDEPTHBUF
	#ifdef USE_LOGDEPTHBUF_EXT
		varying float vFragDepth;
	#else
		uniform float logDepthBufFC;
	#endif
#endif`,Jp=`#ifdef USE_LOGDEPTHBUF
	#ifdef USE_LOGDEPTHBUF_EXT
		vFragDepth = 1.0 + gl_Position.w;
	#else
		gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;
		gl_Position.z *= gl_Position.w;
	#endif
#endif`,Qp=`#ifdef USE_MAP
	vec4 texelColor = texture2D( map, vUv );
	texelColor = mapTexelToLinear( texelColor );
	diffuseColor *= texelColor;
#endif`,$p=`#ifdef USE_MAP
	uniform sampler2D map;
#endif`,Kp=`#ifdef USE_MAP
	vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
	vec4 mapTexel = texture2D( map, uv );
	diffuseColor *= mapTexelToLinear( mapTexel );
#endif`,em=`#ifdef USE_MAP
	uniform mat3 uvTransform;
	uniform sampler2D map;
#endif`,tm=`float metalnessFactor = metalness;
#ifdef USE_METALNESSMAP
	vec4 texelMetalness = texture2D( metalnessMap, vUv );
	metalnessFactor *= texelMetalness.b;
#endif`,nm=`#ifdef USE_METALNESSMAP
	uniform sampler2D metalnessMap;
#endif`,im=`#ifdef USE_MORPHNORMALS
	objectNormal += ( morphNormal0 - normal ) * morphTargetInfluences[ 0 ];
	objectNormal += ( morphNormal1 - normal ) * morphTargetInfluences[ 1 ];
	objectNormal += ( morphNormal2 - normal ) * morphTargetInfluences[ 2 ];
	objectNormal += ( morphNormal3 - normal ) * morphTargetInfluences[ 3 ];
#endif`,rm=`#ifdef USE_MORPHTARGETS
	#ifndef USE_MORPHNORMALS
	uniform float morphTargetInfluences[ 8 ];
	#else
	uniform float morphTargetInfluences[ 4 ];
	#endif
#endif`,am=`#ifdef USE_MORPHTARGETS
	transformed += ( morphTarget0 - position ) * morphTargetInfluences[ 0 ];
	transformed += ( morphTarget1 - position ) * morphTargetInfluences[ 1 ];
	transformed += ( morphTarget2 - position ) * morphTargetInfluences[ 2 ];
	transformed += ( morphTarget3 - position ) * morphTargetInfluences[ 3 ];
	#ifndef USE_MORPHNORMALS
	transformed += ( morphTarget4 - position ) * morphTargetInfluences[ 4 ];
	transformed += ( morphTarget5 - position ) * morphTargetInfluences[ 5 ];
	transformed += ( morphTarget6 - position ) * morphTargetInfluences[ 6 ];
	transformed += ( morphTarget7 - position ) * morphTargetInfluences[ 7 ];
	#endif
#endif`,om=`#ifdef FLAT_SHADED
	vec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );
	vec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );
	vec3 normal = normalize( cross( fdx, fdy ) );
#else
	vec3 normal = normalize( vNormal );
	#ifdef DOUBLE_SIDED
		normal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );
	#endif
	#ifdef USE_TANGENT
		vec3 tangent = normalize( vTangent );
		vec3 bitangent = normalize( vBitangent );
		#ifdef DOUBLE_SIDED
			tangent = tangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );
			bitangent = bitangent * ( float( gl_FrontFacing ) * 2.0 - 1.0 );
		#endif
	#endif
#endif`,sm=`#ifdef USE_NORMALMAP
	#ifdef OBJECTSPACE_NORMALMAP
		normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
		#ifdef FLIP_SIDED
			normal = - normal;
		#endif
		#ifdef DOUBLE_SIDED
			normal = normal * ( float( gl_FrontFacing ) * 2.0 - 1.0 );
		#endif
		normal = normalize( normalMatrix * normal );
	#else
		#ifdef USE_TANGENT
			mat3 vTBN = mat3( tangent, bitangent, normal );
			vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
			mapN.xy = normalScale * mapN.xy;
			normal = normalize( vTBN * mapN );
		#else
			normal = perturbNormal2Arb( -vViewPosition, normal );
		#endif
	#endif
#elif defined( USE_BUMPMAP )
	normal = perturbNormalArb( -vViewPosition, normal, dHdxy_fwd() );
#endif`,lm=`#ifdef USE_NORMALMAP
	uniform sampler2D normalMap;
	uniform vec2 normalScale;
	#ifdef OBJECTSPACE_NORMALMAP
		uniform mat3 normalMatrix;
	#else
		vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm ) {
			vec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );
			vec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );
			vec2 st0 = dFdx( vUv.st );
			vec2 st1 = dFdy( vUv.st );
			float scale = sign( st1.t * st0.s - st0.t * st1.s );
			vec3 S = normalize( ( q0 * st1.t - q1 * st0.t ) * scale );
			vec3 T = normalize( ( - q0 * st1.s + q1 * st0.s ) * scale );
			vec3 N = normalize( surf_norm );
			mat3 tsn = mat3( S, T, N );
			vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;
			mapN.xy *= normalScale;
			mapN.xy *= ( float( gl_FrontFacing ) * 2.0 - 1.0 );
			return normalize( tsn * mapN );
		}
	#endif
#endif`,cm=`vec3 packNormalToRGB( const in vec3 normal ) {
	return normalize( normal ) * 0.5 + 0.5;
}
vec3 unpackRGBToNormal( const in vec3 rgb ) {
	return 2.0 * rgb.xyz - 1.0;
}
const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;
const vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256.,  256. );
const vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );
const float ShiftRight8 = 1. / 256.;
vec4 packDepthToRGBA( const in float v ) {
	vec4 r = vec4( fract( v * PackFactors ), v );
	r.yzw -= r.xyz * ShiftRight8;	return r * PackUpscale;
}
float unpackRGBAToDepth( const in vec4 v ) {
	return dot( v, UnpackFactors );
}
float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
	return ( viewZ + near ) / ( near - far );
}
float orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {
	return linearClipZ * ( near - far ) - near;
}
float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
	return (( near + viewZ ) * far ) / (( far - near ) * viewZ );
}
float perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {
	return ( near * far ) / ( ( far - near ) * invClipZ - far );
}`,um=`#ifdef PREMULTIPLIED_ALPHA
	gl_FragColor.rgb *= gl_FragColor.a;
#endif`,hm=`vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );
gl_Position = projectionMatrix * mvPosition;`,dm=`#if defined( DITHERING )
	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
#endif`,fm=`#if defined( DITHERING )
	vec3 dithering( vec3 color ) {
		float grid_position = rand( gl_FragCoord.xy );
		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
		return color + dither_shift_RGB;
	}
#endif`,pm=`float roughnessFactor = roughness;
#ifdef USE_ROUGHNESSMAP
	vec4 texelRoughness = texture2D( roughnessMap, vUv );
	roughnessFactor *= texelRoughness.g;
#endif`,mm=`#ifdef USE_ROUGHNESSMAP
	uniform sampler2D roughnessMap;
#endif`,vm=`#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHTS > 0
		uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHTS ];
		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];
	#endif
	#if NUM_SPOT_LIGHTS > 0
		uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHTS ];
		varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];
	#endif
	#if NUM_POINT_LIGHTS > 0
		uniform sampler2D pointShadowMap[ NUM_POINT_LIGHTS ];
		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];
	#endif
	float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
		return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );
	}
	float texture2DShadowLerp( sampler2D depths, vec2 size, vec2 uv, float compare ) {
		const vec2 offset = vec2( 0.0, 1.0 );
		vec2 texelSize = vec2( 1.0 ) / size;
		vec2 centroidUV = floor( uv * size + 0.5 ) / size;
		float lb = texture2DCompare( depths, centroidUV + texelSize * offset.xx, compare );
		float lt = texture2DCompare( depths, centroidUV + texelSize * offset.xy, compare );
		float rb = texture2DCompare( depths, centroidUV + texelSize * offset.yx, compare );
		float rt = texture2DCompare( depths, centroidUV + texelSize * offset.yy, compare );
		vec2 f = fract( uv * size + 0.5 );
		float a = mix( lb, lt, f.y );
		float b = mix( rb, rt, f.y );
		float c = mix( a, b, f.x );
		return c;
	}
	float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
		float shadow = 1.0;
		shadowCoord.xyz /= shadowCoord.w;
		shadowCoord.z += shadowBias;
		bvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );
		bool inFrustum = all( inFrustumVec );
		bvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );
		bool frustumTest = all( frustumTestVec );
		if ( frustumTest ) {
		#if defined( SHADOWMAP_TYPE_PCF )
			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
			float dx0 = - texelSize.x * shadowRadius;
			float dy0 = - texelSize.y * shadowRadius;
			float dx1 = + texelSize.x * shadowRadius;
			float dy1 = + texelSize.y * shadowRadius;
			float dx2 = dx0 / 2.0;
			float dy2 = dy0 / 2.0;
			float dx3 = dx1 / 2.0;
			float dy3 = dy1 / 2.0;
			shadow = (
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
			) * ( 1.0 / 17.0 );
		#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
			float dx0 = - texelSize.x * shadowRadius;
			float dy0 = - texelSize.y * shadowRadius;
			float dx1 = + texelSize.x * shadowRadius;
			float dy1 = + texelSize.y * shadowRadius;
			shadow = (
				texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
				texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
				texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
				texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
				texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy, shadowCoord.z ) +
				texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
				texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
				texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
				texture2DShadowLerp( shadowMap, shadowMapSize, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
			) * ( 1.0 / 9.0 );
		#else
			shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
		#endif
		}
		return shadow;
	}
	vec2 cubeToUV( vec3 v, float texelSizeY ) {
		vec3 absV = abs( v );
		float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
		absV *= scaleToCube;
		v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
		vec2 planar = v.xy;
		float almostATexel = 1.5 * texelSizeY;
		float almostOne = 1.0 - almostATexel;
		if ( absV.z >= almostOne ) {
			if ( v.z > 0.0 )
				planar.x = 4.0 - v.x;
		} else if ( absV.x >= almostOne ) {
			float signX = sign( v.x );
			planar.x = v.z * signX + 2.0 * signX;
		} else if ( absV.y >= almostOne ) {
			float signY = sign( v.y );
			planar.x = v.x + 2.0 * signY + 2.0;
			planar.y = v.z * signY - 2.0;
		}
		return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
	}
	float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
		vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
		vec3 lightToPosition = shadowCoord.xyz;
		float dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );		dp += shadowBias;
		vec3 bd3D = normalize( lightToPosition );
		#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT )
			vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
			return (
				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
				texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
				texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
			) * ( 1.0 / 9.0 );
		#else
			return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
		#endif
	}
#endif`,gm=`#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHTS > 0
		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHTS ];
		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHTS ];
	#endif
	#if NUM_SPOT_LIGHTS > 0
		uniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHTS ];
		varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHTS ];
	#endif
	#if NUM_POINT_LIGHTS > 0
		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHTS ];
		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHTS ];
	#endif
#endif`,ym=`#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHTS > 0
	#pragma unroll_loop
	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
		vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * worldPosition;
	}
	#endif
	#if NUM_SPOT_LIGHTS > 0
	#pragma unroll_loop
	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
		vSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * worldPosition;
	}
	#endif
	#if NUM_POINT_LIGHTS > 0
	#pragma unroll_loop
	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
		vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * worldPosition;
	}
	#endif
#endif`,bm=`float getShadowMask() {
	float shadow = 1.0;
	#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHTS > 0
	DirectionalLight directionalLight;
	#pragma unroll_loop
	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
		directionalLight = directionalLights[ i ];
		shadow *= bool( directionalLight.shadow ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
	}
	#endif
	#if NUM_SPOT_LIGHTS > 0
	SpotLight spotLight;
	#pragma unroll_loop
	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
		spotLight = spotLights[ i ];
		shadow *= bool( spotLight.shadow ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;
	}
	#endif
	#if NUM_POINT_LIGHTS > 0
	PointLight pointLight;
	#pragma unroll_loop
	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
		pointLight = pointLights[ i ];
		shadow *= bool( pointLight.shadow ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
	}
	#endif
	#endif
	return shadow;
}`,xm=`#ifdef USE_SKINNING
	mat4 boneMatX = getBoneMatrix( skinIndex.x );
	mat4 boneMatY = getBoneMatrix( skinIndex.y );
	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
	mat4 boneMatW = getBoneMatrix( skinIndex.w );
#endif`,_m=`#ifdef USE_SKINNING
	uniform mat4 bindMatrix;
	uniform mat4 bindMatrixInverse;
	#ifdef BONE_TEXTURE
		uniform highp sampler2D boneTexture;
		uniform int boneTextureSize;
		mat4 getBoneMatrix( const in float i ) {
			float j = i * 4.0;
			float x = mod( j, float( boneTextureSize ) );
			float y = floor( j / float( boneTextureSize ) );
			float dx = 1.0 / float( boneTextureSize );
			float dy = 1.0 / float( boneTextureSize );
			y = dy * ( y + 0.5 );
			vec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );
			vec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );
			vec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );
			vec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );
			mat4 bone = mat4( v1, v2, v3, v4 );
			return bone;
		}
	#else
		uniform mat4 boneMatrices[ MAX_BONES ];
		mat4 getBoneMatrix( const in float i ) {
			mat4 bone = boneMatrices[ int(i) ];
			return bone;
		}
	#endif
#endif`,wm=`#ifdef USE_SKINNING
	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
	vec4 skinned = vec4( 0.0 );
	skinned += boneMatX * skinVertex * skinWeight.x;
	skinned += boneMatY * skinVertex * skinWeight.y;
	skinned += boneMatZ * skinVertex * skinWeight.z;
	skinned += boneMatW * skinVertex * skinWeight.w;
	transformed = ( bindMatrixInverse * skinned ).xyz;
#endif`,Em=`#ifdef USE_SKINNING
	mat4 skinMatrix = mat4( 0.0 );
	skinMatrix += skinWeight.x * boneMatX;
	skinMatrix += skinWeight.y * boneMatY;
	skinMatrix += skinWeight.z * boneMatZ;
	skinMatrix += skinWeight.w * boneMatW;
	skinMatrix  = bindMatrixInverse * skinMatrix * bindMatrix;
	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
	#ifdef USE_TANGENT
		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
	#endif
#endif`,Mm=`float specularStrength;
#ifdef USE_SPECULARMAP
	vec4 texelSpecular = texture2D( specularMap, vUv );
	specularStrength = texelSpecular.r;
#else
	specularStrength = 1.0;
#endif`,Sm=`#ifdef USE_SPECULARMAP
	uniform sampler2D specularMap;
#endif`,Tm=`#if defined( TONE_MAPPING )
	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
#endif`,Am=`#ifndef saturate
	#define saturate(a) clamp( a, 0.0, 1.0 )
#endif
uniform float toneMappingExposure;
uniform float toneMappingWhitePoint;
vec3 LinearToneMapping( vec3 color ) {
	return toneMappingExposure * color;
}
vec3 ReinhardToneMapping( vec3 color ) {
	color *= toneMappingExposure;
	return saturate( color / ( vec3( 1.0 ) + color ) );
}
#define Uncharted2Helper( x ) max( ( ( x * ( 0.15 * x + 0.10 * 0.50 ) + 0.20 * 0.02 ) / ( x * ( 0.15 * x + 0.50 ) + 0.20 * 0.30 ) ) - 0.02 / 0.30, vec3( 0.0 ) )
vec3 Uncharted2ToneMapping( vec3 color ) {
	color *= toneMappingExposure;
	return saturate( Uncharted2Helper( color ) / Uncharted2Helper( vec3( toneMappingWhitePoint ) ) );
}
vec3 OptimizedCineonToneMapping( vec3 color ) {
	color *= toneMappingExposure;
	color = max( vec3( 0.0 ), color - 0.004 );
	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
}
vec3 ACESFilmicToneMapping( vec3 color ) {
	color *= toneMappingExposure;
	return saturate( ( color * ( 2.51 * color + 0.03 ) ) / ( color * ( 2.43 * color + 0.59 ) + 0.14 ) );
}`,Lm=`#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )
	varying vec2 vUv;
#endif`,Cm=`#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )
	varying vec2 vUv;
	uniform mat3 uvTransform;
#endif`,Rm=`#if defined( USE_MAP ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( USE_SPECULARMAP ) || defined( USE_ALPHAMAP ) || defined( USE_EMISSIVEMAP ) || defined( USE_ROUGHNESSMAP ) || defined( USE_METALNESSMAP )
	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
#endif`,Im=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
	varying vec2 vUv2;
#endif`,Pm=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
	attribute vec2 uv2;
	varying vec2 vUv2;
#endif`,Om=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )
	vUv2 = uv2;
#endif`,Dm=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP )
	vec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );
#endif`,km=`uniform sampler2D t2D;
varying vec2 vUv;
void main() {
	vec4 texColor = texture2D( t2D, vUv );
	gl_FragColor = mapTexelToLinear( texColor );
	#include <tonemapping_fragment>
	#include <encodings_fragment>
}`,Nm=`varying vec2 vUv;
uniform mat3 uvTransform;
void main() {
	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
	gl_Position = vec4( position.xy, 1.0, 1.0 );
}`,Bm=`uniform samplerCube tCube;
uniform float tFlip;
uniform float opacity;
varying vec3 vWorldDirection;
void main() {
	vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
	gl_FragColor = mapTexelToLinear( texColor );
	gl_FragColor.a *= opacity;
	#include <tonemapping_fragment>
	#include <encodings_fragment>
}`,zm=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
	gl_Position.z = gl_Position.w;
}`,Fm=`#if DEPTH_PACKING == 3200
	uniform float opacity;
#endif
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	#include <clipping_planes_fragment>
	vec4 diffuseColor = vec4( 1.0 );
	#if DEPTH_PACKING == 3200
		diffuseColor.a = opacity;
	#endif
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <logdepthbuf_fragment>
	#if DEPTH_PACKING == 3200
		gl_FragColor = vec4( vec3( 1.0 - gl_FragCoord.z ), opacity );
	#elif DEPTH_PACKING == 3201
		gl_FragColor = packDepthToRGBA( gl_FragCoord.z );
	#endif
}`,Hm=`#include <common>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <skinbase_vertex>
	#ifdef USE_DISPLACEMENTMAP
		#include <beginnormal_vertex>
		#include <morphnormal_vertex>
		#include <skinnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
}`,Um=`#define DISTANCE
uniform vec3 referencePosition;
uniform float nearDistance;
uniform float farDistance;
varying vec3 vWorldPosition;
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <clipping_planes_pars_fragment>
void main () {
	#include <clipping_planes_fragment>
	vec4 diffuseColor = vec4( 1.0 );
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	float dist = length( vWorldPosition - referencePosition );
	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
	dist = saturate( dist );
	gl_FragColor = packDepthToRGBA( dist );
}`,Gm=`#define DISTANCE
varying vec3 vWorldPosition;
#include <common>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <skinbase_vertex>
	#ifdef USE_DISPLACEMENTMAP
		#include <beginnormal_vertex>
		#include <morphnormal_vertex>
		#include <skinnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <worldpos_vertex>
	#include <clipping_planes_vertex>
	vWorldPosition = worldPosition.xyz;
}`,Vm=`uniform sampler2D tEquirect;
varying vec3 vWorldDirection;
#include <common>
void main() {
	vec3 direction = normalize( vWorldDirection );
	vec2 sampleUV;
	sampleUV.y = asin( clamp( direction.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
	sampleUV.x = atan( direction.z, direction.x ) * RECIPROCAL_PI2 + 0.5;
	vec4 texColor = texture2D( tEquirect, sampleUV );
	gl_FragColor = mapTexelToLinear( texColor );
	#include <tonemapping_fragment>
	#include <encodings_fragment>
}`,Wm=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
}`,jm=`uniform vec3 diffuse;
uniform float opacity;
uniform float dashSize;
uniform float totalSize;
varying float vLineDistance;
#include <common>
#include <color_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	#include <clipping_planes_fragment>
	if ( mod( vLineDistance, totalSize ) > dashSize ) {
		discard;
	}
	vec3 outgoingLight = vec3( 0.0 );
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <logdepthbuf_fragment>
	#include <color_fragment>
	outgoingLight = diffuseColor.rgb;
	gl_FragColor = vec4( outgoingLight, diffuseColor.a );
	#include <premultiplied_alpha_fragment>
	#include <tonemapping_fragment>
	#include <encodings_fragment>
	#include <fog_fragment>
}`,Ym=`uniform float scale;
attribute float lineDistance;
varying float vLineDistance;
#include <common>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <color_vertex>
	vLineDistance = scale * lineDistance;
	vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
	gl_Position = projectionMatrix * mvPosition;
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
}`,Xm=`uniform vec3 diffuse;
uniform float opacity;
#ifndef FLAT_SHADED
	varying vec3 vNormal;
#endif
#include <common>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <uv2_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	#include <clipping_planes_fragment>
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <specularmap_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	#ifdef USE_LIGHTMAP
		reflectedLight.indirectDiffuse += texture2D( lightMap, vUv2 ).xyz * lightMapIntensity;
	#else
		reflectedLight.indirectDiffuse += vec3( 1.0 );
	#endif
	#include <aomap_fragment>
	reflectedLight.indirectDiffuse *= diffuseColor.rgb;
	vec3 outgoingLight = reflectedLight.indirectDiffuse;
	#include <envmap_fragment>
	gl_FragColor = vec4( outgoingLight, diffuseColor.a );
	#include <premultiplied_alpha_fragment>
	#include <tonemapping_fragment>
	#include <encodings_fragment>
	#include <fog_fragment>
}`,Zm=`#include <common>
#include <uv_pars_vertex>
#include <uv2_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <uv2_vertex>
	#include <color_vertex>
	#include <skinbase_vertex>
	#ifdef USE_ENVMAP
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <worldpos_vertex>
	#include <clipping_planes_vertex>
	#include <envmap_vertex>
	#include <fog_vertex>
}`,qm=`uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
varying vec3 vLightFront;
varying vec3 vIndirectFront;
#ifdef DOUBLE_SIDED
	varying vec3 vLightBack;
	varying vec3 vIndirectBack;
#endif
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <uv2_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <fog_pars_fragment>
#include <shadowmap_pars_fragment>
#include <shadowmask_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	#include <clipping_planes_fragment>
	vec4 diffuseColor = vec4( diffuse, opacity );
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <specularmap_fragment>
	#include <emissivemap_fragment>
	reflectedLight.indirectDiffuse = getAmbientLightIrradiance( ambientLightColor );
	#ifdef DOUBLE_SIDED
		reflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;
	#else
		reflectedLight.indirectDiffuse += vIndirectFront;
	#endif
	#include <lightmap_fragment>
	reflectedLight.indirectDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb );
	#ifdef DOUBLE_SIDED
		reflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;
	#else
		reflectedLight.directDiffuse = vLightFront;
	#endif
	reflectedLight.directDiffuse *= BRDF_Diffuse_Lambert( diffuseColor.rgb ) * getShadowMask();
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
	#include <envmap_fragment>
	gl_FragColor = vec4( outgoingLight, diffuseColor.a );
	#include <tonemapping_fragment>
	#include <encodings_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,Jm=`#define LAMBERT
varying vec3 vLightFront;
varying vec3 vIndirectFront;
#ifdef DOUBLE_SIDED
	varying vec3 vLightBack;
	varying vec3 vIndirectBack;
#endif
#include <common>
#include <uv_pars_vertex>
#include <uv2_pars_vertex>
#include <envmap_pars_vertex>
#include <bsdfs>
#include <lights_pars_begin>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <uv2_vertex>
	#include <color_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <worldpos_vertex>
	#include <envmap_vertex>
	#include <lights_lambert_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,Qm=`#define MATCAP
uniform vec3 diffuse;
uniform float opacity;
uniform sampler2D matcap;
varying vec3 vViewPosition;
#ifndef FLAT_SHADED
	varying vec3 vNormal;
#endif
#include <common>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <fog_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	#include <clipping_planes_fragment>
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	vec3 viewDir = normalize( vViewPosition );
	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
	vec3 y = cross( viewDir, x );
	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
	#ifdef USE_MATCAP
		vec4 matcapColor = texture2D( matcap, uv );
		matcapColor = matcapTexelToLinear( matcapColor );
	#else
		vec4 matcapColor = vec4( 1.0 );
	#endif
	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
	gl_FragColor = vec4( outgoingLight, diffuseColor.a );
	#include <premultiplied_alpha_fragment>
	#include <tonemapping_fragment>
	#include <encodings_fragment>
	#include <fog_fragment>
}`,$m=`#define MATCAP
varying vec3 vViewPosition;
#ifndef FLAT_SHADED
	varying vec3 vNormal;
#endif
#include <common>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#ifndef FLAT_SHADED
		vNormal = normalize( transformedNormal );
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
	vViewPosition = - mvPosition.xyz;
}`,Km=`#define PHONG
uniform vec3 diffuse;
uniform vec3 emissive;
uniform vec3 specular;
uniform float shininess;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <uv2_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_pars_fragment>
#include <gradientmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <lights_phong_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	#include <clipping_planes_fragment>
	vec4 diffuseColor = vec4( diffuse, opacity );
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <specularmap_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_phong_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
	#include <envmap_fragment>
	gl_FragColor = vec4( outgoingLight, diffuseColor.a );
	#include <tonemapping_fragment>
	#include <encodings_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,ev=`#define PHONG
varying vec3 vViewPosition;
#ifndef FLAT_SHADED
	varying vec3 vNormal;
#endif
#include <common>
#include <uv_pars_vertex>
#include <uv2_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <uv2_vertex>
	#include <color_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
#ifndef FLAT_SHADED
	vNormal = normalize( transformedNormal );
#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <envmap_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,tv=`#define PHYSICAL
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float roughness;
uniform float metalness;
uniform float opacity;
#ifndef STANDARD
	uniform float clearCoat;
	uniform float clearCoatRoughness;
#endif
varying vec3 vViewPosition;
#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <uv2_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <bsdfs>
#include <cube_uv_reflection_fragment>
#include <envmap_pars_fragment>
#include <envmap_physical_pars_fragment>
#include <fog_pars_fragment>
#include <lights_pars_begin>
#include <lights_physical_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <roughnessmap_pars_fragment>
#include <metalnessmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	#include <clipping_planes_fragment>
	vec4 diffuseColor = vec4( diffuse, opacity );
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <roughnessmap_fragment>
	#include <metalnessmap_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_physical_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
	gl_FragColor = vec4( outgoingLight, diffuseColor.a );
	#include <tonemapping_fragment>
	#include <encodings_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,nv=`#define PHYSICAL
varying vec3 vViewPosition;
#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif
#include <common>
#include <uv_pars_vertex>
#include <uv2_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <uv2_vertex>
	#include <color_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
#ifndef FLAT_SHADED
	vNormal = normalize( transformedNormal );
	#ifdef USE_TANGENT
		vTangent = normalize( transformedTangent );
		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
	#endif
#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,iv=`#define NORMAL
uniform float opacity;
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )
	varying vec3 vViewPosition;
#endif
#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif
#include <packing>
#include <uv_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	#include <clipping_planes_fragment>
	#include <logdepthbuf_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	gl_FragColor = vec4( packNormalToRGB( normal ), opacity );
}`,rv=`#define NORMAL
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )
	varying vec3 vViewPosition;
#endif
#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
#ifndef FLAT_SHADED
	vNormal = normalize( transformedNormal );
	#ifdef USE_TANGENT
		vTangent = normalize( transformedTangent );
		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
	#endif
#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || ( defined( USE_NORMALMAP ) && ! defined( OBJECTSPACE_NORMALMAP ) )
	vViewPosition = - mvPosition.xyz;
#endif
}`,av=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <color_pars_fragment>
#include <map_particle_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	#include <clipping_planes_fragment>
	vec3 outgoingLight = vec3( 0.0 );
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <logdepthbuf_fragment>
	#include <map_particle_fragment>
	#include <color_fragment>
	#include <alphatest_fragment>
	outgoingLight = diffuseColor.rgb;
	gl_FragColor = vec4( outgoingLight, diffuseColor.a );
	#include <premultiplied_alpha_fragment>
	#include <tonemapping_fragment>
	#include <encodings_fragment>
	#include <fog_fragment>
}`,ov=`uniform float size;
uniform float scale;
#include <common>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <color_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <project_vertex>
	gl_PointSize = size;
	#ifdef USE_SIZEATTENUATION
		bool isPerspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 );
		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
	#endif
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <worldpos_vertex>
	#include <fog_vertex>
}`,sv=`uniform vec3 color;
uniform float opacity;
#include <common>
#include <packing>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <shadowmap_pars_fragment>
#include <shadowmask_pars_fragment>
void main() {
	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
	#include <fog_fragment>
}`,lv=`#include <fog_pars_vertex>
#include <shadowmap_pars_vertex>
void main() {
	#include <begin_vertex>
	#include <project_vertex>
	#include <worldpos_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,cv=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	#include <clipping_planes_fragment>
	vec3 outgoingLight = vec3( 0.0 );
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <alphatest_fragment>
	outgoingLight = diffuseColor.rgb;
	gl_FragColor = vec4( outgoingLight, diffuseColor.a );
	#include <tonemapping_fragment>
	#include <encodings_fragment>
	#include <fog_fragment>
}`,uv=`uniform float rotation;
uniform vec2 center;
#include <common>
#include <uv_pars_vertex>
#include <fog_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );
	vec2 scale;
	scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );
	scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );
	#ifndef USE_SIZEATTENUATION
		bool isPerspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 );
		if ( isPerspective ) scale *= - mvPosition.z;
	#endif
	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
	vec2 rotatedPosition;
	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
	mvPosition.xy += rotatedPosition;
	gl_Position = projectionMatrix * mvPosition;
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
}`,Ge={alphamap_fragment:ep,alphamap_pars_fragment:tp,alphatest_fragment:np,aomap_fragment:ip,aomap_pars_fragment:rp,begin_vertex:ap,beginnormal_vertex:op,bsdfs:sp,bumpmap_pars_fragment:lp,clipping_planes_fragment:cp,clipping_planes_pars_fragment:up,clipping_planes_pars_vertex:hp,clipping_planes_vertex:dp,color_fragment:fp,color_pars_fragment:pp,color_pars_vertex:mp,color_vertex:vp,common:gp,cube_uv_reflection_fragment:yp,defaultnormal_vertex:bp,displacementmap_pars_vertex:xp,displacementmap_vertex:_p,emissivemap_fragment:wp,emissivemap_pars_fragment:Ep,encodings_fragment:Mp,encodings_pars_fragment:Sp,envmap_fragment:Tp,envmap_pars_fragment:Ap,envmap_pars_vertex:Lp,envmap_physical_pars_fragment:Fp,envmap_vertex:Cp,fog_vertex:Rp,fog_pars_vertex:Ip,fog_fragment:Pp,fog_pars_fragment:Op,gradientmap_pars_fragment:Dp,lightmap_fragment:kp,lightmap_pars_fragment:Np,lights_lambert_vertex:Bp,lights_pars_begin:zp,lights_phong_fragment:Hp,lights_phong_pars_fragment:Up,lights_physical_fragment:Gp,lights_physical_pars_fragment:Vp,lights_fragment_begin:Wp,lights_fragment_maps:jp,lights_fragment_end:Yp,logdepthbuf_fragment:Xp,logdepthbuf_pars_fragment:Zp,logdepthbuf_pars_vertex:qp,logdepthbuf_vertex:Jp,map_fragment:Qp,map_pars_fragment:$p,map_particle_fragment:Kp,map_particle_pars_fragment:em,metalnessmap_fragment:tm,metalnessmap_pars_fragment:nm,morphnormal_vertex:im,morphtarget_pars_vertex:rm,morphtarget_vertex:am,normal_fragment_begin:om,normal_fragment_maps:sm,normalmap_pars_fragment:lm,packing:cm,premultiplied_alpha_fragment:um,project_vertex:hm,dithering_fragment:dm,dithering_pars_fragment:fm,roughnessmap_fragment:pm,roughnessmap_pars_fragment:mm,shadowmap_pars_fragment:vm,shadowmap_pars_vertex:gm,shadowmap_vertex:ym,shadowmask_pars_fragment:bm,skinbase_vertex:xm,skinning_pars_vertex:_m,skinning_vertex:wm,skinnormal_vertex:Em,specularmap_fragment:Mm,specularmap_pars_fragment:Sm,tonemapping_fragment:Tm,tonemapping_pars_fragment:Am,uv_pars_fragment:Lm,uv_pars_vertex:Cm,uv_vertex:Rm,uv2_pars_fragment:Im,uv2_pars_vertex:Pm,uv2_vertex:Om,worldpos_vertex:Dm,background_frag:km,background_vert:Nm,cube_frag:Bm,cube_vert:zm,depth_frag:Fm,depth_vert:Hm,distanceRGBA_frag:Um,distanceRGBA_vert:Gm,equirect_frag:Vm,equirect_vert:Wm,linedashed_frag:jm,linedashed_vert:Ym,meshbasic_frag:Xm,meshbasic_vert:Zm,meshlambert_frag:qm,meshlambert_vert:Jm,meshmatcap_frag:Qm,meshmatcap_vert:$m,meshphong_frag:Km,meshphong_vert:ev,meshphysical_frag:tv,meshphysical_vert:nv,normal_frag:iv,normal_vert:rv,points_frag:av,points_vert:ov,shadow_frag:sv,shadow_vert:lv,sprite_frag:cv,sprite_vert:uv},de={common:{diffuse:{value:new ye(15658734)},opacity:{value:1},map:{value:null},uvTransform:{value:new xt},alphaMap:{value:null}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},refractionRatio:{value:.98},maxMipLevel:{value:0}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new j(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new ye(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{},shadow:{},shadowBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}}},points:{diffuse:{value:new ye(15658734)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},uvTransform:{value:new xt}},sprite:{diffuse:{value:new ye(15658734)},opacity:{value:1},center:{value:new j(.5,.5)},rotation:{value:0},map:{value:null},uvTransform:{value:new xt}}},xn={basic:{uniforms:zt([de.common,de.specularmap,de.envmap,de.aomap,de.lightmap,de.fog]),vertexShader:Ge.meshbasic_vert,fragmentShader:Ge.meshbasic_frag},lambert:{uniforms:zt([de.common,de.specularmap,de.envmap,de.aomap,de.lightmap,de.emissivemap,de.fog,de.lights,{emissive:{value:new ye(0)}}]),vertexShader:Ge.meshlambert_vert,fragmentShader:Ge.meshlambert_frag},phong:{uniforms:zt([de.common,de.specularmap,de.envmap,de.aomap,de.lightmap,de.emissivemap,de.bumpmap,de.normalmap,de.displacementmap,de.gradientmap,de.fog,de.lights,{emissive:{value:new ye(0)},specular:{value:new ye(1118481)},shininess:{value:30}}]),vertexShader:Ge.meshphong_vert,fragmentShader:Ge.meshphong_frag},standard:{uniforms:zt([de.common,de.envmap,de.aomap,de.lightmap,de.emissivemap,de.bumpmap,de.normalmap,de.displacementmap,de.roughnessmap,de.metalnessmap,de.fog,de.lights,{emissive:{value:new ye(0)},roughness:{value:.5},metalness:{value:.5},envMapIntensity:{value:1}}]),vertexShader:Ge.meshphysical_vert,fragmentShader:Ge.meshphysical_frag},matcap:{uniforms:zt([de.common,de.bumpmap,de.normalmap,de.displacementmap,de.fog,{matcap:{value:null}}]),vertexShader:Ge.meshmatcap_vert,fragmentShader:Ge.meshmatcap_frag},points:{uniforms:zt([de.points,de.fog]),vertexShader:Ge.points_vert,fragmentShader:Ge.points_frag},dashed:{uniforms:zt([de.common,de.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Ge.linedashed_vert,fragmentShader:Ge.linedashed_frag},depth:{uniforms:zt([de.common,de.displacementmap]),vertexShader:Ge.depth_vert,fragmentShader:Ge.depth_frag},normal:{uniforms:zt([de.common,de.bumpmap,de.normalmap,de.displacementmap,{opacity:{value:1}}]),vertexShader:Ge.normal_vert,fragmentShader:Ge.normal_frag},sprite:{uniforms:zt([de.sprite,de.fog]),vertexShader:Ge.sprite_vert,fragmentShader:Ge.sprite_frag},background:{uniforms:{uvTransform:{value:new xt},t2D:{value:null}},vertexShader:Ge.background_vert,fragmentShader:Ge.background_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Ge.cube_vert,fragmentShader:Ge.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Ge.equirect_vert,fragmentShader:Ge.equirect_frag},distanceRGBA:{uniforms:zt([de.common,de.displacementmap,{referencePosition:{value:new E},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Ge.distanceRGBA_vert,fragmentShader:Ge.distanceRGBA_frag},shadow:{uniforms:zt([de.lights,de.fog,{color:{value:new ye(0)},opacity:{value:1}}]),vertexShader:Ge.shadow_vert,fragmentShader:Ge.shadow_frag}};xn.physical={uniforms:zt([xn.standard.uniforms,{clearCoat:{value:0},clearCoatRoughness:{value:0}}]),vertexShader:Ge.meshphysical_vert,fragmentShader:Ge.meshphysical_frag};function rl(){var e=null,t=!1,n=null;function i(r,a){t!==!1&&(n(r,a),e.requestAnimationFrame(i))}return{start:function(){t!==!0&&n!==null&&(e.requestAnimationFrame(i),t=!0)},stop:function(){t=!1},setAnimationLoop:function(r){n=r},setContext:function(r){e=r}}}function hv(e){var t=new WeakMap;function n(s,l){var c=s.array,u=s.dynamic?35048:35044,h=e.createBuffer();e.bindBuffer(l,h),e.bufferData(l,c,u),s.onUploadCallback();var d=5126;return c instanceof Float32Array?d=5126:c instanceof Float64Array?console.warn("THREE.WebGLAttributes: Unsupported data buffer format: Float64Array."):c instanceof Uint16Array?d=5123:c instanceof Int16Array?d=5122:c instanceof Uint32Array?d=5125:c instanceof Int32Array?d=5124:c instanceof Int8Array?d=5120:c instanceof Uint8Array&&(d=5121),{buffer:h,type:d,bytesPerElement:c.BYTES_PER_ELEMENT,version:s.version}}function i(s,l,c){var u=l.array,h=l.updateRange;e.bindBuffer(c,s),l.dynamic===!1?e.bufferData(c,u,35044):h.count===-1?e.bufferSubData(c,0,u):h.count===0?console.error("THREE.WebGLObjects.updateBuffer: dynamic THREE.BufferAttribute marked as needsUpdate but updateRange.count is 0, ensure you are using set methods or updating manually."):(e.bufferSubData(c,h.offset*u.BYTES_PER_ELEMENT,u.subarray(h.offset,h.offset+h.count)),h.count=-1)}function r(s){return s.isInterleavedBufferAttribute&&(s=s.data),t.get(s)}function a(s){s.isInterleavedBufferAttribute&&(s=s.data);var l=t.get(s);l&&(e.deleteBuffer(l.buffer),t.delete(s))}function o(s,l){s.isInterleavedBufferAttribute&&(s=s.data);var c=t.get(s);c===void 0?t.set(s,n(s,l)):c.version<s.version&&(i(c.buffer,s,l),c.version=s.version)}return{get:r,remove:a,update:o}}function Wr(e,t,n,i){Te.call(this),this.type="PlaneGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i},this.fromBufferGeometry(new ci(e,t,n,i)),this.mergeVertices()}Wr.prototype=Object.create(Te.prototype);Wr.prototype.constructor=Wr;function ci(e,t,n,i){oe.call(this),this.type="PlaneBufferGeometry",this.parameters={width:e,height:t,widthSegments:n,heightSegments:i},e=e||1,t=t||1;var r=e/2,a=t/2,o=Math.floor(n)||1,s=Math.floor(i)||1,l=o+1,c=s+1,u=e/o,h=t/s,d,f,p=[],v=[],m=[],g=[];for(f=0;f<c;f++){var y=f*h-a;for(d=0;d<l;d++){var b=d*u-r;v.push(b,-y,0),m.push(0,0,1),g.push(d/o),g.push(1-f/s)}}for(f=0;f<s;f++)for(d=0;d<o;d++){var _=d+l*f,w=d+l*(f+1),L=d+1+l*(f+1),R=d+1+l*f;p.push(_,w,R),p.push(w,L,R)}this.setIndex(p),this.addAttribute("position",new $(v,3)),this.addAttribute("normal",new $(m,3)),this.addAttribute("uv",new $(g,2))}ci.prototype=Object.create(oe.prototype);ci.prototype.constructor=ci;function dv(e,t,n,i){var r=new ye(0),a=0,o,s,l=null,c=0;function u(d,f,p,v){var m=f.background,g=e.vr,y=g.getSession&&g.getSession();if(y&&y.environmentBlendMode==="additive"&&(m=null),m===null?(h(r,a),l=null,c=0):m&&m.isColor&&(h(m,1),v=!0,l=null,c=0),(e.autoClear||v)&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),m&&(m.isCubeTexture||m.isWebGLRenderTargetCube)){s===void 0&&(s=new _t(new Wn(1,1,1),new Dt({type:"BackgroundCubeMaterial",uniforms:si(xn.cube.uniforms),vertexShader:xn.cube.vertexShader,fragmentShader:xn.cube.fragmentShader,side:vt,depthTest:!1,depthWrite:!1,fog:!1})),s.geometry.removeAttribute("normal"),s.geometry.removeAttribute("uv"),s.onBeforeRender=function(_,w,L){this.matrixWorld.copyPosition(L.matrixWorld)},Object.defineProperty(s.material,"map",{get:function(){return this.uniforms.tCube.value}}),n.update(s));var b=m.isWebGLRenderTargetCube?m.texture:m;s.material.uniforms.tCube.value=b,s.material.uniforms.tFlip.value=m.isWebGLRenderTargetCube?1:-1,(l!==m||c!==b.version)&&(s.material.needsUpdate=!0,l=m,c=b.version),d.unshift(s,s.geometry,s.material,0,0,null)}else m&&m.isTexture&&(o===void 0&&(o=new _t(new ci(2,2),new Dt({type:"BackgroundMaterial",uniforms:si(xn.background.uniforms),vertexShader:xn.background.vertexShader,fragmentShader:xn.background.fragmentShader,side:br,depthTest:!1,depthWrite:!1,fog:!1})),o.geometry.removeAttribute("normal"),Object.defineProperty(o.material,"map",{get:function(){return this.uniforms.t2D.value}}),n.update(o)),o.material.uniforms.t2D.value=m,m.matrixAutoUpdate===!0&&m.updateMatrix(),o.material.uniforms.uvTransform.value.copy(m.matrix),(l!==m||c!==m.version)&&(o.material.needsUpdate=!0,l=m,c=m.version),d.unshift(o,o.geometry,o.material,0,0,null))}function h(d,f){t.buffers.color.setClear(d.r,d.g,d.b,f,i)}return{getClearColor:function(){return r},setClearColor:function(d,f){r.set(d),a=f!==void 0?f:1,h(r,a)},getClearAlpha:function(){return a},setClearAlpha:function(d){a=d,h(r,a)},render:u}}function fv(e,t,n,i){var r;function a(l){r=l}function o(l,c){e.drawArrays(r,l,c),n.update(c,r)}function s(l,c,u){var h;if(i.isWebGL2)h=e;else if(h=t.get("ANGLE_instanced_arrays"),h===null){console.error("THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}h[i.isWebGL2?"drawArraysInstanced":"drawArraysInstancedANGLE"](r,c,u,l.maxInstancedCount),n.update(u,r,l.maxInstancedCount)}this.setMode=a,this.render=o,this.renderInstances=s}function pv(e,t,n){var i;function r(){if(i!==void 0)return i;var L=t.get("EXT_texture_filter_anisotropic");return L!==null?i=e.getParameter(L.MAX_TEXTURE_MAX_ANISOTROPY_EXT):i=0,i}function a(L){if(L==="highp"){if(e.getShaderPrecisionFormat(35633,36338).precision>0&&e.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";L="mediump"}return L==="mediump"&&e.getShaderPrecisionFormat(35633,36337).precision>0&&e.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}var o=typeof WebGL2RenderingContext<"u"&&e instanceof WebGL2RenderingContext,s=n.precision!==void 0?n.precision:"highp",l=a(s);l!==s&&(console.warn("THREE.WebGLRenderer:",s,"not supported, using",l,"instead."),s=l);var c=n.logarithmicDepthBuffer===!0,u=e.getParameter(34930),h=e.getParameter(35660),d=e.getParameter(3379),f=e.getParameter(34076),p=e.getParameter(34921),v=e.getParameter(36347),m=e.getParameter(36348),g=e.getParameter(36349),y=h>0,b=o||!!t.get("OES_texture_float"),_=y&&b,w=o?e.getParameter(36183):0;return{isWebGL2:o,getMaxAnisotropy:r,getMaxPrecision:a,precision:s,logarithmicDepthBuffer:c,maxTextures:u,maxVertexTextures:h,maxTextureSize:d,maxCubemapSize:f,maxAttributes:p,maxVertexUniforms:v,maxVaryings:m,maxFragmentUniforms:g,vertexTextures:y,floatFragmentTextures:b,floatVertexTextures:_,maxSamples:w}}function mv(){var e=this,t=null,n=0,i=!1,r=!1,a=new bn,o=new xt,s={value:null,needsUpdate:!1};this.uniform=s,this.numPlanes=0,this.numIntersection=0,this.init=function(u,h,d){var f=u.length!==0||h||n!==0||i;return i=h,t=c(u,d,0),n=u.length,f},this.beginShadows=function(){r=!0,c(null)},this.endShadows=function(){r=!1,l()},this.setState=function(u,h,d,f,p,v){if(!i||u===null||u.length===0||r&&!d)r?c(null):l();else{var m=r?0:n,g=m*4,y=p.clippingState||null;s.value=y,y=c(u,f,g,v);for(var b=0;b!==g;++b)y[b]=t[b];p.clippingState=y,this.numIntersection=h?this.numPlanes:0,this.numPlanes+=m}};function l(){s.value!==t&&(s.value=t,s.needsUpdate=n>0),e.numPlanes=n,e.numIntersection=0}function c(u,h,d,f){var p=u!==null?u.length:0,v=null;if(p!==0){if(v=s.value,f!==!0||v===null){var m=d+p*4,g=h.matrixWorldInverse;o.getNormalMatrix(g),(v===null||v.length<m)&&(v=new Float32Array(m));for(var y=0,b=d;y!==p;++y,b+=4)a.copy(u[y]).applyMatrix4(g,o),a.normal.toArray(v,b),v[b+3]=a.constant}s.value=v,s.needsUpdate=!0}return e.numPlanes=p,v}}function vv(e){var t={};return{get:function(n){if(t[n]!==void 0)return t[n];var i;switch(n){case"WEBGL_depth_texture":i=e.getExtension("WEBGL_depth_texture")||e.getExtension("MOZ_WEBGL_depth_texture")||e.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":i=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":i=e.getExtension("WEBGL_compressed_texture_s3tc")||e.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":i=e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:i=e.getExtension(n)}return i===null&&console.warn("THREE.WebGLRenderer: "+n+" extension not supported."),t[n]=i,i}}}function gv(e,t,n){var i={},r={};function a(u){var h=u.target,d=i[h.id];d.index!==null&&t.remove(d.index);for(var f in d.attributes)t.remove(d.attributes[f]);h.removeEventListener("dispose",a),delete i[h.id];var p=r[d.id];p&&(t.remove(p),delete r[d.id]),n.memory.geometries--}function o(u,h){var d=i[h.id];return d||(h.addEventListener("dispose",a),h.isBufferGeometry?d=h:h.isGeometry&&(h._bufferGeometry===void 0&&(h._bufferGeometry=new oe().setFromObject(u)),d=h._bufferGeometry),i[h.id]=d,n.memory.geometries++,d)}function s(u){var h=u.index,d=u.attributes;h!==null&&t.update(h,34963);for(var f in d)t.update(d[f],34962);var p=u.morphAttributes;for(var f in p)for(var v=p[f],m=0,g=v.length;m<g;m++)t.update(v[m],34962)}function l(u){var h=[],d=u.index,f=u.attributes.position,p=0;if(d!==null){var v=d.array;p=d.version;for(var m=0,g=v.length;m<g;m+=3){var y=v[m+0],b=v[m+1],_=v[m+2];h.push(y,b,b,_,_,y)}}else{var v=f.array;p=f.version;for(var m=0,g=v.length/3-1;m<g;m+=3){var y=m+0,b=m+1,_=m+2;h.push(y,b,b,_,_,y)}}var w=new(Iu(h)>65535?oi:ai)(h,1);w.version=p,t.update(w,34963);var L=r[u.id];L&&t.remove(L),r[u.id]=w}function c(u){var h=r[u.id];if(h){var d=u.index;d!==null&&h.version<d.version&&l(u)}else l(u);return r[u.id]}return{get:o,update:s,getWireframeAttribute:c}}function yv(e,t,n,i){var r;function a(h){r=h}var o,s;function l(h){o=h.type,s=h.bytesPerElement}function c(h,d){e.drawElements(r,d,o,h*s),n.update(d,r)}function u(h,d,f){var p;if(i.isWebGL2)p=e;else{var p=t.get("ANGLE_instanced_arrays");if(p===null){console.error("THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}}p[i.isWebGL2?"drawElementsInstanced":"drawElementsInstancedANGLE"](r,f,o,d*s,h.maxInstancedCount),n.update(f,r,h.maxInstancedCount)}this.setMode=a,this.setIndex=l,this.render=c,this.renderInstances=u}function bv(e){var t={geometries:0,textures:0},n={frame:0,calls:0,triangles:0,points:0,lines:0};function i(a,o,s){switch(s=s||1,n.calls++,o){case 4:n.triangles+=s*(a/3);break;case 5:case 6:n.triangles+=s*(a-2);break;case 1:n.lines+=s*(a/2);break;case 3:n.lines+=s*(a-1);break;case 2:n.lines+=s*a;break;case 0:n.points+=s*a;break;default:console.error("THREE.WebGLInfo: Unknown draw mode:",o);break}}function r(){n.frame++,n.calls=0,n.triangles=0,n.points=0,n.lines=0}return{memory:t,render:n,programs:null,autoReset:!0,reset:r,update:i}}function xv(e,t){return Math.abs(t[1])-Math.abs(e[1])}function _v(e){var t={},n=new Float32Array(8);function i(r,a,o,s){var l=r.morphTargetInfluences,c=l.length,u=t[a.id];if(u===void 0){u=[];for(var h=0;h<c;h++)u[h]=[h,0];t[a.id]=u}for(var d=o.morphTargets&&a.morphAttributes.position,f=o.morphNormals&&a.morphAttributes.normal,h=0;h<c;h++){var p=u[h];p[1]!==0&&(d&&a.removeAttribute("morphTarget"+h),f&&a.removeAttribute("morphNormal"+h))}for(var h=0;h<c;h++){var p=u[h];p[0]=h,p[1]=l[h]}u.sort(xv);for(var h=0;h<8;h++){var p=u[h];if(p){var v=p[0],m=p[1];if(m){d&&a.addAttribute("morphTarget"+h,d[v]),f&&a.addAttribute("morphNormal"+h,f[v]),n[h]=m;continue}}n[h]=0}s.getUniforms().setValue(e,"morphTargetInfluences",n)}return{update:i}}function wv(e,t){var n={};function i(a){var o=t.render.frame,s=a.geometry,l=e.get(a,s);return n[l.id]!==o&&(s.isGeometry&&l.updateFromObject(a),e.update(l),n[l.id]=o),l}function r(){n={}}return{update:i,dispose:r}}function On(e,t,n,i,r,a,o,s,l,c){e=e!==void 0?e:[],t=t!==void 0?t:Oo,o=o!==void 0?o:Gn,tt.call(this,e,t,n,i,r,a,o,s,l,c),this.flipY=!1}On.prototype=Object.create(tt.prototype);On.prototype.constructor=On;On.prototype.isCubeTexture=!0;Object.defineProperty(On.prototype,"images",{get:function(){return this.image},set:function(e){this.image=e}});function Vi(e,t,n,i){tt.call(this,null),this.image={data:e,width:t,height:n,depth:i},this.magFilter=Et,this.minFilter=Et,this.wrapR=Ot,this.generateMipmaps=!1,this.flipY=!1}Vi.prototype=Object.create(tt.prototype);Vi.prototype.constructor=Vi;Vi.prototype.isDataTexture2DArray=!0;function Wi(e,t,n,i){tt.call(this,null),this.image={data:e,width:t,height:n,depth:i},this.magFilter=Et,this.minFilter=Et,this.wrapR=Ot,this.generateMipmaps=!1,this.flipY=!1}Wi.prototype=Object.create(tt.prototype);Wi.prototype.constructor=Wi;Wi.prototype.isDataTexture3D=!0;var Pu=new tt,Ev=new Vi,Mv=new Wi,Ou=new On,Hl=[],Ul=[],Gl=new Float32Array(16),Vl=new Float32Array(9),Wl=new Float32Array(4);function _r(e,t,n){var i=e[0];if(i<=0||i>0)return e;var r=t*n,a=Hl[r];if(a===void 0&&(a=new Float32Array(r),Hl[r]=a),t!==0){i.toArray(a,0);for(var o=1,s=0;o!==t;++o)s+=n,e[o].toArray(a,s)}return a}function $t(e,t){if(e.length!==t.length)return!1;for(var n=0,i=e.length;n<i;n++)if(e[n]!==t[n])return!1;return!0}function Xt(e,t){for(var n=0,i=t.length;n<i;n++)e[n]=t[n]}function Du(e,t){var n=Ul[t];n===void 0&&(n=new Int32Array(t),Ul[t]=n);for(var i=0;i!==t;++i)n[i]=e.allocateTextureUnit();return n}function Sv(e,t){var n=this.cache;n[0]!==t&&(e.uniform1f(this.addr,t),n[0]=t)}function Tv(e,t){var n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y)&&(e.uniform2f(this.addr,t.x,t.y),n[0]=t.x,n[1]=t.y);else{if($t(n,t))return;e.uniform2fv(this.addr,t),Xt(n,t)}}function Av(e,t){var n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z)&&(e.uniform3f(this.addr,t.x,t.y,t.z),n[0]=t.x,n[1]=t.y,n[2]=t.z);else if(t.r!==void 0)(n[0]!==t.r||n[1]!==t.g||n[2]!==t.b)&&(e.uniform3f(this.addr,t.r,t.g,t.b),n[0]=t.r,n[1]=t.g,n[2]=t.b);else{if($t(n,t))return;e.uniform3fv(this.addr,t),Xt(n,t)}}function Lv(e,t){var n=this.cache;if(t.x!==void 0)(n[0]!==t.x||n[1]!==t.y||n[2]!==t.z||n[3]!==t.w)&&(e.uniform4f(this.addr,t.x,t.y,t.z,t.w),n[0]=t.x,n[1]=t.y,n[2]=t.z,n[3]=t.w);else{if($t(n,t))return;e.uniform4fv(this.addr,t),Xt(n,t)}}function Cv(e,t){var n=this.cache,i=t.elements;if(i===void 0){if($t(n,t))return;e.uniformMatrix2fv(this.addr,!1,t),Xt(n,t)}else{if($t(n,i))return;Wl.set(i),e.uniformMatrix2fv(this.addr,!1,Wl),Xt(n,i)}}function Rv(e,t){var n=this.cache,i=t.elements;if(i===void 0){if($t(n,t))return;e.uniformMatrix3fv(this.addr,!1,t),Xt(n,t)}else{if($t(n,i))return;Vl.set(i),e.uniformMatrix3fv(this.addr,!1,Vl),Xt(n,i)}}function Iv(e,t){var n=this.cache,i=t.elements;if(i===void 0){if($t(n,t))return;e.uniformMatrix4fv(this.addr,!1,t),Xt(n,t)}else{if($t(n,i))return;Gl.set(i),e.uniformMatrix4fv(this.addr,!1,Gl),Xt(n,i)}}function Pv(e,t,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.safeSetTexture2D(t||Pu,r)}function Ov(e,t,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture2DArray(t||Ev,r)}function Dv(e,t,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.setTexture3D(t||Mv,r)}function kv(e,t,n){var i=this.cache,r=n.allocateTextureUnit();i[0]!==r&&(e.uniform1i(this.addr,r),i[0]=r),n.safeSetTextureCube(t||Ou,r)}function Nv(e,t){var n=this.cache;n[0]!==t&&(e.uniform1i(this.addr,t),n[0]=t)}function Bv(e,t){var n=this.cache;$t(n,t)||(e.uniform2iv(this.addr,t),Xt(n,t))}function zv(e,t){var n=this.cache;$t(n,t)||(e.uniform3iv(this.addr,t),Xt(n,t))}function Fv(e,t){var n=this.cache;$t(n,t)||(e.uniform4iv(this.addr,t),Xt(n,t))}function Hv(e){switch(e){case 5126:return Sv;case 35664:return Tv;case 35665:return Av;case 35666:return Lv;case 35674:return Cv;case 35675:return Rv;case 35676:return Iv;case 35678:case 36198:return Pv;case 35679:return Dv;case 35680:return kv;case 36289:return Ov;case 5124:case 35670:return Nv;case 35667:case 35671:return Bv;case 35668:case 35672:return zv;case 35669:case 35673:return Fv}}function Uv(e,t){e.uniform1fv(this.addr,t)}function Gv(e,t){e.uniform1iv(this.addr,t)}function Vv(e,t){e.uniform2iv(this.addr,t)}function Wv(e,t){e.uniform3iv(this.addr,t)}function jv(e,t){e.uniform4iv(this.addr,t)}function Yv(e,t){var n=_r(t,this.size,2);e.uniform2fv(this.addr,n)}function Xv(e,t){var n=_r(t,this.size,3);e.uniform3fv(this.addr,n)}function Zv(e,t){var n=_r(t,this.size,4);e.uniform4fv(this.addr,n)}function qv(e,t){var n=_r(t,this.size,4);e.uniformMatrix2fv(this.addr,!1,n)}function Jv(e,t){var n=_r(t,this.size,9);e.uniformMatrix3fv(this.addr,!1,n)}function Qv(e,t){var n=_r(t,this.size,16);e.uniformMatrix4fv(this.addr,!1,n)}function $v(e,t,n){var i=t.length,r=Du(n,i);e.uniform1iv(this.addr,r);for(var a=0;a!==i;++a)n.safeSetTexture2D(t[a]||Pu,r[a])}function Kv(e,t,n){var i=t.length,r=Du(n,i);e.uniform1iv(this.addr,r);for(var a=0;a!==i;++a)n.safeSetTextureCube(t[a]||Ou,r[a])}function eg(e){switch(e){case 5126:return Uv;case 35664:return Yv;case 35665:return Xv;case 35666:return Zv;case 35674:return qv;case 35675:return Jv;case 35676:return Qv;case 35678:return $v;case 35680:return Kv;case 5124:case 35670:return Gv;case 35667:case 35671:return Vv;case 35668:case 35672:return Wv;case 35669:case 35673:return jv}}function tg(e,t,n){this.id=e,this.addr=n,this.cache=[],this.setValue=Hv(t.type)}function ku(e,t,n){this.id=e,this.addr=n,this.cache=[],this.size=t.size,this.setValue=eg(t.type)}ku.prototype.updateCache=function(e){var t=this.cache;e instanceof Float32Array&&t.length!==e.length&&(this.cache=new Float32Array(e.length)),Xt(t,e)};function Nu(e){this.id=e,this.seq=[],this.map={}}Nu.prototype.setValue=function(e,t,n){for(var i=this.seq,r=0,a=i.length;r!==a;++r){var o=i[r];o.setValue(e,t[o.id],n)}};var is=/([\w\d_]+)(\])?(\[|\.)?/g;function jl(e,t){e.seq.push(t),e.map[t.id]=t}function ng(e,t,n){var i=e.name,r=i.length;for(is.lastIndex=0;;){var a=is.exec(i),o=is.lastIndex,s=a[1],l=a[2]==="]",c=a[3];if(l&&(s=s|0),c===void 0||c==="["&&o+2===r){jl(n,c===void 0?new tg(s,e,t):new ku(s,e,t));break}else{var u=n.map,h=u[s];h===void 0&&(h=new Nu(s),jl(n,h)),n=h}}}function Hn(e,t){this.seq=[],this.map={};for(var n=e.getProgramParameter(t,35718),i=0;i<n;++i){var r=e.getActiveUniform(t,i),a=e.getUniformLocation(t,r.name);ng(r,a,this)}}Hn.prototype.setValue=function(e,t,n,i){var r=this.map[t];r!==void 0&&r.setValue(e,n,i)};Hn.prototype.setOptional=function(e,t,n){var i=t[n];i!==void 0&&this.setValue(e,n,i)};Hn.upload=function(e,t,n,i){for(var r=0,a=t.length;r!==a;++r){var o=t[r],s=n[o.id];s.needsUpdate!==!1&&o.setValue(e,s.value,i)}};Hn.seqWithValue=function(e,t){for(var n=[],i=0,r=e.length;i!==r;++i){var a=e[i];a.id in t&&n.push(a)}return n};function Yl(e,t,n){var i=e.createShader(t);return e.shaderSource(i,n),e.compileShader(i),i}var ig=0;function rg(e){for(var t=e.split(`
`),n=0;n<t.length;n++)t[n]=n+1+": "+t[n];return t.join(`
`)}function Bu(e){switch(e){case Nr:return["Linear","( value )"];case _u:return["sRGB","( value )"];case wu:return["RGBE","( value )"];case Eu:return["RGBM","( value, 7.0 )"];case Mu:return["RGBM","( value, 16.0 )"];case Su:return["RGBD","( value, 256.0 )"];case nl:return["Gamma","( value, float( GAMMA_FACTOR ) )"];default:throw new Error("unsupported encoding: "+e)}}function Xl(e,t,n){var i=e.getShaderParameter(t,35713),r=e.getShaderInfoLog(t).trim();if(i&&r==="")return"";var a=e.getShaderSource(t);return"THREE.WebGLShader: gl.getShaderInfoLog() "+n+`
`+r+rg(a)}function Ga(e,t){var n=Bu(t);return"vec4 "+e+"( vec4 value ) { return "+n[0]+"ToLinear"+n[1]+"; }"}function ag(e,t){var n=Bu(t);return"vec4 "+e+"( vec4 value ) { return LinearTo"+n[0]+n[1]+"; }"}function og(e,t){var n;switch(t){case Qs:n="Linear";break;case Uc:n="Reinhard";break;case Gc:n="Uncharted2";break;case Vc:n="OptimizedCineon";break;case Wc:n="ACESFilmic";break;default:throw new Error("unsupported toneMapping: "+t)}return"vec3 "+e+"( vec3 color ) { return "+n+"ToneMapping( color ); }"}function sg(e,t,n){e=e||{};var i=[e.derivatives||t.envMapCubeUV||t.bumpMap||t.normalMap&&!t.objectSpaceNormalMap||t.flatShading?"#extension GL_OES_standard_derivatives : enable":"",(e.fragDepth||t.logarithmicDepthBuffer)&&n.get("EXT_frag_depth")?"#extension GL_EXT_frag_depth : enable":"",e.drawBuffers&&n.get("WEBGL_draw_buffers")?"#extension GL_EXT_draw_buffers : require":"",(e.shaderTextureLOD||t.envMap)&&n.get("EXT_shader_texture_lod")?"#extension GL_EXT_shader_texture_lod : enable":""];return i.filter(Ar).join(`
`)}function lg(e){var t=[];for(var n in e){var i=e[n];i!==!1&&t.push("#define "+n+" "+i)}return t.join(`
`)}function cg(e,t){for(var n={},i=e.getProgramParameter(t,35721),r=0;r<i;r++){var a=e.getActiveAttrib(t,r),o=a.name;n[o]=e.getAttribLocation(t,o)}return n}function Ar(e){return e!==""}function Zl(e,t){return e.replace(/NUM_DIR_LIGHTS/g,t.numDirLights).replace(/NUM_SPOT_LIGHTS/g,t.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g,t.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,t.numPointLights).replace(/NUM_HEMI_LIGHTS/g,t.numHemiLights)}function ql(e,t){return e.replace(/NUM_CLIPPING_PLANES/g,t.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,t.numClippingPlanes-t.numClipIntersection)}function As(e){var t=/^[ \t]*#include +<([\w\d./]+)>/gm;function n(i,r){var a=Ge[r];if(a===void 0)throw new Error("Can not resolve #include <"+r+">");return As(a)}return e.replace(t,n)}function Jl(e){var t=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g;function n(i,r,a,o){for(var s="",l=parseInt(r);l<parseInt(a);l++)s+=o.replace(/\[ i \]/g,"[ "+l+" ]");return s}return e.replace(t,n)}function ug(e,t,n,i,r,a,o){var s=e.getContext(),l=i.defines,c=r.vertexShader,u=r.fragmentShader,h="SHADOWMAP_TYPE_BASIC";a.shadowMapType===Ws?h="SHADOWMAP_TYPE_PCF":a.shadowMapType===xc&&(h="SHADOWMAP_TYPE_PCF_SOFT");var d="ENVMAP_TYPE_CUBE",f="ENVMAP_MODE_REFLECTION",p="ENVMAP_BLENDING_MULTIPLY";if(a.envMap){switch(i.envMap.mapping){case Oo:case ao:d="ENVMAP_TYPE_CUBE";break;case Do:case ko:d="ENVMAP_TYPE_CUBE_UV";break;case $s:case oo:d="ENVMAP_TYPE_EQUIREC";break;case Ks:d="ENVMAP_TYPE_SPHERE";break}switch(i.envMap.mapping){case ao:case oo:f="ENVMAP_MODE_REFRACTION";break}switch(i.combine){case Ca:p="ENVMAP_BLENDING_MULTIPLY";break;case Fc:p="ENVMAP_BLENDING_MIX";break;case Hc:p="ENVMAP_BLENDING_ADD";break}}var v=e.gammaFactor>0?e.gammaFactor:1,m=o.isWebGL2?"":sg(i.extensions,a,t),g=lg(l),y=s.createProgram(),b,_;if(i.isRawShaderMaterial?(b=[g].filter(Ar).join(`
`),b.length>0&&(b+=`
`),_=[m,g].filter(Ar).join(`
`),_.length>0&&(_+=`
`)):(b=["precision "+a.precision+" float;","precision "+a.precision+" int;","#define SHADER_NAME "+r.name,g,a.supportsVertexTextures?"#define VERTEX_TEXTURES":"","#define GAMMA_FACTOR "+v,"#define MAX_BONES "+a.maxBones,a.useFog&&a.fog?"#define USE_FOG":"",a.useFog&&a.fogExp?"#define FOG_EXP2":"",a.map?"#define USE_MAP":"",a.envMap?"#define USE_ENVMAP":"",a.envMap?"#define "+f:"",a.lightMap?"#define USE_LIGHTMAP":"",a.aoMap?"#define USE_AOMAP":"",a.emissiveMap?"#define USE_EMISSIVEMAP":"",a.bumpMap?"#define USE_BUMPMAP":"",a.normalMap?"#define USE_NORMALMAP":"",a.normalMap&&a.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",a.displacementMap&&a.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",a.specularMap?"#define USE_SPECULARMAP":"",a.roughnessMap?"#define USE_ROUGHNESSMAP":"",a.metalnessMap?"#define USE_METALNESSMAP":"",a.alphaMap?"#define USE_ALPHAMAP":"",a.vertexTangents?"#define USE_TANGENT":"",a.vertexColors?"#define USE_COLOR":"",a.flatShading?"#define FLAT_SHADED":"",a.skinning?"#define USE_SKINNING":"",a.useVertexTexture?"#define BONE_TEXTURE":"",a.morphTargets?"#define USE_MORPHTARGETS":"",a.morphNormals&&a.flatShading===!1?"#define USE_MORPHNORMALS":"",a.doubleSided?"#define DOUBLE_SIDED":"",a.flipSided?"#define FLIP_SIDED":"",a.shadowMapEnabled?"#define USE_SHADOWMAP":"",a.shadowMapEnabled?"#define "+h:"",a.sizeAttenuation?"#define USE_SIZEATTENUATION":"",a.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",a.logarithmicDepthBuffer&&(o.isWebGL2||t.get("EXT_frag_depth"))?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT","	attribute vec4 tangent;","#endif","#ifdef USE_COLOR","	attribute vec3 color;","#endif","#ifdef USE_MORPHTARGETS","	attribute vec3 morphTarget0;","	attribute vec3 morphTarget1;","	attribute vec3 morphTarget2;","	attribute vec3 morphTarget3;","	#ifdef USE_MORPHNORMALS","		attribute vec3 morphNormal0;","		attribute vec3 morphNormal1;","		attribute vec3 morphNormal2;","		attribute vec3 morphNormal3;","	#else","		attribute vec3 morphTarget4;","		attribute vec3 morphTarget5;","		attribute vec3 morphTarget6;","		attribute vec3 morphTarget7;","	#endif","#endif","#ifdef USE_SKINNING","	attribute vec4 skinIndex;","	attribute vec4 skinWeight;","#endif",`
`].filter(Ar).join(`
`),_=[m,"precision "+a.precision+" float;","precision "+a.precision+" int;","#define SHADER_NAME "+r.name,g,a.alphaTest?"#define ALPHATEST "+a.alphaTest+(a.alphaTest%1?"":".0"):"","#define GAMMA_FACTOR "+v,a.useFog&&a.fog?"#define USE_FOG":"",a.useFog&&a.fogExp?"#define FOG_EXP2":"",a.map?"#define USE_MAP":"",a.matcap?"#define USE_MATCAP":"",a.envMap?"#define USE_ENVMAP":"",a.envMap?"#define "+d:"",a.envMap?"#define "+f:"",a.envMap?"#define "+p:"",a.lightMap?"#define USE_LIGHTMAP":"",a.aoMap?"#define USE_AOMAP":"",a.emissiveMap?"#define USE_EMISSIVEMAP":"",a.bumpMap?"#define USE_BUMPMAP":"",a.normalMap?"#define USE_NORMALMAP":"",a.normalMap&&a.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",a.specularMap?"#define USE_SPECULARMAP":"",a.roughnessMap?"#define USE_ROUGHNESSMAP":"",a.metalnessMap?"#define USE_METALNESSMAP":"",a.alphaMap?"#define USE_ALPHAMAP":"",a.vertexTangents?"#define USE_TANGENT":"",a.vertexColors?"#define USE_COLOR":"",a.gradientMap?"#define USE_GRADIENTMAP":"",a.flatShading?"#define FLAT_SHADED":"",a.doubleSided?"#define DOUBLE_SIDED":"",a.flipSided?"#define FLIP_SIDED":"",a.shadowMapEnabled?"#define USE_SHADOWMAP":"",a.shadowMapEnabled?"#define "+h:"",a.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",a.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",a.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",a.logarithmicDepthBuffer&&(o.isWebGL2||t.get("EXT_frag_depth"))?"#define USE_LOGDEPTHBUF_EXT":"",a.envMap&&(o.isWebGL2||t.get("EXT_shader_texture_lod"))?"#define TEXTURE_LOD_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;",a.toneMapping!==Ja?"#define TONE_MAPPING":"",a.toneMapping!==Ja?Ge.tonemapping_pars_fragment:"",a.toneMapping!==Ja?og("toneMapping",a.toneMapping):"",a.dithering?"#define DITHERING":"",a.outputEncoding||a.mapEncoding||a.matcapEncoding||a.envMapEncoding||a.emissiveMapEncoding?Ge.encodings_pars_fragment:"",a.mapEncoding?Ga("mapTexelToLinear",a.mapEncoding):"",a.matcapEncoding?Ga("matcapTexelToLinear",a.matcapEncoding):"",a.envMapEncoding?Ga("envMapTexelToLinear",a.envMapEncoding):"",a.emissiveMapEncoding?Ga("emissiveMapTexelToLinear",a.emissiveMapEncoding):"",a.outputEncoding?ag("linearToOutputTexel",a.outputEncoding):"",a.depthPacking?"#define DEPTH_PACKING "+i.depthPacking:"",`
`].filter(Ar).join(`
`)),c=As(c),c=Zl(c,a),c=ql(c,a),u=As(u),u=Zl(u,a),u=ql(u,a),c=Jl(c),u=Jl(u),o.isWebGL2&&!i.isRawShaderMaterial){var w=!1,L=/^\s*#version\s+300\s+es\s*\n/;i.isShaderMaterial&&c.match(L)!==null&&u.match(L)!==null&&(w=!0,c=c.replace(L,""),u=u.replace(L,"")),b=[`#version 300 es
`,"#define attribute in","#define varying out","#define texture2D texture"].join(`
`)+`
`+b,_=[`#version 300 es
`,"#define varying in",w?"":"out highp vec4 pc_fragColor;",w?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
`)+`
`+_}var R=b+c,k=_+u,O=Yl(s,35633,R),z=Yl(s,35632,k);if(s.attachShader(y,O),s.attachShader(y,z),i.index0AttributeName!==void 0?s.bindAttribLocation(y,0,i.index0AttributeName):a.morphTargets===!0&&s.bindAttribLocation(y,0,"position"),s.linkProgram(y),e.debug.checkShaderErrors){var C=s.getProgramInfoLog(y).trim(),I=s.getShaderInfoLog(O).trim(),N=s.getShaderInfoLog(z).trim(),H=!0,G=!0;if(s.getProgramParameter(y,35714)===!1){H=!1;var X=Xl(s,O,"vertex"),Z=Xl(s,z,"fragment");console.error("THREE.WebGLProgram: shader error: ",s.getError(),"35715",s.getProgramParameter(y,35715),"gl.getProgramInfoLog",C,X,Z)}else C!==""?console.warn("THREE.WebGLProgram: gl.getProgramInfoLog()",C):(I===""||N==="")&&(G=!1);G&&(this.diagnostics={runnable:H,material:i,programLog:C,vertexShader:{log:I,prefix:b},fragmentShader:{log:N,prefix:_}})}s.deleteShader(O),s.deleteShader(z);var V;this.getUniforms=function(){return V===void 0&&(V=new Hn(s,y)),V};var Y;return this.getAttributes=function(){return Y===void 0&&(Y=cg(s,y)),Y},this.destroy=function(){s.deleteProgram(y),this.program=void 0},this.name=r.name,this.id=ig++,this.code=n,this.usedTimes=1,this.program=y,this.vertexShader=O,this.fragmentShader=z,this}function hg(e,t,n){var i=[],r={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"phong",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"},a=["precision","supportsVertexTextures","map","mapEncoding","matcap","matcapEncoding","envMap","envMapMode","envMapEncoding","lightMap","aoMap","emissiveMap","emissiveMapEncoding","bumpMap","normalMap","objectSpaceNormalMap","displacementMap","specularMap","roughnessMap","metalnessMap","gradientMap","alphaMap","combine","vertexColors","vertexTangents","fog","useFog","fogExp","flatShading","sizeAttenuation","logarithmicDepthBuffer","skinning","maxBones","useVertexTexture","morphTargets","morphNormals","maxMorphTargets","maxMorphNormals","premultipliedAlpha","numDirLights","numPointLights","numSpotLights","numHemiLights","numRectAreaLights","shadowMapEnabled","shadowMapType","toneMapping","physicallyCorrectLights","alphaTest","doubleSided","flipSided","numClippingPlanes","numClipIntersection","depthPacking","dithering"];function o(l){var c=l.skeleton,u=c.bones;if(n.floatVertexTextures)return 1024;var h=n.maxVertexUniforms,d=Math.floor((h-20)/4),f=Math.min(d,u.length);return f<u.length?(console.warn("THREE.WebGLRenderer: Skeleton has "+u.length+" bones. This GPU supports "+f+"."),0):f}function s(l,c){var u;return l?l.isTexture?u=l.encoding:l.isWebGLRenderTarget&&(console.warn("THREE.WebGLPrograms.getTextureEncodingFromMap: don't use render targets as textures. Use their .texture property instead."),u=l.texture.encoding):u=Nr,u===Nr&&c&&(u=nl),u}this.getParameters=function(l,c,u,h,d,f,p){var v=r[l.type],m=p.isSkinnedMesh?o(p):0,g=n.precision;l.precision!==null&&(g=n.getMaxPrecision(l.precision),g!==l.precision&&console.warn("THREE.WebGLProgram.getParameters:",l.precision,"not supported, using",g,"instead."));var y=e.getRenderTarget(),b={shaderID:v,precision:g,supportsVertexTextures:n.vertexTextures,outputEncoding:s(y?y.texture:null,e.gammaOutput),map:!!l.map,mapEncoding:s(l.map,e.gammaInput),matcap:!!l.matcap,matcapEncoding:s(l.matcap,e.gammaInput),envMap:!!l.envMap,envMapMode:l.envMap&&l.envMap.mapping,envMapEncoding:s(l.envMap,e.gammaInput),envMapCubeUV:!!l.envMap&&(l.envMap.mapping===Do||l.envMap.mapping===ko),lightMap:!!l.lightMap,aoMap:!!l.aoMap,emissiveMap:!!l.emissiveMap,emissiveMapEncoding:s(l.emissiveMap,e.gammaInput),bumpMap:!!l.bumpMap,normalMap:!!l.normalMap,objectSpaceNormalMap:l.normalMapType===Lu,displacementMap:!!l.displacementMap,roughnessMap:!!l.roughnessMap,metalnessMap:!!l.metalnessMap,specularMap:!!l.specularMap,alphaMap:!!l.alphaMap,gradientMap:!!l.gradientMap,combine:l.combine,vertexTangents:l.normalMap&&l.vertexTangents,vertexColors:l.vertexColors,fog:!!h,useFog:l.fog,fogExp:h&&h.isFogExp2,flatShading:l.flatShading,sizeAttenuation:l.sizeAttenuation,logarithmicDepthBuffer:n.logarithmicDepthBuffer,skinning:l.skinning&&m>0,maxBones:m,useVertexTexture:n.floatVertexTextures,morphTargets:l.morphTargets,morphNormals:l.morphNormals,maxMorphTargets:e.maxMorphTargets,maxMorphNormals:e.maxMorphNormals,numDirLights:c.directional.length,numPointLights:c.point.length,numSpotLights:c.spot.length,numRectAreaLights:c.rectArea.length,numHemiLights:c.hemi.length,numClippingPlanes:d,numClipIntersection:f,dithering:l.dithering,shadowMapEnabled:e.shadowMap.enabled&&p.receiveShadow&&u.length>0,shadowMapType:e.shadowMap.type,toneMapping:e.toneMapping,physicallyCorrectLights:e.physicallyCorrectLights,premultipliedAlpha:l.premultipliedAlpha,alphaTest:l.alphaTest,doubleSided:l.side===xr,flipSided:l.side===vt,depthPacking:l.depthPacking!==void 0?l.depthPacking:!1};return b},this.getProgramCode=function(l,c){var u=[];if(c.shaderID?u.push(c.shaderID):(u.push(l.fragmentShader),u.push(l.vertexShader)),l.defines!==void 0)for(var h in l.defines)u.push(h),u.push(l.defines[h]);for(var d=0;d<a.length;d++)u.push(c[a[d]]);return u.push(l.onBeforeCompile.toString()),u.push(e.gammaOutput),u.push(e.gammaFactor),u.join()},this.acquireProgram=function(l,c,u,h){for(var d,f=0,p=i.length;f<p;f++){var v=i[f];if(v.code===h){d=v,++d.usedTimes;break}}return d===void 0&&(d=new ug(e,t,h,l,c,u,n),i.push(d)),d},this.releaseProgram=function(l){if(--l.usedTimes===0){var c=i.indexOf(l);i[c]=i[i.length-1],i.pop(),l.destroy()}},this.programs=i}function dg(){var e=new WeakMap;function t(a){var o=e.get(a);return o===void 0&&(o={},e.set(a,o)),o}function n(a){e.delete(a)}function i(a,o,s){e.get(a)[o]=s}function r(){e=new WeakMap}return{get:t,remove:n,update:i,dispose:r}}function fg(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.program!==t.program?e.program.id-t.program.id:e.material.id!==t.material.id?e.material.id-t.material.id:e.z!==t.z?e.z-t.z:e.id-t.id}function pg(e,t){return e.groupOrder!==t.groupOrder?e.groupOrder-t.groupOrder:e.renderOrder!==t.renderOrder?e.renderOrder-t.renderOrder:e.z!==t.z?t.z-e.z:e.id-t.id}function Ql(){var e=[],t=0,n=[],i=[],r={id:-1};function a(){t=0,n.length=0,i.length=0}function o(u,h,d,f,p,v){var m=e[t];return m===void 0?(m={id:u.id,object:u,geometry:h,material:d,program:d.program||r,groupOrder:f,renderOrder:u.renderOrder,z:p,group:v},e[t]=m):(m.id=u.id,m.object=u,m.geometry=h,m.material=d,m.program=d.program||r,m.groupOrder=f,m.renderOrder=u.renderOrder,m.z=p,m.group=v),t++,m}function s(u,h,d,f,p,v){var m=o(u,h,d,f,p,v);(d.transparent===!0?i:n).push(m)}function l(u,h,d,f,p,v){var m=o(u,h,d,f,p,v);(d.transparent===!0?i:n).unshift(m)}function c(){n.length>1&&n.sort(fg),i.length>1&&i.sort(pg)}return{opaque:n,transparent:i,init:a,push:s,unshift:l,sort:c}}function mg(){var e={};function t(r){var a=r.target;a.removeEventListener("dispose",t),delete e[a.id]}function n(r,a){var o=e[r.id],s;return o===void 0?(s=new Ql,e[r.id]={},e[r.id][a.id]=s,r.addEventListener("dispose",t)):(s=o[a.id],s===void 0&&(s=new Ql,o[a.id]=s)),s}function i(){e={}}return{get:n,dispose:i}}function vg(){var e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];var n;switch(t.type){case"DirectionalLight":n={direction:new E,color:new ye,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new j};break;case"SpotLight":n={position:new E,direction:new E,color:new ye,distance:0,coneCos:0,penumbraCos:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new j};break;case"PointLight":n={position:new E,color:new ye,distance:0,decay:0,shadow:!1,shadowBias:0,shadowRadius:1,shadowMapSize:new j,shadowCameraNear:1,shadowCameraFar:1e3};break;case"HemisphereLight":n={direction:new E,skyColor:new ye,groundColor:new ye};break;case"RectAreaLight":n={color:new ye,position:new E,halfWidth:new E,halfHeight:new E};break}return e[t.id]=n,n}}}var gg=0;function yg(){for(var e=new vg,t={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,shadowsLength:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],point:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]},n=0;n<9;n++)t.probe.push(new E);var i=new E,r=new Me,a=new Me;function o(s,l,c){for(var u=0,h=0,d=0,f=0;f<9;f++)t.probe[f].set(0,0,0);for(var p=0,v=0,m=0,g=0,y=0,b=c.matrixWorldInverse,f=0,_=s.length;f<_;f++){var w=s[f],L=w.color,R=w.intensity,k=w.distance,O=w.shadow&&w.shadow.map?w.shadow.map.texture:null;if(w.isAmbientLight)u+=L.r*R,h+=L.g*R,d+=L.b*R;else if(w.isLightProbe)for(var z=0;z<9;z++)t.probe[z].addScaledVector(w.sh.coefficients[z],R);else if(w.isDirectionalLight){var C=e.get(w);if(C.color.copy(w.color).multiplyScalar(w.intensity),C.direction.setFromMatrixPosition(w.matrixWorld),i.setFromMatrixPosition(w.target.matrixWorld),C.direction.sub(i),C.direction.transformDirection(b),C.shadow=w.castShadow,w.castShadow){var I=w.shadow;C.shadowBias=I.bias,C.shadowRadius=I.radius,C.shadowMapSize=I.mapSize}t.directionalShadowMap[p]=O,t.directionalShadowMatrix[p]=w.shadow.matrix,t.directional[p]=C,p++}else if(w.isSpotLight){var C=e.get(w);if(C.position.setFromMatrixPosition(w.matrixWorld),C.position.applyMatrix4(b),C.color.copy(L).multiplyScalar(R),C.distance=k,C.direction.setFromMatrixPosition(w.matrixWorld),i.setFromMatrixPosition(w.target.matrixWorld),C.direction.sub(i),C.direction.transformDirection(b),C.coneCos=Math.cos(w.angle),C.penumbraCos=Math.cos(w.angle*(1-w.penumbra)),C.decay=w.decay,C.shadow=w.castShadow,w.castShadow){var I=w.shadow;C.shadowBias=I.bias,C.shadowRadius=I.radius,C.shadowMapSize=I.mapSize}t.spotShadowMap[m]=O,t.spotShadowMatrix[m]=w.shadow.matrix,t.spot[m]=C,m++}else if(w.isRectAreaLight){var C=e.get(w);C.color.copy(L).multiplyScalar(R),C.position.setFromMatrixPosition(w.matrixWorld),C.position.applyMatrix4(b),a.identity(),r.copy(w.matrixWorld),r.premultiply(b),a.extractRotation(r),C.halfWidth.set(w.width*.5,0,0),C.halfHeight.set(0,w.height*.5,0),C.halfWidth.applyMatrix4(a),C.halfHeight.applyMatrix4(a),t.rectArea[g]=C,g++}else if(w.isPointLight){var C=e.get(w);if(C.position.setFromMatrixPosition(w.matrixWorld),C.position.applyMatrix4(b),C.color.copy(w.color).multiplyScalar(w.intensity),C.distance=w.distance,C.decay=w.decay,C.shadow=w.castShadow,w.castShadow){var I=w.shadow;C.shadowBias=I.bias,C.shadowRadius=I.radius,C.shadowMapSize=I.mapSize,C.shadowCameraNear=I.camera.near,C.shadowCameraFar=I.camera.far}t.pointShadowMap[v]=O,t.pointShadowMatrix[v]=w.shadow.matrix,t.point[v]=C,v++}else if(w.isHemisphereLight){var C=e.get(w);C.direction.setFromMatrixPosition(w.matrixWorld),C.direction.transformDirection(b),C.direction.normalize(),C.skyColor.copy(w.color).multiplyScalar(R),C.groundColor.copy(w.groundColor).multiplyScalar(R),t.hemi[y]=C,y++}}t.ambient[0]=u,t.ambient[1]=h,t.ambient[2]=d;var N=t.hash;(N.directionalLength!==p||N.pointLength!==v||N.spotLength!==m||N.rectAreaLength!==g||N.hemiLength!==y||N.shadowsLength!==l.length)&&(t.directional.length=p,t.spot.length=m,t.rectArea.length=g,t.point.length=v,t.hemi.length=y,N.directionalLength=p,N.pointLength=v,N.spotLength=m,N.rectAreaLength=g,N.hemiLength=y,N.shadowsLength=l.length,t.version=gg++)}return{setup:o,state:t}}function $l(){var e=new yg,t=[],n=[];function i(){t.length=0,n.length=0}function r(l){t.push(l)}function a(l){n.push(l)}function o(l){e.setup(t,n,l)}var s={lightsArray:t,shadowsArray:n,lights:e};return{init:i,state:s,setupLights:o,pushLight:r,pushShadow:a}}function bg(){var e={};function t(r){var a=r.target;a.removeEventListener("dispose",t),delete e[a.id]}function n(r,a){var o;return e[r.id]===void 0?(o=new $l,e[r.id]={},e[r.id][a.id]=o,r.addEventListener("dispose",t)):e[r.id][a.id]===void 0?(o=new $l,e[r.id][a.id]=o):o=e[r.id][a.id],o}function i(){e={}}return{get:n,dispose:i}}function Yn(e){Oe.call(this),this.type="MeshDepthMaterial",this.depthPacking=Tu,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.setValues(e)}Yn.prototype=Object.create(Oe.prototype);Yn.prototype.constructor=Yn;Yn.prototype.isMeshDepthMaterial=!0;Yn.prototype.copy=function(e){return Oe.prototype.copy.call(this,e),this.depthPacking=e.depthPacking,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this};function Xn(e){Oe.call(this),this.type="MeshDistanceMaterial",this.referencePosition=new E,this.nearDistance=1,this.farDistance=1e3,this.skinning=!1,this.morphTargets=!1,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.fog=!1,this.lights=!1,this.setValues(e)}Xn.prototype=Object.create(Oe.prototype);Xn.prototype.constructor=Xn;Xn.prototype.isMeshDistanceMaterial=!0;Xn.prototype.copy=function(e){return Oe.prototype.copy.call(this,e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this};function zu(e,t,n){for(var i=new Uo,r=new Me,a=new j,o=new j(n,n),s=new E,l=new E,c=1,u=2,h=(c|u)+1,d=new Array(h),f=new Array(h),p={},v={0:vt,1:br,2:xr},m=[new E(1,0,0),new E(-1,0,0),new E(0,0,1),new E(0,0,-1),new E(0,1,0),new E(0,-1,0)],g=[new E(0,1,0),new E(0,1,0),new E(0,1,0),new E(0,1,0),new E(0,0,1),new E(0,0,-1)],y=[new et,new et,new et,new et,new et,new et],b=0;b!==h;++b){var _=(b&c)!==0,w=(b&u)!==0,L=new Yn({depthPacking:Au,morphTargets:_,skinning:w});d[b]=L;var R=new Xn({morphTargets:_,skinning:w});f[b]=R}var k=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Ws,this.render=function(C,I,N){if(k.enabled!==!1&&!(k.autoUpdate===!1&&k.needsUpdate===!1)&&C.length!==0){var H=e.getRenderTarget(),G=e.getActiveCubeFace(),X=e.getActiveMipmapLevel(),Z=e.state;Z.setBlending(ei),Z.buffers.color.setClear(1,1,1,1),Z.buffers.depth.setTest(!0),Z.setScissorTest(!1);for(var V,Y=0,J=C.length;Y<J;Y++){var ie=C[Y],ce=ie.shadow,Re=ie&&ie.isPointLight;if(ce===void 0){console.warn("THREE.WebGLShadowMap:",ie,"has no shadow.");continue}var F=ce.camera;if(a.copy(ce.mapSize),a.min(o),Re){var ue=a.x,K=a.y;y[0].set(ue*2,K,ue,K),y[1].set(0,K,ue,K),y[2].set(ue*3,K,ue,K),y[3].set(ue,K,ue,K),y[4].set(ue*3,0,ue,K),y[5].set(ue,0,ue,K),a.x*=4,a.y*=2}if(ce.map===null){var be={minFilter:Et,magFilter:Et,format:_n};ce.map=new wn(a.x,a.y,be),ce.map.texture.name=ie.name+".shadowMap",F.updateProjectionMatrix()}ce.isSpotLightShadow&&ce.update(ie);var xe=ce.map,Ne=ce.matrix;l.setFromMatrixPosition(ie.matrixWorld),F.position.copy(l),Re?(V=6,Ne.makeTranslation(-l.x,-l.y,-l.z)):(V=1,s.setFromMatrixPosition(ie.target.matrixWorld),F.lookAt(s),F.updateMatrixWorld(),Ne.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),Ne.multiply(F.projectionMatrix),Ne.multiply(F.matrixWorldInverse)),e.setRenderTarget(xe),e.clear();for(var A=0;A<V;A++){if(Re){s.copy(F.position),s.add(m[A]),F.up.copy(g[A]),F.lookAt(s),F.updateMatrixWorld();var M=y[A];Z.viewport(M)}r.multiplyMatrices(F.projectionMatrix,F.matrixWorldInverse),i.setFromMatrix(r),z(I,N,F,Re)}}k.needsUpdate=!1,e.setRenderTarget(H,G,X)}};function O(C,I,N,H,G,X){var Z=C.geometry,V=null,Y=d,J=C.customDepthMaterial;if(N&&(Y=f,J=C.customDistanceMaterial),J)V=J;else{var ie=!1;I.morphTargets&&(Z&&Z.isBufferGeometry?ie=Z.morphAttributes&&Z.morphAttributes.position&&Z.morphAttributes.position.length>0:Z&&Z.isGeometry&&(ie=Z.morphTargets&&Z.morphTargets.length>0)),C.isSkinnedMesh&&I.skinning===!1&&console.warn("THREE.WebGLShadowMap: THREE.SkinnedMesh with material.skinning set to false:",C);var ce=C.isSkinnedMesh&&I.skinning,Re=0;ie&&(Re|=c),ce&&(Re|=u),V=Y[Re]}if(e.localClippingEnabled&&I.clipShadows===!0&&I.clippingPlanes.length!==0){var F=V.uuid,ue=I.uuid,K=p[F];K===void 0&&(K={},p[F]=K);var be=K[ue];be===void 0&&(be=V.clone(),K[ue]=be),V=be}return V.visible=I.visible,V.wireframe=I.wireframe,V.side=I.shadowSide!=null?I.shadowSide:v[I.side],V.clipShadows=I.clipShadows,V.clippingPlanes=I.clippingPlanes,V.clipIntersection=I.clipIntersection,V.wireframeLinewidth=I.wireframeLinewidth,V.linewidth=I.linewidth,N&&V.isMeshDistanceMaterial&&(V.referencePosition.copy(H),V.nearDistance=G,V.farDistance=X),V}function z(C,I,N,H){if(C.visible!==!1){var G=C.layers.test(I.layers);if(G&&(C.isMesh||C.isLine||C.isPoints)&&C.castShadow&&(!C.frustumCulled||i.intersectsObject(C))){C.modelViewMatrix.multiplyMatrices(N.matrixWorldInverse,C.matrixWorld);var X=t.update(C),Z=C.material;if(Array.isArray(Z))for(var V=X.groups,Y=0,J=V.length;Y<J;Y++){var ie=V[Y],ce=Z[ie.materialIndex];if(ce&&ce.visible){var Re=O(C,ce,H,l,N.near,N.far);e.renderBufferDirect(N,null,X,Re,C,ie)}}else if(Z.visible){var Re=O(C,Z,H,l,N.near,N.far);e.renderBufferDirect(N,null,X,Re,C,null)}}for(var F=C.children,ue=0,K=F.length;ue<K;ue++)z(F[ue],I,N,H)}}}function xg(e,t,n,i){function r(){var D=!1,se=new et,pe=null,Ce=new et(0,0,0,0);return{setMask:function(me){pe!==me&&!D&&(e.colorMask(me,me,me,me),pe=me)},setLocked:function(me){D=me},setClear:function(me,je,Ke,Je,mt){mt===!0&&(me*=Je,je*=Je,Ke*=Je),se.set(me,je,Ke,Je),Ce.equals(se)===!1&&(e.clearColor(me,je,Ke,Je),Ce.copy(se))},reset:function(){D=!1,pe=null,Ce.set(-1,0,0,0)}}}function a(){var D=!1,se=null,pe=null,Ce=null;return{setTest:function(me){me?Ne(2929):A(2929)},setMask:function(me){se!==me&&!D&&(e.depthMask(me),se=me)},setFunc:function(me){if(pe!==me){if(me)switch(me){case Pc:e.depthFunc(512);break;case Oc:e.depthFunc(519);break;case Dc:e.depthFunc(513);break;case ro:e.depthFunc(515);break;case kc:e.depthFunc(514);break;case Nc:e.depthFunc(518);break;case Bc:e.depthFunc(516);break;case zc:e.depthFunc(517);break;default:e.depthFunc(515)}else e.depthFunc(515);pe=me}},setLocked:function(me){D=me},setClear:function(me){Ce!==me&&(e.clearDepth(me),Ce=me)},reset:function(){D=!1,se=null,pe=null,Ce=null}}}function o(){var D=!1,se=null,pe=null,Ce=null,me=null,je=null,Ke=null,Je=null,mt=null;return{setTest:function(Xe){Xe?Ne(2960):A(2960)},setMask:function(Xe){se!==Xe&&!D&&(e.stencilMask(Xe),se=Xe)},setFunc:function(Xe,Nt,Bt){(pe!==Xe||Ce!==Nt||me!==Bt)&&(e.stencilFunc(Xe,Nt,Bt),pe=Xe,Ce=Nt,me=Bt)},setOp:function(Xe,Nt,Bt){(je!==Xe||Ke!==Nt||Je!==Bt)&&(e.stencilOp(Xe,Nt,Bt),je=Xe,Ke=Nt,Je=Bt)},setLocked:function(Xe){D=Xe},setClear:function(Xe){mt!==Xe&&(e.clearStencil(Xe),mt=Xe)},reset:function(){D=!1,se=null,pe=null,Ce=null,me=null,je=null,Ke=null,Je=null,mt=null}}}var s=new r,l=new a,c=new o,u=e.getParameter(34921),h=new Uint8Array(u),d=new Uint8Array(u),f=new Uint8Array(u),p={},v=null,m=null,g=null,y=null,b=null,_=null,w=null,L=null,R=null,k=null,O=!1,z=null,C=null,I=null,N=null,H=null,G=e.getParameter(35661),X=!1,Z=0,V=e.getParameter(7938);V.indexOf("WebGL")!==-1?(Z=parseFloat(/^WebGL\ ([0-9])/.exec(V)[1]),X=Z>=1):V.indexOf("OpenGL ES")!==-1&&(Z=parseFloat(/^OpenGL\ ES\ ([0-9])/.exec(V)[1]),X=Z>=2);var Y=null,J={},ie=new et,ce=new et;function Re(D,se,pe){var Ce=new Uint8Array(4),me=e.createTexture();e.bindTexture(D,me),e.texParameteri(D,10241,9728),e.texParameteri(D,10240,9728);for(var je=0;je<pe;je++)e.texImage2D(se+je,0,6408,1,1,0,6408,5121,Ce);return me}var F={};F[3553]=Re(3553,3553,1),F[34067]=Re(34067,34069,6),s.setClear(0,0,0,1),l.setClear(1),c.setClear(0),Ne(2929),l.setFunc(ro),he(!1),ee(gs),Ne(2884),Q(ei);function ue(){for(var D=0,se=h.length;D<se;D++)h[D]=0}function K(D){be(D,0)}function be(D,se){if(h[D]=1,d[D]===0&&(e.enableVertexAttribArray(D),d[D]=1),f[D]!==se){var pe=i.isWebGL2?e:t.get("ANGLE_instanced_arrays");pe[i.isWebGL2?"vertexAttribDivisor":"vertexAttribDivisorANGLE"](D,se),f[D]=se}}function xe(){for(var D=0,se=d.length;D!==se;++D)d[D]!==h[D]&&(e.disableVertexAttribArray(D),d[D]=0)}function Ne(D){p[D]!==!0&&(e.enable(D),p[D]=!0)}function A(D){p[D]!==!1&&(e.disable(D),p[D]=!1)}function M(){if(v===null&&(v=[],t.get("WEBGL_compressed_texture_pvrtc")||t.get("WEBGL_compressed_texture_s3tc")||t.get("WEBGL_compressed_texture_etc1")||t.get("WEBGL_compressed_texture_astc")))for(var D=e.getParameter(34467),se=0;se<D.length;se++)v.push(D[se]);return v}function W(D){return m!==D?(e.useProgram(D),m=D,!0):!1}function Q(D,se,pe,Ce,me,je,Ke,Je){if(D===ei){g&&(A(3042),g=!1);return}if(g||(Ne(3042),g=!0),D!==Zs){if(D!==y||Je!==O){if((b!==Qn||L!==Qn)&&(e.blendEquation(32774),b=Qn,L=Qn),Je)switch(D){case ti:e.blendFuncSeparate(1,771,1,771);break;case to:e.blendFunc(1,1);break;case no:e.blendFuncSeparate(0,0,769,771);break;case io:e.blendFuncSeparate(0,768,0,770);break;default:console.error("THREE.WebGLState: Invalid blending: ",D);break}else switch(D){case ti:e.blendFuncSeparate(770,771,1,771);break;case to:e.blendFunc(770,1);break;case no:e.blendFunc(0,769);break;case io:e.blendFunc(0,768);break;default:console.error("THREE.WebGLState: Invalid blending: ",D);break}_=null,w=null,R=null,k=null,y=D,O=Je}return}me=me||se,je=je||pe,Ke=Ke||Ce,(se!==b||me!==L)&&(e.blendEquationSeparate(n.convert(se),n.convert(me)),b=se,L=me),(pe!==_||Ce!==w||je!==R||Ke!==k)&&(e.blendFuncSeparate(n.convert(pe),n.convert(Ce),n.convert(je),n.convert(Ke)),_=pe,w=Ce,R=je,k=Ke),y=D,O=null}function _e(D,se){D.side===xr?A(2884):Ne(2884);var pe=D.side===vt;se&&(pe=!pe),he(pe),D.blending===ti&&D.transparent===!1?Q(ei):Q(D.blending,D.blendEquation,D.blendSrc,D.blendDst,D.blendEquationAlpha,D.blendSrcAlpha,D.blendDstAlpha,D.premultipliedAlpha),l.setFunc(D.depthFunc),l.setTest(D.depthTest),l.setMask(D.depthWrite),s.setMask(D.colorWrite);var Ce=D.stencilWrite;c.setTest(Ce),Ce&&(c.setFunc(D.stencilFunc,D.stencilRef,D.stencilMask),c.setOp(D.stencilFail,D.stencilZFail,D.stencilZPass)),re(D.polygonOffset,D.polygonOffsetFactor,D.polygonOffsetUnits)}function he(D){z!==D&&(D?e.frontFace(2304):e.frontFace(2305),z=D)}function ee(D){D!==yc?(Ne(2884),D!==C&&(D===gs?e.cullFace(1029):D===bc?e.cullFace(1028):e.cullFace(1032))):A(2884),C=D}function B(D){D!==I&&(X&&e.lineWidth(D),I=D)}function re(D,se,pe){D?(Ne(32823),(N!==se||H!==pe)&&(e.polygonOffset(se,pe),N=se,H=pe)):A(32823)}function Se(D){D?Ne(3089):A(3089)}function Le(D){D===void 0&&(D=33984+G-1),Y!==D&&(e.activeTexture(D),Y=D)}function Ue(D,se){Y===null&&Le();var pe=J[Y];pe===void 0&&(pe={type:void 0,texture:void 0},J[Y]=pe),(pe.type!==D||pe.texture!==se)&&(e.bindTexture(D,se||F[D]),pe.type=D,pe.texture=se)}function Ee(){try{e.compressedTexImage2D.apply(e,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function it(){try{e.texImage2D.apply(e,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function ft(){try{e.texImage3D.apply(e,arguments)}catch(D){console.error("THREE.WebGLState:",D)}}function Tt(D){ie.equals(D)===!1&&(e.scissor(D.x,D.y,D.z,D.w),ie.copy(D))}function kt(D){ce.equals(D)===!1&&(e.viewport(D.x,D.y,D.z,D.w),ce.copy(D))}function We(){for(var D=0;D<d.length;D++)d[D]===1&&(e.disableVertexAttribArray(D),d[D]=0);p={},v=null,Y=null,J={},m=null,y=null,z=null,C=null,s.reset(),l.reset(),c.reset()}return{buffers:{color:s,depth:l,stencil:c},initAttributes:ue,enableAttribute:K,enableAttributeAndDivisor:be,disableUnusedAttributes:xe,enable:Ne,disable:A,getCompressedTextureFormats:M,useProgram:W,setBlending:Q,setMaterial:_e,setFlipSided:he,setCullFace:ee,setLineWidth:B,setPolygonOffset:re,setScissorTest:Se,activeTexture:Le,bindTexture:Ue,compressedTexImage2D:Ee,texImage2D:it,texImage3D:ft,scissor:Tt,viewport:kt,reset:We}}function _g(e,t,n,i,r,a,o){var s={},l,c=typeof OffscreenCanvas<"u";function u(A,M){return c?new OffscreenCanvas(A,M):document.createElementNS("http://www.w3.org/1999/xhtml","canvas")}function h(A,M,W,Q){var _e=1;if((A.width>Q||A.height>Q)&&(_e=Q/Math.max(A.width,A.height)),_e<1||M===!0)if(typeof HTMLImageElement<"u"&&A instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&A instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&A instanceof ImageBitmap){var he=M?Pe.floorPowerOfTwo:Math.floor,ee=he(_e*A.width),B=he(_e*A.height);l===void 0&&(l=u(ee,B));var re=W?u(ee,B):l;re.width=ee,re.height=B;var Se=re.getContext("2d");return Se.drawImage(A,0,0,ee,B),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+A.width+"x"+A.height+") to ("+ee+"x"+B+")."),re}else return"data"in A&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+A.width+"x"+A.height+")."),A;return A}function d(A){return Pe.isPowerOfTwo(A.width)&&Pe.isPowerOfTwo(A.height)}function f(A){return r.isWebGL2?!1:A.wrapS!==Ot||A.wrapT!==Ot||A.minFilter!==Et&&A.minFilter!==Lt}function p(A,M){return A.generateMipmaps&&M&&A.minFilter!==Et&&A.minFilter!==Lt}function v(A,M,W,Q){e.generateMipmap(A);var _e=i.get(M);_e.__maxMipLevel=Math.log(Math.max(W,Q))*Math.LOG2E}function m(A,M){if(!r.isWebGL2)return A;var W=A;return A===6403&&(M===5126&&(W=33326),M===5131&&(W=33325),M===5121&&(W=33321)),A===6407&&(M===5126&&(W=34837),M===5131&&(W=34843),M===5121&&(W=32849)),A===6408&&(M===5126&&(W=34836),M===5131&&(W=34842),M===5121&&(W=32856)),W===33325||W===33326||W===34842||W===34836?t.get("EXT_color_buffer_float"):(W===34843||W===34837)&&console.warn("THREE.WebGLRenderer: Floating point textures with RGB format not supported. Please use RGBA instead."),W}function g(A){return A===Et||A===No||A===Bo?9728:9729}function y(A){var M=A.target;M.removeEventListener("dispose",y),_(M),M.isVideoTexture&&delete s[M.id],o.memory.textures--}function b(A){var M=A.target;M.removeEventListener("dispose",b),w(M),o.memory.textures--}function _(A){var M=i.get(A);M.__webglInit!==void 0&&(e.deleteTexture(M.__webglTexture),i.remove(A))}function w(A){var M=i.get(A),W=i.get(A.texture);if(A){if(W.__webglTexture!==void 0&&e.deleteTexture(W.__webglTexture),A.depthTexture&&A.depthTexture.dispose(),A.isWebGLRenderTargetCube)for(var Q=0;Q<6;Q++)e.deleteFramebuffer(M.__webglFramebuffer[Q]),M.__webglDepthbuffer&&e.deleteRenderbuffer(M.__webglDepthbuffer[Q]);else e.deleteFramebuffer(M.__webglFramebuffer),M.__webglDepthbuffer&&e.deleteRenderbuffer(M.__webglDepthbuffer);i.remove(A.texture),i.remove(A)}}var L=0;function R(){L=0}function k(){var A=L;return A>=r.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+A+" texture units while this GPU supports only "+r.maxTextures),L+=1,A}function O(A,M){var W=i.get(A);if(A.isVideoTexture&&ue(A),A.version>0&&W.__version!==A.version){var Q=A.image;if(Q===void 0)console.warn("THREE.WebGLRenderer: Texture marked for update but image is undefined");else if(Q.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{X(W,A,M);return}}n.activeTexture(33984+M),n.bindTexture(3553,W.__webglTexture)}function z(A,M){var W=i.get(A);if(A.version>0&&W.__version!==A.version){X(W,A,M);return}n.activeTexture(33984+M),n.bindTexture(35866,W.__webglTexture)}function C(A,M){var W=i.get(A);if(A.version>0&&W.__version!==A.version){X(W,A,M);return}n.activeTexture(33984+M),n.bindTexture(32879,W.__webglTexture)}function I(A,M){var W=i.get(A);if(A.image.length===6)if(A.version>0&&W.__version!==A.version){G(W,A),n.activeTexture(33984+M),n.bindTexture(34067,W.__webglTexture),e.pixelStorei(37440,A.flipY);for(var Q=A&&A.isCompressedTexture,_e=A.image[0]&&A.image[0].isDataTexture,he=[],ee=0;ee<6;ee++)!Q&&!_e?he[ee]=h(A.image[ee],!1,!0,r.maxCubemapSize):he[ee]=_e?A.image[ee].image:A.image[ee];var B=he[0],re=d(B)||r.isWebGL2,Se=a.convert(A.format),Le=a.convert(A.type),Ue=m(Se,Le);H(34067,A,re);for(var ee=0;ee<6;ee++)if(!Q)_e?n.texImage2D(34069+ee,0,Ue,he[ee].width,he[ee].height,0,Se,Le,he[ee].data):n.texImage2D(34069+ee,0,Ue,Se,Le,he[ee]);else for(var Ee,it=he[ee].mipmaps,ft=0,Tt=it.length;ft<Tt;ft++)Ee=it[ft],A.format!==_n&&A.format!==Gn?n.getCompressedTextureFormats().indexOf(Se)>-1?n.compressedTexImage2D(34069+ee,ft,Ue,Ee.width,Ee.height,0,Ee.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .setTextureCube()"):n.texImage2D(34069+ee,ft,Ue,Ee.width,Ee.height,0,Se,Le,Ee.data);Q?W.__maxMipLevel=it.length-1:W.__maxMipLevel=0,p(A,re)&&v(34067,A,B.width,B.height),W.__version=A.version,A.onUpdate&&A.onUpdate(A)}else n.activeTexture(33984+M),n.bindTexture(34067,W.__webglTexture)}function N(A,M){n.activeTexture(33984+M),n.bindTexture(34067,i.get(A).__webglTexture)}function H(A,M,W){var Q;if(W?(e.texParameteri(A,10242,a.convert(M.wrapS)),e.texParameteri(A,10243,a.convert(M.wrapT)),(A===32879||A===35866)&&e.texParameteri(A,32882,a.convert(M.wrapR)),e.texParameteri(A,10240,a.convert(M.magFilter)),e.texParameteri(A,10241,a.convert(M.minFilter))):(e.texParameteri(A,10242,33071),e.texParameteri(A,10243,33071),(A===32879||A===35866)&&e.texParameteri(A,32882,33071),(M.wrapS!==Ot||M.wrapT!==Ot)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),e.texParameteri(A,10240,g(M.magFilter)),e.texParameteri(A,10241,g(M.minFilter)),M.minFilter!==Et&&M.minFilter!==Lt&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),Q=t.get("EXT_texture_filter_anisotropic"),Q){if(M.type===zi&&t.get("OES_texture_float_linear")===null||M.type===Fo&&(r.isWebGL2||t.get("OES_texture_half_float_linear"))===null)return;(M.anisotropy>1||i.get(M).__currentAnisotropy)&&(e.texParameterf(A,Q.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(M.anisotropy,r.getMaxAnisotropy())),i.get(M).__currentAnisotropy=M.anisotropy)}}function G(A,M){A.__webglInit===void 0&&(A.__webglInit=!0,M.addEventListener("dispose",y),A.__webglTexture=e.createTexture(),o.memory.textures++)}function X(A,M,W){var Q=3553;M.isDataTexture2DArray&&(Q=35866),M.isDataTexture3D&&(Q=32879),G(A,M),n.activeTexture(33984+W),n.bindTexture(Q,A.__webglTexture),e.pixelStorei(37440,M.flipY),e.pixelStorei(37441,M.premultiplyAlpha),e.pixelStorei(3317,M.unpackAlignment);var _e=f(M)&&d(M.image)===!1,he=h(M.image,_e,!1,r.maxTextureSize),ee=d(he)||r.isWebGL2,B=a.convert(M.format),re=a.convert(M.type),Se=m(B,re);H(Q,M,ee);var Le,Ue=M.mipmaps;if(M.isDepthTexture){if(Se=6402,M.type===zi){if(!r.isWebGL2)throw new Error("Float Depth Texture only supported in WebGL2.0");Se=36012}else r.isWebGL2&&(Se=33189);M.format===ni&&Se===6402&&M.type!==Pr&&M.type!==tl&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),M.type=Pr,re=a.convert(M.type)),M.format===Fi&&(Se=34041,M.type!==Or&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),M.type=Or,re=a.convert(M.type))),n.texImage2D(3553,0,Se,he.width,he.height,0,B,re,null)}else if(M.isDataTexture)if(Ue.length>0&&ee){for(var Ee=0,it=Ue.length;Ee<it;Ee++)Le=Ue[Ee],n.texImage2D(3553,Ee,Se,Le.width,Le.height,0,B,re,Le.data);M.generateMipmaps=!1,A.__maxMipLevel=Ue.length-1}else n.texImage2D(3553,0,Se,he.width,he.height,0,B,re,he.data),A.__maxMipLevel=0;else if(M.isCompressedTexture){for(var Ee=0,it=Ue.length;Ee<it;Ee++)Le=Ue[Ee],M.format!==_n&&M.format!==Gn?n.getCompressedTextureFormats().indexOf(B)>-1?n.compressedTexImage2D(3553,Ee,Se,Le.width,Le.height,0,Le.data):console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()"):n.texImage2D(3553,Ee,Se,Le.width,Le.height,0,B,re,Le.data);A.__maxMipLevel=Ue.length-1}else if(M.isDataTexture2DArray)n.texImage3D(35866,0,Se,he.width,he.height,he.depth,0,B,re,he.data),A.__maxMipLevel=0;else if(M.isDataTexture3D)n.texImage3D(32879,0,Se,he.width,he.height,he.depth,0,B,re,he.data),A.__maxMipLevel=0;else if(Ue.length>0&&ee){for(var Ee=0,it=Ue.length;Ee<it;Ee++)Le=Ue[Ee],n.texImage2D(3553,Ee,Se,B,re,Le);M.generateMipmaps=!1,A.__maxMipLevel=Ue.length-1}else n.texImage2D(3553,0,Se,B,re,he),A.__maxMipLevel=0;p(M,ee)&&v(3553,M,he.width,he.height),A.__version=M.version,M.onUpdate&&M.onUpdate(M)}function Z(A,M,W,Q){var _e=a.convert(M.texture.format),he=a.convert(M.texture.type),ee=m(_e,he);n.texImage2D(Q,0,ee,M.width,M.height,0,_e,he,null),e.bindFramebuffer(36160,A),e.framebufferTexture2D(36160,W,Q,i.get(M.texture).__webglTexture,0),e.bindFramebuffer(36160,null)}function V(A,M,W){if(e.bindRenderbuffer(36161,A),M.depthBuffer&&!M.stencilBuffer){if(W){var Q=F(M);e.renderbufferStorageMultisample(36161,Q,33189,M.width,M.height)}else e.renderbufferStorage(36161,33189,M.width,M.height);e.framebufferRenderbuffer(36160,36096,36161,A)}else if(M.depthBuffer&&M.stencilBuffer){if(W){var Q=F(M);e.renderbufferStorageMultisample(36161,Q,35056,M.width,M.height)}else e.renderbufferStorage(36161,34041,M.width,M.height);e.framebufferRenderbuffer(36160,33306,36161,A)}else{var _e=a.convert(M.texture.format),he=a.convert(M.texture.type),ee=m(_e,he);if(W){var Q=F(M);e.renderbufferStorageMultisample(36161,Q,ee,M.width,M.height)}else e.renderbufferStorage(36161,ee,M.width,M.height)}e.bindRenderbuffer(36161,null)}function Y(A,M){var W=M&&M.isWebGLRenderTargetCube;if(W)throw new Error("Depth Texture with cube render targets is not supported");if(e.bindFramebuffer(36160,A),!(M.depthTexture&&M.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");(!i.get(M.depthTexture).__webglTexture||M.depthTexture.image.width!==M.width||M.depthTexture.image.height!==M.height)&&(M.depthTexture.image.width=M.width,M.depthTexture.image.height=M.height,M.depthTexture.needsUpdate=!0),O(M.depthTexture,0);var Q=i.get(M.depthTexture).__webglTexture;if(M.depthTexture.format===ni)e.framebufferTexture2D(36160,36096,3553,Q,0);else if(M.depthTexture.format===Fi)e.framebufferTexture2D(36160,33306,3553,Q,0);else throw new Error("Unknown depthTexture format")}function J(A){var M=i.get(A),W=A.isWebGLRenderTargetCube===!0;if(A.depthTexture){if(W)throw new Error("target.depthTexture not supported in Cube render targets");Y(M.__webglFramebuffer,A)}else if(W){M.__webglDepthbuffer=[];for(var Q=0;Q<6;Q++)e.bindFramebuffer(36160,M.__webglFramebuffer[Q]),M.__webglDepthbuffer[Q]=e.createRenderbuffer(),V(M.__webglDepthbuffer[Q],A)}else e.bindFramebuffer(36160,M.__webglFramebuffer),M.__webglDepthbuffer=e.createRenderbuffer(),V(M.__webglDepthbuffer,A);e.bindFramebuffer(36160,null)}function ie(A){var M=i.get(A),W=i.get(A.texture);A.addEventListener("dispose",b),W.__webglTexture=e.createTexture(),o.memory.textures++;var Q=A.isWebGLRenderTargetCube===!0,_e=A.isWebGLMultisampleRenderTarget===!0,he=d(A)||r.isWebGL2;if(Q){M.__webglFramebuffer=[];for(var ee=0;ee<6;ee++)M.__webglFramebuffer[ee]=e.createFramebuffer()}else if(M.__webglFramebuffer=e.createFramebuffer(),_e)if(r.isWebGL2){M.__webglMultisampledFramebuffer=e.createFramebuffer(),M.__webglColorRenderbuffer=e.createRenderbuffer(),e.bindRenderbuffer(36161,M.__webglColorRenderbuffer);var B=a.convert(A.texture.format),re=a.convert(A.texture.type),Se=m(B,re),Le=F(A);e.renderbufferStorageMultisample(36161,Le,Se,A.width,A.height),e.bindFramebuffer(36160,M.__webglMultisampledFramebuffer),e.framebufferRenderbuffer(36160,36064,36161,M.__webglColorRenderbuffer),e.bindRenderbuffer(36161,null),A.depthBuffer&&(M.__webglDepthRenderbuffer=e.createRenderbuffer(),V(M.__webglDepthRenderbuffer,A,!0)),e.bindFramebuffer(36160,null)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.");if(Q){n.bindTexture(34067,W.__webglTexture),H(34067,A.texture,he);for(var ee=0;ee<6;ee++)Z(M.__webglFramebuffer[ee],A,36064,34069+ee);p(A.texture,he)&&v(34067,A.texture,A.width,A.height),n.bindTexture(34067,null)}else n.bindTexture(3553,W.__webglTexture),H(3553,A.texture,he),Z(M.__webglFramebuffer,A,36064,3553),p(A.texture,he)&&v(3553,A.texture,A.width,A.height),n.bindTexture(3553,null);A.depthBuffer&&J(A)}function ce(A){var M=A.texture,W=d(A)||r.isWebGL2;if(p(M,W)){var Q=A.isWebGLRenderTargetCube?34067:3553,_e=i.get(M).__webglTexture;n.bindTexture(Q,_e),v(Q,M,A.width,A.height),n.bindTexture(Q,null)}}function Re(A){if(A.isWebGLMultisampleRenderTarget)if(r.isWebGL2){var M=i.get(A);e.bindFramebuffer(36008,M.__webglMultisampledFramebuffer),e.bindFramebuffer(36009,M.__webglFramebuffer);var W=A.width,Q=A.height,_e=16384;A.depthBuffer&&(_e|=256),A.stencilBuffer&&(_e|=1024),e.blitFramebuffer(0,0,W,Q,0,0,W,Q,_e,9728)}else console.warn("THREE.WebGLRenderer: WebGLMultisampleRenderTarget can only be used with WebGL2.")}function F(A){return r.isWebGL2&&A.isWebGLMultisampleRenderTarget?Math.min(r.maxSamples,A.samples):0}function ue(A){var M=A.id,W=o.render.frame;s[M]!==W&&(s[M]=W,A.update())}var K=!1,be=!1;function xe(A,M){A&&A.isWebGLRenderTarget&&(K===!1&&(console.warn("THREE.WebGLTextures.safeSetTexture2D: don't use render targets as textures. Use their .texture property instead."),K=!0),A=A.texture),O(A,M)}function Ne(A,M){A&&A.isWebGLRenderTargetCube&&(be===!1&&(console.warn("THREE.WebGLTextures.safeSetTextureCube: don't use cube render targets as textures. Use their .texture property instead."),be=!0),A=A.texture),A&&A.isCubeTexture||Array.isArray(A.image)&&A.image.length===6?I(A,M):N(A,M)}this.allocateTextureUnit=k,this.resetTextureUnits=R,this.setTexture2D=O,this.setTexture2DArray=z,this.setTexture3D=C,this.setTextureCube=I,this.setTextureCubeDynamic=N,this.setupRenderTarget=ie,this.updateRenderTargetMipmap=ce,this.updateMultisampleRenderTarget=Re,this.safeSetTexture2D=xe,this.safeSetTextureCube=Ne}function Fu(e,t,n){function i(r){var a;if(r===Rn)return 10497;if(r===Ot)return 33071;if(r===ii)return 33648;if(r===Et)return 9728;if(r===No)return 9984;if(r===Bo)return 9986;if(r===Lt)return 9729;if(r===el)return 9985;if(r===Ra)return 9987;if(r===zo)return 5121;if(r===Zc)return 32819;if(r===qc)return 32820;if(r===Jc)return 33635;if(r===jc)return 5120;if(r===Yc)return 5122;if(r===Pr)return 5123;if(r===Xc)return 5124;if(r===tl)return 5125;if(r===zi)return 5126;if(r===Fo){if(n.isWebGL2)return 5131;if(a=t.get("OES_texture_half_float"),a!==null)return a.HALF_FLOAT_OES}if(r===Qc)return 6406;if(r===Gn)return 6407;if(r===_n)return 6408;if(r===$c)return 6409;if(r===Kc)return 6410;if(r===ni)return 6402;if(r===Fi)return 34041;if(r===eu)return 6403;if(r===Qn)return 32774;if(r===_c)return 32778;if(r===wc)return 32779;if(r===Ec)return 0;if(r===Mc)return 1;if(r===Sc)return 768;if(r===Tc)return 769;if(r===qs)return 770;if(r===Js)return 771;if(r===Ac)return 772;if(r===Lc)return 773;if(r===Cc)return 774;if(r===Rc)return 775;if(r===Ic)return 776;if((r===ys||r===bs||r===xs||r===_s)&&(a=t.get("WEBGL_compressed_texture_s3tc"),a!==null)){if(r===ys)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===bs)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===xs)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===_s)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}if((r===ws||r===Es||r===Ms||r===Ss)&&(a=t.get("WEBGL_compressed_texture_pvrtc"),a!==null)){if(r===ws)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===Es)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===Ms)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===Ss)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}if(r===tu&&(a=t.get("WEBGL_compressed_texture_etc1"),a!==null))return a.COMPRESSED_RGB_ETC1_WEBGL;if((r===nu||r===iu||r===ru||r===au||r===ou||r===su||r===lu||r===cu||r===uu||r===hu||r===du||r===fu||r===pu||r===mu)&&(a=t.get("WEBGL_compressed_texture_astc"),a!==null))return r;if(r===Za||r===qa){if(n.isWebGL2){if(r===Za)return 32775;if(r===qa)return 32776}if(a=t.get("EXT_blend_minmax"),a!==null){if(r===Za)return a.MIN_EXT;if(r===qa)return a.MAX_EXT}}if(r===Or){if(n.isWebGL2)return 34042;if(a=t.get("WEBGL_depth_texture"),a!==null)return a.UNSIGNED_INT_24_8_WEBGL}return 0}return{convert:i}}function ji(){ae.call(this),this.type="Group"}ji.prototype=Object.assign(Object.create(ae.prototype),{constructor:ji,isGroup:!0});function jr(e){ct.call(this),this.cameras=e||[]}jr.prototype=Object.assign(Object.create(ct.prototype),{constructor:jr,isArrayCamera:!0});var Kl=new E,ec=new E;function Hu(e,t,n){Kl.setFromMatrixPosition(t.matrixWorld),ec.setFromMatrixPosition(n.matrixWorld);var i=Kl.distanceTo(ec),r=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=r[14]/(r[10]-1),s=r[14]/(r[10]+1),l=(r[9]+1)/r[5],c=(r[9]-1)/r[5],u=(r[8]-1)/r[0],h=(a[8]+1)/a[0],d=o*u,f=o*h,p=i/(-u+h),v=p*-u;t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(v),e.translateZ(p),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.getInverse(e.matrixWorld);var m=o+p,g=s+p,y=d-v,b=f+(i-v),_=l*s/g*m,w=c*s/g*m;e.projectionMatrix.makePerspective(y,b,_,w,m,g)}function al(e){var t,n,i=this,r=null,a=null,o=null,s=[],l=new Me,c=new Me,u=1,h="local-floor";typeof window<"u"&&"VRFrameData"in window&&(a=new window.VRFrameData,window.addEventListener("vrdisplaypresentchange",w,!1));var d=new Me,f=new pt,p=new E,v=new ct;v.viewport=new et,v.layers.enable(1);var m=new ct;m.viewport=new et,m.layers.enable(2);var g=new jr([v,m]);g.layers.enable(1),g.layers.enable(2);function y(){return r!==null&&r.isPresenting===!0}var b=new j,_;function w(){if(y()){var C=r.getEyeParameters("left");t=2*C.renderWidth*u,n=C.renderHeight*u,_=e.getPixelRatio(),e.getSize(b),e.setDrawingBufferSize(t,n,1),v.viewport.set(0,0,t/2,n),m.viewport.set(t/2,0,t/2,n),z.start(),i.dispatchEvent({type:"sessionstart"})}else i.enabled&&e.setDrawingBufferSize(b.width,b.height,_),z.stop(),i.dispatchEvent({type:"sessionend"})}var L=[];function R(C){for(var I=navigator.getGamepads&&navigator.getGamepads(),N=0,H=0,G=I.length;N<G;N++){var X=I[N];if(X&&(X.id==="Daydream Controller"||X.id==="Gear VR Controller"||X.id==="Oculus Go Controller"||X.id==="OpenVR Gamepad"||X.id.startsWith("Oculus Touch")||X.id.startsWith("HTC Vive Focus")||X.id.startsWith("Spatial Controller"))){if(H===C)return X;H++}}}function k(){for(var C=0;C<s.length;C++){var I=s[C],N=R(C);if(N!==void 0&&N.pose!==void 0){if(N.pose===null)return;var H=N.pose;H.hasPosition===!1&&I.position.set(.2,-.6,-.05),H.position!==null&&I.position.fromArray(H.position),H.orientation!==null&&I.quaternion.fromArray(H.orientation),I.matrix.compose(I.position,I.quaternion,I.scale),I.matrix.premultiply(l),I.matrix.decompose(I.position,I.quaternion,I.scale),I.matrixWorldNeedsUpdate=!0,I.visible=!0;var G=N.id==="Daydream Controller"?0:1;L[C]===void 0&&(L[C]=!1),L[C]!==N.buttons[G].pressed&&(L[C]=N.buttons[G].pressed,L[C]===!0?I.dispatchEvent({type:"selectstart"}):(I.dispatchEvent({type:"selectend"}),I.dispatchEvent({type:"select"})))}else I.visible=!1}}function O(C,I){I!==null&&I.length===4&&C.set(I[0]*t,I[1]*n,I[2]*t,I[3]*n)}this.enabled=!1,this.getController=function(C){var I=s[C];return I===void 0&&(I=new ji,I.matrixAutoUpdate=!1,I.visible=!1,s[C]=I),I},this.getDevice=function(){return r},this.setDevice=function(C){C!==void 0&&(r=C),z.setContext(C)},this.setFramebufferScaleFactor=function(C){u=C},this.setReferenceSpaceType=function(C){h=C},this.setPoseTarget=function(C){C!==void 0&&(o=C)},this.getCamera=function(C){var I=h==="local-floor"?1.6:0;if(y()===!1)return C.position.set(0,I,0),C.rotation.set(0,0,0),C;if(r.depthNear=C.near,r.depthFar=C.far,r.getFrameData(a),h==="local-floor"){var N=r.stageParameters;N?l.fromArray(N.sittingToStandingTransform):l.makeTranslation(0,I,0)}var H=a.pose,G=o!==null?o:C;G.matrix.copy(l),G.matrix.decompose(G.position,G.quaternion,G.scale),H.orientation!==null&&(f.fromArray(H.orientation),G.quaternion.multiply(f)),H.position!==null&&(f.setFromRotationMatrix(l),p.fromArray(H.position),p.applyQuaternion(f),G.position.add(p)),G.updateMatrixWorld(),v.near=C.near,m.near=C.near,v.far=C.far,m.far=C.far,v.matrixWorldInverse.fromArray(a.leftViewMatrix),m.matrixWorldInverse.fromArray(a.rightViewMatrix),c.getInverse(l),h==="local-floor"&&(v.matrixWorldInverse.multiply(c),m.matrixWorldInverse.multiply(c));var X=G.parent;X!==null&&(d.getInverse(X.matrixWorld),v.matrixWorldInverse.multiply(d),m.matrixWorldInverse.multiply(d)),v.matrixWorld.getInverse(v.matrixWorldInverse),m.matrixWorld.getInverse(m.matrixWorldInverse),v.projectionMatrix.fromArray(a.leftProjectionMatrix),m.projectionMatrix.fromArray(a.rightProjectionMatrix),Hu(g,v,m);var Z=r.getLayers();if(Z.length){var V=Z[0];O(v.viewport,V.leftBounds),O(m.viewport,V.rightBounds)}return k(),g},this.getStandingMatrix=function(){return l},this.isPresenting=y;var z=new rl;this.setAnimationLoop=function(C){z.setAnimationLoop(C),y()&&z.start()},this.submitFrame=function(){y()&&r.submitFrame()},this.dispose=function(){typeof window<"u"&&window.removeEventListener("vrdisplaypresentchange",w)},this.setFrameOfReferenceType=function(){console.warn("THREE.WebVRManager: setFrameOfReferenceType() has been deprecated.")}}Object.assign(al.prototype,pn.prototype);function Uu(e,t){var n=this,i=null,r=null,a="local-floor",o=null,s=[],l=[];function c(){return i!==null&&r!==null}var u=new ct;u.layers.enable(1),u.viewport=new et;var h=new ct;h.layers.enable(2),h.viewport=new et;var d=new jr([u,h]);d.layers.enable(1),d.layers.enable(2),this.enabled=!1,this.getController=function(_){var w=s[_];return w===void 0&&(w=new ji,w.matrixAutoUpdate=!1,w.visible=!1,s[_]=w),w};function f(_){for(var w=0;w<s.length;w++)l[w]===_.inputSource&&s[w].dispatchEvent({type:_.type})}function p(){e.setFramebuffer(null),e.setRenderTarget(e.getRenderTarget()),b.stop(),n.dispatchEvent({type:"sessionend"})}function v(_){r=_,b.setContext(i),b.start(),n.dispatchEvent({type:"sessionstart"})}this.setFramebufferScaleFactor=function(_){},this.setReferenceSpaceType=function(_){a=_},this.getSession=function(){return i},this.setSession=function(_){i=_,i!==null&&(i.addEventListener("select",f),i.addEventListener("selectstart",f),i.addEventListener("selectend",f),i.addEventListener("end",p),i.updateRenderState({baseLayer:new XRWebGLLayer(i,t)}),i.requestReferenceSpace(a).then(v),l=i.inputSources,i.addEventListener("inputsourceschange",function(){l=i.inputSources,console.log(l);for(var w=0;w<s.length;w++){var L=s[w];L.userData.inputSource=l[w]}}))};function m(_,w){w===null?_.matrixWorld.copy(_.matrix):_.matrixWorld.multiplyMatrices(w.matrixWorld,_.matrix),_.matrixWorldInverse.getInverse(_.matrixWorld)}this.getCamera=function(_){if(c()){var w=_.parent,L=d.cameras;m(d,w);for(var R=0;R<L.length;R++)m(L[R],w);_.matrixWorld.copy(d.matrixWorld);for(var k=_.children,R=0,O=k.length;R<O;R++)k[R].updateMatrixWorld(!0);return Hu(d,u,h),d}return _},this.isPresenting=c;var g=null;function y(_,w){if(o=w.getViewerPose(r),o!==null){var L=o.views,R=i.renderState.baseLayer;e.setFramebuffer(R.framebuffer);for(var k=0;k<L.length;k++){var O=L[k],z=R.getViewport(O),C=O.transform.inverse.matrix,I=d.cameras[k];I.matrix.fromArray(C).getInverse(I.matrix),I.projectionMatrix.fromArray(O.projectionMatrix),I.viewport.set(z.x,z.y,z.width,z.height),k===0&&d.matrix.copy(I.matrix)}}for(var k=0;k<s.length;k++){var N=s[k],H=l[k];if(H){var G=w.getPose(H.targetRaySpace,r);if(G!==null){N.matrix.fromArray(G.transform.matrix),N.matrix.decompose(N.position,N.rotation,N.scale),N.visible=!0;continue}}N.visible=!1}g&&g(_)}var b=new rl;b.setAnimationLoop(y),this.setAnimationLoop=function(_){g=_},this.dispose=function(){},this.getStandingMatrix=function(){return console.warn("THREE.WebXRManager: getStandingMatrix() is no longer needed."),new Me},this.getDevice=function(){console.warn("THREE.WebXRManager: getDevice() has been deprecated.")},this.setDevice=function(){console.warn("THREE.WebXRManager: setDevice() has been deprecated.")},this.setFrameOfReferenceType=function(){console.warn("THREE.WebXRManager: setFrameOfReferenceType() has been deprecated.")},this.submitFrame=function(){}}Object.assign(Uu.prototype,pn.prototype);function ol(e){console.log("THREE.WebGLRenderer",gc),e=e||{};var t=e.canvas!==void 0?e.canvas:document.createElementNS("http://www.w3.org/1999/xhtml","canvas"),n=e.context!==void 0?e.context:null,i=e.alpha!==void 0?e.alpha:!1,r=e.depth!==void 0?e.depth:!0,a=e.stencil!==void 0?e.stencil:!0,o=e.antialias!==void 0?e.antialias:!1,s=e.premultipliedAlpha!==void 0?e.premultipliedAlpha:!0,l=e.preserveDrawingBuffer!==void 0?e.preserveDrawingBuffer:!1,c=e.powerPreference!==void 0?e.powerPreference:"default",u=e.failIfMajorPerformanceCaveat!==void 0?e.failIfMajorPerformanceCaveat:!1,h=null,d=null;this.domElement=t,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.gammaFactor=2,this.gammaInput=!1,this.gammaOutput=!1,this.physicallyCorrectLights=!1,this.toneMapping=Qs,this.toneMappingExposure=1,this.toneMappingWhitePoint=1,this.maxMorphTargets=8,this.maxMorphNormals=4;var f=this,p=!1,v=null,m=0,g=0,y=null,b=null,_=-1,w={geometry:null,program:null,wireframe:!1},L=null,R=null,k=new et,O=new et,z=null,C=t.width,I=t.height,N=1,H=new et(0,0,C,I),G=new et(0,0,C,I),X=!1,Z=new Uo,V=new mv,Y=!1,J=!1,ie=new Me,ce=new E;function Re(){return y===null?N:1}var F;try{var ue={alpha:i,depth:r,stencil:a,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:l,powerPreference:c,failIfMajorPerformanceCaveat:u,xrCompatible:!0};if(t.addEventListener("webglcontextlost",kt,!1),t.addEventListener("webglcontextrestored",We,!1),F=n||t.getContext("webgl",ue)||t.getContext("experimental-webgl",ue),F===null)throw t.getContext("webgl")!==null?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.");F.getShaderPrecisionFormat===void 0&&(F.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(x){throw console.error("THREE.WebGLRenderer: "+x.message),x}var K,be,xe,Ne,A,M,W,Q,_e,he,ee,B,re,Se,Le,Ue,Ee;function it(){K=new vv(F),be=new pv(F,K,e),be.isWebGL2||(K.get("WEBGL_depth_texture"),K.get("OES_texture_float"),K.get("OES_texture_half_float"),K.get("OES_texture_half_float_linear"),K.get("OES_standard_derivatives"),K.get("OES_element_index_uint"),K.get("ANGLE_instanced_arrays")),K.get("OES_texture_float_linear"),Ee=new Fu(F,K,be),xe=new xg(F,K,Ee,be),xe.scissor(O.copy(G).multiplyScalar(N).floor()),xe.viewport(k.copy(H).multiplyScalar(N).floor()),Ne=new bv(F),A=new dg,M=new _g(F,K,xe,A,be,Ee,Ne),W=new hv(F),Q=new gv(F,W,Ne),_e=new wv(Q,Ne),Se=new _v(F),he=new hg(f,K,be),ee=new mg,B=new bg,re=new dv(f,xe,_e,s),Le=new fv(F,K,Ne,be),Ue=new yv(F,K,Ne,be),Ne.programs=he.programs,f.capabilities=be,f.extensions=K,f.properties=A,f.renderLists=ee,f.state=xe,f.info=Ne}it();var ft=typeof navigator<"u"&&"xr"in navigator&&"supportsSession"in navigator.xr?new Uu(f,F):new al(f);this.vr=ft;var Tt=new zu(f,_e,be.maxTextureSize);this.shadowMap=Tt,this.getContext=function(){return F},this.getContextAttributes=function(){return F.getContextAttributes()},this.forceContextLoss=function(){var x=K.get("WEBGL_lose_context");x&&x.loseContext()},this.forceContextRestore=function(){var x=K.get("WEBGL_lose_context");x&&x.restoreContext()},this.getPixelRatio=function(){return N},this.setPixelRatio=function(x){x!==void 0&&(N=x,this.setSize(C,I,!1))},this.getSize=function(x){return x===void 0&&(console.warn("WebGLRenderer: .getsize() now requires a Vector2 as an argument"),x=new j),x.set(C,I)},this.setSize=function(x,S,P){if(ft.isPresenting()){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}C=x,I=S,t.width=Math.floor(x*N),t.height=Math.floor(S*N),P!==!1&&(t.style.width=x+"px",t.style.height=S+"px"),this.setViewport(0,0,x,S)},this.getDrawingBufferSize=function(x){return x===void 0&&(console.warn("WebGLRenderer: .getdrawingBufferSize() now requires a Vector2 as an argument"),x=new j),x.set(C*N,I*N).floor()},this.setDrawingBufferSize=function(x,S,P){C=x,I=S,N=P,t.width=Math.floor(x*P),t.height=Math.floor(S*P),this.setViewport(0,0,x,S)},this.getCurrentViewport=function(x){return x===void 0&&(console.warn("WebGLRenderer: .getCurrentViewport() now requires a Vector4 as an argument"),x=new et),x.copy(k)},this.getViewport=function(x){return x.copy(H)},this.setViewport=function(x,S,P,q){x.isVector4?H.set(x.x,x.y,x.z,x.w):H.set(x,S,P,q),xe.viewport(k.copy(H).multiplyScalar(N).floor())},this.getScissor=function(x){return x.copy(G)},this.setScissor=function(x,S,P,q){x.isVector4?G.set(x.x,x.y,x.z,x.w):G.set(x,S,P,q),xe.scissor(O.copy(G).multiplyScalar(N).floor())},this.getScissorTest=function(){return X},this.setScissorTest=function(x){xe.setScissorTest(X=x)},this.getClearColor=function(){return re.getClearColor()},this.setClearColor=function(){re.setClearColor.apply(re,arguments)},this.getClearAlpha=function(){return re.getClearAlpha()},this.setClearAlpha=function(){re.setClearAlpha.apply(re,arguments)},this.clear=function(x,S,P){var q=0;(x===void 0||x)&&(q|=16384),(S===void 0||S)&&(q|=256),(P===void 0||P)&&(q|=1024),F.clear(q)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",kt,!1),t.removeEventListener("webglcontextrestored",We,!1),ee.dispose(),B.dispose(),A.dispose(),_e.dispose(),ft.dispose(),Je.stop()};function kt(x){x.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),p=!0}function We(){console.log("THREE.WebGLRenderer: Context Restored."),p=!1,it()}function D(x){var S=x.target;S.removeEventListener("dispose",D),se(S)}function se(x){pe(x),A.remove(x)}function pe(x){var S=A.get(x).program;x.program=void 0,S!==void 0&&he.releaseProgram(S)}function Ce(x,S){x.render(function(P){f.renderBufferImmediate(P,S)})}this.renderBufferImmediate=function(x,S){xe.initAttributes();var P=A.get(x);x.hasPositions&&!P.position&&(P.position=F.createBuffer()),x.hasNormals&&!P.normal&&(P.normal=F.createBuffer()),x.hasUvs&&!P.uv&&(P.uv=F.createBuffer()),x.hasColors&&!P.color&&(P.color=F.createBuffer());var q=S.getAttributes();x.hasPositions&&(F.bindBuffer(34962,P.position),F.bufferData(34962,x.positionArray,35048),xe.enableAttribute(q.position),F.vertexAttribPointer(q.position,3,5126,!1,0,0)),x.hasNormals&&(F.bindBuffer(34962,P.normal),F.bufferData(34962,x.normalArray,35048),xe.enableAttribute(q.normal),F.vertexAttribPointer(q.normal,3,5126,!1,0,0)),x.hasUvs&&(F.bindBuffer(34962,P.uv),F.bufferData(34962,x.uvArray,35048),xe.enableAttribute(q.uv),F.vertexAttribPointer(q.uv,2,5126,!1,0,0)),x.hasColors&&(F.bindBuffer(34962,P.color),F.bufferData(34962,x.colorArray,35048),xe.enableAttribute(q.color),F.vertexAttribPointer(q.color,3,5126,!1,0,0)),xe.disableUnusedAttributes(),F.drawArrays(4,0,x.count),x.count=0},this.renderBufferDirect=function(x,S,P,q,le,He){var Be=le.isMesh&&le.matrixWorld.determinant()<0;xe.setMaterial(q,Be);var Ie=wr(x,S,q,le),ze=!1;(w.geometry!==P.id||w.program!==Ie.id||w.wireframe!==(q.wireframe===!0))&&(w.geometry=P.id,w.program=Ie.id,w.wireframe=q.wireframe===!0,ze=!0),le.morphTargetInfluences&&(Se.update(le,P,q,Ie),ze=!0);var Ze=P.index,st=P.attributes.position,De=1;q.wireframe===!0&&(Ze=Q.getWireframeAttribute(P),De=2);var Ae,Qe=Le;Ze!==null&&(Ae=W.get(Ze),Qe=Ue,Qe.setIndex(Ae)),ze&&(me(q,Ie,P),Ze!==null&&F.bindBuffer(34963,Ae.buffer));var Fe=1/0;Ze!==null?Fe=Ze.count:st!==void 0&&(Fe=st.count);var Vt=P.drawRange.start*De,It=P.drawRange.count*De,Bn=He!==null?He.start*De:0,en=He!==null?He.count*De:1/0,Xo=Math.max(Vt,Bn),xh=Math.min(Fe,Vt+It,Bn+en)-1,Zo=Math.max(0,xh-Xo+1);if(Zo!==0){if(le.isMesh)if(q.wireframe===!0)xe.setLineWidth(q.wireframeLinewidth*Re()),Qe.setMode(1);else switch(le.drawMode){case Ho:Qe.setMode(4);break;case bu:Qe.setMode(5);break;case xu:Qe.setMode(6);break}else if(le.isLine){var qo=q.linewidth;qo===void 0&&(qo=1),xe.setLineWidth(qo*Re()),le.isLineSegments?Qe.setMode(1):le.isLineLoop?Qe.setMode(2):Qe.setMode(3)}else le.isPoints?Qe.setMode(0):le.isSprite&&Qe.setMode(4);P&&P.isInstancedBufferGeometry?P.maxInstancedCount>0&&Qe.renderInstances(P,Xo,Zo):Qe.render(Xo,Zo)}};function me(x,S,P){if(P&&P.isInstancedBufferGeometry&&!be.isWebGL2&&K.get("ANGLE_instanced_arrays")===null){console.error("THREE.WebGLRenderer.setupVertexAttributes: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.");return}xe.initAttributes();var q=P.attributes,le=S.getAttributes(),He=x.defaultAttributeValues;for(var Be in le){var Ie=le[Be];if(Ie>=0){var ze=q[Be];if(ze!==void 0){var Ze=ze.normalized,st=ze.itemSize,De=W.get(ze);if(De===void 0)continue;var Ae=De.buffer,Qe=De.type,Fe=De.bytesPerElement;if(ze.isInterleavedBufferAttribute){var Vt=ze.data,It=Vt.stride,Bn=ze.offset;Vt&&Vt.isInstancedInterleavedBuffer?(xe.enableAttributeAndDivisor(Ie,Vt.meshPerAttribute),P.maxInstancedCount===void 0&&(P.maxInstancedCount=Vt.meshPerAttribute*Vt.count)):xe.enableAttribute(Ie),F.bindBuffer(34962,Ae),F.vertexAttribPointer(Ie,st,Qe,Ze,It*Fe,Bn*Fe)}else ze.isInstancedBufferAttribute?(xe.enableAttributeAndDivisor(Ie,ze.meshPerAttribute),P.maxInstancedCount===void 0&&(P.maxInstancedCount=ze.meshPerAttribute*ze.count)):xe.enableAttribute(Ie),F.bindBuffer(34962,Ae),F.vertexAttribPointer(Ie,st,Qe,Ze,0,0)}else if(He!==void 0){var en=He[Be];if(en!==void 0)switch(en.length){case 2:F.vertexAttrib2fv(Ie,en);break;case 3:F.vertexAttrib3fv(Ie,en);break;case 4:F.vertexAttrib4fv(Ie,en);break;default:F.vertexAttrib1fv(Ie,en)}}}}xe.disableUnusedAttributes()}this.compile=function(x,S){d=B.get(x,S),d.init(),x.traverse(function(P){P.isLight&&(d.pushLight(P),P.castShadow&&d.pushShadow(P))}),d.setupLights(S),x.traverse(function(P){if(P.material)if(Array.isArray(P.material))for(var q=0;q<P.material.length;q++)Bt(P.material[q],x.fog,P);else Bt(P.material,x.fog,P)})};var je=null;function Ke(x){ft.isPresenting()||je&&je(x)}var Je=new rl;Je.setAnimationLoop(Ke),typeof window<"u"&&Je.setContext(window),this.setAnimationLoop=function(x){je=x,ft.setAnimationLoop(x),Je.start()},this.render=function(x,S){var P,q;if(arguments[2]!==void 0&&(console.warn("THREE.WebGLRenderer.render(): the renderTarget argument has been removed. Use .setRenderTarget() instead."),P=arguments[2]),arguments[3]!==void 0&&(console.warn("THREE.WebGLRenderer.render(): the forceClear argument has been removed. Use .clear() instead."),q=arguments[3]),!(S&&S.isCamera)){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(!p){w.geometry=null,w.program=null,w.wireframe=!1,_=-1,L=null,x.autoUpdate===!0&&x.updateMatrixWorld(),S.parent===null&&S.updateMatrixWorld(),ft.enabled&&(S=ft.getCamera(S)),d=B.get(x,S),d.init(),x.onBeforeRender(f,x,S,P||y),ie.multiplyMatrices(S.projectionMatrix,S.matrixWorldInverse),Z.setFromMatrix(ie),J=this.localClippingEnabled,Y=V.init(this.clippingPlanes,J,S),h=ee.get(x,S),h.init(),mt(x,S,0,f.sortObjects),f.sortObjects===!0&&h.sort(),Y&&V.beginShadows();var le=d.state.shadowsArray;Tt.render(le,x,S),d.setupLights(S),Y&&V.endShadows(),this.info.autoReset&&this.info.reset(),P!==void 0&&this.setRenderTarget(P),re.render(h,x,S,q);var He=h.opaque,Be=h.transparent;if(x.overrideMaterial){var Ie=x.overrideMaterial;He.length&&Xe(He,x,S,Ie),Be.length&&Xe(Be,x,S,Ie)}else He.length&&Xe(He,x,S),Be.length&&Xe(Be,x,S);x.onAfterRender(f,x,S),y!==null&&(M.updateRenderTargetMipmap(y),M.updateMultisampleRenderTarget(y)),xe.buffers.depth.setTest(!0),xe.buffers.depth.setMask(!0),xe.buffers.color.setMask(!0),xe.setPolygonOffset(!1),ft.enabled&&ft.submitFrame(),h=null,d=null}};function mt(x,S,P,q){if(x.visible!==!1){var le=x.layers.test(S.layers);if(le){if(x.isGroup)P=x.renderOrder;else if(x.isLOD)x.autoUpdate===!0&&x.update(S);else if(x.isLight)d.pushLight(x),x.castShadow&&d.pushShadow(x);else if(x.isSprite){if(!x.frustumCulled||Z.intersectsSprite(x)){q&&ce.setFromMatrixPosition(x.matrixWorld).applyMatrix4(ie);var He=_e.update(x),Be=x.material;Be.visible&&h.push(x,He,Be,P,ce.z,null)}}else if(x.isImmediateRenderObject)q&&ce.setFromMatrixPosition(x.matrixWorld).applyMatrix4(ie),h.push(x,null,x.material,P,ce.z,null);else if((x.isMesh||x.isLine||x.isPoints)&&(x.isSkinnedMesh&&x.skeleton.update(),!x.frustumCulled||Z.intersectsObject(x))){q&&ce.setFromMatrixPosition(x.matrixWorld).applyMatrix4(ie);var He=_e.update(x),Be=x.material;if(Array.isArray(Be))for(var Ie=He.groups,ze=0,Ze=Ie.length;ze<Ze;ze++){var st=Ie[ze],De=Be[st.materialIndex];De&&De.visible&&h.push(x,He,De,P,ce.z,st)}else Be.visible&&h.push(x,He,Be,P,ce.z,null)}}for(var Ae=x.children,ze=0,Ze=Ae.length;ze<Ze;ze++)mt(Ae[ze],S,P,q)}}function Xe(x,S,P,q){for(var le=0,He=x.length;le<He;le++){var Be=x[le],Ie=Be.object,ze=Be.geometry,Ze=q===void 0?Be.material:q,st=Be.group;if(P.isArrayCamera){R=P;for(var De=P.cameras,Ae=0,Qe=De.length;Ae<Qe;Ae++){var Fe=De[Ae];Ie.layers.test(Fe.layers)&&(xe.viewport(k.copy(Fe.viewport)),d.setupLights(Fe),Nt(Ie,S,Fe,ze,Ze,st))}}else R=null,Nt(Ie,S,P,ze,Ze,st)}}function Nt(x,S,P,q,le,He){if(x.onBeforeRender(f,S,P,q,le,He),d=B.get(S,R||P),x.modelViewMatrix.multiplyMatrices(P.matrixWorldInverse,x.matrixWorld),x.normalMatrix.getNormalMatrix(x.modelViewMatrix),x.isImmediateRenderObject){xe.setMaterial(le);var Be=wr(P,S.fog,le,x);w.geometry=null,w.program=null,w.wireframe=!1,Ce(x,Be)}else f.renderBufferDirect(P,S.fog,q,le,x,He);x.onAfterRender(f,S,P,q,le,He),d=B.get(S,R||P)}function Bt(x,S,P){var q=A.get(x),le=d.state.lights,He=d.state.shadowsArray,Be=le.state.version,Ie=he.getParameters(x,le.state,He,S,V.numPlanes,V.numIntersection,P),ze=he.getProgramCode(x,Ie),Ze=q.program,st=!0;if(Ze===void 0)x.addEventListener("dispose",D);else if(Ze.code!==ze)pe(x);else if(q.lightsStateVersion!==Be)q.lightsStateVersion=Be,st=!1;else{if(Ie.shaderID!==void 0)return;st=!1}if(st){if(Ie.shaderID){var De=xn[Ie.shaderID];q.shader={name:x.type,uniforms:si(De.uniforms),vertexShader:De.vertexShader,fragmentShader:De.fragmentShader}}else q.shader={name:x.type,uniforms:x.uniforms,vertexShader:x.vertexShader,fragmentShader:x.fragmentShader};x.onBeforeCompile(q.shader,f),ze=he.getProgramCode(x,Ie),Ze=he.acquireProgram(x,q.shader,Ie,ze),q.program=Ze,x.program=Ze}var Ae=Ze.getAttributes();if(x.morphTargets){x.numSupportedMorphTargets=0;for(var Qe=0;Qe<f.maxMorphTargets;Qe++)Ae["morphTarget"+Qe]>=0&&x.numSupportedMorphTargets++}if(x.morphNormals){x.numSupportedMorphNormals=0;for(var Qe=0;Qe<f.maxMorphNormals;Qe++)Ae["morphNormal"+Qe]>=0&&x.numSupportedMorphNormals++}var Fe=q.shader.uniforms;(!x.isShaderMaterial&&!x.isRawShaderMaterial||x.clipping===!0)&&(q.numClippingPlanes=V.numPlanes,q.numIntersection=V.numIntersection,Fe.clippingPlanes=V.uniform),q.fog=S,q.lightsStateVersion=Be,x.lights&&(Fe.ambientLightColor.value=le.state.ambient,Fe.lightProbe.value=le.state.probe,Fe.directionalLights.value=le.state.directional,Fe.spotLights.value=le.state.spot,Fe.rectAreaLights.value=le.state.rectArea,Fe.pointLights.value=le.state.point,Fe.hemisphereLights.value=le.state.hemi,Fe.directionalShadowMap.value=le.state.directionalShadowMap,Fe.directionalShadowMatrix.value=le.state.directionalShadowMatrix,Fe.spotShadowMap.value=le.state.spotShadowMap,Fe.spotShadowMatrix.value=le.state.spotShadowMatrix,Fe.pointShadowMap.value=le.state.pointShadowMap,Fe.pointShadowMatrix.value=le.state.pointShadowMatrix);var Vt=q.program.getUniforms(),It=Hn.seqWithValue(Vt.seq,Fe);q.uniformsList=It}function wr(x,S,P,q){M.resetTextureUnits();var le=A.get(P),He=d.state.lights;if(Y&&(J||x!==L)){var Be=x===L&&P.id===_;V.setState(P.clippingPlanes,P.clipIntersection,P.clipShadows,x,le,Be)}P.needsUpdate===!1&&(le.program===void 0||P.fog&&le.fog!==S||P.lights&&le.lightsStateVersion!==He.state.version||le.numClippingPlanes!==void 0&&(le.numClippingPlanes!==V.numPlanes||le.numIntersection!==V.numIntersection))&&(P.needsUpdate=!0),P.needsUpdate&&(Bt(P,S,q),P.needsUpdate=!1);var Ie=!1,ze=!1,Ze=!1,st=le.program,De=st.getUniforms(),Ae=le.shader.uniforms;if(xe.useProgram(st.program)&&(Ie=!0,ze=!0,Ze=!0),P.id!==_&&(_=P.id,ze=!0),Ie||L!==x){if(De.setValue(F,"projectionMatrix",x.projectionMatrix),be.logarithmicDepthBuffer&&De.setValue(F,"logDepthBufFC",2/(Math.log(x.far+1)/Math.LN2)),L!==x&&(L=x,ze=!0,Ze=!0),P.isShaderMaterial||P.isMeshPhongMaterial||P.isMeshStandardMaterial||P.envMap){var Qe=De.map.cameraPosition;Qe!==void 0&&Qe.setValue(F,ce.setFromMatrixPosition(x.matrixWorld))}(P.isMeshPhongMaterial||P.isMeshLambertMaterial||P.isMeshBasicMaterial||P.isMeshStandardMaterial||P.isShaderMaterial||P.skinning)&&De.setValue(F,"viewMatrix",x.matrixWorldInverse)}if(P.skinning){De.setOptional(F,q,"bindMatrix"),De.setOptional(F,q,"bindMatrixInverse");var Fe=q.skeleton;if(Fe){var Vt=Fe.bones;if(be.floatVertexTextures){if(Fe.boneTexture===void 0){var It=Math.sqrt(Vt.length*4);It=Pe.ceilPowerOfTwo(It),It=Math.max(It,4);var Bn=new Float32Array(It*It*4);Bn.set(Fe.boneMatrices);var en=new li(Bn,It,It,_n,zi);en.needsUpdate=!0,Fe.boneMatrices=Bn,Fe.boneTexture=en,Fe.boneTextureSize=It}De.setValue(F,"boneTexture",Fe.boneTexture,M),De.setValue(F,"boneTextureSize",Fe.boneTextureSize)}else De.setOptional(F,Fe,"boneMatrices")}}return ze&&(De.setValue(F,"toneMappingExposure",f.toneMappingExposure),De.setValue(F,"toneMappingWhitePoint",f.toneMappingWhitePoint),P.lights&&bh(Ae,Ze),S&&P.fog&&ka(Ae,S),P.isMeshBasicMaterial?Kt(Ae,P):P.isMeshLambertMaterial?(Kt(Ae,P),Ci(Ae,P)):P.isMeshPhongMaterial?(Kt(Ae,P),P.isMeshToonMaterial?fh(Ae,P):Sl(Ae,P)):P.isMeshStandardMaterial?(Kt(Ae,P),P.isMeshPhysicalMaterial?ph(Ae,P):Tl(Ae,P)):P.isMeshMatcapMaterial?(Kt(Ae,P),mh(Ae,P)):P.isMeshDepthMaterial?(Kt(Ae,P),vh(Ae,P)):P.isMeshDistanceMaterial?(Kt(Ae,P),gh(Ae,P)):P.isMeshNormalMaterial?(Kt(Ae,P),yh(Ae,P)):P.isLineBasicMaterial?(Oa(Ae,P),P.isLineDashedMaterial&&jo(Ae,P)):P.isPointsMaterial?Yo(Ae,P):P.isSpriteMaterial?Da(Ae,P):P.isShadowMaterial&&(Ae.color.value.copy(P.color),Ae.opacity.value=P.opacity),Ae.ltc_1!==void 0&&(Ae.ltc_1.value=de.LTC_1),Ae.ltc_2!==void 0&&(Ae.ltc_2.value=de.LTC_2),Hn.upload(F,le.uniformsList,Ae,M)),P.isShaderMaterial&&P.uniformsNeedUpdate===!0&&(Hn.upload(F,le.uniformsList,Ae,M),P.uniformsNeedUpdate=!1),P.isSpriteMaterial&&De.setValue(F,"center",q.center),De.setValue(F,"modelViewMatrix",q.modelViewMatrix),De.setValue(F,"normalMatrix",q.normalMatrix),De.setValue(F,"modelMatrix",q.matrixWorld),st}function Kt(x,S){x.opacity.value=S.opacity,S.color&&x.diffuse.value.copy(S.color),S.emissive&&x.emissive.value.copy(S.emissive).multiplyScalar(S.emissiveIntensity),S.map&&(x.map.value=S.map),S.alphaMap&&(x.alphaMap.value=S.alphaMap),S.specularMap&&(x.specularMap.value=S.specularMap),S.envMap&&(x.envMap.value=S.envMap,x.flipEnvMap.value=S.envMap.isCubeTexture?-1:1,x.reflectivity.value=S.reflectivity,x.refractionRatio.value=S.refractionRatio,x.maxMipLevel.value=A.get(S.envMap).__maxMipLevel),S.lightMap&&(x.lightMap.value=S.lightMap,x.lightMapIntensity.value=S.lightMapIntensity),S.aoMap&&(x.aoMap.value=S.aoMap,x.aoMapIntensity.value=S.aoMapIntensity);var P;S.map?P=S.map:S.specularMap?P=S.specularMap:S.displacementMap?P=S.displacementMap:S.normalMap?P=S.normalMap:S.bumpMap?P=S.bumpMap:S.roughnessMap?P=S.roughnessMap:S.metalnessMap?P=S.metalnessMap:S.alphaMap?P=S.alphaMap:S.emissiveMap&&(P=S.emissiveMap),P!==void 0&&(P.isWebGLRenderTarget&&(P=P.texture),P.matrixAutoUpdate===!0&&P.updateMatrix(),x.uvTransform.value.copy(P.matrix))}function Oa(x,S){x.diffuse.value.copy(S.color),x.opacity.value=S.opacity}function jo(x,S){x.dashSize.value=S.dashSize,x.totalSize.value=S.dashSize+S.gapSize,x.scale.value=S.scale}function Yo(x,S){x.diffuse.value.copy(S.color),x.opacity.value=S.opacity,x.size.value=S.size*N,x.scale.value=I*.5,x.map.value=S.map,S.map!==null&&(S.map.matrixAutoUpdate===!0&&S.map.updateMatrix(),x.uvTransform.value.copy(S.map.matrix))}function Da(x,S){x.diffuse.value.copy(S.color),x.opacity.value=S.opacity,x.rotation.value=S.rotation,x.map.value=S.map,S.map!==null&&(S.map.matrixAutoUpdate===!0&&S.map.updateMatrix(),x.uvTransform.value.copy(S.map.matrix))}function ka(x,S){x.fogColor.value.copy(S.color),S.isFog?(x.fogNear.value=S.near,x.fogFar.value=S.far):S.isFogExp2&&(x.fogDensity.value=S.density)}function Ci(x,S){S.emissiveMap&&(x.emissiveMap.value=S.emissiveMap)}function Sl(x,S){x.specular.value.copy(S.specular),x.shininess.value=Math.max(S.shininess,1e-4),S.emissiveMap&&(x.emissiveMap.value=S.emissiveMap),S.bumpMap&&(x.bumpMap.value=S.bumpMap,x.bumpScale.value=S.bumpScale,S.side===vt&&(x.bumpScale.value*=-1)),S.normalMap&&(x.normalMap.value=S.normalMap,x.normalScale.value.copy(S.normalScale),S.side===vt&&x.normalScale.value.negate()),S.displacementMap&&(x.displacementMap.value=S.displacementMap,x.displacementScale.value=S.displacementScale,x.displacementBias.value=S.displacementBias)}function fh(x,S){Sl(x,S),S.gradientMap&&(x.gradientMap.value=S.gradientMap)}function Tl(x,S){x.roughness.value=S.roughness,x.metalness.value=S.metalness,S.roughnessMap&&(x.roughnessMap.value=S.roughnessMap),S.metalnessMap&&(x.metalnessMap.value=S.metalnessMap),S.emissiveMap&&(x.emissiveMap.value=S.emissiveMap),S.bumpMap&&(x.bumpMap.value=S.bumpMap,x.bumpScale.value=S.bumpScale,S.side===vt&&(x.bumpScale.value*=-1)),S.normalMap&&(x.normalMap.value=S.normalMap,x.normalScale.value.copy(S.normalScale),S.side===vt&&x.normalScale.value.negate()),S.displacementMap&&(x.displacementMap.value=S.displacementMap,x.displacementScale.value=S.displacementScale,x.displacementBias.value=S.displacementBias),S.envMap&&(x.envMapIntensity.value=S.envMapIntensity)}function ph(x,S){Tl(x,S),x.reflectivity.value=S.reflectivity,x.clearCoat.value=S.clearCoat,x.clearCoatRoughness.value=S.clearCoatRoughness}function mh(x,S){S.matcap&&(x.matcap.value=S.matcap),S.bumpMap&&(x.bumpMap.value=S.bumpMap,x.bumpScale.value=S.bumpScale,S.side===vt&&(x.bumpScale.value*=-1)),S.normalMap&&(x.normalMap.value=S.normalMap,x.normalScale.value.copy(S.normalScale),S.side===vt&&x.normalScale.value.negate()),S.displacementMap&&(x.displacementMap.value=S.displacementMap,x.displacementScale.value=S.displacementScale,x.displacementBias.value=S.displacementBias)}function vh(x,S){S.displacementMap&&(x.displacementMap.value=S.displacementMap,x.displacementScale.value=S.displacementScale,x.displacementBias.value=S.displacementBias)}function gh(x,S){S.displacementMap&&(x.displacementMap.value=S.displacementMap,x.displacementScale.value=S.displacementScale,x.displacementBias.value=S.displacementBias),x.referencePosition.value.copy(S.referencePosition),x.nearDistance.value=S.nearDistance,x.farDistance.value=S.farDistance}function yh(x,S){S.bumpMap&&(x.bumpMap.value=S.bumpMap,x.bumpScale.value=S.bumpScale,S.side===vt&&(x.bumpScale.value*=-1)),S.normalMap&&(x.normalMap.value=S.normalMap,x.normalScale.value.copy(S.normalScale),S.side===vt&&x.normalScale.value.negate()),S.displacementMap&&(x.displacementMap.value=S.displacementMap,x.displacementScale.value=S.displacementScale,x.displacementBias.value=S.displacementBias)}function bh(x,S){x.ambientLightColor.needsUpdate=S,x.lightProbe.needsUpdate=S,x.directionalLights.needsUpdate=S,x.pointLights.needsUpdate=S,x.spotLights.needsUpdate=S,x.rectAreaLights.needsUpdate=S,x.hemisphereLights.needsUpdate=S}this.setFramebuffer=function(x){v!==x&&F.bindFramebuffer(36160,x),v=x},this.getActiveCubeFace=function(){return m},this.getActiveMipmapLevel=function(){return g},this.getRenderTarget=function(){return y},this.setRenderTarget=function(x,S,P){y=x,m=S,g=P,x&&A.get(x).__webglFramebuffer===void 0&&M.setupRenderTarget(x);var q=v,le=!1;if(x){var He=A.get(x).__webglFramebuffer;x.isWebGLRenderTargetCube?(q=He[S||0],le=!0):x.isWebGLMultisampleRenderTarget?q=A.get(x).__webglMultisampledFramebuffer:q=He,k.copy(x.viewport),O.copy(x.scissor),z=x.scissorTest}else k.copy(H).multiplyScalar(N).floor(),O.copy(G).multiplyScalar(N).floor(),z=X;if(b!==q&&(F.bindFramebuffer(36160,q),b=q),xe.viewport(k),xe.scissor(O),xe.setScissorTest(z),le){var Be=A.get(x.texture);F.framebufferTexture2D(36160,36064,34069+(S||0),Be.__webglTexture,P||0)}},this.readRenderTargetPixels=function(x,S,P,q,le,He,Be){if(!(x&&x.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}var Ie=A.get(x).__webglFramebuffer;if(x.isWebGLRenderTargetCube&&Be!==void 0&&(Ie=Ie[Be]),Ie){var ze=!1;Ie!==b&&(F.bindFramebuffer(36160,Ie),ze=!0);try{var Ze=x.texture,st=Ze.format,De=Ze.type;if(st!==_n&&Ee.convert(st)!==F.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(De!==zo&&Ee.convert(De)!==F.getParameter(35738)&&!(De===zi&&(be.isWebGL2||K.get("OES_texture_float")||K.get("WEBGL_color_buffer_float")))&&!(De===Fo&&(be.isWebGL2?K.get("EXT_color_buffer_float"):K.get("EXT_color_buffer_half_float")))){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}F.checkFramebufferStatus(36160)===36053?S>=0&&S<=x.width-q&&P>=0&&P<=x.height-le&&F.readPixels(S,P,q,le,Ee.convert(st),Ee.convert(De),He):console.error("THREE.WebGLRenderer.readRenderTargetPixels: readPixels from renderTarget failed. Framebuffer not complete.")}finally{ze&&F.bindFramebuffer(36160,b)}}},this.copyFramebufferToTexture=function(x,S,P){var q=S.image.width,le=S.image.height,He=Ee.convert(S.format);M.setTexture2D(S,0),F.copyTexImage2D(3553,P||0,He,x.x,x.y,q,le,0)},this.copyTextureToTexture=function(x,S,P,q){var le=S.image.width,He=S.image.height,Be=Ee.convert(P.format),Ie=Ee.convert(P.type);M.setTexture2D(P,0),S.isDataTexture?F.texSubImage2D(3553,q||0,x.x,x.y,le,He,Be,Ie,S.image.data):F.texSubImage2D(3553,q||0,x.x,x.y,Be,Ie,S.image)},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}function so(e,t){this.name="",this.color=new ye(e),this.density=t!==void 0?t:25e-5}Object.assign(so.prototype,{isFogExp2:!0,clone:function(){return new so(this.color,this.density)},toJSON:function(){return{type:"FogExp2",color:this.color.getHex(),density:this.density}}});function lo(e,t,n){this.name="",this.color=new ye(e),this.near=t!==void 0?t:1,this.far=n!==void 0?n:1e3}Object.assign(lo.prototype,{isFog:!0,clone:function(){return new lo(this.color,this.near,this.far)},toJSON:function(){return{type:"Fog",color:this.color.getHex(),near:this.near,far:this.far}}});function ui(e,t){this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.dynamic=!1,this.updateRange={offset:0,count:-1},this.version=0}Object.defineProperty(ui.prototype,"needsUpdate",{set:function(e){e===!0&&this.version++}});Object.assign(ui.prototype,{isInterleavedBuffer:!0,onUploadCallback:function(){},setArray:function(e){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");return this.count=e!==void 0?e.length/this.stride:0,this.array=e,this},setDynamic:function(e){return this.dynamic=e,this},copy:function(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.dynamic=e.dynamic,this},copyAt:function(e,t,n){e*=this.stride,n*=t.stride;for(var i=0,r=this.stride;i<r;i++)this.array[e+i]=t.array[n+i];return this},set:function(e,t){return t===void 0&&(t=0),this.array.set(e,t),this},clone:function(){return new this.constructor().copy(this)},onUpload:function(e){return this.onUploadCallback=e,this}});function Yr(e,t,n,i){this.data=e,this.itemSize=t,this.offset=n,this.normalized=i===!0}Object.defineProperties(Yr.prototype,{count:{get:function(){return this.data.count}},array:{get:function(){return this.data.array}}});Object.assign(Yr.prototype,{isInterleavedBufferAttribute:!0,setX:function(e,t){return this.data.array[e*this.data.stride+this.offset]=t,this},setY:function(e,t){return this.data.array[e*this.data.stride+this.offset+1]=t,this},setZ:function(e,t){return this.data.array[e*this.data.stride+this.offset+2]=t,this},setW:function(e,t){return this.data.array[e*this.data.stride+this.offset+3]=t,this},getX:function(e){return this.data.array[e*this.data.stride+this.offset]},getY:function(e){return this.data.array[e*this.data.stride+this.offset+1]},getZ:function(e){return this.data.array[e*this.data.stride+this.offset+2]},getW:function(e){return this.data.array[e*this.data.stride+this.offset+3]},setXY:function(e,t,n){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this},setXYZ:function(e,t,n,i){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this},setXYZW:function(e,t,n,i,r){return e=e*this.data.stride+this.offset,this.data.array[e+0]=t,this.data.array[e+1]=n,this.data.array[e+2]=i,this.data.array[e+3]=r,this}});function Zn(e){Oe.call(this),this.type="SpriteMaterial",this.color=new ye(16777215),this.map=null,this.rotation=0,this.sizeAttenuation=!0,this.lights=!1,this.transparent=!0,this.setValues(e)}Zn.prototype=Object.create(Oe.prototype);Zn.prototype.constructor=Zn;Zn.prototype.isSpriteMaterial=!0;Zn.prototype.copy=function(e){return Oe.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.rotation=e.rotation,this.sizeAttenuation=e.sizeAttenuation,this};var Di;function Xr(e){if(ae.call(this),this.type="Sprite",Di===void 0){Di=new oe;var t=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),n=new ui(t,5);Di.setIndex([0,1,2,0,2,3]),Di.addAttribute("position",new Yr(n,3,0,!1)),Di.addAttribute("uv",new Yr(n,2,3,!1))}this.geometry=Di,this.material=e!==void 0?e:new Zn,this.center=new j(.5,.5)}Xr.prototype=Object.assign(Object.create(ae.prototype),{constructor:Xr,isSprite:!0,raycast:function(){var e=new E,t=new E,n=new E,i=new j,r=new j,a=new Me,o=new E,s=new E,l=new E,c=new j,u=new j,h=new j;function d(f,p,v,m,g,y){i.subVectors(f,v).addScalar(.5).multiply(m),g!==void 0?(r.x=y*i.x-g*i.y,r.y=g*i.x+y*i.y):r.copy(i),f.copy(p),f.x+=r.x,f.y+=r.y,f.applyMatrix4(a)}return function(p,v){t.setFromMatrixScale(this.matrixWorld),a.copy(p._camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(p._camera.matrixWorldInverse,this.matrixWorld),n.setFromMatrixPosition(this.modelViewMatrix),p._camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&t.multiplyScalar(-n.z);var m=this.material.rotation,g,y;m!==0&&(y=Math.cos(m),g=Math.sin(m));var b=this.center;d(o.set(-.5,-.5,0),n,b,t,g,y),d(s.set(.5,-.5,0),n,b,t,g,y),d(l.set(.5,.5,0),n,b,t,g,y),c.set(0,0),u.set(1,0),h.set(1,1);var _=p.ray.intersectTriangle(o,s,l,!1,e);if(!(_===null&&(d(s.set(-.5,.5,0),n,b,t,g,y),u.set(0,1),_=p.ray.intersectTriangle(o,l,s,!1,e),_===null))){var w=p.ray.origin.distanceTo(e);w<p.near||w>p.far||v.push({distance:w,point:e.clone(),uv:yt.getUV(e,o,s,l,c,u,h,new j),face:null,object:this})}}}(),clone:function(){return new this.constructor(this.material).copy(this)},copy:function(e){return ae.prototype.copy.call(this,e),e.center!==void 0&&this.center.copy(e.center),this}});function Zr(){ae.call(this),this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}Zr.prototype=Object.assign(Object.create(ae.prototype),{constructor:Zr,isLOD:!0,copy:function(e){ae.prototype.copy.call(this,e,!1);for(var t=e.levels,n=0,i=t.length;n<i;n++){var r=t[n];this.addLevel(r.object.clone(),r.distance)}return this},addLevel:function(e,t){t===void 0&&(t=0),t=Math.abs(t);for(var n=this.levels,i=0;i<n.length&&!(t<n[i].distance);i++);return n.splice(i,0,{distance:t,object:e}),this.add(e),this},getObjectForDistance:function(e){for(var t=this.levels,n=1,i=t.length;n<i&&!(e<t[n].distance);n++);return t[n-1].object},raycast:function(){var e=new E;return function(n,i){e.setFromMatrixPosition(this.matrixWorld);var r=n.ray.origin.distanceTo(e);this.getObjectForDistance(r).raycast(n,i)}}(),update:function(){var e=new E,t=new E;return function(i){var r=this.levels;if(r.length>1){e.setFromMatrixPosition(i.matrixWorld),t.setFromMatrixPosition(this.matrixWorld);var a=e.distanceTo(t);r[0].object.visible=!0;for(var o=1,s=r.length;o<s&&a>=r[o].distance;o++)r[o-1].object.visible=!1,r[o].object.visible=!0;for(;o<s;o++)r[o].object.visible=!1}}}(),toJSON:function(e){var t=ae.prototype.toJSON.call(this,e);t.object.levels=[];for(var n=this.levels,i=0,r=n.length;i<r;i++){var a=n[i];t.object.levels.push({object:a.object.uuid,distance:a.distance})}return t}});function qr(e,t){e&&e.isGeometry&&console.error("THREE.SkinnedMesh no longer supports THREE.Geometry. Use THREE.BufferGeometry instead."),_t.call(this,e,t),this.type="SkinnedMesh",this.bindMode="attached",this.bindMatrix=new Me,this.bindMatrixInverse=new Me}qr.prototype=Object.assign(Object.create(_t.prototype),{constructor:qr,isSkinnedMesh:!0,bind:function(e,t){this.skeleton=e,t===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),t=this.matrixWorld),this.bindMatrix.copy(t),this.bindMatrixInverse.getInverse(t)},pose:function(){this.skeleton.pose()},normalizeSkinWeights:function(){for(var e=new et,t=this.geometry.attributes.skinWeight,n=0,i=t.count;n<i;n++){e.x=t.getX(n),e.y=t.getY(n),e.z=t.getZ(n),e.w=t.getW(n);var r=1/e.manhattanLength();r!==1/0?e.multiplyScalar(r):e.set(1,0,0,0),t.setXYZW(n,e.x,e.y,e.z,e.w)}},updateMatrixWorld:function(e){_t.prototype.updateMatrixWorld.call(this,e),this.bindMode==="attached"?this.bindMatrixInverse.getInverse(this.matrixWorld):this.bindMode==="detached"?this.bindMatrixInverse.getInverse(this.bindMatrix):console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});function co(e,t){if(e=e||[],this.bones=e.slice(0),this.boneMatrices=new Float32Array(this.bones.length*16),t===void 0)this.calculateInverses();else if(this.bones.length===t.length)this.boneInverses=t.slice(0);else{console.warn("THREE.Skeleton boneInverses is the wrong length."),this.boneInverses=[];for(var n=0,i=this.bones.length;n<i;n++)this.boneInverses.push(new Me)}}Object.assign(co.prototype,{calculateInverses:function(){this.boneInverses=[];for(var e=0,t=this.bones.length;e<t;e++){var n=new Me;this.bones[e]&&n.getInverse(this.bones[e].matrixWorld),this.boneInverses.push(n)}},pose:function(){var e,t,n;for(t=0,n=this.bones.length;t<n;t++)e=this.bones[t],e&&e.matrixWorld.getInverse(this.boneInverses[t]);for(t=0,n=this.bones.length;t<n;t++)e=this.bones[t],e&&(e.parent&&e.parent.isBone?(e.matrix.getInverse(e.parent.matrixWorld),e.matrix.multiply(e.matrixWorld)):e.matrix.copy(e.matrixWorld),e.matrix.decompose(e.position,e.quaternion,e.scale))},update:function(){var e=new Me,t=new Me;return function(){for(var i=this.bones,r=this.boneInverses,a=this.boneMatrices,o=this.boneTexture,s=0,l=i.length;s<l;s++){var c=i[s]?i[s].matrixWorld:t;e.multiplyMatrices(c,r[s]),e.toArray(a,s*16)}o!==void 0&&(o.needsUpdate=!0)}}(),clone:function(){return new co(this.bones,this.boneInverses)},getBoneByName:function(e){for(var t=0,n=this.bones.length;t<n;t++){var i=this.bones[t];if(i.name===e)return i}}});function Ls(){ae.call(this),this.type="Bone"}Ls.prototype=Object.assign(Object.create(ae.prototype),{constructor:Ls,isBone:!0});function $e(e){Oe.call(this),this.type="LineBasicMaterial",this.color=new ye(16777215),this.linewidth=1,this.linecap="round",this.linejoin="round",this.lights=!1,this.setValues(e)}$e.prototype=Object.create(Oe.prototype);$e.prototype.constructor=$e;$e.prototype.isLineBasicMaterial=!0;$e.prototype.copy=function(e){return Oe.prototype.copy.call(this,e),this.color.copy(e.color),this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this};function Mt(e,t,n){n===1&&console.error("THREE.Line: parameter THREE.LinePieces no longer supported. Use THREE.LineSegments instead."),ae.call(this),this.type="Line",this.geometry=e!==void 0?e:new oe,this.material=t!==void 0?t:new $e({color:Math.random()*16777215})}Mt.prototype=Object.assign(Object.create(ae.prototype),{constructor:Mt,isLine:!0,computeLineDistances:function(){var e=new E,t=new E;return function(){var i=this.geometry;if(i.isBufferGeometry)if(i.index===null){for(var r=i.attributes.position,a=[0],o=1,s=r.count;o<s;o++)e.fromBufferAttribute(r,o-1),t.fromBufferAttribute(r,o),a[o]=a[o-1],a[o]+=e.distanceTo(t);i.addAttribute("lineDistance",new $(a,1))}else console.warn("THREE.Line.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(i.isGeometry){var l=i.vertices,a=i.lineDistances;a[0]=0;for(var o=1,s=l.length;o<s;o++)a[o]=a[o-1],a[o]+=l[o-1].distanceTo(l[o])}return this}}(),raycast:function(){var e=new Me,t=new Ai,n=new sn;return function(r,a){var o=r.linePrecision,s=this.geometry,l=this.matrixWorld;if(s.boundingSphere===null&&s.computeBoundingSphere(),n.copy(s.boundingSphere),n.applyMatrix4(l),n.radius+=o,r.ray.intersectsSphere(n)!==!1){e.getInverse(l),t.copy(r.ray).applyMatrix4(e);var c=o/((this.scale.x+this.scale.y+this.scale.z)/3),u=c*c,h=new E,d=new E,f=new E,p=new E,v=this&&this.isLineSegments?2:1;if(s.isBufferGeometry){var m=s.index,g=s.attributes,y=g.position.array;if(m!==null)for(var b=m.array,_=0,w=b.length-1;_<w;_+=v){var L=b[_],R=b[_+1];h.fromArray(y,L*3),d.fromArray(y,R*3);var k=t.distanceSqToSegment(h,d,p,f);if(!(k>u)){p.applyMatrix4(this.matrixWorld);var O=r.ray.origin.distanceTo(p);O<r.near||O>r.far||a.push({distance:O,point:f.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this})}}else for(var _=0,w=y.length/3-1;_<w;_+=v){h.fromArray(y,3*_),d.fromArray(y,3*_+3);var k=t.distanceSqToSegment(h,d,p,f);if(!(k>u)){p.applyMatrix4(this.matrixWorld);var O=r.ray.origin.distanceTo(p);O<r.near||O>r.far||a.push({distance:O,point:f.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this})}}}else if(s.isGeometry)for(var z=s.vertices,C=z.length,_=0;_<C-1;_+=v){var k=t.distanceSqToSegment(z[_],z[_+1],p,f);if(!(k>u)){p.applyMatrix4(this.matrixWorld);var O=r.ray.origin.distanceTo(p);O<r.near||O>r.far||a.push({distance:O,point:f.clone().applyMatrix4(this.matrixWorld),index:_,face:null,faceIndex:null,object:this})}}}}}(),clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});function nt(e,t){Mt.call(this,e,t),this.type="LineSegments"}nt.prototype=Object.assign(Object.create(Mt.prototype),{constructor:nt,isLineSegments:!0,computeLineDistances:function(){var e=new E,t=new E;return function(){var i=this.geometry;if(i.isBufferGeometry)if(i.index===null){for(var r=i.attributes.position,a=[],o=0,s=r.count;o<s;o+=2)e.fromBufferAttribute(r,o),t.fromBufferAttribute(r,o+1),a[o]=o===0?0:a[o-1],a[o+1]=a[o]+e.distanceTo(t);i.addAttribute("lineDistance",new $(a,1))}else console.warn("THREE.LineSegments.computeLineDistances(): Computation only possible with non-indexed BufferGeometry.");else if(i.isGeometry)for(var l=i.vertices,a=i.lineDistances,o=0,s=l.length;o<s;o+=2)e.copy(l[o]),t.copy(l[o+1]),a[o]=o===0?0:a[o-1],a[o+1]=a[o]+e.distanceTo(t);return this}}()});function uo(e,t){Mt.call(this,e,t),this.type="LineLoop"}uo.prototype=Object.assign(Object.create(Mt.prototype),{constructor:uo,isLineLoop:!0});function ln(e){Oe.call(this),this.type="PointsMaterial",this.color=new ye(16777215),this.map=null,this.size=1,this.sizeAttenuation=!0,this.morphTargets=!1,this.lights=!1,this.setValues(e)}ln.prototype=Object.create(Oe.prototype);ln.prototype.constructor=ln;ln.prototype.isPointsMaterial=!0;ln.prototype.copy=function(e){return Oe.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.size=e.size,this.sizeAttenuation=e.sizeAttenuation,this.morphTargets=e.morphTargets,this};function Yi(e,t){ae.call(this),this.type="Points",this.geometry=e!==void 0?e:new oe,this.material=t!==void 0?t:new ln({color:Math.random()*16777215}),this.updateMorphTargets()}Yi.prototype=Object.assign(Object.create(ae.prototype),{constructor:Yi,isPoints:!0,raycast:function(){var e=new Me,t=new Ai,n=new sn;return function(r,a){var o=this,s=this.geometry,l=this.matrixWorld,c=r.params.Points.threshold;if(s.boundingSphere===null&&s.computeBoundingSphere(),n.copy(s.boundingSphere),n.applyMatrix4(l),n.radius+=c,r.ray.intersectsSphere(n)===!1)return;e.getInverse(l),t.copy(r.ray).applyMatrix4(e);var u=c/((this.scale.x+this.scale.y+this.scale.z)/3),h=u*u,d=new E,f=new E;function p(k,O){var z=t.distanceSqToPoint(k);if(z<h){t.closestPointToPoint(k,f),f.applyMatrix4(l);var C=r.ray.origin.distanceTo(f);if(C<r.near||C>r.far)return;a.push({distance:C,distanceToRay:Math.sqrt(z),point:f.clone(),index:O,face:null,object:o})}}if(s.isBufferGeometry){var v=s.index,m=s.attributes,g=m.position.array;if(v!==null)for(var y=v.array,b=0,_=y.length;b<_;b++){var w=y[b];d.fromArray(g,w*3),p(d,w)}else for(var b=0,L=g.length/3;b<L;b++)d.fromArray(g,b*3),p(d,b)}else for(var R=s.vertices,b=0,L=R.length;b<L;b++)p(R[b],b)}}(),updateMorphTargets:function(){var e=this.geometry,t,n,i;if(e.isBufferGeometry){var r=e.morphAttributes,a=Object.keys(r);if(a.length>0){var o=r[a[0]];if(o!==void 0)for(this.morphTargetInfluences=[],this.morphTargetDictionary={},t=0,n=o.length;t<n;t++)i=o[t].name||String(t),this.morphTargetInfluences.push(0),this.morphTargetDictionary[i]=t}}else{var s=e.morphTargets;s!==void 0&&s.length>0&&console.error("THREE.Points.updateMorphTargets() does not support THREE.Geometry. Use THREE.BufferGeometry instead.")}},clone:function(){return new this.constructor(this.geometry,this.material).copy(this)}});function Cs(e,t,n,i,r,a,o,s,l){tt.call(this,e,t,n,i,r,a,o,s,l),this.format=o!==void 0?o:Gn,this.minFilter=a!==void 0?a:Lt,this.magFilter=r!==void 0?r:Lt,this.generateMipmaps=!1}Cs.prototype=Object.assign(Object.create(tt.prototype),{constructor:Cs,isVideoTexture:!0,update:function(){var e=this.image;e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}});function Xi(e,t,n,i,r,a,o,s,l,c,u,h){tt.call(this,null,a,o,s,l,c,i,r,u,h),this.image={width:t,height:n},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}Xi.prototype=Object.create(tt.prototype);Xi.prototype.constructor=Xi;Xi.prototype.isCompressedTexture=!0;function Jr(e,t,n,i,r,a,o,s,l){tt.call(this,e,t,n,i,r,a,o,s,l),this.needsUpdate=!0}Jr.prototype=Object.create(tt.prototype);Jr.prototype.constructor=Jr;Jr.prototype.isCanvasTexture=!0;function Qr(e,t,n,i,r,a,o,s,l,c){if(c=c!==void 0?c:ni,c!==ni&&c!==Fi)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");n===void 0&&c===ni&&(n=Pr),n===void 0&&c===Fi&&(n=Or),tt.call(this,null,i,r,a,o,s,c,n,l),this.image={width:e,height:t},this.magFilter=o!==void 0?o:Et,this.minFilter=s!==void 0?s:Et,this.flipY=!1,this.generateMipmaps=!1}Qr.prototype=Object.create(tt.prototype);Qr.prototype.constructor=Qr;Qr.prototype.isDepthTexture=!0;function Zi(e){oe.call(this),this.type="WireframeGeometry";var t=[],n,i,r,a,o,s=[0,0],l={},c,u,h,d,f=["a","b","c"],p;if(e&&e.isGeometry){var v=e.faces;for(n=0,r=v.length;n<r;n++){var m=v[n];for(i=0;i<3;i++)u=m[f[i]],h=m[f[(i+1)%3]],s[0]=Math.min(u,h),s[1]=Math.max(u,h),d=s[0]+","+s[1],l[d]===void 0&&(l[d]={index1:s[0],index2:s[1]})}for(d in l)c=l[d],p=e.vertices[c.index1],t.push(p.x,p.y,p.z),p=e.vertices[c.index2],t.push(p.x,p.y,p.z)}else if(e&&e.isBufferGeometry){var g,y,b,_,w,L,R,k;if(p=new E,e.index!==null){for(g=e.attributes.position,y=e.index,b=e.groups,b.length===0&&(b=[{start:0,count:y.count,materialIndex:0}]),a=0,o=b.length;a<o;++a)for(_=b[a],w=_.start,L=_.count,n=w,r=w+L;n<r;n+=3)for(i=0;i<3;i++)u=y.getX(n+i),h=y.getX(n+(i+1)%3),s[0]=Math.min(u,h),s[1]=Math.max(u,h),d=s[0]+","+s[1],l[d]===void 0&&(l[d]={index1:s[0],index2:s[1]});for(d in l)c=l[d],p.fromBufferAttribute(g,c.index1),t.push(p.x,p.y,p.z),p.fromBufferAttribute(g,c.index2),t.push(p.x,p.y,p.z)}else for(g=e.attributes.position,n=0,r=g.count/3;n<r;n++)for(i=0;i<3;i++)R=3*n+i,p.fromBufferAttribute(g,R),t.push(p.x,p.y,p.z),k=3*n+(i+1)%3,p.fromBufferAttribute(g,k),t.push(p.x,p.y,p.z)}this.addAttribute("position",new $(t,3))}Zi.prototype=Object.create(oe.prototype);Zi.prototype.constructor=Zi;function $r(e,t,n){Te.call(this),this.type="ParametricGeometry",this.parameters={func:e,slices:t,stacks:n},this.fromBufferGeometry(new qi(e,t,n)),this.mergeVertices()}$r.prototype=Object.create(Te.prototype);$r.prototype.constructor=$r;function qi(e,t,n){oe.call(this),this.type="ParametricBufferGeometry",this.parameters={func:e,slices:t,stacks:n};var i=[],r=[],a=[],o=[],s=1e-5,l=new E,c=new E,u=new E,h=new E,d=new E,f,p;e.length<3&&console.error("THREE.ParametricGeometry: Function must now modify a Vector3 as third parameter.");var v=t+1;for(f=0;f<=n;f++){var m=f/n;for(p=0;p<=t;p++){var g=p/t;e(g,m,c),r.push(c.x,c.y,c.z),g-s>=0?(e(g-s,m,u),h.subVectors(c,u)):(e(g+s,m,u),h.subVectors(u,c)),m-s>=0?(e(g,m-s,u),d.subVectors(c,u)):(e(g,m+s,u),d.subVectors(u,c)),l.crossVectors(h,d).normalize(),a.push(l.x,l.y,l.z),o.push(g,m)}}for(f=0;f<n;f++)for(p=0;p<t;p++){var y=f*v+p,b=f*v+p+1,_=(f+1)*v+p+1,w=(f+1)*v+p;i.push(y,b,w),i.push(b,_,w)}this.setIndex(i),this.addAttribute("position",new $(r,3)),this.addAttribute("normal",new $(a,3)),this.addAttribute("uv",new $(o,2))}qi.prototype=Object.create(oe.prototype);qi.prototype.constructor=qi;function Kr(e,t,n,i){Te.call(this),this.type="PolyhedronGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i},this.fromBufferGeometry(new Ht(e,t,n,i)),this.mergeVertices()}Kr.prototype=Object.create(Te.prototype);Kr.prototype.constructor=Kr;function Ht(e,t,n,i){oe.call(this),this.type="PolyhedronBufferGeometry",this.parameters={vertices:e,indices:t,radius:n,detail:i},n=n||1,i=i||0;var r=[],a=[];o(i),l(n),c(),this.addAttribute("position",new $(r,3)),this.addAttribute("normal",new $(r.slice(),3)),this.addAttribute("uv",new $(a,2)),i===0?this.computeVertexNormals():this.normalizeNormals();function o(g){for(var y=new E,b=new E,_=new E,w=0;w<t.length;w+=3)d(t[w+0],y),d(t[w+1],b),d(t[w+2],_),s(y,b,_,g)}function s(g,y,b,_){var w=Math.pow(2,_),L=[],R,k;for(R=0;R<=w;R++){L[R]=[];var O=g.clone().lerp(b,R/w),z=y.clone().lerp(b,R/w),C=w-R;for(k=0;k<=C;k++)k===0&&R===w?L[R][k]=O:L[R][k]=O.clone().lerp(z,k/C)}for(R=0;R<w;R++)for(k=0;k<2*(w-R)-1;k++){var I=Math.floor(k/2);k%2===0?(h(L[R][I+1]),h(L[R+1][I]),h(L[R][I])):(h(L[R][I+1]),h(L[R+1][I+1]),h(L[R+1][I]))}}function l(g){for(var y=new E,b=0;b<r.length;b+=3)y.x=r[b+0],y.y=r[b+1],y.z=r[b+2],y.normalize().multiplyScalar(g),r[b+0]=y.x,r[b+1]=y.y,r[b+2]=y.z}function c(){for(var g=new E,y=0;y<r.length;y+=3){g.x=r[y+0],g.y=r[y+1],g.z=r[y+2];var b=v(g)/2/Math.PI+.5,_=m(g)/Math.PI+.5;a.push(b,1-_)}f(),u()}function u(){for(var g=0;g<a.length;g+=6){var y=a[g+0],b=a[g+2],_=a[g+4],w=Math.max(y,b,_),L=Math.min(y,b,_);w>.9&&L<.1&&(y<.2&&(a[g+0]+=1),b<.2&&(a[g+2]+=1),_<.2&&(a[g+4]+=1))}}function h(g){r.push(g.x,g.y,g.z)}function d(g,y){var b=g*3;y.x=e[b+0],y.y=e[b+1],y.z=e[b+2]}function f(){for(var g=new E,y=new E,b=new E,_=new E,w=new j,L=new j,R=new j,k=0,O=0;k<r.length;k+=9,O+=6){g.set(r[k+0],r[k+1],r[k+2]),y.set(r[k+3],r[k+4],r[k+5]),b.set(r[k+6],r[k+7],r[k+8]),w.set(a[O+0],a[O+1]),L.set(a[O+2],a[O+3]),R.set(a[O+4],a[O+5]),_.copy(g).add(y).add(b).divideScalar(3);var z=v(_);p(w,O+0,g,z),p(L,O+2,y,z),p(R,O+4,b,z)}}function p(g,y,b,_){_<0&&g.x===1&&(a[y]=g.x-1),b.x===0&&b.z===0&&(a[y]=_/2/Math.PI+.5)}function v(g){return Math.atan2(g.z,-g.x)}function m(g){return Math.atan2(-g.y,Math.sqrt(g.x*g.x+g.z*g.z))}}Ht.prototype=Object.create(oe.prototype);Ht.prototype.constructor=Ht;function ea(e,t){Te.call(this),this.type="TetrahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Ji(e,t)),this.mergeVertices()}ea.prototype=Object.create(Te.prototype);ea.prototype.constructor=ea;function Ji(e,t){var n=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],i=[2,1,0,0,3,2,1,3,0,2,3,1];Ht.call(this,n,i,e,t),this.type="TetrahedronBufferGeometry",this.parameters={radius:e,detail:t}}Ji.prototype=Object.create(Ht.prototype);Ji.prototype.constructor=Ji;function ta(e,t){Te.call(this),this.type="OctahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new hi(e,t)),this.mergeVertices()}ta.prototype=Object.create(Te.prototype);ta.prototype.constructor=ta;function hi(e,t){var n=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],i=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];Ht.call(this,n,i,e,t),this.type="OctahedronBufferGeometry",this.parameters={radius:e,detail:t}}hi.prototype=Object.create(Ht.prototype);hi.prototype.constructor=hi;function na(e,t){Te.call(this),this.type="IcosahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new Qi(e,t)),this.mergeVertices()}na.prototype=Object.create(Te.prototype);na.prototype.constructor=na;function Qi(e,t){var n=(1+Math.sqrt(5))/2,i=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],r=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];Ht.call(this,i,r,e,t),this.type="IcosahedronBufferGeometry",this.parameters={radius:e,detail:t}}Qi.prototype=Object.create(Ht.prototype);Qi.prototype.constructor=Qi;function ia(e,t){Te.call(this),this.type="DodecahedronGeometry",this.parameters={radius:e,detail:t},this.fromBufferGeometry(new $i(e,t)),this.mergeVertices()}ia.prototype=Object.create(Te.prototype);ia.prototype.constructor=ia;function $i(e,t){var n=(1+Math.sqrt(5))/2,i=1/n,r=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-i,-n,0,-i,n,0,i,-n,0,i,n,-i,-n,0,-i,n,0,i,-n,0,i,n,0,-n,0,-i,n,0,-i,-n,0,i,n,0,i],a=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];Ht.call(this,r,a,e,t),this.type="DodecahedronBufferGeometry",this.parameters={radius:e,detail:t}}$i.prototype=Object.create(Ht.prototype);$i.prototype.constructor=$i;function ra(e,t,n,i,r,a){Te.call(this),this.type="TubeGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:r},a!==void 0&&console.warn("THREE.TubeGeometry: taper has been removed.");var o=new di(e,t,n,i,r);this.tangents=o.tangents,this.normals=o.normals,this.binormals=o.binormals,this.fromBufferGeometry(o),this.mergeVertices()}ra.prototype=Object.create(Te.prototype);ra.prototype.constructor=ra;function di(e,t,n,i,r){oe.call(this),this.type="TubeBufferGeometry",this.parameters={path:e,tubularSegments:t,radius:n,radialSegments:i,closed:r},t=t||64,n=n||1,i=i||8,r=r||!1;var a=e.computeFrenetFrames(t,r);this.tangents=a.tangents,this.normals=a.normals,this.binormals=a.binormals;var o=new E,s=new E,l=new j,c=new E,u,h,d=[],f=[],p=[],v=[];m(),this.setIndex(v),this.addAttribute("position",new $(d,3)),this.addAttribute("normal",new $(f,3)),this.addAttribute("uv",new $(p,2));function m(){for(u=0;u<t;u++)g(u);g(r===!1?t:0),b(),y()}function g(_){c=e.getPointAt(_/t,c);var w=a.normals[_],L=a.binormals[_];for(h=0;h<=i;h++){var R=h/i*Math.PI*2,k=Math.sin(R),O=-Math.cos(R);s.x=O*w.x+k*L.x,s.y=O*w.y+k*L.y,s.z=O*w.z+k*L.z,s.normalize(),f.push(s.x,s.y,s.z),o.x=c.x+n*s.x,o.y=c.y+n*s.y,o.z=c.z+n*s.z,d.push(o.x,o.y,o.z)}}function y(){for(h=1;h<=t;h++)for(u=1;u<=i;u++){var _=(i+1)*(h-1)+(u-1),w=(i+1)*h+(u-1),L=(i+1)*h+u,R=(i+1)*(h-1)+u;v.push(_,w,R),v.push(w,L,R)}}function b(){for(u=0;u<=t;u++)for(h=0;h<=i;h++)l.x=u/t,l.y=h/i,p.push(l.x,l.y)}}di.prototype=Object.create(oe.prototype);di.prototype.constructor=di;di.prototype.toJSON=function(){var e=oe.prototype.toJSON.call(this);return e.path=this.parameters.path.toJSON(),e};function aa(e,t,n,i,r,a,o){Te.call(this),this.type="TorusKnotGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:r,q:a},o!==void 0&&console.warn("THREE.TorusKnotGeometry: heightScale has been deprecated. Use .scale( x, y, z ) instead."),this.fromBufferGeometry(new Ki(e,t,n,i,r,a)),this.mergeVertices()}aa.prototype=Object.create(Te.prototype);aa.prototype.constructor=aa;function Ki(e,t,n,i,r,a){oe.call(this),this.type="TorusKnotBufferGeometry",this.parameters={radius:e,tube:t,tubularSegments:n,radialSegments:i,p:r,q:a},e=e||1,t=t||.4,n=Math.floor(n)||64,i=Math.floor(i)||8,r=r||2,a=a||3;var o=[],s=[],l=[],c=[],u,h,d=new E,f=new E,p=new E,v=new E,m=new E,g=new E,y=new E;for(u=0;u<=n;++u){var b=u/n*r*Math.PI*2;for(C(b,r,a,e,p),C(b+.01,r,a,e,v),g.subVectors(v,p),y.addVectors(v,p),m.crossVectors(g,y),y.crossVectors(m,g),m.normalize(),y.normalize(),h=0;h<=i;++h){var _=h/i*Math.PI*2,w=-t*Math.cos(_),L=t*Math.sin(_);d.x=p.x+(w*y.x+L*m.x),d.y=p.y+(w*y.y+L*m.y),d.z=p.z+(w*y.z+L*m.z),s.push(d.x,d.y,d.z),f.subVectors(d,p).normalize(),l.push(f.x,f.y,f.z),c.push(u/n),c.push(h/i)}}for(h=1;h<=n;h++)for(u=1;u<=i;u++){var R=(i+1)*(h-1)+(u-1),k=(i+1)*h+(u-1),O=(i+1)*h+u,z=(i+1)*(h-1)+u;o.push(R,k,z),o.push(k,O,z)}this.setIndex(o),this.addAttribute("position",new $(s,3)),this.addAttribute("normal",new $(l,3)),this.addAttribute("uv",new $(c,2));function C(I,N,H,G,X){var Z=Math.cos(I),V=Math.sin(I),Y=H/N*I,J=Math.cos(Y);X.x=G*(2+J)*.5*Z,X.y=G*(2+J)*V*.5,X.z=G*Math.sin(Y)*.5}}Ki.prototype=Object.create(oe.prototype);Ki.prototype.constructor=Ki;function oa(e,t,n,i,r){Te.call(this),this.type="TorusGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:r},this.fromBufferGeometry(new er(e,t,n,i,r)),this.mergeVertices()}oa.prototype=Object.create(Te.prototype);oa.prototype.constructor=oa;function er(e,t,n,i,r){oe.call(this),this.type="TorusBufferGeometry",this.parameters={radius:e,tube:t,radialSegments:n,tubularSegments:i,arc:r},e=e||1,t=t||.4,n=Math.floor(n)||8,i=Math.floor(i)||6,r=r||Math.PI*2;var a=[],o=[],s=[],l=[],c=new E,u=new E,h=new E,d,f;for(d=0;d<=n;d++)for(f=0;f<=i;f++){var p=f/i*r,v=d/n*Math.PI*2;u.x=(e+t*Math.cos(v))*Math.cos(p),u.y=(e+t*Math.cos(v))*Math.sin(p),u.z=t*Math.sin(v),o.push(u.x,u.y,u.z),c.x=e*Math.cos(p),c.y=e*Math.sin(p),h.subVectors(u,c).normalize(),s.push(h.x,h.y,h.z),l.push(f/i),l.push(d/n)}for(d=1;d<=n;d++)for(f=1;f<=i;f++){var m=(i+1)*d+f-1,g=(i+1)*(d-1)+f-1,y=(i+1)*(d-1)+f,b=(i+1)*d+f;a.push(m,g,b),a.push(g,y,b)}this.setIndex(a),this.addAttribute("position",new $(o,3)),this.addAttribute("normal",new $(s,3)),this.addAttribute("uv",new $(l,2))}er.prototype=Object.create(oe.prototype);er.prototype.constructor=er;var wg={triangulate:function(e,t,n){n=n||2;var i=t&&t.length,r=i?t[0]*n:e.length,a=Gu(e,0,r,n,!0),o=[];if(!a||a.next===a.prev)return o;var s,l,c,u,h,d,f;if(i&&(a=Ag(e,t,a,n)),e.length>80*n){s=c=e[0],l=u=e[1];for(var p=n;p<r;p+=n)h=e[p],d=e[p+1],h<s&&(s=h),d<l&&(l=d),h>c&&(c=h),d>u&&(u=d);f=Math.max(c-s,u-l),f=f!==0?1/f:0}return la(a,o,n,s,l,f),o}};function Gu(e,t,n,i,r){var a,o;if(r===Bg(e,t,n,i)>0)for(a=t;a<n;a+=i)o=tc(a,e[a],e[a+1],o);else for(a=n-i;a>=t;a-=i)o=tc(a,e[a],e[a+1],o);return o&&Kn(o,o.next)&&(ua(o),o=o.next),o}function sa(e,t){if(!e)return e;t||(t=e);var n=e,i;do if(i=!1,!n.steiner&&(Kn(n,n.next)||wt(n.prev,n,n.next)===0)){if(ua(n),n=t=n.prev,n===n.next)break;i=!0}else n=n.next;while(i||n!==t);return t}function la(e,t,n,i,r,a,o){if(e){!o&&a&&Ig(e,i,r,a);for(var s=e,l,c;e.prev!==e.next;){if(l=e.prev,c=e.next,a?Mg(e,i,r,a):Eg(e)){t.push(l.i/n),t.push(e.i/n),t.push(c.i/n),ua(e),e=c.next,s=c.next;continue}if(e=c,e===s){o?o===1?(e=Sg(e,t,n),la(e,t,n,i,r,a,2)):o===2&&Tg(e,t,n,i,r,a):la(sa(e),t,n,i,r,a,1);break}}}}function Eg(e){var t=e.prev,n=e,i=e.next;if(wt(t,n,i)>=0)return!1;for(var r=e.next.next;r!==e.prev;){if(Ni(t.x,t.y,n.x,n.y,i.x,i.y,r.x,r.y)&&wt(r.prev,r,r.next)>=0)return!1;r=r.next}return!0}function Mg(e,t,n,i){var r=e.prev,a=e,o=e.next;if(wt(r,a,o)>=0)return!1;for(var s=r.x<a.x?r.x<o.x?r.x:o.x:a.x<o.x?a.x:o.x,l=r.y<a.y?r.y<o.y?r.y:o.y:a.y<o.y?a.y:o.y,c=r.x>a.x?r.x>o.x?r.x:o.x:a.x>o.x?a.x:o.x,u=r.y>a.y?r.y>o.y?r.y:o.y:a.y>o.y?a.y:o.y,h=Rs(s,l,t,n,i),d=Rs(c,u,t,n,i),f=e.prevZ,p=e.nextZ;f&&f.z>=h&&p&&p.z<=d;){if(f!==e.prev&&f!==e.next&&Ni(r.x,r.y,a.x,a.y,o.x,o.y,f.x,f.y)&&wt(f.prev,f,f.next)>=0||(f=f.prevZ,p!==e.prev&&p!==e.next&&Ni(r.x,r.y,a.x,a.y,o.x,o.y,p.x,p.y)&&wt(p.prev,p,p.next)>=0))return!1;p=p.nextZ}for(;f&&f.z>=h;){if(f!==e.prev&&f!==e.next&&Ni(r.x,r.y,a.x,a.y,o.x,o.y,f.x,f.y)&&wt(f.prev,f,f.next)>=0)return!1;f=f.prevZ}for(;p&&p.z<=d;){if(p!==e.prev&&p!==e.next&&Ni(r.x,r.y,a.x,a.y,o.x,o.y,p.x,p.y)&&wt(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function Sg(e,t,n){var i=e;do{var r=i.prev,a=i.next.next;!Kn(r,a)&&Vu(r,i,i.next,a)&&ca(r,a)&&ca(a,r)&&(t.push(r.i/n),t.push(i.i/n),t.push(a.i/n),ua(i),ua(i.next),i=e=a),i=i.next}while(i!==e);return i}function Tg(e,t,n,i,r,a){var o=e;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&Dg(o,s)){var l=Wu(o,s);o=sa(o,o.next),l=sa(l,l.next),la(o,t,n,i,r,a),la(l,t,n,i,r,a);return}s=s.next}o=o.next}while(o!==e)}function Ag(e,t,n,i){var r=[],a,o,s,l,c;for(a=0,o=t.length;a<o;a++)s=t[a]*i,l=a<o-1?t[a+1]*i:e.length,c=Gu(e,s,l,i,!1),c===c.next&&(c.steiner=!0),r.push(Og(c));for(r.sort(Lg),a=0;a<r.length;a++)Cg(r[a],n),n=sa(n,n.next);return n}function Lg(e,t){return e.x-t.x}function Cg(e,t){if(t=Rg(e,t),t){var n=Wu(t,e);sa(n,n.next)}}function Rg(e,t){var n=t,i=e.x,r=e.y,a=-1/0,o;do{if(r<=n.y&&r>=n.next.y&&n.next.y!==n.y){var s=n.x+(r-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=i&&s>a){if(a=s,s===i){if(r===n.y)return n;if(r===n.next.y)return n.next}o=n.x<n.next.x?n:n.next}}n=n.next}while(n!==t);if(!o)return null;if(i===a)return o.prev;var l=o,c=o.x,u=o.y,h=1/0,d;for(n=o.next;n!==l;)i>=n.x&&n.x>=c&&i!==n.x&&Ni(r<u?i:a,r,c,u,r<u?a:i,r,n.x,n.y)&&(d=Math.abs(r-n.y)/(i-n.x),(d<h||d===h&&n.x>o.x)&&ca(n,e)&&(o=n,h=d)),n=n.next;return o}function Ig(e,t,n,i){var r=e;do r.z===null&&(r.z=Rs(r.x,r.y,t,n,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==e);r.prevZ.nextZ=null,r.prevZ=null,Pg(r)}function Pg(e){var t,n,i,r,a,o,s,l,c=1;do{for(n=e,e=null,a=null,o=0;n;){for(o++,i=n,s=0,t=0;t<c&&(s++,i=i.nextZ,!!i);t++);for(l=c;s>0||l>0&&i;)s!==0&&(l===0||!i||n.z<=i.z)?(r=n,n=n.nextZ,s--):(r=i,i=i.nextZ,l--),a?a.nextZ=r:e=r,r.prevZ=a,a=r;n=i}a.nextZ=null,c*=2}while(o>1);return e}function Rs(e,t,n,i,r){return e=32767*(e-n)*r,t=32767*(t-i)*r,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function Og(e){var t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function Ni(e,t,n,i,r,a,o,s){return(r-o)*(t-s)-(e-o)*(a-s)>=0&&(e-o)*(i-s)-(n-o)*(t-s)>=0&&(n-o)*(a-s)-(r-o)*(i-s)>=0}function Dg(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!kg(e,t)&&ca(e,t)&&ca(t,e)&&Ng(e,t)}function wt(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function Kn(e,t){return e.x===t.x&&e.y===t.y}function Vu(e,t,n,i){return Kn(e,n)&&Kn(t,i)||Kn(e,i)&&Kn(n,t)?!0:wt(e,t,n)>0!=wt(e,t,i)>0&&wt(n,i,e)>0!=wt(n,i,t)>0}function kg(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&Vu(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function ca(e,t){return wt(e.prev,e,e.next)<0?wt(e,t,e.next)>=0&&wt(e,e.prev,t)>=0:wt(e,t,e.prev)<0||wt(e,e.next,t)<0}function Ng(e,t){var n=e,i=!1,r=(e.x+t.x)/2,a=(e.y+t.y)/2;do n.y>a!=n.next.y>a&&n.next.y!==n.y&&r<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(i=!i),n=n.next;while(n!==e);return i}function Wu(e,t){var n=new Is(e.i,e.x,e.y),i=new Is(t.i,t.x,t.y),r=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=r,r.prev=n,i.next=n,n.prev=i,a.next=i,i.prev=a,i}function tc(e,t,n,i){var r=new Is(e,t,n);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function ua(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function Is(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Bg(e,t,n,i){for(var r=0,a=t,o=n-i;a<n;a+=i)r+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return r}var Pn={area:function(e){for(var t=e.length,n=0,i=t-1,r=0;r<t;i=r++)n+=e[i].x*e[r].y-e[r].x*e[i].y;return n*.5},isClockWise:function(e){return Pn.area(e)<0},triangulateShape:function(e,t){var n=[],i=[],r=[];nc(e),ic(n,e);var a=e.length;t.forEach(nc);for(var o=0;o<t.length;o++)i.push(a),a+=t[o].length,ic(n,t[o]);for(var s=wg.triangulate(n,i),o=0;o<s.length;o+=3)r.push(s.slice(o,o+3));return r}};function nc(e){var t=e.length;t>2&&e[t-1].equals(e[0])&&e.pop()}function ic(e,t){for(var n=0;n<t.length;n++)e.push(t[n].x),e.push(t[n].y)}function fi(e,t){Te.call(this),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},this.fromBufferGeometry(new Mn(e,t)),this.mergeVertices()}fi.prototype=Object.create(Te.prototype);fi.prototype.constructor=fi;fi.prototype.toJSON=function(){var e=Te.prototype.toJSON.call(this),t=this.parameters.shapes,n=this.parameters.options;return ju(t,n,e)};function Mn(e,t){oe.call(this),this.type="ExtrudeBufferGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];for(var n=this,i=[],r=[],a=0,o=e.length;a<o;a++){var s=e[a];l(s)}this.addAttribute("position",new $(i,3)),this.addAttribute("uv",new $(r,2)),this.computeVertexNormals();function l(c){var u=[],h=t.curveSegments!==void 0?t.curveSegments:12,d=t.steps!==void 0?t.steps:1,f=t.depth!==void 0?t.depth:100,p=t.bevelEnabled!==void 0?t.bevelEnabled:!0,v=t.bevelThickness!==void 0?t.bevelThickness:6,m=t.bevelSize!==void 0?t.bevelSize:v-2,g=t.bevelOffset!==void 0?t.bevelOffset:0,y=t.bevelSegments!==void 0?t.bevelSegments:3,b=t.extrudePath,_=t.UVGenerator!==void 0?t.UVGenerator:zg;t.amount!==void 0&&(console.warn("THREE.ExtrudeBufferGeometry: amount has been renamed to depth."),f=t.amount);var w,L=!1,R,k,O,z;b&&(w=b.getSpacedPoints(d),L=!0,p=!1,R=b.computeFrenetFrames(d,!1),k=new E,O=new E,z=new E),p||(y=0,v=0,m=0,g=0);var C,I,N,H=c.extractPoints(h),G=H.shape,X=H.holes,Z=!Pn.isClockWise(G);if(Z)for(G=G.reverse(),I=0,N=X.length;I<N;I++)C=X[I],Pn.isClockWise(C)&&(X[I]=C.reverse());var V=Pn.triangulateShape(G,X),Y=G;for(I=0,N=X.length;I<N;I++)C=X[I],G=G.concat(C);function J(We,D,se){return D||console.error("THREE.ExtrudeGeometry: vec does not exist"),D.clone().multiplyScalar(se).add(We)}var ie,ce,Re,F,ue,K=G.length,be,xe=V.length;function Ne(We,D,se){var pe,Ce,me,je=We.x-D.x,Ke=We.y-D.y,Je=se.x-We.x,mt=se.y-We.y,Xe=je*je+Ke*Ke,Nt=je*mt-Ke*Je;if(Math.abs(Nt)>Number.EPSILON){var Bt=Math.sqrt(Xe),wr=Math.sqrt(Je*Je+mt*mt),Kt=D.x-Ke/Bt,Oa=D.y+je/Bt,jo=se.x-mt/wr,Yo=se.y+Je/wr,Da=((jo-Kt)*mt-(Yo-Oa)*Je)/(je*mt-Ke*Je);pe=Kt+je*Da-We.x,Ce=Oa+Ke*Da-We.y;var ka=pe*pe+Ce*Ce;if(ka<=2)return new j(pe,Ce);me=Math.sqrt(ka/2)}else{var Ci=!1;je>Number.EPSILON?Je>Number.EPSILON&&(Ci=!0):je<-Number.EPSILON?Je<-Number.EPSILON&&(Ci=!0):Math.sign(Ke)===Math.sign(mt)&&(Ci=!0),Ci?(pe=-Ke,Ce=je,me=Math.sqrt(Xe)):(pe=je,Ce=Ke,me=Math.sqrt(Xe/2))}return new j(pe/me,Ce/me)}for(var A=[],M=0,W=Y.length,Q=W-1,_e=M+1;M<W;M++,Q++,_e++)Q===W&&(Q=0),_e===W&&(_e=0),A[M]=Ne(Y[M],Y[Q],Y[_e]);var he=[],ee,B=A.concat();for(I=0,N=X.length;I<N;I++){for(C=X[I],ee=[],M=0,W=C.length,Q=W-1,_e=M+1;M<W;M++,Q++,_e++)Q===W&&(Q=0),_e===W&&(_e=0),ee[M]=Ne(C[M],C[Q],C[_e]);he.push(ee),B=B.concat(ee)}for(ie=0;ie<y;ie++){for(Re=ie/y,F=v*Math.cos(Re*Math.PI/2),ce=m*Math.sin(Re*Math.PI/2)+g,M=0,W=Y.length;M<W;M++)ue=J(Y[M],A[M],ce),Ee(ue.x,ue.y,-F);for(I=0,N=X.length;I<N;I++)for(C=X[I],ee=he[I],M=0,W=C.length;M<W;M++)ue=J(C[M],ee[M],ce),Ee(ue.x,ue.y,-F)}for(ce=m+g,M=0;M<K;M++)ue=p?J(G[M],B[M],ce):G[M],L?(O.copy(R.normals[0]).multiplyScalar(ue.x),k.copy(R.binormals[0]).multiplyScalar(ue.y),z.copy(w[0]).add(O).add(k),Ee(z.x,z.y,z.z)):Ee(ue.x,ue.y,0);var re;for(re=1;re<=d;re++)for(M=0;M<K;M++)ue=p?J(G[M],B[M],ce):G[M],L?(O.copy(R.normals[re]).multiplyScalar(ue.x),k.copy(R.binormals[re]).multiplyScalar(ue.y),z.copy(w[re]).add(O).add(k),Ee(z.x,z.y,z.z)):Ee(ue.x,ue.y,f/d*re);for(ie=y-1;ie>=0;ie--){for(Re=ie/y,F=v*Math.cos(Re*Math.PI/2),ce=m*Math.sin(Re*Math.PI/2)+g,M=0,W=Y.length;M<W;M++)ue=J(Y[M],A[M],ce),Ee(ue.x,ue.y,f+F);for(I=0,N=X.length;I<N;I++)for(C=X[I],ee=he[I],M=0,W=C.length;M<W;M++)ue=J(C[M],ee[M],ce),L?Ee(ue.x,ue.y+w[d-1].y,w[d-1].x+F):Ee(ue.x,ue.y,f+F)}Se(),Le();function Se(){var We=i.length/3;if(p){var D=0,se=K*D;for(M=0;M<xe;M++)be=V[M],it(be[2]+se,be[1]+se,be[0]+se);for(D=d+y*2,se=K*D,M=0;M<xe;M++)be=V[M],it(be[0]+se,be[1]+se,be[2]+se)}else{for(M=0;M<xe;M++)be=V[M],it(be[2],be[1],be[0]);for(M=0;M<xe;M++)be=V[M],it(be[0]+K*d,be[1]+K*d,be[2]+K*d)}n.addGroup(We,i.length/3-We,0)}function Le(){var We=i.length/3,D=0;for(Ue(Y,D),D+=Y.length,I=0,N=X.length;I<N;I++)C=X[I],Ue(C,D),D+=C.length;n.addGroup(We,i.length/3-We,1)}function Ue(We,D){var se,pe;for(M=We.length;--M>=0;){se=M,pe=M-1,pe<0&&(pe=We.length-1);var Ce=0,me=d+y*2;for(Ce=0;Ce<me;Ce++){var je=K*Ce,Ke=K*(Ce+1),Je=D+se+je,mt=D+pe+je,Xe=D+pe+Ke,Nt=D+se+Ke;ft(Je,mt,Xe,Nt)}}}function Ee(We,D,se){u.push(We),u.push(D),u.push(se)}function it(We,D,se){Tt(We),Tt(D),Tt(se);var pe=i.length/3,Ce=_.generateTopUV(n,i,pe-3,pe-2,pe-1);kt(Ce[0]),kt(Ce[1]),kt(Ce[2])}function ft(We,D,se,pe){Tt(We),Tt(D),Tt(pe),Tt(D),Tt(se),Tt(pe);var Ce=i.length/3,me=_.generateSideWallUV(n,i,Ce-6,Ce-3,Ce-2,Ce-1);kt(me[0]),kt(me[1]),kt(me[3]),kt(me[1]),kt(me[2]),kt(me[3])}function Tt(We){i.push(u[We*3+0]),i.push(u[We*3+1]),i.push(u[We*3+2])}function kt(We){r.push(We.x),r.push(We.y)}}}Mn.prototype=Object.create(oe.prototype);Mn.prototype.constructor=Mn;Mn.prototype.toJSON=function(){var e=oe.prototype.toJSON.call(this),t=this.parameters.shapes,n=this.parameters.options;return ju(t,n,e)};var zg={generateTopUV:function(e,t,n,i,r){var a=t[n*3],o=t[n*3+1],s=t[i*3],l=t[i*3+1],c=t[r*3],u=t[r*3+1];return[new j(a,o),new j(s,l),new j(c,u)]},generateSideWallUV:function(e,t,n,i,r,a){var o=t[n*3],s=t[n*3+1],l=t[n*3+2],c=t[i*3],u=t[i*3+1],h=t[i*3+2],d=t[r*3],f=t[r*3+1],p=t[r*3+2],v=t[a*3],m=t[a*3+1],g=t[a*3+2];return Math.abs(s-u)<.01?[new j(o,1-l),new j(c,1-h),new j(d,1-p),new j(v,1-g)]:[new j(s,1-l),new j(u,1-h),new j(f,1-p),new j(m,1-g)]}};function ju(e,t,n){if(n.shapes=[],Array.isArray(e))for(var i=0,r=e.length;i<r;i++){var a=e[i];n.shapes.push(a.uuid)}else n.shapes.push(e.uuid);return t.extrudePath!==void 0&&(n.options.extrudePath=t.extrudePath.toJSON()),n}function ha(e,t){Te.call(this),this.type="TextGeometry",this.parameters={text:e,parameters:t},this.fromBufferGeometry(new tr(e,t)),this.mergeVertices()}ha.prototype=Object.create(Te.prototype);ha.prototype.constructor=ha;function tr(e,t){t=t||{};var n=t.font;if(!(n&&n.isFont))return console.error("THREE.TextGeometry: font parameter is not an instance of THREE.Font."),new Te;var i=n.generateShapes(e,t.size);t.depth=t.height!==void 0?t.height:50,t.bevelThickness===void 0&&(t.bevelThickness=10),t.bevelSize===void 0&&(t.bevelSize=8),t.bevelEnabled===void 0&&(t.bevelEnabled=!1),Mn.call(this,i,t),this.type="TextBufferGeometry"}tr.prototype=Object.create(Mn.prototype);tr.prototype.constructor=tr;function da(e,t,n,i,r,a,o){Te.call(this),this.type="SphereGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:r,thetaStart:a,thetaLength:o},this.fromBufferGeometry(new qn(e,t,n,i,r,a,o)),this.mergeVertices()}da.prototype=Object.create(Te.prototype);da.prototype.constructor=da;function qn(e,t,n,i,r,a,o){oe.call(this),this.type="SphereBufferGeometry",this.parameters={radius:e,widthSegments:t,heightSegments:n,phiStart:i,phiLength:r,thetaStart:a,thetaLength:o},e=e||1,t=Math.max(3,Math.floor(t)||8),n=Math.max(2,Math.floor(n)||6),i=i!==void 0?i:0,r=r!==void 0?r:Math.PI*2,a=a!==void 0?a:0,o=o!==void 0?o:Math.PI;var s=Math.min(a+o,Math.PI),l,c,u=0,h=[],d=new E,f=new E,p=[],v=[],m=[],g=[];for(c=0;c<=n;c++){var y=[],b=c/n,_=0;for(c==0&&a==0?_=.5/t:c==n&&s==Math.PI&&(_=-.5/t),l=0;l<=t;l++){var w=l/t;d.x=-e*Math.cos(i+w*r)*Math.sin(a+b*o),d.y=e*Math.cos(a+b*o),d.z=e*Math.sin(i+w*r)*Math.sin(a+b*o),v.push(d.x,d.y,d.z),f.copy(d).normalize(),m.push(f.x,f.y,f.z),g.push(w+_,1-b),y.push(u++)}h.push(y)}for(c=0;c<n;c++)for(l=0;l<t;l++){var L=h[c][l+1],R=h[c][l],k=h[c+1][l],O=h[c+1][l+1];(c!==0||a>0)&&p.push(L,R,O),(c!==n-1||s<Math.PI)&&p.push(R,k,O)}this.setIndex(p),this.addAttribute("position",new $(v,3)),this.addAttribute("normal",new $(m,3)),this.addAttribute("uv",new $(g,2))}qn.prototype=Object.create(oe.prototype);qn.prototype.constructor=qn;function fa(e,t,n,i,r,a){Te.call(this),this.type="RingGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:a},this.fromBufferGeometry(new nr(e,t,n,i,r,a)),this.mergeVertices()}fa.prototype=Object.create(Te.prototype);fa.prototype.constructor=fa;function nr(e,t,n,i,r,a){oe.call(this),this.type="RingBufferGeometry",this.parameters={innerRadius:e,outerRadius:t,thetaSegments:n,phiSegments:i,thetaStart:r,thetaLength:a},e=e||.5,t=t||1,r=r!==void 0?r:0,a=a!==void 0?a:Math.PI*2,n=n!==void 0?Math.max(3,n):8,i=i!==void 0?Math.max(1,i):1;var o=[],s=[],l=[],c=[],u,h=e,d=(t-e)/i,f=new E,p=new j,v,m;for(v=0;v<=i;v++){for(m=0;m<=n;m++)u=r+m/n*a,f.x=h*Math.cos(u),f.y=h*Math.sin(u),s.push(f.x,f.y,f.z),l.push(0,0,1),p.x=(f.x/t+1)/2,p.y=(f.y/t+1)/2,c.push(p.x,p.y);h+=d}for(v=0;v<i;v++){var g=v*(n+1);for(m=0;m<n;m++){u=m+g;var y=u,b=u+n+1,_=u+n+2,w=u+1;o.push(y,b,w),o.push(b,_,w)}}this.setIndex(o),this.addAttribute("position",new $(s,3)),this.addAttribute("normal",new $(l,3)),this.addAttribute("uv",new $(c,2))}nr.prototype=Object.create(oe.prototype);nr.prototype.constructor=nr;function pa(e,t,n,i){Te.call(this),this.type="LatheGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},this.fromBufferGeometry(new ir(e,t,n,i)),this.mergeVertices()}pa.prototype=Object.create(Te.prototype);pa.prototype.constructor=pa;function ir(e,t,n,i){oe.call(this),this.type="LatheBufferGeometry",this.parameters={points:e,segments:t,phiStart:n,phiLength:i},t=Math.floor(t)||12,n=n||0,i=i||Math.PI*2,i=Pe.clamp(i,0,Math.PI*2);var r=[],a=[],o=[],s,l=1/t,c=new E,u=new j,h,d;for(h=0;h<=t;h++){var f=n+h*l*i,p=Math.sin(f),v=Math.cos(f);for(d=0;d<=e.length-1;d++)c.x=e[d].x*p,c.y=e[d].y,c.z=e[d].x*v,a.push(c.x,c.y,c.z),u.x=h/t,u.y=d/(e.length-1),o.push(u.x,u.y)}for(h=0;h<t;h++)for(d=0;d<e.length-1;d++){s=d+h*e.length;var m=s,g=s+e.length,y=s+e.length+1,b=s+1;r.push(m,g,b),r.push(g,y,b)}if(this.setIndex(r),this.addAttribute("position",new $(a,3)),this.addAttribute("uv",new $(o,2)),this.computeVertexNormals(),i===Math.PI*2){var _=this.attributes.normal.array,w=new E,L=new E,R=new E;for(s=t*e.length*3,h=0,d=0;h<e.length;h++,d+=3)w.x=_[d+0],w.y=_[d+1],w.z=_[d+2],L.x=_[s+d+0],L.y=_[s+d+1],L.z=_[s+d+2],R.addVectors(w,L).normalize(),_[d+0]=_[s+d+0]=R.x,_[d+1]=_[s+d+1]=R.y,_[d+2]=_[s+d+2]=R.z}}ir.prototype=Object.create(oe.prototype);ir.prototype.constructor=ir;function pi(e,t){Te.call(this),this.type="ShapeGeometry",typeof t=="object"&&(console.warn("THREE.ShapeGeometry: Options parameter has been removed."),t=t.curveSegments),this.parameters={shapes:e,curveSegments:t},this.fromBufferGeometry(new mi(e,t)),this.mergeVertices()}pi.prototype=Object.create(Te.prototype);pi.prototype.constructor=pi;pi.prototype.toJSON=function(){var e=Te.prototype.toJSON.call(this),t=this.parameters.shapes;return Yu(t,e)};function mi(e,t){oe.call(this),this.type="ShapeBufferGeometry",this.parameters={shapes:e,curveSegments:t},t=t||12;var n=[],i=[],r=[],a=[],o=0,s=0;if(Array.isArray(e)===!1)c(e);else for(var l=0;l<e.length;l++)c(e[l]),this.addGroup(o,s,l),o+=s,s=0;this.setIndex(n),this.addAttribute("position",new $(i,3)),this.addAttribute("normal",new $(r,3)),this.addAttribute("uv",new $(a,2));function c(u){var h,d,f,p=i.length/3,v=u.extractPoints(t),m=v.shape,g=v.holes;for(Pn.isClockWise(m)===!1&&(m=m.reverse()),h=0,d=g.length;h<d;h++)f=g[h],Pn.isClockWise(f)===!0&&(g[h]=f.reverse());var y=Pn.triangulateShape(m,g);for(h=0,d=g.length;h<d;h++)f=g[h],m=m.concat(f);for(h=0,d=m.length;h<d;h++){var b=m[h];i.push(b.x,b.y,0),r.push(0,0,1),a.push(b.x,b.y)}for(h=0,d=y.length;h<d;h++){var _=y[h],w=_[0]+p,L=_[1]+p,R=_[2]+p;n.push(w,L,R),s+=3}}}mi.prototype=Object.create(oe.prototype);mi.prototype.constructor=mi;mi.prototype.toJSON=function(){var e=oe.prototype.toJSON.call(this),t=this.parameters.shapes;return Yu(t,e)};function Yu(e,t){if(t.shapes=[],Array.isArray(e))for(var n=0,i=e.length;n<i;n++){var r=e[n];t.shapes.push(r.uuid)}else t.shapes.push(e.uuid);return t}function rr(e,t){oe.call(this),this.type="EdgesGeometry",this.parameters={thresholdAngle:t},t=t!==void 0?t:1;var n=[],i=Math.cos(Pe.DEG2RAD*t),r=[0,0],a={},o,s,l,c=["a","b","c"],u;e.isBufferGeometry?(u=new Te,u.fromBufferGeometry(e)):u=e.clone(),u.mergeVertices(),u.computeFaceNormals();for(var h=u.vertices,d=u.faces,f=0,p=d.length;f<p;f++)for(var v=d[f],m=0;m<3;m++)o=v[c[m]],s=v[c[(m+1)%3]],r[0]=Math.min(o,s),r[1]=Math.max(o,s),l=r[0]+","+r[1],a[l]===void 0?a[l]={index1:r[0],index2:r[1],face1:f,face2:void 0}:a[l].face2=f;for(l in a){var g=a[l];if(g.face2===void 0||d[g.face1].normal.dot(d[g.face2].normal)<=i){var y=h[g.index1];n.push(y.x,y.y,y.z),y=h[g.index2],n.push(y.x,y.y,y.z)}}this.addAttribute("position",new $(n,3))}rr.prototype=Object.create(oe.prototype);rr.prototype.constructor=rr;function vi(e,t,n,i,r,a,o,s){Te.call(this),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:r,openEnded:a,thetaStart:o,thetaLength:s},this.fromBufferGeometry(new Dn(e,t,n,i,r,a,o,s)),this.mergeVertices()}vi.prototype=Object.create(Te.prototype);vi.prototype.constructor=vi;function Dn(e,t,n,i,r,a,o,s){oe.call(this),this.type="CylinderBufferGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:i,heightSegments:r,openEnded:a,thetaStart:o,thetaLength:s};var l=this;e=e!==void 0?e:1,t=t!==void 0?t:1,n=n||1,i=Math.floor(i)||8,r=Math.floor(r)||1,a=a!==void 0?a:!1,o=o!==void 0?o:0,s=s!==void 0?s:Math.PI*2;var c=[],u=[],h=[],d=[],f=0,p=[],v=n/2,m=0;g(),a===!1&&(e>0&&y(!0),t>0&&y(!1)),this.setIndex(c),this.addAttribute("position",new $(u,3)),this.addAttribute("normal",new $(h,3)),this.addAttribute("uv",new $(d,2));function g(){var b,_,w=new E,L=new E,R=0,k=(t-e)/n;for(_=0;_<=r;_++){var O=[],z=_/r,C=z*(t-e)+e;for(b=0;b<=i;b++){var I=b/i,N=I*s+o,H=Math.sin(N),G=Math.cos(N);L.x=C*H,L.y=-z*n+v,L.z=C*G,u.push(L.x,L.y,L.z),w.set(H,k,G).normalize(),h.push(w.x,w.y,w.z),d.push(I,1-z),O.push(f++)}p.push(O)}for(b=0;b<i;b++)for(_=0;_<r;_++){var X=p[_][b],Z=p[_+1][b],V=p[_+1][b+1],Y=p[_][b+1];c.push(X,Z,Y),c.push(Z,V,Y),R+=6}l.addGroup(m,R,0),m+=R}function y(b){var _,w,L,R=new j,k=new E,O=0,z=b===!0?e:t,C=b===!0?1:-1;for(w=f,_=1;_<=i;_++)u.push(0,v*C,0),h.push(0,C,0),d.push(.5,.5),f++;for(L=f,_=0;_<=i;_++){var I=_/i,N=I*s+o,H=Math.cos(N),G=Math.sin(N);k.x=z*G,k.y=v*C,k.z=z*H,u.push(k.x,k.y,k.z),h.push(0,C,0),R.x=H*.5+.5,R.y=G*.5*C+.5,d.push(R.x,R.y),f++}for(_=0;_<i;_++){var X=w+_,Z=L+_;b===!0?c.push(Z,Z+1,X):c.push(Z+1,Z,X),O+=3}l.addGroup(m,O,b===!0?1:2),m+=O}}Dn.prototype=Object.create(oe.prototype);Dn.prototype.constructor=Dn;function ma(e,t,n,i,r,a,o){vi.call(this,0,e,t,n,i,r,a,o),this.type="ConeGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:a,thetaLength:o}}ma.prototype=Object.create(vi.prototype);ma.prototype.constructor=ma;function va(e,t,n,i,r,a,o){Dn.call(this,0,e,t,n,i,r,a,o),this.type="ConeBufferGeometry",this.parameters={radius:e,height:t,radialSegments:n,heightSegments:i,openEnded:r,thetaStart:a,thetaLength:o}}va.prototype=Object.create(Dn.prototype);va.prototype.constructor=va;function ga(e,t,n,i){Te.call(this),this.type="CircleGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},this.fromBufferGeometry(new ar(e,t,n,i)),this.mergeVertices()}ga.prototype=Object.create(Te.prototype);ga.prototype.constructor=ga;function ar(e,t,n,i){oe.call(this),this.type="CircleBufferGeometry",this.parameters={radius:e,segments:t,thetaStart:n,thetaLength:i},e=e||1,t=t!==void 0?Math.max(3,t):8,n=n!==void 0?n:0,i=i!==void 0?i:Math.PI*2;var r=[],a=[],o=[],s=[],l,c,u=new E,h=new j;for(a.push(0,0,0),o.push(0,0,1),s.push(.5,.5),c=0,l=3;c<=t;c++,l+=3){var d=n+c/t*i;u.x=e*Math.cos(d),u.y=e*Math.sin(d),a.push(u.x,u.y,u.z),o.push(0,0,1),h.x=(a[l]/e+1)/2,h.y=(a[l+1]/e+1)/2,s.push(h.x,h.y)}for(l=1;l<=t;l++)r.push(l,l+1,0);this.setIndex(r),this.addAttribute("position",new $(a,3)),this.addAttribute("normal",new $(o,3)),this.addAttribute("uv",new $(s,2))}ar.prototype=Object.create(oe.prototype);ar.prototype.constructor=ar;var Pt=Object.freeze({WireframeGeometry:Zi,ParametricGeometry:$r,ParametricBufferGeometry:qi,TetrahedronGeometry:ea,TetrahedronBufferGeometry:Ji,OctahedronGeometry:ta,OctahedronBufferGeometry:hi,IcosahedronGeometry:na,IcosahedronBufferGeometry:Qi,DodecahedronGeometry:ia,DodecahedronBufferGeometry:$i,PolyhedronGeometry:Kr,PolyhedronBufferGeometry:Ht,TubeGeometry:ra,TubeBufferGeometry:di,TorusKnotGeometry:aa,TorusKnotBufferGeometry:Ki,TorusGeometry:oa,TorusBufferGeometry:er,TextGeometry:ha,TextBufferGeometry:tr,SphereGeometry:da,SphereBufferGeometry:qn,RingGeometry:fa,RingBufferGeometry:nr,PlaneGeometry:Wr,PlaneBufferGeometry:ci,LatheGeometry:pa,LatheBufferGeometry:ir,ShapeGeometry:pi,ShapeBufferGeometry:mi,ExtrudeGeometry:fi,ExtrudeBufferGeometry:Mn,EdgesGeometry:rr,ConeGeometry:ma,ConeBufferGeometry:va,CylinderGeometry:vi,CylinderBufferGeometry:Dn,CircleGeometry:ga,CircleBufferGeometry:ar,BoxGeometry:Ui,BoxBufferGeometry:Wn});function gi(e){Oe.call(this),this.type="ShadowMaterial",this.color=new ye(0),this.transparent=!0,this.setValues(e)}gi.prototype=Object.create(Oe.prototype);gi.prototype.constructor=gi;gi.prototype.isShadowMaterial=!0;gi.prototype.copy=function(e){return Oe.prototype.copy.call(this,e),this.color.copy(e.color),this};function or(e){Dt.call(this,e),this.type="RawShaderMaterial"}or.prototype=Object.create(Dt.prototype);or.prototype.constructor=or;or.prototype.isRawShaderMaterial=!0;function Sn(e){Oe.call(this),this.defines={STANDARD:""},this.type="MeshStandardMaterial",this.color=new ye(16777215),this.roughness=.5,this.metalness=.5,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ye(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ia,this.normalScale=new j(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapIntensity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}Sn.prototype=Object.create(Oe.prototype);Sn.prototype.constructor=Sn;Sn.prototype.isMeshStandardMaterial=!0;Sn.prototype.copy=function(e){return Oe.prototype.copy.call(this,e),this.defines={STANDARD:""},this.color.copy(e.color),this.roughness=e.roughness,this.metalness=e.metalness,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.roughnessMap=e.roughnessMap,this.metalnessMap=e.metalnessMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapIntensity=e.envMapIntensity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this};function yi(e){Sn.call(this),this.defines={PHYSICAL:""},this.type="MeshPhysicalMaterial",this.reflectivity=.5,this.clearCoat=0,this.clearCoatRoughness=0,this.setValues(e)}yi.prototype=Object.create(Sn.prototype);yi.prototype.constructor=yi;yi.prototype.isMeshPhysicalMaterial=!0;yi.prototype.copy=function(e){return Sn.prototype.copy.call(this,e),this.defines={PHYSICAL:""},this.reflectivity=e.reflectivity,this.clearCoat=e.clearCoat,this.clearCoatRoughness=e.clearCoatRoughness,this};function cn(e){Oe.call(this),this.type="MeshPhongMaterial",this.color=new ye(16777215),this.specular=new ye(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ye(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ia,this.normalScale=new j(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Ca,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}cn.prototype=Object.create(Oe.prototype);cn.prototype.constructor=cn;cn.prototype.isMeshPhongMaterial=!0;cn.prototype.copy=function(e){return Oe.prototype.copy.call(this,e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this};function bi(e){cn.call(this),this.defines={TOON:""},this.type="MeshToonMaterial",this.gradientMap=null,this.setValues(e)}bi.prototype=Object.create(cn.prototype);bi.prototype.constructor=bi;bi.prototype.isMeshToonMaterial=!0;bi.prototype.copy=function(e){return cn.prototype.copy.call(this,e),this.gradientMap=e.gradientMap,this};function xi(e){Oe.call(this),this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ia,this.normalScale=new j(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}xi.prototype=Object.create(Oe.prototype);xi.prototype.constructor=xi;xi.prototype.isMeshNormalMaterial=!0;xi.prototype.copy=function(e){return Oe.prototype.copy.call(this,e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this};function _i(e){Oe.call(this),this.type="MeshLambertMaterial",this.color=new ye(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ye(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Ca,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.setValues(e)}_i.prototype=Object.create(Oe.prototype);_i.prototype.constructor=_i;_i.prototype.isMeshLambertMaterial=!0;_i.prototype.copy=function(e){return Oe.prototype.copy.call(this,e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this};function wi(e){Oe.call(this),this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new ye(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Ia,this.normalScale=new j(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.skinning=!1,this.morphTargets=!1,this.morphNormals=!1,this.lights=!1,this.setValues(e)}wi.prototype=Object.create(Oe.prototype);wi.prototype.constructor=wi;wi.prototype.isMeshMatcapMaterial=!0;wi.prototype.copy=function(e){return Oe.prototype.copy.call(this,e),this.defines={MATCAP:""},this.color.copy(e.color),this.matcap=e.matcap,this.map=e.map,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.alphaMap=e.alphaMap,this.skinning=e.skinning,this.morphTargets=e.morphTargets,this.morphNormals=e.morphNormals,this};function Ei(e){$e.call(this),this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(e)}Ei.prototype=Object.create($e.prototype);Ei.prototype.constructor=Ei;Ei.prototype.isLineDashedMaterial=!0;Ei.prototype.copy=function(e){return $e.prototype.copy.call(this,e),this.scale=e.scale,this.dashSize=e.dashSize,this.gapSize=e.gapSize,this};var Fg=Object.freeze({ShadowMaterial:gi,SpriteMaterial:Zn,RawShaderMaterial:or,ShaderMaterial:Dt,PointsMaterial:ln,MeshPhysicalMaterial:yi,MeshStandardMaterial:Sn,MeshPhongMaterial:cn,MeshToonMaterial:bi,MeshNormalMaterial:xi,MeshLambertMaterial:_i,MeshDepthMaterial:Yn,MeshDistanceMaterial:Xn,MeshBasicMaterial:Yt,MeshMatcapMaterial:wi,LineDashedMaterial:Ei,LineBasicMaterial:$e,Material:Oe}),gt={arraySlice:function(e,t,n){return gt.isTypedArray(e)?new e.constructor(e.subarray(t,n!==void 0?n:e.length)):e.slice(t,n)},convertArray:function(e,t,n){return!e||!n&&e.constructor===t?e:typeof t.BYTES_PER_ELEMENT=="number"?new t(e):Array.prototype.slice.call(e)},isTypedArray:function(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)},getKeyframeOrder:function(e){function t(a,o){return e[a]-e[o]}for(var n=e.length,i=new Array(n),r=0;r!==n;++r)i[r]=r;return i.sort(t),i},sortedArray:function(e,t,n){for(var i=e.length,r=new e.constructor(i),a=0,o=0;o!==i;++a)for(var s=n[a]*t,l=0;l!==t;++l)r[o++]=e[s+l];return r},flattenJSON:function(e,t,n,i){for(var r=1,a=e[0];a!==void 0&&a[i]===void 0;)a=e[r++];if(a!==void 0){var o=a[i];if(o!==void 0)if(Array.isArray(o))do o=a[i],o!==void 0&&(t.push(a.time),n.push.apply(n,o)),a=e[r++];while(a!==void 0);else if(o.toArray!==void 0)do o=a[i],o!==void 0&&(t.push(a.time),o.toArray(n,n.length)),a=e[r++];while(a!==void 0);else do o=a[i],o!==void 0&&(t.push(a.time),n.push(o)),a=e[r++];while(a!==void 0)}}};function jt(e,t,n,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(n),this.sampleValues=t,this.valueSize=n}Object.assign(jt.prototype,{evaluate:function(e){var t=this.parameterPositions,n=this._cachedIndex,i=t[n],r=t[n-1];e:{t:{var a;n:{i:if(!(e<i)){for(var o=n+2;;){if(i===void 0){if(e<r)break i;return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,e,r)}if(n===o)break;if(r=i,i=t[++n],e<i)break t}a=t.length;break n}if(!(e>=r)){var s=t[1];e<s&&(n=2,r=s);for(var o=n-2;;){if(r===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,i);if(n===o)break;if(i=r,r=t[--n-1],e>=r)break t}a=n,n=0;break n}break e}for(;n<a;){var l=n+a>>>1;e<t[l]?a=l:n=l+1}if(i=t[n],r=t[n-1],r===void 0)return this._cachedIndex=0,this.beforeStart_(0,e,i);if(i===void 0)return n=t.length,this._cachedIndex=n,this.afterEnd_(n-1,r,e)}this._cachedIndex=n,this.intervalChanged_(n,r,i)}return this.interpolate_(n,r,e,i)},settings:null,DefaultSettings_:{},getSettings_:function(){return this.settings||this.DefaultSettings_},copySampleValue_:function(e){for(var t=this.resultBuffer,n=this.sampleValues,i=this.valueSize,r=e*i,a=0;a!==i;++a)t[a]=n[r+a];return t},interpolate_:function(){throw new Error("call to abstract method")},intervalChanged_:function(){}});Object.assign(jt.prototype,{beforeStart_:jt.prototype.copySampleValue_,afterEnd_:jt.prototype.copySampleValue_});function ho(e,t,n,i){jt.call(this,e,t,n,i),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0}ho.prototype=Object.assign(Object.create(jt.prototype),{constructor:ho,DefaultSettings_:{endingStart:ri,endingEnd:ri},intervalChanged_:function(e,t,n){var i=this.parameterPositions,r=e-2,a=e+1,o=i[r],s=i[a];if(o===void 0)switch(this.getSettings_().endingStart){case $n:r=e,o=2*t-n;break;case kr:r=i.length-2,o=t+i[r]-i[r+1];break;default:r=e,o=n}if(s===void 0)switch(this.getSettings_().endingEnd){case $n:a=e,s=2*n-t;break;case kr:a=1,s=n+i[1]-i[0];break;default:a=e-1,s=t}var l=(n-t)*.5,c=this.valueSize;this._weightPrev=l/(t-o),this._weightNext=l/(s-n),this._offsetPrev=r*c,this._offsetNext=a*c},interpolate_:function(e,t,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=s-o,c=this._offsetPrev,u=this._offsetNext,h=this._weightPrev,d=this._weightNext,f=(n-t)/(i-t),p=f*f,v=p*f,m=-h*v+2*h*p-h*f,g=(1+h)*v+(-1.5-2*h)*p+(-.5+h)*f+1,y=(-1-d)*v+(1.5+d)*p+.5*f,b=d*v-d*p,_=0;_!==o;++_)r[_]=m*a[c+_]+g*a[l+_]+y*a[s+_]+b*a[u+_];return r}});function ya(e,t,n,i){jt.call(this,e,t,n,i)}ya.prototype=Object.assign(Object.create(jt.prototype),{constructor:ya,interpolate_:function(e,t,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=s-o,c=(n-t)/(i-t),u=1-c,h=0;h!==o;++h)r[h]=a[l+h]*u+a[s+h]*c;return r}});function fo(e,t,n,i){jt.call(this,e,t,n,i)}fo.prototype=Object.assign(Object.create(jt.prototype),{constructor:fo,interpolate_:function(e){return this.copySampleValue_(e-1)}});function St(e,t,n,i){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=gt.convertArray(t,this.TimeBufferType),this.values=gt.convertArray(n,this.ValueBufferType),this.setInterpolation(i||this.DefaultInterpolation)}Object.assign(St,{toJSON:function(e){var t=e.constructor,n;if(t.toJSON!==void 0)n=t.toJSON(e);else{n={name:e.name,times:gt.convertArray(e.times,Array),values:gt.convertArray(e.values,Array)};var i=e.getInterpolation();i!==e.DefaultInterpolation&&(n.interpolation=i)}return n.type=e.ValueTypeName,n}});Object.assign(St.prototype,{constructor:St,TimeBufferType:Float32Array,ValueBufferType:Float32Array,DefaultInterpolation:Lr,InterpolantFactoryMethodDiscrete:function(e){return new fo(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodLinear:function(e){return new ya(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:function(e){return new ho(this.times,this.values,this.getValueSize(),e)},setInterpolation:function(e){var t;switch(e){case Dr:t=this.InterpolantFactoryMethodDiscrete;break;case Lr:t=this.InterpolantFactoryMethodLinear;break;case Qa:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){var n="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(n);return console.warn("THREE.KeyframeTrack:",n),this}return this.createInterpolant=t,this},getInterpolation:function(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Dr;case this.InterpolantFactoryMethodLinear:return Lr;case this.InterpolantFactoryMethodSmooth:return Qa}},getValueSize:function(){return this.values.length/this.times.length},shift:function(e){if(e!==0)for(var t=this.times,n=0,i=t.length;n!==i;++n)t[n]+=e;return this},scale:function(e){if(e!==1)for(var t=this.times,n=0,i=t.length;n!==i;++n)t[n]*=e;return this},trim:function(e,t){for(var n=this.times,i=n.length,r=0,a=i-1;r!==i&&n[r]<e;)++r;for(;a!==-1&&n[a]>t;)--a;if(++a,r!==0||a!==i){r>=a&&(a=Math.max(a,1),r=a-1);var o=this.getValueSize();this.times=gt.arraySlice(n,r,a),this.values=gt.arraySlice(this.values,r*o,a*o)}return this},validate:function(){var e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);var n=this.times,i=this.values,r=n.length;r===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);for(var a=null,o=0;o!==r;o++){var s=n[o];if(typeof s=="number"&&isNaN(s)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,o,s),e=!1;break}if(a!==null&&a>s){console.error("THREE.KeyframeTrack: Out of order keys.",this,o,s,a),e=!1;break}a=s}if(i!==void 0&&gt.isTypedArray(i))for(var o=0,l=i.length;o!==l;++o){var c=i[o];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,o,c),e=!1;break}}return e},optimize:function(){for(var e=this.times,t=this.values,n=this.getValueSize(),i=this.getInterpolation()===Qa,r=1,a=e.length-1,o=1;o<a;++o){var s=!1,l=e[o],c=e[o+1];if(l!==c&&(o!==1||l!==l[0]))if(i)s=!0;else for(var u=o*n,h=u-n,d=u+n,f=0;f!==n;++f){var p=t[u+f];if(p!==t[h+f]||p!==t[d+f]){s=!0;break}}if(s){if(o!==r){e[r]=e[o];for(var v=o*n,m=r*n,f=0;f!==n;++f)t[m+f]=t[v+f]}++r}}if(a>0){e[r]=e[a];for(var v=a*n,m=r*n,f=0;f!==n;++f)t[m+f]=t[v+f];++r}return r!==e.length&&(this.times=gt.arraySlice(e,0,r),this.values=gt.arraySlice(t,0,r*n)),this},clone:function(){var e=gt.arraySlice(this.times,0),t=gt.arraySlice(this.values,0),n=this.constructor,i=new n(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}});function po(e,t,n){St.call(this,e,t,n)}po.prototype=Object.assign(Object.create(St.prototype),{constructor:po,ValueTypeName:"bool",ValueBufferType:Array,DefaultInterpolation:Dr,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0});function mo(e,t,n,i){St.call(this,e,t,n,i)}mo.prototype=Object.assign(Object.create(St.prototype),{constructor:mo,ValueTypeName:"color"});function sr(e,t,n,i){St.call(this,e,t,n,i)}sr.prototype=Object.assign(Object.create(St.prototype),{constructor:sr,ValueTypeName:"number"});function vo(e,t,n,i){jt.call(this,e,t,n,i)}vo.prototype=Object.assign(Object.create(jt.prototype),{constructor:vo,interpolate_:function(e,t,n,i){for(var r=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=e*o,l=(n-t)/(i-t),c=s+o;s!==c;s+=4)pt.slerpFlat(r,0,a,s-o,a,s,l);return r}});function ba(e,t,n,i){St.call(this,e,t,n,i)}ba.prototype=Object.assign(Object.create(St.prototype),{constructor:ba,ValueTypeName:"quaternion",DefaultInterpolation:Lr,InterpolantFactoryMethodLinear:function(e){return new vo(this.times,this.values,this.getValueSize(),e)},InterpolantFactoryMethodSmooth:void 0});function go(e,t,n,i){St.call(this,e,t,n,i)}go.prototype=Object.assign(Object.create(St.prototype),{constructor:go,ValueTypeName:"string",ValueBufferType:Array,DefaultInterpolation:Dr,InterpolantFactoryMethodLinear:void 0,InterpolantFactoryMethodSmooth:void 0});function lr(e,t,n,i){St.call(this,e,t,n,i)}lr.prototype=Object.assign(Object.create(St.prototype),{constructor:lr,ValueTypeName:"vector"});function Qt(e,t,n){this.name=e,this.tracks=n,this.duration=t!==void 0?t:-1,this.uuid=Pe.generateUUID(),this.duration<0&&this.resetDuration()}function Hg(e){switch(e.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return sr;case"vector":case"vector2":case"vector3":case"vector4":return lr;case"color":return mo;case"quaternion":return ba;case"bool":case"boolean":return po;case"string":return go}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+e)}function Ug(e){if(e.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");var t=Hg(e.type);if(e.times===void 0){var n=[],i=[];gt.flattenJSON(e.keys,n,i,"value"),e.times=n,e.values=i}return t.parse!==void 0?t.parse(e):new t(e.name,e.times,e.values,e.interpolation)}Object.assign(Qt,{parse:function(e){for(var t=[],n=e.tracks,i=1/(e.fps||1),r=0,a=n.length;r!==a;++r)t.push(Ug(n[r]).scale(i));return new Qt(e.name,e.duration,t)},toJSON:function(e){for(var t=[],n=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid},r=0,a=n.length;r!==a;++r)t.push(St.toJSON(n[r]));return i},CreateFromMorphTargetSequence:function(e,t,n,i){for(var r=t.length,a=[],o=0;o<r;o++){var s=[],l=[];s.push((o+r-1)%r,o,(o+1)%r),l.push(0,1,0);var c=gt.getKeyframeOrder(s);s=gt.sortedArray(s,1,c),l=gt.sortedArray(l,1,c),!i&&s[0]===0&&(s.push(r),l.push(l[0])),a.push(new sr(".morphTargetInfluences["+t[o].name+"]",s,l).scale(1/n))}return new Qt(e,-1,a)},findByName:function(e,t){var n=e;if(!Array.isArray(e)){var i=e;n=i.geometry&&i.geometry.animations||i.animations}for(var r=0;r<n.length;r++)if(n[r].name===t)return n[r];return null},CreateClipsFromMorphTargetSequences:function(e,t,n){for(var i={},r=/^([\w-]*?)([\d]+)$/,a=0,o=e.length;a<o;a++){var s=e[a],l=s.name.match(r);if(l&&l.length>1){var c=l[1],u=i[c];u||(i[c]=u=[]),u.push(s)}}var h=[];for(var c in i)h.push(Qt.CreateFromMorphTargetSequence(c,i[c],t,n));return h},parseAnimation:function(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;for(var n=function(b,_,w,L,R){if(w.length!==0){var k=[],O=[];gt.flattenJSON(w,k,O,L),k.length!==0&&R.push(new b(_,k,O))}},i=[],r=e.name||"default",a=e.length||-1,o=e.fps||30,s=e.hierarchy||[],l=0;l<s.length;l++){var c=s[l].keys;if(!(!c||c.length===0))if(c[0].morphTargets){for(var u={},h=0;h<c.length;h++)if(c[h].morphTargets)for(var d=0;d<c[h].morphTargets.length;d++)u[c[h].morphTargets[d]]=-1;for(var f in u){for(var p=[],v=[],d=0;d!==c[h].morphTargets.length;++d){var m=c[h];p.push(m.time),v.push(m.morphTarget===f?1:0)}i.push(new sr(".morphTargetInfluence["+f+"]",p,v))}a=u.length*(o||1)}else{var g=".bones["+t[l].name+"]";n(lr,g+".position",c,"pos",i),n(ba,g+".quaternion",c,"rot",i),n(lr,g+".scale",c,"scl",i)}}if(i.length===0)return null;var y=new Qt(r,a,i);return y}});Object.assign(Qt.prototype,{resetDuration:function(){for(var e=this.tracks,t=0,n=0,i=e.length;n!==i;++n){var r=this.tracks[n];t=Math.max(t,r.times[r.times.length-1])}return this.duration=t,this},trim:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].trim(0,this.duration);return this},validate:function(){for(var e=!0,t=0;t<this.tracks.length;t++)e=e&&this.tracks[t].validate();return e},optimize:function(){for(var e=0;e<this.tracks.length;e++)this.tracks[e].optimize();return this},clone:function(){for(var e=[],t=0;t<this.tracks.length;t++)e.push(this.tracks[t].clone());return new Qt(this.name,this.duration,e)}});var Mi={enabled:!1,files:{},add:function(e,t){this.enabled!==!1&&(this.files[e]=t)},get:function(e){if(this.enabled!==!1)return this.files[e]},remove:function(e){delete this.files[e]},clear:function(){this.files={}}};function sl(e,t,n){var i=this,r=!1,a=0,o=0,s=void 0;this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=n,this.itemStart=function(l){o++,r===!1&&i.onStart!==void 0&&i.onStart(l,a,o),r=!0},this.itemEnd=function(l){a++,i.onProgress!==void 0&&i.onProgress(l,a,o),a===o&&(r=!1,i.onLoad!==void 0&&i.onLoad())},this.itemError=function(l){i.onError!==void 0&&i.onError(l)},this.resolveURL=function(l){return s?s(l):l},this.setURLModifier=function(l){return s=l,this}}var Gt=new sl,nn={};function mn(e){this.manager=e!==void 0?e:Gt}Object.assign(mn.prototype,{load:function(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);var r=this,a=Mi.get(e);if(a!==void 0)return r.manager.itemStart(e),setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0),a;if(nn[e]!==void 0){nn[e].push({onLoad:t,onProgress:n,onError:i});return}var o=/^data:(.*?)(;base64)?,(.*)$/,s=e.match(o);if(s){var l=s[1],c=!!s[2],u=s[3];u=decodeURIComponent(u),c&&(u=atob(u));try{var h,d=(this.responseType||"").toLowerCase();switch(d){case"arraybuffer":case"blob":for(var f=new Uint8Array(u.length),p=0;p<u.length;p++)f[p]=u.charCodeAt(p);d==="blob"?h=new Blob([f.buffer],{type:l}):h=f.buffer;break;case"document":var v=new DOMParser;h=v.parseFromString(u,l);break;case"json":h=JSON.parse(u);break;default:h=u;break}setTimeout(function(){t&&t(h),r.manager.itemEnd(e)},0)}catch(y){setTimeout(function(){i&&i(y),r.manager.itemError(e),r.manager.itemEnd(e)},0)}}else{nn[e]=[],nn[e].push({onLoad:t,onProgress:n,onError:i});var m=new XMLHttpRequest;m.open("GET",e,!0),m.addEventListener("load",function(y){var b=this.response;Mi.add(e,b);var _=nn[e];if(delete nn[e],this.status===200||this.status===0){this.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received.");for(var w=0,L=_.length;w<L;w++){var R=_[w];R.onLoad&&R.onLoad(b)}r.manager.itemEnd(e)}else{for(var w=0,L=_.length;w<L;w++){var R=_[w];R.onError&&R.onError(y)}r.manager.itemError(e),r.manager.itemEnd(e)}},!1),m.addEventListener("progress",function(y){for(var b=nn[e],_=0,w=b.length;_<w;_++){var L=b[_];L.onProgress&&L.onProgress(y)}},!1),m.addEventListener("error",function(y){var b=nn[e];delete nn[e];for(var _=0,w=b.length;_<w;_++){var L=b[_];L.onError&&L.onError(y)}r.manager.itemError(e),r.manager.itemEnd(e)},!1),m.addEventListener("abort",function(y){var b=nn[e];delete nn[e];for(var _=0,w=b.length;_<w;_++){var L=b[_];L.onError&&L.onError(y)}r.manager.itemError(e),r.manager.itemEnd(e)},!1),this.responseType!==void 0&&(m.responseType=this.responseType),this.withCredentials!==void 0&&(m.withCredentials=this.withCredentials),m.overrideMimeType&&m.overrideMimeType(this.mimeType!==void 0?this.mimeType:"text/plain");for(var g in this.requestHeader)m.setRequestHeader(g,this.requestHeader[g]);m.send(null)}return r.manager.itemStart(e),m},setPath:function(e){return this.path=e,this},setResponseType:function(e){return this.responseType=e,this},setWithCredentials:function(e){return this.withCredentials=e,this},setMimeType:function(e){return this.mimeType=e,this},setRequestHeader:function(e){return this.requestHeader=e,this}});function Xu(e){this.manager=e!==void 0?e:Gt}Object.assign(Xu.prototype,{load:function(e,t,n,i){var r=this,a=new mn(r.manager);a.setPath(r.path),a.load(e,function(o){t(r.parse(JSON.parse(o)))},n,i)},parse:function(e){for(var t=[],n=0;n<e.length;n++){var i=Qt.parse(e[n]);t.push(i)}return t},setPath:function(e){return this.path=e,this}});function Zu(e){this.manager=e!==void 0?e:Gt,this._parser=null}Object.assign(Zu.prototype,{load:function(e,t,n,i){var r=this,a=[],o=new Xi;o.image=a;var s=new mn(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer");function l(d){s.load(e[d],function(f){var p=r._parser(f,!0);a[d]={width:p.width,height:p.height,format:p.format,mipmaps:p.mipmaps},c+=1,c===6&&(p.mipmapCount===1&&(o.minFilter=Lt),o.format=p.format,o.needsUpdate=!0,t&&t(o))},n,i)}if(Array.isArray(e))for(var c=0,u=0,h=e.length;u<h;++u)l(u);else s.load(e,function(d){var f=r._parser(d,!0);if(f.isCubemap)for(var p=f.mipmaps.length/f.mipmapCount,v=0;v<p;v++){a[v]={mipmaps:[]};for(var m=0;m<f.mipmapCount;m++)a[v].mipmaps.push(f.mipmaps[v*f.mipmapCount+m]),a[v].format=f.format,a[v].width=f.width,a[v].height=f.height}else o.image.width=f.width,o.image.height=f.height,o.mipmaps=f.mipmaps;f.mipmapCount===1&&(o.minFilter=Lt),o.format=f.format,o.needsUpdate=!0,t&&t(o)},n,i);return o},setPath:function(e){return this.path=e,this}});function ll(e){this.manager=e!==void 0?e:Gt,this._parser=null}Object.assign(ll.prototype,{load:function(e,t,n,i){var r=this,a=new li,o=new mn(this.manager);return o.setResponseType("arraybuffer"),o.setPath(this.path),o.load(e,function(s){var l=r._parser(s);l&&(l.image!==void 0?a.image=l.image:l.data!==void 0&&(a.image.width=l.width,a.image.height=l.height,a.image.data=l.data),a.wrapS=l.wrapS!==void 0?l.wrapS:Ot,a.wrapT=l.wrapT!==void 0?l.wrapT:Ot,a.magFilter=l.magFilter!==void 0?l.magFilter:Lt,a.minFilter=l.minFilter!==void 0?l.minFilter:Ra,a.anisotropy=l.anisotropy!==void 0?l.anisotropy:1,l.format!==void 0&&(a.format=l.format),l.type!==void 0&&(a.type=l.type),l.mipmaps!==void 0&&(a.mipmaps=l.mipmaps),l.mipmapCount===1&&(a.minFilter=Lt),a.needsUpdate=!0,t&&t(a,l))},n,i),a},setPath:function(e){return this.path=e,this}});function Pa(e){this.manager=e!==void 0?e:Gt}Object.assign(Pa.prototype,{crossOrigin:"anonymous",load:function(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);var r=this,a=Mi.get(e);if(a!==void 0)return r.manager.itemStart(e),setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0),a;var o=document.createElementNS("http://www.w3.org/1999/xhtml","img");function s(){o.removeEventListener("load",s,!1),o.removeEventListener("error",l,!1),Mi.add(e,this),t&&t(this),r.manager.itemEnd(e)}function l(c){o.removeEventListener("load",s,!1),o.removeEventListener("error",l,!1),i&&i(c),r.manager.itemError(e),r.manager.itemEnd(e)}return o.addEventListener("load",s,!1),o.addEventListener("error",l,!1),e.substr(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),r.manager.itemStart(e),o.src=e,o},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this}});function cl(e){this.manager=e!==void 0?e:Gt}Object.assign(cl.prototype,{crossOrigin:"anonymous",load:function(e,t,n,i){var r=new On,a=new Pa(this.manager);a.setCrossOrigin(this.crossOrigin),a.setPath(this.path);var o=0;function s(c){a.load(e[c],function(u){r.images[c]=u,o++,o===6&&(r.needsUpdate=!0,t&&t(r))},void 0,i)}for(var l=0;l<e.length;++l)s(l);return r},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this}});function Go(e){this.manager=e!==void 0?e:Gt}Object.assign(Go.prototype,{crossOrigin:"anonymous",load:function(e,t,n,i){var r=new tt,a=new Pa(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(o){r.image=o;var s=e.search(/\.jpe?g($|\?)/i)>0||e.search(/^data\:image\/jpeg/)===0;r.format=s?Gn:_n,r.needsUpdate=!0,t!==void 0&&t(r)},n,i),r},setCrossOrigin:function(e){return this.crossOrigin=e,this},setPath:function(e){return this.path=e,this}});function we(){this.type="Curve",this.arcLengthDivisions=200}Object.assign(we.prototype,{getPoint:function(){return console.warn("THREE.Curve: .getPoint() not implemented."),null},getPointAt:function(e,t){var n=this.getUtoTmapping(e);return this.getPoint(n,t)},getPoints:function(e){e===void 0&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return t},getSpacedPoints:function(e){e===void 0&&(e=5);for(var t=[],n=0;n<=e;n++)t.push(this.getPointAt(n/e));return t},getLength:function(){var e=this.getLengths();return e[e.length-1]},getLengths:function(e){if(e===void 0&&(e=this.arcLengthDivisions),this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;var t=[],n,i=this.getPoint(0),r,a=0;for(t.push(0),r=1;r<=e;r++)n=this.getPoint(r/e),a+=n.distanceTo(i),t.push(a),i=n;return this.cacheArcLengths=t,t},updateArcLengths:function(){this.needsUpdate=!0,this.getLengths()},getUtoTmapping:function(e,t){var n=this.getLengths(),i=0,r=n.length,a;t?a=t:a=e*n[r-1];for(var o=0,s=r-1,l;o<=s;)if(i=Math.floor(o+(s-o)/2),l=n[i]-a,l<0)o=i+1;else if(l>0)s=i-1;else{s=i;break}if(i=s,n[i]===a)return i/(r-1);var c=n[i],u=n[i+1],h=u-c,d=(a-c)/h,f=(i+d)/(r-1);return f},getTangent:function(e){var t=1e-4,n=e-t,i=e+t;n<0&&(n=0),i>1&&(i=1);var r=this.getPoint(n),a=this.getPoint(i),o=a.clone().sub(r);return o.normalize()},getTangentAt:function(e){var t=this.getUtoTmapping(e);return this.getTangent(t)},computeFrenetFrames:function(e,t){var n=new E,i=[],r=[],a=[],o=new E,s=new Me,l,c,u;for(l=0;l<=e;l++)c=l/e,i[l]=this.getTangentAt(c),i[l].normalize();r[0]=new E,a[0]=new E;var h=Number.MAX_VALUE,d=Math.abs(i[0].x),f=Math.abs(i[0].y),p=Math.abs(i[0].z);for(d<=h&&(h=d,n.set(1,0,0)),f<=h&&(h=f,n.set(0,1,0)),p<=h&&n.set(0,0,1),o.crossVectors(i[0],n).normalize(),r[0].crossVectors(i[0],o),a[0].crossVectors(i[0],r[0]),l=1;l<=e;l++)r[l]=r[l-1].clone(),a[l]=a[l-1].clone(),o.crossVectors(i[l-1],i[l]),o.length()>Number.EPSILON&&(o.normalize(),u=Math.acos(Pe.clamp(i[l-1].dot(i[l]),-1,1)),r[l].applyMatrix4(s.makeRotationAxis(o,u))),a[l].crossVectors(i[l],r[l]);if(t===!0)for(u=Math.acos(Pe.clamp(r[0].dot(r[e]),-1,1)),u/=e,i[0].dot(o.crossVectors(r[0],r[e]))>0&&(u=-u),l=1;l<=e;l++)r[l].applyMatrix4(s.makeRotationAxis(i[l],u*l)),a[l].crossVectors(i[l],r[l]);return{tangents:i,normals:r,binormals:a}},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this},toJSON:function(){var e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e},fromJSON:function(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}});function Zt(e,t,n,i,r,a,o,s){we.call(this),this.type="EllipseCurve",this.aX=e||0,this.aY=t||0,this.xRadius=n||1,this.yRadius=i||1,this.aStartAngle=r||0,this.aEndAngle=a||2*Math.PI,this.aClockwise=o||!1,this.aRotation=s||0}Zt.prototype=Object.create(we.prototype);Zt.prototype.constructor=Zt;Zt.prototype.isEllipseCurve=!0;Zt.prototype.getPoint=function(e,t){for(var n=t||new j,i=Math.PI*2,r=this.aEndAngle-this.aStartAngle,a=Math.abs(r)<Number.EPSILON;r<0;)r+=i;for(;r>i;)r-=i;r<Number.EPSILON&&(a?r=0:r=i),this.aClockwise===!0&&!a&&(r===i?r=-i:r=r-i);var o=this.aStartAngle+e*r,s=this.aX+this.xRadius*Math.cos(o),l=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){var c=Math.cos(this.aRotation),u=Math.sin(this.aRotation),h=s-this.aX,d=l-this.aY;s=h*c-d*u+this.aX,l=h*u+d*c+this.aY}return n.set(s,l)};Zt.prototype.copy=function(e){return we.prototype.copy.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this};Zt.prototype.toJSON=function(){var e=we.prototype.toJSON.call(this);return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e};Zt.prototype.fromJSON=function(e){return we.prototype.fromJSON.call(this,e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this};function cr(e,t,n,i,r,a){Zt.call(this,e,t,n,n,i,r,a),this.type="ArcCurve"}cr.prototype=Object.create(Zt.prototype);cr.prototype.constructor=cr;cr.prototype.isArcCurve=!0;function ul(){var e=0,t=0,n=0,i=0;function r(a,o,s,l){e=a,t=s,n=-3*a+3*o-2*s-l,i=2*a-2*o+s+l}return{initCatmullRom:function(a,o,s,l,c){r(o,s,c*(s-a),c*(l-o))},initNonuniformCatmullRom:function(a,o,s,l,c,u,h){var d=(o-a)/c-(s-a)/(c+u)+(s-o)/u,f=(s-o)/u-(l-o)/(u+h)+(l-s)/h;d*=u,f*=u,r(o,s,d,f)},calc:function(a){var o=a*a,s=o*a;return e+t*a+n*o+i*s}}}var Va=new E,rs=new ul,as=new ul,os=new ul;function Rt(e,t,n,i){we.call(this),this.type="CatmullRomCurve3",this.points=e||[],this.closed=t||!1,this.curveType=n||"centripetal",this.tension=i||.5}Rt.prototype=Object.create(we.prototype);Rt.prototype.constructor=Rt;Rt.prototype.isCatmullRomCurve3=!0;Rt.prototype.getPoint=function(e,t){var n=t||new E,i=this.points,r=i.length,a=(r-(this.closed?0:1))*e,o=Math.floor(a),s=a-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/r)+1)*r:s===0&&o===r-1&&(o=r-2,s=1);var l,c,u,h;if(this.closed||o>0?l=i[(o-1)%r]:(Va.subVectors(i[0],i[1]).add(i[0]),l=Va),c=i[o%r],u=i[(o+1)%r],this.closed||o+2<r?h=i[(o+2)%r]:(Va.subVectors(i[r-1],i[r-2]).add(i[r-1]),h=Va),this.curveType==="centripetal"||this.curveType==="chordal"){var d=this.curveType==="chordal"?.5:.25,f=Math.pow(l.distanceToSquared(c),d),p=Math.pow(c.distanceToSquared(u),d),v=Math.pow(u.distanceToSquared(h),d);p<1e-4&&(p=1),f<1e-4&&(f=p),v<1e-4&&(v=p),rs.initNonuniformCatmullRom(l.x,c.x,u.x,h.x,f,p,v),as.initNonuniformCatmullRom(l.y,c.y,u.y,h.y,f,p,v),os.initNonuniformCatmullRom(l.z,c.z,u.z,h.z,f,p,v)}else this.curveType==="catmullrom"&&(rs.initCatmullRom(l.x,c.x,u.x,h.x,this.tension),as.initCatmullRom(l.y,c.y,u.y,h.y,this.tension),os.initCatmullRom(l.z,c.z,u.z,h.z,this.tension));return n.set(rs.calc(s),as.calc(s),os.calc(s)),n};Rt.prototype.copy=function(e){we.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var i=e.points[t];this.points.push(i.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this};Rt.prototype.toJSON=function(){var e=we.prototype.toJSON.call(this);e.points=[];for(var t=0,n=this.points.length;t<n;t++){var i=this.points[t];e.points.push(i.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e};Rt.prototype.fromJSON=function(e){we.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var i=e.points[t];this.points.push(new E().fromArray(i))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this};function rc(e,t,n,i,r){var a=(i-t)*.5,o=(r-n)*.5,s=e*e,l=e*s;return(2*n-2*i+a+o)*l+(-3*n+3*i-2*a-o)*s+a*e+n}function Gg(e,t){var n=1-e;return n*n*t}function Vg(e,t){return 2*(1-e)*e*t}function Wg(e,t){return e*e*t}function Cr(e,t,n,i){return Gg(e,t)+Vg(e,n)+Wg(e,i)}function jg(e,t){var n=1-e;return n*n*n*t}function Yg(e,t){var n=1-e;return 3*n*n*e*t}function Xg(e,t){return 3*(1-e)*e*e*t}function Zg(e,t){return e*e*e*t}function Rr(e,t,n,i,r){return jg(e,t)+Yg(e,n)+Xg(e,i)+Zg(e,r)}function un(e,t,n,i){we.call(this),this.type="CubicBezierCurve",this.v0=e||new j,this.v1=t||new j,this.v2=n||new j,this.v3=i||new j}un.prototype=Object.create(we.prototype);un.prototype.constructor=un;un.prototype.isCubicBezierCurve=!0;un.prototype.getPoint=function(e,t){var n=t||new j,i=this.v0,r=this.v1,a=this.v2,o=this.v3;return n.set(Rr(e,i.x,r.x,a.x,o.x),Rr(e,i.y,r.y,a.y,o.y)),n};un.prototype.copy=function(e){return we.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this};un.prototype.toJSON=function(){var e=we.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e};un.prototype.fromJSON=function(e){return we.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this};function Tn(e,t,n,i){we.call(this),this.type="CubicBezierCurve3",this.v0=e||new E,this.v1=t||new E,this.v2=n||new E,this.v3=i||new E}Tn.prototype=Object.create(we.prototype);Tn.prototype.constructor=Tn;Tn.prototype.isCubicBezierCurve3=!0;Tn.prototype.getPoint=function(e,t){var n=t||new E,i=this.v0,r=this.v1,a=this.v2,o=this.v3;return n.set(Rr(e,i.x,r.x,a.x,o.x),Rr(e,i.y,r.y,a.y,o.y),Rr(e,i.z,r.z,a.z,o.z)),n};Tn.prototype.copy=function(e){return we.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this};Tn.prototype.toJSON=function(){var e=we.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e};Tn.prototype.fromJSON=function(e){return we.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this};function Ut(e,t){we.call(this),this.type="LineCurve",this.v1=e||new j,this.v2=t||new j}Ut.prototype=Object.create(we.prototype);Ut.prototype.constructor=Ut;Ut.prototype.isLineCurve=!0;Ut.prototype.getPoint=function(e,t){var n=t||new j;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n};Ut.prototype.getPointAt=function(e,t){return this.getPoint(e,t)};Ut.prototype.getTangent=function(){var e=this.v2.clone().sub(this.v1);return e.normalize()};Ut.prototype.copy=function(e){return we.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this};Ut.prototype.toJSON=function(){var e=we.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e};Ut.prototype.fromJSON=function(e){return we.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this};function hn(e,t){we.call(this),this.type="LineCurve3",this.v1=e||new E,this.v2=t||new E}hn.prototype=Object.create(we.prototype);hn.prototype.constructor=hn;hn.prototype.isLineCurve3=!0;hn.prototype.getPoint=function(e,t){var n=t||new E;return e===1?n.copy(this.v2):(n.copy(this.v2).sub(this.v1),n.multiplyScalar(e).add(this.v1)),n};hn.prototype.getPointAt=function(e,t){return this.getPoint(e,t)};hn.prototype.copy=function(e){return we.prototype.copy.call(this,e),this.v1.copy(e.v1),this.v2.copy(e.v2),this};hn.prototype.toJSON=function(){var e=we.prototype.toJSON.call(this);return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e};hn.prototype.fromJSON=function(e){return we.prototype.fromJSON.call(this,e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this};function dn(e,t,n){we.call(this),this.type="QuadraticBezierCurve",this.v0=e||new j,this.v1=t||new j,this.v2=n||new j}dn.prototype=Object.create(we.prototype);dn.prototype.constructor=dn;dn.prototype.isQuadraticBezierCurve=!0;dn.prototype.getPoint=function(e,t){var n=t||new j,i=this.v0,r=this.v1,a=this.v2;return n.set(Cr(e,i.x,r.x,a.x),Cr(e,i.y,r.y,a.y)),n};dn.prototype.copy=function(e){return we.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this};dn.prototype.toJSON=function(){var e=we.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e};dn.prototype.fromJSON=function(e){return we.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this};function An(e,t,n){we.call(this),this.type="QuadraticBezierCurve3",this.v0=e||new E,this.v1=t||new E,this.v2=n||new E}An.prototype=Object.create(we.prototype);An.prototype.constructor=An;An.prototype.isQuadraticBezierCurve3=!0;An.prototype.getPoint=function(e,t){var n=t||new E,i=this.v0,r=this.v1,a=this.v2;return n.set(Cr(e,i.x,r.x,a.x),Cr(e,i.y,r.y,a.y),Cr(e,i.z,r.z,a.z)),n};An.prototype.copy=function(e){return we.prototype.copy.call(this,e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this};An.prototype.toJSON=function(){var e=we.prototype.toJSON.call(this);return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e};An.prototype.fromJSON=function(e){return we.prototype.fromJSON.call(this,e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this};function fn(e){we.call(this),this.type="SplineCurve",this.points=e||[]}fn.prototype=Object.create(we.prototype);fn.prototype.constructor=fn;fn.prototype.isSplineCurve=!0;fn.prototype.getPoint=function(e,t){var n=t||new j,i=this.points,r=(i.length-1)*e,a=Math.floor(r),o=r-a,s=i[a===0?a:a-1],l=i[a],c=i[a>i.length-2?i.length-1:a+1],u=i[a>i.length-3?i.length-1:a+2];return n.set(rc(o,s.x,l.x,c.x,u.x),rc(o,s.y,l.y,c.y,u.y)),n};fn.prototype.copy=function(e){we.prototype.copy.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var i=e.points[t];this.points.push(i.clone())}return this};fn.prototype.toJSON=function(){var e=we.prototype.toJSON.call(this);e.points=[];for(var t=0,n=this.points.length;t<n;t++){var i=this.points[t];e.points.push(i.toArray())}return e};fn.prototype.fromJSON=function(e){we.prototype.fromJSON.call(this,e),this.points=[];for(var t=0,n=e.points.length;t<n;t++){var i=e.points[t];this.points.push(new j().fromArray(i))}return this};var Ps=Object.freeze({ArcCurve:cr,CatmullRomCurve3:Rt,CubicBezierCurve:un,CubicBezierCurve3:Tn,EllipseCurve:Zt,LineCurve:Ut,LineCurve3:hn,QuadraticBezierCurve:dn,QuadraticBezierCurve3:An,SplineCurve:fn});function In(){we.call(this),this.type="CurvePath",this.curves=[],this.autoClose=!1}In.prototype=Object.assign(Object.create(we.prototype),{constructor:In,add:function(e){this.curves.push(e)},closePath:function(){var e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);e.equals(t)||this.curves.push(new Ut(t,e))},getPoint:function(e){for(var t=e*this.getLength(),n=this.getCurveLengths(),i=0;i<n.length;){if(n[i]>=t){var r=n[i]-t,a=this.curves[i],o=a.getLength(),s=o===0?0:1-r/o;return a.getPointAt(s)}i++}return null},getLength:function(){var e=this.getCurveLengths();return e[e.length-1]},updateArcLengths:function(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()},getCurveLengths:function(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;for(var e=[],t=0,n=0,i=this.curves.length;n<i;n++)t+=this.curves[n].getLength(),e.push(t);return this.cacheLengths=e,e},getSpacedPoints:function(e){e===void 0&&(e=40);for(var t=[],n=0;n<=e;n++)t.push(this.getPoint(n/e));return this.autoClose&&t.push(t[0]),t},getPoints:function(e){e=e||12;for(var t=[],n,i=0,r=this.curves;i<r.length;i++)for(var a=r[i],o=a&&a.isEllipseCurve?e*2:a&&(a.isLineCurve||a.isLineCurve3)?1:a&&a.isSplineCurve?e*a.points.length:e,s=a.getPoints(o),l=0;l<s.length;l++){var c=s[l];n&&n.equals(c)||(t.push(c),n=c)}return this.autoClose&&t.length>1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t},copy:function(e){we.prototype.copy.call(this,e),this.curves=[];for(var t=0,n=e.curves.length;t<n;t++){var i=e.curves[t];this.curves.push(i.clone())}return this.autoClose=e.autoClose,this},toJSON:function(){var e=we.prototype.toJSON.call(this);e.autoClose=this.autoClose,e.curves=[];for(var t=0,n=this.curves.length;t<n;t++){var i=this.curves[t];e.curves.push(i.toJSON())}return e},fromJSON:function(e){we.prototype.fromJSON.call(this,e),this.autoClose=e.autoClose,this.curves=[];for(var t=0,n=e.curves.length;t<n;t++){var i=e.curves[t];this.curves.push(new Ps[i.type]().fromJSON(i))}return this}});function rn(e){In.call(this),this.type="Path",this.currentPoint=new j,e&&this.setFromPoints(e)}rn.prototype=Object.assign(Object.create(In.prototype),{constructor:rn,setFromPoints:function(e){this.moveTo(e[0].x,e[0].y);for(var t=1,n=e.length;t<n;t++)this.lineTo(e[t].x,e[t].y)},moveTo:function(e,t){this.currentPoint.set(e,t)},lineTo:function(e,t){var n=new Ut(this.currentPoint.clone(),new j(e,t));this.curves.push(n),this.currentPoint.set(e,t)},quadraticCurveTo:function(e,t,n,i){var r=new dn(this.currentPoint.clone(),new j(e,t),new j(n,i));this.curves.push(r),this.currentPoint.set(n,i)},bezierCurveTo:function(e,t,n,i,r,a){var o=new un(this.currentPoint.clone(),new j(e,t),new j(n,i),new j(r,a));this.curves.push(o),this.currentPoint.set(r,a)},splineThru:function(e){var t=[this.currentPoint.clone()].concat(e),n=new fn(t);this.curves.push(n),this.currentPoint.copy(e[e.length-1])},arc:function(e,t,n,i,r,a){var o=this.currentPoint.x,s=this.currentPoint.y;this.absarc(e+o,t+s,n,i,r,a)},absarc:function(e,t,n,i,r,a){this.absellipse(e,t,n,n,i,r,a)},ellipse:function(e,t,n,i,r,a,o,s){var l=this.currentPoint.x,c=this.currentPoint.y;this.absellipse(e+l,t+c,n,i,r,a,o,s)},absellipse:function(e,t,n,i,r,a,o,s){var l=new Zt(e,t,n,i,r,a,o,s);if(this.curves.length>0){var c=l.getPoint(0);c.equals(this.currentPoint)||this.lineTo(c.x,c.y)}this.curves.push(l);var u=l.getPoint(1);this.currentPoint.copy(u)},copy:function(e){return In.prototype.copy.call(this,e),this.currentPoint.copy(e.currentPoint),this},toJSON:function(){var e=In.prototype.toJSON.call(this);return e.currentPoint=this.currentPoint.toArray(),e},fromJSON:function(e){return In.prototype.fromJSON.call(this,e),this.currentPoint.fromArray(e.currentPoint),this}});function Un(e){rn.call(this,e),this.uuid=Pe.generateUUID(),this.type="Shape",this.holes=[]}Un.prototype=Object.assign(Object.create(rn.prototype),{constructor:Un,getPointsHoles:function(e){for(var t=[],n=0,i=this.holes.length;n<i;n++)t[n]=this.holes[n].getPoints(e);return t},extractPoints:function(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}},copy:function(e){rn.prototype.copy.call(this,e),this.holes=[];for(var t=0,n=e.holes.length;t<n;t++){var i=e.holes[t];this.holes.push(i.clone())}return this},toJSON:function(){var e=rn.prototype.toJSON.call(this);e.uuid=this.uuid,e.holes=[];for(var t=0,n=this.holes.length;t<n;t++){var i=this.holes[t];e.holes.push(i.toJSON())}return e},fromJSON:function(e){rn.prototype.fromJSON.call(this,e),this.uuid=e.uuid,this.holes=[];for(var t=0,n=e.holes.length;t<n;t++){var i=e.holes[t];this.holes.push(new rn().fromJSON(i))}return this}});function at(e,t){ae.call(this),this.type="Light",this.color=new ye(e),this.intensity=t!==void 0?t:1,this.receiveShadow=void 0}at.prototype=Object.assign(Object.create(ae.prototype),{constructor:at,isLight:!0,copy:function(e){return ae.prototype.copy.call(this,e),this.color.copy(e.color),this.intensity=e.intensity,this},toJSON:function(e){var t=ae.prototype.toJSON.call(this,e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),t}});function yo(e,t,n){at.call(this,e,n),this.type="HemisphereLight",this.castShadow=void 0,this.position.copy(ae.DefaultUp),this.updateMatrix(),this.groundColor=new ye(t)}yo.prototype=Object.assign(Object.create(at.prototype),{constructor:yo,isHemisphereLight:!0,copy:function(e){return at.prototype.copy.call(this,e),this.groundColor.copy(e.groundColor),this}});function Li(e){this.camera=e,this.bias=0,this.radius=1,this.mapSize=new j(512,512),this.map=null,this.matrix=new Me}Object.assign(Li.prototype,{copy:function(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this},clone:function(){return new this.constructor().copy(this)},toJSON:function(){var e={};return this.bias!==0&&(e.bias=this.bias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}});function bo(){Li.call(this,new ct(50,1,.5,500))}bo.prototype=Object.assign(Object.create(Li.prototype),{constructor:bo,isSpotLightShadow:!0,update:function(e){var t=this.camera,n=Pe.RAD2DEG*2*e.angle,i=this.mapSize.width/this.mapSize.height,r=e.distance||t.far;(n!==t.fov||i!==t.aspect||r!==t.far)&&(t.fov=n,t.aspect=i,t.far=r,t.updateProjectionMatrix())}});function xo(e,t,n,i,r,a){at.call(this,e,t),this.type="SpotLight",this.position.copy(ae.DefaultUp),this.updateMatrix(),this.target=new ae,Object.defineProperty(this,"power",{get:function(){return this.intensity*Math.PI},set:function(o){this.intensity=o/Math.PI}}),this.distance=n!==void 0?n:0,this.angle=i!==void 0?i:Math.PI/3,this.penumbra=r!==void 0?r:0,this.decay=a!==void 0?a:1,this.shadow=new bo}xo.prototype=Object.assign(Object.create(at.prototype),{constructor:xo,isSpotLight:!0,copy:function(e){return at.prototype.copy.call(this,e),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}});function _o(e,t,n,i){at.call(this,e,t),this.type="PointLight",Object.defineProperty(this,"power",{get:function(){return this.intensity*4*Math.PI},set:function(r){this.intensity=r/(4*Math.PI)}}),this.distance=n!==void 0?n:0,this.decay=i!==void 0?i:1,this.shadow=new Li(new ct(90,1,.5,500))}_o.prototype=Object.assign(Object.create(at.prototype),{constructor:_o,isPointLight:!0,copy:function(e){return at.prototype.copy.call(this,e),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}});function xa(e,t,n,i,r,a){En.call(this),this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e!==void 0?e:-1,this.right=t!==void 0?t:1,this.top=n!==void 0?n:1,this.bottom=i!==void 0?i:-1,this.near=r!==void 0?r:.1,this.far=a!==void 0?a:2e3,this.updateProjectionMatrix()}xa.prototype=Object.assign(Object.create(En.prototype),{constructor:xa,isOrthographicCamera:!0,copy:function(e,t){return En.prototype.copy.call(this,e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this},setViewOffset:function(e,t,n,i,r,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=i,this.view.width=r,this.view.height=a,this.updateProjectionMatrix()},clearViewOffset:function(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()},updateProjectionMatrix:function(){var e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,i=(this.top+this.bottom)/2,r=n-e,a=n+e,o=i+t,s=i-t;if(this.view!==null&&this.view.enabled){var l=this.zoom/(this.view.width/this.view.fullWidth),c=this.zoom/(this.view.height/this.view.fullHeight),u=(this.right-this.left)/this.view.width,h=(this.top-this.bottom)/this.view.height;r+=u*(this.view.offsetX/l),a=r+u*(this.view.width/l),o-=h*(this.view.offsetY/c),s=o-h*(this.view.height/c)}this.projectionMatrix.makeOrthographic(r,a,o,s,this.near,this.far),this.projectionMatrixInverse.getInverse(this.projectionMatrix)},toJSON:function(e){var t=ae.prototype.toJSON.call(this,e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}});function wo(){Li.call(this,new xa(-5,5,5,-5,.5,500))}wo.prototype=Object.assign(Object.create(Li.prototype),{constructor:wo});function Eo(e,t){at.call(this,e,t),this.type="DirectionalLight",this.position.copy(ae.DefaultUp),this.updateMatrix(),this.target=new ae,this.shadow=new wo}Eo.prototype=Object.assign(Object.create(at.prototype),{constructor:Eo,isDirectionalLight:!0,copy:function(e){return at.prototype.copy.call(this,e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}});function Mo(e,t){at.call(this,e,t),this.type="AmbientLight",this.castShadow=void 0}Mo.prototype=Object.assign(Object.create(at.prototype),{constructor:Mo,isAmbientLight:!0});function So(e,t,n,i){at.call(this,e,t),this.type="RectAreaLight",this.width=n!==void 0?n:10,this.height=i!==void 0?i:10}So.prototype=Object.assign(Object.create(at.prototype),{constructor:So,isRectAreaLight:!0,copy:function(e){return at.prototype.copy.call(this,e),this.width=e.width,this.height=e.height,this},toJSON:function(e){var t=at.prototype.toJSON.call(this,e);return t.object.width=this.width,t.object.height=this.height,t}});function Vo(e){this.manager=e!==void 0?e:Gt,this.textures={}}Object.assign(Vo.prototype,{load:function(e,t,n,i){var r=this,a=new mn(r.manager);a.setPath(r.path),a.load(e,function(o){t(r.parse(JSON.parse(o)))},n,i)},parse:function(e){var t=this.textures;function n(l){return t[l]===void 0&&console.warn("THREE.MaterialLoader: Undefined texture",l),t[l]}var i=new Fg[e.type];if(e.uuid!==void 0&&(i.uuid=e.uuid),e.name!==void 0&&(i.name=e.name),e.color!==void 0&&i.color.setHex(e.color),e.roughness!==void 0&&(i.roughness=e.roughness),e.metalness!==void 0&&(i.metalness=e.metalness),e.emissive!==void 0&&i.emissive.setHex(e.emissive),e.specular!==void 0&&i.specular.setHex(e.specular),e.shininess!==void 0&&(i.shininess=e.shininess),e.clearCoat!==void 0&&(i.clearCoat=e.clearCoat),e.clearCoatRoughness!==void 0&&(i.clearCoatRoughness=e.clearCoatRoughness),e.vertexColors!==void 0&&(i.vertexColors=e.vertexColors),e.fog!==void 0&&(i.fog=e.fog),e.flatShading!==void 0&&(i.flatShading=e.flatShading),e.blending!==void 0&&(i.blending=e.blending),e.combine!==void 0&&(i.combine=e.combine),e.side!==void 0&&(i.side=e.side),e.opacity!==void 0&&(i.opacity=e.opacity),e.transparent!==void 0&&(i.transparent=e.transparent),e.alphaTest!==void 0&&(i.alphaTest=e.alphaTest),e.depthTest!==void 0&&(i.depthTest=e.depthTest),e.depthWrite!==void 0&&(i.depthWrite=e.depthWrite),e.colorWrite!==void 0&&(i.colorWrite=e.colorWrite),e.wireframe!==void 0&&(i.wireframe=e.wireframe),e.wireframeLinewidth!==void 0&&(i.wireframeLinewidth=e.wireframeLinewidth),e.wireframeLinecap!==void 0&&(i.wireframeLinecap=e.wireframeLinecap),e.wireframeLinejoin!==void 0&&(i.wireframeLinejoin=e.wireframeLinejoin),e.rotation!==void 0&&(i.rotation=e.rotation),e.linewidth!==1&&(i.linewidth=e.linewidth),e.dashSize!==void 0&&(i.dashSize=e.dashSize),e.gapSize!==void 0&&(i.gapSize=e.gapSize),e.scale!==void 0&&(i.scale=e.scale),e.polygonOffset!==void 0&&(i.polygonOffset=e.polygonOffset),e.polygonOffsetFactor!==void 0&&(i.polygonOffsetFactor=e.polygonOffsetFactor),e.polygonOffsetUnits!==void 0&&(i.polygonOffsetUnits=e.polygonOffsetUnits),e.skinning!==void 0&&(i.skinning=e.skinning),e.morphTargets!==void 0&&(i.morphTargets=e.morphTargets),e.morphNormals!==void 0&&(i.morphNormals=e.morphNormals),e.dithering!==void 0&&(i.dithering=e.dithering),e.visible!==void 0&&(i.visible=e.visible),e.userData!==void 0&&(i.userData=e.userData),e.uniforms!==void 0)for(var r in e.uniforms){var a=e.uniforms[r];switch(i.uniforms[r]={},a.type){case"t":i.uniforms[r].value=n(a.value);break;case"c":i.uniforms[r].value=new ye().setHex(a.value);break;case"v2":i.uniforms[r].value=new j().fromArray(a.value);break;case"v3":i.uniforms[r].value=new E().fromArray(a.value);break;case"v4":i.uniforms[r].value=new et().fromArray(a.value);break;case"m3":i.uniforms[r].value=new xt().fromArray(a.value);case"m4":i.uniforms[r].value=new Me().fromArray(a.value);break;default:i.uniforms[r].value=a.value}}if(e.defines!==void 0&&(i.defines=e.defines),e.vertexShader!==void 0&&(i.vertexShader=e.vertexShader),e.fragmentShader!==void 0&&(i.fragmentShader=e.fragmentShader),e.extensions!==void 0)for(var o in e.extensions)i.extensions[o]=e.extensions[o];if(e.shading!==void 0&&(i.flatShading=e.shading===1),e.size!==void 0&&(i.size=e.size),e.sizeAttenuation!==void 0&&(i.sizeAttenuation=e.sizeAttenuation),e.map!==void 0&&(i.map=n(e.map)),e.matcap!==void 0&&(i.matcap=n(e.matcap)),e.alphaMap!==void 0&&(i.alphaMap=n(e.alphaMap),i.transparent=!0),e.bumpMap!==void 0&&(i.bumpMap=n(e.bumpMap)),e.bumpScale!==void 0&&(i.bumpScale=e.bumpScale),e.normalMap!==void 0&&(i.normalMap=n(e.normalMap)),e.normalMapType!==void 0&&(i.normalMapType=e.normalMapType),e.normalScale!==void 0){var s=e.normalScale;Array.isArray(s)===!1&&(s=[s,s]),i.normalScale=new j().fromArray(s)}return e.displacementMap!==void 0&&(i.displacementMap=n(e.displacementMap)),e.displacementScale!==void 0&&(i.displacementScale=e.displacementScale),e.displacementBias!==void 0&&(i.displacementBias=e.displacementBias),e.roughnessMap!==void 0&&(i.roughnessMap=n(e.roughnessMap)),e.metalnessMap!==void 0&&(i.metalnessMap=n(e.metalnessMap)),e.emissiveMap!==void 0&&(i.emissiveMap=n(e.emissiveMap)),e.emissiveIntensity!==void 0&&(i.emissiveIntensity=e.emissiveIntensity),e.specularMap!==void 0&&(i.specularMap=n(e.specularMap)),e.envMap!==void 0&&(i.envMap=n(e.envMap)),e.envMapIntensity!==void 0&&(i.envMapIntensity=e.envMapIntensity),e.reflectivity!==void 0&&(i.reflectivity=e.reflectivity),e.refractionRatio!==void 0&&(i.refractionRatio=e.refractionRatio),e.lightMap!==void 0&&(i.lightMap=n(e.lightMap)),e.lightMapIntensity!==void 0&&(i.lightMapIntensity=e.lightMapIntensity),e.aoMap!==void 0&&(i.aoMap=n(e.aoMap)),e.aoMapIntensity!==void 0&&(i.aoMapIntensity=e.aoMapIntensity),e.gradientMap!==void 0&&(i.gradientMap=n(e.gradientMap)),i},setPath:function(e){return this.path=e,this},setTextures:function(e){return this.textures=e,this}});var hl={decodeText:function(e){if(typeof TextDecoder<"u")return new TextDecoder().decode(e);for(var t="",n=0,i=e.length;n<i;n++)t+=String.fromCharCode(e[n]);try{return decodeURIComponent(escape(t))}catch{return t}},extractUrlBase:function(e){var t=e.lastIndexOf("/");return t===-1?"./":e.substr(0,t+1)}};function To(){oe.call(this),this.type="InstancedBufferGeometry",this.maxInstancedCount=void 0}To.prototype=Object.assign(Object.create(oe.prototype),{constructor:To,isInstancedBufferGeometry:!0,copy:function(e){return oe.prototype.copy.call(this,e),this.maxInstancedCount=e.maxInstancedCount,this},clone:function(){return new this.constructor().copy(this)},toJSON:function(){var e=oe.prototype.toJSON.call(this);return e.maxInstancedCount=this.maxInstancedCount,e.isInstancedBufferGeometry=!0,e}});function Ao(e,t,n,i){typeof n=="number"&&(i=n,n=!1,console.error("THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.")),ke.call(this,e,t,n),this.meshPerAttribute=i||1}Ao.prototype=Object.assign(Object.create(ke.prototype),{constructor:Ao,isInstancedBufferAttribute:!0,copy:function(e){return ke.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this},toJSON:function(){var e=ke.prototype.toJSON.call(this);return e.meshPerAttribute=this.meshPerAttribute,e.isInstancedBufferAttribute=!0,e}});function dl(e){this.manager=e!==void 0?e:Gt}Object.assign(dl.prototype,{load:function(e,t,n,i){var r=this,a=new mn(r.manager);a.setPath(r.path),a.load(e,function(o){t(r.parse(JSON.parse(o)))},n,i)},parse:function(e){var t=e.isInstancedBufferGeometry?new To:new oe,n=e.data.index;if(n!==void 0){var i=new ss[n.type](n.array);t.setIndex(new ke(i,1))}var r=e.data.attributes;for(var a in r){var o=r[a],i=new ss[o.type](o.array),s=o.isInstancedBufferAttribute?Ao:ke,l=new s(i,o.itemSize,o.normalized);o.name!==void 0&&(l.name=o.name),t.addAttribute(a,l)}var c=e.data.morphAttributes;if(c)for(var a in c){for(var u=c[a],h=[],d=0,f=u.length;d<f;d++){var o=u[d],i=new ss[o.type](o.array),l=new ke(i,o.itemSize,o.normalized);o.name!==void 0&&(l.name=o.name),h.push(l)}t.morphAttributes[a]=h}var p=e.data.groups||e.data.drawcalls||e.data.offsets;if(p!==void 0)for(var d=0,v=p.length;d!==v;++d){var m=p[d];t.addGroup(m.start,m.count,m.materialIndex)}var g=e.data.boundingSphere;if(g!==void 0){var y=new E;g.center!==void 0&&y.fromArray(g.center),t.boundingSphere=new sn(y,g.radius)}return e.name&&(t.name=e.name),e.userData&&(t.userData=e.userData),t},setPath:function(e){return this.path=e,this}});var ss={Int8Array,Uint8Array,Uint8ClampedArray:typeof Uint8ClampedArray<"u"?Uint8ClampedArray:Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function fl(e){this.manager=e!==void 0?e:Gt,this.resourcePath=""}Object.assign(fl.prototype,{crossOrigin:"anonymous",load:function(e,t,n,i){var r=this,a=this.path===void 0?hl.extractUrlBase(e):this.path;this.resourcePath=this.resourcePath||a;var o=new mn(r.manager);o.setPath(this.path),o.load(e,function(s){var l=null;try{l=JSON.parse(s)}catch(u){i!==void 0&&i(u),console.error("THREE:ObjectLoader: Can't parse "+e+".",u.message);return}var c=l.metadata;if(c===void 0||c.type===void 0||c.type.toLowerCase()==="geometry"){console.error("THREE.ObjectLoader: Can't load "+e);return}r.parse(l,t)},n,i)},setPath:function(e){return this.path=e,this},setResourcePath:function(e){return this.resourcePath=e,this},setCrossOrigin:function(e){return this.crossOrigin=e,this},parse:function(e,t){var n=this.parseShape(e.shapes),i=this.parseGeometries(e.geometries,n),r=this.parseImages(e.images,function(){t!==void 0&&t(s)}),a=this.parseTextures(e.textures,r),o=this.parseMaterials(e.materials,a),s=this.parseObject(e.object,i,o);return e.animations&&(s.animations=this.parseAnimations(e.animations)),(e.images===void 0||e.images.length===0)&&t!==void 0&&t(s),s},parseShape:function(e){var t={};if(e!==void 0)for(var n=0,i=e.length;n<i;n++){var r=new Un().fromJSON(e[n]);t[r.uuid]=r}return t},parseGeometries:function(e,t){var n={};if(e!==void 0)for(var i=new dl,r=0,a=e.length;r<a;r++){var o,s=e[r];switch(s.type){case"PlaneGeometry":case"PlaneBufferGeometry":o=new Pt[s.type](s.width,s.height,s.widthSegments,s.heightSegments);break;case"BoxGeometry":case"BoxBufferGeometry":case"CubeGeometry":o=new Pt[s.type](s.width,s.height,s.depth,s.widthSegments,s.heightSegments,s.depthSegments);break;case"CircleGeometry":case"CircleBufferGeometry":o=new Pt[s.type](s.radius,s.segments,s.thetaStart,s.thetaLength);break;case"CylinderGeometry":case"CylinderBufferGeometry":o=new Pt[s.type](s.radiusTop,s.radiusBottom,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"ConeGeometry":case"ConeBufferGeometry":o=new Pt[s.type](s.radius,s.height,s.radialSegments,s.heightSegments,s.openEnded,s.thetaStart,s.thetaLength);break;case"SphereGeometry":case"SphereBufferGeometry":o=new Pt[s.type](s.radius,s.widthSegments,s.heightSegments,s.phiStart,s.phiLength,s.thetaStart,s.thetaLength);break;case"DodecahedronGeometry":case"DodecahedronBufferGeometry":case"IcosahedronGeometry":case"IcosahedronBufferGeometry":case"OctahedronGeometry":case"OctahedronBufferGeometry":case"TetrahedronGeometry":case"TetrahedronBufferGeometry":o=new Pt[s.type](s.radius,s.detail);break;case"RingGeometry":case"RingBufferGeometry":o=new Pt[s.type](s.innerRadius,s.outerRadius,s.thetaSegments,s.phiSegments,s.thetaStart,s.thetaLength);break;case"TorusGeometry":case"TorusBufferGeometry":o=new Pt[s.type](s.radius,s.tube,s.radialSegments,s.tubularSegments,s.arc);break;case"TorusKnotGeometry":case"TorusKnotBufferGeometry":o=new Pt[s.type](s.radius,s.tube,s.tubularSegments,s.radialSegments,s.p,s.q);break;case"TubeGeometry":case"TubeBufferGeometry":o=new Pt[s.type](new Ps[s.path.type]().fromJSON(s.path),s.tubularSegments,s.radius,s.radialSegments,s.closed);break;case"LatheGeometry":case"LatheBufferGeometry":o=new Pt[s.type](s.points,s.segments,s.phiStart,s.phiLength);break;case"PolyhedronGeometry":case"PolyhedronBufferGeometry":o=new Pt[s.type](s.vertices,s.indices,s.radius,s.details);break;case"ShapeGeometry":case"ShapeBufferGeometry":for(var h=[],l=0,c=s.shapes.length;l<c;l++){var u=t[s.shapes[l]];h.push(u)}o=new Pt[s.type](h,s.curveSegments);break;case"ExtrudeGeometry":case"ExtrudeBufferGeometry":for(var h=[],l=0,c=s.shapes.length;l<c;l++){var u=t[s.shapes[l]];h.push(u)}var d=s.options.extrudePath;d!==void 0&&(s.options.extrudePath=new Ps[d.type]().fromJSON(d)),o=new Pt[s.type](h,s.options);break;case"BufferGeometry":case"InstancedBufferGeometry":o=i.parse(s);break;case"Geometry":if("THREE"in window&&"LegacyJSONLoader"in THREE){var f=new THREE.LegacyJSONLoader;o=f.parse(s,this.resourcePath).geometry}else console.error('THREE.ObjectLoader: You have to import LegacyJSONLoader in order load geometry data of type "Geometry".');break;default:console.warn('THREE.ObjectLoader: Unsupported geometry type "'+s.type+'"');continue}o.uuid=s.uuid,s.name!==void 0&&(o.name=s.name),o.isBufferGeometry===!0&&s.userData!==void 0&&(o.userData=s.userData),n[s.uuid]=o}return n},parseMaterials:function(e,t){var n={},i={};if(e!==void 0){var r=new Vo;r.setTextures(t);for(var a=0,o=e.length;a<o;a++){var s=e[a];if(s.type==="MultiMaterial"){for(var l=[],c=0;c<s.materials.length;c++){var u=s.materials[c];n[u.uuid]===void 0&&(n[u.uuid]=r.parse(u)),l.push(n[u.uuid])}i[s.uuid]=l}else n[s.uuid]===void 0&&(n[s.uuid]=r.parse(s)),i[s.uuid]=n[s.uuid]}}return i},parseAnimations:function(e){for(var t=[],n=0;n<e.length;n++){var i=e[n],r=Qt.parse(i);i.uuid!==void 0&&(r.uuid=i.uuid),t.push(r)}return t},parseImages:function(e,t){var n=this,i={};function r(v){return n.manager.itemStart(v),o.load(v,function(){n.manager.itemEnd(v)},void 0,function(){n.manager.itemError(v),n.manager.itemEnd(v)})}if(e!==void 0&&e.length>0){var a=new sl(t),o=new Pa(a);o.setCrossOrigin(this.crossOrigin);for(var s=0,l=e.length;s<l;s++){var c=e[s],u=c.url;if(Array.isArray(u)){i[c.uuid]=[];for(var h=0,d=u.length;h<d;h++){var f=u[h],p=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(f)?f:n.resourcePath+f;i[c.uuid].push(r(p))}}else{var p=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(c.url)?c.url:n.resourcePath+c.url;i[c.uuid]=r(p)}}}return i},parseTextures:function(e,t){function n(l,c){return typeof l=="number"?l:(console.warn("THREE.ObjectLoader.parseTexture: Constant should be in numeric form.",l),c[l])}var i={};if(e!==void 0)for(var r=0,a=e.length;r<a;r++){var o=e[r];o.image===void 0&&console.warn('THREE.ObjectLoader: No "image" specified for',o.uuid),t[o.image]===void 0&&console.warn("THREE.ObjectLoader: Undefined image",o.image);var s;Array.isArray(t[o.image])?s=new On(t[o.image]):s=new tt(t[o.image]),s.needsUpdate=!0,s.uuid=o.uuid,o.name!==void 0&&(s.name=o.name),o.mapping!==void 0&&(s.mapping=n(o.mapping,qg)),o.offset!==void 0&&s.offset.fromArray(o.offset),o.repeat!==void 0&&s.repeat.fromArray(o.repeat),o.center!==void 0&&s.center.fromArray(o.center),o.rotation!==void 0&&(s.rotation=o.rotation),o.wrap!==void 0&&(s.wrapS=n(o.wrap[0],ac),s.wrapT=n(o.wrap[1],ac)),o.format!==void 0&&(s.format=o.format),o.type!==void 0&&(s.type=o.type),o.encoding!==void 0&&(s.encoding=o.encoding),o.minFilter!==void 0&&(s.minFilter=n(o.minFilter,oc)),o.magFilter!==void 0&&(s.magFilter=n(o.magFilter,oc)),o.anisotropy!==void 0&&(s.anisotropy=o.anisotropy),o.flipY!==void 0&&(s.flipY=o.flipY),o.premultiplyAlpha!==void 0&&(s.premultiplyAlpha=o.premultiplyAlpha),o.unpackAlignment!==void 0&&(s.unpackAlignment=o.unpackAlignment),i[o.uuid]=s}return i},parseObject:function(e,t,n){var i;function r(p){return t[p]===void 0&&console.warn("THREE.ObjectLoader: Undefined geometry",p),t[p]}function a(p){if(p!==void 0){if(Array.isArray(p)){for(var v=[],m=0,g=p.length;m<g;m++){var y=p[m];n[y]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",y),v.push(n[y])}return v}return n[p]===void 0&&console.warn("THREE.ObjectLoader: Undefined material",p),n[p]}}switch(e.type){case"Scene":i=new Br,e.background!==void 0&&Number.isInteger(e.background)&&(i.background=new ye(e.background)),e.fog!==void 0&&(e.fog.type==="Fog"?i.fog=new lo(e.fog.color,e.fog.near,e.fog.far):e.fog.type==="FogExp2"&&(i.fog=new so(e.fog.color,e.fog.density)));break;case"PerspectiveCamera":i=new ct(e.fov,e.aspect,e.near,e.far),e.focus!==void 0&&(i.focus=e.focus),e.zoom!==void 0&&(i.zoom=e.zoom),e.filmGauge!==void 0&&(i.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(i.filmOffset=e.filmOffset),e.view!==void 0&&(i.view=Object.assign({},e.view));break;case"OrthographicCamera":i=new xa(e.left,e.right,e.top,e.bottom,e.near,e.far),e.zoom!==void 0&&(i.zoom=e.zoom),e.view!==void 0&&(i.view=Object.assign({},e.view));break;case"AmbientLight":i=new Mo(e.color,e.intensity);break;case"DirectionalLight":i=new Eo(e.color,e.intensity);break;case"PointLight":i=new _o(e.color,e.intensity,e.distance,e.decay);break;case"RectAreaLight":i=new So(e.color,e.intensity,e.width,e.height);break;case"SpotLight":i=new xo(e.color,e.intensity,e.distance,e.angle,e.penumbra,e.decay);break;case"HemisphereLight":i=new yo(e.color,e.groundColor,e.intensity);break;case"SkinnedMesh":console.warn("THREE.ObjectLoader.parseObject() does not support SkinnedMesh yet.");case"Mesh":var o=r(e.geometry),s=a(e.material);o.bones&&o.bones.length>0?i=new qr(o,s):i=new _t(o,s),e.drawMode!==void 0&&i.setDrawMode(e.drawMode);break;case"LOD":i=new Zr;break;case"Line":i=new Mt(r(e.geometry),a(e.material),e.mode);break;case"LineLoop":i=new uo(r(e.geometry),a(e.material));break;case"LineSegments":i=new nt(r(e.geometry),a(e.material));break;case"PointCloud":case"Points":i=new Yi(r(e.geometry),a(e.material));break;case"Sprite":i=new Xr(a(e.material));break;case"Group":i=new ji;break;default:i=new ae}if(i.uuid=e.uuid,e.name!==void 0&&(i.name=e.name),e.matrix!==void 0?(i.matrix.fromArray(e.matrix),e.matrixAutoUpdate!==void 0&&(i.matrixAutoUpdate=e.matrixAutoUpdate),i.matrixAutoUpdate&&i.matrix.decompose(i.position,i.quaternion,i.scale)):(e.position!==void 0&&i.position.fromArray(e.position),e.rotation!==void 0&&i.rotation.fromArray(e.rotation),e.quaternion!==void 0&&i.quaternion.fromArray(e.quaternion),e.scale!==void 0&&i.scale.fromArray(e.scale)),e.castShadow!==void 0&&(i.castShadow=e.castShadow),e.receiveShadow!==void 0&&(i.receiveShadow=e.receiveShadow),e.shadow&&(e.shadow.bias!==void 0&&(i.shadow.bias=e.shadow.bias),e.shadow.radius!==void 0&&(i.shadow.radius=e.shadow.radius),e.shadow.mapSize!==void 0&&i.shadow.mapSize.fromArray(e.shadow.mapSize),e.shadow.camera!==void 0&&(i.shadow.camera=this.parseObject(e.shadow.camera))),e.visible!==void 0&&(i.visible=e.visible),e.frustumCulled!==void 0&&(i.frustumCulled=e.frustumCulled),e.renderOrder!==void 0&&(i.renderOrder=e.renderOrder),e.userData!==void 0&&(i.userData=e.userData),e.layers!==void 0&&(i.layers.mask=e.layers),e.children!==void 0)for(var l=e.children,c=0;c<l.length;c++)i.add(this.parseObject(l[c],t,n));if(e.type==="LOD")for(var u=e.levels,h=0;h<u.length;h++){var d=u[h],f=i.getObjectByProperty("uuid",d.object);f!==void 0&&i.addLevel(f,d.distance)}return i}});var qg={UVMapping:Po,CubeReflectionMapping:Oo,CubeRefractionMapping:ao,EquirectangularReflectionMapping:$s,EquirectangularRefractionMapping:oo,SphericalReflectionMapping:Ks,CubeUVReflectionMapping:Do,CubeUVRefractionMapping:ko},ac={RepeatWrapping:Rn,ClampToEdgeWrapping:Ot,MirroredRepeatWrapping:ii},oc={NearestFilter:Et,NearestMipmapNearestFilter:No,NearestMipmapLinearFilter:Bo,LinearFilter:Lt,LinearMipmapNearestFilter:el,LinearMipmapLinearFilter:Ra};function Os(e){typeof createImageBitmap>"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.manager=e!==void 0?e:Gt,this.options=void 0}Os.prototype={constructor:Os,setOptions:function(t){return this.options=t,this},load:function(e,t,n,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);var r=this,a=Mi.get(e);if(a!==void 0)return r.manager.itemStart(e),setTimeout(function(){t&&t(a),r.manager.itemEnd(e)},0),a;fetch(e).then(function(o){return o.blob()}).then(function(o){return r.options===void 0?createImageBitmap(o):createImageBitmap(o,r.options)}).then(function(o){Mi.add(e,o),t&&t(o),r.manager.itemEnd(e)}).catch(function(o){i&&i(o),r.manager.itemError(e),r.manager.itemEnd(e)}),r.manager.itemStart(e)},setCrossOrigin:function(){return this},setPath:function(e){return this.path=e,this}};function pl(){this.type="ShapePath",this.color=new ye,this.subPaths=[],this.currentPath=null}Object.assign(pl.prototype,{moveTo:function(e,t){this.currentPath=new rn,this.subPaths.push(this.currentPath),this.currentPath.moveTo(e,t)},lineTo:function(e,t){this.currentPath.lineTo(e,t)},quadraticCurveTo:function(e,t,n,i){this.currentPath.quadraticCurveTo(e,t,n,i)},bezierCurveTo:function(e,t,n,i,r,a){this.currentPath.bezierCurveTo(e,t,n,i,r,a)},splineThru:function(e){this.currentPath.splineThru(e)},toShapes:function(e,t){function n(G){for(var X=[],Z=0,V=G.length;Z<V;Z++){var Y=G[Z],J=new Un;J.curves=Y.curves,X.push(J)}return X}function i(G,X){for(var Z=X.length,V=!1,Y=Z-1,J=0;J<Z;Y=J++){var ie=X[Y],ce=X[J],Re=ce.x-ie.x,F=ce.y-ie.y;if(Math.abs(F)>Number.EPSILON){if(F<0&&(ie=X[J],Re=-Re,ce=X[Y],F=-F),G.y<ie.y||G.y>ce.y)continue;if(G.y===ie.y){if(G.x===ie.x)return!0}else{var ue=F*(G.x-ie.x)-Re*(G.y-ie.y);if(ue===0)return!0;if(ue<0)continue;V=!V}}else{if(G.y!==ie.y)continue;if(ce.x<=G.x&&G.x<=ie.x||ie.x<=G.x&&G.x<=ce.x)return!0}}return V}var r=Pn.isClockWise,a=this.subPaths;if(a.length===0)return[];if(t===!0)return n(a);var o,s,l,c=[];if(a.length===1)return s=a[0],l=new Un,l.curves=s.curves,c.push(l),c;var u=!r(a[0].getPoints());u=e?!u:u;var h=[],d=[],f=[],p=0,v;d[p]=void 0,f[p]=[];for(var m=0,g=a.length;m<g;m++)s=a[m],v=s.getPoints(),o=r(v),o=e?!o:o,o?(!u&&d[p]&&p++,d[p]={s:new Un,p:v},d[p].s.curves=s.curves,u&&p++,f[p]=[]):f[p].push({h:s,p:v[0]});if(!d[0])return n(a);if(d.length>1){for(var y=!1,b=[],_=0,w=d.length;_<w;_++)h[_]=[];for(var _=0,w=d.length;_<w;_++)for(var L=f[_],R=0;R<L.length;R++){for(var k=L[R],O=!0,z=0;z<d.length;z++)i(k.p,d[z].p)&&(_!==z&&b.push({froms:_,tos:z,hole:R}),O?(O=!1,h[z].push(k)):y=!0);O&&h[_].push(k)}b.length>0&&(y||(f=h))}for(var C,m=0,I=d.length;m<I;m++){l=d[m].s,c.push(l),C=f[m];for(var N=0,H=C.length;N<H;N++)l.holes.push(C[N].h)}return c}});function ml(e){this.type="Font",this.data=e}Object.assign(ml.prototype,{isFont:!0,generateShapes:function(e,t){t===void 0&&(t=100);for(var n=[],i=Jg(e,t,this.data),r=0,a=i.length;r<a;r++)Array.prototype.push.apply(n,i[r].toShapes());return n}});function Jg(e,t,n){for(var i=Array.from?Array.from(e):String(e).split(""),r=t/n.resolution,a=(n.boundingBox.yMax-n.boundingBox.yMin+n.underlineThickness)*r,o=[],s=0,l=0,c=0;c<i.length;c++){var u=i[c];if(u===`
`)s=0,l-=a;else{var h=Qg(u,r,s,l,n);s+=h.offsetX,o.push(h.path)}}return o}function Qg(e,t,n,i,r){var a=r.glyphs[e]||r.glyphs["?"];if(!a){console.error('THREE.Font: character "'+e+'" does not exists in font family '+r.familyName+".");return}var o=new pl,s,l,c,u,h,d,f,p;if(a.o)for(var v=a._cachedOutline||(a._cachedOutline=a.o.split(" ")),m=0,g=v.length;m<g;){var y=v[m++];switch(y){case"m":s=v[m++]*t+n,l=v[m++]*t+i,o.moveTo(s,l);break;case"l":s=v[m++]*t+n,l=v[m++]*t+i,o.lineTo(s,l);break;case"q":c=v[m++]*t+n,u=v[m++]*t+i,h=v[m++]*t+n,d=v[m++]*t+i,o.quadraticCurveTo(h,d,c,u);break;case"b":c=v[m++]*t+n,u=v[m++]*t+i,h=v[m++]*t+n,d=v[m++]*t+i,f=v[m++]*t+n,p=v[m++]*t+i,o.bezierCurveTo(h,d,f,p,c,u);break}}return{offsetX:a.ha*t,path:o}}function qu(e){this.manager=e!==void 0?e:Gt}Object.assign(qu.prototype,{load:function(e,t,n,i){var r=this,a=new mn(this.manager);a.setPath(this.path),a.load(e,function(o){var s;try{s=JSON.parse(o)}catch{console.warn("THREE.FontLoader: typeface.js support is being deprecated. Use typeface.json instead."),s=JSON.parse(o.substring(65,o.length-2))}var l=r.parse(s);t&&t(l)},n,i)},parse:function(e){return new ml(e)},setPath:function(e){return this.path=e,this}});function _a(){}_a.Handlers={handlers:[],add:function(e,t){this.handlers.push(e,t)},get:function(e){for(var t=this.handlers,n=0,i=t.length;n<i;n+=2){var r=t[n],a=t[n+1];if(r.test(e))return a}return null}};Object.assign(_a.prototype,{crossOrigin:"anonymous",onLoadStart:function(){},onLoadProgress:function(){},onLoadComplete:function(){},initMaterials:function(e,t,n){for(var i=[],r=0;r<e.length;++r)i[r]=this.createMaterial(e[r],t,n);return i},createMaterial:function(){var e={NoBlending:ei,NormalBlending:ti,AdditiveBlending:to,SubtractiveBlending:no,MultiplyBlending:io,CustomBlending:Zs},t=new ye,n=new Go,i=new Vo;return function(a,o,s){var l={};function c(f,p,v,m,g){var y=o+f,b=_a.Handlers.get(y),_;b!==null?_=b.load(y):(n.setCrossOrigin(s),_=n.load(y)),p!==void 0&&(_.repeat.fromArray(p),p[0]!==1&&(_.wrapS=Rn),p[1]!==1&&(_.wrapT=Rn)),v!==void 0&&_.offset.fromArray(v),m!==void 0&&(m[0]==="repeat"&&(_.wrapS=Rn),m[0]==="mirror"&&(_.wrapS=ii),m[1]==="repeat"&&(_.wrapT=Rn),m[1]==="mirror"&&(_.wrapT=ii)),g!==void 0&&(_.anisotropy=g);var w=Pe.generateUUID();return l[w]=_,w}var u={uuid:Pe.generateUUID(),type:"MeshLambertMaterial"};for(var h in a){var d=a[h];switch(h){case"DbgColor":case"DbgIndex":case"opticalDensity":case"illumination":break;case"DbgName":u.name=d;break;case"blending":u.blending=e[d];break;case"colorAmbient":case"mapAmbient":console.warn("THREE.Loader.createMaterial:",h,"is no longer supported.");break;case"colorDiffuse":u.color=t.fromArray(d).getHex();break;case"colorSpecular":u.specular=t.fromArray(d).getHex();break;case"colorEmissive":u.emissive=t.fromArray(d).getHex();break;case"specularCoef":u.shininess=d;break;case"shading":d.toLowerCase()==="basic"&&(u.type="MeshBasicMaterial"),d.toLowerCase()==="phong"&&(u.type="MeshPhongMaterial"),d.toLowerCase()==="standard"&&(u.type="MeshStandardMaterial");break;case"mapDiffuse":u.map=c(d,a.mapDiffuseRepeat,a.mapDiffuseOffset,a.mapDiffuseWrap,a.mapDiffuseAnisotropy);break;case"mapDiffuseRepeat":case"mapDiffuseOffset":case"mapDiffuseWrap":case"mapDiffuseAnisotropy":break;case"mapEmissive":u.emissiveMap=c(d,a.mapEmissiveRepeat,a.mapEmissiveOffset,a.mapEmissiveWrap,a.mapEmissiveAnisotropy);break;case"mapEmissiveRepeat":case"mapEmissiveOffset":case"mapEmissiveWrap":case"mapEmissiveAnisotropy":break;case"mapLight":u.lightMap=c(d,a.mapLightRepeat,a.mapLightOffset,a.mapLightWrap,a.mapLightAnisotropy);break;case"mapLightRepeat":case"mapLightOffset":case"mapLightWrap":case"mapLightAnisotropy":break;case"mapAO":u.aoMap=c(d,a.mapAORepeat,a.mapAOOffset,a.mapAOWrap,a.mapAOAnisotropy);break;case"mapAORepeat":case"mapAOOffset":case"mapAOWrap":case"mapAOAnisotropy":break;case"mapBump":u.bumpMap=c(d,a.mapBumpRepeat,a.mapBumpOffset,a.mapBumpWrap,a.mapBumpAnisotropy);break;case"mapBumpScale":u.bumpScale=d;break;case"mapBumpRepeat":case"mapBumpOffset":case"mapBumpWrap":case"mapBumpAnisotropy":break;case"mapNormal":u.normalMap=c(d,a.mapNormalRepeat,a.mapNormalOffset,a.mapNormalWrap,a.mapNormalAnisotropy);break;case"mapNormalFactor":u.normalScale=d;break;case"mapNormalRepeat":case"mapNormalOffset":case"mapNormalWrap":case"mapNormalAnisotropy":break;case"mapSpecular":u.specularMap=c(d,a.mapSpecularRepeat,a.mapSpecularOffset,a.mapSpecularWrap,a.mapSpecularAnisotropy);break;case"mapSpecularRepeat":case"mapSpecularOffset":case"mapSpecularWrap":case"mapSpecularAnisotropy":break;case"mapMetalness":u.metalnessMap=c(d,a.mapMetalnessRepeat,a.mapMetalnessOffset,a.mapMetalnessWrap,a.mapMetalnessAnisotropy);break;case"mapMetalnessRepeat":case"mapMetalnessOffset":case"mapMetalnessWrap":case"mapMetalnessAnisotropy":break;case"mapRoughness":u.roughnessMap=c(d,a.mapRoughnessRepeat,a.mapRoughnessOffset,a.mapRoughnessWrap,a.mapRoughnessAnisotropy);break;case"mapRoughnessRepeat":case"mapRoughnessOffset":case"mapRoughnessWrap":case"mapRoughnessAnisotropy":break;case"mapAlpha":u.alphaMap=c(d,a.mapAlphaRepeat,a.mapAlphaOffset,a.mapAlphaWrap,a.mapAlphaAnisotropy);break;case"mapAlphaRepeat":case"mapAlphaOffset":case"mapAlphaWrap":case"mapAlphaAnisotropy":break;case"flipSided":u.side=vt;break;case"doubleSided":u.side=xr;break;case"transparency":console.warn("THREE.Loader.createMaterial: transparency has been renamed to opacity"),u.opacity=d;break;case"depthTest":case"depthWrite":case"colorWrite":case"opacity":case"reflectivity":case"transparent":case"visible":case"wireframe":u[h]=d;break;case"vertexColors":d===!0&&(u.vertexColors=Si),d==="face"&&(u.vertexColors=Xs);break;default:console.error("THREE.Loader.createMaterial: Unsupported",h,d);break}}return u.type==="MeshBasicMaterial"&&delete u.emissive,u.type!=="MeshPhongMaterial"&&delete u.specular,u.opacity<1&&(u.transparent=!0),i.setTextures(l),i.parse(u)}}()});var Wa,vl={getContext:function(){return Wa===void 0&&(Wa=new(window.AudioContext||window.webkitAudioContext)),Wa},setContext:function(e){Wa=e}};function gl(e){this.manager=e!==void 0?e:Gt}Object.assign(gl.prototype,{load:function(e,t,n,i){var r=new mn(this.manager);r.setResponseType("arraybuffer"),r.setPath(this.path),r.load(e,function(a){var o=a.slice(0),s=vl.getContext();s.decodeAudioData(o,function(l){t(l)})},n,i)},setPath:function(e){return this.path=e,this}});function Wo(){this.coefficients=[];for(var e=0;e<9;e++)this.coefficients.push(new E)}Object.assign(Wo.prototype,{isSphericalHarmonics3:!0,set:function(e){for(var t=0;t<9;t++)this.coefficients[t].copy(e[t]);return this},zero:function(){for(var e=0;e<9;e++)this.coefficients[e].set(0,0,0);return this},getAt:function(e,t){var n=e.x,i=e.y,r=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.282095),t.addScale(a[1],.488603*i),t.addScale(a[2],.488603*r),t.addScale(a[3],.488603*n),t.addScale(a[4],1.092548*(n*i)),t.addScale(a[5],1.092548*(i*r)),t.addScale(a[6],.315392*(3*r*r-1)),t.addScale(a[7],1.092548*(n*r)),t.addScale(a[8],.546274*(n*n-i*i)),t},getIrradianceAt:function(e,t){var n=e.x,i=e.y,r=e.z,a=this.coefficients;return t.copy(a[0]).multiplyScalar(.886227),t.addScale(a[1],2*.511664*i),t.addScale(a[2],2*.511664*r),t.addScale(a[3],2*.511664*n),t.addScale(a[4],2*.429043*n*i),t.addScale(a[5],2*.429043*i*r),t.addScale(a[6],.743125*r*r-.247708),t.addScale(a[7],2*.429043*n*r),t.addScale(a[8],.429043*(n*n-i*i)),t},add:function(e){for(var t=0;t<9;t++)this.coefficients[t].add(e.coefficients[t]);return this},scale:function(e){for(var t=0;t<9;t++)this.coefficients[t].multiplyScalar(e);return this},lerp:function(e,t){for(var n=0;n<9;n++)this.coefficients[n].lerp(e.coefficients[n],t);return this},equals:function(e){for(var t=0;t<9;t++)if(!this.coefficients[t].equals(e.coefficients[t]))return!1;return!0},copy:function(e){return this.set(e.coefficients)},clone:function(){return new this.constructor().copy(this)},fromArray:function(e){for(var t=this.coefficients,n=0;n<9;n++)t[n].fromArray(e,n*3);return this},toArray:function(){for(var e=[],t=this.coefficients,n=0;n<9;n++)t[n].toArray(e,n*3);return e}});Object.assign(Wo,{getBasisAt:function(e,t){var n=e.x,i=e.y,r=e.z;t[0]=.282095,t[1]=.488603*i,t[2]=.488603*r,t[3]=.488603*n,t[4]=1.092548*n*i,t[5]=1.092548*i*r,t[6]=.315392*(3*r*r-1),t[7]=1.092548*n*r,t[8]=.546274*(n*n-i*i)}});function on(e,t){at.call(this,void 0,t),this.sh=e!==void 0?e:new Wo}on.prototype=Object.assign(Object.create(at.prototype),{constructor:on,isLightProbe:!0,copy:function(e){return at.prototype.copy.call(this,e),this.sh.copy(e.sh),this.intensity=e.intensity,this},toJSON:function(e){var t=at.prototype.toJSON.call(this,e);return t}});function Ds(e,t,n){on.call(this,void 0,n);var i=new ye().set(e),r=new ye().set(t),a=new E(i.r,i.g,i.b),o=new E(r.r,r.g,r.b),s=Math.sqrt(Math.PI),l=s*Math.sqrt(.75);this.sh.coefficients[0].copy(a).add(o).multiplyScalar(s),this.sh.coefficients[1].copy(a).sub(o).multiplyScalar(l)}Ds.prototype=Object.assign(Object.create(on.prototype),{constructor:Ds,isHemisphereLightProbe:!0,copy:function(e){return on.prototype.copy.call(this,e),this},toJSON:function(e){var t=on.prototype.toJSON.call(this,e);return t}});function ks(e,t){on.call(this,void 0,t);var n=new ye().set(e);this.sh.coefficients[0].set(n.r,n.g,n.b).multiplyScalar(2*Math.sqrt(Math.PI))}ks.prototype=Object.assign(Object.create(on.prototype),{constructor:ks,isAmbientLightProbe:!0,copy:function(e){return on.prototype.copy.call(this,e),this},toJSON:function(e){var t=on.prototype.toJSON.call(this,e);return t}});function Ju(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new ct,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new ct,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1}Object.assign(Ju.prototype,{update:function(){var e,t,n,i,r,a,o,s,l=new Me,c=new Me;return function(h){var d=e!==this||t!==h.focus||n!==h.fov||i!==h.aspect*this.aspect||r!==h.near||a!==h.far||o!==h.zoom||s!==this.eyeSep;if(d){e=this,t=h.focus,n=h.fov,i=h.aspect*this.aspect,r=h.near,a=h.far,o=h.zoom;var f=h.projectionMatrix.clone();s=this.eyeSep/2;var p=s*r/t,v=r*Math.tan(Pe.DEG2RAD*n*.5)/o,m,g;c.elements[12]=-s,l.elements[12]=s,m=-v*i+p,g=v*i+p,f.elements[0]=2*r/(g-m),f.elements[8]=(g+m)/(g-m),this.cameraL.projectionMatrix.copy(f),m=-v*i-p,g=v*i-p,f.elements[0]=2*r/(g-m),f.elements[8]=(g+m)/(g-m),this.cameraR.projectionMatrix.copy(f)}this.cameraL.matrixWorld.copy(h.matrixWorld).multiply(c),this.cameraR.matrixWorld.copy(h.matrixWorld).multiply(l)}}()});function yl(e){this.autoStart=e!==void 0?e:!0,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}Object.assign(yl.prototype,{start:function(){this.startTime=(typeof performance>"u"?Date:performance).now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0},stop:function(){this.getElapsedTime(),this.running=!1,this.autoStart=!1},getElapsedTime:function(){return this.getDelta(),this.elapsedTime},getDelta:function(){var e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){var t=(typeof performance>"u"?Date:performance).now();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}});function Ns(){ae.call(this),this.type="AudioListener",this.context=vl.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0}Ns.prototype=Object.assign(Object.create(ae.prototype),{constructor:Ns,getInput:function(){return this.gain},removeFilter:function(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this},getFilter:function(){return this.filter},setFilter:function(e){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=e,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this},getMasterVolume:function(){return this.gain.gain.value},setMasterVolume:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this},updateMatrixWorld:function(){var e=new E,t=new pt,n=new E,i=new E,r=new yl;return function(o){ae.prototype.updateMatrixWorld.call(this,o);var s=this.context.listener,l=this.up;if(this.timeDelta=r.getDelta(),this.matrixWorld.decompose(e,t,n),i.set(0,0,-1).applyQuaternion(t),s.positionX){var c=this.context.currentTime+this.timeDelta;s.positionX.linearRampToValueAtTime(e.x,c),s.positionY.linearRampToValueAtTime(e.y,c),s.positionZ.linearRampToValueAtTime(e.z,c),s.forwardX.linearRampToValueAtTime(i.x,c),s.forwardY.linearRampToValueAtTime(i.y,c),s.forwardZ.linearRampToValueAtTime(i.z,c),s.upX.linearRampToValueAtTime(l.x,c),s.upY.linearRampToValueAtTime(l.y,c),s.upZ.linearRampToValueAtTime(l.z,c)}else s.setPosition(e.x,e.y,e.z),s.setOrientation(i.x,i.y,i.z,l.x,l.y,l.z)}}()});function ur(e){ae.call(this),this.type="Audio",this.listener=e,this.context=e.context,this.gain=this.context.createGain(),this.gain.connect(e.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.startTime=0,this.offset=0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.sourceType="empty",this.filters=[]}ur.prototype=Object.assign(Object.create(ae.prototype),{constructor:ur,getOutput:function(){return this.gain},setNodeSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=e,this.connect(),this},setMediaElementSource:function(e){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(e),this.connect(),this},setBuffer:function(e){return this.buffer=e,this.sourceType="buffer",this.autoplay&&this.play(),this},play:function(){if(this.isPlaying===!0){console.warn("THREE.Audio: Audio is already playing.");return}if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}var e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.onended=this.onEnded.bind(this),this.startTime=this.context.currentTime,e.start(this.startTime,this.offset),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()},pause:function(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.isPlaying===!0&&(this.source.stop(),this.source.onended=null,this.offset+=(this.context.currentTime-this.startTime)*this.playbackRate,this.isPlaying=!1),this},stop:function(){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.source.stop(),this.source.onended=null,this.offset=0,this.isPlaying=!1,this},connect:function(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].connect(this.filters[e]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this},disconnect:function(){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(var e=1,t=this.filters.length;e<t;e++)this.filters[e-1].disconnect(this.filters[e]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this},getFilters:function(){return this.filters},setFilters:function(e){return e||(e=[]),this.isPlaying===!0?(this.disconnect(),this.filters=e,this.connect()):this.filters=e,this},setDetune:function(e){if(this.detune=e,this.source.detune!==void 0)return this.isPlaying===!0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this},getDetune:function(){return this.detune},getFilter:function(){return this.getFilters()[0]},setFilter:function(e){return this.setFilters(e?[e]:[])},setPlaybackRate:function(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.playbackRate=e,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this},getPlaybackRate:function(){return this.playbackRate},onEnded:function(){this.isPlaying=!1},getLoop:function(){return this.hasPlaybackControl===!1?(console.warn("THREE.Audio: this Audio has no playback control."),!1):this.loop},setLoop:function(e){if(this.hasPlaybackControl===!1){console.warn("THREE.Audio: this Audio has no playback control.");return}return this.loop=e,this.isPlaying===!0&&(this.source.loop=this.loop),this},getVolume:function(){return this.gain.gain.value},setVolume:function(e){return this.gain.gain.setTargetAtTime(e,this.context.currentTime,.01),this}});function Bs(e){ur.call(this,e),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}Bs.prototype=Object.assign(Object.create(ur.prototype),{constructor:Bs,getOutput:function(){return this.panner},getRefDistance:function(){return this.panner.refDistance},setRefDistance:function(e){return this.panner.refDistance=e,this},getRolloffFactor:function(){return this.panner.rolloffFactor},setRolloffFactor:function(e){return this.panner.rolloffFactor=e,this},getDistanceModel:function(){return this.panner.distanceModel},setDistanceModel:function(e){return this.panner.distanceModel=e,this},getMaxDistance:function(){return this.panner.maxDistance},setMaxDistance:function(e){return this.panner.maxDistance=e,this},setDirectionalCone:function(e,t,n){return this.panner.coneInnerAngle=e,this.panner.coneOuterAngle=t,this.panner.coneOuterGain=n,this},updateMatrixWorld:function(){var e=new E,t=new pt,n=new E,i=new E;return function(a){if(ae.prototype.updateMatrixWorld.call(this,a),!(this.hasPlaybackControl===!0&&this.isPlaying===!1)){this.matrixWorld.decompose(e,t,n),i.set(0,0,1).applyQuaternion(t);var o=this.panner;if(o.positionX){var s=this.context.currentTime+this.listener.timeDelta;o.positionX.linearRampToValueAtTime(e.x,s),o.positionY.linearRampToValueAtTime(e.y,s),o.positionZ.linearRampToValueAtTime(e.z,s),o.orientationX.linearRampToValueAtTime(i.x,s),o.orientationY.linearRampToValueAtTime(i.y,s),o.orientationZ.linearRampToValueAtTime(i.z,s)}else o.setPosition(e.x,e.y,e.z),o.setOrientation(i.x,i.y,i.z)}}}()});function bl(e,t){this.analyser=e.context.createAnalyser(),this.analyser.fftSize=t!==void 0?t:2048,this.data=new Uint8Array(this.analyser.frequencyBinCount),e.getOutput().connect(this.analyser)}Object.assign(bl.prototype,{getFrequencyData:function(){return this.analyser.getByteFrequencyData(this.data),this.data},getAverageFrequency:function(){for(var e=0,t=this.getFrequencyData(),n=0;n<t.length;n++)e+=t[n];return e/t.length}});function xl(e,t,n){this.binding=e,this.valueSize=n;var i=Float64Array,r;switch(t){case"quaternion":r=this._slerp;break;case"string":case"bool":i=Array,r=this._select;break;default:r=this._lerp}this.buffer=new i(n*4),this._mixBufferRegion=r,this.cumulativeWeight=0,this.useCount=0,this.referenceCount=0}Object.assign(xl.prototype,{accumulate:function(e,t){var n=this.buffer,i=this.valueSize,r=e*i+i,a=this.cumulativeWeight;if(a===0){for(var o=0;o!==i;++o)n[r+o]=n[o];a=t}else{a+=t;var s=t/a;this._mixBufferRegion(n,r,0,s,i)}this.cumulativeWeight=a},apply:function(e){var t=this.valueSize,n=this.buffer,i=e*t+t,r=this.cumulativeWeight,a=this.binding;if(this.cumulativeWeight=0,r<1){var o=t*3;this._mixBufferRegion(n,i,o,1-r,t)}for(var s=t,l=t+t;s!==l;++s)if(n[s]!==n[s+t]){a.setValue(n,i);break}},saveOriginalState:function(){var e=this.binding,t=this.buffer,n=this.valueSize,i=n*3;e.getValue(t,i);for(var r=n,a=i;r!==a;++r)t[r]=t[i+r%n];this.cumulativeWeight=0},restoreOriginalState:function(){var e=this.valueSize*3;this.binding.setValue(this.buffer,e)},_select:function(e,t,n,i,r){if(i>=.5)for(var a=0;a!==r;++a)e[t+a]=e[n+a]},_slerp:function(e,t,n,i){pt.slerpFlat(e,t,e,t,e,n,i)},_lerp:function(e,t,n,i,r){for(var a=1-i,o=0;o!==r;++o){var s=t+o;e[s]=e[s]*a+e[n+o]*i}}});var ls="\\[\\]\\.:\\/";function Qu(e,t,n){var i=n||Ct.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}Object.assign(Qu.prototype,{getValue:function(e,t){this.bind();var n=this._targetGroup.nCachedObjects_,i=this._bindings[n];i!==void 0&&i.getValue(e,t)},setValue:function(e,t){for(var n=this._bindings,i=this._targetGroup.nCachedObjects_,r=n.length;i!==r;++i)n[i].setValue(e,t)},bind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()},unbind:function(){for(var e=this._bindings,t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}});function Ct(e,t,n){this.path=t,this.parsedPath=n||Ct.parseTrackName(t),this.node=Ct.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e}Object.assign(Ct,{Composite:Qu,create:function(e,t,n){return e&&e.isAnimationObjectGroup?new Ct.Composite(e,t,n):new Ct(e,t,n)},sanitizeNodeName:function(){var e=new RegExp("["+ls+"]","g");return function(n){return n.replace(/\s/g,"_").replace(e,"")}}(),parseTrackName:function(){var e="[^"+ls+"]",t="[^"+ls.replace("\\.","")+"]",n=/((?:WC+[\/:])*)/.source.replace("WC",e),i=/(WCOD+)?/.source.replace("WCOD",t),r=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",e),a=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",e),o=new RegExp("^"+n+i+r+a+"$"),s=["material","materials","bones"];return function(c){var u=o.exec(c);if(!u)throw new Error("PropertyBinding: Cannot parse trackName: "+c);var h={nodeName:u[2],objectName:u[3],objectIndex:u[4],propertyName:u[5],propertyIndex:u[6]},d=h.nodeName&&h.nodeName.lastIndexOf(".");if(d!==void 0&&d!==-1){var f=h.nodeName.substring(d+1);s.indexOf(f)!==-1&&(h.nodeName=h.nodeName.substring(0,d),h.objectName=f)}if(h.propertyName===null||h.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+c);return h}}(),findNode:function(e,t){if(!t||t===""||t==="root"||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){var n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){var i=function(a){for(var o=0;o<a.length;o++){var s=a[o];if(s.name===t||s.uuid===t)return s;var l=i(s.children);if(l)return l}return null},r=i(e.children);if(r)return r}return null}});Object.assign(Ct.prototype,{_getValue_unavailable:function(){},_setValue_unavailable:function(){},BindingType:{Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3},Versioning:{None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2},GetterByBindingType:[function(t,n){t[n]=this.node[this.propertyName]},function(t,n){for(var i=this.resolvedProperty,r=0,a=i.length;r!==a;++r)t[n++]=i[r]},function(t,n){t[n]=this.resolvedProperty[this.propertyIndex]},function(t,n){this.resolvedProperty.toArray(t,n)}],SetterByBindingTypeAndVersioning:[[function(t,n){this.targetObject[this.propertyName]=t[n]},function(t,n){this.targetObject[this.propertyName]=t[n],this.targetObject.needsUpdate=!0},function(t,n){this.targetObject[this.propertyName]=t[n],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,n){for(var i=this.resolvedProperty,r=0,a=i.length;r!==a;++r)i[r]=t[n++]},function(t,n){for(var i=this.resolvedProperty,r=0,a=i.length;r!==a;++r)i[r]=t[n++];this.targetObject.needsUpdate=!0},function(t,n){for(var i=this.resolvedProperty,r=0,a=i.length;r!==a;++r)i[r]=t[n++];this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,n){this.resolvedProperty[this.propertyIndex]=t[n]},function(t,n){this.resolvedProperty[this.propertyIndex]=t[n],this.targetObject.needsUpdate=!0},function(t,n){this.resolvedProperty[this.propertyIndex]=t[n],this.targetObject.matrixWorldNeedsUpdate=!0}],[function(t,n){this.resolvedProperty.fromArray(t,n)},function(t,n){this.resolvedProperty.fromArray(t,n),this.targetObject.needsUpdate=!0},function(t,n){this.resolvedProperty.fromArray(t,n),this.targetObject.matrixWorldNeedsUpdate=!0}]],getValue:function(t,n){this.bind(),this.getValue(t,n)},setValue:function(t,n){this.bind(),this.setValue(t,n)},bind:function(){var e=this.node,t=this.parsedPath,n=t.objectName,i=t.propertyName,r=t.propertyIndex;if(e||(e=Ct.findNode(this.rootNode,t.nodeName)||this.rootNode,this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.error("THREE.PropertyBinding: Trying to update node for track: "+this.path+" but it wasn't found.");return}if(n){var a=t.objectIndex;switch(n){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(var o=0;o<e.length;o++)if(e[o].name===a){a=o;break}break;default:if(e[n]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[n]}if(a!==void 0){if(e[a]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[a]}}var s=e[i];if(s===void 0){var l=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+l+"."+i+" but it wasn't found.",e);return}var c=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?c=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(c=this.Versioning.MatrixWorldNeedsUpdate);var u=this.BindingType.Direct;if(r!==void 0){if(i==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(e.geometry.isBufferGeometry){if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}for(var o=0;o<this.node.geometry.morphAttributes.position.length;o++)if(e.geometry.morphAttributes.position[o].name===r){r=o;break}}else{if(!e.geometry.morphTargets){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphTargets.",this);return}for(var o=0;o<this.node.geometry.morphTargets.length;o++)if(e.geometry.morphTargets[o].name===r){r=o;break}}}u=this.BindingType.ArrayElement,this.resolvedProperty=s,this.propertyIndex=r}else s.fromArray!==void 0&&s.toArray!==void 0?(u=this.BindingType.HasFromToArray,this.resolvedProperty=s):Array.isArray(s)?(u=this.BindingType.EntireArray,this.resolvedProperty=s):this.propertyName=i;this.getValue=this.GetterByBindingType[u],this.setValue=this.SetterByBindingTypeAndVersioning[u][c]},unbind:function(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}});Object.assign(Ct.prototype,{_getValue_unbound:Ct.prototype.getValue,_setValue_unbound:Ct.prototype.setValue});function $u(){this.uuid=Pe.generateUUID(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;var e={};this._indicesByUUID=e;for(var t=0,n=arguments.length;t!==n;++t)e[arguments[t].uuid]=t;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};var i=this;this.stats={objects:{get total(){return i._objects.length},get inUse(){return this.total-i.nCachedObjects_}},get bindingsPerObject(){return i._bindings.length}}}Object.assign($u.prototype,{isAnimationObjectGroup:!0,add:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,i=this._indicesByUUID,r=this._paths,a=this._parsedPaths,o=this._bindings,s=o.length,l=void 0,c=0,u=arguments.length;c!==u;++c){var h=arguments[c],d=h.uuid,f=i[d];if(f===void 0){f=t++,i[d]=f,e.push(h);for(var p=0,v=s;p!==v;++p)o[p].push(new Ct(h,r[p],a[p]))}else if(f<n){l=e[f];var m=--n,g=e[m];i[g.uuid]=f,e[f]=g,i[d]=m,e[m]=h;for(var p=0,v=s;p!==v;++p){var y=o[p],b=y[m],_=y[f];y[f]=b,_===void 0&&(_=new Ct(h,r[p],a[p])),y[m]=_}}else e[f]!==l&&console.error("THREE.AnimationObjectGroup: Different objects with the same UUID detected. Clean the caches or recreate your infrastructure when reloading scenes.")}this.nCachedObjects_=n},remove:function(){for(var e=this._objects,t=this.nCachedObjects_,n=this._indicesByUUID,i=this._bindings,r=i.length,a=0,o=arguments.length;a!==o;++a){var s=arguments[a],l=s.uuid,c=n[l];if(c!==void 0&&c>=t){var u=t++,h=e[u];n[h.uuid]=c,e[c]=h,n[l]=u,e[u]=s;for(var d=0,f=r;d!==f;++d){var p=i[d],v=p[u],m=p[c];p[c]=v,p[u]=m}}}this.nCachedObjects_=t},uncache:function(){for(var e=this._objects,t=e.length,n=this.nCachedObjects_,i=this._indicesByUUID,r=this._bindings,a=r.length,o=0,s=arguments.length;o!==s;++o){var l=arguments[o],c=l.uuid,u=i[c];if(u!==void 0)if(delete i[c],u<n){var h=--n,d=e[h],f=--t,p=e[f];i[d.uuid]=u,e[u]=d,i[p.uuid]=h,e[h]=p,e.pop();for(var v=0,m=a;v!==m;++v){var g=r[v],y=g[h],b=g[f];g[u]=y,g[h]=b,g.pop()}}else{var f=--t,p=e[f];i[p.uuid]=u,e[u]=p,e.pop();for(var v=0,m=a;v!==m;++v){var g=r[v];g[u]=g[f],g.pop()}}}this.nCachedObjects_=n},subscribe_:function(e,t){var n=this._bindingsIndicesByPath,i=n[e],r=this._bindings;if(i!==void 0)return r[i];var a=this._paths,o=this._parsedPaths,s=this._objects,l=s.length,c=this.nCachedObjects_,u=new Array(l);i=r.length,n[e]=i,a.push(e),o.push(t),r.push(u);for(var h=c,d=s.length;h!==d;++h){var f=s[h];u[h]=new Ct(f,e,t)}return u},unsubscribe_:function(e){var t=this._bindingsIndicesByPath,n=t[e];if(n!==void 0){var i=this._paths,r=this._parsedPaths,a=this._bindings,o=a.length-1,s=a[o],l=e[o];t[l]=n,a[n]=s,a.pop(),r[n]=r[o],r.pop(),i[n]=i[o],i.pop()}}});function Ku(e,t,n){this._mixer=e,this._clip=t,this._localRoot=n||null;for(var i=t.tracks,r=i.length,a=new Array(r),o={endingStart:ri,endingEnd:ri},s=0;s!==r;++s){var l=i[s].createInterpolant(null);a[s]=l,l.settings=o}this._interpolantSettings=o,this._interpolants=a,this._propertyBindings=new Array(r),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=gu,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}Object.assign(Ku.prototype,{play:function(){return this._mixer._activateAction(this),this},stop:function(){return this._mixer._deactivateAction(this),this.reset()},reset:function(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()},isRunning:function(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)},isScheduled:function(){return this._mixer._isActiveAction(this)},startAt:function(e){return this._startTime=e,this},setLoop:function(e,t){return this.loop=e,this.repetitions=t,this},setEffectiveWeight:function(e){return this.weight=e,this._effectiveWeight=this.enabled?e:0,this.stopFading()},getEffectiveWeight:function(){return this._effectiveWeight},fadeIn:function(e){return this._scheduleFading(e,0,1)},fadeOut:function(e){return this._scheduleFading(e,1,0)},crossFadeFrom:function(e,t,n){if(e.fadeOut(t),this.fadeIn(t),n){var i=this._clip.duration,r=e._clip.duration,a=r/i,o=i/r;e.warp(1,a,t),this.warp(o,1,t)}return this},crossFadeTo:function(e,t,n){return e.crossFadeFrom(this,t,n)},stopFading:function(){var e=this._weightInterpolant;return e!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},setEffectiveTimeScale:function(e){return this.timeScale=e,this._effectiveTimeScale=this.paused?0:e,this.stopWarping()},getEffectiveTimeScale:function(){return this._effectiveTimeScale},setDuration:function(e){return this.timeScale=this._clip.duration/e,this.stopWarping()},syncWith:function(e){return this.time=e.time,this.timeScale=e.timeScale,this.stopWarping()},halt:function(e){return this.warp(this._effectiveTimeScale,0,e)},warp:function(e,t,n){var i=this._mixer,r=i.time,a=this._timeScaleInterpolant,o=this.timeScale;a===null&&(a=i._lendControlInterpolant(),this._timeScaleInterpolant=a);var s=a.parameterPositions,l=a.sampleValues;return s[0]=r,s[1]=r+n,l[0]=e/o,l[1]=t/o,this},stopWarping:function(){var e=this._timeScaleInterpolant;return e!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(e)),this},getMixer:function(){return this._mixer},getClip:function(){return this._clip},getRoot:function(){return this._localRoot||this._mixer._root},_update:function(e,t,n,i){if(!this.enabled){this._updateWeight(e);return}var r=this._startTime;if(r!==null){var a=(e-r)*n;if(a<0||n===0)return;this._startTime=null,t=n*a}t*=this._updateTimeScale(e);var o=this._updateTime(t),s=this._updateWeight(e);if(s>0)for(var l=this._interpolants,c=this._propertyBindings,u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulate(i,s)},_updateWeight:function(e){var t=0;if(this.enabled){t=this.weight;var n=this._weightInterpolant;if(n!==null){var i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t},_updateTimeScale:function(e){var t=0;if(!this.paused){t=this.timeScale;var n=this._timeScaleInterpolant;if(n!==null){var i=n.evaluate(e)[0];t*=i,e>n.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t},_updateTime:function(e){var t=this.time+e,n=this._clip.duration,i=this.loop,r=this._loopCount,a=i===yu;if(e===0)return r===-1?t:a&&(r&1)===1?n-t:t;if(i===vu){r===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(t>=n)t=n;else if(t<0)t=0;else{this.time=t;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=t,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(r===-1&&(e>=0?(r=0,this._setEndings(!0,this.repetitions===0,a)):this._setEndings(this.repetitions===0,!0,a)),t>=n||t<0){var o=Math.floor(t/n);t-=n*o,r+=Math.abs(o);var s=this.repetitions-r;if(s<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,t=e>0?n:0,this.time=t,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(s===1){var l=e<0;this._setEndings(l,!l,a)}else this._setEndings(!1,!1,a);this._loopCount=r,this.time=t,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=t;if(a&&(r&1)===1)return n-t}return t},_setEndings:function(e,t,n){var i=this._interpolantSettings;n?(i.endingStart=$n,i.endingEnd=$n):(e?i.endingStart=this.zeroSlopeAtStart?$n:ri:i.endingStart=kr,t?i.endingEnd=this.zeroSlopeAtEnd?$n:ri:i.endingEnd=kr)},_scheduleFading:function(e,t,n){var i=this._mixer,r=i.time,a=this._weightInterpolant;a===null&&(a=i._lendControlInterpolant(),this._weightInterpolant=a);var o=a.parameterPositions,s=a.sampleValues;return o[0]=r,s[0]=t,o[1]=r+e,s[1]=n,this}});function zs(e){this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}zs.prototype=Object.assign(Object.create(pn.prototype),{constructor:zs,_bindAction:function(e,t){var n=e._localRoot||this._root,i=e._clip.tracks,r=i.length,a=e._propertyBindings,o=e._interpolants,s=n.uuid,l=this._bindingsByRootAndName,c=l[s];c===void 0&&(c={},l[s]=c);for(var u=0;u!==r;++u){var h=i[u],d=h.name,f=c[d];if(f!==void 0)a[u]=f;else{if(f=a[u],f!==void 0){f._cacheIndex===null&&(++f.referenceCount,this._addInactiveBinding(f,s,d));continue}var p=t&&t._propertyBindings[u].binding.parsedPath;f=new xl(Ct.create(n,d,p),h.ValueTypeName,h.getValueSize()),++f.referenceCount,this._addInactiveBinding(f,s,d),a[u]=f}o[u].resultBuffer=f.buffer}},_activateAction:function(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){var t=(e._localRoot||this._root).uuid,n=e._clip.uuid,i=this._actionsByClip[n];this._bindAction(e,i&&i.knownActions[0]),this._addInactiveAction(e,n,t)}for(var r=e._propertyBindings,a=0,o=r.length;a!==o;++a){var s=r[a];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}},_deactivateAction:function(e){if(this._isActiveAction(e)){for(var t=e._propertyBindings,n=0,i=t.length;n!==i;++n){var r=t[n];--r.useCount===0&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(e)}},_initMemoryManager:function(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;var e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}},_isActiveAction:function(e){var t=e._cacheIndex;return t!==null&&t<this._nActiveActions},_addInactiveAction:function(e,t,n){var i=this._actions,r=this._actionsByClip,a=r[t];if(a===void 0)a={knownActions:[e],actionByRoot:{}},e._byClipCacheIndex=0,r[t]=a;else{var o=a.knownActions;e._byClipCacheIndex=o.length,o.push(e)}e._cacheIndex=i.length,i.push(e),a.actionByRoot[n]=e},_removeInactiveAction:function(e){var t=this._actions,n=t[t.length-1],i=e._cacheIndex;n._cacheIndex=i,t[i]=n,t.pop(),e._cacheIndex=null;var r=e._clip.uuid,a=this._actionsByClip,o=a[r],s=o.knownActions,l=s[s.length-1],c=e._byClipCacheIndex;l._byClipCacheIndex=c,s[c]=l,s.pop(),e._byClipCacheIndex=null;var u=o.actionByRoot,h=(e._localRoot||this._root).uuid;delete u[h],s.length===0&&delete a[r],this._removeInactiveBindingsForAction(e)},_removeInactiveBindingsForAction:function(e){for(var t=e._propertyBindings,n=0,i=t.length;n!==i;++n){var r=t[n];--r.referenceCount===0&&this._removeInactiveBinding(r)}},_lendAction:function(e){var t=this._actions,n=e._cacheIndex,i=this._nActiveActions++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r},_takeBackAction:function(e){var t=this._actions,n=e._cacheIndex,i=--this._nActiveActions,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r},_addInactiveBinding:function(e,t,n){var i=this._bindingsByRootAndName,r=i[t],a=this._bindings;r===void 0&&(r={},i[t]=r),r[n]=e,e._cacheIndex=a.length,a.push(e)},_removeInactiveBinding:function(e){var t=this._bindings,n=e.binding,i=n.rootNode.uuid,r=n.path,a=this._bindingsByRootAndName,o=a[i],s=t[t.length-1],l=e._cacheIndex;s._cacheIndex=l,t[l]=s,t.pop(),delete o[r],Object.keys(o).length===0&&delete a[i]},_lendBinding:function(e){var t=this._bindings,n=e._cacheIndex,i=this._nActiveBindings++,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r},_takeBackBinding:function(e){var t=this._bindings,n=e._cacheIndex,i=--this._nActiveBindings,r=t[i];e._cacheIndex=i,t[i]=e,r._cacheIndex=n,t[n]=r},_lendControlInterpolant:function(){var e=this._controlInterpolants,t=this._nActiveControlInterpolants++,n=e[t];return n===void 0&&(n=new ya(new Float32Array(2),new Float32Array(2),1,this._controlInterpolantsResultBuffer),n.__cacheIndex=t,e[t]=n),n},_takeBackControlInterpolant:function(e){var t=this._controlInterpolants,n=e.__cacheIndex,i=--this._nActiveControlInterpolants,r=t[i];e.__cacheIndex=i,t[i]=e,r.__cacheIndex=n,t[n]=r},_controlInterpolantsResultBuffer:new Float32Array(1),clipAction:function(e,t){var n=t||this._root,i=n.uuid,r=typeof e=="string"?Qt.findByName(n,e):e,a=r!==null?r.uuid:e,o=this._actionsByClip[a],s=null;if(o!==void 0){var l=o.actionByRoot[i];if(l!==void 0)return l;s=o.knownActions[0],r===null&&(r=s._clip)}if(r===null)return null;var c=new Ku(this,r,t);return this._bindAction(c,s),this._addInactiveAction(c,a,i),c},existingAction:function(e,t){var n=t||this._root,i=n.uuid,r=typeof e=="string"?Qt.findByName(n,e):e,a=r?r.uuid:e,o=this._actionsByClip[a];return o!==void 0&&o.actionByRoot[i]||null},stopAllAction:function(){var e=this._actions,t=this._nActiveActions,n=this._bindings,i=this._nActiveBindings;this._nActiveActions=0,this._nActiveBindings=0;for(var r=0;r!==t;++r)e[r].reset();for(var r=0;r!==i;++r)n[r].useCount=0;return this},update:function(e){e*=this.timeScale;for(var t=this._actions,n=this._nActiveActions,i=this.time+=e,r=Math.sign(e),a=this._accuIndex^=1,o=0;o!==n;++o){var s=t[o];s._update(i,e,r,a)}for(var l=this._bindings,c=this._nActiveBindings,o=0;o!==c;++o)l[o].apply(a);return this},getRoot:function(){return this._root},uncacheClip:function(e){var t=this._actions,n=e.uuid,i=this._actionsByClip,r=i[n];if(r!==void 0){for(var a=r.knownActions,o=0,s=a.length;o!==s;++o){var l=a[o];this._deactivateAction(l);var c=l._cacheIndex,u=t[t.length-1];l._cacheIndex=null,l._byClipCacheIndex=null,u._cacheIndex=c,t[c]=u,t.pop(),this._removeInactiveBindingsForAction(l)}delete i[n]}},uncacheRoot:function(e){var t=e.uuid,n=this._actionsByClip;for(var i in n){var r=n[i].actionByRoot,a=r[t];a!==void 0&&(this._deactivateAction(a),this._removeInactiveAction(a))}var o=this._bindingsByRootAndName,s=o[t];if(s!==void 0)for(var l in s){var c=s[l];c.restoreOriginalState(),this._removeInactiveBinding(c)}},uncacheAction:function(e,t){var n=this.existingAction(e,t);n!==null&&(this._deactivateAction(n),this._removeInactiveAction(n))}});function Lo(e){typeof e=="string"&&(console.warn("THREE.Uniform: Type parameter is no longer needed."),e=arguments[1]),this.value=e}Lo.prototype.clone=function(){return new Lo(this.value.clone===void 0?this.value:this.value.clone())};function Fs(e,t,n){ui.call(this,e,t),this.meshPerAttribute=n||1}Fs.prototype=Object.assign(Object.create(ui.prototype),{constructor:Fs,isInstancedInterleavedBuffer:!0,copy:function(e){return ui.prototype.copy.call(this,e),this.meshPerAttribute=e.meshPerAttribute,this}});function eh(e,t,n,i){this.ray=new Ai(e,t),this.near=n||0,this.far=i||1/0,this.params={Mesh:{},Line:{},LOD:{},Points:{threshold:1},Sprite:{}},Object.defineProperties(this.params,{PointCloud:{get:function(){return console.warn("THREE.Raycaster: params.PointCloud has been renamed to params.Points."),this.Points}}})}function sc(e,t){return e.distance-t.distance}function Hs(e,t,n,i){if(e.visible!==!1&&(e.raycast(t,n),i===!0))for(var r=e.children,a=0,o=r.length;a<o;a++)Hs(r[a],t,n,!0)}Object.assign(eh.prototype,{linePrecision:1,set:function(e,t){this.ray.set(e,t)},setFromCamera:function(e,t){t&&t.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(t.matrixWorld),this.ray.direction.set(e.x,e.y,.5).unproject(t).sub(this.ray.origin).normalize(),this._camera=t):t&&t.isOrthographicCamera?(this.ray.origin.set(e.x,e.y,(t.near+t.far)/(t.near-t.far)).unproject(t),this.ray.direction.set(0,0,-1).transformDirection(t.matrixWorld),this._camera=t):console.error("THREE.Raycaster: Unsupported camera type.")},intersectObject:function(e,t,n){var i=n||[];return Hs(e,this,i,t),i.sort(sc),i},intersectObjects:function(e,t,n){var i=n||[];if(Array.isArray(e)===!1)return console.warn("THREE.Raycaster.intersectObjects: objects is not an Array."),i;for(var r=0,a=e.length;r<a;r++)Hs(e[r],this,i,t);return i.sort(sc),i}});function th(e,t,n){return this.radius=e!==void 0?e:1,this.phi=t!==void 0?t:0,this.theta=n!==void 0?n:0,this}Object.assign(th.prototype,{set:function(e,t,n){return this.radius=e,this.phi=t,this.theta=n,this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.radius=e.radius,this.phi=e.phi,this.theta=e.theta,this},makeSafe:function(){var e=1e-6;return this.phi=Math.max(e,Math.min(Math.PI-e,this.phi)),this},setFromVector3:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)},setFromCartesianCoords:function(e,t,n){return this.radius=Math.sqrt(e*e+t*t+n*n),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(e,n),this.phi=Math.acos(Pe.clamp(t/this.radius,-1,1))),this}});function nh(e,t,n){return this.radius=e!==void 0?e:1,this.theta=t!==void 0?t:0,this.y=n!==void 0?n:0,this}Object.assign(nh.prototype,{set:function(e,t,n){return this.radius=e,this.theta=t,this.y=n,this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.radius=e.radius,this.theta=e.theta,this.y=e.y,this},setFromVector3:function(e){return this.setFromCartesianCoords(e.x,e.y,e.z)},setFromCartesianCoords:function(e,t,n){return this.radius=Math.sqrt(e*e+n*n),this.theta=Math.atan2(e,n),this.y=t,this}});function _l(e,t){this.min=e!==void 0?e:new j(1/0,1/0),this.max=t!==void 0?t:new j(-1/0,-1/0)}Object.assign(_l.prototype,{set:function(e,t){return this.min.copy(e),this.max.copy(t),this},setFromPoints:function(e){this.makeEmpty();for(var t=0,n=e.length;t<n;t++)this.expandByPoint(e[t]);return this},setFromCenterAndSize:function(){var e=new j;return function(n,i){var r=e.copy(i).multiplyScalar(.5);return this.min.copy(n).sub(r),this.max.copy(n).add(r),this}}(),clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.min.copy(e.min),this.max.copy(e.max),this},makeEmpty:function(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this},isEmpty:function(){return this.max.x<this.min.x||this.max.y<this.min.y},getCenter:function(e){return e===void 0&&(console.warn("THREE.Box2: .getCenter() target is now required"),e=new j),this.isEmpty()?e.set(0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)},getSize:function(e){return e===void 0&&(console.warn("THREE.Box2: .getSize() target is now required"),e=new j),this.isEmpty()?e.set(0,0):e.subVectors(this.max,this.min)},expandByPoint:function(e){return this.min.min(e),this.max.max(e),this},expandByVector:function(e){return this.min.sub(e),this.max.add(e),this},expandByScalar:function(e){return this.min.addScalar(-e),this.max.addScalar(e),this},containsPoint:function(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y)},containsBox:function(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y},getParameter:function(e,t){return t===void 0&&(console.warn("THREE.Box2: .getParameter() target is now required"),t=new j),t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y))},intersectsBox:function(e){return!(e.max.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y)},clampPoint:function(e,t){return t===void 0&&(console.warn("THREE.Box2: .clampPoint() target is now required"),t=new j),t.copy(e).clamp(this.min,this.max)},distanceToPoint:function(){var e=new j;return function(n){var i=e.copy(n).clamp(this.min,this.max);return i.sub(n).length()}}(),intersect:function(e){return this.min.max(e.min),this.max.min(e.max),this},union:function(e){return this.min.min(e.min),this.max.max(e.max),this},translate:function(e){return this.min.add(e),this.max.add(e),this},equals:function(e){return e.min.equals(this.min)&&e.max.equals(this.max)}});var ja,Mr;function wl(e,t){this.start=e!==void 0?e:new E,this.end=t!==void 0?t:new E}Object.assign(wl.prototype,{set:function(e,t){return this.start.copy(e),this.end.copy(t),this},clone:function(){return new this.constructor().copy(this)},copy:function(e){return this.start.copy(e.start),this.end.copy(e.end),this},getCenter:function(e){return e===void 0&&(console.warn("THREE.Line3: .getCenter() target is now required"),e=new E),e.addVectors(this.start,this.end).multiplyScalar(.5)},delta:function(e){return e===void 0&&(console.warn("THREE.Line3: .delta() target is now required"),e=new E),e.subVectors(this.end,this.start)},distanceSq:function(){return this.start.distanceToSquared(this.end)},distance:function(){return this.start.distanceTo(this.end)},at:function(e,t){return t===void 0&&(console.warn("THREE.Line3: .at() target is now required"),t=new E),this.delta(t).multiplyScalar(e).add(this.start)},closestPointToPointParameter:function(e,t){ja===void 0&&(ja=new E,Mr=new E),ja.subVectors(e,this.start),Mr.subVectors(this.end,this.start);var n=Mr.dot(Mr),i=Mr.dot(ja),r=i/n;return t&&(r=Pe.clamp(r,0,1)),r},closestPointToPoint:function(e,t,n){var i=this.closestPointToPointParameter(e,t);return n===void 0&&(console.warn("THREE.Line3: .closestPointToPoint() target is now required"),n=new E),this.delta(n).multiplyScalar(i).add(this.start)},applyMatrix4:function(e){return this.start.applyMatrix4(e),this.end.applyMatrix4(e),this},equals:function(e){return e.start.equals(this.start)&&e.end.equals(this.end)}});function wa(e){ae.call(this),this.material=e,this.render=function(){}}wa.prototype=Object.create(ae.prototype);wa.prototype.constructor=wa;wa.prototype.isImmediateRenderObject=!0;function Ea(e,t,n,i){this.object=e,this.size=t!==void 0?t:1;var r=n!==void 0?n:16711680,a=i!==void 0?i:1,o=0,s=this.object.geometry;s&&s.isGeometry?o=s.faces.length*3:s&&s.isBufferGeometry&&(o=s.attributes.normal.count);var l=new oe,c=new $(o*2*3,3);l.addAttribute("position",c),nt.call(this,l,new $e({color:r,linewidth:a})),this.matrixAutoUpdate=!1,this.update()}Ea.prototype=Object.create(nt.prototype);Ea.prototype.constructor=Ea;Ea.prototype.update=function(){var e=new E,t=new E,n=new xt;return function(){var r=["a","b","c"];this.object.updateMatrixWorld(!0),n.getNormalMatrix(this.object.matrixWorld);var a=this.object.matrixWorld,o=this.geometry.attributes.position,s=this.object.geometry;if(s&&s.isGeometry)for(var l=s.vertices,c=s.faces,u=0,h=0,d=c.length;h<d;h++)for(var f=c[h],p=0,v=f.vertexNormals.length;p<v;p++){var m=l[f[r[p]]],g=f.vertexNormals[p];e.copy(m).applyMatrix4(a),t.copy(g).applyMatrix3(n).normalize().multiplyScalar(this.size).add(e),o.setXYZ(u,e.x,e.y,e.z),u=u+1,o.setXYZ(u,t.x,t.y,t.z),u=u+1}else if(s&&s.isBufferGeometry)for(var y=s.attributes.position,b=s.attributes.normal,u=0,p=0,v=y.count;p<v;p++)e.set(y.getX(p),y.getY(p),y.getZ(p)).applyMatrix4(a),t.set(b.getX(p),b.getY(p),b.getZ(p)),t.applyMatrix3(n).normalize().multiplyScalar(this.size).add(e),o.setXYZ(u,e.x,e.y,e.z),u=u+1,o.setXYZ(u,t.x,t.y,t.z),u=u+1;o.needsUpdate=!0}}();function hr(e,t){ae.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=t;for(var n=new oe,i=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1],r=0,a=1,o=32;r<o;r++,a++){var s=r/o*Math.PI*2,l=a/o*Math.PI*2;i.push(Math.cos(s),Math.sin(s),1,Math.cos(l),Math.sin(l),1)}n.addAttribute("position",new $(i,3));var c=new $e({fog:!1});this.cone=new nt(n,c),this.add(this.cone),this.update()}hr.prototype=Object.create(ae.prototype);hr.prototype.constructor=hr;hr.prototype.dispose=function(){this.cone.geometry.dispose(),this.cone.material.dispose()};hr.prototype.update=function(){var e=new E;return function(){this.light.updateMatrixWorld();var n=this.light.distance?this.light.distance:1e3,i=n*Math.tan(this.light.angle);this.cone.scale.set(i,i,n),e.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(e),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}();function ih(e){var t=[];e&&e.isBone&&t.push(e);for(var n=0;n<e.children.length;n++)t.push.apply(t,ih(e.children[n]));return t}function dr(e){for(var t=ih(e),n=new oe,i=[],r=[],a=new ye(0,0,1),o=new ye(0,1,0),s=0;s<t.length;s++){var l=t[s];l.parent&&l.parent.isBone&&(i.push(0,0,0),i.push(0,0,0),r.push(a.r,a.g,a.b),r.push(o.r,o.g,o.b))}n.addAttribute("position",new $(i,3)),n.addAttribute("color",new $(r,3));var c=new $e({vertexColors:Si,depthTest:!1,depthWrite:!1,transparent:!0});nt.call(this,n,c),this.root=e,this.bones=t,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}dr.prototype=Object.create(nt.prototype);dr.prototype.constructor=dr;dr.prototype.updateMatrixWorld=function(){var e=new E,t=new Me,n=new Me;return function(r){var a=this.bones,o=this.geometry,s=o.getAttribute("position");n.getInverse(this.root.matrixWorld);for(var l=0,c=0;l<a.length;l++){var u=a[l];u.parent&&u.parent.isBone&&(t.multiplyMatrices(n,u.matrixWorld),e.setFromMatrixPosition(t),s.setXYZ(c,e.x,e.y,e.z),t.multiplyMatrices(n,u.parent.matrixWorld),e.setFromMatrixPosition(t),s.setXYZ(c+1,e.x,e.y,e.z),c+=2)}o.getAttribute("position").needsUpdate=!0,ae.prototype.updateMatrixWorld.call(this,r)}}();function fr(e,t,n){this.light=e,this.light.updateMatrixWorld(),this.color=n;var i=new qn(t,4,2),r=new Yt({wireframe:!0,fog:!1});_t.call(this,i,r),this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}fr.prototype=Object.create(_t.prototype);fr.prototype.constructor=fr;fr.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()};fr.prototype.update=function(){this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)};function pr(e,t){this.type="RectAreaLightHelper",this.light=e,this.color=t;var n=[1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],i=new oe;i.addAttribute("position",new $(n,3)),i.computeBoundingSphere();var r=new $e({fog:!1});Mt.call(this,i,r);var a=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],o=new oe;o.addAttribute("position",new $(a,3)),o.computeBoundingSphere(),this.add(new _t(o,new Yt({side:vt,fog:!1}))),this.update()}pr.prototype=Object.create(Mt.prototype);pr.prototype.constructor=pr;pr.prototype.update=function(){if(this.scale.set(.5*this.light.width,.5*this.light.height,1),this.color!==void 0)this.material.color.set(this.color),this.children[0].material.color.set(this.color);else{this.material.color.copy(this.light.color).multiplyScalar(this.light.intensity);var e=this.material.color,t=Math.max(e.r,e.g,e.b);t>1&&e.multiplyScalar(1/t),this.children[0].material.color.copy(this.material.color)}};pr.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()};function mr(e,t,n){ae.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n;var i=new hi(t);i.rotateY(Math.PI*.5),this.material=new Yt({wireframe:!0,fog:!1}),this.color===void 0&&(this.material.vertexColors=Si);var r=i.getAttribute("position"),a=new Float32Array(r.count*3);i.addAttribute("color",new ke(a,3)),this.add(new _t(i,this.material)),this.update()}mr.prototype=Object.create(ae.prototype);mr.prototype.constructor=mr;mr.prototype.dispose=function(){this.children[0].geometry.dispose(),this.children[0].material.dispose()};mr.prototype.update=function(){var e=new E,t=new ye,n=new ye;return function(){var r=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{var a=r.geometry.getAttribute("color");t.copy(this.light.color),n.copy(this.light.groundColor);for(var o=0,s=a.count;o<s;o++){var l=o<s/2?t:n;a.setXYZ(o,l.r,l.g,l.b)}a.needsUpdate=!0}r.lookAt(e.setFromMatrixPosition(this.light.matrixWorld).negate())}}();function vr(e,t){this.lightProbe=e,this.size=t;var n={};n.GAMMA_OUTPUT="";var i=new Dt({defines:n,uniforms:{sh:{value:this.lightProbe.sh.coefficients},intensity:{value:this.lightProbe.intensity}},vertexShader:["varying vec3 vNormal;","void main() {","	vNormal = normalize( normalMatrix * normal );","	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join(`
`),fragmentShader:["#define RECIPROCAL_PI 0.318309886","vec3 inverseTransformDirection( in vec3 normal, in mat4 matrix ) {","	// matrix is assumed to be orthogonal","	return normalize( ( vec4( normal, 0.0 ) * matrix ).xyz );","}","vec3 linearToOutput( in vec3 a ) {","	#ifdef GAMMA_OUTPUT","		return pow( a, vec3( 1.0 / float( GAMMA_FACTOR ) ) );","	#else","		return a;","	#endif","}","// source: https://graphics.stanford.edu/papers/envmap/envmap.pdf","vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {","	// normal is assumed to have unit length","	float x = normal.x, y = normal.y, z = normal.z;","	// band 0","	vec3 result = shCoefficients[ 0 ] * 0.886227;","	// band 1","	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;","	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;","	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;","	// band 2","	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;","	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;","	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );","	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;","	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );","	return result;","}","uniform vec3 sh[ 9 ]; // sh coefficients","uniform float intensity; // light probe intensity","varying vec3 vNormal;","void main() {","	vec3 normal = normalize( vNormal );","	vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );","	vec3 irradiance = shGetIrradianceAt( worldNormal, sh );","	vec3 outgoingLight = RECIPROCAL_PI * irradiance * intensity;","	outgoingLight = linearToOutput( outgoingLight );","	gl_FragColor = vec4( outgoingLight, 1.0 );","}"].join(`
`)}),r=new qn(1,32,16);_t.call(this,r,i),this.onBeforeRender()}vr.prototype=Object.create(_t.prototype);vr.prototype.constructor=vr;vr.prototype.dispose=function(){this.geometry.dispose(),this.material.dispose()};vr.prototype.onBeforeRender=function(){return function(){this.position.copy(this.lightProbe.position),this.scale.set(1,1,1).multiplyScalar(this.size),this.material.uniforms.intensity.value=this.lightProbe.intensity}}();function Co(e,t,n,i){e=e||10,t=t||10,n=new ye(n!==void 0?n:4473924),i=new ye(i!==void 0?i:8947848);for(var r=t/2,a=e/t,o=e/2,s=[],l=[],c=0,u=0,h=-o;c<=t;c++,h+=a){s.push(-o,0,h,o,0,h),s.push(h,0,-o,h,0,o);var d=c===r?n:i;d.toArray(l,u),u+=3,d.toArray(l,u),u+=3,d.toArray(l,u),u+=3,d.toArray(l,u),u+=3}var f=new oe;f.addAttribute("position",new $(s,3)),f.addAttribute("color",new $(l,3));var p=new $e({vertexColors:Si});nt.call(this,f,p)}Co.prototype=Object.assign(Object.create(nt.prototype),{constructor:Co,copy:function(e){return nt.prototype.copy.call(this,e),this.geometry.copy(e.geometry),this.material.copy(e.material),this},clone:function(){return new this.constructor().copy(this)}});function Ro(e,t,n,i,r,a){e=e||10,t=t||16,n=n||8,i=i||64,r=new ye(r!==void 0?r:4473924),a=new ye(a!==void 0?a:8947848);var o=[],s=[],l,c,u,h,d,f,p;for(h=0;h<=t;h++)u=h/t*(Math.PI*2),l=Math.sin(u)*e,c=Math.cos(u)*e,o.push(0,0,0),o.push(l,0,c),p=h&1?r:a,s.push(p.r,p.g,p.b),s.push(p.r,p.g,p.b);for(h=0;h<=n;h++)for(p=h&1?r:a,f=e-e/n*h,d=0;d<i;d++)u=d/i*(Math.PI*2),l=Math.sin(u)*f,c=Math.cos(u)*f,o.push(l,0,c),s.push(p.r,p.g,p.b),u=(d+1)/i*(Math.PI*2),l=Math.sin(u)*f,c=Math.cos(u)*f,o.push(l,0,c),s.push(p.r,p.g,p.b);var v=new oe;v.addAttribute("position",new $(o,3)),v.addAttribute("color",new $(s,3));var m=new $e({vertexColors:Si});nt.call(this,v,m)}Ro.prototype=Object.create(nt.prototype);Ro.prototype.constructor=Ro;function gr(e,t,n,i){this.audio=e,this.range=t||1,this.divisionsInnerAngle=n||16,this.divisionsOuterAngle=i||2;var r=new oe,a=this.divisionsInnerAngle+this.divisionsOuterAngle*2,o=new Float32Array((a*3+3)*3);r.addAttribute("position",new ke(o,3));var s=new $e({color:65280}),l=new $e({color:16776960});Mt.call(this,r,[l,s]),this.update()}gr.prototype=Object.create(Mt.prototype);gr.prototype.constructor=gr;gr.prototype.update=function(){var e=this.audio,t=this.range,n=this.divisionsInnerAngle,i=this.divisionsOuterAngle,r=Pe.degToRad(e.panner.coneInnerAngle),a=Pe.degToRad(e.panner.coneOuterAngle),o=r/2,s=a/2,l=0,c=0,u,h,d=this.geometry,f=d.attributes.position;d.clearGroups();function p(v,m,g,y){var b=(m-v)/g;for(f.setXYZ(l,0,0,0),c++,u=v;u<m;u+=b)h=l+c,f.setXYZ(h,Math.sin(u)*t,0,Math.cos(u)*t),f.setXYZ(h+1,Math.sin(Math.min(u+b,m))*t,0,Math.cos(Math.min(u+b,m))*t),f.setXYZ(h+2,0,0,0),c+=3;d.addGroup(l,c,y),l+=c,c=0}p(-s,-o,i,0),p(-o,o,n,1),p(o,s,i,0),f.needsUpdate=!0,r===a&&(this.material[0].visible=!1)};gr.prototype.dispose=function(){this.geometry.dispose(),this.material[0].dispose(),this.material[1].dispose()};function Ma(e,t,n,i){this.object=e,this.size=t!==void 0?t:1;var r=n!==void 0?n:16776960,a=i!==void 0?i:1,o=0,s=this.object.geometry;s&&s.isGeometry?o=s.faces.length:console.warn("THREE.FaceNormalsHelper: only THREE.Geometry is supported. Use THREE.VertexNormalsHelper, instead.");var l=new oe,c=new $(o*2*3,3);l.addAttribute("position",c),nt.call(this,l,new $e({color:r,linewidth:a})),this.matrixAutoUpdate=!1,this.update()}Ma.prototype=Object.create(nt.prototype);Ma.prototype.constructor=Ma;Ma.prototype.update=function(){var e=new E,t=new E,n=new xt;return function(){this.object.updateMatrixWorld(!0),n.getNormalMatrix(this.object.matrixWorld);for(var r=this.object.matrixWorld,a=this.geometry.attributes.position,o=this.object.geometry,s=o.vertices,l=o.faces,c=0,u=0,h=l.length;u<h;u++){var d=l[u],f=d.normal;e.copy(s[d.a]).add(s[d.b]).add(s[d.c]).divideScalar(3).applyMatrix4(r),t.copy(f).applyMatrix3(n).normalize().multiplyScalar(this.size).add(e),a.setXYZ(c,e.x,e.y,e.z),c=c+1,a.setXYZ(c,t.x,t.y,t.z),c=c+1}a.needsUpdate=!0}}();function yr(e,t,n){ae.call(this),this.light=e,this.light.updateMatrixWorld(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.color=n,t===void 0&&(t=1);var i=new oe;i.addAttribute("position",new $([-t,t,0,t,t,0,t,-t,0,-t,-t,0,-t,t,0],3));var r=new $e({fog:!1});this.lightPlane=new Mt(i,r),this.add(this.lightPlane),i=new oe,i.addAttribute("position",new $([0,0,0,0,0,1],3)),this.targetLine=new Mt(i,r),this.add(this.targetLine),this.update()}yr.prototype=Object.create(ae.prototype);yr.prototype.constructor=yr;yr.prototype.dispose=function(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()};yr.prototype.update=function(){var e=new E,t=new E,n=new E;return function(){e.setFromMatrixPosition(this.light.matrixWorld),t.setFromMatrixPosition(this.light.target.matrixWorld),n.subVectors(t,e),this.lightPlane.lookAt(t),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(t),this.targetLine.scale.z=n.length()}}();function Sa(e){var t=new oe,n=new $e({color:16777215,vertexColors:Xs}),i=[],r=[],a={},o=new ye(16755200),s=new ye(16711680),l=new ye(43775),c=new ye(16777215),u=new ye(3355443);h("n1","n2",o),h("n2","n4",o),h("n4","n3",o),h("n3","n1",o),h("f1","f2",o),h("f2","f4",o),h("f4","f3",o),h("f3","f1",o),h("n1","f1",o),h("n2","f2",o),h("n3","f3",o),h("n4","f4",o),h("p","n1",s),h("p","n2",s),h("p","n3",s),h("p","n4",s),h("u1","u2",l),h("u2","u3",l),h("u3","u1",l),h("c","t",c),h("p","c",u),h("cn1","cn2",u),h("cn3","cn4",u),h("cf1","cf2",u),h("cf3","cf4",u);function h(f,p,v){d(f,v),d(p,v)}function d(f,p){i.push(0,0,0),r.push(p.r,p.g,p.b),a[f]===void 0&&(a[f]=[]),a[f].push(i.length/3-1)}t.addAttribute("position",new $(i,3)),t.addAttribute("color",new $(r,3)),nt.call(this,t,n),this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=a,this.update()}Sa.prototype=Object.create(nt.prototype);Sa.prototype.constructor=Sa;Sa.prototype.update=function(){var e,t,n=new E,i=new En;function r(a,o,s,l){n.set(o,s,l).unproject(i);var c=t[a];if(c!==void 0)for(var u=e.getAttribute("position"),h=0,d=c.length;h<d;h++)u.setXYZ(c[h],n.x,n.y,n.z)}return function(){e=this.geometry,t=this.pointMap;var o=1,s=1;i.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),r("c",0,0,-1),r("t",0,0,1),r("n1",-o,-s,-1),r("n2",o,-s,-1),r("n3",-o,s,-1),r("n4",o,s,-1),r("f1",-o,-s,1),r("f2",o,-s,1),r("f3",-o,s,1),r("f4",o,s,1),r("u1",o*.7,s*1.1,-1),r("u2",-o*.7,s*1.1,-1),r("u3",0,s*2,-1),r("cf1",-o,0,1),r("cf2",o,0,1),r("cf3",0,-s,1),r("cf4",0,s,1),r("cn1",-o,0,-1),r("cn2",o,0,-1),r("cn3",0,-s,-1),r("cn4",0,s,-1),e.getAttribute("position").needsUpdate=!0}}();function kn(e,t){this.object=e,t===void 0&&(t=16776960);var n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=new Float32Array(8*3),r=new oe;r.setIndex(new ke(n,1)),r.addAttribute("position",new ke(i,3)),nt.call(this,r,new $e({color:t})),this.matrixAutoUpdate=!1,this.update()}kn.prototype=Object.create(nt.prototype);kn.prototype.constructor=kn;kn.prototype.update=function(){var e=new an;return function(n){if(n!==void 0&&console.warn("THREE.BoxHelper: .update() has no longer arguments."),this.object!==void 0&&e.setFromObject(this.object),!e.isEmpty()){var i=e.min,r=e.max,a=this.geometry.attributes.position,o=a.array;o[0]=r.x,o[1]=r.y,o[2]=r.z,o[3]=i.x,o[4]=r.y,o[5]=r.z,o[6]=i.x,o[7]=i.y,o[8]=r.z,o[9]=r.x,o[10]=i.y,o[11]=r.z,o[12]=r.x,o[13]=r.y,o[14]=i.z,o[15]=i.x,o[16]=r.y,o[17]=i.z,o[18]=i.x,o[19]=i.y,o[20]=i.z,o[21]=r.x,o[22]=i.y,o[23]=i.z,a.needsUpdate=!0,this.geometry.computeBoundingSphere()}}}();kn.prototype.setFromObject=function(e){return this.object=e,this.update(),this};kn.prototype.copy=function(e){return nt.prototype.copy.call(this,e),this.object=e.object,this};kn.prototype.clone=function(){return new this.constructor().copy(this)};function Ta(e,t){this.type="Box3Helper",this.box=e,t=t||16776960;var n=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),i=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],r=new oe;r.setIndex(new ke(n,1)),r.addAttribute("position",new $(i,3)),nt.call(this,r,new $e({color:t})),this.geometry.computeBoundingSphere()}Ta.prototype=Object.create(nt.prototype);Ta.prototype.constructor=Ta;Ta.prototype.updateMatrixWorld=function(e){var t=this.box;t.isEmpty()||(t.getCenter(this.position),t.getSize(this.scale),this.scale.multiplyScalar(.5),ae.prototype.updateMatrixWorld.call(this,e))};function Aa(e,t,n){this.type="PlaneHelper",this.plane=e,this.size=t===void 0?1:t;var i=n!==void 0?n:16776960,r=[1,-1,1,-1,1,1,-1,-1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,0,0,1,0,0,0],a=new oe;a.addAttribute("position",new $(r,3)),a.computeBoundingSphere(),Mt.call(this,a,new $e({color:i}));var o=[1,1,1,-1,1,1,-1,-1,1,1,1,1,-1,-1,1,1,-1,1],s=new oe;s.addAttribute("position",new $(o,3)),s.computeBoundingSphere(),this.add(new _t(s,new Yt({color:i,opacity:.2,transparent:!0,depthWrite:!1})))}Aa.prototype=Object.create(Mt.prototype);Aa.prototype.constructor=Aa;Aa.prototype.updateMatrixWorld=function(e){var t=-this.plane.constant;Math.abs(t)<1e-8&&(t=1e-8),this.scale.set(.5*this.size,.5*this.size,t),this.children[0].material.side=t<0?vt:br,this.lookAt(this.plane.normal),ae.prototype.updateMatrixWorld.call(this,e)};var Ya,cs;function Nn(e,t,n,i,r,a){ae.call(this),e===void 0&&(e=new E(0,0,1)),t===void 0&&(t=new E(0,0,0)),n===void 0&&(n=1),i===void 0&&(i=16776960),r===void 0&&(r=.2*n),a===void 0&&(a=.2*r),Ya===void 0&&(Ya=new oe,Ya.addAttribute("position",new $([0,0,0,0,1,0],3)),cs=new Dn(0,.5,1,5,1),cs.translate(0,-.5,0)),this.position.copy(t),this.line=new Mt(Ya,new $e({color:i})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new _t(cs,new Yt({color:i})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(e),this.setLength(n,r,a)}Nn.prototype=Object.create(ae.prototype);Nn.prototype.constructor=Nn;Nn.prototype.setDirection=function(){var e=new E,t;return function(i){i.y>.99999?this.quaternion.set(0,0,0,1):i.y<-.99999?this.quaternion.set(1,0,0,0):(e.set(i.z,0,-i.x).normalize(),t=Math.acos(i.y),this.quaternion.setFromAxisAngle(e,t))}}();Nn.prototype.setLength=function(e,t,n){t===void 0&&(t=.2*e),n===void 0&&(n=.2*t),this.line.scale.set(1,Math.max(0,e-t),1),this.line.updateMatrix(),this.cone.scale.set(n,t,n),this.cone.position.y=e,this.cone.updateMatrix()};Nn.prototype.setColor=function(e){this.line.material.color.set(e),this.cone.material.color.set(e)};Nn.prototype.copy=function(e){return ae.prototype.copy.call(this,e,!1),this.line.copy(e.line),this.cone.copy(e.cone),this};Nn.prototype.clone=function(){return new this.constructor().copy(this)};function La(e){e=e||1;var t=[0,0,0,e,0,0,0,0,0,0,e,0,0,0,0,0,0,e],n=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],i=new oe;i.addAttribute("position",new $(t,3)),i.addAttribute("color",new $(n,3));var r=new $e({vertexColors:Si});nt.call(this,i,r)}La.prototype=Object.create(nt.prototype);La.prototype.constructor=La;function $g(e,t,n,i,r,a,o){return console.warn("THREE.Face4 has been removed. A THREE.Face3 will be created instead."),new Hi(e,t,n,r,a,o)}var Kg=0,ey=1;function ty(e){return console.warn("THREE.MeshFaceMaterial has been removed. Use an Array instead."),e}function ny(e){return e===void 0&&(e=[]),console.warn("THREE.MultiMaterial has been removed. Use an Array instead."),e.isMultiMaterial=!0,e.materials=e,e.clone=function(){return e.slice()},e}function iy(e,t){return console.warn("THREE.PointCloud has been renamed to THREE.Points."),new Yi(e,t)}function ry(e){return console.warn("THREE.Particle has been renamed to THREE.Sprite."),new Xr(e)}function ay(e,t){return console.warn("THREE.ParticleSystem has been renamed to THREE.Points."),new Yi(e,t)}function oy(e){return console.warn("THREE.PointCloudMaterial has been renamed to THREE.PointsMaterial."),new ln(e)}function sy(e){return console.warn("THREE.ParticleBasicMaterial has been renamed to THREE.PointsMaterial."),new ln(e)}function ly(e){return console.warn("THREE.ParticleSystemMaterial has been renamed to THREE.PointsMaterial."),new ln(e)}function cy(e,t,n){return console.warn("THREE.Vertex has been removed. Use THREE.Vector3 instead."),new E(e,t,n)}function uy(e,t){return console.warn("THREE.DynamicBufferAttribute has been removed. Use new THREE.BufferAttribute().setDynamic( true ) instead."),new ke(e,t).setDynamic(!0)}function hy(e,t){return console.warn("THREE.Int8Attribute has been removed. Use new THREE.Int8BufferAttribute() instead."),new zr(e,t)}function dy(e,t){return console.warn("THREE.Uint8Attribute has been removed. Use new THREE.Uint8BufferAttribute() instead."),new Fr(e,t)}function fy(e,t){return console.warn("THREE.Uint8ClampedAttribute has been removed. Use new THREE.Uint8ClampedBufferAttribute() instead."),new Hr(e,t)}function py(e,t){return console.warn("THREE.Int16Attribute has been removed. Use new THREE.Int16BufferAttribute() instead."),new Ur(e,t)}function my(e,t){return console.warn("THREE.Uint16Attribute has been removed. Use new THREE.Uint16BufferAttribute() instead."),new ai(e,t)}function vy(e,t){return console.warn("THREE.Int32Attribute has been removed. Use new THREE.Int32BufferAttribute() instead."),new Gr(e,t)}function gy(e,t){return console.warn("THREE.Uint32Attribute has been removed. Use new THREE.Uint32BufferAttribute() instead."),new oi(e,t)}function yy(e,t){return console.warn("THREE.Float32Attribute has been removed. Use new THREE.Float32BufferAttribute() instead."),new $(e,t)}function by(e,t){return console.warn("THREE.Float64Attribute has been removed. Use new THREE.Float64BufferAttribute() instead."),new Vr(e,t)}we.create=function(e,t){return console.log("THREE.Curve.create() has been deprecated"),e.prototype=Object.create(we.prototype),e.prototype.constructor=e,e.prototype.getPoint=t,e};Object.assign(In.prototype,{createPointsGeometry:function(e){console.warn("THREE.CurvePath: .createPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var t=this.getPoints(e);return this.createGeometry(t)},createSpacedPointsGeometry:function(e){console.warn("THREE.CurvePath: .createSpacedPointsGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");var t=this.getSpacedPoints(e);return this.createGeometry(t)},createGeometry:function(e){console.warn("THREE.CurvePath: .createGeometry() has been removed. Use new THREE.Geometry().setFromPoints( points ) instead.");for(var t=new Te,n=0,i=e.length;n<i;n++){var r=e[n];t.vertices.push(new E(r.x,r.y,r.z||0))}return t}});Object.assign(rn.prototype,{fromPoints:function(e){console.warn("THREE.Path: .fromPoints() has been renamed to .setFromPoints()."),this.setFromPoints(e)}});function rh(e){console.warn("THREE.ClosedSplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),Rt.call(this,e),this.type="catmullrom",this.closed=!0}rh.prototype=Object.create(Rt.prototype);function ah(e){console.warn("THREE.SplineCurve3 has been deprecated. Use THREE.CatmullRomCurve3 instead."),Rt.call(this,e),this.type="catmullrom"}ah.prototype=Object.create(Rt.prototype);function El(e){console.warn("THREE.Spline has been removed. Use THREE.CatmullRomCurve3 instead."),Rt.call(this,e),this.type="catmullrom"}El.prototype=Object.create(Rt.prototype);Object.assign(El.prototype,{initFromArray:function(){console.error("THREE.Spline: .initFromArray() has been removed.")},getControlPointsArray:function(){console.error("THREE.Spline: .getControlPointsArray() has been removed.")},reparametrizeByArcLength:function(){console.error("THREE.Spline: .reparametrizeByArcLength() has been removed.")}});function xy(e){return console.warn("THREE.AxisHelper has been renamed to THREE.AxesHelper."),new La(e)}function _y(e,t){return console.warn("THREE.BoundingBoxHelper has been deprecated. Creating a THREE.BoxHelper instead."),new kn(e,t)}function wy(e,t){return console.warn("THREE.EdgesHelper has been removed. Use THREE.EdgesGeometry instead."),new nt(new rr(e.geometry),new $e({color:t!==void 0?t:16777215}))}Co.prototype.setColors=function(){console.error("THREE.GridHelper: setColors() has been deprecated, pass them in the constructor instead.")};dr.prototype.update=function(){console.error("THREE.SkeletonHelper: update() no longer needs to be called.")};function Ey(e,t){return console.warn("THREE.WireframeHelper has been removed. Use THREE.WireframeGeometry instead."),new nt(new Zi(e.geometry),new $e({color:t!==void 0?t:16777215}))}Object.assign(_a.prototype,{extractUrlBase:function(e){return console.warn("THREE.Loader: .extractUrlBase() has been deprecated. Use THREE.LoaderUtils.extractUrlBase() instead."),hl.extractUrlBase(e)}});function My(e){return console.warn("THREE.XHRLoader has been renamed to THREE.FileLoader."),new mn(e)}function Sy(e){return console.warn("THREE.BinaryTextureLoader has been renamed to THREE.DataTextureLoader."),new ll(e)}Object.assign(fl.prototype,{setTexturePath:function(e){return console.warn("THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath()."),this.setResourcePath(e)}});Object.assign(_l.prototype,{center:function(e){return console.warn("THREE.Box2: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box2: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box2: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},size:function(e){return console.warn("THREE.Box2: .size() has been renamed to .getSize()."),this.getSize(e)}});Object.assign(an.prototype,{center:function(e){return console.warn("THREE.Box3: .center() has been renamed to .getCenter()."),this.getCenter(e)},empty:function(){return console.warn("THREE.Box3: .empty() has been renamed to .isEmpty()."),this.isEmpty()},isIntersectionBox:function(e){return console.warn("THREE.Box3: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionSphere:function(e){return console.warn("THREE.Box3: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)},size:function(e){return console.warn("THREE.Box3: .size() has been renamed to .getSize()."),this.getSize(e)}});wl.prototype.center=function(e){return console.warn("THREE.Line3: .center() has been renamed to .getCenter()."),this.getCenter(e)};Object.assign(Pe,{random16:function(){return console.warn("THREE.Math: .random16() has been deprecated. Use Math.random() instead."),Math.random()},nearestPowerOfTwo:function(e){return console.warn("THREE.Math: .nearestPowerOfTwo() has been renamed to .floorPowerOfTwo()."),Pe.floorPowerOfTwo(e)},nextPowerOfTwo:function(e){return console.warn("THREE.Math: .nextPowerOfTwo() has been renamed to .ceilPowerOfTwo()."),Pe.ceilPowerOfTwo(e)}});Object.assign(xt.prototype,{flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix3: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},multiplyVector3:function(e){return console.warn("THREE.Matrix3: .multiplyVector3() has been removed. Use vector.applyMatrix3( matrix ) instead."),e.applyMatrix3(this)},multiplyVector3Array:function(){console.error("THREE.Matrix3: .multiplyVector3Array() has been removed.")},applyToBuffer:function(e){return console.warn("THREE.Matrix3: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(e)},applyToVector3Array:function(){console.error("THREE.Matrix3: .applyToVector3Array() has been removed.")}});Object.assign(Me.prototype,{extractPosition:function(e){return console.warn("THREE.Matrix4: .extractPosition() has been renamed to .copyPosition()."),this.copyPosition(e)},flattenToArrayOffset:function(e,t){return console.warn("THREE.Matrix4: .flattenToArrayOffset() has been deprecated. Use .toArray() instead."),this.toArray(e,t)},getPosition:function(){var e;return function(){return e===void 0&&(e=new E),console.warn("THREE.Matrix4: .getPosition() has been removed. Use Vector3.setFromMatrixPosition( matrix ) instead."),e.setFromMatrixColumn(this,3)}}(),setRotationFromQuaternion:function(e){return console.warn("THREE.Matrix4: .setRotationFromQuaternion() has been renamed to .makeRotationFromQuaternion()."),this.makeRotationFromQuaternion(e)},multiplyToArray:function(){console.warn("THREE.Matrix4: .multiplyToArray() has been removed.")},multiplyVector3:function(e){return console.warn("THREE.Matrix4: .multiplyVector3() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector4:function(e){return console.warn("THREE.Matrix4: .multiplyVector4() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},multiplyVector3Array:function(){console.error("THREE.Matrix4: .multiplyVector3Array() has been removed.")},rotateAxis:function(e){console.warn("THREE.Matrix4: .rotateAxis() has been removed. Use Vector3.transformDirection( matrix ) instead."),e.transformDirection(this)},crossVector:function(e){return console.warn("THREE.Matrix4: .crossVector() has been removed. Use vector.applyMatrix4( matrix ) instead."),e.applyMatrix4(this)},translate:function(){console.error("THREE.Matrix4: .translate() has been removed.")},rotateX:function(){console.error("THREE.Matrix4: .rotateX() has been removed.")},rotateY:function(){console.error("THREE.Matrix4: .rotateY() has been removed.")},rotateZ:function(){console.error("THREE.Matrix4: .rotateZ() has been removed.")},rotateByAxis:function(){console.error("THREE.Matrix4: .rotateByAxis() has been removed.")},applyToBuffer:function(e){return console.warn("THREE.Matrix4: .applyToBuffer() has been removed. Use matrix.applyToBufferAttribute( attribute ) instead."),this.applyToBufferAttribute(e)},applyToVector3Array:function(){console.error("THREE.Matrix4: .applyToVector3Array() has been removed.")},makeFrustum:function(e,t,n,i,r,a){return console.warn("THREE.Matrix4: .makeFrustum() has been removed. Use .makePerspective( left, right, top, bottom, near, far ) instead."),this.makePerspective(e,t,i,n,r,a)}});bn.prototype.isIntersectionLine=function(e){return console.warn("THREE.Plane: .isIntersectionLine() has been renamed to .intersectsLine()."),this.intersectsLine(e)};pt.prototype.multiplyVector3=function(e){return console.warn("THREE.Quaternion: .multiplyVector3() has been removed. Use is now vector.applyQuaternion( quaternion ) instead."),e.applyQuaternion(this)};Object.assign(Ai.prototype,{isIntersectionBox:function(e){return console.warn("THREE.Ray: .isIntersectionBox() has been renamed to .intersectsBox()."),this.intersectsBox(e)},isIntersectionPlane:function(e){return console.warn("THREE.Ray: .isIntersectionPlane() has been renamed to .intersectsPlane()."),this.intersectsPlane(e)},isIntersectionSphere:function(e){return console.warn("THREE.Ray: .isIntersectionSphere() has been renamed to .intersectsSphere()."),this.intersectsSphere(e)}});Object.assign(yt.prototype,{area:function(){return console.warn("THREE.Triangle: .area() has been renamed to .getArea()."),this.getArea()},barycoordFromPoint:function(e,t){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),this.getBarycoord(e,t)},midpoint:function(e){return console.warn("THREE.Triangle: .midpoint() has been renamed to .getMidpoint()."),this.getMidpoint(e)},normal:function(e){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),this.getNormal(e)},plane:function(e){return console.warn("THREE.Triangle: .plane() has been renamed to .getPlane()."),this.getPlane(e)}});Object.assign(yt,{barycoordFromPoint:function(e,t,n,i,r){return console.warn("THREE.Triangle: .barycoordFromPoint() has been renamed to .getBarycoord()."),yt.getBarycoord(e,t,n,i,r)},normal:function(e,t,n,i){return console.warn("THREE.Triangle: .normal() has been renamed to .getNormal()."),yt.getNormal(e,t,n,i)}});Object.assign(Un.prototype,{extractAllPoints:function(e){return console.warn("THREE.Shape: .extractAllPoints() has been removed. Use .extractPoints() instead."),this.extractPoints(e)},extrude:function(e){return console.warn("THREE.Shape: .extrude() has been removed. Use ExtrudeGeometry() instead."),new fi(this,e)},makeGeometry:function(e){return console.warn("THREE.Shape: .makeGeometry() has been removed. Use ShapeGeometry() instead."),new pi(this,e)}});Object.assign(j.prototype,{fromAttribute:function(e,t,n){return console.warn("THREE.Vector2: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},distanceToManhattan:function(e){return console.warn("THREE.Vector2: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("THREE.Vector2: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}});Object.assign(E.prototype,{setEulerFromRotationMatrix:function(){console.error("THREE.Vector3: .setEulerFromRotationMatrix() has been removed. Use Euler.setFromRotationMatrix() instead.")},setEulerFromQuaternion:function(){console.error("THREE.Vector3: .setEulerFromQuaternion() has been removed. Use Euler.setFromQuaternion() instead.")},getPositionFromMatrix:function(e){return console.warn("THREE.Vector3: .getPositionFromMatrix() has been renamed to .setFromMatrixPosition()."),this.setFromMatrixPosition(e)},getScaleFromMatrix:function(e){return console.warn("THREE.Vector3: .getScaleFromMatrix() has been renamed to .setFromMatrixScale()."),this.setFromMatrixScale(e)},getColumnFromMatrix:function(e,t){return console.warn("THREE.Vector3: .getColumnFromMatrix() has been renamed to .setFromMatrixColumn()."),this.setFromMatrixColumn(t,e)},applyProjection:function(e){return console.warn("THREE.Vector3: .applyProjection() has been removed. Use .applyMatrix4( m ) instead."),this.applyMatrix4(e)},fromAttribute:function(e,t,n){return console.warn("THREE.Vector3: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},distanceToManhattan:function(e){return console.warn("THREE.Vector3: .distanceToManhattan() has been renamed to .manhattanDistanceTo()."),this.manhattanDistanceTo(e)},lengthManhattan:function(){return console.warn("THREE.Vector3: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}});Object.assign(et.prototype,{fromAttribute:function(e,t,n){return console.warn("THREE.Vector4: .fromAttribute() has been renamed to .fromBufferAttribute()."),this.fromBufferAttribute(e,t,n)},lengthManhattan:function(){return console.warn("THREE.Vector4: .lengthManhattan() has been renamed to .manhattanLength()."),this.manhattanLength()}});Object.assign(Te.prototype,{computeTangents:function(){console.error("THREE.Geometry: .computeTangents() has been removed.")},computeLineDistances:function(){console.error("THREE.Geometry: .computeLineDistances() has been removed. Use THREE.Line.computeLineDistances() instead.")}});Object.assign(ae.prototype,{getChildByName:function(e){return console.warn("THREE.Object3D: .getChildByName() has been renamed to .getObjectByName()."),this.getObjectByName(e)},renderDepth:function(){console.warn("THREE.Object3D: .renderDepth has been removed. Use .renderOrder, instead.")},translate:function(e,t){return console.warn("THREE.Object3D: .translate() has been removed. Use .translateOnAxis( axis, distance ) instead."),this.translateOnAxis(t,e)},getWorldRotation:function(){console.error("THREE.Object3D: .getWorldRotation() has been removed. Use THREE.Object3D.getWorldQuaternion( target ) instead.")}});Object.defineProperties(ae.prototype,{eulerOrder:{get:function(){return console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order},set:function(e){console.warn("THREE.Object3D: .eulerOrder is now .rotation.order."),this.rotation.order=e}},useQuaternion:{get:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")},set:function(){console.warn("THREE.Object3D: .useQuaternion has been removed. The library now uses quaternions by default.")}}});Object.defineProperties(Zr.prototype,{objects:{get:function(){return console.warn("THREE.LOD: .objects has been renamed to .levels."),this.levels}}});Object.defineProperty(co.prototype,"useVertexTexture",{get:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")},set:function(){console.warn("THREE.Skeleton: useVertexTexture has been removed.")}});qr.prototype.initBones=function(){console.error("THREE.SkinnedMesh: initBones() has been removed.")};Object.defineProperty(we.prototype,"__arcLengthDivisions",{get:function(){return console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions},set:function(e){console.warn("THREE.Curve: .__arcLengthDivisions is now .arcLengthDivisions."),this.arcLengthDivisions=e}});ct.prototype.setLens=function(e,t){console.warn("THREE.PerspectiveCamera.setLens is deprecated. Use .setFocalLength and .filmGauge for a photographic setup."),t!==void 0&&(this.filmGauge=t),this.setFocalLength(e)};Object.defineProperties(at.prototype,{onlyShadow:{set:function(){console.warn("THREE.Light: .onlyShadow has been removed.")}},shadowCameraFov:{set:function(e){console.warn("THREE.Light: .shadowCameraFov is now .shadow.camera.fov."),this.shadow.camera.fov=e}},shadowCameraLeft:{set:function(e){console.warn("THREE.Light: .shadowCameraLeft is now .shadow.camera.left."),this.shadow.camera.left=e}},shadowCameraRight:{set:function(e){console.warn("THREE.Light: .shadowCameraRight is now .shadow.camera.right."),this.shadow.camera.right=e}},shadowCameraTop:{set:function(e){console.warn("THREE.Light: .shadowCameraTop is now .shadow.camera.top."),this.shadow.camera.top=e}},shadowCameraBottom:{set:function(e){console.warn("THREE.Light: .shadowCameraBottom is now .shadow.camera.bottom."),this.shadow.camera.bottom=e}},shadowCameraNear:{set:function(e){console.warn("THREE.Light: .shadowCameraNear is now .shadow.camera.near."),this.shadow.camera.near=e}},shadowCameraFar:{set:function(e){console.warn("THREE.Light: .shadowCameraFar is now .shadow.camera.far."),this.shadow.camera.far=e}},shadowCameraVisible:{set:function(){console.warn("THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow.camera ) instead.")}},shadowBias:{set:function(e){console.warn("THREE.Light: .shadowBias is now .shadow.bias."),this.shadow.bias=e}},shadowDarkness:{set:function(){console.warn("THREE.Light: .shadowDarkness has been removed.")}},shadowMapWidth:{set:function(e){console.warn("THREE.Light: .shadowMapWidth is now .shadow.mapSize.width."),this.shadow.mapSize.width=e}},shadowMapHeight:{set:function(e){console.warn("THREE.Light: .shadowMapHeight is now .shadow.mapSize.height."),this.shadow.mapSize.height=e}}});Object.defineProperties(ke.prototype,{length:{get:function(){return console.warn("THREE.BufferAttribute: .length has been deprecated. Use .count instead."),this.array.length}},copyIndicesArray:function(){console.error("THREE.BufferAttribute: .copyIndicesArray() has been removed.")}});Object.assign(oe.prototype,{addIndex:function(e){console.warn("THREE.BufferGeometry: .addIndex() has been renamed to .setIndex()."),this.setIndex(e)},addDrawCall:function(e,t,n){n!==void 0&&console.warn("THREE.BufferGeometry: .addDrawCall() no longer supports indexOffset."),console.warn("THREE.BufferGeometry: .addDrawCall() is now .addGroup()."),this.addGroup(e,t)},clearDrawCalls:function(){console.warn("THREE.BufferGeometry: .clearDrawCalls() is now .clearGroups()."),this.clearGroups()},computeTangents:function(){console.warn("THREE.BufferGeometry: .computeTangents() has been removed.")},computeOffsets:function(){console.warn("THREE.BufferGeometry: .computeOffsets() has been removed.")}});Object.defineProperties(oe.prototype,{drawcalls:{get:function(){return console.error("THREE.BufferGeometry: .drawcalls has been renamed to .groups."),this.groups}},offsets:{get:function(){return console.warn("THREE.BufferGeometry: .offsets has been renamed to .groups."),this.groups}}});Object.assign(Mn.prototype,{getArrays:function(){console.error("THREE.ExtrudeBufferGeometry: .getArrays() has been removed.")},addShapeList:function(){console.error("THREE.ExtrudeBufferGeometry: .addShapeList() has been removed.")},addShape:function(){console.error("THREE.ExtrudeBufferGeometry: .addShape() has been removed.")}});Object.defineProperties(Lo.prototype,{dynamic:{set:function(){console.warn("THREE.Uniform: .dynamic has been removed. Use object.onBeforeRender() instead.")}},onUpdate:{value:function(){return console.warn("THREE.Uniform: .onUpdate() has been removed. Use object.onBeforeRender() instead."),this}}});Object.defineProperties(Oe.prototype,{wrapAround:{get:function(){console.warn("THREE.Material: .wrapAround has been removed.")},set:function(){console.warn("THREE.Material: .wrapAround has been removed.")}},overdraw:{get:function(){console.warn("THREE.Material: .overdraw has been removed.")},set:function(){console.warn("THREE.Material: .overdraw has been removed.")}},wrapRGB:{get:function(){return console.warn("THREE.Material: .wrapRGB has been removed."),new ye}},shading:{get:function(){console.error("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead.")},set:function(e){console.warn("THREE."+this.type+": .shading has been removed. Use the boolean .flatShading instead."),this.flatShading=e===js}}});Object.defineProperties(cn.prototype,{metal:{get:function(){return console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead."),!1},set:function(){console.warn("THREE.MeshPhongMaterial: .metal has been removed. Use THREE.MeshStandardMaterial instead")}}});Object.defineProperties(Dt.prototype,{derivatives:{get:function(){return console.warn("THREE.ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives},set:function(e){console.warn("THREE. ShaderMaterial: .derivatives has been moved to .extensions.derivatives."),this.extensions.derivatives=e}}});Object.assign(ol.prototype,{clearTarget:function(e,t,n,i){console.warn("THREE.WebGLRenderer: .clearTarget() has been deprecated. Use .setRenderTarget() and .clear() instead."),this.setRenderTarget(e),this.clear(t,n,i)},animate:function(e){console.warn("THREE.WebGLRenderer: .animate() is now .setAnimationLoop()."),this.setAnimationLoop(e)},getCurrentRenderTarget:function(){return console.warn("THREE.WebGLRenderer: .getCurrentRenderTarget() is now .getRenderTarget()."),this.getRenderTarget()},getMaxAnisotropy:function(){return console.warn("THREE.WebGLRenderer: .getMaxAnisotropy() is now .capabilities.getMaxAnisotropy()."),this.capabilities.getMaxAnisotropy()},getPrecision:function(){return console.warn("THREE.WebGLRenderer: .getPrecision() is now .capabilities.precision."),this.capabilities.precision},resetGLState:function(){return console.warn("THREE.WebGLRenderer: .resetGLState() is now .state.reset()."),this.state.reset()},supportsFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsFloatTextures() is now .extensions.get( 'OES_texture_float' )."),this.extensions.get("OES_texture_float")},supportsHalfFloatTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsHalfFloatTextures() is now .extensions.get( 'OES_texture_half_float' )."),this.extensions.get("OES_texture_half_float")},supportsStandardDerivatives:function(){return console.warn("THREE.WebGLRenderer: .supportsStandardDerivatives() is now .extensions.get( 'OES_standard_derivatives' )."),this.extensions.get("OES_standard_derivatives")},supportsCompressedTextureS3TC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTextureS3TC() is now .extensions.get( 'WEBGL_compressed_texture_s3tc' )."),this.extensions.get("WEBGL_compressed_texture_s3tc")},supportsCompressedTexturePVRTC:function(){return console.warn("THREE.WebGLRenderer: .supportsCompressedTexturePVRTC() is now .extensions.get( 'WEBGL_compressed_texture_pvrtc' )."),this.extensions.get("WEBGL_compressed_texture_pvrtc")},supportsBlendMinMax:function(){return console.warn("THREE.WebGLRenderer: .supportsBlendMinMax() is now .extensions.get( 'EXT_blend_minmax' )."),this.extensions.get("EXT_blend_minmax")},supportsVertexTextures:function(){return console.warn("THREE.WebGLRenderer: .supportsVertexTextures() is now .capabilities.vertexTextures."),this.capabilities.vertexTextures},supportsInstancedArrays:function(){return console.warn("THREE.WebGLRenderer: .supportsInstancedArrays() is now .extensions.get( 'ANGLE_instanced_arrays' )."),this.extensions.get("ANGLE_instanced_arrays")},enableScissorTest:function(e){console.warn("THREE.WebGLRenderer: .enableScissorTest() is now .setScissorTest()."),this.setScissorTest(e)},initMaterial:function(){console.warn("THREE.WebGLRenderer: .initMaterial() has been removed.")},addPrePlugin:function(){console.warn("THREE.WebGLRenderer: .addPrePlugin() has been removed.")},addPostPlugin:function(){console.warn("THREE.WebGLRenderer: .addPostPlugin() has been removed.")},updateShadowMap:function(){console.warn("THREE.WebGLRenderer: .updateShadowMap() has been removed.")},setFaceCulling:function(){console.warn("THREE.WebGLRenderer: .setFaceCulling() has been removed.")},allocTextureUnit:function(){console.warn("THREE.WebGLRenderer: .allocTextureUnit() has been removed.")},setTexture:function(){console.warn("THREE.WebGLRenderer: .setTexture() has been removed.")},setTexture2D:function(){console.warn("THREE.WebGLRenderer: .setTexture2D() has been removed.")},setTextureCube:function(){console.warn("THREE.WebGLRenderer: .setTextureCube() has been removed.")},getActiveMipMapLevel:function(){return console.warn("THREE.WebGLRenderer: .getActiveMipMapLevel() is now .getActiveMipmapLevel()."),this.getActiveMipmapLevel()}});Object.defineProperties(ol.prototype,{shadowMapEnabled:{get:function(){return this.shadowMap.enabled},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapEnabled is now .shadowMap.enabled."),this.shadowMap.enabled=e}},shadowMapType:{get:function(){return this.shadowMap.type},set:function(e){console.warn("THREE.WebGLRenderer: .shadowMapType is now .shadowMap.type."),this.shadowMap.type=e}},shadowMapCullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMapCullFace has been removed. Set Material.shadowSide instead.")}},context:{get:function(){return console.warn("THREE.WebGLRenderer: .context has been removed. Use .getContext() instead."),this.getContext()}}});Object.defineProperties(zu.prototype,{cullFace:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.cullFace has been removed. Set Material.shadowSide instead.")}},renderReverseSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderReverseSided has been removed. Set Material.shadowSide instead.")}},renderSingleSided:{get:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")},set:function(){console.warn("THREE.WebGLRenderer: .shadowMap.renderSingleSided has been removed. Set Material.shadowSide instead.")}}});Object.defineProperties(jn.prototype,{activeCubeFace:{set:function(){console.warn("THREE.WebGLRenderTargetCube: .activeCubeFace has been removed. It is now the second parameter of WebGLRenderer.setRenderTarget().")}},activeMipMapLevel:{set:function(){console.warn("THREE.WebGLRenderTargetCube: .activeMipMapLevel has been removed. It is now the third parameter of WebGLRenderer.setRenderTarget().")}}});Object.defineProperties(wn.prototype,{wrapS:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapS is now .texture.wrapS."),this.texture.wrapS=e}},wrapT:{get:function(){return console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT},set:function(e){console.warn("THREE.WebGLRenderTarget: .wrapT is now .texture.wrapT."),this.texture.wrapT=e}},magFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .magFilter is now .texture.magFilter."),this.texture.magFilter=e}},minFilter:{get:function(){return console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter},set:function(e){console.warn("THREE.WebGLRenderTarget: .minFilter is now .texture.minFilter."),this.texture.minFilter=e}},anisotropy:{get:function(){return console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy},set:function(e){console.warn("THREE.WebGLRenderTarget: .anisotropy is now .texture.anisotropy."),this.texture.anisotropy=e}},offset:{get:function(){return console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset},set:function(e){console.warn("THREE.WebGLRenderTarget: .offset is now .texture.offset."),this.texture.offset=e}},repeat:{get:function(){return console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat},set:function(e){console.warn("THREE.WebGLRenderTarget: .repeat is now .texture.repeat."),this.texture.repeat=e}},format:{get:function(){return console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format},set:function(e){console.warn("THREE.WebGLRenderTarget: .format is now .texture.format."),this.texture.format=e}},type:{get:function(){return console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type},set:function(e){console.warn("THREE.WebGLRenderTarget: .type is now .texture.type."),this.texture.type=e}},generateMipmaps:{get:function(){return console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps},set:function(e){console.warn("THREE.WebGLRenderTarget: .generateMipmaps is now .texture.generateMipmaps."),this.texture.generateMipmaps=e}}});Object.defineProperties(al.prototype,{standing:{set:function(){console.warn("THREE.WebVRManager: .standing has been removed.")}},userHeight:{set:function(){console.warn("THREE.WebVRManager: .userHeight has been removed.")}}});ur.prototype.load=function(e){console.warn("THREE.Audio: .load has been deprecated. Use THREE.AudioLoader instead.");var t=this,n=new gl;return n.load(e,function(i){t.setBuffer(i)}),this};bl.prototype.getData=function(){return console.warn("THREE.AudioAnalyser: .getData() is now .getFrequencyData()."),this.getFrequencyData()};Gi.prototype.updateCubeMap=function(e,t){return console.warn("THREE.CubeCamera: .updateCubeMap() is now .update()."),this.update(e,t)};var Ty={merge:function(e,t,n){console.warn("THREE.GeometryUtils: .merge() has been moved to Geometry. Use geometry.merge( geometry2, matrix, materialIndexOffset ) instead.");var i;t.isMesh&&(t.matrixAutoUpdate&&t.updateMatrix(),i=t.matrix,t=t.geometry),e.merge(t,i,n)},center:function(e){return console.warn("THREE.GeometryUtils: .center() has been moved to Geometry. Use geometry.center() instead."),e.center()}};Vn.crossOrigin=void 0;Vn.loadTexture=function(e,t,n,i){console.warn("THREE.ImageUtils.loadTexture has been deprecated. Use THREE.TextureLoader() instead.");var r=new Go;r.setCrossOrigin(this.crossOrigin);var a=r.load(e,n,void 0,i);return t&&(a.mapping=t),a};Vn.loadTextureCube=function(e,t,n,i){console.warn("THREE.ImageUtils.loadTextureCube has been deprecated. Use THREE.CubeTextureLoader() instead.");var r=new cl;r.setCrossOrigin(this.crossOrigin);var a=r.load(e,n,void 0,i);return t&&(a.mapping=t),a};Vn.loadCompressedTexture=function(){console.error("THREE.ImageUtils.loadCompressedTexture has been removed. Use THREE.DDSLoader instead.")};Vn.loadCompressedTextureCube=function(){console.error("THREE.ImageUtils.loadCompressedTextureCube has been removed. Use THREE.DDSLoader instead.")};function Ay(){console.error("THREE.CanvasRenderer has been removed")}function Ly(){console.error("THREE.JSONLoader has been removed.")}var Cy={createMultiMaterialObject:function(){console.error("THREE.SceneUtils has been moved to /examples/js/utils/SceneUtils.js")},detach:function(){console.error("THREE.SceneUtils has been moved to /examples/js/utils/SceneUtils.js")},attach:function(){console.error("THREE.SceneUtils has been moved to /examples/js/utils/SceneUtils.js")}};function Ry(){console.error("THREE.LensFlare has been moved to /examples/js/objects/Lensflare.js")}var Iy=Object.freeze({ACESFilmicToneMapping:Wc,AddEquation:Qn,AddOperation:Hc,AdditiveBlending:to,AlphaFormat:Qc,AlwaysDepth:Oc,AlwaysStencilFunc:Cu,AmbientLight:Mo,AmbientLightProbe:ks,AnimationClip:Qt,AnimationLoader:Xu,AnimationMixer:zs,AnimationObjectGroup:$u,AnimationUtils:gt,ArcCurve:cr,ArrayCamera:jr,ArrowHelper:Nn,Audio:ur,AudioAnalyser:bl,AudioContext:vl,AudioListener:Ns,AudioLoader:gl,AxesHelper:La,AxisHelper:xy,BackSide:vt,BasicDepthPacking:Tu,BasicShadowMap:Ef,BinaryTextureLoader:Sy,Bone:Ls,BooleanKeyframeTrack:po,BoundingBoxHelper:_y,Box2:_l,Box3:an,Box3Helper:Ta,BoxBufferGeometry:Wn,BoxGeometry:Ui,BoxHelper:kn,BufferAttribute:ke,BufferGeometry:oe,BufferGeometryLoader:dl,ByteType:jc,Cache:Mi,Camera:En,CameraHelper:Sa,CanvasRenderer:Ay,CanvasTexture:Jr,CatmullRomCurve3:Rt,CineonToneMapping:Vc,CircleBufferGeometry:ar,CircleGeometry:ga,ClampToEdgeWrapping:Ot,Clock:yl,ClosedSplineCurve3:rh,Color:ye,ColorKeyframeTrack:mo,CompressedTexture:Xi,CompressedTextureLoader:Zu,ConeBufferGeometry:va,ConeGeometry:ma,CubeCamera:Gi,CubeGeometry:Ui,CubeReflectionMapping:Oo,CubeRefractionMapping:ao,CubeTexture:On,CubeTextureLoader:cl,CubeUVReflectionMapping:Do,CubeUVRefractionMapping:ko,CubicBezierCurve:un,CubicBezierCurve3:Tn,CubicInterpolant:ho,CullFaceBack:gs,CullFaceFront:bc,CullFaceFrontBack:xf,CullFaceNone:yc,Curve:we,CurvePath:In,CustomBlending:Zs,CylinderBufferGeometry:Dn,CylinderGeometry:vi,Cylindrical:nh,DataTexture:li,DataTexture2DArray:Vi,DataTexture3D:Wi,DataTextureLoader:ll,DecrementStencilOp:Df,DecrementWrapStencilOp:Nf,DefaultLoadingManager:Gt,DepthFormat:ni,DepthStencilFormat:Fi,DepthTexture:Qr,DirectionalLight:Eo,DirectionalLightHelper:yr,DirectionalLightShadow:wo,DiscreteInterpolant:fo,DodecahedronBufferGeometry:$i,DodecahedronGeometry:ia,DoubleSide:xr,DstAlphaFactor:Ac,DstColorFactor:Cc,DynamicBufferAttribute:uy,EdgesGeometry:rr,EdgesHelper:wy,EllipseCurve:Zt,EqualDepth:kc,EqualStencilFunc:Hf,EquirectangularReflectionMapping:$s,EquirectangularRefractionMapping:oo,Euler:Ti,EventDispatcher:pn,ExtrudeBufferGeometry:Mn,ExtrudeGeometry:fi,Face3:Hi,Face4:$g,FaceColors:Xs,FaceNormalsHelper:Ma,FileLoader:mn,FlatShading:js,Float32Attribute:yy,Float32BufferAttribute:$,Float64Attribute:by,Float64BufferAttribute:Vr,FloatType:zi,Fog:lo,FogExp2:so,Font:ml,FontLoader:qu,FrontFaceDirectionCCW:wf,FrontFaceDirectionCW:_f,FrontSide:br,Frustum:Uo,GammaEncoding:nl,Geometry:Te,GeometryUtils:Ty,GreaterDepth:Bc,GreaterEqualDepth:Nc,GreaterEqualStencilFunc:Wf,GreaterStencilFunc:Gf,GridHelper:Co,Group:ji,HalfFloatType:Fo,HemisphereLight:yo,HemisphereLightHelper:mr,HemisphereLightProbe:Ds,IcosahedronBufferGeometry:Qi,IcosahedronGeometry:na,ImageBitmapLoader:Os,ImageLoader:Pa,ImageUtils:Vn,ImmediateRenderObject:wa,IncrementStencilOp:Of,IncrementWrapStencilOp:kf,InstancedBufferAttribute:Ao,InstancedBufferGeometry:To,InstancedInterleavedBuffer:Fs,Int16Attribute:py,Int16BufferAttribute:Ur,Int32Attribute:vy,Int32BufferAttribute:Gr,Int8Attribute:hy,Int8BufferAttribute:zr,IntType:Xc,InterleavedBuffer:ui,InterleavedBufferAttribute:Yr,Interpolant:jt,InterpolateDiscrete:Dr,InterpolateLinear:Lr,InterpolateSmooth:Qa,InvertStencilOp:Bf,JSONLoader:Ly,KeepStencilOp:$a,KeyframeTrack:St,LOD:Zr,LatheBufferGeometry:ir,LatheGeometry:pa,Layers:il,LensFlare:Ry,LessDepth:Dc,LessEqualDepth:ro,LessEqualStencilFunc:Uf,LessStencilFunc:Ff,Light:at,LightProbe:on,LightProbeHelper:vr,LightShadow:Li,Line:Mt,Line3:wl,LineBasicMaterial:$e,LineCurve:Ut,LineCurve3:hn,LineDashedMaterial:Ei,LineLoop:uo,LinePieces:ey,LineSegments:nt,LineStrip:Kg,LinearEncoding:Nr,LinearFilter:Lt,LinearInterpolant:ya,LinearMipMapLinearFilter:Lf,LinearMipMapNearestFilter:Af,LinearMipmapLinearFilter:Ra,LinearMipmapNearestFilter:el,LinearToneMapping:Qs,Loader:_a,LoaderUtils:hl,LoadingManager:sl,LogLuvEncoding:Rf,LoopOnce:vu,LoopPingPong:yu,LoopRepeat:gu,LuminanceAlphaFormat:Kc,LuminanceFormat:$c,MOUSE:yf,Material:Oe,MaterialLoader:Vo,Math:Pe,Matrix3:xt,Matrix4:Me,MaxEquation:qa,Mesh:_t,MeshBasicMaterial:Yt,MeshDepthMaterial:Yn,MeshDistanceMaterial:Xn,MeshFaceMaterial:ty,MeshLambertMaterial:_i,MeshMatcapMaterial:wi,MeshNormalMaterial:xi,MeshPhongMaterial:cn,MeshPhysicalMaterial:yi,MeshStandardMaterial:Sn,MeshToonMaterial:bi,MinEquation:Za,MirroredRepeatWrapping:ii,MixOperation:Fc,MultiMaterial:ny,MultiplyBlending:io,MultiplyOperation:Ca,NearestFilter:Et,NearestMipMapLinearFilter:Tf,NearestMipMapNearestFilter:Sf,NearestMipmapLinearFilter:Bo,NearestMipmapNearestFilter:No,NeverDepth:Pc,NeverStencilFunc:zf,NoBlending:ei,NoColors:Ys,NoToneMapping:Ja,NormalBlending:ti,NotEqualDepth:zc,NotEqualStencilFunc:Vf,NumberKeyframeTrack:sr,Object3D:ae,ObjectLoader:fl,ObjectSpaceNormalMap:Lu,OctahedronBufferGeometry:hi,OctahedronGeometry:ta,OneFactor:Mc,OneMinusDstAlphaFactor:Lc,OneMinusDstColorFactor:Rc,OneMinusSrcAlphaFactor:Js,OneMinusSrcColorFactor:Tc,OrthographicCamera:xa,PCFShadowMap:Ws,PCFSoftShadowMap:xc,ParametricBufferGeometry:qi,ParametricGeometry:$r,Particle:ry,ParticleBasicMaterial:sy,ParticleSystem:ay,ParticleSystemMaterial:ly,Path:rn,PerspectiveCamera:ct,Plane:bn,PlaneBufferGeometry:ci,PlaneGeometry:Wr,PlaneHelper:Aa,PointCloud:iy,PointCloudMaterial:oy,PointLight:_o,PointLightHelper:fr,Points:Yi,PointsMaterial:ln,PolarGridHelper:Ro,PolyhedronBufferGeometry:Ht,PolyhedronGeometry:Kr,PositionalAudio:Bs,PositionalAudioHelper:gr,PropertyBinding:Ct,PropertyMixer:xl,QuadraticBezierCurve:dn,QuadraticBezierCurve3:An,Quaternion:pt,QuaternionKeyframeTrack:ba,QuaternionLinearInterpolant:vo,REVISION:gc,RGBADepthPacking:Au,RGBAFormat:_n,RGBA_ASTC_10x10_Format:fu,RGBA_ASTC_10x5_Format:uu,RGBA_ASTC_10x6_Format:hu,RGBA_ASTC_10x8_Format:du,RGBA_ASTC_12x10_Format:pu,RGBA_ASTC_12x12_Format:mu,RGBA_ASTC_4x4_Format:nu,RGBA_ASTC_5x4_Format:iu,RGBA_ASTC_5x5_Format:ru,RGBA_ASTC_6x5_Format:au,RGBA_ASTC_6x6_Format:ou,RGBA_ASTC_8x5_Format:su,RGBA_ASTC_8x6_Format:lu,RGBA_ASTC_8x8_Format:cu,RGBA_PVRTC_2BPPV1_Format:Ss,RGBA_PVRTC_4BPPV1_Format:Ms,RGBA_S3TC_DXT1_Format:bs,RGBA_S3TC_DXT3_Format:xs,RGBA_S3TC_DXT5_Format:_s,RGBDEncoding:Su,RGBEEncoding:wu,RGBEFormat:Cf,RGBFormat:Gn,RGBM16Encoding:Mu,RGBM7Encoding:Eu,RGB_ETC1_Format:tu,RGB_PVRTC_2BPPV1_Format:Es,RGB_PVRTC_4BPPV1_Format:ws,RGB_S3TC_DXT1_Format:ys,RawShaderMaterial:or,Ray:Ai,Raycaster:eh,RectAreaLight:So,RectAreaLightHelper:pr,RedFormat:eu,ReinhardToneMapping:Uc,RepeatWrapping:Rn,ReplaceStencilOp:Pf,ReverseSubtractEquation:wc,RingBufferGeometry:nr,RingGeometry:fa,Scene:Br,SceneUtils:Cy,ShaderChunk:Ge,ShaderLib:xn,ShaderMaterial:Dt,ShadowMaterial:gi,Shape:Un,ShapeBufferGeometry:mi,ShapeGeometry:pi,ShapePath:pl,ShapeUtils:Pn,ShortType:Yc,Skeleton:co,SkeletonHelper:dr,SkinnedMesh:qr,SmoothShading:Mf,Sphere:sn,SphereBufferGeometry:qn,SphereGeometry:da,Spherical:th,SphericalHarmonics3:Wo,SphericalReflectionMapping:Ks,Spline:El,SplineCurve:fn,SplineCurve3:ah,SpotLight:xo,SpotLightHelper:hr,SpotLightShadow:bo,Sprite:Xr,SpriteMaterial:Zn,SrcAlphaFactor:qs,SrcAlphaSaturateFactor:Ic,SrcColorFactor:Sc,StereoCamera:Ju,StringKeyframeTrack:go,SubtractEquation:_c,SubtractiveBlending:no,TOUCH:bf,TangentSpaceNormalMap:Ia,TetrahedronBufferGeometry:Ji,TetrahedronGeometry:ea,TextBufferGeometry:tr,TextGeometry:ha,Texture:tt,TextureLoader:Go,TorusBufferGeometry:er,TorusGeometry:oa,TorusKnotBufferGeometry:Ki,TorusKnotGeometry:aa,Triangle:yt,TriangleFanDrawMode:xu,TriangleStripDrawMode:bu,TrianglesDrawMode:Ho,TubeBufferGeometry:di,TubeGeometry:ra,UVMapping:Po,Uint16Attribute:my,Uint16BufferAttribute:ai,Uint32Attribute:gy,Uint32BufferAttribute:oi,Uint8Attribute:dy,Uint8BufferAttribute:Fr,Uint8ClampedAttribute:fy,Uint8ClampedBufferAttribute:Hr,Uncharted2ToneMapping:Gc,Uniform:Lo,UniformsLib:de,UniformsUtils:Qf,UnsignedByteType:zo,UnsignedInt248Type:Or,UnsignedIntType:tl,UnsignedShort4444Type:Zc,UnsignedShort5551Type:qc,UnsignedShort565Type:Jc,UnsignedShortType:Pr,Vector2:j,Vector3:E,Vector4:et,VectorKeyframeTrack:lr,Vertex:cy,VertexColors:Si,VertexNormalsHelper:Ea,VideoTexture:Cs,WebGLMultisampleRenderTarget:Ts,WebGLRenderTarget:wn,WebGLRenderTargetCube:jn,WebGLRenderer:ol,WebGLUtils:Fu,WireframeGeometry:Zi,WireframeHelper:Ey,WrapAroundEnding:kr,XHRLoader:My,ZeroCurvatureEnding:ri,ZeroFactor:Ec,ZeroSlopeEnding:$n,ZeroStencilOp:If,sRGBEncoding:_u}),Py=`#define GLSLIFY 1
varying vec3 vNormal;
uniform float r;
uniform float g;
uniform float b;
uniform float a;
uniform float c;

void main()
{
    float intensity = pow( abs(c) - dot( vNormal, vec3( 0.0, 0.0, 1.0 ) ), 4.0 );
    gl_FragColor = vec4(r, g, b, a) * intensity;
}`,Oy=`#define GLSLIFY 1
varying vec3 vNormal;

void main()
{
    vNormal = normalize( normalMatrix * normal );
    gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,Ml=function(){function e(){}return e.getHaloMaterial=function(t,n,i,r,a){return t===void 0&&(t=.5),n===void 0&&(n=.5),i===void 0&&(i=.5),r===void 0&&(r=.1),a===void 0&&(a=.5),new THREE.ShaderMaterial({uniforms:{r:{value:t},g:{value:n},b:{value:i},a:{value:r},c:{value:a}},vertexShader:Oy,fragmentShader:Py,side:THREE.BackSide,blending:THREE.AdditiveBlending,transparent:!0,depthTest:!1})},e}();AFRAME.registerComponent("al-angle",{schema:{angle:{type:"number"},edge0Pos:{type:"vec3"},edge1Pos:{type:"vec3"},length:{type:"number"},minFrameMS:{type:"number",default:15},position:{type:"vec3"},radius:{type:"number"},scale:{type:"number"},selected:{type:"boolean"}},init:function(){this.tickFunction=AFRAME.utils.throttle(this.tickFunction,this.data.minFrameMS,this),this.bindMethods(),this.addEventListeners(),this.state={selected:!0,hovered:!1},this.createMesh()},bindMethods:function(){this.createMesh=this.createMesh.bind(this),this.getMatrix=this.getMatrix.bind(this),this.objectToVector3=this.objectToVector3.bind(this),this.pointerDown=this.pointerDown.bind(this),this.pointerOut=this.pointerOut.bind(this),this.pointerOver=this.pointerOver.bind(this)},objectToVector3:function(e){var t=new THREE.Vector3;return t.x=e.x,t.y=e.y,t.z=e.z,t},addEventListeners:function(){this.el.addEventListener("mousedown",this.pointerDown,{capture:!1,once:!1,passive:!0}),this.el.addEventListener("raycaster-intersected",this.pointerOver,{capture:!0,once:!1,passive:!0}),this.el.addEventListener("raycaster-intersected-cleared",this.pointerOut,{capture:!1,once:!1,passive:!0})},removeEventListeners:function(){this.el.removeEventListener("mousedown",this.pointerDown),this.el.removeEventListener("raycaster-intersected",this.pointerOver),this.el.removeEventListener("raycaster-intersected-cleared",this.pointerOut)},pointerDown:function(e){this.el.sceneEl.emit(ot.SELECTED,{type:Jt.ANGLE,id:this.el.id},!0)},pointerOver:function(e){var t=this.state;t.hovered=!0,this.el.sceneEl.emit(ot.POINTER_OVER,{id:this.el.id},!0)},pointerOut:function(e){var t=this.state;t.hovered=!1,this.el.sceneEl.emit(ot.POINTER_OUT,{},!0)},getMatrix:function(){var e=this.objectToVector3(this.data.edge0Pos),t=this.objectToVector3(this.data.edge1Pos),n=new THREE.Matrix4;n.makeScale(this.data.scale,this.data.scale,1);var i=new THREE.Matrix4;i.set(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1);var r=new THREE.Matrix4;return r.lookAt(e,t,new THREE.Object3D().up),r.multiply(n),r.multiply(i),r},createMesh:function(){var e=new THREE.CylinderGeometry(this.data.radius,this.data.radius,this.data.length,6,4),t=new THREE.MeshBasicMaterial,n=new THREE.Mesh(e,t);n.applyMatrix(this.getMatrix()),n.position.copy(this.objectToVector3(this.data.position)),this.state.geometry=e,this.state.material=t,this.state.mesh=n;var i=new THREE.CylinderGeometry(this.data.radius,this.data.radius,this.data.length,6,4),r=Ml.getHaloMaterial(),a=new THREE.Mesh(i,r);this.state.outlineGeometry=i,this.state.outlineMaterialt=r,this.state.outlineMesh=a,n.add(a),this.el.setObject3D("mesh",n),this.el.object3D.renderOrder=U.topLayerRenderOrder-3},update:function(e){var t=this.state;t.selected=this.data.selected,e&&(e.angle!==this.data.angle||e.scale!==this.data.scale)&&this.createMesh()},tickFunction:function(){var e=this.el,t=this.state;t.hovered?t.material.color=new THREE.Color(U.buttonColors.hover):t.selected?t.material.color=new THREE.Color(U.buttonColors.active):t.material.color=new THREE.Color(U.buttonColors.up);var n=e.firstChild;if(n){var i=n.object3D;t.hovered?i.visible=!0:i.visible=!1}},tick:function(){this.tickFunction()},remove:function(){this.removeEventListeners(),this.el.removeObject3D("mesh")}});AFRAME.registerComponent("al-background",{schema:{boundingRadius:{type:"number",default:1},frustrumDistance:{type:"number",default:1},minFrameMS:{type:"number",default:15},scale:{type:"number",default:8},text:{type:"string",default:""}},init:function(){this.state={hasUpdated:!1},this.bindMethods(),this.addEventListeners(),this.tickFunction=AFRAME.utils.throttle(this.tickFunction,this.data.minFrameMS,this)},bindMethods:function(){},addEventListeners:function(){},removeEventListeners:function(){},update:function(e){this.data.text!==e.text&&(this.state.hasUpdated=!1)},tickFunction:function(){if(!this.state.hasUpdated){var e=this.el.object3DMap.text,t=void 0;if(e&&(t=e.geometry,t.attributes.position)){t.computeBoundingBox();var n=new THREE.Vector3;t.boundingBox.getSize(n);var i=(n.y*.001+U.textPadding.height)*this.data.boundingRadius,r=new THREE.PlaneGeometry(1,1,1,1),a=new THREE.MeshStandardMaterial;a.color=new THREE.Color(U.colors.black),a.transparent=!0,a.opacity=.9,a.flatShading=!0,a.roughness=1,a.depthTest=!1;var o=new THREE.Mesh(r,a);o.scale.set((n.x*.001+U.textPadding.width)*this.data.boundingRadius,i,1),o.renderOrder=U.topLayerRenderOrder-1,o.position.add(new THREE.Vector3(0,i*(this.data.frustrumDistance/4),0)),this.el.object3D.add(o),this.state.hasUpdated=!0}}},tick:function(){this.tickFunction()},remove:function(){this.removeEventListeners()}});AFRAME.registerComponent("al-billboard",{schema:{cameraPosition:{type:"string"},cameraTarget:{type:"string",default:"0 0 0"},controlsType:{type:"string",default:"orbit"},minFrameMS:{type:"number",default:15},worldPosition:{type:"string"}},init:function(){this.bindMethods(),this.addEventListeners(),this.tickFunction=AFRAME.utils.throttle(this.tickFunction,this.data.minFrameMS,this)},bindMethods:function(){},addEventListeners:function(){},removeEventListeners:function(){},tickFunction:function(){var e=this.el.sceneEl.camera,t=this.el.object3D,n=ge.stringToVector3(this.data.worldPosition),i=ge.stringToVector3(this.data.cameraPosition);ge.lookToFrustrumSpace(t,e,n,i),t.up.copy(this.el.sceneEl.camera.up)},tick:function(){this.tickFunction()},remove:function(){this.removeEventListeners()}});var Dy=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ky(){throw new Error("Dynamic requires are not currently supported by rollup-plugin-commonjs")}function Ny(e,t){return t={exports:{}},e(t,t.exports),t.exports}var oh=Ny(function(e,t){(function(){var n=this,i=typeof ky<"u",r=n.THREE||i&&Iy;if(!r)throw new Error("MeshLine requires three.js");function a(){r.BufferGeometry.call(this),this.type="MeshLine",this.positions=[],this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[],this.counters=[],this._vertices=[],this._bufferArray=[],this.widthCallback=null,this.matrixWorld=new r.Matrix4,Object.defineProperties(this,{geometry:{enumerable:!0,get:function(){return this},set:function(c){this.setFromGeometry(c)}},vertices:{enumerable:!0,get:function(){return this._vertices},set:function(c){this.setVertices(c)}},bufferArray:{enumerable:!0,get:function(){return this._bufferArray},set:function(c){this.setBufferArray(c)}}})}a.prototype=Object.create(r.BufferGeometry.prototype),a.prototype.constructor=a,a.prototype.isMeshLine=!0,a.prototype.setMatrixWorld=function(c){this.matrixWorld=c},a.prototype.setFromGeometry=function(c,u){c instanceof r.Geometry&&this.setVertices(c.vertices,u),c instanceof r.BufferGeometry&&this.setBufferArray(c.getAttribute("position").array,u),(c instanceof Float32Array||c instanceof Array)&&this.setBufferArray(c,u)},a.prototype.setGeometry=function(c,u){this.setFromGeometry(c,u)},a.prototype.setVertices=function(c,u){this._vertices=c,this.widthCallback=u||this.widthCallback,this.positions=[],this.counters=[];for(var h=0;h<c.length;h++){var d=c[h],f=h/c.length;this.positions.push(d.x,d.y,d.z),this.positions.push(d.x,d.y,d.z),this.counters.push(f),this.counters.push(f)}this.process()},a.prototype.setBufferArray=function(c,u){this._bufferArray=c,this.widthCallback=u||this.widthCallback,this.positions=[],this.counters=[];for(var h=0;h<c.length;h+=3){var d=h/c.length;this.positions.push(c[h],c[h+1],c[h+2]),this.positions.push(c[h],c[h+1],c[h+2]),this.counters.push(d),this.counters.push(d)}this.process()};function o(c,u){var h=new r.Matrix4,d=new r.Ray,f=new r.Sphere,p=new r.Vector3,v=this.geometry;if(f.copy(v.boundingSphere),f.applyMatrix4(this.matrixWorld),c.ray.intersectSphere(f,p)!==!1){h.getInverse(this.matrixWorld),d.copy(c.ray).applyMatrix4(h);var m=new r.Vector3,g=new r.Vector3,y=new r.Vector3,b=this instanceof r.LineSegments?2:1,_=v.index,w=v.attributes;if(_!==null)for(var L=_.array,R=w.position.array,k=w.width.array,O=0,z=L.length-1;O<z;O+=b){var C=L[O],I=L[O+1];m.fromArray(R,C*3),g.fromArray(R,I*3);var N=k[Math.floor(O/3)]!=null?k[Math.floor(O/3)]:1,H=c.params.Line.threshold+this.material.lineWidth*N/2,G=H*H,X=d.distanceSqToSegment(m,g,p,y);if(!(X>G)){p.applyMatrix4(this.matrixWorld);var Z=c.ray.origin.distanceTo(p);Z<c.near||Z>c.far||(u.push({distance:Z,point:y.clone().applyMatrix4(this.matrixWorld),index:O,face:null,faceIndex:null,object:this}),O=z)}}}}a.prototype.raycast=o,a.prototype.compareV3=function(c,u){var h=c*6,d=u*6;return this.positions[h]===this.positions[d]&&this.positions[h+1]===this.positions[d+1]&&this.positions[h+2]===this.positions[d+2]},a.prototype.copyV3=function(c){var u=c*6;return[this.positions[u],this.positions[u+1],this.positions[u+2]]},a.prototype.process=function(){var c=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var u,h;this.compareV3(0,c-1)?h=this.copyV3(c-2):h=this.copyV3(0),this.previous.push(h[0],h[1],h[2]),this.previous.push(h[0],h[1],h[2]);for(var d=0;d<c;d++){if(this.side.push(1),this.side.push(-1),this.widthCallback?u=this.widthCallback(d/(c-1)):u=1,this.width.push(u),this.width.push(u),this.uvs.push(d/(c-1),0),this.uvs.push(d/(c-1),1),d<c-1){h=this.copyV3(d),this.previous.push(h[0],h[1],h[2]),this.previous.push(h[0],h[1],h[2]);var f=d*2;this.indices_array.push(f,f+1,f+2),this.indices_array.push(f+2,f+1,f+3)}d>0&&(h=this.copyV3(d),this.next.push(h[0],h[1],h[2]),this.next.push(h[0],h[1],h[2]))}this.compareV3(c-1,0)?h=this.copyV3(1):h=this.copyV3(c-1),this.next.push(h[0],h[1],h[2]),this.next.push(h[0],h[1],h[2]),!this._attributes||this._attributes.position.count!==this.positions.length?this._attributes={position:new r.BufferAttribute(new Float32Array(this.positions),3),previous:new r.BufferAttribute(new Float32Array(this.previous),3),next:new r.BufferAttribute(new Float32Array(this.next),3),side:new r.BufferAttribute(new Float32Array(this.side),1),width:new r.BufferAttribute(new Float32Array(this.width),1),uv:new r.BufferAttribute(new Float32Array(this.uvs),2),index:new r.BufferAttribute(new Uint16Array(this.indices_array),1),counters:new r.BufferAttribute(new Float32Array(this.counters),1)}:(this._attributes.position.copyArray(new Float32Array(this.positions)),this._attributes.position.needsUpdate=!0,this._attributes.previous.copyArray(new Float32Array(this.previous)),this._attributes.previous.needsUpdate=!0,this._attributes.next.copyArray(new Float32Array(this.next)),this._attributes.next.needsUpdate=!0,this._attributes.side.copyArray(new Float32Array(this.side)),this._attributes.side.needsUpdate=!0,this._attributes.width.copyArray(new Float32Array(this.width)),this._attributes.width.needsUpdate=!0,this._attributes.uv.copyArray(new Float32Array(this.uvs)),this._attributes.uv.needsUpdate=!0,this._attributes.index.copyArray(new Uint16Array(this.indices_array)),this._attributes.index.needsUpdate=!0),this.setAttribute("position",this._attributes.position),this.setAttribute("previous",this._attributes.previous),this.setAttribute("next",this._attributes.next),this.setAttribute("side",this._attributes.side),this.setAttribute("width",this._attributes.width),this.setAttribute("uv",this._attributes.uv),this.setAttribute("counters",this._attributes.counters),this.setIndex(this._attributes.index),this.computeBoundingSphere(),this.computeBoundingBox()};function s(c,u,h,d,f){var p;if(c=c.subarray||c.slice?c:c.buffer,h=h.subarray||h.slice?h:h.buffer,c=u?c.subarray?c.subarray(u,f&&u+f):c.slice(u,f&&u+f):c,h.set)h.set(c,d);else for(p=0;p<c.length;p++)h[p+d]=c[p];return h}a.prototype.advance=function(c){var u=this._attributes.position.array,h=this._attributes.previous.array,d=this._attributes.next.array,f=u.length;s(u,0,h,0,f),s(u,6,u,0,f-6),u[f-6]=c.x,u[f-5]=c.y,u[f-4]=c.z,u[f-3]=c.x,u[f-2]=c.y,u[f-1]=c.z,s(u,6,d,0,f-6),d[f-6]=c.x,d[f-5]=c.y,d[f-4]=c.z,d[f-3]=c.x,d[f-2]=c.y,d[f-1]=c.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0},r.ShaderChunk.meshline_vert=["",r.ShaderChunk.logdepthbuf_pars_vertex,r.ShaderChunk.fog_pars_vertex,"","attribute vec3 previous;","attribute vec3 next;","attribute float side;","attribute float width;","attribute float counters;","","uniform vec2 resolution;","uniform float lineWidth;","uniform vec3 color;","uniform float opacity;","uniform float sizeAttenuation;","","varying vec2 vUV;","varying vec4 vColor;","varying float vCounters;","","vec2 fix( vec4 i, float aspect ) {","","    vec2 res = i.xy / i.w;","    res.x *= aspect;","	 vCounters = counters;","    return res;","","}","","void main() {","","    float aspect = resolution.x / resolution.y;","","    vColor = vec4( color, opacity );","    vUV = uv;","","    mat4 m = projectionMatrix * modelViewMatrix;","    vec4 finalPosition = m * vec4( position, 1.0 );","    vec4 prevPos = m * vec4( previous, 1.0 );","    vec4 nextPos = m * vec4( next, 1.0 );","","    vec2 currentP = fix( finalPosition, aspect );","    vec2 prevP = fix( prevPos, aspect );","    vec2 nextP = fix( nextPos, aspect );","","    float w = lineWidth * width;","","    vec2 dir;","    if( nextP == currentP ) dir = normalize( currentP - prevP );","    else if( prevP == currentP ) dir = normalize( nextP - currentP );","    else {","        vec2 dir1 = normalize( currentP - prevP );","        vec2 dir2 = normalize( nextP - currentP );","        dir = normalize( dir1 + dir2 );","","        vec2 perp = vec2( -dir1.y, dir1.x );","        vec2 miter = vec2( -dir.y, dir.x );","        //w = clamp( w / dot( miter, perp ), 0., 4. * lineWidth * width );","","    }","","    //vec2 normal = ( cross( vec3( dir, 0. ), vec3( 0., 0., 1. ) ) ).xy;","    vec4 normal = vec4( -dir.y, dir.x, 0., 1. );","    normal.xy *= .5 * w;","    normal *= projectionMatrix;","    if( sizeAttenuation == 0. ) {","        normal.xy *= finalPosition.w;","        normal.xy /= ( vec4( resolution, 0., 1. ) * projectionMatrix ).xy;","    }","","    finalPosition.xy += normal.xy * side;","","    gl_Position = finalPosition;","",r.ShaderChunk.logdepthbuf_vertex,r.ShaderChunk.fog_vertex&&"    vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",r.ShaderChunk.fog_vertex,"}"].join(`
`),r.ShaderChunk.meshline_frag=["",r.ShaderChunk.fog_pars_fragment,r.ShaderChunk.logdepthbuf_pars_fragment,"","uniform sampler2D map;","uniform sampler2D alphaMap;","uniform float useMap;","uniform float useAlphaMap;","uniform float useDash;","uniform float dashArray;","uniform float dashOffset;","uniform float dashRatio;","uniform float visibility;","uniform float alphaTest;","uniform vec2 repeat;","","varying vec2 vUV;","varying vec4 vColor;","varying float vCounters;","","void main() {","",r.ShaderChunk.logdepthbuf_fragment,"","    vec4 c = vColor;","    if( useMap == 1. ) c *= texture2D( map, vUV * repeat );","    if( useAlphaMap == 1. ) c.a *= texture2D( alphaMap, vUV * repeat ).a;","    if( c.a < alphaTest ) discard;","    if( useDash == 1. ){","        c.a *= ceil(mod(vCounters + dashOffset, dashArray) - (dashArray * dashRatio));","    }","    gl_FragColor = c;","    gl_FragColor.a *= step(vCounters, visibility);","",r.ShaderChunk.fog_fragment,"}"].join(`
`);function l(c){r.ShaderMaterial.call(this,{uniforms:Object.assign({},r.UniformsLib.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new r.Color(16777215)},opacity:{value:1},resolution:{value:new r.Vector2(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new r.Vector2(1,1)}}),vertexShader:r.ShaderChunk.meshline_vert,fragmentShader:r.ShaderChunk.meshline_frag}),this.type="MeshLineMaterial",Object.defineProperties(this,{lineWidth:{enumerable:!0,get:function(){return this.uniforms.lineWidth.value},set:function(u){this.uniforms.lineWidth.value=u}},map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(u){this.uniforms.map.value=u}},useMap:{enumerable:!0,get:function(){return this.uniforms.useMap.value},set:function(u){this.uniforms.useMap.value=u}},alphaMap:{enumerable:!0,get:function(){return this.uniforms.alphaMap.value},set:function(u){this.uniforms.alphaMap.value=u}},useAlphaMap:{enumerable:!0,get:function(){return this.uniforms.useAlphaMap.value},set:function(u){this.uniforms.useAlphaMap.value=u}},color:{enumerable:!0,get:function(){return this.uniforms.color.value},set:function(u){this.uniforms.color.value=u}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(u){this.uniforms.opacity.value=u}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(u){this.uniforms.resolution.value.copy(u)}},sizeAttenuation:{enumerable:!0,get:function(){return this.uniforms.sizeAttenuation.value},set:function(u){this.uniforms.sizeAttenuation.value=u}},dashArray:{enumerable:!0,get:function(){return this.uniforms.dashArray.value},set:function(u){this.uniforms.dashArray.value=u,this.useDash=u!==0?1:0}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(u){this.uniforms.dashOffset.value=u}},dashRatio:{enumerable:!0,get:function(){return this.uniforms.dashRatio.value},set:function(u){this.uniforms.dashRatio.value=u}},useDash:{enumerable:!0,get:function(){return this.uniforms.useDash.value},set:function(u){this.uniforms.useDash.value=u}},visibility:{enumerable:!0,get:function(){return this.uniforms.visibility.value},set:function(u){this.uniforms.visibility.value=u}},alphaTest:{enumerable:!0,get:function(){return this.uniforms.alphaTest.value},set:function(u){this.uniforms.alphaTest.value=u}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(u){this.uniforms.repeat.value.copy(u)}}}),this.setValues(c)}l.prototype=Object.create(r.ShaderMaterial.prototype),l.prototype.constructor=l,l.prototype.isMeshLineMaterial=!0,l.prototype.copy=function(c){return r.ShaderMaterial.prototype.copy.call(this,c),this.lineWidth=c.lineWidth,this.map=c.map,this.useMap=c.useMap,this.alphaMap=c.alphaMap,this.useAlphaMap=c.useAlphaMap,this.color.copy(c.color),this.opacity=c.opacity,this.resolution.copy(c.resolution),this.sizeAttenuation=c.sizeAttenuation,this.dashArray.copy(c.dashArray),this.dashOffset.copy(c.dashOffset),this.dashRatio.copy(c.dashRatio),this.useDash=c.useDash,this.visibility=c.visibility,this.alphaTest=c.alphaTest,this.repeat.copy(c.repeat),this},e.exports&&(t=e.exports={MeshLine:a,MeshLineMaterial:l,MeshLineRaycast:o}),t.MeshLine=a,t.MeshLineMaterial=l,t.MeshLineRaycast=o}).call(Dy)}),qt=oh.MeshLine,By=oh.MeshLineMaterial;AFRAME.registerComponent("al-bounding-box",{schema:{boundingBoxWidth:{type:"number",default:2},color:{type:"string",default:"#fff"},scale:{type:"string"},enabled:{type:"boolean",default:!0},topLayerRenderOrder:{type:"number",default:999}},init:function(){this.bindMethods(),this.addEventListeners(),this.state={box:new THREE.Box3}},bindMethods:function(){},addEventListeners:function(){},removeEventListeners:function(){},update:function(){var e=this,t=this.el,n=this.state,i=AFRAME.utils.coordinates.parse(this.data.scale);n.box.setFromCenterAndSize(new THREE.Vector3(0,0,0),i);var r=new THREE.BoxGeometry(i.x,i.y,i.z),a=new THREE.MeshBasicMaterial({color:this.data.color,visible:!1}),o=new THREE.Mesh(r,a);t.setObject3D("mesh",o);var s=new THREE.Mesh;s.renderOrder=this.data.topLayerRenderOrder-5;var l=new By({color:new THREE.Color(this.data.color),alphaTest:0,resolution:new THREE.Vector2(this.el.sceneEl.canvas.clientWidth,this.el.sceneEl.canvas.clientHeight),sizeAttenuation:0,lineWidth:this.data.boundingBoxWidth}),c=new THREE.Vector3(i.x,i.y,i.z).multiplyScalar(.5),u=new THREE.Vector3(-i.x,i.y,i.z).multiplyScalar(.5),h=new THREE.Vector3(i.x,i.y,-i.z).multiplyScalar(.5),d=new THREE.Vector3(-i.x,i.y,-i.z).multiplyScalar(.5),f=new THREE.Vector3(i.x,-i.y,i.z).multiplyScalar(.5),p=new THREE.Vector3(-i.x,-i.y,i.z).multiplyScalar(.5),v=new THREE.Vector3(i.x,-i.y,-i.z).multiplyScalar(.5),m=new THREE.Vector3(-i.x,-i.y,-i.z).multiplyScalar(.5),g=new THREE.Geometry;g.vertices.push(c),g.vertices.push(u);var y=new qt;y.setGeometry(g,function(B){return e.data.boundingBoxWidth});var b=new THREE.Mesh(y.geometry,l);s.add(b);var _=new THREE.Geometry;_.vertices.push(c),_.vertices.push(h);var w=new qt;w.setGeometry(_,function(B){return e.data.boundingBoxWidth});var L=new THREE.Mesh(w.geometry,l);s.add(L);var R=new THREE.Geometry;R.vertices.push(c),R.vertices.push(f);var k=new qt;k.setGeometry(R,function(B){return e.data.boundingBoxWidth});var O=new THREE.Mesh(k.geometry,l);s.add(O);var z=new THREE.Geometry;z.vertices.push(d),z.vertices.push(u);var C=new qt;C.setGeometry(z,function(B){return e.data.boundingBoxWidth});var I=new THREE.Mesh(C.geometry,l);s.add(I);var N=new THREE.Geometry;N.vertices.push(d),N.vertices.push(h);var H=new qt;H.setGeometry(N,function(B){return e.data.boundingBoxWidth});var G=new THREE.Mesh(H.geometry,l);s.add(G);var X=new THREE.Geometry;X.vertices.push(d),X.vertices.push(m);var Z=new qt;Z.setGeometry(X,function(B){return e.data.boundingBoxWidth});var V=new THREE.Mesh(Z.geometry,l);s.add(V);var Y=new THREE.Geometry;Y.vertices.push(m),Y.vertices.push(p);var J=new qt;J.setGeometry(Y,function(B){return e.data.boundingBoxWidth});var ie=new THREE.Mesh(J.geometry,l);s.add(ie);var ce=new THREE.Geometry;ce.vertices.push(m),ce.vertices.push(v);var Re=new qt;Re.setGeometry(ce,function(B){return e.data.boundingBoxWidth});var F=new THREE.Mesh(Re.geometry,l);s.add(F);var ue=new THREE.Geometry;ue.vertices.push(f),ue.vertices.push(v);var K=new qt;K.setGeometry(ue,function(B){return e.data.boundingBoxWidth});var be=new THREE.Mesh(K.geometry,l);s.add(be);var xe=new THREE.Geometry;xe.vertices.push(f),xe.vertices.push(p);var Ne=new qt;Ne.setGeometry(xe,function(B){return e.data.boundingBoxWidth});var A=new THREE.Mesh(Ne.geometry,l);s.add(A);var M=new THREE.Geometry;M.vertices.push(u),M.vertices.push(p);var W=new qt;W.setGeometry(M,function(B){return e.data.boundingBoxWidth});var Q=new THREE.Mesh(W.geometry,l);s.add(Q);var _e=new THREE.Geometry;_e.vertices.push(h),_e.vertices.push(v);var he=new qt;he.setGeometry(_e,function(B){return e.data.boundingBoxWidth});var ee=new THREE.Mesh(he.geometry,l);s.add(ee),n.mesh=s,n.material=l,this.data.enabled?t.setObject3D("bbox",s):t.object3DMap.bbox&&t.removeObject3D("bbox")},remove:function(){this.removeEventListeners(),this.el.removeObject3D("mesh")}});AFRAME.registerComponent("al-child-hover-visible",{schema:{minFrameMS:{type:"number",default:15},nodeLabelsAlwaysVisible:{type:"boolean",default:!1}},init:function(){this.tickFunction=AFRAME.utils.throttle(this.tickFunction,this.data.minFrameMS,this),this.bindMethods(),this.addEventListeners(),this.hovered=!1},bindMethods:function(){this.pointerOver=this.pointerOver.bind(this),this.pointerOut=this.pointerOut.bind(this)},addEventListeners:function(){this.el.addEventListener("raycaster-intersected",this.pointerOver,{capture:!0,once:!1,passive:!0}),this.el.addEventListener("raycaster-intersected-cleared",this.pointerOut,{capture:!1,once:!1,passive:!0})},removeEventListeners:function(){this.el.removeEventListener("raycaster-intersected",this.pointerOver),this.el.removeEventListener("raycaster-intersected-cleared",this.pointerOut)},pointerOver:function(e){this.hovered=!0},pointerOut:function(e){this.hovered=!1},tickFunction:function(){var e=this.el,t=e.firstChild.firstChild;if(t){var n=t.object3D;this.hovered||this.data.nodeLabelsAlwaysVisible?n.visible=!0:n.visible=!1}},tick:function(){this.tickFunction()},remove:function(){this.removeEventListeners()}});AFRAME.registerComponent("al-control-lights",{schema:{color:{type:"string",default:"#fff"},controlsType:{type:"string",default:"orbit"},lightIntensity:{type:"number",default:.8},minFrameMS:{type:"number",default:15}},init:function(){this.bindMethods(),this.addEventListeners(),this.tickFunction=AFRAME.utils.throttle(this.tickFunction,this.data.minFrameMS,this);var e=this.el.getObject3D("camera"),t=new THREE.DirectionalLight(new THREE.Color(this.data.color),this.data.lightIntensity);t.position.copy(new THREE.Vector3(1,1,1)),e.add(t);var n=new THREE.DirectionalLight(new THREE.Color(this.data.color),this.data.lightIntensity);n.position.copy(new THREE.Vector3(-1,-1,-1)),e.add(n)},bindMethods:function(){},addEventListeners:function(){},removeEventListeners:function(){},update:function(e){this.data.controlsType!==e.controlsType&&this.el.object3D.up.copy(this.el.sceneEl.camera.up.clone())},tick:function(){},remove:function(){}});function zy(e){return e?Array.isArray(e)?e:e.materials?e.materials:[e]:[]}function Sr(e,t,n,i){e&&(t=t||[],e.traverse(function(r){if(r.isMesh){var a=zy(r.material);a.forEach(function(o){o&&!("envMap"in o)||t.length&&t.indexOf(o.name)===-1||(o.envMap=n,o.reflectivity=i,o.needsUpdate=!0)})}}))}AFRAME.registerComponent("al-cube-env-map",{multiple:!0,schema:{path:{default:""},extension:{default:"jpg",oneOf:["jpg","png"]},format:{default:"RGBFormat",oneOf:["RGBFormat","RGBAFormat"]},enableBackground:{default:!1},reflectivity:{default:1,min:0,max:1},materials:{default:[]}},init:function(){var e=this,t=this.data;t.path&&(this.texture=new THREE.CubeTextureLoader().load([t.path+"posx."+t.extension,t.path+"negx."+t.extension,t.path+"posy."+t.extension,t.path+"negy."+t.extension,t.path+"posz."+t.extension,t.path+"negz."+t.extension]),this.texture.format=THREE[t.format],this.object3dsetHandler=function(){var n=e.el.getObject3D("mesh"),i=e.data;Sr(n,i.materials,e.texture,i.reflectivity)},this.el.addEventListener("object3dset",this.object3dsetHandler))},update:function(e){var t=this.data,n=this.el.getObject3D("mesh"),i=[],r=[];if(t.materials.length&&(e.materials?(i=t.materials.filter(function(o){return!e.materials.includes(o)}),r=e.materials.filter(function(o){return!t.materials.includes(o)})):i=t.materials),i.length&&Sr(n,i,this.texture,t.reflectivity),r.length&&Sr(n,r,null,1),e.materials&&t.reflectivity!==e.reflectivity){var a=t.materials.filter(function(o){return e.materials.includes(o)});a.length&&Sr(n,a,this.texture,t.reflectivity)}this.data.enableBackground&&!e.enableBackground?this.setBackground(this.texture):!this.data.enableBackground&&e.enableBackground&&this.setBackground(null)},remove:function(){this.el.removeEventListener("object3dset",this.object3dsetHandler);var e=this.el.getObject3D("mesh"),t=this.data;Sr(e,t.materials,null,1),t.enableBackground&&this.setBackground(null)},setBackground:function(e){this.el.sceneEl.object3D.background=e}});var Fn={CLICK:"click",FUSING:"fusing",MOUSEENTER:"mouseenter",MOUSEDOWN:"mousedown",MOUSELEAVE:"mouseleave",MOUSEUP:"mouseup"},vn={FUSING:"cursor-fusing",HOVERING:"cursor-hovering",HOVERED:"cursor-hovered"},Xa={DOWN:["mousedown","touchstart"],UP:["mouseup","touchend"]},lc="a-mouse-cursor-hover";AFRAME.registerComponent("al-cursor",{dependencies:["raycaster"],schema:{downEvents:{default:[]},fuse:{default:AFRAME.utils.device.isMobile()},fuseTimeout:{default:1500,min:0},mouseCursorStylesEnabled:{default:!0},upEvents:{default:[]},rayOrigin:{default:"entity",oneOf:["mouse","entity"]}},init:function(){var e=this;this.fuseTimeout=void 0,this.cursorDownEl=null,this.intersectedEl=null,this.canvasBounds=document.body.getBoundingClientRect(),this.isCursorDown=!1,this.updateCanvasBounds=AFRAME.utils.debounce(function(){e.canvasBounds=e.el.sceneEl.canvas.getBoundingClientRect()},500),this.eventDetail={},this.intersectedEventDetail={cursorEl:this.el},this.onCursorDown=AFRAME.utils.bind(this.onCursorDown,this),this.onCursorUp=AFRAME.utils.bind(this.onCursorUp,this),this.onIntersection=AFRAME.utils.bind(this.onIntersection,this),this.onIntersectionCleared=AFRAME.utils.bind(this.onIntersectionCleared,this),this.onMouseMove=AFRAME.utils.bind(this.onMouseMove,this)},update:function(e){this.data.rayOrigin!==e.rayOrigin&&this.updateMouseEventListeners()},play:function(){this.addEventListeners()},pause:function(){this.removeEventListeners()},remove:function(){var e=this.el;e.removeState(vn.HOVERING),e.removeState(vn.FUSING),clearTimeout(this.fuseTimeout),this.intersectedEl&&this.intersectedEl.removeState(vn.HOVERED),this.removeEventListeners()},addEventListeners:function(){var e,t=this.data,n=this.el,i=this;function r(){e=n.sceneEl.canvas,!(t.downEvents.length||t.upEvents.length)&&(Xa.DOWN.forEach(function(a){e.addEventListener(a,i.onCursorDown)}),Xa.UP.forEach(function(a){e.addEventListener(a,i.onCursorUp)}))}e=n.sceneEl.canvas,e?r():n.sceneEl.addEventListener("render-target-loaded",r),t.downEvents.forEach(function(a){n.addEventListener(a,i.onCursorDown)}),t.upEvents.forEach(function(a){n.addEventListener(a,i.onCursorUp)}),n.addEventListener("raycaster-intersection",this.onIntersection),n.addEventListener("raycaster-intersection-cleared",this.onIntersectionCleared),n.sceneEl.addEventListener("rendererresize",this.updateCanvasBounds),window.addEventListener("resize",this.updateCanvasBounds),window.addEventListener("scroll",this.updateCanvasBounds),this.updateMouseEventListeners()},removeEventListeners:function(){var e,t=this.data,n=this.el,i=this;e=n.sceneEl.canvas,e&&!t.downEvents.length&&!t.upEvents.length&&(Xa.DOWN.forEach(function(r){e.removeEventListener(r,i.onCursorDown)}),Xa.UP.forEach(function(r){e.removeEventListener(r,i.onCursorUp)})),t.downEvents.forEach(function(r){n.removeEventListener(r,i.onCursorDown)}),t.upEvents.forEach(function(r){n.removeEventListener(r,i.onCursorUp)}),n.removeEventListener("raycaster-intersection",this.onIntersection),n.removeEventListener("raycaster-intersection-cleared",this.onIntersectionCleared),e.removeEventListener("mousemove",this.onMouseMove),e.removeEventListener("touchstart",this.onMouseMove),e.removeEventListener("touchmove",this.onMouseMove),n.sceneEl.removeEventListener("rendererresize",this.updateCanvasBounds),window.removeEventListener("resize",this.updateCanvasBounds),window.removeEventListener("scroll",this.updateCanvasBounds)},updateMouseEventListeners:function(){var e,t=this.el;e=t.sceneEl.canvas,e.removeEventListener("mousemove",this.onMouseMove),e.removeEventListener("touchmove",this.onMouseMove),t.setAttribute("raycaster","useWorldCoordinates",!1),t.setAttribute("raycaster","far",1e3),this.data.rayOrigin==="mouse"&&(e.addEventListener("mousemove",this.onMouseMove,!1),e.addEventListener("touchmove",this.onMouseMove,!1),t.setAttribute("raycaster","useWorldCoordinates",!0),t.setAttribute("raycaster","far",1e5),this.updateCanvasBounds())},onMouseMove:function(){var e=new THREE.Vector3,t=new THREE.Vector2,n=new THREE.Vector3,i={origin:n,direction:e};return function(r){var a=this.canvasBounds,o=this.el.sceneEl.camera,s,l,c;o.parent.updateMatrixWorld(),r.type==="touchmove"||r.type==="touchstart"?l=r.touches.item(0):l=r,s=l.clientX-a.left,c=l.clientY-a.top,t.x=s/a.width*2-1,t.y=-(c/a.height)*2+1,n.setFromMatrixPosition(o.matrixWorld),e.set(t.x,t.y,.5).unproject(o).sub(n).normalize(),this.el.setAttribute("raycaster",i),r.type==="touchmove"&&r.preventDefault()}}(),onCursorDown:function(e){this.isCursorDown=!0,this.data.rayOrigin==="mouse"&&e.type==="touchstart"&&(this.onMouseMove(e),this.el.components.raycaster.checkIntersections(),e.preventDefault()),this.twoWayEmit(Fn.MOUSEDOWN),this.cursorDownEl=this.intersectedEl},onCursorUp:function(e){if(this.isCursorDown){this.isCursorDown=!1;var t=this.data;this.twoWayEmit(Fn.MOUSEUP),this.cursorDownEl&&this.cursorDownEl!==this.intersectedEl&&(this.intersectedEventDetail.intersection=null,this.cursorDownEl.emit(Fn.MOUSEUP,this.intersectedEventDetail)),(!t.fuse||t.rayOrigin==="mouse")&&this.intersectedEl&&this.cursorDownEl===this.intersectedEl&&this.twoWayEmit(Fn.CLICK),this.cursorDownEl=null,e.type==="touchend"&&e.preventDefault()}},onIntersection:function(e){var t,n=this.el,i,r,a;i=e.detail.els[0]===n?1:0,a=e.detail.intersections[i],r=e.detail.els[i],r&&this.intersectedEl!==r&&(this.intersectedEl&&(t=this.el.components.raycaster.getIntersection(this.intersectedEl),t&&t.distance<=a.distance)||(this.clearCurrentIntersection(!0),this.setIntersection(r,a)))},onIntersectionCleared:function(e){var t=e.detail.clearedEls;t.indexOf(this.intersectedEl)!==-1&&this.clearCurrentIntersection()},setIntersection:function(e){var t=this.el,n=this.data,i=this;this.intersectedEl!==e&&(this.intersectedEl=e,t.addState(vn.HOVERING),e.addState(vn.HOVERED),this.twoWayEmit(Fn.MOUSEENTER),this.data.mouseCursorStylesEnabled&&this.data.rayOrigin==="mouse"&&this.el.sceneEl.canvas.classList.add(lc),!(n.fuseTimeout===0||!n.fuse)&&(t.addState(vn.FUSING),this.twoWayEmit(Fn.FUSING),this.fuseTimeout=setTimeout(function(){t.removeState(vn.FUSING),i.twoWayEmit(Fn.CLICK)},n.fuseTimeout)))},clearCurrentIntersection:function(e){var t,n,i,r=this.el;this.intersectedEl&&(this.intersectedEl.removeState(vn.HOVERED),r.removeState(vn.HOVERING),r.removeState(vn.FUSING),this.twoWayEmit(Fn.MOUSELEAVE),this.data.mouseCursorStylesEnabled&&this.data.rayOrigin==="mouse"&&this.el.sceneEl.canvas.classList.remove(lc),this.intersectedEl=null,clearTimeout(this.fuseTimeout),e!==!0&&(i=this.el.components.raycaster.intersections,i.length!==0&&(t=i[0].object.el===r?1:0,n=i[t],n&&this.setIntersection(n.object.el,n))))},twoWayEmit:function(e){var t=this.el,n=this.intersectedEl,i;i=this.el.components.raycaster.getIntersection(n),this.eventDetail.intersectedEl=n,this.eventDetail.intersection=i,t.emit(e,this.eventDetail),n&&(this.intersectedEventDetail.intersection=i,n.emit(e,this.intersectedEventDetail))}});AFRAME.registerComponent("al-edge",{schema:{length:{type:"number"},minFrameMS:{type:"number",default:15},node1:{type:"vec3"},node2:{type:"vec3"},nodeScale:{type:"number"},radius:{type:"number"},scale:{type:"number"},selected:{type:"boolean"}},init:function(){this.tickFunction=AFRAME.utils.throttle(this.tickFunction,this.data.minFrameMS,this),this.bindMethods(),this.addEventListeners(),this.state={selected:!0,hovered:!1}},bindMethods:function(){this.pointerDown=this.pointerDown.bind(this),this.pointerOver=this.pointerOver.bind(this),this.pointerOut=this.pointerOut.bind(this),this.createMesh=this.createMesh.bind(this),this.getMatrix=this.getMatrix.bind(this)},addEventListeners:function(){this.el.sceneEl.addEventListener("mousedown",this.pointerDown,{capture:!1,once:!1,passive:!0}),this.el.addEventListener("raycaster-intersected",this.pointerOver,{capture:!0,once:!1,passive:!0}),this.el.addEventListener("raycaster-intersected-cleared",this.pointerOut,{capture:!1,once:!1,passive:!0})},removeEventListeners:function(){this.el.sceneEl.removeEventListener("mousedown",this.pointerDown),this.el.removeEventListener("raycaster-intersected",this.pointerOver),this.el.removeEventListener("raycaster-intersected-cleared",this.pointerOut)},pointerDown:function(e){var t=this.state;t.hovered&&this.el.sceneEl.emit(ot.SELECTED,{type:Jt.EDGE,id:this.el.id},!1)},pointerOver:function(e){var t=this.state;t.hovered=!0,this.el.sceneEl.emit(ot.POINTER_OVER,{id:this.el.id},!1)},pointerOut:function(e){var t=this.state;t.hovered=!1,this.el.sceneEl.emit(ot.POINTER_OUT,{},!1)},getMatrix:function(){var e=ge.objectToVector3(this.data.node1),t=ge.objectToVector3(this.data.node2),n=new THREE.Matrix4;n.makeScale(this.data.scale,this.data.scale,1);var i=new THREE.Matrix4;i.set(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1);var r=new THREE.Matrix4;return r.lookAt(e,t,new THREE.Object3D().up),r.multiply(n),r.multiply(i),r},createMesh:function(){var e=new THREE.CylinderGeometry(this.data.radius,this.data.radius,this.data.length,6,4),t=new THREE.MeshBasicMaterial,n=new THREE.Mesh(e,t);n.applyMatrix(this.getMatrix()),this.state.geometry=e,this.state.material=t,this.state.mesh=n;var i=new THREE.CylinderGeometry(this.data.radius,this.data.radius,this.data.length-this.data.nodeScale*2,6,4),r=Ml.getHaloMaterial(),a=new THREE.Mesh(i,r);this.state.outlineGeometry=i,this.state.outlineMaterialt=r,this.state.outlineMesh=a,n.add(a),this.el.setObject3D("mesh",n),this.el.object3D.renderOrder=U.topLayerRenderOrder-2},update:function(e){var t=this.state;t.selected=this.data.selected,e&&(e.radius!==this.data.radius||e.length!==this.data.length||e.scale!==this.data.scale)&&this.createMesh()},tickFunction:function(){var e=this.el,t=this.state;t.hovered?t.material.color=new THREE.Color(U.buttonColors.hover):t.selected?t.material.color=new THREE.Color(U.buttonColors.active):t.material.color=new THREE.Color(U.buttonColors.up);var n=e.firstChild;if(n){var i=n.object3D;t.hovered?i.visible=!0:i.visible=!1}},tick:function(){this.tickFunction()},remove:function(){this.removeEventListeners(),this.el.removeObject3D("mesh")}});var cc={LOADED:"al-model-loaded",ERROR:"al-model-error"};AFRAME.registerComponent("al-gltf-model",{schema:{src:{type:"model",default:""},dracoDecoderPath:{type:"string",default:""}},init:function(){this.bindMethods(),this.addEventListeners(),this.model=null,this.loader=new THREE.GLTFLoader,this.dracoLoader=new THREE.DRACOLoader,this.dracoLoader.setDecoderPath(this.data.dracoDecoderPath),this.loader.setDRACOLoader(this.dracoLoader)},bindMethods:function(){},addEventListeners:function(){},removeEventListeners:function(){},update:function(e){var t=this,n=this.el,i=this.data.src;e&&e.src!==i&&(this.remove(),this.loader.load(i,function(a){t.model=a.scene||a.scenes[0],t.model.animations=a.animations,n.setObject3D("mesh",t.model),n.sceneEl.emit(cc.LOADED,{format:"gltf",model:t.model},!1)},void 0,function(a){var o=a&&a.message?a.message:"Failed to load glTF model";console.warn(o),n.sceneEl.emit(cc.ERROR,{format:"gltf",src:i},!1)}))},remove:function(){this.model&&(this.removeEventListeners(),this.el.removeObject3D("mesh"))}});AFRAME.registerComponent("al-node",{schema:{graphEnabled:{type:"boolean"},minFrameMS:{type:"number",default:15},scale:{type:"number",default:1},selected:{type:"boolean"}},init:function(){this.tickFunction=AFRAME.utils.throttle(this.tickFunction,this.data.minFrameMS,this),this.bindMethods(),this.addEventListeners();var e=this.data,t=this.el,n=t.sceneEl.camera.el.object3DMap.camera;e.scale<U.nodeMinSize&&(e.scale=U.nodeMinSize);var i=new THREE.SphereGeometry(e.scale,16,16),r=new THREE.MeshBasicMaterial,a=new THREE.Mesh(i,r),o=new THREE.SphereGeometry(e.scale,16,16),s=Ml.getHaloMaterial(),l=new THREE.Mesh(o,s);a.add(l),t.setObject3D("mesh",a),t.object3D.renderOrder=U.topLayerRenderOrder-1,this.state={selected:!0,hovered:!1,geometry:i,material:r,mesh:a,outlineGeometry:o,outlineMaterial:s,outlineMesh:l,camera:n,dragging:!1}},bindMethods:function(){this.pointerDown=this.pointerDown.bind(this),this.pointerUp=this.pointerUp.bind(this),this.pointerOver=this.pointerOver.bind(this),this.pointerOut=this.pointerOut.bind(this)},addEventListeners:function(){this.el.sceneEl.addEventListener("mousedown",this.pointerDown,{capture:!1,once:!1,passive:!0}),this.el.addEventListener("mouseup",this.pointerUp,{capture:!1,once:!1,passive:!0}),this.el.sceneEl.addEventListener("mouseup",this.pointerUp,{capture:!1,once:!1,passive:!0}),this.el.addEventListener("raycaster-intersected",this.pointerOver,{capture:!0,once:!1,passive:!0}),this.el.addEventListener("raycaster-intersected-cleared",this.pointerOut,{capture:!1,once:!1,passive:!0})},removeEventListeners:function(){this.el.sceneEl.removeEventListener("mousedown",this.pointerDown),this.el.sceneEl.removeEventListener("mouseup",this.pointerUp),this.el.removeEventListener("mouseup",this.pointerUp),this.el.removeEventListener("raycaster-intersected",this.pointerOver),this.el.removeEventListener("raycaster-intersected-cleared",this.pointerOut)},pointerDown:function(e){var t=this.state;if(t.hovered&&(this.el.sceneEl.emit(ot.SELECTED,{type:Jt.NODE,id:this.el.id},!0),this.data.graphEnabled)){var n=this.state;n.mouseDown=!0,this.el.sceneEl.emit(ot.POINTER_DOWN,{},!0)}},pointerUp:function(e){var t=this.state;this.data.graphEnabled&&(t.dragging=!1,t.mouseDown=!1,this.el.sceneEl.emit(ot.POINTER_UP,{},!0))},pointerOver:function(e){var t=this.state;t.hovered=!0,this.el.sceneEl.emit(ot.POINTER_OVER,{id:this.el.id},!0)},pointerOut:function(e){var t=this.state;t.hovered=!1,t.mouseDown&&t.selected&&(t.dragging=!0),this.el.sceneEl.emit(ot.POINTER_OUT,{},!0)},update:function(){var e=this.state;e.selected=this.data.selected},tickFunction:function(){var e=this.el,t=this.state;this.data.graphEnabled&&t.dragging&&this.el.sceneEl.emit(ot.DRAGGED,{id:this.el.id},!0),t.hovered||t.dragging?t.material.color=new THREE.Color(U.buttonColors.hover):t.selected?t.material.color=new THREE.Color(U.buttonColors.active):t.material.color=new THREE.Color(U.buttonColors.up);var n=e.firstChild;if(n){var i=n.object3D;t.hovered||t.dragging?i.visible=!0:i.visible=!1}},tick:function(){this.tickFunction()},remove:function(){this.removeEventListeners(),this.el.removeObject3D("mesh")}});AFRAME.registerComponent("al-node-spawner",{schema:{graphEnabled:{type:"boolean"},minFrameMS:{type:"number",default:15}},init:function(){this.bindMethods(),this.addEventListeners(),this.state={left:!1,intersecting:!1}},bindMethods:function(){this.canvasMouseDown=this.canvasMouseDown.bind(this),this.pointerOver=this.pointerOver.bind(this),this.pointerOut=this.pointerOut.bind(this),this.elClick=this.elClick.bind(this),this.canvasMouseUp=this.canvasMouseUp.bind(this),this.pointerDown=this.pointerDown.bind(this),this.pointerUp=this.pointerUp.bind(this)},addEventListeners:function(){this.el.sceneEl.canvas.addEventListener("mousedown",this.canvasMouseDown,{capture:!1,once:!1,passive:!0}),this.el.sceneEl.canvas.addEventListener("mouseup",this.canvasMouseUp,{capture:!1,once:!1,passive:!0}),this.el.addEventListener("raycaster-intersected",this.pointerOver,{capture:!1,once:!1,passive:!0}),this.el.addEventListener("raycaster-intersected-cleared",this.pointerOut,!1),this.el.addEventListener("click",this.elClick,{capture:!1,once:!1,passive:!0}),this.el.addEventListener("mousedown",this.pointerDown,{capture:!1,once:!1,passive:!0}),this.el.addEventListener("mouseup",this.pointerUp,{capture:!1,once:!1,passive:!0})},removeEventListeners:function(){this.el.sceneEl.canvas.removeEventListener("mousedown",this.canvasMouseDown),this.el.sceneEl.canvas.removeEventListener("mouseup",this.canvasMouseUp),this.el.removeEventListener("raycaster-intersected",this.pointerOver),this.el.removeEventListener("raycaster-intersected-cleared",this.pointerOut),this.el.removeEventListener("click",this.elClick),this.el.removeEventListener("mousedown",this.pointerDown),this.el.removeEventListener("mouseup",this.pointerUp)},canvasMouseDown:function(e){this.state.left=e.button===0},canvasMouseUp:function(e){var t=this;setTimeout(function(){t.state.left=!1},this.data.minFrameMS)},pointerOver:function(e){this.state.intersecting=!0,this.el.sceneEl.emit("al-valid-target",{valid:!0},!1)},pointerOut:function(e){this.state.intersecting=!1,this.el.sceneEl.emit("al-valid-target",{valid:!1},!1)},pointerDown:function(e){this.data.graphEnabled&&this.el.sceneEl.emit("al-graph-pointer-down",{},!1)},pointerUp:function(e){this.data.graphEnabled&&this.el.sceneEl.emit("al-graph-pointer-up",{},!1)},elClick:function(e){this.state.left&&this.data.graphEnabled&&this.el.sceneEl.emit("al-add-node",{aframeEvent:e},!1)},remove:function(){this.removeEventListeners()}});var gn={INTERACTION:"al-control-interaction",INTERACTION_FINISHED:"al-control-interaction-finished",ANIMATION_STARTED:"al-controls-animation-started",ANIMATION_FINISHED:"al-controls-animation-finished"};AFRAME.registerComponent("al-orbit-control",{dependencies:["camera"],schema:{animating:{type:"boolean",default:!1},autoRotate:{type:"boolean"},autoRotateSpeed:{default:2},controlPosition:{type:"vec3"},controlTarget:{type:"vec3"},dampingFactor:{default:.1},enabled:{default:!0},enableDamping:{default:!0},enableKeys:{default:!0},enablePan:{default:!0},enableRotate:{default:!0},enableZoom:{default:!0},keyPanSpeed:{default:7},maxAzimuthAngle:{type:"number",default:1/0},maxDistance:{default:8e3},maxPolarAngle:{default:88},minAzimuthAngle:{type:"number",default:-1/0},minDistance:{default:1},minFrameMS:{type:"number",default:15},minPolarAngle:{default:0},panSpeed:{default:1},rotateSpeed:{default:.05},screenSpacePanning:{default:!1},zoomSpeed:{type:"number",default:.5}},bindMethods:function(){this.canvasWheel=this.canvasWheel.bind(this),this.getCameraState=this.getCameraState.bind(this),this.handleAnimationCache=this.handleAnimationCache.bind(this),this.mouseDown=this.mouseDown.bind(this),this.mouseMove=this.mouseMove.bind(this),this.mouseUp=this.mouseUp.bind(this),this.objectToVector3=this.objectToVector3.bind(this),this.onWheel=this.onWheel.bind(this)},objectToVector3:function(e){var t=new THREE.Vector3;return t.x=e.x,t.y=e.y,t.z=e.z,t},addListeners:function(){window.addEventListener("mouseup",this.mouseUp,{capture:!1,once:!1,passive:!0}),window.addEventListener("mousemove",this.mouseMove,{capture:!1,once:!1,passive:!0}),this.el.sceneEl.canvas.addEventListener("mousedown",this.mouseDown,{capture:!1,once:!1,passive:!0}),this.el.sceneEl.canvas.addEventListener("wheel",this.canvasWheel,{capture:!1,once:!1,passive:!0}),this.el.sceneEl.addEventListener(gn.ANIMATION_STARTED,this.handleAnimationCache,!1)},removeListeners:function(){window.removeEventListener("mouseup",this.mouseUp),window.removeEventListener("mousemove",this.mouseMove),this.el.sceneEl.canvas.removeEventListener("mousedown",this.mouseDown),this.el.sceneEl.canvas.removeEventListener("wheel",this.canvasWheel),this.el.sceneEl.removeEventListener(gn.ANIMATION_STARTED,this.handleAnimationCache,!1)},handleAnimationCache:function(e){this.state.animationCache=e.detail.slerpPath},mouseUp:function(e){document.body.style.cursor="grab";var t=this.state.controls;t.enabled&&this.el.sceneEl.emit(gn.INTERACTION_FINISHED,{cameraState:this.getCameraState(),needsRender:this.state.mouseDown},!1),this.state.mouseDown=!1},mouseDown:function(e){this.state.mouseDown=!0,document.body.style.cursor="grabbing"},mouseMove:function(e){this.state.mouseDown&&this.el.sceneEl.emit(gn.INTERACTION,{cameraState:this.getCameraState(),needsRender:this.state.mouseDown},!1)},onWheel:function(){var e=this,t=this.state;t.wheelMarker=!1,t.wheelCounter2=t.wheelCounter1,setTimeout(function(){t.wheelCounter2===t.wheelCounter1?(t.wheelMarker=!0,t.wheelCounter1=0,t.wheelCounter2=0,e.el.sceneEl.emit(gn.INTERACTION_FINISHED,{cameraState:e.getCameraState(),needsRender:!0},!1)):e.onWheel()},t.wheelInterval)},canvasWheel:function(e){var t=this.state;t.wheelCounter1+=1,t.wheelMarker&&this.onWheel(),this.el.sceneEl.emit(gn.INTERACTION,{cameraState:this.getCameraState(),needsRender:!0},!1)},init:function(){var e=this,t=this.el,n=this.data;document.body.style.cursor="grab",this.tickFunction=AFRAME.utils.throttle(this.tickFunction,this.data.minFrameMS,this);var i=new THREE.OrbitControls(t.getObject3D("camera"),t.sceneEl.renderer.domElement),r=this.objectToVector3(n.controlPosition),a=this.objectToVector3(n.controlTarget);i.object.position.copy(r),t.getObject3D("camera").position.copy(r),i.target.copy(a);var o=[];this.state={animationCache:o,controls:i,mouseDown:!1,wheelCounter1:0,wheelCounter2:void 0,wheelInterval:50,wheelMarker:!0},this.bindMethods(),this.addListeners(),setTimeout(function(){e.el.sceneEl.emit(gn.INTERACTION,{cameraState:e.getCameraState(),needsRender:!1},!1)},this.data.minFrameMS)},getCameraState:function(){return{position:this.state.controls.object.position,target:this.state.controls.target}},update:function(e){var t=this.state.controls,n=this.data;t.target=this.objectToVector3(n.controlTarget),t.autoRotate=n.autoRotate,t.autoRotateSpeed=n.autoRotateSpeed,t.dampingFactor=n.dampingFactor,t.enabled=n.enabled,t.enableDamping=n.enableDamping,t.enableKeys=n.enableKeys,t.enablePan=n.enablePan,t.enableRotate=n.enableRotate,t.enableZoom=n.enableZoom,t.keyPanSpeed=n.keyPanSpeed,t.maxPolarAngle=THREE.Math.degToRad(n.maxPolarAngle),t.maxAzimuthAngle=THREE.Math.degToRad(n.maxAzimuthAngle),t.maxDistance=n.maxDistance,t.minDistance=n.minDistance,t.minPolarAngle=THREE.Math.degToRad(n.minPolarAngle),t.minAzimuthAngle=THREE.Math.degToRad(n.minAzimuthAngle),t.panSpeed=n.panSpeed,t.rotateSpeed=n.rotateSpeed,t.screenSpacePanning=n.screenSpacePanning,t.zoomSpeed=n.zoomSpeed,this.el.getObject3D("camera").position.copy(this.objectToVector3(n.controlPosition))},tickFunction:function(){var e=this.state.controls;if(e.enabled){if(this.data.animating){var t=this.state.animationCache.shift();t&&t.position&&t.target&&(e.object.position.copy(t.position),this.el.getObject3D("camera").position.copy(t.position),e.target.copy(t.target),this.el.sceneEl.emit(gn.INTERACTION,{cameraState:this.getCameraState(),needsRender:!0},!1)),this.state.animationCache.length===0&&(this.el.sceneEl.emit(gn.ANIMATION_FINISHED,{},!1),this.el.sceneEl.emit(gn.INTERACTION_FINISHED,{cameraState:this.getCameraState(),needsRender:!0},!1))}e.enabled&&(e.enableDamping||e.autoRotate)&&e.update()}},tick:function(){this.tickFunction()},remove:function(){this.state.controls.reset(),this.removeListeners();var e=this.state;e.controls.dispose(),e=null}});AFRAME.registerComponent("al-render-order",{schema:{renderOrder:{type:"number",default:999}},init:function(){var e=this;this.bindMethods(),this.addEventListeners(),Object.keys(this.el.object3DMap).forEach(function(t){e.el.object3DMap[t].renderOrder=e.data.renderOrder})},bindMethods:function(){},addEventListeners:function(){},removeEventListeners:function(){},update:function(){var e=this;Object.keys(this.el.object3DMap).forEach(function(t){e.el.object3DMap[t].renderOrder=e.data.renderOrder})},remove:function(){this.removeEventListeners()}});AFRAME.registerComponent("al-render-overlaid",{schema:{renderOrder:{type:"number",default:999}},init:function(e){this.bindMethods(),this.addEventListeners(),this.setDepth(this.el.object3DMap.mesh),this.setDepth(this.el.object3DMap.text)},bindMethods:function(){},addEventListeners:function(){},removeEventListeners:function(){},setDepth:function(e){e&&(e.renderOrder=this.data.renderOrder,e.material&&(e.material.depthTest=!1))},remove:function(){this.removeEventListeners()}});var lt=function(){function e(){}return e}();lt.INTERACTION="al-control-interaction";lt.INTERACTION_FINISHED="al-control-interaction-finished";lt.ANIMATION_STARTED="al-controls-animation-started";lt.ANIMATION_FINISHED="al-controls-animation-finished";var At={NONE:-1,ROTATE:0,ZOOM:1,PAN:2,TOUCH_ROTATE:3,TOUCH_ZOOM_PAN:4},us={ROTATE:THREE.MOUSE.LEFT,ZOOM:THREE.MOUSE.MIDDLE,PAN:THREE.MOUSE.RIGHT},Fy=function(e){_h(t,e);function t(n,i){var r=e.call(this)||this;return r.screen={left:0,top:0,width:0,height:0},r._changeEvent={type:"change"},r._startEvent={type:"start"},r._endEvent={type:"end"},r.object=n,r.domElement=i!==void 0?i:document,r.enabled=!0,r.screen={left:0,top:0,width:0,height:0},r.rotateSpeed=1,r.zoomSpeed=1.2,r.panSpeed=.3,r.noRotate=!1,r.noZoom=!1,r.noPan=!1,r.staticMoving=!1,r.dynamicDampingFactor=.2,r.minDistance=0,r.maxDistance=1/0,r.target=new THREE.Vector3,r.EPS=1e-6,r._lastPosition=new THREE.Vector3,r._state=At.NONE,r._eye=new THREE.Vector3,r._movePrev=new THREE.Vector2,r._moveCurr=new THREE.Vector2,r._lastAxis=new THREE.Vector3,r._lastAngle=0,r._zoomStart=new THREE.Vector2,r._zoomEnd=new THREE.Vector2,r._touchZoomDistanceStart=0,r._touchZoomDistanceEnd=0,r._panStart=new THREE.Vector2,r._panEnd=new THREE.Vector2,r._target0=r.target.clone(),r._position0=r.object.position.clone(),r._up0=r.object.up.clone(),r._bindMethods(),r._addListeners(),r.update(),r}return Object.defineProperty(t.prototype,"up0",{get:function(){return this._up0.clone()},enumerable:!0,configurable:!0}),t.prototype._bindMethods=function(){this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._mouseWheel=this._mouseWheel.bind(this),this._touchStart=this._touchStart.bind(this),this._touchEnd=this._touchEnd.bind(this),this._touchMove=this._touchMove.bind(this),this._resize=this._resize.bind(this)},t.prototype._addListeners=function(){this.domElement.addEventListener("mousedown",this._mouseDown,{capture:!1,once:!1,passive:!0}),window.addEventListener("mousemove",this._mouseMove,{capture:!1,once:!1,passive:!0}),window.addEventListener("mouseup",this._mouseUp,{capture:!1,once:!1,passive:!0}),this.domElement.addEventListener("wheel",this._mouseWheel,{capture:!1,once:!1,passive:!1}),this.domElement.addEventListener("touchstart",this._touchStart,{capture:!1,once:!1,passive:!0}),window.addEventListener("touchend",this._touchEnd,{capture:!1,once:!1,passive:!0}),window.addEventListener("touchmove",this._touchMove,{capture:!1,once:!1,passive:!0})},t.prototype._mouseDown=function(n){if(this.enabled!==!1){if(this._state===At.NONE)switch(n.button){case us.ROTATE:this._state=At.ROTATE,this.noRotate||(this._moveCurr.copy(this._getMouseOnCircle(n.pageX,n.pageY)),this._movePrev.copy(this._moveCurr));break;case us.ZOOM:this._state=At.ZOOM,this.noZoom||(this._zoomStart.copy(this._getMouseOnScreen(n.pageX,n.pageY)),this._zoomEnd.copy(this._zoomStart));break;case us.PAN:this._state=At.PAN,this.noPan||(this._panStart.copy(this._getMouseOnScreen(n.pageX,n.pageY)),this._panEnd.copy(this._panStart));break;default:this._state=At.NONE}this.dispatchEvent(this._startEvent),this.update()}},t.prototype._mouseMove=function(n){this.enabled!==!1&&(this._state===At.ROTATE&&!this.noRotate?(this._movePrev.copy(this._moveCurr),this._moveCurr.copy(this._getMouseOnCircle(n.pageX,n.pageY))):this._state===At.ZOOM&&!this.noZoom?this._zoomEnd.copy(this._getMouseOnScreen(n.pageX,n.pageY)):this._state===At.PAN&&!this.noPan&&this._panEnd.copy(this._getMouseOnScreen(n.pageX,n.pageY)),this.update())},t.prototype._mouseUp=function(n){this.enabled!==!1&&(this._state=At.NONE,this.dispatchEvent(this._endEvent),this.update())},t.prototype._mouseWheel=function(n){if(!(this.enabled===!1||this.noZoom===!0)){switch(n.preventDefault(),n.stopPropagation(),n.deltaMode){case 2:this._zoomStart.y-=n.deltaY*.025;break;case 1:this._zoomStart.y-=n.deltaY*.01;break;default:this._zoomStart.y-=n.deltaY*25e-5;break}this.dispatchEvent(this._startEvent),this.dispatchEvent(this._endEvent),this.update()}},t.prototype._touchStart=function(n){if(this.enabled!==!1){switch(n.touches.length){case 1:this._state=At.TOUCH_ROTATE,this._moveCurr.copy(this._getMouseOnCircle(n.touches[0].pageX,n.touches[0].pageY)),this._movePrev.copy(this._moveCurr);break;default:this._state=At.TOUCH_ZOOM_PAN;var i=n.touches[0].pageX-n.touches[1].pageX,r=n.touches[0].pageY-n.touches[1].pageY;this._touchZoomDistanceEnd=this._touchZoomDistanceStart=Math.sqrt(i*i+r*r);var a=(n.touches[0].pageX+n.touches[1].pageX)/2,o=(n.touches[0].pageY+n.touches[1].pageY)/2;this._panStart.copy(this._getMouseOnScreen(a,o)),this._panEnd.copy(this._panStart);break}this.dispatchEvent(this._startEvent),this.update()}},t.prototype._touchEnd=function(n){if(this.enabled!==!1){switch(n.touches.length){case 0:this._state=At.NONE;break;case 1:this._state=At.TOUCH_ROTATE,this._moveCurr.copy(this._getMouseOnCircle(n.touches[0].pageX,n.touches[0].pageY)),this._movePrev.copy(this._moveCurr);break;default:break}this.dispatchEvent(this._endEvent),this.update()}},t.prototype._touchMove=function(n){if(this.enabled!==!1){switch(n.touches.length){case 1:this._movePrev.copy(this._moveCurr),this._moveCurr.copy(this._getMouseOnCircle(n.touches[0].pageX,n.touches[0].pageY));break;default:var i=n.touches[0].pageX-n.touches[1].pageX,r=n.touches[0].pageY-n.touches[1].pageY;this._touchZoomDistanceEnd=Math.sqrt(i*i+r*r);var a=(n.touches[0].pageX+n.touches[1].pageX)/2,o=(n.touches[0].pageY+n.touches[1].pageY)/2;this._panEnd.copy(this._getMouseOnScreen(a,o));break}this.update()}},t.prototype._resize=function(){if(this.domElement===document)this.screen.left=0,this.screen.top=0,this.screen.width=window.innerWidth,this.screen.height=window.innerHeight;else{var n=this.domElement.getBoundingClientRect(),i=this.domElement.ownerDocument.documentElement;this.screen.left=n.left+window.pageXOffset-i.clientLeft,this.screen.top=n.top+window.pageYOffset-i.clientTop,this.screen.width=n.width,this.screen.height=n.height}},t.prototype._getMouseOnScreen=function(n,i){var r=new THREE.Vector2;return r.set((n-this.screen.left)/this.screen.width,(i-this.screen.top)/this.screen.height),r},t.prototype._getMouseOnCircle=function(n,i){var r=new THREE.Vector2;return r.set((n-this.screen.width*.5-this.screen.left)/(this.screen.width*.5),(this.screen.height+2*(this.screen.top-i))/this.screen.width),r},t.prototype._rotateCamera=function(){var n=new THREE.Vector3,i=new THREE.Quaternion,r=new THREE.Vector3,a=new THREE.Vector3,o=new THREE.Vector3,s=new THREE.Vector3,l;s.set(this._moveCurr.x-this._movePrev.x,this._moveCurr.y-this._movePrev.y,0),l=s.length(),l?(this._eye.copy(this.object.position).sub(this.target),r.copy(this._eye).normalize(),a.copy(this.object.up).normalize(),o.crossVectors(a,r).normalize(),a.setLength(this._moveCurr.y-this._movePrev.y),o.setLength(this._moveCurr.x-this._movePrev.x),s.copy(a.add(o)),n.crossVectors(s,this._eye).normalize(),l*=this.rotateSpeed,i.setFromAxisAngle(n,l),this._eye.applyQuaternion(i),this.object.up.applyQuaternion(i),this._lastAxis.copy(n),this._lastAngle=l):!this.staticMoving&&this._lastAngle&&(this._lastAngle*=Math.sqrt(1-this.dynamicDampingFactor),this._eye.copy(this.object.position).sub(this.target),i.setFromAxisAngle(this._lastAxis,this._lastAngle),this._eye.applyQuaternion(i),this.object.up.applyQuaternion(i)),this._movePrev.copy(this._moveCurr)},t.prototype._zoomCamera=function(){var n;this._state===At.TOUCH_ZOOM_PAN?(n=this._touchZoomDistanceStart/this._touchZoomDistanceEnd,this._touchZoomDistanceStart=this._touchZoomDistanceEnd,this._eye.multiplyScalar(n)):(n=1+(this._zoomEnd.y-this._zoomStart.y)*this.zoomSpeed,n!==1&&n>0&&this._eye.multiplyScalar(n),this.staticMoving?this._zoomStart.copy(this._zoomEnd):this._zoomStart.y+=(this._zoomEnd.y-this._zoomStart.y)*this.dynamicDampingFactor)},t.prototype._panCamera=function(){var n=new THREE.Vector2,i=new THREE.Vector3,r=new THREE.Vector3;n.copy(this._panEnd).sub(this._panStart),n.lengthSq()&&(n.multiplyScalar(this._eye.length()*this.panSpeed),r.copy(this._eye).cross(this.object.up).setLength(n.x),r.add(i.copy(this.object.up).setLength(n.y)),this.object.position.add(r),this.target.add(r),this.staticMoving?this._panStart.copy(this._panEnd):this._panStart.add(n.subVectors(this._panEnd,this._panStart).multiplyScalar(this.dynamicDampingFactor)))},t.prototype._checkDistances=function(){(!this.noZoom||!this.noPan)&&(this._eye.lengthSq()>this.maxDistance*this.maxDistance&&(this.object.position.addVectors(this.target,this._eye.setLength(this.maxDistance)),this._zoomStart.copy(this._zoomEnd)),this._eye.lengthSq()<this.minDistance*this.minDistance&&(this.object.position.addVectors(this.target,this._eye.setLength(this.minDistance)),this._zoomStart.copy(this._zoomEnd)))},t.prototype.update=function(){this._eye.subVectors(this.object.position,this.target),this.noRotate||this._rotateCamera(),this.noZoom||this._zoomCamera(),this.noPan||this._panCamera(),this.object.position.addVectors(this.target,this._eye),this._checkDistances(),this.object.lookAt(this.target),this._lastPosition.distanceToSquared(this.object.position)>this.EPS&&(this.dispatchEvent(this._changeEvent),this._lastPosition.copy(this.object.position))},t.prototype.reset=function(){this._state=At.NONE,this.target.copy(this._target0),this.object.position.copy(this._position0),this.object.up.copy(this._up0),this._eye.subVectors(this.object.position,this.target),this.object.lookAt(this.target),this.dispatchEvent(this._changeEvent),this._lastPosition.copy(this.object.position)},t.prototype.dispose=function(){this._removeListeners()},t.prototype._removeListeners=function(){this.domElement.removeEventListener("mousedown",this._mouseDown,!1),window.removeEventListener("mousemove",this._mouseMove,!1),window.removeEventListener("mouseup",this._mouseUp,!1),this.domElement.removeEventListener("wheel",this._mouseWheel,!1),this.domElement.removeEventListener("touchstart",this._touchStart,!1),window.removeEventListener("touchend",this._touchEnd,!1),window.removeEventListener("touchmove",this._touchMove,!1)},t}(THREE.EventDispatcher);AFRAME.registerComponent("al-trackball-control",{dependencies:["camera"],schema:{animating:{type:"boolean",default:!1},controlPosition:{type:"vec3"},controlTarget:{type:"vec3"},dynamicDampingFactor:{default:.1},enabled:{type:"boolean",default:!0},maxDistance:{type:"number",default:8e3},minDistance:{type:"number",default:0},noPan:{type:"boolean",default:!1},noRotate:{type:"boolean",default:!1},noZoom:{type:"boolean",default:!1},panSpeed:{type:"number",default:.3},rotateSpeed:{type:"number",default:1},screenHeight:{type:"number",default:0},screenLeft:{type:"number",default:0},screenTop:{type:"number",default:0},screenWidth:{type:"number",default:0},staticMoving:{type:"boolean",default:!0},zoomSpeed:{type:"number",default:.5}},bindMethods:function(){this.canvasWheel=this.canvasWheel.bind(this),this.getCameraState=this.getCameraState.bind(this),this.handleAnimationCache=this.handleAnimationCache.bind(this),this.mouseDown=this.mouseDown.bind(this),this.mouseMove=this.mouseMove.bind(this),this.mouseUp=this.mouseUp.bind(this),this.onWheel=this.onWheel.bind(this)},addListeners:function(){window.addEventListener("mouseup",this.mouseUp,{capture:!1,once:!1,passive:!0}),window.addEventListener("mousemove",this.mouseMove,{capture:!1,once:!1,passive:!0}),this.el.sceneEl.canvas.addEventListener("mousedown",this.mouseDown,{capture:!1,once:!1,passive:!0}),this.el.sceneEl.canvas.addEventListener("wheel",this.canvasWheel,{capture:!1,once:!1,passive:!0}),this.el.sceneEl.oncontextmenu=function(e){e.preventDefault()},this.el.sceneEl.addEventListener(lt.ANIMATION_STARTED,this.handleAnimationCache,!1)},removeListeners:function(){window.removeEventListener("mouseup",this.mouseUp),window.removeEventListener("mousemove",this.mouseMove),this.el.sceneEl.canvas.removeEventListener("mousedown",this.mouseDown),this.el.sceneEl.canvas.removeEventListener("wheel",this.canvasWheel),this.el.sceneEl.removeEventListener(lt.ANIMATION_STARTED,this.handleAnimationCache,!1)},handleAnimationCache:function(e){this.state.animationCache=e.detail.slerpPath;var t=this.el.getObject3D("camera");this.state.cameraAnimationCache=ge.getSlerp3Path(t.up.clone(),this.state.controls.up0)},mouseUp:function(e){document.body.style.cursor="grab";var t=this.state.controls;t.enabled&&this.el.sceneEl.emit(lt.INTERACTION_FINISHED,{cameraState:this.getCameraState(),needsRender:this.state.mouseDown},!1),this.state.mouseDown=!1},mouseDown:function(e){this.state.mouseDown=!0,document.body.style.cursor="grabbing"},mouseMove:function(e){this.state.mouseDown&&this.el.sceneEl.emit(lt.INTERACTION,{cameraState:this.getCameraState(),needsRender:this.state.mouseDown},!1)},onWheel:function(){var e=this,t=this.state;t.wheelMarker=!1,t.wheelCounter2=t.wheelCounter1,setTimeout(function(){t.wheelCounter2===t.wheelCounter1?(t.wheelMarker=!0,t.wheelCounter1=0,t.wheelCounter2=0,e.el.sceneEl.emit(lt.INTERACTION_FINISHED,{cameraState:e.getCameraState(),needsRender:!0},!1)):e.onWheel()},t.wheelInterval)},canvasWheel:function(e){var t=this.state;t.wheelCounter1+=1,t.wheelMarker&&this.onWheel(),this.el.sceneEl.emit(lt.INTERACTION,{cameraState:this.getCameraState(),needsRender:!0},!1)},init:function(){var e=this,t=this.el,n=this.data;document.body.style.cursor="grab",this.tickFunction=AFRAME.utils.throttle(this.tickFunction,U.minFrameMS,this);var i=new Fy(t.getObject3D("camera"),t.sceneEl.renderer.domElement),r=ge.objectToVector3(n.controlPosition),a=ge.objectToVector3(n.controlTarget);i.object.position.copy(r),t.getObject3D("camera").position.copy(r),i.target.copy(a);var o=[];this.state={animationCache:o,cameraAnimationCache:null,controls:i,mouseDown:!1,wheelCounter1:0,wheelCounter2:void 0,wheelInterval:50,wheelMarker:!0},this.bindMethods(),this.addListeners(),ge.waitOneFrame(function(){e.el.sceneEl.emit(lt.INTERACTION,{cameraState:e.getCameraState(),needsRender:!1},!1)})},getCameraState:function(){return{position:this.state.controls.object.position,target:this.state.controls.target}},update:function(e){var t=this.state.controls,n=this.data;t.target=ge.objectToVector3(n.controlTarget),t.dynamicDampingFactor=n.dynamicDampingFactor,t.enabled=n.enabled,t.maxDistance=n.maxDistance,t.minDistance=n.minDistance,t.noPan=n.noPan,t.noRotate=n.noRotate,t.noZoom=n.noZoom,t.panSpeed=n.panSpeed,t.rotateSpeed=n.rotateSpeed,t.screen.height=n.screenHeight,t.screen.left=n.screenLeft,t.screen.top=n.screenTop,t.screen.width=n.screenWidth,t.staticMoving=n.screenHeight,t.zoomSpeed=n.zoomSpeed,this.el.getObject3D("camera").position.copy(ge.objectToVector3(n.controlPosition))},tickFunction:function(){var e=this.state.controls;if(e.enabled){if(this.data.animating&&this.state.cameraAnimationCache){var t=this.state.animationCache.shift(),n=this.state.cameraAnimationCache.shift();if(t&&t.position&&t.target){var i=this.el.getObject3D("camera");e.object.position.copy(t.position),i.position.copy(t.position),n&&i.up.copy(n),e.target.copy(t.target),this.el.sceneEl.emit(lt.INTERACTION,{cameraState:this.getCameraState(),needsRender:!0},!1)}this.state.animationCache.length===0&&(this.el.sceneEl.emit(lt.ANIMATION_FINISHED,{},!1),this.el.sceneEl.emit(lt.INTERACTION_FINISHED,{cameraState:this.getCameraState(),needsRender:!0},!1))}e.enabled&&e.update()}},tick:function(){this.tickFunction()},remove:function(){this.state.controls.reset(),this.removeListeners();var e=this.state;e.controls.dispose(),e=null}});var Hy=function(){function e(){}return e.prototype.load=function(t,n){var i=this;return new Promise(function(r,a){var o=new XMLHttpRequest,s=rt.getFileExtension(t),l=rt.getFileEndCharacters(t,3);if(Object.values(eo).includes(s)||Object.values(eo).includes(l)){var c=[t];i._loadVolume(c,r,a,n)}else o.open("GET",t,!0),o.onload=function(){var u=JSON.parse(o.responseText);u=i._mapfiles(u.baseurl,u.series),i._loadVolume(u,r,a,n)},o.onerror=function(u){a(u)},o.send()})},e.prototype._loadVolume=function(t,n,i,r){var a=new AMI.VolumeLoader(r);a.load(t).then(function(){var o=a.data[0].mergeSeries(a.data),s=o[0].stack[0];a.free(),n(s)}).catch(function(o){console.error("Volume load error"),i(o)})},e.prototype._mapfiles=function(t,n){return n.map(function(i){return t.endsWith("/")||(t+="/"),""+t+i})},e}(),bt=function(){function e(){}return e}();bt.DEFAULT_RENDER_STEPS="al-default-render-steps";bt.ERROR="al-volume-error";bt.LOADED="al-volume-loaded";bt.SLICES_MAX_INDEX="al-volume-slices-max-index";bt.VOLUME_RAY_REQUEST="al-volume-ray-requested";bt.VOLUME_RAY_CAST="al-volume-ray-cast";var Bi=function(){function e(){}return e}();Bi.CREATE="create";Bi.DRAG="drag";AFRAME.registerComponent("al-volume",{schema:{controlsType:{type:"string"},displayMode:{type:"string"},minFrameMS:{type:"number",default:15},slicesIndex:{type:"number"},slicesOrientation:{type:"string"},src:{type:"string"},srcLoaded:{type:"boolean"},volumeSteps:{type:"number"},volumeWindowCenter:{type:"number"},volumeWindowWidth:{type:"number"}},init:function(){this.tickFunction=AFRAME.utils.throttle(this.tickFunction,this.data.minFrameMS,this),this.loader=new Hy,this.state={bufferScene:new THREE.Scene,bufferSceneTextureHeight:this.el.sceneEl.canvas.clientHeight,bufferSceneTextureWidth:this.el.sceneEl.canvas.clientWidth,debounce:!1,frameTime:window.performance.now(),loaded:!1,lastRenderTime:0,volumeSteps:0},this.bindMethods(),this.addEventListeners(),this.createBufferTexture(),this.debouncedRenderBufferScene=vc.debounce(this.renderBufferScene,this.data.minFrameMS).bind(this)},bindMethods:function(){this.addEventListeners=this.addEventListeners.bind(this),this.denormaliseVolumeSteps=this.denormaliseVolumeSteps.bind(this),this.castVolumeRay=this.castVolumeRay.bind(this),this.createBufferTexture=this.createBufferTexture.bind(this),this.getDefaultVolumeSteps=this.getDefaultVolumeSteps.bind(this),this.handleStack=this.handleStack.bind(this),this.onInteraction=this.onInteraction.bind(this),this.onInteractionFinished=this.onInteractionFinished.bind(this),this.removeEventListeners=this.removeEventListeners.bind(this),this.renderBufferScene=this.renderBufferScene.bind(this),this.rendererResize=this.rendererResize.bind(this),this.updateSlicesStack=this.updateSlicesStack.bind(this),this.updateVolumeStack=this.updateVolumeStack.bind(this)},addEventListeners:function(){this.el.sceneEl.addEventListener("rendererresize",this.rendererResize,!1),this.el.sceneEl.addEventListener(lt.INTERACTION,this.onInteraction,!1),this.el.sceneEl.addEventListener(lt.INTERACTION_FINISHED,this.onInteractionFinished,!1),this.el.sceneEl.addEventListener(bt.VOLUME_RAY_REQUEST,this.castVolumeRay,!1)},removeEventListeners:function(){this.el.sceneEl.removeEventListener("rendererresize",this.rendererResize),this.el.sceneEl.removeEventListener(lt.INTERACTION,this.onInteraction),this.el.sceneEl.removeEventListener(lt.INTERACTION_FINISHED,this.onInteractionFinished),this.el.sceneEl.addEventListener(bt.VOLUME_RAY_REQUEST,this.castVolumeRay)},castVolumeRay:function(e){var t=e.detail.cameraPosition,n=e.detail.cameraDirection,i=e.detail.intersection,r=new THREE.Vector3,a=new THREE.Vector3,o=zh.volumeRay(this.state.stackhelper,t,n,U.camera.far,r,a);this.el.sceneEl.emit(bt.VOLUME_RAY_CAST,{hitPosition:r,intersection:i,rayResult:o,hitNormal:a,type:e.detail.type})},createBufferTexture:function(){this.state.bufferSceneTexture=new THREE.WebGLRenderTarget(this.state.bufferSceneTextureWidth,this.state.bufferSceneTextureHeight,{minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter}),this.el.sceneEl.object3D.background=this.state.bufferSceneTexture.texture},onInteraction:function(e){this.state.stackhelper&&e.detail.needsRender&&(this.state.volumeSteps=2)},onInteractionFinished:function(e){this.state.stackhelper&&e.detail.needsRender&&(this.state.volumeSteps=this.denormaliseVolumeSteps(this.data.volumeSteps)),this.state.debounce=!1},getDefaultVolumeSteps:function(){var e;AFRAME.utils.device.isMobile()?e=5:e=7;var t=Math.pow(2,e);return t},denormaliseVolumeSteps:function(e){var t=Math.pow(2,e*10);return t},rendererResize:function(){var e=this.state,t=e.bufferSceneTextureWidth!==this.el.sceneEl.canvas.clientWidth||e.bufferSceneTextureHeight!==this.el.sceneEl.canvas.clientHeight;t&&this.data.displayMode===Ve.VOLUME&&(e.bufferSceneTextureWidth=this.el.sceneEl.canvas.clientWidth,e.bufferSceneTextureHeight=this.el.sceneEl.canvas.clientHeight,this.state.volumeSteps=this.data.volumeSteps)},renderBufferScene:function(){if(this.data.displayMode===Ve.VOLUME){this.createBufferTexture(),this.state.stackhelper.steps=this.state.volumeSteps;var e=window.performance.now();this.el.sceneEl.renderer.setRenderTarget(this.state.bufferSceneTexture),this.el.sceneEl.renderer.render(this.state.bufferScene,this.el.sceneEl.camera),this.el.sceneEl.renderer.setRenderTarget(null);var t=window.performance.now(),n=t-e;this.state.lastRenderTime=n,this.state.volumeSteps=0}},handleStack:function(e){var t=this.state,n=this.el;switch(t.stack=e,this.data.displayMode){case Ve.SLICES:{t.stackhelper=new AMI.StackHelper(t.stack),t.stackhelper.bbox.visible=!1,t.stackhelper.border.color=U.colors.blue;break}case Ve.VOLUME:{var i=n.sceneEl.parentEl.querySelector("#lut-canvases");t.lutHelper=new AMI.LutHelper(i),t.lutHelper.luts=AMI.LutHelper.presetLuts(),t.lutHelper.lutsO=AMI.LutHelper.presetLutsO(),t.stackhelper=new AMI.VolumeRenderHelper(t.stack),t.stackhelper.textureLUT=t.lutHelper.texture,t.stackhelper.steps=this.getDefaultVolumeSteps();break}default:break}n.object3DMap.mesh&&n.removeObject3D("mesh"),this.data.displayMode===Ve.SLICES?n.setObject3D("mesh",this.state.stackhelper):(this.state.bufferScene.children.length&&this.state.bufferScene.remove(this.state.bufferScene.children[0]),this.state.bufferScene.add(this.state.stackhelper)),this.state.loaded||(n.sceneEl.emit(bt.LOADED,t.stackhelper,!1),this.state.loaded=!0)},updateSlicesStack:function(){if(!(!this.state.stackhelper||this.state.stackhelper&&!this.state.stackhelper.slice)){var e=Object.keys(yn).indexOf(this.data.slicesOrientation.toUpperCase()),t=this.state.stackhelper.stack.zCosine,n;Math.round(t.x)===1?n=1:Math.round(t.y)===1?n=2:n=0;var i=Math.round((e+n)%3),r=Math.round((e+n+2)%3),a=this.state.stackhelper.stack.dimensionsIJK[Object.keys(this.state.stackhelper.stack.dimensionsIJK)[r]]-1,o;r!==this._lastStackOrientationIndex||this.data.slicesIndex===void 0?(o=Math.floor(a*.5),this.el.sceneEl.emit(bt.SLICES_MAX_INDEX,a,!1)):o=a*this.data.slicesIndex,this._lastStackOrientationIndex=r;var s=this.state.stackhelper.stack.minMax[1],l=Math.floor(rt.reverseNumber(s*this.data.volumeWindowCenter,0,s)),c=this.state.stackhelper.stack.minMax[1]-this.state.stackhelper.stack.minMax[0],u=Math.floor(c*this.data.volumeWindowWidth);this.state.stackhelper.orientation=i,this.state.stackhelper.index=o,this.state.stackhelper.slice.windowCenter=l,this.state.stackhelper.slice.windowWidth=u}},updateVolumeStack:function(){if(this.state.stackhelper){var e=this.state.stackhelper.stack.minMax[1],t=Math.floor(rt.reverseNumber(e*this.data.volumeWindowCenter,0,e)),n=this.state.stackhelper.stack.minMax[1]-this.state.stackhelper.stack.minMax[0],i=Math.floor(n*this.data.volumeWindowWidth);this.state.stackhelper.windowCenter=t,this.state.stackhelper.windowWidth=i}},update:function(e){var t=this,n=this.state,i=this.el;if(this.data.src)switch(e&&e.src!==this.data.src?this.loader.load(this.data.src,i).then(function(r){t.handleStack(r)}):e&&e.displayMode!==this.data.displayMode&&n.stack&&(this.removeEventListeners(),this.handleStack(n.stack),this.addEventListeners(),this.data.displayMode===Ve.VOLUME?(this.createBufferTexture(),setTimeout(function(){var r=t.getDefaultVolumeSteps(),a=Math.log2(r)/10;t.el.sceneEl.emit(bt.DEFAULT_RENDER_STEPS,a,!1),t.state.volumeSteps=r},U.volumeStepsDelay)):this.el.sceneEl.object3D.background=null),this.data.displayMode){case Ve.SLICES:{this.updateSlicesStack();break}case Ve.VOLUME:{this.updateVolumeStack(),e&&e.volumeSteps!==this.data.volumeSteps&&(this.state.volumeSteps=this.denormaliseVolumeSteps(this.data.volumeSteps)),e&&e.controlsType&&e.controlsType!==this.data.controlsType&&setTimeout(function(){t.state.volumeSteps=t.denormaliseVolumeSteps(t.data.volumeSteps)},U.volumeStepsDelay),e&&e.volumeWindowCenter&&e.volumeWindowCenter!==this.data.volumeWindowCenter&&(this.state.debounce=!0,this.state.stackhelper.stack.windowCenter=this.data.volumeWindowCenter,this.state.volumeSteps=this.denormaliseVolumeSteps(this.data.volumeSteps)),e&&e.volumeWindowWidth&&e.volumeWindowWidth!==this.data.volumeWindowWidth&&(this.state.debounce=!0,this.state.stackhelper.stack.windowWidth=this.data.volumeWindowWidth,this.state.volumeSteps=this.denormaliseVolumeSteps(this.data.volumeSteps));break}default:break}},tickFunction:function(){this.state.stackhelper&&(this.data.displayMode===Ve.SLICES&&this.el.setObject3D("mesh",this.state.stackhelper),this.state.volumeSteps>0&&!this.state.debounce&&this.renderBufferScene())},tick:function(){this.tickFunction()},remove:function(){this.data.displayMode===Ve.SLICES&&this.el.removeObject3D("mesh"),this.removeEventListeners(),this.el.sceneEl.object3D.background=null}});AFRAME.registerPrimitive("al-a-camera",{defaultComponents:{camera:{},"look-controls":{},"wasd-controls":{},position:{x:0,y:1.6,z:0}},mappings:{active:"camera.active",aspect:"camera.aspect",far:"camera.far",fov:"camera.fov","look-controls-enabled":"look-controls.enabled",near:"camera.near","pointer-lock-enabled":"look-controls.pointerLockEnabled","wasd-controls-enabled":"wasd-controls.enabled","reverse-mouse-drag":"look-controls.reverseMouseDrag",zoom:"camera.zoom"}});var Uy={LOADED:"al-model-loaded",ERROR:"al-model-error"},uc={VALID_TARGET:"al-valid-target",ADD_NODE:"al-add-node"};THREE.OrbitControls=function(e,t){this.object=e,this.domElement=t!==void 0?t:document,this.enabled=!0,this.target=new THREE.Vector3,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.25,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.screenSpacePanning=!1,this.keyPanSpeed=7,this.autoRotate=!1,this.autoRotateSpeed=2,this.enableKeys=!0,this.keys={LEFT:37,UP:38,RIGHT:39,BOTTOM:40},this.mouseButtons={LEFT:THREE.MOUSE.LEFT,MIDDLE:THREE.MOUSE.MIDDLE,RIGHT:THREE.MOUSE.RIGHT},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=function(){return c.phi},this.getAzimuthalAngle=function(){return c.theta},this.saveState=function(){n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=function(){n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(i),n.update(),s=o.NONE},this.update=function(){var B=new THREE.Vector3,re=new THREE.Quaternion().setFromUnitVectors(e.up,new THREE.Vector3(0,1,0)),Se=re.clone().inverse(),Le=new THREE.Vector3,Ue=new THREE.Quaternion;return function(){var it=n.object.position;return B.copy(it).sub(n.target),B.applyQuaternion(re),c.setFromVector3(B),n.autoRotate&&s===o.NONE&&O(R()),c.theta+=u.theta,c.phi+=u.phi,c.theta=Math.max(n.minAzimuthAngle,Math.min(n.maxAzimuthAngle,c.theta)),c.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,c.phi)),c.makeSafe(),c.radius*=h,c.radius=Math.max(n.minDistance,Math.min(n.maxDistance,c.radius)),n.target.add(d),B.setFromSpherical(c),B.applyQuaternion(Se),it.copy(n.target).add(B),n.object.lookAt(n.target),n.enableDamping===!0?(u.theta*=1-n.dampingFactor,u.phi*=1-n.dampingFactor,d.multiplyScalar(1-n.dampingFactor)):(u.set(0,0,0),d.set(0,0,0)),h=1,f||Le.distanceToSquared(n.object.position)>l||8*(1-Ue.dot(n.object.quaternion))>l?(n.dispatchEvent(i),Le.copy(n.object.position),Ue.copy(n.object.quaternion),f=!1,!0):!1}}(),this.dispose=function(){n.domElement.removeEventListener("contextmenu",ee,!1),n.domElement.removeEventListener("mousedown",xe,!1),n.domElement.removeEventListener("wheel",M,!1),n.domElement.removeEventListener("touchstart",Q,!1),n.domElement.removeEventListener("touchend",he,!1),n.domElement.removeEventListener("touchmove",_e,!1),document.removeEventListener("mousemove",Ne,!1),document.removeEventListener("mouseup",A,!1),window.removeEventListener("keydown",W,!1)};var n=this,i={type:"change"},r={type:"start"},a={type:"end"},o={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_DOLLY_PAN:4},s=o.NONE,l=1e-6,c=new THREE.Spherical,u=new THREE.Spherical,h=1,d=new THREE.Vector3,f=!1,p=new THREE.Vector2,v=new THREE.Vector2,m=new THREE.Vector2,g=new THREE.Vector2,y=new THREE.Vector2,b=new THREE.Vector2,_=new THREE.Vector2,w=new THREE.Vector2,L=new THREE.Vector2;function R(){return 2*Math.PI/60/60*n.autoRotateSpeed}function k(){return Math.pow(.95,n.zoomSpeed)}function O(B){u.theta-=B}function z(B){u.phi-=B}var C=function(){var B=new THREE.Vector3;return function(Se,Le){B.setFromMatrixColumn(Le,0),B.multiplyScalar(-Se),d.add(B)}}(),I=function(){var B=new THREE.Vector3;return function(Se,Le){n.screenSpacePanning===!0?B.setFromMatrixColumn(Le,1):(B.setFromMatrixColumn(Le,0),B.crossVectors(n.object.up,B)),B.multiplyScalar(Se),d.add(B)}}(),N=function(){var B=new THREE.Vector3;return function(Se,Le){var Ue=n.domElement===document?n.domElement.body:n.domElement;if(n.object.isPerspectiveCamera){var Ee=n.object.position;B.copy(Ee).sub(n.target);var it=B.length();it*=Math.tan(n.object.fov/2*Math.PI/180),C(2*Se*it/Ue.clientHeight,n.object.matrix),I(2*Le*it/Ue.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(C(Se*(n.object.right-n.object.left)/n.object.zoom/Ue.clientWidth,n.object.matrix),I(Le*(n.object.top-n.object.bottom)/n.object.zoom/Ue.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function H(B){n.object.isPerspectiveCamera?h/=B:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom*B)),n.object.updateProjectionMatrix(),f=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function G(B){n.object.isPerspectiveCamera?h*=B:n.object.isOrthographicCamera?(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/B)),n.object.updateProjectionMatrix(),f=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function X(B){p.set(B.clientX,B.clientY)}function Z(B){_.set(B.clientX,B.clientY)}function V(B){g.set(B.clientX,B.clientY)}function Y(B){v.set(B.clientX,B.clientY),m.subVectors(v,p).multiplyScalar(n.rotateSpeed);var re=n.domElement===document?n.domElement.body:n.domElement;O(2*Math.PI*m.x/re.clientHeight),z(2*Math.PI*m.y/re.clientHeight),p.copy(v),n.update()}function J(B){w.set(B.clientX,B.clientY),L.subVectors(w,_),L.y>0?H(k()):L.y<0&&G(k()),_.copy(w),n.update()}function ie(B){y.set(B.clientX,B.clientY),b.subVectors(y,g).multiplyScalar(n.panSpeed),N(b.x,b.y),g.copy(y),n.update()}function ce(B){B.deltaY<0?G(k()):B.deltaY>0&&H(k()),n.update()}function Re(B){var re=!1;switch(B.keyCode){case n.keys.UP:N(0,n.keyPanSpeed),re=!0;break;case n.keys.BOTTOM:N(0,-n.keyPanSpeed),re=!0;break;case n.keys.LEFT:N(n.keyPanSpeed,0),re=!0;break;case n.keys.RIGHT:N(-n.keyPanSpeed,0),re=!0;break}re&&(B.preventDefault(),n.update())}function F(B){p.set(B.touches[0].pageX,B.touches[0].pageY)}function ue(B){if(n.enableZoom){var re=B.touches[0].pageX-B.touches[1].pageX,Se=B.touches[0].pageY-B.touches[1].pageY,Le=Math.sqrt(re*re+Se*Se);_.set(0,Le)}if(n.enablePan){var Ue=.5*(B.touches[0].pageX+B.touches[1].pageX),Ee=.5*(B.touches[0].pageY+B.touches[1].pageY);g.set(Ue,Ee)}}function K(B){v.set(B.touches[0].pageX,B.touches[0].pageY),m.subVectors(v,p).multiplyScalar(n.rotateSpeed);var re=n.domElement===document?n.domElement.body:n.domElement;O(2*Math.PI*m.x/re.clientHeight),z(2*Math.PI*m.y/re.clientHeight),p.copy(v),n.update()}function be(B){if(n.enableZoom){var re=B.touches[0].pageX-B.touches[1].pageX,Se=B.touches[0].pageY-B.touches[1].pageY,Le=Math.sqrt(re*re+Se*Se);w.set(0,Le),L.set(0,Math.pow(w.y/_.y,n.zoomSpeed)),H(L.y),_.copy(w)}if(n.enablePan){var Ue=.5*(B.touches[0].pageX+B.touches[1].pageX),Ee=.5*(B.touches[0].pageY+B.touches[1].pageY);y.set(Ue,Ee),b.subVectors(y,g).multiplyScalar(n.panSpeed),N(b.x,b.y),g.copy(y)}n.update()}function xe(B){if(n.enabled!==!1){switch(B.preventDefault(),n.domElement.focus?n.domElement.focus():window.focus(),B.button){case n.mouseButtons.LEFT:if(B.ctrlKey||B.metaKey||B.shiftKey){if(n.enablePan===!1)return;V(B),s=o.PAN}else{if(n.enableRotate===!1)return;X(B),s=o.ROTATE}break;case n.mouseButtons.MIDDLE:if(n.enableZoom===!1)return;Z(B),s=o.DOLLY;break;case n.mouseButtons.RIGHT:if(n.enablePan===!1)return;V(B),s=o.PAN;break}s!==o.NONE&&(document.addEventListener("mousemove",Ne,!1),document.addEventListener("mouseup",A,!1),n.dispatchEvent(r))}}function Ne(B){if(n.enabled!==!1)switch(B.preventDefault(),s){case o.ROTATE:if(n.enableRotate===!1)return;Y(B);break;case o.DOLLY:if(n.enableZoom===!1)return;J(B);break;case o.PAN:if(n.enablePan===!1)return;ie(B);break}}function A(B){n.enabled!==!1&&(document.removeEventListener("mousemove",Ne,!1),document.removeEventListener("mouseup",A,!1),n.dispatchEvent(a),s=o.NONE)}function M(B){n.enabled===!1||n.enableZoom===!1||s!==o.NONE&&s!==o.ROTATE||(B.preventDefault(),B.stopPropagation(),n.dispatchEvent(r),ce(B),n.dispatchEvent(a))}function W(B){n.enabled===!1||n.enableKeys===!1||n.enablePan===!1||Re(B)}function Q(B){if(n.enabled!==!1){switch(B.preventDefault(),B.touches.length){case 1:if(n.enableRotate===!1)return;F(B),s=o.TOUCH_ROTATE;break;case 2:if(n.enableZoom===!1&&n.enablePan===!1)return;ue(B),s=o.TOUCH_DOLLY_PAN;break;default:s=o.NONE}s!==o.NONE&&n.dispatchEvent(r)}}function _e(B){if(n.enabled!==!1)switch(B.preventDefault(),B.stopPropagation(),B.touches.length){case 1:if(n.enableRotate===!1||s!==o.TOUCH_ROTATE)return;K(B);break;case 2:if(n.enableZoom===!1&&n.enablePan===!1||s!==o.TOUCH_DOLLY_PAN)return;be(B);break;default:s=o.NONE}}function he(B){n.enabled!==!1&&(n.dispatchEvent(a),s=o.NONE)}function ee(B){n.enabled!==!1&&B.preventDefault()}n.domElement.addEventListener("contextmenu",ee,!1),n.domElement.addEventListener("mousedown",xe,!1),n.domElement.addEventListener("wheel",M,!1),n.domElement.addEventListener("touchstart",Q,!1),n.domElement.addEventListener("touchend",he,!1),n.domElement.addEventListener("touchmove",_e,!1),window.addEventListener("keydown",W,!1),this.update()};THREE.OrbitControls.prototype=Object.create(THREE.EventDispatcher.prototype);THREE.OrbitControls.prototype.constructor=THREE.OrbitControls;Object.defineProperties(THREE.OrbitControls.prototype,{center:{get:function(){return console.warn("THREE.OrbitControls: .center has been renamed to .target"),this.target}},noZoom:{get:function(){return console.warn("THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead."),!this.enableZoom},set:function(e){console.warn("THREE.OrbitControls: .noZoom has been deprecated. Use .enableZoom instead."),this.enableZoom=!e}},noRotate:{get:function(){return console.warn("THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead."),!this.enableRotate},set:function(e){console.warn("THREE.OrbitControls: .noRotate has been deprecated. Use .enableRotate instead."),this.enableRotate=!e}},noPan:{get:function(){return console.warn("THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead."),!this.enablePan},set:function(e){console.warn("THREE.OrbitControls: .noPan has been deprecated. Use .enablePan instead."),this.enablePan=!e}},noKeys:{get:function(){return console.warn("THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead."),!this.enableKeys},set:function(e){console.warn("THREE.OrbitControls: .noKeys has been deprecated. Use .enableKeys instead."),this.enableKeys=!e}},staticMoving:{get:function(){return console.warn("THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead."),!this.enableDamping},set:function(e){console.warn("THREE.OrbitControls: .staticMoving has been deprecated. Use .enableDamping instead."),this.enableDamping=!e}},dynamicDampingFactor:{get:function(){return console.warn("THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead."),this.dampingFactor},set:function(e){console.warn("THREE.OrbitControls: .dynamicDampingFactor has been renamed. Use .dampingFactor instead."),this.dampingFactor=e}}});var Gy=function(e,t){var n=e.angles,i=e.boundingSphereRadius,r=e.camera,a=e.cameraPosition,o=e.controlsType,s=e.edges,l=e.edgeMinSize,c=e.edgeSize,u=e.fontSize,h=e.nodes,d=e.selected;return function(){return Array.from(n).map(function(f){var p=f[0],v=f[1],m=s.get(v.edge1Id),g=s.get(v.edge2Id);if(m&&g){var y=void 0,b=void 0,_=void 0;m.node1Id===g.node1Id?(y=h.get(g.node1Id),b=h.get(m.node2Id),_=h.get(g.node2Id)):m.node1Id===g.node2Id?(y=h.get(g.node2Id),b=h.get(m.node2Id),_=h.get(g.node1Id)):m.node2Id===g.node1Id?(y=h.get(g.node1Id),b=h.get(m.node1Id),_=h.get(g.node2Id)):m.node2Id===g.node2Id&&(y=h.get(g.node2Id),b=h.get(m.node1Id),_=h.get(g.node1Id));var w=i*c>l?i*c:l,L=ge.stringToVector3(b.position),R=ge.stringToVector3(_.position),k=ge.stringToVector3(y.position),O=L.clone().sub(k).normalize(),z=R.clone().sub(k).normalize(),C=z.angleTo(O),I=Math.min(k.distanceTo(L),k.distanceTo(R)),N=Math.min(I*.25,w*25);N=Math.max(N,w*10);var H=O.clone().multiplyScalar(N),G=z.clone().multiplyScalar(N),X=H.clone().distanceTo(G.clone()),Z=H.clone().add(G.clone()).divideScalar(2),V=new THREE.Vector3(0,2.5,0),Y=(b.scale+_.scale+y.scale)/3;V.multiplyScalar(Y);var J=THREE.Math.radToDeg(C).toFixed(U.textUnitsDecimalPlaces),ie=J+" "+(parseInt(J)==1?"degree":"degrees"),ce=ge.getFrustrumSpaceDistance(r,k.clone(),a),Re=1,F=ce/i*U.frustrumScaleFactor;return T("a-entity",{"al-child-hover-visible":!0,id:p+"-parent"},T("a-entity",{position:ge.vector3ToString(k),id:p+"-title-anchor","al-billboard":`
              controlsType: `+o+`;
              cameraPosition: `+ge.vector3ToString(r.position)+`;
              worldPosition: `+ge.vector3ToString(k.clone().add(V.clone()))+`;
            `},T("a-entity",{id:p+"-title",text:`
                  value: `+ie+`;
                  side: double;
                  align: center;
                  baseline: bottom;
                  anchor: center;
                  width: `+u*i+`;
                  zOffset: `+1e-7+`;
                `,position:ge.vector3ToString(V),visible:""+(d===p),scale:" "+F+" "+F+" "+F+";","al-background":`
                    text: `+ie+`;
                    boundingRadius: `+u*i+`;
                `,"al-render-overlaid":!0})),T("a-entity",{"data-raycastable":!0,id:p,position:y.position,"al-angle":`
                selected: `+(d===p)+`;
                edge0Pos: `+ge.vector3ToString(H)+`;
                edge1Pos: `+ge.vector3ToString(G)+`;
                position: `+ge.vector3ToString(Z)+`;
                length: `+X+`;
                radius: `+w+`;
                angle: `+v+`;
                scale: `+Re+`;
              `}))}})}()},Vy=function(e,t){var n=e.boundingBox,i=e.boundingBoxEnabled,r=e.cb,a=e.color,o=e.displayMode,s=e.graphEnabled,l=e.mesh,c=e.srcLoaded,u=e.targetEntity;return function(){if(c){if(!l)return null;var h=new THREE.Vector3;n.getSize(h);var d=l.geometry,f=void 0;if(o===Ve.VOLUME)return f=u.object3D.position.clone().add(rt.getGeometryCenter(d)),T("a-entity",{"data-raycastable":!0,position:ge.vector3ToString(f),"al-bounding-box":`
              scale: `+ge.vector3ToString(h)+`;
              color: `+a+`;
              enabled: `+i+`;
            `,"al-node-spawner":`
              graphEnabled: `+s+`;
            `,ref:function(v){return r(v)}});if(o===Ve.SLICES)return f=u.object3D.position.clone().add(rt.getGeometryCenter(d)),T("a-entity",{position:ge.vector3ToString(f),"al-bounding-box":`
              scale: `+ge.vector3ToString(h)+`;
              color: `+a+`;
              enabled: `+i+`;
            `,ref:function(v){return r(v)}});var p=n.getCenter(new THREE.Vector3);return f=new THREE.Vector3,f.x-=u.object3D.position.x-p.x,f.y-=u.object3D.position.y-p.y,f.z-=u.object3D.position.z-p.z,T("a-entity",{position:ge.vector3ToString(f),"al-bounding-box":`
              scale: `+ge.vector3ToString(h)+`;
              color: `+a+`;
              enabled: `+i+`;
            `,ref:function(v){return r(v)}})}else return null}()},Wy=function(e,t,n){if(t===Ve.MESH)switch(n){case Wt.METERS:return e.toFixed(U.textUnitsDecimalPlaces)+" "+n;case Wt.MILLIMETERS:return(e/.001).toFixed(U.textUnitsDecimalPlaces)+" "+n;default:break}else switch(n){case Wt.METERS:return(e/1e3).toFixed(U.textUnitsDecimalPlaces)+" "+n;case Wt.MILLIMETERS:return e.toFixed(U.textUnitsDecimalPlaces)+" "+n;default:break}},jy=function(e,t){var n=e.boundingSphereRadius,i=e.camera,r=e.cameraPosition,a=e.controlsType,o=e.displayMode,s=e.edges,l=e.edgeSize,c=e.fontSize,u=e.edgeMinSize,h=e.nodes,d=e.selected,f=e.units;return function(){return Array.from(s).map(function(p){var v=p[0],m=p[1],g=h.get(m.node1Id),y=h.get(m.node2Id);if(g&&y){var b=ge.stringToVector3(g.position),_=ge.stringToVector3(y.position),w=_.clone().sub(b),L=w.length();w=w.normalize().multiplyScalar(L*.5);var R=b.clone().add(w),k=new THREE.Vector3(0,2.5,0),O=(g.scale+y.scale)/2,z=n*l>u?n*l:u;k.multiplyScalar(O);var C=Wy(L,o,f),I=ge.getFrustrumSpaceDistance(i,R.clone(),r),N=1,H=I/n*U.frustrumScaleFactor;return T("a-entity",{"al-child-hover-visible":!0,id:v+"-parent"},T("a-entity",{position:ge.vector3ToString(R),id:v+"-title-anchor","al-billboard":`
              controlsType: `+a+`;
              cameraPosition: `+ge.vector3ToString(i.position)+`;
              worldPosition: `+ge.vector3ToString(R.clone().add(k.clone()))+`;
            `},T("a-entity",{id:v+"-title",text:`
                  value: `+C+`;
                  side: double;
                  align: center;
                  baseline: bottom;
                  anchor: center;
                  width: `+c*n+`;
                  zOffset: `+1e-7+`;
                `,position:ge.vector3ToString(k),"al-render-overlaid":!0,visible:""+(d===v),"al-background":`
                  text: `+C+`;
                  boundingRadius: `+c*n+`;
                `,scale:" "+H+" "+H+" "+H+";"})),T("a-entity",{"data-raycastable":!0,id:v,position:ge.vector3ToString(R),"al-edge":`
                length: `+L+`;
                node1: `+g.position+`;
                node2: `+y.position+`;
                selected: `+(d===v)+`;
                radius: `+z+`;
                nodeScale: `+O+`;
                scale: `+N+`;
              `}))}})}()},Yy=function(e,t){var n=e.ambientLightColor,i=e.ambientLightIntensity;return T("a-entity",{id:"ambient-light",light:"type: ambient; color: "+n+"; intensity: "+i})},Xy=function(e,t){var n=e.boundingSphereRadius,i=e.camera,r=e.cameraPosition,a=e.controlsType,o=e.fontSize,s=e.graphEnabled,l=e.nodes,c=e.nodeLabelsAlwaysVisible,u=e.selected;return function(){return Array.from(l).map(function(h){var d=h[0],f=h[1],p=ge.getFrustrumSpaceDistance(i,ge.stringToVector3(f.position),r),v=1,m=p/n*U.frustrumScaleFactor,g=new THREE.Vector3(0,3*v,0);return g.multiplyScalar(f.scale),T("a-entity",{"al-child-hover-visible":"nodeLabelsAlwaysVisible: "+(c===!0),id:d+"-parent"},T("a-entity",{position:f.position,id:d+"-title-anchor","al-billboard":`
              controlsType: `+a+`;
              cameraPosition: `+ge.vector3ToString(i.position)+`;
              worldPosition: `+ge.vector3ToString(ge.stringToVector3(f.position).add(g.clone()))+`;
            `},T("a-entity",{text:`
                value: `+f.title+`;
                side: double;
                align: center;
                baseline: bottom;
                anchor: center;
                width: `+o*n+`;
                zOffset: `+1e-7+`;
              `,position:ge.vector3ToString(g),"al-render-overlaid":!0,visible:""+(u===d),id:d+"-label","al-background":`
                  text: `+f.title+`;
                  boundingRadius: `+o*n+`;
              `,scale:" "+m+" "+m+" "+m+";"})),T("a-entity",{"data-raycastable":!0,id:d,position:f.position,"al-node":`
              scale: `+f.scale+`;
              selected: `+(u===d)+`;
              graphEnabled: `+s+`;
            `,scale:" "+v+" "+v+" "+v+";"}))})}()},Zy=function(e,t){var n=e.animating,i=e.aspect,r=e.cb,a=e.controlPosition,o=e.controlTarget,s=e.dampingFactor,l=e.enabled,c=e.far,u=e.fov,h=e.graphEnabled,d=e.maxDistance,f=e.maxPolarAngle,p=e.minDistance,v=e.minPolarAngle,m=e.near,g=e.panSpeed,y=e.rotateSpeed,b=e.zoomSpeed;return function(){return h?T("al-a-camera",{fov:u,near:m,aspect:i,"look-controls":"enabled: false",far:c,id:"mainCamera",raycaster:"objects: [data-raycastable]","al-cursor":"rayOrigin: mouse","al-orbit-control":`
            minDistance: `+p+`;
            minPolarAngle: `+v+`;
            maxDistance: `+d+`;
            maxPolarAngle: `+f+`;
            screenSpacePanning: true;
            rotateSpeed: `+y+`;
            zoomSpeed: `+b+`;
            enableDamping: true;
            dampingFactor: `+s+`;
            controlTarget: `+o+`;
            controlPosition: `+a+`;
            enabled: `+l+`;
            animating: `+n+`;
            panSpeed: `+g+`
          `,"al-control-lights":!0,ref:function(_){return r(_)}}):T("al-a-camera",{fov:u,near:m,aspect:i,"look-controls":"enabled: false",far:c,id:"mainCamera","al-orbit-control":`
            minDistance: `+p+`;
            minPolarAngle: `+v+`;
            maxDistance: `+d+`;
            maxPolarAngle: `+f+`;
            screenSpacePanning: true;
            rotateSpeed: `+y+`;
            zoomSpeed: `+b+`;
            enableDamping: true;
            dampingFactor: `+s+`;
            controlTarget: `+o+`;
            controlPosition: `+a+`;
            enabled: `+l+`;
            animating: `+n+`;
            panSpeed: `+g+`
          `,"al-control-lights":!0,ref:function(_){return r(_)}})}()},qy=function(e,t){var n=e.cb,i=e.isWebGl2;return T("a-scene",{embedded:!0,renderer:`
      colorManagement: true;
      sortObjects: true;
      webgl2: `+i+`;
      antialias: true;
    `,"vr-mode-ui":"enabled: false",ref:function(r){return n(r)}},t)},Jy=function(e,t){var n=e.cb,i=e.controlsType,r=e.displayMode,a=e.dracoDecoderPath,o=e.envMapPath,s=e.graphEnabled,l=e.orientation,c=e.slicesIndex,u=e.src,h=e.srcLoaded,d=e.volumeSteps,f=e.volumeWindowCenter,p=e.volumeWindowWidth;return function(){if(u)switch(r){case Ve.MESH:return T("a-entity",{"data-raycastable":!0,"al-node-spawner":`
                graphEnabled: `+s+`;
              `,"al-gltf-model":`
                src: url(`+u+`);
                dracoDecoderPath: `+a+`;
              `,"al-cube-env-map":`
                path: `+(o||"")+`;
              `,position:"0 0 0",scale:"1 1 1",ref:function(v){return n(v)}});case Ve.SLICES:return T("a-entity",{id:"target-entity","data-raycastable":!0,"al-node-spawner":`
                graphEnabled: `+s+`;
              `,"al-volume":`
                controlsType: `+i+`;
                displayMode: `+r+`;
                slicesIndex: `+c+`;
                slicesOrientation: `+l+`;
                src: `+u+`;
                srcLoaded: `+h+`;
                volumeSteps: `+d+`;
                volumeWindowCenter: `+f+`;
                volumeWindowWidth: `+p+`;
              `,position:"0 0 0",ref:function(v){return n(v)}});case Ve.VOLUME:return T("a-entity",{id:"target-entity","al-volume":`
                controlsType: `+i+`;
                displayMode: `+r+`;
                slicesIndex: `+c+`;
                slicesOrientation: `+l+`;
                src: `+u+`;
                srcLoaded: `+h+`;
                volumeSteps: `+d+`;
                volumeWindowCenter: `+f+`;
                volumeWindowWidth: `+p+`;
              `,position:"0 0 0",ref:function(v){return n(v)}});default:return}else return null}()},Qy=function(e,t){var n=e.animating,i=e.aspect,r=e.cb,a=e.controlPosition,o=e.controlTarget,s=e.dampingFactor,l=e.enabled,c=e.far,u=e.fov,h=e.graphEnabled,d=e.maxDistance,f=e.near,p=e.panSpeed,v=e.rotateSpeed,m=e.screenHeight,g=e.screenWidth,y=e.zoomSpeed;return function(){return h?T("al-a-camera",{fov:u,near:f,aspect:i,"look-controls":"enabled: false",far:c,id:"mainCamera",raycaster:"objects: [data-raycastable]","al-cursor":"rayOrigin: mouse","al-trackball-control":`
            screenLeft: 0;
            screenTop: 0;
            screenWidth: `+g+`;
            screenHeight: `+m+`;
            rotateSpeed: `+v+`;
            zoomSpeed: `+y+`;
            panSpeed: `+p+`;
            maxDistance: `+d+`;
            dynamicDampingFactor: `+s+`;
            controlTarget: `+o+`;
            controlPosition: `+a+`;
            enabled: `+l+`;
            animating: `+n+`
          `,"al-control-lights":!0,ref:function(b){return r(b)}}):T("al-a-camera",{fov:u,near:f,aspect:i,"look-controls":"enabled: false",far:c,id:"mainCamera","al-trackball-control":`
            screenLeft: 0;
            screenTop: 0;
            screenWidth: `+g+`;
            screenHeight: `+m+`;
            rotateSpeed: `+v+`;
            zoomSpeed: `+y+`;
            panSpeed: `+p+`;
            maxDistance: `+d+`;
            dynamicDampingFactor: `+s+`;
            controlTarget: `+o+`;
            controlPosition: `+a+`;
            enabled: `+l+`;
            animating: `+n+`
          `,"al-control-lights":!0,ref:function(b){return r(b)}})}()},fe;(function(e){e.NULL="NULL",e.ERROR="ERROR",e.APP_CLEAR_ANGLES="APP_LOAD_ANGLES",e.APP_CLEAR_EDGES="APP_LOAD_EDGES",e.APP_CLEAR_NODES="APP_LOAD_NODES",e.APP_DELETE_ANGLE="APP_DELETE_ANGLE",e.APP_DELETE_EDGE="APP_DELETE_EDGE",e.APP_DELETE_NODE="APP_DELETE_NODE",e.APP_SELECT_ANGLE="APP_SELECT_ANGLE",e.APP_SELECT_EDGE="APP_SELECT_EDGE",e.APP_SELECT_NODE="APP_SELECT_NODE",e.APP_SET_ANGLE="APP_SET_ANGLE",e.APP_SET_BOUNDINGBOX_ENABLED="APP_SET_BOUNDINGBOX_ENABLED",e.APP_SET_CAMERA="APP_SET_CAMERA",e.APP_SET_CONTROLS_ENABLED="APP_SET_CONTROLS_ENABLED",e.APP_SET_CONTROLS_TYPE="APP_SET_CONTROLS_TYPE",e.APP_SET_DISPLAY_MODE="APP_SET_DISPLAY_MODE",e.APP_SET_EDGE="APP_SET_EDGE",e.APP_SET_MATERIAL="APP_SET_MATERIAL",e.APP_SET_NODE="APP_SET_NODE",e.APP_SET_NODES_ENABLED="APP_SET_NODES_ENABLED",e.APP_SET_NODE_LABELS_ALWAYS_VISIBLE="APP_SET_NODE_LABELS_ALWAYS_VISIBLE",e.APP_SET_ORIENTATION="APP_SET_ORIENTATION",e.APP_SET_SCENE_DISTANCE="APP_SET_SCENE_DISTANCE",e.APP_SET_SLICES_INDEX="APP_SET_SLICES_INDEX",e.APP_SET_SLICES_MAX_INDEX="APP_SET_SLICES_MAX_INDEX",e.APP_SET_SLICES_WINDOW_CENTER="APP_SET_SLICES_WINDOW_CENTER",e.APP_SET_SLICES_WINDOW_WIDTH="APP_SET_SLICES_WINDOW_WIDTH",e.APP_SET_SRC="APP_SET_SRC",e.APP_SET_SRC_LOADED="APP_SET_SRC_LOADED",e.APP_SET_UNITS="APP_SET_UNITS",e.APP_SET_VOLUME_STEPS="APP_SET_VOLUME_STEPS",e.APP_SET_VOLUME_WINDOW_CENTER="APP_SET_VOLUME_WINDOW_CENTER",e.APP_SET_VOLUME_WINDOW_WIDTH="APP_SET_VOLUME_WINDOW_WIDTH"})(fe||(fe={}));var $y=function(e){return function(t,n){return te(qe,void 0,void 0,function(){return ne(this,function(i){return[2,t({type:fe.APP_SET_SRC,payload:e})]})})}},Ky=function(e){return function(t,n){return te(qe,void 0,void 0,function(){return ne(this,function(i){return[2,t({type:fe.APP_SET_SRC_LOADED,payload:e})]})})}},eb=function(e){return function(t,n){return te(qe,void 0,void 0,function(){return ne(this,function(i){return[2,t({type:fe.APP_SET_NODE,payload:e})]})})}},tb=function(e){return function(t,n){return te(qe,void 0,void 0,function(){return ne(this,function(i){return[2,t({type:fe.APP_DELETE_NODE,payload:e})]})})}},nb=function(e){return function(t,n){return te(qe,void 0,void 0,function(){return ne(this,function(i){return[2,t({type:fe.APP_SELECT_NODE,payload:e})]})})}},ib=function(e){return function(t,n){return te(qe,void 0,void 0,function(){return ne(this,function(i){return[2,t({type:fe.APP_CLEAR_NODES,payload:e})]})})}},rb=function(e){return function(t,n){return te(qe,void 0,void 0,function(){return ne(this,function(i){return[2,t({type:fe.APP_SET_EDGE,payload:e})]})})}},ab=function(e){return function(t,n){return te(qe,void 0,void 0,function(){return ne(this,function(i){return[2,t({type:fe.APP_DELETE_EDGE,payload:e})]})})}},ob=function(e){return function(t,n){return te(qe,void 0,void 0,function(){return ne(this,function(i){return[2,t({type:fe.APP_SELECT_EDGE,payload:e})]})})}},sb=function(e){return function(t,n){return te(qe,void 0,void 0,function(){return ne(this,function(i){return[2,t({type:fe.APP_CLEAR_EDGES,payload:e})]})})}},lb=function(e){return function(t,n){return te(qe,void 0,void 0,function(){return ne(this,function(i){return[2,t({type:fe.APP_SET_ANGLE,payload:e})]})})}},cb=function(e){return function(t,n){return te(qe,void 0,void 0,function(){return ne(this,function(i){return[2,t({type:fe.APP_DELETE_ANGLE,payload:e})]})})}},ub=function(e){return function(t,n){return te(qe,void 0,void 0,function(){return ne(this,function(i){return[2,t({type:fe.APP_SELECT_ANGLE,payload:e})]})})}},hb=function(e){return function(t,n){return te(qe,void 0,void 0,function(){return ne(this,function(i){return[2,t({type:fe.APP_CLEAR_ANGLES,payload:e})]})})}},db=function(e){return function(t,n){return te(qe,void 0,void 0,function(){return ne(this,function(i){return[2,t({type:fe.APP_SET_BOUNDINGBOX_ENABLED,payload:e})]})})}},fb=function(e){return function(t,n){return te(qe,void 0,void 0,function(){return ne(this,function(i){return[2,t({type:fe.APP_SET_DISPLAY_MODE,payload:e})]})})}},pb=function(e){return function(t,n){return te(qe,void 0,void 0,function(){return ne(this,function(i){return[2,t({type:fe.APP_SET_NODES_ENABLED,payload:e})]})})}},mb=function(e){return function(t,n){return te(qe,void 0,void 0,function(){return ne(this,function(i){return[2,t({type:fe.APP_SET_MATERIAL,payload:e})]})})}},vb=function(e){return function(t,n){return te(qe,void 0,void 0,function(){return ne(this,function(i){return[2,t({type:fe.APP_SET_NODE_LABELS_ALWAYS_VISIBLE,payload:e})]})})}},gb=function(e){return function(t,n){return te(qe,void 0,void 0,function(){return ne(this,function(i){return[2,t({type:fe.APP_SET_UNITS,payload:e})]})})}},yb=function(e){return function(t,n){return te(qe,void 0,void 0,function(){return ne(this,function(i){return[2,t({type:fe.APP_SET_ORIENTATION,payload:e})]})})}},bb=function(e){return function(t,n){return te(qe,void 0,void 0,function(){return ne(this,function(i){return[2,t({type:fe.APP_SET_SCENE_DISTANCE,payload:e})]})})}},xb=function(e){return function(t,n){return te(qe,void 0,void 0,function(){return ne(this,function(i){return[2,t({type:fe.APP_SET_SLICES_INDEX,payload:e})]})})}},_b=function(e){return function(t,n){return te(qe,void 0,void 0,function(){return ne(this,function(i){return[2,t({type:fe.APP_SET_SLICES_MAX_INDEX,payload:e})]})})}},wb=function(e){return function(t,n){return te(qe,void 0,void 0,function(){return ne(this,function(i){return[2,t({type:fe.APP_SET_VOLUME_STEPS,payload:e})]})})}},Eb=function(e){return function(t,n){return te(qe,void 0,void 0,function(){return ne(this,function(i){return[2,t({type:fe.APP_SET_VOLUME_WINDOW_WIDTH,payload:e})]})})}},Mb=function(e){return function(t,n){return te(qe,void 0,void 0,function(){return ne(this,function(i){return[2,t({type:fe.APP_SET_VOLUME_WINDOW_CENTER,payload:e})]})})}},Sb=function(e){return function(t,n){return te(qe,void 0,void 0,function(){return ne(this,function(i){return[2,t({type:fe.APP_SET_CAMERA,payload:e})]})})}},Tb=function(e){return function(t,n){return te(qe,void 0,void 0,function(){return ne(this,function(i){return[2,t({type:fe.APP_SET_CONTROLS_ENABLED,payload:e})]})})}},Ab=function(e){return function(t,n){return te(qe,void 0,void 0,function(){return ne(this,function(i){return[2,t({type:fe.APP_SET_CONTROLS_TYPE,payload:e})]})})}};function Lb(e){var t,n=e.Symbol;return typeof n=="function"?n.observable?t=n.observable:(t=n("observable"),n.observable=t):t="@@observable",t}var ki;typeof self<"u"?ki=self:typeof window<"u"?ki=window:typeof global<"u"?ki=global:typeof module<"u"?ki=module:ki=Function("return this")();var hc=Lb(ki),hs=function(){return Math.random().toString(36).substring(7).split("").join(".")},Ir={INIT:"@@redux/INIT"+hs(),REPLACE:"@@redux/REPLACE"+hs(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+hs()}};function Cb(e){if(typeof e!="object"||e===null)return!1;for(var t=e;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function sh(e,t,n){var i;if(typeof t=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error("It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function");if(typeof t=="function"&&typeof n>"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error("Expected the enhancer to be a function.");return n(sh)(e,t)}if(typeof e!="function")throw new Error("Expected the reducer to be a function.");var r=e,a=t,o=[],s=o,l=!1;function c(){s===o&&(s=o.slice())}function u(){if(l)throw new Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return a}function h(v){if(typeof v!="function")throw new Error("Expected the listener to be a function.");if(l)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribe(listener) for more details.");var m=!0;return c(),s.push(v),function(){if(m){if(l)throw new Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribe(listener) for more details.");m=!1,c();var y=s.indexOf(v);s.splice(y,1)}}}function d(v){if(!Cb(v))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(typeof v.type>"u")throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(l)throw new Error("Reducers may not dispatch actions.");try{l=!0,a=r(a,v)}finally{l=!1}for(var m=o=s,g=0;g<m.length;g++){var y=m[g];y()}return v}function f(v){if(typeof v!="function")throw new Error("Expected the nextReducer to be a function.");r=v,d({type:Ir.REPLACE})}function p(){var v,m=h;return v={subscribe:function(y){if(typeof y!="object"||y===null)throw new TypeError("Expected the observer to be an object.");function b(){y.next&&y.next(u())}b();var _=m(b);return{unsubscribe:_}}},v[hc]=function(){return this},v}return d({type:Ir.INIT}),i={dispatch:d,subscribe:h,getState:u,replaceReducer:f},i[hc]=p,i}function Rb(e,t){var n=t&&t.type,i=n&&'action "'+String(n)+'"'||"an action";return"Given "+i+', reducer "'+e+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.'}function Ib(e){Object.keys(e).forEach(function(t){var n=e[t],i=n(void 0,{type:Ir.INIT});if(typeof i>"u")throw new Error('Reducer "'+t+`" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);if(typeof n(void 0,{type:Ir.PROBE_UNKNOWN_ACTION()})>"u")throw new Error('Reducer "'+t+'" returned undefined when probed with a random type. '+("Don't try to handle "+Ir.INIT+' or other actions in "redux/*" ')+"namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.")})}function Pb(e){for(var t=Object.keys(e),n={},i=0;i<t.length;i++){var r=t[i];typeof e[r]=="function"&&(n[r]=e[r])}var a=Object.keys(n),o;try{Ib(n)}catch(s){o=s}return function(l,c){if(l===void 0&&(l={}),o)throw o;for(var u=!1,h={},d=0;d<a.length;d++){var f=a[d],p=n[f],v=l[f],m=p(v,c);if(typeof m>"u"){var g=Rb(f,c);throw new Error(g)}h[f]=m,u=u||m!==v}return u?h:l}}function Ob(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Db(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{},i=Object.keys(n);typeof Object.getOwnPropertySymbols=="function"&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable}))),i.forEach(function(r){Ob(e,r,n[r])})}return e}function kb(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.length===0?function(i){return i}:t.length===1?t[0]:t.reduce(function(i,r){return function(){return i(r.apply(void 0,arguments))}})}function Nb(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(i){return function(){var r=i.apply(void 0,arguments),a=function(){throw new Error("Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")},o={getState:r.getState,dispatch:function(){return a.apply(void 0,arguments)}},s=t.map(function(l){return l(o)});return a=kb.apply(void 0,s)(r.dispatch),Db({},r,{dispatch:a})}}}function lh(e){return function(t){var n=t.dispatch,i=t.getState;return function(r){return function(a){return typeof a=="function"?a(n,i,e):r(a)}}}}var ch=lh();ch.withExtraArgument=lh;var dc=function(){return{angles:new Map,boundingBoxEnabled:!1,camera:null,controlsEnabled:!0,controlsType:Ft.TRACKBALL,displayMode:Ve.MESH,edges:new Map,material:ms.DEFAULT,nodes:new Map,nodeLabelsAlwaysVisible:!1,graphEnabled:!1,orientation:yn.CORONAL,selected:null,slicesIndex:.5,slicesMaxIndex:void 0,src:null,srcLoaded:!1,units:Wt.METERS,volumeSteps:.5,volumeStepsHighEnabled:!1,volumeWindowCenter:.5,volumeWindowWidth:1}},Bb=function(e,t){switch(e===void 0&&(e=dc()),t.type){case fe.APP_SET_SRC:{var n=t.payload,i=n[0],r=n[1],a;if(r)a=r;else if(i){var o=rt.getFileExtension(i),s=rt.getFileEndCharacters(i,3);Object.values(Ka).includes(o)||Object.values(Ka).includes(s)?a=Ve.MESH:a=Ve.SLICES}else a=Ve.MESH;return Object.assign({},dc(),{displayMode:a,src:i})}case fe.APP_SET_SRC_LOADED:return Object.assign({},e,{controlsEnabled:t.payload,srcLoaded:t.payload,boundingBoxEnabled:e.displayMode!==Ve.MESH?!0:e.boundingBoxEnabled,controlsType:e.displayMode===Ve.MESH?Ft.ORBIT:Ft.TRACKBALL,units:e.displayMode!==Ve.MESH?Wt.MILLIMETERS:Wt.METERS});case fe.APP_SET_NODE:{var l=t.payload,c=l[0],u=l[1],h=JSON.parse(JSON.stringify(u)),d=e.nodes.get(c),f=Object.assign({},d,h);return Object.assign({},e,{selected:d?e.selected:c,nodes:new Map(e.nodes).set(c,f)})}case fe.APP_DELETE_NODE:return Object.assign({},e,{selected:e.selected===t.payload?null:e.selected,nodes:new Map(Array.from(e.nodes).filter(function(m){var g=m[0];return g!==t.payload})),edges:new Map(Array.from(e.edges).filter(function(m){var g=m[0],y=m[1];return t.payload!==y.node1Id&&t.payload!==y.node2Id}))});case fe.APP_SELECT_NODE:return Object.assign({},e,{selected:t.payload});case fe.APP_CLEAR_NODES:return Object.assign({},e,{nodes:new Map});case fe.APP_SET_EDGE:{var p=t.payload,c=p[0],u=p[1],h=JSON.parse(JSON.stringify(u)),d=e.edges.get(c),f=Object.assign({},d,h);return Object.assign({},e,{selected:d?e.selected:c,edges:new Map(e.edges).set(c,f)})}case fe.APP_DELETE_EDGE:return Object.assign({},e,{selected:e.selected===t.payload?null:e.selected,edges:new Map(Array.from(e.edges).filter(function(m){var g=m[0];return g!==t.payload})),angles:new Map(Array.from(e.angles).filter(function(m){var g=m[0],y=m[1];return t.payload!==y.edge1Id&&t.payload!==y.edge2Id}))});case fe.APP_SELECT_EDGE:return Object.assign({},e,{selected:t.payload});case fe.APP_CLEAR_EDGES:return Object.assign({},e,{edges:new Map});case fe.APP_SET_ANGLE:{var v=t.payload,c=v[0],u=v[1],h=JSON.parse(JSON.stringify(u)),d=e.angles.get(c),f=Object.assign({},d,h);return Object.assign({},e,{selected:d?e.selected:c,angles:new Map(e.angles).set(c,f)})}case fe.APP_DELETE_ANGLE:return Object.assign({},e,{selected:e.selected===t.payload?null:e.selected,angles:new Map(Array.from(e.angles).filter(function(m){var g=m[0];return g!==t.payload}))});case fe.APP_SELECT_ANGLE:return Object.assign({},e,{selected:t.payload});case fe.APP_CLEAR_ANGLES:return Object.assign({},e,{angles:new Map});case fe.APP_SET_DISPLAY_MODE:return Object.assign({},e,{displayMode:t.payload,boundingBoxEnabled:t.payload===Ve.SLICES});case fe.APP_SET_ORIENTATION:return Object.assign({},e,{slicesIndex:.5,orientation:t.payload});case fe.APP_SET_MATERIAL:return Object.assign({},e,{material:t.payload});case fe.APP_SET_NODES_ENABLED:return Object.assign({},e,{graphEnabled:t.payload});case fe.APP_SET_BOUNDINGBOX_ENABLED:return Object.assign({},e,{boundingBoxEnabled:t.payload});case fe.APP_SET_NODE_LABELS_ALWAYS_VISIBLE:return Object.assign({},e,{nodeLabelsAlwaysVisible:t.payload});case fe.APP_SET_SCENE_DISTANCE:return Object.assign({},e,{sceneDistance:t.payload});case fe.APP_SET_SLICES_INDEX:return Object.assign({},e,{slicesIndex:t.payload});case fe.APP_SET_SLICES_MAX_INDEX:return Object.assign({},e,{slicesMaxIndex:t.payload});case fe.APP_SET_UNITS:return Object.assign({},e,{units:t.payload});case fe.APP_SET_VOLUME_STEPS:return Object.assign({},e,{volumeSteps:t.payload});case fe.APP_SET_VOLUME_WINDOW_WIDTH:return Object.assign({},e,{volumeWindowWidth:t.payload});case fe.APP_SET_VOLUME_WINDOW_CENTER:return Object.assign({},e,{volumeWindowCenter:t.payload});case fe.APP_SET_CAMERA:return Object.assign({},e,{camera:Object.assign({},e.camera,t.payload)});case fe.APP_SET_CONTROLS_ENABLED:return Object.assign({},e,{controlsEnabled:t.payload});case fe.APP_SET_CONTROLS_TYPE:return Object.assign({},e,{controlsType:t.payload});default:return Object.assign({},e)}},zb=Pb({app:Bb}),Fb=function(e){return sh(zb,e,Nb(ch))},Hb=function(e,t){return T("a-entity",{id:"model-container"},t)},A0=function(){function e(t){Ye(this,t),this._hovered=null,this._isShiftDown=!1,this._isWebGl2=!0,this.width="640",this.height="480",this.change=ve(this,"change",7),this.loaded=ve(this,"loaded",7),this.store=Bl(this,"store")}return e.prototype.load=function(t,n){return te(this,void 0,void 0,function(){var i=this;return ne(this,function(r){return this.src?(this._setSrc(null),setTimeout(function(){i._setSrc(t,n)},U.minLoadingMS)):this._setSrc(t,n),[2]})})},e.prototype.resize=function(){return te(this,void 0,void 0,function(){return ne(this,function(t){return this._resize(),[2]})})},e.prototype.setNode=function(t){return te(this,void 0,void 0,function(){return ne(this,function(n){return this._setNode(t),[2]})})},e.prototype.setGraph=function(t){return te(this,void 0,void 0,function(){return ne(this,function(n){return this._setGraph(t),[2]})})},e.prototype.deleteNode=function(t){return te(this,void 0,void 0,function(){return ne(this,function(n){return this._deleteNode(t),[2]})})},e.prototype.clearGraph=function(){return te(this,void 0,void 0,function(){return ne(this,function(t){return this._clearGraph(),[2]})})},e.prototype.selectNode=function(t){return te(this,void 0,void 0,function(){return ne(this,function(n){return this._selectNode(t,!0),[2]})})},e.prototype.deleteEdge=function(t){return te(this,void 0,void 0,function(){return ne(this,function(n){return this._deleteEdge(t),[2]})})},e.prototype.deleteAngle=function(t){return te(this,void 0,void 0,function(){return ne(this,function(n){return this._deleteAngle(t),[2]})})},e.prototype.setEdge=function(t){return te(this,void 0,void 0,function(){return ne(this,function(n){return this._setEdge(t),[2]})})},e.prototype.recenter=function(){return te(this,void 0,void 0,function(){return ne(this,function(t){return this._recenter(),[2]})})},e.prototype.setBoundingBoxEnabled=function(t){return te(this,void 0,void 0,function(){return ne(this,function(n){return this._setBoundingBoxEnabled(t),[2]})})},e.prototype.setDisplayMode=function(t){return te(this,void 0,void 0,function(){return ne(this,function(n){return this._setDisplayMode(t),[2]})})},e.prototype.setControlsEnabled=function(t){return te(this,void 0,void 0,function(){return ne(this,function(n){return this._setControlsEnabled(t),[2]})})},e.prototype.setControlsType=function(t){return te(this,void 0,void 0,function(){return ne(this,function(n){return this._setControlsType(t),[2]})})},e.prototype.setGraphEnabled=function(t){return te(this,void 0,void 0,function(){return ne(this,function(n){return this._setGraphEnabled(t),[2]})})},e.prototype.setMaterial=function(t){return te(this,void 0,void 0,function(){return ne(this,function(n){return this._setMaterial(t),[2]})})},e.prototype.setNodeLabelsAlwaysVisible=function(t){return te(this,void 0,void 0,function(){return ne(this,function(n){return this._setNodeLabelsAlwaysVisible(t),[2]})})},e.prototype.setOrientation=function(t){return te(this,void 0,void 0,function(){return ne(this,function(n){return this._setOrientation(t),[2]})})},e.prototype.setSceneDistance=function(t){return te(this,void 0,void 0,function(){return ne(this,function(n){return this._setSceneDistance(t),[2]})})},e.prototype.setSlicesIndex=function(t){return te(this,void 0,void 0,function(){return ne(this,function(n){return this._setSlicesIndex(t),[2]})})},e.prototype.setUnits=function(t){return te(this,void 0,void 0,function(){return ne(this,function(n){return this._setUnits(t),[2]})})},e.prototype.setVolumeSteps=function(t){return te(this,void 0,void 0,function(){return ne(this,function(n){return this._setVolumeSteps(t),[2]})})},e.prototype.setVolumeBrightness=function(t){return te(this,void 0,void 0,function(){return ne(this,function(n){return this._setVolumeWindowCenter(t),[2]})})},e.prototype.setVolumeContrast=function(t){return te(this,void 0,void 0,function(){return ne(this,function(n){return this._setVolumeWindowWidth(t),[2]})})},e.prototype.componentWillLoad=function(){return te(this,void 0,void 0,function(){return ne(this,function(t){return this._isWebGl2=ge.isWebGL2Available(),this.store.setStore(Fb({})),this.store.mapStateToProps(this,function(n){var i=n.app,r=i.angles,a=i.boundingBoxEnabled,o=i.camera,s=i.controlsEnabled,l=i.controlsType,c=i.displayMode,u=i.edges,h=i.graphEnabled,d=i.material,f=i.nodes,p=i.nodeLabelsAlwaysVisible,v=i.orientation,m=i.selected,g=i.sceneDistance,y=i.slicesIndex,b=i.slicesMaxIndex,_=i.src,w=i.srcLoaded,L=i.units,R=i.volumeSteps,k=i.volumeWindowCenter,O=i.volumeWindowWidth;return{angles:r,boundingBoxEnabled:a,camera:o,controlsEnabled:s,controlsType:l,displayMode:c,edges:u,graphEnabled:h,material:d,nodes:f,nodeLabelsAlwaysVisible:p,orientation:v,selected:m,sceneDistance:g,slicesIndex:y,slicesMaxIndex:b,src:_,srcLoaded:w,units:L,volumeSteps:R,volumeWindowCenter:k,volumeWindowWidth:O}}),this.store.mapDispatchToProps(this,{appClearAngles:hb,appClearEdges:sb,appClearNodes:ib,appDeleteAngle:cb,appDeleteEdge:ab,appDeleteNode:tb,appSelectAngle:ub,appSelectEdge:ob,appSelectNode:nb,appSetAngle:lb,appSetBoundingBoxEnabled:db,appSetCamera:Sb,appSetControlsEnabled:Tb,appSetControlsType:Ab,appSetDisplayMode:fb,appSetEdge:rb,appSetGraphEnabled:pb,appSetMaterial:mb,appSetNode:eb,appSetNodeLabelsAlwaysVisible:vb,appSetOrientation:yb,appSetSceneDistance:bb,appSetSlicesIndex:xb,appSetSlicesMaxIndex:_b,appSetSrc:$y,appSetSrcLoaded:Ky,appSetUnits:gb,appSetVolumeSteps:wb,appSetVolumeWindowCenter:Mb,appSetVolumeWindowWidth:Eb}),this._controlsAnimationFinishedHandler=this._controlsAnimationFinishedHandler.bind(this),this._controlsInteractionHandler=this._controlsInteractionHandler.bind(this),this._graphEntryDraggedHandler=this._graphEntryDraggedHandler.bind(this),this._graphEntryPointerDownHandler=this._graphEntryPointerDownHandler.bind(this),this._graphEntryPointerOutHandler=this._graphEntryPointerOutHandler.bind(this),this._graphEntryPointerOverHandler=this._graphEntryPointerOverHandler.bind(this),this._graphEntryPointerUpHandler=this._graphEntryPointerUpHandler.bind(this),this._graphEntrySelectedHandler=this._graphEntrySelectedHandler.bind(this),this._graphEntryValidTargetHandler=this._graphEntryValidTargetHandler.bind(this),this._keyDownHandler=this._keyDownHandler.bind(this),this._keyUpHandler=this._keyUpHandler.bind(this),this._controlsInteractionFinishedHandler=this._controlsInteractionFinishedHandler.bind(this),this._slicesMaxIndexHandler=this._slicesMaxIndexHandler.bind(this),this._spawnNodeHandler=this._spawnNodeHandler.bind(this),this._srcLoadedHandler=this._srcLoadedHandler.bind(this),this._volumeDefaultRenderStepsHandler=this._volumeDefaultRenderStepsHandler.bind(this),this._volumeRaycastHandler=this._volumeRaycastHandler.bind(this),this._debouncedAppSetCamera=vc.debounce(this.appSetCamera,U.minFrameMS).bind(this),[2]})})},e.prototype._renderScene=function(){var t=this;return T(qy,{cb:function(n){t._scene=n,t._scene.addEventListener("loaded",function(){t._scene.sceneEl.renderer.toneMapping=THREE.ACESFilmicToneMapping})},isWebGl2:this._isWebGl2},T(Hb,null,T(Jy,{cb:function(n){t._targetEntity=n},controlsType:this.controlsType,displayMode:this.displayMode,dracoDecoderPath:this.dracoDecoderPath,envMapPath:this.envMapPath,graphEnabled:this.graphEnabled,orientation:this.orientation,slicesIndex:this.slicesIndex,src:this.src,srcLoaded:this.srcLoaded,volumeSteps:this.volumeSteps,volumeWindowCenter:this.volumeWindowCenter,volumeWindowWidth:this.volumeWindowWidth}),T(Vy,{cb:function(n){t._boundingEntity=n},boundingBox:this._boundingBox,boundingBoxEnabled:this.boundingBoxEnabled,color:U.colors.white,displayMode:this.displayMode,graphEnabled:this.graphEnabled,mesh:this._getMesh(),srcLoaded:this.srcLoaded,targetEntity:this._targetEntity})),T(Xy,{boundingSphereRadius:this._boundingSphereRadius,camera:this._scene?this._scene.camera:null,cameraPosition:this.camera?this.camera.position:null,controlsType:this.controlsType,fontSize:U.fontSizeMedium,graphEnabled:this.graphEnabled,nodes:this.nodes,nodeLabelsAlwaysVisible:this.nodeLabelsAlwaysVisible,selected:this.selected}),T(jy,{boundingSphereRadius:this._boundingSphereRadius,camera:this._scene?this._scene.camera:null,cameraPosition:this.camera?this.camera.position:null,controlsType:this.controlsType,displayMode:this.displayMode,edges:this.edges,edgeMinSize:U.edgeMinSize,edgeSize:U.edgeSize,fontSize:U.fontSizeMedium,nodes:this.nodes,selected:this.selected,units:this.units}),T(Gy,{angles:this.angles,boundingSphereRadius:this._boundingSphereRadius,camera:this._scene?this._scene.camera:null,cameraPosition:this.camera?this.camera.position:null,controlsType:this.controlsType,edges:this.edges,edgeMinSize:U.edgeMinSize,edgeSize:U.edgeSize,fontSize:U.fontSizeMedium,nodes:this.nodes,selected:this.selected}),function(){switch(t.controlsType){case Ft.TRACKBALL:return T(Qy,{cb:function(n){t._camera=n},animating:t.camera&&t.camera.animating?t.camera.animating:!1,aspect:t._scene?t._scene.offsetWidth/t._scene.offsetHeight:null,controlPosition:ge.vector3ToString(t.camera?t.camera.position:new THREE.Vector3(0,0,0)),controlTarget:ge.vector3ToString(t.camera?t.camera.target:new THREE.Vector3(0,0,0)),dampingFactor:U.camera.dampingFactor,enabled:t.controlsEnabled,far:t.sceneDistance?rt.getFarFromSceneDistance(t.sceneDistance):U.camera.far,fov:U.camera.fov,graphEnabled:t.graphEnabled,maxDistance:t.sceneDistance?rt.getFarFromSceneDistance(t.sceneDistance):U.camera.maxDistance,near:t.sceneDistance?rt.getNearFromSceneDistance(t.sceneDistance):U.camera.near,panSpeed:U.camera.panSpeed,rotateSpeed:U.camera.trackballRotateSpeed,screenHeight:t._scene?t._scene.canvas.height:0,screenWidth:t._scene?t._scene.canvas.width:0,zoomSpeed:U.camera.trackballZoomSpeed});case Ft.ORBIT:return T(Zy,{cb:function(n){t._camera=n},animating:t.camera&&t.camera.animating?t.camera.animating:!1,aspect:t._scene?t._scene.offsetWidth/t._scene.offsetHeight:null,controlPosition:ge.vector3ToString(t.camera?t.camera.position:new THREE.Vector3(0,0,0)),controlTarget:ge.vector3ToString(t.camera?t.camera.target:new THREE.Vector3(0,0,0)),dampingFactor:U.camera.dampingFactor,enabled:t.controlsEnabled,far:t.sceneDistance?rt.getFarFromSceneDistance(t.sceneDistance):U.camera.far,fov:U.camera.fov,graphEnabled:t.graphEnabled,maxDistance:t.sceneDistance?rt.getFarFromSceneDistance(t.sceneDistance):U.camera.maxDistance,maxPolarAngle:U.camera.maxPolarAngle,minDistance:U.camera.minDistance,minPolarAngle:U.camera.minPolarAngle,panSpeed:U.camera.orbitPanSpeed,near:t.sceneDistance?rt.getNearFromSceneDistance(t.sceneDistance):U.camera.near,rotateSpeed:U.camera.orbitRotateSpeed,zoomSpeed:U.camera.orbitZoomSpeed});default:return null}}(),T(Yy,{ambientLightColor:U.lights.ambientLightColor,ambientLightIntensity:U.lights.ambientLightIntensity}))},e.prototype.render=function(){return T("div",{id:"al-container",class:this.displayMode,style:{width:rt.addCssUnits(this.width),height:rt.addCssUnits(this.height)}},T("div",{id:"lut-container"},T("div",{id:"lut-min"},"0.0"),T("div",{id:"lut-canvases"}),T("div",{id:"lut-max"},"1.0")),this._renderScene(),this.src&&!this.srcLoaded&&T("div",{id:"spinner"},T("div",{class:"square"})))},e.prototype._resize=function(){this._scene&&this._scene.resize()},e.prototype._createEdge=function(t,n){var i=Array.from(this.edges).find(function(o){var s=o[0],l=o[1];return l.node1Id===t&&l.node2Id===n||l.node1Id===n&&l.node2Id===t});if(!i){var r={node1Id:t,node2Id:n},a=Fa.getNextId(Jt.EDGE,this.edges);this._setEdge([a,r])}},e.prototype._createAngle=function(t,n){var i=Array.from(this.angles).find(function(l){var c=l[0],u=l[1];return u.edge1Id===t&&u.edge2Id===n||u.edge1Id===n&&u.edge2Id===t});if(i)console.warn("cannot create angle: angle already exists");else{var r=this.edges.get(t),a=this.edges.get(n);if(r.node1Id===a.node1Id||r.node1Id===a.node2Id||r.node2Id===a.node1Id||r.node2Id===a.node2Id){var o={edge1Id:t,edge2Id:n},s=Fa.getNextId(Jt.ANGLE,this.angles);this._setAngle([s,o])}else console.warn("cannot create angle: edges not connected")}},e.prototype._stateChanged=function(){this.change.emit(this.store.getState().app)},e.prototype._setGraph=function(t){var n=this;if(t.nodes){var i=new Map(t.nodes);i.forEach(function(o,s){n.appSetNode([s,o])})}if(t.edges){var r=new Map(t.edges);r.forEach(function(o,s){n.appSetEdge([s,o])})}if(t.angles){var a=new Map(t.angles);a.forEach(function(o,s){n.appSetAngle([s,o])})}this._stateChanged()},e.prototype._clearGraph=function(){this.appClearNodes(),this.appClearEdges(),this.appClearAngles(),this._stateChanged()},e.prototype._deleteNode=function(t){this.appDeleteNode(t),this._stateChanged()},e.prototype._setNode=function(t){this.appSetNode(t),this._stateChanged()},e.prototype._animateBetween=function(t,n){var i=rt.getCameraStateFromMesh(this._getMesh(),this.sceneDistance),r={position:n,target:i.target.clone()};if(n){var a=r.position.distanceTo(this.camera.position),o=r.target.distanceTo(this.camera.target),s=a/U.maxAnimationSteps>Number.EPSILON,l=o/U.maxAnimationSteps>Number.EPSILON;if(s||l){r.position.copy(n.clone());var c=ge.getSlerpCameraPath(t,r,s,l);this._scene.emit(lt.ANIMATION_STARTED,{slerpPath:c},!1),this.appSetCamera({animating:!0}),this._stateChanged()}}},e.prototype._selectNode=function(t,n){if(n===void 0&&(n=!1),n&&t!==this.selected){var i={position:this.camera.position.clone(),target:this.camera.target.clone()},r=rt.getCameraPositionFromNode(this.nodes.get(t),this._boundingSphereRadius,this.camera.target);this.appSelectNode(t),this._animateBetween(i,r)}else this.appSelectNode(t),this._stateChanged()},e.prototype._setEdge=function(t){this.appSetEdge(t),this._stateChanged()},e.prototype._deleteEdge=function(t){this.appDeleteEdge(t),this._stateChanged()},e.prototype._recenter=function(){var t=rt.getCameraStateFromMesh(this._getMesh(),this.sceneDistance),n={position:this.camera.position.clone(),target:this.camera.target.clone()};this._selectNode(null),this._animateBetween(n,t.position)},e.prototype._selectEdge=function(t){this.appSelectEdge(t),this._stateChanged()},e.prototype._setAngle=function(t){this.appSetAngle(t),this._stateChanged()},e.prototype._selectAngle=function(t){this.appSelectAngle(t),this._stateChanged()},e.prototype._deleteAngle=function(t){this.appDeleteAngle(t),this._stateChanged()},e.prototype._setBoundingBoxEnabled=function(t){this.appSetBoundingBoxEnabled(t),this._stateChanged()},e.prototype._setControlsEnabled=function(t){this.appSetControlsEnabled(t),this._stateChanged()},e.prototype._setControlsType=function(t){this.appSetControlsType(t),this._scene.camera.up.copy(this._targetEntity.object3D.up),this._stateChanged()},e.prototype._setGraphEnabled=function(t){this.appSetGraphEnabled(t),this._stateChanged()},e.prototype._setMaterial=function(t){this.appSetMaterial(t),this._stateChanged()},e.prototype._setNodeLabelsAlwaysVisible=function(t){this.appSetNodeLabelsAlwaysVisible(t),this._stateChanged()},e.prototype._setOrientation=function(t){this.appSetOrientation(t),this._stateChanged()},e.prototype._setSceneDistance=function(t){this.appSetSceneDistance(t),this._stateChanged()},e.prototype._setSlicesIndex=function(t){this.appSetSlicesIndex(t),this._stateChanged()},e.prototype._setUnits=function(t){this.appSetUnits(t),this._stateChanged()},e.prototype._setVolumeSteps=function(t){this.appSetVolumeSteps(t),this._stateChanged()},e.prototype._setVolumeWindowCenter=function(t){this.appSetVolumeWindowCenter(t),this._stateChanged()},e.prototype._setVolumeWindowWidth=function(t){this.appSetVolumeWindowWidth(t),this._stateChanged()},e.prototype._setDisplayMode=function(t){this.appSetDisplayMode(t),this._stateChanged()},e.prototype._setSrc=function(t,n){this.appSetSrc([t,n]),this._stateChanged()},e.prototype._getMesh=function(){var t=null;if(this._targetEntity&&this.displayMode===Ve.MESH){var n=this._targetEntity.object3DMap.mesh;n instanceof THREE.Mesh?t=n:n&&n.traverse(function(i){if(i instanceof THREE.Mesh&&t===null)return t=i,t})}else this._loadedObject&&this._loadedObject._bBox?t=this._loadedObject._bBox._mesh:this._loadedObject&&(t=this._loadedObject._mesh);return t},e.prototype._srcLoadedHandler=function(t){this._loadedObject=t.detail;var n,i;if(this._loadedObject.model){this._boundingBox=rt.getBoundingBox(this._loadedObject.model);var r=new sn;this._boundingSphereRadius=this._boundingBox.getBoundingSphere(r).radius,i=rt.getSceneDistanceFromModel(this._loadedObject.model,U.zoomFactor,U.fov),n=rt.getCameraStateFromModel(this._loadedObject.model,i)}else{var a=this._getMesh();a.geometry.computeBoundingSphere(),a.geometry.computeBoundingBox(),this._boundingBox=rt.getBoundingBox(a),this._boundingSphereRadius=a.geometry.boundingSphere.radius,i=rt.getSceneDistanceFromMesh(a,U.zoomFactor,U.fov),n=rt.getCameraStateFromMesh(a,i)}i&&this.appSetSceneDistance(i),n&&this.appSetCamera(n),this.appSetSrcLoaded(!0),this._stateChanged(),this.loaded.emit(t.detail)},e.prototype._keyDownHandler=function(t){this._isShiftDown=t.shiftKey,t.keyCode===vs.Delete&&this.selected&&(this.nodes.has(this.selected)?this._deleteNode(this.selected):this.edges.has(this.selected)?this._deleteEdge(this.selected):this.angles.has(this.selected)&&this._deleteAngle(this.selected))},e.prototype._keyUpHandler=function(t){this._isShiftDown=!1},e.prototype._graphEntryPointerUpHandler=function(t){this.appSetControlsEnabled(!0),ge.enableControls(this._camera,!0,this.controlsType)},e.prototype._graphEntryPointerDownHandler=function(t){this.appSetControlsEnabled(!1),ge.enableControls(this._camera,!1,this.controlsType)},e.prototype._graphEntryPointerOutHandler=function(t){this._hovered=null},e.prototype._graphEntryPointerOverHandler=function(t){this._hovered=t.detail.id},e.prototype._controlsInteractionHandler=function(t){var n=t.detail.cameraState;this.appSetCamera(n)},e.prototype._controlsInteractionFinishedHandler=function(t){var n=t.detail.cameraState;this._debouncedAppSetCamera(n)},e.prototype._spawnNodeHandler=function(t){if(this.graphEnabled&&this._validTarget&&this._hovered===null){var n=void 0,i=Fa.getNextId(Jt.NODE,this.nodes),r=t.detail.aframeEvent.detail.intersection;if(this.displayMode===Ve.VOLUME&&r?this._scene.emit(bt.VOLUME_RAY_REQUEST,{cameraPosition:this._camera.object3D.children[0].position.clone(),cameraDirection:this._camera.getAttribute("raycaster").direction,intersection:r,type:Bi.CREATE}):r&&(n={targetId:this.src,position:ge.vector3ToString(r.point),scale:this._boundingSphereRadius*U.nodeSize,normal:ge.vector3ToString(r.face.normal),title:i}),n){var a=this.selected;this._setNode([i,n]),this._isShiftDown&&this.nodes.has(a)&&(this._createEdge(a,i),this._selectNode(i))}}},e.prototype._volumeRaycastHandler=function(t){var n=t.detail.hitPosition,i=t.detail.rayResult;switch(t.detail.type){case Bi.CREATE:{var r=void 0,a=Fa.getNextId(Jt.NODE,this.nodes);if(i&&(r={targetId:this.src,position:ge.vector3ToString(n),scale:this._boundingSphereRadius*U.nodeSize,title:a}),r){var o=this.selected;this._setNode([a,r]),this._isShiftDown&&this.nodes.has(o)&&(this._createEdge(o,a),this._selectNode(a))}break}case Bi.DRAG:{var a=this.selected;if(!i){var s=this._camera.object3D.children[0].position.distanceTo(this._targetEntity.getAttribute("position"));n.copy(this._camera.object3D.children[0].position),n.add(this._camera.getAttribute("raycaster").direction.clone().multiplyScalar(s*1.5))}this._setNode([a,{position:ge.vector3ToString(n)}]);var l=a+U.movedEventName;this._scene.emit(l,{},!0);break}default:break}},e.prototype._graphEntryValidTargetHandler=function(t){this._validTarget=t.detail.valid},e.prototype._controlsAnimationFinishedHandler=function(t){this.appSetCamera({animating:!1})},e.prototype._graphEntrySelectedHandler=function(t){if(this.graphEnabled){var n=t.detail.type,i=t.detail.id;switch(n){case Jt.NODE:{this._hovered!==null&&this.nodes.has(this._hovered)&&this.selected!==null&&this.nodes.has(this.selected)&&this.selected!==this._hovered&&this._isShiftDown&&this._createEdge(this.selected,this._hovered),this._selectNode(i);break}case Jt.EDGE:{this._hovered!==null&&this.edges.has(this._hovered)&&this.selected!==null&&this.edges.has(this.selected)&&this.selected!==this._hovered&&this._isShiftDown&&this._createAngle(this.selected,this._hovered),this._selectEdge(i);break}case Jt.ANGLE:{this._selectAngle(i);break}default:break}}},e.prototype._graphEntryDraggedHandler=function(t){var n=t.detail.id,i=this._camera.components.raycaster,r=this._camera.getAttribute("raycaster"),a=new THREE.Vector3,o=!1;if(this.displayMode===Ve.VOLUME){var s=i.getIntersection(this._boundingEntity);s&&this._scene.emit(bt.VOLUME_RAY_REQUEST,{cameraPosition:this._camera.object3D.children[0].position.clone(),cameraDirection:this._camera.getAttribute("raycaster").direction,intersection:s,type:Bi.DRAG})}else{var s=i.getIntersection(this._targetEntity);if(s&&(a.copy(s.point),o=!0),o)a.copy(s.point);else{var l=this._camera.object3D.children[0].position.distanceTo(this._targetEntity.getAttribute("position"));a.copy(this._camera.object3D.children[0].position),a.add(r.direction.clone().multiplyScalar(l*1.5))}this._setNode([n,{position:ge.vector3ToString(a)}]);var c=n+U.movedEventName;this._scene.emit(c,{},!0)}},e.prototype._volumeDefaultRenderStepsHandler=function(t){this.appSetVolumeSteps(t.detail),this._stateChanged()},e.prototype._slicesMaxIndexHandler=function(t){this.appSetSlicesMaxIndex(t.detail)},e.prototype._addEventListeners=function(){window.addEventListener("keydown",this._keyDownHandler,!1),window.addEventListener("keyup",this._keyUpHandler,!1),this._scene.addEventListener(bt.VOLUME_RAY_CAST,this._volumeRaycastHandler,!1),this._scene.addEventListener(lt.ANIMATION_FINISHED,this._controlsAnimationFinishedHandler,!1),this._scene.addEventListener(lt.INTERACTION,this._controlsInteractionHandler,!1),this._scene.addEventListener(lt.INTERACTION_FINISHED,this._controlsInteractionFinishedHandler,!1),this._scene.addEventListener(ot.POINTER_UP,this._graphEntryPointerUpHandler,!1),this._scene.addEventListener(ot.POINTER_DOWN,this._graphEntryPointerDownHandler,!1),this._scene.addEventListener(ot.DRAGGED,this._graphEntryDraggedHandler,!1),this._scene.addEventListener(ot.SELECTED,this._graphEntrySelectedHandler,!1),this._scene.addEventListener(uc.ADD_NODE,this._spawnNodeHandler,!1),this._scene.addEventListener(uc.VALID_TARGET,this._graphEntryValidTargetHandler,!1),this._scene.addEventListener(Uy.LOADED,this._srcLoadedHandler,!1),this._scene.addEventListener(bt.DEFAULT_RENDER_STEPS,this._volumeDefaultRenderStepsHandler,!1),this._scene.addEventListener(bt.LOADED,this._srcLoadedHandler,!1),this._scene.addEventListener(bt.SLICES_MAX_INDEX,this._slicesMaxIndexHandler,!1),this._scene.addEventListener(ot.POINTER_OVER,this._graphEntryPointerOverHandler,!1),this._scene.addEventListener(ot.POINTER_OUT,this._graphEntryPointerOutHandler,!1)},e.prototype.componentDidUpdate=function(){this._scene&&this._addEventListeners()},Object.defineProperty(e,"style",{get:function(){return"#al-container{position:relative;font-family:sans-serif}#al-container a-scene{display:block;width:100%;height:100%}#al-container.mesh a-scene{background-color:var(--al-mesh-viewport-background-color)}#al-container.slices a-scene{background-color:var(--al-slices-viewport-background-color)}#al-container.volume a-scene{background-color:var(--al-volume-viewport-background-color)}#al-container #lut-container{display:none}#al-container .progress.container{position:absolute;top:auto!important;bottom:0!important}#al-container .progress.container .load.progress,#al-container .progress.container .parse.progress{border:none!important;height:4px!important;background-color:var(--load-progress-color,#fff)!important}#al-container #spinner{position:absolute;left:50%;top:calc(50% - 15px)}#al-container #spinner .square{margin:0 0 0 -15px;width:30px;height:30px;-webkit-animation:sk-rotateplane 1.2s ease-in-out infinite;-moz-animation:sk-rotateplane 1.2s infinite ease-in-out;animation:sk-rotateplane 1.2s ease-in-out infinite}#al-container.mesh #spinner .square,#al-container.slices #spinner .square,#al-container.volume #spinner .square{background-color:var(--spinner-color,#fff)}@-webkit-keyframes sk-rotateplane{0%{-webkit-transform:perspective(120px)}50%{-webkit-transform:perspective(120px) rotateY(180deg)}to{-webkit-transform:perspective(120px) rotateY(180deg) rotateX(180deg)}}@keyframes sk-rotateplane{0%{transform:perspective(120px) rotateX(0deg) rotateY(0deg);-webkit-transform:perspective(120px) rotateX(0deg) rotateY(0deg)}50%{transform:perspective(120px) rotateX(-180.1deg) rotateY(0deg);-webkit-transform:perspective(120px) rotateX(-180.1deg) rotateY(0deg)}to{transform:perspective(120px) rotateX(-180deg) rotateY(-179.9deg);-webkit-transform:perspective(120px) rotateX(-180deg) rotateY(-179.9deg)}}"},enumerable:!0,configurable:!0}),e}(),L0=function(){function e(t){Ye(this,t)}return e.prototype.componentDidLoad=function(){Gb(function(){var t=za(window,"hybrid");Ln.getBoolean("_testing")||import("./tap-click-31591259-FZGLPCLW.js").then(function(n){return n.startTapClick(Ln)}),Ln.getBoolean("statusTap",t)&&import("./status-tap-7e7b1839-HGRTIZCV.js").then(function(n){return n.startStatusTap()}),Ln.getBoolean("inputShims",Ub())&&import("./input-shims-c71a172f-E2U7KGEL.js").then(function(n){return n.startInputShims(Ln)}),Ln.getBoolean("hardwareBackButton",t)&&import("./hardware-back-button-fcf38822-67BSU6XA.js").then(function(n){return n.startHardwareBackButton()}),import("./focus-visible-30ddc1ea-IQTWTC23.js").then(function(n){return n.startFocusVisible()})})},e.prototype.render=function(){var t,n=dt(this);return T(ut,{class:(t={},t[n]=!0,t["ion-page"]=!0,t["force-statusbar-padding"]=Ln.getBoolean("_forceStatusbarPadding"),t)})},Object.defineProperty(e.prototype,"el",{get:function(){return ht(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e,"style",{get:function(){return"html.plt-mobile ion-app{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}ion-app.force-statusbar-padding{--ion-safe-area-top:20px}"},enumerable:!0,configurable:!0}),e}(),Ub=function(){return za(window,"ios")&&za(window,"mobile")},Gb=function(e){"requestIdleCallback"in window?window.requestIdleCallback(e):setTimeout(e,32)},C0=function(){function e(t){var n=this;Ye(this,t),this.inToolbar=!1,this.inItem=!1,this.buttonType="button",this.disabled=!1,this.routerDirection="forward",this.strong=!1,this.type="button",this.handleClick=function(i){if(n.type==="button")Jo(n.href,i,n.routerDirection);else if(Al(n.el)){var r=n.el.closest("form");if(r){i.preventDefault();var a=document.createElement("button");a.type=n.type,a.style.display="none",r.appendChild(a),a.click(),a.remove()}}},this.onFocus=function(){n.ionFocus.emit()},this.onBlur=function(){n.ionBlur.emit()},this.ionFocus=ve(this,"ionFocus",7),this.ionBlur=ve(this,"ionBlur",7)}return e.prototype.componentWillLoad=function(){this.inToolbar=!!this.el.closest("ion-buttons"),this.inItem=!!this.el.closest("ion-item")||!!this.el.closest("ion-item-divider")},Object.defineProperty(e.prototype,"hasIconOnly",{get:function(){return!!this.el.querySelector('ion-icon[slot="icon-only"]')},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rippleType",{get:function(){var t=this.fill===void 0||this.fill==="clear";return t&&this.hasIconOnly&&this.inToolbar?"unbounded":"bounded"},enumerable:!0,configurable:!0}),e.prototype.render=function(){var t,n=dt(this),i=this,r=i.buttonType,a=i.type,o=i.disabled,s=i.rel,l=i.target,c=i.size,u=i.href,h=i.color,d=i.expand,f=i.hasIconOnly,p=i.shape,v=i.strong,m=c===void 0&&this.inItem?"small":c,g=u===void 0?"button":"a",y=g==="button"?{type:a}:{download:this.download,href:u,rel:s,target:l},b=this.fill;return b===void 0&&(b=this.inToolbar?"clear":"solid"),T(ut,{onClick:this.handleClick,"aria-disabled":o?"true":null,class:Object.assign(Object.assign({},tn(h)),(t={},t[n]=!0,t[r]=!0,t[r+"-"+d]=d!==void 0,t[r+"-"+m]=m!==void 0,t[r+"-"+p]=p!==void 0,t[r+"-"+b]=!0,t[r+"-strong"]=v,t["button-has-icon-only"]=f,t["button-disabled"]=o,t["ion-activatable"]=!0,t["ion-focusable"]=!0,t))},T(g,Object.assign({},y,{class:"button-native",disabled:o,onFocus:this.onFocus,onBlur:this.onBlur}),T("span",{class:"button-inner"},T("slot",{name:"icon-only"}),T("slot",{name:"start"}),T("slot",null),T("slot",{name:"end"})),n==="md"&&T("ion-ripple-effect",{type:this.rippleType})))},Object.defineProperty(e.prototype,"el",{get:function(){return ht(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e,"style",{get:function(){return":host{--overflow:hidden;--ripple-color:currentColor;--border-width:initial;--border-color:initial;--border-style:initial;--color-hover:initial;--box-shadow:none;display:inline-block;width:auto;color:var(--color);font-family:var(--ion-font-family,inherit);text-align:center;text-decoration:none;text-overflow:ellipsis;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;vertical-align:top;vertical-align:-webkit-baseline-middle;pointer-events:auto;-webkit-font-kerning:none;font-kerning:none}:host(.button-disabled){--opacity:.5;pointer-events:none}:host(.button-disabled) .button-native{cursor:default;pointer-events:none}:host(.button-solid){--background:var(--ion-color-primary,#3880ff);--background-focused:var(--ion-color-primary-shade,#3171e0);--background-hover:var(--ion-color-primary-tint,#4c8dff);--color:var(--ion-color-primary-contrast,#fff);--color-activated:var(--ion-color-primary-contrast,#fff);--color-focused:var(--ion-color-primary-contrast,#fff)}:host(.button-solid.ion-color) .button-native{background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(.button-solid.ion-color.ion-focused) .button-native{background:var(--ion-color-shade)}:host(.button-outline){--border-color:var(--ion-color-primary,#3880ff);--background:transparent;--color:var(--ion-color-primary,#3880ff);--color-focused:var(--ion-color-primary,#3880ff)}:host(.button-outline.ion-color) .button-native{border-color:var(--ion-color-base);background:transparent;color:var(--ion-color-base)}:host(.button-outline.ion-focused.ion-color) .button-native{background:rgba(var(--ion-color-base-rgb),.1);color:var(--ion-color-base)}:host(.button-clear){--border-width:0;--background:transparent;--color:var(--ion-color-primary,#3880ff)}:host(.button-clear.ion-color) .button-native{background:transparent;color:var(--ion-color-base)}:host(.button-clear.ion-focused.ion-color) .button-native{background:rgba(var(--ion-color-base-rgb),.1);color:var(--ion-color-base)}:host(.button-clear.activated.ion-color) .button-native{background:transparent}:host(.button-block){display:block}:host(.button-block) .button-native{margin-left:0;margin-right:0;display:block;width:100%;clear:both;contain:content}:host(.button-block) .button-native:after{clear:both}:host(.button-full){display:block}:host(.button-full) .button-native{margin-left:0;margin-right:0;display:block;width:100%;contain:content}:host(.button-full:not(.button-round)) .button-native{border-radius:0;border-right-width:0;border-left-width:0}.button-native{border-radius:var(--border-radius);-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:var(--padding-start);padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:block;position:relative;width:100%;height:100%;-webkit-transition:var(--transition);transition:var(--transition);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);outline:none;background:var(--background);line-height:1;-webkit-box-shadow:var(--box-shadow);box-shadow:var(--box-shadow);contain:layout style;cursor:pointer;opacity:var(--opacity);overflow:var(--overflow);z-index:0;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-appearance:none;-moz-appearance:none;appearance:none}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){.button-native{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}.button-native::-moz-focus-inner{border:0}.button-inner{display:-ms-flexbox;display:flex;-ms-flex-flow:row nowrap;flex-flow:row nowrap;-ms-flex-negative:0;flex-shrink:0;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:100%;height:100%}::slotted(ion-icon){font-size:1.4em;pointer-events:none}::slotted(ion-icon[slot=start]){margin-left:-.3em;margin-right:.3em;margin-top:0;margin-bottom:0}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){::slotted(ion-icon[slot=start]){margin-left:unset;margin-right:unset;-webkit-margin-start:-.3em;margin-inline-start:-.3em;-webkit-margin-end:.3em;margin-inline-end:.3em}}::slotted(ion-icon[slot=end]){margin-left:.3em;margin-right:-.2em;margin-top:0;margin-bottom:0}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){::slotted(ion-icon[slot=end]){margin-left:unset;margin-right:unset;-webkit-margin-start:.3em;margin-inline-start:.3em;-webkit-margin-end:-.2em;margin-inline-end:-.2em}}::slotted(ion-icon[slot=icon-only]){font-size:1.8em}ion-ripple-effect{color:var(--ripple-color)}:host(.ion-focused) .button-native{background:var(--background-focused);color:var(--color-focused)}:host(.activated) .button-native{background:var(--background-activated);color:var(--color-activated)}@media (any-hover:hover){:host(:hover) .button-native{background:var(--background-hover);color:var(--color-hover)}}:host{--border-radius:4px;--padding-top:0;--padding-bottom:0;--padding-start:1.1em;--padding-end:1.1em;--transition:box-shadow 280ms cubic-bezier(.4,0,.2,1),background-color 15ms linear,color 15ms linear;margin-left:2px;margin-right:2px;margin-top:4px;margin-bottom:4px;height:36px;font-size:14px;font-weight:500;letter-spacing:.06em;text-transform:uppercase}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){:host{margin-left:unset;margin-right:unset;-webkit-margin-start:2px;margin-inline-start:2px;-webkit-margin-end:2px;margin-inline-end:2px}}:host(.button-solid){--background-activated:var(--background);--box-shadow:0 3px 1px -2px rgba(0,0,0,0.2),0 2px 2px 0 rgba(0,0,0,0.14),0 1px 5px 0 rgba(0,0,0,0.12)}:host(.button-solid.activated){--box-shadow:0 5px 5px -3px rgba(0,0,0,0.2),0 8px 10px 1px rgba(0,0,0,0.14),0 3px 14px 2px rgba(0,0,0,0.12)}:host(.button-outline){--border-width:2px;--border-style:solid;--box-shadow:none;--background-activated:transparent;--background-focused:rgba(var(--ion-color-primary-rgb,56,128,255),0.1);--background-hover:rgba(var(--ion-color-primary-rgb,56,128,255),0.04);--color-activated:var(--ion-color-primary,#3880ff)}:host(.button-outline.activated.ion-color) .button-native{background:transparent}:host(.button-clear){--background-activated:transparent;--background-focused:rgba(var(--ion-color-primary-rgb,56,128,255),0.1);--background-hover:rgba(var(--ion-color-primary-rgb,56,128,255),0.04);--color-activated:var(--ion-color-primary,#3880ff);--color-focused:var(--ion-color-primary,#3880ff)}:host(.button-round){--border-radius:64px;--padding-top:0;--padding-start:26px;--padding-end:26px;--padding-bottom:0}:host(.button-large){--padding-top:0;--padding-start:1em;--padding-end:1em;--padding-bottom:0;height:2.8em;font-size:20px}:host(.button-small){--padding-top:0;--padding-start:0.9em;--padding-end:0.9em;--padding-bottom:0;height:2.1em;font-size:13px}:host(.button-strong){font-weight:700}::slotted(ion-icon[slot=icon-only]){padding-left:0;padding-right:0;padding-top:0;padding-bottom:0}@media (any-hover:hover){:host(.button-solid.ion-color:hover) .button-native{background:var(--ion-color-tint)}:host(.button-clear.ion-color:hover) .button-native,:host(.button-outline.ion-color:hover) .button-native{background:rgba(var(--ion-color-base-rgb),.04)}}"},enumerable:!0,configurable:!0}),e}(),ds,Vb=function(){if(!ds){var e=window;e.Ionicons=e.Ionicons||{},ds=e.Ionicons.map=e.Ionicons.map||new Map}return ds},Wb=function(e){var t=fs(e.src);return t||(t=uh(e.name,e.icon,e.mode,e.ios,e.md),t?jb(t):e.icon&&(t=fs(e.icon),t||(t=fs(e.icon[e.mode]),t))?t:null)},jb=function(e){var t=Vb().get(e);return t||Nl("svg/"+e+".svg")},uh=function(e,t,n,i,r){if(n=(n&&n.toLowerCase())==="ios"?"ios":"md",i&&n==="ios"?e=i.toLowerCase():r&&n==="md"?e=r.toLowerCase():(!e&&t&&!hh(t)&&(e=t),Io(e)&&(e=e.toLowerCase(),/^md-|^ios-|^logo-/.test(e)||(e=n+"-"+e))),!Io(e)||e.trim()==="")return null;var a=e.replace(/[a-z]|-|\d/gi,"");return a!==""?null:e},fs=function(e){return Io(e)&&(e=e.trim(),hh(e))?e:null},hh=function(e){return e.length>0&&/(\/|\.)/.test(e)},Io=function(e){return typeof e=="string"},Yb=function(e){if(e){var t=document.createElement("div");t.innerHTML=e;for(var n=t.childNodes.length-1;n>=0;n--)t.childNodes[n].nodeName.toLowerCase()!=="svg"&&t.removeChild(t.childNodes[n]);var i=t.firstElementChild;if(i&&i.nodeName.toLowerCase()==="svg"&&(i.setAttribute("class","s-ion-icon"),dh(i)))return t.innerHTML}return""},dh=function(e){if(e.nodeType===1){if(e.nodeName.toLowerCase()==="script")return!1;for(var t=0;t<e.attributes.length;t++){var n=e.attributes[t].value;if(Io(n)&&n.toLowerCase().indexOf("on")===0)return!1}for(var t=0;t<e.childNodes.length;t++)if(!dh(e.childNodes[t]))return!1}return!0},fc=new Map,Xb=function(e){var t=fc.get(e);return t||(t=fetch(e).then(function(n){return n.status<=299?n.text():Promise.resolve(null)}).then(function(n){return Yb(n)}),fc.set(e,t)),t},R0=function(){function e(t){Ye(this,t),this.mode=Zb(this),this.isVisible=!1,this.lazy=!1}return e.prototype.connectedCallback=function(){var t=this;this.waitUntilVisible(this.el,"50px",function(){t.isVisible=!0,t.loadIcon()})},e.prototype.disconnectedCallback=function(){this.io&&(this.io.disconnect(),this.io=void 0)},e.prototype.waitUntilVisible=function(t,n,i){var r=this;if(this.lazy&&typeof window<"u"&&window.IntersectionObserver){var a=this.io=new window.IntersectionObserver(function(o){o[0].isIntersecting&&(a.disconnect(),r.io=void 0,i())},{rootMargin:n});a.observe(t)}else i()},e.prototype.loadIcon=function(){var t=this;if(this.isVisible){var n=Wb(this);n&&Xb(n).then(function(r){return t.svgContent=r})}if(!this.ariaLabel){var i=uh(this.name,this.icon,this.mode,this.ios,this.md);i&&(this.ariaLabel=i.replace("ios-","").replace("md-","").replace(/\-/g," "))}},e.prototype.render=function(){var t,n,i=this.mode||"md",r=this.flipRtl||this.ariaLabel&&this.ariaLabel.indexOf("arrow")>-1&&this.flipRtl!==!1;return T(ut,{role:"img",class:Object.assign((t={},t[i]=!0,t),qb(this.color),(n={},n["icon-"+this.size]=!!this.size,n["flip-rtl"]=!!r&&this.el.ownerDocument.dir==="rtl",n))},this.svgContent?T("div",{class:"icon-inner",innerHTML:this.svgContent}):T("div",{class:"icon-inner"}))},Object.defineProperty(e,"assetsDirs",{get:function(){return["svg"]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"el",{get:function(){return ht(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e,"watchers",{get:function(){return{name:["loadIcon"],src:["loadIcon"],icon:["loadIcon"]}},enumerable:!0,configurable:!0}),Object.defineProperty(e,"style",{get:function(){return":host{display:inline-block;width:1em;height:1em;contain:strict;fill:currentColor;-webkit-box-sizing:content-box!important;box-sizing:content-box!important}.icon-inner,svg{display:block;height:100%;width:100%}:host(.flip-rtl) .icon-inner{-webkit-transform:scaleX(-1);transform:scaleX(-1)}:host(.icon-small){font-size:18px!important}:host(.icon-large){font-size:32px!important}:host(.ion-color){color:var(--ion-color-base)!important}:host(.ion-color-primary){--ion-color-base:var(--ion-color-primary,#3880ff)}:host(.ion-color-secondary){--ion-color-base:var(--ion-color-secondary,#0cd1e8)}:host(.ion-color-tertiary){--ion-color-base:var(--ion-color-tertiary,#f4a942)}:host(.ion-color-success){--ion-color-base:var(--ion-color-success,#10dc60)}:host(.ion-color-warning){--ion-color-base:var(--ion-color-warning,#ffce00)}:host(.ion-color-danger){--ion-color-base:var(--ion-color-danger,#f14141)}:host(.ion-color-light){--ion-color-base:var(--ion-color-light,#f4f5f8)}:host(.ion-color-medium){--ion-color-base:var(--ion-color-medium,#989aa2)}:host(.ion-color-dark){--ion-color-base:var(--ion-color-dark,#222428)}"},enumerable:!0,configurable:!0}),e}(),Zb=function(e){return kl(e)||document.documentElement.getAttribute("mode")||"md"},qb=function(e){var t;return e?(t={"ion-color":!0},t["ion-color-"+e]=!0,t):null},I0=function(){function e(t){var n=this;Ye(this,t),this.inputId="ion-input-"+Jb++,this.didBlurAfterEdit=!1,this.hasFocus=!1,this.autocapitalize="off",this.autocomplete="off",this.autocorrect="off",this.autofocus=!1,this.clearInput=!1,this.debounce=0,this.disabled=!1,this.name=this.inputId,this.readonly=!1,this.required=!1,this.spellcheck=!1,this.type="text",this.value="",this.onInput=function(i){var r=i.target;r&&(n.value=r.value||""),n.ionInput.emit(i)},this.onBlur=function(){n.hasFocus=!1,n.focusChanged(),n.emitStyle(),n.ionBlur.emit()},this.onFocus=function(){n.hasFocus=!0,n.focusChanged(),n.emitStyle(),n.ionFocus.emit()},this.onKeydown=function(){n.shouldClearOnEdit()&&(n.didBlurAfterEdit&&n.hasValue()&&n.clearTextInput(),n.didBlurAfterEdit=!1)},this.clearTextInput=function(i){n.clearInput&&!n.readonly&&!n.disabled&&i&&(i.preventDefault(),i.stopPropagation()),n.value="",n.nativeInput&&(n.nativeInput.value="")},this.ionInput=ve(this,"ionInput",7),this.ionChange=ve(this,"ionChange",7),this.ionBlur=ve(this,"ionBlur",7),this.ionFocus=ve(this,"ionFocus",7),this.ionInputDidLoad=ve(this,"ionInputDidLoad",7),this.ionInputDidUnload=ve(this,"ionInputDidUnload",7),this.ionStyle=ve(this,"ionStyle",7)}return e.prototype.debounceChanged=function(){this.ionChange=Ba(this.ionChange,this.debounce)},e.prototype.disabledChanged=function(){this.emitStyle()},e.prototype.valueChanged=function(){this.emitStyle(),this.ionChange.emit({value:this.value})},e.prototype.connectedCallback=function(){this.emitStyle(),this.debounceChanged(),this.el.dispatchEvent(new CustomEvent("ionInputDidLoad",{detail:this.el}))},e.prototype.disconnectedCallback=function(){document.dispatchEvent(new CustomEvent("ionInputDidUnload",{detail:this.el}))},e.prototype.setFocus=function(){return te(this,void 0,void 0,function(){return ne(this,function(t){return this.nativeInput&&this.nativeInput.focus(),[2]})})},e.prototype.getInputElement=function(){return Promise.resolve(this.nativeInput)},e.prototype.shouldClearOnEdit=function(){var t=this,n=t.type,i=t.clearOnEdit;return i===void 0?n==="password":i},e.prototype.getValue=function(){return this.value||""},e.prototype.emitStyle=function(){this.ionStyle.emit({interactive:!0,input:!0,"has-placeholder":this.placeholder!=null,"has-value":this.hasValue(),"has-focus":this.hasFocus,"interactive-disabled":this.disabled})},e.prototype.focusChanged=function(){!this.hasFocus&&this.shouldClearOnEdit()&&this.hasValue()&&(this.didBlurAfterEdit=!0)},e.prototype.hasValue=function(){return this.getValue().length>0},e.prototype.render=function(){var t,n=this,i=dt(this),r=this.getValue(),a=this.inputId+"-lbl",o=Ri(this.el);return o&&(o.id=a),T(ut,{"aria-disabled":this.disabled?"true":null,class:Object.assign(Object.assign({},tn(this.color)),(t={},t[i]=!0,t["has-value"]=this.hasValue(),t["has-focus"]=this.hasFocus,t))},T("input",{class:"native-input",ref:function(s){return n.nativeInput=s},"aria-labelledby":a,disabled:this.disabled,accept:this.accept,autoCapitalize:this.autocapitalize,autoComplete:this.autocomplete,autoCorrect:this.autocorrect,autoFocus:this.autofocus,inputMode:this.inputmode,min:this.min,max:this.max,minLength:this.minlength,maxLength:this.maxlength,multiple:this.multiple,name:this.name,pattern:this.pattern,placeholder:this.placeholder||"",readOnly:this.readonly,required:this.required,spellCheck:this.spellcheck,step:this.step,size:this.size,type:this.type,value:r,onInput:this.onInput,onBlur:this.onBlur,onFocus:this.onFocus,onKeyDown:this.onKeydown}),this.clearInput&&!this.readonly&&!this.disabled&&T("button",{type:"button",class:"input-clear-icon",tabindex:"-1",onTouchStart:this.clearTextInput,onMouseDown:this.clearTextInput}))},Object.defineProperty(e.prototype,"el",{get:function(){return ht(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e,"watchers",{get:function(){return{debounce:["debounceChanged"],disabled:["disabledChanged"],value:["valueChanged"]}},enumerable:!0,configurable:!0}),Object.defineProperty(e,"style",{get:function(){return`.sc-ion-input-md-h{--placeholder-color:initial;--placeholder-font-style:initial;--placeholder-font-weight:initial;--placeholder-opacity:.5;--padding-top:0;--padding-bottom:0;--padding-start:0;--background:transparent;--color:initial;display:-ms-flexbox;display:flex;position:relative;-ms-flex:1;flex:1;-ms-flex-align:center;align-items:center;width:100%;padding:0!important;background:var(--background);color:var(--color);font-family:var(--ion-font-family,inherit);z-index:2}ion-item.sc-ion-input-md-h:not(.item-label), ion-item:not(.item-label) .sc-ion-input-md-h{--padding-start:0}.ion-color.sc-ion-input-md-h{color:var(--ion-color-base)}.native-input.sc-ion-input-md{border-radius:var(--border-radius);padding-left:var(--padding-start);padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:inline-block;-ms-flex:1;flex:1;width:100%;max-width:100%;max-height:100%;border:0;outline:none;background:transparent;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-appearance:none;-moz-appearance:none;appearance:none}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){.native-input.sc-ion-input-md{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}.native-input.sc-ion-input-md::-webkit-input-placeholder{color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.native-input.sc-ion-input-md::-moz-placeholder{color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.native-input.sc-ion-input-md:-ms-input-placeholder{color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.native-input.sc-ion-input-md::-ms-input-placeholder{color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.native-input.sc-ion-input-md::placeholder{color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.native-input.sc-ion-input-md:-webkit-autofill{background-color:transparent}.native-input.sc-ion-input-md:invalid{-webkit-box-shadow:none;box-shadow:none}.native-input.sc-ion-input-md::-ms-clear{display:none}.native-input[disabled].sc-ion-input-md{opacity:.4}.cloned-input.sc-ion-input-md{left:0;top:0;position:absolute;pointer-events:none}[dir=rtl].sc-ion-input-md-h .cloned-input.sc-ion-input-md, [dir=rtl] .sc-ion-input-md-h .cloned-input.sc-ion-input-md, [dir=rtl].sc-ion-input-md .cloned-input.sc-ion-input-md{left:unset;right:unset;right:0}.input-clear-icon.sc-ion-input-md{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;background-position:50%;border:0;outline:none;background-color:transparent;background-repeat:no-repeat;visibility:hidden;-webkit-appearance:none;-moz-appearance:none;appearance:none}.has-focus.has-value.sc-ion-input-md-h .input-clear-icon.sc-ion-input-md{visibility:visible}.has-focus.sc-ion-input-md-h{pointer-events:none}.has-focus.sc-ion-input-md-h a.sc-ion-input-md, .has-focus.sc-ion-input-md-h button.sc-ion-input-md, .has-focus.sc-ion-input-md-h input.sc-ion-input-md{pointer-events:auto}.sc-ion-input-md-h{--padding-top:10px;--padding-end:0;--padding-bottom:10px;--padding-start:8px;font-size:inherit}.item-label-floating.sc-ion-input-md-h, .item-label-floating .sc-ion-input-md-h, .item-label-stacked.sc-ion-input-md-h, .item-label-stacked .sc-ion-input-md-h{--padding-top:8px;--padding-bottom:8px;--padding-start:0}.input-clear-icon.sc-ion-input-md{background-image:url("data:image/svg+xml;charset=utf-8,<svg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20512%20512'><polygon%20fill='var(--ion-color-step-600,%20%23666666)'%20points='405,136.798%20375.202,107%20256,226.202%20136.798,107%20107,136.798%20226.202,256%20107,375.202%20136.798,405%20256,285.798%20375.202,405%20405,375.202%20285.798,256'/></svg>");width:30px;height:30px;background-size:22px}`},enumerable:!0,configurable:!0}),e}(),Jb=0,P0=function(){function e(t){Ye(this,t),this.itemStyles=new Map,this.multipleInputs=!1,this.button=!1,this.detailIcon="ios-arrow-forward",this.disabled=!1,this.routerDirection="forward",this.type="button"}return e.prototype.itemStyle=function(t){t.stopPropagation();var n=t.target.tagName,i=t.detail,r={},a=this.itemStyles.get(n)||{},o=!1;Object.keys(i).forEach(function(s){if(i[s]){var l="item-"+s;a[l]||(o=!0),r[l]=!0}}),!o&&Object.keys(r).length!==Object.keys(a).length&&(o=!0),o&&(this.itemStyles.set(n,r),this.el.forceUpdate())},e.prototype.componentDidLoad=function(){var t=this.el.querySelectorAll("ion-checkbox, ion-datetime, ion-select, ion-radio"),n=this.el.querySelectorAll("ion-input, ion-range, ion-searchbar, ion-segment, ion-textarea, ion-toggle");this.multipleInputs=t.length+n.length>1},e.prototype.hasCover=function(){var t=this.el.querySelectorAll("ion-checkbox, ion-datetime, ion-select, ion-radio");return t.length===1&&!this.multipleInputs},e.prototype.isClickable=function(){return this.href!==void 0||this.button},e.prototype.canActivate=function(){return this.isClickable()||this.hasCover()},e.prototype.render=function(){var t,n=this,i=n.detail,r=n.detailIcon,a=n.download,o=n.lines,s=n.disabled,l=n.href,c=n.rel,u=n.target,h=n.routerDirection,d={},f=dt(this),p=this.isClickable(),v=this.canActivate(),m=p?l===void 0?"button":"a":"div",g=m==="button"?{type:this.type}:{download:a,href:l,rel:c,target:u},y=i!==void 0?i:f==="ios"&&p;return this.itemStyles.forEach(function(b){Object.assign(d,b)}),T(ut,{"aria-disabled":s?"true":null,class:Object.assign(Object.assign(Object.assign({},d),tn(this.color)),(t={item:!0},t[f]=!0,t["item-lines-"+o]=o!==void 0,t["item-disabled"]=s,t["in-list"]=Er("ion-list",this.el),t["item-multiple-inputs"]=this.multipleInputs,t["ion-activatable"]=v,t["ion-focusable"]=!0,t))},T(m,Object.assign({},g,{class:"item-native",disabled:s,onClick:function(b){return Jo(l,b,h)}}),T("slot",{name:"start"}),T("div",{class:"item-inner"},T("div",{class:"input-wrapper"},T("slot",null)),T("slot",{name:"end"}),y&&T("ion-icon",{icon:r,lazy:!1,class:"item-detail-icon"}),T("div",{class:"item-inner-highlight"})),v&&f==="md"&&T("ion-ripple-effect",null)),T("div",{class:"item-highlight"}))},Object.defineProperty(e.prototype,"el",{get:function(){return ht(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e,"style",{get:function(){return":host{--border-radius:0px;--border-width:0px;--border-style:solid;--padding-top:0px;--padding-bottom:0px;--padding-end:0px;--padding-start:0px;--box-shadow:none;--inner-border-width:0px;--inner-padding-top:0px;--inner-padding-bottom:0px;--inner-padding-start:0px;--inner-padding-end:0px;--inner-box-shadow:none;--show-full-highlight:0;--show-inset-highlight:0;--detail-icon-color:initial;--detail-icon-font-size:20px;--detail-icon-opacity:0.25;--color-activated:var(--color);--color-focused:var(--color);--color-hover:var(--color);--ripple-color:var(--ion-item-background-activated,currentColor);-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;display:block;position:relative;outline:none;color:var(--color);font-family:var(--ion-font-family,inherit);text-align:initial;text-decoration:none;-webkit-box-sizing:border-box;box-sizing:border-box;overflow:hidden}:host(.ion-color) .item-native{background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(.ion-color) .item-inner,:host(.ion-color) .item-native{border-color:var(--ion-color-shade)}:host(.ion-focused) .item-native{background:var(--background-focused);color:var(--color-focused)}:host(.ion-color.ion-focused) .item-native{background:var(--ion-color-shade);color:var(--ion-color-contrast)}@media (any-hover:hover){:host(.ion-activatable:hover) .item-native{background:var(--background-hover);color:var(--color-hover)}:host(.ion-color.ion-activatable:hover) .item-native{background:var(--ion-color-tint);color:var(--ion-color-contrast)}}:host(.activated) .item-native{background:var(--background-activated);color:var(--color-activated)}:host(.item-disabled),:host(.item-interactive-disabled:not(.item-multiple-inputs)){cursor:default;pointer-events:none}:host(.item-disabled){opacity:.3}.item-native{border-radius:var(--border-radius);margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:-ms-flexbox;display:flex;position:relative;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;width:100%;min-height:var(--min-height);-webkit-transition:var(--transition);transition:var(--transition);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);outline:none;background:var(--background);-webkit-box-shadow:var(--box-shadow);box-shadow:var(--box-shadow);overflow:inherit;-webkit-box-sizing:border-box;box-sizing:border-box}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){.item-native{padding-left:unset;padding-right:unset;-webkit-padding-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));padding-inline-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}.item-native::-moz-focus-inner{border:0}a,button{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-user-drag:none}.item-inner{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:var(--inner-padding-start);padding-right:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end));padding-top:var(--inner-padding-top);padding-bottom:var(--inner-padding-bottom);display:-ms-flexbox;display:flex;position:relative;-ms-flex:1;flex:1;-ms-flex-direction:inherit;flex-direction:inherit;-ms-flex-align:inherit;align-items:inherit;-ms-flex-item-align:stretch;align-self:stretch;min-height:inherit;border-width:var(--inner-border-width);border-style:var(--border-style);border-color:var(--border-color);-webkit-box-shadow:var(--inner-box-shadow);box-shadow:var(--inner-box-shadow);overflow:inherit;-webkit-box-sizing:border-box;box-sizing:border-box}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){.item-inner{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--inner-padding-start);padding-inline-start:var(--inner-padding-start);-webkit-padding-end:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end));padding-inline-end:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end))}}.item-detail-icon{color:var(--detail-icon-color);font-size:var(--detail-icon-font-size);opacity:var(--detail-icon-opacity)}::slotted(ion-icon){font-size:1.6em}::slotted(ion-button){--margin-top:0;--margin-bottom:0;--margin-start:0;--margin-end:0;z-index:1}::slotted(ion-label){-ms-flex:1;flex:1}:host(.item-input),:host([vertical-align-top]){-ms-flex-align:start;align-items:flex-start}.input-wrapper{display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;-ms-flex-direction:inherit;flex-direction:inherit;-ms-flex-align:inherit;align-items:inherit;-ms-flex-item-align:stretch;align-self:stretch;text-overflow:ellipsis;overflow:hidden;-webkit-box-sizing:border-box;box-sizing:border-box}:host(.item-label-floating) .item-native,:host(.item-label-stacked) .item-native{-ms-flex-align:start;align-items:start}:host(.item-label-floating) .input-wrapper,:host(.item-label-stacked) .input-wrapper{-ms-flex:1;flex:1;-ms-flex-direction:column;flex-direction:column}.item-highlight,.item-inner-highlight{left:0;right:0;bottom:0;position:absolute;background:var(--highlight-background)}.item-highlight{height:var(--full-highlight-height)}.item-inner-highlight{height:var(--inset-highlight-height)}:host(.item-interactive.ion-touched.ion-invalid),:host(.item-interactive.item-has-focus){--full-highlight-height:calc(var(--highlight-height) * var(--show-full-highlight));--inset-highlight-height:calc(var(--highlight-height) * var(--show-inset-highlight))}:host(.item-interactive.item-has-focus){--highlight-background:var(--highlight-color-focused)}:host(.item-interactive.ion-valid){--highlight-background:var(--highlight-color-valid)}:host(.item-interactive.ion-invalid){--highlight-background:var(--highlight-color-invalid)}:host(.item-label-floating) ::slotted(ion-select),:host(.item-label-stacked) ::slotted(ion-select){-ms-flex-item-align:stretch;align-self:stretch;width:100%;max-width:100%}:host(.item-label-floating) ::slotted(ion-datetime),:host(.item-label-stacked) ::slotted(ion-datetime){--padding-start:0;width:100%}:host(.item-multiple-inputs) ::slotted(ion-checkbox),:host(.item-multiple-inputs) ::slotted(ion-datetime),:host(.item-multiple-inputs) ::slotted(ion-radio),:host(.item-multiple-inputs) ::slotted(ion-select){position:relative}:host(.item-textarea){-ms-flex-align:stretch;align-items:stretch}::slotted(ion-reorder[slot]){margin-top:0;margin-bottom:0}ion-ripple-effect{color:var(--ripple-color)}:host{--min-height:48px;--background:var(--ion-item-background,var(--ion-background-color,#fff));--background-activated:var(--background);--background-focused:var(--ion-item-background-focused,var(--ion-color-step-100,#e1e1e1));--background-hover:var(--ion-item-background-hover,rgba(var(--ion-text-color-rgb,0,0,0),0.04));--transition:background-color 300ms cubic-bezier(.4,0,.2,1);--padding-start:16px;--color:var(--ion-item-color,var(--ion-text-color,#000));--border-color:var(--ion-item-border-color,var(--ion-border-color,var(--ion-color-step-150,rgba(0,0,0,0.13))));--inner-padding-end:16px;--inner-border-width:0 0 1px 0;--highlight-height:2px;--highlight-color-focused:var(--ion-color-primary,#3880ff);--highlight-color-valid:var(--ion-color-success,#10dc60);--highlight-color-invalid:var(--ion-color-danger,#f04141);font-size:16px;font-weight:400;text-transform:none}:host(.ion-focused.activated) .item-native{background:var(--background-focused);color:var(--color-focused)}:host(.ion-color.activated) .item-native{background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(.ion-color.ion-focused.activated) .item-native{background:var(--ion-color-shade);color:var(--ion-color-contrast)}:host(.item-interactive){--inner-border-width:0}:host(.item-interactive),:host(.item-lines-full){--border-width:0 0 1px 0;--show-full-highlight:1;--show-inset-highlight:0}:host(.item-lines-inset){--inner-border-width:0 0 1px 0;--show-full-highlight:0;--show-inset-highlight:1}:host(.item-lines-inset),:host(.item-lines-none){--border-width:0;--show-full-highlight:0}:host(.item-lines-full),:host(.item-lines-none){--inner-border-width:0;--show-inset-highlight:0}:host(.item-multi-line) ::slotted([slot=end]),:host(.item-multi-line) ::slotted([slot=start]){margin-top:16px;margin-bottom:16px;-ms-flex-item-align:start;align-self:flex-start}::slotted([slot=start]){margin-right:32px}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){::slotted([slot=start]){margin-right:unset;-webkit-margin-end:32px;margin-inline-end:32px}}::slotted([slot=end]){margin-left:32px}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){::slotted([slot=end]){margin-left:unset;-webkit-margin-start:32px;margin-inline-start:32px}}::slotted(ion-icon){color:rgba(var(--ion-text-color-rgb,0,0,0),.54);font-size:24px}:host(.ion-color) ::slotted(ion-icon){color:var(--ion-color-contrast)}::slotted(ion-icon[slot]){margin-top:12px;margin-bottom:12px}::slotted(ion-icon[slot=start]){margin-right:32px}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){::slotted(ion-icon[slot=start]){margin-right:unset;-webkit-margin-end:32px;margin-inline-end:32px}}::slotted(ion-icon[slot=end]){margin-left:16px}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){::slotted(ion-icon[slot=end]){margin-left:unset;-webkit-margin-start:16px;margin-inline-start:16px}}::slotted(ion-note),::slotted(ion-toggle[slot=end]),::slotted(ion-toggle[slot=start]){margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}::slotted(ion-note){-ms-flex-item-align:start;align-self:flex-start;font-size:11px}::slotted(ion-note[slot]){padding-left:0;padding-right:0;padding-top:18px;padding-bottom:10px}::slotted(ion-note[slot=start]){padding-right:16px}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){::slotted(ion-note[slot=start]){padding-right:unset;-webkit-padding-end:16px;padding-inline-end:16px}}::slotted(ion-note[slot=end]){padding-left:16px}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){::slotted(ion-note[slot=end]){padding-left:unset;-webkit-padding-start:16px;padding-inline-start:16px}}::slotted(ion-avatar){width:40px;height:40px}::slotted(ion-thumbnail){width:56px;height:56px}::slotted(ion-avatar),::slotted(ion-thumbnail){margin-top:8px;margin-bottom:8px}::slotted(ion-avatar[slot=start]),::slotted(ion-thumbnail[slot=start]){margin-right:16px}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){::slotted(ion-avatar[slot=start]),::slotted(ion-thumbnail[slot=start]){margin-right:unset;-webkit-margin-end:16px;margin-inline-end:16px}}::slotted(ion-avatar[slot=end]),::slotted(ion-thumbnail[slot=end]){margin-left:16px}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){::slotted(ion-avatar[slot=end]),::slotted(ion-thumbnail[slot=end]){margin-left:unset;-webkit-margin-start:16px;margin-inline-start:16px}}::slotted(ion-label){margin-left:0;margin-right:0;margin-top:11px;margin-bottom:10px}:host(.item-label-floating) ::slotted([slot=end]),:host(.item-label-stacked) ::slotted([slot=end]){margin-top:7px;margin-bottom:7px}:host(.item-radio) ::slotted(ion-label),:host(.item-toggle) ::slotted(ion-label){margin-left:0}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){:host(.item-radio) ::slotted(ion-label),:host(.item-toggle) ::slotted(ion-label){margin-left:unset;-webkit-margin-start:0;margin-inline-start:0}}::slotted(.button-small){--padding-top:0;--padding-bottom:0;--padding-start:.6em;--padding-end:.6em;height:25px;font-size:12px}:host(.item-label-floating),:host(.item-label-stacked){--min-height:55px}:host(.item-label-floating) ::slotted(ion-select),:host(.item-label-stacked) ::slotted(ion-select){--padding-top:8px;--padding-bottom:8px;--padding-start:0}:host(.item-has-focus:not(.ion-color)) ::slotted(.label-floating),:host(.item-has-focus:not(.ion-color)) ::slotted(.label-stacked){color:var(--ion-color-primary,#3880ff)}"},enumerable:!0,configurable:!0}),e}(),O0=function(){function e(t){Ye(this,t),this.sticky=!1}return e.prototype.render=function(){var t,n=dt(this);return T(ut,{class:Object.assign(Object.assign({},tn(this.color)),(t={},t[n]=!0,t["item-divider-sticky"]=this.sticky,t.item=!0,t))},T("slot",{name:"start"}),T("div",{class:"item-divider-inner"},T("div",{class:"item-divider-wrapper"},T("slot",null)),T("slot",{name:"end"})))},Object.defineProperty(e.prototype,"el",{get:function(){return ht(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e,"style",{get:function(){return":host{--padding-top:0px;--padding-end:0px;--padding-bottom:0px;--padding-start:0px;--inner-padding-top:0px;--inner-padding-end:0px;--inner-padding-bottom:0px;--inner-padding-start:0px;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;width:100%;min-height:30px;background:var(--background);color:var(--color);font-family:var(--ion-font-family,inherit);overflow:hidden;z-index:100;-webkit-box-sizing:border-box;box-sizing:border-box}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));padding-inline-start:calc(var(--padding-start) + var(--ion-safe-area-left, 0px));-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}:host(.ion-color){background:var(--ion-color-base);color:var(--ion-color-contrast)}:host(.item-divider-sticky){position:-webkit-sticky;position:sticky;top:0}.item-divider-inner{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:var(--inner-padding-start);padding-right:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end));padding-top:var(--inner-padding-top);padding-bottom:var(--inner-padding-bottom);display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;-ms-flex-direction:inherit;flex-direction:inherit;-ms-flex-align:inherit;align-items:inherit;-ms-flex-item-align:stretch;align-self:stretch;min-height:inherit;border:0;overflow:hidden}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){.item-divider-inner{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--inner-padding-start);padding-inline-start:var(--inner-padding-start);-webkit-padding-end:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end));padding-inline-end:calc(var(--ion-safe-area-right, 0px) + var(--inner-padding-end))}}.item-divider-wrapper{display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;-ms-flex-direction:inherit;flex-direction:inherit;-ms-flex-align:inherit;align-items:inherit;-ms-flex-item-align:stretch;align-self:stretch;text-overflow:ellipsis;overflow:hidden}:host{--background:var(--ion-background-color,#fff);--color:var(--ion-color-step-400,#999);--padding-start:16px;--inner-padding-end:0;border-bottom:1px solid var(--ion-item-border-color,var(--ion-border-color,var(--ion-color-step-150,rgba(0,0,0,.13))));font-size:14px}::slotted([slot=start]){margin-right:32px}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){::slotted([slot=start]){margin-right:unset;-webkit-margin-end:32px;margin-inline-end:32px}}::slotted([slot=end]){margin-left:32px}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){::slotted([slot=end]){margin-left:unset;-webkit-margin-start:32px;margin-inline-start:32px}}::slotted(ion-label){margin-left:0;margin-right:0;margin-top:13px;margin-bottom:10px}::slotted(ion-icon){color:rgba(var(--ion-text-color-rgb,0,0,0),.54);font-size:24px}:host(.ion-color) ::slotted(ion-icon){color:var(--ion-color-contrast)}::slotted(ion-icon[slot]){margin-top:12px;margin-bottom:12px}::slotted(ion-icon[slot=start]){margin-right:32px}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){::slotted(ion-icon[slot=start]){margin-right:unset;-webkit-margin-end:32px;margin-inline-end:32px}}::slotted(ion-icon[slot=end]){margin-left:16px}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){::slotted(ion-icon[slot=end]){margin-left:unset;-webkit-margin-start:16px;margin-inline-start:16px}}::slotted(ion-note){margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;-ms-flex-item-align:start;align-self:flex-start;font-size:11px}::slotted(ion-note[slot]){padding-left:0;padding-right:0;padding-top:18px;padding-bottom:10px}::slotted(ion-note[slot=start]){padding-right:16px}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){::slotted(ion-note[slot=start]){padding-right:unset;-webkit-padding-end:16px;padding-inline-end:16px}}::slotted(ion-note[slot=end]){padding-left:16px}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){::slotted(ion-note[slot=end]){padding-left:unset;-webkit-padding-start:16px;padding-inline-start:16px}}::slotted(ion-avatar){width:40px;height:40px}::slotted(ion-thumbnail){width:56px;height:56px}::slotted(ion-avatar),::slotted(ion-thumbnail){margin-top:8px;margin-bottom:8px}::slotted(ion-avatar[slot=start]),::slotted(ion-thumbnail[slot=start]){margin-right:16px}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){::slotted(ion-avatar[slot=start]),::slotted(ion-thumbnail[slot=start]){margin-right:unset;-webkit-margin-end:16px;margin-inline-end:16px}}::slotted(ion-avatar[slot=end]),::slotted(ion-thumbnail[slot=end]){margin-left:16px}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){::slotted(ion-avatar[slot=end]),::slotted(ion-thumbnail[slot=end]){margin-left:unset;-webkit-margin-start:16px;margin-inline-start:16px}}::slotted(h1){margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;font-size:24px;font-weight:400}::slotted(h2){font-size:16px}::slotted(h2),::slotted(h3,h4,h5,h6){margin-left:0;margin-right:0;margin-top:2px;margin-bottom:2px;font-weight:400}::slotted(h3,h4,h5,h6),::slotted(p){font-size:14px;line-height:normal}::slotted(p){margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;color:var(--ion-color-step-600,#666);text-overflow:inherit;overflow:inherit}"},enumerable:!0,configurable:!0}),e}(),D0=function(){function e(t){Ye(this,t),this.noAnimate=!1,this.ionStyle=ve(this,"ionStyle",7)}return e.prototype.componentWillLoad=function(){this.noAnimate=this.position==="floating",this.emitStyle()},e.prototype.componentDidLoad=function(){var t=this;this.noAnimate&&setTimeout(function(){t.noAnimate=!1},1e3)},e.prototype.positionChanged=function(){this.emitStyle()},e.prototype.emitStyle=function(){var t,n=this.position;this.ionStyle.emit((t={label:!0},t["label-"+n]=n!==void 0,t))},e.prototype.render=function(){var t,n=this.position,i=dt(this);return T(ut,{class:Object.assign(Object.assign({},tn(this.color)),(t={},t[i]=!0,t["label-"+n]=n!==void 0,t["label-no-animate"]=this.noAnimate,t))})},Object.defineProperty(e.prototype,"el",{get:function(){return ht(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e,"watchers",{get:function(){return{position:["positionChanged"]}},enumerable:!0,configurable:!0}),Object.defineProperty(e,"style",{get:function(){return".item.sc-ion-label-md-h, .item .sc-ion-label-md-h{--color:initial;display:block;color:var(--color);font-family:var(--ion-font-family,inherit);font-size:inherit;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;-webkit-box-sizing:border-box;box-sizing:border-box}.ion-color.sc-ion-label-md-h{color:var(--ion-color-base)}.ion-text-wrap.sc-ion-label-md-h, [text-wrap].sc-ion-label-md-h{white-space:normal}.item-interactive-disabled.sc-ion-label-md-h:not(.item-multiple-inputs), .item-interactive-disabled:not(.item-multiple-inputs) .sc-ion-label-md-h{cursor:default;opacity:.3;pointer-events:none}.item-input.sc-ion-label-md-h, .item-input .sc-ion-label-md-h{-ms-flex:initial;flex:initial;max-width:200px;pointer-events:none}.item-textarea.sc-ion-label-md-h, .item-textarea .sc-ion-label-md-h{-ms-flex-item-align:baseline;align-self:baseline}.label-fixed.sc-ion-label-md-h{-ms-flex:0 0 100px;flex:0 0 100px;width:100px;min-width:100px;max-width:200px}.label-floating.sc-ion-label-md-h, .label-stacked.sc-ion-label-md-h{-ms-flex-item-align:stretch;align-self:stretch;width:auto;max-width:100%}.label-no-animate.label-floating.sc-ion-label-md-h{-webkit-transition:none;transition:none}.ion-text-wrap.sc-ion-label-md-h, [text-wrap].sc-ion-label-md-h{line-height:1.5}.label-stacked.sc-ion-label-md-h{-webkit-transform-origin:left top;transform-origin:left top;-webkit-transform:translate3d(0,50%,0) scale(.75);transform:translate3d(0,50%,0) scale(.75);-webkit-transition:color .15s cubic-bezier(.4,0,.2,1);transition:color .15s cubic-bezier(.4,0,.2,1)}[dir=rtl].label-stacked.sc-ion-label-md-h, [dir=rtl] .label-stacked.sc-ion-label-md-h, [dir=rtl].sc-ion-label-md-h -no-combinator.label-stacked.sc-ion-label-md-h, [dir=rtl] .sc-ion-label-md-h -no-combinator.label-stacked.sc-ion-label-md-h{-webkit-transform-origin:right top;transform-origin:right top}.label-floating.sc-ion-label-md-h{-webkit-transform:translate3d(0,96%,0);transform:translate3d(0,96%,0);-webkit-transform-origin:left top;transform-origin:left top;-webkit-transition:color .15s cubic-bezier(.4,0,.2,1),-webkit-transform .15s cubic-bezier(.4,0,.2,1);transition:color .15s cubic-bezier(.4,0,.2,1),-webkit-transform .15s cubic-bezier(.4,0,.2,1);transition:color .15s cubic-bezier(.4,0,.2,1),transform .15s cubic-bezier(.4,0,.2,1);transition:color .15s cubic-bezier(.4,0,.2,1),transform .15s cubic-bezier(.4,0,.2,1),-webkit-transform .15s cubic-bezier(.4,0,.2,1)}[dir=rtl].label-floating.sc-ion-label-md-h, [dir=rtl] .label-floating.sc-ion-label-md-h, [dir=rtl].sc-ion-label-md-h -no-combinator.label-floating.sc-ion-label-md-h, [dir=rtl] .sc-ion-label-md-h -no-combinator.label-floating.sc-ion-label-md-h{-webkit-transform-origin:right top;transform-origin:right top}.label-floating.sc-ion-label-md-h, .label-stacked.sc-ion-label-md-h{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}.item-select.label-floating.sc-ion-label-md-h, .item-select .label-floating.sc-ion-label-md-h{-webkit-transform:translate3d(0,130%,0);transform:translate3d(0,130%,0)}.item-has-focus.label-floating.sc-ion-label-md-h, .item-has-focus .label-floating.sc-ion-label-md-h, .item-has-placeholder.label-floating.sc-ion-label-md-h, .item-has-placeholder .label-floating.sc-ion-label-md-h, .item-has-value.label-floating.sc-ion-label-md-h, .item-has-value .label-floating.sc-ion-label-md-h{-webkit-transform:translate3d(0,50%,0) scale(.75);transform:translate3d(0,50%,0) scale(.75)}.item-has-focus.label-floating.sc-ion-label-md-h, .item-has-focus .label-floating.sc-ion-label-md-h, .item-has-focus.label-stacked.sc-ion-label-md-h, .item-has-focus .label-stacked.sc-ion-label-md-h{color:var(--ion-color-primary,#3880ff)}.sc-ion-label-md-s  h1 {margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;font-size:24px;font-weight:400}.sc-ion-label-md-s  h2 {margin-left:0;margin-right:0;margin-top:2px;margin-bottom:2px;font-size:16px;font-weight:400}.sc-ion-label-md-s  h3 , .sc-ion-label-md-s  h4 , .sc-ion-label-md-s  h5 , .sc-ion-label-md-s  h6 {margin-left:0;margin-right:0;margin-top:2px;margin-bottom:2px;font-size:14px;font-weight:400;line-height:normal}.sc-ion-label-md-s  p {margin-left:0;margin-right:0;margin-top:0;margin-bottom:2px;font-size:14px;line-height:20px;text-overflow:inherit;overflow:inherit}.sc-ion-label-md-s > p{color:var(--ion-color-step-600,#666)}.sc-ion-label-md-h.ion-color.sc-ion-label-md-s > p, .ion-color .sc-ion-label-md-h.sc-ion-label-md-s > p{color:inherit}"},enumerable:!0,configurable:!0}),e}(),k0=function(){function e(t){Ye(this,t),this.inset=!1}return e.prototype.closeSlidingItems=function(){return te(this,void 0,void 0,function(){var t;return ne(this,function(n){return t=this.el.querySelector("ion-item-sliding"),t&&t.closeOpened?[2,t.closeOpened()]:[2,!1]})})},e.prototype.render=function(){var t,n=dt(this),i=this,r=i.lines,a=i.inset;return T(ut,{class:(t={},t[n]=!0,t["list-"+n]=!0,t["list-inset"]=a,t["list-lines-"+r]=r!==void 0,t["list-"+n+"-lines-"+r]=r!==void 0,t)})},Object.defineProperty(e.prototype,"el",{get:function(){return ht(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e,"style",{get:function(){return"ion-list{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;display:block;contain:content;list-style-type:none}ion-list.list-inset{-webkit-transform:translateZ(0);transform:translateZ(0);overflow:hidden}.list-md{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:8px;padding-bottom:8px;background:var(--ion-item-background,var(--ion-background-color,#fff))}.list-md>.input:last-child:after{left:0}:host-context([dir=rtl]) .list-md>.input:last-child:after,[dir=rtl] .list-md>.input:last-child:after{left:unset;right:unset;right:0}.list-md.list-inset{margin-left:16px;margin-right:16px;margin-top:16px;margin-bottom:16px;border-radius:2px}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){.list-md.list-inset{margin-left:unset;margin-right:unset;-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:16px;margin-inline-end:16px}}.list-md.list-inset ion-item:first-child{--border-radius:2px 2px 0 0;--border-width:0 0 1px 0}.list-md.list-inset ion-item:last-child{--border-radius:0 0 2px,2px;--border-width:0}.list-md.list-inset .item-interactive{--padding-start:0;--padding-end:0}.list-md.list-inset+ion-list.list-inset{margin-top:0}.list-md-lines-none .item{--border-width:0;--inner-border-width:0}.list-md-lines-full .item,.list-md .item-lines-full{--border-width:0 0 1px 0}.list-md-lines-full .item{--inner-border-width:0}.list-md-lines-inset .item,.list-md .item-lines-inset{--inner-border-width:0 0 1px 0}.list-md .item-lines-inset{--border-width:0}.list-md .item-lines-full{--inner-border-width:0}.list-md .item-lines-none{--border-width:0;--inner-border-width:0}"},enumerable:!0,configurable:!0}),e}(),N0=function(){function e(t){Ye(this,t)}return e.prototype.render=function(){var t,n=dt(this);return T(ut,{class:Object.assign(Object.assign({},tn(this.color)),(t={},t[n]=!0,t))},T("slot",null))},Object.defineProperty(e,"style",{get:function(){return":host{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between;width:100%;min-height:40px;background:var(--background);color:var(--color);overflow:hidden}:host(.ion-color){background:var(--ion-color-base);color:var(--ion-color-contrast)}:host{--background:transparent;--color:var(--ion-text-color,#000);padding-left:calc(var(--ion-safe-area-left, 0px) + 16px);min-height:45px;font-size:14px}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){:host{padding-left:unset;-webkit-padding-start:calc(var(--ion-safe-area-left, 0px) + 16px);padding-inline-start:calc(var(--ion-safe-area-left, 0px) + 16px)}}"},enumerable:!0,configurable:!0}),e}(),B0=function(){function e(t){var n=this;Ye(this,t),this.noUpdate=!1,this.hasFocus=!1,this.ratioA=0,this.ratioB=0,this.debounce=0,this.name="",this.dualKnobs=!1,this.min=0,this.max=100,this.pin=!1,this.snaps=!1,this.step=1,this.ticks=!0,this.disabled=!1,this.value=0,this.clampBounds=function(i){return zn(n.min,i,n.max)},this.ensureValueInBounds=function(i){return n.dualKnobs?{lower:n.clampBounds(i.lower),upper:n.clampBounds(i.upper)}:n.clampBounds(i)},this.handleKeyboard=function(i,r){var a=n.step;a=a>0?a:1,a=a/(n.max-n.min),r||(a*=-1),i==="A"?n.ratioA=zn(0,n.ratioA+a,1):n.ratioB=zn(0,n.ratioB+a,1),n.updateValue()},this.onBlur=function(){n.hasFocus&&(n.hasFocus=!1,n.ionBlur.emit(),n.emitStyle())},this.onFocus=function(){n.hasFocus||(n.hasFocus=!0,n.ionFocus.emit(),n.emitStyle())},this.ionChange=ve(this,"ionChange",7),this.ionStyle=ve(this,"ionStyle",7),this.ionFocus=ve(this,"ionFocus",7),this.ionBlur=ve(this,"ionBlur",7)}return e.prototype.debounceChanged=function(){this.ionChange=Ba(this.ionChange,this.debounce)},e.prototype.minChanged=function(){this.noUpdate||this.updateRatio()},e.prototype.maxChanged=function(){this.noUpdate||this.updateRatio()},e.prototype.disabledChanged=function(){this.gesture&&this.gesture.setDisabled(this.disabled),this.emitStyle()},e.prototype.valueChanged=function(t){this.noUpdate||this.updateRatio(),t=this.ensureValueInBounds(t),this.ionChange.emit({value:t})},e.prototype.connectedCallback=function(){this.updateRatio(),this.debounceChanged(),this.disabledChanged()},e.prototype.disconnectedCallback=function(){this.gesture&&(this.gesture.destroy(),this.gesture=void 0)},e.prototype.componentDidLoad=function(){return te(this,void 0,void 0,function(){var t,n,i=this;return ne(this,function(r){switch(r.label){case 0:return t=this.rangeSlider,t?(n=this,[4,import("./index-14bae62d-RHNU7WUM.js")]):[3,2];case 1:n.gesture=r.sent().createGesture({el:t,gestureName:"range",gesturePriority:100,threshold:0,onStart:function(a){return i.onStart(a)},onMove:function(a){return i.onMove(a)},onEnd:function(a){return i.onEnd(a)}}),this.gesture.setDisabled(this.disabled),r.label=2;case 2:return[2]}})})},e.prototype.getValue=function(){var t=this.value||0;return this.dualKnobs?typeof t=="object"?t:{lower:0,upper:t}:typeof t=="object"?t.upper:t},e.prototype.emitStyle=function(){this.ionStyle.emit({interactive:!0,"interactive-disabled":this.disabled})},e.prototype.onStart=function(t){var n=this.rect=this.rangeSlider.getBoundingClientRect(),i=t.currentX,r=zn(0,(i-n.left)/n.width,1);document.dir==="rtl"&&(r=1-r),this.pressedKnob=!this.dualKnobs||Math.abs(this.ratioA-r)<Math.abs(this.ratioB-r)?"A":"B",this.setFocus(this.pressedKnob),this.update(i)},e.prototype.onMove=function(t){this.update(t.currentX)},e.prototype.onEnd=function(t){this.update(t.currentX),this.pressedKnob=void 0},e.prototype.update=function(t){var n=this.rect,i=zn(0,(t-n.left)/n.width,1);document.dir==="rtl"&&(i=1-i),this.snaps&&(i=Tr(ps(i,this.min,this.max,this.step),this.min,this.max)),this.pressedKnob==="A"?this.ratioA=i:this.ratioB=i,this.updateValue()},Object.defineProperty(e.prototype,"valA",{get:function(){return ps(this.ratioA,this.min,this.max,this.step)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"valB",{get:function(){return ps(this.ratioB,this.min,this.max,this.step)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"ratioLower",{get:function(){return this.dualKnobs?Math.min(this.ratioA,this.ratioB):0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"ratioUpper",{get:function(){return this.dualKnobs?Math.max(this.ratioA,this.ratioB):this.ratioA},enumerable:!0,configurable:!0}),e.prototype.updateRatio=function(){var t=this.getValue(),n=this,i=n.min,r=n.max;this.dualKnobs?(this.ratioA=Tr(t.lower,i,r),this.ratioB=Tr(t.upper,i,r)):this.ratioA=Tr(t,i,r)},e.prototype.updateValue=function(){this.noUpdate=!0;var t=this,n=t.valA,i=t.valB;this.value=this.dualKnobs?{lower:Math.min(n,i),upper:Math.max(n,i)}:n,this.noUpdate=!1},e.prototype.setFocus=function(t){if(this.el.shadowRoot){var n=this.el.shadowRoot.querySelector(t==="A"?".range-knob-a":".range-knob-b");n&&n.focus()}},e.prototype.render=function(){var t,n,i=this,r=this,a=r.min,o=r.max,s=r.step,l=r.el,c=r.handleKeyboard,u=r.pressedKnob,h=r.disabled,d=r.pin,f=r.ratioLower,p=r.ratioUpper,v=dt(this),m=f*100+"%",g=100-p*100+"%",y=document,b=y.dir==="rtl",_=b?"right":"left",w=b?"left":"right",L=function(I){var N;return N={},N[_]=I[_],N},R=(t={},t[_]=m,t[w]=g,t),k=[];if(this.snaps&&this.ticks)for(var O=a;O<=o;O+=s){var z=Tr(O,a,o),C={ratio:z,active:z>=f&&z<=p};C[_]=z*100+"%",k.push(C)}return Na(!0,l,this.name,JSON.stringify(this.getValue()),h),T(ut,{onFocusin:this.onFocus,onFocusout:this.onBlur,class:Object.assign(Object.assign({},tn(this.color)),(n={},n[v]=!0,n["in-item"]=Er("ion-item",l),n["range-disabled"]=h,n["range-pressed"]=u!==void 0,n["range-has-pin"]=d,n))},T("slot",{name:"start"}),T("div",{class:"range-slider",ref:function(I){return i.rangeSlider=I}},k.map(function(I){return T("div",{style:L(I),role:"presentation",class:{"range-tick":!0,"range-tick-active":I.active}})}),T("div",{class:"range-bar",role:"presentation"}),T("div",{class:"range-bar range-bar-active",role:"presentation",style:R}),pc(b,{knob:"A",pressed:u==="A",value:this.valA,ratio:this.ratioA,pin:d,disabled:h,handleKeyboard:c,min:a,max:o}),this.dualKnobs&&pc(b,{knob:"B",pressed:u==="B",value:this.valB,ratio:this.ratioB,pin:d,disabled:h,handleKeyboard:c,min:a,max:o})),T("slot",{name:"end"}))},Object.defineProperty(e.prototype,"el",{get:function(){return ht(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e,"watchers",{get:function(){return{debounce:["debounceChanged"],min:["minChanged"],max:["maxChanged"],disabled:["disabledChanged"],value:["valueChanged"]}},enumerable:!0,configurable:!0}),Object.defineProperty(e,"style",{get:function(){return':host{--knob-handle-size:calc(var(--knob-size) * 2);display:-ms-flexbox;display:flex;position:relative;-ms-flex:3;flex:3;-ms-flex-align:center;align-items:center;font-family:var(--ion-font-family,inherit);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:2}:host(.range-disabled){pointer-events:none}::slotted(ion-label){-ms-flex:initial;flex:initial}::slotted(ion-icon[slot]){font-size:24px}.range-slider{position:relative;-ms-flex:1;flex:1;width:100%;height:var(--height);contain:size layout style;cursor:-webkit-grab;cursor:grab;-ms-touch-action:pan-y;touch-action:pan-y}:host(.range-pressed) .range-slider{cursor:-webkit-grabbing;cursor:grabbing}.range-pin{position:absolute;background:var(--ion-color-base);color:var(--ion-color-contrast);-webkit-box-sizing:border-box;box-sizing:border-box}.range-knob-handle{left:0;top:calc((var(--height) - var(--knob-handle-size)) / 2);margin-left:calc(0px - var(--knob-handle-size) / 2);position:absolute;width:var(--knob-handle-size);height:var(--knob-handle-size);text-align:center}:host-context([dir=rtl]) .range-knob-handle,[dir=rtl] .range-knob-handle{right:unset;right:0}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){.range-knob-handle{margin-left:unset;-webkit-margin-start:calc(0px - var(--knob-handle-size) / 2);margin-inline-start:calc(0px - var(--knob-handle-size) / 2)}}:host-context([dir=rtl]) .range-knob-handle,[dir=rtl] .range-knob-handle{left:unset}.range-knob-handle:active,.range-knob-handle:focus{outline:none}.range-bar{border-radius:var(--bar-border-radius);left:0;top:calc((var(--height) - var(--bar-height)) / 2);position:absolute;width:100%;height:var(--bar-height);background:var(--bar-background);pointer-events:none}:host-context([dir=rtl]) .range-bar,[dir=rtl] .range-bar{right:unset;right:0;left:unset}.range-knob{border-radius:var(--knob-border-radius);left:calc(50% - var(--knob-size) / 2);top:calc(50% - var(--knob-size) / 2);position:absolute;width:var(--knob-size);height:var(--knob-size);background:var(--knob-background);-webkit-box-shadow:var(--knob-box-shadow);box-shadow:var(--knob-box-shadow);pointer-events:none}:host-context([dir=rtl]) .range-knob,[dir=rtl] .range-knob{right:unset;right:calc(50% - var(--knob-size) / 2);left:unset}:host(.range-pressed) .range-bar-active{will-change:left,right}:host(.in-item){width:100%}:host(.in-item) ::slotted(ion-label){-ms-flex-item-align:center;align-self:center}:host{--knob-border-radius:50%;--knob-background:var(--bar-background-active);--knob-box-shadow:none;--knob-size:18px;--bar-height:2px;--bar-background:rgba(var(--ion-color-primary-rgb,56,128,255),0.26);--bar-background-active:var(--ion-color-primary,#3880ff);--bar-border-radius:0;--height:42px;--pin-background:var(--ion-color-primary,#3880ff);--pin-color:var(--ion-color-primary-contrast,#fff);padding-left:14px;padding-right:14px;padding-top:8px;padding-bottom:8px;font-size:12px}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:14px;padding-inline-start:14px;-webkit-padding-end:14px;padding-inline-end:14px}}:host(.ion-color) .range-bar{background:rgba(var(--ion-color-base-rgb),.26)}:host(.ion-color) .range-bar-active,:host(.ion-color) .range-knob,:host(.ion-color) .range-pin,:host(.ion-color) .range-pin:before,:host(.ion-color) .range-tick{background:var(--ion-color-base);color:var(--ion-color-contrast)}::slotted([slot=start]){margin-left:0;margin-right:14px;margin-top:0;margin-bottom:0}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){::slotted([slot=start]){margin-left:unset;margin-right:unset;-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:14px;margin-inline-end:14px}}::slotted([slot=end]){margin-left:14px;margin-right:0;margin-top:0;margin-bottom:0}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){::slotted([slot=end]){margin-left:unset;margin-right:unset;-webkit-margin-start:14px;margin-inline-start:14px;-webkit-margin-end:0;margin-inline-end:0}}:host(.range-has-pin){padding-top:28px}.range-bar-active{bottom:0;width:auto;background:var(--bar-background-active)}.range-knob{-webkit-transform:scale(.67);transform:scale(.67);-webkit-transition-duration:.12s;transition-duration:.12s;-webkit-transition-property:background-color,border,-webkit-transform;transition-property:background-color,border,-webkit-transform;transition-property:transform,background-color,border;transition-property:transform,background-color,border,-webkit-transform;-webkit-transition-timing-function:ease;transition-timing-function:ease;z-index:2}.range-tick{position:absolute;top:calc((var(--height) - var(--bar-height)) / 2);width:var(--bar-height);height:var(--bar-height);background:var(--bar-background-active);z-index:1;pointer-events:none}.range-tick-active{background:transparent}.range-pin{padding-left:0;padding-right:0;padding-top:8px;padding-bottom:8px;border-radius:50%;-webkit-transform:translateZ(0) scale(.01);transform:translateZ(0) scale(.01);display:inline-block;position:relative;min-width:28px;height:28px;-webkit-transition:background .12s ease,-webkit-transform .12s ease;transition:background .12s ease,-webkit-transform .12s ease;transition:transform .12s ease,background .12s ease;transition:transform .12s ease,background .12s ease,-webkit-transform .12s ease;color:var(--pin-color);text-align:center}.range-pin,.range-pin:before{background:var(--pin-background)}.range-pin:before{left:50%;top:3px;margin-left:-13px;border-radius:50% 50% 50% 0;position:absolute;width:26px;height:26px;-webkit-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-transition:background .12s ease;transition:background .12s ease;content:"";z-index:-1}:host-context([dir=rtl]) .range-pin:before,[dir=rtl] .range-pin:before{right:unset;right:50%}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){.range-pin:before{margin-left:unset;-webkit-margin-start:-13px;margin-inline-start:-13px}}:host-context([dir=rtl]) .range-pin:before,[dir=rtl] .range-pin:before{left:unset}.range-knob-pressed .range-pin{-webkit-transform:translate3d(0,-24px,0) scale(1);transform:translate3d(0,-24px,0) scale(1)}:host(:not(.range-has-pin)) .range-knob-pressed .range-knob{-webkit-transform:scale(1);transform:scale(1)}:host(.range-disabled) .range-bar,:host(.range-disabled) .range-bar-active,:host(.range-disabled) .range-knob,:host(.range-disabled) .range-tick{background-color:var(--ion-color-step-250,#bfbfbf)}:host(.range-disabled) .range-knob{-webkit-transform:scale(.55);transform:scale(.55);outline:5px solid #fff}'},enumerable:!0,configurable:!0}),e}(),pc=function(e,t){var n=t.knob,i=t.value,r=t.ratio,a=t.min,o=t.max,s=t.disabled,l=t.pressed,c=t.pin,u=t.handleKeyboard,h=e?"right":"left",d=function(){var f={};return f[h]=r*100+"%",f};return T("div",{onKeyDown:function(f){var p=f.key;p==="ArrowLeft"||p==="ArrowDown"?(u(n,!1),f.preventDefault(),f.stopPropagation()):(p==="ArrowRight"||p==="ArrowUp")&&(u(n,!0),f.preventDefault(),f.stopPropagation())},class:{"range-knob-handle":!0,"range-knob-a":n==="A","range-knob-b":n==="B","range-knob-pressed":l,"range-knob-min":i===a,"range-knob-max":i===o},style:d(),role:"slider",tabindex:s?-1:0,"aria-valuemin":a,"aria-valuemax":o,"aria-disabled":s?"true":null,"aria-valuenow":i},c&&T("div",{class:"range-pin",role:"presentation"},Math.round(i)),T("div",{class:"range-knob",role:"presentation"}))},ps=function(e,t,n,i){var r=(n-t)*e;return i>0&&(r=Math.round(r/i)*i+t),zn(t,r,n)},Tr=function(e,t,n){return zn(0,(e-t)/(n-t),1)},z0=function(){function e(t){Ye(this,t),this.type="bounded"}return e.prototype.addRipple=function(t,n){return te(this,void 0,void 0,function(){var i=this;return ne(this,function(r){return[2,new Promise(function(a){Qo(function(){var o=i.el.getBoundingClientRect(),s=o.width,l=o.height,c=Math.sqrt(s*s+l*l),u=Math.max(l,s),h=i.unbounded?u:c+$b,d=Math.floor(u*Kb),f=h/d,p=t-o.left,v=n-o.top;i.unbounded&&(p=s*.5,v=l*.5);var m=p-d*.5,g=v-d*.5,y=s*.5-p,b=l*.5-v;Dl(function(){var _=document.createElement("div");_.classList.add("ripple-effect");var w=_.style;w.top=g+"px",w.left=m+"px",w.width=w.height=d+"px",w.setProperty("--final-scale",""+f),w.setProperty("--translate-end",y+"px, "+b+"px");var L=i.el.shadowRoot||i.el;L.appendChild(_),setTimeout(function(){a(function(){Qb(_)})},325)})})})]})})},Object.defineProperty(e.prototype,"unbounded",{get:function(){return this.type==="unbounded"},enumerable:!0,configurable:!0}),e.prototype.render=function(){var t,n=dt(this);return T(ut,{role:"presentation",class:(t={},t[n]=!0,t.unbounded=this.unbounded,t)})},Object.defineProperty(e.prototype,"el",{get:function(){return ht(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e,"style",{get:function(){return":host{left:0;right:0;top:0;bottom:0;position:absolute;contain:strict;pointer-events:none}:host(.unbounded){contain:layout size style}.ripple-effect{border-radius:50%;position:absolute;background-color:currentColor;color:inherit;contain:strict;opacity:0;-webkit-animation:rippleAnimation 225ms forwards,fadeInAnimation 75ms forwards;animation:rippleAnimation 225ms forwards,fadeInAnimation 75ms forwards;will-change:transform,opacity;pointer-events:none}.fade-out{-webkit-transform:translate(var(--translate-end)) scale(var(--final-scale,1));transform:translate(var(--translate-end)) scale(var(--final-scale,1));-webkit-animation:fadeOutAnimation .15s forwards;animation:fadeOutAnimation .15s forwards}@-webkit-keyframes rippleAnimation{0%{-webkit-animation-timing-function:cubic-bezier(.4,0,.2,1);animation-timing-function:cubic-bezier(.4,0,.2,1);-webkit-transform:scale(1);transform:scale(1)}to{-webkit-transform:translate(var(--translate-end)) scale(var(--final-scale,1));transform:translate(var(--translate-end)) scale(var(--final-scale,1))}}@keyframes rippleAnimation{0%{-webkit-animation-timing-function:cubic-bezier(.4,0,.2,1);animation-timing-function:cubic-bezier(.4,0,.2,1);-webkit-transform:scale(1);transform:scale(1)}to{-webkit-transform:translate(var(--translate-end)) scale(var(--final-scale,1));transform:translate(var(--translate-end)) scale(var(--final-scale,1))}}@-webkit-keyframes fadeInAnimation{0%{-webkit-animation-timing-function:linear;animation-timing-function:linear;opacity:0}to{opacity:.16}}@keyframes fadeInAnimation{0%{-webkit-animation-timing-function:linear;animation-timing-function:linear;opacity:0}to{opacity:.16}}@-webkit-keyframes fadeOutAnimation{0%{-webkit-animation-timing-function:linear;animation-timing-function:linear;opacity:.16}to{opacity:0}}@keyframes fadeOutAnimation{0%{-webkit-animation-timing-function:linear;animation-timing-function:linear;opacity:.16}to{opacity:0}}"},enumerable:!0,configurable:!0}),e}(),Qb=function(e){e.classList.add("fade-out"),setTimeout(function(){e.remove()},200)},$b=10,Kb=.5,F0=function(){function e(t){var n=this;Ye(this,t),this.inputId="ion-sel-"+i0++,this.didInit=!1,this.isExpanded=!1,this.disabled=!1,this.cancelText="Cancel",this.okText="OK",this.name=this.inputId,this.multiple=!1,this.interface="alert",this.interfaceOptions={},this.onClick=function(i){n.setFocus(),n.open(i)},this.onFocus=function(){n.ionFocus.emit()},this.onBlur=function(){n.ionBlur.emit()},this.ionChange=ve(this,"ionChange",7),this.ionCancel=ve(this,"ionCancel",7),this.ionFocus=ve(this,"ionFocus",7),this.ionBlur=ve(this,"ionBlur",7),this.ionStyle=ve(this,"ionStyle",7)}return e.prototype.disabledChanged=function(){this.emitStyle()},e.prototype.valueChanged=function(){this.updateOptions(),this.emitStyle(),this.didInit&&this.ionChange.emit({value:this.value})},e.prototype.connectedCallback=function(){return te(this,void 0,void 0,function(){var t,t,n=this;return ne(this,function(i){return this.value===void 0&&(this.multiple?(t=this.childOpts.filter(function(r){return r.selected}),this.value=t.map(function(r){return Jn(r)})):(t=this.childOpts.find(function(r){return r.selected}),t&&(this.value=Jn(t)))),this.updateOptions(),this.updateOverlayOptions(),this.emitStyle(),this.mutationO=Il(this.el,"ion-select-option",function(){return te(n,void 0,void 0,function(){return ne(this,function(r){return this.updateOptions(),this.updateOverlayOptions(),[2]})})}),[2]})})},e.prototype.disconnectedCallback=function(){this.mutationO&&(this.mutationO.disconnect(),this.mutationO=void 0)},e.prototype.componentDidLoad=function(){this.didInit=!0},e.prototype.open=function(t){return te(this,void 0,void 0,function(){var n,i,r=this;return ne(this,function(a){switch(a.label){case 0:return this.disabled||this.isExpanded?[2,void 0]:(i=this,[4,this.createOverlay(t)]);case 1:return n=i.overlay=a.sent(),this.isExpanded=!0,n.onDidDismiss().then(function(){r.overlay=void 0,r.isExpanded=!1,r.setFocus()}),[4,n.present()];case 2:return a.sent(),[2,n]}})})},e.prototype.createOverlay=function(t){var n=this.interface;return(n==="action-sheet"||n==="popover")&&this.multiple&&(console.warn('Select interface cannot be "'+n+'" with a multi-value select. Using the "alert" interface instead.'),n="alert"),n==="popover"&&!t&&(console.warn('Select interface cannot be a "popover" without passing an event. Using the "alert" interface instead.'),n="alert"),n==="popover"?this.openPopover(t):n==="action-sheet"?this.openActionSheet():this.openAlert()},e.prototype.updateOverlayOptions=function(){var t=this.overlay;if(t){var n=this.childOpts;switch(this.interface){case"action-sheet":t.buttons=this.createActionSheetButtons(n);break;case"popover":var i=t.querySelector("ion-select-popover");i&&(i.options=this.createPopoverOptions(n));break;case"alert":var r=this.multiple?"checkbox":"radio";t.inputs=this.createAlertInputs(n,r);break}}},e.prototype.createActionSheetButtons=function(t){var n=this,i=t.map(function(r){return{role:r.selected?"selected":"",text:r.textContent,handler:function(){n.value=Jn(r)}}});return i.push({text:this.cancelText,role:"cancel",handler:function(){n.ionCancel.emit()}}),i},e.prototype.createAlertInputs=function(t,n){return t.map(function(i){return{type:n,label:i.textContent,value:Jn(i),checked:i.selected,disabled:i.disabled}})},e.prototype.createPopoverOptions=function(t){var n=this;return t.map(function(i){var r=Jn(i);return{text:i.textContent,value:r,checked:i.selected,disabled:i.disabled,handler:function(){n.value=r,n.close()}}})},e.prototype.openPopover=function(t){return te(this,void 0,void 0,function(){var n,i,r;return ne(this,function(a){return n=this.interfaceOptions,i=dt(this),r=Object.assign(Object.assign({mode:i},n),{component:"ion-select-popover",cssClass:["select-popover",n.cssClass],event:t,componentProps:{header:n.header,subHeader:n.subHeader,message:n.message,value:this.value,options:this.createPopoverOptions(this.childOpts)}}),[2,Rl.create(r)]})})},e.prototype.openActionSheet=function(){return te(this,void 0,void 0,function(){var t,n,i;return ne(this,function(r){return t=dt(this),n=this.interfaceOptions,i=Object.assign(Object.assign({mode:t},n),{buttons:this.createActionSheetButtons(this.childOpts),cssClass:["select-action-sheet",n.cssClass]}),[2,Cl.create(i)]})})},e.prototype.openAlert=function(){return te(this,void 0,void 0,function(){var t,n,i,r,a,o,s=this;return ne(this,function(l){return t=this.getLabel(),n=t?t.textContent:null,i=this.interfaceOptions,r=this.multiple?"checkbox":"radio",a=dt(this),o=Object.assign(Object.assign({mode:a},i),{header:i.header?i.header:n,inputs:this.createAlertInputs(this.childOpts,r),buttons:[{text:this.cancelText,role:"cancel",handler:function(){s.ionCancel.emit()}},{text:this.okText,handler:function(c){s.value=c}}],cssClass:["select-alert",i.cssClass,this.multiple?"multiple-select-alert":"single-select-alert"]}),[2,Ll.create(o)]})})},e.prototype.close=function(){return this.overlay?this.overlay.dismiss():Promise.resolve(!1)},e.prototype.updateOptions=function(){for(var t=!0,n=this,i=n.value,r=n.childOpts,a=n.compareWith,o=n.multiple,s=0,l=r;s<l.length;s++){var c=l[s],u=Jn(c),h=t&&t0(i,u,a);c.selected=h,h&&!o&&(t=!1)}},e.prototype.getLabel=function(){return Ri(this.el)},e.prototype.hasValue=function(){return this.getText()!==""},Object.defineProperty(e.prototype,"childOpts",{get:function(){return Array.from(this.el.querySelectorAll("ion-select-option"))},enumerable:!0,configurable:!0}),e.prototype.getText=function(){var t=this.selectedText;return t!=null&&t!==""?t:n0(this.childOpts,this.value,this.compareWith)},e.prototype.setFocus=function(){this.buttonEl&&this.buttonEl.focus()},e.prototype.emitStyle=function(){this.ionStyle.emit({interactive:!0,select:!0,"has-placeholder":this.placeholder!=null,"has-value":this.hasValue(),"interactive-disabled":this.disabled,"select-disabled":this.disabled})},e.prototype.render=function(){var t,n=this,i=this,r=i.placeholder,a=i.name,o=i.disabled,s=i.isExpanded,l=i.value,c=i.el,u=dt(this),h=this.inputId+"-lbl",d=Ri(c);d&&(d.id=h);var f=!1,p=this.getText();p===""&&r!=null&&(p=r,f=!0),Na(!0,c,a,e0(l),o);var v={"select-text":!0,"select-placeholder":f};return T(ut,{onClick:this.onClick,role:"combobox","aria-haspopup":"dialog","aria-disabled":o?"true":null,"aria-expanded":""+s,"aria-labelledby":h,class:(t={},t[u]=!0,t["in-item"]=Er("ion-item",c),t["select-disabled"]=o,t)},T("div",{class:v},p),T("div",{class:"select-icon",role:"presentation"},T("div",{class:"select-icon-inner"})),T("button",{type:"button",onFocus:this.onFocus,onBlur:this.onBlur,disabled:o,ref:function(m){return n.buttonEl=m}}))},Object.defineProperty(e.prototype,"el",{get:function(){return ht(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e,"watchers",{get:function(){return{disabled:["disabledChanged"],placeholder:["disabledChanged"],value:["valueChanged"]}},enumerable:!0,configurable:!0}),Object.defineProperty(e,"style",{get:function(){return":host{padding-left:var(--padding-start);padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);display:-ms-flexbox;display:flex;position:relative;font-family:var(--ion-font-family,inherit);overflow:hidden;z-index:2}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}:host(.in-item){position:static;max-width:45%}:host(.select-disabled){opacity:.4;pointer-events:none}:host(.ion-focused) button{border:2px solid #5e9ed6}.select-placeholder{color:currentColor;opacity:.33}button{left:0;top:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;position:absolute;width:100%;height:100%;border:0;background:transparent;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none}:host-context([dir=rtl]) button,[dir=rtl] button{left:unset;right:unset;right:0}button::-moz-focus-inner{border:0}.select-icon{position:relative}.select-text{-ms-flex:1;flex:1;min-width:16px;font-size:inherit;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.select-icon-inner{left:5px;top:50%;margin-top:-3px;position:absolute;width:0;height:0;border-top:5px solid;border-right:5px solid transparent;border-left:5px solid transparent;color:currentColor;opacity:.33;pointer-events:none}:host-context([dir=rtl]) .select-icon-inner,[dir=rtl] .select-icon-inner{left:unset;right:unset;right:5px}:host{--padding-top:10px;--padding-end:0;--padding-bottom:11px;--padding-start:16px}.select-icon{width:19px;height:19px}"},enumerable:!0,configurable:!0}),e}(),Jn=function(e){var t=e.value;return t===void 0?e.textContent||"":t},e0=function(e){if(e!=null)return Array.isArray(e)?e.join(","):e.toString()},t0=function(e,t,n){return e===void 0?!1:Array.isArray(e)?e.some(function(i){return Us(i,t,n)}):Us(e,t,n)},Us=function(e,t,n){return typeof n=="function"?n(e,t):typeof n=="string"?e[n]===t[n]:e===t},n0=function(e,t,n){return t===void 0?"":Array.isArray(t)?t.map(function(i){return mc(e,i,n)}).filter(function(i){return i!==null}).join(", "):mc(e,t,n)||""},mc=function(e,t,n){var i=e.find(function(r){return Us(Jn(r),t,n)});return i?i.textContent:null},i0=0,H0=function(){function e(t){Ye(this,t),this.inputId="ion-selopt-"+r0++,this.disabled=!1,this.selected=!1}return e.prototype.render=function(){return T(ut,{role:"option",id:this.inputId,class:dt(this)})},Object.defineProperty(e.prototype,"el",{get:function(){return ht(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e,"style",{get:function(){return":host{display:none}"},enumerable:!0,configurable:!0}),e}(),r0=0,U0=function(){function e(t){Ye(this,t),this.loaded=!1,this.active=!1}return e.prototype.componentWillLoad=function(){},e.prototype.setActive=function(){return te(this,void 0,void 0,function(){return ne(this,function(t){switch(t.label){case 0:return[4,this.prepareLazyLoaded()];case 1:return t.sent(),this.active=!0,[2]}})})},e.prototype.prepareLazyLoaded=function(){if(!this.loaded&&this.component!=null){this.loaded=!0;try{return Pl(this.delegate,this.el,this.component,["ion-page"])}catch(t){console.error(t)}}return Promise.resolve(void 0)},e.prototype.render=function(){var t=this,n=t.tab,i=t.active,r=t.component;return T(ut,{role:"tabpanel","aria-hidden":i?null:"true","aria-labelledby":"tab-button-"+n,class:{"ion-page":r===void 0,"tab-hidden":!i}},T("slot",null))},Object.defineProperty(e.prototype,"el",{get:function(){return ht(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e,"style",{get:function(){return":host(.tab-hidden){display:none!important}"},enumerable:!0,configurable:!0}),e}(),G0=function(){function e(t){Ye(this,t),this.keyboardVisible=!1,this.translucent=!1,this.ionTabBarChanged=ve(this,"ionTabBarChanged",7)}return e.prototype.selectedTabChanged=function(){this.selectedTab!==void 0&&this.ionTabBarChanged.emit({tab:this.selectedTab})},e.prototype.onKeyboardWillHide=function(){var t=this;setTimeout(function(){return t.keyboardVisible=!1},50)},e.prototype.onKeyboardWillShow=function(){this.el.getAttribute("slot")!=="top"&&(this.keyboardVisible=!0)},e.prototype.componentWillLoad=function(){this.selectedTabChanged()},e.prototype.render=function(){var t,n=this,i=n.color,r=n.translucent,a=n.keyboardVisible,o=dt(this);return T(ut,{role:"tablist","aria-hidden":a?"true":null,class:Object.assign(Object.assign({},tn(i)),(t={},t[o]=!0,t["tab-bar-translucent"]=r,t["tab-bar-hidden"]=a,t))},T("slot",null))},Object.defineProperty(e.prototype,"el",{get:function(){return ht(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e,"watchers",{get:function(){return{selectedTab:["selectedTabChanged"]}},enumerable:!0,configurable:!0}),Object.defineProperty(e,"style",{get:function(){return":host{padding-left:var(--ion-safe-area-left);padding-right:var(--ion-safe-area-right);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:auto;padding-bottom:var(--ion-safe-area-bottom,0);border-top:var(--border);background:var(--background);color:var(--color);text-align:center;contain:strict;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:10;-webkit-box-sizing:content-box!important;box-sizing:content-box!important}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--ion-safe-area-left);padding-inline-start:var(--ion-safe-area-left);-webkit-padding-end:var(--ion-safe-area-right);padding-inline-end:var(--ion-safe-area-right)}}:host(.ion-color) ::slotted(ion-tab-button){--background-focused:var(--ion-color-shade);--color-selected:var(--ion-color-contrast)}:host(.ion-color) ::slotted(.tab-selected){color:var(--ion-color-contrast)}:host(.ion-color),:host(.ion-color) ::slotted(ion-tab-button){color:rgba(var(--ion-color-contrast-rgb),.7);background:var(--ion-color-base)}:host(.ion-color) ::slotted(ion-tab-button.ion-focused),:host(.tab-bar-translucent) ::slotted(ion-tab-button.ion-focused){background:var(--background-focused)}:host(.tab-bar-translucent) ::slotted(ion-tab-button){background:transparent}:host([slot=top]){padding-bottom:0;border-top:0;border-bottom:var(--border)}:host(.tab-bar-hidden){display:none!important}:host{--background:var(--ion-tab-bar-background,var(--ion-background-color,#fff));--background-focused:var(--ion-tab-bar-background-focused,#e0e0e0);--border:1px solid var(--ion-tab-bar-border-color,var(--ion-border-color,var(--ion-color-step-150,rgba(0,0,0,0.07))));--color:var(--ion-tab-bar-color,var(--ion-color-step-600,#666));--color-selected:var(--ion-tab-bar-color-activated,var(--ion-color-primary,#3880ff));height:56px}"},enumerable:!0,configurable:!0}),e}(),V0=function(){function e(t){var n=this;Ye(this,t),this.disabled=!1,this.selected=!1,this.onKeyUp=function(i){(i.key==="Enter"||i.key===" ")&&n.selectTab(i)},this.onClick=function(i){n.selectTab(i)},this.ionTabButtonClick=ve(this,"ionTabButtonClick",7)}return e.prototype.onTabBarChanged=function(t){this.selected=this.tab===t.detail.tab},e.prototype.componentWillLoad=function(){this.layout===void 0&&(this.layout=Ln.get("tabButtonLayout","icon-top"))},e.prototype.selectTab=function(t){this.tab!==void 0&&(this.disabled||this.ionTabButtonClick.emit({tab:this.tab,href:this.href,selected:this.selected}),t.preventDefault())},Object.defineProperty(e.prototype,"hasLabel",{get:function(){return!!this.el.querySelector("ion-label")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasIcon",{get:function(){return!!this.el.querySelector("ion-icon")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tabIndex",{get:function(){if(this.disabled)return-1;var t=this.el.hasAttribute("tabindex");return t?this.el.getAttribute("tabindex"):0},enumerable:!0,configurable:!0}),e.prototype.render=function(){var t,n=this,i=n.disabled,r=n.hasIcon,a=n.hasLabel,o=n.tabIndex,s=n.href,l=n.rel,c=n.target,u=n.layout,h=n.selected,d=n.tab,f=dt(this),p={download:this.download,href:s,rel:l,target:c};return T(ut,{onClick:this.onClick,onKeyup:this.onKeyUp,role:"tab",tabindex:o,"aria-selected":h?"true":null,id:d!==void 0?"tab-button-"+d:null,class:(t={},t[f]=!0,t["tab-selected"]=h,t["tab-disabled"]=i,t["tab-has-label"]=a,t["tab-has-icon"]=r,t["tab-has-label-only"]=a&&!r,t["tab-has-icon-only"]=r&&!a,t["tab-layout-"+u]=!0,t["ion-activatable"]=!0,t["ion-selectable"]=!0,t["ion-focusable"]=!0,t)},T("a",Object.assign({},p,{tabIndex:-1}),T("slot",null),f==="md"&&T("ion-ripple-effect",{type:"unbounded"})))},Object.defineProperty(e.prototype,"el",{get:function(){return ht(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e,"style",{get:function(){return":host{--ripple-color:var(--color-selected);-ms-flex:1;flex:1;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;background:var(--background);color:var(--color)}:host,a{height:100%;outline:none}a{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:var(--padding-start);padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:-ms-flexbox;display:flex;position:relative;-ms-flex-direction:inherit;flex-direction:inherit;-ms-flex-align:inherit;align-items:inherit;-ms-flex-pack:inherit;justify-content:inherit;width:100%;border:0;background:transparent;text-decoration:none;cursor:pointer;overflow:hidden;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-user-drag:none}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){a{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}:host(.ion-focused){background:var(--background-focused)}@media (any-hover:hover){a:hover{color:var(--color-selected)}}:host(.tab-selected){color:var(--color-selected)}:host(.tab-hidden){display:none!important}:host(.tab-disabled){pointer-events:none;opacity:.4}::slotted(ion-icon),::slotted(ion-label){display:block;-ms-flex-item-align:center;align-self:center;max-width:100%;text-overflow:ellipsis;white-space:nowrap;overflow:hidden;-webkit-box-sizing:border-box;box-sizing:border-box}::slotted(ion-label){-ms-flex-order:0;order:0}::slotted(ion-icon){-ms-flex-order:-1;order:-1;height:1em}:host(.tab-has-label-only) ::slotted(ion-label){white-space:normal}::slotted(ion-badge){-webkit-box-sizing:border-box;box-sizing:border-box;position:absolute;z-index:1}:host(.tab-layout-icon-start){-ms-flex-direction:row;flex-direction:row}:host(.tab-layout-icon-end){-ms-flex-direction:row-reverse;flex-direction:row-reverse}:host(.tab-layout-icon-bottom){-ms-flex-direction:column-reverse;flex-direction:column-reverse}:host(.tab-layout-icon-hide) ::slotted(ion-icon),:host(.tab-layout-label-hide) ::slotted(ion-label){display:none}ion-ripple-effect{color:var(--ripple-color)}:host{--padding-top:0;--padding-end:12px;--padding-bottom:0;--padding-start:12px;max-width:168px;font-size:12px;font-weight:400;letter-spacing:.03em}::slotted(ion-label){margin-left:0;margin-right:0;margin-top:2px;margin-bottom:2px;text-transform:none}::slotted(ion-icon){margin-left:0;margin-right:0;margin-top:16px;margin-bottom:16px;-webkit-transform-origin:center center;transform-origin:center center;font-size:22px}:host-context([dir=rtl]) ::slotted(ion-icon),[dir=rtl] ::slotted(ion-icon){-webkit-transform-origin:calc(100% - center) center;transform-origin:calc(100% - center) center}::slotted(ion-badge){border-radius:8px;padding-left:2px;padding-right:2px;padding-top:3px;padding-bottom:2px;left:calc(50% + 6px);top:8px;min-width:12px;font-size:8px;font-weight:400}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){::slotted(ion-badge){padding-left:unset;padding-right:unset;-webkit-padding-start:2px;padding-inline-start:2px;-webkit-padding-end:2px;padding-inline-end:2px}}:host-context([dir=rtl]) ::slotted(ion-badge),[dir=rtl] ::slotted(ion-badge){left:unset;right:unset;right:calc(50% + 6px)}::slotted(ion-badge:empty){display:block;min-width:8px;height:8px}:host(.tab-layout-icon-top) ::slotted(ion-icon){margin-top:6px;margin-bottom:2px}:host(.tab-layout-icon-top) ::slotted(ion-label){margin-top:0;margin-bottom:6px}:host(.tab-layout-icon-bottom) ::slotted(ion-badge){left:70%;top:8px}:host-context([dir=rtl]).tab-layout-icon-bottom ::slotted(ion-badge),:host-context([dir=rtl]):host(.tab-layout-icon-bottom) ::slotted(ion-badge){left:unset;right:unset;right:70%}:host(.tab-layout-icon-bottom) ::slotted(ion-icon){margin-top:0;margin-bottom:6px}:host(.tab-layout-icon-bottom) ::slotted(ion-label){margin-top:6px;margin-bottom:0}:host(.tab-layout-icon-end) ::slotted(ion-badge),:host(.tab-layout-icon-start) ::slotted(ion-badge){left:80%;top:16px}:host-context([dir=rtl]).tab-layout-icon-end ::slotted(ion-badge),:host-context([dir=rtl]).tab-layout-icon-start ::slotted(ion-badge),:host-context([dir=rtl]):host(.tab-layout-icon-end) ::slotted(ion-badge),:host-context([dir=rtl]):host(.tab-layout-icon-start) ::slotted(ion-badge){left:unset;right:unset;right:80%}:host(.tab-layout-icon-start) ::slotted(ion-icon){margin-right:6px}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){:host(.tab-layout-icon-start) ::slotted(ion-icon){margin-right:unset;-webkit-margin-end:6px;margin-inline-end:6px}}:host(.tab-layout-icon-end) ::slotted(ion-icon){margin-left:6px}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){:host(.tab-layout-icon-end) ::slotted(ion-icon){margin-left:unset;-webkit-margin-start:6px;margin-inline-start:6px}}:host(.tab-has-label-only) ::slotted(ion-badge),:host(.tab-layout-icon-hide) ::slotted(ion-badge){left:70%;top:16px}:host-context([dir=rtl]).tab-has-label-only ::slotted(ion-badge),:host-context([dir=rtl]).tab-layout-icon-hide ::slotted(ion-badge),:host-context([dir=rtl]):host(.tab-has-label-only) ::slotted(ion-badge),:host-context([dir=rtl]):host(.tab-layout-icon-hide) ::slotted(ion-badge){left:unset;right:unset;right:70%}:host(.tab-has-label-only) ::slotted(ion-label),:host(.tab-layout-icon-hide) ::slotted(ion-label){margin-top:0;margin-bottom:0}:host(.tab-has-icon-only) ::slotted(ion-badge),:host(.tab-layout-label-hide) ::slotted(ion-badge){top:16px}:host(.tab-has-icon-only) ::slotted(ion-icon),:host(.tab-layout-label-hide) ::slotted(ion-icon){margin-top:0;margin-bottom:0;font-size:24px}"},enumerable:!0,configurable:!0}),e}(),W0=function(){function e(t){var n=this;Ye(this,t),this.inputId="ion-input-"+a0++,this.didBlurAfterEdit=!1,this.hasFocus=!1,this.autocapitalize="none",this.autofocus=!1,this.clearOnEdit=!1,this.debounce=0,this.disabled=!1,this.name=this.inputId,this.readonly=!1,this.required=!1,this.spellcheck=!1,this.autoGrow=!1,this.value="",this.onInput=function(i){n.nativeInput&&(n.value=n.nativeInput.value),n.emitStyle(),n.ionInput.emit(i)},this.onFocus=function(){n.hasFocus=!0,n.focusChange(),n.ionFocus.emit()},this.onBlur=function(){n.hasFocus=!1,n.focusChange(),n.ionBlur.emit()},this.onKeyDown=function(){n.checkClearOnEdit()},this.ionChange=ve(this,"ionChange",7),this.ionInput=ve(this,"ionInput",7),this.ionStyle=ve(this,"ionStyle",7),this.ionBlur=ve(this,"ionBlur",7),this.ionFocus=ve(this,"ionFocus",7)}return e.prototype.debounceChanged=function(){this.ionChange=Ba(this.ionChange,this.debounce)},e.prototype.disabledChanged=function(){this.emitStyle()},e.prototype.valueChanged=function(){var t=this.nativeInput,n=this.getValue();t&&t.value!==n&&(t.value=n),this.runAutoGrow(),this.emitStyle(),this.ionChange.emit({value:n})},e.prototype.connectedCallback=function(){this.emitStyle(),this.debounceChanged(),this.el.dispatchEvent(new CustomEvent("ionInputDidLoad",{detail:this.el}))},e.prototype.disconnectedCallback=function(){document.dispatchEvent(new CustomEvent("ionInputDidUnload",{detail:this.el}))},e.prototype.componentDidLoad=function(){this.runAutoGrow()},e.prototype.runAutoGrow=function(){var t=this.nativeInput;t&&this.autoGrow&&Qo(function(){t.style.height="inherit",t.style.height=t.scrollHeight+"px"})},e.prototype.setFocus=function(){return te(this,void 0,void 0,function(){return ne(this,function(t){return this.nativeInput&&this.nativeInput.focus(),[2]})})},e.prototype.getInputElement=function(){return Promise.resolve(this.nativeInput)},e.prototype.emitStyle=function(){this.ionStyle.emit({interactive:!0,textarea:!0,input:!0,"interactive-disabled":this.disabled,"has-placeholder":this.placeholder!=null,"has-value":this.hasValue(),"has-focus":this.hasFocus})},e.prototype.checkClearOnEdit=function(){this.clearOnEdit&&(this.didBlurAfterEdit&&this.hasValue()&&(this.value=""),this.didBlurAfterEdit=!1)},e.prototype.focusChange=function(){this.clearOnEdit&&!this.hasFocus&&this.hasValue()&&(this.didBlurAfterEdit=!0),this.emitStyle()},e.prototype.hasValue=function(){return this.getValue()!==""},e.prototype.getValue=function(){return this.value||""},e.prototype.render=function(){var t,n=this,i=dt(this),r=this.getValue(),a=this.inputId+"-lbl",o=Ri(this.el);return o&&(o.id=a),T(ut,{"aria-disabled":this.disabled?"true":null,class:Object.assign(Object.assign({},tn(this.color)),(t={},t[i]=!0,t))},T("textarea",{class:"native-textarea",ref:function(s){return n.nativeInput=s},autoCapitalize:this.autocapitalize,autoFocus:this.autofocus,disabled:this.disabled,maxLength:this.maxlength,minLength:this.minlength,name:this.name,placeholder:this.placeholder||"",readOnly:this.readonly,required:this.required,spellCheck:this.spellcheck,cols:this.cols,rows:this.rows,wrap:this.wrap,onInput:this.onInput,onBlur:this.onBlur,onFocus:this.onFocus,onKeyDown:this.onKeyDown},r))},Object.defineProperty(e.prototype,"el",{get:function(){return ht(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e,"watchers",{get:function(){return{debounce:["debounceChanged"],disabled:["disabledChanged"],value:["valueChanged"]}},enumerable:!0,configurable:!0}),Object.defineProperty(e,"style",{get:function(){return".sc-ion-textarea-md-h{--background:initial;--color:initial;--placeholder-color:initial;--placeholder-font-style:initial;--placeholder-font-weight:initial;--placeholder-opacity:.5;--padding-top:0;--padding-bottom:0;--padding-start:0;--border-radius:0;display:block;position:relative;-ms-flex:1;flex:1;width:100%;-webkit-box-sizing:border-box;box-sizing:border-box;background:var(--background);color:var(--color);font-family:var(--ion-font-family,inherit);white-space:pre-wrap;z-index:2}.ion-color.sc-ion-textarea-md-h{background:initial;color:var(--ion-color-base)}ion-item.sc-ion-textarea-md-h, ion-item .sc-ion-textarea-md-h{-ms-flex-item-align:baseline;align-self:baseline}ion-item.sc-ion-textarea-md-h:not(.item-label), ion-item:not(.item-label) .sc-ion-textarea-md-h{--padding-start:0}.native-textarea.sc-ion-textarea-md{border-radius:var(--border-radius);margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:var(--padding-start);padding-right:var(--padding-end);padding-top:var(--padding-top);padding-bottom:var(--padding-bottom);font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;text-decoration:inherit;text-overflow:inherit;text-transform:inherit;text-align:inherit;white-space:inherit;color:inherit;display:block;width:100%;max-width:100%;max-height:100%;border:0;outline:none;background:transparent;-webkit-box-sizing:border-box;box-sizing:border-box;resize:none;-webkit-appearance:none;-moz-appearance:none;appearance:none}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){.native-textarea.sc-ion-textarea-md{padding-left:unset;padding-right:unset;-webkit-padding-start:var(--padding-start);padding-inline-start:var(--padding-start);-webkit-padding-end:var(--padding-end);padding-inline-end:var(--padding-end)}}.native-textarea.sc-ion-textarea-md::-webkit-input-placeholder{color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.native-textarea.sc-ion-textarea-md::-moz-placeholder{color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.native-textarea.sc-ion-textarea-md:-ms-input-placeholder{color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.native-textarea.sc-ion-textarea-md::-ms-input-placeholder{color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.native-textarea.sc-ion-textarea-md::placeholder{color:var(--placeholder-color);font-family:inherit;font-style:var(--placeholder-font-style);font-weight:var(--placeholder-font-weight);opacity:var(--placeholder-opacity)}.native-textarea[disabled].sc-ion-textarea-md{opacity:.4}.cloned-input.sc-ion-textarea-md{left:0;top:0;position:absolute;pointer-events:none}[dir=rtl].sc-ion-textarea-md-h .cloned-input.sc-ion-textarea-md, [dir=rtl] .sc-ion-textarea-md-h .cloned-input.sc-ion-textarea-md, [dir=rtl].sc-ion-textarea-md .cloned-input.sc-ion-textarea-md{left:unset;right:unset;right:0}.sc-ion-textarea-md-h{--padding-top:10px;--padding-end:0;--padding-bottom:11px;--padding-start:8px;margin-left:0;margin-right:0;margin-top:8px;margin-bottom:0;font-size:inherit}.item-label-floating.sc-ion-textarea-md-h, .item-label-floating .sc-ion-textarea-md-h, .item-label-stacked.sc-ion-textarea-md-h, .item-label-stacked .sc-ion-textarea-md-h{--padding-top:8px;--padding-bottom:8px;--padding-start:0}"},enumerable:!0,configurable:!0}),e}(),a0=0,j0=function(){function e(t){var n=this;Ye(this,t),this.inputId="ion-tg-"+s0++,this.lastDrag=0,this.activated=!1,this.name=this.inputId,this.checked=!1,this.disabled=!1,this.value="on",this.onClick=function(){n.lastDrag+300<Date.now()&&(n.checked=!n.checked)},this.onFocus=function(){n.ionFocus.emit()},this.onBlur=function(){n.ionBlur.emit()},this.ionChange=ve(this,"ionChange",7),this.ionFocus=ve(this,"ionFocus",7),this.ionBlur=ve(this,"ionBlur",7),this.ionStyle=ve(this,"ionStyle",7)}return e.prototype.checkedChanged=function(t){this.ionChange.emit({checked:t,value:this.value})},e.prototype.disabledChanged=function(){this.emitStyle(),this.gesture&&this.gesture.setDisabled(this.disabled)},e.prototype.connectedCallback=function(){return te(this,void 0,void 0,function(){var t,n=this;return ne(this,function(i){switch(i.label){case 0:return t=this,[4,import("./index-14bae62d-RHNU7WUM.js")];case 1:return t.gesture=i.sent().createGesture({el:this.el,gestureName:"toggle",gesturePriority:100,threshold:5,passive:!1,onStart:function(){return n.onStart()},onMove:function(r){return n.onMove(r)},onEnd:function(r){return n.onEnd(r)}}),this.disabledChanged(),[2]}})})},e.prototype.disconnectedCallback=function(){this.gesture&&(this.gesture.destroy(),this.gesture=void 0)},e.prototype.componentWillLoad=function(){this.emitStyle()},e.prototype.emitStyle=function(){this.ionStyle.emit({"interactive-disabled":this.disabled})},e.prototype.onStart=function(){this.activated=!0,this.setFocus()},e.prototype.onMove=function(t){o0(document,this.checked,t.deltaX,-10)&&(this.checked=!this.checked,Ol())},e.prototype.onEnd=function(t){this.activated=!1,this.lastDrag=Date.now(),t.event.preventDefault(),t.event.stopImmediatePropagation()},e.prototype.getValue=function(){return this.value||""},e.prototype.setFocus=function(){this.buttonEl&&this.buttonEl.focus()},e.prototype.render=function(){var t,n=this,i=this,r=i.inputId,a=i.disabled,o=i.checked,s=i.activated,l=i.color,c=i.el,u=dt(this),h=r+"-lbl",d=Ri(c),f=this.getValue();return d&&(d.id=h),Na(!0,c,this.name,o?f:"",a),T(ut,{onClick:this.onClick,role:"checkbox","aria-disabled":a?"true":null,"aria-checked":""+o,"aria-labelledby":h,class:Object.assign(Object.assign({},tn(l)),(t={},t[u]=!0,t["in-item"]=Er("ion-item",c),t["toggle-activated"]=s,t["toggle-checked"]=o,t["toggle-disabled"]=a,t.interactive=!0,t))},T("div",{class:"toggle-icon"},T("div",{class:"toggle-inner"})),T("button",{type:"button",onFocus:this.onFocus,onBlur:this.onBlur,disabled:a,ref:function(p){return n.buttonEl=p}}))},Object.defineProperty(e.prototype,"el",{get:function(){return ht(this)},enumerable:!0,configurable:!0}),Object.defineProperty(e,"watchers",{get:function(){return{checked:["checkedChanged"],disabled:["disabledChanged"]}},enumerable:!0,configurable:!0}),Object.defineProperty(e,"style",{get:function(){return":host{-webkit-box-sizing:content-box!important;box-sizing:content-box!important;display:inline-block;outline:none;contain:content;cursor:pointer;-ms-touch-action:none;touch-action:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:2}:host(.ion-focused) input{border:2px solid #5e9ed6}:host(.toggle-disabled){pointer-events:none}button{left:0;top:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;position:absolute;width:100%;height:100%;border:0;background:transparent;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none}:host-context([dir=rtl]) button,[dir=rtl] button{left:unset;right:unset;right:0}button::-moz-focus-inner{border:0}:host{--background:rgba(var(--ion-text-color-rgb,0,0,0),0.3);--background-checked:rgba(var(--ion-color-primary-rgb,56,128,255),0.5);--handle-background:#fff;--handle-background-checked:var(--ion-color-primary,#3880ff);padding-left:12px;padding-right:12px;padding-top:12px;padding-bottom:12px;-webkit-box-sizing:content-box;box-sizing:content-box;position:relative;width:36px;height:14px;contain:strict}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:12px;padding-inline-start:12px;-webkit-padding-end:12px;padding-inline-end:12px}}:host(.ion-color.toggle-checked) .toggle-icon{background:rgba(var(--ion-color-base-rgb),.5)}:host(.ion-color.toggle-checked) .toggle-inner{background:var(--ion-color-base)}.toggle-icon{border-radius:14px;display:block;position:relative;width:100%;height:100%;-webkit-transition:background-color .16s;transition:background-color .16s;background:var(--background);pointer-events:none}.toggle-inner{left:0;top:-3px;border-radius:50%;position:absolute;width:20px;height:20px;-webkit-transition-duration:.16s;transition-duration:.16s;-webkit-transition-property:background-color,-webkit-transform;transition-property:background-color,-webkit-transform;transition-property:transform,background-color;transition-property:transform,background-color,-webkit-transform;-webkit-transition-timing-function:cubic-bezier(.4,0,.2,1);transition-timing-function:cubic-bezier(.4,0,.2,1);background:var(--handle-background);-webkit-box-shadow:0 2px 2px 0 rgba(0,0,0,.14),0 3px 1px -2px rgba(0,0,0,.2),0 1px 5px 0 rgba(0,0,0,.12);box-shadow:0 2px 2px 0 rgba(0,0,0,.14),0 3px 1px -2px rgba(0,0,0,.2),0 1px 5px 0 rgba(0,0,0,.12);will-change:transform,background-color;contain:strict}:host-context([dir=rtl]) .toggle-inner,[dir=rtl] .toggle-inner{left:unset;right:unset;right:0}:host(.toggle-checked) .toggle-icon{background:var(--background-checked)}:host(.toggle-checked) .toggle-inner{-webkit-transform:translate3d(16px,0,0);transform:translate3d(16px,0,0);background:var(--handle-background-checked)}:host-context([dir=rtl]).toggle-checked .toggle-inner,:host-context([dir=rtl]):host(.toggle-checked) .toggle-inner{-webkit-transform:translate3d(calc(-1 * 16px),0,0);transform:translate3d(calc(-1 * 16px),0,0)}:host(.toggle-disabled){opacity:.3}:host(.in-item[slot]){margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;padding-left:16px;padding-right:0;padding-top:12px;padding-bottom:12px;cursor:pointer}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){:host(.in-item[slot]){padding-left:unset;padding-right:unset;-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:0;padding-inline-end:0}}:host(.in-item[slot=start]){padding-left:2px;padding-right:18px;padding-top:12px;padding-bottom:12px}@supports ((-webkit-margin-start:0) or (margin-inline-start:0)) or (-webkit-margin-start:0){:host(.in-item[slot=start]){padding-left:unset;padding-right:unset;-webkit-padding-start:2px;padding-inline-start:2px;-webkit-padding-end:18px;padding-inline-end:18px}}"},enumerable:!0,configurable:!0}),e}(),o0=function(e,t,n,i){var r=e.dir==="rtl";return t?!r&&i>n||r&&-i<n:!r&&-i<n||r&&i>n},s0=0;export{m0 as al_angle_editor,v0 as al_console,g0 as al_control_panel,y0 as al_edge_editor,b0 as al_graph_editor,x0 as al_graph_settings,_0 as al_node_editor,w0 as al_node_list,E0 as al_settings,M0 as al_tabs,S0 as al_url_picker,T0 as al_view_controls,A0 as al_viewer,L0 as ion_app,C0 as ion_button,R0 as ion_icon,I0 as ion_input,P0 as ion_item,O0 as ion_item_divider,D0 as ion_label,k0 as ion_list,N0 as ion_list_header,B0 as ion_range,z0 as ion_ripple_effect,F0 as ion_select,H0 as ion_select_option,U0 as ion_tab,G0 as ion_tab_bar,V0 as ion_tab_button,W0 as ion_textarea,j0 as ion_toggle};
/*! Bundled license information:

@universalviewer/aleph/dist/esm-es5/al-angle-editor_31-md.entry.js:
  (*!\ DECLARE ALIAS AFTER assign prototype ! *)
*/