/*! vue-amap v1.1.20 */(function(Z,H){typeof exports=="object"&&typeof module!="undefined"?H(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],H):(Z=typeof globalThis!="undefined"?globalThis:Z||self,H(Z.VueAMap={},Z.Vue))})(this,function(Z,H){"use strict";const oc=(n=[])=>{const e=[];return{install:i=>{e.includes(i)||(e.push(i),n.forEach(s=>i.use(s)))}}},ce=(n,e)=>{if(n.install=t=>{for(const i of[n,...Object.values(e??{})])t.component(i.name,i)},e)for(const[t,i]of Object.entries(e))n[t]=i;return n};function ac(){let n=[],e="0123456789abcdef";for(var t=0;t<36;t++)n[t]=e.substr(Math.floor(Math.random()*16),1);n[14]="4",n[19]=e.substr(n[19]&3|8,1),n[8]=n[13]=n[18]=n[23]="-";var i=n.join("");return i}var pg=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},fg=function(){var n=[].map.call(arguments,function(e){return e.trim()}).filter(function(e){return e.length}).join("-");return n.length?n.length===1||!/[_.\- ]+/.test(n)?n[0]===n[0].toLowerCase()&&n.slice(1)!==n.slice(1).toLowerCase()?n:n.toLowerCase():n.replace(/^[_.\- ]+/,"").toLowerCase().replace(/[_.\- ]+(\w|$)/g,function(e,t){return t.toUpperCase()}):""},lc=fg,mg=function(){var n=lc.apply(lc,arguments);return n.charAt(0).toUpperCase()+n.slice(1)},gg=mg;let Oo;class _g{constructor(){this._listener=new Map}addListener(e,t,i,s){if(!AMap)throw new Error("please wait for Map API load");if(!e.on)return;e.on(t,i,s),this._listener.get(e)||this._listener.set(e,{});const r=this._listener.get(e);r[t]||(r[t]=[]),r[t].push(i)}removeListener(e,t,i){if(!AMap)throw new Error("please wait for Map API load");if(!e.off||!this._listener.get(e)||!this._listener.get(e)[t])return;const s=this._listener.get(e)[t];if(i){const r=s.indexOf(i);e.off(t,s[r]),s.splice(r,1)}else s.forEach(r=>{e.off(t,r)}),this._listener.get(e)[t]=[]}addListenerOnce(e,t,i,s){return e.on(t,i,s,!0)}trigger(e,t,i){return e.emit(t,i)}clearListeners(e){const t=this._listener.get(e);!t||Object.keys(t).map(i=>{e.clearEvents(i)})}}Oo=Oo||new _g;var No=Oo;function Rt(n){return n?n instanceof AMap.Map:!1}function Pt(n){return n?n instanceof AMap.OverlayGroup:!1}function yg(n){return n?n instanceof AMap.IndoorMap:!1}function kt(n){return n?n instanceof AMap.VectorLayer:!1}function cc(n){if(!n||n.length<4)return n;const e=n.substring(3,n.length);return n[2].toLowerCase()+e}const hc=/^on[A-Z]+/;function uc(n,e){if(!n)throw new Error("\u8BF7\u4F20\u5165url");const t=document.createElement("script");t.type="text/javascript",t.async=!0,t.defer=!0,t.src=n,document.body.appendChild(t),e&&t.addEventListener("load",()=>{e()})}function ko(n){return Array.isArray(n)?n.map(ko):n.toArray()}var le=H.defineComponent({inject:{parentInstance:{default:null}},inheritAttrs:!1,props:{visible:{type:Boolean,default:!0},zIndex:{type:Number},reEventWhenUpdate:{type:Boolean,default:!1}},emits:["init"],data(){return{needInitComponents:[],unwatchFns:[],propsRedirect:{},converters:{},isDestroy:!1,cacheEvents:{},isMounted:!1}},created(){this.$amapComponent=null,this.$parentComponent=null},mounted(){this.parentInstance&&(this.parentInstance.$amapComponent?this.register():this.parentInstance.addChildComponent(this))},beforeUnmount(){!this.$amapComponent||(this.unregisterEvents(),this.unwatchFns.forEach(n=>n()),this.unwatchFns=[],this.destroyComponent(),this.isDestroy=!0)},beforeUpdate(){this.reEventWhenUpdate&&this.isMounted&&this.$amapComponent&&this.unregisterEvents()},updated(){this.reEventWhenUpdate&&this.isMounted&&this.$amapComponent&&this.registerEvents()},methods:{getHandlerFun(n){return this[`__${n}`]?this[`__${n}`]:this.$amapComponent?this.$amapComponent[`set${gg(n)}`]:null},convertProps(){const n={},{$props:e,propsRedirect:t}=this;return Object.keys(e).reduce((i,s)=>{let r=s;const o=this.convertSignalProp(r,e[r]);return o===void 0||(t&&t[s]&&(r=t[r]),n[r]=o),i},n)},convertSignalProp(n,e){return this.converters&&this.converters[n]?this.converters[n].call(this,e):e},registerEvents(){const n=this.$attrs;Object.keys(n).forEach(e=>{if(hc.test(e)){const t=cc(e);No.addListener(this.$amapComponent,t,n[e]),this.cacheEvents[t]=n[e]}})},unregisterEvents(){Object.keys(this.cacheEvents).forEach(n=>{No.removeListener(this.$amapComponent,n,this.cacheEvents[n]),delete this.cacheEvents[n]})},setPropWatchers(){const{propsRedirect:n,$props:e}=this;Object.keys(e).forEach(t=>{let i=t;n&&n[t]&&(i=n[t]);const s=this.getHandlerFun(i);if(!s)return;const r={deep:!1},o=Object.prototype.toString.call(e[t]);(o==="[object Object]"||o==="[object Array]")&&(r.deep=!0);const a=this.$watch(t,l=>{s.call(this.$amapComponent,this.convertSignalProp(t,l))},r);this.unwatchFns.push(a)})},initProps(){["editable","visible","zooms"].forEach(e=>{if(this[e]!==void 0){const t=this.getHandlerFun(e);t&&t.call(this.$amapComponent,this.convertSignalProp(e,this[e]))}})},lazyRegister(){const n=this.parentInstance;n&&n.addChildComponent&&n.addChildComponent(this)},addChildComponent(n){this.needInitComponents.push(n)},createChildren(){for(;this.needInitComponents.length>0;)this.needInitComponents[0].register(),this.needInitComponents.splice(0,1)},register(){this.parentInstance&&!this.$parentComponent&&(this.$parentComponent=this.parentInstance.$amapComponent);const n=this.__initComponent&&this.__initComponent(this.convertProps());n&&n.then?n.then(e=>this.registerRest(e)):this.registerRest(n)},registerRest(n){!this.$amapComponent&&n&&(this.$amapComponent=n),this.registerEvents(),this.initProps(),this.setPropWatchers(),this.$emit("init",this.$amapComponent,this),this.$nextTick(()=>{this.createChildren()}),this.isMounted=!0},$$getInstance(){return this.$amapComponent},destroyComponent(){this.$amapComponent.setMap&&this.$amapComponent.setMap(null),this.$amapComponent.close&&this.$amapComponent.close(),this.$amapComponent.editor&&this.$amapComponent.editor.close()},__visible(n){!!this.$amapComponent&&!!this.$amapComponent.show&&!!this.$amapComponent.hide&&(n===!1?this.$amapComponent.hide():this.$amapComponent.show())},__zIndex(n){this.$amapComponent&&this.$amapComponent.setzIndex&&this.$amapComponent.setzIndex(n)}}}),dc={exports:{}};(function(n,e){(function(t,i){n.exports=i()})(pg,function(){function t(h){var d=[];return h.AMapUI&&d.push(i(h.AMapUI)),h.Loca&&d.push(s(h.Loca)),Promise.all(d)}function i(h){return new Promise(function(d,p){var g=[];if(h.plugins)for(var m=0;m0){if(++e>=R_)return arguments[0]}else e=0;return n.apply(void 0,arguments)}}var D_=Tc(bc),Ec=D_,F_=/\{\n\/\* \[wrapped with (.+)\] \*/,O_=/,? & /;function N_(n){var e=n.match(F_);return e?e[1].split(O_):[]}var k_=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;function B_(n,e){var t=e.length;if(!t)return n;var i=t-1;return e[i]=(t>1?"& ":"")+e[i],e=e.join(t>2?", ":" "),n.replace(k_,`{ /* [wrapped with `+e+`] */ `)}function $_(n){return function(){return n}}var U_=function(){try{var n=Mr(Object,"defineProperty");return n({},"",{}),n}catch{}}(),Ar=U_,z_=Ar?function(n,e){return Ar(n,"toString",{configurable:!0,enumerable:!1,value:$_(e),writable:!0})}:Bo,G_=z_,V_=Tc(G_),Lc=V_;function H_(n,e){for(var t=-1,i=n==null?0:n.length;++t-1}var J_=1,Z_=2,K_=8,Q_=16,e0=32,t0=64,n0=128,i0=256,s0=512,r0=[["ary",n0],["bind",J_],["bindKey",Z_],["curry",K_],["curryRight",Q_],["flip",s0],["partial",e0],["partialRight",t0],["rearg",i0]];function o0(n,e){return H_(r0,function(t){var i="_."+t[0];e&t[1]&&!Y_(n,i)&&n.push(i)}),n.sort()}function Rc(n,e,t){var i=e+"";return Lc(n,B_(i,o0(N_(i),t)))}var a0=1,l0=2,c0=4,h0=8,Pc=32,Ic=64;function Dc(n,e,t,i,s,r,o,a,l,c){var u=e&h0,h=u?o:void 0,d=u?void 0:o,p=u?r:void 0,g=u?void 0:r;e|=u?Pc:Ic,e&=~(u?Ic:Pc),e&c0||(e&=~(a0|l0));var m=[n,e,s,p,h,g,d,a,l,c],f=t.apply(void 0,m);return L_(n)&&Ec(f,m),f.placeholder=i,Rc(f,n,e)}function Ho(n){var e=n;return e.placeholder}var u0=9007199254740991,d0=/^(?:0|[1-9]\d*)$/;function Wo(n,e){var t=typeof n;return e=e??u0,!!e&&(t=="number"||t!="symbol"&&d0.test(n))&&n>-1&&n%1==0&&n1&&v.reverse(),u&&l<_&&(v.length=l),this&&this!==qt&&this instanceof f&&(y=m||Ts(y)),y.apply(L,v)}return f}function b0(n,e,t){var i=Ts(n);function s(){for(var r=arguments.length,o=Array(r),a=r,l=Ho(s);a--;)o[a]=arguments[a];var c=r<3&&o[0]!==l&&o[r-1]!==l?[]:Es(o,l);if(r-=c.length,r-1&&n%1==0&&n<=N0}function Ko(n){return n!=null&&Vc(n.length)&&!$o(n)}function k0(n,e,t){if(!an(t))return!1;var i=typeof e;return(i=="number"?Ko(t)&&Wo(e,t.length):i=="string"&&e in t)?Tr(t[e],n):!1}function B0(n){return Gc(function(e,t){var i=-1,s=t.length,r=s>1?t[s-1]:void 0,o=s>2?t[2]:void 0;for(r=n.length>3&&typeof r=="function"?(s--,r):void 0,o&&k0(t[0],t[1],o)&&(r=s<3?void 0:r,s=1),e=Object(e);++i-1}function Jy(n,e){var t=this.__data__,i=Er(t,n);return i<0?(++this.size,t.push([n,e])):t[i][1]=e,this}function mn(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e{Z.lazyAMapApiLoaderInstance||(Z.lazyAMapApiLoaderInstance||(n.offline?Z.lazyAMapApiLoaderInstance=new Promise(e=>{console.log("@vuemap/vue-amap\u79BB\u7EBF\u90E8\u7F72"),e(window.AMap)}):Z.lazyAMapApiLoaderInstance=Dv(n)),Z.lazyAMapApiLoaderInstance.then())};var sa=H.defineComponent({name:"ElAmap",mixins:[le],provide(){return{parentInstance:this}},props:{vid:{type:String},center:{type:Array},zoom:{type:Number},rotation:{type:Number},pitch:{type:Number},viewMode:{type:String},features:{type:Array},layers:{type:Array},zooms:{type:Array},resizeEnable:{type:Boolean,default:!0},dragEnable:{type:Boolean,default:!0},zoomEnable:{type:Boolean,default:!0},jogEnable:{type:Boolean,default:!0},pitchEnable:{type:Boolean,default:!0},rotateEnable:{type:Boolean,default:!0},animateEnable:{type:Boolean,default:!0},keyboardEnable:{type:Boolean,default:!0},doubleClickZoom:{type:Boolean,default:!0},scrollWheel:{type:Boolean,default:!0},touchZoom:{type:Boolean,default:!0},touchZoomCenter:{type:Number},showLabel:{type:Boolean,default:!0},defaultCursor:{type:String},isHotspot:{type:Boolean},mapStyle:{type:String},wallColor:{type:[String,Array]},roofColor:{type:[String,Array]},showBuildingBlock:{type:Boolean,default:!0},showIndoorMap:{type:Boolean,default:!1},skyColor:{type:[String,Array]},labelRejectMask:{type:Boolean,default:!1},mask:{type:Array},WebGLParams:{type:Object},terrain:{type:Boolean,default:!1}},emits:["update:zoom","update:center","update:rotation","update:pitch"],data(){return{}},computed:{},mounted(){this.createMap()},beforeUnmount(){this.$amapComponent&&(this.$amapComponent.destroy(),this.$amapComponent=null,this.$parentComponent=null)},methods:{createMap(){Z.lazyAMapApiLoaderInstance.then(()=>{const n=this.$el.querySelector(".el-vue-amap"),e=this.vid||ac();n.id=e,this.$nextTick(()=>{this.$amapComponent=new AMap.Map(e,this.convertProps()),this.register(),this.bindModelEvents()})}).catch(n=>{console.warn("init map error: ",n)})},bindModelEvents(){this.$amapComponent.on("zoomchange",()=>{this.$emit("update:zoom",this.$amapComponent.getZoom())}),this.$amapComponent.on("rotatechange",()=>{this.$emit("update:rotation",this.$amapComponent.getRotation()),this.$emit("update:pitch",this.$amapComponent.getPitch())}),this.$amapComponent.on("dragging",()=>{this.$emit("update:center",this.getCenter()),this.$emit("update:pitch",this.$amapComponent.getPitch())}),this.$amapComponent.on("touchmove",()=>{this.$emit("update:center",this.getCenter())})},getCenter(){const n=this.$amapComponent.getCenter();return[n.lng,n.lat]},__dragEnable(n){this.$amapComponent&&this.$amapComponent.setStatus({dragEnable:n})},__zoomEnable(n){this.$amapComponent&&this.$amapComponent.setStatus({zoomEnable:n})},__jogEnable(n){this.$amapComponent&&this.$amapComponent.setStatus({jogEnable:n})},__keyboardEnable(n){this.$amapComponent&&this.$amapComponent.setStatus({keyboardEnable:n})},__doubleClickZoom(n){this.$amapComponent&&this.$amapComponent.setStatus({doubleClickZoom:n})},__scrollWheel(n){this.$amapComponent&&this.$amapComponent.setStatus({scrollWheel:n})},__rotateEnable(n){this.$amapComponent&&this.$amapComponent.setStatus({rotateEnable:n})},__resizeEnable(n){this.$amapComponent&&this.$amapComponent.setStatus({resizeEnable:n})},__showIndoorMap(n){this.$amapComponent&&this.$amapComponent.setStatus({showIndoorMap:n})}}});const Ov={class:"el-vue-amap-container"},Nv=H.createElementVNode("div",{class:"el-vue-amap"},null,-1);function kv(n,e,t,i,s,r){return H.openBlock(),H.createElementBlock("div",Ov,[Nv,H.renderSlot(n.$slots,"default")])}sa.render=kv,sa.__file="src/packages/amap/amap.vue";const uh=ce(sa);var dh=H.defineComponent({name:"ElAmapControlControlBar",mixins:[le],props:{position:{type:[String,Object]},offset:{type:Array},showControlButton:{type:Boolean,default:!0}},data(){return{}},methods:{__initComponent(n){return new Promise(e=>{this.$parentComponent.plugin(["AMap.ControlBar"],()=>{this.$amapComponent=new AMap.ControlBar(n),this.$parentComponent.addControl(this.$amapComponent),e()})})},destroyComponent(){this.$amapComponent&&this.$parentComponent&&(this.parentInstance.isDestroy||this.$parentComponent.removeControl(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null)}},render(){return null}});dh.__file="src/packages/control/ControlBar/ControlBar.vue";const ph=ce(dh);var fh=H.defineComponent({name:"ElAmapControlHawkEye",mixins:[le],props:{autoMove:{type:Boolean,default:!0},showRectangle:{type:Boolean,default:!0},showButton:{type:Boolean,default:!0},isOpen:{type:Boolean,default:!0},mapStyle:{type:String},layers:{type:Array},width:{type:String},height:{type:String},offset:{type:Array},borderStyle:{type:String},borderColor:{type:String},borderRadius:{type:String},borderWidth:{type:String},buttonSize:{type:String}},data(){return{}},methods:{__initComponent(n){return new Promise(e=>{this.$parentComponent.plugin(["AMap.HawkEye"],()=>{this.$amapComponent=new AMap.HawkEye(n),this.$parentComponent.addControl(this.$amapComponent),e()})})},destroyComponent(){this.$amapComponent&&this.$parentComponent&&(this.parentInstance.isDestroy||this.$parentComponent.removeControl(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null)},__isOpen(n){n===!1?this.$amapComponent.close():this.$amapComponent.open()}},render(){return null}});fh.__file="src/packages/control/HawkEye/HawkEye.vue";const mh=ce(fh);var gh=H.defineComponent({name:"ElAmapControlMapType",mixins:[le],props:{defaultType:{type:Number},showTraffic:{type:Boolean,default:!1},showRoad:{type:Boolean,default:!1}},data(){return{}},methods:{__initComponent(n){return new Promise(e=>{this.$parentComponent.plugin(["AMap.MapType"],()=>{this.$amapComponent=new AMap.MapType(n),this.$parentComponent.addControl(this.$amapComponent),e()})})},destroyComponent(){this.$amapComponent&&this.$parentComponent&&(this.parentInstance.isDestroy||this.$parentComponent.removeControl(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null)}},render(){return null}});gh.__file="src/packages/control/MapType/MapType.vue";const _h=ce(gh);var yh=H.defineComponent({name:"ElAmapControlScale",mixins:[le],props:{position:{type:[String,Object]},offset:{type:Array}},data(){return{}},methods:{__initComponent(n){return new Promise(e=>{this.$parentComponent.plugin(["AMap.Scale"],()=>{this.$amapComponent=new AMap.Scale(n),this.$parentComponent.addControl(this.$amapComponent),e()})})},destroyComponent(){this.$amapComponent&&this.$parentComponent&&(this.parentInstance.isDestroy||this.$parentComponent.removeControl(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null)}},render(){return null}});yh.__file="src/packages/control/Scale/Scale.vue";const vh=ce(yh);var xh=H.defineComponent({name:"ElAmapControlToolBar",mixins:[le],props:{position:{type:[String,Object]},offset:{type:Array}},data(){return{}},methods:{__initComponent(n){return new Promise(e=>{this.$parentComponent.plugin(["AMap.ToolBar"],()=>{this.$amapComponent=new AMap.ToolBar(n),this.$parentComponent.addControl(this.$amapComponent),e()})})},destroyComponent(){this.$amapComponent&&this.$parentComponent&&(this.parentInstance.isDestroy||this.$parentComponent.removeControl(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null)}},render(){return null}});xh.__file="src/packages/control/ToolBar/ToolBar.vue";const bh=ce(xh);var ra=H.defineComponent({name:"ElAmapSearchBox",mixins:[le],props:{type:{type:String},city:{type:String},datatype:{type:String},citylimit:{type:Boolean,default:!1},inputId:{type:String},inputCustom:{type:Boolean,default:!1},outputId:{type:String},outPutDirAuto:{type:Boolean,default:!0},closeResultOnScroll:{type:Boolean,default:!0},lang:{type:String},placeholder:{type:String}},data(){return{saveInputId:"",saveVisible:!0}},created(){this.saveInputId=ac()},methods:{__initComponent(n){return n.inputId&&(this.saveInputId=n.inputId,delete n.inputId),n.visible&&(this.saveVisible=n.visible),n.input=this.saveInputId,n.outputId&&(n.output=n.outputId,delete n.outputId),new Promise(e=>{this.$parentComponent.plugin(["AMap.AutoComplete"],()=>{this.$amapComponent=new AMap.AutoComplete(n),e()})})},__visible(n){this.saveVisible=n},__citylimit(n){this.$amapComponent.setCityLimit(n)}}});const Bv={class:"el-vue-search-box-container"},$v=["id","placeholder"];function Uv(n,e,t,i,s,r){return H.withDirectives((H.openBlock(),H.createElementBlock("div",Bv,[n.inputCustom?H.createCommentVNode("v-if",!0):(H.openBlock(),H.createElementBlock("input",{key:0,id:n.saveInputId,type:"text",placeholder:n.placeholder},null,8,$v))],512)),[[H.vShow,n.visible&&!n.inputCustom]])}ra.render=Uv,ra.__file="src/packages/control/SearchBox/SearchBox.vue";const Mh=ce(ra);var oa=H.defineComponent({name:"ElAmapInfoWindow",mixins:[le],props:{isCustom:{type:Boolean,default:!1},autoMove:{type:Boolean,default:!0},avoid:{type:Array},closeWhenClickMap:{type:Boolean,default:!1},content:{type:[String,Object]},size:{type:Array},anchor:{type:String},offset:{type:Array},position:{type:Array}},emits:["update:visible"],data(){return{converters:{}}},unmounted(){this.$amapComponent&&this.$amapComponent.close()},updated(){!this.content&&this.$amapComponent&&this.$amapComponent.setContent(this.$refs.info)},methods:{__initComponent(n){if(n.content||(n.content=this.getSlotContent()),this.$amapComponent=new AMap.InfoWindow(n),this.$amapComponent.on("close",()=>{this.$emit("update:visible",!1)}),this.visible!==!1&&this.$amapComponent.open(this.$parentComponent,this.position),!this.content&&this.$amapComponent){const e={attributes:!0,childList:!0,subtree:!0},t=new MutationObserver(()=>{this.$amapComponent.setContent(this.getSlotContent())});t.observe(this.$refs.info,e),this.observer=t}},getSlotContent(){return this.$refs.info},destroyComponent(){this.observer&&(this.observer.disconnect(),this.observer=null),this.$amapComponent&&(this.$amapComponent.getIsOpen()&&this.$amapComponent.close(),this.$amapComponent=null,this.$parentComponent=null)},__position(n){this.visible?this.$amapComponent.open(this.$parentComponent,n):this.$amapComponent.setPosition(n)},__visible(n){const e=this.$amapComponent.getPosition();e&&(n===!1?this.$amapComponent.close():this.$amapComponent.open(this.$parentComponent,[e.lng,e.lat]))}}});const zv={style:{display:"none"}},Gv={ref:"info"};function Vv(n,e,t,i,s,r){return H.openBlock(),H.createElementBlock("div",zv,[H.createElementVNode("div",Gv,[H.renderSlot(n.$slots,"default")],512)])}oa.render=Vv,oa.__file="src/packages/infoWindow/InfoWindow/InfoWindow.vue";const Sh=ce(oa);var Ch=H.defineComponent({name:"ElAmapLayerCanvas",mixins:[le],props:{canvas:{required:!0,type:Object},zooms:{type:Array},bounds:{type:[Array,Object]},opacity:{type:Number}},data(){return{handlers:{}}},methods:{__initComponent(n){this.$amapComponent=new AMap.CanvasLayer(n),this.$parentComponent.addLayer(this.$amapComponent)},destroyComponent(){this.parentInstance.isDestroy||this.$parentComponent.removeLayer(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null}},render(){return null}});Ch.__file="src/packages/layer/data/Canvas/Canvas.vue";const wh=ce(Ch);var Ah=H.defineComponent({name:"ElAmapLayerCustom",mixins:[le],props:{canvas:{required:!0,type:Object},render:{type:Function},zooms:{type:Array},opacity:{type:Number},alwaysRender:{type:Boolean,default:!1}},data(){return{}},methods:{__initComponent(n){const e=n.canvas;delete n.canvas,this.$amapComponent=new AMap.CustomLayer(e,n),this.$amapComponent.setMap(this.$parentComponent)},destroyComponent(){this.$amapComponent.setMap(null),this.$amapComponent=null,this.$parentComponent=null}},render(){return null}});Ah.__file="src/packages/layer/data/Custom/Custom.vue";const Th=ce(Ah);var Eh=H.defineComponent({name:"ElAmapLayerFlexible",mixins:[le],props:{cacheSize:{type:Number},createTile:{type:Function},zooms:{type:Array},opacity:{type:Array},tileSize:{type:Number}},data(){return{}},methods:{__initComponent(n){this.$amapComponent=new AMap.TileLayer.Flexible(n),this.$amapComponent.setMap(this.$parentComponent)},destroyComponent(){this.$amapComponent.destroy(),this.$amapComponent.setMap(null),this.$amapComponent=null,this.$parentComponent=null}},render(){return null}});Eh.__file="src/packages/layer/data/Flexible/Flexible.vue";const Lh=ce(Eh);var Rh=H.defineComponent({name:"ElAmapLayerGlCustom",mixins:[le],props:{init:{type:Function},render:{type:Function},zooms:{type:Array},opacity:{type:Number}},data(){return{}},methods:{__initComponent(n){this.$amapComponent=new AMap.GLCustomLayer(n),this.$amapComponent.setMap(this.$parentComponent)},destroyComponent(){this.$amapComponent.setMap(null),this.$amapComponent=null,this.$parentComponent=null}},render(){return null}});Rh.__file="src/packages/layer/data/GLCustom/GLCustom.vue";const Ph=ce(Rh);var Ih=H.defineComponent({name:"ElAmapLayerHeatMap",mixins:[le],props:{radius:{type:Number},gradient:{type:Object},zooms:{type:Array},opacity:{type:Array},config:{type:Object},dataSet:{type:Object}},data(){return{propsRedirect:{config:"3d"}}},methods:{__initComponent(n){return new Promise(e=>{AMap.plugin(["AMap.HeatMap"],()=>{delete n.dataSet,this.$amapComponent=new AMap.HeatMap(this.$parentComponent,n),this.dataSet&&this.$amapComponent.setDataSet(this.dataSet),e()})})},destroyComponent(){this.$amapComponent.setDataSet({data:[]}),this.$amapComponent.setMap(null),this.$amapComponent=null,this.$parentComponent=null}},render(){return null}});Ih.__file="src/packages/layer/data/HeatMap/HeatMap.vue";const Dh=ce(Ih);var Fh=H.defineComponent({name:"ElAmapLayerImage",mixins:[le],props:{url:{type:String,required:!0},zoom:{type:Array},bounds:{type:[Array,Object]},opacity:{type:Number}},data(){return{}},methods:{__initComponent(n){this.$amapComponent=new AMap.ImageLayer(n),this.$parentComponent.addLayer(this.$amapComponent)},destroyComponent(){this.parentInstance.isDestroy||this.$parentComponent.removeLayer(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null},__url(n){this.$amapComponent.setImageUrl(n)}},render(){return null}});Fh.__file="src/packages/layer/data/Image/Image.vue";const Oh=ce(Fh);var aa=H.defineComponent({name:"ElAmapLayerLabels",mixins:[le],provide(){return{parentInstance:this}},props:{zooms:{type:Array},opacity:{type:Number},collision:{type:Boolean,default:!0},allowCollision:{type:Boolean,default:!1}},data(){return{}},methods:{__initComponent(n){this.$amapComponent=new AMap.LabelsLayer(n),this.$parentComponent.add(this.$amapComponent)},$$add(n){this.$amapComponent.add(n)},destroyComponent(){this.parentInstance.isDestroy||this.$parentComponent.removeLayer(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null}}});function Hv(n,e,t,i,s,r){return H.openBlock(),H.createElementBlock("div",null,[H.renderSlot(n.$slots,"default")])}aa.render=Hv,aa.__file="src/packages/layer/data/Labels/Labels.vue";const Nh=ce(aa);var la=H.defineComponent({name:"ElAmapLayerVector",mixins:[le],provide(){return{parentInstance:this}},props:{},data(){return{}},methods:{__initComponent(n){this.$amapComponent=new AMap.VectorLayer(n),this.$parentComponent.add(this.$amapComponent)},destroyComponent(){this.parentInstance.isDestroy||this.$parentComponent.removeLayer(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null}}});function Wv(n,e,t,i,s,r){return H.openBlock(),H.createElementBlock("div",null,[H.renderSlot(n.$slots,"default")])}la.render=Wv,la.__file="src/packages/layer/data/Vector/Vector.vue";const kh=ce(la);var Bh=H.defineComponent({name:"ElAmapLayerBuildings",mixins:[le],props:{wallColor:{type:[String,Array]},roofColor:{type:[String,Array]},heightFactor:{type:Number},styleOpts:{type:Object},zooms:{type:Array},opacity:{type:Number}},data(){return{}},methods:{__initComponent(n){this.$amapComponent=new AMap.Buildings(n),this.$parentComponent.add(this.$amapComponent),this.styleOpts&&this.__styleOpts(this.styleOpts)},destroyComponent(){this.$amapComponent.destroy(),this.parentInstance.isDestroy||this.$parentComponent.remove(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null},__styleOpts(n){this.$amapComponent.setStyle(n)}},render(){return null}});Bh.__file="src/packages/layer/official/Buildings/Buildings.vue";const $h=ce(Bh);var Uh=H.defineComponent({name:"ElAmapLayerDefault",mixins:[le],props:{zoom:{type:Array},opacity:{type:Number}},data(){return{}},methods:{__initComponent(n){this.$amapComponent=AMap.createDefaultLayer(n),this.$parentComponent.add(this.$amapComponent)}},render(){return null}});Uh.__file="src/packages/layer/official/DefaultLayer/DefaultLayer.vue";const zh=ce(Uh);var Gh=H.defineComponent({name:"ElAmapLayerDistrict",mixins:[le],props:{type:{type:String,default:"Country",validator(n){return["World","Country","Province"].indexOf(n)!==-1}},adcode:{type:String},SOC:{type:String},depth:{type:Number},zooms:{type:Array},opacity:{type:Number},styles:{type:Object}},data(){return{}},methods:{__initComponent(n){this.type==="World"?this.$amapComponent=new AMap.DistrictLayer.World(n):this.type==="Country"?this.$amapComponent=new AMap.DistrictLayer.Country(n):this.type==="Province"&&(this.$amapComponent=new AMap.DistrictLayer.Province(n)),this.$parentComponent.add(this.$amapComponent)},destroyComponent(){this.parentInstance.isDestroy||this.$parentComponent.remove(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null},__SOC(n){this.$amapComponent.setSOC(n)}},render(){return null}});Gh.__file="src/packages/layer/official/DistrictLayer/DistrictLayer.vue";const Vh=ce(Gh);var Hh=H.defineComponent({name:"ElAmapLayerIndoorMap",mixins:[le],props:{opacity:{type:Number},cursor:{type:String},hideFloorBar:{type:Boolean,default:!1}},data(){return{}},methods:{__initComponent(n){return new Promise(e=>{AMap.plugin(["AMap.IndoorMap"],()=>{this.$amapComponent=new AMap.IndoorMap(n);const t=this.$parentComponent.getLayers();t.push(this.$amapComponent),this.$parentComponent.setLayers(t),e()})})},destroyComponent(){const n=this.$parentComponent.getLayers();let e=-1;for(let t=0;t-1&&(n.splice(e,1),this.$parentComponent.setLayers(n)),this.$amapComponent=null,this.$parentComponent=null},__hideFloorBar(n){n===!1?this.$amapComponent.hideFloorBar():this.$amapComponent.showFloorBar()}},render(){return null}});Hh.__file="src/packages/layer/official/IndoorMap/IndoorMap.vue";const Wh=ce(Hh);var jh=H.defineComponent({name:"ElAmapLayerRoadNet",mixins:[le],props:{zooms:{type:Array},opacity:{type:Number},tileSize:{type:Number}},data(){return{}},methods:{__initComponent(n){this.$amapComponent=new AMap.TileLayer.RoadNet(n),this.$parentComponent.add(this.$amapComponent)},destroyComponent(){this.$amapComponent.destroy(),this.parentInstance.isDestroy||this.$parentComponent.remove(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null}},render(){return null}});jh.__file="src/packages/layer/official/RoadNet/RoadNet.vue";const qh=ce(jh);var Xh=H.defineComponent({name:"ElAmapLayerSatellite",mixins:[le],props:{zooms:{type:Array},opacity:{type:Number},tileSize:{type:Number}},data(){return{}},methods:{__initComponent(n){this.$amapComponent=new AMap.TileLayer.Satellite(n),this.$parentComponent.add(this.$amapComponent)},destroyComponent(){this.$amapComponent.destroy(),this.parentInstance.isDestroy||this.$parentComponent.remove(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null}},render(){return null}});Xh.__file="src/packages/layer/official/Satellite/Satellite.vue";const Yh=ce(Xh);var Jh=H.defineComponent({name:"ElAmapLayerTile",mixins:[le],props:{tileUrl:{type:String,required:!0},zoom:{type:Array},dataZooms:{type:Array},opacity:{type:Number},tileSize:{type:Number}},data(){return{}},methods:{__initComponent(n){this.$amapComponent=new AMap.TileLayer(n),this.$parentComponent.add(this.$amapComponent)},destroyComponent(){this.parentInstance.isDestroy||this.$parentComponent.remove(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null}},render(){return null}});Jh.__file="src/packages/layer/official/TileLayer/TileLayer.vue";const Zh=ce(Jh);var Kh=H.defineComponent({name:"ElAmapLayerTraffic",mixins:[le],props:{autoRefresh:{type:Boolean,defult:!0},interval:{type:Number},zooms:{type:Array},opacity:{type:Number},tileSize:{type:Number}},data(){return{}},methods:{__initComponent(n){this.$amapComponent=new AMap.TileLayer.Traffic(n),this.$parentComponent.add(this.$amapComponent)},stopFresh(){this.$amapComponent&&this.$amapComponent.stopFresh()},destroyComponent(){this.parentInstance.isDestroy||this.$parentComponent.remove(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null}},render(){return null}});Kh.__file="src/packages/layer/official/Traffic/Traffic.vue";const Qh=ce(Kh);var eu=H.defineComponent({name:"ElAmapLayerMapboxVectorTile",mixins:[le],props:{url:{type:String},zooms:{type:Array},dataZooms:{type:Array},opacity:{type:Number},styles:{type:Object}},data(){return{}},methods:{__initComponent(n){return new Promise(e=>{AMap.plugin(["AMap.MapboxVectorTileLayer"],()=>{this.$amapComponent=new AMap.MapboxVectorTileLayer(n),this.$parentComponent.addLayer(this.$amapComponent),e()})})},destroyComponent(){this.parentInstance.isDestroy||this.$parentComponent.removeLayer(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null}},render(){return null}});eu.__file="src/packages/layer/standard/MapboxVectorTileLayer/MapboxVectorTileLayer.vue";const tu=ce(eu);var nu=H.defineComponent({name:"ElAmapLayerWms",mixins:[le],props:{url:{type:String},blend:{type:Boolean,default:!1},params:{type:Object},zooms:{type:Array},opacity:{type:Number}},data(){return{}},methods:{__initComponent(n){this.$amapComponent=new AMap.TileLayer.WMS(n),this.$parentComponent.add(this.$amapComponent)},destroyComponent(){this.parentInstance.isDestroy||this.$parentComponent.remove(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null}},render(){return null}});nu.__file="src/packages/layer/standard/WMS/WMS.vue";const iu=ce(nu);var su=H.defineComponent({name:"ElAmapLayerWmts",mixins:[le],props:{url:{type:String},blend:{type:Boolean,default:!1},params:{type:Object},zooms:{type:Array},opacity:{type:Number}},data(){return{}},methods:{__initComponent(n){this.$amapComponent=new AMap.TileLayer.WMS(n),this.$parentComponent.add(this.$amapComponent)},destroyComponent(){this.parentInstance.isDestroy||this.$parentComponent.remove(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null}},render(){return null}});su.__file="src/packages/layer/standard/WMTS/WMTS.vue";const ru=ce(su);var Et=H.defineComponent({props:{sourceUrl:{type:String},sourceData:{type:Object},geoBufferSource:{type:[ArrayBuffer,String],default(){return null}},layerStyle:{type:Object},defaultStyleValue:{type:Object,default(){return{}}},zooms:{type:Array},opacity:{type:Number},initEvents:{type:Boolean,default:!0},visibleDuration:{type:Number,default:0},onClick:{type:Function,default:null},onMousemove:{type:Function,default:null},onRightclick:{type:Function,default:null}},emits:["mousemove","click","rightclick"],data(){return{isDragging:!1,isRotating:!1}},methods:{setSource(){this.source&&(this.source.destroy(),this.source=null),this.geoBufferSource?typeof this.geoBufferSource=="string"?this.source=new Loca.GeoBufferSource({url:this.geoBufferSource}):this.source=new Loca.GeoBufferSource({data:this.geoBufferSource}):this.sourceUrl?this.source=new Loca.GeoJSONSource({url:this.sourceUrl}):this.sourceData?this.source=new Loca.GeoJSONSource({data:this.sourceData}):this.source=new Loca.GeoJSONSource({}),this.$amapComponent.setSource(this.source)},initComplete(){this.initEvents&&this.bindEvents()},destroyComponent(){this.unBindEvents(),this.parentInstance.isDestroy||(this.$parentComponent.remove(this.$amapComponent),this.$amapComponent.destroy()),this.source&&(this.source.destroy(),this.source=null),this.$amapComponent=null,this.$parentComponent=null},bindEvents(){if(this.parentInstance){const n=this.parentInstance.getMap(),e=this.$props;e.onClick!==null&&n.on("click",this.clickMap),e.onMousemove!==null&&(n.on("mousemove",this.mouseMoveMap),n.on("dragstart",this.dragStart),n.on("dragend",this.dragEnd),n.on("rotatestart",this.rotateStart),n.on("rotateend",this.rotateEnd),n.on("mouseout",this.mouseoutMap)),e.onRightclick!==null&&n.on("rightclick",this.rightclickMap)}},clickMap(n){const e=this._getFeature(n);this.$emit("click",e,n)},rightclickMap(n){const e=this._getFeature(n);this.$emit("rightclick",e,n)},mouseMoveMap(n){if(this.isDragging||this.isRotating)return;const e=this._getFeature(n);this.$emit("mousemove",e,n)},_getFeature(n){return this.$amapComponent.queryFeature(n.pixel.toArray())},dragStart(){this.isDragging=!0},dragEnd(){this.isDragging=!1},mouseoutMap(){this.isDragging=!1,this.isRotating=!1},rotateStart(){this.isRotating=!0},rotateEnd(){this.isRotating=!1},unBindEvents(){if(this.parentInstance){const n=this.parentInstance.getMap();n.off("click",this.clickMap),n.off("rightclick",this.rightclickMap),n.off("mousemove",this.mouseMoveMap),n.off("dragstart",this.dragStart),n.off("dragend",this.dragEnd),n.off("rotatestart",this.rotateStart),n.off("rotateend",this.rotateEnd),n.off("mouseout",this.mouseoutMap)}},__layerStyle(n){this.$nextTick(()=>{this.$amapComponent.setStyle&&this.$amapComponent.setStyle(n)})},__sourceUrl(){this.$nextTick(()=>{this.setSource()})},__sourceData(){this.$nextTick(()=>{this.setSource()})},__geoBufferSource(){this.$nextTick(()=>{this.setSource()})},__visible(n){this.$amapComponent.show&&this.$amapComponent.hide&&(n===!1?this.$amapComponent.hide(this.visibleDuration):this.$amapComponent.show(this.visibleDuration))}}}),ou=H.defineComponent({name:"ElAmapLocaGrid",mixins:[le,Et],props:{cullface:{type:String},acceptLight:{type:Boolean,default:!0},shininess:{type:Number},hasSide:{type:Boolean,default:!0},depth:{type:Boolean,default:!0}},data(){return{converters:{},handlers:{}}},methods:{__initComponent(n){this.$amapComponent=new Loca.GridLayer(n),this.setSource(),this.setStyle(),this.$parentComponent.add(this.$amapComponent),this.initComplete()},setStyle(){const e=Object.assign({},{topColor:"#fff",sideTopColor:"#fff",sideBottomColor:"#fff",altitude:0,height:0,radius:1e3,gap:0,unit:"meter"},this.defaultStyleValue),t={topColor:(s,r)=>(r.properties=r.properties||{},r.properties.topColor===void 0?e.topColor:r.properties.topColor),sideTopColor:(s,r)=>(r.properties=r.properties||{},r.properties.sideTopColor===void 0?e.sideTopColor:r.properties.sideTopColor),sideBottomColor:(s,r)=>(r.properties=r.properties||{},r.properties.sideBottomColor===void 0?e.sideBottomColor:r.properties.sideBottomColor),altitude:(s,r)=>(r.properties=r.properties||{},r.properties.altitude===void 0?e.altitude:r.properties.altitude),height:(s,r)=>(r.properties=r.properties||{},r.properties.height===void 0?e.height:r.properties.height),radius:e.radius,gap:e.gap,unit:e.unit},i=Object.assign({},t,this.layerStyle);this.$amapComponent.setStyle(i)}},render(){return null}});ou.__file="src/packages/loca/GridLayer/GridLayer.vue";const au=ce(ou);var lu=H.defineComponent({name:"ElAmapLocaHeatmap",mixins:[le,Et],props:{depth:{type:Boolean,default:!0}},data(){return{converters:{}}},methods:{__initComponent(n){this.$amapComponent=new Loca.HeatMapLayer(n),this.setSource(),this.setStyle(),this.$parentComponent.add(this.$amapComponent),this.initComplete()},setStyle(){const e=Object.assign({},{radius:20,value:10,gradient:{.5:"blue",.65:"rgb(117,211,248)",.7:"rgb(0, 255, 0)",.9:"#ffea00",1:"red"},opacity:[0,1],height:100,heightBezier:[.4,.2,.4,.8],max:null,min:null,unit:"px",difference:!1},this.defaultStyleValue),t={radius:(s,r)=>(r.properties=r.properties||{},r.properties.radius===void 0?e.radius:r.properties.radius),value:(s,r)=>(r.properties=r.properties||{},r.properties.value===void 0?e.value:r.properties.value),gradient:e.gradient,opacity:e.opacity,height:e.height,heightBezier:e.heightBezier,max:e.max,min:e.min,unit:e.unit,difference:e.difference},i=Object.assign({},t,this.layerStyle);this.$amapComponent.setStyle(i)}},render(){return null}});lu.__file="src/packages/loca/HeatMapLayer/HeatMapLayer.vue";const cu=ce(lu);var hu=H.defineComponent({name:"ElAmapLocaHexagon",mixins:[le,Et],props:{cullface:{type:String},acceptLight:{type:Boolean,default:!0},shininess:{type:Number},hasSide:{type:Boolean,default:!0},depth:{type:Boolean,default:!0}},data(){return{}},methods:{__initComponent(n){this.$amapComponent=new Loca.HexagonLayer(n),this.setSource(),this.setStyle(),this.$parentComponent.add(this.$amapComponent),this.initComplete()},setStyle(){const e=Object.assign({},{topColor:"#fff",sideTopColor:"#fff",sideBottomColor:"#fff",altitude:0,height:0,radius:1e3,gap:0,unit:"meter"},this.defaultStyleValue),t={topColor:(s,r)=>(r.properties=r.properties||{},r.properties.topColor===void 0?e.topColor:r.properties.topColor),sideTopColor:(s,r)=>(r.properties=r.properties||{},r.properties.sideTopColor===void 0?e.sideTopColor:r.properties.sideTopColor),sideBottomColor:(s,r)=>(r.properties=r.properties||{},r.properties.sideBottomColor===void 0?e.sideBottomColor:r.properties.sideBottomColor),altitude:(s,r)=>(r.properties=r.properties||{},r.properties.altitude===void 0?e.altitude:r.properties.altitude),height:(s,r)=>(r.properties=r.properties||{},r.properties.height===void 0?e.height:r.properties.height),radius:e.radius,gap:e.gap,unit:e.unit},i=Object.assign({},t,this.layerStyle);this.$amapComponent.setStyle(i)}},render(){return null}});hu.__file="src/packages/loca/HexagonLayer/HexagonLayer.vue";const uu=ce(hu);var du=H.defineComponent({name:"ElAmapLocaIcon",mixins:[le,Et],props:{},data(){return{converters:{}}},methods:{__initComponent(n){this.$amapComponent=new Loca.IconLayer(n),this.setSource(),this.setStyle(),this.$parentComponent.add(this.$amapComponent),this.initComplete()},setStyle(){const e=Object.assign({},{unit:"px",icon:"",iconSize:[20,20],rotation:0,opacity:1,offset:[0,0]},this.defaultStyleValue),t={unit:e.unit,icon:(s,r)=>(r.properties=r.properties||{},r.properties.icon===void 0?e.icon:r.properties.icon),iconSize:(s,r)=>(r.properties=r.properties||{},r.properties.iconSize===void 0?e.iconSize:r.properties.iconSize),rotation:(s,r)=>(r.properties=r.properties||{},r.properties.rotation===void 0?e.rotation:r.properties.rotation),opacity:(s,r)=>(r.properties=r.properties||{},r.properties.opacity===void 0?e.opacity:r.properties.opacity),offset:(s,r)=>(r.properties=r.properties||{},r.properties.offset===void 0?e.offset:r.properties.offset)},i=Object.assign({},t,this.layerStyle);this.$amapComponent.setStyle(i)}},render(){return null}});du.__file="src/packages/loca/IconLayer/IconLayer.vue";const pu=ce(du);var fu=H.defineComponent({name:"ElAmapLocaLine",mixins:[le,Et],props:{},data(){return{converters:{}}},methods:{__initComponent(n){this.$amapComponent=new Loca.LineLayer(n),this.setSource(),this.setStyle(),this.$parentComponent.add(this.$amapComponent),this.initComplete()},setStyle(){const e=Object.assign({},{color:"#fff",lineWidth:2,altitude:0,borderWidth:0,borderColor:"#fff",dashArray:[10,0,10,0]},this.defaultStyleValue),i=Object.assign({},{color:(s,r)=>(r.properties=r.properties||{},r.properties.color===void 0?e.color:r.properties.color),lineWidth:(s,r)=>(r.properties=r.properties||{},r.properties.lineWidth===void 0?e.lineWidth:r.properties.lineWidth),altitude:(s,r)=>(r.properties=r.properties||{},r.properties.altitude===void 0?e.altitude:r.properties.altitude),borderWidth:(s,r)=>(r.properties=r.properties||{},r.properties.borderWidth===void 0?e.borderWidth:r.properties.borderWidth),borderColor:(s,r)=>(r.properties=r.properties||{},r.properties.borderColor===void 0?e.borderColor:r.properties.borderColor),dashArray:(s,r)=>(r.properties=r.properties||{},r.properties.dashArray===void 0?e.dashArray:r.properties.dashArray)},this.layerStyle);this.$amapComponent.setStyle(i)}},render(){return null}});fu.__file="src/packages/loca/LineLayer/LineLayer.vue";const mu=ce(fu);var gu=H.defineComponent({name:"ElAmapLocaLink",mixins:[le,Et],props:{},data(){return{converters:{}}},methods:{__initComponent(n){this.$amapComponent=new Loca.LinkLayer(n),this.setSource(),this.setStyle(),this.$parentComponent.add(this.$amapComponent),this.initComplete()},setStyle(){const e=Object.assign({},{lineColors:["rgba(255,255,255,1)","rgba(255,255,255,0)"],height:100,smoothSteps:100},this.defaultStyleValue),i=Object.assign({},{lineColors:(s,r)=>(r.properties=r.properties||{},r.properties.lineColors===void 0?e.lineColors:r.properties.lineColors),height:(s,r)=>(r.properties=r.properties||{},r.properties.height===void 0?e.height:r.properties.height),smoothSteps:(s,r)=>(r.properties=r.properties||{},r.properties.smoothSteps===void 0?e.smoothSteps:r.properties.smoothSteps)},this.layerStyle);this.$amapComponent.setStyle(i)}},render(){return null}});gu.__file="src/packages/loca/LinkLayer/LinkLayer.vue";const _u=ce(gu);var ca=H.defineComponent({name:"ElAmapLoca",mixins:[le],provide(){return{parentInstance:this}},props:{ambLight:{type:Object},dirLight:{type:Object},pointLight:{type:Object},onClick:{type:Function,default:null},onMousemove:{type:Function,default:null},onRightclick:{type:Function,default:null},eventOptions:{type:Object,default:()=>({hitFirst:!0})}},emits:["mousemove","click","rightclick"],data(){return{isDragging:!1,isRotating:!1,hitFirst:!0}},unmounted(){this.$amapComponent=null,this.$parentComponent=null},methods:{__initComponent(n){this.$amapComponent=new Loca.Container({map:this.$parentComponent}),n.ambLight&&(this.$amapComponent.ambLight=n.ambLight),n.dirLight&&(this.$amapComponent.dirLight=n.dirLight),n.pointLight&&(this.$amapComponent.pointLight=n.pointLight),this.hitFirst=n.eventOptions.hitFirst,this.bindEvents()},bindEvents(){if(this.parentInstance){const n=this.getMap(),e=this.$props;e.onClick!==null&&n.on("click",this.clickMap),e.onMousemove!==null&&(n.on("mousemove",this.mouseMoveMap),n.on("dragstart",this.dragStart),n.on("dragend",this.dragEnd),n.on("rotatestart",this.rotateStart),n.on("rotateend",this.rotateEnd),n.on("mouseout",this.mouseoutMap)),e.onRightclick!==null&&n.on("rightclick",this.rightclickMap)}},clickMap(n){const e=this._getFeature(n);this.$emit("click",e,n)},rightclickMap(n){const e=this._getFeature(n);this.$emit("rightclick",e,n)},mouseMoveMap(n){if(this.isDragging||this.isRotating)return;const e=this._getFeature(n);this.$emit("mousemove",e,n)},_getFeature(n){const e=[];if(this.$amapComponent.layers){const t=[];this.$amapComponent.layers.forEach(s=>{t.push(s)}),t.sort((s,r)=>r.zIndex-s.zIndex);const i=t.length;for(let s=0;s(r.properties=r.properties||{},r.properties.radius===void 0?e.radius:r.properties.radius),color:(s,r)=>(r.properties=r.properties||{},r.properties.color===void 0?e.color:r.properties.color),unit:e.unit,borderWidth:(s,r)=>(r.properties=r.properties||{},r.properties.borderWidth===void 0?e.borderWidth:r.properties.borderWidth),borderColor:(s,r)=>(r.properties=r.properties||{},r.properties.borderColor===void 0?e.borderColor:r.properties.borderColor),blurWidth:(s,r)=>(r.properties=r.properties||{},r.properties.blurWidth===void 0?e.blurWidth:r.properties.blurWidth)},i=Object.assign({},t,this.layerStyle);this.$amapComponent.setStyle(i)}},render(){return null}});vu.__file="src/packages/loca/PointLayer/PointLayer.vue";const xu=ce(vu);var bu=H.defineComponent({name:"ElAmapLocaPolygon",mixins:[le,Et],props:{cullface:{type:String},acceptLight:{type:Boolean,default:!0},shininess:{type:Number},hasSide:{type:Boolean,default:!0},hasBottom:{type:Boolean,default:!1},blockHide:{type:Boolean,default:!0},depth:{type:Boolean,default:!0}},data(){return{converters:{}}},methods:{__initComponent(n){this.$amapComponent=new Loca.PolygonLayer(n),this.setSource(),this.setStyle(),this.$parentComponent.add(this.$amapComponent),this.initComplete()},setStyle(){const e=Object.assign({},{topColor:"#fff",sideTopColor:"#fff",sideBottomColor:"#fff",altitude:0,height:0,texture:null,textureSize:[20,3],label:void 0,labelAltitude:0},this.defaultStyleValue),t={topColor:(s,r)=>(r.properties=r.properties||{},r.properties.topColor===void 0?e.topColor:r.properties.topColor),sideTopColor:(s,r)=>(r.properties=r.properties||{},r.properties.sideTopColor===void 0?e.sideTopColor:r.properties.sideTopColor),sideBottomColor:(s,r)=>(r.properties=r.properties||{},r.properties.sideBottomColor===void 0?e.sideBottomColor:r.properties.sideBottomColor),altitude:(s,r)=>(r.properties=r.properties||{},r.properties.altitude===void 0?e.altitude:r.properties.altitude),height:(s,r)=>(r.properties=r.properties||{},r.properties.height===void 0?e.height:r.properties.height),texture:e.texture,textureSize:(s,r)=>(r.properties=r.properties||{},r.properties.textureSize===void 0?e.textureSize:r.properties.textureSize),label:(s,r)=>(r.properties=r.properties||{},r.properties.label===void 0?e.label:r.properties.label),labelAltitude:(s,r)=>(r.properties=r.properties||{},r.properties.labelAltitude===void 0?e.labelAltitude:r.properties.labelAltitude)},i=Object.assign({},t,this.layerStyle);this.$amapComponent.setStyle(i)}},render(){return null}});bu.__file="src/packages/loca/PolygonLayer/PolygonLayer.vue";const Mu=ce(bu);var Su=H.defineComponent({name:"ElAmapLocaPrism",mixins:[le,Et],props:{cullface:{type:String},acceptLight:{type:Boolean,default:!0},shininess:{type:Number},hasSide:{type:Boolean,default:!0},depth:{type:Boolean,default:!0}},data(){return{}},methods:{__initComponent(n){this.$amapComponent=new Loca.PrismLayer(n),this.setSource(),this.setStyle(),this.$parentComponent.add(this.$amapComponent),this.initComplete()},setStyle(){const e=Object.assign({},{radius:20,unit:"px",sideNumber:3,rotation:0,altitude:0,height:100,topColor:"#fff",sideTopColor:"#fff",sideBottomColor:"#fff"},this.defaultStyleValue),t={radius:e.radius,unit:e.unit,sideNumber:e.sideNumber,rotation:(s,r)=>(r.properties=r.properties||{},r.properties.rotation===void 0?e.rotation:r.properties.rotation),altitude:e.altitude,height:(s,r)=>(r.properties=r.properties||{},r.properties.height===void 0?e.height:r.properties.height),topColor:(s,r)=>(r.properties=r.properties||{},r.properties.topColor===void 0?e.topColor:r.properties.topColor),sideTopColor:(s,r)=>(r.properties=r.properties||{},r.properties.sideTopColor===void 0?e.sideTopColor:r.properties.sideTopColor),sideBottomColor:(s,r)=>(r.properties=r.properties||{},r.properties.sideBottomColor===void 0?e.sideBottomColor:r.properties.sideBottomColor)},i=Object.assign({},t,this.layerStyle);this.$amapComponent.setStyle(i)}},render(){return null}});Su.__file="src/packages/loca/PrismLayer/PrismLayer.vue";const Cu=ce(Su);var wu=H.defineComponent({name:"ElAmapLocaPulseLine",mixins:[le,Et],props:{depth:{type:Boolean,default:!0}},data(){return{converters:{}}},methods:{__initComponent(n){this.$amapComponent=new Loca.PulseLineLayer(n),this.setSource(),this.setStyle(),this.$parentComponent.add(this.$amapComponent),this.initComplete()},setStyle(){const e=Object.assign({},{lineWidth:1,headColor:"rgba(0, 0, 0, 0.75)",trailColor:"rgba(0, 0, 0, 0.25)",altitude:0,interval:1,duration:2e3},this.defaultStyleValue),t={lineWidth:(s,r)=>(r.properties=r.properties||{},r.properties.lineWidth===void 0?e.lineWidth:r.properties.lineWidth),headColor:(s,r)=>(r.properties=r.properties||{},r.properties.headColor===void 0?e.headColor:r.properties.headColor),trailColor:(s,r)=>(r.properties=r.properties||{},r.properties.trailColor===void 0?e.trailColor:r.properties.trailColor),altitude:e.altitude,interval:e.interval,duration:e.duration},i=Object.assign({},t,this.layerStyle);this.$amapComponent.setStyle(i)}},render(){return null}});wu.__file="src/packages/loca/PulseLineLayer/PulseLineLayer.vue";const Au=ce(wu);var Tu=H.defineComponent({name:"ElAmapLocaPulseLink",mixins:[le,Et],props:{depth:{type:Boolean,default:!0}},data(){return{converters:{}}},methods:{__initComponent(n){this.$amapComponent=new Loca.PulseLinkLayer(n),this.setSource(),this.setStyle(),this.$parentComponent.add(this.$amapComponent),this.initComplete()},setStyle(){const e=Object.assign({},{lineColors:["#fff"],height:100,maxHeightScale:0,smoothSteps:50,lineWidth:[1,1],unit:"px",dash:[4e3,0,4e3,0],speed:100,headColor:"rgba(0, 0, 0, 0.75)",trailColor:"rgba(0, 0, 0, 0.25)",flowLength:100},this.defaultStyleValue),t={lineColors:(s,r)=>(r.properties=r.properties||{},r.properties.lineColors===void 0?e.lineColors:r.properties.lineColors),height:(s,r)=>(r.properties=r.properties||{},r.properties.height===void 0?e.height:r.properties.height),maxHeightScale:(s,r)=>(r.properties=r.properties||{},r.properties.maxHeightScale===void 0?e.maxHeightScale:r.properties.maxHeightScale),smoothSteps:(s,r)=>(r.properties=r.properties||{},r.properties.smoothSteps===void 0?e.smoothSteps:r.properties.smoothSteps),lineWidth:(s,r)=>(r.properties=r.properties||{},r.properties.lineWidth===void 0?e.lineWidth:r.properties.lineWidth),unit:e.unit,dash:(s,r)=>(r.properties=r.properties||{},r.properties.dash===void 0?e.dash:r.properties.dash),speed:(s,r)=>(r.properties=r.properties||{},r.properties.speed===void 0?e.speed:r.properties.speed),headColor:(s,r)=>(r.properties=r.properties||{},r.properties.headColor===void 0?e.headColor:r.properties.headColor),trailColor:(s,r)=>(r.properties=r.properties||{},r.properties.trailColor===void 0?e.trailColor:r.properties.trailColor),flowLength:e.flowLength},i=Object.assign({},t,this.layerStyle);this.$amapComponent.setStyle(i)}},render(){return null}});Tu.__file="src/packages/loca/PulseLinkLayer/PulseLinkLayer.vue";const Eu=ce(Tu);var Lu=H.defineComponent({name:"ElAmapLocaScatter",mixins:[le,Et],props:{},data(){return{converters:{}}},methods:{__initComponent(n){this.$amapComponent=new Loca.ScatterLayer(n),this.setSource(),this.setStyle(),this.$parentComponent.add(this.$amapComponent),this.initComplete()},setStyle(){const e=Object.assign({},{size:[20,20],rotation:0,color:"rgba(200,200,200,1)",altitude:0,borderWidth:0,borderColor:"rgba(250,250,250,1)",texture:null,unit:"px",animate:!1,duration:0},this.defaultStyleValue),t={size:(s,r)=>(r.properties=r.properties||{},r.properties.size===void 0?e.size:r.properties.size),rotation:(s,r)=>(r.properties=r.properties||{},r.properties.rotation===void 0?e.rotation:r.properties.rotation),color:(s,r)=>(r.properties=r.properties||{},r.properties.color===void 0?e.color:r.properties.color),altitude:(s,r)=>(r.properties=r.properties||{},r.properties.altitude===void 0?e.altitude:r.properties.altitude),borderWidth:(s,r)=>(r.properties=r.properties||{},r.properties.borderWidth===void 0?e.borderWidth:r.properties.borderWidth),borderColor:(s,r)=>(r.properties=r.properties||{},r.properties.borderColor===void 0?e.borderColor:r.properties.borderColor),texture:e.texture,unit:e.unit,animate:e.animate,duration:e.duration},i=Object.assign({},t,this.layerStyle);this.$amapComponent.setStyle(i)}},render(){return null}});Lu.__file="src/packages/loca/ScatterLayer/ScatterLayer.vue";const Ru=ce(Lu);var Pu=H.defineComponent({name:"ElAmapLocaZMarker",mixins:[le,Et],props:{},data(){return{converters:{}}},methods:{__initComponent(n){this.$amapComponent=new Loca.ZMarkerLayer(n),this.setSource(),this.setStyle(),this.$parentComponent.add(this.$amapComponent),this.initComplete()},setStyle(){const e=Object.assign({},{unit:"px",content:"",size:[20,20],rotation:0,alwaysFront:!1,altitude:0},this.defaultStyleValue),t={unit:e.unit,content:(s,r)=>(r.properties=r.properties||{},r.properties.content===void 0?e.content:r.properties.content),size:(s,r)=>(r.properties=r.properties||{},r.properties.size===void 0?e.size:r.properties.size),rotation:(s,r)=>(r.properties=r.properties||{},r.properties.rotation===void 0?e.rotation:r.properties.rotation),alwaysFront:e.alwaysFront,altitude:(s,r)=>(r.properties=r.properties||{},r.properties.altitude===void 0?e.altitude:r.properties.altitude)},i=Object.assign({},t,this.layerStyle);this.$amapComponent.setStyle(i)}},render(){return null}});Pu.__file="src/packages/loca/ZMarkerLayer/ZMarkerLayer.vue";const Iu=ce(Pu);var Du=H.defineComponent({name:"ElAmapElasticMarker",mixins:[le],props:{position:{type:[Array,Object],required:!0},title:{type:String},offset:{type:[Array,Object]},clickable:{type:Boolean,default:!0},draggable:{type:Boolean,default:!1},bubble:{type:Boolean,default:!1},zooms:{type:Array},cursor:{type:String},topWhenClick:{type:Boolean,default:!1},zoomStyleMapping:{type:Object},styles:{type:Array},extData:{type:Object,default:()=>null}},emits:["update:position"],data(){return{converters:{}}},methods:{__initComponent(n){return new Promise(e=>{AMap.plugin(["AMap.ElasticMarker"],()=>{this.$amapComponent=new AMap.ElasticMarker(n),this.$parentComponent.add(this.$amapComponent),this.bindModelEvents(),e()})})},bindModelEvents(){this.$amapComponent.on("dragend",()=>{this.emitPosition()}),this.$amapComponent.on("touchend",()=>{this.emitPosition()})},emitPosition(){const n=this.$amapComponent.getPosition();this.$emit("update:position",n.toArray())},destroyComponent(){this.parentInstance.isDestroy||this.$parentComponent.remove(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null}},render(){return null}});Du.__file="src/packages/marker/ElasticMarker/ElasticMarker.vue";const Fu=ce(Du);var Ou=H.defineComponent({name:"ElAmapLabelMarker",mixins:[le],props:{name:{type:String},position:{type:[Array,Object],required:!0},zooms:{type:Array},opacity:{type:Number},rank:{type:Number},icon:{type:Object},text:{type:Object},extData:null},data(){return{converters:{}}},methods:{__initComponent(n){this.$amapComponent=new AMap.LabelMarker(n),this.$parentComponent.add(this.$amapComponent)},destroyComponent(){this.parentInstance.isDestroy||this.$parentComponent.remove(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null}},render(){return null}});Ou.__file="src/packages/marker/LabelMarker/LabelMarker.vue";const Nu=ce(Ou);var ha=H.defineComponent({name:"ElAmapMarker",mixins:[le],props:{position:{type:[Array,Object],required:!0},icon:{type:[String,Object]},content:{type:[String,HTMLElement]},title:{type:String},offset:{type:[Array,Object]},anchor:{type:[String,Array]},angle:{type:Number},clickable:{type:Boolean,default:!0},draggable:{type:Boolean,default:!1},bubble:{type:Boolean,default:!1},zooms:{type:Array},cursor:{type:String},topWhenClick:{type:Boolean,default:!1},label:{type:Object},extData:null},emits:["update:position"],data(){return{withSlot:!1,converters:{}}},methods:{__initComponent(n){if(this.$slots.default&&this.$slots.default().length>0&&(this.withSlot=!0,n.content=this.getSlotContent()),this.$amapComponent=new AMap.Marker(n),Rt(this.$parentComponent)?this.$parentComponent.add(this.$amapComponent):Pt(this.$parentComponent)&&this.$parentComponent.addOverlay(this.$amapComponent),this.withSlot){const e={attributes:!0,childList:!0,subtree:!0},t=new MutationObserver(()=>{this.$amapComponent.setContent(this.getSlotContent())});t.observe(this.$refs.content,e),this.observer=t}this.bindModelEvents()},getSlotContent(){return this.$refs.content},bindModelEvents(){this.$amapComponent.on("dragend",()=>{this.emitPosition()}),this.$amapComponent.on("touchend",()=>{this.emitPosition()})},emitPosition(){const n=this.$amapComponent.getPosition();this.$emit("update:position",n.toArray())},destroyComponent(){this.observer&&(this.observer.disconnect(),this.observer=null),this.$amapComponent.setMap(null),this.$amapComponent=null,this.$parentComponent=null}}});const qv={style:{display:"none"}},Xv={ref:"content"};function Yv(n,e,t,i,s,r){return H.openBlock(),H.createElementBlock("div",qv,[H.createElementVNode("div",Xv,[H.renderSlot(n.$slots,"default")],512)])}ha.render=Yv,ha.__file="src/packages/marker/Marker/Marker.vue";const ku=ce(ha);var Bu=H.defineComponent({name:"ElAmapMarkerCluster",mixins:[le],props:{points:{type:Array,required:!0},gridSize:{type:Number},maxZoom:{type:Number},averageCenter:{type:Boolean,default:!0},clusterByZoomChange:{type:Boolean,default:!1},styles:{type:Array},renderClusterMarker:{type:Function},renderMarker:{type:Function}},data(){return{converters:{}}},methods:{__initComponent(n){return new Promise(e=>{AMap.plugin(["AMap.MarkerCluster"],()=>{const t=n.points;delete n.points,this.$amapComponent=new AMap.MarkerCluster(this.$parentComponent,t,n),e()})})},destroyComponent(){this.$amapComponent.setMap(null),this.$amapComponent=null,this.$parentComponent=null},__points(n){this.$amapComponent&&this.$amapComponent.setData(n)}},render(){return null}});Bu.__file="src/packages/marker/MarkerCluster/MarkerCluster.vue";const $u=ce(Bu);var Uu=H.defineComponent({name:"ElAmapMassMarks",mixins:[le],props:{data:{type:Array,required:!0},zooms:{type:Array},cursor:{type:String},styles:{type:[Array,Object]}},data(){return{propsRedirect:{styles:"style"},converters:{}}},methods:{__initComponent(n){const e=n.data;delete n.data,this.$amapComponent=new AMap.MassMarks(e,n),this.$amapComponent.setMap(this.$parentComponent)},destroyComponent(){this.$amapComponent.clear(),this.$amapComponent.setMap(null),this.$amapComponent=null,this.$parentComponent=null}},render(){return null}});Uu.__file="src/packages/marker/MassMarks/MassMarks.vue";const zu=ce(Uu);var Gu=H.defineComponent({name:"ElAmapText",mixins:[le],props:{position:{type:[Array,Object],required:!0},text:{type:String},title:{type:String},offset:{type:[Array,Object]},anchor:{type:[String,Array]},angle:{type:Number},clickable:{type:Boolean,default:!0},draggable:{type:Boolean,default:!1},bubble:{type:Boolean,default:!1},zooms:{type:Array},cursor:{type:String},topWhenClick:{type:Boolean,default:!1},textStyle:{type:Object},extData:null},emits:["update:position"],data(){return{propsRedirect:{textStyle:"style"},converters:{}}},methods:{__initComponent(n){this.$amapComponent=new AMap.Text(n),this.$parentComponent.add(this.$amapComponent),this.bindModelEvents()},bindModelEvents(){this.$amapComponent.on("dragend",()=>{this.emitPosition()}),this.$amapComponent.on("touchend",()=>{this.emitPosition()})},emitPosition(){const n=this.$amapComponent.getPosition();this.$emit("update:position",n.toArray())},destroyComponent(){this.$amapComponent.setMap(null),this.$amapComponent=null,this.$parentComponent=null}},render(){return null}});Gu.__file="src/packages/marker/Text/Text.vue";const Vu=ce(Gu);var Ri=H.defineComponent({props:{editable:{type:Boolean,default:void 0},editOptions:{type:Object}},data(){return{}},methods:{setEditorEvents(){if(!this.$amapComponent.editor)return;const n=["addnode","adjust","removenode","end","move","add"],e={};Object.keys(this.$attrs).forEach(t=>{if(hc.test(t)){const i=cc(t);n.indexOf(i)!==-1&&(e[i]=this.$attrs[t])}}),Object.keys(e).forEach(t=>{No.addListener(this.$amapComponent.editor,t,e[t])})}}}),Hu=H.defineComponent({name:"ElAmapBezierCurve",mixins:[le,Ri],props:{path:{type:Array,required:!0},bubble:{type:Boolean,default:!1},cursor:{type:String},strokeColor:{type:String},strokeOpacity:{type:Number},strokeWeight:{type:Number},borderWeight:{type:Number},isOutline:{type:Boolean,default:!1},outlineColor:{type:String},draggable:{type:Boolean,default:!1},extData:{type:Object,default:()=>null},strokeStyle:{type:String,validator(n){return["solid","dashed"].indexOf(n)!==-1}},strokeDasharray:{type:Array},lineJoin:{type:String,validator(n){return["miter","round","bevel"].indexOf(n)!==-1}},lineCap:{type:String,validator(n){return["butt","round","square"].indexOf(n)!==-1}},geodesic:{type:Boolean,default:!1},showDir:{type:Boolean,default:!1}},emits:["update:path"],data(){return{converters:{}}},methods:{__initComponent(n){this.$amapComponent=new AMap.BezierCurve(n),Rt(this.$parentComponent)?this.$parentComponent.add(this.$amapComponent):Pt(this.$parentComponent)?this.$parentComponent.addOverlay(this.$amapComponent):kt(this.$parentComponent)&&this.$parentComponent.add(this.$amapComponent),this.bindModelEvents()},bindModelEvents(){this.$amapComponent.on("dragend",()=>{this.emitModel(this.$amapComponent)}),this.$amapComponent.on("touchend",()=>{this.emitModel(this.$amapComponent)})},createEditor(){return new Promise(n=>{this.$amapComponent.editor?n():AMap.plugin(["AMap.BezierCurveEditor"],()=>{this.$amapComponent.editor=new AMap.BezierCurveEditor(this.$parentComponent,this.$amapComponent,this.editOptions),this.setEditorEvents(),this.bindEditorModelEvents(),n()})})},bindEditorModelEvents(){this.$amapComponent.editor.on("addnode",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("adjust",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("removenode",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("add",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("end",n=>{this.emitModel(n.target)})},emitModel(n){this.$emit("update:path",n.getPath())},destroyComponent(){this.$amapComponent.editor&&(this.parentInstance.isDestroy||this.$amapComponent.editor.close(),this.$amapComponent.editor=null),this.parentInstance.isDestroy||(Rt(this.$parentComponent)?this.$parentComponent.remove(this.$amapComponent):Pt(this.$parentComponent)?this.$parentComponent.removeOverlay(this.$amapComponent):kt(this.$parentComponent)&&this.$parentComponent.remove(this.$amapComponent)),this.$amapComponent.destroy&&this.$amapComponent.destroy(),this.$amapComponent=null,this.$parentComponent=null},__zIndex(n){this.$amapComponent&&this.$amapComponent.setOptions({zIndex:n})},__strokeColor(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeColor:n})},__strokeOpacity(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeOpacity:n})},__strokeWeight(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeWeight:n})},__borderWeight(n){this.$amapComponent&&this.$amapComponent.setOptions({borderWeight:n})},__isOutline(n){this.$amapComponent&&this.$amapComponent.setOptions({isOutline:n})},__outlineColor(n){this.$amapComponent&&this.$amapComponent.setOptions({outlineColor:n})},__strokeStyle(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeStyle:n})},__strokeDasharray(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeDasharray:n})},__lineJoin(n){this.$amapComponent&&this.$amapComponent.setOptions({lineJoin:n})},__lineCap(n){this.$amapComponent&&this.$amapComponent.setOptions({lineCap:n})},__geodesic(n){this.$amapComponent&&this.$amapComponent.setOptions({geodesic:n})},__showDir(n){this.$amapComponent&&this.$amapComponent.setOptions({showDir:n})},__editable(n){this.createEditor().then(()=>{n===!0?this.$amapComponent.editor.open():this.$amapComponent.editor.close()})}},render(){return null}});Hu.__file="src/packages/vector/BezierCurve/BezierCurve.vue";const Wu=ce(Hu);var ju=H.defineComponent({name:"ElAmapCircle",mixins:[le,Ri],props:{center:{type:Array,required:!0},radius:{type:Number,required:!0},bubble:{type:Boolean,default:!1},cursor:{type:String},strokeColor:{type:String},strokeOpacity:{type:Number},strokeWeight:{type:Number},fillColor:{type:String},fillOpacity:{type:Number},draggable:{type:Boolean,default:!1},extData:{type:Object,default:()=>null},strokeStyle:{type:String,validator(n){return["solid","dashed"].indexOf(n)!==-1}},strokeDasharray:{type:Array}},emits:["update:center","update:radius"],data(){return{converters:{}}},methods:{__initComponent(n){this.$amapComponent=new AMap.Circle(n),Rt(this.$parentComponent)?this.$parentComponent.add(this.$amapComponent):Pt(this.$parentComponent)?this.$parentComponent.addOverlay(this.$amapComponent):kt(this.$parentComponent)&&this.$parentComponent.add(this.$amapComponent),this.bindModelEvents()},bindModelEvents(){this.$amapComponent.on("dragend",()=>{this.emitModel(this.$amapComponent)}),this.$amapComponent.on("touchend",()=>{this.emitModel(this.$amapComponent)})},createEditor(){return new Promise(n=>{this.$amapComponent.editor?n():AMap.plugin(["AMap.CircleEditor"],()=>{this.$amapComponent.editor=new AMap.CircleEditor(this.$parentComponent,this.$amapComponent,this.editOptions),this.setEditorEvents(),this.bindEditorModelEvents(),n()})})},bindEditorModelEvents(){this.$amapComponent.editor.on("addnode",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("adjust",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("move",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("add",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("end",n=>{this.emitModel(n.target)})},emitModel(n){this.$emit("update:center",n.getCenter().toArray()),this.$emit("update:radius",n.getRadius())},destroyComponent(){this.$amapComponent.editor&&(this.parentInstance.isDestroy||this.$amapComponent.editor.close(),this.$amapComponent.editor=null),this.parentInstance.isDestroy||(Rt(this.$parentComponent)?this.$parentComponent.remove(this.$amapComponent):Pt(this.$parentComponent)?this.$parentComponent.removeOverlay(this.$amapComponent):kt(this.$parentComponent)&&this.$parentComponent.remove(this.$amapComponent)),this.$amapComponent.destroy&&this.$amapComponent.destroy(),this.$amapComponent=null,this.$parentComponent=null},__zIndex(n){this.$amapComponent&&this.$amapComponent.setOptions({zIndex:n})},__strokeColor(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeColor:n})},__strokeOpacity(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeOpacity:n})},__strokeWeight(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeWeight:n})},__fillColor(n){this.$amapComponent&&this.$amapComponent.setOptions({fillColor:n})},__fillOpacity(n){this.$amapComponent&&this.$amapComponent.setOptions({fillOpacity:n})},__strokeStyle(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeStyle:n})},__strokeDasharray(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeDasharray:n})},__editable(n){this.createEditor().then(()=>{n===!0?this.$amapComponent.editor.open():this.$amapComponent.editor.close()})}},render(){return null}});ju.__file="src/packages/vector/Circle/Circle.vue";const qu=ce(ju);var Xu=H.defineComponent({name:"ElAmapEllipse",mixins:[le,Ri],props:{center:{type:Array,required:!0},radius:{type:Array,required:!0},bubble:{type:Boolean,default:!1},cursor:{type:String},strokeColor:{type:String},strokeOpacity:{type:Number},strokeWeight:{type:Number},fillColor:{type:String},fillOpacity:{type:Number},draggable:{type:Boolean,default:!1},extData:{type:Object,default:()=>null},strokeStyle:{type:String,validator(n){return["solid","dashed"].indexOf(n)!==-1}},strokeDasharray:{type:Array}},emits:["update:center","update:radius"],data(){return{converters:{}}},methods:{__initComponent(n){this.$amapComponent=new AMap.Ellipse(n),Rt(this.$parentComponent)?this.$parentComponent.add(this.$amapComponent):Pt(this.$parentComponent)?this.$parentComponent.addOverlay(this.$amapComponent):kt(this.$parentComponent)&&this.$parentComponent.add(this.$amapComponent),this.bindModelEvents()},bindModelEvents(){this.$amapComponent.on("dragend",()=>{this.emitModel(this.$amapComponent)}),this.$amapComponent.on("touchend",()=>{this.emitModel(this.$amapComponent)})},createEditor(){return new Promise(n=>{this.$amapComponent.editor?n():AMap.plugin(["AMap.EllipseEditor"],()=>{this.$amapComponent.editor=new AMap.EllipseEditor(this.$parentComponent,this.$amapComponent,this.editOptions),this.setEditorEvents(),this.bindEditorModelEvents(),n()})})},bindEditorModelEvents(){this.$amapComponent.editor.on("addnode",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("adjust",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("move",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("add",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("end",n=>{this.emitModel(n.target)})},emitModel(n){this.$emit("update:center",n.getCenter().toArray()),this.$emit("update:radius",n.getRadius())},destroyComponent(){this.$amapComponent.editor&&(this.parentInstance.isDestroy||this.$amapComponent.editor.close(),this.$amapComponent.editor=null),this.parentInstance.isDestroy||(Rt(this.$parentComponent)?this.$parentComponent.remove(this.$amapComponent):Pt(this.$parentComponent)?this.$parentComponent.removeOverlay(this.$amapComponent):kt(this.$parentComponent)&&this.$parentComponent.remove(this.$amapComponent)),this.$amapComponent.destroy&&this.$amapComponent.destroy(),this.$amapComponent=null,this.$parentComponent=null},__zIndex(n){this.$amapComponent&&this.$amapComponent.setOptions({zIndex:n})},__strokeColor(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeColor:n})},__strokeOpacity(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeOpacity:n})},__strokeWeight(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeWeight:n})},__fillColor(n){this.$amapComponent&&this.$amapComponent.setOptions({fillColor:n})},__fillOpacity(n){this.$amapComponent&&this.$amapComponent.setOptions({fillOpacity:n})},__strokeStyle(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeStyle:n})},__strokeDasharray(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeDasharray:n})},__editable(n){this.createEditor().then(()=>{n===!0?this.$amapComponent.editor.open():this.$amapComponent.editor.close()})}},render(){return null}});Xu.__file="src/packages/vector/Ellipse/Ellipse.vue";const Yu=ce(Xu);var Ju=H.defineComponent({name:"ElAmapGeojson",mixins:[le],props:{geo:{type:Object,required:!0},markerOptions:{type:Object},getMarker:{type:Function},polylineOptions:{type:Object},getPolyline:{type:Function},polygonOptions:{type:Object},getPolygon:{type:Function}},data(){return{propsRedirect:{geo:"geoJSON"},converters:{}}},methods:{__initComponent(n){return new Promise(e=>{AMap.plugin(["AMap.GeoJSON"],()=>{n.getMarker||(n.getMarker=this.createMarker),n.getPolyline||(n.getPolyline=this.createPolyline),n.getPolygon||(n.getPolygon=this.createPolygon),this.$amapComponent=new AMap.GeoJSON(n),this.$parentComponent.add(this.$amapComponent),e()})})},createMarker(n,e){let t=this.markerOptions||{};return t=Li({},t,n.properties),t.position=e,new AMap.Marker(t)},createPolyline(n,e){let t=this.polylineOptions||{};return t=Li({},t,n.properties),t.path=e,new AMap.Polyline(t)},createPolygon(n,e){let t=this.polygonOptions||{};return t=Li({},t,n.properties),t.path=e,new AMap.Polygon(t)},destroyComponent(){this.parentInstance.isDestroy||this.$parentComponent.remove(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null},__geoJSON(n){this.$amapComponent&&this.$amapComponent.importData(n)}},render(){return null}});Ju.__file="src/packages/vector/GeoJSON/GeoJSON.vue";const Zu=ce(Ju);var Ku=H.defineComponent({name:"ElAmapPolygon",mixins:[le,Ri],props:{path:{type:Array,required:!0},bubble:{type:Boolean,default:!1},cursor:{type:String},strokeColor:{type:String},strokeOpacity:{type:Number},strokeWeight:{type:Number},fillColor:{type:String},fillOpacity:{type:Number},draggable:{type:Boolean,default:!1},extData:{type:Object,default:()=>null},strokeStyle:{type:String,validator(n){return["solid","dashed"].indexOf(n)!==-1}},strokeDasharray:{type:Array}},emits:["update:path"],data(){return{converters:{}}},methods:{__initComponent(n){this.$amapComponent=new AMap.Polygon(n),Rt(this.$parentComponent)?this.$parentComponent.add(this.$amapComponent):Pt(this.$parentComponent)?this.$parentComponent.addOverlay(this.$amapComponent):kt(this.$parentComponent)&&this.$parentComponent.add(this.$amapComponent),this.bindModelEvents()},bindModelEvents(){this.$amapComponent.on("dragend",()=>{this.emitModel(this.$amapComponent)}),this.$amapComponent.on("touchend",()=>{this.emitModel(this.$amapComponent)})},createEditor(){return new Promise(n=>{this.$amapComponent.editor?n():AMap.plugin(["AMap.PolygonEditor"],()=>{this.$amapComponent.editor=new AMap.PolygonEditor(this.$parentComponent,this.$amapComponent,this.editOptions),this.setEditorEvents(),this.bindEditorModelEvents(),n()})})},bindEditorModelEvents(){this.$amapComponent.editor.on("addnode",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("adjust",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("removenode",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("add",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("end",n=>{this.emitModel(n.target)})},emitModel(n){const t=n.getPath().map(ko);this.$emit("update:path",t)},destroyComponent(){this.$amapComponent.editor&&(this.parentInstance.isDestroy||this.$amapComponent.editor.close(),this.$amapComponent.editor=null),this.parentInstance.isDestroy||(Rt(this.$parentComponent)?this.$parentComponent.remove(this.$amapComponent):Pt(this.$parentComponent)?this.$parentComponent.removeOverlay(this.$amapComponent):kt(this.$parentComponent)&&this.$parentComponent.remove(this.$amapComponent)),this.$amapComponent.destroy&&this.$amapComponent.destroy(),this.$amapComponent=null,this.$parentComponent=null},__zIndex(n){this.$amapComponent&&this.$amapComponent.setOptions({zIndex:n})},__strokeColor(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeColor:n})},__strokeOpacity(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeOpacity:n})},__strokeWeight(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeWeight:n})},__fillColor(n){this.$amapComponent&&this.$amapComponent.setOptions({fillColor:n})},__fillOpacity(n){this.$amapComponent&&this.$amapComponent.setOptions({fillOpacity:n})},__strokeStyle(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeStyle:n})},__strokeDasharray(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeDasharray:n})},__editable(n){this.createEditor().then(()=>{n===!0?this.$amapComponent.editor.open():this.$amapComponent.editor.close()})}},render(){return null}});Ku.__file="src/packages/vector/Polygon/Polygon.vue";const Qu=ce(Ku);var ed=H.defineComponent({name:"ElAmapPolyline",mixins:[le,Ri],props:{path:{type:Array,required:!0},bubble:{type:Boolean,default:!1},cursor:{type:String},strokeColor:{type:String},strokeOpacity:{type:Number},strokeWeight:{type:Number},borderWeight:{type:Number},isOutline:{type:Boolean,default:!1},outlineColor:{type:String},draggable:{type:Boolean,default:!1},extData:{type:Object,default:()=>null},strokeStyle:{type:String,validator(n){return["solid","dashed"].indexOf(n)!==-1}},strokeDasharray:{type:Array},lineJoin:{type:String,validator(n){return["miter","round","bevel"].indexOf(n)!==-1}},lineCap:{type:String,validator(n){return["butt","round","square"].indexOf(n)!==-1}},geodesic:{type:Boolean,default:!1},showDir:{type:Boolean,default:!1}},emits:["update:path"],data(){return{converters:{}}},methods:{__initComponent(n){this.$amapComponent=new AMap.Polyline(n),Rt(this.$parentComponent)?this.$parentComponent.add(this.$amapComponent):Pt(this.$parentComponent)?this.$parentComponent.addOverlay(this.$amapComponent):kt(this.$parentComponent)&&this.$parentComponent.add(this.$amapComponent),this.bindModelEvents()},bindModelEvents(){this.$amapComponent.on("dragend",()=>{this.emitModel(this.$amapComponent)}),this.$amapComponent.on("touchend",()=>{this.emitModel(this.$amapComponent)})},createEditor(){return new Promise(n=>{this.$amapComponent.editor?n():AMap.plugin(["AMap.PolylineEditor"],()=>{this.$amapComponent.editor=new AMap.PolylineEditor(this.$parentComponent,this.$amapComponent,this.editOptions),this.setEditorEvents(),this.bindEditorModelEvents(),n()})})},bindEditorModelEvents(){this.$amapComponent.editor.on("addnode",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("adjust",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("removenode",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("add",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("end",n=>{this.emitModel(n.target)})},emitModel(n){const t=n.getPath().map(ko);this.$emit("update:path",t)},destroyComponent(){this.$amapComponent.editor&&(this.parentInstance.isDestroy||this.$amapComponent.editor.close(),this.$amapComponent.editor=null),this.parentInstance.isDestroy||(Rt(this.$parentComponent)?this.$parentComponent.remove(this.$amapComponent):Pt(this.$parentComponent)?this.$parentComponent.removeOverlay(this.$amapComponent):kt(this.$parentComponent)&&this.$parentComponent.remove(this.$amapComponent)),this.$amapComponent.destroy&&this.$amapComponent.destroy(),this.$amapComponent=null,this.$parentComponent=null},__zIndex(n){this.$amapComponent&&this.$amapComponent.setOptions({zIndex:n})},__strokeColor(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeColor:n})},__strokeOpacity(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeOpacity:n})},__strokeWeight(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeWeight:n})},__borderWeight(n){this.$amapComponent&&this.$amapComponent.setOptions({borderWeight:n})},__isOutline(n){this.$amapComponent&&this.$amapComponent.setOptions({isOutline:n})},__outlineColor(n){this.$amapComponent&&this.$amapComponent.setOptions({outlineColor:n})},__strokeStyle(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeStyle:n})},__strokeDasharray(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeDasharray:n})},__lineJoin(n){this.$amapComponent&&this.$amapComponent.setOptions({lineJoin:n})},__lineCap(n){this.$amapComponent&&this.$amapComponent.setOptions({lineCap:n})},__geodesic(n){this.$amapComponent&&this.$amapComponent.setOptions({geodesic:n})},__showDir(n){this.$amapComponent&&this.$amapComponent.setOptions({showDir:n})},__editable(n){this.createEditor().then(()=>{n===!0?this.$amapComponent.editor.open():this.$amapComponent.editor.close()})}},render(){return null}});ed.__file="src/packages/vector/Polyline/Polyline.vue";const td=ce(ed);function nd(n){return new AMap.LngLat(n[0],n[1])}var id=H.defineComponent({name:"ElAmapRectangle",mixins:[le,Ri],props:{bounds:{type:Array,required:!0},bubble:{type:Boolean,default:!1},cursor:{type:String},strokeColor:{type:String},strokeOpacity:{type:Number},strokeWeight:{type:Number},fillColor:{type:String},fillOpacity:{type:Number},draggable:{type:Boolean,default:!1},extData:{type:Object,default:()=>null},strokeStyle:{type:String,validator(n){return["solid","dashed"].indexOf(n)!==-1}},strokeDasharray:{type:Array}},emits:["update:bounds"],data(){return{converters:{bounds(n){return new AMap.Bounds(nd(n[0]),nd(n[1]))}}}},methods:{__initComponent(n){this.$amapComponent=new AMap.Rectangle(n),Rt(this.$parentComponent)?this.$parentComponent.add(this.$amapComponent):Pt(this.$parentComponent)?this.$parentComponent.addOverlay(this.$amapComponent):kt(this.$parentComponent)&&this.$parentComponent.add(this.$amapComponent),this.bindModelEvents()},bindModelEvents(){this.$amapComponent.on("dragend",()=>{this.emitModel(this.$amapComponent)}),this.$amapComponent.on("touchend",()=>{this.emitModel(this.$amapComponent)})},createEditor(){return new Promise(n=>{this.$amapComponent.editor?n():AMap.plugin(["AMap.RectangleEditor"],()=>{this.$amapComponent.editor=new AMap.RectangleEditor(this.$parentComponent,this.$amapComponent,this.editOptions),this.setEditorEvents(),this.bindEditorModelEvents(),n()})})},bindEditorModelEvents(){this.$amapComponent.editor.on("addnode",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("adjust",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("move",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("add",n=>{this.emitModel(n.target)}),this.$amapComponent.editor.on("end",n=>{this.emitModel(n.target)})},emitModel(n){const e=n.getBounds(),t=e.getSouthWest(),i=e.getNorthEast(),s=[t.toArray(),i.toArray()];this.$emit("update:bounds",s)},destroyComponent(){this.$amapComponent.editor&&(this.parentInstance.isDestroy||this.$amapComponent.editor.close(),this.$amapComponent.editor=null),this.parentInstance.isDestroy||(Rt(this.$parentComponent)?this.$parentComponent.remove(this.$amapComponent):Pt(this.$parentComponent)?this.$parentComponent.removeOverlay(this.$amapComponent):kt(this.$parentComponent)&&this.$parentComponent.remove(this.$amapComponent)),this.$amapComponent.destroy&&this.$amapComponent.destroy(),this.$amapComponent=null,this.$parentComponent=null},__zIndex(n){this.$amapComponent&&this.$amapComponent.setOptions({zIndex:n})},__strokeColor(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeColor:n})},__strokeOpacity(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeOpacity:n})},__strokeWeight(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeWeight:n})},__fillColor(n){this.$amapComponent&&this.$amapComponent.setOptions({fillColor:n})},__fillOpacity(n){this.$amapComponent&&this.$amapComponent.setOptions({fillOpacity:n})},__strokeStyle(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeStyle:n})},__strokeDasharray(n){this.$amapComponent&&this.$amapComponent.setOptions({strokeDasharray:n})},__editable(n){this.createEditor().then(()=>{n===!0?this.$amapComponent.editor.open():this.$amapComponent.editor.close()})}},render(){return null}});id.__file="src/packages/vector/Rectangle/Rectangle.vue";const sd=ce(id);var rd=H.defineComponent({name:"ElAmapLayerTiles3d",mixins:[le],props:{url:{type:String,required:!0},threeScriptUrl:{type:String,default:"//a.amap.com/jsapi_demos/static/data3d/lib/three.117.js"},threeGltfLoader:{type:String,default:"//a.amap.com/jsapi_demos/static/data3d/lib/GLTFLoader.117.min.js"},layerStyle:{type:Object}},data(){return{}},methods:{__initComponent(n){return new Promise(e=>{this.$parentComponent.plugin(["AMap.3DTilesLayer"],()=>{window.THREE?(this.createLayer(n),e()):uc(n.threeScriptUrl,()=>{uc(n.threeGltfLoader,()=>{this.createLayer(n),e()})})})})},destroyComponent(){this.$amapComponent=null,this.$parentComponent=null},createLayer(n){let e={};n.layerStyle&&(e=JSON.parse(JSON.stringify(n.layerStyle))),this.$amapComponent=new AMap["3DTilesLayer"]({map:this.$parentComponent,url:n.url,style:e}),console.log(this.$amapComponent)}},render(){return null}});rd.__file="src/packages/layer/data/Tiles3D/Tiles3D.vue";const od=ce(rd);/** * @license * Copyright 2010-2022 Three.js Authors * SPDX-License-Identifier: MIT */const ua="143",Jv=0,ad=1,Zv=2,ld=1,Kv=2,Is=3,Pi=0,Xt=1,Yt=2,Qv=1,Nn=0,Ii=1,cd=2,hd=3,ud=4,ex=5,Di=100,tx=101,nx=102,dd=103,pd=104,ix=200,sx=201,rx=202,ox=203,fd=204,md=205,ax=206,lx=207,cx=208,hx=209,ux=210,dx=0,px=1,fx=2,da=3,mx=4,gx=5,_x=6,yx=7,Rr=0,vx=1,xx=2,gn=0,bx=1,Mx=2,Sx=3,Cx=4,wx=5,gd=300,Fi=301,Oi=302,pa=303,fa=304,Pr=306,ti=1e3,Lt=1001,Ir=1002,_t=1003,ma=1004,ga=1005,Ze=1006,_d=1007,ni=1008,ii=1009,Ax=1010,Tx=1011,yd=1012,Ex=1013,si=1014,Bt=1015,Jt=1016,Lx=1017,Rx=1018,Ni=1020,Px=1021,Ix=1022,Zt=1023,Dx=1024,Fx=1025,ri=1026,ki=1027,Ox=1028,Nx=1029,kx=1030,Bx=1031,$x=1033,_a=33776,ya=33777,va=33778,xa=33779,vd=35840,xd=35841,bd=35842,Md=35843,Ux=36196,Sd=37492,Cd=37496,wd=37808,Ad=37809,Td=37810,Ed=37811,Ld=37812,Rd=37813,Pd=37814,Id=37815,Dd=37816,Fd=37817,Od=37818,Nd=37819,kd=37820,Bd=37821,$d=36492,zx=2200,Gx=2201,Vx=2202,Ds=2300,Bi=2301,ba=2302,$i=2400,Ui=2401,Dr=2402,Ma=2500,Hx=2501,Wx=1,Ud=2,ln=3e3,He=3001,jx=3200,qx=3201,Fr=0,Xx=1,_n="srgb",oi="srgb-linear",Sa=7680,Yx=519,Ca=35044,zd="300 es",wa=1035;class ai{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[e]===void 0&&(i[e]=[]),i[e].indexOf(t)===-1&&i[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const s=this._listeners[e];if(s!==void 0){const r=s.indexOf(t);r!==-1&&s.splice(r,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const i=this._listeners[e.type];if(i!==void 0){e.target=this;const s=i.slice(0);for(let r=0,o=s.length;r>8&255]+xt[n>>16&255]+xt[n>>24&255]+"-"+xt[e&255]+xt[e>>8&255]+"-"+xt[e>>16&15|64]+xt[e>>24&255]+"-"+xt[t&63|128]+xt[t>>8&255]+"-"+xt[t>>16&255]+xt[t>>24&255]+xt[i&255]+xt[i>>8&255]+xt[i>>16&255]+xt[i>>24&255]).toLowerCase()}function ct(n,e,t){return Math.max(e,Math.min(t,n))}function Aa(n,e){return(n%e+e)%e}function Jx(n,e,t,i,s){return i+(n-e)*(s-i)/(t-e)}function Zx(n,e,t){return n!==e?(t-n)/(e-n):0}function Ns(n,e,t){return(1-t)*n+t*e}function Kx(n,e,t,i){return Ns(n,e,1-Math.exp(-t*i))}function Qx(n,e=1){return e-Math.abs(Aa(n,e*2)-e)}function eb(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function tb(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function nb(n,e){return n+Math.floor(Math.random()*(e-n+1))}function ib(n,e){return n+Math.random()*(e-n)}function sb(n){return n*(.5-Math.random())}function rb(n){n!==void 0&&(Gd=n);let e=Gd+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function ob(n){return n*Fs}function ab(n){return n*Os}function Ta(n){return(n&n-1)==0&&n!==0}function Vd(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function Or(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function lb(n,e,t,i,s){const r=Math.cos,o=Math.sin,a=r(t/2),l=o(t/2),c=r((e+i)/2),u=o((e+i)/2),h=r((e-i)/2),d=o((e-i)/2),p=r((i-e)/2),g=o((i-e)/2);switch(s){case"XYX":n.set(a*u,l*h,l*d,a*c);break;case"YZY":n.set(l*d,a*u,l*h,a*c);break;case"ZXZ":n.set(l*h,l*d,a*u,a*c);break;case"XZX":n.set(a*u,l*g,l*p,a*c);break;case"YXY":n.set(l*p,a*u,l*g,a*c);break;case"ZYZ":n.set(l*g,l*p,a*u,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+s)}}function cb(n,e){switch(e.constructor){case Float32Array:return n;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function hb(n,e){switch(e.constructor){case Float32Array:return n;case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}var zi=Object.freeze({__proto__:null,DEG2RAD:Fs,RAD2DEG:Os,generateUUID:$t,clamp:ct,euclideanModulo:Aa,mapLinear:Jx,inverseLerp:Zx,lerp:Ns,damp:Kx,pingpong:Qx,smoothstep:eb,smootherstep:tb,randInt:nb,randFloat:ib,randFloatSpread:sb,seededRandom:rb,degToRad:ob,radToDeg:ab,isPowerOfTwo:Ta,ceilPowerOfTwo:Vd,floorPowerOfTwo:Or,setQuaternionFromProperEuler:lb,normalize:hb,denormalize:cb});class ne{constructor(e=0,t=0){ne.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,i=this.y,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6],this.y=s[1]*t+s[4]*i+s[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(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(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=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(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y;return t*t+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const i=Math.cos(t),s=Math.sin(t),r=this.x-e.x,o=this.y-e.y;return this.x=r*i-o*s+e.x,this.y=r*s+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Ut{constructor(){Ut.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}set(e,t,i,s,r,o,a,l,c){const u=this.elements;return u[0]=e,u[1]=s,u[2]=a,u[3]=t,u[4]=r,u[5]=l,u[6]=i,u[7]=o,u[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],this}extractBasis(e,t,i){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,s=t.elements,r=this.elements,o=i[0],a=i[3],l=i[6],c=i[1],u=i[4],h=i[7],d=i[2],p=i[5],g=i[8],m=s[0],f=s[3],_=s[6],v=s[1],b=s[4],x=s[7],C=s[2],w=s[5],L=s[8];return r[0]=o*m+a*v+l*C,r[3]=o*f+a*b+l*w,r[6]=o*_+a*x+l*L,r[1]=c*m+u*v+h*C,r[4]=c*f+u*b+h*w,r[7]=c*_+u*x+h*L,r[2]=d*m+p*v+g*C,r[5]=d*f+p*b+g*w,r[8]=d*_+p*x+g*L,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8];return t*o*u-t*a*c-i*r*u+i*a*l+s*r*c-s*o*l}invert(){const e=this.elements,t=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=u*o-a*c,d=a*l-u*r,p=c*r-o*l,g=t*h+i*d+s*p;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);const m=1/g;return e[0]=h*m,e[1]=(s*c-u*i)*m,e[2]=(a*i-s*o)*m,e[3]=d*m,e[4]=(u*t-s*l)*m,e[5]=(s*r-a*t)*m,e[6]=p*m,e[7]=(i*l-c*t)*m,e[8]=(o*t-i*r)*m,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,i,s,r,o,a){const l=Math.cos(r),c=Math.sin(r);return this.set(i*l,i*c,-i*(l*o+c*a)+o+e,-s*c,s*l,-s*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){const i=this.elements;return i[0]*=e,i[3]*=e,i[6]*=e,i[1]*=t,i[4]*=t,i[7]*=t,this}rotate(e){const t=Math.cos(e),i=Math.sin(e),s=this.elements,r=s[0],o=s[3],a=s[6],l=s[1],c=s[4],u=s[7];return s[0]=t*r+i*l,s[3]=t*o+i*c,s[6]=t*a+i*u,s[1]=-i*r+t*l,s[4]=-i*o+t*c,s[7]=-i*a+t*u,this}translate(e,t){const i=this.elements;return i[0]+=e*i[2],i[3]+=e*i[5],i[6]+=e*i[8],i[1]+=t*i[2],i[4]+=t*i[5],i[7]+=t*i[8],this}equals(e){const t=this.elements,i=e.elements;for(let s=0;s<9;s++)if(t[s]!==i[s])return!1;return!0}fromArray(e,t=0){for(let i=0;i<9;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e}clone(){return new this.constructor().fromArray(this.elements)}}function Hd(n){for(let e=n.length-1;e>=0;--e)if(n[e]>65535)return!0;return!1}function ks(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function li(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function Nr(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}const Ea={[_n]:{[oi]:li},[oi]:{[_n]:Nr}},Kt={legacyMode:!0,get workingColorSpace(){return oi},set workingColorSpace(n){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(n,e,t){if(this.legacyMode||e===t||!e||!t)return n;if(Ea[e]&&Ea[e][t]!==void 0){const i=Ea[e][t];return n.r=i(n.r),n.g=i(n.g),n.b=i(n.b),n}throw new Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(n,e){return this.convert(n,this.workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this.workingColorSpace)}},Wd={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},ht={r:0,g:0,b:0},Qt={h:0,s:0,l:0},kr={h:0,s:0,l:0};function La(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}function Br(n,e){return e.r=n.r,e.g=n.g,e.b=n.b,e}class ge{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,t===void 0&&i===void 0?this.set(e):this.setRGB(e,t,i)}set(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=_n){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Kt.toWorkingColorSpace(this,t),this}setRGB(e,t,i,s=oi){return this.r=e,this.g=t,this.b=i,Kt.toWorkingColorSpace(this,s),this}setHSL(e,t,i,s=oi){if(e=Aa(e,1),t=ct(t,0,1),i=ct(i,0,1),t===0)this.r=this.g=this.b=i;else{const r=i<=.5?i*(1+t):i+t-i*t,o=2*i-r;this.r=La(o,r,e+1/3),this.g=La(o,r,e),this.b=La(o,r,e-1/3)}return Kt.toWorkingColorSpace(this,s),this}setStyle(e,t=_n){function i(r){r!==void 0&&parseFloat(r)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let s;if(s=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.exec(e)){let r;const o=s[1],a=s[2];switch(o){case"rgb":case"rgba":if(r=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(255,parseInt(r[1],10))/255,this.g=Math.min(255,parseInt(r[2],10))/255,this.b=Math.min(255,parseInt(r[3],10))/255,Kt.toWorkingColorSpace(this,t),i(r[4]),this;if(r=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(r[1],10))/100,this.g=Math.min(100,parseInt(r[2],10))/100,this.b=Math.min(100,parseInt(r[3],10))/100,Kt.toWorkingColorSpace(this,t),i(r[4]),this;break;case"hsl":case"hsla":if(r=/^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a)){const l=parseFloat(r[1])/360,c=parseInt(r[2],10)/100,u=parseInt(r[3],10)/100;return i(r[4]),this.setHSL(l,c,u,t)}break}}else if(s=/^\#([A-Fa-f\d]+)$/.exec(e)){const r=s[1],o=r.length;if(o===3)return this.r=parseInt(r.charAt(0)+r.charAt(0),16)/255,this.g=parseInt(r.charAt(1)+r.charAt(1),16)/255,this.b=parseInt(r.charAt(2)+r.charAt(2),16)/255,Kt.toWorkingColorSpace(this,t),this;if(o===6)return this.r=parseInt(r.charAt(0)+r.charAt(1),16)/255,this.g=parseInt(r.charAt(2)+r.charAt(3),16)/255,this.b=parseInt(r.charAt(4)+r.charAt(5),16)/255,Kt.toWorkingColorSpace(this,t),this}return e&&e.length>0?this.setColorName(e,t):this}setColorName(e,t=_n){const i=Wd[e.toLowerCase()];return i!==void 0?this.setHex(i,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=li(e.r),this.g=li(e.g),this.b=li(e.b),this}copyLinearToSRGB(e){return this.r=Nr(e.r),this.g=Nr(e.g),this.b=Nr(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=_n){return Kt.fromWorkingColorSpace(Br(this,ht),e),ct(ht.r*255,0,255)<<16^ct(ht.g*255,0,255)<<8^ct(ht.b*255,0,255)<<0}getHexString(e=_n){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=oi){Kt.fromWorkingColorSpace(Br(this,ht),t);const i=ht.r,s=ht.g,r=ht.b,o=Math.max(i,s,r),a=Math.min(i,s,r);let l,c;const u=(a+o)/2;if(a===o)l=0,c=0;else{const h=o-a;switch(c=u<=.5?h/(o+a):h/(2-o-a),o){case i:l=(s-r)/h+(s2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement!="undefined"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&e instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&e instanceof ImageBitmap){const t=ks("canvas");t.width=e.width,t.height=e.height;const i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);const s=i.getImageData(0,0,e.width,e.height),r=s.data;for(let o=0;o1)switch(this.wrapS){case ti:e.x=e.x-Math.floor(e.x);break;case Lt:e.x=e.x<0?0:1;break;case Ir:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case ti:e.y=e.y-Math.floor(e.y);break;case Lt:e.y=e.y<0?0:1;break;case Ir:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}}yt.DEFAULT_IMAGE=null,yt.DEFAULT_MAPPING=gd;class We{constructor(e=0,t=0,i=0,s=1){We.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=s}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,i,s){return this.x=e,this.y=t,this.z=i,this.w=s,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,i=this.y,s=this.z,r=this.w,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*s+o[12]*r,this.y=o[1]*t+o[5]*i+o[9]*s+o[13]*r,this.z=o[2]*t+o[6]*i+o[10]*s+o[14]*r,this.w=o[3]*t+o[7]*i+o[11]*s+o[15]*r,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,i,s,r;const o=.01,a=.1,l=e.elements,c=l[0],u=l[4],h=l[8],d=l[1],p=l[5],g=l[9],m=l[2],f=l[6],_=l[10];if(Math.abs(u-d)x&&b>C?bC?x=0?1:-1,b=1-_*_;if(b>Number.EPSILON){const C=Math.sqrt(b),w=Math.atan2(C,_*v);f=Math.sin(f*w)/C,a=Math.sin(a*w)/C}const x=a*v;if(l=l*f+d*x,c=c*f+p*x,u=u*f+g*x,h=h*f+m*x,f===1-a){const C=1/Math.sqrt(l*l+c*c+u*u+h*h);l*=C,c*=C,u*=C,h*=C}}e[t]=l,e[t+1]=c,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,i,s,r,o){const a=i[s],l=i[s+1],c=i[s+2],u=i[s+3],h=r[o],d=r[o+1],p=r[o+2],g=r[o+3];return e[t]=a*g+u*h+l*p-c*d,e[t+1]=l*g+u*d+c*h-a*p,e[t+2]=c*g+u*p+a*d-l*h,e[t+3]=u*g-a*h-l*d-c*p,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,i,s){return this._x=e,this._y=t,this._z=i,this._w=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t){if(!(e&&e.isEuler))throw new Error("THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.");const i=e._x,s=e._y,r=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(i/2),u=a(s/2),h=a(r/2),d=l(i/2),p=l(s/2),g=l(r/2);switch(o){case"XYZ":this._x=d*u*h+c*p*g,this._y=c*p*h-d*u*g,this._z=c*u*g+d*p*h,this._w=c*u*h-d*p*g;break;case"YXZ":this._x=d*u*h+c*p*g,this._y=c*p*h-d*u*g,this._z=c*u*g-d*p*h,this._w=c*u*h+d*p*g;break;case"ZXY":this._x=d*u*h-c*p*g,this._y=c*p*h+d*u*g,this._z=c*u*g+d*p*h,this._w=c*u*h-d*p*g;break;case"ZYX":this._x=d*u*h-c*p*g,this._y=c*p*h+d*u*g,this._z=c*u*g-d*p*h,this._w=c*u*h+d*p*g;break;case"YZX":this._x=d*u*h+c*p*g,this._y=c*p*h+d*u*g,this._z=c*u*g-d*p*h,this._w=c*u*h-d*p*g;break;case"XZY":this._x=d*u*h-c*p*g,this._y=c*p*h-d*u*g,this._z=c*u*g+d*p*h,this._w=c*u*h+d*p*g;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t!==!1&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const i=t/2,s=Math.sin(i);return this._x=e.x*s,this._y=e.y*s,this._z=e.z*s,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,i=t[0],s=t[4],r=t[8],o=t[1],a=t[5],l=t[9],c=t[2],u=t[6],h=t[10],d=i+a+h;if(d>0){const p=.5/Math.sqrt(d+1);this._w=.25/p,this._x=(u-l)*p,this._y=(r-c)*p,this._z=(o-s)*p}else if(i>a&&i>h){const p=2*Math.sqrt(1+i-a-h);this._w=(u-l)/p,this._x=.25*p,this._y=(s+o)/p,this._z=(r+c)/p}else if(a>h){const p=2*Math.sqrt(1+a-i-h);this._w=(r-c)/p,this._x=(s+o)/p,this._y=.25*p,this._z=(l+u)/p}else{const p=2*Math.sqrt(1+h-i-a);this._w=(o-s)/p,this._x=(r+c)/p,this._y=(l+u)/p,this._z=.25*p}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return iMath.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(e){return 2*Math.acos(Math.abs(ct(this.dot(e),-1,1)))}rotateTowards(e,t){const i=this.angleTo(e);if(i===0)return this;const s=Math.min(1,t/i);return this.slerp(e,s),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const i=e._x,s=e._y,r=e._z,o=e._w,a=t._x,l=t._y,c=t._z,u=t._w;return this._x=i*u+o*a+s*c-r*l,this._y=s*u+o*l+r*a-i*c,this._z=r*u+o*c+i*l-s*a,this._w=o*u-i*a-s*l-r*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const i=this._x,s=this._y,r=this._z,o=this._w;let a=o*e._w+i*e._x+s*e._y+r*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=i,this._y=s,this._z=r,this;const l=1-a*a;if(l<=Number.EPSILON){const p=1-t;return this._w=p*o+t*this._w,this._x=p*i+t*this._x,this._y=p*s+t*this._y,this._z=p*r+t*this._z,this.normalize(),this._onChangeCallback(),this}const c=Math.sqrt(l),u=Math.atan2(c,a),h=Math.sin((1-t)*u)/c,d=Math.sin(t*u)/c;return this._w=o*h+this._w*d,this._x=i*h+this._x*d,this._y=s*h+this._y*d,this._z=r*h+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){const e=Math.random(),t=Math.sqrt(1-e),i=Math.sqrt(e),s=2*Math.PI*Math.random(),r=2*Math.PI*Math.random();return this.set(t*Math.cos(s),i*Math.sin(r),i*Math.cos(r),t*Math.sin(s))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class E{constructor(e=0,t=0,i=0){E.prototype.isVector3=!0,this.x=e,this.y=t,this.z=i}set(e,t,i){return i===void 0&&(i=this.z),this.x=e,this.y=t,this.z=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Yd.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Yd.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,i=this.y,s=this.z,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6]*s,this.y=r[1]*t+r[4]*i+r[7]*s,this.z=r[2]*t+r[5]*i+r[8]*s,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,i=this.y,s=this.z,r=e.elements,o=1/(r[3]*t+r[7]*i+r[11]*s+r[15]);return this.x=(r[0]*t+r[4]*i+r[8]*s+r[12])*o,this.y=(r[1]*t+r[5]*i+r[9]*s+r[13])*o,this.z=(r[2]*t+r[6]*i+r[10]*s+r[14])*o,this}applyQuaternion(e){const t=this.x,i=this.y,s=this.z,r=e.x,o=e.y,a=e.z,l=e.w,c=l*t+o*s-a*i,u=l*i+a*t-r*s,h=l*s+r*i-o*t,d=-r*t-o*i-a*s;return this.x=c*l+d*-r+u*-a-h*-o,this.y=u*l+d*-o+h*-r-c*-a,this.z=h*l+d*-a+c*-o-u*-r,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,i=this.y,s=this.z,r=e.elements;return this.x=r[0]*t+r[4]*i+r[8]*s,this.y=r[1]*t+r[5]*i+r[9]*s,this.z=r[2]*t+r[6]*i+r[10]*s,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=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(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(e,t){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Math.max(e,Math.min(t,i)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=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(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,i){return this.x=e.x+(t.x-e.x)*i,this.y=e.y+(t.y-e.y)*i,this.z=e.z+(t.z-e.z)*i,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const i=e.x,s=e.y,r=e.z,o=t.x,a=t.y,l=t.z;return this.x=s*l-r*a,this.y=r*o-i*l,this.z=i*a-s*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return Pa.copy(this).projectOnVector(e),this.sub(Pa)}reflect(e){return this.sub(Pa.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const i=this.dot(e)/t;return Math.acos(ct(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,i=this.y-e.y,s=this.z-e.z;return t*t+i*i+s*s}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,i){const s=Math.sin(t)*e;return this.x=s*Math.sin(i),this.y=Math.cos(t)*e,this.z=s*Math.cos(i),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,i){return this.x=e*Math.sin(t),this.y=i,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),s=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=s,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=(Math.random()-.5)*2,t=Math.random()*Math.PI*2,i=Math.sqrt(1-e**2);return this.x=i*Math.cos(t),this.y=i*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const Pa=new E,Yd=new en;class yn{constructor(e=new E(1/0,1/0,1/0),t=new E(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){let t=1/0,i=1/0,s=1/0,r=-1/0,o=-1/0,a=-1/0;for(let l=0,c=e.length;lr&&(r=u),h>o&&(o=h),d>a&&(a=d)}return this.min.set(t,i,s),this.max.set(r,o,a),this}setFromBufferAttribute(e){let t=1/0,i=1/0,s=1/0,r=-1/0,o=-1/0,a=-1/0;for(let l=0,c=e.count;lr&&(r=u),h>o&&(o=h),d>a&&(a=d)}return this.min.set(t,i,s),this.max.set(r,o,a),this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;tthis.max.x||e.ythis.max.y||e.zthis.max.z)}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return!(e.max.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,ci),ci.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,i;return e.normal.x>0?(t=e.normal.x*this.min.x,i=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,i=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,i+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,i+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,i+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,i+=e.normal.z*this.min.z),t<=-e.constant&&i>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Bs),$r.subVectors(this.max,Bs),Vi.subVectors(e.a,Bs),Hi.subVectors(e.b,Bs),Wi.subVectors(e.c,Bs),Bn.subVectors(Hi,Vi),$n.subVectors(Wi,Hi),hi.subVectors(Vi,Wi);let t=[0,-Bn.z,Bn.y,0,-$n.z,$n.y,0,-hi.z,hi.y,Bn.z,0,-Bn.x,$n.z,0,-$n.x,hi.z,0,-hi.x,-Bn.y,Bn.x,0,-$n.y,$n.x,0,-hi.y,hi.x,0];return!Da(t,Vi,Hi,Wi,$r)||(t=[1,0,0,0,1,0,0,0,1],!Da(t,Vi,Hi,Wi,$r))?!1:(Ur.crossVectors(Bn,$n),t=[Ur.x,Ur.y,Ur.z],Da(t,Vi,Hi,Wi,$r))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return ci.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=this.getSize(ci).length()*.5,e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(vn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),vn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),vn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),vn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),vn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),vn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),vn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),vn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(vn),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const vn=[new E,new E,new E,new E,new E,new E,new E,new E],ci=new E,Ia=new yn,Vi=new E,Hi=new E,Wi=new E,Bn=new E,$n=new E,hi=new E,Bs=new E,$r=new E,Ur=new E,ui=new E;function Da(n,e,t,i,s){for(let r=0,o=n.length-3;r<=o;r+=3){ui.fromArray(n,r);const a=s.x*Math.abs(ui.x)+s.y*Math.abs(ui.y)+s.z*Math.abs(ui.z),l=e.dot(ui),c=t.dot(ui),u=i.dot(ui);if(Math.max(-Math.max(l,c,u),Math.min(l,c,u))>a)return!1}return!0}const pb=new yn,Jd=new E,zr=new E,Fa=new E;class zt{constructor(e=new E,t=-1){this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const i=this.center;t!==void 0?i.copy(t):pb.setFromPoints(e).getCenter(i);let s=0;for(let r=0,o=e.length;rthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){Fa.subVectors(e,this.center);const t=Fa.lengthSq();if(t>this.radius*this.radius){const i=Math.sqrt(t),s=(i-this.radius)*.5;this.center.add(Fa.multiplyScalar(s/i)),this.radius+=s}return this}union(e){return this.center.equals(e.center)===!0?zr.set(0,0,1).multiplyScalar(e.radius):zr.subVectors(e.center,this.center).normalize().multiplyScalar(e.radius),this.expandByPoint(Jd.copy(e.center).add(zr)),this.expandByPoint(Jd.copy(e.center).sub(zr)),this}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const xn=new E,Oa=new E,Gr=new E,Un=new E,Na=new E,Vr=new E,ka=new E;class $s{constructor(e=new E,t=new E(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,xn)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.direction).multiplyScalar(i).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=xn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(xn.copy(this.direction).multiplyScalar(t).add(this.origin),xn.distanceToSquared(e))}distanceSqToSegment(e,t,i,s){Oa.copy(e).add(t).multiplyScalar(.5),Gr.copy(t).sub(e).normalize(),Un.copy(this.origin).sub(Oa);const r=e.distanceTo(t)*.5,o=-this.direction.dot(Gr),a=Un.dot(this.direction),l=-Un.dot(Gr),c=Un.lengthSq(),u=Math.abs(1-o*o);let h,d,p,g;if(u>0)if(h=o*l-a,d=o*a-l,g=r*u,h>=0)if(d>=-g)if(d<=g){const m=1/u;h*=m,d*=m,p=h*(h+o*d+2*a)+d*(o*h+d+2*l)+c}else d=r,h=Math.max(0,-(o*d+a)),p=-h*h+d*(d+2*l)+c;else d=-r,h=Math.max(0,-(o*d+a)),p=-h*h+d*(d+2*l)+c;else d<=-g?(h=Math.max(0,-(-o*r+a)),d=h>0?-r:Math.min(Math.max(-r,-l),r),p=-h*h+d*(d+2*l)+c):d<=g?(h=0,d=Math.min(Math.max(-r,-l),r),p=d*(d+2*l)+c):(h=Math.max(0,-(o*r+a)),d=h>0?r:Math.min(Math.max(-r,-l),r),p=-h*h+d*(d+2*l)+c);else d=o>0?-r:r,h=Math.max(0,-(o*d+a)),p=-h*h+d*(d+2*l)+c;return i&&i.copy(this.direction).multiplyScalar(h).add(this.origin),s&&s.copy(Gr).multiplyScalar(d).add(Oa),p}intersectSphere(e,t){xn.subVectors(e.center,this.origin);const i=xn.dot(this.direction),s=xn.dot(xn)-i*i,r=e.radius*e.radius;if(s>r)return null;const o=Math.sqrt(r-s),a=i-o,l=i+o;return a<0&&l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){const i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,s,r,o,a,l;const c=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,d=this.origin;return c>=0?(i=(e.min.x-d.x)*c,s=(e.max.x-d.x)*c):(i=(e.max.x-d.x)*c,s=(e.min.x-d.x)*c),u>=0?(r=(e.min.y-d.y)*u,o=(e.max.y-d.y)*u):(r=(e.max.y-d.y)*u,o=(e.min.y-d.y)*u),i>o||r>s||((r>i||i!==i)&&(i=r),(o=0?(a=(e.min.z-d.z)*h,l=(e.max.z-d.z)*h):(a=(e.max.z-d.z)*h,l=(e.min.z-d.z)*h),i>l||a>s)||((a>i||i!==i)&&(i=a),(l=0?i:s,t)}intersectsBox(e){return this.intersectBox(e,xn)!==null}intersectTriangle(e,t,i,s,r){Na.subVectors(t,e),Vr.subVectors(i,e),ka.crossVectors(Na,Vr);let o=this.direction.dot(ka),a;if(o>0){if(s)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Un.subVectors(this.origin,e);const l=a*this.direction.dot(Vr.crossVectors(Un,Vr));if(l<0)return null;const c=a*this.direction.dot(Na.cross(Un));if(c<0||l+c>o)return null;const u=-a*Un.dot(ka);return u<0?null:this.at(u/o,r)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Se{constructor(){Se.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}set(e,t,i,s,r,o,a,l,c,u,h,d,p,g,m,f){const _=this.elements;return _[0]=e,_[4]=t,_[8]=i,_[12]=s,_[1]=r,_[5]=o,_[9]=a,_[13]=l,_[2]=c,_[6]=u,_[10]=h,_[14]=d,_[3]=p,_[7]=g,_[11]=m,_[15]=f,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Se().fromArray(this.elements)}copy(e){const t=this.elements,i=e.elements;return t[0]=i[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],this}copyPosition(e){const t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,i){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(e,t,i){return this.set(e.x,t.x,i.x,0,e.y,t.y,i.y,0,e.z,t.z,i.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,i=e.elements,s=1/ji.setFromMatrixColumn(e,0).length(),r=1/ji.setFromMatrixColumn(e,1).length(),o=1/ji.setFromMatrixColumn(e,2).length();return t[0]=i[0]*s,t[1]=i[1]*s,t[2]=i[2]*s,t[3]=0,t[4]=i[4]*r,t[5]=i[5]*r,t[6]=i[6]*r,t[7]=0,t[8]=i[8]*o,t[9]=i[9]*o,t[10]=i[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,i=e.x,s=e.y,r=e.z,o=Math.cos(i),a=Math.sin(i),l=Math.cos(s),c=Math.sin(s),u=Math.cos(r),h=Math.sin(r);if(e.order==="XYZ"){const d=o*u,p=o*h,g=a*u,m=a*h;t[0]=l*u,t[4]=-l*h,t[8]=c,t[1]=p+g*c,t[5]=d-m*c,t[9]=-a*l,t[2]=m-d*c,t[6]=g+p*c,t[10]=o*l}else if(e.order==="YXZ"){const d=l*u,p=l*h,g=c*u,m=c*h;t[0]=d+m*a,t[4]=g*a-p,t[8]=o*c,t[1]=o*h,t[5]=o*u,t[9]=-a,t[2]=p*a-g,t[6]=m+d*a,t[10]=o*l}else if(e.order==="ZXY"){const d=l*u,p=l*h,g=c*u,m=c*h;t[0]=d-m*a,t[4]=-o*h,t[8]=g+p*a,t[1]=p+g*a,t[5]=o*u,t[9]=m-d*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const d=o*u,p=o*h,g=a*u,m=a*h;t[0]=l*u,t[4]=g*c-p,t[8]=d*c+m,t[1]=l*h,t[5]=m*c+d,t[9]=p*c-g,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const d=o*l,p=o*c,g=a*l,m=a*c;t[0]=l*u,t[4]=m-d*h,t[8]=g*h+p,t[1]=h,t[5]=o*u,t[9]=-a*u,t[2]=-c*u,t[6]=p*h+g,t[10]=d-m*h}else if(e.order==="XZY"){const d=o*l,p=o*c,g=a*l,m=a*c;t[0]=l*u,t[4]=-h,t[8]=c*u,t[1]=d*h+m,t[5]=o*u,t[9]=p*h-g,t[2]=g*h-p,t[6]=a*u,t[10]=m*h+d}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(fb,e,mb)}lookAt(e,t,i){const s=this.elements;return It.subVectors(e,t),It.lengthSq()===0&&(It.z=1),It.normalize(),zn.crossVectors(i,It),zn.lengthSq()===0&&(Math.abs(i.z)===1?It.x+=1e-4:It.z+=1e-4,It.normalize(),zn.crossVectors(i,It)),zn.normalize(),Hr.crossVectors(It,zn),s[0]=zn.x,s[4]=Hr.x,s[8]=It.x,s[1]=zn.y,s[5]=Hr.y,s[9]=It.y,s[2]=zn.z,s[6]=Hr.z,s[10]=It.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const i=e.elements,s=t.elements,r=this.elements,o=i[0],a=i[4],l=i[8],c=i[12],u=i[1],h=i[5],d=i[9],p=i[13],g=i[2],m=i[6],f=i[10],_=i[14],v=i[3],b=i[7],x=i[11],C=i[15],w=s[0],L=s[4],y=s[8],A=s[12],I=s[1],R=s[5],Q=s[9],ee=s[13],D=s[2],z=s[6],k=s[10],j=s[14],W=s[3],N=s[7],G=s[11],ie=s[15];return r[0]=o*w+a*I+l*D+c*W,r[4]=o*L+a*R+l*z+c*N,r[8]=o*y+a*Q+l*k+c*G,r[12]=o*A+a*ee+l*j+c*ie,r[1]=u*w+h*I+d*D+p*W,r[5]=u*L+h*R+d*z+p*N,r[9]=u*y+h*Q+d*k+p*G,r[13]=u*A+h*ee+d*j+p*ie,r[2]=g*w+m*I+f*D+_*W,r[6]=g*L+m*R+f*z+_*N,r[10]=g*y+m*Q+f*k+_*G,r[14]=g*A+m*ee+f*j+_*ie,r[3]=v*w+b*I+x*D+C*W,r[7]=v*L+b*R+x*z+C*N,r[11]=v*y+b*Q+x*k+C*G,r[15]=v*A+b*ee+x*j+C*ie,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],i=e[4],s=e[8],r=e[12],o=e[1],a=e[5],l=e[9],c=e[13],u=e[2],h=e[6],d=e[10],p=e[14],g=e[3],m=e[7],f=e[11],_=e[15];return g*(+r*l*h-s*c*h-r*a*d+i*c*d+s*a*p-i*l*p)+m*(+t*l*p-t*c*d+r*o*d-s*o*p+s*c*u-r*l*u)+f*(+t*c*h-t*a*p-r*o*h+i*o*p+r*a*u-i*c*u)+_*(-s*a*u-t*l*h+t*a*d+s*o*h-i*o*d+i*l*u)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){const s=this.elements;return e.isVector3?(s[12]=e.x,s[13]=e.y,s[14]=e.z):(s[12]=e,s[13]=t,s[14]=i),this}invert(){const e=this.elements,t=e[0],i=e[1],s=e[2],r=e[3],o=e[4],a=e[5],l=e[6],c=e[7],u=e[8],h=e[9],d=e[10],p=e[11],g=e[12],m=e[13],f=e[14],_=e[15],v=h*f*c-m*d*c+m*l*p-a*f*p-h*l*_+a*d*_,b=g*d*c-u*f*c-g*l*p+o*f*p+u*l*_-o*d*_,x=u*m*c-g*h*c+g*a*p-o*m*p-u*a*_+o*h*_,C=g*h*l-u*m*l-g*a*d+o*m*d+u*a*f-o*h*f,w=t*v+i*b+s*x+r*C;if(w===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const L=1/w;return e[0]=v*L,e[1]=(m*d*r-h*f*r-m*s*p+i*f*p+h*s*_-i*d*_)*L,e[2]=(a*f*r-m*l*r+m*s*c-i*f*c-a*s*_+i*l*_)*L,e[3]=(h*l*r-a*d*r-h*s*c+i*d*c+a*s*p-i*l*p)*L,e[4]=b*L,e[5]=(u*f*r-g*d*r+g*s*p-t*f*p-u*s*_+t*d*_)*L,e[6]=(g*l*r-o*f*r-g*s*c+t*f*c+o*s*_-t*l*_)*L,e[7]=(o*d*r-u*l*r+u*s*c-t*d*c-o*s*p+t*l*p)*L,e[8]=x*L,e[9]=(g*h*r-u*m*r-g*i*p+t*m*p+u*i*_-t*h*_)*L,e[10]=(o*m*r-g*a*r+g*i*c-t*m*c-o*i*_+t*a*_)*L,e[11]=(u*a*r-o*h*r-u*i*c+t*h*c+o*i*p-t*a*p)*L,e[12]=C*L,e[13]=(u*m*s-g*h*s+g*i*d-t*m*d-u*i*f+t*h*f)*L,e[14]=(g*a*s-o*m*s-g*i*l+t*m*l+o*i*f-t*a*f)*L,e[15]=(o*h*s-u*a*s+u*i*l-t*h*l-o*i*d+t*a*d)*L,this}scale(e){const t=this.elements,i=e.x,s=e.y,r=e.z;return t[0]*=i,t[4]*=s,t[8]*=r,t[1]*=i,t[5]*=s,t[9]*=r,t[2]*=i,t[6]*=s,t[10]*=r,t[3]*=i,t[7]*=s,t[11]*=r,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],s=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,s))}makeTranslation(e,t,i){return this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),i=Math.sin(e);return this.set(1,0,0,0,0,t,-i,0,0,i,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,0,i,0,0,1,0,0,-i,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,0,i,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const i=Math.cos(t),s=Math.sin(t),r=1-i,o=e.x,a=e.y,l=e.z,c=r*o,u=r*a;return this.set(c*o+i,c*a-s*l,c*l+s*a,0,c*a+s*l,u*a+i,u*l-s*o,0,c*l-s*a,u*l+s*o,r*l*l+i,0,0,0,0,1),this}makeScale(e,t,i){return this.set(e,0,0,0,0,t,0,0,0,0,i,0,0,0,0,1),this}makeShear(e,t,i,s,r,o){return this.set(1,i,r,0,e,1,o,0,t,s,1,0,0,0,0,1),this}compose(e,t,i){const s=this.elements,r=t._x,o=t._y,a=t._z,l=t._w,c=r+r,u=o+o,h=a+a,d=r*c,p=r*u,g=r*h,m=o*u,f=o*h,_=a*h,v=l*c,b=l*u,x=l*h,C=i.x,w=i.y,L=i.z;return s[0]=(1-(m+_))*C,s[1]=(p+x)*C,s[2]=(g-b)*C,s[3]=0,s[4]=(p-x)*w,s[5]=(1-(d+_))*w,s[6]=(f+v)*w,s[7]=0,s[8]=(g+b)*L,s[9]=(f-v)*L,s[10]=(1-(d+m))*L,s[11]=0,s[12]=e.x,s[13]=e.y,s[14]=e.z,s[15]=1,this}decompose(e,t,i){const s=this.elements;let r=ji.set(s[0],s[1],s[2]).length();const o=ji.set(s[4],s[5],s[6]).length(),a=ji.set(s[8],s[9],s[10]).length();this.determinant()<0&&(r=-r),e.x=s[12],e.y=s[13],e.z=s[14],tn.copy(this);const c=1/r,u=1/o,h=1/a;return tn.elements[0]*=c,tn.elements[1]*=c,tn.elements[2]*=c,tn.elements[4]*=u,tn.elements[5]*=u,tn.elements[6]*=u,tn.elements[8]*=h,tn.elements[9]*=h,tn.elements[10]*=h,t.setFromRotationMatrix(tn),i.x=r,i.y=o,i.z=a,this}makePerspective(e,t,i,s,r,o){const a=this.elements,l=2*r/(t-e),c=2*r/(i-s),u=(t+e)/(t-e),h=(i+s)/(i-s),d=-(o+r)/(o-r),p=-2*o*r/(o-r);return a[0]=l,a[4]=0,a[8]=u,a[12]=0,a[1]=0,a[5]=c,a[9]=h,a[13]=0,a[2]=0,a[6]=0,a[10]=d,a[14]=p,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(e,t,i,s,r,o){const a=this.elements,l=1/(t-e),c=1/(i-s),u=1/(o-r),h=(t+e)*l,d=(i+s)*c,p=(o+r)*u;return a[0]=2*l,a[4]=0,a[8]=0,a[12]=-h,a[1]=0,a[5]=2*c,a[9]=0,a[13]=-d,a[2]=0,a[6]=0,a[10]=-2*u,a[14]=-p,a[3]=0,a[7]=0,a[11]=0,a[15]=1,this}equals(e){const t=this.elements,i=e.elements;for(let s=0;s<16;s++)if(t[s]!==i[s])return!1;return!0}fromArray(e,t=0){for(let i=0;i<16;i++)this.elements[i]=e[i+t];return this}toArray(e=[],t=0){const i=this.elements;return e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7],e[t+8]=i[8],e[t+9]=i[9],e[t+10]=i[10],e[t+11]=i[11],e[t+12]=i[12],e[t+13]=i[13],e[t+14]=i[14],e[t+15]=i[15],e}}const ji=new E,tn=new Se,fb=new E(0,0,0),mb=new E(1,1,1),zn=new E,Hr=new E,It=new E,Zd=new Se,Kd=new en;class Us{constructor(e=0,t=0,i=0,s=Us.DefaultOrder){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=s}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,i,s=this._order){return this._x=e,this._y=t,this._z=i,this._order=s,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,i=!0){const s=e.elements,r=s[0],o=s[4],a=s[8],l=s[1],c=s[5],u=s[9],h=s[2],d=s[6],p=s[10];switch(t){case"XYZ":this._y=Math.asin(ct(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,p),this._z=Math.atan2(-o,r)):(this._x=Math.atan2(d,c),this._z=0);break;case"YXZ":this._x=Math.asin(-ct(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,p),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-h,r),this._z=0);break;case"ZXY":this._x=Math.asin(ct(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-h,p),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,r));break;case"ZYX":this._y=Math.asin(-ct(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(d,p),this._z=Math.atan2(l,r)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(ct(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-u,c),this._y=Math.atan2(-h,r)):(this._x=0,this._y=Math.atan2(a,p));break;case"XZY":this._z=Math.asin(-ct(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(a,r)):(this._x=Math.atan2(-u,p),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,i===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,i){return Zd.makeRotationFromQuaternion(e),this.setFromRotationMatrix(Zd,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return Kd.setFromEuler(this),this.setFromQuaternion(Kd,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}toVector3(){console.error("THREE.Euler: .toVector3() has been removed. Use Vector3.setFromEuler() instead")}}Us.DefaultOrder="XYZ",Us.RotationOrders=["XYZ","YZX","ZXY","XZY","YXZ","ZYX"];class Ba{constructor(){this.mask=1|0}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let i=0;i0){s.children=[];for(let a=0;a0){s.animations=[];for(let a=0;a0&&(i.geometries=a),l.length>0&&(i.materials=l),c.length>0&&(i.textures=c),u.length>0&&(i.images=u),h.length>0&&(i.shapes=h),d.length>0&&(i.skeletons=d),p.length>0&&(i.animations=p),g.length>0&&(i.nodes=g)}return i.object=s,i;function o(a){const l=[];for(const c in a){const u=a[c];delete u.metadata,l.push(u)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),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(let i=0;i0?s.multiplyScalar(1/Math.sqrt(r)):s.set(0,0,0)}static getBarycoord(e,t,i,s,r){nn.subVectors(s,t),Mn.subVectors(i,t),$a.subVectors(e,t);const o=nn.dot(nn),a=nn.dot(Mn),l=nn.dot($a),c=Mn.dot(Mn),u=Mn.dot($a),h=o*c-a*a;if(h===0)return r.set(-2,-1,-1);const d=1/h,p=(c*l-a*u)*d,g=(o*u-a*l)*d;return r.set(1-p-g,g,p)}static containsPoint(e,t,i,s){return this.getBarycoord(e,t,i,s,Sn),Sn.x>=0&&Sn.y>=0&&Sn.x+Sn.y<=1}static getUV(e,t,i,s,r,o,a,l){return this.getBarycoord(e,t,i,s,Sn),l.set(0,0),l.addScaledVector(r,Sn.x),l.addScaledVector(o,Sn.y),l.addScaledVector(a,Sn.z),l}static isFrontFacing(e,t,i,s){return nn.subVectors(i,t),Mn.subVectors(e,t),nn.cross(Mn).dot(s)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,s){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[s]),this}setFromAttributeAndIndices(e,t,i,s){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,s),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return nn.subVectors(this.c,this.b),Mn.subVectors(this.a,this.b),nn.cross(Mn).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Cn.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Cn.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,i,s,r){return Cn.getUV(e,this.a,this.b,this.c,t,i,s,r)}containsPoint(e){return Cn.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Cn.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const i=this.a,s=this.b,r=this.c;let o,a;Xi.subVectors(s,i),Yi.subVectors(r,i),Ua.subVectors(e,i);const l=Xi.dot(Ua),c=Yi.dot(Ua);if(l<=0&&c<=0)return t.copy(i);za.subVectors(e,s);const u=Xi.dot(za),h=Yi.dot(za);if(u>=0&&h<=u)return t.copy(s);const d=l*h-u*c;if(d<=0&&l>=0&&u<=0)return o=l/(l-u),t.copy(i).addScaledVector(Xi,o);Ga.subVectors(e,r);const p=Xi.dot(Ga),g=Yi.dot(Ga);if(g>=0&&p<=g)return t.copy(r);const m=p*c-l*g;if(m<=0&&c>=0&&g<=0)return a=c/(c-g),t.copy(i).addScaledVector(Yi,a);const f=u*g-p*h;if(f<=0&&h-u>=0&&p-g>=0)return sp.subVectors(r,s),a=(h-u)/(h-u+(p-g)),t.copy(s).addScaledVector(sp,a);const _=1/(f+m+d);return o=m*_,a=d*_,t.copy(i).addScaledVector(Xi,o).addScaledVector(Yi,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let xb=0;class Gt extends ai{constructor(){super();this.isMaterial=!0,Object.defineProperty(this,"id",{value:xb++}),this.uuid=$t(),this.name="",this.type="Material",this.blending=Ii,this.side=Pi,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=fd,this.blendDst=md,this.blendEquation=Di,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=da,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Yx,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Sa,this.stencilZFail=Sa,this.stencilZPass=Sa,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const i=e[t];if(i===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=i===Qv;continue}const s=this[t];if(s===void 0){console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.");continue}s&&s.isColor?s.set(i):s&&s.isVector3&&i&&i.isVector3?s.copy(i):this[t]=i}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const i={metadata:{version:4.5,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(e).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(e).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(e).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(e).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(e).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==Ii&&(i.blending=this.blending),this.side!==Pi&&(i.side=this.side),this.vertexColors&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=this.transparent),i.depthFunc=this.depthFunc,i.depthTest=this.depthTest,i.depthWrite=this.depthWrite,i.colorWrite=this.colorWrite,i.stencilWrite=this.stencilWrite,i.stencilWriteMask=this.stencilWriteMask,i.stencilFunc=this.stencilFunc,i.stencilRef=this.stencilRef,i.stencilFuncMask=this.stencilFuncMask,i.stencilFail=this.stencilFail,i.stencilZFail=this.stencilZFail,i.stencilZPass=this.stencilZPass,this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaToCoverage===!0&&(i.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=this.premultipliedAlpha),this.wireframe===!0&&(i.wireframe=this.wireframe),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=this.flatShading),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),JSON.stringify(this.userData)!=="{}"&&(i.userData=this.userData);function s(r){const o=[];for(const a in r){const l=r[a];delete l.metadata,o.push(l)}return o}if(t){const r=s(e.textures),o=s(e.images);r.length>0&&(i.textures=r),o.length>0&&(i.images=o)}return i}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let i=null;if(t!==null){const s=t.length;i=new Array(s);for(let r=0;r!==s;++r)i[r]=t[r].clone()}return this.clippingPlanes=i,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}}class di extends Gt{constructor(e){super();this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ge(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=Rr,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const at=new E,jr=new ne;class dt{constructor(e,t,i){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=i===!0,this.usage=Ca,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let s=0,r=this.itemSize;s0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const i=this.attributes;for(const l in i){const c=i[l];e.data.attributes[l]=c.toJSON(e.data)}const s={};let r=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],u=[];for(let h=0,d=c.length;h0&&(s[l]=u,r=!0)}r&&(e.data.morphAttributes=s,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const i=e.index;i!==null&&this.setIndex(i.clone(t));const s=e.attributes;for(const c in s){const u=s[c];this.setAttribute(c,u.clone(t))}const r=e.morphAttributes;for(const c in r){const u=[],h=r[c];for(let d=0,p=h.length;d0){const s=t[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;rt.far?null:{distance:c,point:Qr.clone(),object:n}}function eo(n,e,t,i,s,r,o,a,l,c,u,h){Gn.fromBufferAttribute(s,c),Vn.fromBufferAttribute(s,u),Hn.fromBufferAttribute(s,h);const d=n.morphTargetInfluences;if(r&&d){qr.set(0,0,0),Xr.set(0,0,0),Yr.set(0,0,0);for(let g=0,m=r.length;g0?1:-1,u.push(N.x,N.y,N.z),h.push(K/L),h.push(1-G/y),j+=1}}for(let G=0;G0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;const i={};for(const s in this.extensions)this.extensions[s]===!0&&(i[s]=!0);return Object.keys(i).length>0&&(t.extensions=i),t}}class lp extends st{constructor(){super();this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Se,this.projectionMatrix=new Se,this.projectionMatrixInverse=new Se}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}class St extends lp{constructor(e=50,t=1,i=.1,s=2e3){super();this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=i,this.far=s,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Os*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Fs*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Os*2*Math.atan(Math.tan(Fs*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}setViewOffset(e,t,i,s,r,o){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=i,this.view.offsetY=s,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Fs*.5*this.fov)/this.zoom,i=2*t,s=this.aspect*i,r=-.5*s;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;r+=o.offsetX*s/l,t-=o.offsetY*i/c,s*=o.width/l,i*=o.height/c}const a=this.filmOffset;a!==0&&(r+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(r,r+s,t,t-i,e,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const Qi=90,es=1;class Ab extends st{constructor(e,t,i){super();if(this.type="CubeCamera",i.isWebGLCubeRenderTarget!==!0){console.error("THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.");return}this.renderTarget=i;const s=new St(Qi,es,e,t);s.layers=this.layers,s.up.set(0,-1,0),s.lookAt(new E(1,0,0)),this.add(s);const r=new St(Qi,es,e,t);r.layers=this.layers,r.up.set(0,-1,0),r.lookAt(new E(-1,0,0)),this.add(r);const o=new St(Qi,es,e,t);o.layers=this.layers,o.up.set(0,0,1),o.lookAt(new E(0,1,0)),this.add(o);const a=new St(Qi,es,e,t);a.layers=this.layers,a.up.set(0,0,-1),a.lookAt(new E(0,-1,0)),this.add(a);const l=new St(Qi,es,e,t);l.layers=this.layers,l.up.set(0,-1,0),l.lookAt(new E(0,0,1)),this.add(l);const c=new St(Qi,es,e,t);c.layers=this.layers,c.up.set(0,-1,0),c.lookAt(new E(0,0,-1)),this.add(c)}update(e,t){this.parent===null&&this.updateMatrixWorld();const i=this.renderTarget,[s,r,o,a,l,c]=this.children,u=e.getRenderTarget(),h=e.toneMapping,d=e.xr.enabled;e.toneMapping=gn,e.xr.enabled=!1;const p=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,e.setRenderTarget(i,0),e.render(t,s),e.setRenderTarget(i,1),e.render(t,r),e.setRenderTarget(i,2),e.render(t,o),e.setRenderTarget(i,3),e.render(t,a),e.setRenderTarget(i,4),e.render(t,l),i.texture.generateMipmaps=p,e.setRenderTarget(i,5),e.render(t,c),e.setRenderTarget(u),e.toneMapping=h,e.xr.enabled=d,i.texture.needsPMREMUpdate=!0}}class Ja extends yt{constructor(e,t,i,s,r,o,a,l,c,u){e=e!==void 0?e:[],t=t!==void 0?t:Fi;super(e,t,i,s,r,o,a,l,c,u);this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Tb extends kn{constructor(e,t={}){super(e,e,t);this.isWebGLCubeRenderTarget=!0;const i={width:e,height:e,depth:1},s=[i,i,i,i,i,i];this.texture=new Ja(s,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:Ze}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const 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 #include } `,fragmentShader:` uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { vec3 direction = normalize( vWorldDirection ); vec2 sampleUV = equirectUv( direction ); gl_FragColor = texture2D( tEquirect, sampleUV ); } `},s=new Vs(5,5,5),r=new cn({name:"CubemapFromEquirect",uniforms:Ki(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Xt,blending:Nn});r.uniforms.tEquirect.value=t;const o=new ft(s,r),a=t.minFilter;return t.minFilter===ni&&(t.minFilter=Ze),new Ab(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,i,s){const r=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,i,s);e.setRenderTarget(r)}}const Za=new E,Eb=new E,Lb=new Ut;class pi{constructor(e=new E(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,i,s){return this.normal.set(e,t,i),this.constant=s,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,i){const s=Za.subVectors(i,t).cross(Eb.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(s,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}intersectLine(e,t){const i=e.delta(Za),s=this.normal.dot(i);if(s===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const r=-(e.start.dot(this.normal)+this.constant)/s;return r<0||r>1?null:t.copy(i).multiplyScalar(r).add(e.start)}intersectsLine(e){const t=this.distanceToPoint(e.start),i=this.distanceToPoint(e.end);return t<0&&i>0||i<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const i=t||Lb.getNormalMatrix(e),s=this.coplanarPoint(Za).applyMatrix4(e),r=this.normal.applyMatrix3(i).normalize();return this.constant=-s.dot(r),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const ts=new zt,to=new E;class no{constructor(e=new pi,t=new pi,i=new pi,s=new pi,r=new pi,o=new pi){this.planes=[e,t,i,s,r,o]}set(e,t,i,s,r,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(i),a[3].copy(s),a[4].copy(r),a[5].copy(o),this}copy(e){const t=this.planes;for(let i=0;i<6;i++)t[i].copy(e.planes[i]);return this}setFromProjectionMatrix(e){const t=this.planes,i=e.elements,s=i[0],r=i[1],o=i[2],a=i[3],l=i[4],c=i[5],u=i[6],h=i[7],d=i[8],p=i[9],g=i[10],m=i[11],f=i[12],_=i[13],v=i[14],b=i[15];return t[0].setComponents(a-s,h-l,m-d,b-f).normalize(),t[1].setComponents(a+s,h+l,m+d,b+f).normalize(),t[2].setComponents(a+r,h+c,m+p,b+_).normalize(),t[3].setComponents(a-r,h-c,m-p,b-_).normalize(),t[4].setComponents(a-o,h-u,m-g,b-v).normalize(),t[5].setComponents(a+o,h+u,m+g,b+v).normalize(),this}intersectsObject(e){const t=e.geometry;return t.boundingSphere===null&&t.computeBoundingSphere(),ts.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(ts)}intersectsSprite(e){return ts.center.set(0,0,0),ts.radius=.7071067811865476,ts.applyMatrix4(e.matrixWorld),this.intersectsSphere(ts)}intersectsSphere(e){const t=this.planes,i=e.center,s=-e.radius;for(let r=0;r<6;r++)if(t[r].distanceToPoint(i)0?e.max.x:e.min.x,to.y=s.normal.y>0?e.max.y:e.min.y,to.z=s.normal.z>0?e.max.z:e.min.z,s.distanceToPoint(to)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let i=0;i<6;i++)if(t[i].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function cp(){let n=null,e=!1,t=null,i=null;function s(r,o){t(r,o),i=n.requestAnimationFrame(s)}return{start:function(){e!==!0&&t!==null&&(i=n.requestAnimationFrame(s),e=!0)},stop:function(){n.cancelAnimationFrame(i),e=!1},setAnimationLoop:function(r){t=r},setContext:function(r){n=r}}}function Rb(n,e){const t=e.isWebGL2,i=new WeakMap;function s(c,u){const h=c.array,d=c.usage,p=n.createBuffer();n.bindBuffer(u,p),n.bufferData(u,h,d),c.onUploadCallback();let g;if(h instanceof Float32Array)g=5126;else if(h instanceof Uint16Array)if(c.isFloat16BufferAttribute)if(t)g=5131;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else g=5123;else if(h instanceof Int16Array)g=5122;else if(h instanceof Uint32Array)g=5125;else if(h instanceof Int32Array)g=5124;else if(h instanceof Int8Array)g=5120;else if(h instanceof Uint8Array)g=5121;else if(h instanceof Uint8ClampedArray)g=5121;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+h);return{buffer:p,type:g,bytesPerElement:h.BYTES_PER_ELEMENT,version:c.version}}function r(c,u,h){const d=u.array,p=u.updateRange;n.bindBuffer(h,c),p.count===-1?n.bufferSubData(h,0,d):(t?n.bufferSubData(h,p.offset*d.BYTES_PER_ELEMENT,d,p.offset,p.count):n.bufferSubData(h,p.offset*d.BYTES_PER_ELEMENT,d.subarray(p.offset,p.offset+p.count)),p.count=-1)}function o(c){return c.isInterleavedBufferAttribute&&(c=c.data),i.get(c)}function a(c){c.isInterleavedBufferAttribute&&(c=c.data);const u=i.get(c);u&&(n.deleteBuffer(u.buffer),i.delete(c))}function l(c,u){if(c.isGLBufferAttribute){const d=i.get(c);(!d||d.version 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 ); } 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_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) { vec3 halfDir = normalize( lightDir + viewDir ); float dotNH = saturate( dot( normal, halfDir ) ); float dotVH = saturate( dot( viewDir, halfDir ) ); vec3 F = F_Schlick( specularColor, 1.0, dotVH ); float G = G_BlinnPhong_Implicit( ); float D = D_BlinnPhong( shininess, dotNH ); return F * ( G * D ); } #if defined( USE_SHEEN ) float D_Charlie( float roughness, float dotNH ) { float alpha = pow2( roughness ); float invAlpha = 1.0 / alpha; float cos2h = dotNH * dotNH; float sin2h = max( 1.0 - cos2h, 0.0078125 ); return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); } float V_Neubelt( float dotNV, float dotNL ) { return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); } vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { vec3 halfDir = normalize( lightDir + viewDir ); float dotNL = saturate( dot( normal, lightDir ) ); float dotNV = saturate( dot( normal, viewDir ) ); float dotNH = saturate( dot( normal, halfDir ) ); float D = D_Charlie( sheenRoughness, dotNH ); float V = V_Neubelt( dotNV, dotNL ); return sheenColor * ( D * V ); } #endif`,Ub=`#ifdef USE_IRIDESCENCE const mat3 XYZ_TO_REC709 = mat3( 3.2404542, -0.9692660, 0.0556434, -1.5371385, 1.8760108, -0.2040259, -0.4985314, 0.0415560, 1.0572252 ); vec3 Fresnel0ToIor( vec3 fresnel0 ) { vec3 sqrtF0 = sqrt( fresnel0 ); return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 ); } vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) { return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) ); } float IorToFresnel0( float transmittedIor, float incidentIor ) { return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor )); } vec3 evalSensitivity( float OPD, vec3 shift ) { float phase = 2.0 * PI * OPD * 1.0e-9; vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 ); vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 ); vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 ); vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var ); xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) ); xyz /= 1.0685e-7; vec3 rgb = XYZ_TO_REC709 * xyz; return rgb; } vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) { vec3 I; float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) ); float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) ); float cosTheta2Sq = 1.0 - sinTheta2Sq; if ( cosTheta2Sq < 0.0 ) { return vec3( 1.0 ); } float cosTheta2 = sqrt( cosTheta2Sq ); float R0 = IorToFresnel0( iridescenceIOR, outsideIOR ); float R12 = F_Schlick( R0, 1.0, cosTheta1 ); float R21 = R12; float T121 = 1.0 - R12; float phi12 = 0.0; if ( iridescenceIOR < outsideIOR ) phi12 = PI; float phi21 = PI - phi12; vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR ); vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 ); vec3 phi23 = vec3( 0.0 ); if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI; if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI; if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI; float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2; vec3 phi = vec3( phi21 ) + phi23; vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 ); vec3 r123 = sqrt( R123 ); vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 ); vec3 C0 = R12 + Rs; I = C0; vec3 Cm = Rs - T121; for ( int m = 1; m <= 2; ++ m ) { Cm *= r123; vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi ); I += Cm * Sm; } return max( I, vec3( 0.0 ) ); } #endif`,zb=`#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, float faceDirection ) { vec3 vSigmaX = dFdx( surf_pos.xyz ); vec3 vSigmaY = dFdy( surf_pos.xyz ); vec3 vN = surf_norm; vec3 R1 = cross( vSigmaY, vN ); vec3 R2 = cross( vN, vSigmaX ); float fDet = dot( vSigmaX, R1 ) * faceDirection; vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 ); return normalize( abs( fDet ) * surf_norm - vGrad ); } #endif`,Gb=`#if NUM_CLIPPING_PLANES > 0 vec4 plane; #pragma unroll_loop_start for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { plane = clippingPlanes[ i ]; if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; } #pragma unroll_loop_end #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES bool clipped = true; #pragma unroll_loop_start for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { plane = clippingPlanes[ i ]; clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; } #pragma unroll_loop_end if ( clipped ) discard; #endif #endif`,Vb=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; #endif`,Hb=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; #endif`,Wb=`#if NUM_CLIPPING_PLANES > 0 vClipPosition = - mvPosition.xyz; #endif`,jb=`#if defined( USE_COLOR_ALPHA ) diffuseColor *= vColor; #elif defined( USE_COLOR ) diffuseColor.rgb *= vColor; #endif`,qb=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) varying vec3 vColor; #endif`,Xb=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) varying vec3 vColor; #endif`,Yb=`#if defined( USE_COLOR_ALPHA ) vColor = vec4( 1.0 ); #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) vColor = vec3( 1.0 ); #endif #ifdef USE_COLOR vColor *= color; #endif #ifdef USE_INSTANCING_COLOR vColor.xyz *= instanceColor.xyz; #endif`,Jb=`#define PI 3.141592653589793 #define PI2 6.283185307179586 #define PI_HALF 1.5707963267948966 #define RECIPROCAL_PI 0.3183098861837907 #define RECIPROCAL_PI2 0.15915494309189535 #define EPSILON 1e-6 #ifndef saturate #define saturate( a ) clamp( a, 0.0, 1.0 ) #endif #define whiteComplement( a ) ( 1.0 - saturate( a ) ) float pow2( const in float x ) { return x*x; } vec3 pow2( const in vec3 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 max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } 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 ); } #ifdef HIGH_PRECISION float precisionSafeLength( vec3 v ) { return length( v ); } #else float precisionSafeLength( vec3 v ) { float maxComponent = max3( abs( v ) ); return length( v / maxComponent ) * maxComponent; } #endif 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; #ifdef USE_CLEARCOAT vec3 clearcoatNormal; #endif }; 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 ); } 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 luminance( const in vec3 rgb ) { const vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 ); return dot( weights, rgb ); } bool isPerspectiveMatrix( mat4 m ) { return m[ 2 ][ 3 ] == - 1.0; } vec2 equirectUv( in vec3 dir ) { float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; return vec2( u, v ); }`,Zb=`#ifdef ENVMAP_TYPE_CUBE_UV #define cubeUV_minMipLevel 4.0 #define cubeUV_minTileSize 16.0 float getFace( vec3 direction ) { vec3 absDirection = abs( direction ); float face = - 1.0; if ( absDirection.x > absDirection.z ) { if ( absDirection.x > absDirection.y ) face = direction.x > 0.0 ? 0.0 : 3.0; else face = direction.y > 0.0 ? 1.0 : 4.0; } else { if ( absDirection.z > absDirection.y ) face = direction.z > 0.0 ? 2.0 : 5.0; else face = direction.y > 0.0 ? 1.0 : 4.0; } return face; } vec2 getUV( vec3 direction, float face ) { vec2 uv; if ( face == 0.0 ) { uv = vec2( direction.z, direction.y ) / abs( direction.x ); } else if ( face == 1.0 ) { uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); } else if ( face == 2.0 ) { uv = vec2( - direction.x, direction.y ) / abs( direction.z ); } else if ( face == 3.0 ) { uv = vec2( - direction.z, direction.y ) / abs( direction.x ); } else if ( face == 4.0 ) { uv = vec2( - direction.x, direction.z ) / abs( direction.y ); } else { uv = vec2( direction.x, direction.y ) / abs( direction.z ); } return 0.5 * ( uv + 1.0 ); } vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { float face = getFace( direction ); float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); mipInt = max( mipInt, cubeUV_minMipLevel ); float faceSize = exp2( mipInt ); vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; if ( face > 2.0 ) { uv.y += faceSize; face -= 3.0; } uv.x += face * faceSize; uv.x += filterInt * 3.0 * cubeUV_minTileSize; uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); uv.x *= CUBEUV_TEXEL_WIDTH; uv.y *= CUBEUV_TEXEL_HEIGHT; #ifdef texture2DGradEXT return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; #else return texture2D( envMap, uv ).rgb; #endif } #define r0 1.0 #define v0 0.339 #define m0 - 2.0 #define r1 0.8 #define v1 0.276 #define m1 - 1.0 #define r4 0.4 #define v4 0.046 #define m4 2.0 #define r5 0.305 #define v5 0.016 #define m5 3.0 #define r6 0.21 #define v6 0.0038 #define m6 4.0 float roughnessToMip( float roughness ) { float mip = 0.0; if ( roughness >= r1 ) { mip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0; } else if ( roughness >= r4 ) { mip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1; } else if ( roughness >= r5 ) { mip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4; } else if ( roughness >= r6 ) { mip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5; } else { mip = - 2.0 * log2( 1.16 * roughness ); } return mip; } vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { float mip = clamp( roughnessToMip( roughness ), m0, CUBEUV_MAX_MIP ); float mipF = fract( mip ); float mipInt = floor( mip ); vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); if ( mipF == 0.0 ) { return vec4( color0, 1.0 ); } else { vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); return vec4( mix( color0, color1, mipF ), 1.0 ); } } #endif`,Kb=`vec3 transformedNormal = objectNormal; #ifdef USE_INSTANCING mat3 m = mat3( instanceMatrix ); transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) ); transformedNormal = m * transformedNormal; #endif transformedNormal = normalMatrix * transformedNormal; #ifdef FLIP_SIDED transformedNormal = - transformedNormal; #endif #ifdef USE_TANGENT vec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz; #ifdef FLIP_SIDED transformedTangent = - transformedTangent; #endif #endif`,Qb=`#ifdef USE_DISPLACEMENTMAP uniform sampler2D displacementMap; uniform float displacementScale; uniform float displacementBias; #endif`,eM=`#ifdef USE_DISPLACEMENTMAP transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias ); #endif`,tM=`#ifdef USE_EMISSIVEMAP vec4 emissiveColor = texture2D( emissiveMap, vUv ); totalEmissiveRadiance *= emissiveColor.rgb; #endif`,nM=`#ifdef USE_EMISSIVEMAP uniform sampler2D emissiveMap; #endif`,iM="gl_FragColor = linearToOutputTexel( gl_FragColor );",sM=`vec4 LinearToLinear( in vec4 value ) { return value; } 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 ); }`,rM=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vec3 cameraToFrag; if ( isOrthographic ) { cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); } else { cameraToFrag = normalize( vWorldPosition - cameraPosition ); } vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); #ifdef ENVMAP_MODE_REFLECTION vec3 reflectVec = reflect( cameraToFrag, worldNormal ); #else vec3 reflectVec = refract( cameraToFrag, 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_CUBE_UV ) vec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 ); #else vec4 envColor = vec4( 0.0 ); #endif #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`,oM=`#ifdef USE_ENVMAP uniform float envMapIntensity; uniform float flipEnvMap; #ifdef ENVMAP_TYPE_CUBE uniform samplerCube envMap; #else uniform sampler2D envMap; #endif #endif`,aM=`#ifdef USE_ENVMAP uniform float reflectivity; #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) #define ENV_WORLDPOS #endif #ifdef ENV_WORLDPOS varying vec3 vWorldPosition; uniform float refractionRatio; #else varying vec3 vReflect; #endif #endif`,lM=`#ifdef USE_ENVMAP #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) ||defined( PHONG ) #define ENV_WORLDPOS #endif #ifdef ENV_WORLDPOS varying vec3 vWorldPosition; #else varying vec3 vReflect; uniform float refractionRatio; #endif #endif`,cM=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vWorldPosition = worldPosition.xyz; #else vec3 cameraToVertex; if ( isOrthographic ) { cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); } else { 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`,hM=`#ifdef USE_FOG vFogDepth = - mvPosition.z; #endif`,uM=`#ifdef USE_FOG varying float vFogDepth; #endif`,dM=`#ifdef USE_FOG #ifdef FOG_EXP2 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); #else float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); #endif gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); #endif`,pM=`#ifdef USE_FOG uniform vec3 fogColor; varying float vFogDepth; #ifdef FOG_EXP2 uniform float fogDensity; #else uniform float fogNear; uniform float fogFar; #endif #endif`,fM=`#ifdef USE_GRADIENTMAP uniform sampler2D gradientMap; #endif 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 vec3( texture2D( gradientMap, coord ).r ); #else return ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 ); #endif }`,mM=`#ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vUv2 ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; reflectedLight.indirectDiffuse += lightMapIrradiance; #endif`,gM=`#ifdef USE_LIGHTMAP uniform sampler2D lightMap; uniform float lightMapIntensity; #endif`,_M=`vec3 diffuse = vec3( 1.0 ); GeometricContext geometry; geometry.position = mvPosition.xyz; geometry.normal = normalize( transformedNormal ); geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : 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; vIndirectFront += getAmbientLightIrradiance( ambientLightColor ); vIndirectFront += getLightProbeIrradiance( lightProbe, geometry.normal ); #ifdef DOUBLE_SIDED vIndirectBack += getAmbientLightIrradiance( ambientLightColor ); vIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal ); #endif #if NUM_POINT_LIGHTS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { getPointLightInfo( pointLights[ i ], geometry, directLight ); dotNL = dot( geometry.normal, directLight.direction ); directLightColor_Diffuse = directLight.color; vLightFront += saturate( dotNL ) * directLightColor_Diffuse; #ifdef DOUBLE_SIDED vLightBack += saturate( - dotNL ) * directLightColor_Diffuse; #endif } #pragma unroll_loop_end #endif #if NUM_SPOT_LIGHTS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { getSpotLightInfo( spotLights[ i ], geometry, directLight ); dotNL = dot( geometry.normal, directLight.direction ); directLightColor_Diffuse = directLight.color; vLightFront += saturate( dotNL ) * directLightColor_Diffuse; #ifdef DOUBLE_SIDED vLightBack += saturate( - dotNL ) * directLightColor_Diffuse; #endif } #pragma unroll_loop_end #endif #if NUM_DIR_LIGHTS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { getDirectionalLightInfo( directionalLights[ i ], geometry, directLight ); dotNL = dot( geometry.normal, directLight.direction ); directLightColor_Diffuse = directLight.color; vLightFront += saturate( dotNL ) * directLightColor_Diffuse; #ifdef DOUBLE_SIDED vLightBack += saturate( - dotNL ) * directLightColor_Diffuse; #endif } #pragma unroll_loop_end #endif #if NUM_HEMI_LIGHTS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { vIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal ); #ifdef DOUBLE_SIDED vIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal ); #endif } #pragma unroll_loop_end #endif`,yM=`uniform bool receiveShadow; 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 vec3 normal ) { vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); return irradiance; } vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { vec3 irradiance = ambientLightColor; return irradiance; } float getDistanceAttenuation( 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 } float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { return smoothstep( coneCosine, penumbraCosine, angleCosine ); } #if NUM_DIR_LIGHTS > 0 struct DirectionalLight { vec3 direction; vec3 color; }; uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; void getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) { light.color = directionalLight.color; light.direction = directionalLight.direction; light.visible = true; } #endif #if NUM_POINT_LIGHTS > 0 struct PointLight { vec3 position; vec3 color; float distance; float decay; }; uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; void getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) { vec3 lVector = pointLight.position - geometry.position; light.direction = normalize( lVector ); float lightDistance = length( lVector ); light.color = pointLight.color; light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); light.visible = ( light.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; }; uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; void getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) { vec3 lVector = spotLight.position - geometry.position; light.direction = normalize( lVector ); float angleCos = dot( light.direction, spotLight.direction ); float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); if ( spotAttenuation > 0.0 ) { float lightDistance = length( lVector ); light.color = spotLight.color * spotAttenuation; light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); light.visible = ( light.color != vec3( 0.0 ) ); } else { light.color = vec3( 0.0 ); light.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 vec3 normal ) { float dotNL = dot( normal, hemiLight.direction ); float hemiDiffuseWeight = 0.5 * dotNL + 0.5; vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); return irradiance; } #endif`,vM=`#if defined( USE_ENVMAP ) vec3 getIBLIrradiance( const in vec3 normal ) { #if defined( ENVMAP_TYPE_CUBE_UV ) vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); vec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 ); return PI * envMapColor.rgb * envMapIntensity; #else return vec3( 0.0 ); #endif } vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { #if defined( ENVMAP_TYPE_CUBE_UV ) vec3 reflectVec = reflect( - viewDir, normal ); reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); vec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness ); return envMapColor.rgb * envMapIntensity; #else return vec3( 0.0 ); #endif } #endif`,xM=`ToonMaterial material; material.diffuseColor = diffuseColor.rgb;`,bM=`varying vec3 vViewPosition; struct ToonMaterial { vec3 diffuseColor; }; void RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { vec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color; reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Toon #define RE_IndirectDiffuse RE_IndirectDiffuse_Toon #define Material_LightProbeLOD( material ) (0)`,MM=`BlinnPhongMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularColor = specular; material.specularShininess = shininess; material.specularStrength = specularStrength;`,SM=`varying vec3 vViewPosition; 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 ) { float dotNL = saturate( dot( geometry.normal, directLight.direction ) ); vec3 irradiance = dotNL * directLight.color; reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, 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_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_BlinnPhong #define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong #define Material_LightProbeLOD( material ) (0)`,CM=`PhysicalMaterial material; material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) ); float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; material.roughness = min( material.roughness, 1.0 ); #ifdef IOR #ifdef SPECULAR float specularIntensityFactor = specularIntensity; vec3 specularColorFactor = specularColor; #ifdef USE_SPECULARINTENSITYMAP specularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a; #endif #ifdef USE_SPECULARCOLORMAP specularColorFactor *= texture2D( specularColorMap, vUv ).rgb; #endif material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); #else float specularIntensityFactor = 1.0; vec3 specularColorFactor = vec3( 1.0 ); material.specularF90 = 1.0; #endif material.specularColor = mix( min( pow2( ( ior - 1.0 ) / ( ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); #else material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); material.specularF90 = 1.0; #endif #ifdef USE_CLEARCOAT material.clearcoat = clearcoat; material.clearcoatRoughness = clearcoatRoughness; material.clearcoatF0 = vec3( 0.04 ); material.clearcoatF90 = 1.0; #ifdef USE_CLEARCOATMAP material.clearcoat *= texture2D( clearcoatMap, vUv ).x; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y; #endif material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); material.clearcoatRoughness += geometryRoughness; material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); #endif #ifdef USE_IRIDESCENCE material.iridescence = iridescence; material.iridescenceIOR = iridescenceIOR; #ifdef USE_IRIDESCENCEMAP material.iridescence *= texture2D( iridescenceMap, vUv ).r; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vUv ).g + iridescenceThicknessMinimum; #else material.iridescenceThickness = iridescenceThicknessMaximum; #endif #endif #ifdef USE_SHEEN material.sheenColor = sheenColor; #ifdef USE_SHEENCOLORMAP material.sheenColor *= texture2D( sheenColorMap, vUv ).rgb; #endif material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); #ifdef USE_SHEENROUGHNESSMAP material.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a; #endif #endif`,wM=`struct PhysicalMaterial { vec3 diffuseColor; float roughness; vec3 specularColor; float specularF90; #ifdef USE_CLEARCOAT float clearcoat; float clearcoatRoughness; vec3 clearcoatF0; float clearcoatF90; #endif #ifdef USE_IRIDESCENCE float iridescence; float iridescenceIOR; float iridescenceThickness; vec3 iridescenceFresnel; vec3 iridescenceF0; #endif #ifdef USE_SHEEN vec3 sheenColor; float sheenRoughness; #endif }; vec3 clearcoatSpecular = vec3( 0.0 ); vec3 sheenSpecular = vec3( 0.0 ); float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness) { float dotNV = saturate( dot( normal, viewDir ) ); float r2 = roughness * roughness; float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); return saturate( DG * RECIPROCAL_PI ); } vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { float dotNV = saturate( dot( normal, viewDir ) ); 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; vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; return fab; } vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { vec2 fab = DFGApprox( normal, viewDir, roughness ); return specularColor * fab.x + specularF90 * fab.y; } #ifdef USE_IRIDESCENCE void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { #else void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { #endif vec2 fab = DFGApprox( normal, viewDir, roughness ); #ifdef USE_IRIDESCENCE vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); #else vec3 Fr = specularColor; #endif vec3 FssEss = Fr * fab.x + specularF90 * fab.y; float Ess = fab.x + fab.y; float Ems = 1.0 - Ess; vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); singleScatter += FssEss; multiScatter += Fms * Ems; } #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.roughness; 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; #ifdef USE_CLEARCOAT float dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) ); vec3 ccIrradiance = dotNLcc * directLight.color; clearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); #endif #ifdef USE_SHEEN sheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness ); #endif #ifdef USE_IRIDESCENCE reflectedLight.directSpecular += irradiance * BRDF_GGX_Iridescence( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness ); #else reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness ); #endif reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } 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) { #ifdef USE_CLEARCOAT clearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); #endif #ifdef USE_SHEEN sheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness ); #endif vec3 singleScattering = vec3( 0.0 ); vec3 multiScattering = vec3( 0.0 ); vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; #ifdef USE_IRIDESCENCE computeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); #else computeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); #endif vec3 totalScattering = singleScattering + multiScattering; vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); reflectedLight.indirectSpecular += radiance * singleScattering; reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; } #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 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 ); }`,AM=` GeometricContext geometry; geometry.position = - vViewPosition; geometry.normal = normal; geometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); #ifdef USE_CLEARCOAT geometry.clearcoatNormal = clearcoatNormal; #endif #ifdef USE_IRIDESCENCE float dotNVi = saturate( dot( normal, geometry.viewDir ) ); if ( material.iridescenceThickness == 0.0 ) { material.iridescence = 0.0; } else { material.iridescence = saturate( material.iridescence ); } if ( material.iridescence > 0.0 ) { material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); } #endif IncidentLight directLight; #if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) PointLight pointLight; #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 PointLightShadow pointLightShadow; #endif #pragma unroll_loop_start for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { pointLight = pointLights[ i ]; getPointLightInfo( pointLight, geometry, directLight ); #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) pointLightShadow = pointLightShadows[ i ]; directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; #endif RE_Direct( directLight, geometry, material, reflectedLight ); } #pragma unroll_loop_end #endif #if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) SpotLight spotLight; #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 SpotLightShadow spotLightShadow; #endif #pragma unroll_loop_start for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { spotLight = spotLights[ i ]; getSpotLightInfo( spotLight, geometry, directLight ); #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) spotLightShadow = spotLightShadows[ i ]; directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0; #endif RE_Direct( directLight, geometry, material, reflectedLight ); } #pragma unroll_loop_end #endif #if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) DirectionalLight directionalLight; #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 DirectionalLightShadow directionalLightShadow; #endif #pragma unroll_loop_start for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { directionalLight = directionalLights[ i ]; getDirectionalLightInfo( directionalLight, geometry, directLight ); #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) directionalLightShadow = directionalLightShadows[ i ]; directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; #endif RE_Direct( directLight, geometry, material, reflectedLight ); } #pragma unroll_loop_end #endif #if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) RectAreaLight rectAreaLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { rectAreaLight = rectAreaLights[ i ]; RE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight ); } #pragma unroll_loop_end #endif #if defined( RE_IndirectDiffuse ) vec3 iblIrradiance = vec3( 0.0 ); vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); irradiance += getLightProbeIrradiance( lightProbe, geometry.normal ); #if ( NUM_HEMI_LIGHTS > 0 ) #pragma unroll_loop_start for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal ); } #pragma unroll_loop_end #endif #endif #if defined( RE_IndirectSpecular ) vec3 radiance = vec3( 0.0 ); vec3 clearcoatRadiance = vec3( 0.0 ); #endif`,TM=`#if defined( RE_IndirectDiffuse ) #ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vUv2 ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; irradiance += lightMapIrradiance; #endif #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) iblIrradiance += getIBLIrradiance( geometry.normal ); #endif #endif #if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) radiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness ); #ifdef USE_CLEARCOAT clearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness ); #endif #endif`,EM=`#if defined( RE_IndirectDiffuse ) RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight ); #endif #if defined( RE_IndirectSpecular ) RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight ); #endif`,LM=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; #endif`,RM=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) uniform float logDepthBufFC; varying float vFragDepth; varying float vIsPerspective; #endif`,PM=`#ifdef USE_LOGDEPTHBUF #ifdef USE_LOGDEPTHBUF_EXT varying float vFragDepth; varying float vIsPerspective; #else uniform float logDepthBufFC; #endif #endif`,IM=`#ifdef USE_LOGDEPTHBUF #ifdef USE_LOGDEPTHBUF_EXT vFragDepth = 1.0 + gl_Position.w; vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); #else if ( isPerspectiveMatrix( projectionMatrix ) ) { gl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0; gl_Position.z *= gl_Position.w; } #endif #endif`,DM=`#ifdef USE_MAP vec4 sampledDiffuseColor = texture2D( map, vUv ); #ifdef DECODE_VIDEO_TEXTURE sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w ); #endif diffuseColor *= sampledDiffuseColor; #endif`,FM=`#ifdef USE_MAP uniform sampler2D map; #endif`,OM=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; #endif #ifdef USE_MAP diffuseColor *= texture2D( map, uv ); #endif #ifdef USE_ALPHAMAP diffuseColor.a *= texture2D( alphaMap, uv ).g; #endif`,NM=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) uniform mat3 uvTransform; #endif #ifdef USE_MAP uniform sampler2D map; #endif #ifdef USE_ALPHAMAP uniform sampler2D alphaMap; #endif`,kM=`float metalnessFactor = metalness; #ifdef USE_METALNESSMAP vec4 texelMetalness = texture2D( metalnessMap, vUv ); metalnessFactor *= texelMetalness.b; #endif`,BM=`#ifdef USE_METALNESSMAP uniform sampler2D metalnessMap; #endif`,$M=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE ) vColor *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { #if defined( USE_COLOR_ALPHA ) if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; #elif defined( USE_COLOR ) if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; #endif } #endif`,UM=`#ifdef USE_MORPHNORMALS objectNormal *= morphTargetBaseInfluence; #ifdef MORPHTARGETS_TEXTURE for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; } #else objectNormal += morphNormal0 * morphTargetInfluences[ 0 ]; objectNormal += morphNormal1 * morphTargetInfluences[ 1 ]; objectNormal += morphNormal2 * morphTargetInfluences[ 2 ]; objectNormal += morphNormal3 * morphTargetInfluences[ 3 ]; #endif #endif`,zM=`#ifdef USE_MORPHTARGETS uniform float morphTargetBaseInfluence; #ifdef MORPHTARGETS_TEXTURE uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; uniform sampler2DArray morphTargetsTexture; uniform ivec2 morphTargetsTextureSize; vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; int y = texelIndex / morphTargetsTextureSize.x; int x = texelIndex - y * morphTargetsTextureSize.x; ivec3 morphUV = ivec3( x, y, morphTargetIndex ); return texelFetch( morphTargetsTexture, morphUV, 0 ); } #else #ifndef USE_MORPHNORMALS uniform float morphTargetInfluences[ 8 ]; #else uniform float morphTargetInfluences[ 4 ]; #endif #endif #endif`,GM=`#ifdef USE_MORPHTARGETS transformed *= morphTargetBaseInfluence; #ifdef MORPHTARGETS_TEXTURE for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; } #else transformed += morphTarget0 * morphTargetInfluences[ 0 ]; transformed += morphTarget1 * morphTargetInfluences[ 1 ]; transformed += morphTarget2 * morphTargetInfluences[ 2 ]; transformed += morphTarget3 * morphTargetInfluences[ 3 ]; #ifndef USE_MORPHNORMALS transformed += morphTarget4 * morphTargetInfluences[ 4 ]; transformed += morphTarget5 * morphTargetInfluences[ 5 ]; transformed += morphTarget6 * morphTargetInfluences[ 6 ]; transformed += morphTarget7 * morphTargetInfluences[ 7 ]; #endif #endif #endif`,VM=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; #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 * faceDirection; #endif #ifdef USE_TANGENT vec3 tangent = normalize( vTangent ); vec3 bitangent = normalize( vBitangent ); #ifdef DOUBLE_SIDED tangent = tangent * faceDirection; bitangent = bitangent * faceDirection; #endif #if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP ) mat3 vTBN = mat3( tangent, bitangent, normal ); #endif #endif #endif vec3 geometryNormal = normal;`,HM=`#ifdef OBJECTSPACE_NORMALMAP normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0; #ifdef FLIP_SIDED normal = - normal; #endif #ifdef DOUBLE_SIDED normal = normal * faceDirection; #endif normal = normalize( normalMatrix * normal ); #elif defined( TANGENTSPACE_NORMALMAP ) vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0; mapN.xy *= normalScale; #ifdef USE_TANGENT normal = normalize( vTBN * mapN ); #else normal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection ); #endif #elif defined( USE_BUMPMAP ) normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); #endif`,WM=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif #endif`,jM=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif #endif`,qM=`#ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #ifdef USE_TANGENT vTangent = normalize( transformedTangent ); vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); #endif #endif`,XM=`#ifdef USE_NORMALMAP uniform sampler2D normalMap; uniform vec2 normalScale; #endif #ifdef OBJECTSPACE_NORMALMAP uniform mat3 normalMatrix; #endif #if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) ) vec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) { vec3 q0 = dFdx( eye_pos.xyz ); vec3 q1 = dFdy( eye_pos.xyz ); vec2 st0 = dFdx( vUv.st ); vec2 st1 = dFdy( vUv.st ); vec3 N = surf_norm; vec3 q1perp = cross( q1, N ); vec3 q0perp = cross( N, q0 ); vec3 T = q1perp * st0.x + q0perp * st1.x; vec3 B = q1perp * st0.y + q0perp * st1.y; float det = max( dot( T, T ), dot( B, B ) ); float scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det ); return normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z ); } #endif`,YM=`#ifdef USE_CLEARCOAT vec3 clearcoatNormal = geometryNormal; #endif`,JM=`#ifdef USE_CLEARCOAT_NORMALMAP vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0; clearcoatMapN.xy *= clearcoatNormalScale; #ifdef USE_TANGENT clearcoatNormal = normalize( vTBN * clearcoatMapN ); #else clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection ); #endif #endif`,ZM=`#ifdef USE_CLEARCOATMAP uniform sampler2D clearcoatMap; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP uniform sampler2D clearcoatRoughnessMap; #endif #ifdef USE_CLEARCOAT_NORMALMAP uniform sampler2D clearcoatNormalMap; uniform vec2 clearcoatNormalScale; #endif`,KM=`#ifdef USE_IRIDESCENCEMAP uniform sampler2D iridescenceMap; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform sampler2D iridescenceThicknessMap; #endif`,QM=`#ifdef OPAQUE diffuseColor.a = 1.0; #endif #ifdef USE_TRANSMISSION diffuseColor.a *= transmissionAlpha + 0.1; #endif gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,eS=`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 ); } vec4 pack2HalfToRGBA( vec2 v ) { vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); } vec2 unpackRGBATo2Half( vec4 v ) { return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); } 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 ); }`,tS=`#ifdef PREMULTIPLIED_ALPHA gl_FragColor.rgb *= gl_FragColor.a; #endif`,nS=`vec4 mvPosition = vec4( transformed, 1.0 ); #ifdef USE_INSTANCING mvPosition = instanceMatrix * mvPosition; #endif mvPosition = modelViewMatrix * mvPosition; gl_Position = projectionMatrix * mvPosition;`,iS=`#ifdef DITHERING gl_FragColor.rgb = dithering( gl_FragColor.rgb ); #endif`,sS=`#ifdef 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`,rS=`float roughnessFactor = roughness; #ifdef USE_ROUGHNESSMAP vec4 texelRoughness = texture2D( roughnessMap, vUv ); roughnessFactor *= texelRoughness.g; #endif`,oS=`#ifdef USE_ROUGHNESSMAP uniform sampler2D roughnessMap; #endif`,aS=`#ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; struct DirectionalLightShadow { float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ]; struct SpotLightShadow { float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; #endif #if NUM_POINT_LIGHT_SHADOWS > 0 uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; struct PointLightShadow { float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; float shadowCameraNear; float shadowCameraFar; }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); } vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { return unpackRGBATo2Half( texture2D( shadow, uv ) ); } float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ float occlusion = 1.0; vec2 distribution = texture2DDistribution( shadow, uv ); float hard_shadow = step( compare , distribution.x ); if (hard_shadow != 1.0 ) { float distance = compare - distribution.x ; float variance = max( 0.00000, distribution.y * distribution.y ); float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); } return occlusion; } 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 dx = texelSize.x; float dy = texelSize.y; vec2 uv = shadowCoord.xy; vec2 f = fract( uv * shadowMapSize + 0.5 ); uv -= f * texelSize; shadow = ( texture2DCompare( shadowMap, uv, shadowCoord.z ) + texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), f.x ) + mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), f.x ) + mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), f.y ) + mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), f.y ) + mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), f.x ), mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), f.x ), f.y ) ) * ( 1.0 / 9.0 ); #elif defined( SHADOWMAP_TYPE_VSM ) shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); #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 ) || defined( SHADOWMAP_TYPE_VSM ) 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`,lS=`#ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; struct DirectionalLightShadow { float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 uniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ]; varying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ]; struct SpotLightShadow { float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; }; uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; #endif #if NUM_POINT_LIGHT_SHADOWS > 0 uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; struct PointLightShadow { float shadowBias; float shadowNormalBias; float shadowRadius; vec2 shadowMapSize; float shadowCameraNear; float shadowCameraFar; }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif #endif`,cS=`#ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); vec4 shadowWorldPosition; #endif #if NUM_DIR_LIGHT_SHADOWS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 ); vSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end #endif #if NUM_POINT_LIGHT_SHADOWS > 0 #pragma unroll_loop_start for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end #endif #endif`,hS=`float getShadowMask() { float shadow = 1.0; #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 DirectionalLightShadow directionalLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { directionalLight = directionalLightShadows[ i ]; shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; } #pragma unroll_loop_end #endif #if NUM_SPOT_LIGHT_SHADOWS > 0 SpotLightShadow spotLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { spotLight = spotLightShadows[ i ]; shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0; } #pragma unroll_loop_end #endif #if NUM_POINT_LIGHT_SHADOWS > 0 PointLightShadow pointLight; #pragma unroll_loop_start for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { pointLight = pointLightShadows[ i ]; shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; } #pragma unroll_loop_end #endif #endif return shadow; }`,uS=`#ifdef USE_SKINNING mat4 boneMatX = getBoneMatrix( skinIndex.x ); mat4 boneMatY = getBoneMatrix( skinIndex.y ); mat4 boneMatZ = getBoneMatrix( skinIndex.z ); mat4 boneMatW = getBoneMatrix( skinIndex.w ); #endif`,dS=`#ifdef USE_SKINNING uniform mat4 bindMatrix; uniform mat4 bindMatrixInverse; 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; } #endif`,pS=`#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`,fS=`#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`,mS=`float specularStrength; #ifdef USE_SPECULARMAP vec4 texelSpecular = texture2D( specularMap, vUv ); specularStrength = texelSpecular.r; #else specularStrength = 1.0; #endif`,gS=`#ifdef USE_SPECULARMAP uniform sampler2D specularMap; #endif`,_S=`#if defined( TONE_MAPPING ) gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); #endif`,yS=`#ifndef saturate #define saturate( a ) clamp( a, 0.0, 1.0 ) #endif uniform float toneMappingExposure; vec3 LinearToneMapping( vec3 color ) { return toneMappingExposure * color; } vec3 ReinhardToneMapping( vec3 color ) { color *= toneMappingExposure; return saturate( color / ( vec3( 1.0 ) + color ) ); } 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 RRTAndODTFit( vec3 v ) { vec3 a = v * ( v + 0.0245786 ) - 0.000090537; vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; return a / b; } vec3 ACESFilmicToneMapping( vec3 color ) { const mat3 ACESInputMat = mat3( vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), vec3( 0.04823, 0.01566, 0.83777 ) ); const mat3 ACESOutputMat = mat3( vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), vec3( -0.07367, -0.00605, 1.07602 ) ); color *= toneMappingExposure / 0.6; color = ACESInputMat * color; color = RRTAndODTFit( color ); color = ACESOutputMat * color; return saturate( color ); } vec3 CustomToneMapping( vec3 color ) { return color; }`,vS=`#ifdef USE_TRANSMISSION float transmissionAlpha = 1.0; float transmissionFactor = transmission; float thicknessFactor = thickness; #ifdef USE_TRANSMISSIONMAP transmissionFactor *= texture2D( transmissionMap, vUv ).r; #endif #ifdef USE_THICKNESSMAP thicknessFactor *= texture2D( thicknessMap, vUv ).g; #endif vec3 pos = vWorldPosition; vec3 v = normalize( cameraPosition - pos ); vec3 n = inverseTransformDirection( normal, viewMatrix ); vec4 transmission = getIBLVolumeRefraction( n, v, roughnessFactor, material.diffuseColor, material.specularColor, material.specularF90, pos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor, attenuationColor, attenuationDistance ); totalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor ); transmissionAlpha = mix( transmissionAlpha, transmission.a, transmissionFactor ); #endif`,xS=`#ifdef USE_TRANSMISSION uniform float transmission; uniform float thickness; uniform float attenuationDistance; uniform vec3 attenuationColor; #ifdef USE_TRANSMISSIONMAP uniform sampler2D transmissionMap; #endif #ifdef USE_THICKNESSMAP uniform sampler2D thicknessMap; #endif uniform vec2 transmissionSamplerSize; uniform sampler2D transmissionSamplerMap; uniform mat4 modelMatrix; uniform mat4 projectionMatrix; varying vec3 vWorldPosition; vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); vec3 modelScale; modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); return normalize( refractionVector ) * thickness * modelScale; } float applyIorToRoughness( const in float roughness, const in float ior ) { return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); } vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { float framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); #ifdef texture2DLodEXT return texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod ); #else return texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod ); #endif } vec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { if ( attenuationDistance == 0.0 ) { return radiance; } else { vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance * radiance; } } vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, const in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness, const in vec3 attenuationColor, const in float attenuationDistance ) { vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); vec3 refractedRayExit = position + transmissionRay; vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); vec2 refractionCoords = ndcPos.xy / ndcPos.w; refractionCoords += 1.0; refractionCoords /= 2.0; vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); vec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance ); vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); return vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a ); } #endif`,bS=`#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) ) varying vec2 vUv; #endif`,MS=`#ifdef USE_UV #ifdef UVS_VERTEX_ONLY vec2 vUv; #else varying vec2 vUv; #endif uniform mat3 uvTransform; #endif`,SS=`#ifdef USE_UV vUv = ( uvTransform * vec3( uv, 1 ) ).xy; #endif`,CS=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) varying vec2 vUv2; #endif`,wS=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) attribute vec2 uv2; varying vec2 vUv2; uniform mat3 uv2Transform; #endif`,AS=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy; #endif`,TS=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) vec4 worldPosition = vec4( transformed, 1.0 ); #ifdef USE_INSTANCING worldPosition = instanceMatrix * worldPosition; #endif worldPosition = modelMatrix * worldPosition; #endif`;const Be={alphamap_fragment:Pb,alphamap_pars_fragment:Ib,alphatest_fragment:Db,alphatest_pars_fragment:Fb,aomap_fragment:Ob,aomap_pars_fragment:Nb,begin_vertex:kb,beginnormal_vertex:Bb,bsdfs:$b,iridescence_fragment:Ub,bumpmap_pars_fragment:zb,clipping_planes_fragment:Gb,clipping_planes_pars_fragment:Vb,clipping_planes_pars_vertex:Hb,clipping_planes_vertex:Wb,color_fragment:jb,color_pars_fragment:qb,color_pars_vertex:Xb,color_vertex:Yb,common:Jb,cube_uv_reflection_fragment:Zb,defaultnormal_vertex:Kb,displacementmap_pars_vertex:Qb,displacementmap_vertex:eM,emissivemap_fragment:tM,emissivemap_pars_fragment:nM,encodings_fragment:iM,encodings_pars_fragment:sM,envmap_fragment:rM,envmap_common_pars_fragment:oM,envmap_pars_fragment:aM,envmap_pars_vertex:lM,envmap_physical_pars_fragment:vM,envmap_vertex:cM,fog_vertex:hM,fog_pars_vertex:uM,fog_fragment:dM,fog_pars_fragment:pM,gradientmap_pars_fragment:fM,lightmap_fragment:mM,lightmap_pars_fragment:gM,lights_lambert_vertex:_M,lights_pars_begin:yM,lights_toon_fragment:xM,lights_toon_pars_fragment:bM,lights_phong_fragment:MM,lights_phong_pars_fragment:SM,lights_physical_fragment:CM,lights_physical_pars_fragment:wM,lights_fragment_begin:AM,lights_fragment_maps:TM,lights_fragment_end:EM,logdepthbuf_fragment:LM,logdepthbuf_pars_fragment:RM,logdepthbuf_pars_vertex:PM,logdepthbuf_vertex:IM,map_fragment:DM,map_pars_fragment:FM,map_particle_fragment:OM,map_particle_pars_fragment:NM,metalnessmap_fragment:kM,metalnessmap_pars_fragment:BM,morphcolor_vertex:$M,morphnormal_vertex:UM,morphtarget_pars_vertex:zM,morphtarget_vertex:GM,normal_fragment_begin:VM,normal_fragment_maps:HM,normal_pars_fragment:WM,normal_pars_vertex:jM,normal_vertex:qM,normalmap_pars_fragment:XM,clearcoat_normal_fragment_begin:YM,clearcoat_normal_fragment_maps:JM,clearcoat_pars_fragment:ZM,iridescence_pars_fragment:KM,output_fragment:QM,packing:eS,premultiplied_alpha_fragment:tS,project_vertex:nS,dithering_fragment:iS,dithering_pars_fragment:sS,roughnessmap_fragment:rS,roughnessmap_pars_fragment:oS,shadowmap_pars_fragment:aS,shadowmap_pars_vertex:lS,shadowmap_vertex:cS,shadowmask_pars_fragment:hS,skinbase_vertex:uS,skinning_pars_vertex:dS,skinning_vertex:pS,skinnormal_vertex:fS,specularmap_fragment:mS,specularmap_pars_fragment:gS,tonemapping_fragment:_S,tonemapping_pars_fragment:yS,transmission_fragment:vS,transmission_pars_fragment:xS,uv_pars_fragment:bS,uv_pars_vertex:MS,uv_vertex:SS,uv2_pars_fragment:CS,uv2_pars_vertex:wS,uv2_vertex:AS,worldpos_vertex:TS,background_vert:`varying vec2 vUv; uniform mat3 uvTransform; void main() { vUv = ( uvTransform * vec3( uv, 1 ) ).xy; gl_Position = vec4( position.xy, 1.0, 1.0 ); }`,background_frag:`uniform sampler2D t2D; varying vec2 vUv; void main() { gl_FragColor = texture2D( t2D, vUv ); #ifdef DECODE_VIDEO_TEXTURE gl_FragColor = vec4( mix( pow( gl_FragColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), gl_FragColor.rgb * 0.0773993808, vec3( lessThanEqual( gl_FragColor.rgb, vec3( 0.04045 ) ) ) ), gl_FragColor.w ); #endif #include #include }`,cube_vert:`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; }`,cube_frag:`#include uniform float opacity; varying vec3 vWorldDirection; #include void main() { vec3 vReflect = vWorldDirection; #include gl_FragColor = envColor; gl_FragColor.a *= opacity; #include #include }`,depth_vert:`#include #include #include #include #include #include #include varying vec2 vHighPrecisionZW; void main() { #include #include #ifdef USE_DISPLACEMENTMAP #include #include #include #endif #include #include #include #include #include #include #include vHighPrecisionZW = gl_Position.zw; }`,depth_frag:`#if DEPTH_PACKING == 3200 uniform float opacity; #endif #include #include #include #include #include #include #include #include varying vec2 vHighPrecisionZW; void main() { #include vec4 diffuseColor = vec4( 1.0 ); #if DEPTH_PACKING == 3200 diffuseColor.a = opacity; #endif #include #include #include #include float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; #if DEPTH_PACKING == 3200 gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); #elif DEPTH_PACKING == 3201 gl_FragColor = packDepthToRGBA( fragCoordZ ); #endif }`,distanceRGBA_vert:`#define DISTANCE varying vec3 vWorldPosition; #include #include #include #include #include #include void main() { #include #include #ifdef USE_DISPLACEMENTMAP #include #include #include #endif #include #include #include #include #include #include #include vWorldPosition = worldPosition.xyz; }`,distanceRGBA_frag:`#define DISTANCE uniform vec3 referencePosition; uniform float nearDistance; uniform float farDistance; varying vec3 vWorldPosition; #include #include #include #include #include #include #include void main () { #include vec4 diffuseColor = vec4( 1.0 ); #include #include #include float dist = length( vWorldPosition - referencePosition ); dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); dist = saturate( dist ); gl_FragColor = packDepthToRGBA( dist ); }`,equirect_vert:`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include }`,equirect_frag:`uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { vec3 direction = normalize( vWorldDirection ); vec2 sampleUV = equirectUv( direction ); gl_FragColor = texture2D( tEquirect, sampleUV ); #include #include }`,linedashed_vert:`uniform float scale; attribute float lineDistance; varying float vLineDistance; #include #include #include #include #include #include void main() { vLineDistance = scale * lineDistance; #include #include #include #include #include #include #include #include }`,linedashed_frag:`uniform vec3 diffuse; uniform float opacity; uniform float dashSize; uniform float totalSize; varying float vLineDistance; #include #include #include #include #include void main() { #include if ( mod( vLineDistance, totalSize ) > dashSize ) { discard; } vec3 outgoingLight = vec3( 0.0 ); vec4 diffuseColor = vec4( diffuse, opacity ); #include #include outgoingLight = diffuseColor.rgb; #include #include #include #include #include }`,meshbasic_vert:`#include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) #include #include #include #include #include #endif #include #include #include #include #include #include #include #include #include }`,meshbasic_frag:`uniform vec3 diffuse; uniform float opacity; #ifndef FLAT_SHADED varying vec3 vNormal; #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include #include #include ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); #ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vUv2 ); reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; #else reflectedLight.indirectDiffuse += vec3( 1.0 ); #endif #include reflectedLight.indirectDiffuse *= diffuseColor.rgb; vec3 outgoingLight = reflectedLight.indirectDiffuse; #include #include #include #include #include #include #include }`,meshlambert_vert:`#define LAMBERT varying vec3 vLightFront; varying vec3 vIndirectFront; #ifdef DOUBLE_SIDED varying vec3 vLightBack; varying vec3 vIndirectBack; #endif #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include }`,meshlambert_frag:`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 #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #ifdef DOUBLE_SIDED reflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack; #else reflectedLight.indirectDiffuse += vIndirectFront; #endif #include reflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb ); #ifdef DOUBLE_SIDED reflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack; #else reflectedLight.directDiffuse = vLightFront; #endif reflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask(); #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; #include #include #include #include #include #include #include }`,meshmatcap_vert:`#define MATCAP varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; }`,meshmatcap_frag:`#define MATCAP uniform vec3 diffuse; uniform float opacity; uniform sampler2D matcap; varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include #include #include #include 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 ); #else vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); #endif vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; #include #include #include #include #include #include }`,meshnormal_vert:`#define NORMAL #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP ) varying vec3 vViewPosition; #endif #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP ) vViewPosition = - mvPosition.xyz; #endif }`,meshnormal_frag:`#define NORMAL uniform float opacity; #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP ) varying vec3 vViewPosition; #endif #include #include #include #include #include #include #include void main() { #include #include #include #include gl_FragColor = vec4( packNormalToRGB( normal ), opacity ); #ifdef OPAQUE gl_FragColor.a = 1.0; #endif }`,meshphong_vert:`#define PHONG varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include #include }`,meshphong_frag:`#define PHONG uniform vec3 diffuse; uniform vec3 emissive; uniform vec3 specular; uniform float shininess; uniform float opacity; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; #include #include #include #include #include #include #include }`,meshphysical_vert:`#define STANDARD varying vec3 vViewPosition; #ifdef USE_TRANSMISSION varying vec3 vWorldPosition; #endif #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include #ifdef USE_TRANSMISSION vWorldPosition = worldPosition.xyz; #endif }`,meshphysical_frag:`#define STANDARD #ifdef PHYSICAL #define IOR #define SPECULAR #endif uniform vec3 diffuse; uniform vec3 emissive; uniform float roughness; uniform float metalness; uniform float opacity; #ifdef IOR uniform float ior; #endif #ifdef SPECULAR uniform float specularIntensity; uniform vec3 specularColor; #ifdef USE_SPECULARINTENSITYMAP uniform sampler2D specularIntensityMap; #endif #ifdef USE_SPECULARCOLORMAP uniform sampler2D specularColorMap; #endif #endif #ifdef USE_CLEARCOAT uniform float clearcoat; uniform float clearcoatRoughness; #endif #ifdef USE_IRIDESCENCE uniform float iridescence; uniform float iridescenceIOR; uniform float iridescenceThicknessMinimum; uniform float iridescenceThicknessMaximum; #endif #ifdef USE_SHEEN uniform vec3 sheenColor; uniform float sheenRoughness; #ifdef USE_SHEENCOLORMAP uniform sampler2D sheenColorMap; #endif #ifdef USE_SHEENROUGHNESSMAP uniform sampler2D sheenRoughnessMap; #endif #endif varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; #include vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; #ifdef USE_SHEEN float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular; #endif #ifdef USE_CLEARCOAT float dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) ); vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat; #endif #include #include #include #include #include #include }`,meshtoon_vert:`#define TOON varying vec3 vViewPosition; #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include vViewPosition = - mvPosition.xyz; #include #include #include }`,meshtoon_frag:`#define TOON uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diffuseColor = vec4( diffuse, opacity ); ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include #include #include #include #include #include #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; #include #include #include #include #include #include }`,points_vert:`uniform float size; uniform float scale; #include #include #include #include #include #include void main() { #include #include #include #include #include gl_PointSize = size; #ifdef USE_SIZEATTENUATION bool isPerspective = isPerspectiveMatrix( projectionMatrix ); if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); #endif #include #include #include #include }`,points_frag:`uniform vec3 diffuse; uniform float opacity; #include #include #include #include #include #include #include void main() { #include vec3 outgoingLight = vec3( 0.0 ); vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include outgoingLight = diffuseColor.rgb; #include #include #include #include #include }`,shadow_vert:`#include #include #include #include #include void main() { #include #include #include #include #include #include #include #include #include #include #include #include }`,shadow_frag:`uniform vec3 color; uniform float opacity; #include #include #include #include #include #include #include void main() { gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); #include #include #include }`,sprite_vert:`uniform float rotation; uniform vec2 center; #include #include #include #include #include void main() { #include 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 = isPerspectiveMatrix( projectionMatrix ); 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 #include #include }`,sprite_frag:`uniform vec3 diffuse; uniform float opacity; #include #include #include #include #include #include #include #include void main() { #include vec3 outgoingLight = vec3( 0.0 ); vec4 diffuseColor = vec4( diffuse, opacity ); #include #include #include #include outgoingLight = diffuseColor.rgb; #include #include #include #include }`},se={common:{diffuse:{value:new ge(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new Ut},uv2Transform:{value:new Ut},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},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 ne(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 ge(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotShadowMap:{value:[]},spotShadowMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new ge(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Ut}},sprite:{diffuse:{value:new ge(16777215)},opacity:{value:1},center:{value:new ne(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new Ut}}},hn={basic:{uniforms:Mt([se.common,se.specularmap,se.envmap,se.aomap,se.lightmap,se.fog]),vertexShader:Be.meshbasic_vert,fragmentShader:Be.meshbasic_frag},lambert:{uniforms:Mt([se.common,se.specularmap,se.envmap,se.aomap,se.lightmap,se.emissivemap,se.fog,se.lights,{emissive:{value:new ge(0)}}]),vertexShader:Be.meshlambert_vert,fragmentShader:Be.meshlambert_frag},phong:{uniforms:Mt([se.common,se.specularmap,se.envmap,se.aomap,se.lightmap,se.emissivemap,se.bumpmap,se.normalmap,se.displacementmap,se.fog,se.lights,{emissive:{value:new ge(0)},specular:{value:new ge(1118481)},shininess:{value:30}}]),vertexShader:Be.meshphong_vert,fragmentShader:Be.meshphong_frag},standard:{uniforms:Mt([se.common,se.envmap,se.aomap,se.lightmap,se.emissivemap,se.bumpmap,se.normalmap,se.displacementmap,se.roughnessmap,se.metalnessmap,se.fog,se.lights,{emissive:{value:new ge(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Be.meshphysical_vert,fragmentShader:Be.meshphysical_frag},toon:{uniforms:Mt([se.common,se.aomap,se.lightmap,se.emissivemap,se.bumpmap,se.normalmap,se.displacementmap,se.gradientmap,se.fog,se.lights,{emissive:{value:new ge(0)}}]),vertexShader:Be.meshtoon_vert,fragmentShader:Be.meshtoon_frag},matcap:{uniforms:Mt([se.common,se.bumpmap,se.normalmap,se.displacementmap,se.fog,{matcap:{value:null}}]),vertexShader:Be.meshmatcap_vert,fragmentShader:Be.meshmatcap_frag},points:{uniforms:Mt([se.points,se.fog]),vertexShader:Be.points_vert,fragmentShader:Be.points_frag},dashed:{uniforms:Mt([se.common,se.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Be.linedashed_vert,fragmentShader:Be.linedashed_frag},depth:{uniforms:Mt([se.common,se.displacementmap]),vertexShader:Be.depth_vert,fragmentShader:Be.depth_frag},normal:{uniforms:Mt([se.common,se.bumpmap,se.normalmap,se.displacementmap,{opacity:{value:1}}]),vertexShader:Be.meshnormal_vert,fragmentShader:Be.meshnormal_frag},sprite:{uniforms:Mt([se.sprite,se.fog]),vertexShader:Be.sprite_vert,fragmentShader:Be.sprite_frag},background:{uniforms:{uvTransform:{value:new Ut},t2D:{value:null}},vertexShader:Be.background_vert,fragmentShader:Be.background_frag},cube:{uniforms:Mt([se.envmap,{opacity:{value:1}}]),vertexShader:Be.cube_vert,fragmentShader:Be.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Be.equirect_vert,fragmentShader:Be.equirect_frag},distanceRGBA:{uniforms:Mt([se.common,se.displacementmap,{referencePosition:{value:new E},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Be.distanceRGBA_vert,fragmentShader:Be.distanceRGBA_frag},shadow:{uniforms:Mt([se.lights,se.fog,{color:{value:new ge(0)},opacity:{value:1}}]),vertexShader:Be.shadow_vert,fragmentShader:Be.shadow_frag}};hn.physical={uniforms:Mt([hn.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new ne(1,1)},clearcoatNormalMap:{value:null},iridescence:{value:0},iridescenceMap:{value:null},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},sheen:{value:0},sheenColor:{value:new ge(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new ne},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new ge(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new ge(1,1,1)},specularColorMap:{value:null}}]),vertexShader:Be.meshphysical_vert,fragmentShader:Be.meshphysical_frag};function ES(n,e,t,i,s,r){const o=new ge(0);let a=s===!0?0:1,l,c,u=null,h=0,d=null;function p(m,f){let _=!1,v=f.isScene===!0?f.background:null;v&&v.isTexture&&(v=e.get(v));const b=n.xr,x=b.getSession&&b.getSession();x&&x.environmentBlendMode==="additive"&&(v=null),v===null?g(o,a):v&&v.isColor&&(g(v,1),_=!0),(n.autoClear||_)&&n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil),v&&(v.isCubeTexture||v.mapping===Pr)?(c===void 0&&(c=new ft(new Vs(1,1,1),new cn({name:"BackgroundCubeMaterial",uniforms:Ki(hn.cube.uniforms),vertexShader:hn.cube.vertexShader,fragmentShader:hn.cube.fragmentShader,side:Xt,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(C,w,L){this.matrixWorld.copyPosition(L.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(c)),c.material.uniforms.envMap.value=v,c.material.uniforms.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,(u!==v||h!==v.version||d!==n.toneMapping)&&(c.material.needsUpdate=!0,u=v,h=v.version,d=n.toneMapping),c.layers.enableAll(),m.unshift(c,c.geometry,c.material,0,0,null)):v&&v.isTexture&&(l===void 0&&(l=new ft(new Hs(2,2),new cn({name:"BackgroundMaterial",uniforms:Ki(hn.background.uniforms),vertexShader:hn.background.vertexShader,fragmentShader:hn.background.fragmentShader,side:Pi,depthTest:!1,depthWrite:!1,fog:!1})),l.geometry.deleteAttribute("normal"),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(l)),l.material.uniforms.t2D.value=v,v.matrixAutoUpdate===!0&&v.updateMatrix(),l.material.uniforms.uvTransform.value.copy(v.matrix),(u!==v||h!==v.version||d!==n.toneMapping)&&(l.material.needsUpdate=!0,u=v,h=v.version,d=n.toneMapping),l.layers.enableAll(),m.unshift(l,l.geometry,l.material,0,0,null))}function g(m,f){t.buffers.color.setClear(m.r,m.g,m.b,f,r)}return{getClearColor:function(){return o},setClearColor:function(m,f=1){o.set(m),a=f,g(o,a)},getClearAlpha:function(){return a},setClearAlpha:function(m){a=m,g(o,a)},render:p}}function LS(n,e,t,i){const s=n.getParameter(34921),r=i.isWebGL2?null:e.get("OES_vertex_array_object"),o=i.isWebGL2||r!==null,a={},l=f(null);let c=l,u=!1;function h(D,z,k,j,W){let N=!1;if(o){const G=m(j,k,z);c!==G&&(c=G,p(c.object)),N=_(D,j,k,W),N&&v(D,j,k,W)}else{const G=z.wireframe===!0;(c.geometry!==j.id||c.program!==k.id||c.wireframe!==G)&&(c.geometry=j.id,c.program=k.id,c.wireframe=G,N=!0)}W!==null&&t.update(W,34963),(N||u)&&(u=!1,y(D,z,k,j),W!==null&&n.bindBuffer(34963,t.get(W).buffer))}function d(){return i.isWebGL2?n.createVertexArray():r.createVertexArrayOES()}function p(D){return i.isWebGL2?n.bindVertexArray(D):r.bindVertexArrayOES(D)}function g(D){return i.isWebGL2?n.deleteVertexArray(D):r.deleteVertexArrayOES(D)}function m(D,z,k){const j=k.wireframe===!0;let W=a[D.id];W===void 0&&(W={},a[D.id]=W);let N=W[z.id];N===void 0&&(N={},W[z.id]=N);let G=N[j];return G===void 0&&(G=f(d()),N[j]=G),G}function f(D){const z=[],k=[],j=[];for(let W=0;W=0){const xe=W[K];let Le=N[K];if(Le===void 0&&(K==="instanceMatrix"&&D.instanceMatrix&&(Le=D.instanceMatrix),K==="instanceColor"&&D.instanceColor&&(Le=D.instanceColor)),xe===void 0||xe.attribute!==Le||Le&&xe.data!==Le.data)return!0;G++}return c.attributesNum!==G||c.index!==j}function v(D,z,k,j){const W={},N=z.attributes;let G=0;const ie=k.getAttributes();for(const K in ie)if(ie[K].location>=0){let xe=N[K];xe===void 0&&(K==="instanceMatrix"&&D.instanceMatrix&&(xe=D.instanceMatrix),K==="instanceColor"&&D.instanceColor&&(xe=D.instanceColor));const Le={};Le.attribute=xe,xe&&xe.data&&(Le.data=xe.data),W[K]=Le,G++}c.attributes=W,c.attributesNum=G,c.index=j}function b(){const D=c.newAttributes;for(let z=0,k=D.length;z=0){let ae=W[ie];if(ae===void 0&&(ie==="instanceMatrix"&&D.instanceMatrix&&(ae=D.instanceMatrix),ie==="instanceColor"&&D.instanceColor&&(ae=D.instanceColor)),ae!==void 0){const xe=ae.normalized,Le=ae.itemSize,X=t.get(ae);if(X===void 0)continue;const Ne=X.buffer,Ae=X.type,Re=X.bytesPerElement;if(ae.isInterleavedBufferAttribute){const ue=ae.data,Ue=ue.stride,Y=ae.offset;if(ue.isInstancedInterleavedBuffer){for(let q=0;q0&&n.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";L="mediump"}return L==="mediump"&&n.getShaderPrecisionFormat(35633,36337).precision>0&&n.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const o=typeof WebGL2RenderingContext!="undefined"&&n instanceof WebGL2RenderingContext||typeof WebGL2ComputeRenderingContext!="undefined"&&n instanceof WebGL2ComputeRenderingContext;let a=t.precision!==void 0?t.precision:"highp";const l=r(a);l!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",l,"instead."),a=l);const c=o||e.has("WEBGL_draw_buffers"),u=t.logarithmicDepthBuffer===!0,h=n.getParameter(34930),d=n.getParameter(35660),p=n.getParameter(3379),g=n.getParameter(34076),m=n.getParameter(34921),f=n.getParameter(36347),_=n.getParameter(36348),v=n.getParameter(36349),b=d>0,x=o||e.has("OES_texture_float"),C=b&&x,w=o?n.getParameter(36183):0;return{isWebGL2:o,drawBuffers:c,getMaxAnisotropy:s,getMaxPrecision:r,precision:a,logarithmicDepthBuffer:u,maxTextures:h,maxVertexTextures:d,maxTextureSize:p,maxCubemapSize:g,maxAttributes:m,maxVertexUniforms:f,maxVaryings:_,maxFragmentUniforms:v,vertexTextures:b,floatFragmentTextures:x,floatVertexTextures:C,maxSamples:w}}function IS(n){const e=this;let t=null,i=0,s=!1,r=!1;const o=new pi,a=new Ut,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(h,d,p){const g=h.length!==0||d||i!==0||s;return s=d,t=u(h,p,0),i=h.length,g},this.beginShadows=function(){r=!0,u(null)},this.endShadows=function(){r=!1,c()},this.setState=function(h,d,p){const g=h.clippingPlanes,m=h.clipIntersection,f=h.clipShadows,_=n.get(h);if(!s||g===null||g.length===0||r&&!f)r?u(null):c();else{const v=r?0:i,b=v*4;let x=_.clippingState||null;l.value=x,x=u(g,d,b,p);for(let C=0;C!==b;++C)x[C]=t[C];_.clippingState=x,this.numIntersection=m?this.numPlanes:0,this.numPlanes+=v}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=i>0),e.numPlanes=i,e.numIntersection=0}function u(h,d,p,g){const m=h!==null?h.length:0;let f=null;if(m!==0){if(f=l.value,g!==!0||f===null){const _=p+m*4,v=d.matrixWorldInverse;a.getNormalMatrix(v),(f===null||f.length<_)&&(f=new Float32Array(_));for(let b=0,x=p;b!==m;++b,x+=4)o.copy(h[b]).applyMatrix4(v,a),o.normal.toArray(f,x),f[x+3]=o.constant}l.value=f,l.needsUpdate=!0}return e.numPlanes=m,e.numIntersection=0,f}}function DS(n){let e=new WeakMap;function t(o,a){return a===pa?o.mapping=Fi:a===fa&&(o.mapping=Oi),o}function i(o){if(o&&o.isTexture&&o.isRenderTargetTexture===!1){const a=o.mapping;if(a===pa||a===fa)if(e.has(o)){const l=e.get(o).texture;return t(l,o.mapping)}else{const l=o.image;if(l&&l.height>0){const c=new Tb(l.height/2);return c.fromEquirectangularTexture(n,o),e.set(o,c),o.addEventListener("dispose",s),t(c.texture,o.mapping)}else return null}}return o}function s(o){const a=o.target;a.removeEventListener("dispose",s);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function r(){e=new WeakMap}return{get:i,dispose:r}}class ns extends lp{constructor(e=-1,t=1,i=1,s=-1,r=.1,o=2e3){super();this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=i,this.bottom=s,this.near=r,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,i,s,r,o){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=i,this.view.offsetY=s,this.view.width=r,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,s=(this.top+this.bottom)/2;let r=i-e,o=i+e,a=s+t,l=s-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,u=(this.top-this.bottom)/this.view.fullHeight/this.zoom;r+=c*this.view.offsetX,o=r+c*this.view.width,a-=u*this.view.offsetY,l=a-u*this.view.height}this.projectionMatrix.makeOrthographic(r,o,a,l,this.near,this.far),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const is=4,hp=[.125,.215,.35,.446,.526,.582],fi=20,Ka=new ns,up=new ge;let Qa=null;const mi=(1+Math.sqrt(5))/2,ss=1/mi,dp=[new E(1,1,1),new E(-1,1,1),new E(1,1,-1),new E(-1,1,-1),new E(0,mi,ss),new E(0,mi,-ss),new E(ss,0,mi),new E(-ss,0,mi),new E(mi,ss,0),new E(-mi,ss,0)];class el{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,i=.1,s=100){Qa=this._renderer.getRenderTarget(),this._setSize(256);const r=this._allocateTargets();return r.depthBuffer=!0,this._sceneToCubeUV(e,i,s,r),t>0&&this._blur(r,0,0,t),this._applyPMREM(r),this._cleanup(r),r}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=mp(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=fp(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?b:0,b,b),u.setRenderTarget(s),m&&u.render(g,a),u.render(e,a)}g.geometry.dispose(),g.material.dispose(),u.toneMapping=d,u.autoClear=h,e.background=f}_textureToCubeUV(e,t){const i=this._renderer,s=e.mapping===Fi||e.mapping===Oi;s?(this._cubemapMaterial===null&&(this._cubemapMaterial=mp()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=fp());const r=s?this._cubemapMaterial:this._equirectMaterial,o=new ft(this._lodPlanes[0],r),a=r.uniforms;a.envMap.value=e;const l=this._cubeSize;io(t,0,0,3*l,2*l),i.setRenderTarget(t),i.render(o,Ka)}_applyPMREM(e){const t=this._renderer,i=t.autoClear;t.autoClear=!1;for(let s=1;sfi&&console.warn(`sigmaRadians, ${r}, is too large and will clip, as it requested ${f} samples when the maximum is set to ${fi}`);const _=[];let v=0;for(let L=0;Lb-is?s-b+is:0),w=4*(this._cubeSize-x);io(t,C,w,3*x,2*x),l.setRenderTarget(t),l.render(h,Ka)}}function FS(n){const e=[],t=[],i=[];let s=n;const r=n-is+1+hp.length;for(let o=0;on-is?l=hp[o-n+is-1]:o===0&&(l=0),i.push(l);const c=1/(a-2),u=-c,h=1+c,d=[u,u,h,u,h,h,u,u,h,h,u,h],p=6,g=6,m=3,f=2,_=1,v=new Float32Array(m*g*p),b=new Float32Array(f*g*p),x=new Float32Array(_*g*p);for(let w=0;w2?0:-1,A=[L,y,0,L+2/3,y,0,L+2/3,y+1,0,L,y,0,L+2/3,y+1,0,L,y+1,0];v.set(A,m*g*w),b.set(d,f*g*w);const I=[w,w,w,w,w,w];x.set(I,_*g*w)}const C=new bt;C.setAttribute("position",new dt(v,m)),C.setAttribute("uv",new dt(b,f)),C.setAttribute("faceIndex",new dt(x,_)),e.push(C),s>is&&s--}return{lodPlanes:e,sizeLods:t,sigmas:i}}function pp(n,e,t){const i=new kn(n,e,t);return i.texture.mapping=Pr,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function io(n,e,t,i,s){n.viewport.set(e,t,i,s),n.scissor.set(e,t,i,s)}function OS(n,e,t){const i=new Float32Array(fi),s=new E(0,1,0);return new cn({name:"SphericalGaussianBlur",defines:{n:fi,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:s}},vertexShader:tl(),fragmentShader:` precision mediump float; precision mediump int; varying vec3 vOutputDirection; uniform sampler2D envMap; uniform int samples; uniform float weights[ n ]; uniform bool latitudinal; uniform float dTheta; uniform float mipInt; uniform vec3 poleAxis; #define ENVMAP_TYPE_CUBE_UV #include vec3 getSample( float theta, vec3 axis ) { float cosTheta = cos( theta ); // Rodrigues' axis-angle rotation vec3 sampleDirection = vOutputDirection * cosTheta + cross( axis, vOutputDirection ) * sin( theta ) + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); return bilinearCubeUV( envMap, sampleDirection, mipInt ); } void main() { vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); if ( all( equal( axis, vec3( 0.0 ) ) ) ) { axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); } axis = normalize( axis ); gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); for ( int i = 1; i < n; i++ ) { if ( i >= samples ) { break; } float theta = dTheta * float( i ); gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); } } `,blending:Nn,depthTest:!1,depthWrite:!1})}function fp(){return new cn({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:tl(),fragmentShader:` precision mediump float; precision mediump int; varying vec3 vOutputDirection; uniform sampler2D envMap; #include void main() { vec3 outputDirection = normalize( vOutputDirection ); vec2 uv = equirectUv( outputDirection ); gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); } `,blending:Nn,depthTest:!1,depthWrite:!1})}function mp(){return new cn({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:tl(),fragmentShader:` precision mediump float; precision mediump int; uniform float flipEnvMap; varying vec3 vOutputDirection; uniform samplerCube envMap; void main() { gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); } `,blending:Nn,depthTest:!1,depthWrite:!1})}function tl(){return` precision mediump float; precision mediump int; attribute float faceIndex; varying vec3 vOutputDirection; // RH coordinate system; PMREM face-indexing convention vec3 getDirection( vec2 uv, float face ) { uv = 2.0 * uv - 1.0; vec3 direction = vec3( uv, 1.0 ); if ( face == 0.0 ) { direction = direction.zyx; // ( 1, v, u ) pos x } else if ( face == 1.0 ) { direction = direction.xzy; direction.xz *= -1.0; // ( -u, 1, -v ) pos y } else if ( face == 2.0 ) { direction.x *= -1.0; // ( -u, v, 1 ) pos z } else if ( face == 3.0 ) { direction = direction.zyx; direction.xz *= -1.0; // ( -1, v, -u ) neg x } else if ( face == 4.0 ) { direction = direction.xzy; direction.xy *= -1.0; // ( -u, -1, v ) neg y } else if ( face == 5.0 ) { direction.z *= -1.0; // ( u, v, -1 ) neg z } return direction; } void main() { vOutputDirection = getDirection( uv, faceIndex ); gl_Position = vec4( position, 1.0 ); } `}function NS(n){let e=new WeakMap,t=null;function i(a){if(a&&a.isTexture){const l=a.mapping,c=l===pa||l===fa,u=l===Fi||l===Oi;if(c||u)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let h=e.get(a);return t===null&&(t=new el(n)),h=c?t.fromEquirectangular(a,h):t.fromCubemap(a,h),e.set(a,h),h.texture}else{if(e.has(a))return e.get(a).texture;{const h=a.image;if(c&&h&&h.height>0||u&&h&&s(h)){t===null&&(t=new el(n));const d=c?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,d),a.addEventListener("dispose",r),d.texture}else return null}}}return a}function s(a){let l=0;const c=6;for(let u=0;ue.maxTextureSize&&(R=Math.ceil(I/e.maxTextureSize),I=e.maxTextureSize);const Q=new Float32Array(I*R*4*m),ee=new Xd(Q,I,R,m);ee.type=Bt,ee.needsUpdate=!0;const D=A*4;for(let k=0;k0)return n;const s=e*t;let r=xp[s];if(r===void 0&&(r=new Float32Array(s),xp[s]=r),e!==0){i.toArray(r,0);for(let o=1,a=0;o!==e;++o)a+=t,n[o].toArray(r,a)}return r}function Ct(n,e){if(n.length!==e.length)return!1;for(let t=0,i=n.length;t":" "} ${a}: ${t[o]}`)}return i.join(` `)}function kC(n){switch(n){case ln:return["Linear","( value )"];case He:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",n),["Linear","( value )"]}}function Tp(n,e,t){const i=n.getShaderParameter(e,35713),s=n.getShaderInfoLog(e).trim();if(i&&s==="")return"";const r=/ERROR: 0:(\d+)/.exec(s);if(r){const o=parseInt(r[1]);return t.toUpperCase()+` `+s+` `+NC(n.getShaderSource(e),o)}else return s}function BC(n,e){const t=kC(e);return"vec4 "+n+"( vec4 value ) { return LinearTo"+t[0]+t[1]+"; }"}function $C(n,e){let t;switch(e){case bx:t="Linear";break;case Mx:t="Reinhard";break;case Sx:t="OptimizedCineon";break;case Cx:t="ACESFilmic";break;case wx:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function UC(n){return[n.extensionDerivatives||!!n.envMapCubeUVHeight||n.bumpMap||n.tangentSpaceNormalMap||n.clearcoatNormalMap||n.flatShading||n.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(n.extensionFragDepth||n.logarithmicDepthBuffer)&&n.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",n.extensionDrawBuffers&&n.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(n.extensionShaderTextureLOD||n.envMap||n.transmission)&&n.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Ws).join(` `)}function zC(n){const e=[];for(const t in n){const i=n[t];i!==!1&&e.push("#define "+t+" "+i)}return e.join(` `)}function GC(n,e){const t={},i=n.getProgramParameter(e,35721);for(let s=0;s/gm;function sl(n){return n.replace(VC,HC)}function HC(n,e){const t=Be[e];if(t===void 0)throw new Error("Can not resolve #include <"+e+">");return sl(t)}const WC=/#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g,jC=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function Rp(n){return n.replace(jC,Pp).replace(WC,qC)}function qC(n,e,t,i){return console.warn("WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead."),Pp(n,e,t,i)}function Pp(n,e,t,i){let s="";for(let r=parseInt(e);r0&&(f+=` `),_=[p,g].filter(Ws).join(` `),_.length>0&&(_+=` `)):(f=[Ip(t),"#define SHADER_NAME "+t.shaderName,g,t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.supportsVertexTextures?"#define VERTEX_TEXTURES":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+u:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.displacementMap&&t.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",t.specularColorMap?"#define USE_SPECULARCOLORMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEENCOLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors&&t.isWebGL2?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," 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(Ws).join(` `),_=[p,Ip(t),"#define SHADER_NAME "+t.shaderName,g,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+u:"",t.envMap?"#define "+h:"",d?"#define CUBEUV_TEXEL_WIDTH "+d.texelWidth:"",d?"#define CUBEUV_TEXEL_HEIGHT "+d.texelHeight:"",d?"#define CUBEUV_MAX_MIP "+d.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",t.specularColorMap?"#define USE_SPECULARCOLORMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEENCOLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==gn?"#define TONE_MAPPING":"",t.toneMapping!==gn?Be.tonemapping_pars_fragment:"",t.toneMapping!==gn?$C("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Be.encodings_pars_fragment,BC("linearToOutputTexel",t.outputEncoding),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` `].filter(Ws).join(` `)),o=sl(o),o=Ep(o,t),o=Lp(o,t),a=sl(a),a=Ep(a,t),a=Lp(a,t),o=Rp(o),a=Rp(a),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(v=`#version 300 es `,f=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(` `)+` `+f,_=["#define varying in",t.glslVersion===zd?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===zd?"":"#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(` `)+` `+_);const b=v+f+o,x=v+_+a,C=Ap(s,35633,b),w=Ap(s,35632,x);if(s.attachShader(m,C),s.attachShader(m,w),t.index0AttributeName!==void 0?s.bindAttribLocation(m,0,t.index0AttributeName):t.morphTargets===!0&&s.bindAttribLocation(m,0,"position"),s.linkProgram(m),n.debug.checkShaderErrors){const A=s.getProgramInfoLog(m).trim(),I=s.getShaderInfoLog(C).trim(),R=s.getShaderInfoLog(w).trim();let Q=!0,ee=!0;if(s.getProgramParameter(m,35714)===!1){Q=!1;const D=Tp(s,C,"vertex"),z=Tp(s,w,"fragment");console.error("THREE.WebGLProgram: Shader Error "+s.getError()+" - VALIDATE_STATUS "+s.getProgramParameter(m,35715)+` Program Info Log: `+A+` `+D+` `+z)}else A!==""?console.warn("THREE.WebGLProgram: Program Info Log:",A):(I===""||R==="")&&(ee=!1);ee&&(this.diagnostics={runnable:Q,programLog:A,vertexShader:{log:I,prefix:f},fragmentShader:{log:R,prefix:_}})}s.deleteShader(C),s.deleteShader(w);let L;this.getUniforms=function(){return L===void 0&&(L=new ro(s,m)),L};let y;return this.getAttributes=function(){return y===void 0&&(y=GC(s,m)),y},this.destroy=function(){i.releaseStatesOfProgram(this),s.deleteProgram(m),this.program=void 0},this.name=t.shaderName,this.id=OC++,this.cacheKey=e,this.usedTimes=1,this.program=m,this.vertexShader=C,this.fragmentShader=w,this}let ew=0;class tw{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,i=e.fragmentShader,s=this._getShaderStage(t),r=this._getShaderStage(i),o=this._getShaderCacheForMaterial(e);return o.has(s)===!1&&(o.add(s),s.usedTimes++),o.has(r)===!1&&(o.add(r),r.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const i of t)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;return t.has(e)===!1&&t.set(e,new Set),t.get(e)}_getShaderStage(e){const t=this.shaderCache;if(t.has(e)===!1){const i=new nw(e);t.set(e,i)}return t.get(e)}}class nw{constructor(e){this.id=ew++,this.code=e,this.usedTimes=0}}function iw(n,e,t,i,s,r,o){const a=new Ba,l=new tw,c=[],u=s.isWebGL2,h=s.logarithmicDepthBuffer,d=s.vertexTextures;let p=s.precision;const g={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function m(y,A,I,R,Q){const ee=R.fog,D=Q.geometry,z=y.isMeshStandardMaterial?R.environment:null,k=(y.isMeshStandardMaterial?t:e).get(y.envMap||z),j=!!k&&k.mapping===Pr?k.image.height:null,W=g[y.type];y.precision!==null&&(p=s.getMaxPrecision(y.precision),p!==y.precision&&console.warn("THREE.WebGLProgram.getParameters:",y.precision,"not supported, using",p,"instead."));const N=D.morphAttributes.position||D.morphAttributes.normal||D.morphAttributes.color,G=N!==void 0?N.length:0;let ie=0;D.morphAttributes.position!==void 0&&(ie=1),D.morphAttributes.normal!==void 0&&(ie=2),D.morphAttributes.color!==void 0&&(ie=3);let K,ae,xe,Le;if(W){const Ue=hn[W];K=Ue.vertexShader,ae=Ue.fragmentShader}else K=y.vertexShader,ae=y.fragmentShader,l.update(y),xe=l.getVertexShaderID(y),Le=l.getFragmentShaderID(y);const X=n.getRenderTarget(),Ne=y.alphaTest>0,Ae=y.clearcoat>0,Re=y.iridescence>0;return{isWebGL2:u,shaderID:W,shaderName:y.type,vertexShader:K,fragmentShader:ae,defines:y.defines,customVertexShaderID:xe,customFragmentShaderID:Le,isRawShaderMaterial:y.isRawShaderMaterial===!0,glslVersion:y.glslVersion,precision:p,instancing:Q.isInstancedMesh===!0,instancingColor:Q.isInstancedMesh===!0&&Q.instanceColor!==null,supportsVertexTextures:d,outputEncoding:X===null?n.outputEncoding:X.isXRRenderTarget===!0?X.texture.encoding:ln,map:!!y.map,matcap:!!y.matcap,envMap:!!k,envMapMode:k&&k.mapping,envMapCubeUVHeight:j,lightMap:!!y.lightMap,aoMap:!!y.aoMap,emissiveMap:!!y.emissiveMap,bumpMap:!!y.bumpMap,normalMap:!!y.normalMap,objectSpaceNormalMap:y.normalMapType===Xx,tangentSpaceNormalMap:y.normalMapType===Fr,decodeVideoTexture:!!y.map&&y.map.isVideoTexture===!0&&y.map.encoding===He,clearcoat:Ae,clearcoatMap:Ae&&!!y.clearcoatMap,clearcoatRoughnessMap:Ae&&!!y.clearcoatRoughnessMap,clearcoatNormalMap:Ae&&!!y.clearcoatNormalMap,iridescence:Re,iridescenceMap:Re&&!!y.iridescenceMap,iridescenceThicknessMap:Re&&!!y.iridescenceThicknessMap,displacementMap:!!y.displacementMap,roughnessMap:!!y.roughnessMap,metalnessMap:!!y.metalnessMap,specularMap:!!y.specularMap,specularIntensityMap:!!y.specularIntensityMap,specularColorMap:!!y.specularColorMap,opaque:y.transparent===!1&&y.blending===Ii,alphaMap:!!y.alphaMap,alphaTest:Ne,gradientMap:!!y.gradientMap,sheen:y.sheen>0,sheenColorMap:!!y.sheenColorMap,sheenRoughnessMap:!!y.sheenRoughnessMap,transmission:y.transmission>0,transmissionMap:!!y.transmissionMap,thicknessMap:!!y.thicknessMap,combine:y.combine,vertexTangents:!!y.normalMap&&!!D.attributes.tangent,vertexColors:y.vertexColors,vertexAlphas:y.vertexColors===!0&&!!D.attributes.color&&D.attributes.color.itemSize===4,vertexUvs:!!y.map||!!y.bumpMap||!!y.normalMap||!!y.specularMap||!!y.alphaMap||!!y.emissiveMap||!!y.roughnessMap||!!y.metalnessMap||!!y.clearcoatMap||!!y.clearcoatRoughnessMap||!!y.clearcoatNormalMap||!!y.iridescenceMap||!!y.iridescenceThicknessMap||!!y.displacementMap||!!y.transmissionMap||!!y.thicknessMap||!!y.specularIntensityMap||!!y.specularColorMap||!!y.sheenColorMap||!!y.sheenRoughnessMap,uvsVertexOnly:!(!!y.map||!!y.bumpMap||!!y.normalMap||!!y.specularMap||!!y.alphaMap||!!y.emissiveMap||!!y.roughnessMap||!!y.metalnessMap||!!y.clearcoatNormalMap||!!y.iridescenceMap||!!y.iridescenceThicknessMap||y.transmission>0||!!y.transmissionMap||!!y.thicknessMap||!!y.specularIntensityMap||!!y.specularColorMap||y.sheen>0||!!y.sheenColorMap||!!y.sheenRoughnessMap)&&!!y.displacementMap,fog:!!ee,useFog:y.fog===!0,fogExp2:ee&&ee.isFogExp2,flatShading:!!y.flatShading,sizeAttenuation:y.sizeAttenuation,logarithmicDepthBuffer:h,skinning:Q.isSkinnedMesh===!0,morphTargets:D.morphAttributes.position!==void 0,morphNormals:D.morphAttributes.normal!==void 0,morphColors:D.morphAttributes.color!==void 0,morphTargetsCount:G,morphTextureStride:ie,numDirLights:A.directional.length,numPointLights:A.point.length,numSpotLights:A.spot.length,numRectAreaLights:A.rectArea.length,numHemiLights:A.hemi.length,numDirLightShadows:A.directionalShadowMap.length,numPointLightShadows:A.pointShadowMap.length,numSpotLightShadows:A.spotShadowMap.length,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:y.dithering,shadowMapEnabled:n.shadowMap.enabled&&I.length>0,shadowMapType:n.shadowMap.type,toneMapping:y.toneMapped?n.toneMapping:gn,physicallyCorrectLights:n.physicallyCorrectLights,premultipliedAlpha:y.premultipliedAlpha,doubleSided:y.side===Yt,flipSided:y.side===Xt,useDepthPacking:!!y.depthPacking,depthPacking:y.depthPacking||0,index0AttributeName:y.index0AttributeName,extensionDerivatives:y.extensions&&y.extensions.derivatives,extensionFragDepth:y.extensions&&y.extensions.fragDepth,extensionDrawBuffers:y.extensions&&y.extensions.drawBuffers,extensionShaderTextureLOD:y.extensions&&y.extensions.shaderTextureLOD,rendererExtensionFragDepth:u||i.has("EXT_frag_depth"),rendererExtensionDrawBuffers:u||i.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:u||i.has("EXT_shader_texture_lod"),customProgramCacheKey:y.customProgramCacheKey()}}function f(y){const A=[];if(y.shaderID?A.push(y.shaderID):(A.push(y.customVertexShaderID),A.push(y.customFragmentShaderID)),y.defines!==void 0)for(const I in y.defines)A.push(I),A.push(y.defines[I]);return y.isRawShaderMaterial===!1&&(_(A,y),v(A,y),A.push(n.outputEncoding)),A.push(y.customProgramCacheKey),A.join()}function _(y,A){y.push(A.precision),y.push(A.outputEncoding),y.push(A.envMapMode),y.push(A.envMapCubeUVHeight),y.push(A.combine),y.push(A.vertexUvs),y.push(A.fogExp2),y.push(A.sizeAttenuation),y.push(A.morphTargetsCount),y.push(A.morphAttributeCount),y.push(A.numDirLights),y.push(A.numPointLights),y.push(A.numSpotLights),y.push(A.numHemiLights),y.push(A.numRectAreaLights),y.push(A.numDirLightShadows),y.push(A.numPointLightShadows),y.push(A.numSpotLightShadows),y.push(A.shadowMapType),y.push(A.toneMapping),y.push(A.numClippingPlanes),y.push(A.numClipIntersection),y.push(A.depthPacking)}function v(y,A){a.disableAll(),A.isWebGL2&&a.enable(0),A.supportsVertexTextures&&a.enable(1),A.instancing&&a.enable(2),A.instancingColor&&a.enable(3),A.map&&a.enable(4),A.matcap&&a.enable(5),A.envMap&&a.enable(6),A.lightMap&&a.enable(7),A.aoMap&&a.enable(8),A.emissiveMap&&a.enable(9),A.bumpMap&&a.enable(10),A.normalMap&&a.enable(11),A.objectSpaceNormalMap&&a.enable(12),A.tangentSpaceNormalMap&&a.enable(13),A.clearcoat&&a.enable(14),A.clearcoatMap&&a.enable(15),A.clearcoatRoughnessMap&&a.enable(16),A.clearcoatNormalMap&&a.enable(17),A.iridescence&&a.enable(18),A.iridescenceMap&&a.enable(19),A.iridescenceThicknessMap&&a.enable(20),A.displacementMap&&a.enable(21),A.specularMap&&a.enable(22),A.roughnessMap&&a.enable(23),A.metalnessMap&&a.enable(24),A.gradientMap&&a.enable(25),A.alphaMap&&a.enable(26),A.alphaTest&&a.enable(27),A.vertexColors&&a.enable(28),A.vertexAlphas&&a.enable(29),A.vertexUvs&&a.enable(30),A.vertexTangents&&a.enable(31),A.uvsVertexOnly&&a.enable(32),A.fog&&a.enable(33),y.push(a.mask),a.disableAll(),A.useFog&&a.enable(0),A.flatShading&&a.enable(1),A.logarithmicDepthBuffer&&a.enable(2),A.skinning&&a.enable(3),A.morphTargets&&a.enable(4),A.morphNormals&&a.enable(5),A.morphColors&&a.enable(6),A.premultipliedAlpha&&a.enable(7),A.shadowMapEnabled&&a.enable(8),A.physicallyCorrectLights&&a.enable(9),A.doubleSided&&a.enable(10),A.flipSided&&a.enable(11),A.useDepthPacking&&a.enable(12),A.dithering&&a.enable(13),A.specularIntensityMap&&a.enable(14),A.specularColorMap&&a.enable(15),A.transmission&&a.enable(16),A.transmissionMap&&a.enable(17),A.thicknessMap&&a.enable(18),A.sheen&&a.enable(19),A.sheenColorMap&&a.enable(20),A.sheenRoughnessMap&&a.enable(21),A.decodeVideoTexture&&a.enable(22),A.opaque&&a.enable(23),y.push(a.mask)}function b(y){const A=g[y.type];let I;if(A){const R=hn[A];I=Ya.clone(R.uniforms)}else I=y.uniforms;return I}function x(y,A){let I;for(let R=0,Q=c.length;R0?i.push(_):p.transparent===!0?s.push(_):t.push(_)}function l(h,d,p,g,m,f){const _=o(h,d,p,g,m,f);p.transmission>0?i.unshift(_):p.transparent===!0?s.unshift(_):t.unshift(_)}function c(h,d){t.length>1&&t.sort(h||rw),i.length>1&&i.sort(d||Dp),s.length>1&&s.sort(d||Dp)}function u(){for(let h=e,d=n.length;h=n.get(i).length?(r=new Fp,n.get(i).push(r)):r=n.get(i)[s],r}function t(){n=new WeakMap}return{get:e,dispose:t}}function aw(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new E,color:new ge};break;case"SpotLight":t={position:new E,direction:new E,color:new ge,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new E,color:new ge,distance:0,decay:0};break;case"HemisphereLight":t={direction:new E,skyColor:new ge,groundColor:new ge};break;case"RectAreaLight":t={color:new ge,position:new E,halfWidth:new E,halfHeight:new E};break}return n[e.id]=t,t}}}function lw(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ne};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ne};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new ne,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let cw=0;function hw(n,e){return(e.castShadow?1:0)-(n.castShadow?1:0)}function uw(n,e){const t=new aw,i=lw(),s={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotShadow:[],spotShadowMap:[],spotShadowMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[]};for(let u=0;u<9;u++)s.probe.push(new E);const r=new E,o=new Se,a=new Se;function l(u,h){let d=0,p=0,g=0;for(let A=0;A<9;A++)s.probe[A].set(0,0,0);let m=0,f=0,_=0,v=0,b=0,x=0,C=0,w=0;u.sort(hw);const L=h!==!0?Math.PI:1;for(let A=0,I=u.length;A0&&(e.isWebGL2||n.has("OES_texture_float_linear")===!0?(s.rectAreaLTC1=se.LTC_FLOAT_1,s.rectAreaLTC2=se.LTC_FLOAT_2):n.has("OES_texture_half_float_linear")===!0?(s.rectAreaLTC1=se.LTC_HALF_1,s.rectAreaLTC2=se.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),s.ambient[0]=d,s.ambient[1]=p,s.ambient[2]=g;const y=s.hash;(y.directionalLength!==m||y.pointLength!==f||y.spotLength!==_||y.rectAreaLength!==v||y.hemiLength!==b||y.numDirectionalShadows!==x||y.numPointShadows!==C||y.numSpotShadows!==w)&&(s.directional.length=m,s.spot.length=_,s.rectArea.length=v,s.point.length=f,s.hemi.length=b,s.directionalShadow.length=x,s.directionalShadowMap.length=x,s.pointShadow.length=C,s.pointShadowMap.length=C,s.spotShadow.length=w,s.spotShadowMap.length=w,s.directionalShadowMatrix.length=x,s.pointShadowMatrix.length=C,s.spotShadowMatrix.length=w,y.directionalLength=m,y.pointLength=f,y.spotLength=_,y.rectAreaLength=v,y.hemiLength=b,y.numDirectionalShadows=x,y.numPointShadows=C,y.numSpotShadows=w,s.version=cw++)}function c(u,h){let d=0,p=0,g=0,m=0,f=0;const _=h.matrixWorldInverse;for(let v=0,b=u.length;v=t.get(r).length?(a=new Op(n,e),t.get(r).push(a)):a=t.get(r)[o],a}function s(){t=new WeakMap}return{get:i,dispose:s}}class pw extends Gt{constructor(e){super();this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=jx,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class fw extends Gt{constructor(e){super();this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.referencePosition=new E,this.nearDistance=1,this.farDistance=1e3,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const mw=`void main() { gl_Position = vec4( position, 1.0 ); }`,gw=`uniform sampler2D shadow_pass; uniform vec2 resolution; uniform float radius; #include void main() { const float samples = float( VSM_SAMPLES ); float mean = 0.0; float squared_mean = 0.0; float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); float uvStart = samples <= 1.0 ? 0.0 : - 1.0; for ( float i = 0.0; i < samples; i ++ ) { float uvOffset = uvStart + i * uvStride; #ifdef HORIZONTAL_PASS vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); mean += distribution.x; squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; #else float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); mean += depth; squared_mean += depth * depth; #endif } mean = mean / samples; squared_mean = squared_mean / samples; float std_dev = sqrt( squared_mean - mean * mean ); gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); }`;function _w(n,e,t){let i=new no;const s=new ne,r=new ne,o=new We,a=new pw({depthPacking:qx}),l=new fw,c={},u=t.maxTextureSize,h={0:Xt,1:Pi,2:Yt},d=new cn({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new ne},radius:{value:4}},vertexShader:mw,fragmentShader:gw}),p=d.clone();p.defines.HORIZONTAL_PASS=1;const g=new bt;g.setAttribute("position",new dt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const m=new ft(g,d),f=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=ld,this.render=function(x,C,w){if(f.enabled===!1||f.autoUpdate===!1&&f.needsUpdate===!1||x.length===0)return;const L=n.getRenderTarget(),y=n.getActiveCubeFace(),A=n.getActiveMipmapLevel(),I=n.state;I.setBlending(Nn),I.buffers.color.setClear(1,1,1,1),I.buffers.depth.setTest(!0),I.setScissorTest(!1);for(let R=0,Q=x.length;Ru||s.y>u)&&(s.x>u&&(r.x=Math.floor(u/z.x),s.x=r.x*z.x,D.mapSize.x=r.x),s.y>u&&(r.y=Math.floor(u/z.y),s.y=r.y*z.y,D.mapSize.y=r.y)),D.map===null){const j=this.type!==Is?{minFilter:_t,magFilter:_t}:{};D.map=new kn(s.x,s.y,j),D.map.texture.name=ee.name+".shadowMap",D.camera.updateProjectionMatrix()}n.setRenderTarget(D.map),n.clear();const k=D.getViewportCount();for(let j=0;j0){const Q=I.uuid,ee=C.uuid;let D=c[Q];D===void 0&&(D={},c[Q]=D);let z=D[ee];z===void 0&&(z=I.clone(),D[ee]=z),I=z}return I.visible=C.visible,I.wireframe=C.wireframe,A===Is?I.side=C.shadowSide!==null?C.shadowSide:C.side:I.side=C.shadowSide!==null?C.shadowSide:h[C.side],I.alphaMap=C.alphaMap,I.alphaTest=C.alphaTest,I.clipShadows=C.clipShadows,I.clippingPlanes=C.clippingPlanes,I.clipIntersection=C.clipIntersection,I.displacementMap=C.displacementMap,I.displacementScale=C.displacementScale,I.displacementBias=C.displacementBias,I.wireframeLinewidth=C.wireframeLinewidth,I.linewidth=C.linewidth,w.isPointLight===!0&&I.isMeshDistanceMaterial===!0&&(I.referencePosition.setFromMatrixPosition(w.matrixWorld),I.nearDistance=L,I.farDistance=y),I}function b(x,C,w,L,y){if(x.visible===!1)return;if(x.layers.test(C.layers)&&(x.isMesh||x.isLine||x.isPoints)&&(x.castShadow||x.receiveShadow&&y===Is)&&(!x.frustumCulled||i.intersectsObject(x))){x.modelViewMatrix.multiplyMatrices(w.matrixWorldInverse,x.matrixWorld);const R=e.update(x),Q=x.material;if(Array.isArray(Q)){const ee=R.groups;for(let D=0,z=ee.length;D=1):W.indexOf("OpenGL ES")!==-1&&(j=parseFloat(/^OpenGL ES (\d)/.exec(W)[1]),k=j>=2);let N=null,G={};const ie=n.getParameter(3088),K=n.getParameter(2978),ae=new We().fromArray(ie),xe=new We().fromArray(K);function Le(P,me,V){const fe=new Uint8Array(4),pe=n.createTexture();n.bindTexture(P,pe),n.texParameteri(P,10241,9728),n.texParameteri(P,10240,9728);for(let Ge=0;Gete||T.height>te)&&(oe=te/Math.max(T.width,T.height)),oe<1||M===!0)if(typeof HTMLImageElement!="undefined"&&T instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&T instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&T instanceof ImageBitmap){const de=M?Or:Math.floor,Pe=de(oe*T.width),$=de(oe*T.height);m===void 0&&(m=v(Pe,$));const Me=B?v(Pe,$):m;return Me.width=Pe,Me.height=$,Me.getContext("2d").drawImage(T,0,0,Pe,$),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+T.width+"x"+T.height+") to ("+Pe+"x"+$+")."),Me}else return"data"in T&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+T.width+"x"+T.height+")."),T;return T}function x(T){return Ta(T.width)&&Ta(T.height)}function C(T){return a?!1:T.wrapS!==Lt||T.wrapT!==Lt||T.minFilter!==_t&&T.minFilter!==Ze}function w(T,M){return T.generateMipmaps&&M&&T.minFilter!==_t&&T.minFilter!==Ze}function L(T){n.generateMipmap(T)}function y(T,M,B,te,oe=!1){if(a===!1)return M;if(T!==null){if(n[T]!==void 0)return n[T];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+T+"'")}let de=M;return M===6403&&(B===5126&&(de=33326),B===5131&&(de=33325),B===5121&&(de=33321)),M===33319&&(B===5126&&(de=33328),B===5131&&(de=33327),B===5121&&(de=33323)),M===6408&&(B===5126&&(de=34836),B===5131&&(de=34842),B===5121&&(de=te===He&&oe===!1?35907:32856),B===32819&&(de=32854),B===32820&&(de=32855)),(de===33325||de===33326||de===33327||de===33328||de===34842||de===34836)&&e.get("EXT_color_buffer_float"),de}function A(T,M,B){return w(T,B)===!0||T.isFramebufferTexture&&T.minFilter!==_t&&T.minFilter!==Ze?Math.log2(Math.max(M.width,M.height))+1:T.mipmaps!==void 0&&T.mipmaps.length>0?T.mipmaps.length:T.isCompressedTexture&&Array.isArray(T.image)?M.mipmaps.length:1}function I(T){return T===_t||T===ma||T===ga?9728:9729}function R(T){const M=T.target;M.removeEventListener("dispose",R),ee(M),M.isVideoTexture&&g.delete(M)}function Q(T){const M=T.target;M.removeEventListener("dispose",Q),z(M)}function ee(T){const M=i.get(T);if(M.__webglInit===void 0)return;const B=T.source,te=f.get(B);if(te){const oe=te[M.__cacheKey];oe.usedTimes--,oe.usedTimes===0&&D(T),Object.keys(te).length===0&&f.delete(B)}i.remove(T)}function D(T){const M=i.get(T);n.deleteTexture(M.__webglTexture);const B=T.source,te=f.get(B);delete te[M.__cacheKey],o.memory.textures--}function z(T){const M=T.texture,B=i.get(T),te=i.get(M);if(te.__webglTexture!==void 0&&(n.deleteTexture(te.__webglTexture),o.memory.textures--),T.depthTexture&&T.depthTexture.dispose(),T.isWebGLCubeRenderTarget)for(let oe=0;oe<6;oe++)n.deleteFramebuffer(B.__webglFramebuffer[oe]),B.__webglDepthbuffer&&n.deleteRenderbuffer(B.__webglDepthbuffer[oe]);else{if(n.deleteFramebuffer(B.__webglFramebuffer),B.__webglDepthbuffer&&n.deleteRenderbuffer(B.__webglDepthbuffer),B.__webglMultisampledFramebuffer&&n.deleteFramebuffer(B.__webglMultisampledFramebuffer),B.__webglColorRenderbuffer)for(let oe=0;oe=l&&console.warn("THREE.WebGLTextures: Trying to use "+T+" texture units while this GPU supports only "+l),k+=1,T}function N(T){const M=[];return M.push(T.wrapS),M.push(T.wrapT),M.push(T.magFilter),M.push(T.minFilter),M.push(T.anisotropy),M.push(T.internalFormat),M.push(T.format),M.push(T.type),M.push(T.generateMipmaps),M.push(T.premultiplyAlpha),M.push(T.flipY),M.push(T.unpackAlignment),M.push(T.encoding),M.join()}function G(T,M){const B=i.get(T);if(T.isVideoTexture&&Qe(T),T.isRenderTargetTexture===!1&&T.version>0&&B.__version!==T.version){const te=T.image;if(te===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(te.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{Ae(B,T,M);return}}t.activeTexture(33984+M),t.bindTexture(3553,B.__webglTexture)}function ie(T,M){const B=i.get(T);if(T.version>0&&B.__version!==T.version){Ae(B,T,M);return}t.activeTexture(33984+M),t.bindTexture(35866,B.__webglTexture)}function K(T,M){const B=i.get(T);if(T.version>0&&B.__version!==T.version){Ae(B,T,M);return}t.activeTexture(33984+M),t.bindTexture(32879,B.__webglTexture)}function ae(T,M){const B=i.get(T);if(T.version>0&&B.__version!==T.version){Re(B,T,M);return}t.activeTexture(33984+M),t.bindTexture(34067,B.__webglTexture)}const xe={[ti]:10497,[Lt]:33071,[Ir]:33648},Le={[_t]:9728,[ma]:9984,[ga]:9986,[Ze]:9729,[_d]:9985,[ni]:9987};function X(T,M,B){if(B?(n.texParameteri(T,10242,xe[M.wrapS]),n.texParameteri(T,10243,xe[M.wrapT]),(T===32879||T===35866)&&n.texParameteri(T,32882,xe[M.wrapR]),n.texParameteri(T,10240,Le[M.magFilter]),n.texParameteri(T,10241,Le[M.minFilter])):(n.texParameteri(T,10242,33071),n.texParameteri(T,10243,33071),(T===32879||T===35866)&&n.texParameteri(T,32882,33071),(M.wrapS!==Lt||M.wrapT!==Lt)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(T,10240,I(M.magFilter)),n.texParameteri(T,10241,I(M.minFilter)),M.minFilter!==_t&&M.minFilter!==Ze&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),e.has("EXT_texture_filter_anisotropic")===!0){const te=e.get("EXT_texture_filter_anisotropic");if(M.type===Bt&&e.has("OES_texture_float_linear")===!1||a===!1&&M.type===Jt&&e.has("OES_texture_half_float_linear")===!1)return;(M.anisotropy>1||i.get(M).__currentAnisotropy)&&(n.texParameterf(T,te.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(M.anisotropy,s.getMaxAnisotropy())),i.get(M).__currentAnisotropy=M.anisotropy)}}function Ne(T,M){let B=!1;T.__webglInit===void 0&&(T.__webglInit=!0,M.addEventListener("dispose",R));const te=M.source;let oe=f.get(te);oe===void 0&&(oe={},f.set(te,oe));const de=N(M);if(de!==T.__cacheKey){oe[de]===void 0&&(oe[de]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,B=!0),oe[de].usedTimes++;const Pe=oe[T.__cacheKey];Pe!==void 0&&(oe[T.__cacheKey].usedTimes--,Pe.usedTimes===0&&D(M)),T.__cacheKey=de,T.__webglTexture=oe[de].texture}return B}function Ae(T,M,B){let te=3553;M.isDataArrayTexture&&(te=35866),M.isData3DTexture&&(te=32879);const oe=Ne(T,M),de=M.source;if(t.activeTexture(33984+B),t.bindTexture(te,T.__webglTexture),de.version!==de.__currentVersion||oe===!0){n.pixelStorei(37440,M.flipY),n.pixelStorei(37441,M.premultiplyAlpha),n.pixelStorei(3317,M.unpackAlignment),n.pixelStorei(37443,0);const Pe=C(M)&&x(M.image)===!1;let $=b(M.image,Pe,!1,u);$=Je(M,$);const Me=x($)||a,_e=r.convert(M.format,M.encoding);let Ce=r.convert(M.type),ve=y(M.internalFormat,_e,Ce,M.encoding,M.isVideoTexture);X(te,M,Me);let Fe;const qe=M.mipmaps,rt=a&&M.isVideoTexture!==!0,P=de.__currentVersion===void 0||oe===!0,me=A(M,$,Me);if(M.isDepthTexture)ve=6402,a?M.type===Bt?ve=36012:M.type===si?ve=33190:M.type===Ni?ve=35056:ve=33189:M.type===Bt&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),M.format===ri&&ve===6402&&M.type!==yd&&M.type!==si&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),M.type=si,Ce=r.convert(M.type)),M.format===ki&&ve===6402&&(ve=34041,M.type!==Ni&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),M.type=Ni,Ce=r.convert(M.type))),P&&(rt?t.texStorage2D(3553,1,ve,$.width,$.height):t.texImage2D(3553,0,ve,$.width,$.height,0,_e,Ce,null));else if(M.isDataTexture)if(qe.length>0&&Me){rt&&P&&t.texStorage2D(3553,me,ve,qe[0].width,qe[0].height);for(let V=0,fe=qe.length;V>=1,fe>>=1}}else if(qe.length>0&&Me){rt&&P&&t.texStorage2D(3553,me,ve,qe[0].width,qe[0].height);for(let V=0,fe=qe.length;V0&&P++,t.texStorage2D(34067,P,Fe,$[0].width,$[0].height));for(let V=0;V<6;V++)if(Pe){qe?t.texSubImage2D(34069+V,0,0,0,$[V].width,$[V].height,Ce,ve,$[V].data):t.texImage2D(34069+V,0,Fe,$[V].width,$[V].height,0,Ce,ve,$[V].data);for(let fe=0;fe0&&we(T)===!1){const $=de?M:[M];B.__webglMultisampledFramebuffer=n.createFramebuffer(),B.__webglColorRenderbuffer=[],t.bindFramebuffer(36160,B.__webglMultisampledFramebuffer);for(let Me=0;Me<$.length;Me++){const _e=$[Me];B.__webglColorRenderbuffer[Me]=n.createRenderbuffer(),n.bindRenderbuffer(36161,B.__webglColorRenderbuffer[Me]);const Ce=r.convert(_e.format,_e.encoding),ve=r.convert(_e.type),Fe=y(_e.internalFormat,Ce,ve,_e.encoding),qe=Te(T);n.renderbufferStorageMultisample(36161,qe,Fe,T.width,T.height),n.framebufferRenderbuffer(36160,36064+Me,36161,B.__webglColorRenderbuffer[Me])}n.bindRenderbuffer(36161,null),T.depthBuffer&&(B.__webglDepthRenderbuffer=n.createRenderbuffer(),Ue(B.__webglDepthRenderbuffer,T,!0)),t.bindFramebuffer(36160,null)}}if(oe){t.bindTexture(34067,te.__webglTexture),X(34067,M,Pe);for(let $=0;$<6;$++)ue(B.__webglFramebuffer[$],T,M,36064,34069+$);w(M,Pe)&&L(34067),t.unbindTexture()}else if(de){const $=T.texture;for(let Me=0,_e=$.length;Me<_e;Me++){const Ce=$[Me],ve=i.get(Ce);t.bindTexture(3553,ve.__webglTexture),X(3553,Ce,Pe),ue(B.__webglFramebuffer,T,Ce,36064+Me,3553),w(Ce,Pe)&&L(3553)}t.unbindTexture()}else{let $=3553;(T.isWebGL3DRenderTarget||T.isWebGLArrayRenderTarget)&&(a?$=T.isWebGL3DRenderTarget?32879:35866:console.error("THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.")),t.bindTexture($,te.__webglTexture),X($,M,Pe),ue(B.__webglFramebuffer,T,M,36064,$),w(M,Pe)&&L($),t.unbindTexture()}T.depthBuffer&&q(T)}function he(T){const M=x(T)||a,B=T.isWebGLMultipleRenderTargets===!0?T.texture:[T.texture];for(let te=0,oe=B.length;te0&&we(T)===!1){const M=T.isWebGLMultipleRenderTargets?T.texture:[T.texture],B=T.width,te=T.height;let oe=16384;const de=[],Pe=T.stencilBuffer?33306:36096,$=i.get(T),Me=T.isWebGLMultipleRenderTargets===!0;if(Me)for(let _e=0;_e0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&M.__useRenderToTexture!==!1}function Qe(T){const M=o.render.frame;g.get(T)!==M&&(g.set(T,M),T.update())}function Je(T,M){const B=T.encoding,te=T.format,oe=T.type;return T.isCompressedTexture===!0||T.isVideoTexture===!0||T.format===wa||B!==ln&&(B===He?a===!1?e.has("EXT_sRGB")===!0&&te===Zt?(T.format=wa,T.minFilter=Ze,T.generateMipmaps=!1):M=jd.sRGBToLinear(M):(te!==Zt||oe!==ii)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",B)),M}this.allocateTextureUnit=W,this.resetTextureUnits=j,this.setTexture2D=G,this.setTexture2DArray=ie,this.setTexture3D=K,this.setTextureCube=ae,this.rebindTextures=re,this.setupRenderTarget=be,this.updateRenderTargetMipmap=he,this.updateMultisampleRenderTarget=Ie,this.setupDepthRenderbuffer=q,this.setupFrameBufferTexture=ue,this.useMultisampledRTT=we}function xw(n,e,t){const i=t.isWebGL2;function s(r,o=null){let a;if(r===ii)return 5121;if(r===Lx)return 32819;if(r===Rx)return 32820;if(r===Ax)return 5120;if(r===Tx)return 5122;if(r===yd)return 5123;if(r===Ex)return 5124;if(r===si)return 5125;if(r===Bt)return 5126;if(r===Jt)return i?5131:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(r===Px)return 6406;if(r===Zt)return 6408;if(r===Dx)return 6409;if(r===Fx)return 6410;if(r===ri)return 6402;if(r===ki)return 34041;if(r===Ox)return 6403;if(r===Ix)return console.warn("THREE.WebGLRenderer: THREE.RGBFormat has been removed. Use THREE.RGBAFormat instead. https://github.com/mrdoob/three.js/pull/23228"),6408;if(r===wa)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(r===Nx)return 36244;if(r===kx)return 33319;if(r===Bx)return 33320;if(r===$x)return 36249;if(r===_a||r===ya||r===va||r===xa)if(o===He)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(r===_a)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===ya)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===va)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===xa)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(r===_a)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===ya)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===va)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===xa)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===vd||r===xd||r===bd||r===Md)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(r===vd)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===xd)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===bd)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===Md)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===Ux)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(r===Sd||r===Cd)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(r===Sd)return o===He?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(r===Cd)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(r===wd||r===Ad||r===Td||r===Ed||r===Ld||r===Rd||r===Pd||r===Id||r===Dd||r===Fd||r===Od||r===Nd||r===kd||r===Bd)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(r===wd)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===Ad)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===Td)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===Ed)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===Ld)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===Rd)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===Pd)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===Id)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===Dd)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===Fd)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===Od)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===Nd)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===kd)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===Bd)return o===He?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===$d)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(r===$d)return o===He?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;return r===Ni?i?34042:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):n[r]!==void 0?n[r]:null}return{convert:s}}class bw extends St{constructor(e=[]){super();this.isArrayCamera=!0,this.cameras=e}}class sn extends st{constructor(){super();this.isGroup=!0,this.type="Group"}}const Mw={type:"move"};class rl{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new sn,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new sn,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new E,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new E),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new sn,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new E,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new E),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,i){let s=null,r=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const m of e.hand.values()){const f=t.getJointPose(m,i);if(c.joints[m.jointName]===void 0){const v=new sn;v.matrixAutoUpdate=!1,v.visible=!1,c.joints[m.jointName]=v,c.add(v)}const _=c.joints[m.jointName];f!==null&&(_.matrix.fromArray(f.transform.matrix),_.matrix.decompose(_.position,_.rotation,_.scale),_.jointRadius=f.radius),_.visible=f!==null}const u=c.joints["index-finger-tip"],h=c.joints["thumb-tip"],d=u.position.distanceTo(h.position),p=.02,g=.005;c.inputState.pinching&&d>p+g?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&d<=p-g&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(r=t.getPose(e.gripSpace,i),r!==null&&(l.matrix.fromArray(r.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),r.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(r.linearVelocity)):l.hasLinearVelocity=!1,r.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(r.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(s=t.getPose(e.targetRaySpace,i),s===null&&r!==null&&(s=r),s!==null&&(a.matrix.fromArray(s.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),s.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(s.linearVelocity)):a.hasLinearVelocity=!1,s.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(s.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(Mw)))}return a!==null&&(a.visible=s!==null),l!==null&&(l.visible=r!==null),c!==null&&(c.visible=o!==null),this}}class Sw extends yt{constructor(e,t,i,s,r,o,a,l,c,u){if(u=u!==void 0?u:ri,u!==ri&&u!==ki)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");i===void 0&&u===ri&&(i=si),i===void 0&&u===ki&&(i=Ni);super(null,s,r,o,a,l,u,i,c);this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=a!==void 0?a:_t,this.minFilter=l!==void 0?l:_t,this.flipY=!1,this.generateMipmaps=!1}}class Cw extends ai{constructor(e,t){super();const i=this;let s=null,r=1,o=null,a="local-floor",l=null,c=null,u=null,h=null,d=null,p=null;const g=t.getContextAttributes();let m=null,f=null;const _=[],v=[],b=new St;b.layers.enable(1),b.viewport=new We;const x=new St;x.layers.enable(2),x.viewport=new We;const C=[b,x],w=new bw;w.layers.enable(1),w.layers.enable(2);let L=null,y=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(N){let G=_[N];return G===void 0&&(G=new rl,_[N]=G),G.getTargetRaySpace()},this.getControllerGrip=function(N){let G=_[N];return G===void 0&&(G=new rl,_[N]=G),G.getGripSpace()},this.getHand=function(N){let G=_[N];return G===void 0&&(G=new rl,_[N]=G),G.getHandSpace()};function A(N){const G=v.indexOf(N.inputSource);if(G===-1)return;const ie=_[G];ie!==void 0&&ie.dispatchEvent({type:N.type,data:N.inputSource})}function I(){s.removeEventListener("select",A),s.removeEventListener("selectstart",A),s.removeEventListener("selectend",A),s.removeEventListener("squeeze",A),s.removeEventListener("squeezestart",A),s.removeEventListener("squeezeend",A),s.removeEventListener("end",I),s.removeEventListener("inputsourceschange",R);for(let N=0;N<_.length;N++){const G=v[N];G!==null&&(v[N]=null,_[N].disconnect(G))}L=null,y=null,e.setRenderTarget(m),d=null,h=null,u=null,s=null,f=null,W.stop(),i.isPresenting=!1,i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(N){r=N,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(N){a=N,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||o},this.setReferenceSpace=function(N){l=N},this.getBaseLayer=function(){return h!==null?h:d},this.getBinding=function(){return u},this.getFrame=function(){return p},this.getSession=function(){return s},this.setSession=async function(N){if(s=N,s!==null){if(m=e.getRenderTarget(),s.addEventListener("select",A),s.addEventListener("selectstart",A),s.addEventListener("selectend",A),s.addEventListener("squeeze",A),s.addEventListener("squeezestart",A),s.addEventListener("squeezeend",A),s.addEventListener("end",I),s.addEventListener("inputsourceschange",R),g.xrCompatible!==!0&&await t.makeXRCompatible(),s.renderState.layers===void 0||e.capabilities.isWebGL2===!1){const G={antialias:s.renderState.layers===void 0?g.antialias:!0,alpha:g.alpha,depth:g.depth,stencil:g.stencil,framebufferScaleFactor:r};d=new XRWebGLLayer(s,t,G),s.updateRenderState({baseLayer:d}),f=new kn(d.framebufferWidth,d.framebufferHeight,{format:Zt,type:ii,encoding:e.outputEncoding})}else{let G=null,ie=null,K=null;g.depth&&(K=g.stencil?35056:33190,G=g.stencil?ki:ri,ie=g.stencil?Ni:si);const ae={colorFormat:32856,depthFormat:K,scaleFactor:r};u=new XRWebGLBinding(s,t),h=u.createProjectionLayer(ae),s.updateRenderState({layers:[h]}),f=new kn(h.textureWidth,h.textureHeight,{format:Zt,type:ii,depthTexture:new Sw(h.textureWidth,h.textureHeight,ie,void 0,void 0,void 0,void 0,void 0,void 0,G),stencilBuffer:g.stencil,encoding:e.outputEncoding,samples:g.antialias?4:0});const xe=e.properties.get(f);xe.__ignoreDepthValues=h.ignoreDepthValues}f.isXRRenderTarget=!0,this.setFoveation(1),l=null,o=await s.requestReferenceSpace(a),W.setContext(s),W.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}};function R(N){for(let G=0;G=0&&(v[K]=null,_[K].dispatchEvent({type:"disconnected",data:ie}))}for(let G=0;G=v.length){v.push(ie),K=xe;break}else if(v[xe]===null){v[xe]=ie,K=xe;break}if(K===-1)break}const ae=_[K];ae&&ae.dispatchEvent({type:"connected",data:ie})}}const Q=new E,ee=new E;function D(N,G,ie){Q.setFromMatrixPosition(G.matrixWorld),ee.setFromMatrixPosition(ie.matrixWorld);const K=Q.distanceTo(ee),ae=G.projectionMatrix.elements,xe=ie.projectionMatrix.elements,Le=ae[14]/(ae[10]-1),X=ae[14]/(ae[10]+1),Ne=(ae[9]+1)/ae[5],Ae=(ae[9]-1)/ae[5],Re=(ae[8]-1)/ae[0],ue=(xe[8]+1)/xe[0],Ue=Le*Re,Y=Le*ue,q=K/(-Re+ue),re=q*-Re;G.matrixWorld.decompose(N.position,N.quaternion,N.scale),N.translateX(re),N.translateZ(q),N.matrixWorld.compose(N.position,N.quaternion,N.scale),N.matrixWorldInverse.copy(N.matrixWorld).invert();const be=Le+q,he=X+q,Ie=Ue-re,Te=Y+(K-re),we=Ne*X/he*be,Qe=Ae*X/he*be;N.projectionMatrix.makePerspective(Ie,Te,we,Qe,be,he)}function z(N,G){G===null?N.matrixWorld.copy(N.matrix):N.matrixWorld.multiplyMatrices(G.matrixWorld,N.matrix),N.matrixWorldInverse.copy(N.matrixWorld).invert()}this.updateCamera=function(N){if(s===null)return;w.near=x.near=b.near=N.near,w.far=x.far=b.far=N.far,(L!==w.near||y!==w.far)&&(s.updateRenderState({depthNear:w.near,depthFar:w.far}),L=w.near,y=w.far);const G=N.parent,ie=w.cameras;z(w,G);for(let ae=0;ae0&&(m.alphaTest.value=f.alphaTest);const _=e.get(f).envMap;if(_&&(m.envMap.value=_,m.flipEnvMap.value=_.isCubeTexture&&_.isRenderTargetTexture===!1?-1:1,m.reflectivity.value=f.reflectivity,m.ior.value=f.ior,m.refractionRatio.value=f.refractionRatio),f.lightMap){m.lightMap.value=f.lightMap;const x=n.physicallyCorrectLights!==!0?Math.PI:1;m.lightMapIntensity.value=f.lightMapIntensity*x}f.aoMap&&(m.aoMap.value=f.aoMap,m.aoMapIntensity.value=f.aoMapIntensity);let v;f.map?v=f.map:f.specularMap?v=f.specularMap:f.displacementMap?v=f.displacementMap:f.normalMap?v=f.normalMap:f.bumpMap?v=f.bumpMap:f.roughnessMap?v=f.roughnessMap:f.metalnessMap?v=f.metalnessMap:f.alphaMap?v=f.alphaMap:f.emissiveMap?v=f.emissiveMap:f.clearcoatMap?v=f.clearcoatMap:f.clearcoatNormalMap?v=f.clearcoatNormalMap:f.clearcoatRoughnessMap?v=f.clearcoatRoughnessMap:f.iridescenceMap?v=f.iridescenceMap:f.iridescenceThicknessMap?v=f.iridescenceThicknessMap:f.specularIntensityMap?v=f.specularIntensityMap:f.specularColorMap?v=f.specularColorMap:f.transmissionMap?v=f.transmissionMap:f.thicknessMap?v=f.thicknessMap:f.sheenColorMap?v=f.sheenColorMap:f.sheenRoughnessMap&&(v=f.sheenRoughnessMap),v!==void 0&&(v.isWebGLRenderTarget&&(v=v.texture),v.matrixAutoUpdate===!0&&v.updateMatrix(),m.uvTransform.value.copy(v.matrix));let b;f.aoMap?b=f.aoMap:f.lightMap&&(b=f.lightMap),b!==void 0&&(b.isWebGLRenderTarget&&(b=b.texture),b.matrixAutoUpdate===!0&&b.updateMatrix(),m.uv2Transform.value.copy(b.matrix))}function r(m,f){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity}function o(m,f){m.dashSize.value=f.dashSize,m.totalSize.value=f.dashSize+f.gapSize,m.scale.value=f.scale}function a(m,f,_,v){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,m.size.value=f.size*_,m.scale.value=v*.5,f.map&&(m.map.value=f.map),f.alphaMap&&(m.alphaMap.value=f.alphaMap),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest);let b;f.map?b=f.map:f.alphaMap&&(b=f.alphaMap),b!==void 0&&(b.matrixAutoUpdate===!0&&b.updateMatrix(),m.uvTransform.value.copy(b.matrix))}function l(m,f){m.diffuse.value.copy(f.color),m.opacity.value=f.opacity,m.rotation.value=f.rotation,f.map&&(m.map.value=f.map),f.alphaMap&&(m.alphaMap.value=f.alphaMap),f.alphaTest>0&&(m.alphaTest.value=f.alphaTest);let _;f.map?_=f.map:f.alphaMap&&(_=f.alphaMap),_!==void 0&&(_.matrixAutoUpdate===!0&&_.updateMatrix(),m.uvTransform.value.copy(_.matrix))}function c(m,f){m.specular.value.copy(f.specular),m.shininess.value=Math.max(f.shininess,1e-4)}function u(m,f){f.gradientMap&&(m.gradientMap.value=f.gradientMap)}function h(m,f){m.roughness.value=f.roughness,m.metalness.value=f.metalness,f.roughnessMap&&(m.roughnessMap.value=f.roughnessMap),f.metalnessMap&&(m.metalnessMap.value=f.metalnessMap),e.get(f).envMap&&(m.envMapIntensity.value=f.envMapIntensity)}function d(m,f,_){m.ior.value=f.ior,f.sheen>0&&(m.sheenColor.value.copy(f.sheenColor).multiplyScalar(f.sheen),m.sheenRoughness.value=f.sheenRoughness,f.sheenColorMap&&(m.sheenColorMap.value=f.sheenColorMap),f.sheenRoughnessMap&&(m.sheenRoughnessMap.value=f.sheenRoughnessMap)),f.clearcoat>0&&(m.clearcoat.value=f.clearcoat,m.clearcoatRoughness.value=f.clearcoatRoughness,f.clearcoatMap&&(m.clearcoatMap.value=f.clearcoatMap),f.clearcoatRoughnessMap&&(m.clearcoatRoughnessMap.value=f.clearcoatRoughnessMap),f.clearcoatNormalMap&&(m.clearcoatNormalScale.value.copy(f.clearcoatNormalScale),m.clearcoatNormalMap.value=f.clearcoatNormalMap,f.side===Xt&&m.clearcoatNormalScale.value.negate())),f.iridescence>0&&(m.iridescence.value=f.iridescence,m.iridescenceIOR.value=f.iridescenceIOR,m.iridescenceThicknessMinimum.value=f.iridescenceThicknessRange[0],m.iridescenceThicknessMaximum.value=f.iridescenceThicknessRange[1],f.iridescenceMap&&(m.iridescenceMap.value=f.iridescenceMap),f.iridescenceThicknessMap&&(m.iridescenceThicknessMap.value=f.iridescenceThicknessMap)),f.transmission>0&&(m.transmission.value=f.transmission,m.transmissionSamplerMap.value=_.texture,m.transmissionSamplerSize.value.set(_.width,_.height),f.transmissionMap&&(m.transmissionMap.value=f.transmissionMap),m.thickness.value=f.thickness,f.thicknessMap&&(m.thicknessMap.value=f.thicknessMap),m.attenuationDistance.value=f.attenuationDistance,m.attenuationColor.value.copy(f.attenuationColor)),m.specularIntensity.value=f.specularIntensity,m.specularColor.value.copy(f.specularColor),f.specularIntensityMap&&(m.specularIntensityMap.value=f.specularIntensityMap),f.specularColorMap&&(m.specularColorMap.value=f.specularColorMap)}function p(m,f){f.matcap&&(m.matcap.value=f.matcap)}function g(m,f){m.referencePosition.value.copy(f.referencePosition),m.nearDistance.value=f.nearDistance,m.farDistance.value=f.farDistance}return{refreshFogUniforms:t,refreshMaterialUniforms:i}}function Aw(n,e,t,i){let s={},r={},o=[];const a=t.isWebGL2?n.getParameter(35375):0;function l(v,b){const x=b.program;i.uniformBlockBinding(v,x)}function c(v,b){let x=s[v.id];x===void 0&&(g(v),x=u(v),s[v.id]=x,v.addEventListener("dispose",f));const C=b.program;i.updateUBOMapping(v,C);const w=e.render.frame;r[v.id]!==w&&(d(v),r[v.id]=w)}function u(v){const b=h();v.__bindingPointIndex=b;const x=n.createBuffer(),C=v.__size,w=v.usage;return n.bindBuffer(35345,x),n.bufferData(35345,C,w),n.bindBuffer(35345,null),n.bindBufferBase(35345,b,x),x}function h(){for(let v=0;v0){w=x%C;const R=C-w;w!==0&&R-I.boundary<0&&(x+=C-w,A.__offset=x)}x+=I.storage}return w=x%C,w>0&&(x+=C-w),v.__size=x,v.__cache={},this}function m(v){const b=v.value,x={boundary:0,storage:0};return typeof b=="number"?(x.boundary=4,x.storage=4):b.isVector2?(x.boundary=8,x.storage=8):b.isVector3||b.isColor?(x.boundary=16,x.storage=12):b.isVector4?(x.boundary=16,x.storage=16):b.isMatrix3?(x.boundary=48,x.storage=48):b.isMatrix4?(x.boundary=64,x.storage=64):b.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",b),x}function f(v){const b=v.target;b.removeEventListener("dispose",f);const x=o.indexOf(b.__bindingPointIndex);o.splice(x,1),n.deleteBuffer(s[b.id]),delete s[b.id],delete r[b.id]}function _(){for(const v in s)n.deleteBuffer(s[v]);o=[],s={},r={}}return{bind:l,update:c,dispose:_}}function Tw(){const n=ks("canvas");return n.style.display="block",n}function Np(n={}){this.isWebGLRenderer=!0;const e=n.canvas!==void 0?n.canvas:Tw(),t=n.context!==void 0?n.context:null,i=n.depth!==void 0?n.depth:!0,s=n.stencil!==void 0?n.stencil:!0,r=n.antialias!==void 0?n.antialias:!1,o=n.premultipliedAlpha!==void 0?n.premultipliedAlpha:!0,a=n.preserveDrawingBuffer!==void 0?n.preserveDrawingBuffer:!1,l=n.powerPreference!==void 0?n.powerPreference:"default",c=n.failIfMajorPerformanceCaveat!==void 0?n.failIfMajorPerformanceCaveat:!1;let u;t!==null?u=t.getContextAttributes().alpha:u=n.alpha!==void 0?n.alpha:!1;let h=null,d=null;const p=[],g=[];this.domElement=e,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.outputEncoding=ln,this.physicallyCorrectLights=!1,this.toneMapping=gn,this.toneMappingExposure=1,Object.defineProperties(this,{gammaFactor:{get:function(){return console.warn("THREE.WebGLRenderer: .gammaFactor has been removed."),2},set:function(){console.warn("THREE.WebGLRenderer: .gammaFactor has been removed.")}}});const m=this;let f=!1,_=0,v=0,b=null,x=-1,C=null;const w=new We,L=new We;let y=null,A=e.width,I=e.height,R=1,Q=null,ee=null;const D=new We(0,0,A,I),z=new We(0,0,A,I);let k=!1;const j=new no;let W=!1,N=!1,G=null;const ie=new Se,K=new ne,ae=new E,xe={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function Le(){return b===null?R:1}let X=t;function Ne(S,F){for(let U=0;U0?d=g[g.length-1]:d=null,p.pop(),p.length>0?h=p[p.length-1]:h=null};function Zn(S,F,U,O){if(S.visible===!1)return;if(S.layers.test(F.layers)){if(S.isGroup)U=S.renderOrder;else if(S.isLOD)S.autoUpdate===!0&&S.update(F);else if(S.isLight)d.pushLight(S),S.castShadow&&d.pushShadow(S);else if(S.isSprite){if(!S.frustumCulled||j.intersectsSprite(S)){O&&ae.setFromMatrixPosition(S.matrixWorld).applyMatrix4(ie);const De=Te.update(S),ke=S.material;ke.visible&&h.push(S,De,ke,U,ae.z,null)}}else if((S.isMesh||S.isLine||S.isPoints)&&(S.isSkinnedMesh&&S.skeleton.frame!==Ue.render.frame&&(S.skeleton.update(),S.skeleton.frame=Ue.render.frame),!S.frustumCulled||j.intersectsObject(S))){O&&ae.setFromMatrixPosition(S.matrixWorld).applyMatrix4(ie);const De=Te.update(S),ke=S.material;if(Array.isArray(ke)){const Oe=De.groups;for(let Ye=0,ze=Oe.length;Ye0&&On(J,F,U),O&&ue.viewport(w.copy(O)),J.length>0&&Wt(J,F,U),Ee.length>0&&Wt(Ee,F,U),De.length>0&&Wt(De,F,U),ue.buffers.depth.setTest(!0),ue.buffers.depth.setMask(!0),ue.buffers.color.setMask(!0),ue.setPolygonOffset(!1)}function On(S,F,U){const O=Re.isWebGL2;G===null&&(G=new kn(1,1,{generateMipmaps:!0,type:Ae.has("EXT_color_buffer_half_float")?Jt:ii,minFilter:ni,samples:O&&r===!0?4:0})),m.getDrawingBufferSize(K),O?G.setSize(K.x,K.y):G.setSize(Or(K.x),Or(K.y));const J=m.getRenderTarget();m.setRenderTarget(G),m.clear();const Ee=m.toneMapping;m.toneMapping=gn,Wt(S,F,U),m.toneMapping=Ee,q.updateMultisampleRenderTarget(G),q.updateRenderTargetMipmap(G),m.setRenderTarget(J)}function Wt(S,F,U){const O=F.isScene===!0?F.overrideMaterial:null;for(let J=0,Ee=S.length;J0&&q.useMultisampledRTT(S)===!1?J=Y.get(S).__webglMultisampledFramebuffer:J=Ye,w.copy(S.viewport),L.copy(S.scissor),y=S.scissorTest}else w.copy(D).multiplyScalar(R).floor(),L.copy(z).multiplyScalar(R).floor(),y=k;if(ue.bindFramebuffer(36160,J)&&Re.drawBuffers&&O&&ue.drawBuffers(S,J),ue.viewport(w),ue.scissor(L),ue.setScissorTest(y),Ee){const Oe=Y.get(S.texture);X.framebufferTexture2D(36160,36064,34069+F,Oe.__webglTexture,U)}else if(De){const Oe=Y.get(S.texture),Ye=F||0;X.framebufferTextureLayer(36160,36064,Oe.__webglTexture,U||0,Ye)}x=-1},this.readRenderTargetPixels=function(S,F,U,O,J,Ee,De){if(!(S&&S.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let ke=Y.get(S).__webglFramebuffer;if(S.isWebGLCubeRenderTarget&&De!==void 0&&(ke=ke[De]),ke){ue.bindFramebuffer(36160,ke);try{const Oe=S.texture,Ye=Oe.format,ze=Oe.type;if(Ye!==Zt&&$.convert(Ye)!==X.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const Ve=ze===Jt&&(Ae.has("EXT_color_buffer_half_float")||Re.isWebGL2&&Ae.has("EXT_color_buffer_float"));if(ze!==ii&&$.convert(ze)!==X.getParameter(35738)&&!(ze===Bt&&(Re.isWebGL2||Ae.has("OES_texture_float")||Ae.has("WEBGL_color_buffer_float")))&&!Ve){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}F>=0&&F<=S.width-O&&U>=0&&U<=S.height-J&&X.readPixels(F,U,O,J,$.convert(Ye),$.convert(ze),Ee)}finally{const Oe=b!==null?Y.get(b).__webglFramebuffer:null;ue.bindFramebuffer(36160,Oe)}}},this.copyFramebufferToTexture=function(S,F,U=0){const O=Math.pow(2,-U),J=Math.floor(F.image.width*O),Ee=Math.floor(F.image.height*O);q.setTexture2D(F,0),X.copyTexSubImage2D(3553,U,0,0,S.x,S.y,J,Ee),ue.unbindTexture()},this.copyTextureToTexture=function(S,F,U,O=0){const J=F.image.width,Ee=F.image.height,De=$.convert(U.format),ke=$.convert(U.type);q.setTexture2D(U,0),X.pixelStorei(37440,U.flipY),X.pixelStorei(37441,U.premultiplyAlpha),X.pixelStorei(3317,U.unpackAlignment),F.isDataTexture?X.texSubImage2D(3553,O,S.x,S.y,J,Ee,De,ke,F.image.data):F.isCompressedTexture?X.compressedTexSubImage2D(3553,O,S.x,S.y,F.mipmaps[0].width,F.mipmaps[0].height,De,F.mipmaps[0].data):X.texSubImage2D(3553,O,S.x,S.y,De,ke,F.image),O===0&&U.generateMipmaps&&X.generateMipmap(3553),ue.unbindTexture()},this.copyTextureToTexture3D=function(S,F,U,O,J=0){if(m.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const Ee=S.max.x-S.min.x+1,De=S.max.y-S.min.y+1,ke=S.max.z-S.min.z+1,Oe=$.convert(O.format),Ye=$.convert(O.type);let ze;if(O.isData3DTexture)q.setTexture3D(O,0),ze=32879;else if(O.isDataArrayTexture)q.setTexture2DArray(O,0),ze=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}X.pixelStorei(37440,O.flipY),X.pixelStorei(37441,O.premultiplyAlpha),X.pixelStorei(3317,O.unpackAlignment);const Ve=X.getParameter(3314),it=X.getParameter(32878),Si=X.getParameter(3316),Ms=X.getParameter(3315),Ss=X.getParameter(32877),fn=U.isCompressedTexture?U.mipmaps[0]:U.image;X.pixelStorei(3314,fn.width),X.pixelStorei(32878,fn.height),X.pixelStorei(3316,S.min.x),X.pixelStorei(3315,S.min.y),X.pixelStorei(32877,S.min.z),U.isDataTexture||U.isData3DTexture?X.texSubImage3D(ze,J,F.x,F.y,F.z,Ee,De,ke,Oe,Ye,fn.data):U.isCompressedTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),X.compressedTexSubImage3D(ze,J,F.x,F.y,F.z,Ee,De,ke,Oe,fn.data)):X.texSubImage3D(ze,J,F.x,F.y,F.z,Ee,De,ke,Oe,Ye,fn),X.pixelStorei(3314,Ve),X.pixelStorei(32878,it),X.pixelStorei(3316,Si),X.pixelStorei(3315,Ms),X.pixelStorei(32877,Ss),J===0&&O.generateMipmaps&&X.generateMipmap(ze),ue.unbindTexture()},this.initTexture=function(S){S.isCubeTexture?q.setTextureCube(S,0):S.isData3DTexture?q.setTexture3D(S,0):S.isDataArrayTexture?q.setTexture2DArray(S,0):q.setTexture2D(S,0),ue.unbindTexture()},this.resetState=function(){_=0,v=0,b=null,ue.reset(),Me.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}class Ew extends Np{}Ew.prototype.isWebGL1Renderer=!0;class Lw extends st{constructor(){super();this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.overrideMaterial=null,this.autoUpdate=!0,typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.autoUpdate=e.autoUpdate,this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),t}}class Rw{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=Ca,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=$t()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,i){e*=this.stride,i*=t.stride;for(let s=0,r=this.stride;sl)continue;d.applyMatrix4(this.matrixWorld);const y=e.ray.origin.distanceTo(d);ye.far||t.push({distance:y,point:h.clone().applyMatrix4(this.matrixWorld),index:b,face:null,faceIndex:null,object:this})}}else{const _=Math.max(0,o.start),v=Math.min(f.count,o.start+o.count);for(let b=_,x=v-1;bl)continue;d.applyMatrix4(this.matrixWorld);const w=e.ray.origin.distanceTo(d);we.far||t.push({distance:w,point:h.clone().applyMatrix4(this.matrixWorld),index:b,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){const s=t[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;r0){const s=t[i[0]];if(s!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let r=0,o=s.length;rs.far)return;r.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}class Nw extends yt{constructor(e,t,i,s,r,o,a,l,c){super(e,t,i,s,r,o,a,l,c);this.isVideoTexture=!0,this.minFilter=o!==void 0?o:Ze,this.magFilter=r!==void 0?r:Ze,this.generateMipmaps=!1;const u=this;function h(){u.needsUpdate=!0,e.requestVideoFrameCallback(h)}"requestVideoFrameCallback"in e&&e.requestVideoFrameCallback(h)}clone(){return new this.constructor(this.image).copy(this)}update(){const e=this.image;"requestVideoFrameCallback"in e===!1&&e.readyState>=e.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}}class kw extends yt{constructor(e,t,i,s,r,o,a,l,c){super(e,t,i,s,r,o,a,l,c);this.isCanvasTexture=!0,this.needsUpdate=!0}}class un{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){const t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let i,s=this.getPoint(0),r=0;t.push(0);for(let o=1;o<=e;o++)i=this.getPoint(o/e),r+=i.distanceTo(s),t.push(r),s=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const i=this.getLengths();let s=0;const r=i.length;let o;t?o=t:o=e*i[r-1];let a=0,l=r-1,c;for(;a<=l;)if(s=Math.floor(a+(l-a)/2),c=i[s]-o,c<0)a=s+1;else if(c>0)l=s-1;else{l=s;break}if(s=l,i[s]===o)return s/(r-1);const u=i[s],d=i[s+1]-u,p=(o-u)/d;return(s+p)/(r-1)}getTangent(e,t){const i=1e-4;let s=e-i,r=e+i;s<0&&(s=0),r>1&&(r=1);const o=this.getPoint(s),a=this.getPoint(r),l=t||(o.isVector2?new ne:new E);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){const i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){const i=new E,s=[],r=[],o=[],a=new E,l=new Se;for(let p=0;p<=e;p++){const g=p/e;s[p]=this.getTangentAt(g,new E)}r[0]=new E,o[0]=new E;let c=Number.MAX_VALUE;const u=Math.abs(s[0].x),h=Math.abs(s[0].y),d=Math.abs(s[0].z);u<=c&&(c=u,i.set(1,0,0)),h<=c&&(c=h,i.set(0,1,0)),d<=c&&i.set(0,0,1),a.crossVectors(s[0],i).normalize(),r[0].crossVectors(s[0],a),o[0].crossVectors(s[0],r[0]);for(let p=1;p<=e;p++){if(r[p]=r[p-1].clone(),o[p]=o[p-1].clone(),a.crossVectors(s[p-1],s[p]),a.length()>Number.EPSILON){a.normalize();const g=Math.acos(ct(s[p-1].dot(s[p]),-1,1));r[p].applyMatrix4(l.makeRotationAxis(a,g))}o[p].crossVectors(s[p],r[p])}if(t===!0){let p=Math.acos(ct(r[0].dot(r[e]),-1,1));p/=e,s[0].dot(a.crossVectors(r[0],r[e]))>0&&(p=-p);for(let g=1;g<=e;g++)r[g].applyMatrix4(l.makeRotationAxis(s[g],p*g)),o[g].crossVectors(s[g],r[g])}return{tangents:s,normals:r,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class fl extends un{constructor(e=0,t=0,i=1,s=1,r=0,o=Math.PI*2,a=!1,l=0){super();this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=s,this.aStartAngle=r,this.aEndAngle=o,this.aClockwise=a,this.aRotation=l}getPoint(e,t){const i=t||new ne,s=Math.PI*2;let r=this.aEndAngle-this.aStartAngle;const o=Math.abs(r)s;)r-=s;r0?0:(Math.floor(Math.abs(a)/r)+1)*r:l===0&&a===r-1&&(a=r-2,l=1);let c,u;this.closed||a>0?c=s[(a-1)%r]:(ho.subVectors(s[0],s[1]).add(s[0]),c=ho);const h=s[a%r],d=s[(a+1)%r];if(this.closed||a+2s.length-2?s.length-1:o+1],h=s[o>s.length-3?s.length-1:o+2];return i.set(tf(a,l.x,c.x,u.x,h.x),tf(a,l.y,c.y,u.y,h.y)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t=i){const o=s[r]-i,a=this.curves[r],l=a.getLength(),c=l===0?0:1-o/l;return a.getPointAt(c,t)}r++}return null}getLength(){const e=this.getCurveLengths();return e[e.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const e=[];let t=0;for(let i=0,s=this.curves.length;i1&&!t[t.length-1].equals(t[0])&&t.push(t[0]),t}copy(e){super.copy(e),this.curves=[];for(let t=0,i=e.curves.length;t0){const h=c.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(c);const u=c.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){const e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}}class af extends xl{constructor(e){super(e);this.uuid=$t(),this.type="Shape",this.holes=[]}getPointsHoles(e){const t=[];for(let i=0,s=this.holes.length;i80*t){a=c=n[0],l=u=n[1];for(let g=t;gc&&(c=h),d>u&&(u=d);p=Math.max(c-a,u-l),p=p!==0?1/p:0}return Ys(r,o,t,a,l,p),o}};function lf(n,e,t,i,s){let r,o;if(s===p1(n,e,t,i)>0)for(r=e;r=e;r-=i)o=uf(r,n[r],n[r+1],o);return o&&uo(o,o.next)&&(Zs(o),o=o.next),o}function Wn(n,e){if(!n)return n;e||(e=n);let t=n,i;do if(i=!1,!t.steiner&&(uo(t,t.next)||et(t.prev,t,t.next)===0)){if(Zs(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function Ys(n,e,t,i,s,r,o){if(!n)return;!o&&r&&a1(n,i,s,r);let a=n,l,c;for(;n.prev!==n.next;){if(l=n.prev,c=n.next,r?Qw(n,i,s,r):Kw(n)){e.push(l.i/t),e.push(n.i/t),e.push(c.i/t),Zs(n),n=c.next,a=c.next;continue}if(n=c,n===a){o?o===1?(n=e1(Wn(n),e,t),Ys(n,e,t,i,s,r,2)):o===2&&t1(n,e,t,i,s,r):Ys(Wn(n),e,t,i,s,r,1);break}}}function Kw(n){const e=n.prev,t=n,i=n.next;if(et(e,t,i)>=0)return!1;let s=n.next.next;for(;s!==n.prev;){if(os(e.x,e.y,t.x,t.y,i.x,i.y,s.x,s.y)&&et(s.prev,s,s.next)>=0)return!1;s=s.next}return!0}function Qw(n,e,t,i){const s=n.prev,r=n,o=n.next;if(et(s,r,o)>=0)return!1;const a=s.xr.x?s.x>o.x?s.x:o.x:r.x>o.x?r.x:o.x,u=s.y>r.y?s.y>o.y?s.y:o.y:r.y>o.y?r.y:o.y,h=bl(a,l,e,t,i),d=bl(c,u,e,t,i);let p=n.prevZ,g=n.nextZ;for(;p&&p.z>=h&&g&&g.z<=d;){if(p!==n.prev&&p!==n.next&&os(s.x,s.y,r.x,r.y,o.x,o.y,p.x,p.y)&&et(p.prev,p,p.next)>=0||(p=p.prevZ,g!==n.prev&&g!==n.next&&os(s.x,s.y,r.x,r.y,o.x,o.y,g.x,g.y)&&et(g.prev,g,g.next)>=0))return!1;g=g.nextZ}for(;p&&p.z>=h;){if(p!==n.prev&&p!==n.next&&os(s.x,s.y,r.x,r.y,o.x,o.y,p.x,p.y)&&et(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;g&&g.z<=d;){if(g!==n.prev&&g!==n.next&&os(s.x,s.y,r.x,r.y,o.x,o.y,g.x,g.y)&&et(g.prev,g,g.next)>=0)return!1;g=g.nextZ}return!0}function e1(n,e,t){let i=n;do{const s=i.prev,r=i.next.next;!uo(s,r)&&cf(s,i,i.next,r)&&Js(s,r)&&Js(r,s)&&(e.push(s.i/t),e.push(i.i/t),e.push(r.i/t),Zs(i),Zs(i.next),i=n=r),i=i.next}while(i!==n);return Wn(i)}function t1(n,e,t,i,s,r){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&h1(o,a)){let l=hf(o,a);o=Wn(o,o.next),l=Wn(l,l.next),Ys(o,e,t,i,s,r),Ys(l,e,t,i,s,r);return}a=a.next}o=o.next}while(o!==n)}function n1(n,e,t,i){const s=[];let r,o,a,l,c;for(r=0,o=e.length;r=t.next.y&&t.next.y!==t.y){const d=t.x+(s-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(d<=i&&d>r){if(r=d,d===i){if(s===t.y)return t;if(s===t.next.y)return t.next}o=t.x=t.x&&t.x>=l&&i!==t.x&&os(so.x||t.x===o.x&&o1(o,t)))&&(o=t,u=h)),t=t.next;while(t!==a);return o}function o1(n,e){return et(n.prev,n,e.prev)<0&&et(e.next,n,n.next)<0}function a1(n,e,t,i){let s=n;do s.z===null&&(s.z=bl(s.x,s.y,e,t,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==n);s.prevZ.nextZ=null,s.prevZ=null,l1(s)}function l1(n){let e,t,i,s,r,o,a,l,c=1;do{for(t=n,n=null,r=null,o=0;t;){for(o++,i=t,a=0,e=0;e0||l>0&&i;)a!==0&&(l===0||!i||t.z<=i.z)?(s=t,t=t.nextZ,a--):(s=i,i=i.nextZ,l--),r?r.nextZ=s:n=s,s.prevZ=r,r=s;t=i}r.nextZ=null,c*=2}while(o>1);return n}function bl(n,e,t,i,s){return n=32767*(n-t)*s,e=32767*(e-i)*s,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function c1(n){let e=n,t=n;do(e.x=0&&(n-o)*(i-a)-(t-o)*(e-a)>=0&&(t-o)*(r-a)-(s-o)*(i-a)>=0}function h1(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!u1(n,e)&&(Js(n,e)&&Js(e,n)&&d1(n,e)&&(et(n.prev,n,e.prev)||et(n,e.prev,e))||uo(n,e)&&et(n.prev,n,n.next)>0&&et(e.prev,e,e.next)>0)}function et(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function uo(n,e){return n.x===e.x&&n.y===e.y}function cf(n,e,t,i){const s=fo(et(n,e,t)),r=fo(et(n,e,i)),o=fo(et(t,i,n)),a=fo(et(t,i,e));return!!(s!==r&&o!==a||s===0&&po(n,t,e)||r===0&&po(n,i,e)||o===0&&po(t,n,i)||a===0&&po(t,e,i))}function po(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function fo(n){return n>0?1:n<0?-1:0}function u1(n,e){let t=n;do{if(t.i!==n.i&&t.next.i!==n.i&&t.i!==e.i&&t.next.i!==e.i&&cf(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function Js(n,e){return et(n.prev,n,n.next)<0?et(n,e,n.next)>=0&&et(n,n.prev,e)>=0:et(n,e,n.prev)<0||et(n,n.next,e)<0}function d1(n,e){let t=n,i=!1;const s=(n.x+e.x)/2,r=(n.y+e.y)/2;do t.y>r!=t.next.y>r&&t.next.y!==t.y&&s<(t.next.x-t.x)*(r-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==n);return i}function hf(n,e){const t=new Ml(n.i,n.x,n.y),i=new Ml(e.i,e.x,e.y),s=n.next,r=e.prev;return n.next=e,e.prev=n,t.next=s,s.prev=t,i.next=t,t.prev=i,r.next=i,i.prev=r,i}function uf(n,e,t,i){const s=new Ml(n,e,t);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function Zs(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function Ml(n,e,t){this.i=n,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function p1(n,e,t,i){let s=0;for(let r=e,o=t-i;r2&&n[e-1].equals(n[0])&&n.pop()}function pf(n,e){for(let t=0;tNumber.EPSILON){const B=Math.sqrt(T),te=Math.sqrt(Qe*Qe+Je*Je),oe=q.x-we/B,de=q.y+Te/B,Pe=re.x-Je/te,$=re.y+Qe/te,Me=((Pe-oe)*Je-($-de)*Qe)/(Te*Je-we*Qe);be=oe+Te*Me-Y.x,he=de+we*Me-Y.y;const _e=be*be+he*he;if(_e<=2)return new ne(be,he);Ie=Math.sqrt(_e/2)}else{let B=!1;Te>Number.EPSILON?Qe>Number.EPSILON&&(B=!0):Te<-Number.EPSILON?Qe<-Number.EPSILON&&(B=!0):Math.sign(we)===Math.sign(Je)&&(B=!0),B?(be=-we,he=Te,Ie=Math.sqrt(T)):(be=Te,he=we,Ie=Math.sqrt(T/2))}return new ne(be/Ie,he/Ie)}const N=[];for(let Y=0,q=D.length,re=q-1,be=Y+1;Y=0;Y--){const q=Y/f,re=p*Math.cos(q*Math.PI/2),be=g*Math.sin(q*Math.PI/2)+m;for(let he=0,Ie=D.length;he=0;){const be=re;let he=re-1;he<0&&(he=Y.length-1);for(let Ie=0,Te=u+f*2;Ie0!=e>0&&this.version++,this._sheen=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class ff extends Gt{constructor(e){super();this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new ge(16777215),this.specular=new ge(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ge(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Fr,this.normalScale=new ne(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Rr,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.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.flatShading=e.flatShading,this.fog=e.fog,this}}class go extends Gt{constructor(e){super();this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new ge(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ge(0),this.emissiveIntensity=1,this.emissiveMap=null,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Rr,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.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.fog=e.fog,this}}function jn(n,e,t){return mf(n)?new n.constructor(n.subarray(e,t!==void 0?t:n.length)):n.slice(e,t)}function _o(n,e,t){return!n||!t&&n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}function mf(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function g1(n){function e(s,r){return n[s]-n[r]}const t=n.length,i=new Array(t);for(let s=0;s!==t;++s)i[s]=s;return i.sort(e),i}function gf(n,e,t){const i=n.length,s=new n.constructor(i);for(let r=0,o=0;o!==i;++r){const a=t[r]*e;for(let l=0;l!==e;++l)s[o++]=n[a+l]}return s}function _f(n,e,t,i){let s=1,r=n[0];for(;r!==void 0&&r[i]===void 0;)r=n[s++];if(r===void 0)return;let o=r[i];if(o!==void 0)if(Array.isArray(o))do o=r[i],o!==void 0&&(e.push(r.time),t.push.apply(t,o)),r=n[s++];while(r!==void 0);else if(o.toArray!==void 0)do o=r[i],o!==void 0&&(e.push(r.time),o.toArray(t,t.length)),r=n[s++];while(r!==void 0);else do o=r[i],o!==void 0&&(e.push(r.time),t.push(o)),r=n[s++];while(r!==void 0)}class er{constructor(e,t,i,s){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=s!==void 0?s:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let i=this._cachedIndex,s=t[i],r=t[i-1];e:{t:{let o;n:{i:if(!(e=r)){const a=t[1];e=r)break t}o=i,i=0;break n}break e}for(;i>>1;et;)--o;if(++o,r!==0||o!==s){r>=o&&(o=Math.max(o,1),r=o-1);const a=this.getValueSize();this.times=jn(i,r,o),this.values=jn(this.values,r*a,o*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!=0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const i=this.times,s=this.values,r=i.length;r===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==r;a++){const l=i[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(s!==void 0&&mf(s))for(let a=0,l=s.length;a!==l;++a){const c=s[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){const e=jn(this.times),t=jn(this.values),i=this.getValueSize(),s=this.getInterpolation()===ba,r=e.length-1;let o=1;for(let a=1;a0){e[o]=e[r];for(let a=r*i,l=o*i,c=0;c!==i;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=jn(e,0,o),this.values=jn(t,0,o*i)):(this.times=e,this.values=t),this}clone(){const e=jn(this.times,0),t=jn(this.values,0),i=this.constructor,s=new i(this.name,e,t);return s.createInterpolant=this.createInterpolant,s}}dn.prototype.TimeBufferType=Float32Array,dn.prototype.ValueBufferType=Float32Array,dn.prototype.DefaultInterpolation=Bi;class as extends dn{}as.prototype.ValueTypeName="bool",as.prototype.ValueBufferType=Array,as.prototype.DefaultInterpolation=Ds,as.prototype.InterpolantFactoryMethodLinear=void 0,as.prototype.InterpolantFactoryMethodSmooth=void 0;class vf extends dn{}vf.prototype.ValueTypeName="color";class tr extends dn{}tr.prototype.ValueTypeName="number";class v1 extends er{constructor(e,t,i,s){super(e,t,i,s)}interpolate_(e,t,i,s){const r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(i-t)/(s-t);let c=e*a;for(let u=c+a;c!==u;c+=4)en.slerpFlat(r,0,o,c-a,o,c,l);return r}}class _i extends dn{InterpolantFactoryMethodLinear(e){return new v1(this.times,this.values,this.getValueSize(),e)}}_i.prototype.ValueTypeName="quaternion",_i.prototype.DefaultInterpolation=Bi,_i.prototype.InterpolantFactoryMethodSmooth=void 0;class ls extends dn{}ls.prototype.ValueTypeName="string",ls.prototype.ValueBufferType=Array,ls.prototype.DefaultInterpolation=Ds,ls.prototype.InterpolantFactoryMethodLinear=void 0,ls.prototype.InterpolantFactoryMethodSmooth=void 0;class nr extends dn{}nr.prototype.ValueTypeName="vector";class Sl{constructor(e,t=-1,i,s=Ma){this.name=e,this.tracks=i,this.duration=t,this.blendMode=s,this.uuid=$t(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],i=e.tracks,s=1/(e.fps||1);for(let o=0,a=i.length;o!==a;++o)t.push(b1(i[o]).scale(s));const r=new this(e.name,e.duration,t,e.blendMode);return r.uuid=e.uuid,r}static toJSON(e){const t=[],i=e.tracks,s={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let r=0,o=i.length;r!==o;++r)t.push(dn.toJSON(i[r]));return s}static CreateFromMorphTargetSequence(e,t,i,s){const r=t.length,o=[];for(let a=0;a1){const h=u[1];let d=s[h];d||(s[h]=d=[]),d.push(c)}}const o=[];for(const a in s)o.push(this.CreateFromMorphTargetSequence(a,s[a],t,i));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const i=function(h,d,p,g,m){if(p.length!==0){const f=[],_=[];_f(p,f,_,g),f.length!==0&&m.push(new h(d,f,_))}},s=[],r=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let h=0;h{t&&t(r),this.manager.itemEnd(e)},0),r;if(wn[e]!==void 0){wn[e].push({onLoad:t,onProgress:i,onError:s});return}wn[e]=[],wn[e].push({onLoad:t,onProgress:i,onError:s});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream=="undefined"||c.body===void 0||c.body.getReader===void 0)return c;const u=wn[e],h=c.body.getReader(),d=c.headers.get("Content-Length"),p=d?parseInt(d):0,g=p!==0;let m=0;const f=new ReadableStream({start(_){v();function v(){h.read().then(({done:b,value:x})=>{if(b)_.close();else{m+=x.byteLength;const C=new ProgressEvent("progress",{lengthComputable:g,loaded:m,total:p});for(let w=0,L=u.length;w{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(u=>new DOMParser().parseFromString(u,a));case"json":return c.json();default:if(a===void 0)return c.text();{const h=/charset="?([^;"\s]*)"?/i.exec(a),d=h&&h[1]?h[1].toLowerCase():void 0,p=new TextDecoder(d);return c.arrayBuffer().then(g=>p.decode(g))}}}).then(c=>{yi.add(e,c);const u=wn[e];delete wn[e];for(let h=0,d=u.length;h{const u=wn[e];if(u===void 0)throw this.manager.itemError(e),c;delete wn[e];for(let h=0,d=u.length;h{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class S1 extends qn{constructor(e){super(e)}load(e,t,i,s){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const r=this,o=yi.get(e);if(o!==void 0)return r.manager.itemStart(e),setTimeout(function(){t&&t(o),r.manager.itemEnd(e)},0),o;const a=ks("img");function l(){u(),yi.add(e,this),t&&t(this),r.manager.itemEnd(e)}function c(h){u(),s&&s(h),r.manager.itemError(e),r.manager.itemEnd(e)}function u(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),r.manager.itemStart(e),a.src=e,a}}class C1 extends qn{constructor(e){super(e)}load(e,t,i,s){const r=this,o=new al,a=new hs(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(r.withCredentials),a.load(e,function(l){const c=r.parse(l);!c||(c.image!==void 0?o.image=c.image:c.data!==void 0&&(o.image.width=c.width,o.image.height=c.height,o.image.data=c.data),o.wrapS=c.wrapS!==void 0?c.wrapS:Lt,o.wrapT=c.wrapT!==void 0?c.wrapT:Lt,o.magFilter=c.magFilter!==void 0?c.magFilter:Ze,o.minFilter=c.minFilter!==void 0?c.minFilter:Ze,o.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.encoding!==void 0&&(o.encoding=c.encoding),c.flipY!==void 0&&(o.flipY=c.flipY),c.format!==void 0&&(o.format=c.format),c.type!==void 0&&(o.type=c.type),c.mipmaps!==void 0&&(o.mipmaps=c.mipmaps,o.minFilter=ni),c.mipmapCount===1&&(o.minFilter=Ze),c.generateMipmaps!==void 0&&(o.generateMipmaps=c.generateMipmaps),o.needsUpdate=!0,t&&t(o,c))},i,s),o}}class bf extends qn{constructor(e){super(e)}load(e,t,i,s){const r=new yt,o=new S1(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){r.image=a,r.needsUpdate=!0,t!==void 0&&t(r)},i,s),r}}class us extends st{constructor(e,t=1){super();this.isLight=!0,this.type="Light",this.color=new ge(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,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}}class Mf extends us{constructor(e,t,i){super(e,i);this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(st.DefaultUp),this.updateMatrix(),this.groundColor=new ge(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}}const Sf=new Se,Cf=new E,wf=new E;class Cl{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new ne(512,512),this.map=null,this.mapPass=null,this.matrix=new Se,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new no,this._frameExtents=new ne(1,1),this._viewportCount=1,this._viewports=[new We(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,i=this.matrix;Cf.setFromMatrixPosition(e.matrixWorld),t.position.copy(Cf),wf.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(wf),t.updateMatrixWorld(),Sf.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Sf),i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(t.projectionMatrix),i.multiply(t.matrixWorldInverse)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class w1 extends Cl{constructor(){super(new St(50,1,.5,500));this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,i=Os*2*e.angle*this.focus,s=this.mapSize.width/this.mapSize.height,r=e.distance||t.far;(i!==t.fov||s!==t.aspect||r!==t.far)&&(t.fov=i,t.aspect=s,t.far=r,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class wl extends us{constructor(e,t,i=0,s=Math.PI/3,r=0,o=1){super(e,t);this.isSpotLight=!0,this.type="SpotLight",this.position.copy(st.DefaultUp),this.updateMatrix(),this.target=new st,this.distance=i,this.angle=s,this.penumbra=r,this.decay=o,this.shadow=new w1}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const Af=new Se,ir=new E,Al=new E;class A1 extends Cl{constructor(){super(new St(90,1,.5,500));this.isPointLightShadow=!0,this._frameExtents=new ne(4,2),this._viewportCount=6,this._viewports=[new We(2,1,1,1),new We(0,1,1,1),new We(3,1,1,1),new We(1,1,1,1),new We(3,0,1,1),new We(1,0,1,1)],this._cubeDirections=[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)],this._cubeUps=[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)]}updateMatrices(e,t=0){const i=this.camera,s=this.matrix,r=e.distance||i.far;r!==i.far&&(i.far=r,i.updateProjectionMatrix()),ir.setFromMatrixPosition(e.matrixWorld),i.position.copy(ir),Al.copy(i.position),Al.add(this._cubeDirections[t]),i.up.copy(this._cubeUps[t]),i.lookAt(Al),i.updateMatrixWorld(),s.makeTranslation(-ir.x,-ir.y,-ir.z),Af.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(Af)}}class Tl extends us{constructor(e,t,i=0,s=1){super(e,t);this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=s,this.shadow=new A1}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class T1 extends Cl{constructor(){super(new ns(-5,5,5,-5,.5,500));this.isDirectionalLightShadow=!0}}class El extends us{constructor(e,t){super(e,t);this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(st.DefaultUp),this.updateMatrix(),this.target=new st,this.shadow=new T1}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class Tf extends us{constructor(e,t){super(e,t);this.isAmbientLight=!0,this.type="AmbientLight"}}class E1 extends us{constructor(e,t,i=10,s=10){super(e,t);this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=i,this.height=s}get power(){return this.intensity*this.width*this.height*Math.PI}set power(e){this.intensity=e/(this.width*this.height*Math.PI)}copy(e){return super.copy(e),this.width=e.width,this.height=e.height,this}toJSON(e){const t=super.toJSON(e);return t.object.width=this.width,t.object.height=this.height,t}}class vi{static decodeText(e){if(typeof TextDecoder!="undefined")return new TextDecoder().decode(e);let t="";for(let i=0,s=e.length;i0&&this._mixBufferRegionAdditive(i,s,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(i[l]!==i[l+t]){a.setValue(i,s);break}}saveOriginalState(){const e=this.binding,t=this.buffer,i=this.valueSize,s=i*this._origIndex;e.getValue(t,s);for(let r=i,o=s;r!==o;++r)t[r]=t[s+r%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let i=e;i=.5)for(let o=0;o!==r;++o)e[t+o]=e[i+o]}_slerp(e,t,i,s){en.slerpFlat(e,t,e,t,e,i,s)}_slerpAdditive(e,t,i,s,r){const o=this._workIndex*r;en.multiplyQuaternionsFlat(e,o,e,t,e,i),en.slerpFlat(e,t,e,t,e,o,s)}_lerp(e,t,i,s,r){const o=1-s;for(let a=0;a!==r;++a){const l=t+a;e[l]=e[l]*o+e[i+a]*s}}_lerpAdditive(e,t,i,s,r){for(let o=0;o!==r;++o){const a=t+o;e[a]=e[a]+e[i+o]*s}}}const Ll="\\[\\]\\.:\\/",P1=new RegExp("["+Ll+"]","g"),Rl="[^"+Ll+"]",I1="[^"+Ll.replace("\\.","")+"]",D1=/((?:WC+[\/:])*)/.source.replace("WC",Rl),F1=/(WCOD+)?/.source.replace("WCOD",I1),O1=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",Rl),N1=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",Rl),k1=new RegExp("^"+D1+F1+O1+N1+"$"),B1=["material","materials","bones"];class $1{constructor(e,t,i){const s=i||je.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,s)}getValue(e,t){this.bind();const i=this._targetGroup.nCachedObjects_,s=this._bindings[i];s!==void 0&&s.getValue(e,t)}setValue(e,t){const i=this._bindings;for(let s=this._targetGroup.nCachedObjects_,r=i.length;s!==r;++s)i[s].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}}class je{constructor(e,t,i){this.path=t,this.parsedPath=i||je.parseTrackName(t),this.node=je.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new je.Composite(e,t,i):new je(e,t,i)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(P1,"")}static parseTrackName(e){const t=k1.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},s=i.nodeName&&i.nodeName.lastIndexOf(".");if(s!==void 0&&s!==-1){const r=i.nodeName.substring(s+1);B1.indexOf(r)!==-1&&(i.nodeName=i.nodeName.substring(0,s),i.objectName=r)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return i}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const i=e.skeleton.getBoneByName(t);if(i!==void 0)return i}if(e.children){const i=function(r){for(let o=0;o0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case Hx:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulateAdditive(a);break;case Ma:default:for(let u=0,h=l.length;u!==h;++u)l[u].evaluate(o),c[u].accumulate(s,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const i=this._weightInterpolant;if(i!==null){const s=i.evaluate(e)[0];t*=s,e>i.parameterPositions[1]&&(this.stopFading(),s===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const i=this._timeScaleInterpolant;i!==null&&(t*=i.evaluate(e)[0],e>i.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t))}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,i=this.loop;let s=this.time+e,r=this._loopCount;const o=i===Vx;if(e===0)return r===-1?s:o&&(r&1)==1?t-s:s;if(i===zx){r===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(s>=t)s=t;else if(s<0)s=0;else{this.time=s;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=s,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,o)):this._setEndings(this.repetitions===0,!0,o)),s>=t||s<0){const a=Math.floor(s/t);s-=t*a,r+=Math.abs(a);const l=this.repetitions-r;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,s=e>0?t:0,this.time=s,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=r,this.time=s,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=s;if(o&&(r&1)==1)return t-s}return s}_setEndings(e,t,i){const s=this._interpolantSettings;i?(s.endingStart=Ui,s.endingEnd=Ui):(e?s.endingStart=this.zeroSlopeAtStart?Ui:$i:s.endingStart=Dr,t?s.endingEnd=this.zeroSlopeAtEnd?Ui:$i:s.endingEnd=Dr)}_scheduleFading(e,t,i){const s=this._mixer,r=s.time;let o=this._weightInterpolant;o===null&&(o=s._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=r,l[0]=t,a[1]=r+e,l[1]=i,this}}const z1=new Float32Array(1);class G1 extends ai{constructor(e){super();this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const i=e._localRoot||this._root,s=e._clip.tracks,r=s.length,o=e._propertyBindings,a=e._interpolants,l=i.uuid,c=this._bindingsByRootAndName;let u=c[l];u===void 0&&(u={},c[l]=u);for(let h=0;h!==r;++h){const d=s[h],p=d.name;let g=u[p];if(g!==void 0)++g.referenceCount,o[h]=g;else{if(g=o[h],g!==void 0){g._cacheIndex===null&&(++g.referenceCount,this._addInactiveBinding(g,l,p));continue}const m=t&&t._propertyBindings[h].binding.parsedPath;g=new R1(je.create(i,p,m),d.ValueTypeName,d.getValueSize()),++g.referenceCount,this._addInactiveBinding(g,l,p),o[h]=g}a[h].resultBuffer=g.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const i=(e._localRoot||this._root).uuid,s=e._clip.uuid,r=this._actionsByClip[s];this._bindAction(e,r&&r.knownActions[0]),this._addInactiveAction(e,s,i)}const t=e._propertyBindings;for(let i=0,s=t.length;i!==s;++i){const r=t[i];r.useCount++==0&&(this._lendBinding(r),r.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let i=0,s=t.length;i!==s;++i){const r=t[i];--r.useCount==0&&(r.restoreOriginalState(),this._takeBackBinding(r))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t=0;--i)e[i].stop();return this}update(e){e*=this.timeScale;const t=this._actions,i=this._nActiveActions,s=this.time+=e,r=Math.sign(e),o=this._accuIndex^=1;for(let c=0;c!==i;++c)t[c]._update(s,e,r,o);const a=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)a[c].apply(o);return this}setTime(e){this.time=0;for(let t=0;t>-c-14,i[l|256]=1024>>-c-14|32768,s[l]=-c-1,s[l|256]=-c-1):c<=15?(i[l]=c+15<<10,i[l|256]=c+15<<10|32768,s[l]=13,s[l|256]=13):c<128?(i[l]=31744,i[l|256]=64512,s[l]=24,s[l|256]=24):(i[l]=31744,i[l|256]=64512,s[l]=13,s[l|256]=13)}const r=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,u=0;for(;(c&8388608)==0;)c<<=1,u-=8388608;c&=~8388608,u+=947912704,r[l]=c|u}for(let l=1024;l<2048;++l)r[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:t,baseTable:i,shiftTable:s,mantissaTable:r,exponentTable:o,offsetTable:a}}function j1(n){Math.abs(n)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),n=ct(n,-65504,65504),An.floatView[0]=n;const e=An.uint32View[0],t=e>>23&511;return An.baseTable[t]+((e&8388607)>>An.shiftTable[t])}function q1(n){const e=n>>10;return An.uint32View[0]=An.mantissaTable[An.offsetTable[e]+(n&1023)]+An.exponentTable[e],An.floatView[0]}var yo=Object.freeze({__proto__:null,toHalfFloat:j1,fromHalfFloat:q1});typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:ua}})),typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=ua);class X1 extends C1{constructor(e){super(e);this.type=Jt}parse(e){const t=-1,i=1,s=2,r=3,o=4,a=function(b,x){switch(b){case i:console.error("THREE.RGBELoader Read Error: "+(x||""));break;case s:console.error("THREE.RGBELoader Write Error: "+(x||""));break;case r:console.error("THREE.RGBELoader Bad File Format: "+(x||""));break;default:case o:console.error("THREE.RGBELoader: Error: "+(x||""))}return t},l=1,c=2,u=4,h=` `,d=function(b,x,C){const w=128;x=x||1024;let L=b.pos,y=-1,A=0,I="",R=String.fromCharCode.apply(null,new Uint16Array(b.subarray(L,L+w)));for(;0>(y=R.indexOf(h))&&A=b.byteLength||!(I=d(b)))return a(i,"no header found");if(!(R=I.match(x)))return a(r,"bad initial token");for(A.valid|=l,A.programtype=R[1],A.string+=I+` `;I=d(b),I!==!1;){if(A.string+=I+` `,I.charAt(0)==="#"){A.comments+=I+` `;continue}if((R=I.match(C))&&(A.gamma=parseFloat(R[1])),(R=I.match(w))&&(A.exposure=parseFloat(R[1])),(R=I.match(L))&&(A.valid|=c,A.format=R[1]),(R=I.match(y))&&(A.valid|=u,A.height=parseInt(R[1],10),A.width=parseInt(R[2],10)),A.valid&c&&A.valid&u)break}return A.valid&c?A.valid&u?A:a(r,"missing image size specifier"):a(r,"missing format specifier")},g=function(b,x,C){const w=x;if(w<8||w>32767||b[0]!==2||b[1]!==2||b[2]&128)return new Uint8Array(b);if(w!==(b[2]<<8|b[3]))return a(r,"wrong scanline width");const L=new Uint8Array(4*x*C);if(!L.length)return a(o,"unable to allocate buffer space");let y=0,A=0;const I=4*w,R=new Uint8Array(4),Q=new Uint8Array(I);let ee=C;for(;ee>0&&Ab.byteLength)return a(i);if(R[0]=b[A++],R[1]=b[A++],R[2]=b[A++],R[3]=b[A++],R[0]!=2||R[1]!=2||(R[2]<<8|R[3])!=w)return a(r,"bad rgbe scanline format");let D=0,z;for(;D128;if(j&&(z-=128),z===0||D+z>I)return a(r,"bad scanline data");if(j){const W=b[A++];for(let N=0;N=2.0 are supported."));return}const c=new TA(l,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let u=0;u=0&&a[h]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+h+'".')}}c.setExtensions(o),c.setPlugins(a),c.parse(i,s)}parseAsync(e,t){const i=this;return new Promise(function(s,r){i.parse(e,t,s,r)})}}function eA(){let n={};return{get:function(e){return n[e]},add:function(e,t){n[e]=t},remove:function(e){delete n[e]},removeAll:function(){n={}}}}const $e={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS:"KHR_materials_pbrSpecularGlossiness",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression"};class tA{constructor(e){this.parser=e,this.name=$e.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let i=0,s=t.length;i=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,r.source,o)}}class dA{constructor(e){this.parser=e,this.name=$e.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,i=this.parser,s=i.json,r=s.textures[e];if(!r.extensions||!r.extensions[t])return null;const o=r.extensions[t],a=s.images[o.source];let l=i.textureLoader;if(a.uri){const c=i.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return i.loadTextureImage(e,o.source,l);if(s.extensionsRequired&&s.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return i.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class pA{constructor(e){this.name=$e.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,i=t.bufferViews[e];if(i.extensions&&i.extensions[this.name]){const s=i.extensions[this.name],r=this.parser.getDependency("buffer",s.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return Promise.all([r,o.ready]).then(function(a){const l=s.byteOffset||0,c=s.byteLength||0,u=s.count,h=s.byteStride,d=new ArrayBuffer(u*h),p=new Uint8Array(a[0],l,c);return o.decodeGltfBuffer(new Uint8Array(d),u,h,p,s.mode,s.filter),d})}else return null}}const Nf="glTF",rr=12,kf={JSON:1313821514,BIN:5130562};class fA{constructor(e){this.name=$e.KHR_BINARY_GLTF,this.content=null,this.body=null;const t=new DataView(e,0,rr);if(this.header={magic:vi.decodeText(new Uint8Array(e.slice(0,4))),version:t.getUint32(4,!0),length:t.getUint32(8,!0)},this.header.magic!==Nf)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-rr,s=new DataView(e,rr);let r=0;for(;r",t).replace("#include ",i).replace("#include ",s).replace("#include ",r).replace("#include ",o)},Object.defineProperties(this,{specular:{get:function(){return a.specular.value},set:function(l){a.specular.value=l}},specularMap:{get:function(){return a.specularMap.value},set:function(l){a.specularMap.value=l,l?this.defines.USE_SPECULARMAP="":delete this.defines.USE_SPECULARMAP}},glossiness:{get:function(){return a.glossiness.value},set:function(l){a.glossiness.value=l}},glossinessMap:{get:function(){return a.glossinessMap.value},set:function(l){a.glossinessMap.value=l,l?(this.defines.USE_GLOSSINESSMAP="",this.defines.USE_UV=""):(delete this.defines.USE_GLOSSINESSMAP,delete this.defines.USE_UV)}}}),delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this.setValues(e)}copy(e){return super.copy(e),this.specularMap=e.specularMap,this.specular.copy(e.specular),this.glossinessMap=e.glossinessMap,this.glossiness=e.glossiness,delete this.metalness,delete this.roughness,delete this.metalnessMap,delete this.roughnessMap,this}}class _A{constructor(){this.name=$e.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS,this.specularGlossinessParams=["color","map","lightMap","lightMapIntensity","aoMap","aoMapIntensity","emissive","emissiveIntensity","emissiveMap","bumpMap","bumpScale","normalMap","normalMapType","displacementMap","displacementScale","displacementBias","specularMap","specular","glossinessMap","glossiness","alphaMap","envMap","envMapIntensity"]}getMaterialType(){return Dl}extendParams(e,t,i){const s=t.extensions[this.name];e.color=new ge(1,1,1),e.opacity=1;const r=[];if(Array.isArray(s.diffuseFactor)){const o=s.diffuseFactor;e.color.fromArray(o),e.opacity=o[3]}if(s.diffuseTexture!==void 0&&r.push(i.assignTexture(e,"map",s.diffuseTexture,He)),e.emissive=new ge(0,0,0),e.glossiness=s.glossinessFactor!==void 0?s.glossinessFactor:1,e.specular=new ge(1,1,1),Array.isArray(s.specularFactor)&&e.specular.fromArray(s.specularFactor),s.specularGlossinessTexture!==void 0){const o=s.specularGlossinessTexture;r.push(i.assignTexture(e,"glossinessMap",o)),r.push(i.assignTexture(e,"specularMap",o,He))}return Promise.all(r)}createMaterial(e){const t=new Dl(e);return t.fog=!0,t.color=e.color,t.map=e.map===void 0?null:e.map,t.lightMap=null,t.lightMapIntensity=1,t.aoMap=e.aoMap===void 0?null:e.aoMap,t.aoMapIntensity=1,t.emissive=e.emissive,t.emissiveIntensity=e.emissiveIntensity===void 0?1:e.emissiveIntensity,t.emissiveMap=e.emissiveMap===void 0?null:e.emissiveMap,t.bumpMap=e.bumpMap===void 0?null:e.bumpMap,t.bumpScale=1,t.normalMap=e.normalMap===void 0?null:e.normalMap,t.normalMapType=Fr,e.normalScale&&(t.normalScale=e.normalScale),t.displacementMap=null,t.displacementScale=1,t.displacementBias=0,t.specularMap=e.specularMap===void 0?null:e.specularMap,t.specular=e.specular,t.glossinessMap=e.glossinessMap===void 0?null:e.glossinessMap,t.glossiness=e.glossiness,t.alphaMap=null,t.envMap=e.envMap===void 0?null:e.envMap,t.envMapIntensity=1,t}}class yA{constructor(){this.name=$e.KHR_MESH_QUANTIZATION}}class Bf extends er{constructor(e,t,i,s){super(e,t,i,s)}copySampleValue_(e){const t=this.resultBuffer,i=this.sampleValues,s=this.valueSize,r=e*s*3+s;for(let o=0;o!==s;o++)t[o]=i[r+o];return t}interpolate_(e,t,i,s){const r=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=a*2,c=a*3,u=s-t,h=(i-t)/u,d=h*h,p=d*h,g=e*c,m=g-c,f=-2*p+3*d,_=p-d,v=1-f,b=_-d+h;for(let x=0;x!==a;x++){const C=o[m+x+a],w=o[m+x+l]*u,L=o[g+x+a],y=o[g+x]*u;r[x]=v*C+b*w+f*L+_*y}return r}}const vA=new en;class xA extends Bf{interpolate_(e,t,i,s){const r=super.interpolate_(e,t,i,s);return vA.fromArray(r).normalize().toArray(r),r}}const Tn={FLOAT:5126,FLOAT_MAT3:35675,FLOAT_MAT4:35676,FLOAT_VEC2:35664,FLOAT_VEC3:35665,FLOAT_VEC4:35666,LINEAR:9729,REPEAT:10497,SAMPLER_2D:35678,POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6,UNSIGNED_BYTE:5121,UNSIGNED_SHORT:5123},or={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},$f={9728:_t,9729:Ze,9984:ma,9985:_d,9986:ga,9987:ni},Uf={33071:Lt,33648:Ir,10497:ti},zf={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},Fl={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv2",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},Xn={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},bA={CUBICSPLINE:void 0,LINEAR:Bi,STEP:Ds},Ol={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function MA(n){return n.DefaultMaterial===void 0&&(n.DefaultMaterial=new mo({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:Pi})),n.DefaultMaterial}function ar(n,e,t){for(const i in t.extensions)n[i]===void 0&&(e.userData.gltfExtensions=e.userData.gltfExtensions||{},e.userData.gltfExtensions[i]=t.extensions[i])}function xi(n,e){e.extras!==void 0&&(typeof e.extras=="object"?Object.assign(n.userData,e.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+e.extras))}function SA(n,e,t){let i=!1,s=!1,r=!1;for(let c=0,u=e.length;c0||n.search(/^data\:image\/jpeg/)===0?"image/jpeg":n.search(/\.webp($|\?)/i)>0||n.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}class TA{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new eA,this.associations=new Map,this.primitiveCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};const i=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,s=navigator.userAgent.indexOf("Firefox")>-1,r=s?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1;typeof createImageBitmap=="undefined"||i||s&&r<98?this.textureLoader=new bf(this.options.manager):this.textureLoader=new L1(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new hs(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const i=this,s=this.json,r=this.extensions;this.cache.removeAll(),this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([i.getDependencies("scene"),i.getDependencies("animation"),i.getDependencies("camera")])}).then(function(o){const a={scene:o[0][s.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:s.asset,parser:i,userData:{}};ar(r,a,s),xi(a,s),Promise.all(i._invokeAll(function(l){return l.afterRoot&&l.afterRoot(a)})).then(function(){e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],i=this.json.meshes||[];for(let s=0,r=t.length;s{const l=this.associations.get(o);l!=null&&this.associations.set(a,l);for(const[c,u]of o.children.entries())r(u,a.children[c])};return r(i,s),s.name+="_instance_"+e.uses[t]++,s}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let i=0;i=2&&f.setY(A,w[L*l+1]),l>=3&&f.setZ(A,w[L*l+2]),l>=4&&f.setW(A,w[L*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return f})}loadTexture(e){const t=this.json,i=this.options,r=t.textures[e].source,o=t.images[r];let a=this.textureLoader;if(o.uri){const l=i.manager.getHandler(o.uri);l!==null&&(a=l)}return this.loadTextureImage(e,r,a)}loadTextureImage(e,t,i){const s=this,r=this.json,o=r.textures[e],a=r.images[t],l=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[l])return this.textureCache[l];const c=this.loadImageSource(t,i).then(function(u){u.flipY=!1,o.name&&(u.name=o.name);const d=(r.samplers||{})[o.sampler]||{};return u.magFilter=$f[d.magFilter]||Ze,u.minFilter=$f[d.minFilter]||ni,u.wrapS=Uf[d.wrapS]||ti,u.wrapT=Uf[d.wrapT]||ti,s.associations.set(u,{textures:e}),u}).catch(function(){return null});return this.textureCache[l]=c,c}loadImageSource(e,t){const i=this,s=this.json,r=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(h=>h.clone());const o=s.images[e],a=self.URL||self.webkitURL;let l=o.uri||"",c=!1;if(o.bufferView!==void 0)l=i.getDependency("bufferView",o.bufferView).then(function(h){c=!0;const d=new Blob([h],{type:o.mimeType});return l=a.createObjectURL(d),l});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const u=Promise.resolve(l).then(function(h){return new Promise(function(d,p){let g=d;t.isImageBitmapLoader===!0&&(g=function(m){const f=new yt(m);f.needsUpdate=!0,d(f)}),t.load(vi.resolveURL(h,r.path),g,void 0,p)})}).then(function(h){return c===!0&&a.revokeObjectURL(l),h.userData.mimeType=o.mimeType||AA(o.uri),h}).catch(function(h){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),h});return this.sourceCache[e]=u,u}assignTexture(e,t,i,s){const r=this;return this.getDependency("texture",i.index).then(function(o){if(i.texCoord!==void 0&&i.texCoord!=0&&!(t==="aoMap"&&i.texCoord==1)&&console.warn("THREE.GLTFLoader: Custom UV set "+i.texCoord+" for texture "+t+" not yet supported."),r.extensions[$e.KHR_TEXTURE_TRANSFORM]){const a=i.extensions!==void 0?i.extensions[$e.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=r.associations.get(o);o=r.extensions[$e.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),r.associations.set(o,l)}}return s!==void 0&&(o.encoding=s),e[t]=o,o})}assignFinalMaterial(e){const t=e.geometry;let i=e.material;const s=t.attributes.tangent===void 0,r=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+i.uuid;let l=this.cache.get(a);l||(l=new dl,Gt.prototype.copy.call(l,i),l.color.copy(i.color),l.map=i.map,l.sizeAttenuation=!1,this.cache.add(a,l)),i=l}else if(e.isLine){const a="LineBasicMaterial:"+i.uuid;let l=this.cache.get(a);l||(l=new cl,Gt.prototype.copy.call(l,i),l.color.copy(i.color),this.cache.add(a,l)),i=l}if(s||r||o){let a="ClonedMaterial:"+i.uuid+":";i.isGLTFSpecularGlossinessMaterial&&(a+="specular-glossiness:"),s&&(a+="derivative-tangents:"),r&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let l=this.cache.get(a);l||(l=i.clone(),r&&(l.vertexColors=!0),o&&(l.flatShading=!0),s&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(a,l),this.associations.set(l,this.associations.get(i))),i=l}i.aoMap&&t.attributes.uv2===void 0&&t.attributes.uv!==void 0&&t.setAttribute("uv2",t.attributes.uv),e.material=i}getMaterialType(){return mo}loadMaterial(e){const t=this,i=this.json,s=this.extensions,r=i.materials[e];let o;const a={},l=r.extensions||{},c=[];if(l[$e.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]){const h=s[$e.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS];o=h.getMaterialType(),c.push(h.extendParams(a,r,t))}else if(l[$e.KHR_MATERIALS_UNLIT]){const h=s[$e.KHR_MATERIALS_UNLIT];o=h.getMaterialType(),c.push(h.extendParams(a,r,t))}else{const h=r.pbrMetallicRoughness||{};if(a.color=new ge(1,1,1),a.opacity=1,Array.isArray(h.baseColorFactor)){const d=h.baseColorFactor;a.color.fromArray(d),a.opacity=d[3]}h.baseColorTexture!==void 0&&c.push(t.assignTexture(a,"map",h.baseColorTexture,He)),a.metalness=h.metallicFactor!==void 0?h.metallicFactor:1,a.roughness=h.roughnessFactor!==void 0?h.roughnessFactor:1,h.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(a,"metalnessMap",h.metallicRoughnessTexture)),c.push(t.assignTexture(a,"roughnessMap",h.metallicRoughnessTexture))),o=this._invokeOne(function(d){return d.getMaterialType&&d.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(d){return d.extendMaterialParams&&d.extendMaterialParams(e,a)})))}r.doubleSided===!0&&(a.side=Yt);const u=r.alphaMode||Ol.OPAQUE;if(u===Ol.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,u===Ol.MASK&&(a.alphaTest=r.alphaCutoff!==void 0?r.alphaCutoff:.5)),r.normalTexture!==void 0&&o!==di&&(c.push(t.assignTexture(a,"normalMap",r.normalTexture)),a.normalScale=new ne(1,1),r.normalTexture.scale!==void 0)){const h=r.normalTexture.scale;a.normalScale.set(h,h)}return r.occlusionTexture!==void 0&&o!==di&&(c.push(t.assignTexture(a,"aoMap",r.occlusionTexture)),r.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=r.occlusionTexture.strength)),r.emissiveFactor!==void 0&&o!==di&&(a.emissive=new ge().fromArray(r.emissiveFactor)),r.emissiveTexture!==void 0&&o!==di&&c.push(t.assignTexture(a,"emissiveMap",r.emissiveTexture,He)),Promise.all(c).then(function(){let h;return o===Dl?h=s[$e.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(a):h=new o(a),r.name&&(h.name=r.name),xi(h,r),t.associations.set(h,{materials:e}),r.extensions&&ar(s,h,r),h})}createUniqueName(e){const t=je.sanitizeNodeName(e||"");let i=t;for(let s=1;this.nodeNamesUsed[i];++s)i=t+"_"+s;return this.nodeNamesUsed[i]=!0,i}loadGeometries(e){const t=this,i=this.extensions,s=this.primitiveCache;function r(a){return i[$e.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(l){return Hf(l,a,t)})}const o=[];for(let a=0,l=e.length;a0&&CA(_,r),_.name=t.createUniqueName(r.name||"mesh_"+e),xi(_,r),f.extensions&&ar(s,_,f),t.assignFinalMaterial(_),h.push(_)}for(let p=0,g=h.length;p1?l=new sn:a.length===1?l=a[0]:l=new st,l!==a[0])for(let c=0,u=a.length;c{const h=new Map;for(const[d,p]of r.associations)(d instanceof Gt||d instanceof yt)&&h.set(d,p);return u.traverse(d=>{const p=r.associations.get(d);p!=null&&h.set(d,p)}),h};return r.associations=c(o),o})}}function Vf(n,e,t,i){const s=t.nodes[n];return i.getDependency("node",n).then(function(r){if(s.skin===void 0)return r;let o;return i.getDependency("skin",s.skin).then(function(a){o=a;const l=[];for(let c=0,u=o.joints.length;c0){for(let s=0;s0)for(let s=0;s{qf(e)})}function qf(n){const e=i=>{i.geometry&&i.geometry.dispose(),i.material&&i.material.dispose&&i.material.dispose(),i.material.texture&&i.material.texture.dispose&&i.material.texture.dispose()},t=i=>{let s=i.children.filter(r=>r);s.forEach(r=>{r.children.length?t(r):r.isMesh&&e(r)}),s=null};t(n)}class RA extends jf{constructor(e,t){super(),this.frameTimer=-1,this.needsUpdate=!1,t=t||{},this.customCoords=e.customCoords,this.center=t.customCoordsCenter||e.getCenter().toArray(),this.customCoords.lngLatsToCoords([this.center]);const i={zooms:[2,20],opacity:1,alpha:!1,antialias:!1,visible:!0,zIndex:120};this.options=Object.assign({},i,t),this.map=e,this.init()}init(){const e=this.map,t=this.options,i={zooms:t.zooms,opacity:t.opacity,visible:t.visible,zIndex:t.zIndex,init:s=>{const r=e.getContainer(),o=r.offsetWidth,a=r.offsetHeight;let l;e.getView().type==="3D"?l=new St(60,o/a,100,1<<30):l=new ns(o/-2,o/2,a/2,a/-2,1,1e3);const c=new Np({context:s,alpha:t.alpha,antialias:t.antialias});c.setSize(o,a),c.autoClear=!1;const u=new Lw;this.camera=l,this.renderer=c,this.scene=u,t.onInit&&t.onInit(c,u,l),this.animate(),this.emit("complete")},render:()=>{var s,r,o;(s=this.renderer)===null||s===void 0||s.resetState(),this.customCoords.setCenter(this.center);const a=this.camera;if(e.getView().type==="3D"){const{near:l,far:c,fov:u,up:h,lookAt:d,position:p}=this.customCoords.getCameraParams();a.near=l,a.far=c,a.fov=u,a.position.set(...p),a.up.set(...h),a.lookAt(...d),a.updateProjectionMatrix()}else{const{top:l,bottom:c,left:u,right:h,position:d}=this.customCoords.getCameraParams();a.top=l,a.bottom=c,a.left=u,a.right=h,a.position.set(...d),a.updateProjectionMatrix()}this.camera=a,t.onRender?t.onRender(this.renderer,this.scene,this.camera):(r=this.renderer)===null||r===void 0||r.render(this.scene,a),(o=this.renderer)===null||o===void 0||o.resetState()}};this.layer=new AMap.GLCustomLayer(i),this.layer.setMap(e)}update(){this.needsUpdate=!0}animate(){this.needsUpdate&&(this.refreshMap(),this.needsUpdate=!1),this.frameTimer=requestAnimationFrame(()=>{this.animate()})}refreshMap(){this.map&&this.map.render()}convertLngLat(e){return this.customCoords.lngLatsToCoords([e])[0]}add(e){var t;(t=this.scene)===null||t===void 0||t.add(e),this.refreshMap()}remove(e){var t;(t=this.scene)===null||t===void 0||t.remove(e),this.refreshMap()}getScene(){return this.scene}getCamera(){return this.camera}getRender(){return this.renderer}destroy(){var e;cancelAnimationFrame(this.frameTimer),this.layer.setMap(null),this.customCoords=null,LA(this.scene),this.scene=void 0,this.camera=void 0,(e=this.renderer)===null||e===void 0||e.dispose(),this.renderer=void 0,this.layer=null,this.map=null,yi.clear(),this.options=null}getMap(){return this.map?this.map:null}getOpacity(){return this.layer.getOpacity()}setOpacity(e){this.layer.setOpacity(e)}getZooms(){return this.layer.getZooms()}setZooms(e){this.layer.setZooms(e)}getzIndex(){return this.layer.getzIndex()}setzIndex(e){this.layer.setzIndex(e)}show(){this.layer.show()}hide(){this.layer.hide()}}class PA extends jf{constructor(e,t){super(),this.linerAnimationFrame=-1,this.layer=e,t=Object.assign({},{url:"",position:[0,0],height:0,rotation:{x:0,y:0,z:0},scale:1,angle:0},t),this.init(t)}init(e){new sr().load(e.url,t=>{const i=t.scene,s=t.animations;this.layer.add(i),this.object=i,this.animations=s,this.setScale(e.scale),this.setRotation(e.rotation),this.setAngle(e.angle),this.setPosition(e.position),this.setHeight(e.height),e.onLoaded&&e.onLoaded(i,s),this.emit("complete",{target:i,animations:s})})}setScale(e){let t;typeof e=="number"?t={x:e,y:e,z:e}:t=e,this.object.scale.set(t.x,t.y,t.z),this.refresh()}setPosition(e){const t=this.layer.convertLngLat(e);this.object.position.setX(t[0]),this.object.position.setY(t[1]),this.refresh()}setRotation(e){if(e){const t=Math.PI/180*(e.x||0),i=Math.PI/180*(e.y||0),s=Math.PI/180*(e.z||0);this.object.rotation.set(t,i,s),this.refresh()}}setAngle(e){const t=this.object.rotation.x,i=this.object.rotation.z,s=Math.PI/180*e;this.object.rotation.set(t,s,i),this.refresh()}setHeight(e){e!==void 0&&(this.object.position.setZ(e),this.refresh())}getAnimations(){return this.animations}getObject(){return this.object}refresh(){this.layer.update()}show(){this.object.visible=!0,this.refresh()}hide(){this.object.visible=!1,this.refresh()}animate(e){this.linerAnimationFrame=requestAnimationFrame(()=>{this.animate(e)}),e()}startAnimations(){if(this.animations){const e=this.animations,t=new G1(this.object),i={};for(let r=0;r{const r=s.getDelta();t&&t.update(r),this.refresh()})}}stopAnimations(){cancelAnimationFrame(this.linerAnimationFrame)}remove(){this.object&&this.layer.remove(this.object)}destroy(){this.stopAnimations(),this.object&&(qf(this.object),this.object=null,this.layer=null)}}class IA extends vo{constructor(e,t,i,s,r){super();this.scene=e,this.camera=t,this.overrideMaterial=i,this.clearColor=s,this.clearAlpha=r!==void 0?r:0,this.clear=!0,this.clearDepth=!1,this.needsSwap=!1,this._oldClearColor=new ge}render(e,t,i){const s=e.autoClear;e.autoClear=!1;let r,o;this.overrideMaterial!==void 0&&(o=this.scene.overrideMaterial,this.scene.overrideMaterial=this.overrideMaterial),this.clearColor&&(e.getClearColor(this._oldClearColor),r=e.getClearAlpha(),e.setClearColor(this.clearColor,this.clearAlpha)),this.clearDepth&&e.clearDepth(),e.setRenderTarget(this.renderToScreen?null:i),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),e.render(this.scene,this.camera),this.clearColor&&e.setClearColor(this._oldClearColor,r),this.overrideMaterial!==void 0&&(this.scene.overrideMaterial=o),e.autoClear=s}}class DA extends IA{constructor(e,t,i,s,r){super(e,t,i,s,r);this.clear=!1}setCamera(e){this.camera=e}}class FA extends RA{constructor(e,t,i){t.onInit=(s,r)=>{if(this.raycaster=new Rf,t.axesHelper){const o=new H1(1e4);r.add(o)}this.createEffect(),this.createLights(t.lights||[]),this.createHDR(t.hdr),this.bindEvents(),i&&i()};super(e,t);this.lightTypes={AmbientLight:Tf,DirectionalLight:El,HemisphereLight:Mf,PointLight:Tl,RectAreaLight:E1,SpotLight:wl},this.passNum=0,this.passList=[],this.mouse=new ne}createEffect(){var e;const t=(e=this.renderer)==null?void 0:e.getSize(new ne);this.effectComposer=new Q1(this.renderer),this.effectComposer.setSize(t==null?void 0:t.x,t==null?void 0:t.y);const i=new DA(this.scene,this.camera);this.renderPass=i,this.effectComposer.addPass(i)}addPass(e){this.effectComposer.addPass(e),this.passNum++,this.passList.push(e)}removePass(e){const t=this.passList.indexOf(e);t!==-1&&this.passList.splice(t,1),this.effectComposer.removePass(e),this.passNum--}createLights(e){const t={type:"DirectionalLight",args:[]};e&&e.length>0&&e.forEach(i=>{if(i=Li({},t,i),this.lightTypes[i.type]){const s=new this.lightTypes[i.type](...i.args),r=i.position,o=i.lookAt;r&&s.position.set(r.x,r.y,r.z),o&&s.lookAt(o.x,o.y,o.z),this.add(s)}else console.warn("\u5F53\u524D\u8BBE\u7F6E\u7684\u706F\u5149\u7C7B\u578B\u4E0D\u5B58\u5728")})}createHDR(e){if(!e)return;const t=Li({},{urls:[],path:"/",exposure:1},e),i=this.renderer;i.physicallyCorrectLights=!0,i.outputEncoding=He,i.toneMappingExposure=t.exposure;const s=t.urls;let r=new el(i);r.compileCubemapShader();const o=new Y1().setPath(t.path).load(s,()=>{const a=r.fromCubemap(o);o.magFilter=Ze,o.needsUpdate=!0,this.envMap=a?a.texture:null,this.addEnvMap(this.scene),r.dispose(),r=null,this.refreshMap()})}addEnvMap(e){this.scene.environment=this.envMap}bindEvents(){this.clickFun=Ti(this._clickEvent,this),this.hoverFun=Ti(this._hoverEvent,this),this.map.on("click",this.clickFun),this.map.on("mousemove",this.hoverFun)}ubBindEvents(){this.map.off("click",this.clickFun),this.map.off("mousemove",this.hoverFun)}_clickEvent(e){const t=this._intersectGltf(e);t&&t.$vue.$emit("click",t)}_hoverEvent(e){var t;const i=this._intersectGltf(e);if(i)i.isHover||(i.isHover=!0,i.$vue.$emit("mouseover",i));else{const s=(t=this.scene)==null?void 0:t.children;s==null||s.forEach(r=>{r.isCustomGroup&&r.isHover===!0&&(r.isHover=!1,r.$vue.$emit("mouseout",r))})}}_intersectGltf(e){var t,i;const s=this.map.getContainer(),r=s.getBoundingClientRect(),o=r.top+window.pageYOffset-s.clientTop,a=r.left+window.pageXOffset-s.clientLeft;this.mouse.x=(e.originEvent.x+window.pageXOffset-a)/r.width*2-1,this.mouse.y=-((e.originEvent.y+window.pageYOffset-o)/r.height)*2+1;const l=this.camera;(t=this.raycaster)==null||t.setFromCamera(this.mouse,l);const c=(i=this.raycaster)==null?void 0:i.intersectObjects([this.scene],!0),u=c==null?void 0:c.length;if(u&&u>0){let h=null;for(let d=0;d{this.$amapComponent=new OA(this.$parentComponent,n,()=>{e()})})},destroyComponent(){this.$amapComponent.destroy(),this.$amapComponent=null,this.$parentComponent=null},convertLngLat(n){return this.$amapComponent.convertLngLat(n)},addObject(n){this.$amapComponent.addObject(n)},removeObject(n){this.$amapComponent.removeObject(n)},addEnvMap(n){this.$amapComponent.addEnvMap(n)},$$getScene(){return this.$amapComponent.getScene()},$$getRender(){return this.$amapComponent.getRender()},$$refresh(){this.$amapComponent.refreshMap()}}});function NA(n,e,t,i,s,r){return H.renderSlot(n.$slots,"default")}kl.render=NA,kl.__file="src/packages/three/ThreeLayer/ThreeLayer.vue";const Xf=ce(kl);var ds={Linear:{None:function(n){return n}},Quadratic:{In:function(n){return n*n},Out:function(n){return n*(2-n)},InOut:function(n){return(n*=2)<1?.5*n*n:-.5*(--n*(n-2)-1)}},Cubic:{In:function(n){return n*n*n},Out:function(n){return--n*n*n+1},InOut:function(n){return(n*=2)<1?.5*n*n*n:.5*((n-=2)*n*n+2)}},Quartic:{In:function(n){return n*n*n*n},Out:function(n){return 1- --n*n*n*n},InOut:function(n){return(n*=2)<1?.5*n*n*n*n:-.5*((n-=2)*n*n*n-2)}},Quintic:{In:function(n){return n*n*n*n*n},Out:function(n){return--n*n*n*n*n+1},InOut:function(n){return(n*=2)<1?.5*n*n*n*n*n:.5*((n-=2)*n*n*n*n+2)}},Sinusoidal:{In:function(n){return 1-Math.cos(n*Math.PI/2)},Out:function(n){return Math.sin(n*Math.PI/2)},InOut:function(n){return .5*(1-Math.cos(Math.PI*n))}},Exponential:{In:function(n){return n===0?0:Math.pow(1024,n-1)},Out:function(n){return n===1?1:1-Math.pow(2,-10*n)},InOut:function(n){return n===0?0:n===1?1:(n*=2)<1?.5*Math.pow(1024,n-1):.5*(-Math.pow(2,-10*(n-1))+2)}},Circular:{In:function(n){return 1-Math.sqrt(1-n*n)},Out:function(n){return Math.sqrt(1- --n*n)},InOut:function(n){return(n*=2)<1?-.5*(Math.sqrt(1-n*n)-1):.5*(Math.sqrt(1-(n-=2)*n)+1)}},Elastic:{In:function(n){return n===0?0:n===1?1:-Math.pow(2,10*(n-1))*Math.sin((n-1.1)*5*Math.PI)},Out:function(n){return n===0?0:n===1?1:Math.pow(2,-10*n)*Math.sin((n-.1)*5*Math.PI)+1},InOut:function(n){return n===0?0:n===1?1:(n*=2,n<1?-.5*Math.pow(2,10*(n-1))*Math.sin((n-1.1)*5*Math.PI):.5*Math.pow(2,-10*(n-1))*Math.sin((n-1.1)*5*Math.PI)+1)}},Back:{In:function(n){var e=1.70158;return n*n*((e+1)*n-e)},Out:function(n){var e=1.70158;return--n*n*((e+1)*n+e)+1},InOut:function(n){var e=1.70158*1.525;return(n*=2)<1?.5*(n*n*((e+1)*n-e)):.5*((n-=2)*n*((e+1)*n+e)+2)}},Bounce:{In:function(n){return 1-ds.Bounce.Out(1-n)},Out:function(n){return n<1/2.75?7.5625*n*n:n<2/2.75?7.5625*(n-=1.5/2.75)*n+.75:n<2.5/2.75?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375},InOut:function(n){return n<.5?ds.Bounce.In(n*2)*.5:ds.Bounce.Out(n*2-1)*.5+.5}}},lr;typeof self=="undefined"&&typeof process!="undefined"&&process.hrtime?lr=function(){var n=process.hrtime();return n[0]*1e3+n[1]/1e6}:typeof self!="undefined"&&self.performance!==void 0&&self.performance.now!==void 0?lr=self.performance.now.bind(self.performance):Date.now!==void 0?lr=Date.now:lr=function(){return new Date().getTime()};var ps=lr,kA=function(){function n(){this._tweens={},this._tweensAddedDuringUpdate={}}return n.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map(function(t){return e._tweens[t]})},n.prototype.removeAll=function(){this._tweens={}},n.prototype.add=function(e){this._tweens[e.getId()]=e,this._tweensAddedDuringUpdate[e.getId()]=e},n.prototype.remove=function(e){delete this._tweens[e.getId()],delete this._tweensAddedDuringUpdate[e.getId()]},n.prototype.update=function(e,t){e===void 0&&(e=ps()),t===void 0&&(t=!1);var i=Object.keys(this._tweens);if(i.length===0)return!1;for(;i.length>0;){this._tweensAddedDuringUpdate={};for(var s=0;s1?r(n[t],n[t-1],t-i):r(n[s],n[s+1>t?t:s+1],i-s)},Bezier:function(n,e){for(var t=0,i=n.length-1,s=Math.pow,r=cr.Utils.Bernstein,o=0;o<=i;o++)t+=s(1-e,i-o)*s(e,o)*n[o]*r(i,o);return t},CatmullRom:function(n,e){var t=n.length-1,i=t*e,s=Math.floor(i),r=cr.Utils.CatmullRom;return n[0]===n[t]?(e<0&&(s=Math.floor(i=t*(1+e))),r(n[(s-1+t)%t],n[s],n[(s+1)%t],n[(s+2)%t],i-s)):e<0?n[0]-(r(n[0],n[0],n[1],n[1],-i)-n[0]):e>1?n[t]-(r(n[t],n[t],n[t-1],n[t-1],i-t)-n[t]):r(n[s?s-1:0],n[s],n[t1;i--)t*=i;return n[e]=t,t}}(),CatmullRom:function(n,e,t,i,s){var r=(t-n)*.5,o=(i-e)*.5,a=s*s,l=s*a;return(2*e-2*t+r+o)*l+(-3*e+3*t-2*r-o)*a+r*s+e}}},BA=function(){function n(){}return n.nextId=function(){return n._nextId++},n._nextId=0,n}(),Yf=new kA,Jf=function(){function n(e,t){t===void 0&&(t=Yf),this._object=e,this._group=t,this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=ds.Linear.None,this._interpolationFunction=cr.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._id=BA.nextId(),this._isChainStopped=!1,this._goToEnd=!1}return n.prototype.getId=function(){return this._id},n.prototype.isPlaying=function(){return this._isPlaying},n.prototype.isPaused=function(){return this._isPaused},n.prototype.to=function(e,t){return this._valuesEnd=Object.create(e),t!==void 0&&(this._duration=t),this},n.prototype.duration=function(e){return this._duration=e,this},n.prototype.start=function(e){if(this._isPlaying)return this;if(this._group&&this._group.add(this),this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var t in this._valuesStartRepeat)this._swapEndStartRepeatValues(t),this._valuesStart[t]=this._valuesStartRepeat[t]}return this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e!==void 0?typeof e=="string"?ps()+parseFloat(e):e:ps(),this._startTime+=this._delayTime,this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat),this},n.prototype._setupProperties=function(e,t,i,s){for(var r in i){var o=e[r],a=Array.isArray(o),l=a?"array":typeof o,c=!a&&Array.isArray(i[r]);if(!(l==="undefined"||l==="function")){if(c){var u=i[r];if(u.length===0)continue;u=u.map(this._handleRelativeValue.bind(this,o)),i[r]=[o].concat(u)}if((l==="object"||a)&&o&&!c){t[r]=a?[]:{};for(var h in o)t[r][h]=o[h];s[r]=a?[]:{},this._setupProperties(o,t[r],i[r],s[r])}else typeof t[r]=="undefined"&&(t[r]=o),a||(t[r]*=1),c?s[r]=i[r].slice().reverse():s[r]=t[r]||0}}},n.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._group&&this._group.remove(this),this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},n.prototype.end=function(){return this._goToEnd=!0,this.update(1/0),this},n.prototype.pause=function(e){return e===void 0&&(e=ps()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this._group&&this._group.remove(this),this)},n.prototype.resume=function(e){return e===void 0&&(e=ps()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this._group&&this._group.add(this),this)},n.prototype.stopChainedTweens=function(){for(var e=0,t=this._chainedTweens.length;er)return!1;t&&this.start(e)}if(this._goToEnd=!1,e1?1:s;var o=this._easingFunction(s);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,o),this._onUpdateCallback&&this._onUpdateCallback(this._object,s),s===1)if(this._repeat>0){isFinite(this._repeat)&&this._repeat--;for(i in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[i]=="string"&&(this._valuesStartRepeat[i]=this._valuesStartRepeat[i]+parseFloat(this._valuesEnd[i])),this._yoyo&&this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i];return this._yoyo&&(this._reversed=!this._reversed),this._repeatDelayTime!==void 0?this._startTime=e+this._repeatDelayTime:this._startTime=e+this._delayTime,this._onRepeatCallback&&this._onRepeatCallback(this._object),!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var a=0,l=this._chainedTweens.length;a{r.isCustomGroup=!0,r.$vue=i,this.moveAnimation=t.moveAnimation,s&&s()};super(e,t);this.moveFrame=-1,this.angleFrame=-1}setScale(e){let t;typeof e=="number"?t=[e,e,e]:t=e,this.object.scale.set(...t)}setPosition(e){const t=this.layer.convertLngLat(e);!this.moveAnimation||!this.moveAnimation.smooth?(this._updatePosition(t),this.prePosition=t):this.prePosition?this._updatePositionTween(t):(this._updatePosition(t),this.prePosition=t)}_updatePositionTween(e){var t;if(!this.prePosition)return;this.prePositionTween&&this.prePositionTween.end();const i={x:this.prePosition[0],y:this.prePosition[1]};this._stopMoveAnimation();const s=((t=this.moveAnimation)==null?void 0:t.duration)||1e3;this.prePositionTween=new Jf(i).to({x:e[0],y:e[1]}).duration(s).easing(ds.Linear.None).onUpdate(()=>{this._updatePosition([i.x,i.y])}).start(),this._moveAnimate(),this.prePosition=e}_moveAnimate(){var e;(e=this.prePositionTween)==null||e.update(),this.moveFrame=requestAnimationFrame(()=>{this._moveAnimate()})}_stopMoveAnimation(){cancelAnimationFrame(this.moveFrame)}_updatePosition(e){this.object.position.setX(e[0]),this.object.position.setY(e[1]),this.refresh()}setAngle(e){!this.moveAnimation||!this.moveAnimation.smooth?(this._updateAngle(e),this.preAngle=e):this.preAngle===void 0?(this._updateAngle(e),this.preAngle=e):this._updateAngleTween(e)}_updateAngle(e){const t=this.object.rotation.x,i=this.object.rotation.z,s=Math.PI/180*e;this.object.rotation.set(t,s,i),this.refresh()}_updateAngleTween(e){var t;if(this.preAngle===void 0)return;this.preAngleTween&&this.preAngleTween.end();const i={angle:this.preAngle};this._stopAngleAnimation();const s=((t=this.moveAnimation)==null?void 0:t.duration)||1e3;this.preAngleTween=new Jf(i).to({angle:e}).duration(s).easing(ds.Linear.None).onUpdate(()=>{this._updateAngle(i.angle)}).onComplete(()=>{this._stopAngleAnimation()}).start(),this._angleAnimate(),this.preAngle=e}_angleAnimate(){var e;(e=this.preAngleTween)==null||e.update(),this.angleFrame=requestAnimationFrame(()=>{this._angleAnimate()})}_stopAngleAnimation(){cancelAnimationFrame(this.angleFrame)}setMoveAnimation(e){this.moveAnimation=e}remove(){this.object&&this.layer.removeObject(this.object)}destroy(){this._stopAngleAnimation(),this._stopMoveAnimation(),this.prePosition=void 0,this.preAngle=void 0,this.prePositionTween=void 0,this.preAngleTween=void 0,this.object&&(this.object.$vue=null),super.destroy()}}var UA=$A,Zf=H.defineComponent({name:"ElAmapThreeGltf",mixins:[le],props:{url:{type:String},position:{type:Array},height:{type:Number,default:0},rotation:{type:Object},scale:{type:[Number,Array],default:1},angle:{type:Number,default:0},moveAnimation:{type:Object}},emits:["click","mousemove","mouseover","mouseout"],data(){return{}},methods:{__initComponent(n){return new Promise(e=>{this.$amapComponent=new UA(this.$parentComponent,n,this,()=>{e()})})},destroyComponent(){this.parentInstance.isDestroy||this.$amapComponent.remove(),this.$amapComponent.destroy()},$$startAnimations(){this.$amapComponent.startAnimations()},$$stopAnimations(){this.$amapComponent.stopAnimations()}},render(){return null}});Zf.__file="src/packages/three/ThreeGltf/ThreeGltf.vue";const Kf=ce(Zf);var Qf=H.defineComponent({name:"ElAmapControlGeolocation",mixins:[le],props:{position:{type:String},offset:{type:Array},borderColor:{type:String},borderRadius:{type:String},buttonSize:{type:String},convert:{type:Boolean,default:!0},enableHighAccuracy:{type:Boolean,default:!1},timeout:{type:Number},maximumAge:{type:Number},showButton:{type:Boolean,default:!0},showCircle:{type:Boolean,default:!0},showMarker:{type:Boolean,default:!0},markerOptions:{type:Object},circleOptions:{type:Object},panToLocation:{type:Boolean,default:!0},zoomToAccuracy:{type:Boolean,default:!0},GeoLocationFirst:{type:Boolean,default:!0},noIpLocate:{type:Number},noGeoLocation:{type:Number},useNative:{type:Boolean,default:!1},getCityWhenFail:{type:Boolean,default:!1},needAddress:{type:Boolean,default:!1},extensions:{type:String,validator(n){return["base","all"].indexOf(n)!==-1}}},emits:["complete"],data(){return{}},methods:{__initComponent(n){return new Promise(e=>{this.$parentComponent.plugin(["AMap.Geolocation"],()=>{this.$amapComponent=new AMap.Geolocation(n),this.$parentComponent.addControl(this.$amapComponent),this.$amapComponent.on("complete",t=>{this.$emit("complete",t)}),e()})})},destroyComponent(){this.$amapComponent&&this.$parentComponent&&(this.parentInstance.isDestroy||this.$parentComponent.removeControl(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null)}},render(){return null}});Qf.__file="src/packages/control/Geolocation/Geolocation.vue";const em=ce(Qf);var tm=H.defineComponent({name:"ElAmapCircleMarker",mixins:[le],props:{zIndex:{type:Number},center:{type:Array,required:!0},bubble:{type:Boolean,default:!1},cursor:{type:String},radius:{type:Number},strokeColor:{type:String},strokeOpacity:{type:Number},strokeWeight:{type:Number},fillColor:{type:String},fillOpacity:{type:Number},draggable:{type:Boolean,default:!1},extData:{type:Object}},emits:["update:center"],data(){return{converters:{},handlers:{}}},methods:{__initComponent(n){this.$parentComponent=this.parentInstance.$amapComponent,this.$amapComponent=new AMap.CircleMarker(n),this.$parentComponent.add(this.$amapComponent),this.bindModelEvents()},bindModelEvents(){this.$amapComponent.on("dragend",()=>{this.emitPosition()}),this.$amapComponent.on("touchend",()=>{this.emitPosition()})},emitPosition(){const n=this.$amapComponent.getCenter();this.$emit("update:center",n.toArray())},destroyComponent(){this.parentInstance.isDestroy||this.$parentComponent.remove(this.$amapComponent),this.$amapComponent=null},__strokeColor(n){this.$amapComponent.setOptions({strokeColor:n})},__strokeOpacity(n){this.$amapComponent.setOptions({strokeOpacity:n})},__strokeWeight(n){this.$amapComponent.setOptions({strokeWeight:n})},__fillColor(n){this.$amapComponent.setOptions({fillColor:n})},__fillOpacity(n){this.$amapComponent.setOptions({fillOpacity:n})}},render(){return null}});tm.__file="src/packages/marker/CircleMarker/CircleMarker.vue";const nm=ce(tm);var im=H.defineComponent({name:"ElAmapLocaAmbientLight",mixins:[le],props:{color:{type:String},intensity:{type:Number}},data(){return{converters:{},handlers:{}}},methods:{__initComponent(n){this.$amapComponent=new Loca.AmbientLight(n),this.$parentComponent.addLight(this.$amapComponent)},destroyComponent(){this.parentInstance.isDestroy||this.$parentComponent.removeLight(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null}},render(){return null}});im.__file="src/packages/loca/AmbientLight/AmbientLight.vue";const sm=ce(im);var rm=H.defineComponent({name:"ElAmapLocaDirectionalLight",mixins:[le],props:{color:{type:String},intensity:{type:Number},position:{type:Array,required:!0},target:{type:Array}},data(){return{converters:{},handlers:{}}},methods:{__initComponent(n){this.$amapComponent=new Loca.DirectionalLight(n),this.$parentComponent.addLight(this.$amapComponent)},destroyComponent(){this.parentInstance.isDestroy||this.$parentComponent.removeLight(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null}},render(){return null}});rm.__file="src/packages/loca/DirectionalLight/DirectionalLight.vue";const om=ce(rm);var am=H.defineComponent({name:"ElAmapLocaPointLight",mixins:[le],props:{color:{type:String},intensity:{type:Number},position:{type:Array,required:!0},distance:{type:Number}},data(){return{converters:{},handlers:{}}},methods:{__initComponent(n){this.$amapComponent=new Loca.PointLight(n),this.$parentComponent.addLight(this.$amapComponent)},destroyComponent(){this.parentInstance.isDestroy||this.$parentComponent.removeLight(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null}},render(){return null}});am.__file="src/packages/loca/PointLight/PointLight.vue";const lm=ce(am);class zA{constructor(e,t){this.canPlay=!1,this.frame=-1;const i=document.createElement("canvas");this.video=t,t.src=e.url,t.autoplay=!0,t.loop=e.loop;const s={...e,canvas:i};this.canvas=i,this.context=i.getContext("2d"),this.layer=new AMap.CanvasLayer(s),this.initVideoEvents(),this.load()}getLayer(){return this.layer}initVideoEvents(){var e;(e=this.video)==null||e.addEventListener("canplaythrough",()=>{var t,i;this.canvas&&(this.canvas.width=(t=this.video)==null?void 0:t.videoWidth,this.canvas.height=(i=this.video)==null?void 0:i.videoHeight),this.canPlay=!0,this.play()})}load(){var e;(e=this.video)==null||e.load()}play(){var e;this.canPlay&&((e=this.video)==null||e.play(),this.stopRender(),this.render())}pause(){var e;this.stopRender(),(e=this.video)==null||e.pause()}stopRender(){this.frame&&cancelAnimationFrame(this.frame)}render(){var e,t,i,s,r,o,a,l;this.frame=window.requestAnimationFrame(()=>{this.render()}),((e=this.video)==null?void 0:e.paused)?(t=this.video)==null||t.play():((r=this.context)==null||r.clearRect(0,0,(i=this.canvas)==null?void 0:i.width,(s=this.canvas)==null?void 0:s.height),(l=this.context)==null||l.drawImage(this.video,0,0,(o=this.canvas)==null?void 0:o.width,(a=this.canvas)==null?void 0:a.height),this.layer.reFresh())}destroy(){this.stopRender(),this.video&&this.video.pause(),this.video=null}setUrl(e){this.stopRender(),this.canPlay=!1,this.video&&(this.video.src=e,this.load())}setZooms(e){this.getLayer().setZoom(e)}setOpacity(e){this.getLayer().setOpacity(e)}setBounds(e){this.getLayer().setBounds(e)}setzIndex(e){this.getLayer().setzIndex(e)}show(){this.getLayer().show()}hide(){this.getLayer().hide()}}var GA=zA,Bl=H.defineComponent({name:"ElAmapLayerVideo",mixins:[le],props:{url:{required:!0,type:String},zooms:{type:Array},bounds:{type:[Array,Object]},opacity:{type:Number}},data(){return{handlers:{}}},methods:{__initComponent(n){this.$amapComponent=new GA(n,this.$refs.video),this.$parentComponent.addLayer(this.$amapComponent.getLayer())},destroyComponent(){this.$amapComponent.destroy(),this.parentInstance.isDestroy||this.$parentComponent.removeLayer(this.$amapComponent),this.$amapComponent=null,this.$parentComponent=null},$$play(){this.$amapComponent.play()},$$pause(){this.$amapComponent.pause()}},render(){return null}});const VA={ref:"video",style:{display:"none"},muted:""};function HA(n,e,t,i,s,r){return H.openBlock(),H.createElementBlock("video",VA,null,512)}Bl.render=HA,Bl.__file="src/packages/layer/data/Video/Video.vue";const cm=ce(Bl);var hm=H.defineComponent({name:"ElAmapLocaLaser",mixins:[le,Et],props:{depth:{type:Boolean,default:!0}},data(){return{converters:{}}},methods:{__initComponent(n){this.$amapComponent=new Loca.LaserLayer(n),this.setSource(),this.setStyle(),this.$parentComponent.add(this.$amapComponent),this.initComplete()},setStyle(){const e=Object.assign({},{unit:"px",height:200,color:"rgba(255,255,0,0.5)",angle:0,lineWidth:2,trailLength:30,duration:2e3,interval:0,delay:0,repeat:void 0},this.defaultStyleValue),t={unit:e.unit,height:(s,r)=>(r.properties=r.properties||{},r.properties.height===void 0?e.height:r.properties.height),color:(s,r)=>(r.properties=r.properties||{},r.properties.color===void 0?e.color:r.properties.color),angle:e.angle,lineWidth:e.lineWidth,trailLength:e.trailLength,duration:(s,r)=>(r.properties=r.properties||{},r.properties.duration===void 0?e.duration:r.properties.duration),interval:(s,r)=>(r.properties=r.properties||{},r.properties.interval===void 0?e.interval:r.properties.interval),delay:(s,r)=>(r.properties=r.properties||{},r.properties.delay===void 0?e.delay:r.properties.delay),repeat:e.repeat},i=Object.assign({},t,this.layerStyle);this.$amapComponent.setStyle(i)}},render(){return null}});hm.__file="src/packages/loca/LaserLayer/LaserLayer.vue";const um=ce(hm);function dm(n){const e=i=>{i.geometry&&i.geometry.dispose(),i.material&&i.material.dispose&&i.material.dispose(),i.material.texture&&i.material.texture.dispose&&i.material.texture.dispose()},t=i=>{let s=i.children.filter(r=>r);s.forEach(r=>{r.children.length?t(r):r.isMesh&&e(r)}),s=null};t(n)}class WA{constructor(e){this.videoFrame=-1,this.layer=e}init(e,t){return this.video=e.video,this.object=new sn,this.object.isCustomGroup=!0,this.object.$vue=t,new Promise(i=>{var s,r,o,a,l;(s=this.video)==null||s.load(),(r=this.video)==null||r.play();const c=new Nw(this.video),u=new Hs(e.videoWidth||((o=this.video)==null?void 0:o.videoWidth),e.videoHeight||((a=this.video)==null?void 0:a.videoHeight)),h=new ff({map:c,side:Yt,transparent:!0,depthTest:!1}),d=new ft(u,h);d.renderOrder=3,d.rotation.y=Math.PI,d.name="video",this.videoMesh=d,this.object.add(d),this.setVideoTranslate(e.videoTranslate),this.setPosition(e.position),this.setRotation(e.rotation),this.setScale(e.scale),this.setAltitude(e.altitude),(l=this.layer)==null||l.add(this.object),this.videoAnimate(),this.addBgCanvas(e.canvas),this.setAngle(e.angle),this.setOpacity(e.opacity),this.setzIndex(e.zIndex||0),this.bindAlwaysFront(e.alwaysFront),i()})}bindAlwaysFront(e){var t;if(e){const i=(t=this.layer)==null?void 0:t.getMap();this.rotateFun=Ti(this._changeMapRotate,this),i.on("rotatechange",this.rotateFun)}}unBindAlwaysFront(){var e;if(this.rotateFun){const t=(e=this.layer)==null?void 0:e.getMap();t&&t.off("rotatechange",this.rotateFun)}}_changeMapRotate(){var e;const i=((e=this.layer)==null?void 0:e.getMap()).getRotation();this.setAngle(i)}addBgCanvas(e){if(!e)return;const t=new kw(e),i=new Hs(e.width,e.height),s=new ff({map:t,side:Yt,transparent:!0,depthTest:!1}),r=new ft(i,s);r.name="bg",r.renderOrder=1,this.object.add(r),this.canvasTexture=t,this.bgMesh=r}videoAnimate(){this.videoFrame=requestAnimationFrame(()=>{this.videoAnimate()}),this.canvasTexture&&(this.canvasTexture.needsUpdate=!0),this.refresh()}cancelCanvasTextureAnimate(){this.videoFrame>0&&cancelAnimationFrame(this.videoFrame)}setScale(e){let t;typeof e=="number"?t=[e,e,e]:t=e,this.object.scale.set(...t)}setPosition(e){var t;const i=(t=this.layer)==null?void 0:t.convertLngLat(e);this.object.position.setX(i[0]),this.object.position.setY(i[1]),this.refresh()}setRotation(e){if(e){const t=Math.PI/180*(e.x||0),i=Math.PI/180*(e.y||0),s=Math.PI/180*(e.z||0);this.object.rotation.set(t,i,s),this.refresh()}}setVideoTranslate(e){e&&(this.videoMesh.translateX(e.x),this.videoMesh.translateY(e.y),this.videoMesh.translateZ(e.z),this.refresh())}setAltitude(e){e!==void 0&&(this.object.position.setZ(e),this.refresh())}setAngle(e){if(e!==void 0){const t=this.object.rotation.x,i=this.object.rotation.z,s=Math.PI/180*e;this.object.rotation.set(t,s,i),this.refresh()}}setOpacity(e){this.videoMesh.material.opacity=e,this.bgMesh&&(this.bgMesh.material.opacity=e),this.refresh()}setzIndex(e){this.object.renderOrder=e}refresh(){var e;(e=this.layer)==null||e.update()}show(){this.object.visible=!0,this.refresh()}hide(){this.object.visible=!1,this.refresh()}start(){var e;(e=this.video)==null||e.play()}pause(){var e;(e=this.video)==null||e.pause()}remove(){var e;this.object&&((e=this.layer)==null||e.remove(this.object),this.unBindAlwaysFront())}destroy(){this.cancelCanvasTextureAnimate(),this.unBindAlwaysFront(),this.object&&(this.object.$vue=null,dm(this.object),this.video=void 0,this.videoMesh=void 0,this.bgMesh=void 0,this.canvasTexture=void 0,this.rotateFun=void 0,this.object=null,this.layer=void 0)}}var jA=WA,$l=H.defineComponent({name:"ElAmapThreeVideo",mixins:[le],props:{video:{type:[String,Array,HTMLVideoElement],required:!0},videoTranslate:{type:Object,default(){return{x:0,y:0,z:0}}},videoWidth:{type:Number},videoHeight:{type:Number},canvas:{type:Object},position:{type:Array,required:!0},altitude:{type:Number,default:0},rotation:{type:Object},scale:{type:[Number,Array],default:1},angle:{type:Number,default:0},opacity:{type:Number,default:1},alwaysFront:{type:Boolean,default:!1}},emits:["click","mousemove","mouseover","mouseout"],data(){return{videoUrlList:[]}},methods:{__initComponent(n){const e=Object.prototype.toString.call(n.video);return e==="[object String]"?this.videoUrlList=[n.video]:e==="[object Array]"&&(this.videoUrlList=n.video),this.videoUrlList.length>0&&(n.video=this.$refs.video),this.$amapComponent=new jA(this.$parentComponent),new Promise(t=>{this.$nextTick(()=>{this.$amapComponent.init(n,this).then(()=>{t()})})})},destroyComponent(){this.parentInstance.isDestroy||this.$amapComponent.remove(),this.$amapComponent.destroy()},$$start(){this.$amapComponent.start()},$$pause(){this.$amapComponent.pause()}}});const qA={ref:"video",style:{display:"none"},muted:"",loop:"",autoplay:"",crossOrigin:"anonymous"},XA=["src"];function YA(n,e,t,i,s,r){return H.openBlock(),H.createElementBlock("video",qA,[(H.openBlock(!0),H.createElementBlock(H.Fragment,null,H.renderList(n.videoUrlList,o=>(H.openBlock(),H.createElementBlock("source",{key:o,src:o,type:"video/mp4"},null,8,XA))),128))],512)}$l.render=YA,$l.__file="src/packages/three/ThreeVideo/ThreeVideo.vue";const pm=ce($l);class JA{constructor(e,t){this.layer=e;const i=new Tf(this.getColorHex(t.color),t.intensity);this.object=i,e.add(i)}setColor(e){this.object.color=new ge(e),this.refresh()}getColorHex(e){return new ge(e).getHex()}setIntensity(e){this.object.intensity=e,this.refresh()}refresh(){var e;(e=this.layer)==null||e.update()}remove(){var e;this.object&&((e=this.layer)==null||e.remove(this.object))}destroy(){this.object&&(this.object=null,this.layer=null)}}var ZA=JA,fm=H.defineComponent({name:"ElAmapThreeLightAmbient",mixins:[le],props:{color:{type:String,default:"#ffffff"},intensity:{type:Number,default:1}},data(){return{}},methods:{__initComponent(n){this.$amapComponent=new ZA(this.$parentComponent,n)},destroyComponent(){this.parentInstance.isDestroy||this.$amapComponent.remove(),this.$amapComponent.destroy()}},render(){return null}});fm.__file="src/packages/three/ThreeLightAmbient/ThreeLightAmbient.vue";const mm=ce(fm);class KA{constructor(e,t){this.layer=e;const i=new El(this.getColorHex(t.color),t.intensity);this.object=i,this.setPosition(t.position),e.add(i)}setColor(e){this.object.color=new ge(e),this.refresh()}getColorHex(e){return new ge(e).getHex()}setIntensity(e){this.object.intensity=e,this.refresh()}setPosition(e){this.object.position.set(e.x,e.y,e.z),this.refresh()}setTarget(e){e&&(this.object.target=e,this.refresh())}refresh(){var e;(e=this.layer)==null||e.update()}remove(){var e;this.object&&((e=this.layer)==null||e.remove(this.object))}destroy(){this.object&&(this.object=null,this.layer=null)}}var QA=KA,gm=H.defineComponent({name:"ElAmapThreeLightDirectional",mixins:[le],props:{color:{type:String,default:"#ffffff"},intensity:{type:Number,default:1},position:{type:Object,default:()=>({x:0,y:0,z:1})},target:{type:Object}},data(){return{}},methods:{__initComponent(n){this.$amapComponent=new QA(this.$parentComponent,n)},destroyComponent(){this.parentInstance.isDestroy||this.$amapComponent.remove(),this.$amapComponent.destroy()}},render(){return null}});gm.__file="src/packages/three/ThreeLightDirectional/ThreeLightDirectional.vue";const _m=ce(gm);class eT{constructor(e,t){this.layer=e;const i=new Mf(this.getColorHex(t.color),this.getColorHex(t.groundColor),t.intensity);this.object=i,this.setPosition(t.position),e.add(i)}setColor(e){this.object.color=new ge(e),this.refresh()}setGroundColor(e){this.object.groundColor=new ge(e),this.refresh()}getColorHex(e){return new ge(e).getHex()}setIntensity(e){this.object.intensity=e,this.refresh()}setPosition(e){this.object.position.set(e.x,e.y,e.z),this.refresh()}refresh(){var e;(e=this.layer)==null||e.update()}remove(){var e;this.object&&((e=this.layer)==null||e.remove(this.object))}destroy(){this.object&&(this.object=null,this.layer=null)}}var tT=eT,ym=H.defineComponent({name:"ElAmapThreeLightHemisphere",mixins:[le],props:{color:{type:String,default:"#ffffff"},groundColor:{type:String,default:"#ffffff"},intensity:{type:Number,default:1},position:{type:Object,required:!0}},data(){return{}},methods:{__initComponent(n){this.$amapComponent=new tT(this.$parentComponent,n)},destroyComponent(){this.parentInstance.isDestroy||this.$amapComponent.remove(),this.$amapComponent.destroy()}},render(){return null}});ym.__file="src/packages/three/ThreeLightHemisphere/ThreeLightHemisphere.vue";const vm=ce(ym);class nT{constructor(e,t){this.layer=e;const i=new Tl(this.getColorHex(t.color),t.intensity,t.distance,t.decay);this.object=i,this.setPosition(t.position),e.add(i)}setColor(e){this.object.color=new ge(e),this.refresh()}getColorHex(e){return new ge(e).getHex()}setIntensity(e){this.object.intensity=e,this.refresh()}setPosition(e){var t;const i=(t=this.layer)==null?void 0:t.convertLngLat([e.x,e.y]);this.object.position.set(i[0],i[1],e.z),this.refresh()}refresh(){var e;(e=this.layer)==null||e.update()}remove(){var e;this.object&&((e=this.layer)==null||e.remove(this.object))}destroy(){this.object&&(this.object=null,this.layer=null)}}var iT=nT,xm=H.defineComponent({name:"ElAmapThreeLightPoint",mixins:[le],props:{color:{type:String,default:"#ffffff"},intensity:{type:Number,default:1},distance:{type:Number,default:0},decay:{type:Number,default:1},position:{type:Object,required:!0}},data(){return{}},methods:{__initComponent(n){this.$amapComponent=new iT(this.$parentComponent,n)},destroyComponent(){this.parentInstance.isDestroy||this.$amapComponent.remove(),this.$amapComponent.destroy()}},render(){return null}});xm.__file="src/packages/three/ThreeLightPoint/ThreeLightPoint.vue";const bm=ce(xm);class sT{constructor(e,t){this.layer=e;const i=new wl(this.getColorHex(t.color),t.intensity,t.distance,t.angle,t.penumbra,t.decay);this.object=i,this.setPosition(t.position),this.setTarget(t.target),e.add(i)}setColor(e){this.object.color=new ge(e),this.refresh()}getColorHex(e){return new ge(e).getHex()}setIntensity(e){this.object.intensity=e,this.refresh()}setPosition(e){var t;const i=(t=this.layer)==null?void 0:t.convertLngLat([e.x,e.y]);this.object.position.set(i[0],i[1],e.z),this.refresh()}setTarget(e){e&&(this.object.target=e,this.refresh())}refresh(){var e;(e=this.layer)==null||e.update()}remove(){var e;this.object&&((e=this.layer)==null||e.remove(this.object))}destroy(){this.object&&(this.object=null,this.layer=null)}}var rT=sT,Mm=H.defineComponent({name:"ElAmapThreeLightSpot",mixins:[le],props:{color:{type:String,default:"#ffffff"},intensity:{type:Number,default:1},distance:{type:Number,default:0},angle:{type:Number,default:0},penumbra:{type:Number,default:0},decay:{type:Number,default:1},position:{type:Object,required:!0},target:{type:Object}},data(){return{}},methods:{__initComponent(n){this.$amapComponent=new rT(this.$parentComponent,n)},destroyComponent(){this.parentInstance.isDestroy||this.$amapComponent.remove(),this.$amapComponent.destroy()}},render(){return null}});Mm.__file="src/packages/three/ThreeLightSpot/ThreeLightSpot.vue";const Sm=ce(Mm);var Cm={exports:{}},wm={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},Am={exports:{}},oT=function(e){return!e||typeof e=="string"?!1:e instanceof Array||Array.isArray(e)||e.length>=0&&(e.splice instanceof Function||Object.getOwnPropertyDescriptor(e,e.length-1)&&e.constructor.name!=="String")},aT=oT,lT=Array.prototype.concat,cT=Array.prototype.slice,Tm=Am.exports=function(e){for(var t=[],i=0,s=e.length;i=4&&n[3]!==1&&(e=", "+n[3]),"hwb("+n[0]+", "+n[1]+"%, "+n[2]+"%"+e+")"},Ft.to.keyword=function(n){return Lm[n.slice(0,3)]};function Yn(n,e,t){return Math.min(Math.max(e,n),t)}function xo(n){var e=Math.round(n).toString(16).toUpperCase();return e.length<2?"0"+e:e}const dr=wm,Rm={};for(const n of Object.keys(dr))Rm[dr[n]]=n;const ye={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};var Pm=ye;for(const n of Object.keys(ye)){if(!("channels"in ye[n]))throw new Error("missing channels property: "+n);if(!("labels"in ye[n]))throw new Error("missing channel labels property: "+n);if(ye[n].labels.length!==ye[n].channels)throw new Error("channel and label counts mismatch: "+n);const{channels:e,labels:t}=ye[n];delete ye[n].channels,delete ye[n].labels,Object.defineProperty(ye[n],"channels",{value:e}),Object.defineProperty(ye[n],"labels",{value:t})}ye.rgb.hsl=function(n){const e=n[0]/255,t=n[1]/255,i=n[2]/255,s=Math.min(e,t,i),r=Math.max(e,t,i),o=r-s;let a,l;r===s?a=0:e===r?a=(t-i)/o:t===r?a=2+(i-e)/o:i===r&&(a=4+(e-t)/o),a=Math.min(a*60,360),a<0&&(a+=360);const c=(s+r)/2;return r===s?l=0:c<=.5?l=o/(r+s):l=o/(2-r-s),[a,l*100,c*100]},ye.rgb.hsv=function(n){let e,t,i,s,r;const o=n[0]/255,a=n[1]/255,l=n[2]/255,c=Math.max(o,a,l),u=c-Math.min(o,a,l),h=function(d){return(c-d)/6/u+1/2};return u===0?(s=0,r=0):(r=u/c,e=h(o),t=h(a),i=h(l),o===c?s=i-t:a===c?s=1/3+e-i:l===c&&(s=2/3+t-e),s<0?s+=1:s>1&&(s-=1)),[s*360,r*100,c*100]},ye.rgb.hwb=function(n){const e=n[0],t=n[1];let i=n[2];const s=ye.rgb.hsl(n)[0],r=1/255*Math.min(e,Math.min(t,i));return i=1-1/255*Math.max(e,Math.max(t,i)),[s,r*100,i*100]},ye.rgb.cmyk=function(n){const e=n[0]/255,t=n[1]/255,i=n[2]/255,s=Math.min(1-e,1-t,1-i),r=(1-e-s)/(1-s)||0,o=(1-t-s)/(1-s)||0,a=(1-i-s)/(1-s)||0;return[r*100,o*100,a*100,s*100]};function hT(n,e){return(n[0]-e[0])**2+(n[1]-e[1])**2+(n[2]-e[2])**2}ye.rgb.keyword=function(n){const e=Rm[n];if(e)return e;let t=1/0,i;for(const s of Object.keys(dr)){const r=dr[s],o=hT(n,r);o.04045?((e+.055)/1.055)**2.4:e/12.92,t=t>.04045?((t+.055)/1.055)**2.4:t/12.92,i=i>.04045?((i+.055)/1.055)**2.4:i/12.92;const s=e*.4124+t*.3576+i*.1805,r=e*.2126+t*.7152+i*.0722,o=e*.0193+t*.1192+i*.9505;return[s*100,r*100,o*100]},ye.rgb.lab=function(n){const e=ye.rgb.xyz(n);let t=e[0],i=e[1],s=e[2];t/=95.047,i/=100,s/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,i=i>.008856?i**(1/3):7.787*i+16/116,s=s>.008856?s**(1/3):7.787*s+16/116;const r=116*i-16,o=500*(t-i),a=200*(i-s);return[r,o,a]},ye.hsl.rgb=function(n){const e=n[0]/360,t=n[1]/100,i=n[2]/100;let s,r,o;if(t===0)return o=i*255,[o,o,o];i<.5?s=i*(1+t):s=i+t-i*t;const a=2*i-s,l=[0,0,0];for(let c=0;c<3;c++)r=e+1/3*-(c-1),r<0&&r++,r>1&&r--,6*r<1?o=a+(s-a)*6*r:2*r<1?o=s:3*r<2?o=a+(s-a)*(2/3-r)*6:o=a,l[c]=o*255;return l},ye.hsl.hsv=function(n){const e=n[0];let t=n[1]/100,i=n[2]/100,s=t;const r=Math.max(i,.01);i*=2,t*=i<=1?i:2-i,s*=r<=1?r:2-r;const o=(i+t)/2,a=i===0?2*s/(r+s):2*t/(i+t);return[e,a*100,o*100]},ye.hsv.rgb=function(n){const e=n[0]/60,t=n[1]/100;let i=n[2]/100;const s=Math.floor(e)%6,r=e-Math.floor(e),o=255*i*(1-t),a=255*i*(1-t*r),l=255*i*(1-t*(1-r));switch(i*=255,s){case 0:return[i,l,o];case 1:return[a,i,o];case 2:return[o,i,l];case 3:return[o,a,i];case 4:return[l,o,i];case 5:return[i,o,a]}},ye.hsv.hsl=function(n){const e=n[0],t=n[1]/100,i=n[2]/100,s=Math.max(i,.01);let r,o;o=(2-t)*i;const a=(2-t)*s;return r=t*s,r/=a<=1?a:2-a,r=r||0,o/=2,[e,r*100,o*100]},ye.hwb.rgb=function(n){const e=n[0]/360;let t=n[1]/100,i=n[2]/100;const s=t+i;let r;s>1&&(t/=s,i/=s);const o=Math.floor(6*e),a=1-i;r=6*e-o,(o&1)!=0&&(r=1-r);const l=t+r*(a-t);let c,u,h;switch(o){default:case 6:case 0:c=a,u=l,h=t;break;case 1:c=l,u=a,h=t;break;case 2:c=t,u=a,h=l;break;case 3:c=t,u=l,h=a;break;case 4:c=l,u=t,h=a;break;case 5:c=a,u=t,h=l;break}return[c*255,u*255,h*255]},ye.cmyk.rgb=function(n){const e=n[0]/100,t=n[1]/100,i=n[2]/100,s=n[3]/100,r=1-Math.min(1,e*(1-s)+s),o=1-Math.min(1,t*(1-s)+s),a=1-Math.min(1,i*(1-s)+s);return[r*255,o*255,a*255]},ye.xyz.rgb=function(n){const e=n[0]/100,t=n[1]/100,i=n[2]/100;let s,r,o;return s=e*3.2406+t*-1.5372+i*-.4986,r=e*-.9689+t*1.8758+i*.0415,o=e*.0557+t*-.204+i*1.057,s=s>.0031308?1.055*s**(1/2.4)-.055:s*12.92,r=r>.0031308?1.055*r**(1/2.4)-.055:r*12.92,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,s=Math.min(Math.max(0,s),1),r=Math.min(Math.max(0,r),1),o=Math.min(Math.max(0,o),1),[s*255,r*255,o*255]},ye.xyz.lab=function(n){let e=n[0],t=n[1],i=n[2];e/=95.047,t/=100,i/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,t=t>.008856?t**(1/3):7.787*t+16/116,i=i>.008856?i**(1/3):7.787*i+16/116;const s=116*t-16,r=500*(e-t),o=200*(t-i);return[s,r,o]},ye.lab.xyz=function(n){const e=n[0],t=n[1],i=n[2];let s,r,o;r=(e+16)/116,s=t/500+r,o=r-i/200;const a=r**3,l=s**3,c=o**3;return r=a>.008856?a:(r-16/116)/7.787,s=l>.008856?l:(s-16/116)/7.787,o=c>.008856?c:(o-16/116)/7.787,s*=95.047,r*=100,o*=108.883,[s,r,o]},ye.lab.lch=function(n){const e=n[0],t=n[1],i=n[2];let s;s=Math.atan2(i,t)*360/2/Math.PI,s<0&&(s+=360);const o=Math.sqrt(t*t+i*i);return[e,o,s]},ye.lch.lab=function(n){const e=n[0],t=n[1],s=n[2]/360*2*Math.PI,r=t*Math.cos(s),o=t*Math.sin(s);return[e,r,o]},ye.rgb.ansi16=function(n,e=null){const[t,i,s]=n;let r=e===null?ye.rgb.hsv(n)[2]:e;if(r=Math.round(r/50),r===0)return 30;let o=30+(Math.round(s/255)<<2|Math.round(i/255)<<1|Math.round(t/255));return r===2&&(o+=60),o},ye.hsv.ansi16=function(n){return ye.rgb.ansi16(ye.hsv.rgb(n),n[2])},ye.rgb.ansi256=function(n){const e=n[0],t=n[1],i=n[2];return e===t&&t===i?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(i/255*5)},ye.ansi16.rgb=function(n){let e=n%10;if(e===0||e===7)return n>50&&(e+=3.5),e=e/10.5*255,[e,e,e];const t=(~~(n>50)+1)*.5,i=(e&1)*t*255,s=(e>>1&1)*t*255,r=(e>>2&1)*t*255;return[i,s,r]},ye.ansi256.rgb=function(n){if(n>=232){const r=(n-232)*10+8;return[r,r,r]}n-=16;let e;const t=Math.floor(n/36)/5*255,i=Math.floor((e=n%36)/6)/5*255,s=e%6/5*255;return[t,i,s]},ye.rgb.hex=function(n){const t=(((Math.round(n[0])&255)<<16)+((Math.round(n[1])&255)<<8)+(Math.round(n[2])&255)).toString(16).toUpperCase();return"000000".substring(t.length)+t},ye.hex.rgb=function(n){const e=n.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];let t=e[0];e[0].length===3&&(t=t.split("").map(a=>a+a).join(""));const i=parseInt(t,16),s=i>>16&255,r=i>>8&255,o=i&255;return[s,r,o]},ye.rgb.hcg=function(n){const e=n[0]/255,t=n[1]/255,i=n[2]/255,s=Math.max(Math.max(e,t),i),r=Math.min(Math.min(e,t),i),o=s-r;let a,l;return o<1?a=r/(1-o):a=0,o<=0?l=0:s===e?l=(t-i)/o%6:s===t?l=2+(i-e)/o:l=4+(e-t)/o,l/=6,l%=1,[l*360,o*100,a*100]},ye.hsl.hcg=function(n){const e=n[1]/100,t=n[2]/100,i=t<.5?2*e*t:2*e*(1-t);let s=0;return i<1&&(s=(t-.5*i)/(1-i)),[n[0],i*100,s*100]},ye.hsv.hcg=function(n){const e=n[1]/100,t=n[2]/100,i=e*t;let s=0;return i<1&&(s=(t-i)/(1-i)),[n[0],i*100,s*100]},ye.hcg.rgb=function(n){const e=n[0]/360,t=n[1]/100,i=n[2]/100;if(t===0)return[i*255,i*255,i*255];const s=[0,0,0],r=e%1*6,o=r%1,a=1-o;let l=0;switch(Math.floor(r)){case 0:s[0]=1,s[1]=o,s[2]=0;break;case 1:s[0]=a,s[1]=1,s[2]=0;break;case 2:s[0]=0,s[1]=1,s[2]=o;break;case 3:s[0]=0,s[1]=a,s[2]=1;break;case 4:s[0]=o,s[1]=0,s[2]=1;break;default:s[0]=1,s[1]=0,s[2]=a}return l=(1-t)*i,[(t*s[0]+l)*255,(t*s[1]+l)*255,(t*s[2]+l)*255]},ye.hcg.hsv=function(n){const e=n[1]/100,t=n[2]/100,i=e+t*(1-e);let s=0;return i>0&&(s=e/i),[n[0],s*100,i*100]},ye.hcg.hsl=function(n){const e=n[1]/100,i=n[2]/100*(1-e)+.5*e;let s=0;return i>0&&i<.5?s=e/(2*i):i>=.5&&i<1&&(s=e/(2*(1-i))),[n[0],s*100,i*100]},ye.hcg.hwb=function(n){const e=n[1]/100,t=n[2]/100,i=e+t*(1-e);return[n[0],(i-e)*100,(1-i)*100]},ye.hwb.hcg=function(n){const e=n[1]/100,t=n[2]/100,i=1-t,s=i-e;let r=0;return s<1&&(r=(i-s)/(1-s)),[n[0],s*100,r*100]},ye.apple.rgb=function(n){return[n[0]/65535*255,n[1]/65535*255,n[2]/65535*255]},ye.rgb.apple=function(n){return[n[0]/255*65535,n[1]/255*65535,n[2]/255*65535]},ye.gray.rgb=function(n){return[n[0]/100*255,n[0]/100*255,n[0]/100*255]},ye.gray.hsl=function(n){return[0,0,n[0]]},ye.gray.hsv=ye.gray.hsl,ye.gray.hwb=function(n){return[0,100,n[0]]},ye.gray.cmyk=function(n){return[0,0,0,n[0]]},ye.gray.lab=function(n){return[n[0],0,0]},ye.gray.hex=function(n){const e=Math.round(n[0]/100*255)&255,i=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(i.length)+i},ye.rgb.gray=function(n){return[(n[0]+n[1]+n[2])/3/255*100]};const bo=Pm;function uT(){const n={},e=Object.keys(bo);for(let t=e.length,i=0;i1&&(t=i),n(t))};return"conversion"in n&&(e.conversion=n.conversion),e}function vT(n){const e=function(...t){const i=t[0];if(i==null)return i;i.length>1&&(t=i);const s=n(t);if(typeof s=="object")for(let r=s.length,o=0;o{fs[n]={},Object.defineProperty(fs[n],"channels",{value:zl[n].channels}),Object.defineProperty(fs[n],"labels",{value:zl[n].labels});const e=gT(n);Object.keys(e).forEach(i=>{const s=e[i];fs[n][i]=vT(s),fs[n][i].raw=yT(s)})});var xT=fs;const ms=Cm.exports,Ot=xT,Im=["keyword","gray","hex"],Gl={};for(const n of Object.keys(Ot))Gl[[...Ot[n].labels].sort().join("")]=n;const Mo={};function mt(n,e){if(!(this instanceof mt))return new mt(n,e);if(e&&e in Im&&(e=null),e&&!(e in Ot))throw new Error("Unknown model: "+e);let t,i;if(n==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(n instanceof mt)this.model=n.model,this.color=[...n.color],this.valpha=n.valpha;else if(typeof n=="string"){const s=ms.get(n);if(s===null)throw new Error("Unable to parse color from string: "+n);this.model=s.model,i=Ot[this.model].channels,this.color=s.value.slice(0,i),this.valpha=typeof s.value[i]=="number"?s.value[i]:1}else if(n.length>0){this.model=e||"rgb",i=Ot[this.model].channels;const s=Array.prototype.slice.call(n,0,i);this.color=Vl(s,i),this.valpha=typeof n[i]=="number"?n[i]:1}else if(typeof n=="number")this.model="rgb",this.color=[n>>16&255,n>>8&255,n&255],this.valpha=1;else{this.valpha=1;const s=Object.keys(n);"alpha"in n&&(s.splice(s.indexOf("alpha"),1),this.valpha=typeof n.alpha=="number"?n.alpha:0);const r=s.sort().join("");if(!(r in Gl))throw new Error("Unable to parse color from object: "+JSON.stringify(n));this.model=Gl[r];const{labels:o}=Ot[this.model],a=[];for(t=0;t(n%360+360)%360),saturationl:tt("hsl",1,ut(100)),lightness:tt("hsl",2,ut(100)),saturationv:tt("hsv",1,ut(100)),value:tt("hsv",2,ut(100)),chroma:tt("hcg",1,ut(100)),gray:tt("hcg",2,ut(100)),white:tt("hwb",1,ut(100)),wblack:tt("hwb",2,ut(100)),cyan:tt("cmyk",0,ut(100)),magenta:tt("cmyk",1,ut(100)),yellow:tt("cmyk",2,ut(100)),black:tt("cmyk",3,ut(100)),x:tt("xyz",0,ut(95.047)),y:tt("xyz",1,ut(100)),z:tt("xyz",2,ut(108.833)),l:tt("lab",0,ut(100)),a:tt("lab",1),b:tt("lab",2),keyword(n){return n!==void 0?new mt(n):Ot[this.model].keyword(this.color)},hex(n){return n!==void 0?new mt(n):ms.to.hex(this.rgb().round().color)},hexa(n){if(n!==void 0)return new mt(n);const e=this.rgb().round().color;let t=Math.round(this.valpha*255).toString(16).toUpperCase();return t.length===1&&(t="0"+t),ms.to.hex(e)+t},rgbNumber(){const n=this.rgb().color;return(n[0]&255)<<16|(n[1]&255)<<8|n[2]&255},luminosity(){const n=this.rgb().color,e=[];for(const[t,i]of n.entries()){const s=i/255;e[t]=s<=.04045?s/12.92:((s+.055)/1.055)**2.4}return .2126*e[0]+.7152*e[1]+.0722*e[2]},contrast(n){const e=this.luminosity(),t=n.luminosity();return e>t?(e+.05)/(t+.05):(t+.05)/(e+.05)},level(n){const e=this.contrast(n);return e>=7?"AAA":e>=4.5?"AA":""},isDark(){const n=this.rgb().color;return(n[0]*2126+n[1]*7152+n[2]*722)/1e4<128},isLight(){return!this.isDark()},negate(){const n=this.rgb();for(let e=0;e<3;e++)n.color[e]=255-n.color[e];return n},lighten(n){const e=this.hsl();return e.color[2]+=e.color[2]*n,e},darken(n){const e=this.hsl();return e.color[2]-=e.color[2]*n,e},saturate(n){const e=this.hsl();return e.color[1]+=e.color[1]*n,e},desaturate(n){const e=this.hsl();return e.color[1]-=e.color[1]*n,e},whiten(n){const e=this.hwb();return e.color[1]+=e.color[1]*n,e},blacken(n){const e=this.hwb();return e.color[2]+=e.color[2]*n,e},grayscale(){const n=this.rgb().color,e=n[0]*.3+n[1]*.59+n[2]*.11;return mt.rgb(e,e,e)},fade(n){return this.alpha(this.valpha-this.valpha*n)},opaquer(n){return this.alpha(this.valpha+this.valpha*n)},rotate(n){const e=this.hsl();let t=e.color[0];return t=(t+n)%360,t=t<0?360+t:t,e.color[0]=t,e},mix(n,e){if(!n||!n.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof n);const t=n.rgb(),i=this.rgb(),s=e===void 0?.5:e,r=2*s-1,o=t.alpha()-i.alpha(),a=((r*o==-1?r:(r+o)/(1+r*o))+1)/2,l=1-a;return mt.rgb(a*t.red()+l*i.red(),a*t.green()+l*i.green(),a*t.blue()+l*i.blue(),t.alpha()*s+i.alpha()*(1-s))}};for(const n of Object.keys(Ot)){if(Im.includes(n))continue;const{channels:e}=Ot[n];mt.prototype[n]=function(...t){return this.model===n?new mt(this):t.length>0?new mt(t,n):new mt([...ST(Ot[this.model][n].raw(this.color)),this.valpha],n)},mt[n]=function(...t){let i=t[0];return typeof i=="number"&&(i=Vl(t,e)),new mt(i,n)}}function bT(n,e){return Number(n.toFixed(e))}function MT(n){return function(e){return bT(e,n)}}function tt(n,e,t){n=Array.isArray(n)?n:[n];for(const i of n)(Mo[i]||(Mo[i]=[]))[e]=t;return n=n[0],function(i){let s;return i!==void 0?(t&&(i=t(i)),s=this[n](),s.color[e]=i,s):(s=this[n]().color[e],t&&(s=t(s)),s)}}function ut(n){return function(e){return Math.max(0,Math.min(n,e))}}function ST(n){return Array.isArray(n)?n:[n]}function Vl(n,e){for(let t=0;t #include #include #include #include #include #include #include #include #include #include #include #include void main() { v_position = position; #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include } `,AT=` uniform vec3 emissive; uniform float height; uniform vec4 topColorVector4; uniform vec4 bottomColorVector4; varying vec3 v_position; varying vec3 vLightFront; varying vec3 vIndirectFront; #ifdef DOUBLE_SIDED varying vec3 vLightBack; varying vec3 vIndirectBack; #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include void main() { #include vec4 diff = bottomColorVector4 - topColorVector4; vec4 percent = diff/height; float x = topColorVector4.x + percent.x*v_position.z; float y = topColorVector4.y + percent.y*v_position.z; float z = topColorVector4.z + percent.z*v_position.z; float r = topColorVector4.w + percent.w*v_position.z; vec4 diffuseColor = vec4(x,y,z,r); ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); vec3 totalEmissiveRadiance = emissive; #include #include #include #include #include #include #include // accumulation #ifdef DOUBLE_SIDED reflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack; #else reflectedLight.indirectDiffuse += vIndirectFront; #endif #include reflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb ); #ifdef DOUBLE_SIDED reflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack; #else reflectedLight.directDiffuse = vLightFront; #endif reflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask(); // modulation #include vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; #include #include #include #include #include #include #include } `;class TT{constructor(e,t){this.layer=e,this.object=new sn,this.createGlobalMaterial(t),this.layer.add(this.object),this.init(t)}createGlobalMaterial(e){if(e.sideTexture){const t=new bf().load(e.sideTexture);t.wrapS=t.wrapT=ti,t.offset.set(0,.5),t.repeat.set(.1,.1),this.sideImgMaterial=new go({depthTest:e.depthTest,map:t,side:Yt})}this.bottomMaterial=new go({depthTest:e.depthTest,transparent:!0,color:So(e.bottomColor),opacity:Co(e.bottomColor)}),this.topMaterial=new go({depthTest:e.depthTest,transparent:!0,color:So(e.topColor),opacity:Co(e.topColor)})}init(e){e.source.features.forEach(t=>{t.geometry.type==="Polygon"?this.createMesh(t.geometry.coordinates,t.properties,e):t.geometry.type==="MultiPolygon"&&t.geometry.coordinates.forEach(i=>{this.createMesh(i,t.properties,e)})}),this.refresh()}createMesh(e,t,i){if(e.length===0)return;t=t||{};const s=t.height!==void 0?t.height:i.height,r=e[0],o=[],a=[];for(let h=0;h0){const h=new Qs(l,{depth:s,bevelEnabled:!1,steps:1}),p=[new go({visible:!1})];let g;if(i.sideTexture)g=this.sideImgMaterial;else{const v=new ge;v.setHex(So(i.sideTopColor));const b=new We(v.r,v.g,v.b,Co(i.sideTopColor)),x=new ge;x.setHex(So(i.sideBottomColor));const C=new We(x.r,x.g,x.b,Co(i.sideBottomColor)),w=Ya.merge([se.common,se.specularmap,se.envmap,se.aomap,se.lightmap,se.emissivemap,se.fog,se.lights,{emissive:{value:new ge("#000")},topColorVector4:{value:C},bottomColorVector4:{value:b},height:{value:s}}]);g=new cn({depthTest:i.depthTest,side:Yt,transparent:!0,lights:!0,uniforms:w,vertexShader:wT,fragmentShader:AT})}p.push(g);const m=new Qs(l,{depth:0}),f=new ft(m,this.bottomMaterial);this.object.add(f);const _=new ft(h,p);this.object.add(_)}const c=new Qs(l,{depth:0}),u=new ft(c,this.topMaterial);u.translateZ(s),this.object.add(u)}convertLngLat(e){var t;return(t=this.layer)==null?void 0:t.convertLngLat(e)}refresh(){var e;(e=this.layer)==null||e.update()}show(){this.object.visible=!0,this.refresh()}hide(){this.object.visible=!1,this.refresh()}remove(){var e;this.object&&((e=this.layer)==null||e.remove(this.object))}destroy(){this.object&&(dm(this.object),this.bottomMaterial&&(this.bottomMaterial.dispose(),this.bottomMaterial=void 0),this.topMaterial&&(this.topMaterial.dispose(),this.topMaterial=void 0),this.sideImgMaterial&&(this.sideImgMaterial.dispose(),this.sideImgMaterial=void 0),this.object=null,this.layer=void 0)}}var ET=TT,Fm=H.defineComponent({name:"ElAmapThreePolygon",mixins:[le],props:{sideTopColor:{type:String,default:"#ffffff"},sideBottomColor:{type:String,default:"#ffffff"},sideTexture:{type:String},topColor:{type:String,default:"#ffffff"},bottomColor:{type:String,default:"#ffffff"},height:{type:Number,default:30},depthTest:{type:Boolean,default:!0},source:{type:Object,required:!0}},data(){return{}},methods:{__initComponent(n){this.$amapComponent=new ET(this.$parentComponent,n)},destroyComponent(){this.parentInstance.isDestroy||this.$amapComponent.remove(),this.$amapComponent.destroy()}},render(){return null}});Fm.__file="src/packages/three/ThreePolygon/ThreePolygon.vue";const Om=ce(Fm);var Nm=H.defineComponent({name:"ElAmapMouseTool",mixins:[le],props:{type:{type:String,required:!0,default:"marker",validator(n){return["marker","circle","rectangle","polyline","polygon","measureArea","rule","rectZoomIn","rectZoomOut"].includes(n)}},drawOptions:{type:Object,default:()=>null},autoClear:{type:Boolean,default:!0},showTooltip:{type:Boolean,default:!0},tooltipTextMap:{type:Object,default:()=>null},textOptions:{type:Object,default:()=>null}},emits:["draw"],data(){return{preMapCursor:"",tipTexts:{marker:"\u5355\u51FB\u5730\u56FE\u9009\u62E9\u70B9\u4F4D",circle:"\u6309\u4F4F\u9F20\u6807\u5DE6\u952E\u62D6\u62FD\u7ED8\u5236\u5706",rectangle:"\u6309\u4F4F\u9F20\u6807\u5DE6\u952E\u62D6\u62FD\u7ED8\u5236\u77E9\u5F62",polyline:"\u5355\u51FB\u5730\u56FE\u9009\u62E9\u62D0\u70B9\uFF0C\u53CC\u51FB\u5730\u56FE\u5B8C\u6210\u6298\u7EBF\u7ED8\u5236",polygon:"\u5355\u51FB\u5730\u56FE\u9009\u62E9\u62D0\u70B9\uFF0C\u53CC\u51FB\u5730\u56FE\u5B8C\u6210\u591A\u8FB9\u5F62\u7ED8\u5236",measureArea:"\u5355\u51FB\u5730\u56FE\u9009\u62E9\u62D0\u70B9\uFF0C\u53CC\u51FB\u5730\u56FE\u5B8C\u6210\u7ED8\u5236\u5E76\u8BA1\u7B97\u9762\u79EF",rule:"\u5355\u51FB\u5730\u56FE\u9009\u62E9\u62D0\u70B9\uFF0C\u53F3\u51FB\u5730\u56FE\u5B8C\u6210\u7ED8\u5236\u5E76\u8BA1\u7B97\u8DDD\u79BB",rectZoomIn:"\u6309\u4F4F\u9F20\u6807\u5DE6\u952E\u62D6\u62FD\u7ED8\u5236\u77E9\u5F62\uFF0C\u677E\u5F00\u5DE6\u952E\u653E\u5927\u5730\u56FE",rectZoomOut:"\u6309\u4F4F\u9F20\u6807\u5DE6\u952E\u62D6\u62FD\u7ED8\u5236\u77E9\u5F62\uFF0C\u677E\u5F00\u5DE6\u952E\u653E\u5927\u5730\u56FE"}}},methods:{__initComponent(){return new Promise(n=>{AMap.plugin(["AMap.MouseTool"],()=>{this.tooltipTextMap&&Object.assign(this.tipTexts,this.tooltipTextMap),this.$amapComponent=new AMap.MouseTool(this.$parentComponent),this.createTooltip(),this.__type(),this.bindEvent(),this.preMapCursor=this.$parentComponent.getDefaultCursor(),this.$parentComponent.setDefaultCursor("crosshair"),n()})})},__type(){const n=this.type;if(this.$amapComponent[n]){const e=this.drawOptions||{};this.$amapComponent[n](e),this.setText(this.tipTexts[n])}},createTooltip(){if(this.showTooltip){const n=this.textOptions||{};n.anchor="top-left",n.clickable=!1,n.bubble=!0,n.offset=[10,10],this.$text=new AMap.Text(n),this.$parentComponent.add(this.$text),this.$parentComponent.on("mousemove",this.getMousePosition)}},getMousePosition(n){const e=n.lnglat;this.$text.setPosition([e.lng,e.lat])},setText(n){this.$text&&this.$text.setText(n)},bindEvent(){this.$amapComponent.on("draw",n=>{const e=this.type;let t;if(e==="marker")t=n.obj.getPosition().toArray();else if(e==="circle")t={center:n.obj.getCenter().toArray(),radius:n.obj.getRadius()};else if(e==="rectangle"){const i=n.obj.getBounds(),s=i.getSouthWest(),r=i.getNorthEast();t=[s.toArray(),r.toArray()]}else if(e==="polyline")t=n.obj.getPath().map(s=>s.toArray());else if(e==="polygon")t=n.obj.getPath().map(s=>s.toArray());else if(e==="measureArea"){const i=n.obj.getPath().map(s=>s.toArray());t=AMap.GeometryUtil.ringArea(i)}else if(e==="rule"){const i=n.obj.getPath().map(s=>s.toArray());t=AMap.GeometryUtil.distanceOfLine(i)}else(e==="rectZoomIn"||e==="rectZoomOut")&&(t=!0);this.$emit("draw",t,n.obj),this.autoClear&&(this.$$clear(),this.__type())})},$$close(n=!0){this.$amapComponent&&this.$amapComponent.close(n)},$$open(){this.__type()},$$clear(){this.$$close(!0)},destroyComponent(){this.parentInstance.isDestroy||(this.$amapComponent.close(!0),this.$parentComponent.setDefaultCursor(this.preMapCursor),this.$text&&(this.$parentComponent.off("mousemove",this.getMousePosition),this.$parentComponent.remove(this.$text),this.$text=null)),this.$amapComponent=null,this.$parentComponent=null}},render(){return null}});Nm.__file="src/packages/util/MouseTool/MouseTool.vue";const km=ce(Nm),Hl=new WeakMap;class LT extends qn{constructor(e){super(e);this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(e){return this.decoderPath=e,this}setDecoderConfig(e){return this.decoderConfig=e,this}setWorkerLimit(e){return this.workerLimit=e,this}load(e,t,i,s){const r=new hs(this.manager);r.setPath(this.path),r.setResponseType("arraybuffer"),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(e,o=>{const a={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(o,a).then(t).catch(s)},i,s)}decodeDracoFile(e,t,i,s){const r={attributeIDs:i||this.defaultAttributeIDs,attributeTypes:s||this.defaultAttributeTypes,useUniqueIDs:!!i};this.decodeGeometry(e,r).then(t)}decodeGeometry(e,t){for(const l in t.attributeTypes){const c=t.attributeTypes[l];c.BYTES_PER_ELEMENT!==void 0&&(t.attributeTypes[l]=c.name)}const i=JSON.stringify(t);if(Hl.has(e)){const l=Hl.get(e);if(l.key===i)return l.promise;if(e.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let s;const r=this.workerNextTaskID++,o=e.byteLength,a=this._getWorker(r,o).then(l=>(s=l,new Promise((c,u)=>{s._callbacks[r]={resolve:c,reject:u},s.postMessage({type:"decode",id:r,taskConfig:t,buffer:e},[e])}))).then(l=>this._createGeometry(l.geometry));return a.catch(()=>!0).then(()=>{s&&r&&this._releaseTask(s,r)}),Hl.set(e,{key:i,promise:a}),a}_createGeometry(e){const t=new bt;e.index&&t.setIndex(new dt(e.index.array,1));for(let i=0;i{i.load(e,s,void 0,r)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const e=typeof WebAssembly!="object"||this.decoderConfig.type==="js",t=[];return e?t.push(this._loadLibrary("draco_decoder.js","text")):(t.push(this._loadLibrary("draco_wasm_wrapper.js","text")),t.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(t).then(i=>{const s=i[0];e||(this.decoderConfig.wasmBinary=i[1]);const r=RT.toString(),o=["/* draco decoder */",s,"","/* worker */",r.substring(r.indexOf("{")+1,r.lastIndexOf("}"))].join(` `);this.workerSourceURL=URL.createObjectURL(new Blob([o]))}),this.decoderPending}_getWorker(e,t){return this._initDecoder().then(()=>{if(this.workerPool.lengthr._taskLoad?-1:1});const i=this.workerPool[this.workerPool.length-1];return i._taskCosts[e]=t,i._taskLoad+=t,i})}_releaseTask(e,t){e._taskLoad-=e._taskCosts[t],delete e._callbacks[t],delete e._taskCosts[t]}debug(){console.log("Task load: ",this.workerPool.map(e=>e._taskLoad))}dispose(){for(let e=0;e{const h=u.draco,d=new h.Decoder,p=new h.DecoderBuffer;p.Init(new Int8Array(l),l.byteLength);try{const g=t(h,d,p,c),m=g.attributes.map(f=>f.array.buffer);g.index&&m.push(g.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:g},m)}catch(g){console.error(g),self.postMessage({type:"error",id:a.id,error:g.message})}finally{h.destroy(p),h.destroy(d)}});break}};function t(o,a,l,c){const u=c.attributeIDs,h=c.attributeTypes;let d,p;const g=a.GetEncodedGeometryType(l);if(g===o.TRIANGULAR_MESH)d=new o.Mesh,p=a.DecodeBufferToMesh(l,d);else if(g===o.POINT_CLOUD)d=new o.PointCloud,p=a.DecodeBufferToPointCloud(l,d);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!p.ok()||d.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+p.error_msg());const m={index:null,attributes:[]};for(const f in u){const _=self[h[f]];let v,b;if(c.useUniqueIDs)b=u[f],v=a.GetAttributeByUniqueId(d,b);else{if(b=a.GetAttributeId(d,o[u[f]]),b===-1)continue;v=a.GetAttribute(d,b)}m.attributes.push(s(o,a,d,f,_,v))}return g===o.TRIANGULAR_MESH&&(m.index=i(o,a,d)),o.destroy(d),m}function i(o,a,l){const u=l.num_faces()*3,h=u*4,d=o._malloc(h);a.GetTrianglesUInt32Array(l,h,d);const p=new Uint32Array(o.HEAPF32.buffer,d,u).slice();return o._free(d),{array:p,itemSize:1}}function s(o,a,l,c,u,h){const d=h.num_components(),g=l.num_points()*d,m=g*u.BYTES_PER_ELEMENT,f=r(o,u),_=o._malloc(m);a.GetAttributeDataArrayForAllPoints(l,h,f,m,_);const v=new u(o.HEAPF32.buffer,_,g).slice();return o._free(_),{name:c,array:v,itemSize:d}}function r(o,a){switch(a){case Float32Array:return o.DT_FLOAT32;case Int8Array:return o.DT_INT8;case Int16Array:return o.DT_INT16;case Int32Array:return o.DT_INT32;case Uint8Array:return o.DT_UINT8;case Uint16Array:return o.DT_UINT16;case Uint32Array:return o.DT_UINT32}}}function Bm(n){let e;try{e=new URL(n,"http://fakehost.com/")}catch{return null}const t=e.pathname.split("/").pop(),i=t.lastIndexOf(".");return i===-1||i===t.length-1?null:t.substring(i+1)}function PT(n){Promise.resolve().then(n)}class IT{constructor(){this.maxSize=800,this.minSize=600,this.unloadPercent=.05,this.itemSet=new Map,this.itemList=[],this.usedSet=new Set,this.callbacks=new Map,this.unloadPriorityCallback=null;const e=this.itemSet;this.defaultPriorityCallback=t=>e.get(t)}isFull(){return this.itemSet.size>=this.maxSize}add(e,t){const i=this.itemSet;if(i.has(e)||this.isFull())return!1;const s=this.usedSet,r=this.itemList,o=this.callbacks;return r.push(e),s.add(e),i.set(e,Date.now()),o.set(e,t),!0}remove(e){const t=this.usedSet,i=this.itemSet,s=this.itemList,r=this.callbacks;if(i.has(e)){r.get(e)(e);const o=s.indexOf(e);return s.splice(o,1),t.delete(e),i.delete(e),r.delete(e),!0}return!1}markUsed(e){const t=this.itemSet,i=this.usedSet;t.has(e)&&!i.has(e)&&(t.set(e,Date.now()),i.add(e))}markAllUnused(){this.usedSet.clear()}unloadUnusedContent(){const e=this.unloadPercent,t=this.minSize,i=this.itemList,s=this.itemSet,r=this.usedSet,o=this.callbacks,a=i.length-r.size,l=i.length-t,c=this.unloadPriorityCallback||this.defaultPriorityCallback;if(l>0&&a>0){i.sort((g,m)=>{const f=r.has(g),_=r.has(m);return f&&_?0:!f&&!_?c(m)-c(g):f?1:-1});const u=Math.min(l,a),h=Math.max(t*e,u*e);let d=Math.min(h,a);d=Math.ceil(d);const p=i.splice(0,d);for(let g=0,m=p.length;g{this.scheduled=!1,this.unloadUnusedContent(),e&&this.markAllUnused()}))}}class $m{constructor(){this.maxJobs=6,this.items=[],this.callbacks=new Map,this.currJobs=0,this.scheduled=!1,this.autoUpdate=!0,this.priorityCallback=()=>{throw new Error("PriorityQueue: PriorityCallback function not defined.")},this.schedulingCallback=e=>{requestAnimationFrame(e)},this._runjobs=()=>{this.tryRunJobs(),this.scheduled=!1}}sort(){const e=this.priorityCallback;this.items.sort(e)}add(e,t){return new Promise((i,s)=>{const r=(...l)=>t(...l).then(i).catch(s),o=this.items,a=this.callbacks;o.push(e),a.set(e,r),this.autoUpdate&&this.scheduleJobRun()})}remove(e){const t=this.items,i=this.callbacks,s=t.indexOf(e);s!==-1&&(t.splice(s,1),i.delete(e))}tryRunJobs(){this.sort();const e=this.items,t=this.callbacks,i=this.maxJobs;let s=this.currJobs;for(;i>s&&e.length>0;){s++;const r=e.pop(),o=t.get(r);t.delete(r),o(r).then(()=>{this.currJobs--,this.autoUpdate&&this.scheduleJobRun()}).catch(()=>{this.currJobs--,this.autoUpdate&&this.scheduleJobRun()})}this.currJobs=s}scheduleJobRun(){this.scheduled||(this.schedulingCallback(this._runjobs),this.scheduled=!0)}}const wo=0,Ao=1,Wl=2,pr=3,To=4,Eo=6378137,DT=-(1/298.257223563*Eo-Eo);function jl(n){return n===pr||n===To}function bi(n,e){return n.__lastFrameVisited===e&&n.__used}function Um(n,e){n.__lastFrameVisited!==e&&(n.__lastFrameVisited=e,n.__used=!1,n.__inFrustum=!1,n.__isLeaf=!1,n.__visible=!1,n.__active=!1,n.__error=1/0,n.__distanceFromCamera=1/0,n.__childrenWereVisible=!1,n.__allChildrenLoaded=!1)}function zm(n,e,t){if(Um(n,e),n.__used=!0,t.markUsed(n),n.__contentEmpty){const i=n.children;for(let s=0,r=i.length;s0&&n.__depth+1>=r))return!0;let u=!1;const h=n.children;for(let d=0,p=h.length;dn.__depth!==e.__depth?n.__depth>e.__depth?-1:1:n.__inFrustum!==e.__inFrustum?n.__inFrustum?1:-1:n.__used!==e.__used?n.__used?1:-1:n.__error!==e.__error?n.__error>e.__error?1:-1:n.__distanceFromCamera!==e.__distanceFromCamera?n.__distanceFromCamera>e.__distanceFromCamera?-1:1:0,FT=n=>1/(n.__depthFromRenderedParent+1);class OT{get rootTileSet(){const e=this.tileSets[this.rootURL];return!e||e instanceof Promise?null:e}get root(){const e=this.rootTileSet;return e?e.root:null}constructor(e){this.tileSets={},this.rootURL=e,this.fetchOptions={},this.preprocessURL=null;const t=new IT;t.unloadPriorityCallback=FT;const i=new $m;i.maxJobs=4,i.priorityCallback=qm;const s=new $m;s.maxJobs=1,s.priorityCallback=qm,this.lruCache=t,this.downloadQueue=i,this.parseQueue=s,this.stats={parsing:0,downloading:0,failed:0,inFrustum:0,used:0,active:0,visible:0},this.frameCount=0,this.errorTarget=6,this.errorThreshold=1/0,this.loadSiblings=!0,this.displayActiveTiles=!1,this.maxDepth=1/0,this.stopAtEmptyTiles=!0}traverse(e,t){const s=this.tileSets[this.rootURL];!s||!s.root||ql(s.root,e,t)}update(){const e=this.stats,t=this.lruCache,i=this.tileSets,s=i[this.rootURL];if(this.rootURL in i){if(!s||!s.root)return}else{this.loadRootTileSet(this.rootURL);return}const r=s.root;e.inFrustum=0,e.used=0,e.active=0,e.visible=0,this.frameCount++,Vm(r,this),Hm(r,this),Wm(r,this),jm(r,this),t.scheduleUnload()}parseTile(e,t,i){return null}disposeTile(e){}preprocessNode(e,t,i){if(e.content&&(!("uri"in e.content)&&"url"in e.content&&(e.content.uri=e.content.url,delete e.content.url),e.content.uri&&(e.content.uri=new URL(e.content.uri,i+"/").toString()),e.content.boundingVolume&&!("box"in e.content.boundingVolume||"sphere"in e.content.boundingVolume||"region"in e.content.boundingVolume)&&delete e.content.boundingVolume),e.parent=t,e.children=e.children||[],e.content&&e.content.uri){const r=Bm(e.content.uri),o=Boolean(r&&r.toLowerCase()==="json");e.__externalTileSet=o,e.__contentEmpty=o}else e.__externalTileSet=!1,e.__contentEmpty=!0;e.__distanceFromCamera=1/0,e.__error=1/0,e.__inFrustum=!1,e.__isLeaf=!1,e.__usedLastFrame=!1,e.__used=!1,e.__wasSetVisible=!1,e.__visible=!1,e.__childrenWereVisible=!1,e.__allChildrenLoaded=!1,e.__wasSetActive=!1,e.__active=!1,e.__loadingState=wo,e.__loadIndex=0,e.__loadAbort=null,e.__depthFromRenderedParent=-1,t===null?(e.__depth=0,e.refine=e.refine||"REPLACE"):(e.__depth=t.__depth+1,e.refine=e.refine||t.refine)}setTileActive(e,t){}setTileVisible(e,t){}calculateError(e){return 0}tileInView(e){return!0}resetFailedTiles(){const e=this.stats;e.failed!==0&&(this.traverse(t=>{t.__loadingState===To&&(t.__loadingState=wo)}),e.failed=0)}fetchTileSet(e,t,i=null){return fetch(e,t).then(s=>{if(s.ok)return s.json();throw new Error(`TilesRenderer: Failed to load tileset "${e}" with status ${s.status} : ${s.statusText}`)}).then(s=>{const r=s.asset.version;console.assert(r==="1.0"||r==="0.0",'asset.version is expected to be a string of "1.0" or "0.0"');let o=e.replace(/\/[^\/]*\/?$/,"");return o=new URL(o,window.location.href).toString(),ql(s.root,(a,l)=>this.preprocessNode(a,l,o),null,i,i?i.__depth:0),s})}loadRootTileSet(e){const t=this.tileSets;if(e in t)return t[e]instanceof Error?Promise.reject(t[e]):Promise.resolve(t[e]);{const i=this.fetchTileSet(this.preprocessURL?this.preprocessURL(e):e,this.fetchOptions).then(s=>{t[e]=s});return i.catch(s=>{console.error(s),t[e]=s}),t[e]=i,i}}requestTileContents(e){if(e.__loadingState!==wo)return;const t=this.stats,i=this.lruCache,s=this.downloadQueue,r=this.parseQueue,o=e.__externalTileSet;i.add(e,h=>{h.__loadingState===Ao?(h.__loadAbort.abort(),h.__loadAbort=null):o?h.children.length=0:this.disposeTile(h),h.__loadingState===Ao?t.downloading--:h.__loadingState===Wl&&t.parsing--,h.__loadingState=wo,h.__loadIndex++,r.remove(h),s.remove(h)}),e.__loadIndex++;const a=e.__loadIndex,l=new AbortController,c=l.signal;t.downloading++,e.__loadAbort=l,e.__loadingState=Ao;const u=h=>{e.__loadIndex===a&&(h.name!=="AbortError"?(r.remove(e),s.remove(e),e.__loadingState===Wl?t.parsing--:e.__loadingState===Ao&&t.downloading--,t.failed++,console.error(`TilesRenderer : Failed to load tile at url "${e.content.uri}".`),console.error(h),e.__loadingState=To):i.remove(e))};o?s.add(e,h=>{if(h.__loadIndex!==a)return Promise.resolve();const d=this.preprocessURL?this.preprocessURL(h.content.uri):h.content.uri;return this.fetchTileSet(d,Object.assign({signal:c},this.fetchOptions),h)}).then(h=>{e.__loadIndex===a&&(t.downloading--,e.__loadAbort=null,e.__loadingState=pr,e.children.push(h.root))}).catch(u):s.add(e,h=>{if(h.__loadIndex!==a)return Promise.resolve();const d=this.preprocessURL?this.preprocessURL(h.content.uri):h.content.uri;return fetch(d,Object.assign({signal:c},this.fetchOptions))}).then(h=>{if(e.__loadIndex===a){if(h.ok)return h.arrayBuffer();throw new Error(`Failed to load model with error code ${h.status}`)}}).then(h=>{if(e.__loadIndex===a)return t.downloading--,t.parsing++,e.__loadAbort=null,e.__loadingState=Wl,r.add(e,d=>{if(d.__loadIndex!==a)return Promise.resolve();const p=d.content.uri,g=Bm(p);return this.parseTile(h,d,g)})}).then(()=>{e.__loadIndex===a&&(t.parsing--,e.__loadingState=pr,e.__wasSetVisible&&this.setTileVisible(e,!0),e.__wasSetActive&&this.setTileActive(e,!0))}).catch(u)}dispose(){const e=this.lruCache;this.traverse(t=>{e.remove(t)}),this.stats={parsing:0,downloading:0,failed:0,inFrustum:0,used:0,active:0,visible:0},this.frameCount=0}}function Xm(n){return new TextDecoder().decode(n)}class Lo{constructor(e,t,i,s){this.buffer=e,this.binOffset=t+i,this.binLength=s;let r=null;if(i!==0){const o=new Uint8Array(e,t,i);r=JSON.parse(Xm(o))}else r={};this.header=r}getKeys(){return Object.keys(this.header)}getData(e,t,i=null,s=null){const r=this.header;if(!(e in r))return null;const o=r[e];if(o instanceof Object){if(Array.isArray(o))return o;{const{buffer:a,binOffset:l,binLength:c}=this,u=o.byteOffset||0,h=o.type||s,d=o.componentType||i;if("type"in o&&s&&o.type!==s)throw new Error("FeatureTable: Specified type does not match expected type.");let p;switch(h){case"SCALAR":p=1;break;case"VEC2":p=2;break;case"VEC3":p=3;break;case"VEC4":p=4;break;default:throw new Error(`FeatureTable : Feature type not provided for "${e}".`)}let g;const m=l+u,f=t*p;switch(d){case"BYTE":g=new Int8Array(a,m,f);break;case"UNSIGNED_BYTE":g=new Uint8Array(a,m,f);break;case"SHORT":g=new Int16Array(a,m,f);break;case"UNSIGNED_SHORT":g=new Uint16Array(a,m,f);break;case"INT":g=new Int32Array(a,m,f);break;case"UNSIGNED_INT":g=new Uint32Array(a,m,f);break;case"FLOAT":g=new Float32Array(a,m,f);break;case"DOUBLE":g=new Float64Array(a,m,f);break;default:throw new Error(`FeatureTable : Feature component type not provided for "${e}".`)}if(m+f*g.BYTES_PER_ELEMENT>l+c)throw new Error("FeatureTable: Feature data read outside binary body length.");return g}}else return o}}class Xl extends Lo{constructor(e,t,i,s,r){super(e,i,s,r);this.batchSize=t}getData(e,t=null,i=null){return super.getData(e,this.batchSize,t,i)}}class fr{constructor(){this.fetchOptions={},this.workingPath=""}load(e){return fetch(e,this.fetchOptions).then(t=>{if(!t.ok)throw new Error(`Failed to load file "${e}" with status ${t.status} : ${t.statusText}`);return t.arrayBuffer()}).then(t=>(this.workingPath===""&&(this.workingPath=this.workingPathForURL(e)),this.parse(t)))}resolveExternalURL(e){return/^[^\\/]/.test(e)?this.workingPath+"/"+e:e}workingPathForURL(e){const t=e.split(/[\\/]/g);return t.pop(),t.join("/")+"/"}parse(e){throw new Error("LoaderBase: Parse not implemented.")}}function gs(n){let e;if(n instanceof DataView?e=n:e=new DataView(n),String.fromCharCode(e.getUint8(0))==="{")return null;let t="";for(let i=0;i<4;i++)t+=String.fromCharCode(e.getUint8(i));return t}class NT extends fr{parse(e){const t=new DataView(e),i=gs(t);console.assert(i==="b3dm");const s=t.getUint32(4,!0);console.assert(s===1);const r=t.getUint32(8,!0);console.assert(r===e.byteLength);const o=t.getUint32(12,!0),a=t.getUint32(16,!0),l=t.getUint32(20,!0),c=t.getUint32(24,!0),u=28,h=e.slice(u,u+o+a),d=new Lo(h,0,o,a),p=u+o+a,g=e.slice(p,p+l+c),m=new Xl(g,d.getData("BATCH_LENGTH"),0,l,c),f=p+l+c,_=new Uint8Array(e,f,r-f);return{version:s,featureTable:d,batchTable:m,glbBytes:_}}}class Ym extends NT{constructor(e=cs){super();this.manager=e,this.adjustmentTransform=new Se}parse(e){const t=super.parse(e),i=t.glbBytes.slice().buffer;return new Promise((s,r)=>{const o=this.manager,a=this.fetchOptions,l=o.getHandler("path.gltf")||new sr(o);a.credentials==="include"&&a.mode==="cors"&&l.setCrossOrigin("use-credentials"),"credentials"in a&&l.setWithCredentials(a.credentials==="include"),a.headers&&l.setRequestHeader(a.headers);let c=this.workingPath;!/[\\/]$/.test(c)&&c.length&&(c+="/");const u=this.adjustmentTransform;l.parse(i,c,h=>{const{batchTable:d,featureTable:p}=t,{scene:g}=h,m=p.getData("RTC_CENTER");m&&(g.position.x+=m[0],g.position.y+=m[1],g.position.z+=m[2]),h.scene.updateMatrix(),h.scene.matrix.multiply(u),h.scene.matrix.decompose(h.scene.position,h.scene.quaternion,h.scene.scale),h.batchTable=d,h.featureTable=p,g.batchTable=d,g.featureTable=p,s(h)},r)})}}class kT extends fr{parse(e){const t=new DataView(e),i=gs(t);console.assert(i==="pnts");const s=t.getUint32(4,!0);console.assert(s===1);const r=t.getUint32(8,!0);console.assert(r===e.byteLength);const o=t.getUint32(12,!0),a=t.getUint32(16,!0),l=t.getUint32(20,!0),c=t.getUint32(24,!0),u=28,h=e.slice(u,u+o+a),d=new Lo(h,0,o,a),p=u+o+a,g=e.slice(p,p+l+c),m=new Xl(g,d.getData("BATCH_LENGTH")||d.getData("POINTS_LENGTH"),0,l,c);return Promise.resolve({version:s,featureTable:d,batchTable:m})}}class Jm extends kT{constructor(e=cs){super();this.manager=e}parse(e){return super.parse(e).then(t=>{const{featureTable:i}=t,s=i.getData("POINTS_LENGTH"),r=i.getData("POSITION",s,"FLOAT","VEC3"),o=i.getData("RGB",s,"UNSIGNED_BYTE","VEC3");["QUANTIZED_VOLUME_OFFSET","QUANTIZED_VOLUME_SCALE","CONSTANT_RGBA","BATCH_LENGTH","POSITION_QUANTIZED","RGBA","RGB565","NORMAL","NORMAL_OCT16P"].forEach(h=>{h in i.header&&console.warn(`PNTSLoader: Unsupported FeatureTable feature "${h}" detected.`)});const a=new bt;a.setAttribute("position",new dt(r,3,!1));const l=new dl;l.size=2,l.sizeAttenuation=!1,o!==null&&(a.setAttribute("color",new dt(o,3,!0)),l.vertexColors=!0);const c=new Qp(a,l);t.scene=c,t.scene.featureTable=i;const u=i.getData("RTC_CENTER");return u&&(t.scene.position.x+=u[0],t.scene.position.y+=u[1],t.scene.position.z+=u[2]),t})}}class BT extends fr{parse(e){const t=new DataView(e),i=gs(t);console.assert(i==="i3dm");const s=t.getUint32(4,!0);console.assert(s===1);const r=t.getUint32(8,!0);console.assert(r===e.byteLength);const o=t.getUint32(12,!0),a=t.getUint32(16,!0),l=t.getUint32(20,!0),c=t.getUint32(24,!0),u=t.getUint32(28,!0),h=32,d=e.slice(h,h+o+a),p=new Lo(d,0,o,a),g=h+o+a,m=e.slice(g,g+l+c),f=new Xl(m,p.getData("INSTANCES_LENGTH"),0,l,c),_=g+l+c,v=new Uint8Array(e,_,r-_);let b=null,x=null;if(u)b=v,x=Promise.resolve();else{const C=this.resolveExternalURL(Xm(v));x=fetch(C,this.fetchOptions).then(w=>{if(!w.ok)throw new Error(`I3DMLoaderBase : Failed to load file "${C}" with status ${w.status} : ${w.statusText}`);return w.arrayBuffer()}).then(w=>{b=new Uint8Array(w)})}return x.then(()=>({version:s,featureTable:p,batchTable:f,glbBytes:b}))}}const Zm=new E,Yl=new E,Jl=new E,Km=new E,Zl=new en,Ro=new E,Po=new Se;class Qm extends BT{constructor(e=cs){super();this.manager=e,this.adjustmentTransform=new Se}resolveExternalURL(e){return this.manager.resolveURL(super.resolveExternalURL(e))}parse(e){return super.parse(e).then(t=>{const{featureTable:i,batchTable:s}=t,r=t.glbBytes.slice().buffer;return new Promise((o,a)=>{const l=this.fetchOptions,c=this.manager,u=c.getHandler("path.gltf")||new sr(c);l.credentials==="include"&&l.mode==="cors"&&u.setCrossOrigin("use-credentials"),"credentials"in l&&u.setWithCredentials(l.credentials==="include"),l.headers&&u.setRequestHeader(l.headers);let h=this.workingPath;/[\\/]$/.test(h)||(h+="/");const d=this.adjustmentTransform;u.parse(r,h,p=>{const g=i.getData("INSTANCES_LENGTH"),m=i.getData("POSITION",g,"FLOAT","VEC3"),f=i.getData("NORMAL_UP",g,"FLOAT","VEC3"),_=i.getData("NORMAL_RIGHT",g,"FLOAT","VEC3"),v=i.getData("SCALE_NON_UNIFORM",g,"FLOAT","VEC3"),b=i.getData("SCALE",g,"FLOAT","SCALAR");["RTC_CENTER","QUANTIZED_VOLUME_OFFSET","QUANTIZED_VOLUME_SCALE","EAST_NORTH_UP","POSITION_QUANTIZED","NORMAL_UP_OCT32P","NORMAL_RIGHT_OCT32P"].forEach(L=>{L in i.header&&console.warn(`I3DMLoader: Unsupported FeatureTable feature "${L}" detected.`)});const x=new Map,C=[];p.scene.traverse(L=>{if(L.isMesh){const{geometry:y,material:A}=L,I=new Fw(y,A,g);I.position.copy(L.position),I.rotation.copy(L.rotation),I.scale.copy(L.scale),C.push(I),x.set(L,I)}});const w=new E;for(let L=0;L{const A=y.parent;A&&(A.remove(y),A.add(L),L.updateMatrixWorld(),L.position.copy(w).applyMatrix4(L.matrixWorld))});for(let L=0;L{const a=new sn;return o.forEach(l=>{a.add(l.scene)}),{tiles:o,scene:a}})}}class zT{constructor(){this.name="CESIUM_RTC"}afterRoot(e){const{center:t}=e.parser.json.extensions.CESIUM_RTC;e.scene.position.x+=t[0],e.scene.position.y+=t[1],e.scene.position.z+=t[2]}}class GT extends fr{constructor(e=cs){super();this.manager=e}parse(e){return new Promise((t,i)=>{const s=this.manager,r=this.fetchOptions;let o=s.getHandler("path.gltf")||s.getHandler("path.glb");o||(o=new sr(s),o.register(()=>new zT),r.credentials==="include"&&r.mode==="cors"&&o.setCrossOrigin("use-credentials"),"credentials"in r&&o.setWithCredentials(r.credentials==="include"),r.headers&&o.setRequestHeader(r.headers));let a=o.resourcePath||o.path||this.workingPath;!/[\\/]$/.test(a)&&a.length&&(a+="/"),o.parse(e,a,l=>{t(l)},i)})}}const Io=new Se;class VT extends sn{constructor(e){super();this.name="TilesRenderer.TilesGroup",this.tilesRenderer=e}raycast(e,t){this.tilesRenderer.optimizeRaycast&&this.tilesRenderer.raycast(e,t)}updateMatrixWorld(e){if(this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldNeedsUpdate||e){this.parent===null?Io.copy(this.matrix):Io.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1;const t=Io.elements,i=this.matrixWorld.elements;let s=!1;for(let r=0;r<16;r++){const o=t[r],a=i[r];if(Math.abs(o-a)>Number.EPSILON){s=!0;break}}if(s){this.matrixWorld.copy(Io);const r=this.children;for(let o=0,a=r.length;o=t&&v<=i&&b>=s&&b<=r){const x=jT(e);d.push(x),this.getCartographicToPosition(v,b,m,x)}}}return d}getBoundingBox(e,t){ng();const{latStart:i,latEnd:s,lonStart:r,lonEnd:o}=this;if(s-i{Object.getPrototypeOf(i).raycast.call(i,e,t)})}function sg(n,e,t,i){if(t.has(n))if(ec(n.cached.scene,i,Ht),Ht.length>0){Ht.length>1&&Ht.sort(Ql);const l=Ht[0];return Ht.length=0,l}else return null;const s=[],r=n.children;for(let l=0,c=r.length;l1e-6&&console.warn("ThreeTilesRenderer : Non uniform scale used for tile which may cause issues when raycasting.");const _={distance:1/0,tile:null};s.push(_),_.distance=ig.distanceToSquared(bs.origin)*f*f,_.tile=u}else continue}s.sort(Ql);let o=1/0,a=null;for(let l=0,c=s.length;lo)break;{const d=u.tile,p=d.cached.scene;let g=null;if(t.has(d)?(ec(p,i,Ht),Ht.length>0&&(Ht.length>1&&Ht.sort(Ql),g=Ht[0])):g=sg(d,e,t,i),g){const m=g.distance*g.distance;m{t.frustumCulled=t[og]&&e})}class JT extends OT{get autoDisableRendererCulling(){return this._autoDisableRendererCulling}set autoDisableRendererCulling(e){this._autoDisableRendererCulling!==e&&(super._autoDisableRendererCulling=e,this.forEachLoadedModel(t=>{ag(t,!e)}))}constructor(...e){super(...e);this.group=new VT(this),this.cameras=[],this.cameraMap=new Map,this.cameraInfo=[],this.activeTiles=new Set,this.visibleTiles=new Set,this._autoDisableRendererCulling=!0,this.optimizeRaycast=!0,this.onLoadTileSet=null,this.onLoadModel=null,this.onDisposeModel=null,this.onTileVisibilityChange=null;const t=new xf;t.setURLModifier(s=>this.preprocessURL?this.preprocessURL(s):s),this.manager=t;const i=this;this._overridenRaycast=function(s,r){i.optimizeRaycast||Object.getPrototypeOf(this).raycast.call(this,s,r)}}getBounds(e){if(!this.root)return!1;const t=this.root.cached,i=t.box,s=t.boxTransform;return i?(e.copy(i),e.applyMatrix4(s),!0):!1}getOrientedBounds(e,t){if(!this.root)return!1;const i=this.root.cached,s=i.box,r=i.boxTransform;return s?(e.copy(s),t.copy(r),!0):!1}getBoundingSphere(e){if(!this.root)return!1;const t=this.root.cached.sphere;return t?(e.copy(t),!0):!1}forEachLoadedModel(e){this.traverse(t=>{const i=t.cached.scene;i&&e(i,t)})}raycast(e,t){if(!!this.root)if(e.firstHitOnly){const i=sg(this.root,this.group,this.activeTiles,e);i&&t.push(i)}else rg(this.root,this.group,this.activeTiles,e,t)}hasCamera(e){return this.cameraMap.has(e)}setCamera(e){const t=this.cameras,i=this.cameraMap;return i.has(e)?!1:(i.set(e,new ne),t.push(e),!0)}setResolution(e,t,i){const s=this.cameraMap;return s.has(e)?(t instanceof ne?s.get(e).copy(t):s.get(e).set(t,i),!0):!1}setResolutionFromRenderer(e,t){const i=this.cameraMap;if(!i.has(e))return!1;const s=i.get(e);return t.getSize(s),s.multiplyScalar(t.getPixelRatio()),!0}deleteCamera(e){const t=this.cameras,i=this.cameraMap;if(i.has(e)){const s=t.indexOf(e);return t.splice(s,1),i.delete(e),!0}return!1}fetchTileSet(e,...t){const i=super.fetchTileSet(e,...t);return i.then(s=>{this.onLoadTileSet&&Promise.resolve().then(()=>{this.onLoadTileSet(s,e)})}),i}update(){const e=this.group,t=this.cameras,i=this.cameraMap,s=this.cameraInfo;if(t.length===0){console.warn("TilesRenderer: no cameras defined. Cannot update 3d tiles.");return}for(;s.length>t.length;)s.pop();for(;s.length1e-6&&console.warn("ThreeTilesRenderer : Non uniform scale used for tile which may cause issues when calculating screen space error.");for(let o=0,a=s.length;o_.scene);break}case"pnts":{const f=new Jm(l);f.workingPath=o,f.fetchOptions=a,u=f.parse(e).then(_=>_.scene);break}case"i3dm":{const f=new Qm(l);f.workingPath=o,f.fetchOptions=a,f.adjustmentTransform.copy(rn),u=f.parse(e).then(_=>_.scene);break}case"cmpt":{const f=new UT(l);f.workingPath=o,f.fetchOptions=a,f.adjustmentTransform.copy(rn),u=f.parse(e).then(_=>_.scene);break}case"gltf":case"glb":const m=new GT(l);m.workingPath=o,m.fetchOptions=a,u=m.parse(e).then(f=>f.scene);break;default:console.warn(`TilesRenderer: Content type "${g}" not supported.`),u=Promise.resolve(null);break}return u.then(m=>{if(t._loadIndex!==c)return;m.updateMatrix(),(g==="glb"||g==="gltf")&&m.matrix.multiply(rn),m.matrix.premultiply(p),m.matrix.decompose(m.position,m.quaternion,m.scale),m.traverse(b=>{b[og]=b.frustumCulled}),ag(m,!this.autoDisableRendererCulling),d.scene=m,m.traverse(b=>{b.raycast=this._overridenRaycast});const f=[],_=[],v=[];m.traverse(b=>{if(b.geometry&&_.push(b.geometry),b.material){const x=b.material;f.push(b.material);for(const C in x){const w=x[C];w&&w.isTexture&&v.push(w)}}}),d.materials=f,d.geometry=_,d.textures=v,this.onLoadModel&&this.onLoadModel(m,t)})}disposeTile(e){const t=e.cached;if(t.scene){const i=t.materials,s=t.geometry,r=t.textures,o=t.scene.parent;for(let a=0,l=s.length;a0){for(let s=0;s0)for(let s=0;s{e.disposeTile(t)}),e.lruCache.itemSet.clear(),e.lruCache.itemList=[],e.lruCache.callbacks.clear(),e.lruCache=null,e.visibleTiles.clear(),e.activeTiles.clear(),e.downloadQueue.callbacks.clear(),e.downloadQueue.items=[],e.downloadQueue=null,e.parseQueue.callbacks.clear(),e.parseQueue.items=[],e.parseQueue=null,this.clearGroup(this.group),e.tileSets={},e.cameraMap.clear(),e.cameras=[],e.cameraInfo=[],e.group=null}clearGroup(e){e.traverse(t=>{t.isMesh&&(t.geometry.dispose(),t.material.dispose(),t.material.texture&&t.material.texture.dispose&&t.material.texture.dispose()),delete t.featureTable,delete t.batchTable}),delete e.tilesRenderer,e.remove(...e.children)}}class QT extends ZT{constructor(e,t){super(),this.animationFrame=-1,this.mouse=new ne,this.layer=e;const i=new KT(t.url);i.setCamera(this.layer.getCamera()),i.setResolutionFromRenderer(this.layer.getCamera(),this.layer.getRender());const s=t.fetchOptions||{},r=new sr(i.manager);s.credentials==="include"&&s.mode==="cors"&&r.setCrossOrigin("use-credentials"),"credentials"in s&&r.setWithCredentials(s.credentials==="include"),s.headers&&r.setRequestHeader(s.headers);const o=new LT,a=t.dracoDecoderPath||"https://cdn.jsdelivr.net/npm/three@0.143/examples/js/libs/draco/";if(o.setDecoderPath(a),r.setDRACOLoader(o),i.manager.addHandler(/\.gltf$/i,r),i.onLoadTileSet=l=>{this.emit("loadTileSet",l)},i.onLoadModel=(l,c)=>{this.emit("loadModel",{scene:l,tile:c})},i.onDisposeModel=(l,c)=>{this.emit("disposeModel",{scene:l,tile:c})},i.downloadQueue.maxJobs=6,i.parseQueue.maxJobs=6,this.group=i.group,this.layer.add(this.group),this.tilesRenderer=i,t.position&&this.setPosition(t.position),t.rotation&&this.setRotation(t.rotation),t.translate&&this.setTranslate(t.translate),t.scale&&this.setScale(t.scale),this.animate(),t.debug){const l=document.createElement("div");l.style.position="absolute",l.style.top="0px",l.style.left="0px",l.style.color="white",l.style.width="100%",l.style.textAlign="center",l.style.padding="5px",l.style.pointerEvents="none",l.style.lineHeight="1.5em",document.body.appendChild(l),this.statsContainer=l}this.bindEvents(t.mouseEvent)}bindEvents(e){if(e){this.raycaster=new Rf,this.raycaster.firstHitOnly=!0;const t=this.layer.getMap();this.clickMapFn=Ti(this.clickMap,this),t.on("click",this.clickMapFn),this.mousemoveMapFn=Ti(this.mousemoveMap,this),t.on("mousemove",this.mousemoveMapFn),this.rightClickMapFn=Ti(this.rightClickMap,this),t.on("rightclick",this.rightClickMapFn)}}unbindEvents(){const e=this.layer.getMap();this.clickMapFn&&(e.off("click",this.clickMapFn),this.clickMapFn=null),this.mousemoveMapFn&&(e.off("mousemove",this.mousemoveMapFn),this.mousemoveMapFn=null),this.rightClickMapFn&&(e.off("rightclick",this.rightClickMapFn),this.rightClickMapFn=null),this.tilesRenderer&&(this.tilesRenderer.onLoadTileSet=null,this.tilesRenderer.onLoadModel=null,this.tilesRenderer.onDisposeModel=null)}clickMap(e){const t=this._intersectGltf(e);this.emit("click",t)}mousemoveMap(e){const t=this._intersectGltf(e);this.emit("mousemove",t)}rightClickMap(e){const t=this._intersectGltf(e);this.emit("rightClick",t)}_intersectGltf(e){var t,i;const s=this.layer.getMap().getContainer().getBoundingClientRect(),r=this.mouse;r.x=e.originEvent.clientX-s.x,r.y=e.originEvent.clientY-s.y,r.x=r.x/s.width*2-1,r.y=-(r.y/s.height)*2+1;const o=this.layer.getCamera();(t=this.raycaster)===null||t===void 0||t.setFromCamera(r,o);const a=(i=this.raycaster)===null||i===void 0?void 0:i.intersectObject(this.group,!0);if(a!=null&&a.length){const l=a[0].object,c={},u=this.getBatchTable(l);return u&&u.getKeys().forEach(h=>{c[h]=u.getData(h)}),{object:l,batchData:c}}return null}getBatchTable(e){return e?e.batchTable?e.batchTable:this.getBatchTable(e.parent):null}setPosition(e){const t=this.layer.convertLngLat(e);this.group.position.setX(t[0]),this.group.position.setY(t[1]),this.refresh()}setRotation(e){if(e){const t=Math.PI/180*(e.x||0),i=Math.PI/180*(e.y||0),s=Math.PI/180*(e.z||0);this.group.rotation.set(t,i,s),this.refresh()}}setTranslate(e){e&&(this.group.translateX(e.x),this.group.translateY(e.y),this.group.translateZ(e.z),this.refresh())}setScale(e){let t;typeof e=="number"?t={x:e,y:e,z:e}:t=e,this.group.scale.set(t.x,t.y,t.z),this.refresh()}refresh(){this.layer.update()}show(){this.group.visible=!0,this.refresh()}hide(){this.group.visible=!1,this.refresh()}animate(){this.animationFrame=requestAnimationFrame(()=>{this.update(),this.animate()})}update(){var e;if(this.layer.getCamera().updateMatrixWorld(),(e=this.tilesRenderer)===null||e===void 0||e.update(),this.layer.update(),this.statsContainer){const t=this.tilesRenderer;this.statsContainer.innerHTML=`\u6B63\u5728\u4E0B\u8F7D: ${t.stats.downloading} \u6B63\u5728\u7F16\u8BD1: ${t.stats.parsing} \u5DF2\u663E\u793A: ${t.group.children.length-2}`}}getGroup(){return this.group}getTilesRenderer(){return this.tilesRenderer}destroy(){var e;cancelAnimationFrame(this.animationFrame),this.unbindEvents(),this.layer.remove(this.group),(e=this.tilesRenderer)===null||e===void 0||e.dispose(),this.group=null,this.layer=null,this.statsContainer&&(this.statsContainer.remove(),this.statsContainer=void 0)}}var lg=H.defineComponent({name:"ElAmapThreeTiles3d",mixins:[le],props:{url:{type:String,required:!0},position:{type:Object,required:!0},scale:{type:Object},rotation:{type:Object},translate:{type:Object},dracoDecoderPath:{type:String},fetchOptions:{type:Object},mouseEvent:{type:Boolean,default:!1},debug:{type:Boolean,default:!1}},data(){return{}},methods:{__initComponent(n){this.$amapComponent=new QT(this.$parentComponent,n)},destroyComponent(){this.$amapComponent.destroy(),this.$amapComponent=null,this.$parentComponent=null}},render(){return null}});lg.__file="src/packages/three/Three3Dtiles/ThreeTiles3d.vue";const cg=ce(lg);var eE=[uh,ph,mh,_h,vh,bh,Mh,Sh,wh,Th,Lh,Ph,Dh,Oh,Nh,kh,$h,zh,Vh,Wh,qh,Yh,Zh,Qh,tu,iu,ru,au,cu,uu,pu,mu,_u,yu,xu,Mu,Cu,Au,Eu,Ru,Iu,Fu,Nu,ku,$u,zu,Vu,Wu,qu,Yu,Zu,Qu,td,sd,od,Xf,Kf,em,nm,sm,om,lm,cm,um,pm,mm,_m,vm,bm,Sm,Om,km,cg],hg=oc([...eE]);const tE=hg.install;Z.ElAmap=uh,Z.ElAmapBezierCurve=Wu,Z.ElAmapCircle=qu,Z.ElAmapCircleMarker=nm,Z.ElAmapControlControlBar=ph,Z.ElAmapControlGeolocation=em,Z.ElAmapControlHawkEye=mh,Z.ElAmapControlMapType=_h,Z.ElAmapControlScale=vh,Z.ElAmapControlToolBar=bh,Z.ElAmapElasticMarker=Fu,Z.ElAmapEllipse=Yu,Z.ElAmapGeojson=Zu,Z.ElAmapInfoWindow=Sh,Z.ElAmapLabelMarker=Nu,Z.ElAmapLayerBuildings=$h,Z.ElAmapLayerCanvas=wh,Z.ElAmapLayerCustom=Th,Z.ElAmapLayerDefault=zh,Z.ElAmapLayerDistrict=Vh,Z.ElAmapLayerFlexible=Lh,Z.ElAmapLayerGlCustom=Ph,Z.ElAmapLayerHeatMap=Dh,Z.ElAmapLayerImage=Oh,Z.ElAmapLayerIndoorMap=Wh,Z.ElAmapLayerLabels=Nh,Z.ElAmapLayerMapboxVectorTile=tu,Z.ElAmapLayerRoadNet=qh,Z.ElAmapLayerSatellite=Yh,Z.ElAmapLayerThree=Xf,Z.ElAmapLayerTile=Zh,Z.ElAmapLayerTiles3d=od,Z.ElAmapLayerTraffic=Qh,Z.ElAmapLayerVector=kh,Z.ElAmapLayerVideo=cm,Z.ElAmapLayerWms=iu,Z.ElAmapLayerWmts=ru,Z.ElAmapLoca=yu,Z.ElAmapLocaAmbientLight=sm,Z.ElAmapLocaDirectionalLight=om,Z.ElAmapLocaGrid=au,Z.ElAmapLocaHeatmap=cu,Z.ElAmapLocaHexagon=uu,Z.ElAmapLocaIcon=pu,Z.ElAmapLocaLaser=um,Z.ElAmapLocaLine=mu,Z.ElAmapLocaLink=_u,Z.ElAmapLocaPoint=xu,Z.ElAmapLocaPointLight=lm,Z.ElAmapLocaPolygon=Mu,Z.ElAmapLocaPrism=Cu,Z.ElAmapLocaPulseLine=Au,Z.ElAmapLocaPulseLink=Eu,Z.ElAmapLocaScatter=Ru,Z.ElAmapLocaZMarker=Iu,Z.ElAmapMarker=ku,Z.ElAmapMarkerCluster=$u,Z.ElAmapMassMarks=zu,Z.ElAmapMouseTool=km,Z.ElAmapPolygon=Qu,Z.ElAmapPolyline=td,Z.ElAmapRectangle=sd,Z.ElAmapSearchBox=Mh,Z.ElAmapText=Vu,Z.ElAmapThreeGltf=Kf,Z.ElAmapThreeLightAmbient=mm,Z.ElAmapThreeLightDirectional=_m,Z.ElAmapThreeLightHemisphere=vm,Z.ElAmapThreeLightPoint=bm,Z.ElAmapThreeLightSpot=Sm,Z.ElAmapThreePolygon=Om,Z.ElAmapThreeTiles3d=cg,Z.ElAmapThreeVideo=pm,Z.default=hg,Z.initAMapApiLoader=Fv,Z.install=tE,Z.makeInstaller=oc,Z.registerMixin=le,Object.defineProperty(Z,"__esModule",{value:!0})}); //# sourceMappingURL=index.min.js.map