@aibee/crc-bmap 0.8.106 → 0.8.107

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -41,7 +41,7 @@ var n1=Object.create;var Yi=Object.defineProperty;var r1=Object.getOwnPropertyDe
41
41
  `,p=new mP({uniforms:{uColor:{value:new es(e[0]).convertLinearToSRGB()},uGradualColor:{value:new es(e[1]).convertLinearToSRGB()},center:{value:n},maxValue:{value:r},opacity:{value:o},uDirection:{value:s},uMax:{value:a},uMin:{value:u}},vertexShader:c,fragmentShader:h,side:_P});return this.shaderMaterialMap.set(l,p),p}static createLine2MaterialMap(t){let{color:e,width:n,dashed:r,resolution:o}=t,s=e+"-"+n+"-"+r+"-"+o.x+"-"+o.y;if(this.line2MaterialMap.has(s))return this.line2MaterialMap.get(s);let a=new pP({color:parseInt(e.slice(1),16),dashed:r,linewidth:n,worldUnits:!0,dashSize:1,gapSize:3,dashScale:1,resolution:o});return this.line2MaterialMap.set(s,a),a}static createLineDashedMaterial(t){let e="dashed-"+t.color+"-"+t.opacity+"-"+t.dashSize+"-"+t.gapSize+"-"+t.scale;if(this.lineDashedMaterialMap.has(e))return this.lineDashedMaterialMap.get(e);let n=new vP({color:t.color,transparent:!0,opacity:t.opacity,dashSize:t.dashSize||.2,gapSize:t.gapSize||.1,scale:t.scale||1});return this.lineDashedMaterialMap.set(e,n),n}static dispose(){this.lineMaterialMap.forEach((t,e)=>{t.dispose()}),this.lineMaterialMap.clear(),this.meshStandardMaterialMap.forEach((t,e)=>{t.dispose()}),this.meshStandardMaterialMap.clear(),this.meshBasicMaterialMap.forEach((t,e)=>{t.dispose()}),this.meshBasicMaterialMap.clear(),this.shaderMaterialMap.forEach((t,e)=>{t.dispose()}),this.shaderMaterialMap.clear(),this.line2MaterialMap.forEach((t,e)=>{t.dispose()}),this.line2MaterialMap.clear(),this.lineDashedMaterialMap.forEach(t=>{t.dispose()}),this.lineDashedMaterialMap.clear()}};W.lineMaterialMap=new Map;W.meshStandardMaterialMap=new Map;W.meshBasicMaterialMap=new Map;W.shaderMaterialMap=new Map;W.line2MaterialMap=new Map;W.lineDashedMaterialMap=new Map;var H5=f(U(),1),W5=f(P(),1),q5=f(Bt(),1),X5=f(Es(),1),j5=f(hi(),1),Y5=f(pi(),1),K5=f(di(),1),Z5=f(gi(),1),$5=f(mi(),1),J5=f(vi(),1),Q5=f(yi(),1),tY=f(xi(),1),eY=f(Ei(),1),nY=f(Si(),1),rY=f(bi(),1),iY=f(Mi(),1),oY=f(Ti(),1),sY=f(Ai(),1),aY=f(Ul(),1);import{DataTexture as Ci,LinearFilter as we,RGBAFormat as Ri}from"three";function Fl(){let i=new Blob([`var ia=Object.create;var Re=Object.defineProperty;var aa=Object.getOwnPropertyDescriptor;var ua=Object.getOwnPropertyNames;var oa=Object.getPrototypeOf,sa=Object.prototype.hasOwnProperty;var i=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var ca=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of ua(e))!sa.call(r,a)&&a!==t&&Re(r,a,{get:()=>e[a],enumerable:!(n=aa(e,a))||n.enumerable});return r};var W=(r,e,t)=>(t=r!=null?ia(oa(r)):{},ca(e||!r||!r.__esModule?Re(t,"default",{value:r,enumerable:!0}):t,r));var _e=(r,e,t)=>new Promise((n,a)=>{var u=v=>{try{s(t.next(v))}catch(c){a(c)}},o=v=>{try{s(t.throw(v))}catch(c){a(c)}},s=v=>v.done?n(v.value):Promise.resolve(v.value).then(u,o);s((t=t.apply(r,e)).next())});var g=i((Sr,Ce)=>{"use strict";var M=function(r){return r&&r.Math===Math&&r};Ce.exports=M(typeof globalThis=="object"&&globalThis)||M(typeof window=="object"&&window)||M(typeof self=="object"&&self)||M(typeof global=="object"&&global)||M(typeof Sr=="object"&&Sr)||function(){return this}()||Function("return this")()});var d=i((qv,je)=>{"use strict";je.exports=function(r){try{return!!r()}catch(e){return!0}}});var O=i((bv,Ne)=>{"use strict";var va=d();Ne.exports=!va(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var Y=i((xv,Fe)=>{"use strict";var la=d();Fe.exports=!la(function(){var r=function(){}.bind();return typeof r!="function"||r.hasOwnProperty("prototype")})});var I=i((Ev,Ae)=>{"use strict";var fa=Y(),z=Function.prototype.call;Ae.exports=fa?z.bind(z):function(){return z.apply(z,arguments)}});var $e=i(Le=>{"use strict";var De={}.propertyIsEnumerable,Me=Object.getOwnPropertyDescriptor,pa=Me&&!De.call({1:2},1);Le.f=pa?function(e){var t=Me(this,e);return!!t&&t.enumerable}:De});var Tr=i((Sv,Be)=>{"use strict";Be.exports=function(r,e){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:e}}});var h=i((Tv,Ge)=>{"use strict";var Ue=Y(),ke=Function.prototype,mr=ke.call,ya=Ue&&ke.bind.bind(mr,mr);Ge.exports=Ue?ya:function(r){return function(){return mr.apply(r,arguments)}}});var L=i((mv,We)=>{"use strict";var Ke=h(),ga=Ke({}.toString),da=Ke("".slice);We.exports=function(r){return da(ga(r),8,-1)}});var ze=i((Iv,Ye)=>{"use strict";var ha=h(),qa=d(),ba=L(),Ir=Object,xa=ha("".split);Ye.exports=qa(function(){return!Ir("z").propertyIsEnumerable(0)})?function(r){return ba(r)==="String"?xa(r,""):Ir(r)}:Ir});var H=i((wv,He)=>{"use strict";He.exports=function(r){return r==null}});var $=i((Pv,Xe)=>{"use strict";var Ea=H(),Oa=TypeError;Xe.exports=function(r){if(Ea(r))throw new Oa("Can't call method on "+r);return r}});var B=i((Rv,Je)=>{"use strict";var Sa=ze(),Ta=$();Je.exports=function(r){return Sa(Ta(r))}});var q=i((_v,Ze)=>{"use strict";var wr=typeof document=="object"&&document.all;Ze.exports=typeof wr=="undefined"&&wr!==void 0?function(r){return typeof r=="function"||r===wr}:function(r){return typeof r=="function"}});var C=i((Cv,Ve)=>{"use strict";var ma=q();Ve.exports=function(r){return typeof r=="object"?r!==null:ma(r)}});var X=i((jv,Qe)=>{"use strict";var Pr=g(),Ia=q(),wa=function(r){return Ia(r)?r:void 0};Qe.exports=function(r,e){return arguments.length<2?wa(Pr[r]):Pr[r]&&Pr[r][e]}});var et=i((Nv,rt)=>{"use strict";var Pa=h();rt.exports=Pa({}.isPrototypeOf)});var at=i((Fv,it)=>{"use strict";var Ra=g(),tt=Ra.navigator,nt=tt&&tt.userAgent;it.exports=nt?String(nt):""});var ft=i((Av,lt)=>{"use strict";var vt=g(),Rr=at(),ut=vt.process,ot=vt.Deno,st=ut&&ut.versions||ot&&ot.version,ct=st&&st.v8,b,J;ct&&(b=ct.split("."),J=b[0]>0&&b[0]<4?1:+(b[0]+b[1]));!J&&Rr&&(b=Rr.match(/Edge\\/(\\d+)/),(!b||b[1]>=74)&&(b=Rr.match(/Chrome\\/(\\d+)/),b&&(J=+b[1])));lt.exports=J});var _r=i((Dv,yt)=>{"use strict";var pt=ft(),_a=d(),Ca=g(),ja=Ca.String;yt.exports=!!Object.getOwnPropertySymbols&&!_a(function(){var r=Symbol("symbol detection");return!ja(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&pt&&pt<41})});var Cr=i((Mv,gt)=>{"use strict";var Na=_r();gt.exports=Na&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var jr=i((Lv,dt)=>{"use strict";var Fa=X(),Aa=q(),Da=et(),Ma=Cr(),La=Object;dt.exports=Ma?function(r){return typeof r=="symbol"}:function(r){var e=Fa("Symbol");return Aa(e)&&Da(e.prototype,La(r))}});var qt=i(($v,ht)=>{"use strict";var $a=String;ht.exports=function(r){try{return $a(r)}catch(e){return"Object"}}});var xt=i((Bv,bt)=>{"use strict";var Ba=q(),Ua=qt(),ka=TypeError;bt.exports=function(r){if(Ba(r))return r;throw new ka(Ua(r)+" is not a function")}});var Nr=i((Uv,Et)=>{"use strict";var Ga=xt(),Ka=H();Et.exports=function(r,e){var t=r[e];return Ka(t)?void 0:Ga(t)}});var St=i((kv,Ot)=>{"use strict";var Fr=I(),Ar=q(),Dr=C(),Wa=TypeError;Ot.exports=function(r,e){var t,n;if(e==="string"&&Ar(t=r.toString)&&!Dr(n=Fr(t,r))||Ar(t=r.valueOf)&&!Dr(n=Fr(t,r))||e!=="string"&&Ar(t=r.toString)&&!Dr(n=Fr(t,r)))return n;throw new Wa("Can't convert object to primitive value")}});var mt=i((Gv,Tt)=>{"use strict";Tt.exports=!1});var Z=i((Kv,wt)=>{"use strict";var It=g(),Ya=Object.defineProperty;wt.exports=function(r,e){try{Ya(It,r,{value:e,configurable:!0,writable:!0})}catch(t){It[r]=e}return e}});var V=i((Wv,_t)=>{"use strict";var za=mt(),Ha=g(),Xa=Z(),Pt="__core-js_shared__",Rt=_t.exports=Ha[Pt]||Xa(Pt,{});(Rt.versions||(Rt.versions=[])).push({version:"3.41.0",mode:za?"pure":"global",copyright:"\\xA9 2014-2025 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.41.0/LICENSE",source:"https://github.com/zloirock/core-js"})});var Q=i((Yv,jt)=>{"use strict";var Ct=V();jt.exports=function(r,e){return Ct[r]||(Ct[r]=e||{})}});var rr=i((zv,Nt)=>{"use strict";var Ja=$(),Za=Object;Nt.exports=function(r){return Za(Ja(r))}});var w=i((Hv,Ft)=>{"use strict";var Va=h(),Qa=rr(),ru=Va({}.hasOwnProperty);Ft.exports=Object.hasOwn||function(e,t){return ru(Qa(e),t)}});var Mr=i((Xv,At)=>{"use strict";var eu=h(),tu=0,nu=Math.random(),iu=eu(1 .toString);At.exports=function(r){return"Symbol("+(r===void 0?"":r)+")_"+iu(++tu+nu,36)}});var N=i((Jv,Mt)=>{"use strict";var au=g(),uu=Q(),Dt=w(),ou=Mr(),su=_r(),cu=Cr(),j=au.Symbol,Lr=uu("wks"),vu=cu?j.for||j:j&&j.withoutSetter||ou;Mt.exports=function(r){return Dt(Lr,r)||(Lr[r]=su&&Dt(j,r)?j[r]:vu("Symbol."+r)),Lr[r]}});var Ut=i((Zv,Bt)=>{"use strict";var lu=I(),Lt=C(),$t=jr(),fu=Nr(),pu=St(),yu=N(),gu=TypeError,du=yu("toPrimitive");Bt.exports=function(r,e){if(!Lt(r)||$t(r))return r;var t=fu(r,du),n;if(t){if(e===void 0&&(e="default"),n=lu(t,r,e),!Lt(n)||$t(n))return n;throw new gu("Can't convert object to primitive value")}return e===void 0&&(e="number"),pu(r,e)}});var $r=i((Vv,kt)=>{"use strict";var hu=Ut(),qu=jr();kt.exports=function(r){var e=hu(r,"string");return qu(e)?e:e+""}});var Ur=i((Qv,Kt)=>{"use strict";var bu=g(),Gt=C(),Br=bu.document,xu=Gt(Br)&&Gt(Br.createElement);Kt.exports=function(r){return xu?Br.createElement(r):{}}});var kr=i((rl,Wt)=>{"use strict";var Eu=O(),Ou=d(),Su=Ur();Wt.exports=!Eu&&!Ou(function(){return Object.defineProperty(Su("div"),"a",{get:function(){return 7}}).a!==7})});var Gr=i(zt=>{"use strict";var Tu=O(),mu=I(),Iu=$e(),wu=Tr(),Pu=B(),Ru=$r(),_u=w(),Cu=kr(),Yt=Object.getOwnPropertyDescriptor;zt.f=Tu?Yt:function(e,t){if(e=Pu(e),t=Ru(t),Cu)try{return Yt(e,t)}catch(n){}if(_u(e,t))return wu(!mu(Iu.f,e,t),e[t])}});var Kr=i((tl,Ht)=>{"use strict";var ju=O(),Nu=d();Ht.exports=ju&&Nu(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var P=i((nl,Xt)=>{"use strict";var Fu=C(),Au=String,Du=TypeError;Xt.exports=function(r){if(Fu(r))return r;throw new Du(Au(r)+" is not an object")}});var U=i(Zt=>{"use strict";var Mu=O(),Lu=kr(),$u=Kr(),er=P(),Jt=$r(),Bu=TypeError,Wr=Object.defineProperty,Uu=Object.getOwnPropertyDescriptor,Yr="enumerable",zr="configurable",Hr="writable";Zt.f=Mu?$u?function(e,t,n){if(er(e),t=Jt(t),er(n),typeof e=="function"&&t==="prototype"&&"value"in n&&Hr in n&&!n[Hr]){var a=Uu(e,t);a&&a[Hr]&&(e[t]=n.value,n={configurable:zr in n?n[zr]:a[zr],enumerable:Yr in n?n[Yr]:a[Yr],writable:!1})}return Wr(e,t,n)}:Wr:function(e,t,n){if(er(e),t=Jt(t),er(n),Lu)try{return Wr(e,t,n)}catch(a){}if("get"in n||"set"in n)throw new Bu("Accessors not supported");return"value"in n&&(e[t]=n.value),e}});var tr=i((al,Vt)=>{"use strict";var ku=O(),Gu=U(),Ku=Tr();Vt.exports=ku?function(r,e,t){return Gu.f(r,e,Ku(1,t))}:function(r,e,t){return r[e]=t,r}});var en=i((ul,rn)=>{"use strict";var Xr=O(),Wu=w(),Qt=Function.prototype,Yu=Xr&&Object.getOwnPropertyDescriptor,Jr=Wu(Qt,"name"),zu=Jr&&function(){}.name==="something",Hu=Jr&&(!Xr||Xr&&Yu(Qt,"name").configurable);rn.exports={EXISTS:Jr,PROPER:zu,CONFIGURABLE:Hu}});var nn=i((ol,tn)=>{"use strict";var Xu=h(),Ju=q(),Zr=V(),Zu=Xu(Function.toString);Ju(Zr.inspectSource)||(Zr.inspectSource=function(r){return Zu(r)});tn.exports=Zr.inspectSource});var on=i((sl,un)=>{"use strict";var Vu=g(),Qu=q(),an=Vu.WeakMap;un.exports=Qu(an)&&/native code/.test(String(an))});var Vr=i((cl,cn)=>{"use strict";var ro=Q(),eo=Mr(),sn=ro("keys");cn.exports=function(r){return sn[r]||(sn[r]=eo(r))}});var nr=i((vl,vn)=>{"use strict";vn.exports={}});var te=i((ll,pn)=>{"use strict";var to=on(),fn=g(),no=C(),io=tr(),Qr=w(),re=V(),ao=Vr(),uo=nr(),ln="Object already initialized",ee=fn.TypeError,oo=fn.WeakMap,ir,k,ar,so=function(r){return ar(r)?k(r):ir(r,{})},co=function(r){return function(e){var t;if(!no(e)||(t=k(e)).type!==r)throw new ee("Incompatible receiver, "+r+" required");return t}};to||re.state?(x=re.state||(re.state=new oo),x.get=x.get,x.has=x.has,x.set=x.set,ir=function(r,e){if(x.has(r))throw new ee(ln);return e.facade=r,x.set(r,e),e},k=function(r){return x.get(r)||{}},ar=function(r){return x.has(r)}):(_=ao("state"),uo[_]=!0,ir=function(r,e){if(Qr(r,_))throw new ee(ln);return e.facade=r,io(r,_,e),e},k=function(r){return Qr(r,_)?r[_]:{}},ar=function(r){return Qr(r,_)});var x,_;pn.exports={set:ir,get:k,has:ar,enforce:so,getterFor:co}});var hn=i((fl,dn)=>{"use strict";var ie=h(),vo=d(),lo=q(),ur=w(),ne=O(),fo=en().CONFIGURABLE,po=nn(),gn=te(),yo=gn.enforce,go=gn.get,yn=String,or=Object.defineProperty,ho=ie("".slice),qo=ie("".replace),bo=ie([].join),xo=ne&&!vo(function(){return or(function(){},"length",{value:8}).length!==8}),Eo=String(String).split("String"),Oo=dn.exports=function(r,e,t){ho(yn(e),0,7)==="Symbol("&&(e="["+qo(yn(e),/^Symbol\\(([^)]*)\\).*$/,"$1")+"]"),t&&t.getter&&(e="get "+e),t&&t.setter&&(e="set "+e),(!ur(r,"name")||fo&&r.name!==e)&&(ne?or(r,"name",{value:e,configurable:!0}):r.name=e),xo&&t&&ur(t,"arity")&&r.length!==t.arity&&or(r,"length",{value:t.arity});try{t&&ur(t,"constructor")&&t.constructor?ne&&or(r,"prototype",{writable:!1}):r.prototype&&(r.prototype=void 0)}catch(a){}var n=yo(r);return ur(n,"source")||(n.source=bo(Eo,typeof e=="string"?e:"")),r};Function.prototype.toString=Oo(function(){return lo(this)&&go(this).source||po(this)},"toString")});var ae=i((pl,qn)=>{"use strict";var So=q(),To=U(),mo=hn(),Io=Z();qn.exports=function(r,e,t,n){n||(n={});var a=n.enumerable,u=n.name!==void 0?n.name:e;if(So(t)&&mo(t,u,n),n.global)a?r[e]=t:Io(e,t);else{try{n.unsafe?r[e]&&(a=!0):delete r[e]}catch(o){}a?r[e]=t:To.f(r,e,{value:t,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return r}});var xn=i((yl,bn)=>{"use strict";var wo=Math.ceil,Po=Math.floor;bn.exports=Math.trunc||function(e){var t=+e;return(t>0?Po:wo)(t)}});var G=i((gl,En)=>{"use strict";var Ro=xn();En.exports=function(r){var e=+r;return e!==e||e===0?0:Ro(e)}});var Sn=i((dl,On)=>{"use strict";var _o=G(),Co=Math.max,jo=Math.min;On.exports=function(r,e){var t=_o(r);return t<0?Co(t+e,0):jo(t,e)}});var ue=i((hl,Tn)=>{"use strict";var No=G(),Fo=Math.min;Tn.exports=function(r){var e=No(r);return e>0?Fo(e,9007199254740991):0}});var oe=i((ql,mn)=>{"use strict";var Ao=ue();mn.exports=function(r){return Ao(r.length)}});var Pn=i((bl,wn)=>{"use strict";var Do=B(),Mo=Sn(),Lo=oe(),In=function(r){return function(e,t,n){var a=Do(e),u=Lo(a);if(u===0)return!r&&-1;var o=Mo(n,u),s;if(r&&t!==t){for(;u>o;)if(s=a[o++],s!==s)return!0}else for(;u>o;o++)if((r||o in a)&&a[o]===t)return r||o||0;return!r&&-1}};wn.exports={includes:In(!0),indexOf:In(!1)}});var ce=i((xl,_n)=>{"use strict";var $o=h(),se=w(),Bo=B(),Uo=Pn().indexOf,ko=nr(),Rn=$o([].push);_n.exports=function(r,e){var t=Bo(r),n=0,a=[],u;for(u in t)!se(ko,u)&&se(t,u)&&Rn(a,u);for(;e.length>n;)se(t,u=e[n++])&&(~Uo(a,u)||Rn(a,u));return a}});var sr=i((El,Cn)=>{"use strict";Cn.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var Nn=i(jn=>{"use strict";var Go=ce(),Ko=sr(),Wo=Ko.concat("length","prototype");jn.f=Object.getOwnPropertyNames||function(e){return Go(e,Wo)}});var An=i(Fn=>{"use strict";Fn.f=Object.getOwnPropertySymbols});var Mn=i((Tl,Dn)=>{"use strict";var Yo=X(),zo=h(),Ho=Nn(),Xo=An(),Jo=P(),Zo=zo([].concat);Dn.exports=Yo("Reflect","ownKeys")||function(e){var t=Ho.f(Jo(e)),n=Xo.f;return n?Zo(t,n(e)):t}});var Bn=i((ml,$n)=>{"use strict";var Ln=w(),Vo=Mn(),Qo=Gr(),rs=U();$n.exports=function(r,e,t){for(var n=Vo(e),a=rs.f,u=Qo.f,o=0;o<n.length;o++){var s=n[o];!Ln(r,s)&&!(t&&Ln(t,s))&&a(r,s,u(e,s))}}});var kn=i((Il,Un)=>{"use strict";var es=d(),ts=q(),ns=/#|\\.prototype\\./,K=function(r,e){var t=as[is(r)];return t===os?!0:t===us?!1:ts(e)?es(e):!!e},is=K.normalize=function(r){return String(r).replace(ns,".").toLowerCase()},as=K.data={},us=K.NATIVE="N",os=K.POLYFILL="P";Un.exports=K});var ve=i((wl,Gn)=>{"use strict";var cr=g(),ss=Gr().f,cs=tr(),vs=ae(),ls=Z(),fs=Bn(),ps=kn();Gn.exports=function(r,e){var t=r.target,n=r.global,a=r.stat,u,o,s,v,c,l;if(n?o=cr:a?o=cr[t]||ls(t,{}):o=cr[t]&&cr[t].prototype,o)for(s in e){if(c=e[s],r.dontCallGetSet?(l=ss(o,s),v=l&&l.value):v=o[s],u=ps(n?s:t+(a?".":"#")+s,r.forced),!u&&v!==void 0){if(typeof c==typeof v)continue;fs(c,v)}(r.sham||v&&v.sham)&&cs(c,"sham",!0),vs(o,s,c,r)}}});var Wn=i((Pl,Kn)=>{"use strict";var ys=L();Kn.exports=Array.isArray||function(e){return ys(e)==="Array"}});var zn=i((Rl,Yn)=>{"use strict";var gs=O(),ds=Wn(),hs=TypeError,qs=Object.getOwnPropertyDescriptor,bs=gs&&!function(){if(this!==void 0)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(r){return r instanceof TypeError}}();Yn.exports=bs?function(r,e){if(ds(r)&&!qs(r,"length").writable)throw new hs("Cannot set read only .length");return r.length=e}:function(r,e){return r.length=e}});var Xn=i((_l,Hn)=>{"use strict";var xs=TypeError,Es=9007199254740991;Hn.exports=function(r){if(r>Es)throw xs("Maximum allowed index exceeded");return r}});var Jn=i(()=>{"use strict";var Os=ve(),Ss=rr(),Ts=oe(),ms=zn(),Is=Xn(),ws=d(),Ps=ws(function(){return[].push.call({length:4294967296},1)!==4294967297}),Rs=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(r){return r instanceof TypeError}},_s=Ps||!Rs();Os({target:"Array",proto:!0,arity:1,forced:_s},{push:function(e){var t=Ss(this),n=Ts(t),a=arguments.length;Is(n+a);for(var u=0;u<a;u++)t[n]=arguments[u],n++;return ms(t,n),n}})});var Qn=i((Nl,Vn)=>{"use strict";var Cs=N(),js=Cs("toStringTag"),Zn={};Zn[js]="z";Vn.exports=String(Zn)==="[object z]"});var ei=i((Fl,ri)=>{"use strict";var Ns=Qn(),Fs=q(),vr=L(),As=N(),Ds=As("toStringTag"),Ms=Object,Ls=vr(function(){return arguments}())==="Arguments",$s=function(r,e){try{return r[e]}catch(t){}};ri.exports=Ns?vr:function(r){var e,t,n;return r===void 0?"Undefined":r===null?"Null":typeof(t=$s(e=Ms(r),Ds))=="string"?t:Ls?vr(e):(n=vr(e))==="Object"&&Fs(e.callee)?"Arguments":n}});var lr=i((Al,ti)=>{"use strict";var Bs=ei(),Us=String;ti.exports=function(r){if(Bs(r)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return Us(r)}});var ii=i((Dl,ni)=>{"use strict";var ks=P();ni.exports=function(){var r=ks(this),e="";return r.hasIndices&&(e+="d"),r.global&&(e+="g"),r.ignoreCase&&(e+="i"),r.multiline&&(e+="m"),r.dotAll&&(e+="s"),r.unicode&&(e+="u"),r.unicodeSets&&(e+="v"),r.sticky&&(e+="y"),e}});var ui=i((Ml,ai)=>{"use strict";var le=d(),Gs=g(),fe=Gs.RegExp,pe=le(function(){var r=fe("a","y");return r.lastIndex=2,r.exec("abcd")!==null}),Ks=pe||le(function(){return!fe("a","y").sticky}),Ws=pe||le(function(){var r=fe("^r","gy");return r.lastIndex=2,r.exec("str")!==null});ai.exports={BROKEN_CARET:Ws,MISSED_STICKY:Ks,UNSUPPORTED_Y:pe}});var si=i((Ll,oi)=>{"use strict";var Ys=ce(),zs=sr();oi.exports=Object.keys||function(e){return Ys(e,zs)}});var vi=i(ci=>{"use strict";var Hs=O(),Xs=Kr(),Js=U(),Zs=P(),Vs=B(),Qs=si();ci.f=Hs&&!Xs?Object.defineProperties:function(e,t){Zs(e);for(var n=Vs(t),a=Qs(t),u=a.length,o=0,s;u>o;)Js.f(e,s=a[o++],n[s]);return e}});var fi=i((Bl,li)=>{"use strict";var rc=X();li.exports=rc("document","documentElement")});var xi=i((Ul,bi)=>{"use strict";var ec=P(),tc=vi(),pi=sr(),nc=nr(),ic=fi(),ac=Ur(),uc=Vr(),yi=">",gi="<",ge="prototype",de="script",hi=uc("IE_PROTO"),ye=function(){},qi=function(r){return gi+de+yi+r+gi+"/"+de+yi},di=function(r){r.write(qi("")),r.close();var e=r.parentWindow.Object;return r=null,e},oc=function(){var r=ac("iframe"),e="java"+de+":",t;return r.style.display="none",ic.appendChild(r),r.src=String(e),t=r.contentWindow.document,t.open(),t.write(qi("document.F=Object")),t.close(),t.F},fr,pr=function(){try{fr=new ActiveXObject("htmlfile")}catch(e){}pr=typeof document!="undefined"?document.domain&&fr?di(fr):oc():di(fr);for(var r=pi.length;r--;)delete pr[ge][pi[r]];return pr()};nc[hi]=!0;bi.exports=Object.create||function(e,t){var n;return e!==null?(ye[ge]=ec(e),n=new ye,ye[ge]=null,n[hi]=e):n=pr(),t===void 0?n:tc.f(n,t)}});var Oi=i((kl,Ei)=>{"use strict";var sc=d(),cc=g(),vc=cc.RegExp;Ei.exports=sc(function(){var r=vc(".","s");return!(r.dotAll&&r.test(\`
42
42
  \`)&&r.flags==="s")})});var Ti=i((Gl,Si)=>{"use strict";var lc=d(),fc=g(),pc=fc.RegExp;Si.exports=lc(function(){var r=pc("(?<a>b)","g");return r.exec("b").groups.a!=="b"||"b".replace(r,"$<a>c")!=="bc"})});var dr=i((Kl,Ii)=>{"use strict";var F=I(),gr=h(),yc=lr(),gc=ii(),dc=ui(),hc=Q(),qc=xi(),bc=te().get,xc=Oi(),Ec=Ti(),Oc=hc("native-string-replace",String.prototype.replace),yr=RegExp.prototype.exec,qe=yr,Sc=gr("".charAt),Tc=gr("".indexOf),mc=gr("".replace),he=gr("".slice),be=function(){var r=/a/,e=/b*/g;return F(yr,r,"a"),F(yr,e,"a"),r.lastIndex!==0||e.lastIndex!==0}(),mi=dc.BROKEN_CARET,xe=/()??/.exec("")[1]!==void 0,Ic=be||xe||mi||xc||Ec;Ic&&(qe=function(e){var t=this,n=bc(t),a=yc(e),u=n.raw,o,s,v,c,l,y,f;if(u)return u.lastIndex=t.lastIndex,o=F(qe,u,a),t.lastIndex=u.lastIndex,o;var p=n.groups,E=mi&&t.sticky,S=F(gc,t),T=t.source,R=0,m=a;if(E&&(S=mc(S,"y",""),Tc(S,"g")===-1&&(S+="g"),m=he(a,t.lastIndex),t.lastIndex>0&&(!t.multiline||t.multiline&&Sc(a,t.lastIndex-1)!==\`
43
43
  \`)&&(T="(?: "+T+")",m=" "+m,R++),s=new RegExp("^(?:"+T+")",S)),xe&&(s=new RegExp("^"+T+"$(?!\\\\s)",S)),be&&(v=t.lastIndex),c=F(yr,E?s:t,m),E?c?(c.input=he(c.input,R),c[0]=he(c[0],R),c.index=t.lastIndex,t.lastIndex+=c[0].length):t.lastIndex=0:be&&c&&(t.lastIndex=t.global?c.index+c[0].length:v),xe&&c&&c.length>1&&F(Oc,c[0],s,function(){for(l=1;l<arguments.length-2;l++)arguments[l]===void 0&&(c[l]=void 0)}),c&&p)for(c.groups=y=qc(null),l=0;l<p.length;l++)f=p[l],y[f[0]]=c[f[1]];return c});Ii.exports=qe});var hr=i(()=>{"use strict";var wc=ve(),wi=dr();wc({target:"RegExp",proto:!0,forced:/./.exec!==wi},{exec:wi})});var Ni=i((Xl,ji)=>{"use strict";var Pc=Y(),Ci=Function.prototype,Ri=Ci.apply,_i=Ci.call;ji.exports=typeof Reflect=="object"&&Reflect.apply||(Pc?_i.bind(Ri):function(){return _i.apply(Ri,arguments)})});var $i=i((Jl,Li)=>{"use strict";hr();var Fi=I(),Ai=ae(),Rc=dr(),Di=d(),Mi=N(),_c=tr(),Cc=Mi("species"),Ee=RegExp.prototype;Li.exports=function(r,e,t,n){var a=Mi(r),u=!Di(function(){var c={};return c[a]=function(){return 7},""[r](c)!==7}),o=u&&!Di(function(){var c=!1,l=/a/;return r==="split"&&(l={},l.constructor={},l.constructor[Cc]=function(){return l},l.flags="",l[a]=/./[a]),l.exec=function(){return c=!0,null},l[a](""),!c});if(!u||!o||t){var s=/./[a],v=e(a,""[r],function(c,l,y,f,p){var E=l.exec;return E===Rc||E===Ee.exec?u&&!p?{done:!0,value:Fi(s,l,y,f)}:{done:!0,value:Fi(c,y,l,f)}:{done:!1}});Ai(String.prototype,r,v[0]),Ai(Ee,a,v[1])}n&&_c(Ee[a],"sham",!0)}});var Gi=i((Zl,ki)=>{"use strict";var Oe=h(),jc=G(),Nc=lr(),Fc=$(),Ac=Oe("".charAt),Bi=Oe("".charCodeAt),Dc=Oe("".slice),Ui=function(r){return function(e,t){var n=Nc(Fc(e)),a=jc(t),u=n.length,o,s;return a<0||a>=u?r?"":void 0:(o=Bi(n,a),o<55296||o>56319||a+1===u||(s=Bi(n,a+1))<56320||s>57343?r?Ac(n,a):o:r?Dc(n,a,a+2):(o-55296<<10)+(s-56320)+65536)}};ki.exports={codeAt:Ui(!1),charAt:Ui(!0)}});var Wi=i((Vl,Ki)=>{"use strict";var Mc=Gi().charAt;Ki.exports=function(r,e,t){return e+(t?Mc(r,e).length:1)}});var zi=i((Ql,Yi)=>{"use strict";var me=h(),Lc=rr(),$c=Math.floor,Se=me("".charAt),Bc=me("".replace),Te=me("".slice),Uc=/\\$([$&'\`]|\\d{1,2}|<[^>]*>)/g,kc=/\\$([$&'\`]|\\d{1,2})/g;Yi.exports=function(r,e,t,n,a,u){var o=t+r.length,s=n.length,v=kc;return a!==void 0&&(a=Lc(a),v=Uc),Bc(u,v,function(c,l){var y;switch(Se(l,0)){case"$":return"$";case"&":return r;case"\`":return Te(e,0,t);case"'":return Te(e,o);case"<":y=a[Te(l,1,-1)];break;default:var f=+l;if(f===0)return c;if(f>s){var p=$c(f/10);return p===0?c:p<=s?n[p-1]===void 0?Se(l,1):n[p-1]+Se(l,1):c}y=n[f-1]}return y===void 0?"":y})}});var Ji=i((rf,Xi)=>{"use strict";var Hi=I(),Gc=P(),Kc=q(),Wc=L(),Yc=dr(),zc=TypeError;Xi.exports=function(r,e){var t=r.exec;if(Kc(t)){var n=Hi(t,r,e);return n!==null&&Gc(n),n}if(Wc(r)==="RegExp")return Hi(Yc,r,e);throw new zc("RegExp#exec called on incompatible receiver")}});var ea=i(()=>{"use strict";var Hc=Ni(),Zi=I(),qr=h(),Xc=$i(),Jc=d(),Zc=P(),Vc=q(),Qc=H(),rv=G(),ev=ue(),A=lr(),tv=$(),nv=Wi(),iv=Nr(),av=zi(),uv=Ji(),ov=N(),we=ov("replace"),sv=Math.max,cv=Math.min,vv=qr([].concat),Ie=qr([].push),Vi=qr("".indexOf),Qi=qr("".slice),lv=function(r){return r===void 0?r:String(r)},fv=function(){return"a".replace(/./,"$0")==="$0"}(),ra=function(){return/./[we]?/./[we]("a","$0")==="":!1}(),pv=!Jc(function(){var r=/./;return r.exec=function(){var e=[];return e.groups={a:"7"},e},"".replace(r,"$<a>")!=="7"});Xc("replace",function(r,e,t){var n=ra?"$":"$0";return[function(u,o){var s=tv(this),v=Qc(u)?void 0:iv(u,we);return v?Zi(v,u,s,o):Zi(e,A(s),u,o)},function(a,u){var o=Zc(this),s=A(a);if(typeof u=="string"&&Vi(u,n)===-1&&Vi(u,"$<")===-1){var v=t(e,o,s,u);if(v.done)return v.value}var c=Vc(u);c||(u=A(u));var l=o.global,y;l&&(y=o.unicode,o.lastIndex=0);for(var f=[],p;p=uv(o,s),!(p===null||(Ie(f,p),!l));){var E=A(p[0]);E===""&&(o.lastIndex=nv(s,ev(o.lastIndex),y))}for(var S="",T=0,R=0;R<f.length;R++){p=f[R];for(var m=A(p[0]),D=sv(cv(rv(p.index),s.length),0),br=[],xr,Er=1;Er<p.length;Er++)Ie(br,lv(p[Er]));var Or=p.groups;if(c){var Pe=vv([m],br,D,s);Or!==void 0&&Ie(Pe,Or),xr=A(Hc(u,void 0,Pe))}else xr=av(m,s,D,br,Or,u);D>=T&&(S+=Qi(s,T,D)+xr,T=D+m.length)}return S+Qi(s,T)}]},!pv||!fv||ra)});var vf=W(Jn(),1);var zl=W(hr(),1);function Pi(r){return/[\\u4E00-\\u9FA5]+/g.test(r)}var nf=W(ea(),1),af=W(hr(),1);function ta(r){return r.replace(/[A-Z]/g,e=>"_"+e.toLowerCase()).replace(/^_/,"")}function na(r){let e={};for(let n in r)n.startsWith("on")&&(e[ta(n.slice(2))]=r[n]);let t=n=>_e(this,null,function*(){let{data:a}=n;if(e[a.type])try{let u=yield e[a.type](a.data);if(u!=null&&u.$transfer&&Array.isArray(u.$transfer)){let o=u.$transfer;delete u.$transfer,self.postMessage({type:""+a.type+"_result",key:a.key,data:u},o)}else self.postMessage({type:""+a.type+"_result",key:a.key,data:u})}catch(u){self.postMessage({type:""+a.type+"_result",key:a.key,error:u})}else self.postMessage({type:""+a.type+"_result",key:a.key,error:"no_event"})});return self.addEventListener("message",t),()=>{self.removeEventListener("message",t)}}function yv(r,e){return new OffscreenCanvas(r,e)}function gv(r){return r.getContext("2d",{willReadFrequently:!0})}function dv(r,e,t){r.width=t.width,r.height=t.height,e.font=t.font,e.textBaseline=t.textBaseline,e.lineWidth=t.lineWidth,e.fillStyle=t.fillStyle,e.strokeStyle=t.strokeStyle}na({onGetTextureByTexts(r){let{texts:e,options:t,originHeight:n}=r,a=yv(t.width,t.height),u=gv(a);dv(a,u,t),u.clearRect(0,0,a.width,a.height);let o=[],s=0,v=0,c={};e.forEach(y=>{let f=Math.ceil(u.measureText(y).width);if(f=f%2===0?f:f+1,f+=2,f+s>t.width&&(s=0,v+=n,n+v>t.height)){let E=u.getImageData(0,0,t.width,v);o.push({data:E.data,offsetMap:c,height:v}),v=0,u.clearRect(0,0,t.width,t.height),c={}}let p=Pi(y)?4:8;t.lineWidth&&u.strokeText(y,2+s,p+v),u.fillText(y,2+s,p+v),c[y]={width:f,height:n,x:s,y:v},s+=f});let l=u.getImageData(0,0,t.width,n+v);return o.push({data:l.data,offsetMap:c,height:v+n}),{data:o,$transfer:o.map(y=>y.data.buffer)}}});
44
- `],{type:"text/javascript"}),t=URL.createObjectURL(i),e=new Worker(t);return URL.revokeObjectURL(t),e}var tt=class{static getCanvas(){if(this.canvas)return this.canvas;{let t=document.createElement("canvas");return this.canvas=t,t}}static getCtx(){if(this.ctx)return this.ctx;let e=this.getCanvas().getContext("2d",{willReadFrequently:!0});return this.ctx=e,e}static getIdleCanvas(){if(this.idleCanvas)return this.idleCanvas;{let t=document.createElement("canvas");return this.idleCanvas=t,t}}static getIdleCtx(){if(this.idleCtx)return this.idleCtx;let e=this.getIdleCanvas().getContext("2d",{willReadFrequently:!0});return this.idleCtx=e,e}static getMergedOptions(t){return S({},this.options,t)}static setCtxStyle(t,e,n){e===void 0&&(e=this.getCanvas()),n===void 0&&(n=this.getCtx()),e.width=t.width,e.height=t.height,n.font=t.font,n.textBaseline=t.textBaseline,n.lineWidth=t.lineWidth,n.fillStyle=t.fillStyle,n.strokeStyle=t.strokeStyle}static getTextureByText(t,e){let n=this.getMergedOptions(e),r=(e==null?void 0:e.maxWidth)||600,o=tr(S({},n,{text:t,maxWidth:r}));if(this.cacheMap.has(o))return this.cacheMap.get(o);let s=this.getCanvas(),a=this.getCtx();a.clearRect(0,0,s.width,s.height),this.setCtxStyle(n);let u=[],l="",c=[],h="",p=0;for(let b=0;b<t.length;b++){let C=t[b];if(C==="("||C==="\uFF08"){if(p===0&&h){let w=d(h);c.push(...w),h=""}p++}else if((C===")"||C==="\uFF09")&&(p--,p===0)){h+=C,c.push(h),h="";continue}h+=C}if(h){let b=d(h);c.push(...b)}function d(b){let C=[],w="",I=!1,A="";for(let R=0;R<b.length;R++){let B=b[R];(B==='"'||B==="'")&&(!I||B===A)?(I?(w+=B,C.push(w),w=""):(w&&C.push(w),w=B),I=!I,A=B):w+=B}return w&&C.push(w),C}for(let b of c)if(b.startsWith("(")||b.startsWith("\uFF08")||b.startsWith('"')||b.startsWith("'"))if(a.measureText(b).width>r){l&&(u.push(l),l="");let w="",I=b.split("");for(let A of I){let R=w+A;a.measureText(R).width>r&&w?(u.push(w),w=A):w=R}w&&(l=w)}else{let w=l?l+" "+b:b;a.measureText(w).width>r&&l?(u.push(l),l=b):l=w}else{let C=b.split(" ");for(let w of C){let I=l?l+" "+w:w,A=a.measureText(I);if(A.width>r)if(l&&u.push(l),A.width>r||Kn(w)){let R="",B=w.split("");for(let H of B){let k=R+H;a.measureText(k).width>r&&R?(u.push(R),R=H):R=k}R&&(l=R)}else l=w;else l=I}}l&&u.push(l);let m=64,_=m*u.length,v=Math.max(...u.map(b=>{let C=Math.ceil(a.measureText(b).width);return C%2===0?C:C+1}))+2;u.forEach((b,C)=>{let w=Math.ceil(a.measureText(b).width),I=Math.floor((v-w)/2),A=(Kn(b)?4:8)+C*m;n.lineWidth&&a.strokeText(b,I,A),a.fillText(b,I,A)});let x=a.getImageData(0,0,v,_),M=new Ci(x.data,v,_,Ri);return M.flipY=!0,M.minFilter=we,M.magFilter=we,this.cacheMap.set(o,{texture:M,lines:u.length}),{texture:M,lines:u.length}}static lazyGetTextureByTexts(t,e){return E(this,null,function*(){let n=this.getMergedOptions(e),r=n.height;return n.height=Math.min(r*t.length,2048),window.OffscreenCanvas?(console.log("use webworker"),this.getTextsByWorker(t,n,r)):typeof window.requestIdleCallback=="function"?(console.log("use browser idle"),this.getTextsByBrowserIdle(t,n,r)):(console.log("use sync text textures"),this.getTextsSync(t,n,r))})}static getTextsByWorker(t,e,n){return E(this,null,function*(){return this.textTextureWorker||(this.textTextureWorker=Fl()),(yield rt(this.textTextureWorker,"get_texture_by_texts",{texts:t,options:e,originHeight:n})).data.map(o=>{let s=new Ci(o.data,e.width,o.height,Ri);return s.flipY=!0,s.minFilter=we,s.magFilter=we,{texture:s,offsetMap:o.offsetMap}}).reduce((o,s)=>(Object.keys(s.offsetMap).forEach(a=>{o[a]=s.offsetMap[a],o[a].texture=s.texture}),o),{})})}static getTextsByBrowserIdle(t,e,n){return E(this,null,function*(){let r=0,o=t.length;return new Promise(s=>{let a=this.getIdleCanvas(),u=this.getIdleCtx();u.clearRect(0,0,a.width,a.height),this.setCtxStyle(e,a,u);let l=[],c=0,h=0,p={},d=()=>E(this,null,function*(){let _=u.getImageData(0,0,e.width,n+h);l.push({imageData:_,offsetMap:p,height:n+h});let v=l.reduce((x,M)=>{let b=new Ci(M.imageData.data,e.width,M.height,Ri);return b.flipY=!0,b.minFilter=we,b.magFilter=we,Object.keys(M.offsetMap).forEach(C=>{x[C]=S({},M.offsetMap[C],{texture:b})}),x},{});s(v)}),m=_=>{if(r>=o)return d();if(_.timeRemaining()>0){let v=t[r],x=Math.ceil(u.measureText(v).width);if(x=x%2===0?x:x+1,x+=2,x+c>e.width&&(c=0,h+=n,n+h>e.height)){let b=u.getImageData(0,0,e.width,h);l.push({imageData:b,offsetMap:p,height:h}),h=0,u.clearRect(0,0,e.width,e.height),p={}}let M=Kn(v)?4:8;if(e.lineWidth&&u.strokeText(v,2+c,M+h),u.fillText(v,2+c,M+h),p[v]={width:x,height:n,x:c,y:h},c+=x,++r>=o)return d();_.timeRemaining()>0?m(_):this.timer.requestIdleCallback(m)}else this.timer.requestIdleCallback(m)};this.timer.requestIdleCallback(m),this.timer.setTimeout(()=>{r===0&&(console.log("idle \u4E0D\u6267\u884C \u56DE\u9000\u5230\u540C\u6B65"),s(this.getTextsSync(t,e,n)))},1e3)})})}static getTextsSync(t,e,n){let r=this.getCanvas(),o=this.getCtx();o.clearRect(0,0,r.width,r.height),this.setCtxStyle(e);let s=[],a=0,u=0,l={};t.forEach(p=>{let d=Math.ceil(o.measureText(p).width);if(d=d%2===0?d:d+1,d+=2,d+a>e.width&&(a=0,u+=n,n+u>e.height)){let _=o.getImageData(0,0,e.width,u);s.push({data:_.data,offsetMap:l,height:u}),u=0,o.clearRect(0,0,e.width,e.height),l={}}let m=Kn(p)?4:8;e.lineWidth&&o.strokeText(p,2+a,m+u),o.fillText(p,2+a,m+u),l[p]={width:d,height:n,x:a,y:u},a+=d});let c=o.getImageData(0,0,e.width,n+u);return s.push({data:c.data,offsetMap:l,height:u+n}),s.reduce((p,d)=>{let m=new Ci(d.data,e.width,d.height,Ri);return m.flipY=!0,m.minFilter=we,m.magFilter=we,Object.keys(d.offsetMap).forEach(_=>{p[_]=S({},d.offsetMap[_],{texture:m})}),p},{})}static getTextureByTexts(t,e){let n=this.getMergedOptions(e),r=n.height;n.height=Math.min(r*t.length,1e4);let o=this.getCanvas(),s=this.getCtx();s.clearRect(0,0,o.width,o.height),this.setCtxStyle(n);let a=0,u=0,l={};t.forEach(p=>{let d=Math.ceil(s.measureText(p).width);d=d%2===0?d:d+1,d+=2,d+a>n.width&&(a=0,u+=r);let m=Kn(p)?4:8;n.lineWidth&&s.strokeText(p,2+a,m+u),s.fillText(p,2+a,m+u),l[p]={width:d,height:r,x:a,y:u},a+=d});let c=s.getImageData(0,0,n.width,r+u),h=new Ci(Uint8Array.from(c.data),n.width,r+u,Ri);return h.flipY=!0,h.minFilter=we,h.magFilter=we,{texture:h,offsetMap:l}}static dispose(){var t;this.ctx=null,this.canvas=null,this.idleCtx=null,this.idleCanvas=null,this.timer.dispose(),this.cacheMap.forEach(e=>e.texture.dispose()),this.cacheMap.clear(),(t=this.textTextureWorker)==null||t.terminate(),this.textTextureWorker=null}};tt.canvas=document.createElement("canvas");tt.ctx=tt.canvas.getContext("2d",{willReadFrequently:!0});tt.cacheMap=new Map;tt.textTextureWorker=null;tt.idleCanvas=null;tt.idleCtx=null;tt.timer=new j;tt.options={width:2048,height:512,font:"54px sans-serif",textBaseline:"hanging",lineWidth:8,fillStyle:"rgba(0,0,0,1)",strokeStyle:"white"};var fY=f(P(),1);import{LinearFilter as Ts,RGBAFormat as F2,Texture as WO,TextureLoader as qO}from"three";var ut=class{static getTextureByUrl(t){if(this.urlTextureMap.has(t))return Promise.resolve(this.urlTextureMap.get(t));let e=this.textureLoader.loadAsync(t);return e.then(n=>{n.format=F2,n.magFilter=Ts,n.minFilter=Ts,n.colorSpace="srgb",this.urlTextureMap.set(t,n)}),this.urlTextureMap.set(t,e),e}static getUrlTextureBorder(t,e,n){let r=t+"-"+n.width+"-"+n.color;if(this.borderUrlTextureMap.has(r))return Promise.resolve(this.borderUrlTextureMap.get(r));let o=this.textureLoader.loadAsync(t).then(s=>{let a=this.ctx,u=this.canvas,l=e+n.width*2;u.width=l,u.height=l;let c=l/2;a.clearRect(0,0,l,l),a.beginPath(),a.arc(c,c,e/2+n.width,0,2*Math.PI),a.fillStyle=n.color,a.fill(),a.beginPath(),a.arc(c,c,e/2,0,2*Math.PI),a.closePath(),a.clip(),a.drawImage(s.image,n.width,n.width,e,e);let h=new WO(u);return h.format=F2,h.magFilter=Ts,h.minFilter=Ts,h.colorSpace="srgb",h.needsUpdate=!0,this.borderUrlTextureMap.set(r,h),h});return this.borderUrlTextureMap.set(r,o),o}static dispose(){this.urlTextureMap.forEach(t=>{t instanceof Promise?t.then(e=>e.dispose()):t.dispose()}),this.borderUrlTextureMap.forEach(t=>{t instanceof Promise?t.then(e=>e.dispose()):t.dispose()}),this.urlTextureMap.clear(),this.borderUrlTextureMap.clear(),this.ctx=null,this.canvas=null}};ut.textureLoader=new qO;ut.urlTextureMap=new Map;ut.borderUrlTextureMap=new Map;ut.canvas=document.createElement("canvas");ut.ctx=ut.canvas.getContext("2d",{willReadFrequently:!0});var B8=f(P(),1);import{GLTFLoader as LF}from"three/examples/jsm/loaders/GLTFLoader";var n8=f(P(),1),r8=f(Mn(),1),i8=f(l0(),1),o8=f(Bl(),1),s8=f(hi(),1),a8=f(pi(),1),u8=f(di(),1),l8=f(gi(),1),c8=f(mi(),1),h8=f(vi(),1),p8=f(yi(),1),f8=f(xi(),1),d8=f(Ei(),1),g8=f(Si(),1),m8=f(bi(),1),_8=f(Mi(),1),v8=f(Ti(),1),y8=f(Ai(),1),x8=f(U(),1),E8=f(o6(),1),S8=f(s6(),1),b8=f(xc(),1),M8=f(Sc(),1),w8=f(Mc(),1),T8=f(Tc(),1),A8=f(qn(),1),C8=f(f6(),1),R8=f(d6(),1),P8=f(g6(),1),I8=f(m6(),1),L8=f(Es(),1),N8=f(Ac(),1);var TF=()=>(v6(),l1(_6)),{ParkingTypeIconMap:Cc,ManGlb:y6,Arrow:Hs,DracoDecoderJs:x6,DracoDecoderWasm:E6,DracoWasmWrapperJs:S6,RoyalEsplanade1k:b6}=TF();import{BufferAttribute as M6,BufferGeometry as AF,Color as CF,FileLoader as w6,Loader as RF,LinearSRGBColorSpace as PF,SRGBColorSpace as T6}from"three";var Rc=new WeakMap,Ws=class extends RF{setDecoderPath(t){return this.decoderPath=t,this}setDecoderConfig(t){return this.decoderConfig=t,this}setWorkerLimit(t){return this.workerLimit=t,this}load(t,e,n,r){let o=new w6(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,s=>{this.parse(s,e,r)},n,r)}parse(t,e,n){n===void 0&&(n=()=>{}),this.decodeDracoFile(t,e,null,null,T6).catch(n)}decodeDracoFile(t,e,n,r,o,s){o===void 0&&(o=PF),s===void 0&&(s=()=>{});let a={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!n,vertexColorSpace:o};return this.decodeGeometry(t,a).then(e).catch(s)}decodeGeometry(t,e){let n=JSON.stringify(e);if(Rc.has(t)){let u=Rc.get(t);if(u.key===n)return u.promise;if(t.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let r,o=this.workerNextTaskID++,s=t.byteLength,a=this._getWorker(o,s).then(u=>(r=u,new Promise((l,c)=>{r._callbacks[o]={resolve:l,reject:c},r.postMessage({type:"decode",id:o,taskConfig:e,buffer:t},[t])}))).then(u=>this._createGeometry(u.geometry));return a.catch(()=>!0).then(()=>{r&&o&&this._releaseTask(r,o)}),Rc.set(t,{key:n,promise:a}),a}_createGeometry(t){let e=new AF;t.index&&e.setIndex(new M6(t.index.array,1));for(let n=0;n<t.attributes.length;n++){let r=t.attributes[n],o=r.name,s=r.array,a=r.itemSize,u=new M6(s,a);o==="color"&&(this._assignVertexColorSpace(u,r.vertexColorSpace),u.normalized=!(s instanceof Float32Array)),e.setAttribute(o,u)}return e}_assignVertexColorSpace(t,e){if(e!==T6)return;let n=new CF;for(let r=0,o=t.count;r<o;r++)n.fromBufferAttribute(t,r).convertSRGBToLinear(),t.setXYZ(r,n.r,n.g,n.b)}_loadLibrary(t,e){let n=new w6(this.manager);return n.setPath(this.decoderPath),n.setResponseType(e),n.setWithCredentials(this.withCredentials),new Promise((r,o)=>{n.load(t,r,void 0,o)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;let t=typeof WebAssembly!="object"||this.decoderConfig.type==="js",e=[];return t?e.push(this._loadLibrary(x6,"text")):(e.push(this._loadLibrary(S6,"text")),e.push(this._loadLibrary(E6,"arraybuffer"))),this.decoderPending=Promise.all(e).then(n=>{let r=n[0];t||(this.decoderConfig.wasmBinary=n[1]);let o=IF.toString(),s=["/* draco decoder */",r,"","/* worker */",o.substring(o.indexOf("{")+1,o.lastIndexOf("}"))].join(`
44
+ `],{type:"text/javascript"}),t=URL.createObjectURL(i),e=new Worker(t);return URL.revokeObjectURL(t),e}var tt=class{static getCanvas(){if(this.canvas)return this.canvas;{let t=document.createElement("canvas");return this.canvas=t,t}}static getCtx(){if(this.ctx)return this.ctx;let e=this.getCanvas().getContext("2d",{willReadFrequently:!0});return this.ctx=e,e}static getIdleCanvas(){if(this.idleCanvas)return this.idleCanvas;{let t=document.createElement("canvas");return this.idleCanvas=t,t}}static getIdleCtx(){if(this.idleCtx)return this.idleCtx;let e=this.getIdleCanvas().getContext("2d",{willReadFrequently:!0});return this.idleCtx=e,e}static getMergedOptions(t){return S({},this.options,t)}static setCtxStyle(t,e,n){e===void 0&&(e=this.getCanvas()),n===void 0&&(n=this.getCtx()),e.width=t.width,e.height=t.height,n.font=t.font,n.textBaseline=t.textBaseline,n.lineWidth=t.lineWidth,n.fillStyle=t.fillStyle,n.strokeStyle=t.strokeStyle}static getTextureByText(t,e){let n=this.getMergedOptions(e),r=(e==null?void 0:e.maxWidth)||600,o=tr(S({},n,{text:t,maxWidth:r}));if(this.cacheMap.has(o))return this.cacheMap.get(o);let s=this.getCanvas(),a=this.getCtx();a.clearRect(0,0,s.width,s.height),this.setCtxStyle(n);let u=[],l="",c=[],h="",p=0;for(let b=0;b<t.length;b++){let C=t[b];if(C==="("||C==="\uFF08"){if(p===0&&h){let w=d(h);c.push(...w),h=""}p++}else if((C===")"||C==="\uFF09")&&(p--,p===0)){h+=C,c.push(h),h="";continue}h+=C}if(h){let b=d(h);c.push(...b)}function d(b){let C=[],w="",I=!1,A="";for(let R=0;R<b.length;R++){let B=b[R];(B==='"'||B==="'")&&(!I||B===A)?(I?(w+=B,C.push(w),w=""):(w&&C.push(w),w=B),I=!I,A=B):w+=B}return w&&C.push(w),C}for(let b of c)if(b.startsWith("(")||b.startsWith("\uFF08")||b.startsWith('"')||b.startsWith("'"))if(a.measureText(b).width>r){l&&(u.push(l),l="");let w="",I=b.split("");for(let A of I){let R=w+A;a.measureText(R).width>r&&w?(u.push(w),w=A):w=R}w&&(l=w)}else{let w=l?l+" "+b:b;a.measureText(w).width>r&&l?(u.push(l),l=b):l=w}else{let C=b.split(" ");for(let w of C){let I=l?l+" "+w:w,A=a.measureText(I);if(A.width>r)if(l&&u.push(l),A.width>r||Kn(w)){let R="",B=w.split("");for(let H of B){let k=R+H;a.measureText(k).width>r&&R?(u.push(R),R=H):R=k}R&&(l=R)}else l=w;else l=I}}l&&u.push(l);let m=64,_=m*u.length,v=Math.max(...u.map(b=>{let C=Math.ceil(a.measureText(b).width);return C%2===0?C:C+1}))+2;u.forEach((b,C)=>{let w=Math.ceil(a.measureText(b).width),I=Math.floor((v-w)/2),A=(Kn(b)?4:8)+C*m;n.lineWidth&&a.strokeText(b,I,A),a.fillText(b,I,A)});let x=a.getImageData(0,0,v,_),M=new Ci(x.data,v,_,Ri);return M.flipY=!0,M.minFilter=we,M.magFilter=we,this.cacheMap.set(o,{texture:M,lines:u.length}),{texture:M,lines:u.length}}static lazyGetTextureByTexts(t,e){return E(this,null,function*(){let n=this.getMergedOptions(e),r=n.height;return n.height=Math.min(r*t.length,2048),console.log("use sync text textures"),this.getTextsSync(t,n,r)})}static getTextsByWorker(t,e,n){return E(this,null,function*(){return this.textTextureWorker||(this.textTextureWorker=Fl()),(yield rt(this.textTextureWorker,"get_texture_by_texts",{texts:t,options:e,originHeight:n})).data.map(o=>{let s=new Ci(o.data,e.width,o.height,Ri);return s.flipY=!0,s.minFilter=we,s.magFilter=we,{texture:s,offsetMap:o.offsetMap}}).reduce((o,s)=>(Object.keys(s.offsetMap).forEach(a=>{o[a]=s.offsetMap[a],o[a].texture=s.texture}),o),{})})}static getTextsByBrowserIdle(t,e,n){return E(this,null,function*(){let r=0,o=t.length;return new Promise(s=>{let a=this.getIdleCanvas(),u=this.getIdleCtx();u.clearRect(0,0,a.width,a.height),this.setCtxStyle(e,a,u);let l=[],c=0,h=0,p={},d=()=>E(this,null,function*(){let _=u.getImageData(0,0,e.width,n+h);l.push({imageData:_,offsetMap:p,height:n+h});let v=l.reduce((x,M)=>{let b=new Ci(M.imageData.data,e.width,M.height,Ri);return b.flipY=!0,b.minFilter=we,b.magFilter=we,Object.keys(M.offsetMap).forEach(C=>{x[C]=S({},M.offsetMap[C],{texture:b})}),x},{});s(v)}),m=_=>{if(r>=o)return d();if(_.timeRemaining()>0){let v=t[r],x=Math.ceil(u.measureText(v).width);if(x=x%2===0?x:x+1,x+=2,x+c>e.width&&(c=0,h+=n,n+h>e.height)){let b=u.getImageData(0,0,e.width,h);l.push({imageData:b,offsetMap:p,height:h}),h=0,u.clearRect(0,0,e.width,e.height),p={}}let M=Kn(v)?4:8;if(e.lineWidth&&u.strokeText(v,2+c,M+h),u.fillText(v,2+c,M+h),p[v]={width:x,height:n,x:c,y:h},c+=x,++r>=o)return d();_.timeRemaining()>0?m(_):this.timer.requestIdleCallback(m)}else this.timer.requestIdleCallback(m)};this.timer.requestIdleCallback(m),this.timer.setTimeout(()=>{r===0&&(console.log("idle \u4E0D\u6267\u884C \u56DE\u9000\u5230\u540C\u6B65"),s(this.getTextsSync(t,e,n)))},1e3)})})}static getTextsSync(t,e,n){let r=this.getCanvas(),o=this.getCtx();o.clearRect(0,0,r.width,r.height),this.setCtxStyle(e);let s=[],a=0,u=0,l={};t.forEach(p=>{let d=Math.ceil(o.measureText(p).width);if(d=d%2===0?d:d+1,d+=2,d+a>e.width&&(a=0,u+=n,n+u>e.height)){let _=o.getImageData(0,0,e.width,u);s.push({data:_.data,offsetMap:l,height:u}),u=0,o.clearRect(0,0,e.width,e.height),l={}}let m=Kn(p)?4:8;e.lineWidth&&o.strokeText(p,2+a,m+u),o.fillText(p,2+a,m+u),l[p]={width:d,height:n,x:a,y:u},a+=d});let c=o.getImageData(0,0,e.width,n+u);return s.push({data:c.data,offsetMap:l,height:u+n}),s.reduce((p,d)=>{let m=new Ci(d.data,e.width,d.height,Ri);return m.flipY=!0,m.minFilter=we,m.magFilter=we,Object.keys(d.offsetMap).forEach(_=>{p[_]=S({},d.offsetMap[_],{texture:m})}),p},{})}static getTextureByTexts(t,e){let n=this.getMergedOptions(e),r=n.height;n.height=Math.min(r*t.length,1e4);let o=this.getCanvas(),s=this.getCtx();s.clearRect(0,0,o.width,o.height),this.setCtxStyle(n);let a=0,u=0,l={};t.forEach(p=>{let d=Math.ceil(s.measureText(p).width);d=d%2===0?d:d+1,d+=2,d+a>n.width&&(a=0,u+=r);let m=Kn(p)?4:8;n.lineWidth&&s.strokeText(p,2+a,m+u),s.fillText(p,2+a,m+u),l[p]={width:d,height:r,x:a,y:u},a+=d});let c=s.getImageData(0,0,n.width,r+u),h=new Ci(Uint8Array.from(c.data),n.width,r+u,Ri);return h.flipY=!0,h.minFilter=we,h.magFilter=we,{texture:h,offsetMap:l}}static dispose(){var t;this.ctx=null,this.canvas=null,this.idleCtx=null,this.idleCanvas=null,this.timer.dispose(),this.cacheMap.forEach(e=>e.texture.dispose()),this.cacheMap.clear(),(t=this.textTextureWorker)==null||t.terminate(),this.textTextureWorker=null}};tt.canvas=document.createElement("canvas");tt.ctx=tt.canvas.getContext("2d",{willReadFrequently:!0});tt.cacheMap=new Map;tt.textTextureWorker=null;tt.idleCanvas=null;tt.idleCtx=null;tt.timer=new j;tt.options={width:2048,height:512,font:"54px sans-serif",textBaseline:"hanging",lineWidth:8,fillStyle:"rgba(0,0,0,1)",strokeStyle:"white"};var fY=f(P(),1);import{LinearFilter as Ts,RGBAFormat as F2,Texture as WO,TextureLoader as qO}from"three";var ut=class{static getTextureByUrl(t){if(this.urlTextureMap.has(t))return Promise.resolve(this.urlTextureMap.get(t));let e=this.textureLoader.loadAsync(t);return e.then(n=>{n.format=F2,n.magFilter=Ts,n.minFilter=Ts,n.colorSpace="srgb",this.urlTextureMap.set(t,n)}),this.urlTextureMap.set(t,e),e}static getUrlTextureBorder(t,e,n){let r=t+"-"+n.width+"-"+n.color;if(this.borderUrlTextureMap.has(r))return Promise.resolve(this.borderUrlTextureMap.get(r));let o=this.textureLoader.loadAsync(t).then(s=>{let a=this.ctx,u=this.canvas,l=e+n.width*2;u.width=l,u.height=l;let c=l/2;a.clearRect(0,0,l,l),a.beginPath(),a.arc(c,c,e/2+n.width,0,2*Math.PI),a.fillStyle=n.color,a.fill(),a.beginPath(),a.arc(c,c,e/2,0,2*Math.PI),a.closePath(),a.clip(),a.drawImage(s.image,n.width,n.width,e,e);let h=new WO(u);return h.format=F2,h.magFilter=Ts,h.minFilter=Ts,h.colorSpace="srgb",h.needsUpdate=!0,this.borderUrlTextureMap.set(r,h),h});return this.borderUrlTextureMap.set(r,o),o}static dispose(){this.urlTextureMap.forEach(t=>{t instanceof Promise?t.then(e=>e.dispose()):t.dispose()}),this.borderUrlTextureMap.forEach(t=>{t instanceof Promise?t.then(e=>e.dispose()):t.dispose()}),this.urlTextureMap.clear(),this.borderUrlTextureMap.clear(),this.ctx=null,this.canvas=null}};ut.textureLoader=new qO;ut.urlTextureMap=new Map;ut.borderUrlTextureMap=new Map;ut.canvas=document.createElement("canvas");ut.ctx=ut.canvas.getContext("2d",{willReadFrequently:!0});var B8=f(P(),1);import{GLTFLoader as LF}from"three/examples/jsm/loaders/GLTFLoader";var n8=f(P(),1),r8=f(Mn(),1),i8=f(l0(),1),o8=f(Bl(),1),s8=f(hi(),1),a8=f(pi(),1),u8=f(di(),1),l8=f(gi(),1),c8=f(mi(),1),h8=f(vi(),1),p8=f(yi(),1),f8=f(xi(),1),d8=f(Ei(),1),g8=f(Si(),1),m8=f(bi(),1),_8=f(Mi(),1),v8=f(Ti(),1),y8=f(Ai(),1),x8=f(U(),1),E8=f(o6(),1),S8=f(s6(),1),b8=f(xc(),1),M8=f(Sc(),1),w8=f(Mc(),1),T8=f(Tc(),1),A8=f(qn(),1),C8=f(f6(),1),R8=f(d6(),1),P8=f(g6(),1),I8=f(m6(),1),L8=f(Es(),1),N8=f(Ac(),1);var TF=()=>(v6(),l1(_6)),{ParkingTypeIconMap:Cc,ManGlb:y6,Arrow:Hs,DracoDecoderJs:x6,DracoDecoderWasm:E6,DracoWasmWrapperJs:S6,RoyalEsplanade1k:b6}=TF();import{BufferAttribute as M6,BufferGeometry as AF,Color as CF,FileLoader as w6,Loader as RF,LinearSRGBColorSpace as PF,SRGBColorSpace as T6}from"three";var Rc=new WeakMap,Ws=class extends RF{setDecoderPath(t){return this.decoderPath=t,this}setDecoderConfig(t){return this.decoderConfig=t,this}setWorkerLimit(t){return this.workerLimit=t,this}load(t,e,n,r){let o=new w6(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,s=>{this.parse(s,e,r)},n,r)}parse(t,e,n){n===void 0&&(n=()=>{}),this.decodeDracoFile(t,e,null,null,T6).catch(n)}decodeDracoFile(t,e,n,r,o,s){o===void 0&&(o=PF),s===void 0&&(s=()=>{});let a={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:r||this.defaultAttributeTypes,useUniqueIDs:!!n,vertexColorSpace:o};return this.decodeGeometry(t,a).then(e).catch(s)}decodeGeometry(t,e){let n=JSON.stringify(e);if(Rc.has(t)){let u=Rc.get(t);if(u.key===n)return u.promise;if(t.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let r,o=this.workerNextTaskID++,s=t.byteLength,a=this._getWorker(o,s).then(u=>(r=u,new Promise((l,c)=>{r._callbacks[o]={resolve:l,reject:c},r.postMessage({type:"decode",id:o,taskConfig:e,buffer:t},[t])}))).then(u=>this._createGeometry(u.geometry));return a.catch(()=>!0).then(()=>{r&&o&&this._releaseTask(r,o)}),Rc.set(t,{key:n,promise:a}),a}_createGeometry(t){let e=new AF;t.index&&e.setIndex(new M6(t.index.array,1));for(let n=0;n<t.attributes.length;n++){let r=t.attributes[n],o=r.name,s=r.array,a=r.itemSize,u=new M6(s,a);o==="color"&&(this._assignVertexColorSpace(u,r.vertexColorSpace),u.normalized=!(s instanceof Float32Array)),e.setAttribute(o,u)}return e}_assignVertexColorSpace(t,e){if(e!==T6)return;let n=new CF;for(let r=0,o=t.count;r<o;r++)n.fromBufferAttribute(t,r).convertSRGBToLinear(),t.setXYZ(r,n.r,n.g,n.b)}_loadLibrary(t,e){let n=new w6(this.manager);return n.setPath(this.decoderPath),n.setResponseType(e),n.setWithCredentials(this.withCredentials),new Promise((r,o)=>{n.load(t,r,void 0,o)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;let t=typeof WebAssembly!="object"||this.decoderConfig.type==="js",e=[];return t?e.push(this._loadLibrary(x6,"text")):(e.push(this._loadLibrary(S6,"text")),e.push(this._loadLibrary(E6,"arraybuffer"))),this.decoderPending=Promise.all(e).then(n=>{let r=n[0];t||(this.decoderConfig.wasmBinary=n[1]);let o=IF.toString(),s=["/* draco decoder */",r,"","/* worker */",o.substring(o.indexOf("{")+1,o.lastIndexOf("}"))].join(`
45
45
  `);this.workerSourceURL=URL.createObjectURL(new Blob([s]))}),this.decoderPending}_getWorker(t,e){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){let r=new Worker(this.workerSourceURL);r._callbacks={},r._taskCosts={},r._taskLoad=0,r.postMessage({type:"init",decoderConfig:this.decoderConfig}),r.onmessage=function(o){let s=o.data;switch(s.type){case"decode":r._callbacks[s.id].resolve(s);break;case"error":r._callbacks[s.id].reject(s);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+s.type+'"')}},this.workerPool.push(r)}else this.workerPool.sort(function(r,o){return r._taskLoad>o._taskLoad?-1:1});let n=this.workerPool[this.workerPool.length-1];return n._taskCosts[t]=e,n._taskLoad+=e,n})}_releaseTask(t,e){t._taskLoad-=t._taskCosts[e],delete t._callbacks[e],delete t._taskCosts[e]}debug(){console.log("Task load: ",this.workerPool.map(t=>t._taskLoad))}dispose(){for(let t=0;t<this.workerPool.length;++t)this.workerPool[t].terminate();return this.workerPool.length=0,this.workerSourceURL!==""&&URL.revokeObjectURL(this.workerSourceURL),this}constructor(t){super(t),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"}}};function IF(){let i,t;onmessage=function(s){let a=s.data;switch(a.type){case"init":i=a.decoderConfig,t=new Promise(function(c){i.onModuleLoaded=function(h){c({draco:h})},DracoDecoderModule(i)});break;case"decode":let u=a.buffer,l=a.taskConfig;t.then(c=>{let h=c.draco,p=new h.Decoder;try{let d=e(h,p,new Int8Array(u),l),m=d.attributes.map(_=>_.array.buffer);d.index&&m.push(d.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:d},m)}catch(d){console.error(d),self.postMessage({type:"error",id:a.id,error:d.message})}finally{h.destroy(p)}});break}};function e(s,a,u,l){let c=l.attributeIDs,h=l.attributeTypes,p,d,m=a.GetEncodedGeometryType(u);if(m===s.TRIANGULAR_MESH)p=new s.Mesh,d=a.DecodeArrayToMesh(u,u.byteLength,p);else if(m===s.POINT_CLOUD)p=new s.PointCloud,d=a.DecodeArrayToPointCloud(u,u.byteLength,p);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!d.ok()||p.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+d.error_msg());let _={index:null,attributes:[]};for(let v in c){let x=self[h[v]],M,b;if(l.useUniqueIDs)b=c[v],M=a.GetAttributeByUniqueId(p,b);else{if(b=a.GetAttributeId(p,s[c[v]]),b===-1)continue;M=a.GetAttribute(p,b)}let C=r(s,a,p,v,x,M);v==="color"&&(C.vertexColorSpace=l.vertexColorSpace),_.attributes.push(C)}return m===s.TRIANGULAR_MESH&&(_.index=n(s,a,p)),s.destroy(p),_}function n(s,a,u){let c=u.num_faces()*3,h=c*4,p=s._malloc(h);a.GetTrianglesUInt32Array(u,h,p);let d=new Uint32Array(s.HEAPF32.buffer,p,c).slice();return s._free(p),{array:d,itemSize:1}}function r(s,a,u,l,c,h){let p=h.num_components(),m=u.num_points()*p,_=m*c.BYTES_PER_ELEMENT,v=o(s,c),x=s._malloc(_);a.GetAttributeDataArrayForAllPoints(u,h,v,_,x);let M=new c(s.HEAPF32.buffer,x,m).slice();return s._free(x),{name:l,array:M,itemSize:p}}function o(s,a){switch(a){case Float32Array:return s.DT_FLOAT32;case Int8Array:return s.DT_INT8;case Int16Array:return s.DT_INT16;case Int32Array:return s.DT_INT32;case Uint8Array:return s.DT_UINT8;case Uint16Array:return s.DT_UINT16;case Uint32Array:return s.DT_UINT32}}}var bt=class{static loadModel(t,e){return E(this,null,function*(){if(e===void 0&&(e=!0),e){if(this.modelMap.has(t)){let r=this.modelMap.get(t);if(r instanceof Promise)r.then(o=>S({},o,{scene:o.scene.clone()}));else return S({},r,{scene:r.scene.clone()})}let n=new Promise((r,o)=>{this.loader.load(t,s=>{this.modelMap.set(t,s),r(s)},void 0,o)});return this.modelMap.set(t,n),n.then(r=>S({},r,{scene:r.scene.clone()}))}else return new Promise((n,r)=>{this.loader.load(t,n,void 0,r)})})}static dispose(){this.modelMap.forEach(t=>{t instanceof Promise?t.then(e=>J(e.scene)):J(t.scene)}),this.modelMap.clear()}};bt.dracoLoader=new Ws;bt.loader=new LF().setDRACOLoader(bt.dracoLoader);bt.modelMap=new Map;function Pc(){let i=new Blob([`var Fm=Object.create;var pl=Object.defineProperty;var Bm=Object.getOwnPropertyDescriptor;var zm=Object.getOwnPropertyNames;var km=Object.getPrototypeOf,Gm=Object.prototype.hasOwnProperty;var $=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var Vm=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of zm(e))!Gm.call(n,r)&&r!==t&&pl(n,r,{get:()=>e[r],enumerable:!(i=Bm(e,r))||i.enumerable});return n};var xr=(n,e,t)=>(t=n!=null?Fm(km(n)):{},Vm(e||!n||!n.__esModule?pl(t,"default",{value:n,enumerable:!0}):t,n));var yr=(n,e,t)=>new Promise((i,r)=>{var s=c=>{try{a(t.next(c))}catch(l){r(l)}},o=c=>{try{a(t.throw(c))}catch(l){r(l)}},a=c=>c.done?i(c.value):Promise.resolve(c.value).then(s,o);a((t=t.apply(n,e)).next())});var vt=$((qo,fh)=>{"use strict";var sr=function(n){return n&&n.Math===Math&&n};fh.exports=sr(typeof globalThis=="object"&&globalThis)||sr(typeof window=="object"&&window)||sr(typeof self=="object"&&self)||sr(typeof global=="object"&&global)||sr(typeof qo=="object"&&qo)||function(){return this}()||Function("return this")()});var ph=$((FA,dh)=>{"use strict";dh.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}});var ft=$((BA,mh)=>{"use strict";var Xo=typeof document=="object"&&document.all;mh.exports=typeof Xo=="undefined"&&Xo!==void 0?function(n){return typeof n=="function"||n===Xo}:function(n){return typeof n=="function"}});var pn=$((zA,gh)=>{"use strict";var TM=ft();gh.exports=function(n){return typeof n=="object"?n!==null:TM(n)}});var bs=$((kA,vh)=>{"use strict";var wM=vt(),_h=pn(),Yo=wM.document,AM=_h(Yo)&&_h(Yo.createElement);vh.exports=function(n){return AM?Yo.createElement(n):{}}});var Mh=$((GA,yh)=>{"use strict";var RM=bs(),$o=RM("span").classList,xh=$o&&$o.constructor&&$o.constructor.prototype;yh.exports=xh===Object.prototype?void 0:xh});var dt=$((VA,Sh)=>{"use strict";Sh.exports=function(n){try{return!!n()}catch(e){return!0}}});var Es=$((HA,bh)=>{"use strict";var CM=dt();bh.exports=!CM(function(){var n=function(){}.bind();return typeof n!="function"||n.hasOwnProperty("prototype")})});var bt=$((WA,wh)=>{"use strict";var Eh=Es(),Th=Function.prototype,Zo=Th.call,PM=Eh&&Th.bind.bind(Zo,Zo);wh.exports=Eh?PM:function(n){return function(){return Zo.apply(n,arguments)}}});var ar=$((qA,Rh)=>{"use strict";var Ah=bt(),IM=Ah({}.toString),LM=Ah("".slice);Rh.exports=function(n){return LM(IM(n),8,-1)}});var Ph=$((XA,Ch)=>{"use strict";var UM=bt(),DM=dt(),NM=ar(),Jo=Object,OM=UM("".split);Ch.exports=DM(function(){return!Jo("z").propertyIsEnumerable(0)})?function(n){return NM(n)==="String"?OM(n,""):Jo(n)}:Jo});var Ts=$((YA,Ih)=>{"use strict";Ih.exports=function(n){return n==null}});var Ni=$(($A,Lh)=>{"use strict";var FM=Ts(),BM=TypeError;Lh.exports=function(n){if(FM(n))throw new BM("Can't call method on "+n);return n}});var Oi=$((ZA,Uh)=>{"use strict";var zM=Ph(),kM=Ni();Uh.exports=function(n){return zM(kM(n))}});var or=$((JA,Dh)=>{"use strict";Dh.exports=!1});var ws=$((KA,Oh)=>{"use strict";var Nh=vt(),GM=Object.defineProperty;Oh.exports=function(n,e){try{GM(Nh,n,{value:e,configurable:!0,writable:!0})}catch(t){Nh[n]=e}return e}});var As=$((jA,zh)=>{"use strict";var VM=or(),HM=vt(),WM=ws(),Fh="__core-js_shared__",Bh=zh.exports=HM[Fh]||WM(Fh,{});(Bh.versions||(Bh.versions=[])).push({version:"3.41.0",mode:VM?"pure":"global",copyright:"\\xA9 2014-2025 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.41.0/LICENSE",source:"https://github.com/zloirock/core-js"})});var Rs=$((QA,Gh)=>{"use strict";var kh=As();Gh.exports=function(n,e){return kh[n]||(kh[n]=e||{})}});var cr=$((e1,Vh)=>{"use strict";var qM=Ni(),XM=Object;Vh.exports=function(n){return XM(qM(n))}});var en=$((t1,Hh)=>{"use strict";var YM=bt(),$M=cr(),ZM=YM({}.hasOwnProperty);Hh.exports=Object.hasOwn||function(e,t){return ZM($M(e),t)}});var Ko=$((n1,Wh)=>{"use strict";var JM=bt(),KM=0,jM=Math.random(),QM=JM(1 .toString);Wh.exports=function(n){return"Symbol("+(n===void 0?"":n)+")_"+QM(++KM+jM,36)}});var $h=$((i1,Yh)=>{"use strict";var eS=vt(),qh=eS.navigator,Xh=qh&&qh.userAgent;Yh.exports=Xh?String(Xh):""});var tf=$((r1,ef)=>{"use strict";var Qh=vt(),jo=$h(),Zh=Qh.process,Jh=Qh.Deno,Kh=Zh&&Zh.versions||Jh&&Jh.version,jh=Kh&&Kh.v8,qt,Cs;jh&&(qt=jh.split("."),Cs=qt[0]>0&&qt[0]<4?1:+(qt[0]+qt[1]));!Cs&&jo&&(qt=jo.match(/Edge\\/(\\d+)/),(!qt||qt[1]>=74)&&(qt=jo.match(/Chrome\\/(\\d+)/),qt&&(Cs=+qt[1])));ef.exports=Cs});var Qo=$((s1,rf)=>{"use strict";var nf=tf(),tS=dt(),nS=vt(),iS=nS.String;rf.exports=!!Object.getOwnPropertySymbols&&!tS(function(){var n=Symbol("symbol detection");return!iS(n)||!(Object(n)instanceof Symbol)||!Symbol.sham&&nf&&nf<41})});var ec=$((a1,sf)=>{"use strict";var rS=Qo();sf.exports=rS&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Xt=$((o1,of)=>{"use strict";var sS=vt(),aS=Rs(),af=en(),oS=Ko(),cS=Qo(),lS=ec(),Fi=sS.Symbol,tc=aS("wks"),uS=lS?Fi.for||Fi:Fi&&Fi.withoutSetter||oS;of.exports=function(n){return af(tc,n)||(tc[n]=cS&&af(Fi,n)?Fi[n]:uS("Symbol."+n)),tc[n]}});var Un=$((c1,cf)=>{"use strict";var hS=pn(),fS=String,dS=TypeError;cf.exports=function(n){if(hS(n))return n;throw new dS(fS(n)+" is not an object")}});var Yt=$((l1,lf)=>{"use strict";var pS=dt();lf.exports=!pS(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var nc=$((u1,uf)=>{"use strict";var mS=Yt(),gS=dt();uf.exports=mS&&gS(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var ic=$((h1,hf)=>{"use strict";var _S=Yt(),vS=dt(),xS=bs();hf.exports=!_S&&!vS(function(){return Object.defineProperty(xS("div"),"a",{get:function(){return 7}}).a!==7})});var mn=$((f1,ff)=>{"use strict";var yS=Es(),Ps=Function.prototype.call;ff.exports=yS?Ps.bind(Ps):function(){return Ps.apply(Ps,arguments)}});var Is=$((d1,df)=>{"use strict";var rc=vt(),MS=ft(),SS=function(n){return MS(n)?n:void 0};df.exports=function(n,e){return arguments.length<2?SS(rc[n]):rc[n]&&rc[n][e]}});var mf=$((p1,pf)=>{"use strict";var bS=bt();pf.exports=bS({}.isPrototypeOf)});var sc=$((m1,gf)=>{"use strict";var ES=Is(),TS=ft(),wS=mf(),AS=ec(),RS=Object;gf.exports=AS?function(n){return typeof n=="symbol"}:function(n){var e=ES("Symbol");return TS(e)&&wS(e.prototype,RS(n))}});var vf=$((g1,_f)=>{"use strict";var CS=String;_f.exports=function(n){try{return CS(n)}catch(e){return"Object"}}});var ac=$((_1,xf)=>{"use strict";var PS=ft(),IS=vf(),LS=TypeError;xf.exports=function(n){if(PS(n))return n;throw new LS(IS(n)+" is not a function")}});var oc=$((v1,yf)=>{"use strict";var US=ac(),DS=Ts();yf.exports=function(n,e){var t=n[e];return DS(t)?void 0:US(t)}});var Sf=$((x1,Mf)=>{"use strict";var cc=mn(),lc=ft(),uc=pn(),NS=TypeError;Mf.exports=function(n,e){var t,i;if(e==="string"&&lc(t=n.toString)&&!uc(i=cc(t,n))||lc(t=n.valueOf)&&!uc(i=cc(t,n))||e!=="string"&&lc(t=n.toString)&&!uc(i=cc(t,n)))return i;throw new NS("Can't convert object to primitive value")}});var wf=$((y1,Tf)=>{"use strict";var OS=mn(),bf=pn(),Ef=sc(),FS=oc(),BS=Sf(),zS=Xt(),kS=TypeError,GS=zS("toPrimitive");Tf.exports=function(n,e){if(!bf(n)||Ef(n))return n;var t=FS(n,GS),i;if(t){if(e===void 0&&(e="default"),i=OS(t,n,e),!bf(i)||Ef(i))return i;throw new kS("Can't convert object to primitive value")}return e===void 0&&(e="number"),BS(n,e)}});var hc=$((M1,Af)=>{"use strict";var VS=wf(),HS=sc();Af.exports=function(n){var e=VS(n,"string");return HS(e)?e:e+""}});var Dn=$(Cf=>{"use strict";var WS=Yt(),qS=ic(),XS=nc(),Ls=Un(),Rf=hc(),YS=TypeError,fc=Object.defineProperty,$S=Object.getOwnPropertyDescriptor,dc="enumerable",pc="configurable",mc="writable";Cf.f=WS?XS?function(e,t,i){if(Ls(e),t=Rf(t),Ls(i),typeof e=="function"&&t==="prototype"&&"value"in i&&mc in i&&!i[mc]){var r=$S(e,t);r&&r[mc]&&(e[t]=i.value,i={configurable:pc in i?i[pc]:r[pc],enumerable:dc in i?i[dc]:r[dc],writable:!1})}return fc(e,t,i)}:fc:function(e,t,i){if(Ls(e),t=Rf(t),Ls(i),qS)try{return fc(e,t,i)}catch(r){}if("get"in i||"set"in i)throw new YS("Accessors not supported");return"value"in i&&(e[t]=i.value),e}});var If=$((b1,Pf)=>{"use strict";var ZS=Math.ceil,JS=Math.floor;Pf.exports=Math.trunc||function(e){var t=+e;return(t>0?JS:ZS)(t)}});var lr=$((E1,Lf)=>{"use strict";var KS=If();Lf.exports=function(n){var e=+n;return e!==e||e===0?0:KS(e)}});var Df=$((T1,Uf)=>{"use strict";var jS=lr(),QS=Math.max,eb=Math.min;Uf.exports=function(n,e){var t=jS(n);return t<0?QS(t+e,0):eb(t,e)}});var gc=$((w1,Nf)=>{"use strict";var tb=lr(),nb=Math.min;Nf.exports=function(n){var e=tb(n);return e>0?nb(e,9007199254740991):0}});var _c=$((A1,Of)=>{"use strict";var ib=gc();Of.exports=function(n){return ib(n.length)}});var zf=$((R1,Bf)=>{"use strict";var rb=Oi(),sb=Df(),ab=_c(),Ff=function(n){return function(e,t,i){var r=rb(e),s=ab(r);if(s===0)return!n&&-1;var o=sb(i,s),a;if(n&&t!==t){for(;s>o;)if(a=r[o++],a!==a)return!0}else for(;s>o;o++)if((n||o in r)&&r[o]===t)return n||o||0;return!n&&-1}};Bf.exports={includes:Ff(!0),indexOf:Ff(!1)}});var Us=$((C1,kf)=>{"use strict";kf.exports={}});var xc=$((P1,Vf)=>{"use strict";var ob=bt(),vc=en(),cb=Oi(),lb=zf().indexOf,ub=Us(),Gf=ob([].push);Vf.exports=function(n,e){var t=cb(n),i=0,r=[],s;for(s in t)!vc(ub,s)&&vc(t,s)&&Gf(r,s);for(;e.length>i;)vc(t,s=e[i++])&&(~lb(r,s)||Gf(r,s));return r}});var Ds=$((I1,Hf)=>{"use strict";Hf.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var qf=$((L1,Wf)=>{"use strict";var hb=xc(),fb=Ds();Wf.exports=Object.keys||function(e){return hb(e,fb)}});var Yf=$(Xf=>{"use strict";var db=Yt(),pb=nc(),mb=Dn(),gb=Un(),_b=Oi(),vb=qf();Xf.f=db&&!pb?Object.defineProperties:function(e,t){gb(e);for(var i=_b(t),r=vb(t),s=r.length,o=0,a;s>o;)mb.f(e,a=r[o++],i[a]);return e}});var Zf=$((D1,$f)=>{"use strict";var xb=Is();$f.exports=xb("document","documentElement")});var Ns=$((N1,Kf)=>{"use strict";var yb=Rs(),Mb=Ko(),Jf=yb("keys");Kf.exports=function(n){return Jf[n]||(Jf[n]=Mb(n))}});var ur=$((O1,rd)=>{"use strict";var Sb=Un(),bb=Yf(),jf=Ds(),Eb=Us(),Tb=Zf(),wb=bs(),Ab=Ns(),Qf=">",ed="<",Mc="prototype",Sc="script",nd=Ab("IE_PROTO"),yc=function(){},id=function(n){return ed+Sc+Qf+n+ed+"/"+Sc+Qf},td=function(n){n.write(id("")),n.close();var e=n.parentWindow.Object;return n=null,e},Rb=function(){var n=wb("iframe"),e="java"+Sc+":",t;return n.style.display="none",Tb.appendChild(n),n.src=String(e),t=n.contentWindow.document,t.open(),t.write(id("document.F=Object")),t.close(),t.F},Os,Fs=function(){try{Os=new ActiveXObject("htmlfile")}catch(e){}Fs=typeof document!="undefined"?document.domain&&Os?td(Os):Rb():td(Os);for(var n=jf.length;n--;)delete Fs[Mc][jf[n]];return Fs()};Eb[nd]=!0;rd.exports=Object.create||function(e,t){var i;return e!==null?(yc[Mc]=Sb(e),i=new yc,yc[Mc]=null,i[nd]=e):i=Fs(),t===void 0?i:bb.f(i,t)}});var ad=$((F1,sd)=>{"use strict";var Cb=Xt(),Pb=ur(),Ib=Dn().f,bc=Cb("unscopables"),Ec=Array.prototype;Ec[bc]===void 0&&Ib(Ec,bc,{configurable:!0,value:Pb(null)});sd.exports=function(n){Ec[bc][n]=!0}});var Bs=$((B1,od)=>{"use strict";od.exports={}});var ud=$((z1,ld)=>{"use strict";var Lb=vt(),Ub=ft(),cd=Lb.WeakMap;ld.exports=Ub(cd)&&/native code/.test(String(cd))});var zs=$((k1,hd)=>{"use strict";hd.exports=function(n,e){return{enumerable:!(n&1),configurable:!(n&2),writable:!(n&4),value:e}}});var Bi=$((G1,fd)=>{"use strict";var Db=Yt(),Nb=Dn(),Ob=zs();fd.exports=Db?function(n,e,t){return Nb.f(n,e,Ob(1,t))}:function(n,e,t){return n[e]=t,n}});var Vs=$((V1,md)=>{"use strict";var Fb=ud(),pd=vt(),Bb=pn(),zb=Bi(),Tc=en(),wc=As(),kb=Ns(),Gb=Us(),dd="Object already initialized",Ac=pd.TypeError,Vb=pd.WeakMap,ks,hr,Gs,Hb=function(n){return Gs(n)?hr(n):ks(n,{})},Wb=function(n){return function(e){var t;if(!Bb(e)||(t=hr(e)).type!==n)throw new Ac("Incompatible receiver, "+n+" required");return t}};Fb||wc.state?($t=wc.state||(wc.state=new Vb),$t.get=$t.get,$t.has=$t.has,$t.set=$t.set,ks=function(n,e){if($t.has(n))throw new Ac(dd);return e.facade=n,$t.set(n,e),e},hr=function(n){return $t.get(n)||{}},Gs=function(n){return $t.has(n)}):(ti=kb("state"),Gb[ti]=!0,ks=function(n,e){if(Tc(n,ti))throw new Ac(dd);return e.facade=n,zb(n,ti,e),e},hr=function(n){return Tc(n,ti)?n[ti]:{}},Gs=function(n){return Tc(n,ti)});var $t,ti;md.exports={set:ks,get:hr,has:Gs,enforce:Hb,getterFor:Wb}});var xd=$(vd=>{"use strict";var gd={}.propertyIsEnumerable,_d=Object.getOwnPropertyDescriptor,qb=_d&&!gd.call({1:2},1);vd.f=qb?function(e){var t=_d(this,e);return!!t&&t.enumerable}:gd});var Rc=$(Md=>{"use strict";var Xb=Yt(),Yb=mn(),$b=xd(),Zb=zs(),Jb=Oi(),Kb=hc(),jb=en(),Qb=ic(),yd=Object.getOwnPropertyDescriptor;Md.f=Xb?yd:function(e,t){if(e=Jb(e),t=Kb(t),Qb)try{return yd(e,t)}catch(i){}if(jb(e,t))return Zb(!Yb($b.f,e,t),e[t])}});var Ic=$((q1,bd)=>{"use strict";var Cc=Yt(),eE=en(),Sd=Function.prototype,tE=Cc&&Object.getOwnPropertyDescriptor,Pc=eE(Sd,"name"),nE=Pc&&function(){}.name==="something",iE=Pc&&(!Cc||Cc&&tE(Sd,"name").configurable);bd.exports={EXISTS:Pc,PROPER:nE,CONFIGURABLE:iE}});var Td=$((X1,Ed)=>{"use strict";var rE=bt(),sE=ft(),Lc=As(),aE=rE(Function.toString);sE(Lc.inspectSource)||(Lc.inspectSource=function(n){return aE(n)});Ed.exports=Lc.inspectSource});var Cd=$((Y1,Rd)=>{"use strict";var Dc=bt(),oE=dt(),cE=ft(),Hs=en(),Uc=Yt(),lE=Ic().CONFIGURABLE,uE=Td(),Ad=Vs(),hE=Ad.enforce,fE=Ad.get,wd=String,Ws=Object.defineProperty,dE=Dc("".slice),pE=Dc("".replace),mE=Dc([].join),gE=Uc&&!oE(function(){return Ws(function(){},"length",{value:8}).length!==8}),_E=String(String).split("String"),vE=Rd.exports=function(n,e,t){dE(wd(e),0,7)==="Symbol("&&(e="["+pE(wd(e),/^Symbol\\(([^)]*)\\).*$/,"$1")+"]"),t&&t.getter&&(e="get "+e),t&&t.setter&&(e="set "+e),(!Hs(n,"name")||lE&&n.name!==e)&&(Uc?Ws(n,"name",{value:e,configurable:!0}):n.name=e),gE&&t&&Hs(t,"arity")&&n.length!==t.arity&&Ws(n,"length",{value:t.arity});try{t&&Hs(t,"constructor")&&t.constructor?Uc&&Ws(n,"prototype",{writable:!1}):n.prototype&&(n.prototype=void 0)}catch(r){}var i=hE(n);return Hs(i,"source")||(i.source=mE(_E,typeof e=="string"?e:"")),n};Function.prototype.toString=vE(function(){return cE(this)&&fE(this).source||uE(this)},"toString")});var fr=$(($1,Pd)=>{"use strict";var xE=ft(),yE=Dn(),ME=Cd(),SE=ws();Pd.exports=function(n,e,t,i){i||(i={});var r=i.enumerable,s=i.name!==void 0?i.name:e;if(xE(t)&&ME(t,s,i),i.global)r?n[e]=t:SE(e,t);else{try{i.unsafe?n[e]&&(r=!0):delete n[e]}catch(o){}r?n[e]=t:yE.f(n,e,{value:t,enumerable:!1,configurable:!i.nonConfigurable,writable:!i.nonWritable})}return n}});var Ld=$(Id=>{"use strict";var bE=xc(),EE=Ds(),TE=EE.concat("length","prototype");Id.f=Object.getOwnPropertyNames||function(e){return bE(e,TE)}});var Dd=$(Ud=>{"use strict";Ud.f=Object.getOwnPropertySymbols});var Od=$((K1,Nd)=>{"use strict";var wE=Is(),AE=bt(),RE=Ld(),CE=Dd(),PE=Un(),IE=AE([].concat);Nd.exports=wE("Reflect","ownKeys")||function(e){var t=RE.f(PE(e)),i=CE.f;return i?IE(t,i(e)):t}});var zd=$((j1,Bd)=>{"use strict";var Fd=en(),LE=Od(),UE=Rc(),DE=Dn();Bd.exports=function(n,e,t){for(var i=LE(e),r=DE.f,s=UE.f,o=0;o<i.length;o++){var a=i[o];!Fd(n,a)&&!(t&&Fd(t,a))&&r(n,a,s(e,a))}}});var Gd=$((Q1,kd)=>{"use strict";var NE=dt(),OE=ft(),FE=/#|\\.prototype\\./,dr=function(n,e){var t=zE[BE(n)];return t===GE?!0:t===kE?!1:OE(e)?NE(e):!!e},BE=dr.normalize=function(n){return String(n).replace(FE,".").toLowerCase()},zE=dr.data={},kE=dr.NATIVE="N",GE=dr.POLYFILL="P";kd.exports=dr});var Xs=$((eR,Vd)=>{"use strict";var qs=vt(),VE=Rc().f,HE=Bi(),WE=fr(),qE=ws(),XE=zd(),YE=Gd();Vd.exports=function(n,e){var t=n.target,i=n.global,r=n.stat,s,o,a,c,l,u;if(i?o=qs:r?o=qs[t]||qE(t,{}):o=qs[t]&&qs[t].prototype,o)for(a in e){if(l=e[a],n.dontCallGetSet?(u=VE(o,a),c=u&&u.value):c=o[a],s=YE(i?a:t+(r?".":"#")+a,n.forced),!s&&c!==void 0){if(typeof l==typeof c)continue;XE(l,c)}(n.sham||c&&c.sham)&&HE(l,"sham",!0),WE(o,a,l,n)}}});var Wd=$((tR,Hd)=>{"use strict";var $E=dt();Hd.exports=!$E(function(){function n(){}return n.prototype.constructor=null,Object.getPrototypeOf(new n)!==n.prototype})});var Oc=$((nR,Xd)=>{"use strict";var ZE=en(),JE=ft(),KE=cr(),jE=Ns(),QE=Wd(),qd=jE("IE_PROTO"),Nc=Object,eT=Nc.prototype;Xd.exports=QE?Nc.getPrototypeOf:function(n){var e=KE(n);if(ZE(e,qd))return e[qd];var t=e.constructor;return JE(t)&&e instanceof t?t.prototype:e instanceof Nc?eT:null}});var kc=$((iR,Zd)=>{"use strict";var tT=dt(),nT=ft(),iT=pn(),rT=ur(),Yd=Oc(),sT=fr(),aT=Xt(),oT=or(),zc=aT("iterator"),$d=!1,gn,Fc,Bc;[].keys&&(Bc=[].keys(),"next"in Bc?(Fc=Yd(Yd(Bc)),Fc!==Object.prototype&&(gn=Fc)):$d=!0);var cT=!iT(gn)||tT(function(){var n={};return gn[zc].call(n)!==n});cT?gn={}:oT&&(gn=rT(gn));nT(gn[zc])||sT(gn,zc,function(){return this});Zd.exports={IteratorPrototype:gn,BUGGY_SAFARI_ITERATORS:$d}});var Ys=$((rR,Kd)=>{"use strict";var lT=Dn().f,uT=en(),hT=Xt(),Jd=hT("toStringTag");Kd.exports=function(n,e,t){n&&!t&&(n=n.prototype),n&&!uT(n,Jd)&&lT(n,Jd,{configurable:!0,value:e})}});var Qd=$((sR,jd)=>{"use strict";var fT=kc().IteratorPrototype,dT=ur(),pT=zs(),mT=Ys(),gT=Bs(),_T=function(){return this};jd.exports=function(n,e,t,i){var r=e+" Iterator";return n.prototype=dT(fT,{next:pT(+!i,t)}),mT(n,r,!1,!0),gT[r]=_T,n}});var tp=$((aR,ep)=>{"use strict";var vT=bt(),xT=ac();ep.exports=function(n,e,t){try{return vT(xT(Object.getOwnPropertyDescriptor(n,e)[t]))}catch(i){}}});var ip=$((oR,np)=>{"use strict";var yT=pn();np.exports=function(n){return yT(n)||n===null}});var sp=$((cR,rp)=>{"use strict";var MT=ip(),ST=String,bT=TypeError;rp.exports=function(n){if(MT(n))return n;throw new bT("Can't set "+ST(n)+" as a prototype")}});var op=$((lR,ap)=>{"use strict";var ET=tp(),TT=pn(),wT=Ni(),AT=sp();ap.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var n=!1,e={},t;try{t=ET(Object.prototype,"__proto__","set"),t(e,[]),n=e instanceof Array}catch(i){}return function(r,s){return wT(r),AT(s),TT(r)&&(n?t(r,s):r.__proto__=s),r}}():void 0)});var vp=$((uR,_p)=>{"use strict";var RT=Xs(),CT=mn(),$s=or(),mp=Ic(),PT=ft(),IT=Qd(),cp=Oc(),lp=op(),LT=Ys(),UT=Bi(),Gc=fr(),DT=Xt(),up=Bs(),gp=kc(),NT=mp.PROPER,OT=mp.CONFIGURABLE,hp=gp.IteratorPrototype,Zs=gp.BUGGY_SAFARI_ITERATORS,pr=DT("iterator"),fp="keys",mr="values",dp="entries",pp=function(){return this};_p.exports=function(n,e,t,i,r,s,o){IT(t,e,i);var a=function(d){if(d===r&&f)return f;if(!Zs&&d&&d in u)return u[d];switch(d){case fp:return function(){return new t(this,d)};case mr:return function(){return new t(this,d)};case dp:return function(){return new t(this,d)}}return function(){return new t(this)}},c=e+" Iterator",l=!1,u=n.prototype,h=u[pr]||u["@@iterator"]||r&&u[r],f=!Zs&&h||a(r),m=e==="Array"&&u.entries||h,g,x,p;if(m&&(g=cp(m.call(new n)),g!==Object.prototype&&g.next&&(!$s&&cp(g)!==hp&&(lp?lp(g,hp):PT(g[pr])||Gc(g,pr,pp)),LT(g,c,!0,!0),$s&&(up[c]=pp))),NT&&r===mr&&h&&h.name!==mr&&(!$s&&OT?UT(u,"name",mr):(l=!0,f=function(){return CT(h,this)})),r)if(x={values:a(mr),keys:s?f:a(fp),entries:a(dp)},o)for(p in x)(Zs||l||!(p in u))&&Gc(u,p,x[p]);else RT({target:e,proto:!0,forced:Zs||l},x);return(!$s||o)&&u[pr]!==f&&Gc(u,pr,f,{name:r}),up[e]=f,x}});var yp=$((hR,xp)=>{"use strict";xp.exports=function(n,e){return{value:n,done:e}}});var wp=$((fR,Tp)=>{"use strict";var FT=Oi(),Vc=ad(),Mp=Bs(),bp=Vs(),BT=Dn().f,zT=vp(),Js=yp(),kT=or(),GT=Yt(),Ep="Array Iterator",VT=bp.set,HT=bp.getterFor(Ep);Tp.exports=zT(Array,"Array",function(n,e){VT(this,{type:Ep,target:FT(n),index:0,kind:e})},function(){var n=HT(this),e=n.target,t=n.index++;if(!e||t>=e.length)return n.target=null,Js(void 0,!0);switch(n.kind){case"keys":return Js(t,!1);case"values":return Js(e[t],!1)}return Js([t,e[t]],!1)},"values");var Sp=Mp.Arguments=Mp.Array;Vc("keys");Vc("values");Vc("entries");if(!kT&&GT&&Sp.name!=="values")try{BT(Sp,"name",{value:"values"})}catch(n){}});var Ip=$(()=>{"use strict";var Ap=vt(),Cp=ph(),WT=Mh(),gr=wp(),Rp=Bi(),qT=Ys(),XT=Xt(),Hc=XT("iterator"),Wc=gr.values,Pp=function(n,e){if(n){if(n[Hc]!==Wc)try{Rp(n,Hc,Wc)}catch(i){n[Hc]=Wc}if(qT(n,e,!0),Cp[e]){for(var t in gr)if(n[t]!==gr[t])try{Rp(n,t,gr[t])}catch(i){n[t]=gr[t]}}}};for(Ks in Cp)Pp(Ap[Ks]&&Ap[Ks].prototype,Ks);var Ks;Pp(WT,"DOMTokenList")});var Up=$((mR,Lp)=>{"use strict";var YT=ar();Lp.exports=Array.isArray||function(e){return YT(e)==="Array"}});var Np=$((gR,Dp)=>{"use strict";var $T=Yt(),ZT=Up(),JT=TypeError,KT=Object.getOwnPropertyDescriptor,jT=$T&&!function(){if(this!==void 0)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(n){return n instanceof TypeError}}();Dp.exports=jT?function(n,e){if(ZT(n)&&!KT(n,"length").writable)throw new JT("Cannot set read only .length");return n.length=e}:function(n,e){return n.length=e}});var Fp=$((_R,Op)=>{"use strict";var QT=TypeError,ew=9007199254740991;Op.exports=function(n){if(n>ew)throw QT("Maximum allowed index exceeded");return n}});var Bp=$(()=>{"use strict";var tw=Xs(),nw=cr(),iw=_c(),rw=Np(),sw=Fp(),aw=dt(),ow=aw(function(){return[].push.call({length:4294967296},1)!==4294967297}),cw=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(n){return n instanceof TypeError}},lw=ow||!cw();tw({target:"Array",proto:!0,arity:1,forced:lw},{push:function(e){var t=nw(this),i=iw(t),r=arguments.length;sw(i+r);for(var s=0;s<r;s++)t[i]=arguments[s],i++;return rw(t,i),i}})});var Gp=$((wR,kp)=>{"use strict";var uw=Xt(),hw=uw("toStringTag"),zp={};zp[hw]="z";kp.exports=String(zp)==="[object z]"});var Hp=$((AR,Vp)=>{"use strict";var fw=Gp(),dw=ft(),js=ar(),pw=Xt(),mw=pw("toStringTag"),gw=Object,_w=js(function(){return arguments}())==="Arguments",vw=function(n,e){try{return n[e]}catch(t){}};Vp.exports=fw?js:function(n){var e,t,i;return n===void 0?"Undefined":n===null?"Null":typeof(t=vw(e=gw(n),mw))=="string"?t:_w?js(e):(i=js(e))==="Object"&&dw(e.callee)?"Arguments":i}});var Qs=$((RR,Wp)=>{"use strict";var xw=Hp(),yw=String;Wp.exports=function(n){if(xw(n)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return yw(n)}});var Xp=$((CR,qp)=>{"use strict";var Mw=Un();qp.exports=function(){var n=Mw(this),e="";return n.hasIndices&&(e+="d"),n.global&&(e+="g"),n.ignoreCase&&(e+="i"),n.multiline&&(e+="m"),n.dotAll&&(e+="s"),n.unicode&&(e+="u"),n.unicodeSets&&(e+="v"),n.sticky&&(e+="y"),e}});var $p=$((PR,Yp)=>{"use strict";var Xc=dt(),Sw=vt(),Yc=Sw.RegExp,$c=Xc(function(){var n=Yc("a","y");return n.lastIndex=2,n.exec("abcd")!==null}),bw=$c||Xc(function(){return!Yc("a","y").sticky}),Ew=$c||Xc(function(){var n=Yc("^r","gy");return n.lastIndex=2,n.exec("str")!==null});Yp.exports={BROKEN_CARET:Ew,MISSED_STICKY:bw,UNSUPPORTED_Y:$c}});var Jp=$((IR,Zp)=>{"use strict";var Tw=dt(),ww=vt(),Aw=ww.RegExp;Zp.exports=Tw(function(){var n=Aw(".","s");return!(n.dotAll&&n.test(\`
46
46
  \`)&&n.flags==="s")})});var jp=$((LR,Kp)=>{"use strict";var Rw=dt(),Cw=vt(),Pw=Cw.RegExp;Kp.exports=Rw(function(){var n=Pw("(?<a>b)","g");return n.exec("b").groups.a!=="b"||"b".replace(n,"$<a>c")!=="bc"})});var na=$((UR,em)=>{"use strict";var zi=mn(),ta=bt(),Iw=Qs(),Lw=Xp(),Uw=$p(),Dw=Rs(),Nw=ur(),Ow=Vs().get,Fw=Jp(),Bw=jp(),zw=Dw("native-string-replace",String.prototype.replace),ea=RegExp.prototype.exec,Jc=ea,kw=ta("".charAt),Gw=ta("".indexOf),Vw=ta("".replace),Zc=ta("".slice),Kc=function(){var n=/a/,e=/b*/g;return zi(ea,n,"a"),zi(ea,e,"a"),n.lastIndex!==0||e.lastIndex!==0}(),Qp=Uw.BROKEN_CARET,jc=/()??/.exec("")[1]!==void 0,Hw=Kc||jc||Qp||Fw||Bw;Hw&&(Jc=function(e){var t=this,i=Ow(t),r=Iw(e),s=i.raw,o,a,c,l,u,h,f;if(s)return s.lastIndex=t.lastIndex,o=zi(Jc,s,r),t.lastIndex=s.lastIndex,o;var m=i.groups,g=Qp&&t.sticky,x=zi(Lw,t),p=t.source,d=0,b=r;if(g&&(x=Vw(x,"y",""),Gw(x,"g")===-1&&(x+="g"),b=Zc(r,t.lastIndex),t.lastIndex>0&&(!t.multiline||t.multiline&&kw(r,t.lastIndex-1)!==\`
47
47
  \`)&&(p="(?: "+p+")",b=" "+b,d++),a=new RegExp("^(?:"+p+")",x)),jc&&(a=new RegExp("^"+p+"$(?!\\\\s)",x)),Kc&&(c=t.lastIndex),l=zi(ea,g?a:t,b),g?l?(l.input=Zc(l.input,d),l[0]=Zc(l[0],d),l.index=t.lastIndex,t.lastIndex+=l[0].length):t.lastIndex=0:Kc&&l&&(t.lastIndex=t.global?l.index+l[0].length:c),jc&&l&&l.length>1&&zi(zw,l[0],a,function(){for(u=1;u<arguments.length-2;u++)arguments[u]===void 0&&(l[u]=void 0)}),l&&m)for(l.groups=h=Nw(null),u=0;u<m.length;u++)f=m[u],h[f[0]]=l[f[1]];return l});em.exports=Jc});var Qc=$(()=>{"use strict";var Ww=Xs(),tm=na();Ww({target:"RegExp",proto:!0,forced:/./.exec!==tm},{exec:tm})});var am=$((OR,sm)=>{"use strict";var qw=Es(),rm=Function.prototype,nm=rm.apply,im=rm.call;sm.exports=typeof Reflect=="object"&&Reflect.apply||(qw?im.bind(nm):function(){return im.apply(nm,arguments)})});var fm=$((FR,hm)=>{"use strict";Qc();var om=mn(),cm=fr(),Xw=na(),lm=dt(),um=Xt(),Yw=Bi(),$w=um("species"),el=RegExp.prototype;hm.exports=function(n,e,t,i){var r=um(n),s=!lm(function(){var l={};return l[r]=function(){return 7},""[n](l)!==7}),o=s&&!lm(function(){var l=!1,u=/a/;return n==="split"&&(u={},u.constructor={},u.constructor[$w]=function(){return u},u.flags="",u[r]=/./[r]),u.exec=function(){return l=!0,null},u[r](""),!l});if(!s||!o||t){var a=/./[r],c=e(r,""[n],function(l,u,h,f,m){var g=u.exec;return g===Xw||g===el.exec?s&&!m?{done:!0,value:om(a,u,h,f)}:{done:!0,value:om(l,h,u,f)}:{done:!1}});cm(String.prototype,n,c[0]),cm(el,r,c[1])}i&&Yw(el[r],"sham",!0)}});var gm=$((BR,mm)=>{"use strict";var tl=bt(),Zw=lr(),Jw=Qs(),Kw=Ni(),jw=tl("".charAt),dm=tl("".charCodeAt),Qw=tl("".slice),pm=function(n){return function(e,t){var i=Jw(Kw(e)),r=Zw(t),s=i.length,o,a;return r<0||r>=s?n?"":void 0:(o=dm(i,r),o<55296||o>56319||r+1===s||(a=dm(i,r+1))<56320||a>57343?n?jw(i,r):o:n?Qw(i,r,r+2):(o-55296<<10)+(a-56320)+65536)}};mm.exports={codeAt:pm(!1),charAt:pm(!0)}});var vm=$((zR,_m)=>{"use strict";var eA=gm().charAt;_m.exports=function(n,e,t){return e+(t?eA(n,e).length:1)}});var ym=$((kR,xm)=>{"use strict";var rl=bt(),tA=cr(),nA=Math.floor,nl=rl("".charAt),iA=rl("".replace),il=rl("".slice),rA=/\\$([$&'\`]|\\d{1,2}|<[^>]*>)/g,sA=/\\$([$&'\`]|\\d{1,2})/g;xm.exports=function(n,e,t,i,r,s){var o=t+n.length,a=i.length,c=sA;return r!==void 0&&(r=tA(r),c=rA),iA(s,c,function(l,u){var h;switch(nl(u,0)){case"$":return"$";case"&":return n;case"\`":return il(e,0,t);case"'":return il(e,o);case"<":h=r[il(u,1,-1)];break;default:var f=+u;if(f===0)return l;if(f>a){var m=nA(f/10);return m===0?l:m<=a?i[m-1]===void 0?nl(u,1):i[m-1]+nl(u,1):l}h=i[f-1]}return h===void 0?"":h})}});var bm=$((GR,Sm)=>{"use strict";var Mm=mn(),aA=Un(),oA=ft(),cA=ar(),lA=na(),uA=TypeError;Sm.exports=function(n,e){var t=n.exec;if(oA(t)){var i=Mm(t,n,e);return i!==null&&aA(i),i}if(cA(n)==="RegExp")return Mm(lA,n,e);throw new uA("RegExp#exec called on incompatible receiver")}});var Rm=$(()=>{"use strict";var hA=am(),Em=mn(),ia=bt(),fA=fm(),dA=dt(),pA=Un(),mA=ft(),gA=Ts(),_A=lr(),vA=gc(),ki=Qs(),xA=Ni(),yA=vm(),MA=oc(),SA=ym(),bA=bm(),EA=Xt(),al=EA("replace"),TA=Math.max,wA=Math.min,AA=ia([].concat),sl=ia([].push),Tm=ia("".indexOf),wm=ia("".slice),RA=function(n){return n===void 0?n:String(n)},CA=function(){return"a".replace(/./,"$0")==="$0"}(),Am=function(){return/./[al]?/./[al]("a","$0")==="":!1}(),PA=!dA(function(){var n=/./;return n.exec=function(){var e=[];return e.groups={a:"7"},e},"".replace(n,"$<a>")!=="7"});fA("replace",function(n,e,t){var i=Am?"$":"$0";return[function(s,o){var a=xA(this),c=gA(s)?void 0:MA(s,al);return c?Em(c,s,a,o):Em(e,ki(a),s,o)},function(r,s){var o=pA(this),a=ki(r);if(typeof s=="string"&&Tm(s,i)===-1&&Tm(s,"$<")===-1){var c=t(e,o,a,s);if(c.done)return c.value}var l=mA(s);l||(s=ki(s));var u=o.global,h;u&&(h=o.unicode,o.lastIndex=0);for(var f=[],m;m=bA(o,a),!(m===null||(sl(f,m),!u));){var g=ki(m[0]);g===""&&(o.lastIndex=yA(a,vA(o.lastIndex),h))}for(var x="",p=0,d=0;d<f.length;d++){m=f[d];for(var b=ki(m[0]),v=TA(wA(_A(m.index),a.length),0),T=[],I,R=1;R<m.length;R++)sl(T,RA(m[R]));var A=m.groups;if(l){var B=AA([b],T,v,a);A!==void 0&&sl(B,A),I=ki(hA(s,void 0,B))}else I=SA(b,a,v,T,A,s);v>=p&&(x+=wm(a,p,v)+I,p=v+b.length)}return x+wm(a,p)}]},!PA||!CA||Am)});var Bo="162";var Hm=0,ml=1,Wm=2;var Hu=1,qm=2,cn=3,Cn=0,wt=1,un=2,Tn=0,Si=1,gl=2,_l=3,vl=4,Xm=5,Wn=100,Ym=101,$m=102,xl=103,yl=104,Zm=200,Jm=201,Km=202,jm=203,Wa=204,qa=205,Qm=206,eg=207,tg=208,ng=209,ig=210,rg=211,sg=212,ag=213,og=214,cg=0,lg=1,ug=2,Xr=3,hg=4,fg=5,dg=6,pg=7,Wu=0,mg=1,gg=2,wn=0,_g=1,vg=2,xg=3,yg=4,Mg=5,Sg=6,bg=7;var qu=300,Ti=301,wi=302,Xa=303,Ya=304,xs=306,$a=1e3,kt=1001,Za=1002,Mt=1003,Ml=1004;var Vi=1005;var Tt=1006,ca=1007;var Xn=1008;var An=1009,Eg=1010,Tg=1011,zo=1012,Xu=1013,En=1014,hn=1015,Ki=1016,Yu=1017,$u=1018,$n=1020,wg=1021,Gt=1023,Ag=1024,Rg=1025,Zn=1026,Ai=1027,Cg=1028,Zu=1029,Pg=1030,Ju=1031,Ku=1033,la=33776,ua=33777,ha=33778,fa=33779,Sl=35840,bl=35841,El=35842,Tl=35843,ju=36196,wl=37492,Al=37496,Rl=37808,Cl=37809,Pl=37810,Il=37811,Ll=37812,Ul=37813,Dl=37814,Nl=37815,Ol=37816,Fl=37817,Bl=37818,zl=37819,kl=37820,Gl=37821,da=36492,Vl=36494,Hl=36495,Ig=36283,Wl=36284,ql=36285,Xl=36286;var Yr=2300,$r=2301,pa=2302,Yl=2400,$l=2401,Zl=2402;var Lg=3200,Ug=3201,Dg=0,Ng=1,bn="",Jt="srgb",Ln="srgb-linear",ko="display-p3",ys="display-p3-linear",Zr="linear",Je="srgb",Jr="rec709",Kr="p3";var ni=7680;var Jl=519,Og=512,Fg=513,Bg=514,Qu=515,zg=516,kg=517,Gg=518,Vg=519,Kl=35044;var jl="300 es",Ja=1035,fn=2e3,jr=2001,Pn=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let 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;let i=this._listeners;return i[e]!==void 0&&i[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;let r=this._listeners[e];if(r!==void 0){let s=r.indexOf(t);s!==-1&&r.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;let i=this._listeners[e.type];if(i!==void 0){e.target=this;let r=i.slice(0);for(let s=0,o=r.length;s<o;s++)r[s].call(this,e);e.target=null}}},mt=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];var ma=Math.PI/180,Ka=180/Math.PI;function Ui(){let n=Math.random()*4294967295|0,e=Math.random()*4294967295|0,t=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(mt[n&255]+mt[n>>8&255]+mt[n>>16&255]+mt[n>>24&255]+"-"+mt[e&255]+mt[e>>8&255]+"-"+mt[e>>16&15|64]+mt[e>>24&255]+"-"+mt[t&63|128]+mt[t>>8&255]+"-"+mt[t>>16&255]+mt[t>>24&255]+mt[i&255]+mt[i>>8&255]+mt[i>>16&255]+mt[i>>24&255]).toLowerCase()}function _t(n,e,t){return Math.max(e,Math.min(t,n))}function Hg(n,e){return(n%e+e)%e}function ga(n,e,t){return(1-t)*n+t*e}function Ql(n){return(n&n-1)===0&&n!==0}function ja(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function Hi(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function Et(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}var ue=class n{constructor(e=0,t=0){n.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){let t=this.x,i=this.y,r=e.elements;return this.x=r[0]*t+r[3]*i+r[6],this.y=r[1]*t+r[4]*i+r[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){let 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=Math.trunc(this.x),this.y=Math.trunc(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}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let i=this.dot(e)/t;return Math.acos(_t(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let 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){let i=Math.cos(t),r=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*i-o*r+e.x,this.y=s*r+o*i+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},ze=class n{constructor(e,t,i,r,s,o,a,c,l){n.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,o,a,c,l)}set(e,t,i,r,s,o,a,c,l){let u=this.elements;return u[0]=e,u[1]=r,u[2]=a,u[3]=t,u[4]=s,u[5]=c,u[6]=i,u[7]=o,u[8]=l,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let 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){let 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){let i=e.elements,r=t.elements,s=this.elements,o=i[0],a=i[3],c=i[6],l=i[1],u=i[4],h=i[7],f=i[2],m=i[5],g=i[8],x=r[0],p=r[3],d=r[6],b=r[1],v=r[4],T=r[7],I=r[2],R=r[5],A=r[8];return s[0]=o*x+a*b+c*I,s[3]=o*p+a*v+c*R,s[6]=o*d+a*T+c*A,s[1]=l*x+u*b+h*I,s[4]=l*p+u*v+h*R,s[7]=l*d+u*T+h*A,s[2]=f*x+m*b+g*I,s[5]=f*p+m*v+g*R,s[8]=f*d+m*T+g*A,this}multiplyScalar(e){let 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(){let e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],c=e[6],l=e[7],u=e[8];return t*o*u-t*a*l-i*s*u+i*a*c+r*s*l-r*o*c}invert(){let e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],c=e[6],l=e[7],u=e[8],h=u*o-a*l,f=a*c-u*s,m=l*s-o*c,g=t*h+i*f+r*m;if(g===0)return this.set(0,0,0,0,0,0,0,0,0);let x=1/g;return e[0]=h*x,e[1]=(r*l-u*i)*x,e[2]=(a*i-r*o)*x,e[3]=f*x,e[4]=(u*t-r*c)*x,e[5]=(r*s-a*t)*x,e[6]=m*x,e[7]=(i*c-l*t)*x,e[8]=(o*t-i*s)*x,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let 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,r,s,o,a){let c=Math.cos(s),l=Math.sin(s);return this.set(i*c,i*l,-i*(c*o+l*a)+o+e,-r*l,r*c,-r*(-l*o+c*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(_a.makeScale(e,t)),this}rotate(e){return this.premultiply(_a.makeRotation(-e)),this}translate(e,t){return this.premultiply(_a.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),i=Math.sin(e);return this.set(t,-i,0,i,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,i=e.elements;for(let r=0;r<9;r++)if(t[r]!==i[r])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){let 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)}},_a=new ze;function eh(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function Qr(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function Wg(){let n=Qr("canvas");return n.style.display="block",n}var eu={};function qg(n){n in eu||(eu[n]=!0,console.warn(n))}var tu=new ze().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),nu=new ze().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Mr={[Ln]:{transfer:Zr,primaries:Jr,toReference:n=>n,fromReference:n=>n},[Jt]:{transfer:Je,primaries:Jr,toReference:n=>n.convertSRGBToLinear(),fromReference:n=>n.convertLinearToSRGB()},[ys]:{transfer:Zr,primaries:Kr,toReference:n=>n.applyMatrix3(nu),fromReference:n=>n.applyMatrix3(tu)},[ko]:{transfer:Je,primaries:Kr,toReference:n=>n.convertSRGBToLinear().applyMatrix3(nu),fromReference:n=>n.applyMatrix3(tu).convertLinearToSRGB()}},Xg=new Set([Ln,ys]),Ye={enabled:!0,_workingColorSpace:Ln,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(n){if(!Xg.has(n))throw new Error(\`Unsupported working color space, "\${n}".\`);this._workingColorSpace=n},convert:function(n,e,t){if(this.enabled===!1||e===t||!e||!t)return n;let i=Mr[e].toReference,r=Mr[t].fromReference;return r(i(n))},fromWorkingColorSpace:function(n,e){return this.convert(n,this._workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this._workingColorSpace)},getPrimaries:function(n){return Mr[n].primaries},getTransfer:function(n){return n===bn?Zr:Mr[n].transfer}};function bi(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function va(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}var ii,es=class{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement=="undefined")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{ii===void 0&&(ii=Qr("canvas")),ii.width=e.width,ii.height=e.height;let i=ii.getContext("2d");e instanceof ImageData?i.putImageData(e,0,0):i.drawImage(e,0,0,e.width,e.height),t=ii}return t.width>2048||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){let t=Qr("canvas");t.width=e.width,t.height=e.height;let i=t.getContext("2d");i.drawImage(e,0,0,e.width,e.height);let r=i.getImageData(0,0,e.width,e.height),s=r.data;for(let o=0;o<s.length;o++)s[o]=bi(s[o]/255)*255;return i.putImageData(r,0,0),t}else if(e.data){let t=e.data.slice(0);for(let i=0;i<t.length;i++)t instanceof Uint8Array||t instanceof Uint8ClampedArray?t[i]=Math.floor(bi(t[i]/255)*255):t[i]=bi(t[i]);return{data:t,width:e.width,height:e.height}}else return console.warn("THREE.ImageUtils.sRGBToLinear(): Unsupported image type. No color space conversion applied."),e}},Yg=0,ts=class{constructor(e=null){this.isSource=!0,Object.defineProperty(this,"id",{value:Yg++}),this.uuid=Ui(),this.data=e,this.dataReady=!0,this.version=0}set needsUpdate(e){e===!0&&this.version++}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.images[this.uuid]!==void 0)return e.images[this.uuid];let i={uuid:this.uuid,url:""},r=this.data;if(r!==null){let s;if(Array.isArray(r)){s=[];for(let o=0,a=r.length;o<a;o++)r[o].isDataTexture?s.push(xa(r[o].image)):s.push(xa(r[o]))}else s=xa(r);i.url=s}return t||(e.images[this.uuid]=i),i}};function xa(n){return typeof HTMLImageElement!="undefined"&&n instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&n instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&n instanceof ImageBitmap?es.getDataURL(n):n.data?{data:Array.from(n.data),width:n.width,height:n.height,type:n.data.constructor.name}:(console.warn("THREE.Texture: Unable to serialize Texture."),{})}var $g=0,Nt=class n extends Pn{constructor(e=n.DEFAULT_IMAGE,t=n.DEFAULT_MAPPING,i=kt,r=kt,s=Tt,o=Xn,a=Gt,c=An,l=n.DEFAULT_ANISOTROPY,u=bn){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:$g++}),this.uuid=Ui(),this.name="",this.source=new ts(e),this.mipmaps=[],this.mapping=t,this.channel=0,this.wrapS=i,this.wrapT=r,this.magFilter=s,this.minFilter=o,this.anisotropy=l,this.format=a,this.internalFormat=null,this.type=c,this.offset=new ue(0,0),this.repeat=new ue(1,1),this.center=new ue(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new ze,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=u,this.userData={},this.version=0,this.onUpdate=null,this.isRenderTargetTexture=!1,this.needsPMREMUpdate=!1}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}toJSON(e){let t=e===void 0||typeof e=="string";if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let i={metadata:{version:4.6,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),t||(e.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==qu)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case $a:e.x=e.x-Math.floor(e.x);break;case kt:e.x=e.x<0?0:1;break;case Za: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 $a:e.y=e.y-Math.floor(e.y);break;case kt:e.y=e.y<0?0:1;break;case Za: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)}};Nt.DEFAULT_IMAGE=null;Nt.DEFAULT_MAPPING=qu;Nt.DEFAULT_ANISOTROPY=1;var ht=class n{constructor(e=0,t=0,i=0,r=1){n.prototype.isVector4=!0,this.x=e,this.y=t,this.z=i,this.w=r}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,r){return this.x=e,this.y=t,this.z=i,this.w=r,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){let t=this.x,i=this.y,r=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*i+o[8]*r+o[12]*s,this.y=o[1]*t+o[5]*i+o[9]*r+o[13]*s,this.z=o[2]*t+o[6]*i+o[10]*r+o[14]*s,this.w=o[3]*t+o[7]*i+o[11]*r+o[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let 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,r,s,c=e.elements,l=c[0],u=c[4],h=c[8],f=c[1],m=c[5],g=c[9],x=c[2],p=c[6],d=c[10];if(Math.abs(u-f)<.01&&Math.abs(h-x)<.01&&Math.abs(g-p)<.01){if(Math.abs(u+f)<.1&&Math.abs(h+x)<.1&&Math.abs(g+p)<.1&&Math.abs(l+m+d-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;let v=(l+1)/2,T=(m+1)/2,I=(d+1)/2,R=(u+f)/4,A=(h+x)/4,B=(g+p)/4;return v>T&&v>I?v<.01?(i=0,r=.707106781,s=.707106781):(i=Math.sqrt(v),r=R/i,s=A/i):T>I?T<.01?(i=.707106781,r=0,s=.707106781):(r=Math.sqrt(T),i=R/r,s=B/r):I<.01?(i=.707106781,r=.707106781,s=0):(s=Math.sqrt(I),i=A/s,r=B/s),this.set(i,r,s,t),this}let b=Math.sqrt((p-g)*(p-g)+(h-x)*(h-x)+(f-u)*(f-u));return Math.abs(b)<.001&&(b=1),this.x=(p-g)/b,this.y=(h-x)/b,this.z=(f-u)/b,this.w=Math.acos((l+m+d-1)/2),this}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.w=Math.min(this.w,e.w),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.w=Math.max(this.w,e.w),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.w=Math.max(e.w,Math.min(t.w,this.w)),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.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){let 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.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,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)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}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.w+=(e.w-this.w)*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.w=e.w+(t.w-e.w)*i,this}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}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}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}},Qa=class extends Pn{constructor(e=1,t=1,i={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new ht(0,0,e,t),this.scissorTest=!1,this.viewport=new ht(0,0,e,t);let r={width:e,height:t,depth:1};i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Tt,depthBuffer:!0,stencilBuffer:!1,depthTexture:null,samples:0,count:1},i);let s=new Nt(r,i.mapping,i.wrapS,i.wrapT,i.magFilter,i.minFilter,i.format,i.type,i.anisotropy,i.colorSpace);s.flipY=!1,s.generateMipmaps=i.generateMipmaps,s.internalFormat=i.internalFormat,this.textures=[];let o=i.count;for(let a=0;a<o;a++)this.textures[a]=s.clone(),this.textures[a].isRenderTargetTexture=!0;this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.depthTexture=i.depthTexture,this.samples=i.samples}get texture(){return this.textures[0]}set texture(e){this.textures[0]=e}setSize(e,t,i=1){if(this.width!==e||this.height!==t||this.depth!==i){this.width=e,this.height=t,this.depth=i;for(let r=0,s=this.textures.length;r<s;r++)this.textures[r].image.width=e,this.textures[r].image.height=t,this.textures[r].image.depth=i;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let i=0,r=e.textures.length;i<r;i++)this.textures[i]=e.textures[i].clone(),this.textures[i].isRenderTargetTexture=!0;let t=Object.assign({},e.texture.image);return this.texture.source=new ts(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}},dn=class extends Qa{constructor(e=1,t=1,i={}){super(e,t,i),this.isWebGLRenderTarget=!0}},ns=class extends Nt{constructor(e=null,t=1,i=1,r=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=Mt,this.minFilter=Mt,this.wrapR=kt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var eo=class extends Nt{constructor(e=null,t=1,i=1,r=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:i,depth:r},this.magFilter=Mt,this.minFilter=Mt,this.wrapR=kt,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}};var In=class{constructor(e=0,t=0,i=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=i,this._w=r}static slerpFlat(e,t,i,r,s,o,a){let c=i[r+0],l=i[r+1],u=i[r+2],h=i[r+3],f=s[o+0],m=s[o+1],g=s[o+2],x=s[o+3];if(a===0){e[t+0]=c,e[t+1]=l,e[t+2]=u,e[t+3]=h;return}if(a===1){e[t+0]=f,e[t+1]=m,e[t+2]=g,e[t+3]=x;return}if(h!==x||c!==f||l!==m||u!==g){let p=1-a,d=c*f+l*m+u*g+h*x,b=d>=0?1:-1,v=1-d*d;if(v>Number.EPSILON){let I=Math.sqrt(v),R=Math.atan2(I,d*b);p=Math.sin(p*R)/I,a=Math.sin(a*R)/I}let T=a*b;if(c=c*p+f*T,l=l*p+m*T,u=u*p+g*T,h=h*p+x*T,p===1-a){let I=1/Math.sqrt(c*c+l*l+u*u+h*h);c*=I,l*=I,u*=I,h*=I}}e[t]=c,e[t+1]=l,e[t+2]=u,e[t+3]=h}static multiplyQuaternionsFlat(e,t,i,r,s,o){let a=i[r],c=i[r+1],l=i[r+2],u=i[r+3],h=s[o],f=s[o+1],m=s[o+2],g=s[o+3];return e[t]=a*g+u*h+c*m-l*f,e[t+1]=c*g+u*f+l*h-a*m,e[t+2]=l*g+u*m+a*f-c*h,e[t+3]=u*g-a*h-c*f-l*m,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,r){return this._x=e,this._y=t,this._z=i,this._w=r,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=!0){let i=e._x,r=e._y,s=e._z,o=e._order,a=Math.cos,c=Math.sin,l=a(i/2),u=a(r/2),h=a(s/2),f=c(i/2),m=c(r/2),g=c(s/2);switch(o){case"XYZ":this._x=f*u*h+l*m*g,this._y=l*m*h-f*u*g,this._z=l*u*g+f*m*h,this._w=l*u*h-f*m*g;break;case"YXZ":this._x=f*u*h+l*m*g,this._y=l*m*h-f*u*g,this._z=l*u*g-f*m*h,this._w=l*u*h+f*m*g;break;case"ZXY":this._x=f*u*h-l*m*g,this._y=l*m*h+f*u*g,this._z=l*u*g+f*m*h,this._w=l*u*h-f*m*g;break;case"ZYX":this._x=f*u*h-l*m*g,this._y=l*m*h+f*u*g,this._z=l*u*g-f*m*h,this._w=l*u*h+f*m*g;break;case"YZX":this._x=f*u*h+l*m*g,this._y=l*m*h+f*u*g,this._z=l*u*g-f*m*h,this._w=l*u*h-f*m*g;break;case"XZY":this._x=f*u*h-l*m*g,this._y=l*m*h-f*u*g,this._z=l*u*g+f*m*h,this._w=l*u*h+f*m*g;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let i=t/2,r=Math.sin(i);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,i=t[0],r=t[4],s=t[8],o=t[1],a=t[5],c=t[9],l=t[2],u=t[6],h=t[10],f=i+a+h;if(f>0){let m=.5/Math.sqrt(f+1);this._w=.25/m,this._x=(u-c)*m,this._y=(s-l)*m,this._z=(o-r)*m}else if(i>a&&i>h){let m=2*Math.sqrt(1+i-a-h);this._w=(u-c)/m,this._x=.25*m,this._y=(r+o)/m,this._z=(s+l)/m}else if(a>h){let m=2*Math.sqrt(1+a-i-h);this._w=(s-l)/m,this._x=(r+o)/m,this._y=.25*m,this._z=(c+u)/m}else{let m=2*Math.sqrt(1+h-i-a);this._w=(o-r)/m,this._x=(s+l)/m,this._y=(c+u)/m,this._z=.25*m}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let i=e.dot(t)+1;return i<Number.EPSILON?(i=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=i):(this._x=0,this._y=-e.z,this._z=e.y,this._w=i)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=i),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(_t(this.dot(e),-1,1)))}rotateTowards(e,t){let i=this.angleTo(e);if(i===0)return this;let r=Math.min(1,t/i);return this.slerp(e,r),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){let i=e._x,r=e._y,s=e._z,o=e._w,a=t._x,c=t._y,l=t._z,u=t._w;return this._x=i*u+o*a+r*l-s*c,this._y=r*u+o*c+s*a-i*l,this._z=s*u+o*l+i*c-r*a,this._w=o*u-i*a-r*c-s*l,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);let i=this._x,r=this._y,s=this._z,o=this._w,a=o*e._w+i*e._x+r*e._y+s*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=r,this._z=s,this;let c=1-a*a;if(c<=Number.EPSILON){let m=1-t;return this._w=m*o+t*this._w,this._x=m*i+t*this._x,this._y=m*r+t*this._y,this._z=m*s+t*this._z,this.normalize(),this}let l=Math.sqrt(c),u=Math.atan2(l,a),h=Math.sin((1-t)*u)/l,f=Math.sin(t*u)/l;return this._w=o*h+this._w*f,this._x=i*h+this._x*f,this._y=r*h+this._y*f,this._z=s*h+this._z*f,this._onChangeCallback(),this}slerpQuaternions(e,t,i){return this.copy(e).slerp(t,i)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),i=Math.random(),r=Math.sqrt(1-i),s=Math.sqrt(i);return this.set(r*Math.sin(e),r*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}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._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},L=class n{constructor(e=0,t=0,i=0){n.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(iu.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(iu.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[3]*i+s[6]*r,this.y=s[1]*t+s[4]*i+s[7]*r,this.z=s[2]*t+s[5]*i+s[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,i=this.y,r=this.z,s=e.elements,o=1/(s[3]*t+s[7]*i+s[11]*r+s[15]);return this.x=(s[0]*t+s[4]*i+s[8]*r+s[12])*o,this.y=(s[1]*t+s[5]*i+s[9]*r+s[13])*o,this.z=(s[2]*t+s[6]*i+s[10]*r+s[14])*o,this}applyQuaternion(e){let t=this.x,i=this.y,r=this.z,s=e.x,o=e.y,a=e.z,c=e.w,l=2*(o*r-a*i),u=2*(a*t-s*r),h=2*(s*i-o*t);return this.x=t+c*l+o*h-a*u,this.y=i+c*u+a*l-s*h,this.z=r+c*h+s*u-o*l,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,i=this.y,r=this.z,s=e.elements;return this.x=s[0]*t+s[4]*i+s[8]*r,this.y=s[1]*t+s[5]*i+s[9]*r,this.z=s[2]*t+s[6]*i+s[10]*r,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){let 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=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(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){let i=e.x,r=e.y,s=e.z,o=t.x,a=t.y,c=t.z;return this.x=r*c-s*a,this.y=s*o-i*c,this.z=i*a-r*o,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let i=e.dot(this)/t;return this.copy(e).multiplyScalar(i)}projectOnPlane(e){return ya.copy(this).projectOnVector(e),this.sub(ya)}reflect(e){return this.sub(ya.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let i=this.dot(e)/t;return Math.acos(_t(i,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,i=this.y-e.y,r=this.z-e.z;return t*t+i*i+r*r}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){let r=Math.sin(t)*e;return this.x=r*Math.sin(i),this.y=Math.cos(t)*e,this.z=r*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){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),i=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=i,this.z=r,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}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,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(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,i=Math.sqrt(1-t*t);return this.x=i*Math.cos(e),this.y=t,this.z=i*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},ya=new L,iu=new In,Jn=class{constructor(e=new L(1/0,1/0,1/0),t=new L(-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){this.makeEmpty();for(let t=0,i=e.length;t<i;t+=3)this.expandByPoint(Ft.fromArray(e,t));return this}setFromBufferAttribute(e){this.makeEmpty();for(let t=0,i=e.count;t<i;t++)this.expandByPoint(Ft.fromBufferAttribute(e,t));return this}setFromPoints(e){this.makeEmpty();for(let t=0,i=e.length;t<i;t++)this.expandByPoint(e[t]);return this}setFromCenterAndSize(e,t){let i=Ft.copy(t).multiplyScalar(.5);return this.min.copy(e).sub(i),this.max.copy(e).add(i),this}setFromObject(e,t=!1){return this.makeEmpty(),this.expandByObject(e,t)}clone(){return new this.constructor().copy(this)}copy(e){return this.min.copy(e.min),this.max.copy(e.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(e){return this.isEmpty()?e.set(0,0,0):e.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(e){return this.isEmpty()?e.set(0,0,0):e.subVectors(this.max,this.min)}expandByPoint(e){return this.min.min(e),this.max.max(e),this}expandByVector(e){return this.min.sub(e),this.max.add(e),this}expandByScalar(e){return this.min.addScalar(-e),this.max.addScalar(e),this}expandByObject(e,t=!1){e.updateWorldMatrix(!1,!1);let i=e.geometry;if(i!==void 0){let s=i.getAttribute("position");if(t===!0&&s!==void 0&&e.isInstancedMesh!==!0)for(let o=0,a=s.count;o<a;o++)e.isMesh===!0?e.getVertexPosition(o,Ft):Ft.fromBufferAttribute(s,o),Ft.applyMatrix4(e.matrixWorld),this.expandByPoint(Ft);else e.boundingBox!==void 0?(e.boundingBox===null&&e.computeBoundingBox(),Sr.copy(e.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),Sr.copy(i.boundingBox)),Sr.applyMatrix4(e.matrixWorld),this.union(Sr)}let r=e.children;for(let s=0,o=r.length;s<o;s++)this.expandByObject(r[s],t);return this}containsPoint(e){return!(e.x<this.min.x||e.x>this.max.x||e.y<this.min.y||e.y>this.max.y||e.z<this.min.z||e.z>this.max.z)}containsBox(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.x<this.min.x||e.min.x>this.max.x||e.max.y<this.min.y||e.min.y>this.max.y||e.max.z<this.min.z||e.min.z>this.max.z)}intersectsSphere(e){return this.clampPoint(e.center,Ft),Ft.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(Wi),br.subVectors(this.max,Wi),ri.subVectors(e.a,Wi),si.subVectors(e.b,Wi),ai.subVectors(e.c,Wi),_n.subVectors(si,ri),vn.subVectors(ai,si),Fn.subVectors(ri,ai);let t=[0,-_n.z,_n.y,0,-vn.z,vn.y,0,-Fn.z,Fn.y,_n.z,0,-_n.x,vn.z,0,-vn.x,Fn.z,0,-Fn.x,-_n.y,_n.x,0,-vn.y,vn.x,0,-Fn.y,Fn.x,0];return!Ma(t,ri,si,ai,br)||(t=[1,0,0,0,1,0,0,0,1],!Ma(t,ri,si,ai,br))?!1:(Er.crossVectors(_n,vn),t=[Er.x,Er.y,Er.z],Ma(t,ri,si,ai,br))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Ft).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Ft).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:(nn[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),nn[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),nn[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),nn[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),nn[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),nn[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),nn[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),nn[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(nn),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)}},nn=[new L,new L,new L,new L,new L,new L,new L,new L],Ft=new L,Sr=new Jn,ri=new L,si=new L,ai=new L,_n=new L,vn=new L,Fn=new L,Wi=new L,br=new L,Er=new L,Bn=new L;function Ma(n,e,t,i,r){for(let s=0,o=n.length-3;s<=o;s+=3){Bn.fromArray(n,s);let a=r.x*Math.abs(Bn.x)+r.y*Math.abs(Bn.y)+r.z*Math.abs(Bn.z),c=e.dot(Bn),l=t.dot(Bn),u=i.dot(Bn);if(Math.max(-Math.max(c,l,u),Math.min(c,l,u))>a)return!1}return!0}var Zg=new Jn,qi=new L,Sa=new L,ji=class{constructor(e=new L,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let i=this.center;t!==void 0?i.copy(t):Zg.setFromPoints(e).getCenter(i);let r=0;for(let s=0,o=e.length;s<o;s++)r=Math.max(r,i.distanceToSquared(e[s]));return this.radius=Math.sqrt(r),this}copy(e){return this.center.copy(e.center),this.radius=e.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(e){return e.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(e){return e.distanceTo(this.center)-this.radius}intersectsSphere(e){let t=this.radius+e.radius;return e.center.distanceToSquared(this.center)<=t*t}intersectsBox(e){return e.intersectsSphere(this)}intersectsPlane(e){return Math.abs(e.distanceToPoint(this.center))<=this.radius}clampPoint(e,t){let i=this.center.distanceToSquared(e);return t.copy(e),i>this.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){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;qi.subVectors(e,this.center);let t=qi.lengthSq();if(t>this.radius*this.radius){let i=Math.sqrt(t),r=(i-this.radius)*.5;this.center.addScaledVector(qi,r/i),this.radius+=r}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(Sa.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(qi.copy(e.center).add(Sa)),this.expandByPoint(qi.copy(e.center).sub(Sa))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}},rn=new L,ba=new L,Tr=new L,xn=new L,Ea=new L,wr=new L,Ta=new L,to=class{constructor(e=new L,t=new L(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.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,rn)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let i=t.dot(this.direction);return i<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=rn.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(rn.copy(this.origin).addScaledVector(this.direction,t),rn.distanceToSquared(e))}distanceSqToSegment(e,t,i,r){ba.copy(e).add(t).multiplyScalar(.5),Tr.copy(t).sub(e).normalize(),xn.copy(this.origin).sub(ba);let s=e.distanceTo(t)*.5,o=-this.direction.dot(Tr),a=xn.dot(this.direction),c=-xn.dot(Tr),l=xn.lengthSq(),u=Math.abs(1-o*o),h,f,m,g;if(u>0)if(h=o*c-a,f=o*a-c,g=s*u,h>=0)if(f>=-g)if(f<=g){let x=1/u;h*=x,f*=x,m=h*(h+o*f+2*a)+f*(o*h+f+2*c)+l}else f=s,h=Math.max(0,-(o*f+a)),m=-h*h+f*(f+2*c)+l;else f=-s,h=Math.max(0,-(o*f+a)),m=-h*h+f*(f+2*c)+l;else f<=-g?(h=Math.max(0,-(-o*s+a)),f=h>0?-s:Math.min(Math.max(-s,-c),s),m=-h*h+f*(f+2*c)+l):f<=g?(h=0,f=Math.min(Math.max(-s,-c),s),m=f*(f+2*c)+l):(h=Math.max(0,-(o*s+a)),f=h>0?s:Math.min(Math.max(-s,-c),s),m=-h*h+f*(f+2*c)+l);else f=o>0?-s:s,h=Math.max(0,-(o*f+a)),m=-h*h+f*(f+2*c)+l;return i&&i.copy(this.origin).addScaledVector(this.direction,h),r&&r.copy(ba).addScaledVector(Tr,f),m}intersectSphere(e,t){rn.subVectors(e.center,this.origin);let i=rn.dot(this.direction),r=rn.dot(rn)-i*i,s=e.radius*e.radius;if(r>s)return null;let o=Math.sqrt(s-r),a=i-o,c=i+o;return c<0?null:a<0?this.at(c,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let i=-(this.origin.dot(e.normal)+e.constant)/t;return i>=0?i:null}intersectPlane(e,t){let i=this.distanceToPlane(e);return i===null?null:this.at(i,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let i,r,s,o,a,c,l=1/this.direction.x,u=1/this.direction.y,h=1/this.direction.z,f=this.origin;return l>=0?(i=(e.min.x-f.x)*l,r=(e.max.x-f.x)*l):(i=(e.max.x-f.x)*l,r=(e.min.x-f.x)*l),u>=0?(s=(e.min.y-f.y)*u,o=(e.max.y-f.y)*u):(s=(e.max.y-f.y)*u,o=(e.min.y-f.y)*u),i>o||s>r||((s>i||isNaN(i))&&(i=s),(o<r||isNaN(r))&&(r=o),h>=0?(a=(e.min.z-f.z)*h,c=(e.max.z-f.z)*h):(a=(e.max.z-f.z)*h,c=(e.min.z-f.z)*h),i>c||a>r)||((a>i||i!==i)&&(i=a),(c<r||r!==r)&&(r=c),r<0)?null:this.at(i>=0?i:r,t)}intersectsBox(e){return this.intersectBox(e,rn)!==null}intersectTriangle(e,t,i,r,s){Ea.subVectors(t,e),wr.subVectors(i,e),Ta.crossVectors(Ea,wr);let o=this.direction.dot(Ta),a;if(o>0){if(r)return null;a=1}else if(o<0)a=-1,o=-o;else return null;xn.subVectors(this.origin,e);let c=a*this.direction.dot(wr.crossVectors(xn,wr));if(c<0)return null;let l=a*this.direction.dot(Ea.cross(xn));if(l<0||c+l>o)return null;let u=-a*xn.dot(Ta);return u<0?null:this.at(u/o,s)}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)}},st=class n{constructor(e,t,i,r,s,o,a,c,l,u,h,f,m,g,x,p){n.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,i,r,s,o,a,c,l,u,h,f,m,g,x,p)}set(e,t,i,r,s,o,a,c,l,u,h,f,m,g,x,p){let d=this.elements;return d[0]=e,d[4]=t,d[8]=i,d[12]=r,d[1]=s,d[5]=o,d[9]=a,d[13]=c,d[2]=l,d[6]=u,d[10]=h,d[14]=f,d[3]=m,d[7]=g,d[11]=x,d[15]=p,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 n().fromArray(this.elements)}copy(e){let 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){let t=this.elements,i=e.elements;return t[12]=i[12],t[13]=i[13],t[14]=i[14],this}setFromMatrix3(e){let 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){let t=this.elements,i=e.elements,r=1/oi.setFromMatrixColumn(e,0).length(),s=1/oi.setFromMatrixColumn(e,1).length(),o=1/oi.setFromMatrixColumn(e,2).length();return t[0]=i[0]*r,t[1]=i[1]*r,t[2]=i[2]*r,t[3]=0,t[4]=i[4]*s,t[5]=i[5]*s,t[6]=i[6]*s,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){let t=this.elements,i=e.x,r=e.y,s=e.z,o=Math.cos(i),a=Math.sin(i),c=Math.cos(r),l=Math.sin(r),u=Math.cos(s),h=Math.sin(s);if(e.order==="XYZ"){let f=o*u,m=o*h,g=a*u,x=a*h;t[0]=c*u,t[4]=-c*h,t[8]=l,t[1]=m+g*l,t[5]=f-x*l,t[9]=-a*c,t[2]=x-f*l,t[6]=g+m*l,t[10]=o*c}else if(e.order==="YXZ"){let f=c*u,m=c*h,g=l*u,x=l*h;t[0]=f+x*a,t[4]=g*a-m,t[8]=o*l,t[1]=o*h,t[5]=o*u,t[9]=-a,t[2]=m*a-g,t[6]=x+f*a,t[10]=o*c}else if(e.order==="ZXY"){let f=c*u,m=c*h,g=l*u,x=l*h;t[0]=f-x*a,t[4]=-o*h,t[8]=g+m*a,t[1]=m+g*a,t[5]=o*u,t[9]=x-f*a,t[2]=-o*l,t[6]=a,t[10]=o*c}else if(e.order==="ZYX"){let f=o*u,m=o*h,g=a*u,x=a*h;t[0]=c*u,t[4]=g*l-m,t[8]=f*l+x,t[1]=c*h,t[5]=x*l+f,t[9]=m*l-g,t[2]=-l,t[6]=a*c,t[10]=o*c}else if(e.order==="YZX"){let f=o*c,m=o*l,g=a*c,x=a*l;t[0]=c*u,t[4]=x-f*h,t[8]=g*h+m,t[1]=h,t[5]=o*u,t[9]=-a*u,t[2]=-l*u,t[6]=m*h+g,t[10]=f-x*h}else if(e.order==="XZY"){let f=o*c,m=o*l,g=a*c,x=a*l;t[0]=c*u,t[4]=-h,t[8]=l*u,t[1]=f*h+x,t[5]=o*u,t[9]=m*h-g,t[2]=g*h-m,t[6]=a*u,t[10]=x*h+f}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(Jg,e,Kg)}lookAt(e,t,i){let r=this.elements;return Ct.subVectors(e,t),Ct.lengthSq()===0&&(Ct.z=1),Ct.normalize(),yn.crossVectors(i,Ct),yn.lengthSq()===0&&(Math.abs(i.z)===1?Ct.x+=1e-4:Ct.z+=1e-4,Ct.normalize(),yn.crossVectors(i,Ct)),yn.normalize(),Ar.crossVectors(Ct,yn),r[0]=yn.x,r[4]=Ar.x,r[8]=Ct.x,r[1]=yn.y,r[5]=Ar.y,r[9]=Ct.y,r[2]=yn.z,r[6]=Ar.z,r[10]=Ct.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let i=e.elements,r=t.elements,s=this.elements,o=i[0],a=i[4],c=i[8],l=i[12],u=i[1],h=i[5],f=i[9],m=i[13],g=i[2],x=i[6],p=i[10],d=i[14],b=i[3],v=i[7],T=i[11],I=i[15],R=r[0],A=r[4],B=r[8],j=r[12],y=r[1],E=r[5],ie=r[9],K=r[13],C=r[2],H=r[6],G=r[10],Y=r[14],W=r[3],q=r[7],ne=r[11],te=r[15];return s[0]=o*R+a*y+c*C+l*W,s[4]=o*A+a*E+c*H+l*q,s[8]=o*B+a*ie+c*G+l*ne,s[12]=o*j+a*K+c*Y+l*te,s[1]=u*R+h*y+f*C+m*W,s[5]=u*A+h*E+f*H+m*q,s[9]=u*B+h*ie+f*G+m*ne,s[13]=u*j+h*K+f*Y+m*te,s[2]=g*R+x*y+p*C+d*W,s[6]=g*A+x*E+p*H+d*q,s[10]=g*B+x*ie+p*G+d*ne,s[14]=g*j+x*K+p*Y+d*te,s[3]=b*R+v*y+T*C+I*W,s[7]=b*A+v*E+T*H+I*q,s[11]=b*B+v*ie+T*G+I*ne,s[15]=b*j+v*K+T*Y+I*te,this}multiplyScalar(e){let 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(){let e=this.elements,t=e[0],i=e[4],r=e[8],s=e[12],o=e[1],a=e[5],c=e[9],l=e[13],u=e[2],h=e[6],f=e[10],m=e[14],g=e[3],x=e[7],p=e[11],d=e[15];return g*(+s*c*h-r*l*h-s*a*f+i*l*f+r*a*m-i*c*m)+x*(+t*c*m-t*l*f+s*o*f-r*o*m+r*l*u-s*c*u)+p*(+t*l*h-t*a*m-s*o*h+i*o*m+s*a*u-i*l*u)+d*(-r*a*u-t*c*h+t*a*f+r*o*h-i*o*f+i*c*u)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,i){let r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=i),this}invert(){let e=this.elements,t=e[0],i=e[1],r=e[2],s=e[3],o=e[4],a=e[5],c=e[6],l=e[7],u=e[8],h=e[9],f=e[10],m=e[11],g=e[12],x=e[13],p=e[14],d=e[15],b=h*p*l-x*f*l+x*c*m-a*p*m-h*c*d+a*f*d,v=g*f*l-u*p*l-g*c*m+o*p*m+u*c*d-o*f*d,T=u*x*l-g*h*l+g*a*m-o*x*m-u*a*d+o*h*d,I=g*h*c-u*x*c-g*a*f+o*x*f+u*a*p-o*h*p,R=t*b+i*v+r*T+s*I;if(R===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let A=1/R;return e[0]=b*A,e[1]=(x*f*s-h*p*s-x*r*m+i*p*m+h*r*d-i*f*d)*A,e[2]=(a*p*s-x*c*s+x*r*l-i*p*l-a*r*d+i*c*d)*A,e[3]=(h*c*s-a*f*s-h*r*l+i*f*l+a*r*m-i*c*m)*A,e[4]=v*A,e[5]=(u*p*s-g*f*s+g*r*m-t*p*m-u*r*d+t*f*d)*A,e[6]=(g*c*s-o*p*s-g*r*l+t*p*l+o*r*d-t*c*d)*A,e[7]=(o*f*s-u*c*s+u*r*l-t*f*l-o*r*m+t*c*m)*A,e[8]=T*A,e[9]=(g*h*s-u*x*s-g*i*m+t*x*m+u*i*d-t*h*d)*A,e[10]=(o*x*s-g*a*s+g*i*l-t*x*l-o*i*d+t*a*d)*A,e[11]=(u*a*s-o*h*s-u*i*l+t*h*l+o*i*m-t*a*m)*A,e[12]=I*A,e[13]=(u*x*r-g*h*r+g*i*f-t*x*f-u*i*p+t*h*p)*A,e[14]=(g*a*r-o*x*r-g*i*c+t*x*c+o*i*p-t*a*p)*A,e[15]=(o*h*r-u*a*r+u*i*c-t*h*c-o*i*f+t*a*f)*A,this}scale(e){let t=this.elements,i=e.x,r=e.y,s=e.z;return t[0]*=i,t[4]*=r,t[8]*=s,t[1]*=i,t[5]*=r,t[9]*=s,t[2]*=i,t[6]*=r,t[10]*=s,t[3]*=i,t[7]*=r,t[11]*=s,this}getMaxScaleOnAxis(){let 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],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,i,r))}makeTranslation(e,t,i){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,i,0,0,0,1),this}makeRotationX(e){let 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){let 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){let 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){let i=Math.cos(t),r=Math.sin(t),s=1-i,o=e.x,a=e.y,c=e.z,l=s*o,u=s*a;return this.set(l*o+i,l*a-r*c,l*c+r*a,0,l*a+r*c,u*a+i,u*c-r*o,0,l*c-r*a,u*c+r*o,s*c*c+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,r,s,o){return this.set(1,i,s,0,e,1,o,0,t,r,1,0,0,0,0,1),this}compose(e,t,i){let r=this.elements,s=t._x,o=t._y,a=t._z,c=t._w,l=s+s,u=o+o,h=a+a,f=s*l,m=s*u,g=s*h,x=o*u,p=o*h,d=a*h,b=c*l,v=c*u,T=c*h,I=i.x,R=i.y,A=i.z;return r[0]=(1-(x+d))*I,r[1]=(m+T)*I,r[2]=(g-v)*I,r[3]=0,r[4]=(m-T)*R,r[5]=(1-(f+d))*R,r[6]=(p+b)*R,r[7]=0,r[8]=(g+v)*A,r[9]=(p-b)*A,r[10]=(1-(f+x))*A,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,i){let r=this.elements,s=oi.set(r[0],r[1],r[2]).length(),o=oi.set(r[4],r[5],r[6]).length(),a=oi.set(r[8],r[9],r[10]).length();this.determinant()<0&&(s=-s),e.x=r[12],e.y=r[13],e.z=r[14],Bt.copy(this);let l=1/s,u=1/o,h=1/a;return Bt.elements[0]*=l,Bt.elements[1]*=l,Bt.elements[2]*=l,Bt.elements[4]*=u,Bt.elements[5]*=u,Bt.elements[6]*=u,Bt.elements[8]*=h,Bt.elements[9]*=h,Bt.elements[10]*=h,t.setFromRotationMatrix(Bt),i.x=s,i.y=o,i.z=a,this}makePerspective(e,t,i,r,s,o,a=fn){let c=this.elements,l=2*s/(t-e),u=2*s/(i-r),h=(t+e)/(t-e),f=(i+r)/(i-r),m,g;if(a===fn)m=-(o+s)/(o-s),g=-2*o*s/(o-s);else if(a===jr)m=-o/(o-s),g=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return c[0]=l,c[4]=0,c[8]=h,c[12]=0,c[1]=0,c[5]=u,c[9]=f,c[13]=0,c[2]=0,c[6]=0,c[10]=m,c[14]=g,c[3]=0,c[7]=0,c[11]=-1,c[15]=0,this}makeOrthographic(e,t,i,r,s,o,a=fn){let c=this.elements,l=1/(t-e),u=1/(i-r),h=1/(o-s),f=(t+e)*l,m=(i+r)*u,g,x;if(a===fn)g=(o+s)*h,x=-2*h;else if(a===jr)g=s*h,x=-1*h;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return c[0]=2*l,c[4]=0,c[8]=0,c[12]=-f,c[1]=0,c[5]=2*u,c[9]=0,c[13]=-m,c[2]=0,c[6]=0,c[10]=x,c[14]=-g,c[3]=0,c[7]=0,c[11]=0,c[15]=1,this}equals(e){let t=this.elements,i=e.elements;for(let r=0;r<16;r++)if(t[r]!==i[r])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){let 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}},oi=new L,Bt=new st,Jg=new L(0,0,0),Kg=new L(1,1,1),yn=new L,Ar=new L,Ct=new L,ru=new st,su=new In,Kn=class n{constructor(e=0,t=0,i=0,r=n.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=i,this._order=r}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,r=this._order){return this._x=e,this._y=t,this._z=i,this._order=r,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){let r=e.elements,s=r[0],o=r[4],a=r[8],c=r[1],l=r[5],u=r[9],h=r[2],f=r[6],m=r[10];switch(t){case"XYZ":this._y=Math.asin(_t(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-u,m),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(f,l),this._z=0);break;case"YXZ":this._x=Math.asin(-_t(u,-1,1)),Math.abs(u)<.9999999?(this._y=Math.atan2(a,m),this._z=Math.atan2(c,l)):(this._y=Math.atan2(-h,s),this._z=0);break;case"ZXY":this._x=Math.asin(_t(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-h,m),this._z=Math.atan2(-o,l)):(this._y=0,this._z=Math.atan2(c,s));break;case"ZYX":this._y=Math.asin(-_t(h,-1,1)),Math.abs(h)<.9999999?(this._x=Math.atan2(f,m),this._z=Math.atan2(c,s)):(this._x=0,this._z=Math.atan2(-o,l));break;case"YZX":this._z=Math.asin(_t(c,-1,1)),Math.abs(c)<.9999999?(this._x=Math.atan2(-u,l),this._y=Math.atan2(-h,s)):(this._x=0,this._y=Math.atan2(a,m));break;case"XZY":this._z=Math.asin(-_t(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(f,l),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-u,m),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 ru.makeRotationFromQuaternion(e),this.setFromRotationMatrix(ru,t,i)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return su.setFromEuler(this),this.setFromQuaternion(su,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}};Kn.DEFAULT_ORDER="XYZ";var is=class{constructor(){this.mask=1}set(e){this.mask=(1<<e|0)>>>0}enable(e){this.mask|=1<<e|0}enableAll(){this.mask=-1}toggle(e){this.mask^=1<<e|0}disable(e){this.mask&=~(1<<e|0)}disableAll(){this.mask=0}test(e){return(this.mask&e.mask)!==0}isEnabled(e){return(this.mask&(1<<e|0))!==0}},jg=0,au=new L,ci=new In,sn=new st,Rr=new L,Xi=new L,Qg=new L,e_=new In,ou=new L(1,0,0),cu=new L(0,1,0),lu=new L(0,0,1),t_={type:"added"},n_={type:"removed"},wa={type:"childadded",child:null},Aa={type:"childremoved",child:null},jt=class n extends Pn{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:jg++}),this.uuid=Ui(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=n.DEFAULT_UP.clone();let e=new L,t=new Kn,i=new In,r=new L(1,1,1);function s(){i.setFromEuler(t,!1)}function o(){t.setFromQuaternion(i,void 0,!1)}t._onChange(s),i._onChange(o),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:e},rotation:{configurable:!0,enumerable:!0,value:t},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:r},modelViewMatrix:{value:new st},normalMatrix:{value:new ze}}),this.matrix=new st,this.matrixWorld=new st,this.matrixAutoUpdate=n.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=n.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new is,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(e){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(e),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(e){return this.quaternion.premultiply(e),this}setRotationFromAxisAngle(e,t){this.quaternion.setFromAxisAngle(e,t)}setRotationFromEuler(e){this.quaternion.setFromEuler(e,!0)}setRotationFromMatrix(e){this.quaternion.setFromRotationMatrix(e)}setRotationFromQuaternion(e){this.quaternion.copy(e)}rotateOnAxis(e,t){return ci.setFromAxisAngle(e,t),this.quaternion.multiply(ci),this}rotateOnWorldAxis(e,t){return ci.setFromAxisAngle(e,t),this.quaternion.premultiply(ci),this}rotateX(e){return this.rotateOnAxis(ou,e)}rotateY(e){return this.rotateOnAxis(cu,e)}rotateZ(e){return this.rotateOnAxis(lu,e)}translateOnAxis(e,t){return au.copy(e).applyQuaternion(this.quaternion),this.position.add(au.multiplyScalar(t)),this}translateX(e){return this.translateOnAxis(ou,e)}translateY(e){return this.translateOnAxis(cu,e)}translateZ(e){return this.translateOnAxis(lu,e)}localToWorld(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(this.matrixWorld)}worldToLocal(e){return this.updateWorldMatrix(!0,!1),e.applyMatrix4(sn.copy(this.matrixWorld).invert())}lookAt(e,t,i){e.isVector3?Rr.copy(e):Rr.set(e,t,i);let r=this.parent;this.updateWorldMatrix(!0,!1),Xi.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?sn.lookAt(Xi,Rr,this.up):sn.lookAt(Rr,Xi,this.up),this.quaternion.setFromRotationMatrix(sn),r&&(sn.extractRotation(r.matrixWorld),ci.setFromRotationMatrix(sn),this.quaternion.premultiply(ci.invert()))}add(e){if(arguments.length>1){for(let t=0;t<arguments.length;t++)this.add(arguments[t]);return this}return e===this?(console.error("THREE.Object3D.add: object can't be added as a child of itself.",e),this):(e&&e.isObject3D?(e.parent!==null&&e.parent.remove(e),e.parent=this,this.children.push(e),e.dispatchEvent(t_),wa.child=e,this.dispatchEvent(wa),wa.child=null):console.error("THREE.Object3D.add: object not an instance of THREE.Object3D.",e),this)}remove(e){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}let t=this.children.indexOf(e);return t!==-1&&(e.parent=null,this.children.splice(t,1),e.dispatchEvent(n_),Aa.child=e,this.dispatchEvent(Aa),Aa.child=null),this}removeFromParent(){let e=this.parent;return e!==null&&e.remove(this),this}clear(){return this.remove(...this.children)}attach(e){return this.updateWorldMatrix(!0,!1),sn.copy(this.matrixWorld).invert(),e.parent!==null&&(e.parent.updateWorldMatrix(!0,!1),sn.multiply(e.parent.matrixWorld)),e.applyMatrix4(sn),this.add(e),e.updateWorldMatrix(!1,!0),this}getObjectById(e){return this.getObjectByProperty("id",e)}getObjectByName(e){return this.getObjectByProperty("name",e)}getObjectByProperty(e,t){if(this[e]===t)return this;for(let i=0,r=this.children.length;i<r;i++){let o=this.children[i].getObjectByProperty(e,t);if(o!==void 0)return o}}getObjectsByProperty(e,t,i=[]){this[e]===t&&i.push(this);let r=this.children;for(let s=0,o=r.length;s<o;s++)r[s].getObjectsByProperty(e,t,i);return i}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Xi,e,Qg),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Xi,e_,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);let t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);let t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverse(e)}traverseVisible(e){if(this.visible===!1)return;e(this);let t=this.children;for(let i=0,r=t.length;i<r;i++)t[i].traverseVisible(e)}traverseAncestors(e){let t=this.parent;t!==null&&(e(t),t.traverseAncestors(e))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(e){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||e)&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.matrixWorldNeedsUpdate=!1,e=!0);let t=this.children;for(let i=0,r=t.length;i<r;i++){let s=t[i];(s.matrixWorldAutoUpdate===!0||e===!0)&&s.updateMatrixWorld(e)}}updateWorldMatrix(e,t){let i=this.parent;if(e===!0&&i!==null&&i.matrixWorldAutoUpdate===!0&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),t===!0){let r=this.children;for(let s=0,o=r.length;s<o;s++){let a=r[s];a.matrixWorldAutoUpdate===!0&&a.updateWorldMatrix(!1,!0)}}}toJSON(e){let t=e===void 0||typeof e=="string",i={};t&&(e={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.6,type:"Object",generator:"Object3D.toJSON"});let r={};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.castShadow===!0&&(r.castShadow=!0),this.receiveShadow===!0&&(r.receiveShadow=!0),this.visible===!1&&(r.visible=!1),this.frustumCulled===!1&&(r.frustumCulled=!1),this.renderOrder!==0&&(r.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type="InstancedMesh",r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type="BatchedMesh",r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.visibility=this._visibility,r.active=this._active,r.bounds=this._bounds.map(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.sphere.center.toArray()})),r.maxGeometryCount=this._maxGeometryCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.geometryCount=this._geometryCount,r.matricesTexture=this._matricesTexture.toJSON(e),this.boundingSphere!==null&&(r.boundingSphere={center:r.boundingSphere.center.toArray(),radius:r.boundingSphere.radius}),this.boundingBox!==null&&(r.boundingBox={min:r.boundingBox.min.toArray(),max:r.boundingBox.max.toArray()}));function s(a,c){return a[c.uuid]===void 0&&(a[c.uuid]=c.toJSON(e)),c.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=s(e.geometries,this.geometry);let a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){let c=a.shapes;if(Array.isArray(c))for(let l=0,u=c.length;l<u;l++){let h=c[l];s(e.shapes,h)}else s(e.shapes,c)}}if(this.isSkinnedMesh&&(r.bindMode=this.bindMode,r.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(s(e.skeletons,this.skeleton),r.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){let a=[];for(let c=0,l=this.material.length;c<l;c++)a.push(s(e.materials,this.material[c]));r.material=a}else r.material=s(e.materials,this.material);if(this.children.length>0){r.children=[];for(let a=0;a<this.children.length;a++)r.children.push(this.children[a].toJSON(e).object)}if(this.animations.length>0){r.animations=[];for(let a=0;a<this.animations.length;a++){let c=this.animations[a];r.animations.push(s(e.animations,c))}}if(t){let a=o(e.geometries),c=o(e.materials),l=o(e.textures),u=o(e.images),h=o(e.shapes),f=o(e.skeletons),m=o(e.animations),g=o(e.nodes);a.length>0&&(i.geometries=a),c.length>0&&(i.materials=c),l.length>0&&(i.textures=l),u.length>0&&(i.images=u),h.length>0&&(i.shapes=h),f.length>0&&(i.skeletons=f),m.length>0&&(i.animations=m),g.length>0&&(i.nodes=g)}return i.object=r,i;function o(a){let c=[];for(let l in a){let u=a[l];delete u.metadata,c.push(u)}return c}}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.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,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.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let i=0;i<e.children.length;i++){let r=e.children[i];this.add(r.clone())}return this}};jt.DEFAULT_UP=new L(0,1,0);jt.DEFAULT_MATRIX_AUTO_UPDATE=!0;jt.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;var zt=new L,an=new L,Ra=new L,on=new L,li=new L,ui=new L,uu=new L,Ca=new L,Pa=new L,Ia=new L,vi=class n{constructor(e=new L,t=new L,i=new L){this.a=e,this.b=t,this.c=i}static getNormal(e,t,i,r){r.subVectors(i,t),zt.subVectors(e,t),r.cross(zt);let s=r.lengthSq();return s>0?r.multiplyScalar(1/Math.sqrt(s)):r.set(0,0,0)}static getBarycoord(e,t,i,r,s){zt.subVectors(r,t),an.subVectors(i,t),Ra.subVectors(e,t);let o=zt.dot(zt),a=zt.dot(an),c=zt.dot(Ra),l=an.dot(an),u=an.dot(Ra),h=o*l-a*a;if(h===0)return s.set(0,0,0),null;let f=1/h,m=(l*c-a*u)*f,g=(o*u-a*c)*f;return s.set(1-m-g,g,m)}static containsPoint(e,t,i,r){return this.getBarycoord(e,t,i,r,on)===null?!1:on.x>=0&&on.y>=0&&on.x+on.y<=1}static getInterpolation(e,t,i,r,s,o,a,c){return this.getBarycoord(e,t,i,r,on)===null?(c.x=0,c.y=0,"z"in c&&(c.z=0),"w"in c&&(c.w=0),null):(c.setScalar(0),c.addScaledVector(s,on.x),c.addScaledVector(o,on.y),c.addScaledVector(a,on.z),c)}static isFrontFacing(e,t,i,r){return zt.subVectors(i,t),an.subVectors(e,t),zt.cross(an).dot(r)<0}set(e,t,i){return this.a.copy(e),this.b.copy(t),this.c.copy(i),this}setFromPointsAndIndices(e,t,i,r){return this.a.copy(e[t]),this.b.copy(e[i]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,i,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,i),this.c.fromBufferAttribute(e,r),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 zt.subVectors(this.c,this.b),an.subVectors(this.a,this.b),zt.cross(an).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return n.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return n.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,i,r,s){return n.getInterpolation(e,this.a,this.b,this.c,t,i,r,s)}containsPoint(e){return n.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return n.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let i=this.a,r=this.b,s=this.c,o,a;li.subVectors(r,i),ui.subVectors(s,i),Ca.subVectors(e,i);let c=li.dot(Ca),l=ui.dot(Ca);if(c<=0&&l<=0)return t.copy(i);Pa.subVectors(e,r);let u=li.dot(Pa),h=ui.dot(Pa);if(u>=0&&h<=u)return t.copy(r);let f=c*h-u*l;if(f<=0&&c>=0&&u<=0)return o=c/(c-u),t.copy(i).addScaledVector(li,o);Ia.subVectors(e,s);let m=li.dot(Ia),g=ui.dot(Ia);if(g>=0&&m<=g)return t.copy(s);let x=m*l-c*g;if(x<=0&&l>=0&&g<=0)return a=l/(l-g),t.copy(i).addScaledVector(ui,a);let p=u*g-m*h;if(p<=0&&h-u>=0&&m-g>=0)return uu.subVectors(s,r),a=(h-u)/(h-u+(m-g)),t.copy(r).addScaledVector(uu,a);let d=1/(p+x+f);return o=x*d,a=f*d,t.copy(i).addScaledVector(li,o).addScaledVector(ui,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},th={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},Mn={h:0,s:0,l:0},Cr={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}var Xe=class{constructor(e,t,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,i)}set(e,t,i){if(t===void 0&&i===void 0){let r=e;r&&r.isColor?this.copy(r):typeof r=="number"?this.setHex(r):typeof r=="string"&&this.setStyle(r)}else this.setRGB(e,t,i);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Jt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,Ye.toWorkingColorSpace(this,t),this}setRGB(e,t,i,r=Ye.workingColorSpace){return this.r=e,this.g=t,this.b=i,Ye.toWorkingColorSpace(this,r),this}setHSL(e,t,i,r=Ye.workingColorSpace){if(e=Hg(e,1),t=_t(t,0,1),i=_t(i,0,1),t===0)this.r=this.g=this.b=i;else{let s=i<=.5?i*(1+t):i+t-i*t,o=2*i-s;this.r=La(o,s,e+1/3),this.g=La(o,s,e),this.b=La(o,s,e-1/3)}return Ye.toWorkingColorSpace(this,r),this}setStyle(e,t=Jt){function i(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let r;if(r=/^(\\w+)\\(([^\\)]*)\\)/.exec(e)){let s,o=r[1],a=r[2];switch(o){case"rgb":case"rgba":if(s=/^\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(a))return i(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*,\\s*(\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(a))return i(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\\s*(\\d*\\.?\\d+)\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*,\\s*(\\d*\\.?\\d+)\\%\\s*(?:,\\s*(\\d*\\.?\\d+)\\s*)?$/.exec(a))return i(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(r=/^\\#([A-Fa-f\\d]+)$/.exec(e)){let s=r[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Jt){let i=th[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=bi(e.r),this.g=bi(e.g),this.b=bi(e.b),this}copyLinearToSRGB(e){return this.r=va(e.r),this.g=va(e.g),this.b=va(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Jt){return Ye.fromWorkingColorSpace(gt.copy(this),e),Math.round(_t(gt.r*255,0,255))*65536+Math.round(_t(gt.g*255,0,255))*256+Math.round(_t(gt.b*255,0,255))}getHexString(e=Jt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=Ye.workingColorSpace){Ye.fromWorkingColorSpace(gt.copy(this),t);let i=gt.r,r=gt.g,s=gt.b,o=Math.max(i,r,s),a=Math.min(i,r,s),c,l,u=(a+o)/2;if(a===o)c=0,l=0;else{let h=o-a;switch(l=u<=.5?h/(o+a):h/(2-o-a),o){case i:c=(r-s)/h+(r<s?6:0);break;case r:c=(s-i)/h+2;break;case s:c=(i-r)/h+4;break}c/=6}return e.h=c,e.s=l,e.l=u,e}getRGB(e,t=Ye.workingColorSpace){return Ye.fromWorkingColorSpace(gt.copy(this),t),e.r=gt.r,e.g=gt.g,e.b=gt.b,e}getStyle(e=Jt){Ye.fromWorkingColorSpace(gt.copy(this),e);let t=gt.r,i=gt.g,r=gt.b;return e!==Jt?\`color(\${e} \${t.toFixed(3)} \${i.toFixed(3)} \${r.toFixed(3)})\`:\`rgb(\${Math.round(t*255)},\${Math.round(i*255)},\${Math.round(r*255)})\`}offsetHSL(e,t,i){return this.getHSL(Mn),this.setHSL(Mn.h+e,Mn.s+t,Mn.l+i)}add(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this}addColors(e,t){return this.r=e.r+t.r,this.g=e.g+t.g,this.b=e.b+t.b,this}addScalar(e){return this.r+=e,this.g+=e,this.b+=e,this}sub(e){return this.r=Math.max(0,this.r-e.r),this.g=Math.max(0,this.g-e.g),this.b=Math.max(0,this.b-e.b),this}multiply(e){return this.r*=e.r,this.g*=e.g,this.b*=e.b,this}multiplyScalar(e){return this.r*=e,this.g*=e,this.b*=e,this}lerp(e,t){return this.r+=(e.r-this.r)*t,this.g+=(e.g-this.g)*t,this.b+=(e.b-this.b)*t,this}lerpColors(e,t,i){return this.r=e.r+(t.r-e.r)*i,this.g=e.g+(t.g-e.g)*i,this.b=e.b+(t.b-e.b)*i,this}lerpHSL(e,t){this.getHSL(Mn),e.getHSL(Cr);let i=ga(Mn.h,Cr.h,t),r=ga(Mn.s,Cr.s,t),s=ga(Mn.l,Cr.l,t);return this.setHSL(i,r,s),this}setFromVector3(e){return this.r=e.x,this.g=e.y,this.b=e.z,this}applyMatrix3(e){let t=this.r,i=this.g,r=this.b,s=e.elements;return this.r=s[0]*t+s[3]*i+s[6]*r,this.g=s[1]*t+s[4]*i+s[7]*r,this.b=s[2]*t+s[5]*i+s[8]*r,this}equals(e){return e.r===this.r&&e.g===this.g&&e.b===this.b}fromArray(e,t=0){return this.r=e[t],this.g=e[t+1],this.b=e[t+2],this}toArray(e=[],t=0){return e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e}fromBufferAttribute(e,t){return this.r=e.getX(t),this.g=e.getY(t),this.b=e.getZ(t),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}},gt=new Xe;Xe.NAMES=th;var i_=0,Ri=class extends Pn{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:i_++}),this.uuid=Ui(),this.name="",this.type="Material",this.blending=Si,this.side=Cn,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=Wa,this.blendDst=qa,this.blendEquation=Wn,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new Xe(0,0,0),this.blendAlpha=0,this.depthFunc=Xr,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Jl,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=ni,this.stencilZFail=ni,this.stencilZPass=ni,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.forceSinglePass=!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(let t in e){let i=e[t];if(i===void 0){console.warn(\`THREE.Material: parameter '\${t}' has value of undefined.\`);continue}let r=this[t];if(r===void 0){console.warn(\`THREE.Material: '\${t}' is not a property of THREE.\${this.type}.\`);continue}r&&r.isColor?r.set(i):r&&r.isVector3&&i&&i.isVector3?r.copy(i):this[t]=i}}toJSON(e){let t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});let i={metadata:{version:4.6,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!==void 0&&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.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.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.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),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&&this.attenuationDistance!==1/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!==Si&&(i.blending=this.blending),this.side!==Cn&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==Wa&&(i.blendSrc=this.blendSrc),this.blendDst!==qa&&(i.blendDst=this.blendDst),this.blendEquation!==Wn&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==Xr&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==Jl&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==ni&&(i.stencilFail=this.stencilFail),this.stencilZFail!==ni&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==ni&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),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.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.wireframe===!0&&(i.wireframe=!0),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=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function r(s){let o=[];for(let a in s){let c=s[a];delete c.metadata,o.push(c)}return o}if(t){let s=r(e.textures),o=r(e.images);s.length>0&&(i.textures=s),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.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,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;let t=e.clippingPlanes,i=null;if(t!==null){let r=t.length;i=new Array(r);for(let s=0;s!==r;++s)i[s]=t[s].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.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,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++}},rs=class extends Ri{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Xe(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.envMapRotation=new Kn,this.combine=Wu,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.envMapRotation.copy(e.envMapRotation),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}};var rt=new L,Pr=new ue,At=class{constructor(e,t,i=!1){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,this.usage=Kl,this._updateRange={offset:0,count:-1},this.updateRanges=[],this.gpuType=hn,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}get updateRange(){return qg("THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead."),this._updateRange}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}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.gpuType=e.gpuType,this}copyAt(e,t,i){e*=this.itemSize,i*=t.itemSize;for(let r=0,s=this.itemSize;r<s;r++)this.array[e+r]=t.array[i+r];return this}copyArray(e){return this.array.set(e),this}applyMatrix3(e){if(this.itemSize===2)for(let t=0,i=this.count;t<i;t++)Pr.fromBufferAttribute(this,t),Pr.applyMatrix3(e),this.setXY(t,Pr.x,Pr.y);else if(this.itemSize===3)for(let t=0,i=this.count;t<i;t++)rt.fromBufferAttribute(this,t),rt.applyMatrix3(e),this.setXYZ(t,rt.x,rt.y,rt.z);return this}applyMatrix4(e){for(let t=0,i=this.count;t<i;t++)rt.fromBufferAttribute(this,t),rt.applyMatrix4(e),this.setXYZ(t,rt.x,rt.y,rt.z);return this}applyNormalMatrix(e){for(let t=0,i=this.count;t<i;t++)rt.fromBufferAttribute(this,t),rt.applyNormalMatrix(e),this.setXYZ(t,rt.x,rt.y,rt.z);return this}transformDirection(e){for(let t=0,i=this.count;t<i;t++)rt.fromBufferAttribute(this,t),rt.transformDirection(e),this.setXYZ(t,rt.x,rt.y,rt.z);return this}set(e,t=0){return this.array.set(e,t),this}getComponent(e,t){let i=this.array[e*this.itemSize+t];return this.normalized&&(i=Hi(i,this.array)),i}setComponent(e,t,i){return this.normalized&&(i=Et(i,this.array)),this.array[e*this.itemSize+t]=i,this}getX(e){let t=this.array[e*this.itemSize];return this.normalized&&(t=Hi(t,this.array)),t}setX(e,t){return this.normalized&&(t=Et(t,this.array)),this.array[e*this.itemSize]=t,this}getY(e){let t=this.array[e*this.itemSize+1];return this.normalized&&(t=Hi(t,this.array)),t}setY(e,t){return this.normalized&&(t=Et(t,this.array)),this.array[e*this.itemSize+1]=t,this}getZ(e){let t=this.array[e*this.itemSize+2];return this.normalized&&(t=Hi(t,this.array)),t}setZ(e,t){return this.normalized&&(t=Et(t,this.array)),this.array[e*this.itemSize+2]=t,this}getW(e){let t=this.array[e*this.itemSize+3];return this.normalized&&(t=Hi(t,this.array)),t}setW(e,t){return this.normalized&&(t=Et(t,this.array)),this.array[e*this.itemSize+3]=t,this}setXY(e,t,i){return e*=this.itemSize,this.normalized&&(t=Et(t,this.array),i=Et(i,this.array)),this.array[e+0]=t,this.array[e+1]=i,this}setXYZ(e,t,i,r){return e*=this.itemSize,this.normalized&&(t=Et(t,this.array),i=Et(i,this.array),r=Et(r,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this}setXYZW(e,t,i,r,s){return e*=this.itemSize,this.normalized&&(t=Et(t,this.array),i=Et(i,this.array),r=Et(r,this.array),s=Et(s,this.array)),this.array[e+0]=t,this.array[e+1]=i,this.array[e+2]=r,this.array[e+3]=s,this}onUpload(e){return this.onUploadCallback=e,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){let e={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(e.name=this.name),this.usage!==Kl&&(e.usage=this.usage),e}};var ss=class extends At{constructor(e,t,i){super(new Uint16Array(e),t,i)}};var as=class extends At{constructor(e,t,i){super(new Uint32Array(e),t,i)}};var St=class extends At{constructor(e,t,i){super(new Float32Array(e),t,i)}},r_=0,Dt=new st,Ua=new jt,hi=new L,Pt=new Jn,Yi=new Jn,lt=new L,Ht=class n extends Pn{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:r_++}),this.uuid=Ui(),this.name="",this.type="BufferGeometry",this.index=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(e){return Array.isArray(e)?this.index=new(eh(e)?as:ss)(e,1):this.index=e,this}getAttribute(e){return this.attributes[e]}setAttribute(e,t){return this.attributes[e]=t,this}deleteAttribute(e){return delete this.attributes[e],this}hasAttribute(e){return this.attributes[e]!==void 0}addGroup(e,t,i=0){this.groups.push({start:e,count:t,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(e,t){this.drawRange.start=e,this.drawRange.count=t}applyMatrix4(e){let t=this.attributes.position;t!==void 0&&(t.applyMatrix4(e),t.needsUpdate=!0);let i=this.attributes.normal;if(i!==void 0){let s=new ze().getNormalMatrix(e);i.applyNormalMatrix(s),i.needsUpdate=!0}let r=this.attributes.tangent;return r!==void 0&&(r.transformDirection(e),r.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(e){return Dt.makeRotationFromQuaternion(e),this.applyMatrix4(Dt),this}rotateX(e){return Dt.makeRotationX(e),this.applyMatrix4(Dt),this}rotateY(e){return Dt.makeRotationY(e),this.applyMatrix4(Dt),this}rotateZ(e){return Dt.makeRotationZ(e),this.applyMatrix4(Dt),this}translate(e,t,i){return Dt.makeTranslation(e,t,i),this.applyMatrix4(Dt),this}scale(e,t,i){return Dt.makeScale(e,t,i),this.applyMatrix4(Dt),this}lookAt(e){return Ua.lookAt(e),Ua.updateMatrix(),this.applyMatrix4(Ua.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(hi).negate(),this.translate(hi.x,hi.y,hi.z),this}setFromPoints(e){let t=[];for(let i=0,r=e.length;i<r;i++){let s=e[i];t.push(s.x,s.y,s.z||0)}return this.setAttribute("position",new St(t,3)),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Jn);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.",this),this.boundingBox.set(new L(-1/0,-1/0,-1/0),new L(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let i=0,r=t.length;i<r;i++){let s=t[i];Pt.setFromBufferAttribute(s),this.morphTargetsRelative?(lt.addVectors(this.boundingBox.min,Pt.min),this.boundingBox.expandByPoint(lt),lt.addVectors(this.boundingBox.max,Pt.max),this.boundingBox.expandByPoint(lt)):(this.boundingBox.expandByPoint(Pt.min),this.boundingBox.expandByPoint(Pt.max))}}else this.boundingBox.makeEmpty();(isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z))&&console.error('THREE.BufferGeometry.computeBoundingBox(): Computed min/max have NaN values. The "position" attribute is likely to have NaN values.',this)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new ji);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error("THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.",this),this.boundingSphere.set(new L,1/0);return}if(e){let i=this.boundingSphere.center;if(Pt.setFromBufferAttribute(e),t)for(let s=0,o=t.length;s<o;s++){let a=t[s];Yi.setFromBufferAttribute(a),this.morphTargetsRelative?(lt.addVectors(Pt.min,Yi.min),Pt.expandByPoint(lt),lt.addVectors(Pt.max,Yi.max),Pt.expandByPoint(lt)):(Pt.expandByPoint(Yi.min),Pt.expandByPoint(Yi.max))}Pt.getCenter(i);let r=0;for(let s=0,o=e.count;s<o;s++)lt.fromBufferAttribute(e,s),r=Math.max(r,i.distanceToSquared(lt));if(t)for(let s=0,o=t.length;s<o;s++){let a=t[s],c=this.morphTargetsRelative;for(let l=0,u=a.count;l<u;l++)lt.fromBufferAttribute(a,l),c&&(hi.fromBufferAttribute(e,l),lt.add(hi)),r=Math.max(r,i.distanceToSquared(lt))}this.boundingSphere.radius=Math.sqrt(r),isNaN(this.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this)}}computeTangents(){let e=this.index,t=this.attributes;if(e===null||t.position===void 0||t.normal===void 0||t.uv===void 0){console.error("THREE.BufferGeometry: .computeTangents() failed. Missing required attributes (index, position, normal or uv)");return}let i=t.position,r=t.normal,s=t.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new At(new Float32Array(4*i.count),4));let o=this.getAttribute("tangent"),a=[],c=[];for(let B=0;B<i.count;B++)a[B]=new L,c[B]=new L;let l=new L,u=new L,h=new L,f=new ue,m=new ue,g=new ue,x=new L,p=new L;function d(B,j,y){l.fromBufferAttribute(i,B),u.fromBufferAttribute(i,j),h.fromBufferAttribute(i,y),f.fromBufferAttribute(s,B),m.fromBufferAttribute(s,j),g.fromBufferAttribute(s,y),u.sub(l),h.sub(l),m.sub(f),g.sub(f);let E=1/(m.x*g.y-g.x*m.y);isFinite(E)&&(x.copy(u).multiplyScalar(g.y).addScaledVector(h,-m.y).multiplyScalar(E),p.copy(h).multiplyScalar(m.x).addScaledVector(u,-g.x).multiplyScalar(E),a[B].add(x),a[j].add(x),a[y].add(x),c[B].add(p),c[j].add(p),c[y].add(p))}let b=this.groups;b.length===0&&(b=[{start:0,count:e.count}]);for(let B=0,j=b.length;B<j;++B){let y=b[B],E=y.start,ie=y.count;for(let K=E,C=E+ie;K<C;K+=3)d(e.getX(K+0),e.getX(K+1),e.getX(K+2))}let v=new L,T=new L,I=new L,R=new L;function A(B){I.fromBufferAttribute(r,B),R.copy(I);let j=a[B];v.copy(j),v.sub(I.multiplyScalar(I.dot(j))).normalize(),T.crossVectors(R,j);let E=T.dot(c[B])<0?-1:1;o.setXYZW(B,v.x,v.y,v.z,E)}for(let B=0,j=b.length;B<j;++B){let y=b[B],E=y.start,ie=y.count;for(let K=E,C=E+ie;K<C;K+=3)A(e.getX(K+0)),A(e.getX(K+1)),A(e.getX(K+2))}}computeVertexNormals(){let e=this.index,t=this.getAttribute("position");if(t!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new At(new Float32Array(t.count*3),3),this.setAttribute("normal",i);else for(let f=0,m=i.count;f<m;f++)i.setXYZ(f,0,0,0);let r=new L,s=new L,o=new L,a=new L,c=new L,l=new L,u=new L,h=new L;if(e)for(let f=0,m=e.count;f<m;f+=3){let g=e.getX(f+0),x=e.getX(f+1),p=e.getX(f+2);r.fromBufferAttribute(t,g),s.fromBufferAttribute(t,x),o.fromBufferAttribute(t,p),u.subVectors(o,s),h.subVectors(r,s),u.cross(h),a.fromBufferAttribute(i,g),c.fromBufferAttribute(i,x),l.fromBufferAttribute(i,p),a.add(u),c.add(u),l.add(u),i.setXYZ(g,a.x,a.y,a.z),i.setXYZ(x,c.x,c.y,c.z),i.setXYZ(p,l.x,l.y,l.z)}else for(let f=0,m=t.count;f<m;f+=3)r.fromBufferAttribute(t,f+0),s.fromBufferAttribute(t,f+1),o.fromBufferAttribute(t,f+2),u.subVectors(o,s),h.subVectors(r,s),u.cross(h),i.setXYZ(f+0,u.x,u.y,u.z),i.setXYZ(f+1,u.x,u.y,u.z),i.setXYZ(f+2,u.x,u.y,u.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){let e=this.attributes.normal;for(let t=0,i=e.count;t<i;t++)lt.fromBufferAttribute(e,t),lt.normalize(),e.setXYZ(t,lt.x,lt.y,lt.z)}toNonIndexed(){function e(a,c){let l=a.array,u=a.itemSize,h=a.normalized,f=new l.constructor(c.length*u),m=0,g=0;for(let x=0,p=c.length;x<p;x++){a.isInterleavedBufferAttribute?m=c[x]*a.data.stride+a.offset:m=c[x]*u;for(let d=0;d<u;d++)f[g++]=l[m++]}return new At(f,u,h)}if(this.index===null)return console.warn("THREE.BufferGeometry.toNonIndexed(): BufferGeometry is already non-indexed."),this;let t=new n,i=this.index.array,r=this.attributes;for(let a in r){let c=r[a],l=e(c,i);t.setAttribute(a,l)}let s=this.morphAttributes;for(let a in s){let c=[],l=s[a];for(let u=0,h=l.length;u<h;u++){let f=l[u],m=e(f,i);c.push(m)}t.morphAttributes[a]=c}t.morphTargetsRelative=this.morphTargetsRelative;let o=this.groups;for(let a=0,c=o.length;a<c;a++){let l=o[a];t.addGroup(l.start,l.count,l.materialIndex)}return t}toJSON(){let e={metadata:{version:4.6,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(e.uuid=this.uuid,e.type=this.type,this.name!==""&&(e.name=this.name),Object.keys(this.userData).length>0&&(e.userData=this.userData),this.parameters!==void 0){let c=this.parameters;for(let l in c)c[l]!==void 0&&(e[l]=c[l]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let i=this.attributes;for(let c in i){let l=i[c];e.data.attributes[c]=l.toJSON(e.data)}let r={},s=!1;for(let c in this.morphAttributes){let l=this.morphAttributes[c],u=[];for(let h=0,f=l.length;h<f;h++){let m=l[h];u.push(m.toJSON(e.data))}u.length>0&&(r[c]=u,s=!0)}s&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));let 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;let t={};this.name=e.name;let i=e.index;i!==null&&this.setIndex(i.clone(t));let r=e.attributes;for(let l in r){let u=r[l];this.setAttribute(l,u.clone(t))}let s=e.morphAttributes;for(let l in s){let u=[],h=s[l];for(let f=0,m=h.length;f<m;f++)u.push(h[f].clone(t));this.morphAttributes[l]=u}this.morphTargetsRelative=e.morphTargetsRelative;let o=e.groups;for(let l=0,u=o.length;l<u;l++){let h=o[l];this.addGroup(h.start,h.count,h.materialIndex)}let a=e.boundingBox;a!==null&&(this.boundingBox=a.clone());let c=e.boundingSphere;return c!==null&&(this.boundingSphere=c.clone()),this.drawRange.start=e.drawRange.start,this.drawRange.count=e.drawRange.count,this.userData=e.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}},hu=new st,zn=new to,Ir=new ji,fu=new L,fi=new L,di=new L,pi=new L,Da=new L,Lr=new L,Ur=new ue,Dr=new ue,Nr=new ue,du=new L,pu=new L,mu=new L,Or=new L,Fr=new L,Vt=class extends jt{constructor(e=new Ht,t=new rs){super(),this.isMesh=!0,this.type="Mesh",this.geometry=e,this.material=t,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),e.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=e.morphTargetInfluences.slice()),e.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},e.morphTargetDictionary)),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}updateMorphTargets(){let t=this.geometry.morphAttributes,i=Object.keys(t);if(i.length>0){let r=t[i[0]];if(r!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=r.length;s<o;s++){let a=r[s].name||String(s);this.morphTargetInfluences.push(0),this.morphTargetDictionary[a]=s}}}}getVertexPosition(e,t){let i=this.geometry,r=i.attributes.position,s=i.morphAttributes.position,o=i.morphTargetsRelative;t.fromBufferAttribute(r,e);let a=this.morphTargetInfluences;if(s&&a){Lr.set(0,0,0);for(let c=0,l=s.length;c<l;c++){let u=a[c],h=s[c];u!==0&&(Da.fromBufferAttribute(h,e),o?Lr.addScaledVector(Da,u):Lr.addScaledVector(Da.sub(t),u))}t.add(Lr)}return t}raycast(e,t){let i=this.geometry,r=this.material,s=this.matrixWorld;r!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),Ir.copy(i.boundingSphere),Ir.applyMatrix4(s),zn.copy(e.ray).recast(e.near),!(Ir.containsPoint(zn.origin)===!1&&(zn.intersectSphere(Ir,fu)===null||zn.origin.distanceToSquared(fu)>(e.far-e.near)**2))&&(hu.copy(s).invert(),zn.copy(e.ray).applyMatrix4(hu),!(i.boundingBox!==null&&zn.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(e,t,zn)))}_computeIntersections(e,t,i){let r,s=this.geometry,o=this.material,a=s.index,c=s.attributes.position,l=s.attributes.uv,u=s.attributes.uv1,h=s.attributes.normal,f=s.groups,m=s.drawRange;if(a!==null)if(Array.isArray(o))for(let g=0,x=f.length;g<x;g++){let p=f[g],d=o[p.materialIndex],b=Math.max(p.start,m.start),v=Math.min(a.count,Math.min(p.start+p.count,m.start+m.count));for(let T=b,I=v;T<I;T+=3){let R=a.getX(T),A=a.getX(T+1),B=a.getX(T+2);r=Br(this,d,e,i,l,u,h,R,A,B),r&&(r.faceIndex=Math.floor(T/3),r.face.materialIndex=p.materialIndex,t.push(r))}}else{let g=Math.max(0,m.start),x=Math.min(a.count,m.start+m.count);for(let p=g,d=x;p<d;p+=3){let b=a.getX(p),v=a.getX(p+1),T=a.getX(p+2);r=Br(this,o,e,i,l,u,h,b,v,T),r&&(r.faceIndex=Math.floor(p/3),t.push(r))}}else if(c!==void 0)if(Array.isArray(o))for(let g=0,x=f.length;g<x;g++){let p=f[g],d=o[p.materialIndex],b=Math.max(p.start,m.start),v=Math.min(c.count,Math.min(p.start+p.count,m.start+m.count));for(let T=b,I=v;T<I;T+=3){let R=T,A=T+1,B=T+2;r=Br(this,d,e,i,l,u,h,R,A,B),r&&(r.faceIndex=Math.floor(T/3),r.face.materialIndex=p.materialIndex,t.push(r))}}else{let g=Math.max(0,m.start),x=Math.min(c.count,m.start+m.count);for(let p=g,d=x;p<d;p+=3){let b=p,v=p+1,T=p+2;r=Br(this,o,e,i,l,u,h,b,v,T),r&&(r.faceIndex=Math.floor(p/3),t.push(r))}}}};function s_(n,e,t,i,r,s,o,a){let c;if(e.side===wt?c=i.intersectTriangle(o,s,r,!0,a):c=i.intersectTriangle(r,s,o,e.side===Cn,a),c===null)return null;Fr.copy(a),Fr.applyMatrix4(n.matrixWorld);let l=t.ray.origin.distanceTo(Fr);return l<t.near||l>t.far?null:{distance:l,point:Fr.clone(),object:n}}function Br(n,e,t,i,r,s,o,a,c,l){n.getVertexPosition(a,fi),n.getVertexPosition(c,di),n.getVertexPosition(l,pi);let u=s_(n,e,t,i,fi,di,pi,Or);if(u){r&&(Ur.fromBufferAttribute(r,a),Dr.fromBufferAttribute(r,c),Nr.fromBufferAttribute(r,l),u.uv=vi.getInterpolation(Or,fi,di,pi,Ur,Dr,Nr,new ue)),s&&(Ur.fromBufferAttribute(s,a),Dr.fromBufferAttribute(s,c),Nr.fromBufferAttribute(s,l),u.uv1=vi.getInterpolation(Or,fi,di,pi,Ur,Dr,Nr,new ue)),o&&(du.fromBufferAttribute(o,a),pu.fromBufferAttribute(o,c),mu.fromBufferAttribute(o,l),u.normal=vi.getInterpolation(Or,fi,di,pi,du,pu,mu,new L),u.normal.dot(i.direction)>0&&u.normal.multiplyScalar(-1));let h={a,b:c,c:l,normal:new L,materialIndex:0};vi.getNormal(fi,di,pi,h.normal),u.face=h}return u}var Qi=class n extends Ht{constructor(e=1,t=1,i=1,r=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:i,widthSegments:r,heightSegments:s,depthSegments:o};let a=this;r=Math.floor(r),s=Math.floor(s),o=Math.floor(o);let c=[],l=[],u=[],h=[],f=0,m=0;g("z","y","x",-1,-1,i,t,e,o,s,0),g("z","y","x",1,-1,i,t,-e,o,s,1),g("x","z","y",1,1,e,i,t,r,o,2),g("x","z","y",1,-1,e,i,-t,r,o,3),g("x","y","z",1,-1,e,t,i,r,s,4),g("x","y","z",-1,-1,e,t,-i,r,s,5),this.setIndex(c),this.setAttribute("position",new St(l,3)),this.setAttribute("normal",new St(u,3)),this.setAttribute("uv",new St(h,2));function g(x,p,d,b,v,T,I,R,A,B,j){let y=T/A,E=I/B,ie=T/2,K=I/2,C=R/2,H=A+1,G=B+1,Y=0,W=0,q=new L;for(let ne=0;ne<G;ne++){let te=ne*E-K;for(let _e=0;_e<H;_e++){let Ie=_e*y-ie;q[x]=Ie*b,q[p]=te*v,q[d]=C,l.push(q.x,q.y,q.z),q[x]=0,q[p]=0,q[d]=R>0?1:-1,u.push(q.x,q.y,q.z),h.push(_e/A),h.push(1-ne/B),Y+=1}}for(let ne=0;ne<B;ne++)for(let te=0;te<A;te++){let _e=f+te+H*ne,Ie=f+te+H*(ne+1),z=f+(te+1)+H*(ne+1),Q=f+(te+1)+H*ne;c.push(_e,Ie,Q),c.push(Ie,z,Q),W+=6}a.addGroup(m,W,j),m+=W,f+=Y}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}static fromJSON(e){return new n(e.width,e.height,e.depth,e.widthSegments,e.heightSegments,e.depthSegments)}};function Ci(n){let e={};for(let t in n){e[t]={};for(let i in n[t]){let r=n[t][i];r&&(r.isColor||r.isMatrix3||r.isMatrix4||r.isVector2||r.isVector3||r.isVector4||r.isTexture||r.isQuaternion)?r.isRenderTargetTexture?(console.warn("UniformsUtils: Textures of render targets cannot be cloned via cloneUniforms() or mergeUniforms()."),e[t][i]=null):e[t][i]=r.clone():Array.isArray(r)?e[t][i]=r.slice():e[t][i]=r}}return e}function yt(n){let e={};for(let t=0;t<n.length;t++){let i=Ci(n[t]);for(let r in i)e[r]=i[r]}return e}function a_(n){let e=[];for(let t=0;t<n.length;t++)e.push(n[t].clone());return e}function nh(n){return n.getRenderTarget()===null?n.outputColorSpace:Ye.workingColorSpace}var o_={clone:Ci,merge:yt},c_=\`void main() {
@@ -3843,7 +3843,7 @@ void main() {
3843
3843
  }
3844
3844
 
3845
3845
  }\`,mo=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,i){if(this.texture===null){let r=new Nt,s=e.properties.get(r);s.__webglTexture=t.texture,(t.depthNear!=i.depthNear||t.depthFar!=i.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=r}}render(e,t){if(this.texture!==null){if(this.mesh===null){let i=t.cameras[0].viewport,r=new Qt({extensions:{fragDepth:!0},vertexShader:Fy,fragmentShader:By,uniforms:{depthColor:{value:this.texture},depthWidth:{value:i.z},depthHeight:{value:i.w}}});this.mesh=new Vt(new us(20,20),r)}e.render(this.mesh,t)}}reset(){this.texture=null,this.mesh=null}},go=class extends Pn{constructor(e,t){super();let i=this,r=null,s=1,o=null,a="local-floor",c=1,l=null,u=null,h=null,f=null,m=null,g=null,x=new mo,p=t.getContextAttributes(),d=null,b=null,v=[],T=[],I=new ue,R=null,A=new It;A.layers.enable(1),A.viewport=new ht;let B=new It;B.layers.enable(2),B.viewport=new ht;let j=[A,B],y=new po;y.layers.enable(1),y.layers.enable(2);let E=null,ie=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(z){let Q=v[z];return Q===void 0&&(Q=new $i,v[z]=Q),Q.getTargetRaySpace()},this.getControllerGrip=function(z){let Q=v[z];return Q===void 0&&(Q=new $i,v[z]=Q),Q.getGripSpace()},this.getHand=function(z){let Q=v[z];return Q===void 0&&(Q=new $i,v[z]=Q),Q.getHandSpace()};function K(z){let Q=T.indexOf(z.inputSource);if(Q===-1)return;let me=v[Q];me!==void 0&&(me.update(z.inputSource,z.frame,l||o),me.dispatchEvent({type:z.type,data:z.inputSource}))}function C(){r.removeEventListener("select",K),r.removeEventListener("selectstart",K),r.removeEventListener("selectend",K),r.removeEventListener("squeeze",K),r.removeEventListener("squeezestart",K),r.removeEventListener("squeezeend",K),r.removeEventListener("end",C),r.removeEventListener("inputsourceschange",H);for(let z=0;z<v.length;z++){let Q=T[z];Q!==null&&(T[z]=null,v[z].disconnect(Q))}E=null,ie=null,x.reset(),e.setRenderTarget(d),m=null,f=null,h=null,r=null,b=null,Ie.stop(),i.isPresenting=!1,e.setPixelRatio(R),e.setSize(I.width,I.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(z){s=z,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(z){a=z,i.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return l||o},this.setReferenceSpace=function(z){l=z},this.getBaseLayer=function(){return f!==null?f:m},this.getBinding=function(){return h},this.getFrame=function(){return g},this.getSession=function(){return r},this.setSession=function(z){return yr(this,null,function*(){if(r=z,r!==null){if(d=e.getRenderTarget(),r.addEventListener("select",K),r.addEventListener("selectstart",K),r.addEventListener("selectend",K),r.addEventListener("squeeze",K),r.addEventListener("squeezestart",K),r.addEventListener("squeezeend",K),r.addEventListener("end",C),r.addEventListener("inputsourceschange",H),p.xrCompatible!==!0&&(yield t.makeXRCompatible()),R=e.getPixelRatio(),e.getSize(I),r.renderState.layers===void 0||e.capabilities.isWebGL2===!1){let Q={antialias:r.renderState.layers===void 0?p.antialias:!0,alpha:!0,depth:p.depth,stencil:p.stencil,framebufferScaleFactor:s};m=new XRWebGLLayer(r,t,Q),r.updateRenderState({baseLayer:m}),e.setPixelRatio(1),e.setSize(m.framebufferWidth,m.framebufferHeight,!1),b=new dn(m.framebufferWidth,m.framebufferHeight,{format:Gt,type:An,colorSpace:e.outputColorSpace,stencilBuffer:p.stencil})}else{let Q=null,me=null,Te=null;p.depth&&(Te=p.stencil?t.DEPTH24_STENCIL8:t.DEPTH_COMPONENT24,Q=p.stencil?Ai:Zn,me=p.stencil?$n:En);let Me={colorFormat:t.RGBA8,depthFormat:Te,scaleFactor:s};h=new XRWebGLBinding(r,t),f=h.createProjectionLayer(Me),r.updateRenderState({layers:[f]}),e.setPixelRatio(1),e.setSize(f.textureWidth,f.textureHeight,!1),b=new dn(f.textureWidth,f.textureHeight,{format:Gt,type:An,depthTexture:new fs(f.textureWidth,f.textureHeight,me,void 0,void 0,void 0,void 0,void 0,void 0,Q),stencilBuffer:p.stencil,colorSpace:e.outputColorSpace,samples:p.antialias?4:0});let xe=e.properties.get(b);xe.__ignoreDepthValues=f.ignoreDepthValues}b.isXRRenderTarget=!0,this.setFoveation(c),l=null,o=yield r.requestReferenceSpace(a),Ie.setContext(r),Ie.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}})},this.getEnvironmentBlendMode=function(){if(r!==null)return r.environmentBlendMode};function H(z){for(let Q=0;Q<z.removed.length;Q++){let me=z.removed[Q],Te=T.indexOf(me);Te>=0&&(T[Te]=null,v[Te].disconnect(me))}for(let Q=0;Q<z.added.length;Q++){let me=z.added[Q],Te=T.indexOf(me);if(Te===-1){for(let xe=0;xe<v.length;xe++)if(xe>=T.length){T.push(me),Te=xe;break}else if(T[xe]===null){T[xe]=me,Te=xe;break}if(Te===-1)break}let Me=v[Te];Me&&Me.connect(me)}}let G=new L,Y=new L;function W(z,Q,me){G.setFromMatrixPosition(Q.matrixWorld),Y.setFromMatrixPosition(me.matrixWorld);let Te=G.distanceTo(Y),Me=Q.projectionMatrix.elements,xe=me.projectionMatrix.elements,ke=Me[14]/(Me[10]-1),we=Me[14]/(Me[10]+1),w=(Me[9]+1)/Me[5],ae=(Me[9]-1)/Me[5],X=(Me[8]-1)/Me[0],re=(xe[8]+1)/xe[0],Z=ke*X,ve=ke*re,pe=Te/(-X+re),ye=pe*-X;Q.matrixWorld.decompose(z.position,z.quaternion,z.scale),z.translateX(ye),z.translateZ(pe),z.matrixWorld.compose(z.position,z.quaternion,z.scale),z.matrixWorldInverse.copy(z.matrixWorld).invert();let Ve=ke+pe,S=we+pe,_=Z-ye,k=ve+(Te-ye),V=w*we/S*Ve,ee=ae*we/S*Ve;z.projectionMatrix.makePerspective(_,k,V,ee,Ve,S),z.projectionMatrixInverse.copy(z.projectionMatrix).invert()}function q(z,Q){Q===null?z.matrixWorld.copy(z.matrix):z.matrixWorld.multiplyMatrices(Q.matrixWorld,z.matrix),z.matrixWorldInverse.copy(z.matrixWorld).invert()}this.updateCamera=function(z){if(r===null)return;x.texture!==null&&(z.near=x.depthNear,z.far=x.depthFar),y.near=B.near=A.near=z.near,y.far=B.far=A.far=z.far,(E!==y.near||ie!==y.far)&&(r.updateRenderState({depthNear:y.near,depthFar:y.far}),E=y.near,ie=y.far,A.near=E,A.far=ie,B.near=E,B.far=ie,A.updateProjectionMatrix(),B.updateProjectionMatrix(),z.updateProjectionMatrix());let Q=z.parent,me=y.cameras;q(y,Q);for(let Te=0;Te<me.length;Te++)q(me[Te],Q);me.length===2?W(y,A,B):y.projectionMatrix.copy(A.projectionMatrix),ne(z,y,Q)};function ne(z,Q,me){me===null?z.matrix.copy(Q.matrixWorld):(z.matrix.copy(me.matrixWorld),z.matrix.invert(),z.matrix.multiply(Q.matrixWorld)),z.matrix.decompose(z.position,z.quaternion,z.scale),z.updateMatrixWorld(!0),z.projectionMatrix.copy(Q.projectionMatrix),z.projectionMatrixInverse.copy(Q.projectionMatrixInverse),z.isPerspectiveCamera&&(z.fov=Ka*2*Math.atan(1/z.projectionMatrix.elements[5]),z.zoom=1)}this.getCamera=function(){return y},this.getFoveation=function(){if(!(f===null&&m===null))return c},this.setFoveation=function(z){c=z,f!==null&&(f.fixedFoveation=z),m!==null&&m.fixedFoveation!==void 0&&(m.fixedFoveation=z)},this.hasDepthSensing=function(){return x.texture!==null};let te=null;function _e(z,Q){if(u=Q.getViewerPose(l||o),g=Q,u!==null){let me=u.views;m!==null&&(e.setRenderTargetFramebuffer(b,m.framebuffer),e.setRenderTarget(b));let Te=!1;me.length!==y.cameras.length&&(y.cameras.length=0,Te=!0);for(let xe=0;xe<me.length;xe++){let ke=me[xe],we=null;if(m!==null)we=m.getViewport(ke);else{let ae=h.getViewSubImage(f,ke);we=ae.viewport,xe===0&&(e.setRenderTargetTextures(b,ae.colorTexture,f.ignoreDepthValues?void 0:ae.depthStencilTexture),e.setRenderTarget(b))}let w=j[xe];w===void 0&&(w=new It,w.layers.enable(xe),w.viewport=new ht,j[xe]=w),w.matrix.fromArray(ke.transform.matrix),w.matrix.decompose(w.position,w.quaternion,w.scale),w.projectionMatrix.fromArray(ke.projectionMatrix),w.projectionMatrixInverse.copy(w.projectionMatrix).invert(),w.viewport.set(we.x,we.y,we.width,we.height),xe===0&&(y.matrix.copy(w.matrix),y.matrix.decompose(y.position,y.quaternion,y.scale)),Te===!0&&y.cameras.push(w)}let Me=r.enabledFeatures;if(Me&&Me.includes("depth-sensing")){let xe=h.getDepthInformation(me[0]);xe&&xe.isValid&&xe.texture&&x.init(e,xe,r.renderState)}}for(let me=0;me<v.length;me++){let Te=T[me],Me=v[me];Te!==null&&Me!==void 0&&Me.update(Te,Q,l||o)}x.render(e,y),te&&te(z,Q),Q.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:Q}),g=null}let Ie=new ih;Ie.setAnimationLoop(_e),this.setAnimationLoop=function(z){te=z},this.dispose=function(){}}},Vn=new Kn,zy=new st;function ky(n,e){function t(p,d){p.matrixAutoUpdate===!0&&p.updateMatrix(),d.value.copy(p.matrix)}function i(p,d){d.color.getRGB(p.fogColor.value,nh(n)),d.isFog?(p.fogNear.value=d.near,p.fogFar.value=d.far):d.isFogExp2&&(p.fogDensity.value=d.density)}function r(p,d,b,v,T){d.isMeshBasicMaterial||d.isMeshLambertMaterial?s(p,d):d.isMeshToonMaterial?(s(p,d),h(p,d)):d.isMeshPhongMaterial?(s(p,d),u(p,d)):d.isMeshStandardMaterial?(s(p,d),f(p,d),d.isMeshPhysicalMaterial&&m(p,d,T)):d.isMeshMatcapMaterial?(s(p,d),g(p,d)):d.isMeshDepthMaterial?s(p,d):d.isMeshDistanceMaterial?(s(p,d),x(p,d)):d.isMeshNormalMaterial?s(p,d):d.isLineBasicMaterial?(o(p,d),d.isLineDashedMaterial&&a(p,d)):d.isPointsMaterial?c(p,d,b,v):d.isSpriteMaterial?l(p,d):d.isShadowMaterial?(p.color.value.copy(d.color),p.opacity.value=d.opacity):d.isShaderMaterial&&(d.uniformsNeedUpdate=!1)}function s(p,d){p.opacity.value=d.opacity,d.color&&p.diffuse.value.copy(d.color),d.emissive&&p.emissive.value.copy(d.emissive).multiplyScalar(d.emissiveIntensity),d.map&&(p.map.value=d.map,t(d.map,p.mapTransform)),d.alphaMap&&(p.alphaMap.value=d.alphaMap,t(d.alphaMap,p.alphaMapTransform)),d.bumpMap&&(p.bumpMap.value=d.bumpMap,t(d.bumpMap,p.bumpMapTransform),p.bumpScale.value=d.bumpScale,d.side===wt&&(p.bumpScale.value*=-1)),d.normalMap&&(p.normalMap.value=d.normalMap,t(d.normalMap,p.normalMapTransform),p.normalScale.value.copy(d.normalScale),d.side===wt&&p.normalScale.value.negate()),d.displacementMap&&(p.displacementMap.value=d.displacementMap,t(d.displacementMap,p.displacementMapTransform),p.displacementScale.value=d.displacementScale,p.displacementBias.value=d.displacementBias),d.emissiveMap&&(p.emissiveMap.value=d.emissiveMap,t(d.emissiveMap,p.emissiveMapTransform)),d.specularMap&&(p.specularMap.value=d.specularMap,t(d.specularMap,p.specularMapTransform)),d.alphaTest>0&&(p.alphaTest.value=d.alphaTest);let b=e.get(d),v=b.envMap,T=b.envMapRotation;if(v&&(p.envMap.value=v,Vn.copy(T),Vn.x*=-1,Vn.y*=-1,Vn.z*=-1,v.isCubeTexture&&v.isRenderTargetTexture===!1&&(Vn.y*=-1,Vn.z*=-1),p.envMapRotation.value.setFromMatrix4(zy.makeRotationFromEuler(Vn)),p.flipEnvMap.value=v.isCubeTexture&&v.isRenderTargetTexture===!1?-1:1,p.reflectivity.value=d.reflectivity,p.ior.value=d.ior,p.refractionRatio.value=d.refractionRatio),d.lightMap){p.lightMap.value=d.lightMap;let I=n._useLegacyLights===!0?Math.PI:1;p.lightMapIntensity.value=d.lightMapIntensity*I,t(d.lightMap,p.lightMapTransform)}d.aoMap&&(p.aoMap.value=d.aoMap,p.aoMapIntensity.value=d.aoMapIntensity,t(d.aoMap,p.aoMapTransform))}function o(p,d){p.diffuse.value.copy(d.color),p.opacity.value=d.opacity,d.map&&(p.map.value=d.map,t(d.map,p.mapTransform))}function a(p,d){p.dashSize.value=d.dashSize,p.totalSize.value=d.dashSize+d.gapSize,p.scale.value=d.scale}function c(p,d,b,v){p.diffuse.value.copy(d.color),p.opacity.value=d.opacity,p.size.value=d.size*b,p.scale.value=v*.5,d.map&&(p.map.value=d.map,t(d.map,p.uvTransform)),d.alphaMap&&(p.alphaMap.value=d.alphaMap,t(d.alphaMap,p.alphaMapTransform)),d.alphaTest>0&&(p.alphaTest.value=d.alphaTest)}function l(p,d){p.diffuse.value.copy(d.color),p.opacity.value=d.opacity,p.rotation.value=d.rotation,d.map&&(p.map.value=d.map,t(d.map,p.mapTransform)),d.alphaMap&&(p.alphaMap.value=d.alphaMap,t(d.alphaMap,p.alphaMapTransform)),d.alphaTest>0&&(p.alphaTest.value=d.alphaTest)}function u(p,d){p.specular.value.copy(d.specular),p.shininess.value=Math.max(d.shininess,1e-4)}function h(p,d){d.gradientMap&&(p.gradientMap.value=d.gradientMap)}function f(p,d){p.metalness.value=d.metalness,d.metalnessMap&&(p.metalnessMap.value=d.metalnessMap,t(d.metalnessMap,p.metalnessMapTransform)),p.roughness.value=d.roughness,d.roughnessMap&&(p.roughnessMap.value=d.roughnessMap,t(d.roughnessMap,p.roughnessMapTransform)),e.get(d).envMap&&(p.envMapIntensity.value=d.envMapIntensity)}function m(p,d,b){p.ior.value=d.ior,d.sheen>0&&(p.sheenColor.value.copy(d.sheenColor).multiplyScalar(d.sheen),p.sheenRoughness.value=d.sheenRoughness,d.sheenColorMap&&(p.sheenColorMap.value=d.sheenColorMap,t(d.sheenColorMap,p.sheenColorMapTransform)),d.sheenRoughnessMap&&(p.sheenRoughnessMap.value=d.sheenRoughnessMap,t(d.sheenRoughnessMap,p.sheenRoughnessMapTransform))),d.clearcoat>0&&(p.clearcoat.value=d.clearcoat,p.clearcoatRoughness.value=d.clearcoatRoughness,d.clearcoatMap&&(p.clearcoatMap.value=d.clearcoatMap,t(d.clearcoatMap,p.clearcoatMapTransform)),d.clearcoatRoughnessMap&&(p.clearcoatRoughnessMap.value=d.clearcoatRoughnessMap,t(d.clearcoatRoughnessMap,p.clearcoatRoughnessMapTransform)),d.clearcoatNormalMap&&(p.clearcoatNormalMap.value=d.clearcoatNormalMap,t(d.clearcoatNormalMap,p.clearcoatNormalMapTransform),p.clearcoatNormalScale.value.copy(d.clearcoatNormalScale),d.side===wt&&p.clearcoatNormalScale.value.negate())),d.iridescence>0&&(p.iridescence.value=d.iridescence,p.iridescenceIOR.value=d.iridescenceIOR,p.iridescenceThicknessMinimum.value=d.iridescenceThicknessRange[0],p.iridescenceThicknessMaximum.value=d.iridescenceThicknessRange[1],d.iridescenceMap&&(p.iridescenceMap.value=d.iridescenceMap,t(d.iridescenceMap,p.iridescenceMapTransform)),d.iridescenceThicknessMap&&(p.iridescenceThicknessMap.value=d.iridescenceThicknessMap,t(d.iridescenceThicknessMap,p.iridescenceThicknessMapTransform))),d.transmission>0&&(p.transmission.value=d.transmission,p.transmissionSamplerMap.value=b.texture,p.transmissionSamplerSize.value.set(b.width,b.height),d.transmissionMap&&(p.transmissionMap.value=d.transmissionMap,t(d.transmissionMap,p.transmissionMapTransform)),p.thickness.value=d.thickness,d.thicknessMap&&(p.thicknessMap.value=d.thicknessMap,t(d.thicknessMap,p.thicknessMapTransform)),p.attenuationDistance.value=d.attenuationDistance,p.attenuationColor.value.copy(d.attenuationColor)),d.anisotropy>0&&(p.anisotropyVector.value.set(d.anisotropy*Math.cos(d.anisotropyRotation),d.anisotropy*Math.sin(d.anisotropyRotation)),d.anisotropyMap&&(p.anisotropyMap.value=d.anisotropyMap,t(d.anisotropyMap,p.anisotropyMapTransform))),p.specularIntensity.value=d.specularIntensity,p.specularColor.value.copy(d.specularColor),d.specularColorMap&&(p.specularColorMap.value=d.specularColorMap,t(d.specularColorMap,p.specularColorMapTransform)),d.specularIntensityMap&&(p.specularIntensityMap.value=d.specularIntensityMap,t(d.specularIntensityMap,p.specularIntensityMapTransform))}function g(p,d){d.matcap&&(p.matcap.value=d.matcap)}function x(p,d){let b=e.get(d).light;p.referencePosition.value.setFromMatrixPosition(b.matrixWorld),p.nearDistance.value=b.shadow.camera.near,p.farDistance.value=b.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:r}}function Gy(n,e,t,i){let r={},s={},o=[],a=t.isWebGL2?n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS):0;function c(b,v){let T=v.program;i.uniformBlockBinding(b,T)}function l(b,v){let T=r[b.id];T===void 0&&(g(b),T=u(b),r[b.id]=T,b.addEventListener("dispose",p));let I=v.program;i.updateUBOMapping(b,I);let R=e.render.frame;s[b.id]!==R&&(f(b),s[b.id]=R)}function u(b){let v=h();b.__bindingPointIndex=v;let T=n.createBuffer(),I=b.__size,R=b.usage;return n.bindBuffer(n.UNIFORM_BUFFER,T),n.bufferData(n.UNIFORM_BUFFER,I,R),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,v,T),T}function h(){for(let b=0;b<a;b++)if(o.indexOf(b)===-1)return o.push(b),b;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function f(b){let v=r[b.id],T=b.uniforms,I=b.__cache;n.bindBuffer(n.UNIFORM_BUFFER,v);for(let R=0,A=T.length;R<A;R++){let B=Array.isArray(T[R])?T[R]:[T[R]];for(let j=0,y=B.length;j<y;j++){let E=B[j];if(m(E,R,j,I)===!0){let ie=E.__offset,K=Array.isArray(E.value)?E.value:[E.value],C=0;for(let H=0;H<K.length;H++){let G=K[H],Y=x(G);typeof G=="number"||typeof G=="boolean"?(E.__data[0]=G,n.bufferSubData(n.UNIFORM_BUFFER,ie+C,E.__data)):G.isMatrix3?(E.__data[0]=G.elements[0],E.__data[1]=G.elements[1],E.__data[2]=G.elements[2],E.__data[3]=0,E.__data[4]=G.elements[3],E.__data[5]=G.elements[4],E.__data[6]=G.elements[5],E.__data[7]=0,E.__data[8]=G.elements[6],E.__data[9]=G.elements[7],E.__data[10]=G.elements[8],E.__data[11]=0):(G.toArray(E.__data,C),C+=Y.storage/Float32Array.BYTES_PER_ELEMENT)}n.bufferSubData(n.UNIFORM_BUFFER,ie,E.__data)}}}n.bindBuffer(n.UNIFORM_BUFFER,null)}function m(b,v,T,I){let R=b.value,A=v+"_"+T;if(I[A]===void 0)return typeof R=="number"||typeof R=="boolean"?I[A]=R:I[A]=R.clone(),!0;{let B=I[A];if(typeof R=="number"||typeof R=="boolean"){if(B!==R)return I[A]=R,!0}else if(B.equals(R)===!1)return B.copy(R),!0}return!1}function g(b){let v=b.uniforms,T=0,I=16;for(let A=0,B=v.length;A<B;A++){let j=Array.isArray(v[A])?v[A]:[v[A]];for(let y=0,E=j.length;y<E;y++){let ie=j[y],K=Array.isArray(ie.value)?ie.value:[ie.value];for(let C=0,H=K.length;C<H;C++){let G=K[C],Y=x(G),W=T%I;W!==0&&I-W<Y.boundary&&(T+=I-W),ie.__data=new Float32Array(Y.storage/Float32Array.BYTES_PER_ELEMENT),ie.__offset=T,T+=Y.storage}}}let R=T%I;return R>0&&(T+=I-R),b.__size=T,b.__cache={},this}function x(b){let v={boundary:0,storage:0};return typeof b=="number"||typeof b=="boolean"?(v.boundary=4,v.storage=4):b.isVector2?(v.boundary=8,v.storage=8):b.isVector3||b.isColor?(v.boundary=16,v.storage=12):b.isVector4?(v.boundary=16,v.storage=16):b.isMatrix3?(v.boundary=48,v.storage=48):b.isMatrix4?(v.boundary=64,v.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),v}function p(b){let v=b.target;v.removeEventListener("dispose",p);let T=o.indexOf(v.__bindingPointIndex);o.splice(T,1),n.deleteBuffer(r[v.id]),delete r[v.id],delete s[v.id]}function d(){for(let b in r)n.deleteBuffer(r[b]);o=[],r={},s={}}return{bind:c,update:l,dispose:d}}var _o=class{constructor(e={}){let{canvas:t=Wg(),context:i=null,depth:r=!0,stencil:s=!0,alpha:o=!1,antialias:a=!1,premultipliedAlpha:c=!0,preserveDrawingBuffer:l=!1,powerPreference:u="default",failIfMajorPerformanceCaveat:h=!1}=e;this.isWebGLRenderer=!0;let f;i!==null?f=i.getContextAttributes().alpha:f=o;let m=new Uint32Array(4),g=new Int32Array(4),x=null,p=null,d=[],b=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=Jt,this._useLegacyLights=!1,this.toneMapping=wn,this.toneMappingExposure=1;let v=this,T=!1,I=0,R=0,A=null,B=-1,j=null,y=new ht,E=new ht,ie=null,K=new Xe(0),C=0,H=t.width,G=t.height,Y=1,W=null,q=null,ne=new ht(0,0,H,G),te=new ht(0,0,H,G),_e=!1,Ie=new ls,z=!1,Q=!1,me=null,Te=new st,Me=new ue,xe=new L,ke={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function we(){return A===null?Y:1}let w=i;function ae(M,U){for(let O=0;O<M.length;O++){let F=M[O],D=t.getContext(F,U);if(D!==null)return D}return null}try{let M={alpha:!0,depth:r,stencil:s,antialias:a,premultipliedAlpha:c,preserveDrawingBuffer:l,powerPreference:u,failIfMajorPerformanceCaveat:h};if("setAttribute"in t&&t.setAttribute("data-engine",\`three.js r\${Bo}\`),t.addEventListener("webglcontextlost",Ke,!1),t.addEventListener("webglcontextrestored",P,!1),t.addEventListener("webglcontextcreationerror",fe,!1),w===null){let U=["webgl2","webgl","experimental-webgl"];if(v.isWebGL1Renderer===!0&&U.shift(),w=ae(U,M),w===null)throw ae(U)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext!="undefined"&&w instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),w.getShaderPrecisionFormat===void 0&&(w.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(M){throw console.error("THREE.WebGLRenderer: "+M.message),M}let X,re,Z,ve,pe,ye,Ve,S,_,k,V,ee,J,Le,Re,ce,he,Ue,se,it,He,Ae,Se,be;function qe(){X=new ix(w),re=new K0(w,X,e),X.init(re),Ae=new Ny(w,X,re),Z=new Uy(w,X,re),ve=new ax(w),pe=new My,ye=new Dy(w,X,Z,pe,re,Ae,ve),Ve=new Q0(v),S=new nx(v),_=new f_(w,re),Se=new Z0(w,X,_,re),k=new rx(w,_,ve,Se),V=new ux(w,k,_,ve),se=new lx(w,re,ye),ce=new j0(pe),ee=new yy(v,Ve,S,X,re,Se,ce),J=new ky(v,pe),Le=new by,Re=new Cy(X,re),Ue=new $0(v,Ve,S,Z,V,f,c),he=new Ly(v,V,re),be=new Gy(w,ve,re,Z),it=new J0(w,X,ve,re),He=new sx(w,X,ve,re),ve.programs=ee.programs,v.capabilities=re,v.extensions=X,v.properties=pe,v.renderLists=Le,v.shadowMap=he,v.state=Z,v.info=ve}qe();let Ne=new go(v,w);this.xr=Ne,this.getContext=function(){return w},this.getContextAttributes=function(){return w.getContextAttributes()},this.forceContextLoss=function(){let M=X.get("WEBGL_lose_context");M&&M.loseContext()},this.forceContextRestore=function(){let M=X.get("WEBGL_lose_context");M&&M.restoreContext()},this.getPixelRatio=function(){return Y},this.setPixelRatio=function(M){M!==void 0&&(Y=M,this.setSize(H,G,!1))},this.getSize=function(M){return M.set(H,G)},this.setSize=function(M,U,O=!0){if(Ne.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}H=M,G=U,t.width=Math.floor(M*Y),t.height=Math.floor(U*Y),O===!0&&(t.style.width=M+"px",t.style.height=U+"px"),this.setViewport(0,0,M,U)},this.getDrawingBufferSize=function(M){return M.set(H*Y,G*Y).floor()},this.setDrawingBufferSize=function(M,U,O){H=M,G=U,Y=O,t.width=Math.floor(M*O),t.height=Math.floor(U*O),this.setViewport(0,0,M,U)},this.getCurrentViewport=function(M){return M.copy(y)},this.getViewport=function(M){return M.copy(ne)},this.setViewport=function(M,U,O,F){M.isVector4?ne.set(M.x,M.y,M.z,M.w):ne.set(M,U,O,F),Z.viewport(y.copy(ne).multiplyScalar(Y).round())},this.getScissor=function(M){return M.copy(te)},this.setScissor=function(M,U,O,F){M.isVector4?te.set(M.x,M.y,M.z,M.w):te.set(M,U,O,F),Z.scissor(E.copy(te).multiplyScalar(Y).round())},this.getScissorTest=function(){return _e},this.setScissorTest=function(M){Z.setScissorTest(_e=M)},this.setOpaqueSort=function(M){W=M},this.setTransparentSort=function(M){q=M},this.getClearColor=function(M){return M.copy(Ue.getClearColor())},this.setClearColor=function(){Ue.setClearColor.apply(Ue,arguments)},this.getClearAlpha=function(){return Ue.getClearAlpha()},this.setClearAlpha=function(){Ue.setClearAlpha.apply(Ue,arguments)},this.clear=function(M=!0,U=!0,O=!0){let F=0;if(M){let D=!1;if(A!==null){let ge=A.texture.format;D=ge===Ku||ge===Ju||ge===Zu}if(D){let ge=A.texture.type,Ee=ge===An||ge===En||ge===zo||ge===$n||ge===Yu||ge===$u,Ce=Ue.getClearColor(),Pe=Ue.getClearAlpha(),Ge=Ce.r,De=Ce.g,Oe=Ce.b;Ee?(m[0]=Ge,m[1]=De,m[2]=Oe,m[3]=Pe,w.clearBufferuiv(w.COLOR,0,m)):(g[0]=Ge,g[1]=De,g[2]=Oe,g[3]=Pe,w.clearBufferiv(w.COLOR,0,g))}else F|=w.COLOR_BUFFER_BIT}U&&(F|=w.DEPTH_BUFFER_BIT),O&&(F|=w.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),w.clear(F)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",Ke,!1),t.removeEventListener("webglcontextrestored",P,!1),t.removeEventListener("webglcontextcreationerror",fe,!1),Le.dispose(),Re.dispose(),pe.dispose(),Ve.dispose(),S.dispose(),V.dispose(),Se.dispose(),be.dispose(),ee.dispose(),Ne.dispose(),Ne.removeEventListener("sessionstart",Lt),Ne.removeEventListener("sessionend",Ze),me&&(me.dispose(),me=null),xt.stop()};function Ke(M){M.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),T=!0}function P(){console.log("THREE.WebGLRenderer: Context Restored."),T=!1;let M=ve.autoReset,U=he.enabled,O=he.autoUpdate,F=he.needsUpdate,D=he.type;qe(),ve.autoReset=M,he.enabled=U,he.autoUpdate=O,he.needsUpdate=F,he.type=D}function fe(M){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",M.statusMessage)}function N(M){let U=M.target;U.removeEventListener("dispose",N),oe(U)}function oe(M){de(M),pe.remove(M)}function de(M){let U=pe.get(M).programs;U!==void 0&&(U.forEach(function(O){ee.releaseProgram(O)}),M.isShaderMaterial&&ee.releaseShaderCache(M))}this.renderBufferDirect=function(M,U,O,F,D,ge){U===null&&(U=ke);let Ee=D.isMesh&&D.matrixWorld.determinant()<0,Ce=Um(M,U,O,F,D);Z.setMaterial(F,Ee);let Pe=O.index,Ge=1;if(F.wireframe===!0){if(Pe=k.getWireframeAttribute(O),Pe===void 0)return;Ge=2}let De=O.drawRange,Oe=O.attributes.position,nt=De.start*Ge,Rt=(De.start+De.count)*Ge;ge!==null&&(nt=Math.max(nt,ge.start*Ge),Rt=Math.min(Rt,(ge.start+ge.count)*Ge)),Pe!==null?(nt=Math.max(nt,0),Rt=Math.min(Rt,Pe.count)):Oe!=null&&(nt=Math.max(nt,0),Rt=Math.min(Rt,Oe.count));let ct=Rt-nt;if(ct<0||ct===1/0)return;Se.setup(D,F,Ce,O,Pe);let tn,et=it;if(Pe!==null&&(tn=_.get(Pe),et=He,et.setIndex(tn)),D.isMesh)F.wireframe===!0?(Z.setLineWidth(F.wireframeLinewidth*we()),et.setMode(w.LINES)):et.setMode(w.TRIANGLES);else if(D.isLine){let Fe=F.linewidth;Fe===void 0&&(Fe=1),Z.setLineWidth(Fe*we()),D.isLineSegments?et.setMode(w.LINES):D.isLineLoop?et.setMode(w.LINE_LOOP):et.setMode(w.LINE_STRIP)}else D.isPoints?et.setMode(w.POINTS):D.isSprite&&et.setMode(w.TRIANGLES);if(D.isBatchedMesh)et.renderMultiDraw(D._multiDrawStarts,D._multiDrawCounts,D._multiDrawCount);else if(D.isInstancedMesh)et.renderInstances(nt,ct,D.count);else if(O.isInstancedBufferGeometry){let Fe=O._maxInstanceCount!==void 0?O._maxInstanceCount:1/0,ra=Math.min(O.instanceCount,Fe);et.renderInstances(nt,ct,ra)}else et.render(nt,ct)};function We(M,U,O){M.transparent===!0&&M.side===un&&M.forceSinglePass===!1?(M.side=wt,M.needsUpdate=!0,vr(M,U,O),M.side=Cn,M.needsUpdate=!0,vr(M,U,O),M.side=un):vr(M,U,O)}this.compile=function(M,U,O=null){O===null&&(O=M),p=Re.get(O),p.init(),b.push(p),O.traverseVisible(function(D){D.isLight&&D.layers.test(U.layers)&&(p.pushLight(D),D.castShadow&&p.pushShadow(D))}),M!==O&&M.traverseVisible(function(D){D.isLight&&D.layers.test(U.layers)&&(p.pushLight(D),D.castShadow&&p.pushShadow(D))}),p.setupLights(v._useLegacyLights);let F=new Set;return M.traverse(function(D){let ge=D.material;if(ge)if(Array.isArray(ge))for(let Ee=0;Ee<ge.length;Ee++){let Ce=ge[Ee];We(Ce,O,D),F.add(Ce)}else We(ge,O,D),F.add(ge)}),b.pop(),p=null,F},this.compileAsync=function(M,U,O=null){let F=this.compile(M,U,O);return new Promise(D=>{function ge(){if(F.forEach(function(Ee){pe.get(Ee).currentProgram.isReady()&&F.delete(Ee)}),F.size===0){D(M);return}setTimeout(ge,10)}X.get("KHR_parallel_shader_compile")!==null?ge():setTimeout(ge,10)})};let $e=null;function ut(M){$e&&$e(M)}function Lt(){xt.stop()}function Ze(){xt.start()}let xt=new ih;xt.setAnimationLoop(ut),typeof self!="undefined"&&xt.setContext(self),this.setAnimationLoop=function(M){$e=M,Ne.setAnimationLoop(M),M===null?xt.stop():xt.start()},Ne.addEventListener("sessionstart",Lt),Ne.addEventListener("sessionend",Ze),this.render=function(M,U){if(U!==void 0&&U.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(T===!0)return;M.matrixWorldAutoUpdate===!0&&M.updateMatrixWorld(),U.parent===null&&U.matrixWorldAutoUpdate===!0&&U.updateMatrixWorld(),Ne.enabled===!0&&Ne.isPresenting===!0&&(Ne.cameraAutoUpdate===!0&&Ne.updateCamera(U),U=Ne.getCamera()),M.isScene===!0&&M.onBeforeRender(v,M,U,A),p=Re.get(M,b.length),p.init(),b.push(p),Te.multiplyMatrices(U.projectionMatrix,U.matrixWorldInverse),Ie.setFromProjectionMatrix(Te),Q=this.localClippingEnabled,z=ce.init(this.clippingPlanes,Q),x=Le.get(M,d.length),x.init(),d.push(x),Zt(M,U,0,v.sortObjects),x.finish(),v.sortObjects===!0&&x.sort(W,q),this.info.render.frame++,z===!0&&ce.beginShadows();let O=p.state.shadowsArray;if(he.render(O,M,U),z===!0&&ce.endShadows(),this.info.autoReset===!0&&this.info.reset(),(Ne.enabled===!1||Ne.isPresenting===!1||Ne.hasDepthSensing()===!1)&&Ue.render(x,M),p.setupLights(v._useLegacyLights),U.isArrayCamera){let F=U.cameras;for(let D=0,ge=F.length;D<ge;D++){let Ee=F[D];cl(x,M,Ee,Ee.viewport)}}else cl(x,M,U);A!==null&&(ye.updateMultisampleRenderTarget(A),ye.updateRenderTargetMipmap(A)),M.isScene===!0&&M.onAfterRender(v,M,U),Se.resetDefaultState(),B=-1,j=null,b.pop(),b.length>0?p=b[b.length-1]:p=null,d.pop(),d.length>0?x=d[d.length-1]:x=null};function Zt(M,U,O,F){if(M.visible===!1)return;if(M.layers.test(U.layers)){if(M.isGroup)O=M.renderOrder;else if(M.isLOD)M.autoUpdate===!0&&M.update(U);else if(M.isLight)p.pushLight(M),M.castShadow&&p.pushShadow(M);else if(M.isSprite){if(!M.frustumCulled||Ie.intersectsSprite(M)){F&&xe.setFromMatrixPosition(M.matrixWorld).applyMatrix4(Te);let Ee=V.update(M),Ce=M.material;Ce.visible&&x.push(M,Ee,Ce,O,xe.z,null)}}else if((M.isMesh||M.isLine||M.isPoints)&&(!M.frustumCulled||Ie.intersectsObject(M))){let Ee=V.update(M),Ce=M.material;if(F&&(M.boundingSphere!==void 0?(M.boundingSphere===null&&M.computeBoundingSphere(),xe.copy(M.boundingSphere.center)):(Ee.boundingSphere===null&&Ee.computeBoundingSphere(),xe.copy(Ee.boundingSphere.center)),xe.applyMatrix4(M.matrixWorld).applyMatrix4(Te)),Array.isArray(Ce)){let Pe=Ee.groups;for(let Ge=0,De=Pe.length;Ge<De;Ge++){let Oe=Pe[Ge],nt=Ce[Oe.materialIndex];nt&&nt.visible&&x.push(M,Ee,nt,O,xe.z,Oe)}}else Ce.visible&&x.push(M,Ee,Ce,O,xe.z,null)}}let ge=M.children;for(let Ee=0,Ce=ge.length;Ee<Ce;Ee++)Zt(ge[Ee],U,O,F)}function cl(M,U,O,F){let D=M.opaque,ge=M.transmissive,Ee=M.transparent;p.setupLightsView(O),z===!0&&ce.setGlobalState(v.clippingPlanes,O),ge.length>0&&Lm(D,ge,U,O),F&&Z.viewport(y.copy(F)),D.length>0&&_r(D,U,O),ge.length>0&&_r(ge,U,O),Ee.length>0&&_r(Ee,U,O),Z.buffers.depth.setTest(!0),Z.buffers.depth.setMask(!0),Z.buffers.color.setMask(!0),Z.setPolygonOffset(!1)}function Lm(M,U,O,F){if((O.isScene===!0?O.overrideMaterial:null)!==null)return;let ge=re.isWebGL2;me===null&&(me=new dn(1,1,{generateMipmaps:!0,type:X.has("EXT_color_buffer_half_float")?Ki:An,minFilter:Xn,samples:ge?4:0})),v.getDrawingBufferSize(Me),ge?me.setSize(Me.x,Me.y):me.setSize(ja(Me.x),ja(Me.y));let Ee=v.getRenderTarget();v.setRenderTarget(me),v.getClearColor(K),C=v.getClearAlpha(),C<1&&v.setClearColor(16777215,.5),v.clear();let Ce=v.toneMapping;v.toneMapping=wn,_r(M,O,F),ye.updateMultisampleRenderTarget(me),ye.updateRenderTargetMipmap(me);let Pe=!1;for(let Ge=0,De=U.length;Ge<De;Ge++){let Oe=U[Ge],nt=Oe.object,Rt=Oe.geometry,ct=Oe.material,tn=Oe.group;if(ct.side===un&&nt.layers.test(F.layers)){let et=ct.side;ct.side=wt,ct.needsUpdate=!0,ll(nt,O,F,Rt,ct,tn),ct.side=et,ct.needsUpdate=!0,Pe=!0}}Pe===!0&&(ye.updateMultisampleRenderTarget(me),ye.updateRenderTargetMipmap(me)),v.setRenderTarget(Ee),v.setClearColor(K,C),v.toneMapping=Ce}function _r(M,U,O){let F=U.isScene===!0?U.overrideMaterial:null;for(let D=0,ge=M.length;D<ge;D++){let Ee=M[D],Ce=Ee.object,Pe=Ee.geometry,Ge=F===null?Ee.material:F,De=Ee.group;Ce.layers.test(O.layers)&&ll(Ce,U,O,Pe,Ge,De)}}function ll(M,U,O,F,D,ge){M.onBeforeRender(v,U,O,F,D,ge),M.modelViewMatrix.multiplyMatrices(O.matrixWorldInverse,M.matrixWorld),M.normalMatrix.getNormalMatrix(M.modelViewMatrix),D.onBeforeRender(v,U,O,F,M,ge),D.transparent===!0&&D.side===un&&D.forceSinglePass===!1?(D.side=wt,D.needsUpdate=!0,v.renderBufferDirect(O,U,F,D,M,ge),D.side=Cn,D.needsUpdate=!0,v.renderBufferDirect(O,U,F,D,M,ge),D.side=un):v.renderBufferDirect(O,U,F,D,M,ge),M.onAfterRender(v,U,O,F,D,ge)}function vr(M,U,O){U.isScene!==!0&&(U=ke);let F=pe.get(M),D=p.state.lights,ge=p.state.shadowsArray,Ee=D.state.version,Ce=ee.getParameters(M,D.state,ge,U,O),Pe=ee.getProgramCacheKey(Ce),Ge=F.programs;F.environment=M.isMeshStandardMaterial?U.environment:null,F.fog=U.fog,F.envMap=(M.isMeshStandardMaterial?S:Ve).get(M.envMap||F.environment),F.envMapRotation=F.environment!==null&&M.envMap===null?U.environmentRotation:M.envMapRotation,Ge===void 0&&(M.addEventListener("dispose",N),Ge=new Map,F.programs=Ge);let De=Ge.get(Pe);if(De!==void 0){if(F.currentProgram===De&&F.lightsStateVersion===Ee)return hl(M,Ce),De}else Ce.uniforms=ee.getUniforms(M),M.onBuild(O,Ce,v),M.onBeforeCompile(Ce,v),De=ee.acquireProgram(Ce,Pe),Ge.set(Pe,De),F.uniforms=Ce.uniforms;let Oe=F.uniforms;return(!M.isShaderMaterial&&!M.isRawShaderMaterial||M.clipping===!0)&&(Oe.clippingPlanes=ce.uniform),hl(M,Ce),F.needsLights=Nm(M),F.lightsStateVersion=Ee,F.needsLights&&(Oe.ambientLightColor.value=D.state.ambient,Oe.lightProbe.value=D.state.probe,Oe.directionalLights.value=D.state.directional,Oe.directionalLightShadows.value=D.state.directionalShadow,Oe.spotLights.value=D.state.spot,Oe.spotLightShadows.value=D.state.spotShadow,Oe.rectAreaLights.value=D.state.rectArea,Oe.ltc_1.value=D.state.rectAreaLTC1,Oe.ltc_2.value=D.state.rectAreaLTC2,Oe.pointLights.value=D.state.point,Oe.pointLightShadows.value=D.state.pointShadow,Oe.hemisphereLights.value=D.state.hemi,Oe.directionalShadowMap.value=D.state.directionalShadowMap,Oe.directionalShadowMatrix.value=D.state.directionalShadowMatrix,Oe.spotShadowMap.value=D.state.spotShadowMap,Oe.spotLightMatrix.value=D.state.spotLightMatrix,Oe.spotLightMap.value=D.state.spotLightMap,Oe.pointShadowMap.value=D.state.pointShadowMap,Oe.pointShadowMatrix.value=D.state.pointShadowMatrix),F.currentProgram=De,F.uniformsList=null,De}function ul(M){if(M.uniformsList===null){let U=M.currentProgram.getUniforms();M.uniformsList=Ei.seqWithValue(U.seq,M.uniforms)}return M.uniformsList}function hl(M,U){let O=pe.get(M);O.outputColorSpace=U.outputColorSpace,O.batching=U.batching,O.instancing=U.instancing,O.instancingColor=U.instancingColor,O.instancingMorph=U.instancingMorph,O.skinning=U.skinning,O.morphTargets=U.morphTargets,O.morphNormals=U.morphNormals,O.morphColors=U.morphColors,O.morphTargetsCount=U.morphTargetsCount,O.numClippingPlanes=U.numClippingPlanes,O.numIntersection=U.numClipIntersection,O.vertexAlphas=U.vertexAlphas,O.vertexTangents=U.vertexTangents,O.toneMapping=U.toneMapping}function Um(M,U,O,F,D){U.isScene!==!0&&(U=ke),ye.resetTextureUnits();let ge=U.fog,Ee=F.isMeshStandardMaterial?U.environment:null,Ce=A===null?v.outputColorSpace:A.isXRRenderTarget===!0?A.texture.colorSpace:Ln,Pe=(F.isMeshStandardMaterial?S:Ve).get(F.envMap||Ee),Ge=F.vertexColors===!0&&!!O.attributes.color&&O.attributes.color.itemSize===4,De=!!O.attributes.tangent&&(!!F.normalMap||F.anisotropy>0),Oe=!!O.morphAttributes.position,nt=!!O.morphAttributes.normal,Rt=!!O.morphAttributes.color,ct=wn;F.toneMapped&&(A===null||A.isXRRenderTarget===!0)&&(ct=v.toneMapping);let tn=O.morphAttributes.position||O.morphAttributes.normal||O.morphAttributes.color,et=tn!==void 0?tn.length:0,Fe=pe.get(F),ra=p.state.lights;if(z===!0&&(Q===!0||M!==j)){let Ut=M===j&&F.id===B;ce.setState(F,M,Ut)}let je=!1;F.version===Fe.__version?(Fe.needsLights&&Fe.lightsStateVersion!==ra.state.version||Fe.outputColorSpace!==Ce||D.isBatchedMesh&&Fe.batching===!1||!D.isBatchedMesh&&Fe.batching===!0||D.isInstancedMesh&&Fe.instancing===!1||!D.isInstancedMesh&&Fe.instancing===!0||D.isSkinnedMesh&&Fe.skinning===!1||!D.isSkinnedMesh&&Fe.skinning===!0||D.isInstancedMesh&&Fe.instancingColor===!0&&D.instanceColor===null||D.isInstancedMesh&&Fe.instancingColor===!1&&D.instanceColor!==null||D.isInstancedMesh&&Fe.instancingMorph===!0&&D.morphTexture===null||D.isInstancedMesh&&Fe.instancingMorph===!1&&D.morphTexture!==null||Fe.envMap!==Pe||F.fog===!0&&Fe.fog!==ge||Fe.numClippingPlanes!==void 0&&(Fe.numClippingPlanes!==ce.numPlanes||Fe.numIntersection!==ce.numIntersection)||Fe.vertexAlphas!==Ge||Fe.vertexTangents!==De||Fe.morphTargets!==Oe||Fe.morphNormals!==nt||Fe.morphColors!==Rt||Fe.toneMapping!==ct||re.isWebGL2===!0&&Fe.morphTargetsCount!==et)&&(je=!0):(je=!0,Fe.__version=F.version);let Nn=Fe.currentProgram;je===!0&&(Nn=vr(F,U,D));let fl=!1,Gi=!1,sa=!1,pt=Nn.getUniforms(),On=Fe.uniforms;if(Z.useProgram(Nn.program)&&(fl=!0,Gi=!0,sa=!0),F.id!==B&&(B=F.id,Gi=!0),fl||j!==M){pt.setValue(w,"projectionMatrix",M.projectionMatrix),pt.setValue(w,"viewMatrix",M.matrixWorldInverse);let Ut=pt.map.cameraPosition;Ut!==void 0&&Ut.setValue(w,xe.setFromMatrixPosition(M.matrixWorld)),re.logarithmicDepthBuffer&&pt.setValue(w,"logDepthBufFC",2/(Math.log(M.far+1)/Math.LN2)),(F.isMeshPhongMaterial||F.isMeshToonMaterial||F.isMeshLambertMaterial||F.isMeshBasicMaterial||F.isMeshStandardMaterial||F.isShaderMaterial)&&pt.setValue(w,"isOrthographic",M.isOrthographicCamera===!0),j!==M&&(j=M,Gi=!0,sa=!0)}if(D.isSkinnedMesh){pt.setOptional(w,D,"bindMatrix"),pt.setOptional(w,D,"bindMatrixInverse");let Ut=D.skeleton;Ut&&(re.floatVertexTextures?(Ut.boneTexture===null&&Ut.computeBoneTexture(),pt.setValue(w,"boneTexture",Ut.boneTexture,ye)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}D.isBatchedMesh&&(pt.setOptional(w,D,"batchingTexture"),pt.setValue(w,"batchingTexture",D._matricesTexture,ye));let aa=O.morphAttributes;if((aa.position!==void 0||aa.normal!==void 0||aa.color!==void 0&&re.isWebGL2===!0)&&se.update(D,O,Nn),(Gi||Fe.receiveShadow!==D.receiveShadow)&&(Fe.receiveShadow=D.receiveShadow,pt.setValue(w,"receiveShadow",D.receiveShadow)),F.isMeshGouraudMaterial&&F.envMap!==null&&(On.envMap.value=Pe,On.flipEnvMap.value=Pe.isCubeTexture&&Pe.isRenderTargetTexture===!1?-1:1),Gi&&(pt.setValue(w,"toneMappingExposure",v.toneMappingExposure),Fe.needsLights&&Dm(On,sa),ge&&F.fog===!0&&J.refreshFogUniforms(On,ge),J.refreshMaterialUniforms(On,F,Y,G,me),Ei.upload(w,ul(Fe),On,ye)),F.isShaderMaterial&&F.uniformsNeedUpdate===!0&&(Ei.upload(w,ul(Fe),On,ye),F.uniformsNeedUpdate=!1),F.isSpriteMaterial&&pt.setValue(w,"center",D.center),pt.setValue(w,"modelViewMatrix",D.modelViewMatrix),pt.setValue(w,"normalMatrix",D.normalMatrix),pt.setValue(w,"modelMatrix",D.matrixWorld),F.isShaderMaterial||F.isRawShaderMaterial){let Ut=F.uniformsGroups;for(let oa=0,Om=Ut.length;oa<Om;oa++)if(re.isWebGL2){let dl=Ut[oa];be.update(dl,Nn),be.bind(dl,Nn)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return Nn}function Dm(M,U){M.ambientLightColor.needsUpdate=U,M.lightProbe.needsUpdate=U,M.directionalLights.needsUpdate=U,M.directionalLightShadows.needsUpdate=U,M.pointLights.needsUpdate=U,M.pointLightShadows.needsUpdate=U,M.spotLights.needsUpdate=U,M.spotLightShadows.needsUpdate=U,M.rectAreaLights.needsUpdate=U,M.hemisphereLights.needsUpdate=U}function Nm(M){return M.isMeshLambertMaterial||M.isMeshToonMaterial||M.isMeshPhongMaterial||M.isMeshStandardMaterial||M.isShadowMaterial||M.isShaderMaterial&&M.lights===!0}this.getActiveCubeFace=function(){return I},this.getActiveMipmapLevel=function(){return R},this.getRenderTarget=function(){return A},this.setRenderTargetTextures=function(M,U,O){pe.get(M.texture).__webglTexture=U,pe.get(M.depthTexture).__webglTexture=O;let F=pe.get(M);F.__hasExternalTextures=!0,F.__autoAllocateDepthBuffer=O===void 0,F.__autoAllocateDepthBuffer||X.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),F.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(M,U){let O=pe.get(M);O.__webglFramebuffer=U,O.__useDefaultFramebuffer=U===void 0},this.setRenderTarget=function(M,U=0,O=0){A=M,I=U,R=O;let F=!0,D=null,ge=!1,Ee=!1;if(M){let Pe=pe.get(M);Pe.__useDefaultFramebuffer!==void 0?(Z.bindFramebuffer(w.FRAMEBUFFER,null),F=!1):Pe.__webglFramebuffer===void 0?ye.setupRenderTarget(M):Pe.__hasExternalTextures&&ye.rebindTextures(M,pe.get(M.texture).__webglTexture,pe.get(M.depthTexture).__webglTexture);let Ge=M.texture;(Ge.isData3DTexture||Ge.isDataArrayTexture||Ge.isCompressedArrayTexture)&&(Ee=!0);let De=pe.get(M).__webglFramebuffer;M.isWebGLCubeRenderTarget?(Array.isArray(De[U])?D=De[U][O]:D=De[U],ge=!0):re.isWebGL2&&M.samples>0&&ye.useMultisampledRTT(M)===!1?D=pe.get(M).__webglMultisampledFramebuffer:Array.isArray(De)?D=De[O]:D=De,y.copy(M.viewport),E.copy(M.scissor),ie=M.scissorTest}else y.copy(ne).multiplyScalar(Y).floor(),E.copy(te).multiplyScalar(Y).floor(),ie=_e;if(Z.bindFramebuffer(w.FRAMEBUFFER,D)&&re.drawBuffers&&F&&Z.drawBuffers(M,D),Z.viewport(y),Z.scissor(E),Z.setScissorTest(ie),ge){let Pe=pe.get(M.texture);w.framebufferTexture2D(w.FRAMEBUFFER,w.COLOR_ATTACHMENT0,w.TEXTURE_CUBE_MAP_POSITIVE_X+U,Pe.__webglTexture,O)}else if(Ee){let Pe=pe.get(M.texture),Ge=U||0;w.framebufferTextureLayer(w.FRAMEBUFFER,w.COLOR_ATTACHMENT0,Pe.__webglTexture,O||0,Ge)}B=-1},this.readRenderTargetPixels=function(M,U,O,F,D,ge,Ee){if(!(M&&M.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ce=pe.get(M).__webglFramebuffer;if(M.isWebGLCubeRenderTarget&&Ee!==void 0&&(Ce=Ce[Ee]),Ce){Z.bindFramebuffer(w.FRAMEBUFFER,Ce);try{let Pe=M.texture,Ge=Pe.format,De=Pe.type;if(Ge!==Gt&&Ae.convert(Ge)!==w.getParameter(w.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let Oe=De===Ki&&(X.has("EXT_color_buffer_half_float")||re.isWebGL2&&X.has("EXT_color_buffer_float"));if(De!==An&&Ae.convert(De)!==w.getParameter(w.IMPLEMENTATION_COLOR_READ_TYPE)&&!(De===hn&&(re.isWebGL2||X.has("OES_texture_float")||X.has("WEBGL_color_buffer_float")))&&!Oe){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}U>=0&&U<=M.width-F&&O>=0&&O<=M.height-D&&w.readPixels(U,O,F,D,Ae.convert(Ge),Ae.convert(De),ge)}finally{let Pe=A!==null?pe.get(A).__webglFramebuffer:null;Z.bindFramebuffer(w.FRAMEBUFFER,Pe)}}},this.copyFramebufferToTexture=function(M,U,O=0){let F=Math.pow(2,-O),D=Math.floor(U.image.width*F),ge=Math.floor(U.image.height*F);ye.setTexture2D(U,0),w.copyTexSubImage2D(w.TEXTURE_2D,O,0,0,M.x,M.y,D,ge),Z.unbindTexture()},this.copyTextureToTexture=function(M,U,O,F=0){let D=U.image.width,ge=U.image.height,Ee=Ae.convert(O.format),Ce=Ae.convert(O.type);ye.setTexture2D(O,0),w.pixelStorei(w.UNPACK_FLIP_Y_WEBGL,O.flipY),w.pixelStorei(w.UNPACK_PREMULTIPLY_ALPHA_WEBGL,O.premultiplyAlpha),w.pixelStorei(w.UNPACK_ALIGNMENT,O.unpackAlignment),U.isDataTexture?w.texSubImage2D(w.TEXTURE_2D,F,M.x,M.y,D,ge,Ee,Ce,U.image.data):U.isCompressedTexture?w.compressedTexSubImage2D(w.TEXTURE_2D,F,M.x,M.y,U.mipmaps[0].width,U.mipmaps[0].height,Ee,U.mipmaps[0].data):w.texSubImage2D(w.TEXTURE_2D,F,M.x,M.y,Ee,Ce,U.image),F===0&&O.generateMipmaps&&w.generateMipmap(w.TEXTURE_2D),Z.unbindTexture()},this.copyTextureToTexture3D=function(M,U,O,F,D=0){if(v.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let ge=Math.round(M.max.x-M.min.x),Ee=Math.round(M.max.y-M.min.y),Ce=M.max.z-M.min.z+1,Pe=Ae.convert(F.format),Ge=Ae.convert(F.type),De;if(F.isData3DTexture)ye.setTexture3D(F,0),De=w.TEXTURE_3D;else if(F.isDataArrayTexture||F.isCompressedArrayTexture)ye.setTexture2DArray(F,0),De=w.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}w.pixelStorei(w.UNPACK_FLIP_Y_WEBGL,F.flipY),w.pixelStorei(w.UNPACK_PREMULTIPLY_ALPHA_WEBGL,F.premultiplyAlpha),w.pixelStorei(w.UNPACK_ALIGNMENT,F.unpackAlignment);let Oe=w.getParameter(w.UNPACK_ROW_LENGTH),nt=w.getParameter(w.UNPACK_IMAGE_HEIGHT),Rt=w.getParameter(w.UNPACK_SKIP_PIXELS),ct=w.getParameter(w.UNPACK_SKIP_ROWS),tn=w.getParameter(w.UNPACK_SKIP_IMAGES),et=O.isCompressedTexture?O.mipmaps[D]:O.image;w.pixelStorei(w.UNPACK_ROW_LENGTH,et.width),w.pixelStorei(w.UNPACK_IMAGE_HEIGHT,et.height),w.pixelStorei(w.UNPACK_SKIP_PIXELS,M.min.x),w.pixelStorei(w.UNPACK_SKIP_ROWS,M.min.y),w.pixelStorei(w.UNPACK_SKIP_IMAGES,M.min.z),O.isDataTexture||O.isData3DTexture?w.texSubImage3D(De,D,U.x,U.y,U.z,ge,Ee,Ce,Pe,Ge,et.data):F.isCompressedArrayTexture?w.compressedTexSubImage3D(De,D,U.x,U.y,U.z,ge,Ee,Ce,Pe,et.data):w.texSubImage3D(De,D,U.x,U.y,U.z,ge,Ee,Ce,Pe,Ge,et),w.pixelStorei(w.UNPACK_ROW_LENGTH,Oe),w.pixelStorei(w.UNPACK_IMAGE_HEIGHT,nt),w.pixelStorei(w.UNPACK_SKIP_PIXELS,Rt),w.pixelStorei(w.UNPACK_SKIP_ROWS,ct),w.pixelStorei(w.UNPACK_SKIP_IMAGES,tn),D===0&&F.generateMipmaps&&w.generateMipmap(De),Z.unbindTexture()},this.initTexture=function(M){M.isCubeTexture?ye.setTextureCube(M,0):M.isData3DTexture?ye.setTexture3D(M,0):M.isDataArrayTexture||M.isCompressedArrayTexture?ye.setTexture2DArray(M,0):ye.setTexture2D(M,0),Z.unbindTexture()},this.resetState=function(){I=0,R=0,A=null,Z.reset(),Se.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return fn}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;let t=this.getContext();t.drawingBufferColorSpace=e===ko?"display-p3":"srgb",t.unpackColorSpace=Ye.workingColorSpace===ys?"display-p3":"srgb"}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(e){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=e}},vo=class extends _o{};vo.prototype.isWebGL1Renderer=!0;var Ot=class{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){let i=this.getUtoTmapping(e);return this.getPoint(i,t)}getPoints(e=5){let t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return t}getSpacedPoints(e=5){let t=[];for(let i=0;i<=e;i++)t.push(this.getPointAt(i/e));return t}getLength(){let 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;let t=[],i,r=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)i=this.getPoint(o/e),s+=i.distanceTo(r),t.push(s),r=i;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){let i=this.getLengths(),r=0,s=i.length,o;t?o=t:o=e*i[s-1];let a=0,c=s-1,l;for(;a<=c;)if(r=Math.floor(a+(c-a)/2),l=i[r]-o,l<0)a=r+1;else if(l>0)c=r-1;else{c=r;break}if(r=c,i[r]===o)return r/(s-1);let u=i[r],f=i[r+1]-u,m=(o-u)/f;return(r+m)/(s-1)}getTangent(e,t){let r=e-1e-4,s=e+1e-4;r<0&&(r=0),s>1&&(s=1);let o=this.getPoint(r),a=this.getPoint(s),c=t||(o.isVector2?new ue:new L);return c.copy(a).sub(o).normalize(),c}getTangentAt(e,t){let i=this.getUtoTmapping(e);return this.getTangent(i,t)}computeFrenetFrames(e,t){let i=new L,r=[],s=[],o=[],a=new L,c=new st;for(let m=0;m<=e;m++){let g=m/e;r[m]=this.getTangentAt(g,new L)}s[0]=new L,o[0]=new L;let l=Number.MAX_VALUE,u=Math.abs(r[0].x),h=Math.abs(r[0].y),f=Math.abs(r[0].z);u<=l&&(l=u,i.set(1,0,0)),h<=l&&(l=h,i.set(0,1,0)),f<=l&&i.set(0,0,1),a.crossVectors(r[0],i).normalize(),s[0].crossVectors(r[0],a),o[0].crossVectors(r[0],s[0]);for(let m=1;m<=e;m++){if(s[m]=s[m-1].clone(),o[m]=o[m-1].clone(),a.crossVectors(r[m-1],r[m]),a.length()>Number.EPSILON){a.normalize();let g=Math.acos(_t(r[m-1].dot(r[m]),-1,1));s[m].applyMatrix4(c.makeRotationAxis(a,g))}o[m].crossVectors(r[m],s[m])}if(t===!0){let m=Math.acos(_t(s[0].dot(s[e]),-1,1));m/=e,r[0].dot(a.crossVectors(s[0],s[e]))>0&&(m=-m);for(let g=1;g<=e;g++)s[g].applyMatrix4(c.makeRotationAxis(r[g],m*g)),o[g].crossVectors(r[g],s[g])}return{tangents:r,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){let e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}},er=class extends Ot{constructor(e=0,t=0,i=1,r=1,s=0,o=Math.PI*2,a=!1,c=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=e,this.aY=t,this.xRadius=i,this.yRadius=r,this.aStartAngle=s,this.aEndAngle=o,this.aClockwise=a,this.aRotation=c}getPoint(e,t=new ue){let i=t,r=Math.PI*2,s=this.aEndAngle-this.aStartAngle,o=Math.abs(s)<Number.EPSILON;for(;s<0;)s+=r;for(;s>r;)s-=r;s<Number.EPSILON&&(o?s=0:s=r),this.aClockwise===!0&&!o&&(s===r?s=-r:s=s-r);let a=this.aStartAngle+e*s,c=this.aX+this.xRadius*Math.cos(a),l=this.aY+this.yRadius*Math.sin(a);if(this.aRotation!==0){let u=Math.cos(this.aRotation),h=Math.sin(this.aRotation),f=c-this.aX,m=l-this.aY;c=f*u-m*h+this.aX,l=f*h+m*u+this.aY}return i.set(c,l)}copy(e){return super.copy(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}toJSON(){let e=super.toJSON();return e.aX=this.aX,e.aY=this.aY,e.xRadius=this.xRadius,e.yRadius=this.yRadius,e.aStartAngle=this.aStartAngle,e.aEndAngle=this.aEndAngle,e.aClockwise=this.aClockwise,e.aRotation=this.aRotation,e}fromJSON(e){return super.fromJSON(e),this.aX=e.aX,this.aY=e.aY,this.xRadius=e.xRadius,this.yRadius=e.yRadius,this.aStartAngle=e.aStartAngle,this.aEndAngle=e.aEndAngle,this.aClockwise=e.aClockwise,this.aRotation=e.aRotation,this}},xo=class extends er{constructor(e,t,i,r,s,o){super(e,t,i,i,r,s,o),this.isArcCurve=!0,this.type="ArcCurve"}};function Vo(){let n=0,e=0,t=0,i=0;function r(s,o,a,c){n=s,e=a,t=-3*s+3*o-2*a-c,i=2*s-2*o+a+c}return{initCatmullRom:function(s,o,a,c,l){r(o,a,l*(a-s),l*(c-o))},initNonuniformCatmullRom:function(s,o,a,c,l,u,h){let f=(o-s)/l-(a-s)/(l+u)+(a-o)/u,m=(a-o)/u-(c-o)/(u+h)+(c-a)/h;f*=u,m*=u,r(o,a,f,m)},calc:function(s){let o=s*s,a=o*s;return n+e*s+t*o+i*a}}}var Vr=new L,Ga=new Vo,Va=new Vo,Ha=new Vo,yo=class extends Ot{constructor(e=[],t=!1,i="centripetal",r=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=e,this.closed=t,this.curveType=i,this.tension=r}getPoint(e,t=new L){let i=t,r=this.points,s=r.length,o=(s-(this.closed?0:1))*e,a=Math.floor(o),c=o-a;this.closed?a+=a>0?0:(Math.floor(Math.abs(a)/s)+1)*s:c===0&&a===s-1&&(a=s-2,c=1);let l,u;this.closed||a>0?l=r[(a-1)%s]:(Vr.subVectors(r[0],r[1]).add(r[0]),l=Vr);let h=r[a%s],f=r[(a+1)%s];if(this.closed||a+2<s?u=r[(a+2)%s]:(Vr.subVectors(r[s-1],r[s-2]).add(r[s-1]),u=Vr),this.curveType==="centripetal"||this.curveType==="chordal"){let m=this.curveType==="chordal"?.5:.25,g=Math.pow(l.distanceToSquared(h),m),x=Math.pow(h.distanceToSquared(f),m),p=Math.pow(f.distanceToSquared(u),m);x<1e-4&&(x=1),g<1e-4&&(g=x),p<1e-4&&(p=x),Ga.initNonuniformCatmullRom(l.x,h.x,f.x,u.x,g,x,p),Va.initNonuniformCatmullRom(l.y,h.y,f.y,u.y,g,x,p),Ha.initNonuniformCatmullRom(l.z,h.z,f.z,u.z,g,x,p)}else this.curveType==="catmullrom"&&(Ga.initCatmullRom(l.x,h.x,f.x,u.x,this.tension),Va.initCatmullRom(l.y,h.y,f.y,u.y,this.tension),Ha.initCatmullRom(l.z,h.z,f.z,u.z,this.tension));return i.set(Ga.calc(c),Va.calc(c),Ha.calc(c)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let r=e.points[t];this.points.push(r.clone())}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){let r=this.points[t];e.points.push(r.toArray())}return e.closed=this.closed,e.curveType=this.curveType,e.tension=this.tension,e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let r=e.points[t];this.points.push(new L().fromArray(r))}return this.closed=e.closed,this.curveType=e.curveType,this.tension=e.tension,this}};function zu(n,e,t,i,r){let s=(i-e)*.5,o=(r-t)*.5,a=n*n,c=n*a;return(2*t-2*i+s+o)*c+(-3*t+3*i-2*s-o)*a+s*n+t}function Vy(n,e){let t=1-n;return t*t*e}function Hy(n,e){return 2*(1-n)*n*e}function Wy(n,e){return n*n*e}function Zi(n,e,t,i){return Vy(n,e)+Hy(n,t)+Wy(n,i)}function qy(n,e){let t=1-n;return t*t*t*e}function Xy(n,e){let t=1-n;return 3*t*t*n*e}function Yy(n,e){return 3*(1-n)*n*n*e}function $y(n,e){return n*n*n*e}function Ji(n,e,t,i,r){return qy(n,e)+Xy(n,t)+Yy(n,i)+$y(n,r)}var ds=class extends Ot{constructor(e=new ue,t=new ue,i=new ue,r=new ue){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new ue){let i=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return i.set(Ji(e,r.x,s.x,o.x,a.x),Ji(e,r.y,s.y,o.y,a.y)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},Mo=class extends Ot{constructor(e=new L,t=new L,i=new L,r=new L){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=e,this.v1=t,this.v2=i,this.v3=r}getPoint(e,t=new L){let i=t,r=this.v0,s=this.v1,o=this.v2,a=this.v3;return i.set(Ji(e,r.x,s.x,o.x,a.x),Ji(e,r.y,s.y,o.y,a.y),Ji(e,r.z,s.z,o.z,a.z)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this.v3.copy(e.v3),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e.v3=this.v3.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this.v3.fromArray(e.v3),this}},ps=class extends Ot{constructor(e=new ue,t=new ue){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=e,this.v2=t}getPoint(e,t=new ue){let i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new ue){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},So=class extends Ot{constructor(e=new L,t=new L){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=e,this.v2=t}getPoint(e,t=new L){let i=t;return e===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(e).add(this.v1)),i}getPointAt(e,t){return this.getPoint(e,t)}getTangent(e,t=new L){return t.subVectors(this.v2,this.v1).normalize()}getTangentAt(e,t){return this.getTangent(e,t)}copy(e){return super.copy(e),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},ms=class extends Ot{constructor(e=new ue,t=new ue,i=new ue){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new ue){let i=t,r=this.v0,s=this.v1,o=this.v2;return i.set(Zi(e,r.x,s.x,o.x),Zi(e,r.y,s.y,o.y)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},bo=class extends Ot{constructor(e=new L,t=new L,i=new L){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=e,this.v1=t,this.v2=i}getPoint(e,t=new L){let i=t,r=this.v0,s=this.v1,o=this.v2;return i.set(Zi(e,r.x,s.x,o.x),Zi(e,r.y,s.y,o.y),Zi(e,r.z,s.z,o.z)),i}copy(e){return super.copy(e),this.v0.copy(e.v0),this.v1.copy(e.v1),this.v2.copy(e.v2),this}toJSON(){let e=super.toJSON();return e.v0=this.v0.toArray(),e.v1=this.v1.toArray(),e.v2=this.v2.toArray(),e}fromJSON(e){return super.fromJSON(e),this.v0.fromArray(e.v0),this.v1.fromArray(e.v1),this.v2.fromArray(e.v2),this}},gs=class extends Ot{constructor(e=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=e}getPoint(e,t=new ue){let i=t,r=this.points,s=(r.length-1)*e,o=Math.floor(s),a=s-o,c=r[o===0?o:o-1],l=r[o],u=r[o>r.length-2?r.length-1:o+1],h=r[o>r.length-3?r.length-1:o+2];return i.set(zu(a,c.x,l.x,u.x,h.x),zu(a,c.y,l.y,u.y,h.y)),i}copy(e){super.copy(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let r=e.points[t];this.points.push(r.clone())}return this}toJSON(){let e=super.toJSON();e.points=[];for(let t=0,i=this.points.length;t<i;t++){let r=this.points[t];e.points.push(r.toArray())}return e}fromJSON(e){super.fromJSON(e),this.points=[];for(let t=0,i=e.points.length;t<i;t++){let r=e.points[t];this.points.push(new ue().fromArray(r))}return this}},Eo=Object.freeze({__proto__:null,ArcCurve:xo,CatmullRomCurve3:yo,CubicBezierCurve:ds,CubicBezierCurve3:Mo,EllipseCurve:er,LineCurve:ps,LineCurve3:So,QuadraticBezierCurve:ms,QuadraticBezierCurve3:bo,SplineCurve:gs}),To=class extends Ot{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(e){this.curves.push(e)}closePath(){let e=this.curves[0].getPoint(0),t=this.curves[this.curves.length-1].getPoint(1);if(!e.equals(t)){let i=e.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new Eo[i](t,e))}return this}getPoint(e,t){let i=e*this.getLength(),r=this.getCurveLengths(),s=0;for(;s<r.length;){if(r[s]>=i){let o=r[s]-i,a=this.curves[s],c=a.getLength(),l=c===0?0:1-o/c;return a.getPointAt(l,t)}s++}return null}getLength(){let 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;let e=[],t=0;for(let i=0,r=this.curves.length;i<r;i++)t+=this.curves[i].getLength(),e.push(t);return this.cacheLengths=e,e}getSpacedPoints(e=40){let t=[];for(let i=0;i<=e;i++)t.push(this.getPoint(i/e));return this.autoClose&&t.push(t[0]),t}getPoints(e=12){let t=[],i;for(let r=0,s=this.curves;r<s.length;r++){let o=s[r],a=o.isEllipseCurve?e*2:o.isLineCurve||o.isLineCurve3?1:o.isSplineCurve?e*o.points.length:e,c=o.getPoints(a);for(let l=0;l<c.length;l++){let u=c[l];i&&i.equals(u)||(t.push(u),i=u)}}return this.autoClose&&t.length>1&&!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;t<i;t++){let r=e.curves[t];this.curves.push(r.clone())}return this.autoClose=e.autoClose,this}toJSON(){let e=super.toJSON();e.autoClose=this.autoClose,e.curves=[];for(let t=0,i=this.curves.length;t<i;t++){let r=this.curves[t];e.curves.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.autoClose=e.autoClose,this.curves=[];for(let t=0,i=e.curves.length;t<i;t++){let r=e.curves[t];this.curves.push(new Eo[r.type]().fromJSON(r))}return this}},Pi=class extends To{constructor(e){super(),this.type="Path",this.currentPoint=new ue,e&&this.setFromPoints(e)}setFromPoints(e){this.moveTo(e[0].x,e[0].y);for(let t=1,i=e.length;t<i;t++)this.lineTo(e[t].x,e[t].y);return this}moveTo(e,t){return this.currentPoint.set(e,t),this}lineTo(e,t){let i=new ps(this.currentPoint.clone(),new ue(e,t));return this.curves.push(i),this.currentPoint.set(e,t),this}quadraticCurveTo(e,t,i,r){let s=new ms(this.currentPoint.clone(),new ue(e,t),new ue(i,r));return this.curves.push(s),this.currentPoint.set(i,r),this}bezierCurveTo(e,t,i,r,s,o){let a=new ds(this.currentPoint.clone(),new ue(e,t),new ue(i,r),new ue(s,o));return this.curves.push(a),this.currentPoint.set(s,o),this}splineThru(e){let t=[this.currentPoint.clone()].concat(e),i=new gs(t);return this.curves.push(i),this.currentPoint.copy(e[e.length-1]),this}arc(e,t,i,r,s,o){let a=this.currentPoint.x,c=this.currentPoint.y;return this.absarc(e+a,t+c,i,r,s,o),this}absarc(e,t,i,r,s,o){return this.absellipse(e,t,i,i,r,s,o),this}ellipse(e,t,i,r,s,o,a,c){let l=this.currentPoint.x,u=this.currentPoint.y;return this.absellipse(e+l,t+u,i,r,s,o,a,c),this}absellipse(e,t,i,r,s,o,a,c){let l=new er(e,t,i,r,s,o,a,c);if(this.curves.length>0){let h=l.getPoint(0);h.equals(this.currentPoint)||this.lineTo(h.x,h.y)}this.curves.push(l);let u=l.getPoint(1);return this.currentPoint.copy(u),this}copy(e){return super.copy(e),this.currentPoint.copy(e.currentPoint),this}toJSON(){let e=super.toJSON();return e.currentPoint=this.currentPoint.toArray(),e}fromJSON(e){return super.fromJSON(e),this.currentPoint.fromArray(e.currentPoint),this}};var Ii=class extends Pi{constructor(e){super(e),this.uuid=Ui(),this.type="Shape",this.holes=[]}getPointsHoles(e){let t=[];for(let i=0,r=this.holes.length;i<r;i++)t[i]=this.holes[i].getPoints(e);return t}extractPoints(e){return{shape:this.getPoints(e),holes:this.getPointsHoles(e)}}copy(e){super.copy(e),this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){let r=e.holes[t];this.holes.push(r.clone())}return this}toJSON(){let e=super.toJSON();e.uuid=this.uuid,e.holes=[];for(let t=0,i=this.holes.length;t<i;t++){let r=this.holes[t];e.holes.push(r.toJSON())}return e}fromJSON(e){super.fromJSON(e),this.uuid=e.uuid,this.holes=[];for(let t=0,i=e.holes.length;t<i;t++){let r=e.holes[t];this.holes.push(new Pi().fromJSON(r))}return this}},Zy={triangulate:function(n,e,t=2){let i=e&&e.length,r=i?e[0]*t:n.length,s=lh(n,0,r,t,!0),o=[];if(!s||s.next===s.prev)return o;let a,c,l,u,h,f,m;if(i&&(s=eM(n,e,s,t)),n.length>80*t){a=l=n[0],c=u=n[1];for(let g=t;g<r;g+=t)h=n[g],f=n[g+1],h<a&&(a=h),f<c&&(c=f),h>l&&(l=h),f>u&&(u=f);m=Math.max(l-a,u-c),m=m!==0?32767/m:0}return tr(s,o,t,a,c,m,0),o}};function lh(n,e,t,i,r){let s,o;if(r===hM(n,e,t,i)>0)for(s=e;s<t;s+=i)o=ku(s,n[s],n[s+1],o);else for(s=t-i;s>=e;s-=i)o=ku(s,n[s],n[s+1],o);return o&&Ss(o,o.next)&&(ir(o),o=o.next),o}function jn(n,e){if(!n)return n;e||(e=n);let t=n,i;do if(i=!1,!t.steiner&&(Ss(t,t.next)||tt(t.prev,t,t.next)===0)){if(ir(t),t=e=t.prev,t===t.next)break;i=!0}else t=t.next;while(i||t!==e);return e}function tr(n,e,t,i,r,s,o){if(!n)return;!o&&s&&sM(n,i,r,s);let a=n,c,l;for(;n.prev!==n.next;){if(c=n.prev,l=n.next,s?Ky(n,i,r,s):Jy(n)){e.push(c.i/t|0),e.push(n.i/t|0),e.push(l.i/t|0),ir(n),n=l.next,a=l.next;continue}if(n=l,n===a){o?o===1?(n=jy(jn(n),e,t),tr(n,e,t,i,r,s,2)):o===2&&Qy(n,e,t,i,r,s):tr(jn(n),e,t,i,r,s,1);break}}}function Jy(n){let e=n.prev,t=n,i=n.next;if(tt(e,t,i)>=0)return!1;let r=e.x,s=t.x,o=i.x,a=e.y,c=t.y,l=i.y,u=r<s?r<o?r:o:s<o?s:o,h=a<c?a<l?a:l:c<l?c:l,f=r>s?r>o?r:o:s>o?s:o,m=a>c?a>l?a:l:c>l?c:l,g=i.next;for(;g!==e;){if(g.x>=u&&g.x<=f&&g.y>=h&&g.y<=m&&Mi(r,a,s,c,o,l,g.x,g.y)&&tt(g.prev,g,g.next)>=0)return!1;g=g.next}return!0}function Ky(n,e,t,i){let r=n.prev,s=n,o=n.next;if(tt(r,s,o)>=0)return!1;let a=r.x,c=s.x,l=o.x,u=r.y,h=s.y,f=o.y,m=a<c?a<l?a:l:c<l?c:l,g=u<h?u<f?u:f:h<f?h:f,x=a>c?a>l?a:l:c>l?c:l,p=u>h?u>f?u:f:h>f?h:f,d=wo(m,g,e,t,i),b=wo(x,p,e,t,i),v=n.prevZ,T=n.nextZ;for(;v&&v.z>=d&&T&&T.z<=b;){if(v.x>=m&&v.x<=x&&v.y>=g&&v.y<=p&&v!==r&&v!==o&&Mi(a,u,c,h,l,f,v.x,v.y)&&tt(v.prev,v,v.next)>=0||(v=v.prevZ,T.x>=m&&T.x<=x&&T.y>=g&&T.y<=p&&T!==r&&T!==o&&Mi(a,u,c,h,l,f,T.x,T.y)&&tt(T.prev,T,T.next)>=0))return!1;T=T.nextZ}for(;v&&v.z>=d;){if(v.x>=m&&v.x<=x&&v.y>=g&&v.y<=p&&v!==r&&v!==o&&Mi(a,u,c,h,l,f,v.x,v.y)&&tt(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;T&&T.z<=b;){if(T.x>=m&&T.x<=x&&T.y>=g&&T.y<=p&&T!==r&&T!==o&&Mi(a,u,c,h,l,f,T.x,T.y)&&tt(T.prev,T,T.next)>=0)return!1;T=T.nextZ}return!0}function jy(n,e,t){let i=n;do{let r=i.prev,s=i.next.next;!Ss(r,s)&&uh(r,i,i.next,s)&&nr(r,s)&&nr(s,r)&&(e.push(r.i/t|0),e.push(i.i/t|0),e.push(s.i/t|0),ir(i),ir(i.next),i=n=s),i=i.next}while(i!==n);return jn(i)}function Qy(n,e,t,i,r,s){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&cM(o,a)){let c=hh(o,a);o=jn(o,o.next),c=jn(c,c.next),tr(o,e,t,i,r,s,0),tr(c,e,t,i,r,s,0);return}a=a.next}o=o.next}while(o!==n)}function eM(n,e,t,i){let r=[],s,o,a,c,l;for(s=0,o=e.length;s<o;s++)a=e[s]*i,c=s<o-1?e[s+1]*i:n.length,l=lh(n,a,c,i,!1),l===l.next&&(l.steiner=!0),r.push(oM(l));for(r.sort(tM),s=0;s<r.length;s++)t=nM(r[s],t);return t}function tM(n,e){return n.x-e.x}function nM(n,e){let t=iM(n,e);if(!t)return e;let i=hh(t,n);return jn(i,i.next),jn(t,t.next)}function iM(n,e){let t=e,i=-1/0,r,s=n.x,o=n.y;do{if(o<=t.y&&o>=t.next.y&&t.next.y!==t.y){let f=t.x+(o-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=s&&f>i&&(i=f,r=t.x<t.next.x?t:t.next,f===s))return r}t=t.next}while(t!==e);if(!r)return null;let a=r,c=r.x,l=r.y,u=1/0,h;t=r;do s>=t.x&&t.x>=c&&s!==t.x&&Mi(o<l?s:i,o,c,l,o<l?i:s,o,t.x,t.y)&&(h=Math.abs(o-t.y)/(s-t.x),nr(t,n)&&(h<u||h===u&&(t.x>r.x||t.x===r.x&&rM(r,t)))&&(r=t,u=h)),t=t.next;while(t!==a);return r}function rM(n,e){return tt(n.prev,n,e.prev)<0&&tt(e.next,n,n.next)<0}function sM(n,e,t,i){let r=n;do r.z===0&&(r.z=wo(r.x,r.y,e,t,i)),r.prevZ=r.prev,r.nextZ=r.next,r=r.next;while(r!==n);r.prevZ.nextZ=null,r.prevZ=null,aM(r)}function aM(n){let e,t,i,r,s,o,a,c,l=1;do{for(t=n,n=null,s=null,o=0;t;){for(o++,i=t,a=0,e=0;e<l&&(a++,i=i.nextZ,!!i);e++);for(c=l;a>0||c>0&&i;)a!==0&&(c===0||!i||t.z<=i.z)?(r=t,t=t.nextZ,a--):(r=i,i=i.nextZ,c--),s?s.nextZ=r:n=r,r.prevZ=s,s=r;t=i}s.nextZ=null,l*=2}while(o>1);return n}function wo(n,e,t,i,r){return n=(n-t)*r|0,e=(e-i)*r|0,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 oM(n){let e=n,t=n;do(e.x<t.x||e.x===t.x&&e.y<t.y)&&(t=e),e=e.next;while(e!==n);return t}function Mi(n,e,t,i,r,s,o,a){return(r-o)*(e-a)>=(n-o)*(s-a)&&(n-o)*(i-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(r-o)*(i-a)}function cM(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!lM(n,e)&&(nr(n,e)&&nr(e,n)&&uM(n,e)&&(tt(n.prev,n,e.prev)||tt(n,e.prev,e))||Ss(n,e)&&tt(n.prev,n,n.next)>0&&tt(e.prev,e,e.next)>0)}function tt(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function Ss(n,e){return n.x===e.x&&n.y===e.y}function uh(n,e,t,i){let r=Wr(tt(n,e,t)),s=Wr(tt(n,e,i)),o=Wr(tt(t,i,n)),a=Wr(tt(t,i,e));return!!(r!==s&&o!==a||r===0&&Hr(n,t,e)||s===0&&Hr(n,i,e)||o===0&&Hr(t,n,i)||a===0&&Hr(t,e,i))}function Hr(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 Wr(n){return n>0?1:n<0?-1:0}function lM(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&&uh(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function nr(n,e){return tt(n.prev,n,n.next)<0?tt(n,e,n.next)>=0&&tt(n,n.prev,e)>=0:tt(n,e,n.prev)<0||tt(n,n.next,e)<0}function uM(n,e){let t=n,i=!1,r=(n.x+e.x)/2,s=(n.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&r<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(i=!i),t=t.next;while(t!==n);return i}function hh(n,e){let t=new Ao(n.i,n.x,n.y),i=new Ao(e.i,e.x,e.y),r=n.next,s=e.prev;return n.next=e,e.prev=n,t.next=r,r.prev=t,i.next=t,t.prev=i,s.next=i,i.prev=s,i}function ku(n,e,t,i){let r=new Ao(n,e,t);return i?(r.next=i.next,r.prev=i,i.next.prev=r,i.next=r):(r.prev=r,r.next=r),r}function ir(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 Ao(n,e,t){this.i=n,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function hM(n,e,t,i){let r=0;for(let s=e,o=t-i;s<t;s+=i)r+=(n[o]-n[s])*(n[s+1]+n[o+1]),o=s;return r}var Rn=class n{static area(e){let t=e.length,i=0;for(let r=t-1,s=0;s<t;r=s++)i+=e[r].x*e[s].y-e[s].x*e[r].y;return i*.5}static isClockWise(e){return n.area(e)<0}static triangulateShape(e,t){let i=[],r=[],s=[];Gu(e),Vu(i,e);let o=e.length;t.forEach(Gu);for(let c=0;c<t.length;c++)r.push(o),o+=t[c].length,Vu(i,t[c]);let a=Zy.triangulate(i,r);for(let c=0;c<a.length;c+=3)s.push(a.slice(c,c+3));return s}};function Gu(n){let e=n.length;e>2&&n[e-1].equals(n[0])&&n.pop()}function Vu(n,e){for(let t=0;t<e.length;t++)n.push(e[t].x),n.push(e[t].y)}var _s=class n extends Ht{constructor(e=new Ii([new ue(.5,.5),new ue(-.5,.5),new ue(-.5,-.5),new ue(.5,-.5)]),t={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:e,options:t},e=Array.isArray(e)?e:[e];let i=this,r=[],s=[];for(let a=0,c=e.length;a<c;a++){let l=e[a];o(l)}this.setAttribute("position",new St(r,3)),this.setAttribute("uv",new St(s,2)),this.computeVertexNormals();function o(a){let c=[],l=t.curveSegments!==void 0?t.curveSegments:12,u=t.steps!==void 0?t.steps:1,h=t.depth!==void 0?t.depth:1,f=t.bevelEnabled!==void 0?t.bevelEnabled:!0,m=t.bevelThickness!==void 0?t.bevelThickness:.2,g=t.bevelSize!==void 0?t.bevelSize:m-.1,x=t.bevelOffset!==void 0?t.bevelOffset:0,p=t.bevelSegments!==void 0?t.bevelSegments:3,d=t.extrudePath,b=t.UVGenerator!==void 0?t.UVGenerator:fM,v,T=!1,I,R,A,B;d&&(v=d.getSpacedPoints(u),T=!0,f=!1,I=d.computeFrenetFrames(u,!1),R=new L,A=new L,B=new L),f||(p=0,m=0,g=0,x=0);let j=a.extractPoints(l),y=j.shape,E=j.holes;if(!Rn.isClockWise(y)){y=y.reverse();for(let w=0,ae=E.length;w<ae;w++){let X=E[w];Rn.isClockWise(X)&&(E[w]=X.reverse())}}let K=Rn.triangulateShape(y,E),C=y;for(let w=0,ae=E.length;w<ae;w++){let X=E[w];y=y.concat(X)}function H(w,ae,X){return ae||console.error("THREE.ExtrudeGeometry: vec does not exist"),w.clone().addScaledVector(ae,X)}let G=y.length,Y=K.length;function W(w,ae,X){let re,Z,ve,pe=w.x-ae.x,ye=w.y-ae.y,Ve=X.x-w.x,S=X.y-w.y,_=pe*pe+ye*ye,k=pe*S-ye*Ve;if(Math.abs(k)>Number.EPSILON){let V=Math.sqrt(_),ee=Math.sqrt(Ve*Ve+S*S),J=ae.x-ye/V,Le=ae.y+pe/V,Re=X.x-S/ee,ce=X.y+Ve/ee,he=((Re-J)*S-(ce-Le)*Ve)/(pe*S-ye*Ve);re=J+pe*he-w.x,Z=Le+ye*he-w.y;let Ue=re*re+Z*Z;if(Ue<=2)return new ue(re,Z);ve=Math.sqrt(Ue/2)}else{let V=!1;pe>Number.EPSILON?Ve>Number.EPSILON&&(V=!0):pe<-Number.EPSILON?Ve<-Number.EPSILON&&(V=!0):Math.sign(ye)===Math.sign(S)&&(V=!0),V?(re=-ye,Z=pe,ve=Math.sqrt(_)):(re=pe,Z=ye,ve=Math.sqrt(_/2))}return new ue(re/ve,Z/ve)}let q=[];for(let w=0,ae=C.length,X=ae-1,re=w+1;w<ae;w++,X++,re++)X===ae&&(X=0),re===ae&&(re=0),q[w]=W(C[w],C[X],C[re]);let ne=[],te,_e=q.concat();for(let w=0,ae=E.length;w<ae;w++){let X=E[w];te=[];for(let re=0,Z=X.length,ve=Z-1,pe=re+1;re<Z;re++,ve++,pe++)ve===Z&&(ve=0),pe===Z&&(pe=0),te[re]=W(X[re],X[ve],X[pe]);ne.push(te),_e=_e.concat(te)}for(let w=0;w<p;w++){let ae=w/p,X=m*Math.cos(ae*Math.PI/2),re=g*Math.sin(ae*Math.PI/2)+x;for(let Z=0,ve=C.length;Z<ve;Z++){let pe=H(C[Z],q[Z],re);Te(pe.x,pe.y,-X)}for(let Z=0,ve=E.length;Z<ve;Z++){let pe=E[Z];te=ne[Z];for(let ye=0,Ve=pe.length;ye<Ve;ye++){let S=H(pe[ye],te[ye],re);Te(S.x,S.y,-X)}}}let Ie=g+x;for(let w=0;w<G;w++){let ae=f?H(y[w],_e[w],Ie):y[w];T?(A.copy(I.normals[0]).multiplyScalar(ae.x),R.copy(I.binormals[0]).multiplyScalar(ae.y),B.copy(v[0]).add(A).add(R),Te(B.x,B.y,B.z)):Te(ae.x,ae.y,0)}for(let w=1;w<=u;w++)for(let ae=0;ae<G;ae++){let X=f?H(y[ae],_e[ae],Ie):y[ae];T?(A.copy(I.normals[w]).multiplyScalar(X.x),R.copy(I.binormals[w]).multiplyScalar(X.y),B.copy(v[w]).add(A).add(R),Te(B.x,B.y,B.z)):Te(X.x,X.y,h/u*w)}for(let w=p-1;w>=0;w--){let ae=w/p,X=m*Math.cos(ae*Math.PI/2),re=g*Math.sin(ae*Math.PI/2)+x;for(let Z=0,ve=C.length;Z<ve;Z++){let pe=H(C[Z],q[Z],re);Te(pe.x,pe.y,h+X)}for(let Z=0,ve=E.length;Z<ve;Z++){let pe=E[Z];te=ne[Z];for(let ye=0,Ve=pe.length;ye<Ve;ye++){let S=H(pe[ye],te[ye],re);T?Te(S.x,S.y+v[u-1].y,v[u-1].x+X):Te(S.x,S.y,h+X)}}}z(),Q();function z(){let w=r.length/3;if(f){let ae=0,X=G*ae;for(let re=0;re<Y;re++){let Z=K[re];Me(Z[2]+X,Z[1]+X,Z[0]+X)}ae=u+p*2,X=G*ae;for(let re=0;re<Y;re++){let Z=K[re];Me(Z[0]+X,Z[1]+X,Z[2]+X)}}else{for(let ae=0;ae<Y;ae++){let X=K[ae];Me(X[2],X[1],X[0])}for(let ae=0;ae<Y;ae++){let X=K[ae];Me(X[0]+G*u,X[1]+G*u,X[2]+G*u)}}i.addGroup(w,r.length/3-w,0)}function Q(){let w=r.length/3,ae=0;me(C,ae),ae+=C.length;for(let X=0,re=E.length;X<re;X++){let Z=E[X];me(Z,ae),ae+=Z.length}i.addGroup(w,r.length/3-w,1)}function me(w,ae){let X=w.length;for(;--X>=0;){let re=X,Z=X-1;Z<0&&(Z=w.length-1);for(let ve=0,pe=u+p*2;ve<pe;ve++){let ye=G*ve,Ve=G*(ve+1),S=ae+re+ye,_=ae+Z+ye,k=ae+Z+Ve,V=ae+re+Ve;xe(S,_,k,V)}}}function Te(w,ae,X){c.push(w),c.push(ae),c.push(X)}function Me(w,ae,X){ke(w),ke(ae),ke(X);let re=r.length/3,Z=b.generateTopUV(i,r,re-3,re-2,re-1);we(Z[0]),we(Z[1]),we(Z[2])}function xe(w,ae,X,re){ke(w),ke(ae),ke(re),ke(ae),ke(X),ke(re);let Z=r.length/3,ve=b.generateSideWallUV(i,r,Z-6,Z-3,Z-2,Z-1);we(ve[0]),we(ve[1]),we(ve[3]),we(ve[1]),we(ve[2]),we(ve[3])}function ke(w){r.push(c[w*3+0]),r.push(c[w*3+1]),r.push(c[w*3+2])}function we(w){s.push(w.x),s.push(w.y)}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON(),t=this.parameters.shapes,i=this.parameters.options;return dM(t,i,e)}static fromJSON(e,t){let i=[];for(let s=0,o=e.shapes.length;s<o;s++){let a=t[e.shapes[s]];i.push(a)}let r=e.options.extrudePath;return r!==void 0&&(e.options.extrudePath=new Eo[r.type]().fromJSON(r)),new n(i,e.options)}},fM={generateTopUV:function(n,e,t,i,r){let s=e[t*3],o=e[t*3+1],a=e[i*3],c=e[i*3+1],l=e[r*3],u=e[r*3+1];return[new ue(s,o),new ue(a,c),new ue(l,u)]},generateSideWallUV:function(n,e,t,i,r,s){let o=e[t*3],a=e[t*3+1],c=e[t*3+2],l=e[i*3],u=e[i*3+1],h=e[i*3+2],f=e[r*3],m=e[r*3+1],g=e[r*3+2],x=e[s*3],p=e[s*3+1],d=e[s*3+2];return Math.abs(a-u)<Math.abs(o-l)?[new ue(o,1-c),new ue(l,1-h),new ue(f,1-g),new ue(x,1-d)]:[new ue(a,1-c),new ue(u,1-h),new ue(m,1-g),new ue(p,1-d)]}};function dM(n,e,t){if(t.shapes=[],Array.isArray(n))for(let i=0,r=n.length;i<r;i++){let s=n[i];t.shapes.push(s.uuid)}else t.shapes.push(n.uuid);return t.options=Object.assign({},e),e.extrudePath!==void 0&&(t.options.extrudePath=e.extrudePath.toJSON()),t}var vs=class n extends Ht{constructor(e=new Ii([new ue(0,.5),new ue(-.5,-.5),new ue(.5,-.5)]),t=12){super(),this.type="ShapeGeometry",this.parameters={shapes:e,curveSegments:t};let i=[],r=[],s=[],o=[],a=0,c=0;if(Array.isArray(e)===!1)l(e);else for(let u=0;u<e.length;u++)l(e[u]),this.addGroup(a,c,u),a+=c,c=0;this.setIndex(i),this.setAttribute("position",new St(r,3)),this.setAttribute("normal",new St(s,3)),this.setAttribute("uv",new St(o,2));function l(u){let h=r.length/3,f=u.extractPoints(t),m=f.shape,g=f.holes;Rn.isClockWise(m)===!1&&(m=m.reverse());for(let p=0,d=g.length;p<d;p++){let b=g[p];Rn.isClockWise(b)===!0&&(g[p]=b.reverse())}let x=Rn.triangulateShape(m,g);for(let p=0,d=g.length;p<d;p++){let b=g[p];m=m.concat(b)}for(let p=0,d=m.length;p<d;p++){let b=m[p];r.push(b.x,b.y,0),s.push(0,0,1),o.push(b.x,b.y)}for(let p=0,d=x.length;p<d;p++){let b=x[p],v=b[0]+h,T=b[1]+h,I=b[2]+h;i.push(v,T,I),c+=3}}}copy(e){return super.copy(e),this.parameters=Object.assign({},e.parameters),this}toJSON(){let e=super.toJSON(),t=this.parameters.shapes;return pM(t,e)}static fromJSON(e,t){let i=[];for(let r=0,s=e.shapes.length;r<s;r++){let o=t[e.shapes[r]];i.push(o)}return new n(i,e.curveSegments)}};function pM(n,e){if(e.shapes=[],Array.isArray(n))for(let t=0,i=n.length;t<i;t++){let r=n[t];e.shapes.push(r.uuid)}else e.shapes.push(n.uuid);return e}function qr(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 mM(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}var Li=class{constructor(e,t,i,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r!==void 0?r:new t.constructor(i),this.sampleValues=t,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,i=this._cachedIndex,r=t[i],s=t[i-1];n:{e:{let o;t:{i:if(!(e<r)){for(let a=i+2;;){if(r===void 0){if(e<s)break i;return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===a)break;if(s=r,r=t[++i],e<r)break e}o=t.length;break t}if(!(e>=s)){let a=t[1];e<a&&(i=2,s=a);for(let c=i-2;;){if(s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===c)break;if(r=s,s=t[--i-1],e>=s)break e}o=i,i=0;break t}break n}for(;i<o;){let a=i+o>>>1;e<t[a]?o=a:i=a+1}if(r=t[i],s=t[i-1],s===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(r===void 0)return i=t.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,s,r)}return this.interpolate_(i,s,e,r)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(e){let t=this.resultBuffer,i=this.sampleValues,r=this.valueSize,s=e*r;for(let o=0;o!==r;++o)t[o]=i[s+o];return t}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},Ro=class extends Li{constructor(e,t,i,r){super(e,t,i,r),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Yl,endingEnd:Yl}}intervalChanged_(e,t,i){let r=this.parameterPositions,s=e-2,o=e+1,a=r[s],c=r[o];if(a===void 0)switch(this.getSettings_().endingStart){case $l:s=e,a=2*t-i;break;case Zl:s=r.length-2,a=t+r[s]-r[s+1];break;default:s=e,a=i}if(c===void 0)switch(this.getSettings_().endingEnd){case $l:o=e,c=2*i-t;break;case Zl:o=1,c=i+r[1]-r[0];break;default:o=e-1,c=t}let l=(i-t)*.5,u=this.valueSize;this._weightPrev=l/(t-a),this._weightNext=l/(c-i),this._offsetPrev=s*u,this._offsetNext=o*u}interpolate_(e,t,i,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=e*a,l=c-a,u=this._offsetPrev,h=this._offsetNext,f=this._weightPrev,m=this._weightNext,g=(i-t)/(r-t),x=g*g,p=x*g,d=-f*p+2*f*x-f*g,b=(1+f)*p+(-1.5-2*f)*x+(-.5+f)*g+1,v=(-1-m)*p+(1.5+m)*x+.5*g,T=m*p-m*x;for(let I=0;I!==a;++I)s[I]=d*o[u+I]+b*o[l+I]+v*o[c+I]+T*o[h+I];return s}},Co=class extends Li{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=e*a,l=c-a,u=(i-t)/(r-t),h=1-u;for(let f=0;f!==a;++f)s[f]=o[l+f]*h+o[c+f]*u;return s}},Po=class extends Li{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e){return this.copySampleValue_(e-1)}},Wt=class{constructor(e,t,i,r){if(e===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(t===void 0||t.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+e);this.name=e,this.times=qr(t,this.TimeBufferType),this.values=qr(i,this.ValueBufferType),this.setInterpolation(r||this.DefaultInterpolation)}static toJSON(e){let t=e.constructor,i;if(t.toJSON!==this.toJSON)i=t.toJSON(e);else{i={name:e.name,times:qr(e.times,Array),values:qr(e.values,Array)};let r=e.getInterpolation();r!==e.DefaultInterpolation&&(i.interpolation=r)}return i.type=e.ValueTypeName,i}InterpolantFactoryMethodDiscrete(e){return new Po(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodLinear(e){return new Co(this.times,this.values,this.getValueSize(),e)}InterpolantFactoryMethodSmooth(e){return new Ro(this.times,this.values,this.getValueSize(),e)}setInterpolation(e){let t;switch(e){case Yr:t=this.InterpolantFactoryMethodDiscrete;break;case $r:t=this.InterpolantFactoryMethodLinear;break;case pa:t=this.InterpolantFactoryMethodSmooth;break}if(t===void 0){let i="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(e!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(i);return console.warn("THREE.KeyframeTrack:",i),this}return this.createInterpolant=t,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return Yr;case this.InterpolantFactoryMethodLinear:return $r;case this.InterpolantFactoryMethodSmooth:return pa}}getValueSize(){return this.values.length/this.times.length}shift(e){if(e!==0){let t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]+=e}return this}scale(e){if(e!==1){let t=this.times;for(let i=0,r=t.length;i!==r;++i)t[i]*=e}return this}trim(e,t){let i=this.times,r=i.length,s=0,o=r-1;for(;s!==r&&i[s]<e;)++s;for(;o!==-1&&i[o]>t;)--o;if(++o,s!==0||o!==r){s>=o&&(o=Math.max(o,1),s=o-1);let a=this.getValueSize();this.times=i.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);let i=this.times,r=this.values,s=i.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){let c=i[a];if(typeof c=="number"&&isNaN(c)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,c),e=!1;break}if(o!==null&&o>c){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,c,o),e=!1;break}o=c}if(r!==void 0&&mM(r))for(let a=0,c=r.length;a!==c;++a){let l=r[a];if(isNaN(l)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,l),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),i=this.getValueSize(),r=this.getInterpolation()===pa,s=e.length-1,o=1;for(let a=1;a<s;++a){let c=!1,l=e[a],u=e[a+1];if(l!==u&&(a!==1||l!==e[0]))if(r)c=!0;else{let h=a*i,f=h-i,m=h+i;for(let g=0;g!==i;++g){let x=t[h+g];if(x!==t[f+g]||x!==t[m+g]){c=!0;break}}}if(c){if(a!==o){e[o]=e[a];let h=a*i,f=o*i;for(let m=0;m!==i;++m)t[f+m]=t[h+m]}++o}}if(s>0){e[o]=e[s];for(let a=s*i,c=o*i,l=0;l!==i;++l)t[c+l]=t[a+l];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*i)):(this.times=e,this.values=t),this}clone(){let e=this.times.slice(),t=this.values.slice(),i=this.constructor,r=new i(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}};Wt.prototype.TimeBufferType=Float32Array;Wt.prototype.ValueBufferType=Float32Array;Wt.prototype.DefaultInterpolation=$r;var Qn=class extends Wt{};Qn.prototype.ValueTypeName="bool";Qn.prototype.ValueBufferType=Array;Qn.prototype.DefaultInterpolation=Yr;Qn.prototype.InterpolantFactoryMethodLinear=void 0;Qn.prototype.InterpolantFactoryMethodSmooth=void 0;var Io=class extends Wt{};Io.prototype.ValueTypeName="color";var Lo=class extends Wt{};Lo.prototype.ValueTypeName="number";var Uo=class extends Li{constructor(e,t,i,r){super(e,t,i,r)}interpolate_(e,t,i,r){let s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,c=(i-t)/(r-t),l=e*a;for(let u=l+a;l!==u;l+=4)In.slerpFlat(s,0,o,l-a,o,l,c);return s}},rr=class extends Wt{InterpolantFactoryMethodLinear(e){return new Uo(this.times,this.values,this.getValueSize(),e)}};rr.prototype.ValueTypeName="quaternion";rr.prototype.DefaultInterpolation=$r;rr.prototype.InterpolantFactoryMethodSmooth=void 0;var ei=class extends Wt{};ei.prototype.ValueTypeName="string";ei.prototype.ValueBufferType=Array;ei.prototype.DefaultInterpolation=Yr;ei.prototype.InterpolantFactoryMethodLinear=void 0;ei.prototype.InterpolantFactoryMethodSmooth=void 0;var Do=class extends Wt{};Do.prototype.ValueTypeName="vector";var No=class{constructor(e,t,i){let r=this,s=!1,o=0,a=0,c,l=[];this.onStart=void 0,this.onLoad=e,this.onProgress=t,this.onError=i,this.itemStart=function(u){a++,s===!1&&r.onStart!==void 0&&r.onStart(u,o,a),s=!0},this.itemEnd=function(u){o++,r.onProgress!==void 0&&r.onProgress(u,o,a),o===a&&(s=!1,r.onLoad!==void 0&&r.onLoad())},this.itemError=function(u){r.onError!==void 0&&r.onError(u)},this.resolveURL=function(u){return c?c(u):u},this.setURLModifier=function(u){return c=u,this},this.addHandler=function(u,h){return l.push(u,h),this},this.removeHandler=function(u){let h=l.indexOf(u);return h!==-1&&l.splice(h,2),this},this.getHandler=function(u){for(let h=0,f=l.length;h<f;h+=2){let m=l[h],g=l[h+1];if(m.global&&(m.lastIndex=0),m.test(u))return g}return null}}},gM=new No,Oo=class{constructor(e){this.manager=e!==void 0?e:gM,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(e,t){let i=this;return new Promise(function(r,s){i.load(e,r,t,s)})}parse(){}setCrossOrigin(e){return this.crossOrigin=e,this}setWithCredentials(e){return this.withCredentials=e,this}setPath(e){return this.path=e,this}setResourcePath(e){return this.resourcePath=e,this}setRequestHeader(e){return this.requestHeader=e,this}};Oo.DEFAULT_MATERIAL_NAME="__DEFAULT";var Ho="\\\\[\\\\]\\\\.:\\\\/",_M=new RegExp("["+Ho+"]","g"),Wo="[^"+Ho+"]",vM="[^"+Ho.replace("\\\\.","")+"]",xM=/((?:WC+[\\/:])*)/.source.replace("WC",Wo),yM=/(WCOD+)?/.source.replace("WCOD",vM),MM=/(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace("WC",Wo),SM=/\\.(WC+)(?:\\[(.+)\\])?/.source.replace("WC",Wo),bM=new RegExp("^"+xM+yM+MM+SM+"$"),EM=["material","materials","bones","map"],Fo=class{constructor(e,t,i){let r=i||Qe.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();let i=this._targetGroup.nCachedObjects_,r=this._bindings[i];r!==void 0&&r.getValue(e,t)}setValue(e,t){let i=this._bindings;for(let r=this._targetGroup.nCachedObjects_,s=i.length;r!==s;++r)i[r].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,i=e.length;t!==i;++t)e[t].unbind()}},Qe=class n{constructor(e,t,i){this.path=t,this.parsedPath=i||n.parseTrackName(t),this.node=n.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,i){return e&&e.isAnimationObjectGroup?new n.Composite(e,t,i):new n(e,t,i)}static sanitizeNodeName(e){return e.replace(/\\s/g,"_").replace(_M,"")}static parseTrackName(e){let t=bM.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);let i={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=i.nodeName&&i.nodeName.lastIndexOf(".");if(r!==void 0&&r!==-1){let s=i.nodeName.substring(r+1);EM.indexOf(s)!==-1&&(i.nodeName=i.nodeName.substring(0,r),i.objectName=s)}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){let i=e.skeleton.getBoneByName(t);if(i!==void 0)return i}if(e.children){let i=function(s){for(let o=0;o<s.length;o++){let a=s[o];if(a.name===t||a.uuid===t)return a;let c=i(a.children);if(c)return c}return null},r=i(e.children);if(r)return r}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(e,t){e[t]=this.targetObject[this.propertyName]}_getValue_array(e,t){let i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)e[t++]=i[r]}_getValue_arrayElement(e,t){e[t]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(e,t){this.resolvedProperty.toArray(e,t)}_setValue_direct(e,t){this.targetObject[this.propertyName]=e[t]}_setValue_direct_setNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(e,t){this.targetObject[this.propertyName]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(e,t){let i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++]}_setValue_array_setNeedsUpdate(e,t){let i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(e,t){let i=this.resolvedProperty;for(let r=0,s=i.length;r!==s;++r)i[r]=e[t++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(e,t){this.resolvedProperty[this.propertyIndex]=e[t]}_setValue_arrayElement_setNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty[this.propertyIndex]=e[t],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(e,t){this.resolvedProperty.fromArray(e,t)}_setValue_fromArray_setNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(e,t){this.resolvedProperty.fromArray(e,t),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(e,t){this.bind(),this.getValue(e,t)}_setValue_unbound(e,t){this.bind(),this.setValue(e,t)}bind(){let e=this.node,t=this.parsedPath,i=t.objectName,r=t.propertyName,s=t.propertyIndex;if(e||(e=n.findNode(this.rootNode,t.nodeName),this.node=e),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!e){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(i){let l=t.objectIndex;switch(i){case"materials":if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}e=e.material.materials;break;case"bones":if(!e.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}e=e.skeleton.bones;for(let u=0;u<e.length;u++)if(e[u].name===l){l=u;break}break;case"map":if("map"in e){e=e.map;break}if(!e.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!e.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}e=e.material.map;break;default:if(e[i]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}e=e[i]}if(l!==void 0){if(e[l]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,e);return}e=e[l]}}let o=e[r];if(o===void 0){let l=t.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+l+"."+r+" but it wasn't found.",e);return}let a=this.Versioning.None;this.targetObject=e,e.needsUpdate!==void 0?a=this.Versioning.NeedsUpdate:e.matrixWorldNeedsUpdate!==void 0&&(a=this.Versioning.MatrixWorldNeedsUpdate);let c=this.BindingType.Direct;if(s!==void 0){if(r==="morphTargetInfluences"){if(!e.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!e.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}e.morphTargetDictionary[s]!==void 0&&(s=e.morphTargetDictionary[s])}c=this.BindingType.ArrayElement,this.resolvedProperty=o,this.propertyIndex=s}else o.fromArray!==void 0&&o.toArray!==void 0?(c=this.BindingType.HasFromToArray,this.resolvedProperty=o):Array.isArray(o)?(c=this.BindingType.EntireArray,this.resolvedProperty=o):this.propertyName=r;this.getValue=this.GetterByBindingType[c],this.setValue=this.SetterByBindingTypeAndVersioning[c][a]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};Qe.Composite=Fo;Qe.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Qe.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Qe.prototype.GetterByBindingType=[Qe.prototype._getValue_direct,Qe.prototype._getValue_array,Qe.prototype._getValue_arrayElement,Qe.prototype._getValue_toArray];Qe.prototype.SetterByBindingTypeAndVersioning=[[Qe.prototype._setValue_direct,Qe.prototype._setValue_direct_setNeedsUpdate,Qe.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Qe.prototype._setValue_array,Qe.prototype._setValue_array_setNeedsUpdate,Qe.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Qe.prototype._setValue_arrayElement,Qe.prototype._setValue_arrayElement_setNeedsUpdate,Qe.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Qe.prototype._setValue_fromArray,Qe.prototype._setValue_fromArray_setNeedsUpdate,Qe.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var DA=new Float32Array(1);typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:Bo}}));typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=Bo);var SR=xr(Ip(),1),bR=xr(Bp(),1);function qc(n,e){e===void 0&&(e=[]);let t=new Ii(n.map(i=>new ue(...i)));return e.length&&e.forEach(i=>{var r=new Pi(i.map(s=>new ue(...s)));t.holes.push(r)}),t}var WR=xr(Rm(),1),qR=xr(Qc(),1);function Cm(n){return n.replace(/[A-Z]/g,e=>"_"+e.toLowerCase()).replace(/^_/,"")}function Pm(n){let e={};for(let i in n)i.startsWith("on")&&(e[Cm(i.slice(2))]=n[i]);let t=i=>yr(this,null,function*(){let{data:r}=i;if(e[r.type])try{let s=yield e[r.type](r.data);if(s!=null&&s.$transfer&&Array.isArray(s.$transfer)){let o=s.$transfer;delete s.$transfer,self.postMessage({type:""+r.type+"_result",key:r.key,data:s},o)}else self.postMessage({type:""+r.type+"_result",key:r.key,data:s})}catch(s){self.postMessage({type:""+r.type+"_result",key:r.key,error:s})}else self.postMessage({type:""+r.type+"_result",key:r.key,error:"no_event"})});return self.addEventListener("message",t),()=>{self.removeEventListener("message",t)}}function ol(n,e=!1){let t=n[0].index!==null,i=new Set(Object.keys(n[0].attributes)),r=new Set(Object.keys(n[0].morphAttributes)),s={},o={},a=n[0].morphTargetsRelative,c=new Ht,l=0;for(let u=0;u<n.length;++u){let h=n[u],f=0;if(t!==(h.index!==null))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."),null;for(let m in h.attributes){if(!i.has(m))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+'. All geometries must have compatible attributes; make sure "'+m+'" attribute exists among all geometries, or in none of them.'),null;s[m]===void 0&&(s[m]=[]),s[m].push(h.attributes[m]),f++}if(f!==i.size)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". Make sure all geometries have the same number of attributes."),null;if(a!==h.morphTargetsRelative)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphTargetsRelative must be consistent throughout all geometries."),null;for(let m in h.morphAttributes){if(!r.has(m))return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". .morphAttributes must be consistent throughout all geometries."),null;o[m]===void 0&&(o[m]=[]),o[m].push(h.morphAttributes[m])}if(e){let m;if(t)m=h.index.count;else if(h.attributes.position!==void 0)m=h.attributes.position.count;else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index "+u+". The geometry must have either an index or a position attribute"),null;c.addGroup(l,m,u),l+=m}}if(t){let u=0,h=[];for(let f=0;f<n.length;++f){let m=n[f].index;for(let g=0;g<m.count;++g)h.push(m.getX(g)+u);u+=n[f].attributes.position.count}c.setIndex(h)}for(let u in s){let h=Im(s[u]);if(!h)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" attribute."),null;c.setAttribute(u,h)}for(let u in o){let h=o[u][0].length;if(h===0)break;c.morphAttributes=c.morphAttributes||{},c.morphAttributes[u]=[];for(let f=0;f<h;++f){let m=[];for(let x=0;x<o[u].length;++x)m.push(o[u][x][f]);let g=Im(m);if(!g)return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the "+u+" morphAttribute."),null;c.morphAttributes[u].push(g)}}return c}function Im(n){let e,t,i,r=-1,s=0;for(let l=0;l<n.length;++l){let u=n[l];if(e===void 0&&(e=u.array.constructor),e!==u.array.constructor)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."),null;if(t===void 0&&(t=u.itemSize),t!==u.itemSize)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."),null;if(i===void 0&&(i=u.normalized),i!==u.normalized)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."),null;if(r===-1&&(r=u.gpuType),r!==u.gpuType)return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."),null;s+=u.count*t}let o=new e(s),a=new At(o,t,i),c=0;for(let l=0;l<n.length;++l){let u=n[l];if(u.isInterleavedBufferAttribute){let h=c/t;for(let f=0,m=u.count;f<m;f++)for(let g=0;g<t;g++){let x=u.getComponent(f,g);a.setComponent(f+h,g,x)}}else o.set(u.array,c);c+=u.count*t}return r!==void 0&&(a.gpuType=r),a}Pm({onGetMergedGeometryAttributes(n){let{data:e}=n,t=e.map(s=>{let o=s.geometry.coords,a=qc(o[0],o.slice(1));return new _s(a,{steps:1,bevelEnabled:!1,depth:s.height,curveSegments:4})}),i=ol(t);t.forEach(s=>s.dispose());let r={attributes:i.attributes,index:i.index,morphAttributes:i.morphAttributes,morphTargetsRelative:i.morphTargetsRelative,groups:i.groups,boundingSphere:i.boundingSphere};return i.dispose(),r},onGetMergedShapeGeometryAttributes(n){let{data:e}=n,t=e.map(s=>{let o=qc(s.geometry.coords[0].slice(0,-1),s.geometry.coords.slice(1)),a=new vs(o,4),c=a.getAttribute("position");for(let l=0;l<c.count;l++)c.setZ(l,s.airHeight+(s.deltaHeight||0));return a}),i=ol(t);t.forEach(s=>s.dispose());let r={attributes:i.attributes,index:i.index,morphAttributes:i.morphAttributes,morphTargetsRelative:i.morphTargetsRelative,groups:i.groups,boundingSphere:i.boundingSphere};return i.dispose(),r}});
3846
- `],{type:"text/javascript"}),t=URL.createObjectURL(i),e=new Worker(t);return URL.revokeObjectURL(t),e}import{BufferGeometry as NF,BufferAttribute as A6}from"three";var ue=class{static GetMergeGeometry(t){return E(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield rt(e,"get_merged_geometry_attributes",{data:t}),r=this.GetBufferGeometryByData(n);return this.WorkerPool.releaseWorker(e),r})}static GetMergedShapeGeometry(t){return E(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield rt(e,"get_merged_shape_geometry_attributes",{data:t}),r=this.GetBufferGeometryByData(n);return this.WorkerPool.releaseWorker(e),r})}static GetBufferGeometryByData(t){let e=new NF;return Object.keys(t.attributes).forEach(n=>{e.setAttribute(n,new A6(t.attributes[n].array,t.attributes[n].itemSize))}),t.index&&e.setIndex(new A6(t.index.array,t.index.itemSize)),e.morphAttributes=t.morphAttributes,e.morphTargetsRelative=t.morphTargetsRelative,e.groups=t.groups,e.boundingSphere=t.boundingSphere,e}static dispose(){this.WorkerPool.dispose()}};ue.WorkerPool=new Qo(10,Pc);import{cloneDeep as GF}from"lodash";var Ic={id:"",height:.1,airHeight:0,area:0,group:"",fillColor:"#EFF4FB",strokeColor:"#ffffff",fillOpacity:1,strokeOpacity:1,strokeWidth:1,doors:[],locked:!1,visible:!0,geometry:{type:"polygon",cds:[],coords:[],curveCpt:[],curveIndex:[]},layerType:"",zIndex:0,stroke:!0,deltaHeight:0,userData:{},gradualColor:[],renderType:"single",colorFactor:.9,center_coord_x:0,center_coord_y:0,dashed:!1},et=class extends OF{getCenter(){if(this.options.geometry.type==="point")return this.position.clone();let t=new jt,e=new qs;return e.setFromObject(this),e.getCenter(t),t}getSize(){if(this.options.geometry.type==="point")return new jt(0,0,0);let t=new qs,e=new jt;return t.setFromObject(this),t.getSize(e),e}getPosition(){let{center_coord_x:t,center_coord_y:e}=this.options,n=this.getCenter();return n.setZ(n.z+this.options.height/2),new jt(t,e,n.z+this.options.height/2)}init(){this.geometry=this.initGeometry(),this.initMaterial(),this.initMesh(),this.mesh.position.z=this.options.airHeight+this.options.deltaHeight,this.options.stroke&&this.options.strokeOpacity!==0&&(this.initLineMaterial(),this.initLineGeometry(),this.createBorder())}initDoor(){var t;if((t=this.options.doors)!=null&&t.length&&this.options.geometry.type==="polygon"){let e=this.options.geometry.coords[0];this.options.doors.forEach(n=>{let r=n.type==="single"?.5:1,o=.5,s=Oe(e,n.coord),a=new He(...n.coord),u=new He(...e[s]).sub(new He(...n.coord)).normalize(),l=new He().addVectors(a,u.clone().multiplyScalar(r)),c=new He().addVectors(a,u.clone().multiplyScalar(-r)),h=new He(-u.y,u.x),p=new He().addVectors(l,h.clone().multiplyScalar(o));em([p.x,p.y],e)||(h.multiplyScalar(-1),p=new He().addVectors(l,h.clone().multiplyScalar(o)));let d=new He().addVectors(c,h.clone().multiplyScalar(o)),m=[[l.x,l.y],[p.x,p.y],[d.x,d.y],[c.x,c.y]];this.options.geometry.coords=[[...e.slice(0,s+1),...m,...e.slice(s+1)]],e=this.options.geometry.coords[0]})}}initGeometry(){let t=Io(this.options.geometry.coords[0],this.options.geometry.coords.slice(1));return new DF(t,{steps:1,bevelEnabled:!1,depth:this.options.height,curveSegments:4})}initSingleMaterial(){let t=W.createMeshBasicMaterial({color:this.options.fillColor,opacity:this.options.fillOpacity});if(this.options.secondUrl&&ut.getTextureByUrl(this.options.secondUrl).then(n=>{n.wrapS=R6,n.wrapT=R6,n.needsUpdate=!0,t.map=n,t.side=zF}),this.options.height<=.1)return this.material=t,t;let e=W.createMeshBasicMaterial({color:De(this.options.fillColor),opacity:this.options.fillOpacity});return this.material=[t,e],[t,e]}getMaxAndMin(t,e){let n=new qs().setFromObject(this),r=t.clone().add(e.clone().multiplyScalar(1e3)),o=new C6(r,e.clone().multiplyScalar(-1)),s=new jt;o.intersectBox(n,s);let a=t.clone().add(e.clone().multiplyScalar(-1e3)),u=new C6(a,e.clone()),l=new jt;return u.intersectBox(n,l),{max:l,min:s}}initGradualMaterial(){let{max:t,min:e}=new qs().setFromObject(this),n=t.clone().sub(e),r=Math.max(n.x,n.y,n.z)/2,o=this.getPosition(),s=new jt(-1,.2,0).normalize(),{max:a,min:u}=this.getMaxAndMin(o,s),l=W.createShaderMaterial({gradualColor:this.options.gradualColor,center:this.getPosition(),maxValue:r,opacity:this.options.fillOpacity,direction:new jt(-1,.2,0),max:a,min:u});if(this.options.height<=.1)return this.material=l,l;let c=this.getCenter(),h=new jt(-1,.2,1).normalize(),{max:p,min:d}=this.getMaxAndMin(c,h),m=W.createShaderMaterial({gradualColor:[De(this.options.gradualColor[0],this.options.colorFactor),De(this.options.gradualColor[1],this.options.colorFactor)],center:this.getCenter(),maxValue:r,opacity:this.options.fillOpacity,direction:new jt(-1,.2,1),max:p,min:d});return this.material=[l,m],[l,m]}initMaterial(){return this.options.renderType==="gradual"?this.initGradualMaterial():this.initSingleMaterial()}initLineMaterial(){if(this.options.dashed){let t=W.createLineDashedMaterial({color:this.options.strokeColor,opacity:this.options.strokeOpacity});return this.lineMaterial=t,t}else{let t=W.createLineMaterial({color:this.options.strokeColor,opacity:this.options.strokeOpacity});return this.lineMaterial=t,t}}initMesh(){this.mesh&&this.remove(this.mesh),this.mesh=new UF(this.geometry,this.material),this.add(this.mesh)}getBorderPoints(){let t=[],e=this.options.height+this.options.deltaHeight,{coords:n}=this.options.geometry;for(let r=0;r<n.length;r++){let o=n[r];for(let s=0;s<o.length;s++){let a=o[s],u=s+1===o.length?o[0]:o[s+1];t.push(new jt(a[0],a[1],e)),t.push(new jt(u[0],u[1],e))}}return t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new FF().setFromPoints(t);this.lineGeometry=e}createBorder(){this.line&&this.remove(this.line);let t=new BF(this.lineGeometry,this.lineMaterial);return t.position.z=this.options.airHeight+.01,this.options.dashed&&t.computeLineDistances(),this.line=t,this.add(t),t}raycast(t){if(!this.visible||this.options.geometry.type==="point")return!1;this.mesh.updateMatrixWorld(!0);let e=t.intersectObject(this.mesh);if(e[0]){let{point:n,distance:r}=e[0];return{position:n,distance:r}}return!1}dispose(){var t,e;(t=this.geometry)==null||t.dispose(),(e=this.line)==null||e.geometry.dispose(),this.clear()}constructor(t,e){if(super(),this.context=t,this.line=null,this.options=Zn(GF(S({},Ic,e)),this),this.options.geometry.type==="point"){let[n,r]=this.options.geometry.coords;return this.position.set(n,r,this.options.height+this.options.airHeight),this}this.initDoor(),this.init(),this.visible=this.options.visible,this.addEventListener("change-fillColor",n=>{let{value:r}=n;this.initMaterial(),this.initMesh()}),this.addEventListener("change-fillOpacity",n=>{let{value:r}=n;this.initMaterial(),this.initMesh()}),this.addEventListener("change-height",n=>{let{value:r}=n;this.dispose(),this.init()}),this.addEventListener("change-strokeColor",n=>{let{value:r}=n;!this.options.stroke||!this.options.strokeOpacity||(this.initLineMaterial(),this.createBorder())}),this.addEventListener("change-strokeOpacity",n=>{let{value:r}=n;if(this.options.stroke)if(r)this.lineGeometry||this.initLineGeometry(),this.initLineMaterial(),this.createBorder();else{var o;this.line&&(this.remove(this.line),this.line=null),(o=this.lineGeometry)==null||o.dispose(),this.lineGeometry=void 0}}),this.addEventListener("change-airHeight",n=>{let{value:r}=n;this.position.z=r}),this.addEventListener("change-visible",n=>{let{value:r}=n;this.visible=r}),this.addEventListener("change-stroke",n=>{let{value:r}=n;if(r){if(this.line)return;this.initLineGeometry(),this.initLineMaterial(),this.createBorder()}else if(this.line){var o;this.remove(this.line),(o=this.lineGeometry)==null||o.dispose()}}),this.addEventListener("change-dashed",()=>{!this.options.stroke||!this.options.strokeOpacity||(this.lineGeometry||this.initLineGeometry(),this.initLineMaterial(),this.createBorder())}),this.addEventListener("change-renderType",()=>{this.initMaterial(),this.initMesh()}),this.addEventListener("change-gradualColor",()=>{this.initMaterial(),this.initMesh()})}};import{Object3D as kF,PlaneGeometry as VF,Mesh as HF,ShadowMaterial as WF,Color as qF,DoubleSide as XF}from"three";var Xs=class extends kF{initLight(){let t=Vg(16777215,.5);return t.position.set(0,0,100),this.add(t),t}changeLightCamera(t){let e=t.x,n=t.y;this.directionalLight.shadow.camera.left=-e,this.directionalLight.shadow.camera.right=e,this.directionalLight.shadow.camera.top=n,this.directionalLight.shadow.camera.bottom=-n,this.directionalLight.shadow.camera.near=.5,this.directionalLight.shadow.camera.far=Math.max(e,n)}changeLightColor(t){this.directionalLight.color=new qF(t)}setPosition(t){this.position.copy(t),this.directionalLight.position.set(-t.x/2,-t.y/2,100)}initPlane(t,e){t===void 0&&(t=1e3),e===void 0&&(e=1e3);let n=new VF(t,e),r=new WF({transparent:!0,opacity:0,side:XF}),o=new HF(n,r);return o.receiveShadow=!0,o.position.z=-10,this.add(o),this.plane=o,o}setTarget(t){this.directionalLight.target=t}transformOpacity(t){return t*this.basicOpacity}setOpacity(t){this.plane.material.opacity=this.transformOpacity(t)}dispose(){J(this,!0)}constructor(){super(),this.basicOpacity=.07,this.directionalLight=this.initLight(),this.initPlane()}};var E9=f(P(),1);import{EventDispatcher as KF,Vector3 as ZF}from"three";import{Box3 as P6,Vector3 as Q}from"three";import{debounce as jF}from"lodash";var YF={autoUpdate:!0,appendToBody:!1,autoChangePlacement:!1},xr=class extends pt{initObserver(){let t=new MutationObserver(jF(()=>{this.div&&this.usePlacement()},100));t.observe(this.div,{childList:!0,subtree:!0,attributes:!0}),this.observer=t}getPlacementPosition(){var t,e;if(this.element instanceof et&&this.element.options.geometry.type==="polygon"){let{max:s,min:a}=new P6().setFromObject(this.element),u=(s.x+a.x)/2,l=(s.y+a.y)/2;return{left:new Q(a.x,l,s.z),leftTop:new Q(a.x,s.y,s.z),top:new Q(u,s.y,s.z),rightTop:new Q(s.x,s.y,s.z),right:new Q(s.x,l,s.z),rightBottom:new Q(s.x,a.y,s.z),bottom:new Q(u,a.y,s.z),leftBottom:new Q(a.x,a.y,s.z),center:new Q(u,l,s.z)}}let{x:n,y:r,z:o}=((e=this.element)==null||(t=e.getPosition)==null?void 0:t.call(e))||this.position;return{left:new Q(n,r,o),leftTop:new Q(n,r,o),top:new Q(n,r,o),rightTop:new Q(n,r,o),right:new Q(n,r,o),rightBottom:new Q(n,r,o),bottom:new Q(n,r,o),leftBottom:new Q(n,r,o),center:new Q(n,r,o)}}getPlacementScreenPosition(){let{width:t,height:e}=this.context.clientSize,n=this.getPlacementPosition();return Object.keys(n).reduce((r,o)=>{let{x:s,y:a}=L(n[o],this.context.camera,t,e);return r[o]={x:s,y:a},r},{})}checkOverflow(t,e){let{width:n,height:r}=this.context.clientSize;return e.x>0&&t.x<n&&e.y<r&&t.y>0}getPlacement(){let{clientWidth:t,clientHeight:e}=this.div,n=this.getPlacementScreenPosition(),r=t/2,o=e/2,s=[{type:"center",getBox(a,u){return{max:{x:r+a,y:u-e},min:{x:a-r,y:u}}}},{type:"left",getBox(a,u){return{max:{x:a,y:u-o},min:{x:a-t,y:u+o}}}},{type:"leftTop",getBox(a,u){return{max:{x:a,y:u-e},min:{x:a-t,y:u}}}},{type:"top",getBox(a,u){return{max:{x:a+r,y:u-e},min:{x:a-r,y:u}}}},{type:"rightTop",getBox(a,u){return{max:{x:a+t,y:u-e},min:{x:a,y:u}}}},{type:"right",getBox(a,u){return{max:{x:a+t,y:u-o},min:{x:a,y:u+o}}}},{type:"rightBottom",getBox(a,u){return{max:{x:a+t,y:u},min:{x:a,y:u+e}}}},{type:"bottom",getBox(a,u){return{max:{x:a+r,y:u},min:{x:a-r,y:u+e}}}},{type:"leftBottom",getBox(a,u){return{max:{x:a,y:u},min:{x:a-t,y:u+o}}}}];for(let a=0;a<s.length;a++){let u=s[a],l=n[u.type],{max:c,min:h}=u.getBox(l.x,l.y);if(this.checkOverflow(c,h))return{type:u.type,position:l}}return{type:"center",position:n.center}}initDiv(){let t=document.createElement("div");return t.style.position="absolute",t}usePlacement(){let t=this.getPlacement();this.div.className="overlay_"+t.type,this._updatePosition(t.position.x,t.position.y)}bindElement(t){this.element=t,this.options.autoChangePlacement&&this.initObserver(),this.onUpdate()}unBindElement(){this.element=void 0}setVisible(t,e){e===void 0&&(e="block"),t!==this.visible&&(this.div.style.display=t?e:"none",this.visible=t)}setOpacity(t){this.div.style.opacity=""+t}getPosition(){return this.element?typeof this.element.getPosition=="function"?this.element.getPosition():new P6().setFromObject(this.element).getCenter(new Q):this.position}get withinDisplayRange(){let{x:t,y:e}=this.clientPos,{width:n,height:r}=this.context.clientSize;return t>=0&&t<=n&&e>=0&&e<=r}_updatePosition(t,e){this.clientPos={x:t,y:e};let{width:n,height:r,x:o,y:s}=this.context.clientSize;this.options.appendToBody&&(this.div.style.left=""+o+"px",this.div.style.top=""+(s+r)+"px"),this.options.autoUpdate?this.div.style.transform="translate3d("+t+"px, "+(-r+e)+"px, 0)":this.dispatchEvent({type:"update-position",x:t,y:e,width:n,height:r})}updatePosition(t){t===void 0&&(t=!1);let e=this.getPosition(),{width:n,height:r}=this.context.clientSize,{x:o,y:s}=L(e,this.context.camera,n,r);this.clientPos.x===o&&this.clientPos.y===s&&!t||this._updatePosition(o,s)}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}dispose(){var t,e;super.dispose(),this.unRegistryEvent(),this.unBindElement(),(t=this.observer)==null||t.disconnect(),(e=this.div)==null||e.remove(),this.div=null}constructor(t,e={}){super(),this.context=t,this.position=new Q,this.clientPos={x:0,y:0},this.visible=!0,this.placement="top",this.observer=null,this.onUpdate=()=>{this.options.autoChangePlacement?this.usePlacement():this.updatePosition()},this.options=S({},YF,e),this.registryEvent(),this.div=this.initDiv(),this.options.appendToBody?document.body.appendChild(this.div):this.context.container.appendChild(this.div)}};var $F={texts:[{text:""}],level:1,icon_position:"bottom",collision_enable:!0,opacity:1,id:"",position:{x:0,y:0,z:0},icon_opacity:1,icon_border:{color:"#586EE0",width:0},background:"",collision_hide_icon:!0,built_in:!1,box_only_icon:!1},Nn=class extends KF{get withinDisplayRange(){return this.overlay.withinDisplayRange}resetSize(){return E(this,null,function*(){if(yield Lm(),!this.disposed)if(this.options.box_only_icon){if(!this.img)return;let{width:t,height:e}=this.img.getBoundingClientRect();this.size={width:t+2,height:e+2}}else{let{width:t,height:e}=this.div.getBoundingClientRect();this.size={width:t+2,height:e+2}}})}renderHelperBox(){}get clientPos(){return this.overlay.clientPos}initDiv(){let t=document.createElement("div");return this.div=t,this.addText(),this.options.icon&&this.addIcon(),t.style.fontSize="12px",t.style.textShadow="#fff 1px 0 0, #fff 0 1px 0, #fff -1px 0 0, #fff 0 -1px 0",t.style.display="flex",t.style.flexDirection="column",t.style.justifyContent="center",t.style.alignItems="center",t.style.padding="4px",this.overlay.setOpacity(this.options.opacity),this.overlay.div.style.pointerEvents="none",this.overlay.div.style.userSelect="none",this.overlay.div.appendChild(t),this.resetSize(),t}addIcon(){if(!this.img){let t=this.initIcon();this.options.icon_position==="top"?this.div.firstChild?this.div.insertBefore(t,this.div.firstChild):this.div.appendChild(t):this.div.appendChild(t)}}addText(){let t=this.initText();this.options.icon_position==="top"?this.div.appendChild(t):this.div.firstChild?this.div.insertBefore(t,this.div.firstChild):this.div.appendChild(t)}getPosition(){return this.position}initText(){let t=document.createElement("div");return t.appendChild(this.createTextFragment()),t.style.textAlign="center",this.textDiv=t,t}createTextFragment(){let t=document.createDocumentFragment();return this.options.texts.forEach(e=>{let n=document.createElement("div");if(n.style.whiteSpace="nowrap",e.styles)for(let[r,o]of Object.entries(e.styles))n.style[r]=o;n.textContent=e.text,t.appendChild(n)}),t}initIcon(){var t,e;let n=document.createElement("img");return n.setAttribute("src",this.options.icon),n.style.width=""+(((t=this.options.icon_size)==null?void 0:t[0])||32)+"px",n.style.height=""+(((e=this.options.icon_size)==null?void 0:e[1])||32)+"px",n.style.opacity=""+this.options.icon_opacity+"px",n.style.borderRadius="50%",this.options.icon_border.width&&(n.style.border=this.options.icon_border.width+"px solid "+this.options.icon_border.color),n.onload=()=>{this.resetSize()},this.img=n,n}registryEvent(){}unRegistryEvent(){}setVisible(t){t!==this.visible&&(this.visible=t,this.changeOverlayVisible(t))}changeOverlayVisible(t){if(!(t===this.overlay.visible&&this.options.collision_hide_icon))if(this.options.collision_hide_icon)this.overlay.visible=t,this.overlay.div.style.visibility=t?"visible":"hidden";else{if(this.showTextStatus===t)return;this.textDiv.style.visibility=t?"visible":"hidden",this.showTextStatus=t}}parentSetVisible(t){this.visible&&this.changeOverlayVisible(t)}getBox(t){t===void 0&&(t=this.context.config.poi.boxScale);let{width:e,height:n}=this.size,r=e*t,o=n*t,{x:s,y:a}=this.overlay.clientPos;return{left:s-r/2,right:s+r/2,top:this.options.icon?a-o:a-o/2,bottom:this.options.icon?a:a+o/2}}getOriginBox(){return this.getBox(1)}isContain(t,e){if(!this.overlay.visible||!this.visible)return!1;let n=this.getOriginBox();return t>=n.left&&t<=n.right&&e>=n.top&&e<=n.bottom}dispose(){this.unRegistryEvent(),this.div=null,this.textDiv=null,this.img=void 0,this.overlay.dispose(),this.disposed=!0}constructor(t,e){var n,r,o;super(),this.context=t,this.visible=!0,this.size={width:0,height:0},this.position=new ZF,this.userData={},this.showTextStatus=!0,this.disposed=!1,this._changePosition=()=>{this.overlay.updatePosition(!0)},this.options=Zn(S({},$F,e),this),this.position.set(((n=e.position)==null?void 0:n.x)||0,((r=e.position)==null?void 0:r.y)||0,((o=e.position)==null?void 0:o.z)||0),this.overlay=new xr(this.context,{autoUpdate:!1}),this.overlay.addEventListener("update-position",s=>{let{x:a,y:u,height:l}=s;this.overlay.div.style.transform="translate3d(calc("+a+"px - 50%), calc("+(-l+u)+"px - "+(this.options.icon&&this.options.icon_position!=="center"?"100%":"50%")+"), 0)"}),this.overlay.bindElement(this),this.registryEvent(),this.initDiv(),this.addEventListener("change-icon",s=>{let{value:a}=s;a?this.img?this.img.setAttribute("src",a):(this.addIcon(),this._changePosition()):(this.img&&this.div.removeChild(this.img),this.img=void 0,this._changePosition(),this.resetSize())}),this.addEventListener("change-texts",s=>{let{value:a}=s,u=this.textDiv;if(u){let l=this.initText();this.div.replaceChild(l,u)}else this.addText();this.resetSize()}),this.addEventListener("change-opacity",s=>{let{value:a}=s;this.overlay.setOpacity(a)}),this.addEventListener("change-icon_size",s=>{let{value:a}=s;this.img&&(this.img.style.width=""+((a==null?void 0:a[0])||32)+"px",this.img.style.height=""+((a==null?void 0:a[1])||32)+"px",this.resetSize())}),this.addEventListener("change-icon_opacity",s=>{let{value:a}=s;this.img&&(this.img.style.opacity=""+a)}),this.addEventListener("change-icon_border",s=>{let{value:a}=s;this.img&&(this.img.style.border=a.width+"px solid "+a.color)}),this.addEventListener("change-background",s=>{let{value:a}=s;this.div.style.background=a})}};var bK=f(P(),1),MK=f(de(),1),wK=f(ge(),1),TK=f(me(),1),AK=f(_e(),1),CK=f(ve(),1),RK=f(ye(),1),PK=f(xe(),1);import{Box3 as Qs,Object3D as Lc,Vector3 as ta}from"three";import{MeshBasicMaterial as JF,Object3D as QF,PlaneGeometry as tB,Texture as eB,DoubleSide as nB,Mesh as rB,Matrix3 as I6,Vector2 as iB}from"three";import{create as oB}from"@mars3d/heatmap.js";import{featureCollection as sB,point as aB,bbox as uB,center as lB}from"@turf/turf";var js=class extends QF{clearHeatmap(){this.div.firstChild&&this.div.removeChild(this.div.firstChild),this.heatmap=void 0}loadData(t){this.clearHeatmap();let{width:e,height:n,leftTop:r,center:o}=this.getBox(t);this.heatmap=oB(S({width:e,height:n,container:this.div},this.context.config.heatMap)),this.heatmap.setData(this.transformData(t,r)),this.initPlane(e,n),this.position.set(o[0],o[1],this.position.z)}initPlane(t,e){this.plane&&this.remove(this.plane);let n=new tB(t,e),r=new eB(this.div.firstChild);r.needsUpdate=!0;let o=new JF({transparent:!0,side:nB,map:r});o.needsUpdate=!0,this.plane=new rB(n,o),this.add(this.plane)}getTransMatrix(t){let{x:e,y:n}=t;return new I6().makeScale(1,-1).multiply(new I6().makeTranslation(0-e,0-n))}transformData(t,e){let n=this.getTransMatrix(e);return{data:t.data.map(o=>{let s=new iB(o.x,o.y).applyMatrix3(n);return{x:s.x,y:s.y,value:o.value}}),max:t.max,min:t.min}}getBox(t){let e=sB(t.data.map(u=>aB([u.x,u.y]))),n=uB(e),r=n[2]-n[0],o=n[3]-n[1],s={x:n[0],y:n[3]},a=lB(e);return{width:r,height:o,leftTop:s,center:a.geometry.coordinates}}dispose(){this.div=null,this.heatmap=void 0}constructor(t){super(),this.context=t,this.div=document.createElement("div")}};import{Object3D as cB,Vector3 as hB}from"three";var Ys=class extends cB{loadModel(){return E(this,null,function*(){let t=yield bt.loadModel(this.options.modelUrl);t.scene.rotation.set(Math.PI/2,Math.PI/2,0),this.add(t.scene),this.model=t})}dispose(){J(this),this.model=null}constructor(t,e){super(),this.context=t,this.options=e,this.model=null,this.position.copy(e.position||new hB(0,0,0)),this.loadModel()}};var G9=f(P(),1);import{Box3 as fB,Vector3 as dB}from"three";import{Object3D as pB}from"three";var it=class extends pB{dispose(){J(this),this.children.forEach(t=>t.dispose==null?void 0:t.dispose.call(t)),this.clear()}constructor(t){super(),this.context=t}};var Ks=class extends it{getCenter(){return new fB().setFromObject(this).getCenter(new dB)}createGraphic(t){let e=new et(this.context,t);return e.userData.data=t,this.add(e),this.graphicMap.set(t.id,e),e}removeGraphic(t){this.remove(t),this.graphicMap.delete(t.options.id),t.dispose()}removeGraphicById(t){this.graphicMap.has(t)&&this.removeGraphic(this.graphicMap.get(t))}getGraphicByNodeId(t){return this.graphicMap.get(t)||null}getGraphicByRaycaster(t){let e={distance:1e4,graphic:null,position:null},n=this.children.reduce((r,o)=>{if(o instanceof et){let s=o.raycast(t);if(s){let{distance:a}=s;if(a<r.distance)return{distance:s.distance,position:s.position,graphic:o}}return r}else return r},e);return n===e?{graphics:[],position:null}:{graphics:[n.graphic],position:n.position}}constructor(t){super(t),this.graphicMap=new Map}};var j9=f(Zs(),1),Y9=f(U(),1);import{debounce as MB}from"lodash";var $s=class extends it{clear(t){return t===void 0&&(t=!1),this.pois.forEach(e=>{e.options.built_in&&!t||e.dispose()}),this.pois=t?[]:this.pois.filter(e=>e.options.built_in),this}createPoi(t){let e=new Nn(this.context,t);return this.pushPoi(e),e.addEventListener("change-level",()=>this.changePoiLevelOrCollisionEnable(e)),e.addEventListener("change-collision_enable",()=>this.changePoiLevelOrCollisionEnable(e)),Promise.resolve().then(()=>{this.debounceCollisionDetection()}),e}changePoiLevelOrCollisionEnable(t){let e=this.pois.findIndex(n=>n===t);e!==-1&&(this.pois.splice(e,1),this.pushPoi(t))}removePoi(t){let e=this.pois.findIndex(n=>n===t);e!==-1&&(this.pois.splice(e,1),t.dispose())}removePoiById(t){let e=this.pois.find(n=>n.options.id===t);e&&this.removePoi(e)}getPoiById(t){return this.pois.find(n=>n.options.id===t)||null}pushPoi(t){if(!t.options.collision_enable){this.pois.unshift(t);return}if(t.options.level===0){this.pois.push(t);return}for(let e=0;e<this.pois.length;e++){let n=this.pois[e];if(n.options.collision_enable&&n.options.level<=t.options.level){this.pois.splice(e,0,t);return}}this.pois.push(t)}getPoiByDeviceXy(t,e){return this.pois.filter(r=>r instanceof Nn&&r.isContain(t,e))}collisionDetection(){let t=[];this.pois.filter(n=>n.visible&&n.withinDisplayRange).forEach((n,r)=>{let{left:o,right:s,top:a,bottom:u}=n.getBox();if(r===0||!n.options.collision_enable){t.push({left:o,right:s,top:a,bottom:u}),n.parentSetVisible(!0);return}let l=t.some(c=>c.left<s&&c.right>o&&c.top<u&&c.bottom>a);n.parentSetVisible(!l),l||t.push({left:o,right:s,top:a,bottom:u})})}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}dispose(){this.timer.dispose(),this.pois.forEach(t=>t.dispose()),this.pois.length=0,this.debounceCollisionDetection=()=>{},super.dispose(),this.unRegistryEvent()}constructor(t){super(t),this.pois=[],this.timer=new j,this.onUpdate=()=>{this.timer.requestAnimationFrame(()=>{this.collisionDetection()})},this.registryEvent(),this.debounceCollisionDetection=MB(this.collisionDetection,10)}};var tK=f(Zs(),1),eK=f(U(),1);import{debounce as L6}from"lodash";import{Vector2 as wB,Vector3 as TB}from"three";var Er=class extends it{clear(){return this.pois.forEach(t=>{t.dispose()}),this.pois=[],this}createPoi(t){let e=new nt(this.context,t);return this.pushPoi(e),e}changePoiLevelOrCollisionEnable(t){let e=this.pois.findIndex(n=>n===t);e!==-1&&(this.pois.splice(e,1),this.pushPoi(t))}removePoi(t){let e=this.pois.findIndex(n=>n===t);e!==-1&&(this.remove(t),this.pois.splice(e,1),t.dispose())}removePoiById(t){let e=this.pois.find(n=>n.options.id===t);e&&this.removePoi(e)}getPoiById(t){return this.pois.find(n=>n.options.id===t)||null}pushPoi(t){if(this.add(t),t.addEventListener("change-level",()=>this.changePoiLevelOrCollisionEnable(t)),t.addEventListener("change-collision_enable",()=>this.changePoiLevelOrCollisionEnable(t)),Promise.resolve().then(()=>{this.debounceChangeParkingSpaceVisibleByZoom(),this.debounceCollisionDetection()}),!t.options.collision_enable){this.pois.unshift(t);return}if(t.options.level===0){this.pois.push(t);return}for(let e=0;e<this.pois.length;e++){let n=this.pois[e];if(n.options.collision_enable&&n.options.level<=t.options.level){this.pois.splice(e,0,t);return}}this.pois.push(t)}getPoiByDeviceXy(t,e){let n=new wB(t,e);return this.pois.filter(o=>o instanceof nt&&o.canSelect&&o.box.containsPoint(n))}collisionDetection(){let t=[],{camera:e}=this.context;e.updateMatrixWorld();let n=a=>a<=1&&a>=-1,r=e.projectionMatrix.clone();r.multiply(e.matrixWorldInverse);let o=e.zoom/this.context.basicZoom;this.pois.filter(a=>{if(a.visible){var u,l;if(!(o<=a.options.maxWeight&&o>=a.options.minWeight))return a.parentSetVisible(!1),!1;let c=a.spriteIcon?(u=a.spriteIcon)==null?void 0:u.matrixWorld:((l=a.spriteText)==null?void 0:l.matrixWorld)||a.matrixWorld,h=new TB().setFromMatrixPosition(c);return h.applyMatrix4(r),a.screenPosition=h,n(h.x)&&n(h.y)&&n(h.z)}return!1}).forEach((a,u)=>{let l=a.getBox(a.screenPosition);if(u===0||!a.options.collision_enable){t.push(l),a.parentSetVisible(!0);return}let c=t.some(h=>h.intersectsBox(l));a.parentSetVisible(!c),c||t.push(l)})}registryEvent(){this.context.addEventListener("update",this.onUpdate),this.context.addEventListener("control-zoom-change",this.changeParkingSpaceVisibleByZoom)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate),this.context.removeEventListener("control-zoom-change",this.changeParkingSpaceVisibleByZoom)}dispose(){this.timer.dispose(),this.pois.forEach(t=>t.dispose()),this.pois.length=0,this.debounceCollisionDetection=()=>{},super.dispose(),this.unRegistryEvent()}constructor(t){super(t),this.pois=[],this.timer=new j,this.changeParkingSpaceVisibleByZoom=()=>{var e;let n=(e=this.parent)==null?void 0:e.parent;if(n&&n instanceof Yt){let{clientSize:{width:r,height:o}}=this.context,{max:s,min:a}=n.box,l=Math.min(r/(s.x-a.x),o/(s.y-a.y))*(s.x-a.x)/60,c=this.context.camera.zoom>=l;this.pois.filter(h=>h.userData.type==="parkingSpace").map(h=>{h.visible=c,c||h.parentSetVisible(c)})}},this.onUpdate=()=>{this.timer.requestAnimationFrame(()=>{this.collisionDetection()})},this.registryEvent(),this.debounceCollisionDetection=L6(this.collisionDetection,10),this.debounceChangeParkingSpaceVisibleByZoom=L6(this.changeParkingSpaceVisibleByZoom,10)}};var lK=f(U(),1),cK=f(P(),1);import{Group as AB}from"three";var Js=class extends it{createParkings(t,e){e===void 0&&(e=!0),this.parkingOptions=t,this.merged=e,e?this.createMergedParking(t):this.createIndependentParking(t),this.createParkingTexture(t)}createMergedParking(t){let e=t.reduce((n,r)=>{let{fillColor:o,fillOpacity:s,strokeColor:a,strokeOpacity:u,height:l,airHeight:c}=r,h=o.toLowerCase()+"-"+s+"-"+a.toLowerCase()+"-"+u+"-"+l+"-"+c;return u===0&&(h=o.toLowerCase()+"-"+s+"-"+l+"-"+c),n[h]?n[h].push(r):n[h]=[r],this.parkingNoOptionsMap.set(r.texts[0],r),n},{});Promise.all(Object.values(e).map(n=>new Promise(r=>{let o=new br(this.context,n),s=()=>{o.removeEventListener("init-geometry",s),r(o)};o.addEventListener("init-geometry",s)}))).then(n=>{J(this.mergedGraphicGroup),this.mergedGraphicGroup.clear(),this.mergedGraphicGroup.add(...n)})}createIndependentParking(t){t.forEach(e=>{let n=new et(this.context,e);this.add(n),this.parkingNoGraphicMap.set(e.texts[0],n),this.graphicMap.set(n.options.id,n)})}createParkingTexture(t){let e=t.filter(n=>Cc[n.parkingType]).map(n=>{let r=tm(n.geometry.coords,[n.center_coord_x,n.center_coord_y]);return{uuid:n.id,iconUrl:Cc[n.parkingType],name:n.texts[0],deltaHeight:n.deltaHeight,airHeight:n.airHeight,height:n.height,geometry:S({},n.geometry,{coords:r}),opacity:n.fillOpacity,visible:!0}});if(e.length){let n=new Sr(this.context,e);this.add(n)}}changeParkingColor(t){this.merged?(Object.keys(t).map(e=>{let n=this.parkingNoOptionsMap.get(e);n&&(n.fillColor=t[e])}),this.createMergedParking(this.parkingOptions)):Object.keys(t).map(e=>{let n=this.parkingNoGraphicMap.get(e);n&&(n.options.fillColor=t[e])})}dispose(){this.graphicMap.clear(),this.parkingNoGraphicMap.clear(),this.parkingNoOptionsMap.clear(),this.parkingOptions=[],super.dispose()}constructor(t){super(t),this.graphicMap=new Map,this.parkingNoGraphicMap=new Map,this.parkingOptions=[],this.parkingNoOptionsMap=new Map,this.merged=!1,this.mergedGraphicGroup=new AB,this.add(this.mergedGraphicGroup)}};var Yt=class extends Lc{getPosition(){return this.box.getCenter(new ta)}createGround(t){let e=new et(this.context,t);e.userData.data=t,this.addGrounds([e])}addGrounds(t){t.forEach(e=>{this.grounds.has(e)||(e.mesh.castShadow=!0,this.grounds.add(e),this.groundLayer.add(e))}),this.changeGroundMaxHeight()}changeGroundMaxHeight(){let t=Array.from(this.grounds);this.groundMaxHeight=this.grounds.size>0?Math.max(...t.map(e=>e.options.height+e.options.airHeight+e.options.deltaHeight)):0,this.groundUpper.position.z=this.groundMaxHeight+.01}get hasElement(){return!!(this.grounds.size||this.graphicLayer.children.length)}getCenter(){return new Qs().setFromObject(this).getCenter(new ta)}addModel(t){let e=new Ys(this.context,t);return this.models.add(e),this.modelMap.set(t.id,e),e}addShadow(){let t=new Qs().setFromObject(this.groundUpper),e=t.getCenter(new ta),n=t.getSize(new ta);this.shadow.setPosition(e),this.shadow.changeLightCamera(n)}addGraphic(t){return this.graphicLayer.createGraphic(t)}addPoi(t){return this.poiLayer.createPoi(t)}addHeatmap(t){this.heatmap||(this.heatmap=new js(this.context),this.add(this.heatmap)),this.heatmap.loadData(t);let e=new Qs().setFromObject(this.graphicLayer);return this.heatmap.position.setZ(e.max.z),this.heatmap}removeHeatMap(){this.heatmap&&(this.remove(this.heatmap),this.heatmap.dispose(),this.heatmap=void 0)}setShadowOpacity(t){this.shadow.setOpacity(t)}setShadowVisible(t){this.shadow.visible=t}updateBox(){this.box.setFromObject(this.groundLayer)}dispose(){var t;console.log("floor dispose",this.name),this.shadow.dispose(),this.groundLayer.dispose(),this.graphicLayer.dispose(),this.poiLayer.dispose(),this.poiLayer2.dispose(),this.parkingSpaceLayer.dispose(),this.wallLayer.dispose(),this.textureLayer.dispose(),this.glbModelLayer.dispose(),this.laneLayer.dispose(),this.mergeGraphicLayer.dispose(),this.textTextureLayer.dispose(),this.grounds.forEach(e=>e.dispose()),(t=this.heatmap)==null||t.dispose(),this.groundUpper.clear(),this.models.children.forEach(e=>e.dispose()),this.models.clear(),this.modelMap.clear(),this.clear()}constructor(t){super(),this.context=t,this.grounds=new Set,this.shadow=new Xs,this.groundUpper=new Lc,this.models=new Lc,this.modelMap=new Map,this.groundMaxHeight=0,this.name="",this.key="",this.box=new Qs,this.groundLayer=new it(this.context),this.graphicLayer=new Ks(this.context),this.poiLayer=new $s(this.context),this.poiLayer2=new Er(this.context),this.parkingSpaceLayer=new Js(this.context),this.wallLayer=new it(this.context),this.textureLayer=new it(this.context),this.glbModelLayer=new it(this.context),this.laneLayer=new it(this.context),this.mergeGraphicLayer=new it(this.context),this.textTextureLayer=new it(this.context),this.groundUpper.add(this.graphicLayer),this.groundUpper.add(this.poiLayer),this.groundUpper.add(this.poiLayer2),this.groundUpper.add(this.parkingSpaceLayer),this.groundUpper.add(this.wallLayer),this.groundUpper.add(this.textureLayer),this.groundUpper.add(this.glbModelLayer),this.groundUpper.add(this.laneLayer),this.groundUpper.add(this.mergeGraphicLayer),this.groundUpper.add(this.textTextureLayer),this.add(this.groundUpper),this.add(this.groundLayer),this.add(this.models)}};var kK=f(U(),1),VK=f(P(),1);import{EventDispatcher as CB,Vector3 as RB}from"three";var Kt=class extends CB{_registryEvent(){this.context.addEventListener("resize",this._onResize)}_unRegistryEvent(){this.context.removeEventListener("resize",this._onResize)}setEnable(t){this.enable=t,t?this.svg.style.display="block":this.svg.style.display="none"}getIntersectByPointerEvent(t){let{camera:e,renderer:n}=this.context,{offsetX:r,offsetY:o}=t,{clientWidth:s,clientHeight:a}=n.domElement,u=r/s*2-1,l=1-o/a*2;return new RB(u,l,0).unproject(e)}getSvgCoordinate(t){let{camera:e,container:n}=this.context;return L(t,e,n.clientWidth,n.clientHeight)}dispose(){this._unRegistryEvent(),this.context.container.removeChild(this.svg),this.svg=null}constructor(t){super(),this.context=t,this.points=[],this.enable=!0,this._onResize=e=>{let{width:n,height:r}=e;this.svg&&(this.svg.setAttribute("width",""+n),this.svg.setAttribute("height",""+r))},this.svg=Im(""+t.container.clientWidth,""+t.container.clientHeight),t.container.appendChild(this.svg),this._registryEvent()}};var ea=class extends Kt{setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}registryEvent(){this.context.container.addEventListener("pointerenter",this.onPointermove),this.context.container.addEventListener("pointermove",this.onPointermove),this.context.container.addEventListener("pointerleave",this.onPointerleave),this.context.container.addEventListener("pointerdown",this.onPointerdown),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerenter",this.onPointermove),this.context.container.removeEventListener("pointermove",this.onPointermove),this.context.container.removeEventListener("pointerleave",this.onPointerleave),this.context.container.removeEventListener("pointerdown",this.onPointerdown),this.context.removeEventListener("update",this.onUpdate)}addPoint(t){if(this.points.push(t),this.points.length>=2){let e=this.calculatedDistance();this.dispatchEvent({type:"distance",distance:e})}}calculatedDistance(){let[{x:t,y:e},{x:n,y:r}]=this.points;return Math.sqrt((n-t)**2+(r-e)**2)}dispose(){super.dispose(),this.unRegistryEvent(),this.line=null,this.circles=[]}constructor(t){super(t),this.context=t,this.onUpdate=()=>{if(this.points[0]){let r=this.getSvgCoordinate(this.points[0]);Tn(this.circles[0],r.x,r.y),ne(this.line,r)}if(this.points[1]){let r=this.getSvgCoordinate(this.points[1]);Tn(this.circles[1],r.x,r.y),ne(this.line,void 0,r)}},this.onPointermove=r=>{this.points.length===1&&(this.line.style.display="block",ne(this.line,void 0,{x:r.offsetX,y:r.offsetY}))},this.onPointerleave=()=>{this.points[1]||(this.line.style.display="none")},this.onPointerdown=r=>{if(this.points[1])return;let o=this.getIntersectByPointerEvent(r);if(o){let{offsetX:s,offsetY:a}=r,u=this.circles[this.points.length];Tn(u,s,a),this.points.length||ne(this.line,{x:s,y:a},{x:s,y:a}),this.addPoint(o)}};let{config:{svg:{circle:e,line:n}}}=t;this.circles=[Qr(e.radius,e.fill),Qr(e.radius,e.fill)],this.line=Vo(n.stroke),this.svg.appendChild(this.circles[0]),this.svg.appendChild(this.circles[1]),this.svg.appendChild(this.line),this.registryEvent()}};var XK=f(U(),1);var na=class extends Kt{setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}get lastLine(){return this.lines.slice(-1)[0]}addCircle(t){this.circles.push(t),this.svg.appendChild(t)}addLine(t){this.lines.push(t),this.svg.appendChild(t)}registryEvent(){this.context.container.addEventListener("pointerenter",this.onPointermove),this.context.container.addEventListener("pointermove",this.onPointermove),this.context.container.addEventListener("pointerleave",this.onPointerleave),this.context.container.addEventListener("pointerdown",this.onPointerdown),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerenter",this.onPointermove),this.context.container.removeEventListener("pointermove",this.onPointermove),this.context.container.removeEventListener("pointerleave",this.onPointerleave),this.context.container.removeEventListener("pointerdown",this.onPointerdown),this.context.removeEventListener("update",this.onUpdate)}checkAdsorb(t,e){if(this.points.length<3)return!1;let n=this.circles[0],r=+n.getAttribute("cx"),o=+n.getAttribute("cy");return Math.sqrt((t-r)**2+(e-o)**2)<=5}addPoint(t){if(this.points.push(t),this.isClose){let e=this.calculatedArea();this.dispatchEvent({type:"area",area:e})}}calculatedArea(){let t=this.points.map(r=>[r.x,r.y]),e=0,n=t.length;for(let r=0;r<n;r++){let o=(r+1)%n;e+=t[r][0]*t[o][1]-t[o][0]*t[r][1]}return Math.abs(e/2)}dispose(){super.dispose(),this.unRegistryEvent(),this.lines=[],this.circles=[]}constructor(t){super(t),this.circles=[],this.lines=[],this.isClose=!1,this.onUpdate=()=>{this.points.length&&this.points.forEach((e,n)=>{let r=this.getSvgCoordinate(e);this.circles[n]&&Tn(this.circles[n],r.x,r.y),n!==0&&ne(this.lines[n-1],void 0,r),this.lines[n]&&ne(this.lines[n],r)})},this.onPointermove=e=>{!this.lastLine||this.isClose||(this.lastLine.style.display="block",ne(this.lastLine,void 0,{x:e.offsetX,y:e.offsetY}))},this.onPointerleave=()=>{this.isClose||(this.lastLine.style.display="none")},this.onPointerdown=e=>{if(this.isClose)return;let n=this.getIntersectByPointerEvent(e);if(n){let{offsetX:r,offsetY:o}=e;this.checkAdsorb(r,o)?(this.isClose=!0,this.addPoint(this.points[0])):this.addPoint(n);let{circle:{fill:s,radius:a},line:{stroke:u}}=this.context.config.svg;if(!this.isClose){let l=Qr(a,s);Tn(l,r,o),this.addCircle(l)}if(this.lines.length&&ne(this.lastLine,void 0,{x:r,y:o}),!this.isClose){let l=Vo(u);ne(l,{x:r,y:o},{x:r,y:o}),this.addLine(l)}}},this.registryEvent()}};import{Box3 as PB}from"three";var N6=class extends Kt{setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}selectGraphic(t){this.graphic=t}dispose(){super.dispose(),this.unRegistryEvent(),this.rect=null,this.cornerRect=[],this.centerRect=[]}constructor(t){super(t),this.context=t,this.cornerRect=[],this.centerRect=[],this.onUpdate=()=>{if(this.graphic){let n=new PB().setFromObject(this.graphic),{camera:r,container:{clientWidth:o,clientHeight:s}}=this.context,{min:a,max:u}=n,l=L(a,r,o,s),c=L(u,r,o,s);gt(this.rect,l.x,c.y,Math.abs(c.x-l.x),Math.abs(c.y-l.y));let{x:h,y:p}=l,{x:d,y:m}=c,_=5,v=[{x:h-_,y:m-_},{x:d-_,y:m-_},{x:h-_,y:p-_},{x:d-_,y:p-_}];for(let w=0;w<v.length;w++)gt(this.cornerRect[w],v[w].x,v[w].y,_*2,_*2);let x=4,M=(h+d)/2,b=(p+m)/2,C=[{x:M-x,y:m-x},{x:h-x,y:b-x},{x:d-x,y:b-x},{x:M-x,y:p-x}];for(let w=0;w<C.length;w++)gt(this.centerRect[w],C[w].x,C[w].y,x*2,x*2)}else{gt(this.rect,0,0,0,0);for(let n=0;n<this.cornerRect.length;n++)gt(this.cornerRect[n],0,0,0,0),gt(this.centerRect[n],0,0,0,0)}};let{config:{svg:{line:e}}}=t;this.rect=nn(e.stroke,"transparent"),this.svg.appendChild(this.rect);for(let n=0;n<4;n++)this.cornerRect[n]=nn(e.stroke,"#ffffff"),this.centerRect[n]=nn(e.stroke,"#ffffff"),this.svg.appendChild(this.cornerRect[n]),this.svg.appendChild(this.centerRect[n]);this.registryEvent()}};var t7=f(U(),1);import{BufferGeometry as IB,Color as Nc,LineSegments as LB,Mesh as NB,Object3D as OB,ShaderMaterial as DB,Vector3 as O6}from"three";import{mergeGeometries as UB}from"three/examples/jsm/utils/BufferGeometryUtils";var ra=class extends OB{initGeometry(){return E(this,null,function*(){let t=yield ue.GetMergeGeometry(this.options);this.geometry=t})}initMaterial(){let t=`
3846
+ `],{type:"text/javascript"}),t=URL.createObjectURL(i),e=new Worker(t);return URL.revokeObjectURL(t),e}import{BufferGeometry as NF,BufferAttribute as A6}from"three";var ue=class{static GetMergeGeometry(t){return E(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield rt(e,"get_merged_geometry_attributes",{data:t}),r=this.GetBufferGeometryByData(n);return this.WorkerPool.releaseWorker(e),r})}static GetMergedShapeGeometry(t){return E(this,null,function*(){let e=yield this.WorkerPool.getWorker(),n=yield rt(e,"get_merged_shape_geometry_attributes",{data:t}),r=this.GetBufferGeometryByData(n);return this.WorkerPool.releaseWorker(e),r})}static GetBufferGeometryByData(t){let e=new NF;return Object.keys(t.attributes).forEach(n=>{e.setAttribute(n,new A6(t.attributes[n].array,t.attributes[n].itemSize))}),t.index&&e.setIndex(new A6(t.index.array,t.index.itemSize)),e.morphAttributes=t.morphAttributes,e.morphTargetsRelative=t.morphTargetsRelative,e.groups=t.groups,e.boundingSphere=t.boundingSphere,e}static dispose(){this.WorkerPool.dispose()}};ue.WorkerPool=new Qo(10,Pc);import{cloneDeep as GF}from"lodash";var Ic={id:"",height:.1,airHeight:0,area:0,group:"",fillColor:"#EFF4FB",strokeColor:"#ffffff",fillOpacity:1,strokeOpacity:1,strokeWidth:1,doors:[],locked:!1,visible:!0,geometry:{type:"polygon",cds:[],coords:[],curveCpt:[],curveIndex:[]},layerType:"",zIndex:0,stroke:!0,deltaHeight:0,userData:{},gradualColor:[],renderType:"single",colorFactor:.9,center_coord_x:0,center_coord_y:0,dashed:!1},et=class extends OF{getCenter(){if(this.options.geometry.type==="point")return this.position.clone();let t=new jt,e=new qs;return e.setFromObject(this),e.getCenter(t),t}getSize(){if(this.options.geometry.type==="point")return new jt(0,0,0);let t=new qs,e=new jt;return t.setFromObject(this),t.getSize(e),e}getPosition(){let{center_coord_x:t,center_coord_y:e}=this.options,n=this.getCenter();return n.setZ(n.z+this.options.height/2),new jt(t,e,n.z+this.options.height/2)}init(){this.geometry=this.initGeometry(),this.initMaterial(),this.initMesh(),this.mesh.position.z=this.options.airHeight+this.options.deltaHeight,this.options.stroke&&this.options.strokeOpacity!==0&&(this.initLineMaterial(),this.initLineGeometry(),this.createBorder())}initDoor(){var t;if((t=this.options.doors)!=null&&t.length&&this.options.geometry.type==="polygon"){let e=this.options.geometry.coords[0];this.options.doors.forEach(n=>{let r=n.type==="single"?.5:1,o=.5,s=Oe(e,n.coord),a=new He(...n.coord),u=new He(...e[s]).sub(new He(...n.coord)).normalize(),l=new He().addVectors(a,u.clone().multiplyScalar(r)),c=new He().addVectors(a,u.clone().multiplyScalar(-r)),h=new He(-u.y,u.x),p=new He().addVectors(l,h.clone().multiplyScalar(o));em([p.x,p.y],e)||(h.multiplyScalar(-1),p=new He().addVectors(l,h.clone().multiplyScalar(o)));let d=new He().addVectors(c,h.clone().multiplyScalar(o)),m=[[l.x,l.y],[p.x,p.y],[d.x,d.y],[c.x,c.y]];this.options.geometry.coords=[[...e.slice(0,s+1),...m,...e.slice(s+1)]],e=this.options.geometry.coords[0]})}}initGeometry(){let t=Io(this.options.geometry.coords[0],this.options.geometry.coords.slice(1));return new DF(t,{steps:1,bevelEnabled:!1,depth:this.options.height,curveSegments:4})}initSingleMaterial(){let t=W.createMeshBasicMaterial({color:this.options.fillColor,opacity:this.options.fillOpacity});if(this.options.secondUrl&&ut.getTextureByUrl(this.options.secondUrl).then(n=>{n.wrapS=R6,n.wrapT=R6,n.needsUpdate=!0,t.map=n,t.side=zF}),this.options.height<=.1)return this.material=t,t;let e=W.createMeshBasicMaterial({color:De(this.options.fillColor),opacity:this.options.fillOpacity});return this.material=[t,e],[t,e]}getMaxAndMin(t,e){let n=new qs().setFromObject(this),r=t.clone().add(e.clone().multiplyScalar(1e3)),o=new C6(r,e.clone().multiplyScalar(-1)),s=new jt;o.intersectBox(n,s);let a=t.clone().add(e.clone().multiplyScalar(-1e3)),u=new C6(a,e.clone()),l=new jt;return u.intersectBox(n,l),{max:l,min:s}}initGradualMaterial(){let{max:t,min:e}=new qs().setFromObject(this),n=t.clone().sub(e),r=Math.max(n.x,n.y,n.z)/2,o=this.getPosition(),s=new jt(-1,.2,0).normalize(),{max:a,min:u}=this.getMaxAndMin(o,s),l=W.createShaderMaterial({gradualColor:this.options.gradualColor,center:this.getPosition(),maxValue:r,opacity:this.options.fillOpacity,direction:new jt(-1,.2,0),max:a,min:u});if(this.options.height<=.1)return this.material=l,l;let c=this.getCenter(),h=new jt(-1,.2,1).normalize(),{max:p,min:d}=this.getMaxAndMin(c,h),m=W.createShaderMaterial({gradualColor:[De(this.options.gradualColor[0],this.options.colorFactor),De(this.options.gradualColor[1],this.options.colorFactor)],center:this.getCenter(),maxValue:r,opacity:this.options.fillOpacity,direction:new jt(-1,.2,1),max:p,min:d});return this.material=[l,m],[l,m]}initMaterial(){return this.options.renderType==="gradual"?this.initGradualMaterial():this.initSingleMaterial()}initLineMaterial(){if(this.options.dashed){let t=W.createLineDashedMaterial({color:this.options.strokeColor,opacity:this.options.strokeOpacity});return this.lineMaterial=t,t}else{let t=W.createLineMaterial({color:this.options.strokeColor,opacity:this.options.strokeOpacity});return this.lineMaterial=t,t}}initMesh(){this.mesh&&this.remove(this.mesh),this.mesh=new UF(this.geometry,this.material),this.add(this.mesh)}getBorderPoints(){let t=[],e=this.options.height+this.options.deltaHeight,{coords:n}=this.options.geometry;for(let r=0;r<n.length;r++){let o=n[r];for(let s=0;s<o.length;s++){let a=o[s],u=s+1===o.length?o[0]:o[s+1];t.push(new jt(a[0],a[1],e)),t.push(new jt(u[0],u[1],e))}}return t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new FF().setFromPoints(t);this.lineGeometry=e}createBorder(){this.line&&this.remove(this.line);let t=new BF(this.lineGeometry,this.lineMaterial);return t.position.z=this.options.airHeight+.01,this.options.dashed&&t.computeLineDistances(),this.line=t,this.add(t),t}raycast(t){if(!this.visible||this.options.geometry.type==="point")return!1;this.mesh.updateMatrixWorld(!0);let e=t.intersectObject(this.mesh);if(e[0]){let{point:n,distance:r}=e[0];return{position:n,distance:r}}return!1}dispose(){var t,e;(t=this.geometry)==null||t.dispose(),(e=this.line)==null||e.geometry.dispose(),this.clear()}constructor(t,e){if(super(),this.context=t,this.line=null,this.options=Zn(GF(S({},Ic,e)),this),this.options.geometry.type==="point"){let[n,r]=this.options.geometry.coords;return this.position.set(n,r,this.options.height+this.options.airHeight),this}this.initDoor(),this.init(),this.visible=this.options.visible,this.addEventListener("change-fillColor",n=>{let{value:r}=n;this.initMaterial(),this.initMesh()}),this.addEventListener("change-fillOpacity",n=>{let{value:r}=n;this.initMaterial(),this.initMesh()}),this.addEventListener("change-height",n=>{let{value:r}=n;this.dispose(),this.init()}),this.addEventListener("change-strokeColor",n=>{let{value:r}=n;!this.options.stroke||!this.options.strokeOpacity||(this.initLineMaterial(),this.createBorder())}),this.addEventListener("change-strokeOpacity",n=>{let{value:r}=n;if(this.options.stroke)if(r)this.lineGeometry||this.initLineGeometry(),this.initLineMaterial(),this.createBorder();else{var o;this.line&&(this.remove(this.line),this.line=null),(o=this.lineGeometry)==null||o.dispose(),this.lineGeometry=void 0}}),this.addEventListener("change-airHeight",n=>{let{value:r}=n;this.position.z=r}),this.addEventListener("change-visible",n=>{let{value:r}=n;this.visible=r}),this.addEventListener("change-stroke",n=>{let{value:r}=n;if(r){if(this.line)return;this.initLineGeometry(),this.initLineMaterial(),this.createBorder()}else if(this.line){var o;this.remove(this.line),(o=this.lineGeometry)==null||o.dispose()}}),this.addEventListener("change-dashed",()=>{!this.options.stroke||!this.options.strokeOpacity||(this.lineGeometry||this.initLineGeometry(),this.initLineMaterial(),this.createBorder())}),this.addEventListener("change-renderType",()=>{this.initMaterial(),this.initMesh()}),this.addEventListener("change-gradualColor",()=>{this.initMaterial(),this.initMesh()})}};import{Object3D as kF,PlaneGeometry as VF,Mesh as HF,ShadowMaterial as WF,Color as qF,DoubleSide as XF}from"three";var Xs=class extends kF{initLight(){let t=Vg(16777215,.5);return t.position.set(0,0,100),this.add(t),t}changeLightCamera(t){let e=t.x,n=t.y;this.directionalLight.shadow.camera.left=-e,this.directionalLight.shadow.camera.right=e,this.directionalLight.shadow.camera.top=n,this.directionalLight.shadow.camera.bottom=-n,this.directionalLight.shadow.camera.near=.5,this.directionalLight.shadow.camera.far=Math.max(e,n)}changeLightColor(t){this.directionalLight.color=new qF(t)}setPosition(t){this.position.copy(t),this.directionalLight.position.set(-t.x/2,-t.y/2,100)}initPlane(t,e){t===void 0&&(t=1e3),e===void 0&&(e=1e3);let n=new VF(t,e),r=new WF({transparent:!0,opacity:0,side:XF}),o=new HF(n,r);return o.receiveShadow=!0,o.position.z=-10,this.add(o),this.plane=o,o}setTarget(t){this.directionalLight.target=t}transformOpacity(t){return t*this.basicOpacity}setOpacity(t){this.plane.material.opacity=this.transformOpacity(t)}dispose(){J(this,!0)}constructor(){super(),this.basicOpacity=.07,this.directionalLight=this.initLight(),this.initPlane()}};var E9=f(P(),1);import{EventDispatcher as KF,Vector3 as ZF}from"three";import{Box3 as P6,Vector3 as Q}from"three";import{debounce as jF}from"lodash";var YF={autoUpdate:!0,appendToBody:!1,autoChangePlacement:!1},xr=class extends pt{initObserver(){let t=new MutationObserver(jF(()=>{this.div&&this.usePlacement()},100));t.observe(this.div,{childList:!0,subtree:!0,attributes:!0}),this.observer=t}getPlacementPosition(){var t,e;if(this.element instanceof et&&this.element.options.geometry.type==="polygon"){let{max:s,min:a}=new P6().setFromObject(this.element),u=(s.x+a.x)/2,l=(s.y+a.y)/2;return{left:new Q(a.x,l,s.z),leftTop:new Q(a.x,s.y,s.z),top:new Q(u,s.y,s.z),rightTop:new Q(s.x,s.y,s.z),right:new Q(s.x,l,s.z),rightBottom:new Q(s.x,a.y,s.z),bottom:new Q(u,a.y,s.z),leftBottom:new Q(a.x,a.y,s.z),center:new Q(u,l,s.z)}}let{x:n,y:r,z:o}=((e=this.element)==null||(t=e.getPosition)==null?void 0:t.call(e))||this.position;return{left:new Q(n,r,o),leftTop:new Q(n,r,o),top:new Q(n,r,o),rightTop:new Q(n,r,o),right:new Q(n,r,o),rightBottom:new Q(n,r,o),bottom:new Q(n,r,o),leftBottom:new Q(n,r,o),center:new Q(n,r,o)}}getPlacementScreenPosition(){let{width:t,height:e}=this.context.clientSize,n=this.getPlacementPosition();return Object.keys(n).reduce((r,o)=>{let{x:s,y:a}=L(n[o],this.context.camera,t,e);return r[o]={x:s,y:a},r},{})}checkOverflow(t,e){let{width:n,height:r}=this.context.clientSize;return e.x>0&&t.x<n&&e.y<r&&t.y>0}getPlacement(){let{clientWidth:t,clientHeight:e}=this.div,n=this.getPlacementScreenPosition(),r=t/2,o=e/2,s=[{type:"center",getBox(a,u){return{max:{x:r+a,y:u-e},min:{x:a-r,y:u}}}},{type:"left",getBox(a,u){return{max:{x:a,y:u-o},min:{x:a-t,y:u+o}}}},{type:"leftTop",getBox(a,u){return{max:{x:a,y:u-e},min:{x:a-t,y:u}}}},{type:"top",getBox(a,u){return{max:{x:a+r,y:u-e},min:{x:a-r,y:u}}}},{type:"rightTop",getBox(a,u){return{max:{x:a+t,y:u-e},min:{x:a,y:u}}}},{type:"right",getBox(a,u){return{max:{x:a+t,y:u-o},min:{x:a,y:u+o}}}},{type:"rightBottom",getBox(a,u){return{max:{x:a+t,y:u},min:{x:a,y:u+e}}}},{type:"bottom",getBox(a,u){return{max:{x:a+r,y:u},min:{x:a-r,y:u+e}}}},{type:"leftBottom",getBox(a,u){return{max:{x:a,y:u},min:{x:a-t,y:u+o}}}}];for(let a=0;a<s.length;a++){let u=s[a],l=n[u.type],{max:c,min:h}=u.getBox(l.x,l.y);if(this.checkOverflow(c,h))return{type:u.type,position:l}}return{type:"center",position:n.center}}initDiv(){let t=document.createElement("div");return t.style.position="absolute",t}usePlacement(){let t=this.getPlacement();this.div.className="overlay_"+t.type,this._updatePosition(t.position.x,t.position.y)}bindElement(t){this.element=t,this.options.autoChangePlacement&&this.initObserver(),this.onUpdate()}unBindElement(){this.element=void 0}setVisible(t,e){e===void 0&&(e="block"),t!==this.visible&&(this.div.style.display=t?e:"none",this.visible=t)}setOpacity(t){this.div.style.opacity=""+t}getPosition(){return this.element?typeof this.element.getPosition=="function"?this.element.getPosition():new P6().setFromObject(this.element).getCenter(new Q):this.position}get withinDisplayRange(){let{x:t,y:e}=this.clientPos,{width:n,height:r}=this.context.clientSize;return t>=0&&t<=n&&e>=0&&e<=r}_updatePosition(t,e){this.clientPos={x:t,y:e};let{width:n,height:r,x:o,y:s}=this.context.clientSize;this.options.appendToBody&&(this.div.style.left=""+o+"px",this.div.style.top=""+(s+r)+"px"),this.options.autoUpdate?this.div.style.transform="translate3d("+t+"px, "+(-r+e)+"px, 0)":this.dispatchEvent({type:"update-position",x:t,y:e,width:n,height:r})}updatePosition(t){t===void 0&&(t=!1);let e=this.getPosition(),{width:n,height:r}=this.context.clientSize,{x:o,y:s}=L(e,this.context.camera,n,r);this.clientPos.x===o&&this.clientPos.y===s&&!t||this._updatePosition(o,s)}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}dispose(){var t,e;super.dispose(),this.unRegistryEvent(),this.unBindElement(),(t=this.observer)==null||t.disconnect(),(e=this.div)==null||e.remove(),this.div=null}constructor(t,e={}){super(),this.context=t,this.position=new Q,this.clientPos={x:0,y:0},this.visible=!0,this.placement="top",this.observer=null,this.onUpdate=()=>{this.options.autoChangePlacement?this.usePlacement():this.updatePosition()},this.options=S({},YF,e),this.registryEvent(),this.div=this.initDiv(),this.options.appendToBody?document.body.appendChild(this.div):this.context.container.appendChild(this.div)}};var $F={texts:[{text:""}],level:1,icon_position:"bottom",collision_enable:!0,opacity:1,id:"",position:{x:0,y:0,z:0},icon_opacity:1,icon_border:{color:"#586EE0",width:0},background:"",collision_hide_icon:!0,built_in:!1,box_only_icon:!1},Nn=class extends KF{get withinDisplayRange(){return this.overlay.withinDisplayRange}resetSize(){return E(this,null,function*(){if(yield Lm(),!this.disposed)if(this.options.box_only_icon){if(!this.img)return;let{width:t,height:e}=this.img.getBoundingClientRect();this.size={width:t+2,height:e+2}}else{let{width:t,height:e}=this.div.getBoundingClientRect();this.size={width:t+2,height:e+2}}})}renderHelperBox(){}get clientPos(){return this.overlay.clientPos}initDiv(){let t=document.createElement("div");return this.div=t,this.addText(),this.options.icon&&this.addIcon(),t.style.fontSize="12px",t.style.textShadow="#fff 1px 0 0, #fff 0 1px 0, #fff -1px 0 0, #fff 0 -1px 0",t.style.display="flex",t.style.flexDirection="column",t.style.justifyContent="center",t.style.alignItems="center",t.style.padding="4px",this.overlay.setOpacity(this.options.opacity),this.overlay.div.style.pointerEvents="none",this.overlay.div.style.userSelect="none",this.overlay.div.appendChild(t),this.resetSize(),t}addIcon(){if(!this.img){let t=this.initIcon();this.options.icon_position==="top"?this.div.firstChild?this.div.insertBefore(t,this.div.firstChild):this.div.appendChild(t):this.div.appendChild(t)}}addText(){let t=this.initText();this.options.icon_position==="top"?this.div.appendChild(t):this.div.firstChild?this.div.insertBefore(t,this.div.firstChild):this.div.appendChild(t)}getPosition(){return this.position}initText(){let t=document.createElement("div");return t.appendChild(this.createTextFragment()),t.style.textAlign="center",this.textDiv=t,t}createTextFragment(){let t=document.createDocumentFragment();return this.options.texts.forEach(e=>{let n=document.createElement("div");if(n.style.whiteSpace="nowrap",e.styles)for(let[r,o]of Object.entries(e.styles))n.style[r]=o;n.textContent=e.text,t.appendChild(n)}),t}initIcon(){var t,e;let n=document.createElement("img");return n.setAttribute("src",this.options.icon),n.style.width=""+(((t=this.options.icon_size)==null?void 0:t[0])||32)+"px",n.style.height=""+(((e=this.options.icon_size)==null?void 0:e[1])||32)+"px",n.style.opacity=""+this.options.icon_opacity+"px",n.style.borderRadius="50%",this.options.icon_border.width&&(n.style.border=this.options.icon_border.width+"px solid "+this.options.icon_border.color),n.onload=()=>{this.resetSize()},this.img=n,n}registryEvent(){}unRegistryEvent(){}setVisible(t){t!==this.visible&&(this.visible=t,this.changeOverlayVisible(t))}changeOverlayVisible(t){if(!(t===this.overlay.visible&&this.options.collision_hide_icon))if(this.options.collision_hide_icon)this.overlay.visible=t,this.overlay.div.style.visibility=t?"visible":"hidden";else{if(this.showTextStatus===t)return;this.textDiv.style.visibility=t?"visible":"hidden",this.showTextStatus=t}}parentSetVisible(t){this.visible&&this.changeOverlayVisible(t)}getBox(t){t===void 0&&(t=this.context.config.poi.boxScale);let{width:e,height:n}=this.size,r=e*t,o=n*t,{x:s,y:a}=this.overlay.clientPos;return{left:s-r/2,right:s+r/2,top:this.options.icon?a-o:a-o/2,bottom:this.options.icon?a:a+o/2}}getOriginBox(){return this.getBox(1)}isContain(t,e){if(!this.overlay.visible||!this.visible)return!1;let n=this.getOriginBox();return t>=n.left&&t<=n.right&&e>=n.top&&e<=n.bottom}dispose(){this.unRegistryEvent(),this.div=null,this.textDiv=null,this.img=void 0,this.overlay.dispose(),this.disposed=!0}constructor(t,e){var n,r,o;super(),this.context=t,this.visible=!0,this.size={width:0,height:0},this.position=new ZF,this.userData={},this.showTextStatus=!0,this.disposed=!1,this._changePosition=()=>{this.overlay.updatePosition(!0)},this.options=Zn(S({},$F,e),this),this.position.set(((n=e.position)==null?void 0:n.x)||0,((r=e.position)==null?void 0:r.y)||0,((o=e.position)==null?void 0:o.z)||0),this.overlay=new xr(this.context,{autoUpdate:!1}),this.overlay.addEventListener("update-position",s=>{let{x:a,y:u,height:l}=s;this.overlay.div.style.transform="translate3d(calc("+a+"px - 50%), calc("+(-l+u)+"px - "+(this.options.icon&&this.options.icon_position!=="center"?"100%":"50%")+"), 0)"}),this.overlay.bindElement(this),this.registryEvent(),this.initDiv(),this.addEventListener("change-icon",s=>{let{value:a}=s;a?this.img?this.img.setAttribute("src",a):(this.addIcon(),this._changePosition()):(this.img&&this.div.removeChild(this.img),this.img=void 0,this._changePosition(),this.resetSize())}),this.addEventListener("change-texts",s=>{let{value:a}=s,u=this.textDiv;if(u){let l=this.initText();this.div.replaceChild(l,u)}else this.addText();this.resetSize()}),this.addEventListener("change-opacity",s=>{let{value:a}=s;this.overlay.setOpacity(a)}),this.addEventListener("change-icon_size",s=>{let{value:a}=s;this.img&&(this.img.style.width=""+((a==null?void 0:a[0])||32)+"px",this.img.style.height=""+((a==null?void 0:a[1])||32)+"px",this.resetSize())}),this.addEventListener("change-icon_opacity",s=>{let{value:a}=s;this.img&&(this.img.style.opacity=""+a)}),this.addEventListener("change-icon_border",s=>{let{value:a}=s;this.img&&(this.img.style.border=a.width+"px solid "+a.color)}),this.addEventListener("change-background",s=>{let{value:a}=s;this.div.style.background=a})}};var bK=f(P(),1),MK=f(de(),1),wK=f(ge(),1),TK=f(me(),1),AK=f(_e(),1),CK=f(ve(),1),RK=f(ye(),1),PK=f(xe(),1);import{Box3 as Qs,Object3D as Lc,Vector3 as ta}from"three";import{MeshBasicMaterial as JF,Object3D as QF,PlaneGeometry as tB,Texture as eB,DoubleSide as nB,Mesh as rB,Matrix3 as I6,Vector2 as iB}from"three";import{create as oB}from"@mars3d/heatmap.js";import{featureCollection as sB,point as aB,bbox as uB,center as lB}from"@turf/turf";var js=class extends QF{clearHeatmap(){this.div.firstChild&&this.div.removeChild(this.div.firstChild),this.heatmap=void 0}loadData(t){this.clearHeatmap();let{width:e,height:n,leftTop:r,center:o}=this.getBox(t);this.heatmap=oB(S({width:e,height:n,container:this.div},this.context.config.heatMap)),this.heatmap.setData(this.transformData(t,r)),this.initPlane(e,n),this.position.set(o[0],o[1],this.position.z)}initPlane(t,e){this.plane&&this.remove(this.plane);let n=new tB(t,e),r=new eB(this.div.firstChild);r.needsUpdate=!0;let o=new JF({transparent:!0,side:nB,map:r});o.needsUpdate=!0,this.plane=new rB(n,o),this.add(this.plane)}getTransMatrix(t){let{x:e,y:n}=t;return new I6().makeScale(1,-1).multiply(new I6().makeTranslation(0-e,0-n))}transformData(t,e){let n=this.getTransMatrix(e);return{data:t.data.map(o=>{let s=new iB(o.x,o.y).applyMatrix3(n);return{x:s.x,y:s.y,value:o.value}}),max:t.max,min:t.min}}getBox(t){let e=sB(t.data.map(u=>aB([u.x,u.y]))),n=uB(e),r=n[2]-n[0],o=n[3]-n[1],s={x:n[0],y:n[3]},a=lB(e);return{width:r,height:o,leftTop:s,center:a.geometry.coordinates}}dispose(){this.div=null,this.heatmap=void 0}constructor(t){super(),this.context=t,this.div=document.createElement("div")}};import{Object3D as cB,Vector3 as hB}from"three";var Ys=class extends cB{loadModel(){return E(this,null,function*(){let t=yield bt.loadModel(this.options.modelUrl);t.scene.rotation.set(Math.PI/2,Math.PI/2,0),this.add(t.scene),this.model=t})}dispose(){J(this),this.model=null}constructor(t,e){super(),this.context=t,this.options=e,this.model=null,this.position.copy(e.position||new hB(0,0,0)),this.loadModel()}};var G9=f(P(),1);import{Box3 as fB,Vector3 as dB}from"three";import{Object3D as pB}from"three";var it=class extends pB{dispose(){J(this),this.children.forEach(t=>t.dispose==null?void 0:t.dispose.call(t)),this.clear()}constructor(t){super(),this.context=t}};var Ks=class extends it{getCenter(){return new fB().setFromObject(this).getCenter(new dB)}createGraphic(t){let e=new et(this.context,t);return e.userData.data=t,this.add(e),this.graphicMap.set(t.id,e),e}removeGraphic(t){this.remove(t),this.graphicMap.delete(t.options.id),t.dispose()}removeGraphicById(t){this.graphicMap.has(t)&&this.removeGraphic(this.graphicMap.get(t))}getGraphicByNodeId(t){return this.graphicMap.get(t)||null}getGraphicByRaycaster(t){let e={distance:1e4,graphic:null,position:null},n=this.children.reduce((r,o)=>{if(o instanceof et){let s=o.raycast(t);if(s){let{distance:a}=s;if(a<r.distance)return{distance:s.distance,position:s.position,graphic:o}}return r}else return r},e);return n===e?{graphics:[],position:null}:{graphics:[n.graphic],position:n.position}}constructor(t){super(t),this.graphicMap=new Map}};var j9=f(Zs(),1),Y9=f(U(),1);import{debounce as MB}from"lodash";var $s=class extends it{clear(t){return t===void 0&&(t=!1),this.pois.forEach(e=>{e.options.built_in&&!t||e.dispose()}),this.pois=t?[]:this.pois.filter(e=>e.options.built_in),this}createPoi(t){let e=new Nn(this.context,t);return this.pushPoi(e),e.addEventListener("change-level",()=>this.changePoiLevelOrCollisionEnable(e)),e.addEventListener("change-collision_enable",()=>this.changePoiLevelOrCollisionEnable(e)),Promise.resolve().then(()=>{this.debounceCollisionDetection()}),e}changePoiLevelOrCollisionEnable(t){let e=this.pois.findIndex(n=>n===t);e!==-1&&(this.pois.splice(e,1),this.pushPoi(t))}removePoi(t){let e=this.pois.findIndex(n=>n===t);e!==-1&&(this.pois.splice(e,1),t.dispose())}removePoiById(t){let e=this.pois.find(n=>n.options.id===t);e&&this.removePoi(e)}getPoiById(t){return this.pois.find(n=>n.options.id===t)||null}pushPoi(t){if(!t.options.collision_enable){this.pois.unshift(t);return}if(t.options.level===0){this.pois.push(t);return}for(let e=0;e<this.pois.length;e++){let n=this.pois[e];if(n.options.collision_enable&&n.options.level<=t.options.level){this.pois.splice(e,0,t);return}}this.pois.push(t)}getPoiByDeviceXy(t,e){return this.pois.filter(r=>r instanceof Nn&&r.isContain(t,e))}collisionDetection(){let t=[];this.pois.filter(n=>n.visible&&n.withinDisplayRange).forEach((n,r)=>{let{left:o,right:s,top:a,bottom:u}=n.getBox();if(r===0||!n.options.collision_enable){t.push({left:o,right:s,top:a,bottom:u}),n.parentSetVisible(!0);return}let l=t.some(c=>c.left<s&&c.right>o&&c.top<u&&c.bottom>a);n.parentSetVisible(!l),l||t.push({left:o,right:s,top:a,bottom:u})})}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}dispose(){this.timer.dispose(),this.pois.forEach(t=>t.dispose()),this.pois.length=0,this.debounceCollisionDetection=()=>{},super.dispose(),this.unRegistryEvent()}constructor(t){super(t),this.pois=[],this.timer=new j,this.onUpdate=()=>{this.timer.requestAnimationFrame(()=>{this.collisionDetection()})},this.registryEvent(),this.debounceCollisionDetection=MB(this.collisionDetection,10)}};var tK=f(Zs(),1),eK=f(U(),1);import{debounce as L6}from"lodash";import{Vector2 as wB,Vector3 as TB}from"three";var Er=class extends it{clear(){return this.pois.forEach(t=>{t.dispose()}),this.pois=[],this}createPoi(t){let e=new nt(this.context,t);return this.pushPoi(e),e}changePoiLevelOrCollisionEnable(t){let e=this.pois.findIndex(n=>n===t);e!==-1&&(this.pois.splice(e,1),this.pushPoi(t))}removePoi(t){let e=this.pois.findIndex(n=>n===t);e!==-1&&(this.remove(t),this.pois.splice(e,1),t.dispose())}removePoiById(t){let e=this.pois.find(n=>n.options.id===t);e&&this.removePoi(e)}getPoiById(t){return this.pois.find(n=>n.options.id===t)||null}pushPoi(t){if(this.add(t),t.addEventListener("change-level",()=>this.changePoiLevelOrCollisionEnable(t)),t.addEventListener("change-collision_enable",()=>this.changePoiLevelOrCollisionEnable(t)),Promise.resolve().then(()=>{this.debounceChangeParkingSpaceVisibleByZoom(),this.debounceCollisionDetection()}),!t.options.collision_enable){this.pois.unshift(t);return}if(t.options.level===0){this.pois.push(t);return}for(let e=0;e<this.pois.length;e++){let n=this.pois[e];if(n.options.collision_enable&&n.options.level<=t.options.level){this.pois.splice(e,0,t);return}}this.pois.push(t)}getPoiByDeviceXy(t,e){let n=new wB(t,e);return this.pois.filter(o=>o instanceof nt&&o.canSelect&&o.box.containsPoint(n))}collisionDetection(){let t=[],{camera:e}=this.context;e.updateMatrixWorld();let n=a=>a<=1&&a>=-1,r=e.projectionMatrix.clone();r.multiply(e.matrixWorldInverse);let o=e.zoom/this.context.basicZoom;console.log("currentWeight",o),this.pois.filter(a=>{if(a.visible){var u,l;if(!(o<=a.options.maxWeight+.1&&o>=a.options.minWeight-.1))return a.parentSetVisible(!1),!1;let c=a.spriteIcon?(u=a.spriteIcon)==null?void 0:u.matrixWorld:((l=a.spriteText)==null?void 0:l.matrixWorld)||a.matrixWorld,h=new TB().setFromMatrixPosition(c);return h.applyMatrix4(r),a.screenPosition=h,n(h.x)&&n(h.y)&&n(h.z)}return!1}).forEach((a,u)=>{let l=a.getBox(a.screenPosition);if(u===0||!a.options.collision_enable){t.push(l),a.parentSetVisible(!0);return}let c=t.some(h=>h.intersectsBox(l));a.parentSetVisible(!c),c||t.push(l)})}registryEvent(){this.context.addEventListener("update",this.onUpdate),this.context.addEventListener("control-zoom-change",this.changeParkingSpaceVisibleByZoom)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate),this.context.removeEventListener("control-zoom-change",this.changeParkingSpaceVisibleByZoom)}dispose(){this.timer.dispose(),this.pois.forEach(t=>t.dispose()),this.pois.length=0,this.debounceCollisionDetection=()=>{},super.dispose(),this.unRegistryEvent()}constructor(t){super(t),this.pois=[],this.timer=new j,this.changeParkingSpaceVisibleByZoom=()=>{var e;let n=(e=this.parent)==null?void 0:e.parent;if(n&&n instanceof Yt){let{clientSize:{width:r,height:o}}=this.context,{max:s,min:a}=n.box,l=Math.min(r/(s.x-a.x),o/(s.y-a.y))*(s.x-a.x)/60,c=this.context.camera.zoom>=l;this.pois.filter(h=>h.userData.type==="parkingSpace").map(h=>{h.visible=c,c||h.parentSetVisible(c)})}},this.onUpdate=()=>{this.timer.requestAnimationFrame(()=>{this.collisionDetection()})},this.registryEvent(),this.debounceCollisionDetection=L6(this.collisionDetection,10),this.debounceChangeParkingSpaceVisibleByZoom=L6(this.changeParkingSpaceVisibleByZoom,10)}};var lK=f(U(),1),cK=f(P(),1);import{Group as AB}from"three";var Js=class extends it{createParkings(t,e){e===void 0&&(e=!0),this.parkingOptions=t,this.merged=e,e?this.createMergedParking(t):this.createIndependentParking(t),this.createParkingTexture(t)}createMergedParking(t){let e=t.reduce((n,r)=>{let{fillColor:o,fillOpacity:s,strokeColor:a,strokeOpacity:u,height:l,airHeight:c}=r,h=o.toLowerCase()+"-"+s+"-"+a.toLowerCase()+"-"+u+"-"+l+"-"+c;return u===0&&(h=o.toLowerCase()+"-"+s+"-"+l+"-"+c),n[h]?n[h].push(r):n[h]=[r],this.parkingNoOptionsMap.set(r.texts[0],r),n},{});Promise.all(Object.values(e).map(n=>new Promise(r=>{let o=new br(this.context,n),s=()=>{o.removeEventListener("init-geometry",s),r(o)};o.addEventListener("init-geometry",s)}))).then(n=>{J(this.mergedGraphicGroup),this.mergedGraphicGroup.clear(),this.mergedGraphicGroup.add(...n)})}createIndependentParking(t){t.forEach(e=>{let n=new et(this.context,e);this.add(n),this.parkingNoGraphicMap.set(e.texts[0],n),this.graphicMap.set(n.options.id,n)})}createParkingTexture(t){let e=t.filter(n=>Cc[n.parkingType]).map(n=>{let r=tm(n.geometry.coords,[n.center_coord_x,n.center_coord_y]);return{uuid:n.id,iconUrl:Cc[n.parkingType],name:n.texts[0],deltaHeight:n.deltaHeight,airHeight:n.airHeight,height:n.height,geometry:S({},n.geometry,{coords:r}),opacity:n.fillOpacity,visible:!0}});if(e.length){let n=new Sr(this.context,e);this.add(n)}}changeParkingColor(t){this.merged?(Object.keys(t).map(e=>{let n=this.parkingNoOptionsMap.get(e);n&&(n.fillColor=t[e])}),this.createMergedParking(this.parkingOptions)):Object.keys(t).map(e=>{let n=this.parkingNoGraphicMap.get(e);n&&(n.options.fillColor=t[e])})}dispose(){this.graphicMap.clear(),this.parkingNoGraphicMap.clear(),this.parkingNoOptionsMap.clear(),this.parkingOptions=[],super.dispose()}constructor(t){super(t),this.graphicMap=new Map,this.parkingNoGraphicMap=new Map,this.parkingOptions=[],this.parkingNoOptionsMap=new Map,this.merged=!1,this.mergedGraphicGroup=new AB,this.add(this.mergedGraphicGroup)}};var Yt=class extends Lc{getPosition(){return this.box.getCenter(new ta)}createGround(t){let e=new et(this.context,t);e.userData.data=t,this.addGrounds([e])}addGrounds(t){t.forEach(e=>{this.grounds.has(e)||(e.mesh.castShadow=!0,this.grounds.add(e),this.groundLayer.add(e))}),this.changeGroundMaxHeight()}changeGroundMaxHeight(){let t=Array.from(this.grounds);this.groundMaxHeight=this.grounds.size>0?Math.max(...t.map(e=>e.options.height+e.options.airHeight+e.options.deltaHeight)):0,this.groundUpper.position.z=this.groundMaxHeight+.01}get hasElement(){return!!(this.grounds.size||this.graphicLayer.children.length)}getCenter(){return new Qs().setFromObject(this).getCenter(new ta)}addModel(t){let e=new Ys(this.context,t);return this.models.add(e),this.modelMap.set(t.id,e),e}addShadow(){let t=new Qs().setFromObject(this.groundUpper),e=t.getCenter(new ta),n=t.getSize(new ta);this.shadow.setPosition(e),this.shadow.changeLightCamera(n)}addGraphic(t){return this.graphicLayer.createGraphic(t)}addPoi(t){return this.poiLayer.createPoi(t)}addHeatmap(t){this.heatmap||(this.heatmap=new js(this.context),this.add(this.heatmap)),this.heatmap.loadData(t);let e=new Qs().setFromObject(this.graphicLayer);return this.heatmap.position.setZ(e.max.z),this.heatmap}removeHeatMap(){this.heatmap&&(this.remove(this.heatmap),this.heatmap.dispose(),this.heatmap=void 0)}setShadowOpacity(t){this.shadow.setOpacity(t)}setShadowVisible(t){this.shadow.visible=t}updateBox(){this.box.setFromObject(this.groundLayer)}dispose(){var t;console.log("floor dispose",this.name),this.shadow.dispose(),this.groundLayer.dispose(),this.graphicLayer.dispose(),this.poiLayer.dispose(),this.poiLayer2.dispose(),this.parkingSpaceLayer.dispose(),this.wallLayer.dispose(),this.textureLayer.dispose(),this.glbModelLayer.dispose(),this.laneLayer.dispose(),this.mergeGraphicLayer.dispose(),this.textTextureLayer.dispose(),this.grounds.forEach(e=>e.dispose()),(t=this.heatmap)==null||t.dispose(),this.groundUpper.clear(),this.models.children.forEach(e=>e.dispose()),this.models.clear(),this.modelMap.clear(),this.clear()}constructor(t){super(),this.context=t,this.grounds=new Set,this.shadow=new Xs,this.groundUpper=new Lc,this.models=new Lc,this.modelMap=new Map,this.groundMaxHeight=0,this.name="",this.key="",this.box=new Qs,this.groundLayer=new it(this.context),this.graphicLayer=new Ks(this.context),this.poiLayer=new $s(this.context),this.poiLayer2=new Er(this.context),this.parkingSpaceLayer=new Js(this.context),this.wallLayer=new it(this.context),this.textureLayer=new it(this.context),this.glbModelLayer=new it(this.context),this.laneLayer=new it(this.context),this.mergeGraphicLayer=new it(this.context),this.textTextureLayer=new it(this.context),this.groundUpper.add(this.graphicLayer),this.groundUpper.add(this.poiLayer),this.groundUpper.add(this.poiLayer2),this.groundUpper.add(this.parkingSpaceLayer),this.groundUpper.add(this.wallLayer),this.groundUpper.add(this.textureLayer),this.groundUpper.add(this.glbModelLayer),this.groundUpper.add(this.laneLayer),this.groundUpper.add(this.mergeGraphicLayer),this.groundUpper.add(this.textTextureLayer),this.add(this.groundUpper),this.add(this.groundLayer),this.add(this.models)}};var kK=f(U(),1),VK=f(P(),1);import{EventDispatcher as CB,Vector3 as RB}from"three";var Kt=class extends CB{_registryEvent(){this.context.addEventListener("resize",this._onResize)}_unRegistryEvent(){this.context.removeEventListener("resize",this._onResize)}setEnable(t){this.enable=t,t?this.svg.style.display="block":this.svg.style.display="none"}getIntersectByPointerEvent(t){let{camera:e,renderer:n}=this.context,{offsetX:r,offsetY:o}=t,{clientWidth:s,clientHeight:a}=n.domElement,u=r/s*2-1,l=1-o/a*2;return new RB(u,l,0).unproject(e)}getSvgCoordinate(t){let{camera:e,container:n}=this.context;return L(t,e,n.clientWidth,n.clientHeight)}dispose(){this._unRegistryEvent(),this.context.container.removeChild(this.svg),this.svg=null}constructor(t){super(),this.context=t,this.points=[],this.enable=!0,this._onResize=e=>{let{width:n,height:r}=e;this.svg&&(this.svg.setAttribute("width",""+n),this.svg.setAttribute("height",""+r))},this.svg=Im(""+t.container.clientWidth,""+t.container.clientHeight),t.container.appendChild(this.svg),this._registryEvent()}};var ea=class extends Kt{setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}registryEvent(){this.context.container.addEventListener("pointerenter",this.onPointermove),this.context.container.addEventListener("pointermove",this.onPointermove),this.context.container.addEventListener("pointerleave",this.onPointerleave),this.context.container.addEventListener("pointerdown",this.onPointerdown),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerenter",this.onPointermove),this.context.container.removeEventListener("pointermove",this.onPointermove),this.context.container.removeEventListener("pointerleave",this.onPointerleave),this.context.container.removeEventListener("pointerdown",this.onPointerdown),this.context.removeEventListener("update",this.onUpdate)}addPoint(t){if(this.points.push(t),this.points.length>=2){let e=this.calculatedDistance();this.dispatchEvent({type:"distance",distance:e})}}calculatedDistance(){let[{x:t,y:e},{x:n,y:r}]=this.points;return Math.sqrt((n-t)**2+(r-e)**2)}dispose(){super.dispose(),this.unRegistryEvent(),this.line=null,this.circles=[]}constructor(t){super(t),this.context=t,this.onUpdate=()=>{if(this.points[0]){let r=this.getSvgCoordinate(this.points[0]);Tn(this.circles[0],r.x,r.y),ne(this.line,r)}if(this.points[1]){let r=this.getSvgCoordinate(this.points[1]);Tn(this.circles[1],r.x,r.y),ne(this.line,void 0,r)}},this.onPointermove=r=>{this.points.length===1&&(this.line.style.display="block",ne(this.line,void 0,{x:r.offsetX,y:r.offsetY}))},this.onPointerleave=()=>{this.points[1]||(this.line.style.display="none")},this.onPointerdown=r=>{if(this.points[1])return;let o=this.getIntersectByPointerEvent(r);if(o){let{offsetX:s,offsetY:a}=r,u=this.circles[this.points.length];Tn(u,s,a),this.points.length||ne(this.line,{x:s,y:a},{x:s,y:a}),this.addPoint(o)}};let{config:{svg:{circle:e,line:n}}}=t;this.circles=[Qr(e.radius,e.fill),Qr(e.radius,e.fill)],this.line=Vo(n.stroke),this.svg.appendChild(this.circles[0]),this.svg.appendChild(this.circles[1]),this.svg.appendChild(this.line),this.registryEvent()}};var XK=f(U(),1);var na=class extends Kt{setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}get lastLine(){return this.lines.slice(-1)[0]}addCircle(t){this.circles.push(t),this.svg.appendChild(t)}addLine(t){this.lines.push(t),this.svg.appendChild(t)}registryEvent(){this.context.container.addEventListener("pointerenter",this.onPointermove),this.context.container.addEventListener("pointermove",this.onPointermove),this.context.container.addEventListener("pointerleave",this.onPointerleave),this.context.container.addEventListener("pointerdown",this.onPointerdown),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerenter",this.onPointermove),this.context.container.removeEventListener("pointermove",this.onPointermove),this.context.container.removeEventListener("pointerleave",this.onPointerleave),this.context.container.removeEventListener("pointerdown",this.onPointerdown),this.context.removeEventListener("update",this.onUpdate)}checkAdsorb(t,e){if(this.points.length<3)return!1;let n=this.circles[0],r=+n.getAttribute("cx"),o=+n.getAttribute("cy");return Math.sqrt((t-r)**2+(e-o)**2)<=5}addPoint(t){if(this.points.push(t),this.isClose){let e=this.calculatedArea();this.dispatchEvent({type:"area",area:e})}}calculatedArea(){let t=this.points.map(r=>[r.x,r.y]),e=0,n=t.length;for(let r=0;r<n;r++){let o=(r+1)%n;e+=t[r][0]*t[o][1]-t[o][0]*t[r][1]}return Math.abs(e/2)}dispose(){super.dispose(),this.unRegistryEvent(),this.lines=[],this.circles=[]}constructor(t){super(t),this.circles=[],this.lines=[],this.isClose=!1,this.onUpdate=()=>{this.points.length&&this.points.forEach((e,n)=>{let r=this.getSvgCoordinate(e);this.circles[n]&&Tn(this.circles[n],r.x,r.y),n!==0&&ne(this.lines[n-1],void 0,r),this.lines[n]&&ne(this.lines[n],r)})},this.onPointermove=e=>{!this.lastLine||this.isClose||(this.lastLine.style.display="block",ne(this.lastLine,void 0,{x:e.offsetX,y:e.offsetY}))},this.onPointerleave=()=>{this.isClose||(this.lastLine.style.display="none")},this.onPointerdown=e=>{if(this.isClose)return;let n=this.getIntersectByPointerEvent(e);if(n){let{offsetX:r,offsetY:o}=e;this.checkAdsorb(r,o)?(this.isClose=!0,this.addPoint(this.points[0])):this.addPoint(n);let{circle:{fill:s,radius:a},line:{stroke:u}}=this.context.config.svg;if(!this.isClose){let l=Qr(a,s);Tn(l,r,o),this.addCircle(l)}if(this.lines.length&&ne(this.lastLine,void 0,{x:r,y:o}),!this.isClose){let l=Vo(u);ne(l,{x:r,y:o},{x:r,y:o}),this.addLine(l)}}},this.registryEvent()}};import{Box3 as PB}from"three";var N6=class extends Kt{setEnable(t){super.setEnable(t),t?this.registryEvent():this.unRegistryEvent()}registryEvent(){this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.removeEventListener("update",this.onUpdate)}selectGraphic(t){this.graphic=t}dispose(){super.dispose(),this.unRegistryEvent(),this.rect=null,this.cornerRect=[],this.centerRect=[]}constructor(t){super(t),this.context=t,this.cornerRect=[],this.centerRect=[],this.onUpdate=()=>{if(this.graphic){let n=new PB().setFromObject(this.graphic),{camera:r,container:{clientWidth:o,clientHeight:s}}=this.context,{min:a,max:u}=n,l=L(a,r,o,s),c=L(u,r,o,s);gt(this.rect,l.x,c.y,Math.abs(c.x-l.x),Math.abs(c.y-l.y));let{x:h,y:p}=l,{x:d,y:m}=c,_=5,v=[{x:h-_,y:m-_},{x:d-_,y:m-_},{x:h-_,y:p-_},{x:d-_,y:p-_}];for(let w=0;w<v.length;w++)gt(this.cornerRect[w],v[w].x,v[w].y,_*2,_*2);let x=4,M=(h+d)/2,b=(p+m)/2,C=[{x:M-x,y:m-x},{x:h-x,y:b-x},{x:d-x,y:b-x},{x:M-x,y:p-x}];for(let w=0;w<C.length;w++)gt(this.centerRect[w],C[w].x,C[w].y,x*2,x*2)}else{gt(this.rect,0,0,0,0);for(let n=0;n<this.cornerRect.length;n++)gt(this.cornerRect[n],0,0,0,0),gt(this.centerRect[n],0,0,0,0)}};let{config:{svg:{line:e}}}=t;this.rect=nn(e.stroke,"transparent"),this.svg.appendChild(this.rect);for(let n=0;n<4;n++)this.cornerRect[n]=nn(e.stroke,"#ffffff"),this.centerRect[n]=nn(e.stroke,"#ffffff"),this.svg.appendChild(this.cornerRect[n]),this.svg.appendChild(this.centerRect[n]);this.registryEvent()}};var t7=f(U(),1);import{BufferGeometry as IB,Color as Nc,LineSegments as LB,Mesh as NB,Object3D as OB,ShaderMaterial as DB,Vector3 as O6}from"three";import{mergeGeometries as UB}from"three/examples/jsm/utils/BufferGeometryUtils";var ra=class extends OB{initGeometry(){return E(this,null,function*(){let t=yield ue.GetMergeGeometry(this.options);this.geometry=t})}initMaterial(){let t=`
3847
3847
  varying vec3 vPosition; // \u7528\u4E8E\u4F20\u9012\u9876\u70B9\u7684\u4F4D\u7F6E\u7ED9\u7247\u6BB5\u7740\u8272\u5668
3848
3848
  uniform float maxZ; // \u58F0\u660E\u4E00\u4E2Auniform\u53D8\u91CF
3849
3849
  uniform vec3 uColor;
@@ -3908,7 +3908,7 @@ void main() {
3908
3908
  gl_FragColor = vec4(uColor2, uOpacity); // \u5176\u4ED6\u9762\u989C\u8272\uFF09
3909
3909
  }
3910
3910
  }
3911
- `,n=-1/0,r=this.geometry.getAttribute("position");if(r)for(let s=0;s<r.count;s++){let a=r.getZ(s);a>n&&(n=a)}let o=new uz({uniforms:{maxZ:{value:n},uColor:{value:new F6(this.options[0].fillColor).convertLinearToSRGB()},uColor2:{value:new F6(De(this.options[0].fillColor)).convertLinearToSRGB()},uOpacity:{value:this.options[0].fillOpacity}},vertexShader:t,fragmentShader:e,transparent:!0});this.material=o}initLineMaterial(){let t=W.createLineMaterial({color:this.options[0].strokeColor,opacity:this.options[0].strokeOpacity});return this.lineMaterial=t,t}initMesh(){this.mesh&&this.remove(this.mesh),this.mesh=new oz(this.geometry,this.material),this.add(this.mesh)}getBorderPoints(){let t=[],e=this.options[0].height+this.options[0].deltaHeight;return this.options.map(n=>{let{coords:r}=n.geometry;for(let o=0;o<r.length;o++){let s=r[o];for(let a=0;a<s.length;a++){let u=s[a],l=a+1===s.length?s[0]:s[a+1];t.push(new U6(u[0],u[1],e)),t.push(new U6(l[0],l[1],e))}}}),t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new sz().setFromPoints(t);this.lineGeometry=e}createBorder(){this.line&&this.remove(this.line);let t=new az(this.lineGeometry,this.lineMaterial);return t.position.z=.01,this.line=t,this.add(t),t}dispose(){var t,e,n;(t=this.geometry)==null||t.dispose(),(e=this.material)==null||e.dispose(),(n=this.line)==null||n.geometry.dispose(),this.clear()}constructor(t,e){super(),this.context=t,this.options=e.map(n=>S({},Ic,n)),this.init()}};var G7=f(P(),1),k7=f(Xo(),1);import{Box2 as Oc,Object3D as lz,Sprite as B6,SpriteMaterial as z6,Vector2 as sa}from"three";import{isNil as zi}from"lodash";var cz={text:"",icon:"",icon_size:[22,22],level:1,collision_enable:!0,opacity:1,id:"",position:{x:0,y:0,z:0},text_font_size:14,icon_rotate:0,depth_test:!1,hide_text:!1,maxWeight:25,minWeight:1},nt=class extends lz{get hasText(){return!this.options.hide_text&&this.options.text}get durIconAndText(){return this.options.icon&&this.hasText?2:0}get offset(){return this.options.icon&&this.hasText?0:.5}get iconWidth(){return this.options.icon?this.options.icon_size[0]:0}get iconHeight(){return this.options.icon?this.options.icon_size[1]:0}get textWidth(){return this.hasText?this.textHeight*this.textAspect:0}get textHeight(){return this.hasText?this.options.text_font_size*this.textureLines:0}get hasOriginTexture(){let{text_texture:t,text_texture_width:e,text_texture_height:n,text_texture_offset_x:r,text_texture_offset_y:o}=this.options;return!zi(t)&&!zi(e)&&!zi(n)&&!zi(r)&&!zi(o)}get deltaZ(){return!this.options.icon&&this.hasText?.1+this.offset*(this.iconHeight+this.durIconAndText+this.textHeight)/this.context.camera.zoom:.1}get canSelect(){return this.visible&&(this.spriteIcon?this.spriteIcon.visible:!0)&&(this.spriteText?this.spriteText.visible:!0)}registryEvent(){this.context.addEventListener("control-zoom-change",this._initScale),this.addEventListener("change-icon",t=>E(this,null,function*(){let{value:e}=t;this._initIconPromise&&(yield this._initIconPromise),this.spriteIcon&&(this.remove(this.spriteIcon),this.spriteIcon=void 0),yield this.initIcon(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})})),this.addEventListener("change-text",t=>{let{value:e}=t;this.spriteText&&(this.remove(this.spriteText),this.spriteText=void 0),this.initText(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})}),this.addEventListener("change-text_font_size",t=>{let{value:e}=t;this.spriteText&&(this.remove(this.spriteText),this.spriteText=void 0),this.initText(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})}),this.addEventListener("change-icon_rotate",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.rotation=e/180*Math.PI)}),this.addEventListener("change-icon_size",t=>{let{value:e}=t;this.spriteIcon&&(this.initSize(),this._initScale({zoom:this.context.camera.zoom}))}),this.addEventListener("change-depth_test",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.depthTest=e),this.spriteText&&(this.spriteText.material.depthTest=e)})}unRegistryEvent(){this.context.removeEventListener("control-zoom-change",this._initScale)}getPosition(){return this.position}initIcon(){return E(this,null,function*(){if(this.options.icon)return this._initIconPromise=new Promise(t=>E(this,null,function*(){let e;if(this.options.icon_border){let{icon:r,icon_size:o,icon_border:s}=this.options;e=yield ut.getUrlTextureBorder(r,o[0]-s.width*2,s)}else e=yield ut.getTextureByUrl(this.options.icon);let n=new B6(new z6({map:e,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test,rotation:this.options.icon_rotate/180*Math.PI}));n.visible=!1,n.renderOrder=1e5+this.options.level,e.needsUpdate=!0,this.add(n),this.spriteIcon=n,t(n)})).then(()=>{this._initIconPromise=null})})}initText(){if(this.hasText){let t;if(this.hasOriginTexture){let{text_texture:n,text_texture_width:r,text_texture_height:o,text_texture_offset_x:s,text_texture_offset_y:a}=this.options;t=this.options.text_texture.clone(),t.uuid=n.uuid,t.offset.set(s/t.image.width,1-(o+a)/t.image.height),t.repeat.set(r/t.image.width,o/t.image.height),this.textAspect=r/o}else{let n=tt.getTextureByText(this.options.text);t=n.texture,this.textureLines=n.lines,this.textAspect=t.image.width/t.image.height}let e=new B6(new z6({map:t,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test}));e.visible=!1,e.renderOrder=100001+this.options.level,t.needsUpdate=!0,this.spriteText=e,this.add(e)}}initSize(){var t,e;let n=0,r=0,{icon:o}=this.options;o?this.hasText?(n=0,r=n*(this.iconHeight/this.textHeight)-this.iconHeight/this.textHeight-this.durIconAndText/this.textHeight):(n=.5,r=0):this.hasText?(r=.5,n=0):(n=0,r=0),(t=this.spriteIcon)==null||t.center.set(.5,n),(e=this.spriteText)==null||e.center.set(.5,r)}init(){return E(this,null,function*(){yield Promise.all([this.initIcon(),new Promise(t=>{this.initText(),t(!0)})]),this.initSize(),this._initScale({zoom:this.context.camera.zoom})})}resetZ(){let t=this.deltaZ;this.spriteIcon&&(this.spriteIcon.position.z=t),this.spriteText&&(this.spriteText.position.z=t)}getBox(t){let{clientSize:{width:e,height:n}}=this.context,r=e*(t.x+1)/2,o=n*(-t.y+1)/2;o+=this.offset*(this.iconHeight+this.durIconAndText+this.textHeight);let s=this.iconWidth/2,a=new Oc(new sa(r-s,o-this.iconHeight),new sa(r+s,o)),u=this.textWidth/2,l=new Oc(new sa(r-u,o-this.textHeight-this.durIconAndText-this.iconHeight),new sa(r+u,o-this.iconHeight-this.durIconAndText));return this.box=l.union(a),this.box}renderBoxHelper(t,e){if(!this.boxHelper){let n=document.createElement("div");n.style.position="absolute",n.style.zIndex="999",n.style.border="1px solid red",n.style.pointerEvents="none",this.boxHelper=n,this.context.container.appendChild(n)}t&&e?(this.boxHelper.style.left=t+"px",this.boxHelper.style.top=e+"px",this.boxHelper.style.width="2px",this.boxHelper.style.height="2px"):(this.boxHelper.style.left=this.box.min.x+"px",this.boxHelper.style.top=this.box.min.y+"px",this.boxHelper.style.width=this.box.max.x-this.box.min.x+"px",this.boxHelper.style.height=this.box.max.y-this.box.min.y+"px")}parentSetVisible(t){this.spriteText&&(this.spriteText.visible=t),this.spriteIcon&&(this.spriteIcon.visible=t),this.boxHelper&&(this.boxHelper.style.display=t?"block":"none")}dispose(){this.clear(),this.unRegistryEvent(),this.spriteText=void 0,this.spriteIcon=void 0}constructor(t,e){var n;super(),this.context=t,this.textAspect=1,this.box=new Oc,this._initIconPromise=null,this.textureLines=1,this._initScale=o=>{let{zoom:s}=o;if(this.spriteText){let u=this.textHeight/s;this.spriteText.scale.set(this.textAspect*u,u,.1)}if(this.spriteIcon){var a;(a=this.spriteIcon)==null||a.scale.set(this.options.icon_size[0]/s,this.options.icon_size[1]/s,.1)}this.resetZ()};var r;this.options=Zn(S({},cz,e,{text:(r=(n=e.text)==null?void 0:n.trim())!=null?r:""}),this),this.position.set(this.options.position.x,this.options.position.y,this.options.position.z),this.registryEvent(),this.init()}};var K7=f(Xo(),1);import{DoubleSide as hz,Matrix4 as G6,Mesh as pz,MeshBasicMaterial as fz,Object3D as dz,PlaneGeometry as gz}from"three";import{mergeGeometries as mz}from"three/examples/jsm/utils/BufferGeometryUtils";var _z={airHeight:0,deltaHeight:0,height:0,geometry:{cds:[],type:"polygon",coords:[],curveCpt:[],curveIndex:[]},texts:[],fillColor:"#ffffff",fillOpacity:0,strokeColor:"#ffffff",strokeOpacity:0,secondHeight:0,secondRotate:0,center_x:0,center_y:0},aa=class extends dz{init(){return E(this,null,function*(){let t=this.options.map(s=>tt.getTextureByText(s.texts[0],{fillStyle:x0(s.fillColor,s.fillOpacity),strokeStyle:x0(s.strokeColor,s.strokeOpacity),lineWidth:6,font:"bold 54px sans-serif",maxWidth:2048})),e=t.map((s,a)=>{let u=this.options[a],{width:l,height:c}=s.texture.image,h=l/c,p=u.secondHeight*h,d=new gz(p,u.secondHeight),m=new G6().makeTranslation(u.center_x,u.center_y,u.airHeight+u.deltaHeight+u.height).multiply(new G6().makeRotationZ(u.secondRotate));return d.applyMatrix4(m),d}),n=mz(e,!0);e.forEach(s=>s.dispose());let r=t.map(s=>{let{texture:a}=s,u=new fz({map:a,alphaTest:1,side:hz});return a.needsUpdate=!0,u}),o=new pz(n,r);this.mesh=o,this.position.z+=.04,this.add(o)})}dispose(){var t,e,n;(t=this.mesh)==null||t.geometry.dispose(),(n=this.mesh)==null||(e=n.material)==null||e.forEach(r=>r.dispose()),this.clear()}constructor(t,e){super(),this.context=t,this.options=e.map(n=>S({},_z,n)).filter(n=>n.texts[0].trim()),this.options.length&&this.init()}};import{Object3D as vz}from"three";import{Line2 as yz}from"three/examples/jsm/lines/Line2";import{LineGeometry as xz}from"three/examples/jsm/lines/LineGeometry";import{LineMaterial as Ez}from"three/examples/jsm/lines/LineMaterial";var Gi=class extends vz{registryEvent(){this.context.addEventListener("resize",this.onResize)}unRegistryEvent(){this.context.removeEventListener("resize",this.onResize)}setPosition(t,e){this.lineGeometry.setPositions([t.x,t.y,t.z,e.x,e.y,e.z]),this.line||this.createLine()}createLine(){this.line=new yz(this.lineGeometry,this.lineMaterial),this.line.renderOrder=100003,this.add(this.line)}dispose(){var t;this.unRegistryEvent(),this.line&&J(this.line),this.lineGeometry=null,this.lineMaterial=null,this.clear(),(t=this.line)==null||t.clear(),this.line=null}constructor(t,e,n){super(),this.context=t,this.lineGeometry=new xz,this.lineMaterial=new Ez({color:0,transparent:!0,depthTest:!1,linewidth:2}),this.line=null,this.onResize=()=>{let{width:r,height:o}=this.context.clientSize;this.lineMaterial.resolution.set(r,o)},this.onResize(),this.registryEvent(),e&&n&&this.setPosition(e,n)}};import{Frustum as Sz}from"three";var ua=class extends Kt{setEnable(t){super.setEnable(t),gt(this.rect,0,0,0,0),t?this.registryEvent():(this.startPoint=void 0,this.unRegistryEvent())}registryEvent(){this.context.container.addEventListener("pointerdown",this.onPointerDown),this.context.container.addEventListener("pointermove",this.onPointerMove),this.context.container.addEventListener("pointerup",this.onPointerUp),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerdown",this.onPointerDown),this.context.container.removeEventListener("pointermove",this.onPointerMove),this.context.container.removeEventListener("pointerup",this.onPointerUp),this.context.removeEventListener("update",this.onUpdate)}doSelect(){if(this.startPoint&&this.endPoint){if(this.startPoint.distanceTo(this.endPoint)<.1)return;let{context:{camera:e,container:{clientWidth:n,clientHeight:r}}}=this,o=L(this.startPoint,e,n,r),s=L(this.endPoint,e,n,r),a={x:Math.min(o.x,s.x),y:Math.min(o.y,s.y)},u={x:Math.max(o.x,s.x),y:Math.max(o.y,s.y)},l=this.searchMapInFrustum(a,u);this.dispatchEvent({type:"selected",list:l})}}searchMapInFrustum(t,e){var n;let{context:r}=this;return((n=r.currentFloor)==null?void 0:n.graphicLayer.children.filter(o=>o instanceof et&&this.searchChildInFrustum(o,t,e)))||[]}searchChildInFrustum(t,e,n){let{context:{camera:r,container:{clientWidth:o,clientHeight:s}}}=this;if(!t)return!1;if(!t.mesh){let p=t.getPosition();if(p){let d=L(p,r,o,s);return en(d,e,n)}return!1}t.mesh.geometry.boundingBox||t.mesh.geometry.computeBoundingBox();let a=t.mesh.geometry.boundingBox;if(!a)return!1;let{min:u,max:l}=a,c=L(u,r,o,s),h=L(l,r,o,s);return!(!en(c,e,n)||!en(h,e,n))}dispose(){super.dispose(),this.rect=null,this.unRegistryEvent()}constructor(t){super(t),this.frustum=new Sz,this.onPointerDown=r=>{if(!this.enable)return;let o=this.getIntersectByPointerEvent(r);o&&(this.startPoint=o),this.endPoint=void 0},this.onPointerMove=r=>{if(!this.enable||!this.startPoint)return;let o=this.getIntersectByPointerEvent(r);o&&(this.endPoint=o)},this.onPointerUp=r=>{if(!this.enable)return;let o=this.getIntersectByPointerEvent(r);o&&(this.endPoint=o),this.doSelect(),this.startPoint=void 0},this.onUpdate=()=>{if(this.startPoint){let r=this.getSvgCoordinate(this.startPoint),o=S({},r);this.endPoint&&(o=this.getSvgCoordinate(this.endPoint));let s={x:Math.min(r.x,o.x),y:Math.min(r.y,o.y)},a=Math.abs(o.x-r.x),u=Math.abs(o.y-r.y);gt(this.rect,s.x,s.y,a,u)}else gt(this.rect,0,0,0,0)};let{config:{selectBox:{fill:e,stroke:n}}}=t;this.rect=nn(n,e),this.svg.appendChild(this.rect),this.registryEvent()}};var la=class extends bz{get list(){return this._list}enableBoxSelection(){this.isMultipleSelect||!this.context.config.enableBoxSelect||(this.isMultipleSelect=!0,this.boxSelection.setEnable(!0),this.prevPanStatus=this.context.control.enablePan,this.prevRotateStatus=this.context.control.enableRotate,this.context.control.enablePan=!1,this.context.control.enableRotate=!1)}disableBoxSelection(){this.isMultipleSelect&&(this.isMultipleSelect=!1,this.boxSelection.setEnable(!1),this.context.control.enablePan=!!this.prevPanStatus,this.context.control.enableRotate=!!this.prevRotateStatus)}selectEnd(){this.dispatchEvent({type:"select",graphics:[...this._list],isMultipleSelect:this.isMultipleSelect})}registryEvent(){this.context.container.addEventListener("pointerdown",this.onPointerDown),this.context.container.addEventListener("pointerup",this.onPointerUp),this.context.container.addEventListener("pointerout",this.onPointerOut),this.context.container.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp),this.boxSelection.addEventListener("selected",this.onBoxSelected)}unRegistryEvent(){this.context.container.removeEventListener("pointerdown",this.onPointerDown),this.context.container.removeEventListener("pointerup",this.onPointerUp),this.context.container.removeEventListener("pointerout",this.onPointerOut),this.context.container.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp),this.boxSelection.removeEventListener("selected",this.onBoxSelected)}clear(){this._list.clear()}remove(t){this._list.delete(t)}dispose(){this.unRegistryEvent()}constructor(t){super(),this.context=t,this._list=new Set,this.downPoint=null,this.downTime=0,this.isMultipleSelect=!1,this.onPointerDown=e=>{Date.now()-this.downTime<200||(this.downPoint={x:e.offsetX,y:e.offsetY},this.downTime=Date.now())},this.onPointerUp=e=>{if(!this.downPoint)return;let{offsetX:n,offsetY:r}=e,{x:o,y:s}=this.downPoint;if(Math.sqrt((o-n)**2+(s-r)**2)>3)return;let{graphics:a}=this.context.getGraphicsByDeviceXy(n,r),u=new Set(a.map(c=>c.options.id));this.context.getPoisByDeviceXy(n,r).forEach(c=>{if(!u.has(c.options.id)){var h;let p=((h=this.context.currentFloor)==null?void 0:h.graphicLayer.graphicMap.get(c.options.id))||null;p&&p.options.geometry.type==="point"&&(a.push(p),u.add(c.options.id))}}),(Jn?e.metaKey:e.ctrlKey)||this._list.clear(),a.forEach(c=>this._list.add(c)),this.selectEnd(),this.downPoint=null},this.onPointerOut=e=>{this.disableBoxSelection()},this.onKeyDown=e=>{Qn(e.key)&&this.enableBoxSelection()},this.onKeyUp=e=>{Qn(e.key)&&this.disableBoxSelection()},this.onBoxSelected=e=>{let{list:n}=e;this._list.clear(),n.forEach(r=>{this._list.add(r)}),this.selectEnd()},this.boxSelection=new ua(t),this.boxSelection.setEnable(!1),this.registryEvent()}};var XZ=f(de(),1),jZ=f(ge(),1),YZ=f(me(),1),KZ=f(_e(),1),ZZ=f(ve(),1),$Z=f(ye(),1),JZ=f(xe(),1),QZ=f(P(),1);import{EventDispatcher as Mz,Vector2 as wz}from"three";var ca=class extends Mz{handleHoverGraphicsChange(t){t===void 0&&(t=this.curGraphics),this.dispatchEvent({type:"hover-change",graphics:Array.from(t)})}registryEvent(){this.context.addEventListener("pointer-over",this.onPointerMove),this.context.addEventListener("pointer-move",this.onPointerMove),this.context.addEventListener("pointer-level",this.onPointerLevel),document.body.addEventListener("pointermove",this.onBodyPointerMove)}unRegistryEvent(){this.context.removeEventListener("pointer-over",this.onPointerMove),this.context.removeEventListener("pointer-move",this.onPointerMove),this.context.removeEventListener("pointer-level",this.onPointerLevel),document.body.removeEventListener("pointermove",this.onBodyPointerMove)}dispose(){this.unRegistryEvent(),this.timer.dispose()}constructor(t){super(),this.context=t,this.curGraphics=new Set,this.timer=new j,this.graphicTimerMap=new Map,this.onPointerMove=e=>{let{graphics:n,pois:r,e:o}=e,s=r.map(c=>{var h;return(h=this.context.currentFloor)==null?void 0:h.graphicLayer.graphicMap.get(c.options.id)}).filter(c=>c&&c.options.geometry.type==="point");if(!n.length&&!s.length&&this.curGraphics.size){this.curGraphics.clear(),this.handleHoverGraphicsChange();return}let{time:a}=this.context.config.hover,u=new Set;if(s.length){let c,h=1e4;s.forEach(p=>{let d=r.find(m=>m.options.id===p.options.id);if(d instanceof Nn){let{x:m,y:_}=d.clientPos,v=Math.sqrt((m-o.offsetX)**2+(_-o.offsetY)**2);v<h&&(h=v,c=p)}else if(d instanceof nt){let{x:m,y:_}=d.box.getCenter(new wz),v=Math.sqrt((m-o.offsetX)**2+(_-o.offsetY)**2);v<h&&(h=v,c=p)}}),u.add(c)}u.size||n.forEach(c=>u.add(c)),u.forEach(c=>{if(this.graphicTimerMap.get(c)||this.curGraphics.has(c))return;let h=this.timer.setTimeout(()=>{this.curGraphics.add(c),this.graphicTimerMap.delete(c),this.timer.clearTimeout(h),this.handleHoverGraphicsChange()},a);this.graphicTimerMap.set(c,h)}),this.graphicTimerMap.forEach((c,h)=>{u.has(h)||(this.timer.clearTimeout(c),this.graphicTimerMap.delete(h))});let l=this.curGraphics.size;this.curGraphics.forEach(c=>{u.has(c)||this.curGraphics.delete(c)}),l!==this.curGraphics.size&&this.handleHoverGraphicsChange()},this.onPointerLevel=()=>{this.curGraphics.clear(),this.handleHoverGraphicsChange()},this.onBodyPointerMove=e=>{if(this.curGraphics.size){let n=this.context.container.getBoundingClientRect();(e.clientX<n.left||e.clientX>n.right||e.clientY<n.top||e.clientY>n.bottom)&&this.onPointerLevel()}},this.registryEvent()}};var h$=f(P(),1);import{Box3 as Tz,Vector3 as ha}from"three";var pa=class{updateBox(){this.box.setFromObject(this.context.scene)}setEnable(t){this.enable=t,t?this.registryEvent():this.unRegistryEvent()}changePrevCamera(){this.prevCamera={position:this.context.camera.position.clone(),zoom:this.context.camera.zoom,target:this.context.control.target.clone()}}backToPrevCamera(){this.setEnable(!1),this.context.camera.position.copy(this.prevCamera.position),this.context.camera.zoom=this.prevCamera.zoom,this.context.control.target.copy(this.prevCamera.target),this.context.control.update(),this.setEnable(!0)}registryEvent(){this.context.addEventListener("control-change",this.onCameraChange)}unRegistryEvent(){this.context.removeEventListener("control-change",this.onCameraChange)}getCurFloorScreenPosition(){if(!this.context.scene.children.filter(v=>v instanceof Yt).length)return null;let e=this.box,{camera:n,clientSize:{width:r,height:o}}=this.context,{min:s,max:a}=e,u=L(s,n,r,o),l=L(a,n,r,o),c=L(new ha(s.x,a.y,a.z),n,r,o),h=L(new ha(a.x,s.y,s.z),n,r,o),p=Math.min(u.x,l.x,c.x,h.x),d=Math.max(u.x,l.x,c.x,h.x),m=Math.min(u.y,l.y,c.y,h.y),_=Math.max(u.y,l.y,c.y,h.y);return{left:p,right:d,top:m,bottom:_}}checkDistanceToScreenEdge(t){let{left:e,right:n,top:r,bottom:o}=t,{width:s,height:a}=this.context.clientSize,[u,l,c,h]=this.context.config.cameraBound.padding,p=n>=h,d=s-e>=l,m=a-r>=c,_=o>=u;return p&&d&&m&&_}dispose(){this.unRegistryEvent()}constructor(t){this.context=t,this.prevCamera={position:new ha,zoom:1,target:new ha},this.enable=!0,this.box=new Tz,this.onCameraChange=()=>{let e=this.getCurFloorScreenPosition();if(e){let{left:n,right:r,top:o,bottom:s}=e;this.checkDistanceToScreenEdge({left:n,right:r,top:o,bottom:s})?this.changePrevCamera():this.backToPrevCamera()}},this.registryEvent(),this.changePrevCamera()}};var T$=f(Fc(),1);import{Vector3 as n3}from"three";import{Tween as _a,Group as Yz}from"@tweenjs/tween.js";var S$=f(P(),1),b$=f(U(),1);import{EventDispatcher as Hz,MOUSE as Mr,Quaternion as t3,Spherical as da,TOUCH as wr,Vector2 as It,Vector3 as Zt,Plane as Wz,Ray as qz,MathUtils as Xz}from"three";var ga=new qz,e3=new Wz,jz=Math.cos(70*Xz.DEG2RAD),ma=class extends Hz{dispose(){this.domElement.removeEventListener("contextmenu",this.onContextMenu),this.domElement.removeEventListener("pointerdown",this.onPointerDown),this.domElement.removeEventListener("pointercancel",this.onPointerUp),this.domElement.removeEventListener("wheel",this.onMouseWheel),this.domElement.removeEventListener("pointermove",this.onPointerMove),this.domElement.removeEventListener("pointerup",this.onPointerUp),this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=null)}constructor(t,e){super(),this.rotateLineStart=new It,this.rotateLineEnd=new It,this.spherical=new da,this.sphericalDelta=new da,this.object=t,this.domElement=e,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new Zt,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.screenSpacePanning=!1,this.mouseButtons={LEFT:Mr.PAN,MIDDLE:Mr.DOLLY,RIGHT:Mr.ROTATE},this.touches={ONE:wr.PAN,TWO:wr.DOLLY_ROTATE},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return a.phi},this.getAzimuthalAngle=function(){return a.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(y){y.addEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=y},this.stopListenToKeyEvents=function(){var y;(y=this._domElementKeyEvents)==null||y.removeEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=null},this.saveState=function(){n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=function(){n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent({type:"change"}),n.update(),o=r.NONE},this.update=function(){let y=new Zt,T=new t3().setFromUnitVectors(t.up,new Zt(0,1,0)),V=T.clone().invert(),Z=new Zt,Tt=new t3,he=new Zt,$t=2*Math.PI;return function(Ir){Ir===void 0&&(Ir=null);let Ae=n.object.position;y.copy(Ae).sub(n.target),y.applyQuaternion(T),a.setFromVector3(y),n.autoRotate&&o===r.NONE&&k(B(Ir)),n.enableDamping?(a.theta+=u.theta*n.dampingFactor,a.phi+=u.phi*n.dampingFactor):(a.theta+=u.theta,a.phi+=u.phi);let Ce=n.minAzimuthAngle,Re=n.maxAzimuthAngle;isFinite(Ce)&&isFinite(Re)&&(Ce<-Math.PI?Ce+=$t:Ce>Math.PI&&(Ce-=$t),Re<-Math.PI?Re+=$t:Re>Math.PI&&(Re-=$t),Ce<=Re?a.theta=Math.max(Ce,Math.min(Re,a.theta)):a.theta=a.theta>(Ce+Re)/2?Math.max(Ce,a.theta):Math.min(Re,a.theta)),a.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,a.phi)),a.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(c,n.dampingFactor):n.target.add(c),n.zoomToCursor&&I||n.object.isOrthographicCamera?a.radius=wt(a.radius):a.radius=wt(a.radius*l),y.setFromSpherical(a),y.applyQuaternion(V),Ae.copy(n.target).add(y),n.object.lookAt(n.target),n.enableDamping===!0?(u.theta*=1-n.dampingFactor,u.phi*=1-n.dampingFactor,c.multiplyScalar(1-n.dampingFactor)):(u.set(0,0,0),c.set(0,0,0));let Xi=!1;if(n.zoomToCursor&&I){let Lr=null;if(n.object.isPerspectiveCamera){let Nr=y.length();Lr=wt(Nr*l);let ji=Nr-Lr;n.object.position.addScaledVector(C,ji),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){let Nr=new Zt(w.x,w.y,0);Nr.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/l)),n.object.updateProjectionMatrix(),Xi=!0;let ji=new Zt(w.x,w.y,0);ji.unproject(n.object),n.object.position.sub(ji).add(Nr),n.object.updateMatrixWorld(),Lr=y.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;Lr!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(Lr).add(n.object.position):(ga.origin.copy(n.object.position),ga.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(ga.direction))<jz?t.lookAt(n.target):(e3.setFromNormalAndCoplanarPoint(n.object.up,n.target),ga.intersectPlane(e3,n.target))))}else n.object.isOrthographicCamera&&(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/l)),n.object.updateProjectionMatrix(),Xi=!0);return l=1,I=!1,Xi||Z.distanceToSquared(n.object.position)>s||8*(1-Tt.dot(n.object.quaternion))>s||he.distanceToSquared(n.target)>0?(n.dispatchEvent({type:"change"}),Z.copy(n.object.position),Tt.copy(n.object.quaternion),he.copy(n.target),Xi=!1,!0):!1}}();let n=this,r={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},o=r.NONE,s=1e-6,a=new da,u=new da,l=1,c=new Zt,h=new It,p=new It,d=new It,m=new It,_=new It,v=new It,x=new It,M=new It,b=new It,C=new Zt,w=new It,I=!1,A=[],R={};function B(y){return y!==null?2*Math.PI/60*n.autoRotateSpeed*y:2*Math.PI/60/60*n.autoRotateSpeed}function H(){return Math.pow(.95,n.zoomSpeed)}function k(y){u.theta-=y}function lt(y){u.phi-=y}let xt=function(){let y=new Zt;return function(V,Z){y.setFromMatrixColumn(Z,0),y.multiplyScalar(-V),c.add(y)}}(),Nt=function(){let y=new Zt;return function(V,Z){n.screenSpacePanning===!0?y.setFromMatrixColumn(Z,1):(y.setFromMatrixColumn(Z,0),y.crossVectors(n.object.up,y)),y.multiplyScalar(V),c.add(y)}}(),Ot=function(){let y=new Zt;return function(V,Z){let Tt=n.domElement;if(n.object.isPerspectiveCamera){let he=n.object.position;y.copy(he).sub(n.target);let $t=y.length();$t*=Math.tan(n.object.fov/2*Math.PI/180),xt(2*V*$t/Tt.clientHeight,n.object.matrix),Nt(2*Z*$t/Tt.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(xt(V*(n.object.right-n.object.left)/n.object.zoom/Tt.clientWidth,n.object.matrix),Nt(Z*(n.object.top-n.object.bottom)/n.object.zoom/Tt.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function Fn(y){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?l/=y:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Rr(y){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?l*=y:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Pr(y){if(!n.zoomToCursor)return;I=!0;let T=n.domElement.getBoundingClientRect(),V=y.clientX-T.left,Z=y.clientY-T.top,Tt=T.width,he=T.height;w.x=V/Tt*2-1,w.y=-(Z/he)*2+1,C.set(w.x,w.y,1).unproject(n.object).sub(n.object.position).normalize()}function wt(y){return Math.max(n.minDistance,Math.min(n.maxDistance,y))}function $c(y){h.set(y.clientX,y.clientY)}function G3(y){Pr(y),x.set(y.clientX,y.clientY)}function Jc(y){m.set(y.clientX,y.clientY)}function k3(y){p.set(y.clientX,y.clientY),d.subVectors(p,h).multiplyScalar(n.rotateSpeed);let T=n.domElement;k(2*Math.PI*d.x/T.clientHeight),lt(2*Math.PI*d.y/T.clientHeight),h.copy(p),n.update()}function V3(y){M.set(y.clientX,y.clientY),b.subVectors(M,x),b.y>0?Fn(H()):b.y<0&&Rr(H()),x.copy(M),n.update()}function H3(y){_.set(y.clientX,y.clientY),v.subVectors(_,m).multiplyScalar(n.panSpeed),Ot(v.x,v.y),m.copy(_),n.update()}function W3(y){Pr(y),y.deltaY<0?Rr(H()):y.deltaY>0&&Fn(H()),n.update()}function q3(y){let T=!1;switch(y.code){case n.keys.UP:y.ctrlKey||y.metaKey||y.shiftKey?lt(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Ot(0,n.keyPanSpeed),T=!0;break;case n.keys.BOTTOM:y.ctrlKey||y.metaKey||y.shiftKey?lt(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Ot(0,-n.keyPanSpeed),T=!0;break;case n.keys.LEFT:y.ctrlKey||y.metaKey||y.shiftKey?k(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Ot(n.keyPanSpeed,0),T=!0;break;case n.keys.RIGHT:y.ctrlKey||y.metaKey||y.shiftKey?k(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Ot(-n.keyPanSpeed,0),T=!0;break}T&&(y.preventDefault(),n.update())}function Qc(){if(A.length===1)h.set(A[0].pageX,A[0].pageY);else{let y=(A[0].pageX-A[0].pageY)/(A[1].pageX-A[1].pageY),T=A[0].pageY-y*A[0].pageX;n.rotateLineStart.set(y,T);let V=.5*(A[0].pageX+A[1].pageX),Z=.5*(A[0].pageY+A[1].pageY);h.set(V,Z)}}function th(){if(A.length===1)m.set(A[0].pageX,A[0].pageY);else{let y=.5*(A[0].pageX+A[1].pageX),T=.5*(A[0].pageY+A[1].pageY);m.set(y,T)}}function eh(){let y=A[0].pageX-A[1].pageX,T=A[0].pageY-A[1].pageY,V=Math.sqrt(y*y+T*T);x.set(0,V)}function X3(){n.enableZoom&&eh(),n.enablePan&&th()}function j3(){n.enableZoom&&eh(),n.enableRotate&&Qc()}function nh(y){if(A.length==1)p.set(y.pageX,y.pageY);else{let V=Ha(y),Z=.5*(y.pageX+V.x),Tt=.5*(y.pageY+V.y);p.set(Z,Tt);let he=(y.pageY-V.y)/(y.pageX-V.x),$t=V.y-he*V.x;if(n.rotateLineEnd.set(he,$t),Number.isFinite(n.rotateLineEnd.x)&&Number.isFinite(n.rotateLineStart.x)){let Wa=(n.rotateLineStart.y-n.rotateLineEnd.y)/(n.rotateLineEnd.x-n.rotateLineStart.x),Ir=he*Wa+$t;if(Number.isFinite(Wa)&&Number.isFinite(Ir)){let Ae=Math.atan(n.rotateLineEnd.x)-Math.atan(n.rotateLineStart.x);Math.PI-Math.abs(Ae)<.5&&(Ae=-Math.sign(Ae)*(Math.PI-Math.abs(Ae))),Math.abs(Ae)<.1&&(u.theta+=Ae)}}n.rotateLineStart.copy(n.rotateLineEnd)}d.subVectors(p,h).multiplyScalar(n.rotateSpeed);let T=n.domElement;lt(2*Math.PI*d.y/T.clientHeight),h.copy(p)}function rh(y){if(A.length===1)_.set(y.pageX,y.pageY);else{let T=Ha(y),V=.5*(y.pageX+T.x),Z=.5*(y.pageY+T.y);_.set(V,Z)}v.subVectors(_,m).multiplyScalar(n.panSpeed),Ot(v.x,v.y),m.copy(_)}function ih(y){let T=Ha(y),V=y.pageX-T.x,Z=y.pageY-T.y,Tt=Math.sqrt(V*V+Z*Z);M.set(0,Tt),b.set(0,Math.pow(M.y/x.y,n.zoomSpeed)),Fn(b.y),x.copy(M)}function Y3(y){n.enableZoom&&ih(y),n.enablePan&&rh(y)}function K3(y){n.enableZoom&&ih(y),n.enableRotate&&nh(y)}this.onPointerDown=function(T){n.enabled!==!1&&(A.length===0&&(n.domElement.setPointerCapture(T.pointerId),n.domElement.addEventListener("pointermove",n.onPointerMove),n.domElement.addEventListener("pointerup",n.onPointerUp)),t1(T),T.pointerType==="touch"?J3(T):Z3(T))},this.onPointerMove=function(T){n.enabled!==!1&&(T.pointerType==="touch"?Q3(T):$3(T))},this.onPointerUp=function(T){e1(T),A.length===0&&(n.domElement.releasePointerCapture(T.pointerId),n.domElement.removeEventListener("pointermove",n.onPointerMove),n.domElement.removeEventListener("pointerup",n.onPointerUp)),n.dispatchEvent({type:"end"}),o=r.NONE};function Z3(y){let T;switch(y.button){case 0:T=n.mouseButtons.LEFT;break;case 1:T=n.mouseButtons.MIDDLE;break;case 2:T=n.mouseButtons.RIGHT;break;default:T=-1}switch(T){case Mr.DOLLY:if(n.enableZoom===!1)return;G3(y),o=r.DOLLY;break;case Mr.ROTATE:if(y.ctrlKey||y.metaKey||y.shiftKey){if(n.enablePan===!1)return;Jc(y),o=r.PAN}else{if(n.enableRotate===!1)return;$c(y),o=r.ROTATE}break;case Mr.PAN:if(y.ctrlKey||y.metaKey||y.shiftKey){if(n.enableRotate===!1)return;$c(y),o=r.ROTATE}else{if(n.enablePan===!1)return;Jc(y),o=r.PAN}break;default:o=r.NONE}o!==r.NONE&&n.dispatchEvent({type:"start"})}function $3(y){switch(o){case r.ROTATE:if(n.enableRotate===!1)return;k3(y);break;case r.DOLLY:if(n.enableZoom===!1)return;V3(y);break;case r.PAN:if(n.enablePan===!1)return;H3(y);break}}this.onMouseWheel=function(T){n.enabled===!1||n.enableZoom===!1||o!==r.NONE||(T.preventDefault(),n.dispatchEvent({type:"start"}),W3(T),n.dispatchEvent({type:"end"}))},this.onKeyDown=function(T){n.enabled===!1||n.enablePan===!1||q3(T)};function J3(y){switch(oh(y),A.length){case 1:switch(n.touches.ONE){case wr.ROTATE:if(n.enableRotate===!1)return;Qc(),o=r.TOUCH_ROTATE;break;case wr.PAN:if(n.enablePan===!1)return;th(),o=r.TOUCH_PAN;break;default:o=r.NONE}break;case 2:switch(n.touches.TWO){case wr.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;X3(),o=r.TOUCH_DOLLY_PAN;break;case wr.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;j3(),o=r.TOUCH_DOLLY_ROTATE;break;default:o=r.NONE}break;default:o=r.NONE}o!==r.NONE&&n.dispatchEvent({type:"start"})}function Q3(y){switch(oh(y),o){case r.TOUCH_ROTATE:if(n.enableRotate===!1)return;nh(y),n.update();break;case r.TOUCH_PAN:if(n.enablePan===!1)return;rh(y),n.update();break;case r.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Y3(y),n.update();break;case r.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;K3(y),n.update();break;default:o=r.NONE}}this.onContextMenu=function(T){n.enabled!==!1&&T.preventDefault()};function t1(y){A.push(y)}function e1(y){delete R[y.pointerId];for(let T=0;T<A.length;T++)if(A[T].pointerId==y.pointerId){A.splice(T,1);return}}function oh(y){let T=R[y.pointerId];T===void 0&&(T=new It,R[y.pointerId]=T),T.set(y.pageX,y.pageY)}function Ha(y){let T=y.pointerId===A[0].pointerId?A[1]:A[0];return R[T.pointerId]}n.domElement.addEventListener("contextmenu",this.onContextMenu),n.domElement.addEventListener("pointerdown",this.onPointerDown),n.domElement.addEventListener("pointercancel",this.onPointerUp),n.domElement.addEventListener("wheel",this.onMouseWheel,{passive:!1}),this.update()}};var va=class extends ma{registryEvent(){this.addEventListener("change",this.onChange),this.context.addEventListener("update",this.tweenUpdate)}unRegistryEvent(){this.removeEventListener("change",this.onChange),this.context.removeEventListener("update",this.tweenUpdate)}setPolarAngle(t,e){e===void 0&&(e=!1);let{maxPolarAngle:n,minPolarAngle:r}=this,o=n===r;(e||t<=n&&t>=r)&&(this.maxPolarAngle=t,this.minPolarAngle=t,this.update()),o||(this.maxPolarAngle=n,this.minPolarAngle=r)}setPolarAngleByDuration(t,e,n){return E(this,null,function*(){return e===void 0&&(e=!1),n===void 0&&(n=500),n<=0?this.setPolarAngle(t,e):zt(new Promise(r=>{let o={polar:this.getPolarAngle()},s={polar:t},a=new _a(o,this.tweenGroup).to(s,n).onUpdate(()=>{this.setPolarAngle(o.polar,e)}).onComplete(()=>{this.enabled=!0,this.tweenGroup.remove(a),r(!0)}).onStart(()=>{this.enabled=!1}).start()}),n+500)})}setAzimuthalAngle(t,e){let{maxAzimuthAngle:n,minAzimuthAngle:r}=this,o=n===r;(e||t<=n&&t>=r)&&(this.maxAzimuthAngle=t,this.minAzimuthAngle=t,this.update()),o||(this.maxAzimuthAngle=n,this.minAzimuthAngle=r)}setAzimuthalAngleDuration(t,e,n){return e===void 0&&(e=!1),n===void 0&&(n=500),n<=0?this.setAzimuthalAngle(t,e):zt(new Promise(r=>{let o={azimuthal:this.getAzimuthalAngle()},s={azimuthal:t},a=new _a(o,this.tweenGroup).to(s,n).onUpdate(()=>{this.setAzimuthalAngle(o.azimuthal,e)}).onComplete(()=>{this.enabled=!0,this.tweenGroup.remove(a),r(!0)}).onStart(()=>{this.enabled=!1}).start()}),n+500)}getCameraLookAt(){return new n3().subVectors(this.target,this.camera.position)}setCameraPositionByTarget(t,e){return E(this,null,function*(){let n=this.target.clone(),r=this.getCameraLookAt();if(!e){this.camera.position.copy(t.clone().sub(r)),this.target.copy(t.clone()),this.update();return}return zt(new Promise(o=>{let s=new _a(n,this.tweenGroup).to(t,e).onUpdate(()=>{this.camera.position.copy(n.clone().sub(r)),this.target.copy(n.clone()),this.update()}).onComplete(()=>{this.tweenGroup.remove(s),this.enabled=!0,o(!0)}).onStart(()=>{this.enabled=!1}).start()}),e+500)})}setZoom(t,e,n){n===void 0&&(n=!1);let{minZoom:r,maxZoom:o}=this;(n||t>=r&&t<=o)&&(this.camera.position.copy(e.clone().sub(this.getCameraLookAt())),this.target.copy(e),this.camera.zoom=t,this.update())}setZoomByDuration(t,e,n,r){return E(this,null,function*(){n===void 0&&(n=!1),r===void 0&&(r=500);let o={zoom:this.camera.zoom,target:this.target.clone()};if(t!==this.camera.zoom)return r?zt(new Promise(s=>{let a=new _a(o,this.tweenGroup).to({zoom:t,target:e},r).onUpdate(()=>{this.setZoom(o.zoom,o.target,n)}).onComplete(()=>{this.tweenGroup.remove(a),this.enabled=!0,s(!0)}).onStart(()=>{this.enabled=!1}).start()}),r+500).finally(()=>{this.enabled=!0}):this.setZoom(t,e,n)})}setTargetByOffset(t,e){if(e===void 0&&(e=this.target.clone()),this.camera.updateMatrix(),t){let n=new n3;n.setFromMatrixColumn(this.camera.matrix,1),n.normalize(),n.multiplyScalar(t/this.camera.zoom),e.add(n)}this.setCameraPositionByTarget(e,0)}clearTween(){this.tweenGroup.getAll().forEach(t=>t.stop()),this.tweenGroup.removeAll()}dispose(){super.dispose(),this.unRegistryEvent(),this.clearTween()}constructor(t,e,n){super(e,n),this.context=t,this.camera=e,this.domElement=n,this.prevCameraZoom=1,this.tweenGroup=new Yz,this.offsetY=0,this.onChange=()=>{let r=this.camera.zoom;r!==this.prevCameraZoom&&(this.prevCameraZoom=r,this.dispatchEvent({type:"change-zoom",zoom:r}))},this.tweenUpdate=()=>{this.tweenGroup.update()},this.enableDamping=!1,this.zoomSpeed=.5,this.prevCameraZoom=e.zoom,this.registryEvent()}};import{EventDispatcher as Kz,PCFSoftShadowMap as Zz,WebGLRenderer as $z}from"three";var ya=class extends $z{setCameraAndScene(t,e){this.scene=t,this.camera=e}autoRender(){this.scene&&this.camera&&this.enable&&(this.event.dispatchEvent({type:"update"}),this.render(this.scene,this.camera)),this.timer.requestAnimationFrame(()=>{this.autoRender()})}pauseRender(){this.enable=!1}continueRender(){this.enable=!0}addEventListener(t,e){this.event.addEventListener(t,e)}removeEventListener(t,e){this.event.removeEventListener(t,e)}dispose(){this.timer.dispose(),this.enable=!1,super.dispose(),this.domElement=null}constructor(t){super(S({antialias:!0,alpha:!0},t)),this.event=new Kz,this.enable=!0,this.timer=new j,this.autoClear=!0,this.setPixelRatio(window.devicePixelRatio),this.shadowMap.enabled=!0,this.shadowMap.autoUpdate=!0,this.shadowMap.type=Zz}};import{Euler as Jz,Matrix4 as Qz,Scene as tG,EquirectangularReflectionMapping as eG}from"three";import{RGBELoader as nG}from"three/examples/jsm/loaders/RGBELoader.js";var xa=class extends tG{constructor(){super(),new nG().load(b6,t=>{t.mapping=eG,this.environment=t;let e=new Qz;e.makeRotationX(Math.PI/2),this.environmentRotation=new Jz().setFromRotationMatrix(e)})}};import{OrthographicCamera as rG}from"three";var Ea=class extends rG{constructor(t,e){super(-t/2,t/2,e/2,-e/2,-1e4,5e4),this.up.set(0,0,1),this.position.set(0,0,100),this.lookAt(0,0,0)}};var Sa=class extends iG{resizeClientSize(){let{x:t,y:e,width:n,height:r}=this.container.getBoundingClientRect();this.clientSize={width:n||this.container.clientWidth,height:r||this.container.clientHeight,x:t,y:e}}init(){let{clientWidth:t,clientHeight:e}=this.container;this.camera=new Ea(t,e),this.renderer.setSize(t,e),this.renderer.setCameraAndScene(this.scene,this.camera),this.renderer.autoRender(),this.control=new va(this,this.camera,this.renderer.domElement),this.control.maxPolarAngle=this.config.control.maxPolar,this.container.appendChild(this.renderer.domElement),this.scene.add(this.lights),this.basicRatio=this.getRatio(),this.control.addEventListener("change",this.onControlChange),this.control.addEventListener("change-zoom",this.onControlChangeZoom),this.renderer.addEventListener("update",this.onRendererUpdate),this.cameraBound=new pa(this)}getRatio(t,e){t===void 0&&(t=new We(0,0,0)),e===void 0&&(e=new We(100,0,0));let{clientWidth:n,clientHeight:r}=this.container,o=L(t,this.camera,n,r),s=L(e,this.camera,n,r);return Math.ceil(Math.sqrt((s.x-o.x)**2+(s.y-o.y)**2))}changeAmbientLightColor(t){this.lights.children.forEach(e=>{e instanceof lG&&(e.color=new uG(t))})}switchFloor(t){this.currentFloor&&(this.scene.remove(this.currentFloor),this.currentFloor.dispose()),this.currentFloor=t,this.scene.add(t);let e=t.getCenter();e&&(this.lights.position.x=e.x,this.lights.position.y=e.y),this.cameraBound.updateBox()}getGraphicsByDeviceXy(t,e){var n;let r=new Tr;r.x=t/this.clientSize.width*2-1,r.y=e/this.clientSize.height*-2+1;let o=new sG;return o.setFromCamera(r,this.camera),o.ray.origin.sub(o.ray.direction.clone().multiplyScalar(100)),((n=this.currentFloor)==null?void 0:n.graphicLayer.getGraphicByRaycaster(o))||{graphics:[],position:null}}getPoisByDeviceXy(t,e){var n,r;let o=(n=this.currentFloor)==null?void 0:n.poiLayer.getPoiByDeviceXy(t,e),s=(r=this.currentFloor)==null?void 0:r.poiLayer2.getPoiByDeviceXy(t,e);return(o||[]).concat(s||[])}registryEvent(){window.addEventListener("resize",this.onWindowResize),this.container.addEventListener("click",this.onClick),this.container.addEventListener("pointerover",this.onPointerover),this.container.addEventListener("pointermove",this.onPointermove),this.container.addEventListener("pointerleave",this.onPointerleave),this.container.addEventListener("pointercancel",this.onPointerleave),this.container.addEventListener("pointerout",this.onPointerleave),this.selection.addEventListener("select",this.onSelectionSelect),this.hoverHelper.addEventListener("hover-change",this.onHoverChange)}unRegistryEvent(){window.removeEventListener("resize",this.onWindowResize),this.container.removeEventListener("click",this.onClick),this.container.removeEventListener("pointerover",this.onPointerover),this.container.removeEventListener("pointermove",this.onPointermove),this.container.removeEventListener("pointerleave",this.onPointerleave),this.container.removeEventListener("pointercancel",this.onPointerleave),this.container.removeEventListener("pointerout",this.onPointerleave),this.selection.removeEventListener("select",this.onSelectionSelect),this.hoverHelper.removeEventListener("hover-change",this.onHoverChange),this.control.removeEventListener("change",this.onControlChange),this.control.removeEventListener("change-zoom",this.onControlChangeZoom),this.renderer.removeEventListener("update",this.onRendererUpdate)}setPolarAngle(t,e){return e===void 0&&(e=500),this.control.setPolarAngleByDuration(t,!0,e)}setAzimuthalAngle(t,e){return e===void 0&&(e=500),this.control.setAzimuthalAngleDuration(t,!0,e)}getCameraLookAt(){return this.control.getCameraLookAt()}setZoom(t,e,n){return n===void 0&&(n=500),this.control.setZoomByDuration(t,e,!0,n)}getFitCameraToObjectZoom(t,e,n,r){e===void 0&&(e=[20,20,20,20]),n===void 0&&(n=500),r===void 0&&(r=!0);let[o,s,a,u]=e,{clientSize:{width:l,height:c}}=this,h=this.control.getPolarAngle();r&&this.setPolarAngle(0,0);let p=new aG().setFromObject(t);this.setPolarAngle(h,0);let{max:d,min:m}=p,_=new We(m.x,d.y,d.z),v=new We(d.x,d.y,d.z),x=new We(d.x,m.y,m.z),M=new We(m.x,m.y,m.z),b=L(_,this.camera,l,c),C=L(v,this.camera,l,c),w=L(M,this.camera,l,c),I=L(x,this.camera,l,c),R=new oG().setFromPoints([new Tr(b.x,b.y),new Tr(C.x,C.y),new Tr(w.x,w.y),new Tr(I.x,I.y)]).getSize(new Tr),B=(l-s-u)/R.x,H=(c-o-a)/R.y,k=Math.min(B,H),lt=new We((d.x+m.x)/2,(d.y+m.y)/2,(d.z+m.z)/2),xt=k*this.camera.zoom,Nt=this.camera.clone();Nt.zoom=xt,Nt.updateMatrix();let Ot=(l-R.x*k)/2,Fn=(c-R.y*k)/2,Rr=(s-u)/2,Pr=(o-a)/2;if(Rr){let wt=new We;wt.setFromMatrixColumn(Nt.matrix,0),wt.normalize(),wt.multiplyScalar(Rr/xt),lt.add(wt)}if(Pr){let wt=new We;wt.setFromMatrixColumn(Nt.matrix,1),wt.normalize(),wt.multiplyScalar(Pr/xt),lt.add(wt)}return{zoom:k*this.camera.zoom,center:lt}}fitCameraToObject(t,e,n,r){e===void 0&&(e=[20,20,20,20]),n===void 0&&(n=500),r===void 0&&(r=!0);let{zoom:o,center:s}=this.getFitCameraToObjectZoom(t,e,n,r);return this.setZoom(o,s,n)}getFitCameraToGroundZoom(t,e,n){if(t===void 0&&(t=[20,20,20,20]),e===void 0&&(e=500),n===void 0&&(n=!0),this.currentFloor&&this.currentFloor.hasElement)return this.getFitCameraToObjectZoom(this.currentFloor.groundUpper,t,e,n).zoom}fitCameraToGround(t,e,n){return t===void 0&&(t=[20,20,20,20]),e===void 0&&(e=500),n===void 0&&(n=!0),this.currentFloor&&this.currentFloor.hasElement?this.fitCameraToObject(this.currentFloor.groundLayer,t,e,n):Promise.resolve(!1)}setCameraPosition(t,e){return E(this,null,function*(){return this.control.setCameraPositionByTarget(t,e)})}pauseRender(){this.renderer.pauseRender()}continueRender(){this.renderer.continueRender()}dispose(){var t;(t=this.currentFloor)==null||t.dispose(),this.control.dispose(),this.cameraBound.dispose(),this.selection.dispose(),this.hoverHelper.dispose(),this.unRegistryEvent(),this.renderer.domElement.remove(),this.renderer.dispose(),this.lights.children.forEach(e=>e.dispose()),J(this.scene),this.scene.clear(),this.container=null}constructor(t,e){super(),this.container=t,this.config=e,this.scene=new xa,this.renderer=new ya,this.lights=kg(),this.clientSize={width:0,height:0,x:0,y:0},this.renderRf=0,this.basicZoom=1,this.onControlChange=()=>{this.dispatchEvent({type:"change-ratio",px:(this.basicRatio||0)*this.camera.zoom}),this.dispatchEvent({type:"control-change"})},this.onControlChangeZoom=n=>{let{zoom:r}=n;this.dispatchEvent({type:"control-zoom-change",zoom:r})},this.onRendererUpdate=()=>{this.dispatchEvent({type:"update"})},this.onWindowResize=()=>{let{container:n,camera:r,renderer:o}=this,{clientWidth:s,clientHeight:a}=n;s=Math.max(1,s),a=Math.max(1,a),r.left=-s/2,r.right=s/2,r.top=a/2,r.bottom=-a/2,r.updateProjectionMatrix(),o.setSize(s,a),this.resizeClientSize(),this.dispatchEvent({type:"resize",width:s,height:a})},this.onClick=n=>{let{graphics:r,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY);r.length&&this.dispatchEvent({type:"graphic-click",graphics:r,position:o});let s=this.getPoisByDeviceXy(n.offsetX,n.offsetY);s.length&&this.dispatchEvent({type:"poi-click",pois:s})},this.onPointerover=n=>{let{graphics:r,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY),s=this.getPoisByDeviceXy(n.offsetX,n.offsetY);this.dispatchEvent({type:"pointer-over",e:n,graphics:r,pois:s,position:o})},this.onPointermove=n=>{let{graphics:r,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY),s=this.getPoisByDeviceXy(n.offsetX,n.offsetY);this.dispatchEvent({type:"pointer-move",e:n,graphics:r,pois:s,position:o})},this.onPointerleave=n=>{this.dispatchEvent({type:"pointer-level"})},this.onSelectionSelect=n=>{let{graphics:r,isMultipleSelect:o}=n;this.dispatchEvent({type:"select-graphic",graphics:r,isMultipleSelect:o})},this.onHoverChange=n=>{let{graphics:r}=n;this.dispatchEvent({type:"hover",graphics:r})},this.container.style.position="relative",this.container.style.overflow="hidden",this.init(),this.selection=new la(this),this.hoverHelper=new ca(this),this.resizeClientSize(),this.registryEvent()}};import{merge as cG}from"lodash";var hG={placeId:0,apiDomain:"",apiInfo:{},apiPath:{floorGraphic:"/api/inception-map/floor/get",floorRange:"/api/inception-map/range/get",equipmentList:"/api/inception-map/equipment/get",roadNetwork:"/api/inception-map/road_network/get",loadPlaceInfo:"https://screen.aibee.cn/ai-map/map/get-floor-map"},enableBoxSelect:!0,resizeObserver:!1,initTransToMark:!1,heatMap:{radius:50,gradient:{0:"#8F9FCD",.5:"#6284FF",1:"#F95D5D"}},useFloorCache:!0,control:{maxPolar:1.2,defaultPolar:1.1,defaultAzimuthal:0},defaultPadding:[20,20,20,20],svg:{circle:{radius:"2",fill:"#1CADFF"},line:{stroke:"#1CADFF"}},selectBox:{stroke:"#1CADFF",fill:"rgba(28, 173, 255, 0.3)"},hover:{time:100},ground:{color:"#F6F6F6",opacity:1,height:.001,stroke:!1,strokeColor:"#E6E6E6",strokeOpacity:1},markGraphic:{color:"#EEF0F3",opacity:1,height:.001,stroke:!1,strokeColor:"#000",strokeOpacity:1},graphic:{fillOpacity:1},cameraBound:{padding:[150,150,150,150]},poi:{boxScale:1}};function r3(i){return cG({},hG,i)}import{debounce as RG}from"lodash";var gJ=f(P(),1);var le;function i3(i,t){return i===void 0&&(i="aibee_map"),t===void 0&&(t=1),new Promise((e,n)=>{if(le)return e({db:le,type:"success"});let r=indexedDB.open(i,t);r.onupgradeneeded=function(o){le=o.target.result,console.log("onupgradeneeded"),e({db:le,type:"onupgradeneeded"})},r.onsuccess=o=>{le=o.target.result,e({db:le,type:"success"})},r.onerror=o=>{n(o)}})}function Bc(i,t,e){return e===void 0&&(e=le),new Promise((n,r)=>{e||r("\u6CA1\u6709db");let s=e.transaction([i],"readonly").objectStore(i).get(t);s.onsuccess=()=>{s.result?n(s.result.value):n(null)},s.onerror=a=>{console.log("[getVersionByKey]",a),n(null)}})}function o3(i,t,e,n){return n===void 0&&(n=le),new Promise((r,o)=>(n||o("\u6CA1\u6709db"),new Promise((s,a)=>E(this,null,function*(){let u=yield Bc(i,t),l=n.transaction([i],"readwrite").objectStore(i),c=u!==null?l.put({key:t,value:e}):l.add({key:t,value:e});c.onsuccess=function(h){s(h)},c.onerror=function(h){a(h)}}))))}function On(i,t){t===void 0&&(t=le),t&&(t.objectStoreNames.contains(i)||t.createObjectStore(i,{keyPath:"key"}))}function s3(i){i===void 0&&(i=le),i==null||i.close(),le=null}import{Vector3 as MG,Color as wG}from"three";var aJ=f(U(),1),uJ=f(P(),1);function ba(i,t){let e=i.poi_info.showName||i.store_name||i.poi_info.text;switch(t){case"zh-cn":return e;case"en":var n;return((n=i.store_info_ext)==null?void 0:n.poi_name)||e;case"zh-hk":var r;return((r=i.store_info_ext)==null?void 0:r.traditional_name)||e}}function Ma(i,t){let e=i.poi_info.showName||i.store_name||i.poi_info.text;switch(t){case"zh-cn":return e;case"en":var n;return((n=i.infra_info_ext)==null?void 0:n.poi_name)||e;case"zh-hk":var r;return((r=i.infra_info_ext)==null?void 0:r.traditional_name)||e}}function a3(i,t,e){switch(i.l_type){case"graph":return pG(i,t);case"wall":return fG(i,t);case"lane":return dG(i,t);case"texture2d":case"texture3d":return gG(i,t);case"glb":return mG(i,t);case"store":return _G(i,t);case"facility":return yG(i,t);case"parkingSpace":return EG(i,t,e);case"text":return bG(i,t)}}function u3(i,t,e,n){switch(i.l_type){case"store":return vG(i,t,e,n.showStoreName);case"facility":return xG(i,t,e,n.showFacilityName);case"parkingSpace":return SG(i,t)}}function pG(i,t){let e=i.elements.reduce((n,r)=>{let{fillColor:o,fillOpacity:s,strokeColor:a,strokeOpacity:u,height:l,airHeight:c}=r,h=o.toLowerCase()+"-"+s+"-"+a.toLowerCase()+"-"+u+"-"+l+"-"+c;return u===0&&(h=o.toLowerCase()+"-"+s+"-"+l+"-"+c),n[h]?n[h].push(r):n[h]=[r],n},{});Object.values(e).forEach(n=>{let r=new br(t.context,n);t.mergeGraphicLayer.add(r)})}function fG(i,t){let e=i.elements.reduce((n,r)=>{let{fillColor:o,fillOpacity:s,strokeColor:a,strokeOpacity:u,height:l}=r,c=o.toLowerCase()+"-"+s+"-"+a.toLowerCase()+"-"+u+"-"+l;return u===0&&(c=o.toLowerCase()+"-"+s+"-"+l),n[c]?n[c].push(r):n[c]=[r],n},{});Object.values(e).forEach(n=>{let r=new ra(t.context,n);t.wallLayer.add(r)})}function dG(i,t){let e=i.elements.reduce((n,r)=>{let{fillColor:o,fillOpacity:s,strokeColor:a,strokeOpacity:u}=r,l=o.toLowerCase()+"-"+s+"-"+a.toLowerCase()+"-"+u;return u===0&&(l=o.toLowerCase()+"-"+s),n[l]?n[l].push(r):n[l]=[r],n},{});Object.values(e).forEach(n=>{let r=new oa(t.context,n);t.laneLayer.add(r)})}function gG(i,t){if(i.elements.length){let e=new Sr(t.context,i.elements);t.textureLayer.add(e)}}function mG(i,t){i.elements.forEach(e=>{let n=new ia(t.context,S({},e,{url:e.secondUrl,rotate:e.secondRotate,width:e.secondWidth,center_x:e.center_coord_x,center_y:e.center_coord_y}));t.glbModelLayer.add(n)})}function _G(i,t){i.elements.map(e=>{let n=t.addGraphic(e);t.userData.graphics.push(n),t.userData.graphicMap.set(e.id,n)})}function vG(i,t,e,n){i.elements.map(r=>{try{let o=ba(r,e),s=new nt(t.context,{id:r.id,icon:r.poi_info.showImageUrl||r.poi_info.icon,text:o,position:{x:r.center_coord_x,y:r.center_coord_y,z:r.airHeight+r.height},icon_size:[24,24],level:r.poi_info.level||0,hide_text:!n,maxWeight:r.poi_info.maxWeight||25,minWeight:r.poi_info.minWeight||1});t.poiLayer2.pushPoi(s),s&&(s.userData.type="store",s.userData.data=r,s.userData.floor=t.name)}catch(o){console.log("\u521B\u5EFA\u5E97\u94FApoi\u5931\u8D25",o,r)}})}function yG(i,t){i.elements.map(e=>{let n=t.addGraphic(e);t.userData.graphics.push(n),t.userData.graphicMap.set(e.id,n)})}function xG(i,t,e,n){i.elements.filter(o=>o.poi_info).map(o=>{try{let s=Ma(o,e),a=new nt(t.context,{id:o.id,icon:o.poi_info.showImageUrl||o.poi_info.icon,text:s,position:{x:o.center_coord_x,y:o.center_coord_y,z:o.airHeight+o.height},icon_size:[24,24],level:o.poi_info.level||0,hide_text:!n,maxWeight:o.poi_info.maxWeight||25,minWeight:o.poi_info.minWeight||1});t.poiLayer2.pushPoi(a),a.userData.type="facility",a.userData.data=o,a.userData.floor=t.name}catch(s){console.log("\u6DFB\u52A0facility\u5931\u8D25",s,o)}})}function EG(i,t,e){t.parkingSpaceLayer.createParkings(i.elements,e.mergeParkingSpace),t.userData.parkingSpaces=t.parkingSpaceLayer.graphicMap.values(),t.userData.parkingSpacesGraphicMap=t.parkingSpaceLayer.graphicMap}function SG(i,t){return E(this,null,function*(){let e=i.elements.filter(o=>o.texts[0]),n=e.map(o=>o.texts[0]),r=yield tt.lazyGetTextureByTexts(n);e.forEach(o=>{try{let s=o.texts[0],a=new nt(t.context,{id:o.id,text:s,position:{x:o.center_coord_x,y:o.center_coord_y,z:o.airHeight+o.height},text_texture:r[s].texture,text_texture_width:r[s].width,text_texture_height:r[s].height,text_texture_offset_x:r[s].x,text_texture_offset_y:r[s].y});a&&(a.userData.type="parkingSpace",a.userData.data=o,a.userData.floor=t.name),t.poiLayer2.pushPoi(a)}catch(s){console.log("\u6DFB\u52A0\u8F66\u4F4Dpoi\u5931\u8D25",s,o)}}),Object.values(r).forEach(o=>{o.texture.dispose()})})}function bG(i,t){let e=new aa(t.context,i.elements.map(n=>S({},n,{center_x:n.center_coord_x,center_y:n.center_coord_y})));t.textTextureLayer.add(e)}var l3="map_version",c3="route_version",h3="facility_version",zc="map_data",wa="road_network_data",Gc="facility_data",TG={mergeParkingSpace:!0},Ar=class extends pt{initDb(){return E(this,null,function*(){try{let{db:t,type:e}=yield i3("aibee_map",2);e==="onupgradeneeded"&&(On(l3),On(c3),On(h3),On(zc),On(wa),On(Gc)),this.db=t}catch(t){console.log("[\u6253\u5F00indexDb\u9519\u8BEF]",t)}})}load(t,e){return E(this,null,function*(){if(Array.isArray(t))this.floors=t,e&&(this.placeConfig=S({},this.placeConfig,e));else{let n=yield fetch(t).then(r=>r.json());n.code===200&&(this.floors=n.data.list,this.placeConfig=S({},this.placeConfig,JSON.parse(n.data.config||"{}")))}this.getOtherDataByFreeTime()})}setCacheData(t,e,n){return this.initDbPromise.then(()=>o3(t,""+e,n,this.db))}getCacheData(t,e){return this.initDbPromise.then(()=>Bc(t,""+e,this.db))}getFloorCacheKey(t){return t.floor_id+"_"+t.version_id}getFloorData(t){return E(this,null,function*(){let e=yield this.getFloorJsonData(t);return e?this.getDataByJson(e):null})}getFloorDataByFloorInfo(t){return E(this,null,function*(){let e=yield this.getFloorJsonDataByFloorInfo(t);return this.getDataByJson(e)})}setLocale(t){this.locale=t,this.bmap.context.currentFloor&&this.bmap.context.currentFloor.poiLayer2.pois.forEach(e=>{e.userData.type==="store"&&(e.options.text=ba(e.userData.data,t)),e.userData.type==="facility"&&(e.options.text=Ma(e.userData.data,t))})}getFloorJsonDataByFloorInfo(t){return E(this,null,function*(){if(this.getFloorDataPromise.has(t.floor))return this.getFloorDataPromise.get(t.floor);let e=new Promise(n=>E(this,null,function*(){let r=this.getFloorCacheKey(t),o=yield fetch(t.map_url).then(s=>s.json());o.floor=t.floor,this.setCacheData(zc,r,o),this.setCacheData(l3,r,t.version_id),n(o)}));return this.getFloorDataPromise.set(t.floor,e),e})}getFloorJsonData(t){return E(this,null,function*(){let e=this.floors.find(r=>r.floor===t);if(!e)return null;let n=this.getFloorCacheKey(e);try{let r=yield this.getCacheData(zc,n);return r||this.getFloorJsonDataByFloorInfo(e)}catch(r){return console.log("[get floor data error]",r),this.getFloorJsonDataByFloorInfo(e)}})}getRoadNetworkData(){return E(this,null,function*(){return(yield Promise.all(this.floors.map(e=>E(this,null,function*(){let n=this.getFloorCacheKey(e);try{let r=yield this.getCacheData(wa,n);if(r)return r;let o=yield fetch(e.route_url).then(s=>s.json());return this.setCacheData(wa,n,o),this.setCacheData(c3,n,e.version_id),o}catch(r){let o=yield fetch(e.route_url).then(s=>s.json());return this.setCacheData(wa,n,o),o}})))).filter(e=>e.points)})}getFacilitiesData(){return E(this,null,function*(){let t=this.floors.reduce((r,o)=>r.updated_at>o.updated_at?r:o,this.floors[0]);if(!t)return null;let e=this.getFloorCacheKey(t),n=()=>E(this,null,function*(){let r=yield fetch(t.entry_infra_url).then(o=>o.json());return r&&(this.setCacheData(Gc,e,r),this.setCacheData(h3,e,t.version_id)),r});try{let r=yield this.getCacheData(Gc,e);return r||n()}catch(r){return console.log("[get facility error]",r),n()}})}getOtherDataByFreeTime(){return E(this,null,function*(){for(let t=0;t<this.floors.length;t++){let e=this.floors[t];this.getFloorJsonData(e.floor)}})}getMulFloorsData(t){return E(this,null,function*(){return Promise.all(t.map(e=>this.getFloorData(e))).then(e=>e.filter(n=>n))})}getDataByUrl(t){return E(this,null,function*(){let e=yield fetch(t).then(n=>n.json());return this.getDataByJson(e)})}getDataByJson(t,e,n){return E(this,null,function*(){return e=this.getFloorBaseLayer(t,e),n=S({},this.placeConfig,n),t.layers.forEach(r=>{["range","ground"].includes(r.l_type)||rr(r.elements,e.userData.center)}),yield this.getFloorContentLayer(t,e),yield this.getFloorPoi(t,e,n),this.changeFloorBox(t,e),e})}changeFloorBox(t,e){e.updateBox();let n=e.box.getSize(new MG),r=Math.max(n.x,n.y,n.z);e.userData.height=r/4+t.floorHeight}switchFloor(t,e){return E(this,null,function*(){return new Promise(n=>{let r={run:()=>this._switchFloor(t,e),meta:{type:"switchFloor"}},o=this.taskQueue.replaceByMetaType(r),s=a=>{let{task:u,res:l}=a;u.tid===o&&(this.taskQueue.removeEventListener("active-task-end",s),n(l))};this.taskQueue.addEventListener("active-task-end",s)})})}_switchFloor(t,e){return E(this,null,function*(){var n;let r=t;if(typeof t=="string"){let l=yield this.getFloorJsonData(t);if(l)r=l;else return null}e=S({},this.placeConfig,e);let o=new Yt(this.bmap.context);o.userData.data=t;let s=this.floors.find(l=>l.floor===r.floor);var a;let u=(a=s==null?void 0:s.map_angle)!=null?a:0;return this.bmap.dispatchEvent({type:ht.SWITCH_FLOOR_BEFORE,data:{curFloor:o,graphics:[]}}),this.dispatchEvent({type:"switch-floor-before",data:{curFloor:o,graphics:[],floorData:r}}),this.bmap.context.scene.background=new wG(e.backgroundColor),this.getFloorBaseLayer(r,o),this.changeFloorBox(r,o),this.bmap.buildingCenter=o.userData.center,this.bmap.currentBuildGround=(n=o.userData.data.layers.find(l=>l.l_type==="range"))==null?void 0:n.elements[0],this.bmap.context.switchFloor(o),this.bmap.initialFloorCamera(),this.bmap.context.control.setAzimuthalAngle(u/180*Math.PI,!0),this.bmap.context.cameraBound.updateBox(),r.layers.forEach(l=>{["range","ground"].includes(l.l_type)||rr(l.elements,o.userData.center)}),this.dispatchEvent({type:"switch-floor-ground",data:{curFloor:o,graphics:[]}}),this.bmap.dispatchEvent({type:ht.SWITCH_FLOOR_GROUND,data:{curFloor:o}}),yield Ho(),yield this.getFloorContentLayer(r,o),this.changeFloorBox(r,o),this.dispatchEvent({type:"switch-floor-content",data:{curFloor:o,graphics:[]}}),yield Nm(2),yield this.getFloorPoi(r,o,e),this.dispatchEvent({type:"switch-floor-after",data:{curFloor:o,graphics:o.graphicLayer.children}}),this.bmap.dispatchEvent({type:ht.SWITCH_FLOOR_AFTER,data:{curFloor:o,graphics:o.graphicLayer.children}}),o})}getFloorBaseLayer(t,e){e||(e=new Yt(this.bmap.context));let n=[0,0];return t.layers.forEach(r=>{switch(r.l_type){case"range":let o=r.elements[0];n=[o.center_x,o.center_y];break;case"ground":rr(r.elements,n);let s=r.elements.map(a=>new et(this.bmap.context,a));e.addGrounds(s);break;default:break}}),e.userData.center=n,e.name=t.floor,e.userData.data=t,e}getFloorContentLayer(t,e){return E(this,null,function*(){e||(e=new Yt(this.bmap.context)),e.userData.graphics=[],e.userData.graphicMap=new Map;let n=Date.now();for(let r=0;r<t.layers.length;r++){let o=t.layers[r];["range","ground"].includes(o.l_type)||(a3(o,e,this.options),console.log("time",Date.now()-n,o.l_type),Date.now()-n>50&&(yield Ho(),n=Date.now()))}return e})}getFloorPoi(t,e,n){return E(this,null,function*(){n===void 0&&(n=this.placeConfig);let r=Date.now();yield Promise.all(t.layers.map(s=>u3(s,e,this.locale,n))),console.log("poi time",Date.now()-r);let o=Date.now();Ho().then(()=>{console.log("poi render time",Date.now()-o)})})}clear(){return E(this,null,function*(){var t;s3((t=this.db)!=null?t:void 0)})}dispose(){super.dispose(),this.clear(),this.getFloorDataPromise.clear()}constructor(t,e={}){super(),this.bmap=t,this.floors=[],this.initDbPromise=Promise.resolve(),this.db=null,this.taskQueue=new ir,this.locale="zh-cn",this.placeConfig={backgroundColor:"#f1f7f6",showFacilityName:!0,showStoreName:!0},this.getFloorDataPromise=new Map,this.options=S({},TG,e),this.initDbPromise=this.initDb()}};var PJ=f(P(),1);function p3(i,t){return E(this,null,function*(){let{brand:e,project:n}=i,{apiDomain:r,apiPath:{floorRange:o},apiInfo:s}=t,a=""+r+o+"?brand="+e+"&project="+n+"&phase="+n+"&building="+n;return yield fetch(a,s).then(l=>l.json()).then(l=>l.data).then(l=>{let c=(l||[])[0];return c&&(c.info=JSON.parse(c.info)),c})})}function f3(i,t){return E(this,null,function*(){let{brand:e,project:n,floor:r,ts:o,resource_type_list:s}=i,{apiDomain:a,apiPath:{floorGraphic:u},apiInfo:l}=t,c=""+a+u+"?brand="+e+"&project="+n+"&phase="+n+"&building="+n+"&floor="+r+"&ts="+o+"&resource_type_list="+s;return yield fetch(c,l).then(p=>p.json()).then(p=>p.data).then(p=>((p||[]).map(d=>d.info=JSON.parse(d.info)),p||[]))})}function MJ(i,t){return E(this,null,function*(){let{project:e,floor:n}=i,{apiDomain:r,apiInfo:o}=t,s=r+"/api/inception-map/external_street/get?projectCode="+e+"&floorCode="+n;return yield fetch(s,o).then(u=>u.json()).then(u=>u.data).then(u=>JSON.parse(u[0].streetInfo||"{}")).then(u=>u.fileId?AG(u.fileId,t):null)})}function AG(i,t){return E(this,null,function*(){let{apiDomain:e,apiInfo:n}=t;return fetch(e+"/api/inception-map/file/getFileStream?fileId="+i,n).then(r=>r.arrayBuffer()).then(r=>{let s=new TextDecoder("utf-8").decode(r);return s?JSON.parse(s):null})})}var d3=class{load(t){return E(this,null,function*(){let e=tr(t);if(this.cacheData.has(e))return this.cacheData.get(e);let[,n]=yield Promise.all([this.loadBuildGround(t),f3(t,this.bmap.config)]),r=tr({floor:t.floor,ts:t.ts});rr(n.map(s=>s.info),this.bmap.buildingCenter,this.floorDataLengthMap.get(r)||0),n.forEach(s=>s.info.transformToBuildingGround=!1),this.cacheData.set(e,n);let o=this.floorDataLengthMap.get(r)||0;return this.floorDataLengthMap.set(r,o+n.length),this.loadExternalStreet(t),n})}loadExternalStreet(t){return E(this,null,function*(){})}switchFloorByData(t,e){if(!t.length)return;let n=e.userData.legacyToGraphicMap||new Map,r=e.userData.graphicMap||new Map,{ground:o,markGraphic:s,graphic:a}=this.bmap.config;for(let u=0;u<t.length;u++){let l=t[u];l.info.group==="ground"?(l.info.fillColor=o.color,l.info.fillOpacity=o.opacity,l.info.height=o.height,l.info.stroke=o.stroke,l.info.strokeColor=o.strokeColor,l.info.strokeOpacity=o.strokeOpacity):l.info.userData.mark?(l.info.height=s.height,l.info.fillColor=s.color,l.info.fillOpacity=s.opacity,l.info.stroke=s.stroke,l.info.strokeColor=s.strokeColor,l.info.strokeOpacity=s.strokeOpacity):(l.info.fillOpacity=a.fillOpacity,this.bmap.config.initTransToMark&&(l.info.height=s.height,l.info.fillColor=s.color,l.info.stroke=s.stroke,l.info.strokeColor=s.strokeColor,l.info.strokeOpacity=s.strokeOpacity))}for(let u of t){if(u.info.group==="ground")e.createGround(u.info);else{let l=e.addGraphic(u.info);l.userData.data=u,n.set(u.legacy_id,l)}r.set(u.element_uuid,u)}e.userData.legacyToGraphicMap=n,e.userData.graphicMap=r,e.updateBox(),e===this.bmap.context.currentFloor?(this.bmap.triggerHooks(ht.SWITCH_FLOOR_BEFORE,{curFloor:e,graphics:e.graphicLayer.children}),this.bmap.initialFloorCamera(),this.bmap.triggerHooks(ht.SWITCH_FLOOR_AFTER,{curFloor:e,graphics:e.graphicLayer.children})):this.bmap.switchFloorByFloor(e)}filterData(t,e){let n=e.userData.graphicMap||new Map;return t.filter(r=>!n.has(r.element_uuid))}switchFloorByStoreData(t,e){return E(this,null,function*(){let n=yield this.load(S({},t,{resource_type_list:"6"})),r=this.filterData(n,e);this.switchFloorByData(r,e)})}switchFloorByOtherData(t,e){return E(this,null,function*(){let n=yield this.load(S({},t,{resource_type_list:"1,2,3,4"})),r=this.filterData(n,e);this.switchFloorByData(r,e)})}loadBuildGround(t){return E(this,null,function*(){let{brand:e,project:n}=t,r=yield this.loadBuildingGround({brand:e,project:n});return this.bmap.currentBuildGround=r,this.bmap.changeBuildingCenter(r,{brand:e,project:n}),this.bmap.currentBuildGround})}loadBuildingGround(t){return E(this,null,function*(){let{brand:e,project:n}=t,r=tr({brand:e,project:n});if(this.buildingGroundMap.has(r))return this.buildingGroundMap.get(r);let o=p3({brand:e,project:n},this.bmap.config).then(s=>(this.buildingGroundMap.set(r,s),s));return this.buildingGroundMap.set(r,o),o})}switchFloor(t){return E(this,null,function*(){let e=new Yt(this.bmap.context);e.userData.graphicMap=new Map,e.name=t.floor;try{yield Promise.all([this.switchFloorByStoreData(t,e),this.switchFloorByOtherData(t,e)])}catch(n){console.log(n)}return e})}dispose(){this.cacheData.clear(),this.floorDataLengthMap.clear(),this.buildingGroundMap.clear()}constructor(t){this.bmap=t,this.cacheData=new Map,this.floorDataLengthMap=new Map,this.buildingGroundMap=new Map,this.externalStreetMap=new Map}};var JJ=function(i){return i[i.D2=0]="D2",i[i.D3=1.1]="D3",i}({}),Ta=class extends CG{get basicZoom(){return this.context.basicZoom}set basicZoom(t){this.context.basicZoom=t}changeBuildingCenter(t,e){let{brand:n,project:r}=e,o=t?Fo(t.info.geometry.cds[0]):[0,0];this.buildingCenter=o,this.dispatchEvent({type:"center-change",center:o,project:r,brand:n})}use(t){t.bmap=this,this.plugins.push(t)}unUse(t){this.plugins=this.plugins.filter(e=>e!==t)}triggerHooks(t,e){this.dispatchEvent({type:t,data:e})}switchFloor(t){return E(this,null,function*(){return this.loader||(this.loader=new Ar(this),yield this.loader.load(this.config.apiPath.loadPlaceInfo+"?place_id="+this.config.placeId+"&env=prod")),this.loader.switchFloor(t)})}switchFloorByFloor(t,e){e===void 0&&(e=t.graphicLayer.children),this.triggerHooks(ht.SWITCH_FLOOR_BEFORE,{curFloor:t,graphics:e}),this.context.switchFloor(t),this.initialFloorCamera(),this.triggerHooks(ht.SWITCH_FLOOR_AFTER,{curFloor:t,graphics:e})}initialFloorCamera(){this.context.cameraBound.setEnable(!1),this.context.control.minZoom=0,this.context.control.maxZoom=1/0,this.context.camera.zoom=1,this.context.setAzimuthalAngle(this.config.control.defaultAzimuthal,0),this.context.setPolarAngle(this.config.control.defaultPolar,0),this.context.fitCameraToGround(this.config.defaultPadding,0);let t=this.context.camera.zoom;this.context.control.minZoom=t,this.context.control.maxZoom=t*30,this.type==="3d"&&this.context.fitCameraToGround(this.config.defaultPadding,0,!1),this.basicZoom=this.context.camera.zoom,this.context.control.addEventListener("change",this.onControlChange),this.onControlChange(),this.context.cameraBound.setEnable(!0),this.context.cameraBound.changePrevCamera()}addModel(t,e){if(t.options.geometry.type==="polygon"){var n;let r=(n=this.context.currentFloor)==null?void 0:n.addModel(S({},e,{position:t.getPosition().setZ(.1),id:t.options.id}));if(r){let{facilityAngle:o=0,facilityXScale:s=1,facilityYScale:a=1}=t.options.userData;r.rotateZ((180-o)/180*Math.PI),r.scale.set(s,a,1)}}}addHeatmap(t){var e;return(e=this.context.currentFloor)==null?void 0:e.addHeatmap(t)}getLegacyToGraphicMap(){var t;return((t=this.context.currentFloor)==null?void 0:t.userData.legacyToGraphicMap)||new Map}getFloorAllGraphics(){var t;return((t=this.context.currentFloor)==null?void 0:t.graphicLayer.children.filter(e=>e instanceof et))||[]}createGraphicPoi(t,e){if(this.context.currentFloor){e.id===void 0&&(e.id=t.options.id);let n=t.options.center,r=t.getCenter(),o=(n==null?void 0:n[0])||r.x,s=(n==null?void 0:n[1])||r.y;return console.log(o,s,n,r),this.context.currentFloor.addPoi(S({},e,{position:{x:o,y:s,z:r.z+t.options.height/2}}))}return null}removeHeatMap(){var t;(t=this.context.currentFloor)==null||t.removeHeatMap()}translateElementToCenter(t,e,n,r){e===void 0&&(e=500),n===void 0&&(n=0),r===void 0&&(r=0);let o=t.getPosition().clone(),{context:{camera:s}}=this;if(s.updateMatrix(),r){let a=new kc;a.setFromMatrixColumn(s.matrix,1),a.normalize(),a.multiplyScalar(r/s.zoom),o.add(a)}if(n){let a=new kc;a.setFromMatrixColumn(s.matrix,0),a.normalize(),a.multiplyScalar(n/s.zoom),o.add(a)}return this.context.setCameraPosition(o,e)}translateElementToCenterX(t,e){return E(this,null,function*(){return e===void 0&&(e=500),zt(new Promise(n=>{let r=this.context.control.target.clone(),o=t.getPosition();this.timer.requestAnimationFrame(()=>{let{clientSize:{width:s,height:a},camera:u}=this.context,c=L(o,u,s,a).x-s/2,h=new kc;h.setFromMatrixColumn(this.context.camera.matrix,0),h.normalize(),h.multiplyScalar(c/this.context.camera.zoom),r.add(h),this.context.setCameraPosition(r,e).then(n)})}),e+500)})}getElementDeviceCoordinate(t){let e=t.position.clone(),{clientWidth:n,clientHeight:r}=this.container;return L(e,this.context.camera,n,r)}changeMapType(t,e){return e===void 0&&(e=500),this.type=t,t==="2d"?this.context.setPolarAngle(0,e):this.context.setPolarAngle(1.1,e)}resetView(t){return E(this,null,function*(){t===void 0&&(t=300);let e=t/3;yield this.context.setAzimuthalAngle(this.config.control.defaultAzimuthal,e),yield this.context.setPolarAngle(this.config.control.defaultPolar,e),yield this.context.fitCameraToGround(this.config.defaultPadding,e,!1)})}reduceMap(t,e){t===void 0&&(t=.5),e===void 0&&(e=500);let n=this.context.camera.zoom;return this.context.setZoom(n-t,this.context.control.target,e)}enlargeMap(t,e){t===void 0&&(t=.5),e===void 0&&(e=500);let n=this.context.camera.zoom;return this.context.setZoom(n+t,this.context.control.target,e)}registryEvent(){if(window.addEventListener("keydown",this.onKeydown),window.addEventListener("keyup",this.onKeyUp),this.config.resizeObserver){let t=new ResizeObserver(this.debounceResize);t.observe(this.container),this.observe=t}}unRegistryEvent(){var t;this.context.control.removeEventListener("change",this.onControlChange),window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("keyup",this.onKeyUp),(t=this.observe)==null||t.disconnect(),this.observe=null}configurePolarShortcutKeys(t){this.polarKeys=t}configureAzimuthalShortcutKeys(t){this.azimuthalKeys=t}rotateMap(t){t===void 0&&(t=.1);let e=this.context.control.getAzimuthalAngle();this.context.setAzimuthalAngle(e+t,500)}measureDistance(){return E(this,null,function*(){return this.cancelDistance(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgLine=new ea(this.context);let n=this.svgLine.dispose.bind(this.svgLine);this.svgLine.dispose=function(){n(),e("cancel")},this.svgLine.addEventListener("distance",r=>{let{distance:o}=r;t(o)})})})}cancelDistance(){this.svgLine&&(this.svgLine.dispose(),this.svgLine=void 0,this.context.control.enableRotate=!0)}measureArea(){return this.cancelArea(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgPolygon=new na(this.context);let n=this.svgPolygon.dispose.bind(this.svgPolygon);this.svgPolygon.dispose=function(){n(),e("cancel")},this.svgPolygon.addEventListener("area",r=>{let{area:o}=r;t(o)})})}cancelArea(){this.svgPolygon&&(this.svgPolygon.dispose(),this.svgPolygon=void 0,this.context.control.enableRotate=!0)}getGraphicByNodeId(t){var e,n;return((e=this.context.currentFloor)==null?void 0:e.graphicLayer.getGraphicByNodeId(t))||((n=this.context.currentFloor)==null?void 0:n.parkingSpaceLayer.graphicMap.get(t))||null}deleteGraphic(t){var e;(e=this.context.currentFloor)==null||e.graphicLayer.removeGraphic(t)}createGraphicByOptions(t){var e;if(!t.transformToBuildingGround&&this.currentBuildGround){let n=Fo(this.currentBuildGround.info.geometry.cds[0]);if(t.geometry.type==="polygon")t.geometry.coords=JSON.parse(JSON.stringify(t.geometry.cds)),t.geometry.coords.map(r=>{Array.isArray(r)&&r.forEach(o=>{o[0]-=n[0],o[1]-=n[1]})});else{let[r,o]=t.geometry.cds;t.geometry.coords=[r-n[0],o-n[1]]}}return(e=this.context.currentFloor)==null?void 0:e.graphicLayer.createGraphic(t)}removePoiById(t){var e,n;(e=this.context.currentFloor)==null||e.poiLayer.removePoiById(t),(n=this.context.currentFloor)==null||n.poiLayer2.removePoiById(t)}getPoiById(t){var e,n;return((e=this.context.currentFloor)==null?void 0:e.poiLayer.getPoiById(t))||((n=this.context.currentFloor)==null?void 0:n.poiLayer2.getPoiById(t))}getPois(){var t,e;return[...(((t=this.context.currentFloor)==null?void 0:t.poiLayer.pois)||[]).filter(n=>!n.options.built_in),...((e=this.context.currentFloor)==null?void 0:e.poiLayer2.pois)||[]]}clearPoi(){this.context.currentFloor&&this.context.currentFloor.poiLayer.clear()}removeSelectGraphic(t){this.context.selection.remove(t)}dispose(){this.loader&&(this.loader.dispose(),this.loader=null),this.unRegistryEvent(),this.timer.dispose(),this.plugins.forEach(t=>t.dispose()),this.plugins=[],this.context.dispose(),this.context=null,this.container=null,tt.dispose(),ut.dispose(),sn.dispose(),bt.dispose(),W.dispose(),ue.dispose(),this.debounceResize=null}constructor(t,e={}){super(),this.container=t,this.polarKeys=[],this.azimuthalKeys=[],this.prevCameraZoom=1,this.type="2d",this.currentBuildGround=null,this.observe=null,this.buildingCenter=[0,0],this.timer=new j,this.plugins=[],this.loader=null,this.onControlChange=()=>{let{camera:{zoom:n}}=this.context;n!==this.prevCameraZoom&&(this.dispatchEvent({type:"zoom-change",basicZoom:this.basicZoom,cameraZoom:this.context.camera.zoom}),this.prevCameraZoom=n)},this.onKeydown=n=>{this.polarKeys.includes(n.code)&&(this.context.control.maxPolarAngle=this.config.control.maxPolar,this.context.control.minPolarAngle=0),this.azimuthalKeys.includes(n.code)&&(this.context.control.maxAzimuthAngle=1/0,this.context.control.minAzimuthAngle=1/0)},this.onKeyUp=n=>{if(this.polarKeys.includes(n.code)){let r=this.context.control.getPolarAngle();this.context.control.maxPolarAngle=r,this.context.control.minPolarAngle=r}if(this.azimuthalKeys.includes(n.code)){let r=this.context.control.getAzimuthalAngle();this.context.control.maxAzimuthAngle=r,this.context.control.minAzimuthAngle=r}},this.resize=()=>{this.context.cameraBound.setEnable(!1),this.context.onWindowResize();let n=this.context.control.getAzimuthalAngle(),r=this.context.camera.zoom;this.context.control.minZoom=0,this.context.control.maxZoom=1/0,this.context.camera.zoom=1,this.context.setAzimuthalAngle(0,0);let o=this.context.getFitCameraToGroundZoom(this.config.defaultPadding,0)||1;this.context.camera.zoom=r,this.context.control.minZoom=o,this.context.control.maxZoom=o*25,this.basicZoom=r,this.context.control.addEventListener("change",this.onControlChange),this.context.setAzimuthalAngle(n,0),this.context.cameraBound.setEnable(!0)},this.config=r3(e),this.context=new Sa(t,this.config),this.debounceResize=RG(this.resize,5),this.registryEvent()}};var rQ=f(P(),1);import{EventDispatcher as PG}from"three";var Mt=class extends PG{dispose(){let t=this.bmap.plugins.findIndex(e=>e===this);t!==-1&&this.bmap.plugins.splice(t,1),this.bmap=null}constructor(t){super(),this.bmap=t,this.bmap.use(this)}};var g3=class extends Mt{fetchEquipment(){return E(this,null,function*(){let{apiDomain:t,apiPath:{equipmentList:e},apiInfo:n}=this.bmap.config,r=""+t+e;yield fetch(r,n).then(o=>o.json()).then(o=>o.data).then(o=>{this.equipmentList=o,this.equipmentMap=new Map(o.map(s=>[s.equipment_id,s]))}),this.dispatchEvent({type:"change-equipment-list",data:this.equipmentList}),this.bmap.context.currentFloor&&this.changeGraphicToEquipment(this.bmap.context.currentFloor.graphicLayer.children)})}getGraphicEquipment(t){return t.userData.data.info.userData.equipment}changeGraphicToEquipment(t){t.filter(e=>{let n=this.getGraphicEquipment(e);return n&&this.equipmentMap.has(n)}).forEach(e=>{let n=this.equipmentMap.get(this.getGraphicEquipment(e)),r=this.bmap.createGraphicPoi(e,{icon:n==null?void 0:n.equipment_icon,built_in:!0,icon_size:[14,14]});r&&(r.userData.data=n,r.userData.type="equipment")})}dispose(){var t;this.bmap.removeEventListener(ht.SWITCH_FLOOR_AFTER,this.onSwitchFloor),Array.from(((t=this.bmap.context.currentFloor)==null?void 0:t.poiLayer.pois)||[]).forEach(e=>{if(e.userData.type==="equipment"){var n;(n=this.bmap.context.currentFloor)==null||n.poiLayer.removePoi(e)}}),super.dispose()}constructor(t){super(t),this.equipmentList=[],this.equipmentMap=new Map,this.onSwitchFloor=e=>{let{data:{graphics:n}}=e;this.equipmentList.length&&this.changeGraphicToEquipment(n)},this.fetchEquipment(),this.bmap.addEventListener(ht.SWITCH_FLOOR_AFTER,this.onSwitchFloor)}};var gtt=f(ti(),1),mtt=f(Bt(),1),_tt=f(P(),1),vtt=f(Fc(),1);var RQ=f(P(),1),PQ=f(U(),1);import{Mesh as BG,Object3D as zG,TextureLoader as GG,Color as kG,Vector2 as Hc,Vector3 as VG,NormalBlending as HG,RepeatWrapping as WG}from"three";var cQ=f(Bl(),1),hQ=f(hi(),1),pQ=f(pi(),1),fQ=f(di(),1),dQ=f(gi(),1),gQ=f(mi(),1),mQ=f(vi(),1),_Q=f(yi(),1),vQ=f(xi(),1),yQ=f(Ei(),1),xQ=f(Si(),1),EQ=f(bi(),1),SQ=f(Mi(),1),bQ=f(Ti(),1),MQ=f(Ai(),1),wQ=f(U(),1),TQ=f(Ac(),1);import{BufferGeometry as IG,Matrix4 as _3,Vector3 as Dn,Ray as LG,Sphere as NG,LineSegments as OG,BufferAttribute as _n,ShaderChunk as Lt,ShaderMaterial as v3,UniformsLib as DG,Color as UG,Vector2 as m3}from"three";var yt=class extends IG{constructor(){super(),this.isMeshLine=!0,this.type="MeshLine",this.positions=[],this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[],this.counters=[],this._points=[],this._geom=null,this.widthCallback=null,this.matrixWorld=new _3,Object.defineProperties(this,{geometry:{enumerable:!0,get:function(){return this}},geom:{enumerable:!0,get:function(){return this._geom},set:function(t){this.setGeometry(t,this.widthCallback)}},points:{enumerable:!0,get:function(){return this._points},set:function(t){this.setPoints(t,this.widthCallback)}}})}};yt.prototype.setMatrixWorld=function(i){this.matrixWorld=i};yt.prototype.setGeometry=function(i,t){this._geometry=i,this.setPoints(i.getAttribute("position").array,t)};yt.prototype.setPoints=function(i,t){if(!(i instanceof Float32Array)&&!(i instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=i,this.widthCallback=t,this.positions=[],this.counters=[],i.length&&i[0]instanceof Dn)for(var e=0;e<i.length;e++){var n=i[e],r=e/i.length;this.positions.push(n.x,n.y,n.z),this.positions.push(n.x,n.y,n.z),this.counters.push(r),this.counters.push(r)}else for(var e=0;e<i.length;e+=3){var r=e/i.length;this.positions.push(i[e],i[e+1],i[e+2]),this.positions.push(i[e],i[e+1],i[e+2]),this.counters.push(r),this.counters.push(r)}this.process()};function FG(i,t){var e=new _3,n=new LG,r=new NG,o=new Dn,s=this.geometry;if(s.boundingSphere||s.computeBoundingSphere(),r.copy(s.boundingSphere),r.applyMatrix4(this.matrixWorld),i.ray.intersectSphere(r,o)!==!1){e.copy(this.matrixWorld).invert(),n.copy(i.ray).applyMatrix4(e);var a=new Dn,u=new Dn,l=new Dn,c=this instanceof OG?2:1,h=s.index,p=s.attributes;if(h!==null)for(var d=h.array,m=p.position.array,_=p.width.array,v=0,x=d.length-1;v<x;v+=c){var M=d[v],b=d[v+1];a.fromArray(m,M*3),u.fromArray(m,b*3);var C=_[Math.floor(v/3)]!==void 0?_[Math.floor(v/3)]:1,w=i.params.Line.threshold+this.material.lineWidth*C/2,I=w*w,A=n.distanceSqToSegment(a,u,o,l);if(!(A>I)){o.applyMatrix4(this.matrixWorld);var R=i.ray.origin.distanceTo(o);R<i.near||R>i.far||(t.push({distance:R,point:l.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this}),v=x)}}}}yt.prototype.raycast=FG;yt.prototype.compareV3=function(i,t){var e=i*6,n=t*6;return this.positions[e]===this.positions[n]&&this.positions[e+1]===this.positions[n+1]&&this.positions[e+2]===this.positions[n+2]};yt.prototype.copyV3=function(i){var t=i*6;return[this.positions[t],this.positions[t+1],this.positions[t+2]]};yt.prototype.getDistance=function(i){let t=0;for(let e=0;e<i;e++){let n=6*e,r=new Dn(this.positions[n],this.positions[n+1],this.positions[n+2]),o=new Dn(this.positions[n+6],this.positions[n+7],this.positions[n+8]),s=r.distanceTo(o);t+=s}return t};yt.prototype.process=function(){var i=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var t;let e=this.getDistance(i-1);var n;this.compareV3(0,i-1)?n=this.copyV3(i-2):n=this.copyV3(0),this.previous.push(n[0],n[1],n[2]),this.previous.push(n[0],n[1],n[2]);for(var r=0;r<i;r++){if(this.side.push(1),this.side.push(-1),this.widthCallback?t=this.widthCallback(r/(i-1)):t=1,this.width.push(t),this.width.push(t),r===0)this.uvs.push(0,0),this.uvs.push(0,1);else if(r===i-1)this.uvs.push(1,0),this.uvs.push(1,1);else{let s=this.getDistance(r)/e;this.uvs.push(s,0),this.uvs.push(s,1)}if(r<i-1){n=this.copyV3(r),this.previous.push(n[0],n[1],n[2]),this.previous.push(n[0],n[1],n[2]);var o=r*2;this.indices_array.push(o,o+1,o+2),this.indices_array.push(o+2,o+1,o+3)}r>0&&(n=this.copyV3(r),this.next.push(n[0],n[1],n[2]),this.next.push(n[0],n[1],n[2]))}this.compareV3(i-1,0)?n=this.copyV3(1):n=this.copyV3(i-1),this.next.push(n[0],n[1],n[2]),this.next.push(n[0],n[1],n[2]),!this._attributes||this._attributes.position.count!==this.positions.length?this._attributes={position:new _n(new Float32Array(this.positions),3),previous:new _n(new Float32Array(this.previous),3),next:new _n(new Float32Array(this.next),3),side:new _n(new Float32Array(this.side),1),width:new _n(new Float32Array(this.width),1),uv:new _n(new Float32Array(this.uvs),2),index:new _n(new Uint16Array(this.indices_array),1),counters:new _n(new Float32Array(this.counters),1)}:(this._attributes.position.copyArray(new Float32Array(this.positions)),this._attributes.position.needsUpdate=!0,this._attributes.previous.copyArray(new Float32Array(this.previous)),this._attributes.previous.needsUpdate=!0,this._attributes.next.copyArray(new Float32Array(this.next)),this._attributes.next.needsUpdate=!0,this._attributes.side.copyArray(new Float32Array(this.side)),this._attributes.side.needsUpdate=!0,this._attributes.width.copyArray(new Float32Array(this.width)),this._attributes.width.needsUpdate=!0,this._attributes.uv.copyArray(new Float32Array(this.uvs)),this._attributes.uv.needsUpdate=!0,this._attributes.index.copyArray(new Uint16Array(this.indices_array)),this._attributes.index.needsUpdate=!0),this.setAttribute("position",this._attributes.position),this.setAttribute("previous",this._attributes.previous),this.setAttribute("next",this._attributes.next),this.setAttribute("side",this._attributes.side),this.setAttribute("width",this._attributes.width),this.setAttribute("uv",this._attributes.uv),this.setAttribute("counters",this._attributes.counters),this.setIndex(this._attributes.index),this.computeBoundingSphere(),this.computeBoundingBox()};function Vc(i,t,e,n,r){var o;if(i=i.subarray||i.slice?i:i.buffer,e=e.subarray||e.slice?e:e.buffer,i=t?i.subarray?i.subarray(t,r&&t+r):i.slice(t,r&&t+r):i,e.set)e.set(i,n);else for(o=0;o<i.length;o++)e[o+n]=i[o];return e}yt.prototype.advance=function(i){var t=this._attributes.position.array,e=this._attributes.previous.array,n=this._attributes.next.array,r=t.length;Vc(t,0,e,0,r),Vc(t,6,t,0,r-6),t[r-6]=i.x,t[r-5]=i.y,t[r-4]=i.z,t[r-3]=i.x,t[r-2]=i.y,t[r-1]=i.z,Vc(t,6,n,0,r-6),n[r-6]=i.x,n[r-5]=i.y,n[r-4]=i.z,n[r-3]=i.x,n[r-2]=i.y,n[r-1]=i.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0};Lt.meshline_vert=["",Lt.logdepthbuf_pars_vertex,Lt.fog_pars_vertex,"","attribute vec3 previous;","attribute vec3 next;","attribute float side;","attribute float width;","attribute float counters;","","uniform vec2 resolution;","uniform float lineWidth;","uniform vec3 color;","uniform float opacity;","uniform float sizeAttenuation;","","varying vec2 vUV;","varying vec4 vColor;","varying float vCounters;","","vec2 fix( vec4 i, float aspect ) {",""," vec2 res = i.xy / i.w;"," res.x *= aspect;"," vCounters = counters;"," return res;","","}","","void main() {",""," float aspect = resolution.x / resolution.y;",""," vColor = vec4( color, opacity );"," vUV = uv;",""," mat4 m = projectionMatrix * modelViewMatrix;"," vec4 finalPosition = m * vec4( position, 1.0 );"," vec4 prevPos = m * vec4( previous, 1.0 );"," vec4 nextPos = m * vec4( next, 1.0 );",""," vec2 currentP = fix( finalPosition, aspect );"," vec2 prevP = fix( prevPos, aspect );"," vec2 nextP = fix( nextPos, aspect );",""," float w = lineWidth * width;",""," vec2 dir;"," if( nextP == currentP ) dir = normalize( currentP - prevP );"," else if( prevP == currentP ) dir = normalize( nextP - currentP );"," else {"," vec2 dir1 = normalize( currentP - prevP );"," vec2 dir2 = normalize( nextP - currentP );"," dir = normalize( dir1 + dir2 );",""," vec2 perp = vec2( -dir1.y, dir1.x );"," vec2 miter = vec2( -dir.y, dir.x );"," //w = clamp( w / dot( miter, perp ), 0., 4. * lineWidth * width );",""," }",""," //vec2 normal = ( cross( vec3( dir, 0. ), vec3( 0., 0., 1. ) ) ).xy;"," vec4 normal = vec4( -dir.y, dir.x, 0., 1. );"," normal.xy *= .5 * w;"," normal *= projectionMatrix;"," if( sizeAttenuation == 0. ) {"," normal.xy *= finalPosition.w;"," normal.xy /= ( vec4( resolution, 0., 1. ) * projectionMatrix ).xy;"," }",""," finalPosition.xy += normal.xy * side;",""," gl_Position = finalPosition;","",Lt.logdepthbuf_vertex,Lt.fog_vertex&&" vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",Lt.fog_vertex,"}"].join(`
3911
+ `,n=-1/0,r=this.geometry.getAttribute("position");if(r)for(let s=0;s<r.count;s++){let a=r.getZ(s);a>n&&(n=a)}let o=new uz({uniforms:{maxZ:{value:n},uColor:{value:new F6(this.options[0].fillColor).convertLinearToSRGB()},uColor2:{value:new F6(De(this.options[0].fillColor)).convertLinearToSRGB()},uOpacity:{value:this.options[0].fillOpacity}},vertexShader:t,fragmentShader:e,transparent:!0});this.material=o}initLineMaterial(){let t=W.createLineMaterial({color:this.options[0].strokeColor,opacity:this.options[0].strokeOpacity});return this.lineMaterial=t,t}initMesh(){this.mesh&&this.remove(this.mesh),this.mesh=new oz(this.geometry,this.material),this.add(this.mesh)}getBorderPoints(){let t=[],e=this.options[0].height+this.options[0].deltaHeight;return this.options.map(n=>{let{coords:r}=n.geometry;for(let o=0;o<r.length;o++){let s=r[o];for(let a=0;a<s.length;a++){let u=s[a],l=a+1===s.length?s[0]:s[a+1];t.push(new U6(u[0],u[1],e)),t.push(new U6(l[0],l[1],e))}}}),t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new sz().setFromPoints(t);this.lineGeometry=e}createBorder(){this.line&&this.remove(this.line);let t=new az(this.lineGeometry,this.lineMaterial);return t.position.z=.01,this.line=t,this.add(t),t}dispose(){var t,e,n;(t=this.geometry)==null||t.dispose(),(e=this.material)==null||e.dispose(),(n=this.line)==null||n.geometry.dispose(),this.clear()}constructor(t,e){super(),this.context=t,this.options=e.map(n=>S({},Ic,n)),this.init()}};var G7=f(P(),1),k7=f(Xo(),1);import{Box2 as Oc,Object3D as lz,Sprite as B6,SpriteMaterial as z6,Vector2 as sa}from"three";import{isNil as zi}from"lodash";var cz={text:"",icon:"",icon_size:[22,22],level:1,collision_enable:!0,opacity:1,id:"",position:{x:0,y:0,z:0},text_font_size:14,icon_rotate:0,depth_test:!1,hide_text:!1,maxWeight:25,minWeight:1},nt=class extends lz{get hasText(){return!this.options.hide_text&&this.options.text}get durIconAndText(){return this.options.icon&&this.hasText?2:0}get offset(){return this.options.icon&&this.hasText?0:.5}get iconWidth(){return this.options.icon?this.options.icon_size[0]:0}get iconHeight(){return this.options.icon?this.options.icon_size[1]:0}get textWidth(){return this.hasText?this.textHeight*this.textAspect:0}get textHeight(){return this.hasText?this.options.text_font_size*this.textureLines:0}get hasOriginTexture(){let{text_texture:t,text_texture_width:e,text_texture_height:n,text_texture_offset_x:r,text_texture_offset_y:o}=this.options;return!zi(t)&&!zi(e)&&!zi(n)&&!zi(r)&&!zi(o)}get deltaZ(){return!this.options.icon&&this.hasText?.1+this.offset*(this.iconHeight+this.durIconAndText+this.textHeight)/this.context.camera.zoom:.1}get canSelect(){return this.visible&&(this.spriteIcon?this.spriteIcon.visible:!0)&&(this.spriteText?this.spriteText.visible:!0)}registryEvent(){this.context.addEventListener("control-zoom-change",this._initScale),this.addEventListener("change-icon",t=>E(this,null,function*(){let{value:e}=t;this._initIconPromise&&(yield this._initIconPromise),this.spriteIcon&&(this.remove(this.spriteIcon),this.spriteIcon=void 0),yield this.initIcon(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})})),this.addEventListener("change-text",t=>{let{value:e}=t;this.spriteText&&(this.remove(this.spriteText),this.spriteText=void 0),this.initText(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})}),this.addEventListener("change-text_font_size",t=>{let{value:e}=t;this.spriteText&&(this.remove(this.spriteText),this.spriteText=void 0),this.initText(),this.initSize(),this._initScale({zoom:this.context.camera.zoom})}),this.addEventListener("change-icon_rotate",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.rotation=e/180*Math.PI)}),this.addEventListener("change-icon_size",t=>{let{value:e}=t;this.spriteIcon&&(this.initSize(),this._initScale({zoom:this.context.camera.zoom}))}),this.addEventListener("change-depth_test",t=>{let{value:e}=t;this.spriteIcon&&(this.spriteIcon.material.depthTest=e),this.spriteText&&(this.spriteText.material.depthTest=e)})}unRegistryEvent(){this.context.removeEventListener("control-zoom-change",this._initScale)}getPosition(){return this.position}initIcon(){return E(this,null,function*(){if(this.options.icon)return this._initIconPromise=new Promise(t=>E(this,null,function*(){let e;if(this.options.icon_border){let{icon:r,icon_size:o,icon_border:s}=this.options;e=yield ut.getUrlTextureBorder(r,o[0]-s.width*2,s)}else e=yield ut.getTextureByUrl(this.options.icon);let n=new B6(new z6({map:e,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test,rotation:this.options.icon_rotate/180*Math.PI}));n.visible=!1,n.renderOrder=1e5+this.options.level,e.needsUpdate=!0,this.add(n),this.spriteIcon=n,t(n)})).then(()=>{this._initIconPromise=null})})}initText(){if(this.hasText){let t;if(this.hasOriginTexture){let{text_texture:n,text_texture_width:r,text_texture_height:o,text_texture_offset_x:s,text_texture_offset_y:a}=this.options;t=this.options.text_texture.clone(),t.uuid=n.uuid,t.offset.set(s/t.image.width,1-(o+a)/t.image.height),t.repeat.set(r/t.image.width,o/t.image.height),this.textAspect=r/o}else{let n=tt.getTextureByText(this.options.text);t=n.texture,this.textureLines=n.lines,this.textAspect=t.image.width/t.image.height}let e=new B6(new z6({map:t,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test}));e.visible=!1,e.renderOrder=100001+this.options.level,t.needsUpdate=!0,this.spriteText=e,this.add(e)}}initSize(){var t,e;let n=0,r=0,{icon:o}=this.options;o?this.hasText?(n=0,r=n*(this.iconHeight/this.textHeight)-this.iconHeight/this.textHeight-this.durIconAndText/this.textHeight):(n=.5,r=0):this.hasText?(r=.5,n=0):(n=0,r=0),(t=this.spriteIcon)==null||t.center.set(.5,n),(e=this.spriteText)==null||e.center.set(.5,r)}init(){return E(this,null,function*(){yield Promise.all([this.initIcon(),new Promise(t=>{this.initText(),t(!0)})]),this.initSize(),this._initScale({zoom:this.context.camera.zoom})})}resetZ(){let t=this.deltaZ;this.spriteIcon&&(this.spriteIcon.position.z=t),this.spriteText&&(this.spriteText.position.z=t)}getBox(t){let{clientSize:{width:e,height:n}}=this.context,r=e*(t.x+1)/2,o=n*(-t.y+1)/2;o+=this.offset*(this.iconHeight+this.durIconAndText+this.textHeight);let s=this.iconWidth/2,a=new Oc(new sa(r-s,o-this.iconHeight),new sa(r+s,o)),u=this.textWidth/2,l=new Oc(new sa(r-u,o-this.textHeight-this.durIconAndText-this.iconHeight),new sa(r+u,o-this.iconHeight-this.durIconAndText));return this.box=l.union(a),this.box}renderBoxHelper(t,e){if(!this.boxHelper){let n=document.createElement("div");n.style.position="absolute",n.style.zIndex="999",n.style.border="1px solid red",n.style.pointerEvents="none",this.boxHelper=n,this.context.container.appendChild(n)}t&&e?(this.boxHelper.style.left=t+"px",this.boxHelper.style.top=e+"px",this.boxHelper.style.width="2px",this.boxHelper.style.height="2px"):(this.boxHelper.style.left=this.box.min.x+"px",this.boxHelper.style.top=this.box.min.y+"px",this.boxHelper.style.width=this.box.max.x-this.box.min.x+"px",this.boxHelper.style.height=this.box.max.y-this.box.min.y+"px")}parentSetVisible(t){this.spriteText&&(this.spriteText.visible=t),this.spriteIcon&&(this.spriteIcon.visible=t),this.boxHelper&&(this.boxHelper.style.display=t?"block":"none")}dispose(){this.clear(),this.unRegistryEvent(),this.spriteText=void 0,this.spriteIcon=void 0}constructor(t,e){var n;super(),this.context=t,this.textAspect=1,this.box=new Oc,this._initIconPromise=null,this.textureLines=1,this._initScale=o=>{let{zoom:s}=o;if(this.spriteText){let u=this.textHeight/s;this.spriteText.scale.set(this.textAspect*u,u,.1)}if(this.spriteIcon){var a;(a=this.spriteIcon)==null||a.scale.set(this.options.icon_size[0]/s,this.options.icon_size[1]/s,.1)}this.resetZ()};var r;this.options=Zn(S({},cz,e,{text:(r=(n=e.text)==null?void 0:n.trim())!=null?r:""}),this),this.position.set(this.options.position.x,this.options.position.y,this.options.position.z),this.registryEvent(),this.init()}};var K7=f(Xo(),1);import{DoubleSide as hz,Matrix4 as G6,Mesh as pz,MeshBasicMaterial as fz,Object3D as dz,PlaneGeometry as gz}from"three";import{mergeGeometries as mz}from"three/examples/jsm/utils/BufferGeometryUtils";var _z={airHeight:0,deltaHeight:0,height:0,geometry:{cds:[],type:"polygon",coords:[],curveCpt:[],curveIndex:[]},texts:[],fillColor:"#ffffff",fillOpacity:0,strokeColor:"#ffffff",strokeOpacity:0,secondHeight:0,secondRotate:0,center_x:0,center_y:0},aa=class extends dz{init(){return E(this,null,function*(){let t=this.options.map(s=>tt.getTextureByText(s.texts[0],{fillStyle:x0(s.fillColor,s.fillOpacity),strokeStyle:x0(s.strokeColor,s.strokeOpacity),lineWidth:6,font:"bold 54px sans-serif",maxWidth:2048})),e=t.map((s,a)=>{let u=this.options[a],{width:l,height:c}=s.texture.image,h=l/c,p=u.secondHeight*h,d=new gz(p,u.secondHeight),m=new G6().makeTranslation(u.center_x,u.center_y,u.airHeight+u.deltaHeight+u.height).multiply(new G6().makeRotationZ(u.secondRotate));return d.applyMatrix4(m),d}),n=mz(e,!0);e.forEach(s=>s.dispose());let r=t.map(s=>{let{texture:a}=s,u=new fz({map:a,alphaTest:1,side:hz});return a.needsUpdate=!0,u}),o=new pz(n,r);this.mesh=o,this.position.z+=.04,this.add(o)})}dispose(){var t,e,n;(t=this.mesh)==null||t.geometry.dispose(),(n=this.mesh)==null||(e=n.material)==null||e.forEach(r=>r.dispose()),this.clear()}constructor(t,e){super(),this.context=t,this.options=e.map(n=>S({},_z,n)).filter(n=>n.texts[0].trim()),this.options.length&&this.init()}};import{Object3D as vz}from"three";import{Line2 as yz}from"three/examples/jsm/lines/Line2";import{LineGeometry as xz}from"three/examples/jsm/lines/LineGeometry";import{LineMaterial as Ez}from"three/examples/jsm/lines/LineMaterial";var Gi=class extends vz{registryEvent(){this.context.addEventListener("resize",this.onResize)}unRegistryEvent(){this.context.removeEventListener("resize",this.onResize)}setPosition(t,e){this.lineGeometry.setPositions([t.x,t.y,t.z,e.x,e.y,e.z]),this.line||this.createLine()}createLine(){this.line=new yz(this.lineGeometry,this.lineMaterial),this.line.renderOrder=100003,this.add(this.line)}dispose(){var t;this.unRegistryEvent(),this.line&&J(this.line),this.lineGeometry=null,this.lineMaterial=null,this.clear(),(t=this.line)==null||t.clear(),this.line=null}constructor(t,e,n){super(),this.context=t,this.lineGeometry=new xz,this.lineMaterial=new Ez({color:0,transparent:!0,depthTest:!1,linewidth:2}),this.line=null,this.onResize=()=>{let{width:r,height:o}=this.context.clientSize;this.lineMaterial.resolution.set(r,o)},this.onResize(),this.registryEvent(),e&&n&&this.setPosition(e,n)}};import{Frustum as Sz}from"three";var ua=class extends Kt{setEnable(t){super.setEnable(t),gt(this.rect,0,0,0,0),t?this.registryEvent():(this.startPoint=void 0,this.unRegistryEvent())}registryEvent(){this.context.container.addEventListener("pointerdown",this.onPointerDown),this.context.container.addEventListener("pointermove",this.onPointerMove),this.context.container.addEventListener("pointerup",this.onPointerUp),this.context.addEventListener("update",this.onUpdate)}unRegistryEvent(){this.context.container.removeEventListener("pointerdown",this.onPointerDown),this.context.container.removeEventListener("pointermove",this.onPointerMove),this.context.container.removeEventListener("pointerup",this.onPointerUp),this.context.removeEventListener("update",this.onUpdate)}doSelect(){if(this.startPoint&&this.endPoint){if(this.startPoint.distanceTo(this.endPoint)<.1)return;let{context:{camera:e,container:{clientWidth:n,clientHeight:r}}}=this,o=L(this.startPoint,e,n,r),s=L(this.endPoint,e,n,r),a={x:Math.min(o.x,s.x),y:Math.min(o.y,s.y)},u={x:Math.max(o.x,s.x),y:Math.max(o.y,s.y)},l=this.searchMapInFrustum(a,u);this.dispatchEvent({type:"selected",list:l})}}searchMapInFrustum(t,e){var n;let{context:r}=this;return((n=r.currentFloor)==null?void 0:n.graphicLayer.children.filter(o=>o instanceof et&&this.searchChildInFrustum(o,t,e)))||[]}searchChildInFrustum(t,e,n){let{context:{camera:r,container:{clientWidth:o,clientHeight:s}}}=this;if(!t)return!1;if(!t.mesh){let p=t.getPosition();if(p){let d=L(p,r,o,s);return en(d,e,n)}return!1}t.mesh.geometry.boundingBox||t.mesh.geometry.computeBoundingBox();let a=t.mesh.geometry.boundingBox;if(!a)return!1;let{min:u,max:l}=a,c=L(u,r,o,s),h=L(l,r,o,s);return!(!en(c,e,n)||!en(h,e,n))}dispose(){super.dispose(),this.rect=null,this.unRegistryEvent()}constructor(t){super(t),this.frustum=new Sz,this.onPointerDown=r=>{if(!this.enable)return;let o=this.getIntersectByPointerEvent(r);o&&(this.startPoint=o),this.endPoint=void 0},this.onPointerMove=r=>{if(!this.enable||!this.startPoint)return;let o=this.getIntersectByPointerEvent(r);o&&(this.endPoint=o)},this.onPointerUp=r=>{if(!this.enable)return;let o=this.getIntersectByPointerEvent(r);o&&(this.endPoint=o),this.doSelect(),this.startPoint=void 0},this.onUpdate=()=>{if(this.startPoint){let r=this.getSvgCoordinate(this.startPoint),o=S({},r);this.endPoint&&(o=this.getSvgCoordinate(this.endPoint));let s={x:Math.min(r.x,o.x),y:Math.min(r.y,o.y)},a=Math.abs(o.x-r.x),u=Math.abs(o.y-r.y);gt(this.rect,s.x,s.y,a,u)}else gt(this.rect,0,0,0,0)};let{config:{selectBox:{fill:e,stroke:n}}}=t;this.rect=nn(n,e),this.svg.appendChild(this.rect),this.registryEvent()}};var la=class extends bz{get list(){return this._list}enableBoxSelection(){this.isMultipleSelect||!this.context.config.enableBoxSelect||(this.isMultipleSelect=!0,this.boxSelection.setEnable(!0),this.prevPanStatus=this.context.control.enablePan,this.prevRotateStatus=this.context.control.enableRotate,this.context.control.enablePan=!1,this.context.control.enableRotate=!1)}disableBoxSelection(){this.isMultipleSelect&&(this.isMultipleSelect=!1,this.boxSelection.setEnable(!1),this.context.control.enablePan=!!this.prevPanStatus,this.context.control.enableRotate=!!this.prevRotateStatus)}selectEnd(){this.dispatchEvent({type:"select",graphics:[...this._list],isMultipleSelect:this.isMultipleSelect})}registryEvent(){this.context.container.addEventListener("pointerdown",this.onPointerDown),this.context.container.addEventListener("pointerup",this.onPointerUp),this.context.container.addEventListener("pointerout",this.onPointerOut),this.context.container.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp),this.boxSelection.addEventListener("selected",this.onBoxSelected)}unRegistryEvent(){this.context.container.removeEventListener("pointerdown",this.onPointerDown),this.context.container.removeEventListener("pointerup",this.onPointerUp),this.context.container.removeEventListener("pointerout",this.onPointerOut),this.context.container.removeEventListener("pointercancel",this.onPointerOut),window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("keyup",this.onKeyUp),this.boxSelection.removeEventListener("selected",this.onBoxSelected)}clear(){this._list.clear()}remove(t){this._list.delete(t)}dispose(){this.unRegistryEvent()}constructor(t){super(),this.context=t,this._list=new Set,this.downPoint=null,this.downTime=0,this.isMultipleSelect=!1,this.onPointerDown=e=>{Date.now()-this.downTime<200||(this.downPoint={x:e.offsetX,y:e.offsetY},this.downTime=Date.now())},this.onPointerUp=e=>{if(!this.downPoint)return;let{offsetX:n,offsetY:r}=e,{x:o,y:s}=this.downPoint;if(Math.sqrt((o-n)**2+(s-r)**2)>3)return;let{graphics:a}=this.context.getGraphicsByDeviceXy(n,r),u=new Set(a.map(c=>c.options.id));this.context.getPoisByDeviceXy(n,r).forEach(c=>{if(!u.has(c.options.id)){var h;let p=((h=this.context.currentFloor)==null?void 0:h.graphicLayer.graphicMap.get(c.options.id))||null;p&&p.options.geometry.type==="point"&&(a.push(p),u.add(c.options.id))}}),(Jn?e.metaKey:e.ctrlKey)||this._list.clear(),a.forEach(c=>this._list.add(c)),this.selectEnd(),this.downPoint=null},this.onPointerOut=e=>{this.disableBoxSelection()},this.onKeyDown=e=>{Qn(e.key)&&this.enableBoxSelection()},this.onKeyUp=e=>{Qn(e.key)&&this.disableBoxSelection()},this.onBoxSelected=e=>{let{list:n}=e;this._list.clear(),n.forEach(r=>{this._list.add(r)}),this.selectEnd()},this.boxSelection=new ua(t),this.boxSelection.setEnable(!1),this.registryEvent()}};var XZ=f(de(),1),jZ=f(ge(),1),YZ=f(me(),1),KZ=f(_e(),1),ZZ=f(ve(),1),$Z=f(ye(),1),JZ=f(xe(),1),QZ=f(P(),1);import{EventDispatcher as Mz,Vector2 as wz}from"three";var ca=class extends Mz{handleHoverGraphicsChange(t){t===void 0&&(t=this.curGraphics),this.dispatchEvent({type:"hover-change",graphics:Array.from(t)})}registryEvent(){this.context.addEventListener("pointer-over",this.onPointerMove),this.context.addEventListener("pointer-move",this.onPointerMove),this.context.addEventListener("pointer-level",this.onPointerLevel),document.body.addEventListener("pointermove",this.onBodyPointerMove)}unRegistryEvent(){this.context.removeEventListener("pointer-over",this.onPointerMove),this.context.removeEventListener("pointer-move",this.onPointerMove),this.context.removeEventListener("pointer-level",this.onPointerLevel),document.body.removeEventListener("pointermove",this.onBodyPointerMove)}dispose(){this.unRegistryEvent(),this.timer.dispose()}constructor(t){super(),this.context=t,this.curGraphics=new Set,this.timer=new j,this.graphicTimerMap=new Map,this.onPointerMove=e=>{let{graphics:n,pois:r,e:o}=e,s=r.map(c=>{var h;return(h=this.context.currentFloor)==null?void 0:h.graphicLayer.graphicMap.get(c.options.id)}).filter(c=>c&&c.options.geometry.type==="point");if(!n.length&&!s.length&&this.curGraphics.size){this.curGraphics.clear(),this.handleHoverGraphicsChange();return}let{time:a}=this.context.config.hover,u=new Set;if(s.length){let c,h=1e4;s.forEach(p=>{let d=r.find(m=>m.options.id===p.options.id);if(d instanceof Nn){let{x:m,y:_}=d.clientPos,v=Math.sqrt((m-o.offsetX)**2+(_-o.offsetY)**2);v<h&&(h=v,c=p)}else if(d instanceof nt){let{x:m,y:_}=d.box.getCenter(new wz),v=Math.sqrt((m-o.offsetX)**2+(_-o.offsetY)**2);v<h&&(h=v,c=p)}}),u.add(c)}u.size||n.forEach(c=>u.add(c)),u.forEach(c=>{if(this.graphicTimerMap.get(c)||this.curGraphics.has(c))return;let h=this.timer.setTimeout(()=>{this.curGraphics.add(c),this.graphicTimerMap.delete(c),this.timer.clearTimeout(h),this.handleHoverGraphicsChange()},a);this.graphicTimerMap.set(c,h)}),this.graphicTimerMap.forEach((c,h)=>{u.has(h)||(this.timer.clearTimeout(c),this.graphicTimerMap.delete(h))});let l=this.curGraphics.size;this.curGraphics.forEach(c=>{u.has(c)||this.curGraphics.delete(c)}),l!==this.curGraphics.size&&this.handleHoverGraphicsChange()},this.onPointerLevel=()=>{this.curGraphics.clear(),this.handleHoverGraphicsChange()},this.onBodyPointerMove=e=>{if(this.curGraphics.size){let n=this.context.container.getBoundingClientRect();(e.clientX<n.left||e.clientX>n.right||e.clientY<n.top||e.clientY>n.bottom)&&this.onPointerLevel()}},this.registryEvent()}};var h$=f(P(),1);import{Box3 as Tz,Vector3 as ha}from"three";var pa=class{updateBox(){this.box.setFromObject(this.context.scene)}setEnable(t){this.enable=t,t?this.registryEvent():this.unRegistryEvent()}changePrevCamera(){this.prevCamera={position:this.context.camera.position.clone(),zoom:this.context.camera.zoom,target:this.context.control.target.clone()}}backToPrevCamera(){this.setEnable(!1),this.context.camera.position.copy(this.prevCamera.position),this.context.camera.zoom=this.prevCamera.zoom,this.context.control.target.copy(this.prevCamera.target),this.context.control.update(),this.setEnable(!0)}registryEvent(){this.context.addEventListener("control-change",this.onCameraChange)}unRegistryEvent(){this.context.removeEventListener("control-change",this.onCameraChange)}getCurFloorScreenPosition(){if(!this.context.scene.children.filter(v=>v instanceof Yt).length)return null;let e=this.box,{camera:n,clientSize:{width:r,height:o}}=this.context,{min:s,max:a}=e,u=L(s,n,r,o),l=L(a,n,r,o),c=L(new ha(s.x,a.y,a.z),n,r,o),h=L(new ha(a.x,s.y,s.z),n,r,o),p=Math.min(u.x,l.x,c.x,h.x),d=Math.max(u.x,l.x,c.x,h.x),m=Math.min(u.y,l.y,c.y,h.y),_=Math.max(u.y,l.y,c.y,h.y);return{left:p,right:d,top:m,bottom:_}}checkDistanceToScreenEdge(t){let{left:e,right:n,top:r,bottom:o}=t,{width:s,height:a}=this.context.clientSize,[u,l,c,h]=this.context.config.cameraBound.padding,p=n>=h,d=s-e>=l,m=a-r>=c,_=o>=u;return p&&d&&m&&_}dispose(){this.unRegistryEvent()}constructor(t){this.context=t,this.prevCamera={position:new ha,zoom:1,target:new ha},this.enable=!0,this.box=new Tz,this.onCameraChange=()=>{let e=this.getCurFloorScreenPosition();if(e){let{left:n,right:r,top:o,bottom:s}=e;this.checkDistanceToScreenEdge({left:n,right:r,top:o,bottom:s})?this.changePrevCamera():this.backToPrevCamera()}},this.registryEvent(),this.changePrevCamera()}};var T$=f(Fc(),1);import{Vector3 as n3}from"three";import{Tween as _a,Group as Yz}from"@tweenjs/tween.js";var S$=f(P(),1),b$=f(U(),1);import{EventDispatcher as Hz,MOUSE as Mr,Quaternion as t3,Spherical as da,TOUCH as wr,Vector2 as It,Vector3 as Zt,Plane as Wz,Ray as qz,MathUtils as Xz}from"three";var ga=new qz,e3=new Wz,jz=Math.cos(70*Xz.DEG2RAD),ma=class extends Hz{dispose(){this.domElement.removeEventListener("contextmenu",this.onContextMenu),this.domElement.removeEventListener("pointerdown",this.onPointerDown),this.domElement.removeEventListener("pointercancel",this.onPointerUp),this.domElement.removeEventListener("wheel",this.onMouseWheel),this.domElement.removeEventListener("pointermove",this.onPointerMove),this.domElement.removeEventListener("pointerup",this.onPointerUp),this._domElementKeyEvents!==null&&(this._domElementKeyEvents.removeEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=null)}constructor(t,e){super(),this.rotateLineStart=new It,this.rotateLineEnd=new It,this.spherical=new da,this.sphericalDelta=new da,this.object=t,this.domElement=e,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new Zt,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.screenSpacePanning=!1,this.mouseButtons={LEFT:Mr.PAN,MIDDLE:Mr.DOLLY,RIGHT:Mr.ROTATE},this.touches={ONE:wr.PAN,TWO:wr.DOLLY_ROTATE},this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this._domElementKeyEvents=null,this.getPolarAngle=function(){return a.phi},this.getAzimuthalAngle=function(){return a.theta},this.getDistance=function(){return this.object.position.distanceTo(this.target)},this.listenToKeyEvents=function(y){y.addEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=y},this.stopListenToKeyEvents=function(){var y;(y=this._domElementKeyEvents)==null||y.removeEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=null},this.saveState=function(){n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=function(){n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent({type:"change"}),n.update(),o=r.NONE},this.update=function(){let y=new Zt,T=new t3().setFromUnitVectors(t.up,new Zt(0,1,0)),V=T.clone().invert(),Z=new Zt,Tt=new t3,he=new Zt,$t=2*Math.PI;return function(Ir){Ir===void 0&&(Ir=null);let Ae=n.object.position;y.copy(Ae).sub(n.target),y.applyQuaternion(T),a.setFromVector3(y),n.autoRotate&&o===r.NONE&&k(B(Ir)),n.enableDamping?(a.theta+=u.theta*n.dampingFactor,a.phi+=u.phi*n.dampingFactor):(a.theta+=u.theta,a.phi+=u.phi);let Ce=n.minAzimuthAngle,Re=n.maxAzimuthAngle;isFinite(Ce)&&isFinite(Re)&&(Ce<-Math.PI?Ce+=$t:Ce>Math.PI&&(Ce-=$t),Re<-Math.PI?Re+=$t:Re>Math.PI&&(Re-=$t),Ce<=Re?a.theta=Math.max(Ce,Math.min(Re,a.theta)):a.theta=a.theta>(Ce+Re)/2?Math.max(Ce,a.theta):Math.min(Re,a.theta)),a.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,a.phi)),a.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(c,n.dampingFactor):n.target.add(c),n.zoomToCursor&&I||n.object.isOrthographicCamera?a.radius=wt(a.radius):a.radius=wt(a.radius*l),y.setFromSpherical(a),y.applyQuaternion(V),Ae.copy(n.target).add(y),n.object.lookAt(n.target),n.enableDamping===!0?(u.theta*=1-n.dampingFactor,u.phi*=1-n.dampingFactor,c.multiplyScalar(1-n.dampingFactor)):(u.set(0,0,0),c.set(0,0,0));let Xi=!1;if(n.zoomToCursor&&I){let Lr=null;if(n.object.isPerspectiveCamera){let Nr=y.length();Lr=wt(Nr*l);let ji=Nr-Lr;n.object.position.addScaledVector(C,ji),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){let Nr=new Zt(w.x,w.y,0);Nr.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/l)),n.object.updateProjectionMatrix(),Xi=!0;let ji=new Zt(w.x,w.y,0);ji.unproject(n.object),n.object.position.sub(ji).add(Nr),n.object.updateMatrixWorld(),Lr=y.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;Lr!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(Lr).add(n.object.position):(ga.origin.copy(n.object.position),ga.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(ga.direction))<jz?t.lookAt(n.target):(e3.setFromNormalAndCoplanarPoint(n.object.up,n.target),ga.intersectPlane(e3,n.target))))}else n.object.isOrthographicCamera&&(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/l)),n.object.updateProjectionMatrix(),Xi=!0);return l=1,I=!1,Xi||Z.distanceToSquared(n.object.position)>s||8*(1-Tt.dot(n.object.quaternion))>s||he.distanceToSquared(n.target)>0?(n.dispatchEvent({type:"change"}),Z.copy(n.object.position),Tt.copy(n.object.quaternion),he.copy(n.target),Xi=!1,!0):!1}}();let n=this,r={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},o=r.NONE,s=1e-6,a=new da,u=new da,l=1,c=new Zt,h=new It,p=new It,d=new It,m=new It,_=new It,v=new It,x=new It,M=new It,b=new It,C=new Zt,w=new It,I=!1,A=[],R={};function B(y){return y!==null?2*Math.PI/60*n.autoRotateSpeed*y:2*Math.PI/60/60*n.autoRotateSpeed}function H(){return Math.pow(.95,n.zoomSpeed)}function k(y){u.theta-=y}function lt(y){u.phi-=y}let xt=function(){let y=new Zt;return function(V,Z){y.setFromMatrixColumn(Z,0),y.multiplyScalar(-V),c.add(y)}}(),Nt=function(){let y=new Zt;return function(V,Z){n.screenSpacePanning===!0?y.setFromMatrixColumn(Z,1):(y.setFromMatrixColumn(Z,0),y.crossVectors(n.object.up,y)),y.multiplyScalar(V),c.add(y)}}(),Ot=function(){let y=new Zt;return function(V,Z){let Tt=n.domElement;if(n.object.isPerspectiveCamera){let he=n.object.position;y.copy(he).sub(n.target);let $t=y.length();$t*=Math.tan(n.object.fov/2*Math.PI/180),xt(2*V*$t/Tt.clientHeight,n.object.matrix),Nt(2*Z*$t/Tt.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(xt(V*(n.object.right-n.object.left)/n.object.zoom/Tt.clientWidth,n.object.matrix),Nt(Z*(n.object.top-n.object.bottom)/n.object.zoom/Tt.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function Fn(y){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?l/=y:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Rr(y){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?l*=y:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Pr(y){if(!n.zoomToCursor)return;I=!0;let T=n.domElement.getBoundingClientRect(),V=y.clientX-T.left,Z=y.clientY-T.top,Tt=T.width,he=T.height;w.x=V/Tt*2-1,w.y=-(Z/he)*2+1,C.set(w.x,w.y,1).unproject(n.object).sub(n.object.position).normalize()}function wt(y){return Math.max(n.minDistance,Math.min(n.maxDistance,y))}function $c(y){h.set(y.clientX,y.clientY)}function G3(y){Pr(y),x.set(y.clientX,y.clientY)}function Jc(y){m.set(y.clientX,y.clientY)}function k3(y){p.set(y.clientX,y.clientY),d.subVectors(p,h).multiplyScalar(n.rotateSpeed);let T=n.domElement;k(2*Math.PI*d.x/T.clientHeight),lt(2*Math.PI*d.y/T.clientHeight),h.copy(p),n.update()}function V3(y){M.set(y.clientX,y.clientY),b.subVectors(M,x),b.y>0?Fn(H()):b.y<0&&Rr(H()),x.copy(M),n.update()}function H3(y){_.set(y.clientX,y.clientY),v.subVectors(_,m).multiplyScalar(n.panSpeed),Ot(v.x,v.y),m.copy(_),n.update()}function W3(y){Pr(y),y.deltaY<0?Rr(H()):y.deltaY>0&&Fn(H()),n.update()}function q3(y){let T=!1;switch(y.code){case n.keys.UP:y.ctrlKey||y.metaKey||y.shiftKey?lt(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Ot(0,n.keyPanSpeed),T=!0;break;case n.keys.BOTTOM:y.ctrlKey||y.metaKey||y.shiftKey?lt(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Ot(0,-n.keyPanSpeed),T=!0;break;case n.keys.LEFT:y.ctrlKey||y.metaKey||y.shiftKey?k(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Ot(n.keyPanSpeed,0),T=!0;break;case n.keys.RIGHT:y.ctrlKey||y.metaKey||y.shiftKey?k(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Ot(-n.keyPanSpeed,0),T=!0;break}T&&(y.preventDefault(),n.update())}function Qc(){if(A.length===1)h.set(A[0].pageX,A[0].pageY);else{let y=(A[0].pageX-A[0].pageY)/(A[1].pageX-A[1].pageY),T=A[0].pageY-y*A[0].pageX;n.rotateLineStart.set(y,T);let V=.5*(A[0].pageX+A[1].pageX),Z=.5*(A[0].pageY+A[1].pageY);h.set(V,Z)}}function th(){if(A.length===1)m.set(A[0].pageX,A[0].pageY);else{let y=.5*(A[0].pageX+A[1].pageX),T=.5*(A[0].pageY+A[1].pageY);m.set(y,T)}}function eh(){let y=A[0].pageX-A[1].pageX,T=A[0].pageY-A[1].pageY,V=Math.sqrt(y*y+T*T);x.set(0,V)}function X3(){n.enableZoom&&eh(),n.enablePan&&th()}function j3(){n.enableZoom&&eh(),n.enableRotate&&Qc()}function nh(y){if(A.length==1)p.set(y.pageX,y.pageY);else{let V=Ha(y),Z=.5*(y.pageX+V.x),Tt=.5*(y.pageY+V.y);p.set(Z,Tt);let he=(y.pageY-V.y)/(y.pageX-V.x),$t=V.y-he*V.x;if(n.rotateLineEnd.set(he,$t),Number.isFinite(n.rotateLineEnd.x)&&Number.isFinite(n.rotateLineStart.x)){let Wa=(n.rotateLineStart.y-n.rotateLineEnd.y)/(n.rotateLineEnd.x-n.rotateLineStart.x),Ir=he*Wa+$t;if(Number.isFinite(Wa)&&Number.isFinite(Ir)){let Ae=Math.atan(n.rotateLineEnd.x)-Math.atan(n.rotateLineStart.x);Math.PI-Math.abs(Ae)<.5&&(Ae=-Math.sign(Ae)*(Math.PI-Math.abs(Ae))),Math.abs(Ae)<.1&&(u.theta+=Ae)}}n.rotateLineStart.copy(n.rotateLineEnd)}d.subVectors(p,h).multiplyScalar(n.rotateSpeed);let T=n.domElement;lt(2*Math.PI*d.y/T.clientHeight),h.copy(p)}function rh(y){if(A.length===1)_.set(y.pageX,y.pageY);else{let T=Ha(y),V=.5*(y.pageX+T.x),Z=.5*(y.pageY+T.y);_.set(V,Z)}v.subVectors(_,m).multiplyScalar(n.panSpeed),Ot(v.x,v.y),m.copy(_)}function ih(y){let T=Ha(y),V=y.pageX-T.x,Z=y.pageY-T.y,Tt=Math.sqrt(V*V+Z*Z);M.set(0,Tt),b.set(0,Math.pow(M.y/x.y,n.zoomSpeed)),Fn(b.y),x.copy(M)}function Y3(y){n.enableZoom&&ih(y),n.enablePan&&rh(y)}function K3(y){n.enableZoom&&ih(y),n.enableRotate&&nh(y)}this.onPointerDown=function(T){n.enabled!==!1&&(A.length===0&&(n.domElement.setPointerCapture(T.pointerId),n.domElement.addEventListener("pointermove",n.onPointerMove),n.domElement.addEventListener("pointerup",n.onPointerUp)),t1(T),T.pointerType==="touch"?J3(T):Z3(T))},this.onPointerMove=function(T){n.enabled!==!1&&(T.pointerType==="touch"?Q3(T):$3(T))},this.onPointerUp=function(T){e1(T),A.length===0&&(n.domElement.releasePointerCapture(T.pointerId),n.domElement.removeEventListener("pointermove",n.onPointerMove),n.domElement.removeEventListener("pointerup",n.onPointerUp)),n.dispatchEvent({type:"end"}),o=r.NONE};function Z3(y){let T;switch(y.button){case 0:T=n.mouseButtons.LEFT;break;case 1:T=n.mouseButtons.MIDDLE;break;case 2:T=n.mouseButtons.RIGHT;break;default:T=-1}switch(T){case Mr.DOLLY:if(n.enableZoom===!1)return;G3(y),o=r.DOLLY;break;case Mr.ROTATE:if(y.ctrlKey||y.metaKey||y.shiftKey){if(n.enablePan===!1)return;Jc(y),o=r.PAN}else{if(n.enableRotate===!1)return;$c(y),o=r.ROTATE}break;case Mr.PAN:if(y.ctrlKey||y.metaKey||y.shiftKey){if(n.enableRotate===!1)return;$c(y),o=r.ROTATE}else{if(n.enablePan===!1)return;Jc(y),o=r.PAN}break;default:o=r.NONE}o!==r.NONE&&n.dispatchEvent({type:"start"})}function $3(y){switch(o){case r.ROTATE:if(n.enableRotate===!1)return;k3(y);break;case r.DOLLY:if(n.enableZoom===!1)return;V3(y);break;case r.PAN:if(n.enablePan===!1)return;H3(y);break}}this.onMouseWheel=function(T){n.enabled===!1||n.enableZoom===!1||o!==r.NONE||(T.preventDefault(),n.dispatchEvent({type:"start"}),W3(T),n.dispatchEvent({type:"end"}))},this.onKeyDown=function(T){n.enabled===!1||n.enablePan===!1||q3(T)};function J3(y){switch(oh(y),A.length){case 1:switch(n.touches.ONE){case wr.ROTATE:if(n.enableRotate===!1)return;Qc(),o=r.TOUCH_ROTATE;break;case wr.PAN:if(n.enablePan===!1)return;th(),o=r.TOUCH_PAN;break;default:o=r.NONE}break;case 2:switch(n.touches.TWO){case wr.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;X3(),o=r.TOUCH_DOLLY_PAN;break;case wr.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;j3(),o=r.TOUCH_DOLLY_ROTATE;break;default:o=r.NONE}break;default:o=r.NONE}o!==r.NONE&&n.dispatchEvent({type:"start"})}function Q3(y){switch(oh(y),o){case r.TOUCH_ROTATE:if(n.enableRotate===!1)return;nh(y),n.update();break;case r.TOUCH_PAN:if(n.enablePan===!1)return;rh(y),n.update();break;case r.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Y3(y),n.update();break;case r.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;K3(y),n.update();break;default:o=r.NONE}}this.onContextMenu=function(T){n.enabled!==!1&&T.preventDefault()};function t1(y){A.push(y)}function e1(y){delete R[y.pointerId];for(let T=0;T<A.length;T++)if(A[T].pointerId==y.pointerId){A.splice(T,1);return}}function oh(y){let T=R[y.pointerId];T===void 0&&(T=new It,R[y.pointerId]=T),T.set(y.pageX,y.pageY)}function Ha(y){let T=y.pointerId===A[0].pointerId?A[1]:A[0];return R[T.pointerId]}n.domElement.addEventListener("contextmenu",this.onContextMenu),n.domElement.addEventListener("pointerdown",this.onPointerDown),n.domElement.addEventListener("pointercancel",this.onPointerUp),n.domElement.addEventListener("wheel",this.onMouseWheel,{passive:!1}),this.update()}};var va=class extends ma{registryEvent(){this.addEventListener("change",this.onChange),this.context.addEventListener("update",this.tweenUpdate)}unRegistryEvent(){this.removeEventListener("change",this.onChange),this.context.removeEventListener("update",this.tweenUpdate)}setPolarAngle(t,e){e===void 0&&(e=!1);let{maxPolarAngle:n,minPolarAngle:r}=this,o=n===r;(e||t<=n&&t>=r)&&(this.maxPolarAngle=t,this.minPolarAngle=t,this.update()),o||(this.maxPolarAngle=n,this.minPolarAngle=r)}setPolarAngleByDuration(t,e,n){return E(this,null,function*(){return e===void 0&&(e=!1),n===void 0&&(n=500),n<=0?this.setPolarAngle(t,e):zt(new Promise(r=>{let o={polar:this.getPolarAngle()},s={polar:t},a=new _a(o,this.tweenGroup).to(s,n).onUpdate(()=>{this.setPolarAngle(o.polar,e)}).onComplete(()=>{this.enabled=!0,this.tweenGroup.remove(a),r(!0)}).onStart(()=>{this.enabled=!1}).start()}),n+500)})}setAzimuthalAngle(t,e){let{maxAzimuthAngle:n,minAzimuthAngle:r}=this,o=n===r;(e||t<=n&&t>=r)&&(this.maxAzimuthAngle=t,this.minAzimuthAngle=t,this.update()),o||(this.maxAzimuthAngle=n,this.minAzimuthAngle=r)}setAzimuthalAngleDuration(t,e,n){return e===void 0&&(e=!1),n===void 0&&(n=500),n<=0?this.setAzimuthalAngle(t,e):zt(new Promise(r=>{let o={azimuthal:this.getAzimuthalAngle()},s={azimuthal:t},a=new _a(o,this.tweenGroup).to(s,n).onUpdate(()=>{this.setAzimuthalAngle(o.azimuthal,e)}).onComplete(()=>{this.enabled=!0,this.tweenGroup.remove(a),r(!0)}).onStart(()=>{this.enabled=!1}).start()}),n+500)}getCameraLookAt(){return new n3().subVectors(this.target,this.camera.position)}setCameraPositionByTarget(t,e){return E(this,null,function*(){let n=this.target.clone(),r=this.getCameraLookAt();if(!e){this.camera.position.copy(t.clone().sub(r)),this.target.copy(t.clone()),this.update();return}return zt(new Promise(o=>{let s=new _a(n,this.tweenGroup).to(t,e).onUpdate(()=>{this.camera.position.copy(n.clone().sub(r)),this.target.copy(n.clone()),this.update()}).onComplete(()=>{this.tweenGroup.remove(s),this.enabled=!0,o(!0)}).onStart(()=>{this.enabled=!1}).start()}),e+500)})}setZoom(t,e,n){n===void 0&&(n=!1);let{minZoom:r,maxZoom:o}=this;(n||t>=r&&t<=o)&&(this.camera.position.copy(e.clone().sub(this.getCameraLookAt())),this.target.copy(e),this.camera.zoom=t,this.update())}setZoomByDuration(t,e,n,r){return E(this,null,function*(){n===void 0&&(n=!1),r===void 0&&(r=500);let o={zoom:this.camera.zoom,target:this.target.clone()};if(t!==this.camera.zoom)return r?zt(new Promise(s=>{let a=new _a(o,this.tweenGroup).to({zoom:t,target:e},r).onUpdate(()=>{this.setZoom(o.zoom,o.target,n)}).onComplete(()=>{this.tweenGroup.remove(a),this.enabled=!0,s(!0)}).onStart(()=>{this.enabled=!1}).start()}),r+500).finally(()=>{this.enabled=!0}):this.setZoom(t,e,n)})}setTargetByOffset(t,e){if(e===void 0&&(e=this.target.clone()),this.camera.updateMatrix(),t){let n=new n3;n.setFromMatrixColumn(this.camera.matrix,1),n.normalize(),n.multiplyScalar(t/this.camera.zoom),e.add(n)}this.setCameraPositionByTarget(e,0)}clearTween(){this.tweenGroup.getAll().forEach(t=>t.stop()),this.tweenGroup.removeAll()}dispose(){super.dispose(),this.unRegistryEvent(),this.clearTween()}constructor(t,e,n){super(e,n),this.context=t,this.camera=e,this.domElement=n,this.prevCameraZoom=1,this.tweenGroup=new Yz,this.offsetY=0,this.onChange=()=>{let r=this.camera.zoom;r!==this.prevCameraZoom&&(this.prevCameraZoom=r,this.dispatchEvent({type:"change-zoom",zoom:r}))},this.tweenUpdate=()=>{this.tweenGroup.update()},this.enableDamping=!1,this.zoomSpeed=.5,this.prevCameraZoom=e.zoom,this.registryEvent()}};import{EventDispatcher as Kz,PCFSoftShadowMap as Zz,WebGLRenderer as $z}from"three";var ya=class extends $z{setCameraAndScene(t,e){this.scene=t,this.camera=e}autoRender(){this.scene&&this.camera&&this.enable&&(this.event.dispatchEvent({type:"update"}),this.render(this.scene,this.camera)),this.timer.requestAnimationFrame(()=>{this.autoRender()})}pauseRender(){this.enable=!1}continueRender(){this.enable=!0}addEventListener(t,e){this.event.addEventListener(t,e)}removeEventListener(t,e){this.event.removeEventListener(t,e)}dispose(){this.timer.dispose(),this.enable=!1,super.dispose(),this.domElement=null}constructor(t){super(S({antialias:!0,alpha:!0},t)),this.event=new Kz,this.enable=!0,this.timer=new j,this.autoClear=!0,this.setPixelRatio(window.devicePixelRatio),this.shadowMap.enabled=!0,this.shadowMap.autoUpdate=!0,this.shadowMap.type=Zz}};import{Euler as Jz,Matrix4 as Qz,Scene as tG,EquirectangularReflectionMapping as eG}from"three";import{RGBELoader as nG}from"three/examples/jsm/loaders/RGBELoader.js";var xa=class extends tG{constructor(){super(),new nG().load(b6,t=>{t.mapping=eG,this.environment=t;let e=new Qz;e.makeRotationX(Math.PI/2),this.environmentRotation=new Jz().setFromRotationMatrix(e)})}};import{OrthographicCamera as rG}from"three";var Ea=class extends rG{constructor(t,e){super(-t/2,t/2,e/2,-e/2,-1e4,5e4),this.up.set(0,0,1),this.position.set(0,0,100),this.lookAt(0,0,0)}};var Sa=class extends iG{resizeClientSize(){let{x:t,y:e,width:n,height:r}=this.container.getBoundingClientRect();this.clientSize={width:n||this.container.clientWidth,height:r||this.container.clientHeight,x:t,y:e}}init(){let{clientWidth:t,clientHeight:e}=this.container;this.camera=new Ea(t,e),this.renderer.setSize(t,e),this.renderer.setCameraAndScene(this.scene,this.camera),this.renderer.autoRender(),this.control=new va(this,this.camera,this.renderer.domElement),this.control.maxPolarAngle=this.config.control.maxPolar,this.container.appendChild(this.renderer.domElement),this.scene.add(this.lights),this.basicRatio=this.getRatio(),this.control.addEventListener("change",this.onControlChange),this.control.addEventListener("change-zoom",this.onControlChangeZoom),this.renderer.addEventListener("update",this.onRendererUpdate),this.cameraBound=new pa(this)}getRatio(t,e){t===void 0&&(t=new We(0,0,0)),e===void 0&&(e=new We(100,0,0));let{clientWidth:n,clientHeight:r}=this.container,o=L(t,this.camera,n,r),s=L(e,this.camera,n,r);return Math.ceil(Math.sqrt((s.x-o.x)**2+(s.y-o.y)**2))}changeAmbientLightColor(t){this.lights.children.forEach(e=>{e instanceof lG&&(e.color=new uG(t))})}switchFloor(t){this.currentFloor&&(this.scene.remove(this.currentFloor),this.currentFloor.dispose()),this.currentFloor=t,this.scene.add(t);let e=t.getCenter();e&&(this.lights.position.x=e.x,this.lights.position.y=e.y),this.cameraBound.updateBox()}getGraphicsByDeviceXy(t,e){var n;let r=new Tr;r.x=t/this.clientSize.width*2-1,r.y=e/this.clientSize.height*-2+1;let o=new sG;return o.setFromCamera(r,this.camera),o.ray.origin.sub(o.ray.direction.clone().multiplyScalar(100)),((n=this.currentFloor)==null?void 0:n.graphicLayer.getGraphicByRaycaster(o))||{graphics:[],position:null}}getPoisByDeviceXy(t,e){var n,r;let o=(n=this.currentFloor)==null?void 0:n.poiLayer.getPoiByDeviceXy(t,e),s=(r=this.currentFloor)==null?void 0:r.poiLayer2.getPoiByDeviceXy(t,e);return(o||[]).concat(s||[])}registryEvent(){window.addEventListener("resize",this.onWindowResize),this.container.addEventListener("click",this.onClick),this.container.addEventListener("pointerover",this.onPointerover),this.container.addEventListener("pointermove",this.onPointermove),this.container.addEventListener("pointerleave",this.onPointerleave),this.container.addEventListener("pointercancel",this.onPointerleave),this.container.addEventListener("pointerout",this.onPointerleave),this.selection.addEventListener("select",this.onSelectionSelect),this.hoverHelper.addEventListener("hover-change",this.onHoverChange)}unRegistryEvent(){window.removeEventListener("resize",this.onWindowResize),this.container.removeEventListener("click",this.onClick),this.container.removeEventListener("pointerover",this.onPointerover),this.container.removeEventListener("pointermove",this.onPointermove),this.container.removeEventListener("pointerleave",this.onPointerleave),this.container.removeEventListener("pointercancel",this.onPointerleave),this.container.removeEventListener("pointerout",this.onPointerleave),this.selection.removeEventListener("select",this.onSelectionSelect),this.hoverHelper.removeEventListener("hover-change",this.onHoverChange),this.control.removeEventListener("change",this.onControlChange),this.control.removeEventListener("change-zoom",this.onControlChangeZoom),this.renderer.removeEventListener("update",this.onRendererUpdate)}setPolarAngle(t,e){return e===void 0&&(e=500),this.control.setPolarAngleByDuration(t,!0,e)}setAzimuthalAngle(t,e){return e===void 0&&(e=500),this.control.setAzimuthalAngleDuration(t,!0,e)}getCameraLookAt(){return this.control.getCameraLookAt()}setZoom(t,e,n){return n===void 0&&(n=500),this.control.setZoomByDuration(t,e,!0,n)}getFitCameraToObjectZoom(t,e,n,r){e===void 0&&(e=[20,20,20,20]),n===void 0&&(n=500),r===void 0&&(r=!0);let[o,s,a,u]=e,{clientSize:{width:l,height:c}}=this,h=this.control.getPolarAngle();r&&this.setPolarAngle(0,0);let p=new aG().setFromObject(t);this.setPolarAngle(h,0);let{max:d,min:m}=p,_=new We(m.x,d.y,d.z),v=new We(d.x,d.y,d.z),x=new We(d.x,m.y,m.z),M=new We(m.x,m.y,m.z),b=L(_,this.camera,l,c),C=L(v,this.camera,l,c),w=L(M,this.camera,l,c),I=L(x,this.camera,l,c),R=new oG().setFromPoints([new Tr(b.x,b.y),new Tr(C.x,C.y),new Tr(w.x,w.y),new Tr(I.x,I.y)]).getSize(new Tr),B=(l-s-u)/R.x,H=(c-o-a)/R.y,k=Math.min(B,H),lt=new We((d.x+m.x)/2,(d.y+m.y)/2,(d.z+m.z)/2),xt=k*this.camera.zoom,Nt=this.camera.clone();Nt.zoom=xt,Nt.updateMatrix();let Ot=(l-R.x*k)/2,Fn=(c-R.y*k)/2,Rr=(s-u)/2,Pr=(o-a)/2;if(Rr){let wt=new We;wt.setFromMatrixColumn(Nt.matrix,0),wt.normalize(),wt.multiplyScalar(Rr/xt),lt.add(wt)}if(Pr){let wt=new We;wt.setFromMatrixColumn(Nt.matrix,1),wt.normalize(),wt.multiplyScalar(Pr/xt),lt.add(wt)}return{zoom:k*this.camera.zoom,center:lt}}fitCameraToObject(t,e,n,r){e===void 0&&(e=[20,20,20,20]),n===void 0&&(n=500),r===void 0&&(r=!0);let{zoom:o,center:s}=this.getFitCameraToObjectZoom(t,e,n,r);return this.setZoom(o,s,n)}getFitCameraToGroundZoom(t,e,n){if(t===void 0&&(t=[20,20,20,20]),e===void 0&&(e=500),n===void 0&&(n=!0),this.currentFloor&&this.currentFloor.hasElement)return this.getFitCameraToObjectZoom(this.currentFloor.groundUpper,t,e,n).zoom}fitCameraToGround(t,e,n){return t===void 0&&(t=[20,20,20,20]),e===void 0&&(e=500),n===void 0&&(n=!0),this.currentFloor&&this.currentFloor.hasElement?this.fitCameraToObject(this.currentFloor.groundLayer,t,e,n):Promise.resolve(!1)}setCameraPosition(t,e){return E(this,null,function*(){return this.control.setCameraPositionByTarget(t,e)})}pauseRender(){this.renderer.pauseRender()}continueRender(){this.renderer.continueRender()}dispose(){var t;(t=this.currentFloor)==null||t.dispose(),this.control.dispose(),this.cameraBound.dispose(),this.selection.dispose(),this.hoverHelper.dispose(),this.unRegistryEvent(),this.renderer.domElement.remove(),this.renderer.dispose(),this.lights.children.forEach(e=>e.dispose()),J(this.scene),this.scene.clear(),this.container=null}constructor(t,e){super(),this.container=t,this.config=e,this.scene=new xa,this.renderer=new ya,this.lights=kg(),this.clientSize={width:0,height:0,x:0,y:0},this.renderRf=0,this.basicZoom=1,this.onControlChange=()=>{this.dispatchEvent({type:"change-ratio",px:(this.basicRatio||0)*this.camera.zoom}),this.dispatchEvent({type:"control-change"})},this.onControlChangeZoom=n=>{let{zoom:r}=n;this.dispatchEvent({type:"control-zoom-change",zoom:r})},this.onRendererUpdate=()=>{this.dispatchEvent({type:"update"})},this.onWindowResize=()=>{let{container:n,camera:r,renderer:o}=this,{clientWidth:s,clientHeight:a}=n;s=Math.max(1,s),a=Math.max(1,a),r.left=-s/2,r.right=s/2,r.top=a/2,r.bottom=-a/2,r.updateProjectionMatrix(),o.setSize(s,a),this.resizeClientSize(),this.dispatchEvent({type:"resize",width:s,height:a})},this.onClick=n=>{let{graphics:r,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY);r.length&&this.dispatchEvent({type:"graphic-click",graphics:r,position:o});let s=this.getPoisByDeviceXy(n.offsetX,n.offsetY);s.length&&this.dispatchEvent({type:"poi-click",pois:s})},this.onPointerover=n=>{let{graphics:r,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY),s=this.getPoisByDeviceXy(n.offsetX,n.offsetY);this.dispatchEvent({type:"pointer-over",e:n,graphics:r,pois:s,position:o})},this.onPointermove=n=>{let{graphics:r,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY),s=this.getPoisByDeviceXy(n.offsetX,n.offsetY);this.dispatchEvent({type:"pointer-move",e:n,graphics:r,pois:s,position:o})},this.onPointerleave=n=>{this.dispatchEvent({type:"pointer-level"})},this.onSelectionSelect=n=>{let{graphics:r,isMultipleSelect:o}=n;this.dispatchEvent({type:"select-graphic",graphics:r,isMultipleSelect:o})},this.onHoverChange=n=>{let{graphics:r}=n;this.dispatchEvent({type:"hover",graphics:r})},this.container.style.position="relative",this.container.style.overflow="hidden",this.init(),this.selection=new la(this),this.hoverHelper=new ca(this),this.resizeClientSize(),this.registryEvent()}};import{merge as cG}from"lodash";var hG={placeId:0,apiDomain:"",apiInfo:{},apiPath:{floorGraphic:"/api/inception-map/floor/get",floorRange:"/api/inception-map/range/get",equipmentList:"/api/inception-map/equipment/get",roadNetwork:"/api/inception-map/road_network/get",loadPlaceInfo:"https://screen.aibee.cn/ai-map/map/get-floor-map"},enableBoxSelect:!0,resizeObserver:!1,initTransToMark:!1,heatMap:{radius:50,gradient:{0:"#8F9FCD",.5:"#6284FF",1:"#F95D5D"}},useFloorCache:!0,control:{maxPolar:1.2,defaultPolar:1.1,defaultAzimuthal:0},defaultPadding:[20,20,20,20],svg:{circle:{radius:"2",fill:"#1CADFF"},line:{stroke:"#1CADFF"}},selectBox:{stroke:"#1CADFF",fill:"rgba(28, 173, 255, 0.3)"},hover:{time:100},ground:{color:"#F6F6F6",opacity:1,height:.001,stroke:!1,strokeColor:"#E6E6E6",strokeOpacity:1},markGraphic:{color:"#EEF0F3",opacity:1,height:.001,stroke:!1,strokeColor:"#000",strokeOpacity:1},graphic:{fillOpacity:1},cameraBound:{padding:[150,150,150,150]},poi:{boxScale:1}};function r3(i){return cG({},hG,i)}import{debounce as RG}from"lodash";var gJ=f(P(),1);var le;function i3(i,t){return i===void 0&&(i="aibee_map"),t===void 0&&(t=1),new Promise((e,n)=>{if(le)return e({db:le,type:"success"});let r=indexedDB.open(i,t);r.onupgradeneeded=function(o){le=o.target.result,console.log("onupgradeneeded"),e({db:le,type:"onupgradeneeded"})},r.onsuccess=o=>{le=o.target.result,e({db:le,type:"success"})},r.onerror=o=>{n(o)}})}function Bc(i,t,e){return e===void 0&&(e=le),new Promise((n,r)=>{e||r("\u6CA1\u6709db");let s=e.transaction([i],"readonly").objectStore(i).get(t);s.onsuccess=()=>{s.result?n(s.result.value):n(null)},s.onerror=a=>{console.log("[getVersionByKey]",a),n(null)}})}function o3(i,t,e,n){return n===void 0&&(n=le),new Promise((r,o)=>(n||o("\u6CA1\u6709db"),new Promise((s,a)=>E(this,null,function*(){let u=yield Bc(i,t),l=n.transaction([i],"readwrite").objectStore(i),c=u!==null?l.put({key:t,value:e}):l.add({key:t,value:e});c.onsuccess=function(h){s(h)},c.onerror=function(h){a(h)}}))))}function On(i,t){t===void 0&&(t=le),t&&(t.objectStoreNames.contains(i)||t.createObjectStore(i,{keyPath:"key"}))}function s3(i){i===void 0&&(i=le),i==null||i.close(),le=null}import{Vector3 as MG,Color as wG}from"three";var aJ=f(U(),1),uJ=f(P(),1);function ba(i,t){let e=i.poi_info.showName||i.store_name||i.poi_info.text;switch(t){case"zh-cn":return e;case"en":var n;return((n=i.store_info_ext)==null?void 0:n.poi_name)||e;case"zh-hk":var r;return((r=i.store_info_ext)==null?void 0:r.traditional_name)||e}}function Ma(i,t){let e=i.poi_info.showName||i.store_name||i.poi_info.text;switch(t){case"zh-cn":return e;case"en":var n;return((n=i.infra_info_ext)==null?void 0:n.poi_name)||e;case"zh-hk":var r;return((r=i.infra_info_ext)==null?void 0:r.traditional_name)||e}}function a3(i,t,e){switch(i.l_type){case"graph":return pG(i,t);case"wall":return fG(i,t);case"lane":return dG(i,t);case"texture2d":case"texture3d":return gG(i,t);case"glb":return mG(i,t);case"store":return _G(i,t);case"facility":return yG(i,t);case"parkingSpace":return EG(i,t,e);case"text":return bG(i,t)}}function u3(i,t,e,n){switch(i.l_type){case"store":return vG(i,t,e,n.showStoreName);case"facility":return xG(i,t,e,n.showFacilityName);case"parkingSpace":return SG(i,t)}}function pG(i,t){let e=i.elements.reduce((n,r)=>{let{fillColor:o,fillOpacity:s,strokeColor:a,strokeOpacity:u,height:l,airHeight:c}=r,h=o.toLowerCase()+"-"+s+"-"+a.toLowerCase()+"-"+u+"-"+l+"-"+c;return u===0&&(h=o.toLowerCase()+"-"+s+"-"+l+"-"+c),n[h]?n[h].push(r):n[h]=[r],n},{});Object.values(e).forEach(n=>{let r=new br(t.context,n);t.mergeGraphicLayer.add(r)})}function fG(i,t){let e=i.elements.reduce((n,r)=>{let{fillColor:o,fillOpacity:s,strokeColor:a,strokeOpacity:u,height:l}=r,c=o.toLowerCase()+"-"+s+"-"+a.toLowerCase()+"-"+u+"-"+l;return u===0&&(c=o.toLowerCase()+"-"+s+"-"+l),n[c]?n[c].push(r):n[c]=[r],n},{});Object.values(e).forEach(n=>{let r=new ra(t.context,n);t.wallLayer.add(r)})}function dG(i,t){let e=i.elements.reduce((n,r)=>{let{fillColor:o,fillOpacity:s,strokeColor:a,strokeOpacity:u}=r,l=o.toLowerCase()+"-"+s+"-"+a.toLowerCase()+"-"+u;return u===0&&(l=o.toLowerCase()+"-"+s),n[l]?n[l].push(r):n[l]=[r],n},{});Object.values(e).forEach(n=>{let r=new oa(t.context,n);t.laneLayer.add(r)})}function gG(i,t){if(i.elements.length){let e=new Sr(t.context,i.elements);t.textureLayer.add(e)}}function mG(i,t){i.elements.forEach(e=>{let n=new ia(t.context,S({},e,{url:e.secondUrl,rotate:e.secondRotate,width:e.secondWidth,center_x:e.center_coord_x,center_y:e.center_coord_y}));t.glbModelLayer.add(n)})}function _G(i,t){i.elements.map(e=>{let n=t.addGraphic(e);t.userData.graphics.push(n),t.userData.graphicMap.set(e.id,n)})}function vG(i,t,e,n){i.elements.map(r=>{try{let o=ba(r,e),s=new nt(t.context,{id:r.id,icon:r.poi_info.showImageUrl||r.poi_info.icon,text:o,position:{x:r.center_coord_x,y:r.center_coord_y,z:r.airHeight+r.height},icon_size:[24,24],level:r.poi_info.level||0,hide_text:!n,maxWeight:r.poi_info.maxWeight||25,minWeight:r.poi_info.minWeight||1});t.poiLayer2.pushPoi(s),s&&(s.userData.type="store",s.userData.data=r,s.userData.floor=t.name)}catch(o){console.log("\u521B\u5EFA\u5E97\u94FApoi\u5931\u8D25",o,r)}})}function yG(i,t){i.elements.map(e=>{let n=t.addGraphic(e);t.userData.graphics.push(n),t.userData.graphicMap.set(e.id,n)})}function xG(i,t,e,n){i.elements.filter(o=>o.poi_info).map(o=>{try{let s=Ma(o,e),a=new nt(t.context,{id:o.id,icon:o.poi_info.showImageUrl||o.poi_info.icon,text:s,position:{x:o.center_coord_x,y:o.center_coord_y,z:o.airHeight+o.height},icon_size:[24,24],level:o.poi_info.level||0,hide_text:!n,maxWeight:o.poi_info.maxWeight||25,minWeight:o.poi_info.minWeight||1});t.poiLayer2.pushPoi(a),a.userData.type="facility",a.userData.data=o,a.userData.floor=t.name}catch(s){console.log("\u6DFB\u52A0facility\u5931\u8D25",s,o)}})}function EG(i,t,e){t.parkingSpaceLayer.createParkings(i.elements,e.mergeParkingSpace),t.userData.parkingSpaces=t.parkingSpaceLayer.graphicMap.values(),t.userData.parkingSpacesGraphicMap=t.parkingSpaceLayer.graphicMap}function SG(i,t){return E(this,null,function*(){let e=i.elements.filter(o=>o.texts[0]),n=e.map(o=>o.texts[0]),r=yield tt.lazyGetTextureByTexts(n,{height:64});e.forEach(o=>{try{let s=o.texts[0],a=new nt(t.context,{id:o.id,text:s,position:{x:o.center_coord_x,y:o.center_coord_y,z:o.airHeight+o.height},text_texture:r[s].texture,text_texture_width:r[s].width,text_texture_height:r[s].height,text_texture_offset_x:r[s].x,text_texture_offset_y:r[s].y});a&&(a.userData.type="parkingSpace",a.userData.data=o,a.userData.floor=t.name),t.poiLayer2.pushPoi(a)}catch(s){console.log("\u6DFB\u52A0\u8F66\u4F4Dpoi\u5931\u8D25",s,o)}}),Object.values(r).forEach(o=>{o.texture.dispose()})})}function bG(i,t){let e=new aa(t.context,i.elements.map(n=>S({},n,{center_x:n.center_coord_x,center_y:n.center_coord_y})));t.textTextureLayer.add(e)}var l3="map_version",c3="route_version",h3="facility_version",zc="map_data",wa="road_network_data",Gc="facility_data",TG={mergeParkingSpace:!0},Ar=class extends pt{initDb(){return E(this,null,function*(){try{let{db:t,type:e}=yield i3("aibee_map",2);e==="onupgradeneeded"&&(On(l3),On(c3),On(h3),On(zc),On(wa),On(Gc)),this.db=t}catch(t){console.log("[\u6253\u5F00indexDb\u9519\u8BEF]",t)}})}load(t,e){return E(this,null,function*(){if(Array.isArray(t))this.floors=t,e&&(this.placeConfig=S({},this.placeConfig,e));else{let n=yield fetch(t).then(r=>r.json());n.code===200&&(this.floors=n.data.list,this.placeConfig=S({},this.placeConfig,JSON.parse(n.data.config||"{}")))}this.getOtherDataByFreeTime()})}setCacheData(t,e,n){return this.initDbPromise.then(()=>o3(t,""+e,n,this.db))}getCacheData(t,e){return this.initDbPromise.then(()=>Bc(t,""+e,this.db))}getFloorCacheKey(t){return t.floor_id+"_"+t.version_id}getFloorData(t){return E(this,null,function*(){let e=yield this.getFloorJsonData(t);return e?this.getDataByJson(e):null})}getFloorDataByFloorInfo(t){return E(this,null,function*(){let e=yield this.getFloorJsonDataByFloorInfo(t);return this.getDataByJson(e)})}setLocale(t){this.locale=t,this.bmap.context.currentFloor&&this.bmap.context.currentFloor.poiLayer2.pois.forEach(e=>{e.userData.type==="store"&&(e.options.text=ba(e.userData.data,t)),e.userData.type==="facility"&&(e.options.text=Ma(e.userData.data,t))})}getFloorJsonDataByFloorInfo(t){return E(this,null,function*(){if(this.getFloorDataPromise.has(t.floor))return this.getFloorDataPromise.get(t.floor);let e=new Promise(n=>E(this,null,function*(){let r=this.getFloorCacheKey(t),o=yield fetch(t.map_url).then(s=>s.json());o.floor=t.floor,this.setCacheData(zc,r,o),this.setCacheData(l3,r,t.version_id),n(o)}));return this.getFloorDataPromise.set(t.floor,e),e})}getFloorJsonData(t){return E(this,null,function*(){let e=this.floors.find(r=>r.floor===t);if(!e)return null;let n=this.getFloorCacheKey(e);try{let r=yield this.getCacheData(zc,n);return r||this.getFloorJsonDataByFloorInfo(e)}catch(r){return console.log("[get floor data error]",r),this.getFloorJsonDataByFloorInfo(e)}})}getRoadNetworkData(){return E(this,null,function*(){return(yield Promise.all(this.floors.map(e=>E(this,null,function*(){let n=this.getFloorCacheKey(e);try{let r=yield this.getCacheData(wa,n);if(r)return r;let o=yield fetch(e.route_url).then(s=>s.json());return this.setCacheData(wa,n,o),this.setCacheData(c3,n,e.version_id),o}catch(r){let o=yield fetch(e.route_url).then(s=>s.json());return this.setCacheData(wa,n,o),o}})))).filter(e=>e.points)})}getFacilitiesData(){return E(this,null,function*(){let t=this.floors.reduce((r,o)=>r.updated_at>o.updated_at?r:o,this.floors[0]);if(!t)return null;let e=this.getFloorCacheKey(t),n=()=>E(this,null,function*(){let r=yield fetch(t.entry_infra_url).then(o=>o.json());return r&&(this.setCacheData(Gc,e,r),this.setCacheData(h3,e,t.version_id)),r});try{let r=yield this.getCacheData(Gc,e);return r||n()}catch(r){return console.log("[get facility error]",r),n()}})}getOtherDataByFreeTime(){return E(this,null,function*(){for(let t=0;t<this.floors.length;t++){let e=this.floors[t];this.getFloorJsonData(e.floor)}})}getMulFloorsData(t){return E(this,null,function*(){return Promise.all(t.map(e=>this.getFloorData(e))).then(e=>e.filter(n=>n))})}getDataByUrl(t){return E(this,null,function*(){let e=yield fetch(t).then(n=>n.json());return this.getDataByJson(e)})}getDataByJson(t,e,n){return E(this,null,function*(){return e=this.getFloorBaseLayer(t,e),n=S({},this.placeConfig,n),t.layers.forEach(r=>{["range","ground"].includes(r.l_type)||rr(r.elements,e.userData.center)}),yield this.getFloorContentLayer(t,e),yield this.getFloorPoi(t,e,n),this.changeFloorBox(t,e),e})}changeFloorBox(t,e){e.updateBox();let n=e.box.getSize(new MG),r=Math.max(n.x,n.y,n.z);e.userData.height=r/4+t.floorHeight}switchFloor(t,e){return E(this,null,function*(){return new Promise(n=>{let r={run:()=>this._switchFloor(t,e),meta:{type:"switchFloor"}},o=this.taskQueue.replaceByMetaType(r),s=a=>{let{task:u,res:l}=a;u.tid===o&&(this.taskQueue.removeEventListener("active-task-end",s),n(l))};this.taskQueue.addEventListener("active-task-end",s)})})}_switchFloor(t,e){return E(this,null,function*(){var n;let r=t;if(typeof t=="string"){let l=yield this.getFloorJsonData(t);if(l)r=l;else return null}e=S({},this.placeConfig,e);let o=new Yt(this.bmap.context);o.userData.data=t;let s=this.floors.find(l=>l.floor===r.floor);var a;let u=(a=s==null?void 0:s.map_angle)!=null?a:0;return this.bmap.dispatchEvent({type:ht.SWITCH_FLOOR_BEFORE,data:{curFloor:o,graphics:[]}}),this.dispatchEvent({type:"switch-floor-before",data:{curFloor:o,graphics:[],floorData:r}}),this.bmap.context.scene.background=new wG(e.backgroundColor),this.getFloorBaseLayer(r,o),this.changeFloorBox(r,o),this.bmap.buildingCenter=o.userData.center,this.bmap.currentBuildGround=(n=o.userData.data.layers.find(l=>l.l_type==="range"))==null?void 0:n.elements[0],this.bmap.context.switchFloor(o),this.bmap.initialFloorCamera(),this.bmap.context.control.setAzimuthalAngle(u/180*Math.PI,!0),this.bmap.context.cameraBound.updateBox(),r.layers.forEach(l=>{["range","ground"].includes(l.l_type)||rr(l.elements,o.userData.center)}),this.dispatchEvent({type:"switch-floor-ground",data:{curFloor:o,graphics:[]}}),this.bmap.dispatchEvent({type:ht.SWITCH_FLOOR_GROUND,data:{curFloor:o}}),yield Ho(),yield this.getFloorContentLayer(r,o),this.changeFloorBox(r,o),this.dispatchEvent({type:"switch-floor-content",data:{curFloor:o,graphics:[]}}),yield Nm(2),yield this.getFloorPoi(r,o,e),this.dispatchEvent({type:"switch-floor-after",data:{curFloor:o,graphics:o.graphicLayer.children}}),this.bmap.dispatchEvent({type:ht.SWITCH_FLOOR_AFTER,data:{curFloor:o,graphics:o.graphicLayer.children}}),o})}getFloorBaseLayer(t,e){e||(e=new Yt(this.bmap.context));let n=[0,0];return t.layers.forEach(r=>{switch(r.l_type){case"range":let o=r.elements[0];n=[o.center_x,o.center_y];break;case"ground":rr(r.elements,n);let s=r.elements.map(a=>new et(this.bmap.context,a));e.addGrounds(s);break;default:break}}),e.userData.center=n,e.name=t.floor,e.userData.data=t,e}getFloorContentLayer(t,e){return E(this,null,function*(){e||(e=new Yt(this.bmap.context)),e.userData.graphics=[],e.userData.graphicMap=new Map;let n=Date.now();for(let r=0;r<t.layers.length;r++){let o=t.layers[r];["range","ground"].includes(o.l_type)||(a3(o,e,this.options),console.log("time",Date.now()-n,o.l_type),Date.now()-n>50&&(yield Ho(),n=Date.now()))}return e})}getFloorPoi(t,e,n){return E(this,null,function*(){n===void 0&&(n=this.placeConfig);let r=Date.now();yield Promise.all(t.layers.map(s=>u3(s,e,this.locale,n))),console.log("poi time",Date.now()-r);let o=Date.now();Ho().then(()=>{console.log("poi render time",Date.now()-o)})})}clear(){return E(this,null,function*(){var t;s3((t=this.db)!=null?t:void 0)})}dispose(){super.dispose(),this.clear(),this.getFloorDataPromise.clear()}constructor(t,e={}){super(),this.bmap=t,this.floors=[],this.initDbPromise=Promise.resolve(),this.db=null,this.taskQueue=new ir,this.locale="zh-cn",this.placeConfig={backgroundColor:"#f1f7f6",showFacilityName:!0,showStoreName:!0},this.getFloorDataPromise=new Map,this.options=S({},TG,e),this.initDbPromise=this.initDb()}};var PJ=f(P(),1);function p3(i,t){return E(this,null,function*(){let{brand:e,project:n}=i,{apiDomain:r,apiPath:{floorRange:o},apiInfo:s}=t,a=""+r+o+"?brand="+e+"&project="+n+"&phase="+n+"&building="+n;return yield fetch(a,s).then(l=>l.json()).then(l=>l.data).then(l=>{let c=(l||[])[0];return c&&(c.info=JSON.parse(c.info)),c})})}function f3(i,t){return E(this,null,function*(){let{brand:e,project:n,floor:r,ts:o,resource_type_list:s}=i,{apiDomain:a,apiPath:{floorGraphic:u},apiInfo:l}=t,c=""+a+u+"?brand="+e+"&project="+n+"&phase="+n+"&building="+n+"&floor="+r+"&ts="+o+"&resource_type_list="+s;return yield fetch(c,l).then(p=>p.json()).then(p=>p.data).then(p=>((p||[]).map(d=>d.info=JSON.parse(d.info)),p||[]))})}function MJ(i,t){return E(this,null,function*(){let{project:e,floor:n}=i,{apiDomain:r,apiInfo:o}=t,s=r+"/api/inception-map/external_street/get?projectCode="+e+"&floorCode="+n;return yield fetch(s,o).then(u=>u.json()).then(u=>u.data).then(u=>JSON.parse(u[0].streetInfo||"{}")).then(u=>u.fileId?AG(u.fileId,t):null)})}function AG(i,t){return E(this,null,function*(){let{apiDomain:e,apiInfo:n}=t;return fetch(e+"/api/inception-map/file/getFileStream?fileId="+i,n).then(r=>r.arrayBuffer()).then(r=>{let s=new TextDecoder("utf-8").decode(r);return s?JSON.parse(s):null})})}var d3=class{load(t){return E(this,null,function*(){let e=tr(t);if(this.cacheData.has(e))return this.cacheData.get(e);let[,n]=yield Promise.all([this.loadBuildGround(t),f3(t,this.bmap.config)]),r=tr({floor:t.floor,ts:t.ts});rr(n.map(s=>s.info),this.bmap.buildingCenter,this.floorDataLengthMap.get(r)||0),n.forEach(s=>s.info.transformToBuildingGround=!1),this.cacheData.set(e,n);let o=this.floorDataLengthMap.get(r)||0;return this.floorDataLengthMap.set(r,o+n.length),this.loadExternalStreet(t),n})}loadExternalStreet(t){return E(this,null,function*(){})}switchFloorByData(t,e){if(!t.length)return;let n=e.userData.legacyToGraphicMap||new Map,r=e.userData.graphicMap||new Map,{ground:o,markGraphic:s,graphic:a}=this.bmap.config;for(let u=0;u<t.length;u++){let l=t[u];l.info.group==="ground"?(l.info.fillColor=o.color,l.info.fillOpacity=o.opacity,l.info.height=o.height,l.info.stroke=o.stroke,l.info.strokeColor=o.strokeColor,l.info.strokeOpacity=o.strokeOpacity):l.info.userData.mark?(l.info.height=s.height,l.info.fillColor=s.color,l.info.fillOpacity=s.opacity,l.info.stroke=s.stroke,l.info.strokeColor=s.strokeColor,l.info.strokeOpacity=s.strokeOpacity):(l.info.fillOpacity=a.fillOpacity,this.bmap.config.initTransToMark&&(l.info.height=s.height,l.info.fillColor=s.color,l.info.stroke=s.stroke,l.info.strokeColor=s.strokeColor,l.info.strokeOpacity=s.strokeOpacity))}for(let u of t){if(u.info.group==="ground")e.createGround(u.info);else{let l=e.addGraphic(u.info);l.userData.data=u,n.set(u.legacy_id,l)}r.set(u.element_uuid,u)}e.userData.legacyToGraphicMap=n,e.userData.graphicMap=r,e.updateBox(),e===this.bmap.context.currentFloor?(this.bmap.triggerHooks(ht.SWITCH_FLOOR_BEFORE,{curFloor:e,graphics:e.graphicLayer.children}),this.bmap.initialFloorCamera(),this.bmap.triggerHooks(ht.SWITCH_FLOOR_AFTER,{curFloor:e,graphics:e.graphicLayer.children})):this.bmap.switchFloorByFloor(e)}filterData(t,e){let n=e.userData.graphicMap||new Map;return t.filter(r=>!n.has(r.element_uuid))}switchFloorByStoreData(t,e){return E(this,null,function*(){let n=yield this.load(S({},t,{resource_type_list:"6"})),r=this.filterData(n,e);this.switchFloorByData(r,e)})}switchFloorByOtherData(t,e){return E(this,null,function*(){let n=yield this.load(S({},t,{resource_type_list:"1,2,3,4"})),r=this.filterData(n,e);this.switchFloorByData(r,e)})}loadBuildGround(t){return E(this,null,function*(){let{brand:e,project:n}=t,r=yield this.loadBuildingGround({brand:e,project:n});return this.bmap.currentBuildGround=r,this.bmap.changeBuildingCenter(r,{brand:e,project:n}),this.bmap.currentBuildGround})}loadBuildingGround(t){return E(this,null,function*(){let{brand:e,project:n}=t,r=tr({brand:e,project:n});if(this.buildingGroundMap.has(r))return this.buildingGroundMap.get(r);let o=p3({brand:e,project:n},this.bmap.config).then(s=>(this.buildingGroundMap.set(r,s),s));return this.buildingGroundMap.set(r,o),o})}switchFloor(t){return E(this,null,function*(){let e=new Yt(this.bmap.context);e.userData.graphicMap=new Map,e.name=t.floor;try{yield Promise.all([this.switchFloorByStoreData(t,e),this.switchFloorByOtherData(t,e)])}catch(n){console.log(n)}return e})}dispose(){this.cacheData.clear(),this.floorDataLengthMap.clear(),this.buildingGroundMap.clear()}constructor(t){this.bmap=t,this.cacheData=new Map,this.floorDataLengthMap=new Map,this.buildingGroundMap=new Map,this.externalStreetMap=new Map}};var JJ=function(i){return i[i.D2=0]="D2",i[i.D3=1.1]="D3",i}({}),Ta=class extends CG{get basicZoom(){return this.context.basicZoom}set basicZoom(t){this.context.basicZoom=t}changeBuildingCenter(t,e){let{brand:n,project:r}=e,o=t?Fo(t.info.geometry.cds[0]):[0,0];this.buildingCenter=o,this.dispatchEvent({type:"center-change",center:o,project:r,brand:n})}use(t){t.bmap=this,this.plugins.push(t)}unUse(t){this.plugins=this.plugins.filter(e=>e!==t)}triggerHooks(t,e){this.dispatchEvent({type:t,data:e})}switchFloor(t){return E(this,null,function*(){return this.loader||(this.loader=new Ar(this),yield this.loader.load(this.config.apiPath.loadPlaceInfo+"?place_id="+this.config.placeId+"&env=prod")),this.loader.switchFloor(t)})}switchFloorByFloor(t,e){e===void 0&&(e=t.graphicLayer.children),this.triggerHooks(ht.SWITCH_FLOOR_BEFORE,{curFloor:t,graphics:e}),this.context.switchFloor(t),this.initialFloorCamera(),this.triggerHooks(ht.SWITCH_FLOOR_AFTER,{curFloor:t,graphics:e})}initialFloorCamera(){this.context.cameraBound.setEnable(!1),this.context.control.minZoom=0,this.context.control.maxZoom=1/0,this.context.camera.zoom=1,this.context.setAzimuthalAngle(this.config.control.defaultAzimuthal,0),this.context.setPolarAngle(this.config.control.defaultPolar,0),this.context.fitCameraToGround(this.config.defaultPadding,0);let t=this.context.camera.zoom;this.context.control.minZoom=t,this.context.control.maxZoom=t*25,this.type==="3d"&&this.context.fitCameraToGround(this.config.defaultPadding,0,!1),this.basicZoom=this.context.camera.zoom,this.context.control.addEventListener("change",this.onControlChange),this.onControlChange(),this.context.cameraBound.setEnable(!0),this.context.cameraBound.changePrevCamera()}addModel(t,e){if(t.options.geometry.type==="polygon"){var n;let r=(n=this.context.currentFloor)==null?void 0:n.addModel(S({},e,{position:t.getPosition().setZ(.1),id:t.options.id}));if(r){let{facilityAngle:o=0,facilityXScale:s=1,facilityYScale:a=1}=t.options.userData;r.rotateZ((180-o)/180*Math.PI),r.scale.set(s,a,1)}}}addHeatmap(t){var e;return(e=this.context.currentFloor)==null?void 0:e.addHeatmap(t)}getLegacyToGraphicMap(){var t;return((t=this.context.currentFloor)==null?void 0:t.userData.legacyToGraphicMap)||new Map}getFloorAllGraphics(){var t;return((t=this.context.currentFloor)==null?void 0:t.graphicLayer.children.filter(e=>e instanceof et))||[]}createGraphicPoi(t,e){if(this.context.currentFloor){e.id===void 0&&(e.id=t.options.id);let n=t.options.center,r=t.getCenter(),o=(n==null?void 0:n[0])||r.x,s=(n==null?void 0:n[1])||r.y;return console.log(o,s,n,r),this.context.currentFloor.addPoi(S({},e,{position:{x:o,y:s,z:r.z+t.options.height/2}}))}return null}removeHeatMap(){var t;(t=this.context.currentFloor)==null||t.removeHeatMap()}translateElementToCenter(t,e,n,r){e===void 0&&(e=500),n===void 0&&(n=0),r===void 0&&(r=0);let o=t.getPosition().clone(),{context:{camera:s}}=this;if(s.updateMatrix(),r){let a=new kc;a.setFromMatrixColumn(s.matrix,1),a.normalize(),a.multiplyScalar(r/s.zoom),o.add(a)}if(n){let a=new kc;a.setFromMatrixColumn(s.matrix,0),a.normalize(),a.multiplyScalar(n/s.zoom),o.add(a)}return this.context.setCameraPosition(o,e)}translateElementToCenterX(t,e){return E(this,null,function*(){return e===void 0&&(e=500),zt(new Promise(n=>{let r=this.context.control.target.clone(),o=t.getPosition();this.timer.requestAnimationFrame(()=>{let{clientSize:{width:s,height:a},camera:u}=this.context,c=L(o,u,s,a).x-s/2,h=new kc;h.setFromMatrixColumn(this.context.camera.matrix,0),h.normalize(),h.multiplyScalar(c/this.context.camera.zoom),r.add(h),this.context.setCameraPosition(r,e).then(n)})}),e+500)})}getElementDeviceCoordinate(t){let e=t.position.clone(),{clientWidth:n,clientHeight:r}=this.container;return L(e,this.context.camera,n,r)}changeMapType(t,e){return e===void 0&&(e=500),this.type=t,t==="2d"?this.context.setPolarAngle(0,e):this.context.setPolarAngle(1.1,e)}resetView(t){return E(this,null,function*(){t===void 0&&(t=300);let e=t/3;yield this.context.setAzimuthalAngle(this.config.control.defaultAzimuthal,e),yield this.context.setPolarAngle(this.config.control.defaultPolar,e),yield this.context.fitCameraToGround(this.config.defaultPadding,e,!1)})}reduceMap(t,e){t===void 0&&(t=.5),e===void 0&&(e=500);let n=this.context.camera.zoom;return this.context.setZoom(n-t,this.context.control.target,e)}enlargeMap(t,e){t===void 0&&(t=.5),e===void 0&&(e=500);let n=this.context.camera.zoom;return this.context.setZoom(n+t,this.context.control.target,e)}registryEvent(){if(window.addEventListener("keydown",this.onKeydown),window.addEventListener("keyup",this.onKeyUp),this.config.resizeObserver){let t=new ResizeObserver(this.debounceResize);t.observe(this.container),this.observe=t}}unRegistryEvent(){var t;this.context.control.removeEventListener("change",this.onControlChange),window.removeEventListener("keydown",this.onKeydown),window.removeEventListener("keyup",this.onKeyUp),(t=this.observe)==null||t.disconnect(),this.observe=null}configurePolarShortcutKeys(t){this.polarKeys=t}configureAzimuthalShortcutKeys(t){this.azimuthalKeys=t}rotateMap(t){t===void 0&&(t=.1);let e=this.context.control.getAzimuthalAngle();this.context.setAzimuthalAngle(e+t,500)}measureDistance(){return E(this,null,function*(){return this.cancelDistance(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgLine=new ea(this.context);let n=this.svgLine.dispose.bind(this.svgLine);this.svgLine.dispose=function(){n(),e("cancel")},this.svgLine.addEventListener("distance",r=>{let{distance:o}=r;t(o)})})})}cancelDistance(){this.svgLine&&(this.svgLine.dispose(),this.svgLine=void 0,this.context.control.enableRotate=!0)}measureArea(){return this.cancelArea(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgPolygon=new na(this.context);let n=this.svgPolygon.dispose.bind(this.svgPolygon);this.svgPolygon.dispose=function(){n(),e("cancel")},this.svgPolygon.addEventListener("area",r=>{let{area:o}=r;t(o)})})}cancelArea(){this.svgPolygon&&(this.svgPolygon.dispose(),this.svgPolygon=void 0,this.context.control.enableRotate=!0)}getGraphicByNodeId(t){var e,n;return((e=this.context.currentFloor)==null?void 0:e.graphicLayer.getGraphicByNodeId(t))||((n=this.context.currentFloor)==null?void 0:n.parkingSpaceLayer.graphicMap.get(t))||null}deleteGraphic(t){var e;(e=this.context.currentFloor)==null||e.graphicLayer.removeGraphic(t)}createGraphicByOptions(t){var e;if(!t.transformToBuildingGround&&this.currentBuildGround){let n=Fo(this.currentBuildGround.info.geometry.cds[0]);if(t.geometry.type==="polygon")t.geometry.coords=JSON.parse(JSON.stringify(t.geometry.cds)),t.geometry.coords.map(r=>{Array.isArray(r)&&r.forEach(o=>{o[0]-=n[0],o[1]-=n[1]})});else{let[r,o]=t.geometry.cds;t.geometry.coords=[r-n[0],o-n[1]]}}return(e=this.context.currentFloor)==null?void 0:e.graphicLayer.createGraphic(t)}removePoiById(t){var e,n;(e=this.context.currentFloor)==null||e.poiLayer.removePoiById(t),(n=this.context.currentFloor)==null||n.poiLayer2.removePoiById(t)}getPoiById(t){var e,n;return((e=this.context.currentFloor)==null?void 0:e.poiLayer.getPoiById(t))||((n=this.context.currentFloor)==null?void 0:n.poiLayer2.getPoiById(t))}getPois(){var t,e;return[...(((t=this.context.currentFloor)==null?void 0:t.poiLayer.pois)||[]).filter(n=>!n.options.built_in),...((e=this.context.currentFloor)==null?void 0:e.poiLayer2.pois)||[]]}clearPoi(){this.context.currentFloor&&this.context.currentFloor.poiLayer.clear()}removeSelectGraphic(t){this.context.selection.remove(t)}dispose(){this.loader&&(this.loader.dispose(),this.loader=null),this.unRegistryEvent(),this.timer.dispose(),this.plugins.forEach(t=>t.dispose()),this.plugins=[],this.context.dispose(),this.context=null,this.container=null,tt.dispose(),ut.dispose(),sn.dispose(),bt.dispose(),W.dispose(),ue.dispose(),this.debounceResize=null}constructor(t,e={}){super(),this.container=t,this.polarKeys=[],this.azimuthalKeys=[],this.prevCameraZoom=1,this.type="2d",this.currentBuildGround=null,this.observe=null,this.buildingCenter=[0,0],this.timer=new j,this.plugins=[],this.loader=null,this.onControlChange=()=>{let{camera:{zoom:n}}=this.context;n!==this.prevCameraZoom&&(this.dispatchEvent({type:"zoom-change",basicZoom:this.basicZoom,cameraZoom:this.context.camera.zoom}),this.prevCameraZoom=n)},this.onKeydown=n=>{this.polarKeys.includes(n.code)&&(this.context.control.maxPolarAngle=this.config.control.maxPolar,this.context.control.minPolarAngle=0),this.azimuthalKeys.includes(n.code)&&(this.context.control.maxAzimuthAngle=1/0,this.context.control.minAzimuthAngle=1/0)},this.onKeyUp=n=>{if(this.polarKeys.includes(n.code)){let r=this.context.control.getPolarAngle();this.context.control.maxPolarAngle=r,this.context.control.minPolarAngle=r}if(this.azimuthalKeys.includes(n.code)){let r=this.context.control.getAzimuthalAngle();this.context.control.maxAzimuthAngle=r,this.context.control.minAzimuthAngle=r}},this.resize=()=>{this.context.cameraBound.setEnable(!1),this.context.onWindowResize();let n=this.context.control.getAzimuthalAngle(),r=this.context.camera.zoom;this.context.control.minZoom=0,this.context.control.maxZoom=1/0,this.context.camera.zoom=1,this.context.setAzimuthalAngle(0,0);let o=this.context.getFitCameraToGroundZoom(this.config.defaultPadding,0)||1;this.context.camera.zoom=r,this.context.control.minZoom=o,this.context.control.maxZoom=o*25,this.basicZoom=r,this.context.control.addEventListener("change",this.onControlChange),this.context.setAzimuthalAngle(n,0),this.context.cameraBound.setEnable(!0)},this.config=r3(e),this.context=new Sa(t,this.config),this.debounceResize=RG(this.resize,5),this.registryEvent()}};var rQ=f(P(),1);import{EventDispatcher as PG}from"three";var Mt=class extends PG{dispose(){let t=this.bmap.plugins.findIndex(e=>e===this);t!==-1&&this.bmap.plugins.splice(t,1),this.bmap=null}constructor(t){super(),this.bmap=t,this.bmap.use(this)}};var g3=class extends Mt{fetchEquipment(){return E(this,null,function*(){let{apiDomain:t,apiPath:{equipmentList:e},apiInfo:n}=this.bmap.config,r=""+t+e;yield fetch(r,n).then(o=>o.json()).then(o=>o.data).then(o=>{this.equipmentList=o,this.equipmentMap=new Map(o.map(s=>[s.equipment_id,s]))}),this.dispatchEvent({type:"change-equipment-list",data:this.equipmentList}),this.bmap.context.currentFloor&&this.changeGraphicToEquipment(this.bmap.context.currentFloor.graphicLayer.children)})}getGraphicEquipment(t){return t.userData.data.info.userData.equipment}changeGraphicToEquipment(t){t.filter(e=>{let n=this.getGraphicEquipment(e);return n&&this.equipmentMap.has(n)}).forEach(e=>{let n=this.equipmentMap.get(this.getGraphicEquipment(e)),r=this.bmap.createGraphicPoi(e,{icon:n==null?void 0:n.equipment_icon,built_in:!0,icon_size:[14,14]});r&&(r.userData.data=n,r.userData.type="equipment")})}dispose(){var t;this.bmap.removeEventListener(ht.SWITCH_FLOOR_AFTER,this.onSwitchFloor),Array.from(((t=this.bmap.context.currentFloor)==null?void 0:t.poiLayer.pois)||[]).forEach(e=>{if(e.userData.type==="equipment"){var n;(n=this.bmap.context.currentFloor)==null||n.poiLayer.removePoi(e)}}),super.dispose()}constructor(t){super(t),this.equipmentList=[],this.equipmentMap=new Map,this.onSwitchFloor=e=>{let{data:{graphics:n}}=e;this.equipmentList.length&&this.changeGraphicToEquipment(n)},this.fetchEquipment(),this.bmap.addEventListener(ht.SWITCH_FLOOR_AFTER,this.onSwitchFloor)}};var gtt=f(ti(),1),mtt=f(Bt(),1),_tt=f(P(),1),vtt=f(Fc(),1);var RQ=f(P(),1),PQ=f(U(),1);import{Mesh as BG,Object3D as zG,TextureLoader as GG,Color as kG,Vector2 as Hc,Vector3 as VG,NormalBlending as HG,RepeatWrapping as WG}from"three";var cQ=f(Bl(),1),hQ=f(hi(),1),pQ=f(pi(),1),fQ=f(di(),1),dQ=f(gi(),1),gQ=f(mi(),1),mQ=f(vi(),1),_Q=f(yi(),1),vQ=f(xi(),1),yQ=f(Ei(),1),xQ=f(Si(),1),EQ=f(bi(),1),SQ=f(Mi(),1),bQ=f(Ti(),1),MQ=f(Ai(),1),wQ=f(U(),1),TQ=f(Ac(),1);import{BufferGeometry as IG,Matrix4 as _3,Vector3 as Dn,Ray as LG,Sphere as NG,LineSegments as OG,BufferAttribute as _n,ShaderChunk as Lt,ShaderMaterial as v3,UniformsLib as DG,Color as UG,Vector2 as m3}from"three";var yt=class extends IG{constructor(){super(),this.isMeshLine=!0,this.type="MeshLine",this.positions=[],this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[],this.counters=[],this._points=[],this._geom=null,this.widthCallback=null,this.matrixWorld=new _3,Object.defineProperties(this,{geometry:{enumerable:!0,get:function(){return this}},geom:{enumerable:!0,get:function(){return this._geom},set:function(t){this.setGeometry(t,this.widthCallback)}},points:{enumerable:!0,get:function(){return this._points},set:function(t){this.setPoints(t,this.widthCallback)}}})}};yt.prototype.setMatrixWorld=function(i){this.matrixWorld=i};yt.prototype.setGeometry=function(i,t){this._geometry=i,this.setPoints(i.getAttribute("position").array,t)};yt.prototype.setPoints=function(i,t){if(!(i instanceof Float32Array)&&!(i instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=i,this.widthCallback=t,this.positions=[],this.counters=[],i.length&&i[0]instanceof Dn)for(var e=0;e<i.length;e++){var n=i[e],r=e/i.length;this.positions.push(n.x,n.y,n.z),this.positions.push(n.x,n.y,n.z),this.counters.push(r),this.counters.push(r)}else for(var e=0;e<i.length;e+=3){var r=e/i.length;this.positions.push(i[e],i[e+1],i[e+2]),this.positions.push(i[e],i[e+1],i[e+2]),this.counters.push(r),this.counters.push(r)}this.process()};function FG(i,t){var e=new _3,n=new LG,r=new NG,o=new Dn,s=this.geometry;if(s.boundingSphere||s.computeBoundingSphere(),r.copy(s.boundingSphere),r.applyMatrix4(this.matrixWorld),i.ray.intersectSphere(r,o)!==!1){e.copy(this.matrixWorld).invert(),n.copy(i.ray).applyMatrix4(e);var a=new Dn,u=new Dn,l=new Dn,c=this instanceof OG?2:1,h=s.index,p=s.attributes;if(h!==null)for(var d=h.array,m=p.position.array,_=p.width.array,v=0,x=d.length-1;v<x;v+=c){var M=d[v],b=d[v+1];a.fromArray(m,M*3),u.fromArray(m,b*3);var C=_[Math.floor(v/3)]!==void 0?_[Math.floor(v/3)]:1,w=i.params.Line.threshold+this.material.lineWidth*C/2,I=w*w,A=n.distanceSqToSegment(a,u,o,l);if(!(A>I)){o.applyMatrix4(this.matrixWorld);var R=i.ray.origin.distanceTo(o);R<i.near||R>i.far||(t.push({distance:R,point:l.clone().applyMatrix4(this.matrixWorld),index:v,face:null,faceIndex:null,object:this}),v=x)}}}}yt.prototype.raycast=FG;yt.prototype.compareV3=function(i,t){var e=i*6,n=t*6;return this.positions[e]===this.positions[n]&&this.positions[e+1]===this.positions[n+1]&&this.positions[e+2]===this.positions[n+2]};yt.prototype.copyV3=function(i){var t=i*6;return[this.positions[t],this.positions[t+1],this.positions[t+2]]};yt.prototype.getDistance=function(i){let t=0;for(let e=0;e<i;e++){let n=6*e,r=new Dn(this.positions[n],this.positions[n+1],this.positions[n+2]),o=new Dn(this.positions[n+6],this.positions[n+7],this.positions[n+8]),s=r.distanceTo(o);t+=s}return t};yt.prototype.process=function(){var i=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var t;let e=this.getDistance(i-1);var n;this.compareV3(0,i-1)?n=this.copyV3(i-2):n=this.copyV3(0),this.previous.push(n[0],n[1],n[2]),this.previous.push(n[0],n[1],n[2]);for(var r=0;r<i;r++){if(this.side.push(1),this.side.push(-1),this.widthCallback?t=this.widthCallback(r/(i-1)):t=1,this.width.push(t),this.width.push(t),r===0)this.uvs.push(0,0),this.uvs.push(0,1);else if(r===i-1)this.uvs.push(1,0),this.uvs.push(1,1);else{let s=this.getDistance(r)/e;this.uvs.push(s,0),this.uvs.push(s,1)}if(r<i-1){n=this.copyV3(r),this.previous.push(n[0],n[1],n[2]),this.previous.push(n[0],n[1],n[2]);var o=r*2;this.indices_array.push(o,o+1,o+2),this.indices_array.push(o+2,o+1,o+3)}r>0&&(n=this.copyV3(r),this.next.push(n[0],n[1],n[2]),this.next.push(n[0],n[1],n[2]))}this.compareV3(i-1,0)?n=this.copyV3(1):n=this.copyV3(i-1),this.next.push(n[0],n[1],n[2]),this.next.push(n[0],n[1],n[2]),!this._attributes||this._attributes.position.count!==this.positions.length?this._attributes={position:new _n(new Float32Array(this.positions),3),previous:new _n(new Float32Array(this.previous),3),next:new _n(new Float32Array(this.next),3),side:new _n(new Float32Array(this.side),1),width:new _n(new Float32Array(this.width),1),uv:new _n(new Float32Array(this.uvs),2),index:new _n(new Uint16Array(this.indices_array),1),counters:new _n(new Float32Array(this.counters),1)}:(this._attributes.position.copyArray(new Float32Array(this.positions)),this._attributes.position.needsUpdate=!0,this._attributes.previous.copyArray(new Float32Array(this.previous)),this._attributes.previous.needsUpdate=!0,this._attributes.next.copyArray(new Float32Array(this.next)),this._attributes.next.needsUpdate=!0,this._attributes.side.copyArray(new Float32Array(this.side)),this._attributes.side.needsUpdate=!0,this._attributes.width.copyArray(new Float32Array(this.width)),this._attributes.width.needsUpdate=!0,this._attributes.uv.copyArray(new Float32Array(this.uvs)),this._attributes.uv.needsUpdate=!0,this._attributes.index.copyArray(new Uint16Array(this.indices_array)),this._attributes.index.needsUpdate=!0),this.setAttribute("position",this._attributes.position),this.setAttribute("previous",this._attributes.previous),this.setAttribute("next",this._attributes.next),this.setAttribute("side",this._attributes.side),this.setAttribute("width",this._attributes.width),this.setAttribute("uv",this._attributes.uv),this.setAttribute("counters",this._attributes.counters),this.setIndex(this._attributes.index),this.computeBoundingSphere(),this.computeBoundingBox()};function Vc(i,t,e,n,r){var o;if(i=i.subarray||i.slice?i:i.buffer,e=e.subarray||e.slice?e:e.buffer,i=t?i.subarray?i.subarray(t,r&&t+r):i.slice(t,r&&t+r):i,e.set)e.set(i,n);else for(o=0;o<i.length;o++)e[o+n]=i[o];return e}yt.prototype.advance=function(i){var t=this._attributes.position.array,e=this._attributes.previous.array,n=this._attributes.next.array,r=t.length;Vc(t,0,e,0,r),Vc(t,6,t,0,r-6),t[r-6]=i.x,t[r-5]=i.y,t[r-4]=i.z,t[r-3]=i.x,t[r-2]=i.y,t[r-1]=i.z,Vc(t,6,n,0,r-6),n[r-6]=i.x,n[r-5]=i.y,n[r-4]=i.z,n[r-3]=i.x,n[r-2]=i.y,n[r-1]=i.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0};Lt.meshline_vert=["",Lt.logdepthbuf_pars_vertex,Lt.fog_pars_vertex,"","attribute vec3 previous;","attribute vec3 next;","attribute float side;","attribute float width;","attribute float counters;","","uniform vec2 resolution;","uniform float lineWidth;","uniform vec3 color;","uniform float opacity;","uniform float sizeAttenuation;","","varying vec2 vUV;","varying vec4 vColor;","varying float vCounters;","","vec2 fix( vec4 i, float aspect ) {",""," vec2 res = i.xy / i.w;"," res.x *= aspect;"," vCounters = counters;"," return res;","","}","","void main() {",""," float aspect = resolution.x / resolution.y;",""," vColor = vec4( color, opacity );"," vUV = uv;",""," mat4 m = projectionMatrix * modelViewMatrix;"," vec4 finalPosition = m * vec4( position, 1.0 );"," vec4 prevPos = m * vec4( previous, 1.0 );"," vec4 nextPos = m * vec4( next, 1.0 );",""," vec2 currentP = fix( finalPosition, aspect );"," vec2 prevP = fix( prevPos, aspect );"," vec2 nextP = fix( nextPos, aspect );",""," float w = lineWidth * width;",""," vec2 dir;"," if( nextP == currentP ) dir = normalize( currentP - prevP );"," else if( prevP == currentP ) dir = normalize( nextP - currentP );"," else {"," vec2 dir1 = normalize( currentP - prevP );"," vec2 dir2 = normalize( nextP - currentP );"," dir = normalize( dir1 + dir2 );",""," vec2 perp = vec2( -dir1.y, dir1.x );"," vec2 miter = vec2( -dir.y, dir.x );"," //w = clamp( w / dot( miter, perp ), 0., 4. * lineWidth * width );",""," }",""," //vec2 normal = ( cross( vec3( dir, 0. ), vec3( 0., 0., 1. ) ) ).xy;"," vec4 normal = vec4( -dir.y, dir.x, 0., 1. );"," normal.xy *= .5 * w;"," normal *= projectionMatrix;"," if( sizeAttenuation == 0. ) {"," normal.xy *= finalPosition.w;"," normal.xy /= ( vec4( resolution, 0., 1. ) * projectionMatrix ).xy;"," }",""," finalPosition.xy += normal.xy * side;",""," gl_Position = finalPosition;","",Lt.logdepthbuf_vertex,Lt.fog_vertex&&" vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",Lt.fog_vertex,"}"].join(`
3912
3912
  `);Lt.meshline_frag=["",Lt.fog_pars_fragment,Lt.logdepthbuf_pars_fragment,"","uniform sampler2D map;","uniform sampler2D alphaMap;","uniform float useMap;","uniform float useAlphaMap;","uniform float useDash;","uniform float dashArray;","uniform float dashOffset;","uniform float dashRatio;","uniform float visibility;","uniform float alphaTest;","uniform vec2 repeat;","uniform float thresholdRatio;","","varying vec2 vUV;","varying vec4 vColor;","varying float vCounters;","","void main() {","",Lt.logdepthbuf_fragment,""," vec4 c = vColor;"," if( useMap == 1. ) c *= texture2D( map, vUV * repeat );"," if( useAlphaMap == 1. ) c.a *= texture2D( alphaMap, vUV * repeat ).a;"," if( c.a < alphaTest ) discard;"," if( useDash == 1. ){"," c.a *= ceil(mod(vCounters + dashOffset, dashArray) - (dashArray * dashRatio));"," }"," gl_FragColor = c;"," gl_FragColor.a *= step(vCounters, visibility);","",Lt.fog_fragment,"if (vUV.x <= thresholdRatio) {","gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);","}","}"].join(`
3913
3913
  `);var Un=class extends v3{constructor(t){super({uniforms:Object.assign({},DG.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new UG(16777215)},opacity:{value:1},resolution:{value:new m3(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new m3(1,1)},thresholdRatio:{value:0},transparent:{value:!0},depthTest:{vale:!1},depthWrite:{value:!1}}),vertexShader:Lt.meshline_vert,fragmentShader:Lt.meshline_frag}),this.isMeshLineMaterial=!0,this.type="MeshLineMaterial",Object.defineProperties(this,{lineWidth:{enumerable:!0,get:function(){return this.uniforms.lineWidth.value},set:function(e){this.uniforms.lineWidth.value=e}},map:{enumerable:!0,get:function(){return this.uniforms.map.value},set:function(e){this.uniforms.map.value=e}},useMap:{enumerable:!0,get:function(){return this.uniforms.useMap.value},set:function(e){this.uniforms.useMap.value=e}},alphaMap:{enumerable:!0,get:function(){return this.uniforms.alphaMap.value},set:function(e){this.uniforms.alphaMap.value=e}},useAlphaMap:{enumerable:!0,get:function(){return this.uniforms.useAlphaMap.value},set:function(e){this.uniforms.useAlphaMap.value=e}},color:{enumerable:!0,get:function(){return this.uniforms.color.value},set:function(e){this.uniforms.color.value=e}},opacity:{enumerable:!0,get:function(){return this.uniforms.opacity.value},set:function(e){this.uniforms.opacity.value=e}},resolution:{enumerable:!0,get:function(){return this.uniforms.resolution.value},set:function(e){this.uniforms.resolution.value.copy(e)}},sizeAttenuation:{enumerable:!0,get:function(){return this.uniforms.sizeAttenuation.value},set:function(e){this.uniforms.sizeAttenuation.value=e}},dashArray:{enumerable:!0,get:function(){return this.uniforms.dashArray.value},set:function(e){this.uniforms.dashArray.value=e,this.useDash=e!==0?1:0}},dashOffset:{enumerable:!0,get:function(){return this.uniforms.dashOffset.value},set:function(e){this.uniforms.dashOffset.value=e}},dashRatio:{enumerable:!0,get:function(){return this.uniforms.dashRatio.value},set:function(e){this.uniforms.dashRatio.value=e}},useDash:{enumerable:!0,get:function(){return this.uniforms.useDash.value},set:function(e){this.uniforms.useDash.value=e}},visibility:{enumerable:!0,get:function(){return this.uniforms.visibility.value},set:function(e){this.uniforms.visibility.value=e}},alphaTest:{enumerable:!0,get:function(){return this.uniforms.alphaTest.value},set:function(e){this.uniforms.alphaTest.value=e}},repeat:{enumerable:!0,get:function(){return this.uniforms.repeat.value},set:function(e){this.uniforms.repeat.value.copy(e)}},thresholdRatio:{enumerable:!0,get:function(){return this.uniforms.thresholdRatio.value},set:function(e){this.uniforms.thresholdRatio.value=e}}}),this.setValues(t)}};Un.prototype.copy=function(i){return v3.prototype.copy.call(this,i),this.lineWidth=i.lineWidth,this.map=i.map,this.useMap=i.useMap,this.alphaMap=i.alphaMap,this.useAlphaMap=i.useAlphaMap,this.color.copy(i.color),this.opacity=i.opacity,this.resolution.copy(i.resolution),this.sizeAttenuation=i.sizeAttenuation,this.dashArray.copy(i.dashArray),this.dashOffset.copy(i.dashOffset),this.dashRatio.copy(i.dashRatio),this.useDash=i.useDash,this.visibility=i.visibility,this.alphaTest=i.alphaTest,this.repeat.copy(i.repeat),this};var y3={texture_url:Hs,lineWidth:10,color:16777215},Aa=class extends zG{registryEvent(){this.navigation.bmap.context.addEventListener("control-change",this.onControlChange),this.navigation.bmap.context.addEventListener("update",this.onUpdate),this.navigation.bmap.context.addEventListener("resize",this.onResize)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("control-change",this.onControlChange),this.navigation.bmap.context.removeEventListener("update",this.onUpdate),this.navigation.bmap.context.removeEventListener("resize",this.onResize)}getRepeat(){let{points:t,navigation:{bmap:{context:{camera:e,clientSize:{width:n,height:r}}}}}=this,o=t.map(a=>{let[u,l]=a;return L(new VG(u,l,0),e,n,r)}).map(a=>{let{x:u,y:l}=a;return[u,l]});return Rt(o)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new Hc(t,1)}loadTexture(t){return new Promise((e,n)=>{new GG().load(t,e,void 0,n)})}transformPoints(t){let e=[];for(let n=0;n<t.length;n++)e.push(...t[n],0);return e}updatePoints(t){this.points=t,this.changeRepeat();let e=this.transformPoints(t);this.geometry&&this.geometry.setPoints(e)}movePath(t){this.material&&(this.material.thresholdRatio=t)}create(t){return E(this,null,function*(){let e=this.geometry=new yt;if(this.updatePoints(t),!this.texture){let o=this.texture=yield this.loadTexture(this.config.texture_url);o.wrapS=o.wrapT=WG}let n=this.material=new Un({useMap:!0,color:new kG(this.config.color),transparent:!0,resolution:new Hc(this.navigation.bmap.context.clientSize.width,this.navigation.bmap.context.clientSize.height),depthTest:!1,sizeAttenuation:!1,lineWidth:this.config.lineWidth*2,map:this.texture,blending:HG,repeat:new Hc(this.getRepeat(),1)}),r=this.mesh=new BG(e,n);return r.renderOrder=99999,this.add(r),r})}dispose(){var t,e,n;this.unRegistryEvent(),this.clear(),(t=this.geometry)==null||t.dispose(),(e=this.material)==null||e.dispose(),(n=this.texture)==null||n.dispose(),this.navigation=null}constructor(t,e){super(),this.navigation=t,this.mesh=null,this.geometry=null,this.material=null,this.texture=null,this.config=y3,this.points=[],this.basicRepeat=1,this.prevCameraZoom=0,this.onControlChange=()=>{let n=this.navigation.bmap.context.camera.zoom;n!==this.prevCameraZoom&&(this.prevCameraZoom=n,this.changeRepeat())},this.onUpdate=()=>{this.texture},this.onResize=()=>{if(this.material){let{width:n,height:r}=this.navigation.bmap.context.clientSize;this.material.resolution.set(n,r)}},this.config=Object.assign({},y3,e),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}};import{Tween as Wc,Easing as nk}from"@tweenjs/tween.js";import{Vector2 as rk,Vector3 as ce}from"three";var BQ=f(Zs(),1),zQ=f(P(),1),GQ=f(U(),1);import{EventDispatcher as qG,Vector2 as XG}from"three";import{Tween as jG}from"@tweenjs/tween.js";import{throttle as YG}from"lodash";import{booleanPointInPolygon as KG,point as ZG,polygon as $G}from"@turf/turf";var JG={offsetDistance:15,offsetToResetTime:3e3,directionEmitThreshold:5,simulationSpeed:1},Ca=class extends qG{get curRoutePath(){return this.paths[this.routeIndex]||null}get curRoutePathPoints(){var t;return((t=this.curRoutePath)==null?void 0:t.points)||[]}registryEvent(){this.navigation.bmap.context.addEventListener("update",this.onUpdate),this.navigation.addEventListener("add-path",this.onAddPaths)}unRegistryEvent(){this.navigation.bmap.context.removeEventListener("update",this.onUpdate),this.navigation.removeEventListener("add-path",this.onAddPaths)}setRoadData(t){this.roadData=t}resetStatus(t){this.offset=!1,this.reset=!1,this.routeIndex=0,this.pointIndex=0,this.resetTimer&&(this.timer.clearTimeout(this.resetTimer),this.resetTimer=null),t.length&&(this.position=t[0].points[0])}emitNavigationStatus(){let t=this.getNavigationInfo();t&&this.dispatchEvent({type:"navigation-info",info:t})}adsorb(t,e){let{curRoutePathPoints:n,position:r,curRoutePath:o,paths:s,routeIndex:a}=this;if(!n.length)return null;let u=n,l=this.paths[this.routeIndex].floor,c=this.getCurRouteRemainDistance();if(r){let v=Oe(n,r);u=u.slice(v+1),u.unshift(r)}let h=[{floor:o==null?void 0:o.floor,points:u},...s.slice(a+1)],{distance:p,closestPoint:d,index:m,i:_}=h.reduce((v,x,M)=>{if(x.floor!==t)return v;let{distance:b,closestPoint:C,index:w}=x.points.reduce((I,A,R,B)=>{if(!B[R+1])return S({},I,{distance:I.distance===1/0?G(A,e):I.distance});let{distance:H,closestPoint:k}=__(e,A,B[R+1]);if(l===t){let lt=[e,...B.slice(R+1)],xt=Rt(lt);if(c-xt>10)return I}return H<I.distance?{distance:H,closestPoint:k,index:R}:I},{distance:1/0,closestPoint:x.points[0],index:0});return b<v.distance?{distance:b,closestPoint:C,index:M,i:w}:v},{distance:1/0,closestPoint:u[0],index:0,i:0});return{distance:p,closestPoint:d,routeIndex:m+a,pointIndex:m===0?_+this.pointIndex:_}}toPosition(t,e){let n=this.adsorb(t,e);if(!n)return;let{distance:r,closestPoint:o,routeIndex:s,pointIndex:a}=n;r>this.options.offsetDistance?(this.offset=!0,this.resetTimer||(this.resetTimer=this.timer.setTimeout(()=>{this.reset=!0,this.resetTimer=null},this.options.offsetToResetTime))):(this.offset=!1,this.reset=!1,this.resetTimer&&(this.timer.clearTimeout(this.resetTimer),this.resetTimer=null)),this.routeIndex=s,this.pointIndex=a,this.position=o,this.emitNavigationStatus()}startSimulation(){this.resetStatus(this.paths),this.emitNavigationStatus(),this.startCurRouteSimulation()}pause(){var t;this.tweenUtil.clear(),(t=this.throttleUpdatePosition)==null||t.cancel(),this.paused=!0}continue(){this.paused=!1,this.startCurRouteSimulation()}startCurRouteSimulation(){return E(this,null,function*(){let{curRoutePath:t}=this;if(!t)return;this.simulationTween&&this.tweenUtil.remove(this.simulationTween);let e=[];return new Promise(n=>{let r=[this.position,...this.curRoutePathPoints.slice(this.pointIndex+1)],o=this.getCurRouteRemainDistance(),s=o/this.options.simulationSpeed,a=this.throttleUpdatePosition=YG(l=>{let c=er(r,l.distance);c&&(e.push({floor:t.floor,pos:c}),this.toPosition(t.floor,c))},100),u=this.simulationTween=new jG({distance:0},this.tweenUtil.group).to({distance:o},s*1e3).onUpdate(a).onComplete(()=>{this.tweenUtil.remove(u),a.flush(),a.cancel(),this.routeIndex+1<this.paths.length?(this.routeIndex++,this.position=this.paths[this.routeIndex].points[0],this.pointIndex=0,setTimeout(()=>{n(this.startCurRouteSimulation())},3e3)):(n(!0),console.log(e,this.routeIndex,this.paths))}).start()})})}changeSimulationSpeed(t){this.options.simulationSpeed=t,this.paused||this.startCurRouteSimulation()}getCurRouteRemainDistance(){let{curRoutePathPoints:t,pointIndex:e,position:n}=this;if(!t.length)return 0;let r=[n,...t.slice(e+1)];return Rt(r)}getCurRouteToStartDistance(){let{curRoutePathPoints:t,pointIndex:e,position:n}=this;if(!t.length)return 0;let r=[...t.slice(0,e+1),n];return Rt(r)}getRemainDistance(){let t=this.getCurRouteRemainDistance();return{total:this.paths.slice(this.routeIndex+1).reduce((r,o)=>r+o.distance,0)+t,curRoute:t}}getNextDirDistance(){var t;if(!this.position)return null;let{pointIndex:e,curRoutePathPoints:n,position:r,curRoutePath:o}=this,s=e,a=Ue.FRONT,u=(o==null||(t=o.pointInfos[s])==null?void 0:t.crossName)||"",l=0,c=0,h=0;for(;a===Ue.FRONT&&s<=n.length;){let m=n[s],_=n[s+1],v=n[s+2];if(!m||!_)a=Ue.END;else if(l+=G(m,_),!v)a=Ue.END;else{a=S0(m,_,v),c=Bo(m,_,v),h=(new XG(v[0]-_[0],v[1]-_[1]).angle()*180/Math.PI-90+360)%360;var p;u=(p=o==null?void 0:o.pointInfos[s+1].crossName)!=null?p:"",s+=1}}if(n[s]&&(l=G(r,n[s])),a===Ue.END&&l<=this.options.directionEmitThreshold)return{dir:a,distance:l,crossName:u,angle:c,nextAngle:h};let d=this.getCurRouteToStartDistance();return e===0&&d<=5?{dir:Ue.START,distance:l,crossName:u,angle:c,nextAngle:h}:(l>=this.options.directionEmitThreshold&&(a=Ue.FRONT),{dir:a,distance:l,crossName:u,angle:c,nextAngle:h})}getCurPointAreaInfo(){let t=this.roadData.find(e=>e.floor===this.paths[this.routeIndex].floor);if(t){let e=(t.areas||[]).find(n=>{let r=$G(n.cds),o=ZG(this.position);return KG(o,r)});if(e)return e}return{imageUrl:null}}getNavigationInfo(){let{total:t,curRoute:e}=this.getRemainDistance(),n=this.getNextDirDistance();if(!n)return null;let{dir:r,distance:o,crossName:s,angle:a,nextAngle:u}=n;e<=10&&(r=Ue.END);let{imageUrl:l}=this.getCurPointAreaInfo();return{distance:t,curRouteDistance:e,nextDirDistance:o,dir:r,angle:a,nextAngle:u,pos:this.position,routeIndex:this.routeIndex,crossName:s,offset:this.offset,reset:this.reset,imageUrl:l}}dispose(){this.timer.dispose(),this.unRegistryEvent(),this.tweenUtil.clear(),this.navigation=null}constructor(t,e,n){super(),this.navigation=t,this.offset=!1,this.reset=!1,this.position=[0,0],this.routeIndex=0,this.pointIndex=0,this.paths=[],this.timer=new j,this.resetTimer=null,this.tweenUtil=new an,this.paused=!1,this.onAddPaths=r=>{let{paths:o}=r;this.paths=o,this.resetStatus(o),this.simulationTween&&this.startSimulation()},this.onUpdate=()=>{this.tweenUtil.update()},this.options=Object.assign({},JG,e),this.roadData=n,this.registryEvent()}};var YQ=f(Es(),1),KQ=f(hi(),1),ZQ=f(pi(),1),$Q=f(di(),1),JQ=f(gi(),1),QQ=f(mi(),1),ttt=f(vi(),1),ett=f(yi(),1),ntt=f(xi(),1),rtt=f(Ei(),1),itt=f(Si(),1),ott=f(bi(),1),stt=f(Mi(),1),att=f(Ti(),1),utt=f(Ai(),1),ltt=f(Ul(),1),ctt=f(P(),1);import{DataTexture as QG,LinearFilter as x3,RGBAFormat as E3,Sprite as tk,SpriteMaterial as ek}from"three";var qe=class i extends nt{addDebug(){i.canvas.style.cssText=`
3914
3914
  position: fixed;