@aibee/crc-bmap 0.8.97 → 0.8.99
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.cjs +2 -2
- package/lib/index.esm.min.js +2 -2
- package/lib/index.js +2 -2
- package/lib/index.online.esm.min.js +2 -2
- package/lib/platform/wrapper.cjs +2 -2
- package/lib/platform/wrapper.esm.min.js +2 -2
- package/lib/platform/wrapper.js +2 -2
- package/lib/platform/wrapper.online.esm.min.js +2 -2
- package/lib/src/context/renderer.js +1 -0
- package/lib/src/elements/merge-graphic.d.ts +4 -4
- package/lib/src/elements/merge-graphic.js +3 -3
- package/lib/src/factory/text-texture.js +7 -0
- package/package.json +2 -2
|
@@ -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 Jo(e[0]).convertLinearToSRGB()},uGradualColor:{value:new Jo(e[1]).convertLinearToSRGB()},center:{value:n},maxValue:{value:i},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:i,resolution:o}=t,s=e+"-"+n+"-"+i+"-"+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:i,linewidth:n,worldUnits:!0,dashSize:1,gapSize:3,dashScale:1,resolution:o});return this.line2MaterialMap.set(s,a),a}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()}};X.lineMaterialMap=new Map;X.meshStandardMaterialMap=new Map;X.meshBasicMaterialMap=new Map;X.shaderMaterialMap=new Map;X.line2MaterialMap=new Map;var V5=d(D(),1),H5=d(vs(),1),W5=d(hi(),1),q5=d(pi(),1),X5=d(di(),1),j5=d(gi(),1),Y5=d(mi(),1),K5=d(vi(),1),Z5=d(yi(),1),$5=d(xi(),1),J5=d(Ei(),1),Q5=d(Si(),1),tY=d(bi(),1),eY=d(Mi(),1),nY=d(Ti(),1),rY=d(Ai(),1),iY=d(Ol(),1),oY=d(A(),1);import{DataTexture as Ci,LinearFilter as we,RGBAFormat as Ri}from"three";function Dl(){let r=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.40.0",mode:za?"pure":"global",copyright:"\\xA9 2014-2025 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.40.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(r),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),i=Qn(S({},n,{text:t}));if(this.cacheMap.has(i))return this.cacheMap.get(i);let o=this.getCanvas(),s=this.getCtx();s.clearRect(0,0,o.width,o.height),this.setCtxStyle(n);let a=Jr(t)?4:8;n.lineWidth&&s.strokeText(t,2,a),s.fillText(t,2,a);let u=Math.ceil(s.measureText(t).width);u=u%2===0?u:u+1,u+=2;let l=s.getImageData(0,0,u,64),c=new Ci(l.data,u,n.height,Ri);return c.flipY=!0,c.minFilter=we,c.magFilter=we,this.cacheMap.set(i,c),c}static lazyGetTextureByTexts(t,e){return x(this,null,function*(){let n=this.getMergedOptions(e),i=n.height;return n.height=Math.min(i*t.length,2048),window.OffscreenCanvas?(console.log("use webworker"),this.getTextsByWorker(t,n,i)):typeof window.requestIdleCallback=="function"?(console.log("use browser idle"),this.getTextsByBrowserIdle(t,n,i)):(console.log("use sync text textures"),this.getTextsSync(t,n,i))})}static getTextsByWorker(t,e,n){return x(this,null,function*(){return this.textTextureWorker||(this.textTextureWorker=Dl()),(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 x(this,null,function*(){let i=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={},f=()=>x(this,null,function*(){let _=u.getImageData(0,0,e.width,n+h);l.push({imageData:_,offsetMap:p,height:n+h});let y=l.reduce((E,M)=>{let w=new Ci(M.imageData.data,e.width,M.height,Ri);return w.flipY=!0,w.minFilter=we,w.magFilter=we,Object.keys(M.offsetMap).forEach(P=>{E[P]=S({},M.offsetMap[P],{texture:w})}),E},{});s(y)}),m=_=>{if(i>=o)return f();if(_.timeRemaining()>0){let y=t[i],E=Math.ceil(u.measureText(y).width);if(E=E%2===0?E:E+1,E+=2,E+c>e.width&&(c=0,h+=n,n+h>e.height)){let w=u.getImageData(0,0,e.width,h);l.push({imageData:w,offsetMap:p,height:h}),h=0,u.clearRect(0,0,e.width,e.height),p={}}let M=Jr(y)?4:8;if(e.lineWidth&&u.strokeText(y,2+c,M+h),u.fillText(y,2+c,M+h),p[y]={width:E,height:n,x:c,y:h},c+=E,++i>=o)return f();_.timeRemaining()>0?m(_):this.timer.requestIdleCallback(m)}else this.timer.requestIdleCallback(m)};this.timer.requestIdleCallback(m)})})}static getTextsSync(t,e,n){let i=this.getCanvas(),o=this.getCtx();o.clearRect(0,0,i.width,i.height),this.setCtxStyle(e);let s=[],a=0,u=0,l={};t.forEach(p=>{let f=Math.ceil(o.measureText(p).width);if(f=f%2===0?f:f+1,f+=2,f+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=Jr(p)?4:8;e.lineWidth&&o.strokeText(p,2+a,m+u),o.fillText(p,2+a,m+u),l[p]={width:f,height:n,x:a,y:u},a+=f});let c=o.getImageData(0,0,e.width,n+u);return s.push({data:c.data,offsetMap:l,height:u+n}),s.reduce((p,f)=>{let m=new Ci(f.data,e.width,f.height,Ri);return m.flipY=!0,m.minFilter=we,m.magFilter=we,Object.keys(f.offsetMap).forEach(_=>{p[_]=S({},f.offsetMap[_],{texture:m})}),p},{})}static getTextureByTexts(t,e){let n=this.getMergedOptions(e),i=n.height;n.height=Math.min(i*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 f=Math.ceil(s.measureText(p).width);f=f%2===0?f:f+1,f+=2,f+a>n.width&&(a=0,u+=i);let m=Jr(p)?4:8;n.lineWidth&&s.strokeText(p,2+a,m+u),s.fillText(p,2+a,m+u),l[p]={width:f,height:i,x:a,y:u},a+=f});let c=s.getImageData(0,0,n.width,i+u),h=new Ci(Uint8Array.from(c.data),n.width,i+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.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 W;tt.options={width:2048,height:64,font:"54px sans-serif",textBaseline:"hanging",lineWidth:8,fillStyle:"rgba(0,0,0,1)",strokeStyle:"white"};var hY=d(A(),1);import{LinearFilter as bs,RGBAFormat as G2,Texture as HO,TextureLoader as WO}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=G2,n.magFilter=bs,n.minFilter=bs,n.colorSpace="srgb",this.urlTextureMap.set(t,n)}),this.urlTextureMap.set(t,e),e}static getUrlTextureBorder(t,e,n){let i=t+"-"+n.width+"-"+n.color;if(this.borderUrlTextureMap.has(i))return Promise.resolve(this.borderUrlTextureMap.get(i));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 HO(u);return h.format=G2,h.magFilter=bs,h.minFilter=bs,h.colorSpace="srgb",h.needsUpdate=!0,this.borderUrlTextureMap.set(i,h),h});return this.borderUrlTextureMap.set(i,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 WO;ut.urlTextureMap=new Map;ut.borderUrlTextureMap=new Map;ut.canvas=document.createElement("canvas");ut.ctx=ut.canvas.getContext("2d",{willReadFrequently:!0});var U8=d(A(),1);import{GLTFLoader as IF}from"three/examples/jsm/loaders/GLTFLoader";var t8=d(A(),1),e8=d(Mn(),1),n8=d(a0(),1),r8=d(Ul(),1),i8=d(hi(),1),o8=d(pi(),1),s8=d(di(),1),a8=d(gi(),1),u8=d(mi(),1),l8=d(vi(),1),c8=d(yi(),1),h8=d(xi(),1),p8=d(Ei(),1),f8=d(Si(),1),d8=d(bi(),1),g8=d(Mi(),1),m8=d(Ti(),1),_8=d(Ai(),1),v8=d(D(),1),y8=d(u6(),1),x8=d(l6(),1),E8=d(vc(),1),S8=d(xc(),1),b8=d(Sc(),1),M8=d(Mc(),1),w8=d(qn(),1),T8=d(m6(),1),A8=d(_6(),1),C8=d(v6(),1),R8=d(y6(),1),P8=d(vs(),1),I8=d(wc(),1);var wF=()=>(E6(),l1(x6)),{ParkingTypeIconMap:Tc,ManGlb:S6,Arrow:Gs,DracoDecoderJs:b6,DracoDecoderWasm:M6,DracoWasmWrapperJs:w6,RoyalEsplanade1k:T6}=wF();import{BufferAttribute as A6,BufferGeometry as TF,Color as AF,FileLoader as C6,Loader as CF,LinearSRGBColorSpace as RF,SRGBColorSpace as R6}from"three";var Ac=new WeakMap,ks=class extends CF{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,i){let o=new C6(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,i)},n,i)}parse(t,e,n){n===void 0&&(n=()=>{}),this.decodeDracoFile(t,e,null,null,R6).catch(n)}decodeDracoFile(t,e,n,i,o,s){o===void 0&&(o=RF),s===void 0&&(s=()=>{});let a={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!n,vertexColorSpace:o};return this.decodeGeometry(t,a).then(e).catch(s)}decodeGeometry(t,e){let n=JSON.stringify(e);if(Ac.has(t)){let u=Ac.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 i,o=this.workerNextTaskID++,s=t.byteLength,a=this._getWorker(o,s).then(u=>(i=u,new Promise((l,c)=>{i._callbacks[o]={resolve:l,reject:c},i.postMessage({type:"decode",id:o,taskConfig:e,buffer:t},[t])}))).then(u=>this._createGeometry(u.geometry));return a.catch(()=>!0).then(()=>{i&&o&&this._releaseTask(i,o)}),Ac.set(t,{key:n,promise:a}),a}_createGeometry(t){let e=new TF;t.index&&e.setIndex(new A6(t.index.array,1));for(let n=0;n<t.attributes.length;n++){let i=t.attributes[n],o=i.name,s=i.array,a=i.itemSize,u=new A6(s,a);o==="color"&&(this._assignVertexColorSpace(u,i.vertexColorSpace),u.normalized=!(s instanceof Float32Array)),e.setAttribute(o,u)}return e}_assignVertexColorSpace(t,e){if(e!==R6)return;let n=new AF;for(let i=0,o=t.count;i<o;i++)n.fromBufferAttribute(t,i).convertSRGBToLinear(),t.setXYZ(i,n.r,n.g,n.b)}_loadLibrary(t,e){let n=new C6(this.manager);return n.setPath(this.decoderPath),n.setResponseType(e),n.setWithCredentials(this.withCredentials),new Promise((i,o)=>{n.load(t,i,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(b6,"text")):(e.push(this._loadLibrary(w6,"text")),e.push(this._loadLibrary(M6,"arraybuffer"))),this.decoderPending=Promise.all(e).then(n=>{let i=n[0];t||(this.decoderConfig.wasmBinary=n[1]);let o=PF.toString(),s=["/* draco decoder */",i,"","/* worker */",o.substring(o.indexOf("{")+1,o.lastIndexOf("}"))].join(`
|
|
44
|
+
`],{type:"text/javascript"}),t=URL.createObjectURL(r),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),i=Qn(S({},n,{text:t}));if(this.cacheMap.has(i))return this.cacheMap.get(i);let o=this.getCanvas(),s=this.getCtx();s.clearRect(0,0,o.width,o.height),this.setCtxStyle(n);let a=Jr(t)?4:8;n.lineWidth&&s.strokeText(t,2,a),s.fillText(t,2,a);let u=Math.ceil(s.measureText(t).width);u=u%2===0?u:u+1,u+=2;let l=s.getImageData(0,0,u,64),c=new Ci(l.data,u,n.height,Ri);return c.flipY=!0,c.minFilter=we,c.magFilter=we,this.cacheMap.set(i,c),c}static lazyGetTextureByTexts(t,e){return x(this,null,function*(){let n=this.getMergedOptions(e),i=n.height;return n.height=Math.min(i*t.length,2048),window.OffscreenCanvas?(console.log("use webworker"),this.getTextsByWorker(t,n,i)):typeof window.requestIdleCallback=="function"?(console.log("use browser idle"),this.getTextsByBrowserIdle(t,n,i)):(console.log("use sync text textures"),this.getTextsSync(t,n,i))})}static getTextsByWorker(t,e,n){return x(this,null,function*(){return this.textTextureWorker||(this.textTextureWorker=Dl()),(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 x(this,null,function*(){let i=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={},f=()=>x(this,null,function*(){let _=u.getImageData(0,0,e.width,n+h);l.push({imageData:_,offsetMap:p,height:n+h});let y=l.reduce((E,M)=>{let w=new Ci(M.imageData.data,e.width,M.height,Ri);return w.flipY=!0,w.minFilter=we,w.magFilter=we,Object.keys(M.offsetMap).forEach(P=>{E[P]=S({},M.offsetMap[P],{texture:w})}),E},{});s(y)}),m=_=>{if(i>=o)return f();if(_.timeRemaining()>0){let y=t[i],E=Math.ceil(u.measureText(y).width);if(E=E%2===0?E:E+1,E+=2,E+c>e.width&&(c=0,h+=n,n+h>e.height)){let w=u.getImageData(0,0,e.width,h);l.push({imageData:w,offsetMap:p,height:h}),h=0,u.clearRect(0,0,e.width,e.height),p={}}let M=Jr(y)?4:8;if(e.lineWidth&&u.strokeText(y,2+c,M+h),u.fillText(y,2+c,M+h),p[y]={width:E,height:n,x:c,y:h},c+=E,++i>=o)return f();_.timeRemaining()>0?m(_):this.timer.requestIdleCallback(m)}else this.timer.requestIdleCallback(m)};this.timer.requestIdleCallback(m),this.timer.setTimeout(()=>{i===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 i=this.getCanvas(),o=this.getCtx();o.clearRect(0,0,i.width,i.height),this.setCtxStyle(e);let s=[],a=0,u=0,l={};t.forEach(p=>{let f=Math.ceil(o.measureText(p).width);if(f=f%2===0?f:f+1,f+=2,f+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=Jr(p)?4:8;e.lineWidth&&o.strokeText(p,2+a,m+u),o.fillText(p,2+a,m+u),l[p]={width:f,height:n,x:a,y:u},a+=f});let c=o.getImageData(0,0,e.width,n+u);return s.push({data:c.data,offsetMap:l,height:u+n}),s.reduce((p,f)=>{let m=new Ci(f.data,e.width,f.height,Ri);return m.flipY=!0,m.minFilter=we,m.magFilter=we,Object.keys(f.offsetMap).forEach(_=>{p[_]=S({},f.offsetMap[_],{texture:m})}),p},{})}static getTextureByTexts(t,e){let n=this.getMergedOptions(e),i=n.height;n.height=Math.min(i*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 f=Math.ceil(s.measureText(p).width);f=f%2===0?f:f+1,f+=2,f+a>n.width&&(a=0,u+=i);let m=Jr(p)?4:8;n.lineWidth&&s.strokeText(p,2+a,m+u),s.fillText(p,2+a,m+u),l[p]={width:f,height:i,x:a,y:u},a+=f});let c=s.getImageData(0,0,n.width,i+u),h=new Ci(Uint8Array.from(c.data),n.width,i+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.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 W;tt.options={width:2048,height:64,font:"54px sans-serif",textBaseline:"hanging",lineWidth:8,fillStyle:"rgba(0,0,0,1)",strokeStyle:"white"};var hY=d(A(),1);import{LinearFilter as bs,RGBAFormat as G2,Texture as HO,TextureLoader as WO}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=G2,n.magFilter=bs,n.minFilter=bs,n.colorSpace="srgb",this.urlTextureMap.set(t,n)}),this.urlTextureMap.set(t,e),e}static getUrlTextureBorder(t,e,n){let i=t+"-"+n.width+"-"+n.color;if(this.borderUrlTextureMap.has(i))return Promise.resolve(this.borderUrlTextureMap.get(i));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 HO(u);return h.format=G2,h.magFilter=bs,h.minFilter=bs,h.colorSpace="srgb",h.needsUpdate=!0,this.borderUrlTextureMap.set(i,h),h});return this.borderUrlTextureMap.set(i,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 WO;ut.urlTextureMap=new Map;ut.borderUrlTextureMap=new Map;ut.canvas=document.createElement("canvas");ut.ctx=ut.canvas.getContext("2d",{willReadFrequently:!0});var U8=d(A(),1);import{GLTFLoader as IF}from"three/examples/jsm/loaders/GLTFLoader";var t8=d(A(),1),e8=d(Mn(),1),n8=d(a0(),1),r8=d(Ul(),1),i8=d(hi(),1),o8=d(pi(),1),s8=d(di(),1),a8=d(gi(),1),u8=d(mi(),1),l8=d(vi(),1),c8=d(yi(),1),h8=d(xi(),1),p8=d(Ei(),1),f8=d(Si(),1),d8=d(bi(),1),g8=d(Mi(),1),m8=d(Ti(),1),_8=d(Ai(),1),v8=d(D(),1),y8=d(u6(),1),x8=d(l6(),1),E8=d(vc(),1),S8=d(xc(),1),b8=d(Sc(),1),M8=d(Mc(),1),w8=d(qn(),1),T8=d(m6(),1),A8=d(_6(),1),C8=d(v6(),1),R8=d(y6(),1),P8=d(vs(),1),I8=d(wc(),1);var wF=()=>(E6(),l1(x6)),{ParkingTypeIconMap:Tc,ManGlb:S6,Arrow:Gs,DracoDecoderJs:b6,DracoDecoderWasm:M6,DracoWasmWrapperJs:w6,RoyalEsplanade1k:T6}=wF();import{BufferAttribute as A6,BufferGeometry as TF,Color as AF,FileLoader as C6,Loader as CF,LinearSRGBColorSpace as RF,SRGBColorSpace as R6}from"three";var Ac=new WeakMap,ks=class extends CF{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,i){let o=new C6(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,i)},n,i)}parse(t,e,n){n===void 0&&(n=()=>{}),this.decodeDracoFile(t,e,null,null,R6).catch(n)}decodeDracoFile(t,e,n,i,o,s){o===void 0&&(o=RF),s===void 0&&(s=()=>{});let a={attributeIDs:n||this.defaultAttributeIDs,attributeTypes:i||this.defaultAttributeTypes,useUniqueIDs:!!n,vertexColorSpace:o};return this.decodeGeometry(t,a).then(e).catch(s)}decodeGeometry(t,e){let n=JSON.stringify(e);if(Ac.has(t)){let u=Ac.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 i,o=this.workerNextTaskID++,s=t.byteLength,a=this._getWorker(o,s).then(u=>(i=u,new Promise((l,c)=>{i._callbacks[o]={resolve:l,reject:c},i.postMessage({type:"decode",id:o,taskConfig:e,buffer:t},[t])}))).then(u=>this._createGeometry(u.geometry));return a.catch(()=>!0).then(()=>{i&&o&&this._releaseTask(i,o)}),Ac.set(t,{key:n,promise:a}),a}_createGeometry(t){let e=new TF;t.index&&e.setIndex(new A6(t.index.array,1));for(let n=0;n<t.attributes.length;n++){let i=t.attributes[n],o=i.name,s=i.array,a=i.itemSize,u=new A6(s,a);o==="color"&&(this._assignVertexColorSpace(u,i.vertexColorSpace),u.normalized=!(s instanceof Float32Array)),e.setAttribute(o,u)}return e}_assignVertexColorSpace(t,e){if(e!==R6)return;let n=new AF;for(let i=0,o=t.count;i<o;i++)n.fromBufferAttribute(t,i).convertSRGBToLinear(),t.setXYZ(i,n.r,n.g,n.b)}_loadLibrary(t,e){let n=new C6(this.manager);return n.setPath(this.decoderPath),n.setResponseType(e),n.setWithCredentials(this.withCredentials),new Promise((i,o)=>{n.load(t,i,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(b6,"text")):(e.push(this._loadLibrary(w6,"text")),e.push(this._loadLibrary(M6,"arraybuffer"))),this.decoderPending=Promise.all(e).then(n=>{let i=n[0];t||(this.decoderConfig.wasmBinary=n[1]);let o=PF.toString(),s=["/* draco decoder */",i,"","/* 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 i=new Worker(this.workerSourceURL);i._callbacks={},i._taskCosts={},i._taskLoad=0,i.postMessage({type:"init",decoderConfig:this.decoderConfig}),i.onmessage=function(o){let s=o.data;switch(s.type){case"decode":i._callbacks[s.id].resolve(s);break;case"error":i._callbacks[s.id].reject(s);break;default:console.error('THREE.DRACOLoader: Unexpected message, "'+s.type+'"')}},this.workerPool.push(i)}else this.workerPool.sort(function(i,o){return i._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 PF(){let r,t;onmessage=function(s){let a=s.data;switch(a.type){case"init":r=a.decoderConfig,t=new Promise(function(c){r.onModuleLoaded=function(h){c({draco:h})},DracoDecoderModule(r)});break;case"decode":let u=a.buffer,l=a.taskConfig;t.then(c=>{let h=c.draco,p=new h.Decoder;try{let f=e(h,p,new Int8Array(u),l),m=f.attributes.map(_=>_.array.buffer);f.index&&m.push(f.index.array.buffer),self.postMessage({type:"decode",id:a.id,geometry:f},m)}catch(f){console.error(f),self.postMessage({type:"error",id:a.id,error:f.message})}finally{h.destroy(p)}});break}};function e(s,a,u,l){let c=l.attributeIDs,h=l.attributeTypes,p,f,m=a.GetEncodedGeometryType(u);if(m===s.TRIANGULAR_MESH)p=new s.Mesh,f=a.DecodeArrayToMesh(u,u.byteLength,p);else if(m===s.POINT_CLOUD)p=new s.PointCloud,f=a.DecodeArrayToPointCloud(u,u.byteLength,p);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!f.ok()||p.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+f.error_msg());let _={index:null,attributes:[]};for(let y in c){let E=self[h[y]],M,w;if(l.useUniqueIDs)w=c[y],M=a.GetAttributeByUniqueId(p,w);else{if(w=a.GetAttributeId(p,s[c[y]]),w===-1)continue;M=a.GetAttribute(p,w)}let P=i(s,a,p,y,E,M);y==="color"&&(P.vertexColorSpace=l.vertexColorSpace),_.attributes.push(P)}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 f=new Uint32Array(s.HEAPF32.buffer,p,c).slice();return s._free(p),{array:f,itemSize:1}}function i(s,a,u,l,c,h){let p=h.num_components(),m=u.num_points()*p,_=m*c.BYTES_PER_ELEMENT,y=o(s,c),E=s._malloc(_);a.GetAttributeDataArrayForAllPoints(u,h,y,_,E);let M=new c(s.HEAPF32.buffer,E,m).slice();return s._free(E),{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 St=class{static loadModel(t,e){return x(this,null,function*(){if(e===void 0&&(e=!0),e){if(this.modelMap.has(t)){let i=this.modelMap.get(t);if(i instanceof Promise)i.then(o=>S({},o,{scene:o.scene.clone()}));else return S({},i,{scene:i.scene.clone()})}let n=new Promise((i,o)=>{this.loader.load(t,s=>{this.modelMap.set(t,s),i(s)},void 0,o)});return this.modelMap.set(t,n),n.then(i=>S({},i,{scene:i.scene.clone()}))}else return new Promise((n,i)=>{this.loader.load(t,n,void 0,i)})})}static dispose(){this.modelMap.forEach(t=>{t instanceof Promise?t.then(e=>J(e.scene)):J(t.scene)}),this.modelMap.clear()}};St.dracoLoader=new ks;St.loader=new IF().setDRACOLoader(St.dracoLoader);St.modelMap=new Map;function Cc(){let r=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.40.0",mode:VM?"pure":"global",copyright:"\\xA9 2014-2025 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.40.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&>&&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() {
|
|
@@ -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,i=this.geometry.getAttribute("position");if(i)for(let s=0;s<i.count;s++){let a=i.getZ(s);a>n&&(n=a)}let o=new uz({uniforms:{maxZ:{value:n},uColor:{value:new G6(this.options[0].fillColor).convertLinearToSRGB()},uColor2:{value:new G6(De(this.options[0].fillColor)).convertLinearToSRGB()},uOpacity:{value:this.options[0].fillOpacity}},vertexShader:t,fragmentShader:e,transparent:!0});this.material=o}initLineMaterial(){let t=X.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:i}=n.geometry;for(let o=0;o<i.length;o++){let s=i[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 z6(u[0],u[1],e)),t.push(new z6(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;this.geometry.dispose(),this.material.dispose(),(t=this.line)==null||t.geometry.dispose(),this.clear()}constructor(t,e){super(),this.context=t,this.options=e.map(n=>S({},Rc,n)),this.init()}};var B7=d(A(),1);import{Box2 as Lc,Object3D as lz,Sprite as k6,SpriteMaterial as V6,Vector2 as ra}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},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.options.text_font_size*this.textAspect:0}get textHeight(){return this.hasText?this.options.text_font_size:0}get hasOriginTexture(){let{text_texture:t,text_texture_width:e,text_texture_height:n,text_texture_offset_x:i,text_texture_offset_y:o}=this.options;return!zi(t)&&!zi(e)&&!zi(n)&&!zi(i)&&!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=>x(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 x(this,null,function*(){if(this.options.icon)return this._initIconPromise=new Promise(t=>x(this,null,function*(){let e;if(this.options.icon_border){let{icon:i,icon_size:o,icon_border:s}=this.options;e=yield ut.getUrlTextureBorder(i,o[0]-s.width*2,s)}else e=yield ut.getTextureByUrl(this.options.icon);let n=new k6(new V6({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:i,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(i/t.image.width,o/t.image.height),this.textAspect=i/o}else t=tt.getTextureByText(this.options.text),this.textAspect=t.image.width/t.image.height;let e=new k6(new V6({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,i=0,{icon:o}=this.options;o?this.hasText?(n=0,i=n*(this.iconHeight/this.textHeight)-this.iconHeight/this.textHeight-this.durIconAndText/this.textHeight):(n=.5,i=0):this.hasText?(i=.5,n=0):(n=0,i=0),(t=this.spriteIcon)==null||t.center.set(.5,n),(e=this.spriteText)==null||e.center.set(.5,i)}init(){return x(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,i=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 Lc(new ra(i-s,o-this.iconHeight),new ra(i+s,o)),u=this.textWidth/2,l=new Lc(new ra(i-u,o-this.textHeight-this.durIconAndText-this.iconHeight),new ra(i+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){super(),this.context=t,this.textAspect=1,this.box=new Lc,this._initIconPromise=null,this._initScale=n=>{let{zoom:i}=n;if(this.spriteText){let s=this.textHeight/i;this.spriteText.scale.set(this.textAspect*s,s,.1)}if(this.spriteIcon){var o;(o=this.spriteIcon)==null||o.scale.set(this.options.icon_size[0]/i,this.options.icon_size[1]/i,.1)}this.resetZ()},this.options=Kn(S({},cz,e),this),this.position.set(this.options.position.x,this.options.position.y,this.options.position.z),this.registryEvent(),this.init()}};import{DoubleSide as hz,Matrix4 as H6,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},ia=class extends dz{init(){return x(this,null,function*(){let t=this.options.map(s=>tt.getTextureByText(s.texts[0],{fillStyle:v0(s.fillColor,s.fillOpacity),strokeStyle:v0(s.strokeColor,s.strokeOpacity),lineWidth:6,font:"bold 54px sans-serif"})),e=t.map((s,a)=>{let u=this.options[a],{width:l,height:c}=s.image,h=l/c,p=u.secondHeight*h,f=new gz(p,u.secondHeight),m=new H6().makeTranslation(u.center_x,u.center_y,u.airHeight+u.deltaHeight+u.height).multiply(new H6().makeRotationZ(u.secondRotate));return f.applyMatrix4(m),f}),n=mz(e,!0);e.forEach(s=>s.dispose());let i=t.map(s=>{let a=new fz({map:s,alphaTest:1,side:hz});return s.needsUpdate=!0,a}),o=new pz(n,i);this.mesh=o,this.position.z+=.04,this.add(o)})}dispose(){var t,e;(t=this.mesh)==null||t.geometry.dispose(),((e=this.mesh)==null?void 0:e.material).forEach(n=>n.dispose()),this.clear()}constructor(t,e){super(),this.context=t,this.options=e.map(n=>S({},_z,n)),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:i,height:o}=this.context.clientSize;this.lineMaterial.resolution.set(i,o)},this.onResize(),this.registryEvent(),e&&n&&this.setPosition(e,n)}};import{Frustum as Sz}from"three";var oa=class extends Yt{setEnable(t){super.setEnable(t),dt(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:i}}}=this,o=C(this.startPoint,e,n,i),s=C(this.endPoint,e,n,i),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:i}=this;return((n=i.currentFloor)==null?void 0:n.graphicLayer.children.filter(o=>o instanceof et&&this.searchChildInFrustum(o,t,e)))||[]}searchChildInFrustum(t,e,n){let{context:{camera:i,container:{clientWidth:o,clientHeight:s}}}=this;if(!t)return!1;if(!t.mesh){let p=t.getPosition();if(p){let f=C(p,i,o,s);return en(f,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=C(u,i,o,s),h=C(l,i,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=i=>{if(!this.enable)return;let o=this.getIntersectByPointerEvent(i);o&&(this.startPoint=o),this.endPoint=void 0},this.onPointerMove=i=>{if(!this.enable||!this.startPoint)return;let o=this.getIntersectByPointerEvent(i);o&&(this.endPoint=o)},this.onPointerUp=i=>{if(!this.enable)return;let o=this.getIntersectByPointerEvent(i);o&&(this.endPoint=o),this.doSelect(),this.startPoint=void 0},this.onUpdate=()=>{if(this.startPoint){let i=this.getSvgCoordinate(this.startPoint),o=S({},i);this.endPoint&&(o=this.getSvgCoordinate(this.endPoint));let s={x:Math.min(i.x,o.x),y:Math.min(i.y,o.y)},a=Math.abs(o.x-i.x),u=Math.abs(o.y-i.y);dt(this.rect,s.x,s.y,a,u)}else dt(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 sa=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:i}=e,{x:o,y:s}=this.downPoint;if(Math.sqrt((o-n)**2+(s-i)**2)>3)return;let{graphics:a}=this.context.getGraphicsByDeviceXy(n,i),u=new Set(a.map(c=>c.options.id));this.context.getPoisByDeviceXy(n,i).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))}}),($n?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=>{Jn(e.key)&&this.enableBoxSelection()},this.onKeyUp=e=>{Jn(e.key)&&this.disableBoxSelection()},this.onBoxSelected=e=>{let{list:n}=e;this._list.clear(),n.forEach(i=>{this._list.add(i)}),this.selectEnd()},this.boxSelection=new oa(t),this.boxSelection.setEnable(!1),this.registryEvent()}};var VZ=d(de(),1),HZ=d(ge(),1),WZ=d(me(),1),qZ=d(_e(),1),XZ=d(ve(),1),jZ=d(ye(),1),YZ=d(xe(),1),KZ=d(A(),1);import{EventDispatcher as Mz,Vector2 as wz}from"three";var aa=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 W,this.graphicTimerMap=new Map,this.onPointerMove=e=>{let{graphics:n,pois:i,e:o}=e,s=i.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 f=i.find(m=>m.options.id===p.options.id);if(f instanceof Nn){let{x:m,y:_}=f.clientPos,y=Math.sqrt((m-o.offsetX)**2+(_-o.offsetY)**2);y<h&&(h=y,c=p)}else if(f instanceof nt){let{x:m,y:_}=f.box.getCenter(new wz),y=Math.sqrt((m-o.offsetX)**2+(_-o.offsetY)**2);y<h&&(h=y,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 a$=d(A(),1);import{Box3 as Tz,Vector3 as ua}from"three";var la=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(y=>y instanceof jt).length)return null;let e=this.box,{camera:n,clientSize:{width:i,height:o}}=this.context,{min:s,max:a}=e,u=C(s,n,i,o),l=C(a,n,i,o),c=C(new ua(s.x,a.y,a.z),n,i,o),h=C(new ua(a.x,s.y,s.z),n,i,o),p=Math.min(u.x,l.x,c.x,h.x),f=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:f,top:m,bottom:_}}checkDistanceToScreenEdge(t){let{left:e,right:n,top:i,bottom:o}=t,{width:s,height:a}=this.context.clientSize,[u,l,c,h]=this.context.config.cameraBound.padding,p=n>=h,f=s-e>=l,m=a-i>=c,_=o>=u;return p&&f&&m&&_}dispose(){this.unRegistryEvent()}constructor(t){this.context=t,this.prevCamera={position:new ua,zoom:1,target:new ua},this.enable=!0,this.box=new Tz,this.onCameraChange=()=>{let e=this.getCurFloorScreenPosition();if(e){let{left:n,right:i,top:o,bottom:s}=e;this.checkDistanceToScreenEdge({left:n,right:i,top:o,bottom:s})?this.changePrevCamera():this.backToPrevCamera()}},this.registryEvent(),this.changePrevCamera()}};var S$=d(Dc(),1);import{Vector3 as o3}from"three";import{Tween as da,Group as Yz}from"@tweenjs/tween.js";var v$=d(A(),1),y$=d(D(),1);import{EventDispatcher as Hz,MOUSE as br,Quaternion as r3,Spherical as ha,TOUCH as Mr,Vector2 as Pt,Vector3 as Kt,Plane as Wz,Ray as qz,MathUtils as Xz}from"three";var pa=new qz,i3=new Wz,jz=Math.cos(70*Xz.DEG2RAD),fa=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 Pt,this.rotateLineEnd=new Pt,this.spherical=new ha,this.sphericalDelta=new ha,this.object=t,this.domElement=e,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new Kt,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:br.PAN,MIDDLE:br.DOLLY,RIGHT:br.ROTATE},this.touches={ONE:Mr.PAN,TWO:Mr.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(v){v.addEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=v},this.stopListenToKeyEvents=function(){var v;(v=this._domElementKeyEvents)==null||v.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=i.NONE},this.update=function(){let v=new Kt,b=new r3().setFromUnitVectors(t.up,new Kt(0,1,0)),G=b.clone().invert(),Z=new Kt,wt=new r3,he=new Kt,Zt=2*Math.PI;return function(Pr){Pr===void 0&&(Pr=null);let Ae=n.object.position;v.copy(Ae).sub(n.target),v.applyQuaternion(b),a.setFromVector3(v),n.autoRotate&&o===i.NONE&&k(j(Pr)),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+=Zt:Ce>Math.PI&&(Ce-=Zt),Re<-Math.PI?Re+=Zt:Re>Math.PI&&(Re-=Zt),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&&U||n.object.isOrthographicCamera?a.radius=Mt(a.radius):a.radius=Mt(a.radius*l),v.setFromSpherical(a),v.applyQuaternion(G),Ae.copy(n.target).add(v),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&&U){let Ir=null;if(n.object.isPerspectiveCamera){let Lr=v.length();Ir=Mt(Lr*l);let ji=Lr-Ir;n.object.position.addScaledVector(P,ji),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){let Lr=new Kt(R.x,R.y,0);Lr.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 Kt(R.x,R.y,0);ji.unproject(n.object),n.object.position.sub(ji).add(Lr),n.object.updateMatrixWorld(),Ir=v.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;Ir!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(Ir).add(n.object.position):(pa.origin.copy(n.object.position),pa.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(pa.direction))<jz?t.lookAt(n.target):(i3.setFromNormalAndCoplanarPoint(n.object.up,n.target),pa.intersectPlane(i3,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,U=!1,Xi||Z.distanceToSquared(n.object.position)>s||8*(1-wt.dot(n.object.quaternion))>s||he.distanceToSquared(n.target)>0?(n.dispatchEvent({type:"change"}),Z.copy(n.object.position),wt.copy(n.object.quaternion),he.copy(n.target),Xi=!1,!0):!1}}();let n=this,i={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},o=i.NONE,s=1e-6,a=new ha,u=new ha,l=1,c=new Kt,h=new Pt,p=new Pt,f=new Pt,m=new Pt,_=new Pt,y=new Pt,E=new Pt,M=new Pt,w=new Pt,P=new Kt,R=new Pt,U=!1,T=[],I={};function j(v){return v!==null?2*Math.PI/60*n.autoRotateSpeed*v:2*Math.PI/60/60*n.autoRotateSpeed}function Y(){return Math.pow(.95,n.zoomSpeed)}function k(v){u.theta-=v}function ht(v){u.phi-=v}let yt=function(){let v=new Kt;return function(G,Z){v.setFromMatrixColumn(Z,0),v.multiplyScalar(-G),c.add(v)}}(),Lt=function(){let v=new Kt;return function(G,Z){n.screenSpacePanning===!0?v.setFromMatrixColumn(Z,1):(v.setFromMatrixColumn(Z,0),v.crossVectors(n.object.up,v)),v.multiplyScalar(G),c.add(v)}}(),Nt=function(){let v=new Kt;return function(G,Z){let wt=n.domElement;if(n.object.isPerspectiveCamera){let he=n.object.position;v.copy(he).sub(n.target);let Zt=v.length();Zt*=Math.tan(n.object.fov/2*Math.PI/180),yt(2*G*Zt/wt.clientHeight,n.object.matrix),Lt(2*Z*Zt/wt.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(yt(G*(n.object.right-n.object.left)/n.object.zoom/wt.clientWidth,n.object.matrix),Lt(Z*(n.object.top-n.object.bottom)/n.object.zoom/wt.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function Fn(v){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?l/=v:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Cr(v){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?l*=v:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Rr(v){if(!n.zoomToCursor)return;U=!0;let b=n.domElement.getBoundingClientRect(),G=v.clientX-b.left,Z=v.clientY-b.top,wt=b.width,he=b.height;R.x=G/wt*2-1,R.y=-(Z/he)*2+1,P.set(R.x,R.y,1).unproject(n.object).sub(n.object.position).normalize()}function Mt(v){return Math.max(n.minDistance,Math.min(n.maxDistance,v))}function Jc(v){h.set(v.clientX,v.clientY)}function G3(v){Rr(v),E.set(v.clientX,v.clientY)}function Qc(v){m.set(v.clientX,v.clientY)}function k3(v){p.set(v.clientX,v.clientY),f.subVectors(p,h).multiplyScalar(n.rotateSpeed);let b=n.domElement;k(2*Math.PI*f.x/b.clientHeight),ht(2*Math.PI*f.y/b.clientHeight),h.copy(p),n.update()}function V3(v){M.set(v.clientX,v.clientY),w.subVectors(M,E),w.y>0?Fn(Y()):w.y<0&&Cr(Y()),E.copy(M),n.update()}function H3(v){_.set(v.clientX,v.clientY),y.subVectors(_,m).multiplyScalar(n.panSpeed),Nt(y.x,y.y),m.copy(_),n.update()}function W3(v){Rr(v),v.deltaY<0?Cr(Y()):v.deltaY>0&&Fn(Y()),n.update()}function q3(v){let b=!1;switch(v.code){case n.keys.UP:v.ctrlKey||v.metaKey||v.shiftKey?ht(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Nt(0,n.keyPanSpeed),b=!0;break;case n.keys.BOTTOM:v.ctrlKey||v.metaKey||v.shiftKey?ht(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Nt(0,-n.keyPanSpeed),b=!0;break;case n.keys.LEFT:v.ctrlKey||v.metaKey||v.shiftKey?k(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Nt(n.keyPanSpeed,0),b=!0;break;case n.keys.RIGHT:v.ctrlKey||v.metaKey||v.shiftKey?k(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Nt(-n.keyPanSpeed,0),b=!0;break}b&&(v.preventDefault(),n.update())}function th(){if(T.length===1)h.set(T[0].pageX,T[0].pageY);else{let v=(T[0].pageX-T[0].pageY)/(T[1].pageX-T[1].pageY),b=T[0].pageY-v*T[0].pageX;n.rotateLineStart.set(v,b);let G=.5*(T[0].pageX+T[1].pageX),Z=.5*(T[0].pageY+T[1].pageY);h.set(G,Z)}}function eh(){if(T.length===1)m.set(T[0].pageX,T[0].pageY);else{let v=.5*(T[0].pageX+T[1].pageX),b=.5*(T[0].pageY+T[1].pageY);m.set(v,b)}}function nh(){let v=T[0].pageX-T[1].pageX,b=T[0].pageY-T[1].pageY,G=Math.sqrt(v*v+b*b);E.set(0,G)}function X3(){n.enableZoom&&nh(),n.enablePan&&eh()}function j3(){n.enableZoom&&nh(),n.enableRotate&&th()}function rh(v){if(T.length==1)p.set(v.pageX,v.pageY);else{let G=ka(v),Z=.5*(v.pageX+G.x),wt=.5*(v.pageY+G.y);p.set(Z,wt);let he=(v.pageY-G.y)/(v.pageX-G.x),Zt=G.y-he*G.x;if(n.rotateLineEnd.set(he,Zt),Number.isFinite(n.rotateLineEnd.x)&&Number.isFinite(n.rotateLineStart.x)){let Va=(n.rotateLineStart.y-n.rotateLineEnd.y)/(n.rotateLineEnd.x-n.rotateLineStart.x),Pr=he*Va+Zt;if(Number.isFinite(Va)&&Number.isFinite(Pr)){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)}f.subVectors(p,h).multiplyScalar(n.rotateSpeed);let b=n.domElement;ht(2*Math.PI*f.y/b.clientHeight),h.copy(p)}function ih(v){if(T.length===1)_.set(v.pageX,v.pageY);else{let b=ka(v),G=.5*(v.pageX+b.x),Z=.5*(v.pageY+b.y);_.set(G,Z)}y.subVectors(_,m).multiplyScalar(n.panSpeed),Nt(y.x,y.y),m.copy(_)}function oh(v){let b=ka(v),G=v.pageX-b.x,Z=v.pageY-b.y,wt=Math.sqrt(G*G+Z*Z);M.set(0,wt),w.set(0,Math.pow(M.y/E.y,n.zoomSpeed)),Fn(w.y),E.copy(M)}function Y3(v){n.enableZoom&&oh(v),n.enablePan&&ih(v)}function K3(v){n.enableZoom&&oh(v),n.enableRotate&&rh(v)}this.onPointerDown=function(b){n.enabled!==!1&&(T.length===0&&(n.domElement.setPointerCapture(b.pointerId),n.domElement.addEventListener("pointermove",n.onPointerMove),n.domElement.addEventListener("pointerup",n.onPointerUp)),t1(b),b.pointerType==="touch"?J3(b):Z3(b))},this.onPointerMove=function(b){n.enabled!==!1&&(b.pointerType==="touch"?Q3(b):$3(b))},this.onPointerUp=function(b){e1(b),T.length===0&&(n.domElement.releasePointerCapture(b.pointerId),n.domElement.removeEventListener("pointermove",n.onPointerMove),n.domElement.removeEventListener("pointerup",n.onPointerUp)),n.dispatchEvent({type:"end"}),o=i.NONE};function Z3(v){let b;switch(v.button){case 0:b=n.mouseButtons.LEFT;break;case 1:b=n.mouseButtons.MIDDLE;break;case 2:b=n.mouseButtons.RIGHT;break;default:b=-1}switch(b){case br.DOLLY:if(n.enableZoom===!1)return;G3(v),o=i.DOLLY;break;case br.ROTATE:if(v.ctrlKey||v.metaKey||v.shiftKey){if(n.enablePan===!1)return;Qc(v),o=i.PAN}else{if(n.enableRotate===!1)return;Jc(v),o=i.ROTATE}break;case br.PAN:if(v.ctrlKey||v.metaKey||v.shiftKey){if(n.enableRotate===!1)return;Jc(v),o=i.ROTATE}else{if(n.enablePan===!1)return;Qc(v),o=i.PAN}break;default:o=i.NONE}o!==i.NONE&&n.dispatchEvent({type:"start"})}function $3(v){switch(o){case i.ROTATE:if(n.enableRotate===!1)return;k3(v);break;case i.DOLLY:if(n.enableZoom===!1)return;V3(v);break;case i.PAN:if(n.enablePan===!1)return;H3(v);break}}this.onMouseWheel=function(b){n.enabled===!1||n.enableZoom===!1||o!==i.NONE||(b.preventDefault(),n.dispatchEvent({type:"start"}),W3(b),n.dispatchEvent({type:"end"}))},this.onKeyDown=function(b){n.enabled===!1||n.enablePan===!1||q3(b)};function J3(v){switch(sh(v),T.length){case 1:switch(n.touches.ONE){case Mr.ROTATE:if(n.enableRotate===!1)return;th(),o=i.TOUCH_ROTATE;break;case Mr.PAN:if(n.enablePan===!1)return;eh(),o=i.TOUCH_PAN;break;default:o=i.NONE}break;case 2:switch(n.touches.TWO){case Mr.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;X3(),o=i.TOUCH_DOLLY_PAN;break;case Mr.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;j3(),o=i.TOUCH_DOLLY_ROTATE;break;default:o=i.NONE}break;default:o=i.NONE}o!==i.NONE&&n.dispatchEvent({type:"start"})}function Q3(v){switch(sh(v),o){case i.TOUCH_ROTATE:if(n.enableRotate===!1)return;rh(v),n.update();break;case i.TOUCH_PAN:if(n.enablePan===!1)return;ih(v),n.update();break;case i.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Y3(v),n.update();break;case i.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;K3(v),n.update();break;default:o=i.NONE}}this.onContextMenu=function(b){n.enabled!==!1&&b.preventDefault()};function t1(v){T.push(v)}function e1(v){delete I[v.pointerId];for(let b=0;b<T.length;b++)if(T[b].pointerId==v.pointerId){T.splice(b,1);return}}function sh(v){let b=I[v.pointerId];b===void 0&&(b=new Pt,I[v.pointerId]=b),b.set(v.pageX,v.pageY)}function ka(v){let b=v.pointerId===T[0].pointerId?T[1]:T[0];return I[b.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 ga=class extends fa{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:i}=this,o=n===i;(e||t<=n&&t>=i)&&(this.maxPolarAngle=t,this.minPolarAngle=t,this.update()),o||(this.maxPolarAngle=n,this.minPolarAngle=i)}setPolarAngleByDuration(t,e,n){return x(this,null,function*(){return e===void 0&&(e=!1),n===void 0&&(n=500),n<=0?this.setPolarAngle(t,e):Ft(new Promise(i=>{let o={polar:this.getPolarAngle()},s={polar:t},a=new da(o,this.tweenGroup).to(s,n).onUpdate(()=>{this.setPolarAngle(o.polar,e)}).onComplete(()=>{this.enabled=!0,this.tweenGroup.remove(a),i(!0)}).onStart(()=>{this.enabled=!1}).start()}),n+500)})}setAzimuthalAngle(t,e){let{maxAzimuthAngle:n,minAzimuthAngle:i}=this,o=n===i;(e||t<=n&&t>=i)&&(this.maxAzimuthAngle=t,this.minAzimuthAngle=t,this.update()),o||(this.maxAzimuthAngle=n,this.minAzimuthAngle=i)}setAzimuthalAngleDuration(t,e,n){return e===void 0&&(e=!1),n===void 0&&(n=500),n<=0?this.setAzimuthalAngle(t,e):Ft(new Promise(i=>{let o={azimuthal:this.getAzimuthalAngle()},s={azimuthal:t},a=new da(o,this.tweenGroup).to(s,n).onUpdate(()=>{this.setAzimuthalAngle(o.azimuthal,e)}).onComplete(()=>{this.enabled=!0,this.tweenGroup.remove(a),i(!0)}).onStart(()=>{this.enabled=!1}).start()}),n+500)}getCameraLookAt(){return new o3().subVectors(this.target,this.camera.position)}setCameraPositionByTarget(t,e){return x(this,null,function*(){let n=this.target.clone(),i=this.getCameraLookAt();if(!e){this.camera.position.copy(t.clone().sub(i)),this.target.copy(t.clone()),this.update();return}return Ft(new Promise(o=>{let s=new da(n,this.tweenGroup).to(t,e).onUpdate(()=>{this.camera.position.copy(n.clone().sub(i)),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:i,maxZoom:o}=this;(n||t>=i&&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,i){return x(this,null,function*(){n===void 0&&(n=!1),i===void 0&&(i=500);let o={zoom:this.camera.zoom,target:this.target.clone()};if(t!==this.camera.zoom)return i?Ft(new Promise(s=>{let a=new da(o,this.tweenGroup).to({zoom:t,target:e},i).onUpdate(()=>{this.setZoom(o.zoom,o.target,n)}).onComplete(()=>{this.tweenGroup.remove(a),this.enabled=!0,s(!0)}).onStart(()=>{this.enabled=!1}).start()}),i+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 o3;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 i=this.camera.zoom;i!==this.prevCameraZoom&&(this.prevCameraZoom=i,this.dispatchEvent({type:"change-zoom",zoom:i}))},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 ma=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()}constructor(t){super(S({antialias:!0,alpha:!0},t)),this.event=new Kz,this.enable=!0,this.timer=new W,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 _a=class extends tG{constructor(){super(),new nG().load(T6,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 va=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 ya=class extends iG{resizeClientSize(){let{x:t,y:e,width:n,height:i}=this.container.getBoundingClientRect();this.clientSize={width:n||this.container.clientWidth,height:i||this.container.clientHeight,x:t,y:e}}init(){let{clientWidth:t,clientHeight:e}=this.container;this.camera=new va(t,e),this.renderer.setSize(t,e),this.renderer.setCameraAndScene(this.scene,this.camera),this.renderer.autoRender(),this.control=new ga(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 la(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:i}=this.container,o=C(t,this.camera,n,i),s=C(e,this.camera,n,i);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 i=new wr;i.x=t/this.clientSize.width*2-1,i.y=e/this.clientSize.height*-2+1;let o=new sG;return o.setFromCamera(i,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,i;let o=(n=this.currentFloor)==null?void 0:n.poiLayer.getPoiByDeviceXy(t,e),s=(i=this.currentFloor)==null?void 0:i.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,i){e===void 0&&(e=[20,20,20,20]),n===void 0&&(n=500),i===void 0&&(i=!0);let[o,s,a,u]=e,{clientSize:{width:l,height:c}}=this,h=this.control.getPolarAngle();i&&this.setPolarAngle(0,0);let p=new aG().setFromObject(t);this.setPolarAngle(h,0);let{max:f,min:m}=p,_=new We(m.x,f.y,f.z),y=new We(f.x,f.y,f.z),E=new We(f.x,m.y,m.z),M=new We(m.x,m.y,m.z),w=C(_,this.camera,l,c),P=C(y,this.camera,l,c),R=C(M,this.camera,l,c),U=C(E,this.camera,l,c),I=new oG().setFromPoints([new wr(w.x,w.y),new wr(P.x,P.y),new wr(R.x,R.y),new wr(U.x,U.y)]).getSize(new wr),j=(l-s-u)/I.x,Y=(c-o-a)/I.y,k=Math.min(j,Y),ht=new We((f.x+m.x)/2,(f.y+m.y)/2,(f.z+m.z)/2),yt=k*this.camera.zoom,Lt=this.camera.clone();Lt.zoom=yt,Lt.updateMatrix();let Nt=(l-I.x*k)/2,Fn=(c-I.y*k)/2,Cr=(s-u)/2,Rr=(o-a)/2;if(Cr){let Mt=new We;Mt.setFromMatrixColumn(Lt.matrix,0),Mt.normalize(),Mt.multiplyScalar(Cr/yt),ht.add(Mt)}if(Rr){let Mt=new We;Mt.setFromMatrixColumn(Lt.matrix,1),Mt.normalize(),Mt.multiplyScalar(Rr/yt),ht.add(Mt)}return{zoom:k*this.camera.zoom,center:ht}}fitCameraToObject(t,e,n,i){e===void 0&&(e=[20,20,20,20]),n===void 0&&(n=500),i===void 0&&(i=!0);let{zoom:o,center:s}=this.getFitCameraToObjectZoom(t,e,n,i);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 x(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 _a,this.renderer=new ma,this.lights=Vg(),this.clientSize={width:0,height:0,x:0,y:0},this.renderRf=0,this.onControlChange=()=>{this.dispatchEvent({type:"change-ratio",px:(this.basicRatio||0)*this.camera.zoom}),this.dispatchEvent({type:"control-change"})},this.onControlChangeZoom=n=>{let{zoom:i}=n;this.dispatchEvent({type:"control-zoom-change",zoom:i})},this.onRendererUpdate=()=>{this.dispatchEvent({type:"update"})},this.onWindowResize=()=>{let{container:n,camera:i,renderer:o}=this,{clientWidth:s,clientHeight:a}=n;s=Math.max(1,s),a=Math.max(1,a),i.left=-s/2,i.right=s/2,i.top=a/2,i.bottom=-a/2,i.updateProjectionMatrix(),o.setSize(s,a),this.resizeClientSize(),this.dispatchEvent({type:"resize",width:s,height:a})},this.onClick=n=>{let{graphics:i,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY);i.length&&this.dispatchEvent({type:"graphic-click",graphics:i,position:o});let s=this.getPoisByDeviceXy(n.offsetX,n.offsetY);s.length&&this.dispatchEvent({type:"poi-click",pois:s})},this.onPointerover=n=>{let{graphics:i,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY),s=this.getPoisByDeviceXy(n.offsetX,n.offsetY);this.dispatchEvent({type:"pointer-over",e:n,graphics:i,pois:s,position:o})},this.onPointermove=n=>{let{graphics:i,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY),s=this.getPoisByDeviceXy(n.offsetX,n.offsetY);this.dispatchEvent({type:"pointer-move",e:n,graphics:i,pois:s,position:o})},this.onPointerleave=n=>{this.dispatchEvent({type:"pointer-level"})},this.onSelectionSelect=n=>{let{graphics:i,isMultipleSelect:o}=n;this.dispatchEvent({type:"select-graphic",graphics:i,isMultipleSelect:o})},this.onHoverChange=n=>{let{graphics:i}=n;this.dispatchEvent({type:"hover",graphics:i})},this.container.style.position="relative",this.container.style.overflow="hidden",this.init(),this.selection=new sa(this),this.hoverHelper=new aa(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 s3(r){return cG({},hG,r)}import{debounce as PG}from"lodash";var hJ=d(A(),1);var le;function a3(r,t){return r===void 0&&(r="aibee_map"),t===void 0&&(t=1),new Promise((e,n)=>{if(le)return e({db:le,type:"success"});let i=indexedDB.open(r,t);i.onupgradeneeded=function(o){le=o.target.result,console.log("onupgradeneeded"),e({db:le,type:"onupgradeneeded"})},i.onsuccess=o=>{le=o.target.result,e({db:le,type:"success"})},i.onerror=o=>{n(o)}})}function Uc(r,t,e){return e===void 0&&(e=le),new Promise((n,i)=>{e||i("\u6CA1\u6709db");let s=e.transaction([r],"readonly").objectStore(r).get(t);s.onsuccess=()=>{s.result?n(s.result.value):n(null)},s.onerror=a=>{console.log("[getVersionByKey]",a),n(null)}})}function u3(r,t,e,n){return n===void 0&&(n=le),new Promise((i,o)=>(n||o("\u6CA1\u6709db"),new Promise((s,a)=>x(this,null,function*(){let u=yield Uc(r,t),l=n.transaction([r],"readwrite").objectStore(r),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(r,t){t===void 0&&(t=le),t&&(t.objectStoreNames.contains(r)||t.createObjectStore(r,{keyPath:"key"}))}function l3(r){r===void 0&&(r=le),r==null||r.close(),le=null}import{Vector3 as MG,EventDispatcher as wG,Color as TG}from"three";var rJ=d(D(),1),iJ=d(A(),1);function xa(r,t){let e=r.poi_info.showName||r.store_name||r.poi_info.text;switch(t){case"zh-cn":return e;case"en":var n;return((n=r.store_info_ext)==null?void 0:n.poi_name)||e;case"zh-hk":var i;return((i=r.store_info_ext)==null?void 0:i.traditional_name)||e}}function Ea(r,t){let e=r.poi_info.showName||r.store_name||r.poi_info.text;switch(t){case"zh-cn":return e;case"en":var n;return((n=r.infra_info_ext)==null?void 0:n.poi_name)||e;case"zh-hk":var i;return((i=r.infra_info_ext)==null?void 0:i.traditional_name)||e}}function c3(r,t,e){switch(r.l_type){case"graph":return pG(r,t);case"wall":return fG(r,t);case"lane":return dG(r,t);case"texture2d":case"texture3d":return gG(r,t);case"glb":return mG(r,t);case"store":return _G(r,t);case"facility":return yG(r,t);case"parkingSpace":return EG(r,t,e);case"text":return bG(r,t)}}function h3(r,t,e,n){switch(r.l_type){case"store":return vG(r,t,e,n.showStoreName);case"facility":return xG(r,t,e,n.showFacilityName);case"parkingSpace":return SG(r,t)}}function pG(r,t){let e=r.elements.reduce((n,i)=>{let{fillColor:o,fillOpacity:s,strokeColor:a,strokeOpacity:u,height:l,airHeight:c}=i,h=o.toLowerCase()+"-"+s+"-"+a.toLowerCase()+"-"+u+"-"+l+"-"+c;return u===0&&(h=o.toLowerCase()+"-"+s+"-"+l+"-"+c),n[h]?n[h].push(i):n[h]=[i],n},{});Object.values(e).forEach(n=>{let i=new Sr(t.context,n);t.mergeGraphicLayer.add(i)})}function fG(r,t){let e=r.elements.reduce((n,i)=>{let{fillColor:o,fillOpacity:s,strokeColor:a,strokeOpacity:u,height:l}=i,c=o.toLowerCase()+"-"+s+"-"+a.toLowerCase()+"-"+u+"-"+l;return u===0&&(c=o.toLowerCase()+"-"+s+"-"+l),n[c]?n[c].push(i):n[c]=[i],n},{});Object.values(e).forEach(n=>{let i=new ta(t.context,n);t.wallLayer.add(i)})}function dG(r,t){let e=r.elements.reduce((n,i)=>{let{fillColor:o,fillOpacity:s,strokeColor:a,strokeOpacity:u}=i,l=o.toLowerCase()+"-"+s+"-"+a.toLowerCase()+"-"+u;return u===0&&(l=o.toLowerCase()+"-"+s),n[l]?n[l].push(i):n[l]=[i],n},{});Object.values(e).forEach(n=>{let i=new na(t.context,n);t.laneLayer.add(i)})}function gG(r,t){if(r.elements.length){let e=new Er(t.context,r.elements);t.textureLayer.add(e)}}function mG(r,t){r.elements.forEach(e=>{let n=new ea(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(r,t){r.elements.map(e=>{let n=t.addGraphic(e);t.userData.graphics.push(n),t.userData.graphicMap.set(e.id,n)})}function vG(r,t,e,n){r.elements.map(i=>{try{let o=xa(i,e),s=new nt(t.context,{id:i.id,icon:i.poi_info.icon,text:o,position:{x:i.center_coord_x,y:i.center_coord_y,z:i.airHeight+i.height},icon_size:[24,24],level:i.poi_info.level||0,hide_text:!n});t.poiLayer2.pushPoi(s),s&&(s.userData.type="store",s.userData.data=i,s.userData.floor=t.name)}catch(o){console.log("\u521B\u5EFA\u5E97\u94FApoi\u5931\u8D25",o,i)}})}function yG(r,t){r.elements.map(e=>{let n=t.addGraphic(e);t.userData.graphics.push(n),t.userData.graphicMap.set(e.id,n)})}function xG(r,t,e,n){r.elements.filter(o=>o.poi_info).map(o=>{try{let s=Ea(o,e),a=new nt(t.context,{id:o.id,icon: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});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(r,t,e){t.parkingSpaceLayer.createParkings(r.elements,e.mergeParkingSpace),t.userData.parkingSpaces=t.parkingSpaceLayer.graphicMap.values(),t.userData.parkingSpacesGraphicMap=t.parkingSpaceLayer.graphicMap}function SG(r,t){return x(this,null,function*(){let e=r.elements.filter(o=>o.texts[0]),n=e.map(o=>o.texts[0]),i=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:i[s].texture,text_texture_width:i[s].width,text_texture_height:i[s].height,text_texture_offset_x:i[s].x,text_texture_offset_y:i[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(i).forEach(o=>{o.texture.dispose()})})}function bG(r,t){let e=new ia(t.context,r.elements.map(n=>S({},n,{center_x:n.center_coord_x,center_y:n.center_coord_y})));t.textTextureLayer.add(e)}var Fc="map_version",Bc="route_version",zc="facility_version",Gc="map_data",Sa="road_network_data",kc="facility_data",AG={mergeParkingSpace:!0},Tr=class extends wG{initDb(){return x(this,null,function*(){try{let{db:t,type:e}=yield a3("aibee_map",2);e==="onupgradeneeded"&&(On(Fc),On(Bc),On(zc),On(Gc),On(Sa),On(kc)),this.db=t}catch(t){console.log("[\u6253\u5F00indexDb\u9519\u8BEF]",t)}})}load(t,e){return x(this,null,function*(){if(Array.isArray(t))this.floors=t,e&&(this.placeConfig=S({},this.placeConfig,e));else{let n=yield fetch(t).then(i=>i.json());n.code===200&&(this.floors=n.data.list,this.placeConfig=S({},this.placeConfig,JSON.parse(n.data.config||"{}")))}})}setCacheData(t,e,n){return this.initDbPromise.then(()=>u3(t,""+e,n,this.db))}getCacheData(t,e){return this.initDbPromise.then(()=>Uc(t,""+e,this.db))}getFloorCacheKey(t){return""+t.floor_id}getFloorData(t){return x(this,null,function*(){let e=yield this.getFloorJsonData(t);return e?this.getDataByJson(e):null})}getFloorDataByFloorInfo(t){return x(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=xa(e.userData.data,t)),e.userData.type==="facility"&&(e.options.text=Ea(e.userData.data,t))})}getFloorJsonDataByFloorInfo(t){return x(this,null,function*(){let e=this.getFloorCacheKey(t);console.time("zstd_json");let n=yield fetch(t.map_url).then(i=>i.json());return n.floor=t.floor,console.timeEnd("zstd_json"),this.setCacheData(Gc,e,n),this.setCacheData(Fc,e,t.version_id),n})}getFloorJsonData(t){return x(this,null,function*(){let e=this.floors.find(i=>i.floor===t);if(!e)return null;let n=this.getFloorCacheKey(e);try{if((yield this.getCacheData(Fc,n))===e.version_id){let o=yield this.getCacheData(Gc,n);if(o)return o}return this.getFloorJsonDataByFloorInfo(e)}catch(i){return console.log("[get floor data error]",i),this.getFloorJsonDataByFloorInfo(e)}})}getRoadNetworkData(){return x(this,null,function*(){return(yield Promise.all(this.floors.map(e=>x(this,null,function*(){let n=this.getFloorCacheKey(e);try{if((yield this.getCacheData(Bc,n))===e.version_id){let s=yield this.getCacheData(Sa,n);if(s)return s}let o=yield fetch(e.route_url).then(s=>s.json());return this.setCacheData(Sa,n,o),this.setCacheData(Bc,n,e.version_id),o}catch(i){let o=yield fetch(e.route_url).then(s=>s.json());return this.setCacheData(Sa,n,o),o}})))).filter(e=>e.points)})}getFacilitiesData(){return x(this,null,function*(){let t=this.floors.reduce((i,o)=>i.updated_at>o.updated_at?i:o,this.floors[0]);if(!t)return null;let e=this.getFloorCacheKey(t),n=()=>x(this,null,function*(){let i=yield fetch(t.entry_infra_url).then(o=>o.json());return i&&(this.setCacheData(kc,e,i),this.setCacheData(zc,e,t.version_id)),i});try{if((yield this.getCacheData(zc,e))===t.version_id){let o=yield this.getCacheData(kc,e);if(o)return o}return n()}catch(i){return console.log("[get facility error]",i),n()}})}getOtherDataByFreeTime(){return x(this,null,function*(){})}getMulFloorsData(t){return x(this,null,function*(){return Promise.all(t.map(e=>this.getFloorData(e))).then(e=>e.filter(n=>n))})}getDataByUrl(t){return x(this,null,function*(){let e=yield fetch(t).then(n=>n.json());return this.getDataByJson(e)})}getDataByJson(t,e,n){return x(this,null,function*(){return e=this.getFloorBaseLayer(t,e),n=S({},this.placeConfig,n),t.layers.forEach(i=>{["range","ground"].includes(i.l_type)||nr(i.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),i=Math.max(n.x,n.y,n.z);e.userData.height=i/4+t.floorHeight}switchFloor(t,e){return x(this,null,function*(){return new Promise(n=>{let i={run:()=>this._switchFloor(t,e),meta:{type:"switchFloor"}},o=this.taskQueue.replaceByMetaType(i),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 x(this,null,function*(){var n;let i=t;if(typeof t=="string"){let l=yield this.getFloorJsonData(t);if(l)i=l;else return null}e=S({},this.placeConfig,e);let o=new jt(this.bmap.context);o.userData.data=t;let s=this.floors.find(l=>l.floor===i.floor);var a;let u=(a=s==null?void 0:s.map_angle)!=null?a:0;return this.bmap.dispatchEvent({type:ct.SWITCH_FLOOR_BEFORE,data:{curFloor:o,graphics:[]}}),this.dispatchEvent({type:"switch-floor-before",data:{curFloor:o,graphics:[],floorData:i}}),this.bmap.context.control.setAzimuthalAngle(u/180*Math.PI,!0),this.bmap.context.scene.background=new TG(e.backgroundColor),this.getFloorBaseLayer(i,o),this.changeFloorBox(i,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.cameraBound.updateBox(),i.layers.forEach(l=>{["range","ground"].includes(l.l_type)||nr(l.elements,o.userData.center)}),this.dispatchEvent({type:"switch-floor-ground",data:{curFloor:o,graphics:[]}}),this.bmap.dispatchEvent({type:ct.SWITCH_FLOOR_GROUND,data:{curFloor:o}}),yield Ho(),yield this.getFloorContentLayer(i,o),this.changeFloorBox(i,o),this.dispatchEvent({type:"switch-floor-content",data:{curFloor:o,graphics:[]}}),yield Om(2),yield this.getFloorPoi(i,o,e),this.dispatchEvent({type:"switch-floor-after",data:{curFloor:o,graphics:o.graphicLayer.children}}),this.bmap.dispatchEvent({type:ct.SWITCH_FLOOR_AFTER,data:{curFloor:o,graphics:o.graphicLayer.children}}),o})}getFloorBaseLayer(t,e){e||(e=new jt(this.bmap.context));let n=[0,0];return t.layers.forEach(i=>{switch(i.l_type){case"range":let o=i.elements[0];n=[o.center_x,o.center_y];break;case"ground":nr(i.elements,n);let s=i.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 x(this,null,function*(){e||(e=new jt(this.bmap.context)),e.userData.graphics=[],e.userData.graphicMap=new Map;let n=Date.now();for(let i=0;i<t.layers.length;i++){let o=t.layers[i];["range","ground"].includes(o.l_type)||(c3(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 x(this,null,function*(){n===void 0&&(n=this.placeConfig);let i=Date.now();yield Promise.all(t.layers.map(s=>h3(s,e,this.locale,n))),console.log("poi time",Date.now()-i);let o=Date.now();Ho().then(()=>{console.log("poi render time",Date.now()-o)})})}clear(){return x(this,null,function*(){var t;l3((t=this.db)!=null?t:void 0)})}dispose(){this.clear()}constructor(t,e={}){super(),this.bmap=t,this.floors=[],this.initDbPromise=Promise.resolve(),this.db=null,this.taskQueue=new rr,this.locale="zh-cn",this.placeConfig={backgroundColor:"#f1f7f6",showFacilityName:!0,showStoreName:!0},this.options=S({},AG,e),this.initDbPromise=this.initDb()}};var TJ=d(A(),1);function p3(r,t){return x(this,null,function*(){let{brand:e,project:n}=r,{apiDomain:i,apiPath:{floorRange:o},apiInfo:s}=t,a=""+i+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(r,t){return x(this,null,function*(){let{brand:e,project:n,floor:i,ts:o,resource_type_list:s}=r,{apiDomain:a,apiPath:{floorGraphic:u},apiInfo:l}=t,c=""+a+u+"?brand="+e+"&project="+n+"&phase="+n+"&building="+n+"&floor="+i+"&ts="+o+"&resource_type_list="+s;return yield fetch(c,l).then(p=>p.json()).then(p=>p.data).then(p=>((p||[]).map(f=>f.info=JSON.parse(f.info)),p||[]))})}function xJ(r,t){return x(this,null,function*(){let{project:e,floor:n}=r,{apiDomain:i,apiInfo:o}=t,s=i+"/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?CG(u.fileId,t):null)})}function CG(r,t){return x(this,null,function*(){let{apiDomain:e,apiInfo:n}=t;return fetch(e+"/api/inception-map/file/getFileStream?fileId="+r,n).then(i=>i.arrayBuffer()).then(i=>{let s=new TextDecoder("utf-8").decode(i);return s?JSON.parse(s):null})})}var d3=class{load(t){return x(this,null,function*(){let e=Qn(t);if(this.cacheData.has(e))return this.cacheData.get(e);let[,n]=yield Promise.all([this.loadBuildGround(t),f3(t,this.bmap.config)]),i=Qn({floor:t.floor,ts:t.ts});nr(n.map(s=>s.info),this.bmap.buildingCenter,this.floorDataLengthMap.get(i)||0),n.forEach(s=>s.info.transformToBuildingGround=!1),this.cacheData.set(e,n);let o=this.floorDataLengthMap.get(i)||0;return this.floorDataLengthMap.set(i,o+n.length),this.loadExternalStreet(t),n})}loadExternalStreet(t){return x(this,null,function*(){})}switchFloorByData(t,e){if(!t.length)return;let n=e.userData.legacyToGraphicMap||new Map,i=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)}i.set(u.element_uuid,u)}e.userData.legacyToGraphicMap=n,e.userData.graphicMap=i,e.updateBox(),e===this.bmap.context.currentFloor?(this.bmap.triggerHooks(ct.SWITCH_FLOOR_BEFORE,{curFloor:e,graphics:e.graphicLayer.children}),this.bmap.initialFloorCamera(),this.bmap.triggerHooks(ct.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(i=>!n.has(i.element_uuid))}switchFloorByStoreData(t,e){return x(this,null,function*(){let n=yield this.load(S({},t,{resource_type_list:"6"})),i=this.filterData(n,e);this.switchFloorByData(i,e)})}switchFloorByOtherData(t,e){return x(this,null,function*(){let n=yield this.load(S({},t,{resource_type_list:"1,2,3,4"})),i=this.filterData(n,e);this.switchFloorByData(i,e)})}loadBuildGround(t){return x(this,null,function*(){let{brand:e,project:n}=t,i=yield this.loadBuildingGround({brand:e,project:n});return this.bmap.currentBuildGround=i,this.bmap.changeBuildingCenter(i,{brand:e,project:n}),this.bmap.currentBuildGround})}loadBuildingGround(t){return x(this,null,function*(){let{brand:e,project:n}=t,i=Qn({brand:e,project:n});if(this.buildingGroundMap.has(i))return this.buildingGroundMap.get(i);let o=p3({brand:e,project:n},this.bmap.config).then(s=>(this.buildingGroundMap.set(i,s),s));return this.buildingGroundMap.set(i,o),o})}switchFloor(t){return x(this,null,function*(){let e=new jt(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 YJ=function(r){return r[r.D2=0]="D2",r[r.D3=1.1]="D3",r}({}),ba=class extends RG{changeBuildingCenter(t,e){let{brand:n,project:i}=e,o=t?Fo(t.info.geometry.cds[0]):[0,0];this.buildingCenter=o,this.dispatchEvent({type:"center-change",center:o,project:i,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 x(this,null,function*(){return this.loader||(this.loader=new Tr(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(ct.SWITCH_FLOOR_BEFORE,{curFloor:t,graphics:e}),this.context.switchFloor(t),this.initialFloorCamera(),this.triggerHooks(ct.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 i=(n=this.context.currentFloor)==null?void 0:n.addModel(S({},e,{position:t.getPosition().setZ(.1),id:t.options.id}));if(i){let{facilityAngle:o=0,facilityXScale:s=1,facilityYScale:a=1}=t.options.userData;i.rotateZ((180-o)/180*Math.PI),i.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,i=t.getCenter(),o=(n==null?void 0:n[0])||i.x,s=(n==null?void 0:n[1])||i.y;return console.log(o,s,n,i),this.context.currentFloor.addPoi(S({},e,{position:{x:o,y:s,z:i.z+t.options.height/2}}))}return null}removeHeatMap(){var t;(t=this.context.currentFloor)==null||t.removeHeatMap()}translateElementToCenter(t,e,n,i){e===void 0&&(e=500),n===void 0&&(n=0),i===void 0&&(i=0);let o=t.getPosition().clone(),{context:{camera:s}}=this;if(s.updateMatrix(),i){let a=new Vc;a.setFromMatrixColumn(s.matrix,1),a.normalize(),a.multiplyScalar(i/s.zoom),o.add(a)}if(n){let a=new Vc;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 x(this,null,function*(){return e===void 0&&(e=500),Ft(new Promise(n=>{let i=this.context.control.target.clone(),o=t.getPosition();this.timer.requestAnimationFrame(()=>{let{clientSize:{width:s,height:a},camera:u}=this.context,c=C(o,u,s,a).x-s/2,h=new Vc;h.setFromMatrixColumn(this.context.camera.matrix,0),h.normalize(),h.multiplyScalar(c/this.context.camera.zoom),i.add(h),this.context.setCameraPosition(i,e).then(n)})}),e+500)})}getElementDeviceCoordinate(t){let e=t.position.clone(),{clientWidth:n,clientHeight:i}=this.container;return C(e,this.context.camera,n,i)}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 x(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 x(this,null,function*(){return this.cancelDistance(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgLine=new Js(this.context);let n=this.svgLine.dispose.bind(this.svgLine);this.svgLine.dispose=function(){n(),e("cancel")},this.svgLine.addEventListener("distance",i=>{let{distance:o}=i;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 Qs(this.context);let n=this.svgPolygon.dispose.bind(this.svgPolygon);this.svgPolygon.dispose=function(){n(),e("cancel")},this.svgPolygon.addEventListener("area",i=>{let{area:o}=i;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(i=>{Array.isArray(i)&&i.forEach(o=>{o[0]-=n[0],o[1]-=n[1]})});else{let[i,o]=t.geometry.cds;t.geometry.coords=[i-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(),St.dispose(),X.dispose(),ue.dispose(),this.debounceResize=null}constructor(t,e={}){super(),this.container=t,this.polarKeys=[],this.azimuthalKeys=[],this.basicZoom=1,this.prevCameraZoom=1,this.type="2d",this.currentBuildGround=null,this.observe=null,this.buildingCenter=[0,0],this.timer=new W,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 i=this.context.control.getPolarAngle();this.context.control.maxPolarAngle=i,this.context.control.minPolarAngle=i}if(this.azimuthalKeys.includes(n.code)){let i=this.context.control.getAzimuthalAngle();this.context.control.maxAzimuthAngle=i,this.context.control.minAzimuthAngle=i}},this.resize=()=>{this.context.cameraBound.setEnable(!1),this.context.onWindowResize();let n=this.context.control.getAzimuthalAngle(),i=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=i,this.context.control.minZoom=o,this.context.control.maxZoom=o*25,this.basicZoom=i,this.context.control.addEventListener("change",this.onControlChange),this.context.setAzimuthalAngle(n,0),this.context.cameraBound.setEnable(!0)},this.config=s3(e),this.context=new ya(t,this.config),this.debounceResize=PG(this.resize,5),this.registryEvent()}};var QJ=d(A(),1);import{EventDispatcher as IG}from"three";var bt=class extends IG{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 bt{fetchEquipment(){return x(this,null,function*(){let{apiDomain:t,apiPath:{equipmentList:e},apiInfo:n}=this.bmap.config,i=""+t+e;yield fetch(i,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)),i=this.bmap.createGraphicPoi(e,{icon:n==null?void 0:n.equipment_icon,built_in:!0,icon_size:[14,14]});i&&(i.userData.data=n,i.userData.type="equipment")})}dispose(){var t;this.bmap.removeEventListener(ct.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(ct.SWITCH_FLOOR_AFTER,this.onSwitchFloor)}};var htt=d(ti(),1),ptt=d(ee(),1),ftt=d(A(),1),dtt=d(Dc(),1);var wQ=d(A(),1),TQ=d(D(),1);import{Mesh as zG,Object3D as GG,TextureLoader as kG,Color as VG,Vector2 as Wc,Vector3 as HG,NormalBlending as WG,RepeatWrapping as qG}from"three";var sQ=d(Ul(),1),aQ=d(hi(),1),uQ=d(pi(),1),lQ=d(di(),1),cQ=d(gi(),1),hQ=d(mi(),1),pQ=d(vi(),1),fQ=d(yi(),1),dQ=d(xi(),1),gQ=d(Ei(),1),mQ=d(Si(),1),_Q=d(bi(),1),vQ=d(Mi(),1),yQ=d(Ti(),1),xQ=d(Ai(),1),EQ=d(D(),1),SQ=d(wc(),1);import{BufferGeometry as LG,Matrix4 as _3,Vector3 as Dn,Ray as NG,Sphere as OG,LineSegments as DG,BufferAttribute as _n,ShaderChunk as It,ShaderMaterial as v3,UniformsLib as UG,Color as FG,Vector2 as m3}from"three";var vt=class extends LG{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)}}})}};vt.prototype.setMatrixWorld=function(r){this.matrixWorld=r};vt.prototype.setGeometry=function(r,t){this._geometry=r,this.setPoints(r.getAttribute("position").array,t)};vt.prototype.setPoints=function(r,t){if(!(r instanceof Float32Array)&&!(r instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=r,this.widthCallback=t,this.positions=[],this.counters=[],r.length&&r[0]instanceof Dn)for(var e=0;e<r.length;e++){var n=r[e],i=e/r.length;this.positions.push(n.x,n.y,n.z),this.positions.push(n.x,n.y,n.z),this.counters.push(i),this.counters.push(i)}else for(var e=0;e<r.length;e+=3){var i=e/r.length;this.positions.push(r[e],r[e+1],r[e+2]),this.positions.push(r[e],r[e+1],r[e+2]),this.counters.push(i),this.counters.push(i)}this.process()};function BG(r,t){var e=new _3,n=new NG,i=new OG,o=new Dn,s=this.geometry;if(s.boundingSphere||s.computeBoundingSphere(),i.copy(s.boundingSphere),i.applyMatrix4(this.matrixWorld),r.ray.intersectSphere(i,o)!==!1){e.copy(this.matrixWorld).invert(),n.copy(r.ray).applyMatrix4(e);var a=new Dn,u=new Dn,l=new Dn,c=this instanceof DG?2:1,h=s.index,p=s.attributes;if(h!==null)for(var f=h.array,m=p.position.array,_=p.width.array,y=0,E=f.length-1;y<E;y+=c){var M=f[y],w=f[y+1];a.fromArray(m,M*3),u.fromArray(m,w*3);var P=_[Math.floor(y/3)]!==void 0?_[Math.floor(y/3)]:1,R=r.params.Line.threshold+this.material.lineWidth*P/2,U=R*R,T=n.distanceSqToSegment(a,u,o,l);if(!(T>U)){o.applyMatrix4(this.matrixWorld);var I=r.ray.origin.distanceTo(o);I<r.near||I>r.far||(t.push({distance:I,point:l.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this}),y=E)}}}}vt.prototype.raycast=BG;vt.prototype.compareV3=function(r,t){var e=r*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]};vt.prototype.copyV3=function(r){var t=r*6;return[this.positions[t],this.positions[t+1],this.positions[t+2]]};vt.prototype.getDistance=function(r){let t=0;for(let e=0;e<r;e++){let n=6*e,i=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=i.distanceTo(o);t+=s}return t};vt.prototype.process=function(){var r=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var t;let e=this.getDistance(r-1);var n;this.compareV3(0,r-1)?n=this.copyV3(r-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 i=0;i<r;i++){if(this.side.push(1),this.side.push(-1),this.widthCallback?t=this.widthCallback(i/(r-1)):t=1,this.width.push(t),this.width.push(t),i===0)this.uvs.push(0,0),this.uvs.push(0,1);else if(i===r-1)this.uvs.push(1,0),this.uvs.push(1,1);else{let s=this.getDistance(i)/e;this.uvs.push(s,0),this.uvs.push(s,1)}if(i<r-1){n=this.copyV3(i),this.previous.push(n[0],n[1],n[2]),this.previous.push(n[0],n[1],n[2]);var o=i*2;this.indices_array.push(o,o+1,o+2),this.indices_array.push(o+2,o+1,o+3)}i>0&&(n=this.copyV3(i),this.next.push(n[0],n[1],n[2]),this.next.push(n[0],n[1],n[2]))}this.compareV3(r-1,0)?n=this.copyV3(1):n=this.copyV3(r-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 Hc(r,t,e,n,i){var o;if(r=r.subarray||r.slice?r:r.buffer,e=e.subarray||e.slice?e:e.buffer,r=t?r.subarray?r.subarray(t,i&&t+i):r.slice(t,i&&t+i):r,e.set)e.set(r,n);else for(o=0;o<r.length;o++)e[o+n]=r[o];return e}vt.prototype.advance=function(r){var t=this._attributes.position.array,e=this._attributes.previous.array,n=this._attributes.next.array,i=t.length;Hc(t,0,e,0,i),Hc(t,6,t,0,i-6),t[i-6]=r.x,t[i-5]=r.y,t[i-4]=r.z,t[i-3]=r.x,t[i-2]=r.y,t[i-1]=r.z,Hc(t,6,n,0,i-6),n[i-6]=r.x,n[i-5]=r.y,n[i-4]=r.z,n[i-3]=r.x,n[i-2]=r.y,n[i-1]=r.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0};It.meshline_vert=["",It.logdepthbuf_pars_vertex,It.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;","",It.logdepthbuf_vertex,It.fog_vertex&&" vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",It.fog_vertex,"}"].join(`
|
|
3911
|
+
`,n=-1/0,i=this.geometry.getAttribute("position");if(i)for(let s=0;s<i.count;s++){let a=i.getZ(s);a>n&&(n=a)}let o=new uz({uniforms:{maxZ:{value:n},uColor:{value:new G6(this.options[0].fillColor).convertLinearToSRGB()},uColor2:{value:new G6(De(this.options[0].fillColor)).convertLinearToSRGB()},uOpacity:{value:this.options[0].fillOpacity}},vertexShader:t,fragmentShader:e,transparent:!0});this.material=o}initLineMaterial(){let t=X.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:i}=n.geometry;for(let o=0;o<i.length;o++){let s=i[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 z6(u[0],u[1],e)),t.push(new z6(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({},Rc,n)),this.init()}};var B7=d(A(),1);import{Box2 as Lc,Object3D as lz,Sprite as k6,SpriteMaterial as V6,Vector2 as ra}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},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.options.text_font_size*this.textAspect:0}get textHeight(){return this.hasText?this.options.text_font_size:0}get hasOriginTexture(){let{text_texture:t,text_texture_width:e,text_texture_height:n,text_texture_offset_x:i,text_texture_offset_y:o}=this.options;return!zi(t)&&!zi(e)&&!zi(n)&&!zi(i)&&!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=>x(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 x(this,null,function*(){if(this.options.icon)return this._initIconPromise=new Promise(t=>x(this,null,function*(){let e;if(this.options.icon_border){let{icon:i,icon_size:o,icon_border:s}=this.options;e=yield ut.getUrlTextureBorder(i,o[0]-s.width*2,s)}else e=yield ut.getTextureByUrl(this.options.icon);let n=new k6(new V6({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:i,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(i/t.image.width,o/t.image.height),this.textAspect=i/o}else t=tt.getTextureByText(this.options.text),this.textAspect=t.image.width/t.image.height;let e=new k6(new V6({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,i=0,{icon:o}=this.options;o?this.hasText?(n=0,i=n*(this.iconHeight/this.textHeight)-this.iconHeight/this.textHeight-this.durIconAndText/this.textHeight):(n=.5,i=0):this.hasText?(i=.5,n=0):(n=0,i=0),(t=this.spriteIcon)==null||t.center.set(.5,n),(e=this.spriteText)==null||e.center.set(.5,i)}init(){return x(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,i=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 Lc(new ra(i-s,o-this.iconHeight),new ra(i+s,o)),u=this.textWidth/2,l=new Lc(new ra(i-u,o-this.textHeight-this.durIconAndText-this.iconHeight),new ra(i+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){super(),this.context=t,this.textAspect=1,this.box=new Lc,this._initIconPromise=null,this._initScale=n=>{let{zoom:i}=n;if(this.spriteText){let s=this.textHeight/i;this.spriteText.scale.set(this.textAspect*s,s,.1)}if(this.spriteIcon){var o;(o=this.spriteIcon)==null||o.scale.set(this.options.icon_size[0]/i,this.options.icon_size[1]/i,.1)}this.resetZ()},this.options=Kn(S({},cz,e),this),this.position.set(this.options.position.x,this.options.position.y,this.options.position.z),this.registryEvent(),this.init()}};import{DoubleSide as hz,Matrix4 as H6,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},ia=class extends dz{init(){return x(this,null,function*(){let t=this.options.map(s=>tt.getTextureByText(s.texts[0],{fillStyle:v0(s.fillColor,s.fillOpacity),strokeStyle:v0(s.strokeColor,s.strokeOpacity),lineWidth:6,font:"bold 54px sans-serif"})),e=t.map((s,a)=>{let u=this.options[a],{width:l,height:c}=s.image,h=l/c,p=u.secondHeight*h,f=new gz(p,u.secondHeight),m=new H6().makeTranslation(u.center_x,u.center_y,u.airHeight+u.deltaHeight+u.height).multiply(new H6().makeRotationZ(u.secondRotate));return f.applyMatrix4(m),f}),n=mz(e,!0);e.forEach(s=>s.dispose());let i=t.map(s=>{let a=new fz({map:s,alphaTest:1,side:hz});return s.needsUpdate=!0,a}),o=new pz(n,i);this.mesh=o,this.position.z+=.04,this.add(o)})}dispose(){var t,e;(t=this.mesh)==null||t.geometry.dispose(),((e=this.mesh)==null?void 0:e.material).forEach(n=>n.dispose()),this.clear()}constructor(t,e){super(),this.context=t,this.options=e.map(n=>S({},_z,n)),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:i,height:o}=this.context.clientSize;this.lineMaterial.resolution.set(i,o)},this.onResize(),this.registryEvent(),e&&n&&this.setPosition(e,n)}};import{Frustum as Sz}from"three";var oa=class extends Yt{setEnable(t){super.setEnable(t),dt(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:i}}}=this,o=C(this.startPoint,e,n,i),s=C(this.endPoint,e,n,i),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:i}=this;return((n=i.currentFloor)==null?void 0:n.graphicLayer.children.filter(o=>o instanceof et&&this.searchChildInFrustum(o,t,e)))||[]}searchChildInFrustum(t,e,n){let{context:{camera:i,container:{clientWidth:o,clientHeight:s}}}=this;if(!t)return!1;if(!t.mesh){let p=t.getPosition();if(p){let f=C(p,i,o,s);return en(f,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=C(u,i,o,s),h=C(l,i,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=i=>{if(!this.enable)return;let o=this.getIntersectByPointerEvent(i);o&&(this.startPoint=o),this.endPoint=void 0},this.onPointerMove=i=>{if(!this.enable||!this.startPoint)return;let o=this.getIntersectByPointerEvent(i);o&&(this.endPoint=o)},this.onPointerUp=i=>{if(!this.enable)return;let o=this.getIntersectByPointerEvent(i);o&&(this.endPoint=o),this.doSelect(),this.startPoint=void 0},this.onUpdate=()=>{if(this.startPoint){let i=this.getSvgCoordinate(this.startPoint),o=S({},i);this.endPoint&&(o=this.getSvgCoordinate(this.endPoint));let s={x:Math.min(i.x,o.x),y:Math.min(i.y,o.y)},a=Math.abs(o.x-i.x),u=Math.abs(o.y-i.y);dt(this.rect,s.x,s.y,a,u)}else dt(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 sa=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:i}=e,{x:o,y:s}=this.downPoint;if(Math.sqrt((o-n)**2+(s-i)**2)>3)return;let{graphics:a}=this.context.getGraphicsByDeviceXy(n,i),u=new Set(a.map(c=>c.options.id));this.context.getPoisByDeviceXy(n,i).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))}}),($n?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=>{Jn(e.key)&&this.enableBoxSelection()},this.onKeyUp=e=>{Jn(e.key)&&this.disableBoxSelection()},this.onBoxSelected=e=>{let{list:n}=e;this._list.clear(),n.forEach(i=>{this._list.add(i)}),this.selectEnd()},this.boxSelection=new oa(t),this.boxSelection.setEnable(!1),this.registryEvent()}};var VZ=d(de(),1),HZ=d(ge(),1),WZ=d(me(),1),qZ=d(_e(),1),XZ=d(ve(),1),jZ=d(ye(),1),YZ=d(xe(),1),KZ=d(A(),1);import{EventDispatcher as Mz,Vector2 as wz}from"three";var aa=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 W,this.graphicTimerMap=new Map,this.onPointerMove=e=>{let{graphics:n,pois:i,e:o}=e,s=i.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 f=i.find(m=>m.options.id===p.options.id);if(f instanceof Nn){let{x:m,y:_}=f.clientPos,y=Math.sqrt((m-o.offsetX)**2+(_-o.offsetY)**2);y<h&&(h=y,c=p)}else if(f instanceof nt){let{x:m,y:_}=f.box.getCenter(new wz),y=Math.sqrt((m-o.offsetX)**2+(_-o.offsetY)**2);y<h&&(h=y,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 a$=d(A(),1);import{Box3 as Tz,Vector3 as ua}from"three";var la=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(y=>y instanceof jt).length)return null;let e=this.box,{camera:n,clientSize:{width:i,height:o}}=this.context,{min:s,max:a}=e,u=C(s,n,i,o),l=C(a,n,i,o),c=C(new ua(s.x,a.y,a.z),n,i,o),h=C(new ua(a.x,s.y,s.z),n,i,o),p=Math.min(u.x,l.x,c.x,h.x),f=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:f,top:m,bottom:_}}checkDistanceToScreenEdge(t){let{left:e,right:n,top:i,bottom:o}=t,{width:s,height:a}=this.context.clientSize,[u,l,c,h]=this.context.config.cameraBound.padding,p=n>=h,f=s-e>=l,m=a-i>=c,_=o>=u;return p&&f&&m&&_}dispose(){this.unRegistryEvent()}constructor(t){this.context=t,this.prevCamera={position:new ua,zoom:1,target:new ua},this.enable=!0,this.box=new Tz,this.onCameraChange=()=>{let e=this.getCurFloorScreenPosition();if(e){let{left:n,right:i,top:o,bottom:s}=e;this.checkDistanceToScreenEdge({left:n,right:i,top:o,bottom:s})?this.changePrevCamera():this.backToPrevCamera()}},this.registryEvent(),this.changePrevCamera()}};var S$=d(Dc(),1);import{Vector3 as o3}from"three";import{Tween as da,Group as Yz}from"@tweenjs/tween.js";var v$=d(A(),1),y$=d(D(),1);import{EventDispatcher as Hz,MOUSE as br,Quaternion as r3,Spherical as ha,TOUCH as Mr,Vector2 as Pt,Vector3 as Kt,Plane as Wz,Ray as qz,MathUtils as Xz}from"three";var pa=new qz,i3=new Wz,jz=Math.cos(70*Xz.DEG2RAD),fa=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 Pt,this.rotateLineEnd=new Pt,this.spherical=new ha,this.sphericalDelta=new ha,this.object=t,this.domElement=e,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new Kt,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:br.PAN,MIDDLE:br.DOLLY,RIGHT:br.ROTATE},this.touches={ONE:Mr.PAN,TWO:Mr.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(v){v.addEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=v},this.stopListenToKeyEvents=function(){var v;(v=this._domElementKeyEvents)==null||v.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=i.NONE},this.update=function(){let v=new Kt,b=new r3().setFromUnitVectors(t.up,new Kt(0,1,0)),G=b.clone().invert(),Z=new Kt,wt=new r3,he=new Kt,Zt=2*Math.PI;return function(Pr){Pr===void 0&&(Pr=null);let Ae=n.object.position;v.copy(Ae).sub(n.target),v.applyQuaternion(b),a.setFromVector3(v),n.autoRotate&&o===i.NONE&&k(j(Pr)),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+=Zt:Ce>Math.PI&&(Ce-=Zt),Re<-Math.PI?Re+=Zt:Re>Math.PI&&(Re-=Zt),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&&U||n.object.isOrthographicCamera?a.radius=Mt(a.radius):a.radius=Mt(a.radius*l),v.setFromSpherical(a),v.applyQuaternion(G),Ae.copy(n.target).add(v),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&&U){let Ir=null;if(n.object.isPerspectiveCamera){let Lr=v.length();Ir=Mt(Lr*l);let ji=Lr-Ir;n.object.position.addScaledVector(P,ji),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){let Lr=new Kt(R.x,R.y,0);Lr.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 Kt(R.x,R.y,0);ji.unproject(n.object),n.object.position.sub(ji).add(Lr),n.object.updateMatrixWorld(),Ir=v.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;Ir!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(Ir).add(n.object.position):(pa.origin.copy(n.object.position),pa.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(pa.direction))<jz?t.lookAt(n.target):(i3.setFromNormalAndCoplanarPoint(n.object.up,n.target),pa.intersectPlane(i3,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,U=!1,Xi||Z.distanceToSquared(n.object.position)>s||8*(1-wt.dot(n.object.quaternion))>s||he.distanceToSquared(n.target)>0?(n.dispatchEvent({type:"change"}),Z.copy(n.object.position),wt.copy(n.object.quaternion),he.copy(n.target),Xi=!1,!0):!1}}();let n=this,i={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6},o=i.NONE,s=1e-6,a=new ha,u=new ha,l=1,c=new Kt,h=new Pt,p=new Pt,f=new Pt,m=new Pt,_=new Pt,y=new Pt,E=new Pt,M=new Pt,w=new Pt,P=new Kt,R=new Pt,U=!1,T=[],I={};function j(v){return v!==null?2*Math.PI/60*n.autoRotateSpeed*v:2*Math.PI/60/60*n.autoRotateSpeed}function Y(){return Math.pow(.95,n.zoomSpeed)}function k(v){u.theta-=v}function ht(v){u.phi-=v}let yt=function(){let v=new Kt;return function(G,Z){v.setFromMatrixColumn(Z,0),v.multiplyScalar(-G),c.add(v)}}(),Lt=function(){let v=new Kt;return function(G,Z){n.screenSpacePanning===!0?v.setFromMatrixColumn(Z,1):(v.setFromMatrixColumn(Z,0),v.crossVectors(n.object.up,v)),v.multiplyScalar(G),c.add(v)}}(),Nt=function(){let v=new Kt;return function(G,Z){let wt=n.domElement;if(n.object.isPerspectiveCamera){let he=n.object.position;v.copy(he).sub(n.target);let Zt=v.length();Zt*=Math.tan(n.object.fov/2*Math.PI/180),yt(2*G*Zt/wt.clientHeight,n.object.matrix),Lt(2*Z*Zt/wt.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(yt(G*(n.object.right-n.object.left)/n.object.zoom/wt.clientWidth,n.object.matrix),Lt(Z*(n.object.top-n.object.bottom)/n.object.zoom/wt.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function Fn(v){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?l/=v:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Cr(v){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?l*=v:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Rr(v){if(!n.zoomToCursor)return;U=!0;let b=n.domElement.getBoundingClientRect(),G=v.clientX-b.left,Z=v.clientY-b.top,wt=b.width,he=b.height;R.x=G/wt*2-1,R.y=-(Z/he)*2+1,P.set(R.x,R.y,1).unproject(n.object).sub(n.object.position).normalize()}function Mt(v){return Math.max(n.minDistance,Math.min(n.maxDistance,v))}function Jc(v){h.set(v.clientX,v.clientY)}function G3(v){Rr(v),E.set(v.clientX,v.clientY)}function Qc(v){m.set(v.clientX,v.clientY)}function k3(v){p.set(v.clientX,v.clientY),f.subVectors(p,h).multiplyScalar(n.rotateSpeed);let b=n.domElement;k(2*Math.PI*f.x/b.clientHeight),ht(2*Math.PI*f.y/b.clientHeight),h.copy(p),n.update()}function V3(v){M.set(v.clientX,v.clientY),w.subVectors(M,E),w.y>0?Fn(Y()):w.y<0&&Cr(Y()),E.copy(M),n.update()}function H3(v){_.set(v.clientX,v.clientY),y.subVectors(_,m).multiplyScalar(n.panSpeed),Nt(y.x,y.y),m.copy(_),n.update()}function W3(v){Rr(v),v.deltaY<0?Cr(Y()):v.deltaY>0&&Fn(Y()),n.update()}function q3(v){let b=!1;switch(v.code){case n.keys.UP:v.ctrlKey||v.metaKey||v.shiftKey?ht(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Nt(0,n.keyPanSpeed),b=!0;break;case n.keys.BOTTOM:v.ctrlKey||v.metaKey||v.shiftKey?ht(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Nt(0,-n.keyPanSpeed),b=!0;break;case n.keys.LEFT:v.ctrlKey||v.metaKey||v.shiftKey?k(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Nt(n.keyPanSpeed,0),b=!0;break;case n.keys.RIGHT:v.ctrlKey||v.metaKey||v.shiftKey?k(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Nt(-n.keyPanSpeed,0),b=!0;break}b&&(v.preventDefault(),n.update())}function th(){if(T.length===1)h.set(T[0].pageX,T[0].pageY);else{let v=(T[0].pageX-T[0].pageY)/(T[1].pageX-T[1].pageY),b=T[0].pageY-v*T[0].pageX;n.rotateLineStart.set(v,b);let G=.5*(T[0].pageX+T[1].pageX),Z=.5*(T[0].pageY+T[1].pageY);h.set(G,Z)}}function eh(){if(T.length===1)m.set(T[0].pageX,T[0].pageY);else{let v=.5*(T[0].pageX+T[1].pageX),b=.5*(T[0].pageY+T[1].pageY);m.set(v,b)}}function nh(){let v=T[0].pageX-T[1].pageX,b=T[0].pageY-T[1].pageY,G=Math.sqrt(v*v+b*b);E.set(0,G)}function X3(){n.enableZoom&&nh(),n.enablePan&&eh()}function j3(){n.enableZoom&&nh(),n.enableRotate&&th()}function rh(v){if(T.length==1)p.set(v.pageX,v.pageY);else{let G=ka(v),Z=.5*(v.pageX+G.x),wt=.5*(v.pageY+G.y);p.set(Z,wt);let he=(v.pageY-G.y)/(v.pageX-G.x),Zt=G.y-he*G.x;if(n.rotateLineEnd.set(he,Zt),Number.isFinite(n.rotateLineEnd.x)&&Number.isFinite(n.rotateLineStart.x)){let Va=(n.rotateLineStart.y-n.rotateLineEnd.y)/(n.rotateLineEnd.x-n.rotateLineStart.x),Pr=he*Va+Zt;if(Number.isFinite(Va)&&Number.isFinite(Pr)){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)}f.subVectors(p,h).multiplyScalar(n.rotateSpeed);let b=n.domElement;ht(2*Math.PI*f.y/b.clientHeight),h.copy(p)}function ih(v){if(T.length===1)_.set(v.pageX,v.pageY);else{let b=ka(v),G=.5*(v.pageX+b.x),Z=.5*(v.pageY+b.y);_.set(G,Z)}y.subVectors(_,m).multiplyScalar(n.panSpeed),Nt(y.x,y.y),m.copy(_)}function oh(v){let b=ka(v),G=v.pageX-b.x,Z=v.pageY-b.y,wt=Math.sqrt(G*G+Z*Z);M.set(0,wt),w.set(0,Math.pow(M.y/E.y,n.zoomSpeed)),Fn(w.y),E.copy(M)}function Y3(v){n.enableZoom&&oh(v),n.enablePan&&ih(v)}function K3(v){n.enableZoom&&oh(v),n.enableRotate&&rh(v)}this.onPointerDown=function(b){n.enabled!==!1&&(T.length===0&&(n.domElement.setPointerCapture(b.pointerId),n.domElement.addEventListener("pointermove",n.onPointerMove),n.domElement.addEventListener("pointerup",n.onPointerUp)),t1(b),b.pointerType==="touch"?J3(b):Z3(b))},this.onPointerMove=function(b){n.enabled!==!1&&(b.pointerType==="touch"?Q3(b):$3(b))},this.onPointerUp=function(b){e1(b),T.length===0&&(n.domElement.releasePointerCapture(b.pointerId),n.domElement.removeEventListener("pointermove",n.onPointerMove),n.domElement.removeEventListener("pointerup",n.onPointerUp)),n.dispatchEvent({type:"end"}),o=i.NONE};function Z3(v){let b;switch(v.button){case 0:b=n.mouseButtons.LEFT;break;case 1:b=n.mouseButtons.MIDDLE;break;case 2:b=n.mouseButtons.RIGHT;break;default:b=-1}switch(b){case br.DOLLY:if(n.enableZoom===!1)return;G3(v),o=i.DOLLY;break;case br.ROTATE:if(v.ctrlKey||v.metaKey||v.shiftKey){if(n.enablePan===!1)return;Qc(v),o=i.PAN}else{if(n.enableRotate===!1)return;Jc(v),o=i.ROTATE}break;case br.PAN:if(v.ctrlKey||v.metaKey||v.shiftKey){if(n.enableRotate===!1)return;Jc(v),o=i.ROTATE}else{if(n.enablePan===!1)return;Qc(v),o=i.PAN}break;default:o=i.NONE}o!==i.NONE&&n.dispatchEvent({type:"start"})}function $3(v){switch(o){case i.ROTATE:if(n.enableRotate===!1)return;k3(v);break;case i.DOLLY:if(n.enableZoom===!1)return;V3(v);break;case i.PAN:if(n.enablePan===!1)return;H3(v);break}}this.onMouseWheel=function(b){n.enabled===!1||n.enableZoom===!1||o!==i.NONE||(b.preventDefault(),n.dispatchEvent({type:"start"}),W3(b),n.dispatchEvent({type:"end"}))},this.onKeyDown=function(b){n.enabled===!1||n.enablePan===!1||q3(b)};function J3(v){switch(sh(v),T.length){case 1:switch(n.touches.ONE){case Mr.ROTATE:if(n.enableRotate===!1)return;th(),o=i.TOUCH_ROTATE;break;case Mr.PAN:if(n.enablePan===!1)return;eh(),o=i.TOUCH_PAN;break;default:o=i.NONE}break;case 2:switch(n.touches.TWO){case Mr.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;X3(),o=i.TOUCH_DOLLY_PAN;break;case Mr.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;j3(),o=i.TOUCH_DOLLY_ROTATE;break;default:o=i.NONE}break;default:o=i.NONE}o!==i.NONE&&n.dispatchEvent({type:"start"})}function Q3(v){switch(sh(v),o){case i.TOUCH_ROTATE:if(n.enableRotate===!1)return;rh(v),n.update();break;case i.TOUCH_PAN:if(n.enablePan===!1)return;ih(v),n.update();break;case i.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Y3(v),n.update();break;case i.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;K3(v),n.update();break;default:o=i.NONE}}this.onContextMenu=function(b){n.enabled!==!1&&b.preventDefault()};function t1(v){T.push(v)}function e1(v){delete I[v.pointerId];for(let b=0;b<T.length;b++)if(T[b].pointerId==v.pointerId){T.splice(b,1);return}}function sh(v){let b=I[v.pointerId];b===void 0&&(b=new Pt,I[v.pointerId]=b),b.set(v.pageX,v.pageY)}function ka(v){let b=v.pointerId===T[0].pointerId?T[1]:T[0];return I[b.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 ga=class extends fa{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:i}=this,o=n===i;(e||t<=n&&t>=i)&&(this.maxPolarAngle=t,this.minPolarAngle=t,this.update()),o||(this.maxPolarAngle=n,this.minPolarAngle=i)}setPolarAngleByDuration(t,e,n){return x(this,null,function*(){return e===void 0&&(e=!1),n===void 0&&(n=500),n<=0?this.setPolarAngle(t,e):Ft(new Promise(i=>{let o={polar:this.getPolarAngle()},s={polar:t},a=new da(o,this.tweenGroup).to(s,n).onUpdate(()=>{this.setPolarAngle(o.polar,e)}).onComplete(()=>{this.enabled=!0,this.tweenGroup.remove(a),i(!0)}).onStart(()=>{this.enabled=!1}).start()}),n+500)})}setAzimuthalAngle(t,e){let{maxAzimuthAngle:n,minAzimuthAngle:i}=this,o=n===i;(e||t<=n&&t>=i)&&(this.maxAzimuthAngle=t,this.minAzimuthAngle=t,this.update()),o||(this.maxAzimuthAngle=n,this.minAzimuthAngle=i)}setAzimuthalAngleDuration(t,e,n){return e===void 0&&(e=!1),n===void 0&&(n=500),n<=0?this.setAzimuthalAngle(t,e):Ft(new Promise(i=>{let o={azimuthal:this.getAzimuthalAngle()},s={azimuthal:t},a=new da(o,this.tweenGroup).to(s,n).onUpdate(()=>{this.setAzimuthalAngle(o.azimuthal,e)}).onComplete(()=>{this.enabled=!0,this.tweenGroup.remove(a),i(!0)}).onStart(()=>{this.enabled=!1}).start()}),n+500)}getCameraLookAt(){return new o3().subVectors(this.target,this.camera.position)}setCameraPositionByTarget(t,e){return x(this,null,function*(){let n=this.target.clone(),i=this.getCameraLookAt();if(!e){this.camera.position.copy(t.clone().sub(i)),this.target.copy(t.clone()),this.update();return}return Ft(new Promise(o=>{let s=new da(n,this.tweenGroup).to(t,e).onUpdate(()=>{this.camera.position.copy(n.clone().sub(i)),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:i,maxZoom:o}=this;(n||t>=i&&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,i){return x(this,null,function*(){n===void 0&&(n=!1),i===void 0&&(i=500);let o={zoom:this.camera.zoom,target:this.target.clone()};if(t!==this.camera.zoom)return i?Ft(new Promise(s=>{let a=new da(o,this.tweenGroup).to({zoom:t,target:e},i).onUpdate(()=>{this.setZoom(o.zoom,o.target,n)}).onComplete(()=>{this.tweenGroup.remove(a),this.enabled=!0,s(!0)}).onStart(()=>{this.enabled=!1}).start()}),i+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 o3;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 i=this.camera.zoom;i!==this.prevCameraZoom&&(this.prevCameraZoom=i,this.dispatchEvent({type:"change-zoom",zoom:i}))},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 ma=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 W,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 _a=class extends tG{constructor(){super(),new nG().load(T6,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 va=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 ya=class extends iG{resizeClientSize(){let{x:t,y:e,width:n,height:i}=this.container.getBoundingClientRect();this.clientSize={width:n||this.container.clientWidth,height:i||this.container.clientHeight,x:t,y:e}}init(){let{clientWidth:t,clientHeight:e}=this.container;this.camera=new va(t,e),this.renderer.setSize(t,e),this.renderer.setCameraAndScene(this.scene,this.camera),this.renderer.autoRender(),this.control=new ga(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 la(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:i}=this.container,o=C(t,this.camera,n,i),s=C(e,this.camera,n,i);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 i=new wr;i.x=t/this.clientSize.width*2-1,i.y=e/this.clientSize.height*-2+1;let o=new sG;return o.setFromCamera(i,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,i;let o=(n=this.currentFloor)==null?void 0:n.poiLayer.getPoiByDeviceXy(t,e),s=(i=this.currentFloor)==null?void 0:i.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,i){e===void 0&&(e=[20,20,20,20]),n===void 0&&(n=500),i===void 0&&(i=!0);let[o,s,a,u]=e,{clientSize:{width:l,height:c}}=this,h=this.control.getPolarAngle();i&&this.setPolarAngle(0,0);let p=new aG().setFromObject(t);this.setPolarAngle(h,0);let{max:f,min:m}=p,_=new We(m.x,f.y,f.z),y=new We(f.x,f.y,f.z),E=new We(f.x,m.y,m.z),M=new We(m.x,m.y,m.z),w=C(_,this.camera,l,c),P=C(y,this.camera,l,c),R=C(M,this.camera,l,c),U=C(E,this.camera,l,c),I=new oG().setFromPoints([new wr(w.x,w.y),new wr(P.x,P.y),new wr(R.x,R.y),new wr(U.x,U.y)]).getSize(new wr),j=(l-s-u)/I.x,Y=(c-o-a)/I.y,k=Math.min(j,Y),ht=new We((f.x+m.x)/2,(f.y+m.y)/2,(f.z+m.z)/2),yt=k*this.camera.zoom,Lt=this.camera.clone();Lt.zoom=yt,Lt.updateMatrix();let Nt=(l-I.x*k)/2,Fn=(c-I.y*k)/2,Cr=(s-u)/2,Rr=(o-a)/2;if(Cr){let Mt=new We;Mt.setFromMatrixColumn(Lt.matrix,0),Mt.normalize(),Mt.multiplyScalar(Cr/yt),ht.add(Mt)}if(Rr){let Mt=new We;Mt.setFromMatrixColumn(Lt.matrix,1),Mt.normalize(),Mt.multiplyScalar(Rr/yt),ht.add(Mt)}return{zoom:k*this.camera.zoom,center:ht}}fitCameraToObject(t,e,n,i){e===void 0&&(e=[20,20,20,20]),n===void 0&&(n=500),i===void 0&&(i=!0);let{zoom:o,center:s}=this.getFitCameraToObjectZoom(t,e,n,i);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 x(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 _a,this.renderer=new ma,this.lights=Vg(),this.clientSize={width:0,height:0,x:0,y:0},this.renderRf=0,this.onControlChange=()=>{this.dispatchEvent({type:"change-ratio",px:(this.basicRatio||0)*this.camera.zoom}),this.dispatchEvent({type:"control-change"})},this.onControlChangeZoom=n=>{let{zoom:i}=n;this.dispatchEvent({type:"control-zoom-change",zoom:i})},this.onRendererUpdate=()=>{this.dispatchEvent({type:"update"})},this.onWindowResize=()=>{let{container:n,camera:i,renderer:o}=this,{clientWidth:s,clientHeight:a}=n;s=Math.max(1,s),a=Math.max(1,a),i.left=-s/2,i.right=s/2,i.top=a/2,i.bottom=-a/2,i.updateProjectionMatrix(),o.setSize(s,a),this.resizeClientSize(),this.dispatchEvent({type:"resize",width:s,height:a})},this.onClick=n=>{let{graphics:i,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY);i.length&&this.dispatchEvent({type:"graphic-click",graphics:i,position:o});let s=this.getPoisByDeviceXy(n.offsetX,n.offsetY);s.length&&this.dispatchEvent({type:"poi-click",pois:s})},this.onPointerover=n=>{let{graphics:i,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY),s=this.getPoisByDeviceXy(n.offsetX,n.offsetY);this.dispatchEvent({type:"pointer-over",e:n,graphics:i,pois:s,position:o})},this.onPointermove=n=>{let{graphics:i,position:o}=this.getGraphicsByDeviceXy(n.offsetX,n.offsetY),s=this.getPoisByDeviceXy(n.offsetX,n.offsetY);this.dispatchEvent({type:"pointer-move",e:n,graphics:i,pois:s,position:o})},this.onPointerleave=n=>{this.dispatchEvent({type:"pointer-level"})},this.onSelectionSelect=n=>{let{graphics:i,isMultipleSelect:o}=n;this.dispatchEvent({type:"select-graphic",graphics:i,isMultipleSelect:o})},this.onHoverChange=n=>{let{graphics:i}=n;this.dispatchEvent({type:"hover",graphics:i})},this.container.style.position="relative",this.container.style.overflow="hidden",this.init(),this.selection=new sa(this),this.hoverHelper=new aa(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 s3(r){return cG({},hG,r)}import{debounce as PG}from"lodash";var hJ=d(A(),1);var le;function a3(r,t){return r===void 0&&(r="aibee_map"),t===void 0&&(t=1),new Promise((e,n)=>{if(le)return e({db:le,type:"success"});let i=indexedDB.open(r,t);i.onupgradeneeded=function(o){le=o.target.result,console.log("onupgradeneeded"),e({db:le,type:"onupgradeneeded"})},i.onsuccess=o=>{le=o.target.result,e({db:le,type:"success"})},i.onerror=o=>{n(o)}})}function Uc(r,t,e){return e===void 0&&(e=le),new Promise((n,i)=>{e||i("\u6CA1\u6709db");let s=e.transaction([r],"readonly").objectStore(r).get(t);s.onsuccess=()=>{s.result?n(s.result.value):n(null)},s.onerror=a=>{console.log("[getVersionByKey]",a),n(null)}})}function u3(r,t,e,n){return n===void 0&&(n=le),new Promise((i,o)=>(n||o("\u6CA1\u6709db"),new Promise((s,a)=>x(this,null,function*(){let u=yield Uc(r,t),l=n.transaction([r],"readwrite").objectStore(r),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(r,t){t===void 0&&(t=le),t&&(t.objectStoreNames.contains(r)||t.createObjectStore(r,{keyPath:"key"}))}function l3(r){r===void 0&&(r=le),r==null||r.close(),le=null}import{Vector3 as MG,EventDispatcher as wG,Color as TG}from"three";var rJ=d(D(),1),iJ=d(A(),1);function xa(r,t){let e=r.poi_info.showName||r.store_name||r.poi_info.text;switch(t){case"zh-cn":return e;case"en":var n;return((n=r.store_info_ext)==null?void 0:n.poi_name)||e;case"zh-hk":var i;return((i=r.store_info_ext)==null?void 0:i.traditional_name)||e}}function Ea(r,t){let e=r.poi_info.showName||r.store_name||r.poi_info.text;switch(t){case"zh-cn":return e;case"en":var n;return((n=r.infra_info_ext)==null?void 0:n.poi_name)||e;case"zh-hk":var i;return((i=r.infra_info_ext)==null?void 0:i.traditional_name)||e}}function c3(r,t,e){switch(r.l_type){case"graph":return pG(r,t);case"wall":return fG(r,t);case"lane":return dG(r,t);case"texture2d":case"texture3d":return gG(r,t);case"glb":return mG(r,t);case"store":return _G(r,t);case"facility":return yG(r,t);case"parkingSpace":return EG(r,t,e);case"text":return bG(r,t)}}function h3(r,t,e,n){switch(r.l_type){case"store":return vG(r,t,e,n.showStoreName);case"facility":return xG(r,t,e,n.showFacilityName);case"parkingSpace":return SG(r,t)}}function pG(r,t){let e=r.elements.reduce((n,i)=>{let{fillColor:o,fillOpacity:s,strokeColor:a,strokeOpacity:u,height:l,airHeight:c}=i,h=o.toLowerCase()+"-"+s+"-"+a.toLowerCase()+"-"+u+"-"+l+"-"+c;return u===0&&(h=o.toLowerCase()+"-"+s+"-"+l+"-"+c),n[h]?n[h].push(i):n[h]=[i],n},{});Object.values(e).forEach(n=>{let i=new Sr(t.context,n);t.mergeGraphicLayer.add(i)})}function fG(r,t){let e=r.elements.reduce((n,i)=>{let{fillColor:o,fillOpacity:s,strokeColor:a,strokeOpacity:u,height:l}=i,c=o.toLowerCase()+"-"+s+"-"+a.toLowerCase()+"-"+u+"-"+l;return u===0&&(c=o.toLowerCase()+"-"+s+"-"+l),n[c]?n[c].push(i):n[c]=[i],n},{});Object.values(e).forEach(n=>{let i=new ta(t.context,n);t.wallLayer.add(i)})}function dG(r,t){let e=r.elements.reduce((n,i)=>{let{fillColor:o,fillOpacity:s,strokeColor:a,strokeOpacity:u}=i,l=o.toLowerCase()+"-"+s+"-"+a.toLowerCase()+"-"+u;return u===0&&(l=o.toLowerCase()+"-"+s),n[l]?n[l].push(i):n[l]=[i],n},{});Object.values(e).forEach(n=>{let i=new na(t.context,n);t.laneLayer.add(i)})}function gG(r,t){if(r.elements.length){let e=new Er(t.context,r.elements);t.textureLayer.add(e)}}function mG(r,t){r.elements.forEach(e=>{let n=new ea(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(r,t){r.elements.map(e=>{let n=t.addGraphic(e);t.userData.graphics.push(n),t.userData.graphicMap.set(e.id,n)})}function vG(r,t,e,n){r.elements.map(i=>{try{let o=xa(i,e),s=new nt(t.context,{id:i.id,icon:i.poi_info.icon,text:o,position:{x:i.center_coord_x,y:i.center_coord_y,z:i.airHeight+i.height},icon_size:[24,24],level:i.poi_info.level||0,hide_text:!n});t.poiLayer2.pushPoi(s),s&&(s.userData.type="store",s.userData.data=i,s.userData.floor=t.name)}catch(o){console.log("\u521B\u5EFA\u5E97\u94FApoi\u5931\u8D25",o,i)}})}function yG(r,t){r.elements.map(e=>{let n=t.addGraphic(e);t.userData.graphics.push(n),t.userData.graphicMap.set(e.id,n)})}function xG(r,t,e,n){r.elements.filter(o=>o.poi_info).map(o=>{try{let s=Ea(o,e),a=new nt(t.context,{id:o.id,icon: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});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(r,t,e){t.parkingSpaceLayer.createParkings(r.elements,e.mergeParkingSpace),t.userData.parkingSpaces=t.parkingSpaceLayer.graphicMap.values(),t.userData.parkingSpacesGraphicMap=t.parkingSpaceLayer.graphicMap}function SG(r,t){return x(this,null,function*(){let e=r.elements.filter(o=>o.texts[0]),n=e.map(o=>o.texts[0]),i=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:i[s].texture,text_texture_width:i[s].width,text_texture_height:i[s].height,text_texture_offset_x:i[s].x,text_texture_offset_y:i[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(i).forEach(o=>{o.texture.dispose()})})}function bG(r,t){let e=new ia(t.context,r.elements.map(n=>S({},n,{center_x:n.center_coord_x,center_y:n.center_coord_y})));t.textTextureLayer.add(e)}var Fc="map_version",Bc="route_version",zc="facility_version",Gc="map_data",Sa="road_network_data",kc="facility_data",AG={mergeParkingSpace:!0},Tr=class extends wG{initDb(){return x(this,null,function*(){try{let{db:t,type:e}=yield a3("aibee_map",2);e==="onupgradeneeded"&&(On(Fc),On(Bc),On(zc),On(Gc),On(Sa),On(kc)),this.db=t}catch(t){console.log("[\u6253\u5F00indexDb\u9519\u8BEF]",t)}})}load(t,e){return x(this,null,function*(){if(Array.isArray(t))this.floors=t,e&&(this.placeConfig=S({},this.placeConfig,e));else{let n=yield fetch(t).then(i=>i.json());n.code===200&&(this.floors=n.data.list,this.placeConfig=S({},this.placeConfig,JSON.parse(n.data.config||"{}")))}})}setCacheData(t,e,n){return this.initDbPromise.then(()=>u3(t,""+e,n,this.db))}getCacheData(t,e){return this.initDbPromise.then(()=>Uc(t,""+e,this.db))}getFloorCacheKey(t){return""+t.floor_id}getFloorData(t){return x(this,null,function*(){let e=yield this.getFloorJsonData(t);return e?this.getDataByJson(e):null})}getFloorDataByFloorInfo(t){return x(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=xa(e.userData.data,t)),e.userData.type==="facility"&&(e.options.text=Ea(e.userData.data,t))})}getFloorJsonDataByFloorInfo(t){return x(this,null,function*(){let e=this.getFloorCacheKey(t);console.time("zstd_json");let n=yield fetch(t.map_url).then(i=>i.json());return n.floor=t.floor,console.timeEnd("zstd_json"),this.setCacheData(Gc,e,n),this.setCacheData(Fc,e,t.version_id),n})}getFloorJsonData(t){return x(this,null,function*(){let e=this.floors.find(i=>i.floor===t);if(!e)return null;let n=this.getFloorCacheKey(e);try{if((yield this.getCacheData(Fc,n))===e.version_id){let o=yield this.getCacheData(Gc,n);if(o)return o}return this.getFloorJsonDataByFloorInfo(e)}catch(i){return console.log("[get floor data error]",i),this.getFloorJsonDataByFloorInfo(e)}})}getRoadNetworkData(){return x(this,null,function*(){return(yield Promise.all(this.floors.map(e=>x(this,null,function*(){let n=this.getFloorCacheKey(e);try{if((yield this.getCacheData(Bc,n))===e.version_id){let s=yield this.getCacheData(Sa,n);if(s)return s}let o=yield fetch(e.route_url).then(s=>s.json());return this.setCacheData(Sa,n,o),this.setCacheData(Bc,n,e.version_id),o}catch(i){let o=yield fetch(e.route_url).then(s=>s.json());return this.setCacheData(Sa,n,o),o}})))).filter(e=>e.points)})}getFacilitiesData(){return x(this,null,function*(){let t=this.floors.reduce((i,o)=>i.updated_at>o.updated_at?i:o,this.floors[0]);if(!t)return null;let e=this.getFloorCacheKey(t),n=()=>x(this,null,function*(){let i=yield fetch(t.entry_infra_url).then(o=>o.json());return i&&(this.setCacheData(kc,e,i),this.setCacheData(zc,e,t.version_id)),i});try{if((yield this.getCacheData(zc,e))===t.version_id){let o=yield this.getCacheData(kc,e);if(o)return o}return n()}catch(i){return console.log("[get facility error]",i),n()}})}getOtherDataByFreeTime(){return x(this,null,function*(){})}getMulFloorsData(t){return x(this,null,function*(){return Promise.all(t.map(e=>this.getFloorData(e))).then(e=>e.filter(n=>n))})}getDataByUrl(t){return x(this,null,function*(){let e=yield fetch(t).then(n=>n.json());return this.getDataByJson(e)})}getDataByJson(t,e,n){return x(this,null,function*(){return e=this.getFloorBaseLayer(t,e),n=S({},this.placeConfig,n),t.layers.forEach(i=>{["range","ground"].includes(i.l_type)||nr(i.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),i=Math.max(n.x,n.y,n.z);e.userData.height=i/4+t.floorHeight}switchFloor(t,e){return x(this,null,function*(){return new Promise(n=>{let i={run:()=>this._switchFloor(t,e),meta:{type:"switchFloor"}},o=this.taskQueue.replaceByMetaType(i),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 x(this,null,function*(){var n;let i=t;if(typeof t=="string"){let l=yield this.getFloorJsonData(t);if(l)i=l;else return null}e=S({},this.placeConfig,e);let o=new jt(this.bmap.context);o.userData.data=t;let s=this.floors.find(l=>l.floor===i.floor);var a;let u=(a=s==null?void 0:s.map_angle)!=null?a:0;return this.bmap.dispatchEvent({type:ct.SWITCH_FLOOR_BEFORE,data:{curFloor:o,graphics:[]}}),this.dispatchEvent({type:"switch-floor-before",data:{curFloor:o,graphics:[],floorData:i}}),this.bmap.context.control.setAzimuthalAngle(u/180*Math.PI,!0),this.bmap.context.scene.background=new TG(e.backgroundColor),this.getFloorBaseLayer(i,o),this.changeFloorBox(i,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.cameraBound.updateBox(),i.layers.forEach(l=>{["range","ground"].includes(l.l_type)||nr(l.elements,o.userData.center)}),this.dispatchEvent({type:"switch-floor-ground",data:{curFloor:o,graphics:[]}}),this.bmap.dispatchEvent({type:ct.SWITCH_FLOOR_GROUND,data:{curFloor:o}}),yield Ho(),yield this.getFloorContentLayer(i,o),this.changeFloorBox(i,o),this.dispatchEvent({type:"switch-floor-content",data:{curFloor:o,graphics:[]}}),yield Om(2),yield this.getFloorPoi(i,o,e),this.dispatchEvent({type:"switch-floor-after",data:{curFloor:o,graphics:o.graphicLayer.children}}),this.bmap.dispatchEvent({type:ct.SWITCH_FLOOR_AFTER,data:{curFloor:o,graphics:o.graphicLayer.children}}),o})}getFloorBaseLayer(t,e){e||(e=new jt(this.bmap.context));let n=[0,0];return t.layers.forEach(i=>{switch(i.l_type){case"range":let o=i.elements[0];n=[o.center_x,o.center_y];break;case"ground":nr(i.elements,n);let s=i.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 x(this,null,function*(){e||(e=new jt(this.bmap.context)),e.userData.graphics=[],e.userData.graphicMap=new Map;let n=Date.now();for(let i=0;i<t.layers.length;i++){let o=t.layers[i];["range","ground"].includes(o.l_type)||(c3(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 x(this,null,function*(){n===void 0&&(n=this.placeConfig);let i=Date.now();yield Promise.all(t.layers.map(s=>h3(s,e,this.locale,n))),console.log("poi time",Date.now()-i);let o=Date.now();Ho().then(()=>{console.log("poi render time",Date.now()-o)})})}clear(){return x(this,null,function*(){var t;l3((t=this.db)!=null?t:void 0)})}dispose(){this.clear()}constructor(t,e={}){super(),this.bmap=t,this.floors=[],this.initDbPromise=Promise.resolve(),this.db=null,this.taskQueue=new rr,this.locale="zh-cn",this.placeConfig={backgroundColor:"#f1f7f6",showFacilityName:!0,showStoreName:!0},this.options=S({},AG,e),this.initDbPromise=this.initDb()}};var TJ=d(A(),1);function p3(r,t){return x(this,null,function*(){let{brand:e,project:n}=r,{apiDomain:i,apiPath:{floorRange:o},apiInfo:s}=t,a=""+i+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(r,t){return x(this,null,function*(){let{brand:e,project:n,floor:i,ts:o,resource_type_list:s}=r,{apiDomain:a,apiPath:{floorGraphic:u},apiInfo:l}=t,c=""+a+u+"?brand="+e+"&project="+n+"&phase="+n+"&building="+n+"&floor="+i+"&ts="+o+"&resource_type_list="+s;return yield fetch(c,l).then(p=>p.json()).then(p=>p.data).then(p=>((p||[]).map(f=>f.info=JSON.parse(f.info)),p||[]))})}function xJ(r,t){return x(this,null,function*(){let{project:e,floor:n}=r,{apiDomain:i,apiInfo:o}=t,s=i+"/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?CG(u.fileId,t):null)})}function CG(r,t){return x(this,null,function*(){let{apiDomain:e,apiInfo:n}=t;return fetch(e+"/api/inception-map/file/getFileStream?fileId="+r,n).then(i=>i.arrayBuffer()).then(i=>{let s=new TextDecoder("utf-8").decode(i);return s?JSON.parse(s):null})})}var d3=class{load(t){return x(this,null,function*(){let e=Qn(t);if(this.cacheData.has(e))return this.cacheData.get(e);let[,n]=yield Promise.all([this.loadBuildGround(t),f3(t,this.bmap.config)]),i=Qn({floor:t.floor,ts:t.ts});nr(n.map(s=>s.info),this.bmap.buildingCenter,this.floorDataLengthMap.get(i)||0),n.forEach(s=>s.info.transformToBuildingGround=!1),this.cacheData.set(e,n);let o=this.floorDataLengthMap.get(i)||0;return this.floorDataLengthMap.set(i,o+n.length),this.loadExternalStreet(t),n})}loadExternalStreet(t){return x(this,null,function*(){})}switchFloorByData(t,e){if(!t.length)return;let n=e.userData.legacyToGraphicMap||new Map,i=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)}i.set(u.element_uuid,u)}e.userData.legacyToGraphicMap=n,e.userData.graphicMap=i,e.updateBox(),e===this.bmap.context.currentFloor?(this.bmap.triggerHooks(ct.SWITCH_FLOOR_BEFORE,{curFloor:e,graphics:e.graphicLayer.children}),this.bmap.initialFloorCamera(),this.bmap.triggerHooks(ct.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(i=>!n.has(i.element_uuid))}switchFloorByStoreData(t,e){return x(this,null,function*(){let n=yield this.load(S({},t,{resource_type_list:"6"})),i=this.filterData(n,e);this.switchFloorByData(i,e)})}switchFloorByOtherData(t,e){return x(this,null,function*(){let n=yield this.load(S({},t,{resource_type_list:"1,2,3,4"})),i=this.filterData(n,e);this.switchFloorByData(i,e)})}loadBuildGround(t){return x(this,null,function*(){let{brand:e,project:n}=t,i=yield this.loadBuildingGround({brand:e,project:n});return this.bmap.currentBuildGround=i,this.bmap.changeBuildingCenter(i,{brand:e,project:n}),this.bmap.currentBuildGround})}loadBuildingGround(t){return x(this,null,function*(){let{brand:e,project:n}=t,i=Qn({brand:e,project:n});if(this.buildingGroundMap.has(i))return this.buildingGroundMap.get(i);let o=p3({brand:e,project:n},this.bmap.config).then(s=>(this.buildingGroundMap.set(i,s),s));return this.buildingGroundMap.set(i,o),o})}switchFloor(t){return x(this,null,function*(){let e=new jt(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 YJ=function(r){return r[r.D2=0]="D2",r[r.D3=1.1]="D3",r}({}),ba=class extends RG{changeBuildingCenter(t,e){let{brand:n,project:i}=e,o=t?Fo(t.info.geometry.cds[0]):[0,0];this.buildingCenter=o,this.dispatchEvent({type:"center-change",center:o,project:i,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 x(this,null,function*(){return this.loader||(this.loader=new Tr(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(ct.SWITCH_FLOOR_BEFORE,{curFloor:t,graphics:e}),this.context.switchFloor(t),this.initialFloorCamera(),this.triggerHooks(ct.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 i=(n=this.context.currentFloor)==null?void 0:n.addModel(S({},e,{position:t.getPosition().setZ(.1),id:t.options.id}));if(i){let{facilityAngle:o=0,facilityXScale:s=1,facilityYScale:a=1}=t.options.userData;i.rotateZ((180-o)/180*Math.PI),i.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,i=t.getCenter(),o=(n==null?void 0:n[0])||i.x,s=(n==null?void 0:n[1])||i.y;return console.log(o,s,n,i),this.context.currentFloor.addPoi(S({},e,{position:{x:o,y:s,z:i.z+t.options.height/2}}))}return null}removeHeatMap(){var t;(t=this.context.currentFloor)==null||t.removeHeatMap()}translateElementToCenter(t,e,n,i){e===void 0&&(e=500),n===void 0&&(n=0),i===void 0&&(i=0);let o=t.getPosition().clone(),{context:{camera:s}}=this;if(s.updateMatrix(),i){let a=new Vc;a.setFromMatrixColumn(s.matrix,1),a.normalize(),a.multiplyScalar(i/s.zoom),o.add(a)}if(n){let a=new Vc;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 x(this,null,function*(){return e===void 0&&(e=500),Ft(new Promise(n=>{let i=this.context.control.target.clone(),o=t.getPosition();this.timer.requestAnimationFrame(()=>{let{clientSize:{width:s,height:a},camera:u}=this.context,c=C(o,u,s,a).x-s/2,h=new Vc;h.setFromMatrixColumn(this.context.camera.matrix,0),h.normalize(),h.multiplyScalar(c/this.context.camera.zoom),i.add(h),this.context.setCameraPosition(i,e).then(n)})}),e+500)})}getElementDeviceCoordinate(t){let e=t.position.clone(),{clientWidth:n,clientHeight:i}=this.container;return C(e,this.context.camera,n,i)}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 x(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 x(this,null,function*(){return this.cancelDistance(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgLine=new Js(this.context);let n=this.svgLine.dispose.bind(this.svgLine);this.svgLine.dispose=function(){n(),e("cancel")},this.svgLine.addEventListener("distance",i=>{let{distance:o}=i;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 Qs(this.context);let n=this.svgPolygon.dispose.bind(this.svgPolygon);this.svgPolygon.dispose=function(){n(),e("cancel")},this.svgPolygon.addEventListener("area",i=>{let{area:o}=i;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(i=>{Array.isArray(i)&&i.forEach(o=>{o[0]-=n[0],o[1]-=n[1]})});else{let[i,o]=t.geometry.cds;t.geometry.coords=[i-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(),St.dispose(),X.dispose(),ue.dispose(),this.debounceResize=null}constructor(t,e={}){super(),this.container=t,this.polarKeys=[],this.azimuthalKeys=[],this.basicZoom=1,this.prevCameraZoom=1,this.type="2d",this.currentBuildGround=null,this.observe=null,this.buildingCenter=[0,0],this.timer=new W,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 i=this.context.control.getPolarAngle();this.context.control.maxPolarAngle=i,this.context.control.minPolarAngle=i}if(this.azimuthalKeys.includes(n.code)){let i=this.context.control.getAzimuthalAngle();this.context.control.maxAzimuthAngle=i,this.context.control.minAzimuthAngle=i}},this.resize=()=>{this.context.cameraBound.setEnable(!1),this.context.onWindowResize();let n=this.context.control.getAzimuthalAngle(),i=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=i,this.context.control.minZoom=o,this.context.control.maxZoom=o*25,this.basicZoom=i,this.context.control.addEventListener("change",this.onControlChange),this.context.setAzimuthalAngle(n,0),this.context.cameraBound.setEnable(!0)},this.config=s3(e),this.context=new ya(t,this.config),this.debounceResize=PG(this.resize,5),this.registryEvent()}};var QJ=d(A(),1);import{EventDispatcher as IG}from"three";var bt=class extends IG{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 bt{fetchEquipment(){return x(this,null,function*(){let{apiDomain:t,apiPath:{equipmentList:e},apiInfo:n}=this.bmap.config,i=""+t+e;yield fetch(i,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)),i=this.bmap.createGraphicPoi(e,{icon:n==null?void 0:n.equipment_icon,built_in:!0,icon_size:[14,14]});i&&(i.userData.data=n,i.userData.type="equipment")})}dispose(){var t;this.bmap.removeEventListener(ct.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(ct.SWITCH_FLOOR_AFTER,this.onSwitchFloor)}};var htt=d(ti(),1),ptt=d(ee(),1),ftt=d(A(),1),dtt=d(Dc(),1);var wQ=d(A(),1),TQ=d(D(),1);import{Mesh as zG,Object3D as GG,TextureLoader as kG,Color as VG,Vector2 as Wc,Vector3 as HG,NormalBlending as WG,RepeatWrapping as qG}from"three";var sQ=d(Ul(),1),aQ=d(hi(),1),uQ=d(pi(),1),lQ=d(di(),1),cQ=d(gi(),1),hQ=d(mi(),1),pQ=d(vi(),1),fQ=d(yi(),1),dQ=d(xi(),1),gQ=d(Ei(),1),mQ=d(Si(),1),_Q=d(bi(),1),vQ=d(Mi(),1),yQ=d(Ti(),1),xQ=d(Ai(),1),EQ=d(D(),1),SQ=d(wc(),1);import{BufferGeometry as LG,Matrix4 as _3,Vector3 as Dn,Ray as NG,Sphere as OG,LineSegments as DG,BufferAttribute as _n,ShaderChunk as It,ShaderMaterial as v3,UniformsLib as UG,Color as FG,Vector2 as m3}from"three";var vt=class extends LG{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)}}})}};vt.prototype.setMatrixWorld=function(r){this.matrixWorld=r};vt.prototype.setGeometry=function(r,t){this._geometry=r,this.setPoints(r.getAttribute("position").array,t)};vt.prototype.setPoints=function(r,t){if(!(r instanceof Float32Array)&&!(r instanceof Array)){console.error("ERROR: The BufferArray of points is not instancied correctly.");return}if(this._points=r,this.widthCallback=t,this.positions=[],this.counters=[],r.length&&r[0]instanceof Dn)for(var e=0;e<r.length;e++){var n=r[e],i=e/r.length;this.positions.push(n.x,n.y,n.z),this.positions.push(n.x,n.y,n.z),this.counters.push(i),this.counters.push(i)}else for(var e=0;e<r.length;e+=3){var i=e/r.length;this.positions.push(r[e],r[e+1],r[e+2]),this.positions.push(r[e],r[e+1],r[e+2]),this.counters.push(i),this.counters.push(i)}this.process()};function BG(r,t){var e=new _3,n=new NG,i=new OG,o=new Dn,s=this.geometry;if(s.boundingSphere||s.computeBoundingSphere(),i.copy(s.boundingSphere),i.applyMatrix4(this.matrixWorld),r.ray.intersectSphere(i,o)!==!1){e.copy(this.matrixWorld).invert(),n.copy(r.ray).applyMatrix4(e);var a=new Dn,u=new Dn,l=new Dn,c=this instanceof DG?2:1,h=s.index,p=s.attributes;if(h!==null)for(var f=h.array,m=p.position.array,_=p.width.array,y=0,E=f.length-1;y<E;y+=c){var M=f[y],w=f[y+1];a.fromArray(m,M*3),u.fromArray(m,w*3);var P=_[Math.floor(y/3)]!==void 0?_[Math.floor(y/3)]:1,R=r.params.Line.threshold+this.material.lineWidth*P/2,U=R*R,T=n.distanceSqToSegment(a,u,o,l);if(!(T>U)){o.applyMatrix4(this.matrixWorld);var I=r.ray.origin.distanceTo(o);I<r.near||I>r.far||(t.push({distance:I,point:l.clone().applyMatrix4(this.matrixWorld),index:y,face:null,faceIndex:null,object:this}),y=E)}}}}vt.prototype.raycast=BG;vt.prototype.compareV3=function(r,t){var e=r*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]};vt.prototype.copyV3=function(r){var t=r*6;return[this.positions[t],this.positions[t+1],this.positions[t+2]]};vt.prototype.getDistance=function(r){let t=0;for(let e=0;e<r;e++){let n=6*e,i=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=i.distanceTo(o);t+=s}return t};vt.prototype.process=function(){var r=this.positions.length/6;this.previous=[],this.next=[],this.side=[],this.width=[],this.indices_array=[],this.uvs=[];var t;let e=this.getDistance(r-1);var n;this.compareV3(0,r-1)?n=this.copyV3(r-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 i=0;i<r;i++){if(this.side.push(1),this.side.push(-1),this.widthCallback?t=this.widthCallback(i/(r-1)):t=1,this.width.push(t),this.width.push(t),i===0)this.uvs.push(0,0),this.uvs.push(0,1);else if(i===r-1)this.uvs.push(1,0),this.uvs.push(1,1);else{let s=this.getDistance(i)/e;this.uvs.push(s,0),this.uvs.push(s,1)}if(i<r-1){n=this.copyV3(i),this.previous.push(n[0],n[1],n[2]),this.previous.push(n[0],n[1],n[2]);var o=i*2;this.indices_array.push(o,o+1,o+2),this.indices_array.push(o+2,o+1,o+3)}i>0&&(n=this.copyV3(i),this.next.push(n[0],n[1],n[2]),this.next.push(n[0],n[1],n[2]))}this.compareV3(r-1,0)?n=this.copyV3(1):n=this.copyV3(r-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 Hc(r,t,e,n,i){var o;if(r=r.subarray||r.slice?r:r.buffer,e=e.subarray||e.slice?e:e.buffer,r=t?r.subarray?r.subarray(t,i&&t+i):r.slice(t,i&&t+i):r,e.set)e.set(r,n);else for(o=0;o<r.length;o++)e[o+n]=r[o];return e}vt.prototype.advance=function(r){var t=this._attributes.position.array,e=this._attributes.previous.array,n=this._attributes.next.array,i=t.length;Hc(t,0,e,0,i),Hc(t,6,t,0,i-6),t[i-6]=r.x,t[i-5]=r.y,t[i-4]=r.z,t[i-3]=r.x,t[i-2]=r.y,t[i-1]=r.z,Hc(t,6,n,0,i-6),n[i-6]=r.x,n[i-5]=r.y,n[i-4]=r.z,n[i-3]=r.x,n[i-2]=r.y,n[i-1]=r.z,this._attributes.position.needsUpdate=!0,this._attributes.previous.needsUpdate=!0,this._attributes.next.needsUpdate=!0};It.meshline_vert=["",It.logdepthbuf_pars_vertex,It.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;","",It.logdepthbuf_vertex,It.fog_vertex&&" vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",It.fog_vertex,"}"].join(`
|
|
3912
3912
|
`);It.meshline_frag=["",It.fog_pars_fragment,It.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() {","",It.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);","",It.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({},UG.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new FG(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:It.meshline_vert,fragmentShader:It.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(r){return v3.prototype.copy.call(this,r),this.lineWidth=r.lineWidth,this.map=r.map,this.useMap=r.useMap,this.alphaMap=r.alphaMap,this.useAlphaMap=r.useAlphaMap,this.color.copy(r.color),this.opacity=r.opacity,this.resolution.copy(r.resolution),this.sizeAttenuation=r.sizeAttenuation,this.dashArray.copy(r.dashArray),this.dashOffset.copy(r.dashOffset),this.dashRatio.copy(r.dashRatio),this.useDash=r.useDash,this.visibility=r.visibility,this.alphaTest=r.alphaTest,this.repeat.copy(r.repeat),this};var y3={texture_url:Gs,lineWidth:10,color:16777215},Ma=class extends GG{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:i}}}}}=this,o=t.map(a=>{let[u,l]=a;return C(new HG(u,l,0),e,n,i)}).map(a=>{let{x:u,y:l}=a;return[u,l]});return Ct(o)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new Wc(t,1)}loadTexture(t){return new Promise((e,n)=>{new kG().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 x(this,null,function*(){let e=this.geometry=new vt;if(this.updatePoints(t),!this.texture){let o=this.texture=yield this.loadTexture(this.config.texture_url);o.wrapS=o.wrapT=qG}let n=this.material=new Un({useMap:!0,color:new VG(this.config.color),transparent:!0,resolution:new Wc(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:WG,repeat:new Wc(this.getRepeat(),1)}),i=this.mesh=new zG(e,n);return i.renderOrder=100009,this.add(i),i})}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:i}=this.navigation.bmap.context.clientSize;this.material.resolution.set(n,i)}},this.config=Object.assign({},y3,e),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}};import{Tween as qc,Easing as rk}from"@tweenjs/tween.js";import{Vector2 as ik,Vector3 as ce}from"three";var OQ=d(js(),1),DQ=d(A(),1),UQ=d(D(),1);import{EventDispatcher as XG,Vector2 as jG}from"three";import{Tween as YG}from"@tweenjs/tween.js";import{throttle as KG}from"lodash";import{booleanPointInPolygon as ZG,point as $G,polygon as JG}from"@turf/turf";var QG={offsetDistance:15,offsetToResetTime:3e3,directionEmitThreshold:5,simulationSpeed:1},wa=class extends XG{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:i,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(i){let y=Oe(n,i);u=u.slice(y+1),u.unshift(i)}let h=[{floor:o==null?void 0:o.floor,points:u},...s.slice(a+1)],{distance:p,closestPoint:f,index:m,i:_}=h.reduce((y,E,M)=>{if(E.floor!==t)return y;let{distance:w,closestPoint:P,index:R}=E.points.reduce((U,T,I,j)=>{if(!j[I+1])return S({},U,{distance:U.distance===1/0?z(T,e):U.distance});let{distance:Y,closestPoint:k}=y_(e,T,j[I+1]);if(l===t){let ht=[e,...j.slice(I+1)],yt=Ct(ht);if(c-yt>10)return U}return Y<U.distance?{distance:Y,closestPoint:k,index:I}:U},{distance:1/0,closestPoint:E.points[0],index:0});return w<y.distance?{distance:w,closestPoint:P,index:M,i:R}:y},{distance:1/0,closestPoint:u[0],index:0,i:0});return{distance:p,closestPoint:f,routeIndex:m+a,pointIndex:m===0?_+this.pointIndex:_}}toPosition(t,e){let n=this.adsorb(t,e);if(!n)return;let{distance:i,closestPoint:o,routeIndex:s,pointIndex:a}=n;i>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 x(this,null,function*(){let{curRoutePath:t}=this;if(!t)return;this.simulationTween&&this.tweenUtil.remove(this.simulationTween);let e=[];return new Promise(n=>{let i=[this.position,...this.curRoutePathPoints.slice(this.pointIndex+1)],o=this.getCurRouteRemainDistance(),s=o/this.options.simulationSpeed,a=this.throttleUpdatePosition=KG(l=>{let c=tr(i,l.distance);c&&(e.push({floor:t.floor,pos:c}),this.toPosition(t.floor,c))},100),u=this.simulationTween=new YG({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 i=[n,...t.slice(e+1)];return Ct(i)}getCurRouteToStartDistance(){let{curRoutePathPoints:t,pointIndex:e,position:n}=this;if(!t.length)return 0;let i=[...t.slice(0,e+1),n];return Ct(i)}getRemainDistance(){let t=this.getCurRouteRemainDistance();return{total:this.paths.slice(this.routeIndex+1).reduce((i,o)=>i+o.distance,0)+t,curRoute:t}}getNextDirDistance(){var t;if(!this.position)return null;let{pointIndex:e,curRoutePathPoints:n,position:i,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],y=n[s+2];if(!m||!_)a=Ue.END;else if(l+=z(m,_),!y)a=Ue.END;else{a=x0(m,_,y),c=Bo(m,_,y),h=(new jG(y[0]-_[0],y[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=z(i,n[s])),a===Ue.END&&l<=this.options.directionEmitThreshold)return{dir:a,distance:l,crossName:u,angle:c,nextAngle:h};let f=this.getCurRouteToStartDistance();return e===0&&f<=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 i=JG(n.cds),o=$G(this.position);return ZG(o,i)});if(e)return e}return{imageUrl:null}}getNavigationInfo(){let{total:t,curRoute:e}=this.getRemainDistance(),n=this.getNextDirDistance();if(!n)return null;let{dir:i,distance:o,crossName:s,angle:a,nextAngle:u}=n;e<=10&&(i=Ue.END);let{imageUrl:l}=this.getCurPointAreaInfo();return{distance:t,curRouteDistance:e,nextDirDistance:o,dir:i,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 W,this.resetTimer=null,this.tweenUtil=new an,this.paused=!1,this.onAddPaths=i=>{let{paths:o}=i;this.paths=o,this.resetStatus(o),this.simulationTween&&this.startSimulation()},this.onUpdate=()=>{this.tweenUtil.update()},this.options=Object.assign({},QG,e),this.roadData=n,this.registryEvent()}};var WQ=d(vs(),1),qQ=d(hi(),1),XQ=d(pi(),1),jQ=d(di(),1),YQ=d(gi(),1),KQ=d(mi(),1),ZQ=d(vi(),1),$Q=d(yi(),1),JQ=d(xi(),1),QQ=d(Ei(),1),ttt=d(Si(),1),ett=d(bi(),1),ntt=d(Mi(),1),rtt=d(Ti(),1),itt=d(Ai(),1),ott=d(Ol(),1),stt=d(A(),1);import{DataTexture as tk,LinearFilter as x3,RGBAFormat as E3,Sprite as ek,SpriteMaterial as nk}from"three";var qe=class r extends nt{addDebug(){r.canvas.style.cssText=`
|
|
3914
3914
|
position: fixed;
|