@aibee/crc-bmap 0.8.65 → 0.8.67

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.
@@ -1,7 +1,7 @@
1
1
  var hT=Object.create;var kc=Object.defineProperty;var pT=Object.getOwnPropertyDescriptor;var fT=Object.getOwnPropertyNames;var dT=Object.getPrototypeOf,mT=Object.prototype.hasOwnProperty;var f=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports);var gT=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of fT(t))!mT.call(r,i)&&i!==e&&kc(r,i,{get:()=>t[i],enumerable:!(n=pT(t,i))||n.enumerable});return r};var d=(r,t,e)=>(e=r!=null?hT(dT(r)):{},gT(t||!r||!r.__esModule?kc(e,"default",{value:r,enumerable:!0}):e,r));var j=(r,t,e)=>new Promise((n,i)=>{var o=u=>{try{a(e.next(u))}catch(l){i(l)}},s=u=>{try{a(e.throw(u))}catch(l){i(l)}},a=u=>u.done?n(u.value):Promise.resolve(u.value).then(o,s);a((e=e.apply(r,t)).next())});var E=f((Ia,Vc)=>{"use strict";var _r=function(r){return r&&r.Math===Math&&r};Vc.exports=_r(typeof globalThis=="object"&&globalThis)||_r(typeof window=="object"&&window)||_r(typeof self=="object"&&self)||_r(typeof global=="object"&&global)||_r(typeof Ia=="object"&&Ia)||function(){return this}()||Function("return this")()});var X=f((NR,Jc)=>{"use strict";Jc.exports=function(r){try{return!!r()}catch(t){return!0}}});var F=f((UR,Lc)=>{"use strict";var yT=X();Lc.exports=!yT(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var Wr=f((GR,Bc)=>{"use strict";var MT=X();Bc.exports=!MT(function(){var r=function(){}.bind();return typeof r!="function"||r.hasOwnProperty("prototype")})});var k=f((kR,Qc)=>{"use strict";var PT=Wr(),Fi=Function.prototype.call;Qc.exports=PT?Fi.bind(Fi):function(){return Fi.apply(Fi,arguments)}});var Ya=f($c=>{"use strict";var Hc={}.propertyIsEnumerable,qc=Object.getOwnPropertyDescriptor,jT=qc&&!Hc.call({1:2},1);$c.f=jT?function(t){var e=qc(this,t);return!!e&&e.enumerable}:Hc});var ze=f((JR,th)=>{"use strict";th.exports=function(r,t){return{enumerable:!(r&1),configurable:!(r&2),writable:!(r&4),value:t}}});var Y=f((LR,rh)=>{"use strict";var eh=Wr(),nh=Function.prototype,Ea=nh.call,AT=eh&&nh.bind.bind(Ea,Ea);rh.exports=eh?AT:function(r){return function(){return Ea.apply(r,arguments)}}});var we=f((BR,oh)=>{"use strict";var ih=Y(),TT=ih({}.toString),wT=ih("".slice);oh.exports=function(r){return wT(TT(r),8,-1)}});var xr=f((QR,sh)=>{"use strict";var ST=Y(),bT=X(),vT=we(),Da=Object,_T=ST("".split);sh.exports=bT(function(){return!Da("z").propertyIsEnumerable(0)})?function(r){return vT(r)==="String"?_T(r,""):Da(r)}:Da});var Zn=f((HR,ah)=>{"use strict";ah.exports=function(r){return r==null}});var mn=f((qR,uh)=>{"use strict";var WT=Zn(),xT=TypeError;uh.exports=function(r){if(WT(r))throw new xT("Can't call method on "+r);return r}});var Cn=f(($R,lh)=>{"use strict";var IT=xr(),YT=mn();lh.exports=function(r){return IT(YT(r))}});var z=f((tF,ch)=>{"use strict";var Xa=typeof document=="object"&&document.all;ch.exports=typeof Xa=="undefined"&&Xa!==void 0?function(r){return typeof r=="function"||r===Xa}:function(r){return typeof r=="function"}});var tt=f((eF,hh)=>{"use strict";var ET=z();hh.exports=function(r){return typeof r=="object"?r!==null:ET(r)}});var Ut=f((nF,ph)=>{"use strict";var Za=E(),DT=z(),XT=function(r){return DT(r)?r:void 0};ph.exports=function(r,t){return arguments.length<2?XT(Za[r]):Za[r]&&Za[r][t]}});var On=f((rF,fh)=>{"use strict";var ZT=Y();fh.exports=ZT({}.isPrototypeOf)});var Kn=f((iF,gh)=>{"use strict";var CT=E(),dh=CT.navigator,mh=dh&&dh.userAgent;gh.exports=mh?String(mh):""});var Ir=f((oF,Th)=>{"use strict";var Ah=E(),Ca=Kn(),yh=Ah.process,Mh=Ah.Deno,Ph=yh&&yh.versions||Mh&&Mh.version,jh=Ph&&Ph.v8,Gt,zi;jh&&(Gt=jh.split("."),zi=Gt[0]>0&&Gt[0]<4?1:+(Gt[0]+Gt[1]));!zi&&Ca&&(Gt=Ca.match(/Edge\/(\d+)/),(!Gt||Gt[1]>=74)&&(Gt=Ca.match(/Chrome\/(\d+)/),Gt&&(zi=+Gt[1])));Th.exports=zi});var Ni=f((sF,Sh)=>{"use strict";var wh=Ir(),OT=X(),KT=E(),RT=KT.String;Sh.exports=!!Object.getOwnPropertySymbols&&!OT(function(){var r=Symbol("symbol detection");return!RT(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&wh&&wh<41})});var Oa=f((aF,bh)=>{"use strict";var FT=Ni();bh.exports=FT&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Yr=f((uF,vh)=>{"use strict";var zT=Ut(),NT=z(),UT=On(),GT=Oa(),kT=Object;vh.exports=GT?function(r){return typeof r=="symbol"}:function(r){var t=zT("Symbol");return NT(t)&&UT(t.prototype,kT(r))}});var Rn=f((lF,_h)=>{"use strict";var VT=String;_h.exports=function(r){try{return VT(r)}catch(t){return"Object"}}});var ne=f((cF,Wh)=>{"use strict";var JT=z(),LT=Rn(),BT=TypeError;Wh.exports=function(r){if(JT(r))return r;throw new BT(LT(r)+" is not a function")}});var Er=f((hF,xh)=>{"use strict";var QT=ne(),HT=Zn();xh.exports=function(r,t){var e=r[t];return HT(e)?void 0:QT(e)}});var Yh=f((pF,Ih)=>{"use strict";var Ka=k(),Ra=z(),Fa=tt(),qT=TypeError;Ih.exports=function(r,t){var e,n;if(t==="string"&&Ra(e=r.toString)&&!Fa(n=Ka(e,r))||Ra(e=r.valueOf)&&!Fa(n=Ka(e,r))||t!=="string"&&Ra(e=r.toString)&&!Fa(n=Ka(e,r)))return n;throw new qT("Can't convert object to primitive value")}});var Ne=f((fF,Eh)=>{"use strict";Eh.exports=!1});var Ui=f((dF,Xh)=>{"use strict";var Dh=E(),$T=Object.defineProperty;Xh.exports=function(r,t){try{$T(Dh,r,{value:t,configurable:!0,writable:!0})}catch(e){Dh[r]=t}return t}});var Gi=f((mF,Oh)=>{"use strict";var tw=Ne(),ew=E(),nw=Ui(),Zh="__core-js_shared__",Ch=Oh.exports=ew[Zh]||nw(Zh,{});(Ch.versions||(Ch.versions=[])).push({version:"3.39.0",mode:tw?"pure":"global",copyright:"\xA9 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.39.0/LICENSE",source:"https://github.com/zloirock/core-js"})});var ki=f((gF,Rh)=>{"use strict";var Kh=Gi();Rh.exports=function(r,t){return Kh[r]||(Kh[r]=t||{})}});var it=f((yF,Fh)=>{"use strict";var rw=mn(),iw=Object;Fh.exports=function(r){return iw(rw(r))}});var ot=f((MF,zh)=>{"use strict";var ow=Y(),sw=it(),aw=ow({}.hasOwnProperty);zh.exports=Object.hasOwn||function(t,e){return aw(sw(t),e)}});var Vi=f((PF,Nh)=>{"use strict";var uw=Y(),lw=0,cw=Math.random(),hw=uw(1 .toString);Nh.exports=function(r){return"Symbol("+(r===void 0?"":r)+")_"+hw(++lw+cw,36)}});var J=f((jF,Gh)=>{"use strict";var pw=E(),fw=ki(),Uh=ot(),dw=Vi(),mw=Ni(),gw=Oa(),Fn=pw.Symbol,za=fw("wks"),yw=gw?Fn.for||Fn:Fn&&Fn.withoutSetter||dw;Gh.exports=function(r){return Uh(za,r)||(za[r]=mw&&Uh(Fn,r)?Fn[r]:yw("Symbol."+r)),za[r]}});var Na=f((AF,Jh)=>{"use strict";var Mw=k(),kh=tt(),Vh=Yr(),Pw=Er(),jw=Yh(),Aw=J(),Tw=TypeError,ww=Aw("toPrimitive");Jh.exports=function(r,t){if(!kh(r)||Vh(r))return r;var e=Pw(r,ww),n;if(e){if(t===void 0&&(t="default"),n=Mw(e,r,t),!kh(n)||Vh(n))return n;throw new Tw("Can't convert object to primitive value")}return t===void 0&&(t="number"),jw(r,t)}});var Ji=f((TF,Lh)=>{"use strict";var Sw=Na(),bw=Yr();Lh.exports=function(r){var t=Sw(r,"string");return bw(t)?t:t+""}});var Li=f((wF,Qh)=>{"use strict";var vw=E(),Bh=tt(),Ua=vw.document,_w=Bh(Ua)&&Bh(Ua.createElement);Qh.exports=function(r){return _w?Ua.createElement(r):{}}});var Ga=f((SF,Hh)=>{"use strict";var Ww=F(),xw=X(),Iw=Li();Hh.exports=!Ww&&!xw(function(){return Object.defineProperty(Iw("div"),"a",{get:function(){return 7}}).a!==7})});var Bi=f($h=>{"use strict";var Yw=F(),Ew=k(),Dw=Ya(),Xw=ze(),Zw=Cn(),Cw=Ji(),Ow=ot(),Kw=Ga(),qh=Object.getOwnPropertyDescriptor;$h.f=Yw?qh:function(t,e){if(t=Zw(t),e=Cw(e),Kw)try{return qh(t,e)}catch(n){}if(Ow(t,e))return Xw(!Ew(Dw.f,t,e),t[e])}});var ka=f((vF,tp)=>{"use strict";var Rw=F(),Fw=X();tp.exports=Rw&&Fw(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var rt=f((_F,ep)=>{"use strict";var zw=tt(),Nw=String,Uw=TypeError;ep.exports=function(r){if(zw(r))return r;throw new Uw(Nw(r)+" is not an object")}});var vt=f(rp=>{"use strict";var Gw=F(),kw=Ga(),Vw=ka(),Qi=rt(),np=Ji(),Jw=TypeError,Va=Object.defineProperty,Lw=Object.getOwnPropertyDescriptor,Ja="enumerable",La="configurable",Ba="writable";rp.f=Gw?Vw?function(t,e,n){if(Qi(t),e=np(e),Qi(n),typeof t=="function"&&e==="prototype"&&"value"in n&&Ba in n&&!n[Ba]){var i=Lw(t,e);i&&i[Ba]&&(t[e]=n.value,n={configurable:La in n?n[La]:i[La],enumerable:Ja in n?n[Ja]:i[Ja],writable:!1})}return Va(t,e,n)}:Va:function(t,e,n){if(Qi(t),e=np(e),Qi(n),kw)try{return Va(t,e,n)}catch(i){}if("get"in n||"set"in n)throw new Jw("Accessors not supported");return"value"in n&&(t[e]=n.value),t}});var _t=f((xF,ip)=>{"use strict";var Bw=F(),Qw=vt(),Hw=ze();ip.exports=Bw?function(r,t,e){return Qw.f(r,t,Hw(1,e))}:function(r,t,e){return r[t]=e,r}});var Dr=f((IF,sp)=>{"use strict";var Qa=F(),qw=ot(),op=Function.prototype,$w=Qa&&Object.getOwnPropertyDescriptor,Ha=qw(op,"name"),tS=Ha&&function(){}.name==="something",eS=Ha&&(!Qa||Qa&&$w(op,"name").configurable);sp.exports={EXISTS:Ha,PROPER:tS,CONFIGURABLE:eS}});var $a=f((YF,ap)=>{"use strict";var nS=Y(),rS=z(),qa=Gi(),iS=nS(Function.toString);rS(qa.inspectSource)||(qa.inspectSource=function(r){return iS(r)});ap.exports=qa.inspectSource});var cp=f((EF,lp)=>{"use strict";var oS=E(),sS=z(),up=oS.WeakMap;lp.exports=sS(up)&&/native code/.test(String(up))});var Hi=f((DF,pp)=>{"use strict";var aS=ki(),uS=Vi(),hp=aS("keys");pp.exports=function(r){return hp[r]||(hp[r]=uS(r))}});var qi=f((XF,fp)=>{"use strict";fp.exports={}});var re=f((ZF,gp)=>{"use strict";var lS=cp(),mp=E(),cS=tt(),hS=_t(),tu=ot(),eu=Gi(),pS=Hi(),fS=qi(),dp="Object already initialized",nu=mp.TypeError,dS=mp.WeakMap,$i,Xr,to,mS=function(r){return to(r)?Xr(r):$i(r,{})},gS=function(r){return function(t){var e;if(!cS(t)||(e=Xr(t)).type!==r)throw new nu("Incompatible receiver, "+r+" required");return e}};lS||eu.state?(kt=eu.state||(eu.state=new dS),kt.get=kt.get,kt.has=kt.has,kt.set=kt.set,$i=function(r,t){if(kt.has(r))throw new nu(dp);return t.facade=r,kt.set(r,t),t},Xr=function(r){return kt.get(r)||{}},to=function(r){return kt.has(r)}):(gn=pS("state"),fS[gn]=!0,$i=function(r,t){if(tu(r,gn))throw new nu(dp);return t.facade=r,hS(r,gn,t),t},Xr=function(r){return tu(r,gn)?r[gn]:{}},to=function(r){return tu(r,gn)});var kt,gn;gp.exports={set:$i,get:Xr,has:to,enforce:mS,getterFor:gS}});var ou=f((CF,Pp)=>{"use strict";var iu=Y(),yS=X(),MS=z(),eo=ot(),ru=F(),PS=Dr().CONFIGURABLE,jS=$a(),Mp=re(),AS=Mp.enforce,TS=Mp.get,yp=String,no=Object.defineProperty,wS=iu("".slice),SS=iu("".replace),bS=iu([].join),vS=ru&&!yS(function(){return no(function(){},"length",{value:8}).length!==8}),_S=String(String).split("String"),WS=Pp.exports=function(r,t,e){wS(yp(t),0,7)==="Symbol("&&(t="["+SS(yp(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),e&&e.getter&&(t="get "+t),e&&e.setter&&(t="set "+t),(!eo(r,"name")||PS&&r.name!==t)&&(ru?no(r,"name",{value:t,configurable:!0}):r.name=t),vS&&e&&eo(e,"arity")&&r.length!==e.arity&&no(r,"length",{value:e.arity});try{e&&eo(e,"constructor")&&e.constructor?ru&&no(r,"prototype",{writable:!1}):r.prototype&&(r.prototype=void 0)}catch(i){}var n=AS(r);return eo(n,"source")||(n.source=bS(_S,typeof t=="string"?t:"")),r};Function.prototype.toString=WS(function(){return MS(this)&&TS(this).source||jS(this)},"toString")});var Wt=f((OF,jp)=>{"use strict";var xS=z(),IS=vt(),YS=ou(),ES=Ui();jp.exports=function(r,t,e,n){n||(n={});var i=n.enumerable,o=n.name!==void 0?n.name:t;if(xS(e)&&YS(e,o,n),n.global)i?r[t]=e:ES(t,e);else{try{n.unsafe?r[t]&&(i=!0):delete r[t]}catch(s){}i?r[t]=e:IS.f(r,t,{value:e,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return r}});var Tp=f((KF,Ap)=>{"use strict";var DS=Math.ceil,XS=Math.floor;Ap.exports=Math.trunc||function(t){var e=+t;return(e>0?XS:DS)(e)}});var Pt=f((RF,wp)=>{"use strict";var ZS=Tp();wp.exports=function(r){var t=+r;return t!==t||t===0?0:ZS(t)}});var Zr=f((FF,Sp)=>{"use strict";var CS=Pt(),OS=Math.max,KS=Math.min;Sp.exports=function(r,t){var e=CS(r);return e<0?OS(e+t,0):KS(e,t)}});var yn=f((zF,bp)=>{"use strict";var RS=Pt(),FS=Math.min;bp.exports=function(r){var t=RS(r);return t>0?FS(t,9007199254740991):0}});var et=f((NF,vp)=>{"use strict";var zS=yn();vp.exports=function(r){return zS(r.length)}});var xp=f((UF,Wp)=>{"use strict";var NS=Cn(),US=Zr(),GS=et(),_p=function(r){return function(t,e,n){var i=NS(t),o=GS(i);if(o===0)return!r&&-1;var s=US(n,o),a;if(r&&e!==e){for(;o>s;)if(a=i[s++],a!==a)return!0}else for(;o>s;s++)if((r||s in i)&&i[s]===e)return r||s||0;return!r&&-1}};Wp.exports={includes:_p(!0),indexOf:_p(!1)}});var au=f((GF,Yp)=>{"use strict";var kS=Y(),su=ot(),VS=Cn(),JS=xp().indexOf,LS=qi(),Ip=kS([].push);Yp.exports=function(r,t){var e=VS(r),n=0,i=[],o;for(o in e)!su(LS,o)&&su(e,o)&&Ip(i,o);for(;t.length>n;)su(e,o=t[n++])&&(~JS(i,o)||Ip(i,o));return i}});var ro=f((kF,Ep)=>{"use strict";Ep.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var uu=f(Dp=>{"use strict";var BS=au(),QS=ro(),HS=QS.concat("length","prototype");Dp.f=Object.getOwnPropertyNames||function(t){return BS(t,HS)}});var lu=f(Xp=>{"use strict";Xp.f=Object.getOwnPropertySymbols});var Cp=f((LF,Zp)=>{"use strict";var qS=Ut(),$S=Y(),tb=uu(),eb=lu(),nb=rt(),rb=$S([].concat);Zp.exports=qS("Reflect","ownKeys")||function(t){var e=tb.f(nb(t)),n=eb.f;return n?rb(e,n(t)):e}});var io=f((BF,Kp)=>{"use strict";var Op=ot(),ib=Cp(),ob=Bi(),sb=vt();Kp.exports=function(r,t,e){for(var n=ib(t),i=sb.f,o=ob.f,s=0;s<n.length;s++){var a=n[s];!Op(r,a)&&!(e&&Op(e,a))&&i(r,a,o(t,a))}}});var Fp=f((QF,Rp)=>{"use strict";var ab=X(),ub=z(),lb=/#|\.prototype\./,Cr=function(r,t){var e=hb[cb(r)];return e===fb?!0:e===pb?!1:ub(t)?ab(t):!!t},cb=Cr.normalize=function(r){return String(r).replace(lb,".").toLowerCase()},hb=Cr.data={},pb=Cr.NATIVE="N",fb=Cr.POLYFILL="P";Rp.exports=Cr});var C=f((HF,zp)=>{"use strict";var oo=E(),db=Bi().f,mb=_t(),gb=Wt(),yb=Ui(),Mb=io(),Pb=Fp();zp.exports=function(r,t){var e=r.target,n=r.global,i=r.stat,o,s,a,u,l,c;if(n?s=oo:i?s=oo[e]||yb(e,{}):s=oo[e]&&oo[e].prototype,s)for(a in t){if(l=t[a],r.dontCallGetSet?(c=db(s,a),u=c&&c.value):u=s[a],o=Pb(n?a:e+(i?".":"#")+a,r.forced),!o&&u!==void 0){if(typeof l==typeof u)continue;Mb(l,u)}(r.sham||u&&u.sham)&&mb(l,"sham",!0),gb(s,a,l,r)}}});var Or=f((qF,Np)=>{"use strict";var jb=we();Np.exports=Array.isArray||function(t){return jb(t)==="Array"}});var cu=f(($F,Up)=>{"use strict";var Ab=F(),Tb=Or(),wb=TypeError,Sb=Object.getOwnPropertyDescriptor,bb=Ab&&!function(){if(this!==void 0)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(r){return r instanceof TypeError}}();Up.exports=bb?function(r,t){if(Tb(r)&&!Sb(r,"length").writable)throw new wb("Cannot set read only .length");return r.length=t}:function(r,t){return r.length=t}});var so=f((tz,Gp)=>{"use strict";var vb=TypeError,_b=9007199254740991;Gp.exports=function(r){if(r>_b)throw vb("Maximum allowed index exceeded");return r}});var Z=f(()=>{"use strict";var Wb=C(),xb=it(),Ib=et(),Yb=cu(),Eb=so(),Db=X(),Xb=Db(function(){return[].push.call({length:4294967296},1)!==4294967297}),Zb=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(r){return r instanceof TypeError}},Cb=Xb||!Zb();Wb({target:"Array",proto:!0,arity:1,forced:Cb},{push:function(t){var e=xb(this),n=Ib(e),i=arguments.length;Eb(n+i);for(var o=0;o<i;o++)e[n]=arguments[o],n++;return Yb(e,n),n}})});var Vp=f((rz,kp)=>{"use strict";kp.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 Bp=f((iz,Lp)=>{"use strict";var Ob=Li(),hu=Ob("span").classList,Jp=hu&&hu.constructor&&hu.constructor.prototype;Lp.exports=Jp===Object.prototype?void 0:Jp});var pu=f((oz,Qp)=>{"use strict";var Kb=au(),Rb=ro();Qp.exports=Object.keys||function(t){return Kb(t,Rb)}});var qp=f(Hp=>{"use strict";var Fb=F(),zb=ka(),Nb=vt(),Ub=rt(),Gb=Cn(),kb=pu();Hp.f=Fb&&!zb?Object.defineProperties:function(t,e){Ub(t);for(var n=Gb(e),i=kb(e),o=i.length,s=0,a;o>s;)Nb.f(t,a=i[s++],n[a]);return t}});var tf=f((az,$p)=>{"use strict";var Vb=Ut();$p.exports=Vb("document","documentElement")});var Mn=f((uz,uf)=>{"use strict";var Jb=rt(),Lb=qp(),ef=ro(),Bb=qi(),Qb=tf(),Hb=Li(),qb=Hi(),nf=">",rf="<",du="prototype",mu="script",sf=qb("IE_PROTO"),fu=function(){},af=function(r){return rf+mu+nf+r+rf+"/"+mu+nf},of=function(r){r.write(af("")),r.close();var t=r.parentWindow.Object;return r=null,t},$b=function(){var r=Hb("iframe"),t="java"+mu+":",e;return r.style.display="none",Qb.appendChild(r),r.src=String(t),e=r.contentWindow.document,e.open(),e.write(af("document.F=Object")),e.close(),e.F},ao,uo=function(){try{ao=new ActiveXObject("htmlfile")}catch(t){}uo=typeof document!="undefined"?document.domain&&ao?of(ao):$b():of(ao);for(var r=ef.length;r--;)delete uo[du][ef[r]];return uo()};Bb[sf]=!0;uf.exports=Object.create||function(t,e){var n;return t!==null?(fu[du]=Jb(t),n=new fu,fu[du]=null,n[sf]=t):n=uo(),e===void 0?n:Lb.f(n,e)}});var Kr=f((lz,lf)=>{"use strict";var tv=J(),ev=Mn(),nv=vt().f,gu=tv("unscopables"),yu=Array.prototype;yu[gu]===void 0&&nv(yu,gu,{configurable:!0,value:ev(null)});lf.exports=function(r){yu[gu][r]=!0}});var zn=f((cz,cf)=>{"use strict";cf.exports={}});var pf=f((hz,hf)=>{"use strict";var rv=X();hf.exports=!rv(function(){function r(){}return r.prototype.constructor=null,Object.getPrototypeOf(new r)!==r.prototype})});var Rr=f((pz,df)=>{"use strict";var iv=ot(),ov=z(),sv=it(),av=Hi(),uv=pf(),ff=av("IE_PROTO"),Mu=Object,lv=Mu.prototype;df.exports=uv?Mu.getPrototypeOf:function(r){var t=sv(r);if(iv(t,ff))return t[ff];var e=t.constructor;return ov(e)&&t instanceof e?e.prototype:t instanceof Mu?lv:null}});var Tu=f((fz,yf)=>{"use strict";var cv=X(),hv=z(),pv=tt(),fv=Mn(),mf=Rr(),dv=Wt(),mv=J(),gv=Ne(),Au=mv("iterator"),gf=!1,Se,Pu,ju;[].keys&&(ju=[].keys(),"next"in ju?(Pu=mf(mf(ju)),Pu!==Object.prototype&&(Se=Pu)):gf=!0);var yv=!pv(Se)||cv(function(){var r={};return Se[Au].call(r)!==r});yv?Se={}:gv&&(Se=fv(Se));hv(Se[Au])||dv(Se,Au,function(){return this});yf.exports={IteratorPrototype:Se,BUGGY_SAFARI_ITERATORS:gf}});var Ue=f((dz,Pf)=>{"use strict";var Mv=vt().f,Pv=ot(),jv=J(),Mf=jv("toStringTag");Pf.exports=function(r,t,e){r&&!e&&(r=r.prototype),r&&!Pv(r,Mf)&&Mv(r,Mf,{configurable:!0,value:t})}});var wu=f((mz,jf)=>{"use strict";var Av=Tu().IteratorPrototype,Tv=Mn(),wv=ze(),Sv=Ue(),bv=zn(),vv=function(){return this};jf.exports=function(r,t,e,n){var i=t+" Iterator";return r.prototype=Tv(Av,{next:wv(+!n,e)}),Sv(r,i,!1,!0),bv[i]=vv,r}});var Fr=f((gz,Af)=>{"use strict";var _v=Y(),Wv=ne();Af.exports=function(r,t,e){try{return _v(Wv(Object.getOwnPropertyDescriptor(r,t)[e]))}catch(n){}}});var wf=f((yz,Tf)=>{"use strict";var xv=tt();Tf.exports=function(r){return xv(r)||r===null}});var bf=f((Mz,Sf)=>{"use strict";var Iv=wf(),Yv=String,Ev=TypeError;Sf.exports=function(r){if(Iv(r))return r;throw new Ev("Can't set "+Yv(r)+" as a prototype")}});var Pn=f((Pz,vf)=>{"use strict";var Dv=Fr(),Xv=tt(),Zv=mn(),Cv=bf();vf.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var r=!1,t={},e;try{e=Dv(Object.prototype,"__proto__","set"),e(t,[]),r=t instanceof Array}catch(n){}return function(i,o){return Zv(i),Cv(o),Xv(i)&&(r?e(i,o):i.__proto__=o),i}}():void 0)});var bu=f((jz,Cf)=>{"use strict";var Ov=C(),Kv=k(),lo=Ne(),Xf=Dr(),Rv=z(),Fv=wu(),_f=Rr(),Wf=Pn(),zv=Ue(),Nv=_t(),Su=Wt(),Uv=J(),xf=zn(),Zf=Tu(),Gv=Xf.PROPER,kv=Xf.CONFIGURABLE,If=Zf.IteratorPrototype,co=Zf.BUGGY_SAFARI_ITERATORS,zr=Uv("iterator"),Yf="keys",Nr="values",Ef="entries",Df=function(){return this};Cf.exports=function(r,t,e,n,i,o,s){Fv(e,t,n);var a=function(A){if(A===i&&p)return p;if(!co&&A&&A in c)return c[A];switch(A){case Yf:return function(){return new e(this,A)};case Nr:return function(){return new e(this,A)};case Ef:return function(){return new e(this,A)}}return function(){return new e(this)}},u=t+" Iterator",l=!1,c=r.prototype,h=c[zr]||c["@@iterator"]||i&&c[i],p=!co&&h||a(i),m=t==="Array"&&c.entries||h,g,M,P;if(m&&(g=_f(m.call(new r)),g!==Object.prototype&&g.next&&(!lo&&_f(g)!==If&&(Wf?Wf(g,If):Rv(g[zr])||Su(g,zr,Df)),zv(g,u,!0,!0),lo&&(xf[u]=Df))),Gv&&i===Nr&&h&&h.name!==Nr&&(!lo&&kv?Nv(c,"name",Nr):(l=!0,p=function(){return Kv(h,this)})),i)if(M={values:a(Nr),keys:o?p:a(Yf),entries:a(Ef)},s)for(P in M)(co||l||!(P in c))&&Su(c,P,M[P]);else Ov({target:t,proto:!0,forced:co||l},M);return(!lo||s)&&c[zr]!==p&&Su(c,zr,p,{name:i}),xf[t]=p,M}});var ho=f((Az,Of)=>{"use strict";Of.exports=function(r,t){return{value:r,done:t}}});var _u=f((Tz,Nf)=>{"use strict";var Vv=Cn(),vu=Kr(),Kf=zn(),Ff=re(),Jv=vt().f,Lv=bu(),po=ho(),Bv=Ne(),Qv=F(),zf="Array Iterator",Hv=Ff.set,qv=Ff.getterFor(zf);Nf.exports=Lv(Array,"Array",function(r,t){Hv(this,{type:zf,target:Vv(r),index:0,kind:t})},function(){var r=qv(this),t=r.target,e=r.index++;if(!t||e>=t.length)return r.target=null,po(void 0,!0);switch(r.kind){case"keys":return po(e,!1);case"values":return po(t[e],!1)}return po([e,t[e]],!1)},"values");var Rf=Kf.Arguments=Kf.Array;vu("keys");vu("values");vu("entries");if(!Bv&&Qv&&Rf.name!=="values")try{Jv(Rf,"name",{value:"values"})}catch(r){}});var v=f(()=>{"use strict";var Uf=E(),kf=Vp(),$v=Bp(),Ur=_u(),Gf=_t(),t_=Ue(),e_=J(),Wu=e_("iterator"),xu=Ur.values,Vf=function(r,t){if(r){if(r[Wu]!==xu)try{Gf(r,Wu,xu)}catch(n){r[Wu]=xu}if(t_(r,t,!0),kf[t]){for(var e in Ur)if(r[e]!==Ur[e])try{Gf(r,e,Ur[e])}catch(n){r[e]=Ur[e]}}}};for(fo in kf)Vf(Uf[fo]&&Uf[fo].prototype,fo);var fo;Vf($v,"DOMTokenList")});var mo=f((bz,Qf)=>{"use strict";var n_=Wr(),Bf=Function.prototype,Jf=Bf.apply,Lf=Bf.call;Qf.exports=typeof Reflect=="object"&&Reflect.apply||(n_?Lf.bind(Jf):function(){return Lf.apply(Jf,arguments)})});var Gr=f((vz,Hf)=>{"use strict";var r_=Y();Hf.exports=r_([].slice)});var td=f((_z,$f)=>{"use strict";var i_=J(),o_=i_("toStringTag"),qf={};qf[o_]="z";$f.exports=String(qf)==="[object z]"});var be=f((Wz,ed)=>{"use strict";var s_=td(),a_=z(),go=we(),u_=J(),l_=u_("toStringTag"),c_=Object,h_=go(function(){return arguments}())==="Arguments",p_=function(r,t){try{return r[t]}catch(e){}};ed.exports=s_?go:function(r){var t,e,n;return r===void 0?"Undefined":r===null?"Null":typeof(e=p_(t=c_(r),l_))=="string"?e:h_?go(t):(n=go(t))==="Object"&&a_(t.callee)?"Arguments":n}});var jt=f((xz,nd)=>{"use strict";var f_=be(),d_=String;nd.exports=function(r){if(f_(r)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return d_(r)}});var ad=f((Iz,sd)=>{"use strict";var m_=Y(),rd=Or(),g_=z(),id=we(),y_=jt(),od=m_([].push);sd.exports=function(r){if(g_(r))return r;if(rd(r)){for(var t=r.length,e=[],n=0;n<t;n++){var i=r[n];typeof i=="string"?od(e,i):(typeof i=="number"||id(i)==="Number"||id(i)==="String")&&od(e,y_(i))}var o=e.length,s=!0;return function(a,u){if(s)return s=!1,u;if(rd(this))return u;for(var l=0;l<o;l++)if(e[l]===a)return u}}}});var Vr=f(()=>{"use strict";var M_=C(),md=Ut(),gd=mo(),P_=k(),kr=Y(),yd=X(),ud=z(),ld=Yr(),Md=Gr(),j_=ad(),A_=Ni(),T_=String,Ge=md("JSON","stringify"),yo=kr(/./.exec),cd=kr("".charAt),w_=kr("".charCodeAt),S_=kr("".replace),b_=kr(1 .toString),v_=/[\uD800-\uDFFF]/g,hd=/^[\uD800-\uDBFF]$/,pd=/^[\uDC00-\uDFFF]$/,fd=!A_||yd(function(){var r=md("Symbol")("stringify detection");return Ge([r])!=="[null]"||Ge({a:r})!=="{}"||Ge(Object(r))!=="{}"}),dd=yd(function(){return Ge("\uDF06\uD834")!=='"\\udf06\\ud834"'||Ge("\uDEAD")!=='"\\udead"'}),__=function(r,t){var e=Md(arguments),n=j_(t);if(!(!ud(n)&&(r===void 0||ld(r))))return e[1]=function(i,o){if(ud(n)&&(o=P_(n,this,T_(i),o)),!ld(o))return o},gd(Ge,null,e)},W_=function(r,t,e){var n=cd(e,t-1),i=cd(e,t+1);return yo(hd,r)&&!yo(pd,i)||yo(pd,r)&&!yo(hd,n)?"\\u"+b_(w_(r,0),16):r};Ge&&M_({target:"JSON",stat:!0,arity:3,forced:fd||dd},{stringify:function(t,e,n){var i=Md(arguments),o=gd(fd?__:Ge,null,i);return dd&&typeof o=="string"?S_(o,v_,W_):o}})});var Vt=f((Dz,Pd)=>{"use strict";var Iu=Y(),Mo=Set.prototype;Pd.exports={Set,add:Iu(Mo.add),has:Iu(Mo.has),remove:Iu(Mo.delete),proto:Mo}});var ke=f((Xz,jd)=>{"use strict";var x_=Vt().has;jd.exports=function(r){return x_(r),r}});var Ve=f((Zz,Ad)=>{"use strict";var I_=k();Ad.exports=function(r,t,e){for(var n=e?r:r.iterator,i=r.next,o,s;!(o=I_(i,n)).done;)if(s=t(o.value),s!==void 0)return s}});var Nn=f((Cz,vd)=>{"use strict";var Td=Y(),Y_=Ve(),wd=Vt(),E_=wd.Set,Sd=wd.proto,D_=Td(Sd.forEach),bd=Td(Sd.keys),X_=bd(new E_).next;vd.exports=function(r,t,e){return e?Y_({iterator:bd(r),next:X_},t):D_(r,t)}});var Po=f((Oz,Wd)=>{"use strict";var _d=Vt(),Z_=Nn(),C_=_d.Set,O_=_d.add;Wd.exports=function(r){var t=new C_;return Z_(r,function(e){O_(t,e)}),t}});var Un=f((Kz,xd)=>{"use strict";var K_=Fr(),R_=Vt();xd.exports=K_(R_.proto,"size","get")||function(r){return r.size}});var Yd=f((Rz,Id)=>{"use strict";Id.exports=function(r){return{iterator:r,next:r.next,done:!1}}});var Je=f((Fz,Od)=>{"use strict";var Ed=ne(),Zd=rt(),Dd=k(),F_=Pt(),z_=Yd(),Xd="Invalid size",N_=RangeError,U_=TypeError,G_=Math.max,Cd=function(r,t){this.set=r,this.size=G_(t,0),this.has=Ed(r.has),this.keys=Ed(r.keys)};Cd.prototype={getIterator:function(){return z_(Zd(Dd(this.keys,this.set)))},includes:function(r){return Dd(this.has,this.set,r)}};Od.exports=function(r){Zd(r);var t=+r.size;if(t!==t)throw new U_(Xd);var e=F_(t);if(e<0)throw new N_(Xd);return new Cd(r,e)}});var zd=f((zz,Fd)=>{"use strict";var k_=ke(),Rd=Vt(),V_=Po(),J_=Un(),L_=Je(),B_=Nn(),Q_=Ve(),H_=Rd.has,Kd=Rd.remove;Fd.exports=function(t){var e=k_(this),n=L_(t),i=V_(e);return J_(e)<=n.size?B_(e,function(o){n.includes(o)&&Kd(i,o)}):Q_(n.getIterator(),function(o){H_(e,o)&&Kd(i,o)}),i}});var Le=f((Nz,Ud)=>{"use strict";var q_=Ut(),Nd=function(r){return{size:r,has:function(){return!1},keys:function(){return{next:function(){return{done:!0}}}}}};Ud.exports=function(r){var t=q_("Set");try{new t()[r](Nd(0));try{return new t()[r](Nd(-1)),!1}catch(e){return!0}}catch(e){return!1}}});var ie=f(()=>{"use strict";var $_=C(),tW=zd(),eW=Le();$_({target:"Set",proto:!0,real:!0,forced:!eW("difference")},{difference:tW})});var Vd=f((kz,kd)=>{"use strict";var nW=ke(),Yu=Vt(),rW=Un(),iW=Je(),oW=Nn(),sW=Ve(),aW=Yu.Set,Gd=Yu.add,uW=Yu.has;kd.exports=function(t){var e=nW(this),n=iW(t),i=new aW;return rW(e)>n.size?sW(n.getIterator(),function(o){uW(e,o)&&Gd(i,o)}):oW(e,function(o){n.includes(o)&&Gd(i,o)}),i}});var oe=f(()=>{"use strict";var lW=C(),cW=X(),hW=Vd(),pW=Le(),fW=!pW("intersection")||cW(function(){return String(Array.from(new Set([1,2,3]).intersection(new Set([3,2]))))!=="3,2"});lW({target:"Set",proto:!0,real:!0,forced:fW},{intersection:hW})});var jo=f((Lz,Ld)=>{"use strict";var dW=k(),Jd=rt(),mW=Er();Ld.exports=function(r,t,e){var n,i;Jd(r);try{if(n=mW(r,"return"),!n){if(t==="throw")throw e;return e}n=dW(n,r)}catch(o){i=!0,n=o}if(t==="throw")throw e;if(i)throw n;return Jd(n),e}});var Qd=f((Bz,Bd)=>{"use strict";var gW=ke(),yW=Vt().has,MW=Un(),PW=Je(),jW=Nn(),AW=Ve(),TW=jo();Bd.exports=function(t){var e=gW(this),n=PW(t);if(MW(e)<=n.size)return jW(e,function(o){if(n.includes(o))return!1},!0)!==!1;var i=n.getIterator();return AW(i,function(o){if(yW(e,o))return TW(i,"normal",!1)})!==!1}});var se=f(()=>{"use strict";var wW=C(),SW=Qd(),bW=Le();wW({target:"Set",proto:!0,real:!0,forced:!bW("isDisjointFrom")},{isDisjointFrom:SW})});var qd=f((qz,Hd)=>{"use strict";var vW=ke(),_W=Un(),WW=Nn(),xW=Je();Hd.exports=function(t){var e=vW(this),n=xW(t);return _W(e)>n.size?!1:WW(e,function(i){if(!n.includes(i))return!1},!0)!==!1}});var ae=f(()=>{"use strict";var IW=C(),YW=qd(),EW=Le();IW({target:"Set",proto:!0,real:!0,forced:!EW("isSubsetOf")},{isSubsetOf:YW})});var tm=f((eN,$d)=>{"use strict";var DW=ke(),XW=Vt().has,ZW=Un(),CW=Je(),OW=Ve(),KW=jo();$d.exports=function(t){var e=DW(this),n=CW(t);if(ZW(e)<n.size)return!1;var i=n.getIterator();return OW(i,function(o){if(!XW(e,o))return KW(i,"normal",!1)})!==!1}});var ue=f(()=>{"use strict";var RW=C(),FW=tm(),zW=Le();RW({target:"Set",proto:!0,real:!0,forced:!zW("isSupersetOf")},{isSupersetOf:FW})});var nm=f((iN,em)=>{"use strict";var NW=ke(),Eu=Vt(),UW=Po(),GW=Je(),kW=Ve(),VW=Eu.add,JW=Eu.has,LW=Eu.remove;em.exports=function(t){var e=NW(this),n=GW(t).getIterator(),i=UW(e);return kW(n,function(o){JW(e,o)?LW(i,o):VW(i,o)}),i}});var le=f(()=>{"use strict";var BW=C(),QW=nm(),HW=Le();BW({target:"Set",proto:!0,real:!0,forced:!HW("symmetricDifference")},{symmetricDifference:QW})});var im=f((aN,rm)=>{"use strict";var qW=ke(),$W=Vt().add,tx=Po(),ex=Je(),nx=Ve();rm.exports=function(t){var e=qW(this),n=ex(t).getIterator(),i=tx(e);return nx(n,function(o){$W(i,o)}),i}});var ce=f(()=>{"use strict";var rx=C(),ix=im(),ox=Le();rx({target:"Set",proto:!0,real:!0,forced:!ox("union")},{union:ix})});var lm=f((SN,um)=>{"use strict";var hx=rt();um.exports=function(){var r=hx(this),t="";return r.hasIndices&&(t+="d"),r.global&&(t+="g"),r.ignoreCase&&(t+="i"),r.multiline&&(t+="m"),r.dotAll&&(t+="s"),r.unicode&&(t+="u"),r.unicodeSets&&(t+="v"),r.sticky&&(t+="y"),t}});var hm=f((bN,cm)=>{"use strict";var Du=X(),px=E(),Xu=px.RegExp,Zu=Du(function(){var r=Xu("a","y");return r.lastIndex=2,r.exec("abcd")!==null}),fx=Zu||Du(function(){return!Xu("a","y").sticky}),dx=Zu||Du(function(){var r=Xu("^r","gy");return r.lastIndex=2,r.exec("str")!==null});cm.exports={BROKEN_CARET:dx,MISSED_STICKY:fx,UNSUPPORTED_Y:Zu}});var fm=f((vN,pm)=>{"use strict";var mx=X(),gx=E(),yx=gx.RegExp;pm.exports=mx(function(){var r=yx(".","s");return!(r.dotAll&&r.test(`
2
2
  `)&&r.flags==="s")})});var mm=f((_N,dm)=>{"use strict";var Mx=X(),Px=E(),jx=Px.RegExp;dm.exports=Mx(function(){var r=jx("(?<a>b)","g");return r.exec("b").groups.a!=="b"||"b".replace(r,"$<a>c")!=="bc"})});var wo=f((WN,ym)=>{"use strict";var Gn=k(),To=Y(),Ax=jt(),Tx=lm(),wx=hm(),Sx=ki(),bx=Mn(),vx=re().get,_x=fm(),Wx=mm(),xx=Sx("native-string-replace",String.prototype.replace),Ao=RegExp.prototype.exec,Ou=Ao,Ix=To("".charAt),Yx=To("".indexOf),Ex=To("".replace),Cu=To("".slice),Ku=function(){var r=/a/,t=/b*/g;return Gn(Ao,r,"a"),Gn(Ao,t,"a"),r.lastIndex!==0||t.lastIndex!==0}(),gm=wx.BROKEN_CARET,Ru=/()??/.exec("")[1]!==void 0,Dx=Ku||Ru||gm||_x||Wx;Dx&&(Ou=function(t){var e=this,n=vx(e),i=Ax(t),o=n.raw,s,a,u,l,c,h,p;if(o)return o.lastIndex=e.lastIndex,s=Gn(Ou,o,i),e.lastIndex=o.lastIndex,s;var m=n.groups,g=gm&&e.sticky,M=Gn(Tx,e),P=e.source,A=0,S=i;if(g&&(M=Ex(M,"y",""),Yx(M,"g")===-1&&(M+="g"),S=Cu(i,e.lastIndex),e.lastIndex>0&&(!e.multiline||e.multiline&&Ix(i,e.lastIndex-1)!==`
3
3
  `)&&(P="(?: "+P+")",S=" "+S,A++),a=new RegExp("^(?:"+P+")",M)),Ru&&(a=new RegExp("^"+P+"$(?!\\s)",M)),Ku&&(u=e.lastIndex),l=Gn(Ao,g?a:e,S),g?l?(l.input=Cu(l.input,A),l[0]=Cu(l[0],A),l.index=e.lastIndex,e.lastIndex+=l[0].length):e.lastIndex=0:Ku&&l&&(e.lastIndex=e.global?l.index+l[0].length:u),Ru&&l&&l.length>1&&Gn(xx,l[0],a,function(){for(c=1;c<arguments.length-2;c++)arguments[c]===void 0&&(l[c]=void 0)}),l&&m)for(l.groups=h=bx(null),c=0;c<m.length;c++)p=m[c],h[p[0]]=l[p[1]];return l});ym.exports=Ou});var pe=f(()=>{"use strict";var Xx=C(),Mm=wo();Xx({target:"RegExp",proto:!0,forced:/./.exec!==Mm},{exec:Mm})});var Am=f(()=>{"use strict";var Rx=C(),Fx=E(),zx=Ue();Rx({global:!0},{Reflect:{}});zx(Fx.Reflect,"Reflect",!0)});var wm=f((UN,Tm)=>{"use strict";var Nx=vt().f;Tm.exports=function(r,t,e){e in r||Nx(r,e,{configurable:!0,get:function(){return t[e]},set:function(n){t[e]=n}})}});var Wo=f((GN,bm)=>{"use strict";var Ux=z(),Gx=tt(),Sm=Pn();bm.exports=function(r,t,e){var n,i;return Sm&&Ux(n=t.constructor)&&n!==e&&Gx(i=n.prototype)&&i!==e.prototype&&Sm(r,i),r}});var _m=f((kN,vm)=>{"use strict";var kx=jt();vm.exports=function(r,t){return r===void 0?arguments.length<2?"":t:kx(r)}});var xm=f((VN,Wm)=>{"use strict";var Vx=tt(),Jx=_t();Wm.exports=function(r,t){Vx(t)&&"cause"in t&&Jx(r,"cause",t.cause)}});var Dm=f((JN,Em)=>{"use strict";var Lx=Y(),Im=Error,Bx=Lx("".replace),Qx=function(r){return String(new Im(r).stack)}("zxcasd"),Ym=/\n\s*at [^:]*:[^\n]*/,Hx=Ym.test(Qx);Em.exports=function(r,t){if(Hx&&typeof r=="string"&&!Im.prepareStackTrace)for(;t--;)r=Bx(r,Ym,"");return r}});var Zm=f((LN,Xm)=>{"use strict";var qx=X(),$x=ze();Xm.exports=!qx(function(){var r=new Error("a");return"stack"in r?(Object.defineProperty(r,"stack",$x(1,7)),r.stack!==7):!0})});var Km=f((BN,Om)=>{"use strict";var tI=_t(),eI=Dm(),nI=Zm(),Cm=Error.captureStackTrace;Om.exports=function(r,t,e,n){nI&&(Cm?Cm(r,t):tI(r,"stack",eI(e,n)))}});var Vm=f((QN,km)=>{"use strict";var Rm=Ut(),rI=ot(),Fm=_t(),iI=On(),zm=Pn(),Nm=io(),Um=wm(),oI=Wo(),sI=_m(),aI=xm(),uI=Km(),lI=F(),Gm=Ne();km.exports=function(r,t,e,n){var i="stackTraceLimit",o=n?2:1,s=r.split("."),a=s[s.length-1],u=Rm.apply(null,s);if(u){var l=u.prototype;if(!Gm&&rI(l,"cause")&&delete l.cause,!e)return u;var c=Rm("Error"),h=t(function(p,m){var g=sI(n?m:p,void 0),M=n?new u(p):new u;return g!==void 0&&Fm(M,"message",g),uI(M,h,M.stack,2),this&&iI(l,this)&&oI(M,this,h),arguments.length>o&&aI(M,arguments[o]),M});if(h.prototype=l,a!=="Error"?zm?zm(h,c):Nm(h,c,{name:!0}):lI&&i in u&&(Um(h,u,i),Um(h,u,"prepareStackTrace")),Nm(h,u),!Gm)try{l.name!==a&&Fm(l,"name",a),l.constructor=h}catch(p){}return h}}});var Uu=f(()=>{"use strict";var Lm=C(),cI=E(),fe=mo(),Bm=Vm(),zu="WebAssembly",Jm=cI[zu],xo=new Error("e",{cause:7}).cause!==7,jn=function(r,t){var e={};e[r]=Bm(r,t,xo),Lm({global:!0,constructor:!0,arity:1,forced:xo},e)},Nu=function(r,t){if(Jm&&Jm[r]){var e={};e[r]=Bm(zu+"."+r,t,xo),Lm({target:zu,stat:!0,constructor:!0,arity:1,forced:xo},e)}};jn("Error",function(r){return function(e){return fe(r,this,arguments)}});jn("EvalError",function(r){return function(e){return fe(r,this,arguments)}});jn("RangeError",function(r){return function(e){return fe(r,this,arguments)}});jn("ReferenceError",function(r){return function(e){return fe(r,this,arguments)}});jn("SyntaxError",function(r){return function(e){return fe(r,this,arguments)}});jn("TypeError",function(r){return function(e){return fe(r,this,arguments)}});jn("URIError",function(r){return function(e){return fe(r,this,arguments)}});Nu("CompileError",function(r){return function(e){return fe(r,this,arguments)}});Nu("LinkError",function(r){return function(e){return fe(r,this,arguments)}});Nu("RuntimeError",function(r){return function(e){return fe(r,this,arguments)}})});var i2=f((iU,r2)=>{"use strict";pe();var $m=k(),t2=Wt(),hI=wo(),e2=X(),n2=J(),pI=_t(),fI=n2("species"),Gu=RegExp.prototype;r2.exports=function(r,t,e,n){var i=n2(r),o=!e2(function(){var l={};return l[i]=function(){return 7},""[r](l)!==7}),s=o&&!e2(function(){var l=!1,c=/a/;return r==="split"&&(c={},c.constructor={},c.constructor[fI]=function(){return c},c.flags="",c[i]=/./[i]),c.exec=function(){return l=!0,null},c[i](""),!l});if(!o||!s||e){var a=/./[i],u=t(i,""[r],function(l,c,h,p,m){var g=c.exec;return g===hI||g===Gu.exec?o&&!m?{done:!0,value:$m(a,c,h,p)}:{done:!0,value:$m(l,h,c,p)}:{done:!1}});t2(String.prototype,r,u[0]),t2(Gu,i,u[1])}n&&pI(Gu[i],"sham",!0)}});var Do=f((oU,a2)=>{"use strict";var ku=Y(),dI=Pt(),mI=jt(),gI=mn(),yI=ku("".charAt),o2=ku("".charCodeAt),MI=ku("".slice),s2=function(r){return function(t,e){var n=mI(gI(t)),i=dI(e),o=n.length,s,a;return i<0||i>=o?r?"":void 0:(s=o2(n,i),s<55296||s>56319||i+1===o||(a=o2(n,i+1))<56320||a>57343?r?yI(n,i):s:r?MI(n,i,i+2):(s-55296<<10)+(a-56320)+65536)}};a2.exports={codeAt:s2(!1),charAt:s2(!0)}});var l2=f((sU,u2)=>{"use strict";var PI=Do().charAt;u2.exports=function(r,t,e){return t+(e?PI(r,t).length:1)}});var h2=f((aU,c2)=>{"use strict";var Lu=Y(),jI=it(),AI=Math.floor,Vu=Lu("".charAt),TI=Lu("".replace),Ju=Lu("".slice),wI=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,SI=/\$([$&'`]|\d{1,2})/g;c2.exports=function(r,t,e,n,i,o){var s=e+r.length,a=n.length,u=SI;return i!==void 0&&(i=jI(i),u=wI),TI(o,u,function(l,c){var h;switch(Vu(c,0)){case"$":return"$";case"&":return r;case"`":return Ju(t,0,e);case"'":return Ju(t,s);case"<":h=i[Ju(c,1,-1)];break;default:var p=+c;if(p===0)return l;if(p>a){var m=AI(p/10);return m===0?l:m<=a?n[m-1]===void 0?Vu(c,1):n[m-1]+Vu(c,1):l}h=n[p-1]}return h===void 0?"":h})}});var d2=f((uU,f2)=>{"use strict";var p2=k(),bI=rt(),vI=z(),_I=we(),WI=wo(),xI=TypeError;f2.exports=function(r,t){var e=r.exec;if(vI(e)){var n=p2(e,r,t);return n!==null&&bI(n),n}if(_I(r)==="RegExp")return p2(WI,r,t);throw new xI("RegExp#exec called on incompatible receiver")}});var Lr=f(()=>{"use strict";var II=mo(),m2=k(),Xo=Y(),YI=i2(),EI=X(),DI=rt(),XI=z(),ZI=Zn(),CI=Pt(),OI=yn(),Vn=jt(),KI=mn(),RI=l2(),FI=Er(),zI=h2(),NI=d2(),UI=J(),Qu=UI("replace"),GI=Math.max,kI=Math.min,VI=Xo([].concat),Bu=Xo([].push),g2=Xo("".indexOf),y2=Xo("".slice),JI=function(r){return r===void 0?r:String(r)},LI=function(){return"a".replace(/./,"$0")==="$0"}(),M2=function(){return/./[Qu]?/./[Qu]("a","$0")==="":!1}(),BI=!EI(function(){var r=/./;return r.exec=function(){var t=[];return t.groups={a:"7"},t},"".replace(r,"$<a>")!=="7"});YI("replace",function(r,t,e){var n=M2?"$":"$0";return[function(o,s){var a=KI(this),u=ZI(o)?void 0:FI(o,Qu);return u?m2(u,o,a,s):m2(t,Vn(a),o,s)},function(i,o){var s=DI(this),a=Vn(i);if(typeof o=="string"&&g2(o,n)===-1&&g2(o,"$<")===-1){var u=e(t,s,a,o);if(u.done)return u.value}var l=XI(o);l||(o=Vn(o));var c=s.global,h;c&&(h=s.unicode,s.lastIndex=0);for(var p=[],m;m=NI(s,a),!(m===null||(Bu(p,m),!c));){var g=Vn(m[0]);g===""&&(s.lastIndex=RI(a,OI(s.lastIndex),h))}for(var M="",P=0,A=0;A<p.length;A++){m=p[A];for(var S=Vn(m[0]),_=GI(kI(CI(m.index),a.length),0),I=[],x,O=1;O<m.length;O++)Bu(I,JI(m[O]));var b=m.groups;if(l){var U=VI([S],I,_,a);b!==void 0&&Bu(U,b),x=Vn(II(o,void 0,U))}else x=zI(S,a,_,I,b,o);_>=P&&(M+=y2(a,P,_)+x,P=_+S.length)}return M+y2(a,P)}]},!BI||!LI||M2)});var Hu=f((hU,P2)=>{"use strict";P2.exports=`
4
- \v\f\r \xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF`});var T2=f((pU,A2)=>{"use strict";var QI=Y(),HI=mn(),qI=jt(),$u=Hu(),j2=QI("".replace),$I=RegExp("^["+$u+"]+"),tY=RegExp("(^|[^"+$u+"])["+$u+"]+$"),qu=function(r){return function(t){var e=qI(HI(t));return r&1&&(e=j2(e,$I,"")),r&2&&(e=j2(e,tY,"$1")),e}};A2.exports={start:qu(1),end:qu(2),trim:qu(3)}});var v2=f((fU,b2)=>{"use strict";var eY=Dr().PROPER,nY=X(),w2=Hu(),S2="\u200B\x85\u180E";b2.exports=function(r){return nY(function(){return!!w2[r]()||S2[r]()!==S2||eY&&w2[r].name!==r})}});var _2=f(()=>{"use strict";var rY=C(),iY=T2().trim,oY=v2();rY({target:"String",proto:!0,forced:oY("trim")},{trim:function(){return iY(this)}})});var n0=f((OU,Y2)=>{"use strict";var I2=Rn(),sY=TypeError;Y2.exports=function(r,t){if(!delete r[t])throw new sY("Cannot delete property "+I2(t)+" of "+I2(r))}});var Zo=f((KU,D2)=>{"use strict";var E2=Gr(),aY=Math.floor,r0=function(r,t){var e=r.length;if(e<8)for(var n=1,i,o;n<e;){for(o=n,i=r[n];o&&t(r[o-1],i)>0;)r[o]=r[--o];o!==n++&&(r[o]=i)}else for(var s=aY(e/2),a=r0(E2(r,0,s),t),u=r0(E2(r,s),t),l=a.length,c=u.length,h=0,p=0;h<l||p<c;)r[h+p]=h<l&&p<c?t(a[h],u[p])<=0?a[h++]:u[p++]:h<l?a[h++]:u[p++];return r};D2.exports=r0});var Z2=f((RU,X2)=>{"use strict";var uY=X();X2.exports=function(r,t){var e=[][r];return!!e&&uY(function(){e.call(null,t||function(){return 1},1)})}});var i0=f((FU,O2)=>{"use strict";var lY=Kn(),C2=lY.match(/firefox\/(\d+)/i);O2.exports=!!C2&&+C2[1]});var o0=f((zU,K2)=>{"use strict";var cY=Kn();K2.exports=/MSIE|Trident/.test(cY)});var s0=f((NU,F2)=>{"use strict";var hY=Kn(),R2=hY.match(/AppleWebKit\/(\d+)\./);F2.exports=!!R2&&+R2[1]});var Co=f(()=>{"use strict";var pY=C(),J2=Y(),fY=ne(),dY=it(),z2=et(),mY=n0(),N2=jt(),a0=X(),gY=Zo(),yY=Z2(),U2=i0(),MY=o0(),G2=Ir(),k2=s0(),He=[],V2=J2(He.sort),PY=J2(He.push),jY=a0(function(){He.sort(void 0)}),AY=a0(function(){He.sort(null)}),TY=yY("sort"),L2=!a0(function(){if(G2)return G2<70;if(!(U2&&U2>3)){if(MY)return!0;if(k2)return k2<603;var r="",t,e,n,i;for(t=65;t<76;t++){switch(e=String.fromCharCode(t),t){case 66:case 69:case 70:case 72:n=3;break;case 68:case 71:n=4;break;default:n=2}for(i=0;i<47;i++)He.push({k:e+i,v:n})}for(He.sort(function(o,s){return s.v-o.v}),i=0;i<He.length;i++)e=He[i].k.charAt(0),r.charAt(r.length-1)!==e&&(r+=e);return r!=="DGBEFHACIJK"}}),wY=jY||!AY||!TY||!L2,SY=function(r){return function(t,e){return e===void 0?-1:t===void 0?1:r!==void 0?+r(t,e)||0:N2(t)>N2(e)?1:-1}};pY({target:"Array",proto:!0,forced:wY},{sort:function(t){t!==void 0&&fY(t);var e=dY(this);if(L2)return t===void 0?V2(e):V2(e,t);var n=[],i=z2(e),o,s;for(s=0;s<i;s++)s in e&&PY(n,e[s]);for(gY(n,SY(t)),o=z2(n),s=0;s<o;)e[s]=n[s++];for(;s<i;)mY(e,s++);return e}})});var Q2=f((BU,B2)=>{B2.exports=function(t,e){return t[0]=e[0],t[1]=e[1],t}});var $2=f((QU,q2)=>{var H2=Q2();q2.exports=function(r,t){Array.isArray(t)||(t=[]),r.length>0&&t.push(H2([0,0],r[0]));for(var e=0;e<r.length-1;e++){var n=r[e],i=r[e+1],o=n[0],s=n[1],a=i[0],u=i[1],l=[.75*o+.25*a,.75*s+.25*u],c=[.25*o+.75*a,.25*s+.75*u];t.push(l),t.push(c)}return r.length>1&&t.push(H2([0,0],r[r.length-1])),t}});var og=f((iG,ig)=>{var l0=class{constructor(){this.keys=new Set,this.queue=[]}sort(){this.queue.sort((t,e)=>t.priority-e.priority)}set(t,e){let n=Number(e);if(isNaN(n))throw new TypeError('"priority" must be a number');return this.keys.has(t)?this.queue.map(i=>(i.key===t&&Object.assign(i,{priority:n}),i)):(this.keys.add(t),this.queue.push({key:t,priority:n})),this.sort(),this.queue.length}next(){let t=this.queue.shift();return this.keys.delete(t.key),t}isEmpty(){return this.queue.length===0}has(t){return this.keys.has(t)}get(t){return this.queue.find(e=>e.key===t)}};ig.exports=l0});var ug=f((oG,ag)=>{function sg(r,t){let e=new Map;for(let[n,i]of r)n!==t&&i instanceof Map?e.set(n,sg(i,t)):n!==t&&e.set(n,i);return e}ag.exports=sg});var hg=f((sG,cg)=>{function WY(r){let t=Number(r);return!(isNaN(t)||t<=0)}function lg(r){let t=new Map;return Object.keys(r).forEach(n=>{let i=r[n];if(i!==null&&typeof i=="object"&&!Array.isArray(i))return t.set(n,lg(i));if(!WY(i))throw new Error(`Could not add node at key "${n}", make sure it's a valid node`,i);return t.set(n,Number(i))}),t}cg.exports=lg});var dg=f((aG,fg)=>{function pg(r){if(!(r instanceof Map))throw new Error(`Invalid graph: Expected Map instead found ${typeof r}`);r.forEach((t,e)=>{if(typeof t=="object"&&t instanceof Map){pg(t);return}if(typeof t!="number"||t<=0)throw new Error(`Values must be numbers greater than 0. Found value ${t} at ${e}`)})}fg.exports=pg});var h0=f((uG,yg)=>{var xY=og(),IY=ug(),mg=hg(),gg=dg(),c0=class{constructor(t){t instanceof Map?(gg(t),this.graph=t):t?this.graph=mg(t):this.graph=new Map}addNode(t,e){let n;return e instanceof Map?(gg(e),n=e):n=mg(e),this.graph.set(t,n),this}addVertex(t,e){return this.addNode(t,e)}removeNode(t){return this.graph=IY(this.graph,t),this}path(t,e,n={}){if(!this.graph.size)return n.cost?{path:null,cost:0}:null;let i=new Set,o=new xY,s=new Map,a=[],u=0,l=[];if(n.avoid&&(l=[].concat(n.avoid)),l.includes(t))throw new Error(`Starting node (${t}) cannot be avoided`);if(l.includes(e))throw new Error(`Ending node (${e}) cannot be avoided`);for(o.set(t,0);!o.isEmpty();){let c=o.next();if(c.key===e){u=c.priority;let p=c.key;for(;s.has(p);)a.push(p),p=s.get(p);break}i.add(c.key),(this.graph.get(c.key)||new Map).forEach((p,m)=>{if(i.has(m)||l.includes(m))return null;if(!o.has(m))return s.set(m,c.key),o.set(m,c.priority+p);let g=o.get(m).priority,M=c.priority+p;return M<g?(s.set(m,c.key),o.set(m,M)):null})}return a.length?(n.trim?a.shift():a=a.concat([t]),n.reverse||(a=a.reverse()),n.cost?{path:a,cost:u}:a):n.cost?{path:null,cost:0}:null}shortestPath(...t){return this.path(...t)}};yg.exports=c0});var Hr=f((mG,Pg)=>{"use strict";var YY=we(),EY=Y();Pg.exports=function(r){if(YY(r)==="Function")return EY(r)}});var qe=f((gG,Ag)=>{"use strict";var jg=Hr(),DY=ne(),XY=Wr(),ZY=jg(jg.bind);Ag.exports=function(r,t){return DY(r),t===void 0?r:XY?ZY(r,t):function(){return r.apply(t,arguments)}}});var Sg=f((yG,wg)=>{"use strict";var CY=Or(),OY=et(),KY=so(),RY=qe(),Tg=function(r,t,e,n,i,o,s,a){for(var u=i,l=0,c=s?RY(s,a):!1,h,p;l<n;)l in e&&(h=c?c(e[l],l,t):e[l],o>0&&CY(h)?(p=OY(h),u=Tg(r,t,h,p,u,o-1)-1):(KY(u+1),r[u]=h),u++),l++;return u};wg.exports=Tg});var Ko=f((MG,xg)=>{"use strict";var FY=Y(),zY=X(),bg=z(),NY=be(),UY=Ut(),GY=$a(),vg=function(){},_g=UY("Reflect","construct"),p0=/^\s*(?:class|function)\b/,kY=FY(p0.exec),VY=!p0.test(vg),qr=function(t){if(!bg(t))return!1;try{return _g(vg,[],t),!0}catch(e){return!1}},Wg=function(t){if(!bg(t))return!1;switch(NY(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return VY||!!kY(p0,GY(t))}catch(e){return!0}};Wg.sham=!0;xg.exports=!_g||zY(function(){var r;return qr(qr.call)||!qr(Object)||!qr(function(){r=!0})||r})?Wg:qr});var Dg=f((PG,Eg)=>{"use strict";var Ig=Or(),JY=Ko(),LY=tt(),BY=J(),QY=BY("species"),Yg=Array;Eg.exports=function(r){var t;return Ig(r)&&(t=r.constructor,JY(t)&&(t===Yg||Ig(t.prototype))?t=void 0:LY(t)&&(t=t[QY],t===null&&(t=void 0))),t===void 0?Yg:t}});var f0=f((jG,Xg)=>{"use strict";var HY=Dg();Xg.exports=function(r,t){return new(HY(r))(t===0?0:t)}});var d0=f(()=>{"use strict";var qY=C(),$Y=Sg(),tE=it(),eE=et(),nE=Pt(),rE=f0();qY({target:"Array",proto:!0},{flat:function(){var t=arguments.length?arguments[0]:void 0,e=tE(this),n=eE(e),i=rE(e,0);return i.length=$Y(i,e,e,n,0,t===void 0?1:nE(t)),i}})});var m0=f(()=>{"use strict";var iE=Kr();iE("flat")});var Gg=f((Ok,Ug)=>{"use strict";var PE=J(),zg=PE("iterator"),Ng=!1;try{Fg=0,y0={next:function(){return{done:!!Fg++}},return:function(){Ng=!0}},y0[zg]=function(){return this},Array.from(y0,function(){throw 2})}catch(r){}var Fg,y0;Ug.exports=function(r,t){try{if(!t&&!Ng)return!1}catch(i){return!1}var e=!1;try{var n={};n[zg]=function(){return{next:function(){return{done:e=!0}}}},r(n)}catch(i){}return e}});var M0=f((Kk,kg)=>{"use strict";kg.exports=typeof ArrayBuffer!="undefined"&&typeof DataView!="undefined"});var Ie=f((Rk,Jg)=>{"use strict";var Vg=ou(),jE=vt();Jg.exports=function(r,t,e){return e.get&&Vg(e.get,t,{getter:!0}),e.set&&Vg(e.set,t,{setter:!0}),jE.f(r,t,e)}});var dt=f((Fk,ry)=>{"use strict";var AE=M0(),T0=F(),ut=E(),Hg=z(),Uo=tt(),rn=ot(),w0=be(),TE=Rn(),wE=_t(),P0=Wt(),SE=Ie(),bE=On(),Go=Rr(),tr=Pn(),vE=J(),_E=Vi(),qg=re(),$g=qg.enforce,WE=qg.get,zo=ut.Int8Array,j0=zo&&zo.prototype,Lg=ut.Uint8ClampedArray,Bg=Lg&&Lg.prototype,me=zo&&Go(zo),Lt=j0&&Go(j0),xE=Object.prototype,S0=ut.TypeError,Qg=vE("toStringTag"),A0=_E("TYPED_ARRAY_TAG"),No="TypedArrayConstructor",Ye=AE&&!!tr&&w0(ut.opera)!=="Opera",ty=!1,ft,nn,$n,Ee={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},b0={BigInt64Array:8,BigUint64Array:8},IE=function(t){if(!Uo(t))return!1;var e=w0(t);return e==="DataView"||rn(Ee,e)||rn(b0,e)},ey=function(r){var t=Go(r);if(Uo(t)){var e=WE(t);return e&&rn(e,No)?e[No]:ey(t)}},ny=function(r){if(!Uo(r))return!1;var t=w0(r);return rn(Ee,t)||rn(b0,t)},YE=function(r){if(ny(r))return r;throw new S0("Target is not a typed array")},EE=function(r){if(Hg(r)&&(!tr||bE(me,r)))return r;throw new S0(TE(r)+" is not a typed array constructor")},DE=function(r,t,e,n){if(T0){if(e)for(var i in Ee){var o=ut[i];if(o&&rn(o.prototype,r))try{delete o.prototype[r]}catch(s){try{o.prototype[r]=t}catch(a){}}}(!Lt[r]||e)&&P0(Lt,r,e?t:Ye&&j0[r]||t,n)}},XE=function(r,t,e){var n,i;if(T0){if(tr){if(e){for(n in Ee)if(i=ut[n],i&&rn(i,r))try{delete i[r]}catch(o){}}if(!me[r]||e)try{return P0(me,r,e?t:Ye&&me[r]||t)}catch(o){}else return}for(n in Ee)i=ut[n],i&&(!i[r]||e)&&P0(i,r,t)}};for(ft in Ee)nn=ut[ft],$n=nn&&nn.prototype,$n?$g($n)[No]=nn:Ye=!1;for(ft in b0)nn=ut[ft],$n=nn&&nn.prototype,$n&&($g($n)[No]=nn);if((!Ye||!Hg(me)||me===Function.prototype)&&(me=function(){throw new S0("Incorrect invocation")},Ye))for(ft in Ee)ut[ft]&&tr(ut[ft],me);if((!Ye||!Lt||Lt===xE)&&(Lt=me.prototype,Ye))for(ft in Ee)ut[ft]&&tr(ut[ft].prototype,Lt);Ye&&Go(Bg)!==Lt&&tr(Bg,Lt);if(T0&&!rn(Lt,Qg)){ty=!0,SE(Lt,Qg,{configurable:!0,get:function(){return Uo(this)?this[A0]:void 0}});for(ft in Ee)ut[ft]&&wE(ut[ft],A0,ft)}ry.exports={NATIVE_ARRAY_BUFFER_VIEWS:Ye,TYPED_ARRAY_TAG:ty&&A0,aTypedArray:YE,aTypedArrayConstructor:EE,exportTypedArrayMethod:DE,exportTypedArrayStaticMethod:XE,getTypedArrayConstructor:ey,isView:IE,isTypedArray:ny,TypedArray:me,TypedArrayPrototype:Lt}});var _0=f((zk,oy)=>{"use strict";var iy=E(),v0=X(),ZE=Gg(),CE=dt().NATIVE_ARRAY_BUFFER_VIEWS,OE=iy.ArrayBuffer,Tn=iy.Int8Array;oy.exports=!CE||!v0(function(){Tn(1)})||!v0(function(){new Tn(-1)})||!ZE(function(r){new Tn,new Tn(null),new Tn(1.5),new Tn(r)},!0)||v0(function(){return new Tn(new OE(2),1,void 0).length!==1})});var W0=f((Nk,sy)=>{"use strict";var KE=Wt();sy.exports=function(r,t,e){for(var n in t)KE(r,n,t[n],e);return r}});var $r=f((Uk,ay)=>{"use strict";var RE=On(),FE=TypeError;ay.exports=function(r,t){if(RE(t,r))return r;throw new FE("Incorrect invocation")}});var ko=f((Gk,uy)=>{"use strict";var zE=Pt(),NE=yn(),UE=RangeError;uy.exports=function(r){if(r===void 0)return 0;var t=zE(r),e=NE(t);if(t!==e)throw new UE("Wrong length or index");return e}});var cy=f((kk,ly)=>{"use strict";ly.exports=Math.sign||function(t){var e=+t;return e===0||e!==e?e:e<0?-1:1}});var dy=f((Vk,fy)=>{"use strict";var GE=cy(),kE=Math.abs,py=2220446049250313e-31,hy=1/py,VE=function(r){return r+hy-hy};fy.exports=function(r,t,e,n){var i=+r,o=kE(i),s=GE(i);if(o<n)return s*VE(o/n/t)*n*t;var a=(1+t/py)*o,u=a-(a-o);return u>e||u!==u?s*(1/0):s*u}});var gy=f((Jk,my)=>{"use strict";var JE=dy(),LE=11920928955078125e-23,BE=34028234663852886e22,QE=11754943508222875e-54;my.exports=Math.fround||function(t){return JE(t,LE,BE,QE)}});var My=f((Lk,yy)=>{"use strict";var HE=Array,qE=Math.abs,De=Math.pow,$E=Math.floor,tD=Math.log,eD=Math.LN2,nD=function(r,t,e){var n=HE(e),i=e*8-t-1,o=(1<<i)-1,s=o>>1,a=t===23?De(2,-24)-De(2,-77):0,u=r<0||r===0&&1/r<0?1:0,l=0,c,h,p;for(r=qE(r),r!==r||r===1/0?(h=r!==r?1:0,c=o):(c=$E(tD(r)/eD),p=De(2,-c),r*p<1&&(c--,p*=2),c+s>=1?r+=a/p:r+=a*De(2,1-s),r*p>=2&&(c++,p/=2),c+s>=o?(h=0,c=o):c+s>=1?(h=(r*p-1)*De(2,t),c+=s):(h=r*De(2,s-1)*De(2,t),c=0));t>=8;)n[l++]=h&255,h/=256,t-=8;for(c=c<<t|h,i+=t;i>0;)n[l++]=c&255,c/=256,i-=8;return n[l-1]|=u*128,n},rD=function(r,t){var e=r.length,n=e*8-t-1,i=(1<<n)-1,o=i>>1,s=n-7,a=e-1,u=r[a--],l=u&127,c;for(u>>=7;s>0;)l=l*256+r[a--],s-=8;for(c=l&(1<<-s)-1,l>>=-s,s+=t;s>0;)c=c*256+r[a--],s-=8;if(l===0)l=1-o;else{if(l===i)return c?NaN:u?-1/0:1/0;c+=De(2,t),l-=o}return(u?-1:1)*c*De(2,l-t)};yy.exports={pack:nD,unpack:rD}});var x0=f((Bk,jy)=>{"use strict";var iD=it(),Py=Zr(),oD=et();jy.exports=function(t){for(var e=iD(this),n=oD(e),i=arguments.length,o=Py(i>1?arguments[1]:void 0,n),s=i>2?arguments[2]:void 0,a=s===void 0?n:Py(s,n);a>o;)e[o++]=t;return e}});var qo=f((Qk,Oy)=>{"use strict";var Qo=E(),X0=Y(),I0=F(),sD=M0(),Ey=Dr(),aD=_t(),uD=Ie(),Ay=W0(),Y0=X(),Vo=$r(),lD=Pt(),cD=yn(),Lo=ko(),hD=gy(),Dy=My(),pD=Rr(),Ty=Pn(),fD=x0(),dD=Gr(),mD=Wo(),gD=io(),Xy=Ue(),Z0=re(),yD=Ey.PROPER,wy=Ey.CONFIGURABLE,nr="ArrayBuffer",Ho="DataView",rr="prototype",MD="Wrong length",Zy="Wrong index",Sy=Z0.getterFor(nr),ei=Z0.getterFor(Ho),by=Z0.set,Bt=Qo[nr],Tt=Bt,er=Tt&&Tt[rr],ge=Qo[Ho],wn=ge&&ge[rr],vy=Object.prototype,PD=Qo.Array,Bo=Qo.RangeError,jD=X0(fD),AD=X0([].reverse),Cy=Dy.pack,_y=Dy.unpack,Wy=function(r){return[r&255]},xy=function(r){return[r&255,r>>8&255]},Iy=function(r){return[r&255,r>>8&255,r>>16&255,r>>24&255]},Yy=function(r){return r[3]<<24|r[2]<<16|r[1]<<8|r[0]},TD=function(r){return Cy(hD(r),23,4)},wD=function(r){return Cy(r,52,8)},Jo=function(r,t,e){uD(r[rr],t,{configurable:!0,get:function(){return e(this)[t]}})},on=function(r,t,e,n){var i=ei(r),o=Lo(e),s=!!n;if(o+t>i.byteLength)throw new Bo(Zy);var a=i.bytes,u=o+i.byteOffset,l=dD(a,u,u+t);return s?l:AD(l)},sn=function(r,t,e,n,i,o){var s=ei(r),a=Lo(e),u=n(+i),l=!!o;if(a+t>s.byteLength)throw new Bo(Zy);for(var c=s.bytes,h=a+s.byteOffset,p=0;p<t;p++)c[h+p]=u[l?p:t-p-1]};sD?(E0=yD&&Bt.name!==nr,!Y0(function(){Bt(1)})||!Y0(function(){new Bt(-1)})||Y0(function(){return new Bt,new Bt(1.5),new Bt(NaN),Bt.length!==1||E0&&!wy})?(Tt=function(t){return Vo(this,er),mD(new Bt(Lo(t)),this,Tt)},Tt[rr]=er,er.constructor=Tt,gD(Tt,Bt)):E0&&wy&&aD(Bt,"name",nr),Ty&&pD(wn)!==vy&&Ty(wn,vy),ti=new ge(new Tt(2)),D0=X0(wn.setInt8),ti.setInt8(0,2147483648),ti.setInt8(1,2147483649),(ti.getInt8(0)||!ti.getInt8(1))&&Ay(wn,{setInt8:function(t,e){D0(this,t,e<<24>>24)},setUint8:function(t,e){D0(this,t,e<<24>>24)}},{unsafe:!0})):(Tt=function(t){Vo(this,er);var e=Lo(t);by(this,{type:nr,bytes:jD(PD(e),0),byteLength:e}),I0||(this.byteLength=e,this.detached=!1)},er=Tt[rr],ge=function(t,e,n){Vo(this,wn),Vo(t,er);var i=Sy(t),o=i.byteLength,s=lD(e);if(s<0||s>o)throw new Bo("Wrong offset");if(n=n===void 0?o-s:cD(n),s+n>o)throw new Bo(MD);by(this,{type:Ho,buffer:t,byteLength:n,byteOffset:s,bytes:i.bytes}),I0||(this.buffer=t,this.byteLength=n,this.byteOffset=s)},wn=ge[rr],I0&&(Jo(Tt,"byteLength",Sy),Jo(ge,"buffer",ei),Jo(ge,"byteLength",ei),Jo(ge,"byteOffset",ei)),Ay(wn,{getInt8:function(t){return on(this,1,t)[0]<<24>>24},getUint8:function(t){return on(this,1,t)[0]},getInt16:function(t){var e=on(this,2,t,arguments.length>1?arguments[1]:!1);return(e[1]<<8|e[0])<<16>>16},getUint16:function(t){var e=on(this,2,t,arguments.length>1?arguments[1]:!1);return e[1]<<8|e[0]},getInt32:function(t){return Yy(on(this,4,t,arguments.length>1?arguments[1]:!1))},getUint32:function(t){return Yy(on(this,4,t,arguments.length>1?arguments[1]:!1))>>>0},getFloat32:function(t){return _y(on(this,4,t,arguments.length>1?arguments[1]:!1),23)},getFloat64:function(t){return _y(on(this,8,t,arguments.length>1?arguments[1]:!1),52)},setInt8:function(t,e){sn(this,1,t,Wy,e)},setUint8:function(t,e){sn(this,1,t,Wy,e)},setInt16:function(t,e){sn(this,2,t,xy,e,arguments.length>2?arguments[2]:!1)},setUint16:function(t,e){sn(this,2,t,xy,e,arguments.length>2?arguments[2]:!1)},setInt32:function(t,e){sn(this,4,t,Iy,e,arguments.length>2?arguments[2]:!1)},setUint32:function(t,e){sn(this,4,t,Iy,e,arguments.length>2?arguments[2]:!1)},setFloat32:function(t,e){sn(this,4,t,TD,e,arguments.length>2?arguments[2]:!1)},setFloat64:function(t,e){sn(this,8,t,wD,e,arguments.length>2?arguments[2]:!1)}}));var E0,ti,D0;Xy(Tt,nr);Xy(ge,Ho);Oy.exports={ArrayBuffer:Tt,DataView:ge}});var Ry=f((Hk,Ky)=>{"use strict";var SD=tt(),bD=Math.floor;Ky.exports=Number.isInteger||function(t){return!SD(t)&&isFinite(t)&&bD(t)===t}});var zy=f((qk,Fy)=>{"use strict";var vD=Pt(),_D=RangeError;Fy.exports=function(r){var t=vD(r);if(t<0)throw new _D("The argument can't be less than 0");return t}});var C0=f(($k,Ny)=>{"use strict";var WD=zy(),xD=RangeError;Ny.exports=function(r,t){var e=WD(r);if(e%t)throw new xD("Wrong offset");return e}});var Gy=f((tV,Uy)=>{"use strict";var ID=Math.round;Uy.exports=function(r){var t=ID(r);return t<0?0:t>255?255:t&255}});var O0=f((eV,ky)=>{"use strict";var YD=Ko(),ED=Rn(),DD=TypeError;ky.exports=function(r){if(YD(r))return r;throw new DD(ED(r)+" is not a constructor")}});var ni=f((nV,Jy)=>{"use strict";var XD=be(),Vy=Er(),ZD=Zn(),CD=zn(),OD=J(),KD=OD("iterator");Jy.exports=function(r){if(!ZD(r))return Vy(r,KD)||Vy(r,"@@iterator")||CD[XD(r)]}});var $o=f((rV,Ly)=>{"use strict";var RD=k(),FD=ne(),zD=rt(),ND=Rn(),UD=ni(),GD=TypeError;Ly.exports=function(r,t){var e=arguments.length<2?UD(r):t;if(FD(e))return zD(RD(e,r));throw new GD(ND(r)+" is not iterable")}});var K0=f((iV,By)=>{"use strict";var kD=J(),VD=zn(),JD=kD("iterator"),LD=Array.prototype;By.exports=function(r){return r!==void 0&&(VD.Array===r||LD[JD]===r)}});var R0=f((oV,Qy)=>{"use strict";var BD=be();Qy.exports=function(r){var t=BD(r);return t==="BigInt64Array"||t==="BigUint64Array"}});var ts=f((sV,Hy)=>{"use strict";var QD=Na(),HD=TypeError;Hy.exports=function(r){var t=QD(r,"number");if(typeof t=="number")throw new HD("Can't convert number to bigint");return BigInt(t)}});var F0=f((aV,qy)=>{"use strict";var qD=qe(),$D=k(),t6=O0(),e6=it(),n6=et(),r6=$o(),i6=ni(),o6=K0(),s6=R0(),a6=dt().aTypedArrayConstructor,u6=ts();qy.exports=function(t){var e=t6(this),n=e6(t),i=arguments.length,o=i>1?arguments[1]:void 0,s=o!==void 0,a=i6(n),u,l,c,h,p,m,g,M;if(a&&!o6(a))for(g=r6(n,a),M=g.next,n=[];!(m=$D(M,g)).done;)n.push(m.value);for(s&&i>2&&(o=qD(o,arguments[2])),l=n6(n),c=new(a6(e))(l),h=s6(c),u=0;l>u;u++)p=s?o(n[u],u):n[u],c[u]=h?u6(p):+p;return c}});var eM=f((uV,tM)=>{"use strict";var l6=qe(),c6=Y(),h6=xr(),p6=it(),f6=et(),d6=f0(),$y=c6([].push),an=function(r){var t=r===1,e=r===2,n=r===3,i=r===4,o=r===6,s=r===7,a=r===5||o;return function(u,l,c,h){for(var p=p6(u),m=h6(p),g=f6(m),M=l6(l,c),P=0,A=h||d6,S=t?A(u,g):e||s?A(u,0):void 0,_,I;g>P;P++)if((a||P in m)&&(_=m[P],I=M(_,P,p),r))if(t)S[P]=I;else if(I)switch(r){case 3:return!0;case 5:return _;case 6:return P;case 2:$y(S,_)}else switch(r){case 4:return!1;case 7:$y(S,_)}return o?-1:n||i?i:S}};tM.exports={forEach:an(0),map:an(1),filter:an(2),some:an(3),every:an(4),find:an(5),findIndex:an(6),filterReject:an(7)}});var z0=f((lV,rM)=>{"use strict";var m6=Ut(),g6=Ie(),y6=J(),M6=F(),nM=y6("species");rM.exports=function(r){var t=m6(r);M6&&t&&!t[nM]&&g6(t,nM,{configurable:!0,get:function(){return this}})}});var N0=f((cV,iM)=>{"use strict";var P6=et();iM.exports=function(r,t,e){for(var n=0,i=arguments.length>2?e:P6(t),o=new r(i);i>n;)o[n]=t[n++];return o}});var un=f((hV,B0)=>{"use strict";var oM=C(),gM=E(),sM=k(),j6=F(),A6=_0(),si=dt(),yM=qo(),aM=$r(),T6=ze(),ri=_t(),w6=Ry(),S6=yn(),uM=ko(),U0=C0(),b6=Gy(),MM=Ji(),ii=ot(),v6=be(),V0=tt(),_6=Yr(),W6=Mn(),x6=On(),es=Pn(),I6=uu().f,lM=F0(),Y6=eM().forEach,E6=z0(),D6=Ie(),PM=vt(),jM=Bi(),cM=N0(),Q0=re(),X6=Wo(),J0=Q0.get,Z6=Q0.set,C6=Q0.enforce,AM=PM.f,O6=jM.f,G0=gM.RangeError,TM=yM.ArrayBuffer,K6=TM.prototype,R6=yM.DataView,ns=si.NATIVE_ARRAY_BUFFER_VIEWS,hM=si.TYPED_ARRAY_TAG,pM=si.TypedArray,oi=si.TypedArrayPrototype,L0=si.isTypedArray,rs="BYTES_PER_ELEMENT",k0="Wrong length",is=function(r,t){D6(r,t,{configurable:!0,get:function(){return J0(this)[t]}})},fM=function(r){var t;return x6(K6,r)||(t=v6(r))==="ArrayBuffer"||t==="SharedArrayBuffer"},wM=function(r,t){return L0(r)&&!_6(t)&&t in r&&w6(+t)&&t>=0},dM=function(t,e){return e=MM(e),wM(t,e)?T6(2,t[e]):O6(t,e)},mM=function(t,e,n){return e=MM(e),wM(t,e)&&V0(n)&&ii(n,"value")&&!ii(n,"get")&&!ii(n,"set")&&!n.configurable&&(!ii(n,"writable")||n.writable)&&(!ii(n,"enumerable")||n.enumerable)?(t[e]=n.value,t):AM(t,e,n)};j6?(ns||(jM.f=dM,PM.f=mM,is(oi,"buffer"),is(oi,"byteOffset"),is(oi,"byteLength"),is(oi,"length")),oM({target:"Object",stat:!0,forced:!ns},{getOwnPropertyDescriptor:dM,defineProperty:mM}),B0.exports=function(r,t,e){var n=r.match(/\d+/)[0]/8,i=r+(e?"Clamped":"")+"Array",o="get"+r,s="set"+r,a=gM[i],u=a,l=u&&u.prototype,c={},h=function(M,P){var A=J0(M);return A.view[o](P*n+A.byteOffset,!0)},p=function(M,P,A){var S=J0(M);S.view[s](P*n+S.byteOffset,e?b6(A):A,!0)},m=function(M,P){AM(M,P,{get:function(){return h(this,P)},set:function(A){return p(this,P,A)},enumerable:!0})};ns?A6&&(u=t(function(M,P,A,S){return aM(M,l),X6(function(){return V0(P)?fM(P)?S!==void 0?new a(P,U0(A,n),S):A!==void 0?new a(P,U0(A,n)):new a(P):L0(P)?cM(u,P):sM(lM,u,P):new a(uM(P))}(),M,u)}),es&&es(u,pM),Y6(I6(a),function(M){M in u||ri(u,M,a[M])}),u.prototype=l):(u=t(function(M,P,A,S){aM(M,l);var _=0,I=0,x,O,b;if(!V0(P))b=uM(P),O=b*n,x=new TM(O);else if(fM(P)){x=P,I=U0(A,n);var U=P.byteLength;if(S===void 0){if(U%n)throw new G0(k0);if(O=U-I,O<0)throw new G0(k0)}else if(O=S6(S)*n,O+I>U)throw new G0(k0);b=O/n}else return L0(P)?cM(u,P):sM(lM,u,P);for(Z6(M,{buffer:x,byteOffset:I,byteLength:O,length:b,view:new R6(x)});_<b;)m(M,_++)}),es&&es(u,pM),l=u.prototype=W6(oi)),l.constructor!==u&&ri(l,"constructor",u),C6(l).TypedArrayConstructor=u,hM&&ri(l,hM,i);var g=u!==a;c[i]=u,oM({global:!0,constructor:!0,forced:g,sham:!ns},c),rs in u||ri(u,rs,n),rs in l||ri(l,rs,n),E6(i)}):B0.exports=function(){}});var os=f(()=>{"use strict";var F6=un();F6("Uint8",function(r){return function(e,n,i){return r(this,e,n,i)}})});var ai=f(()=>{"use strict";var SM=dt(),z6=et(),N6=Pt(),U6=SM.aTypedArray,G6=SM.exportTypedArrayMethod;G6("at",function(t){var e=U6(this),n=z6(e),i=N6(t),o=i>=0?i:n+i;return o<0||o>=n?void 0:e[o]})});var ui=f(()=>{"use strict";var bM=dt(),k6=x0(),V6=ts(),J6=be(),L6=k(),B6=Y(),Q6=X(),H6=bM.aTypedArray,q6=bM.exportTypedArrayMethod,$6=B6("".slice),t3=Q6(function(){var r=0;return new Int8Array(2).fill({valueOf:function(){return r++}}),r!==1});q6("fill",function(t){var e=arguments.length;H6(this);var n=$6(J6(this),0,3)==="Big"?V6(t):+t;return L6(k6,this,n,e>1?arguments[1]:void 0,e>2?arguments[2]:void 0)},t3)});var li=f((MV,_M)=>{"use strict";var e3=qe(),n3=xr(),r3=it(),i3=et(),vM=function(r){var t=r===1;return function(e,n,i){for(var o=r3(e),s=n3(o),a=i3(s),u=e3(n,i),l,c;a-- >0;)if(l=s[a],c=u(l,a,o),c)switch(r){case 0:return l;case 1:return a}return t?-1:void 0}};_M.exports={findLast:vM(0),findLastIndex:vM(1)}});var ci=f(()=>{"use strict";var WM=dt(),o3=li().findLast,s3=WM.aTypedArray,a3=WM.exportTypedArrayMethod;a3("findLast",function(t){return o3(s3(this),t,arguments.length>1?arguments[1]:void 0)})});var hi=f(()=>{"use strict";var xM=dt(),u3=li().findLastIndex,l3=xM.aTypedArray,c3=xM.exportTypedArrayMethod;c3("findLastIndex",function(t){return u3(l3(this),t,arguments.length>1?arguments[1]:void 0)})});var pi=f(()=>{"use strict";var YM=E(),EM=k(),$0=dt(),h3=et(),p3=C0(),f3=it(),DM=X(),d3=YM.RangeError,H0=YM.Int8Array,IM=H0&&H0.prototype,XM=IM&&IM.set,m3=$0.aTypedArray,g3=$0.exportTypedArrayMethod,q0=!DM(function(){var r=new Uint8ClampedArray(2);return EM(XM,r,{length:1,0:3},1),r[1]!==3}),y3=q0&&$0.NATIVE_ARRAY_BUFFER_VIEWS&&DM(function(){var r=new H0(2);return r.set(1),r.set("2",1),r[0]!==0||r[1]!==2});g3("set",function(t){m3(this);var e=p3(arguments.length>1?arguments[1]:void 0,1),n=f3(t);if(q0)return EM(XM,this,n,e);var i=this.length,o=h3(n),s=0;if(o+e>i)throw new d3("Wrong length");for(;s<o;)this[e+s]=n[s++]},!q0||y3)});var di=f(()=>{"use strict";var M3=E(),P3=Hr(),tl=X(),j3=ne(),A3=Zo(),RM=dt(),ZM=i0(),T3=o0(),CM=Ir(),OM=s0(),w3=RM.aTypedArray,S3=RM.exportTypedArrayMethod,fi=M3.Uint16Array,ir=fi&&P3(fi.prototype.sort),b3=!!ir&&!(tl(function(){ir(new fi(2),null)})&&tl(function(){ir(new fi(2),{})})),KM=!!ir&&!tl(function(){if(CM)return CM<74;if(ZM)return ZM<67;if(T3)return!0;if(OM)return OM<602;var r=new fi(516),t=Array(516),e,n;for(e=0;e<516;e++)n=e%4,r[e]=515-e,t[e]=e-2*n+3;for(ir(r,function(i,o){return(i/4|0)-(o/4|0)}),e=0;e<516;e++)if(r[e]!==t[e])return!0}),v3=function(r){return function(t,e){return r!==void 0?+r(t,e)||0:e!==e?-1:t!==t?1:t===0&&e===0?1/t>0&&1/e<0?1:-1:t>e}};S3("sort",function(t){return t!==void 0&&j3(t),KM?ir(this,t):A3(w3(this),v3(t))},!KM||b3)});var zM=f((_V,FM)=>{"use strict";var _3=et();FM.exports=function(r,t){for(var e=_3(r),n=new t(e),i=0;i<e;i++)n[i]=r[e-i-1];return n}});var mi=f(()=>{"use strict";var W3=zM(),el=dt(),x3=el.aTypedArray,I3=el.exportTypedArrayMethod,Y3=el.getTypedArrayConstructor;I3("toReversed",function(){return W3(x3(this),Y3(this))})});var gi=f(()=>{"use strict";var ss=dt(),E3=Y(),D3=ne(),X3=N0(),Z3=ss.aTypedArray,C3=ss.getTypedArrayConstructor,O3=ss.exportTypedArrayMethod,K3=E3(ss.TypedArrayPrototype.sort);O3("toSorted",function(t){t!==void 0&&D3(t);var e=Z3(this),n=X3(C3(e),e);return K3(n,t)})});var UM=f((EV,NM)=>{"use strict";var R3=et(),F3=Pt(),z3=RangeError;NM.exports=function(r,t,e,n){var i=R3(r),o=F3(e),s=o<0?i+o:o;if(s>=i||s<0)throw new z3("Incorrect index");for(var a=new t(i),u=0;u<i;u++)a[u]=u===s?n:r[u];return a}});var yi=f(()=>{"use strict";var N3=UM(),nl=dt(),U3=R0(),G3=Pt(),k3=ts(),V3=nl.aTypedArray,J3=nl.getTypedArrayConstructor,L3=nl.exportTypedArrayMethod,B3=!!function(){try{new Int8Array(1).with(2,{valueOf:function(){throw 8}})}catch(r){return r===8}}();L3("with",function(r,t){var e=V3(this),n=G3(r),i=U3(e)?k3(t):+t;return N3(e,J3(e),n,i)},!B3)});var Mi=f(()=>{"use strict";var Q3=C(),H3=E(),q3=qo(),$3=z0(),rl="ArrayBuffer",GM=q3[rl],tX=H3[rl];Q3({global:!0,constructor:!0,forced:tX!==GM},{ArrayBuffer:GM});$3(rl)});var Pi=f(()=>{"use strict";var eX=C(),ol=Hr(),nX=X(),LM=qo(),kM=rt(),VM=Zr(),rX=yn(),sl=LM.ArrayBuffer,il=LM.DataView,BM=il.prototype,JM=ol(sl.prototype.slice),iX=ol(BM.getUint8),oX=ol(BM.setUint8),sX=nX(function(){return!new sl(2).slice(1,void 0).byteLength});eX({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:sX},{slice:function(t,e){if(JM&&e===void 0)return JM(kM(this),t);for(var n=kM(this).byteLength,i=VM(t,n),o=VM(e===void 0?n:e,n),s=new sl(rX(o-i)),a=new il(this),u=new il(s),l=0;i<o;)oX(u,l++,iX(a,i++));return s}})});var al=f((RV,qM)=>{"use strict";var HM=E(),aX=Fr(),uX=we(),QM=HM.ArrayBuffer,lX=HM.TypeError;qM.exports=QM&&aX(QM.prototype,"byteLength","get")||function(r){if(uX(r)!=="ArrayBuffer")throw new lX("ArrayBuffer expected");return r.byteLength}});var ul=f((FV,nP)=>{"use strict";var cX=E(),hX=Hr(),pX=al(),$M=cX.ArrayBuffer,tP=$M&&$M.prototype,eP=tP&&hX(tP.slice);nP.exports=function(r){if(pX(r)!==0||!eP)return!1;try{return eP(r,0,0),!1}catch(t){return!0}}});var ji=f(()=>{"use strict";var fX=F(),dX=Ie(),mX=ul(),rP=ArrayBuffer.prototype;fX&&!("detached"in rP)&&dX(rP,"detached",{configurable:!0,get:function(){return mX(this)}})});var oP=f((UV,iP)=>{"use strict";var gX=ul(),yX=TypeError;iP.exports=function(r){if(gX(r))throw new yX("ArrayBuffer is detached");return r}});var ll=f((GV,sP)=>{"use strict";var Ai=E(),MX=Kn(),PX=we(),as=function(r){return MX.slice(0,r.length)===r};sP.exports=function(){return as("Bun/")?"BUN":as("Cloudflare-Workers")?"CLOUDFLARE":as("Deno/")?"DENO":as("Node.js/")?"NODE":Ai.Bun&&typeof Bun.version=="string"?"BUN":Ai.Deno&&typeof Deno.version=="object"?"DENO":PX(Ai.process)==="process"?"NODE":Ai.window&&Ai.document?"BROWSER":"REST"}()});var uP=f((kV,aP)=>{"use strict";var jX=ll();aP.exports=jX==="NODE"});var cP=f((VV,lP)=>{"use strict";var AX=E(),TX=uP();lP.exports=function(r){if(TX){try{return AX.process.getBuiltinModule(r)}catch(t){}try{return Function('return require("'+r+'")')()}catch(t){}}}});var pl=f((JV,pP)=>{"use strict";var wX=E(),SX=X(),cl=Ir(),hl=ll(),hP=wX.structuredClone;pP.exports=!!hP&&!SX(function(){if(hl==="DENO"&&cl>92||hl==="NODE"&&cl>94||hl==="BROWSER"&&cl>97)return!1;var r=new ArrayBuffer(8),t=hP(r,{transfer:[r]});return r.byteLength!==0||t.byteLength!==8})});var gP=f((LV,mP)=>{"use strict";var gl=E(),bX=cP(),vX=pl(),_X=gl.structuredClone,fP=gl.ArrayBuffer,us=gl.MessageChannel,ml=!1,fl,dP,ls,dl;if(vX)ml=function(r){_X(r,{transfer:[r]})};else if(fP)try{us||(fl=bX("worker_threads"),fl&&(us=fl.MessageChannel)),us&&(dP=new us,ls=new fP(2),dl=function(r){dP.port1.postMessage(null,[r])},ls.byteLength===2&&(dl(ls),ls.byteLength===0&&(ml=dl)))}catch(r){}mP.exports=ml});var Tl=f((BV,wP)=>{"use strict";var Pl=E(),jl=Y(),jP=Fr(),WX=ko(),xX=oP(),IX=al(),yP=gP(),yl=pl(),YX=Pl.structuredClone,AP=Pl.ArrayBuffer,Ml=Pl.DataView,EX=Math.min,Al=AP.prototype,TP=Ml.prototype,DX=jl(Al.slice),MP=jP(Al,"resizable","get"),PP=jP(Al,"maxByteLength","get"),XX=jl(TP.getInt8),ZX=jl(TP.setInt8);wP.exports=(yl||yP)&&function(r,t,e){var n=IX(r),i=t===void 0?n:WX(t),o=!MP||!MP(r),s;if(xX(r),yl&&(r=YX(r,{transfer:[r]}),n===i&&(e||o)))return r;if(n>=i&&(!e||o))s=DX(r,0,i);else{var a=e&&!o&&PP?{maxByteLength:PP(r)}:void 0;s=new AP(i,a);for(var u=new Ml(r),l=new Ml(s),c=EX(i,n),h=0;h<c;h++)ZX(l,h,XX(u,h))}return yl||yP(r),s}});var Ti=f(()=>{"use strict";var CX=C(),SP=Tl();SP&&CX({target:"ArrayBuffer",proto:!0},{transfer:function(){return SP(this,arguments.length?arguments[0]:void 0,!0)}})});var wi=f(()=>{"use strict";var OX=C(),bP=Tl();bP&&OX({target:"ArrayBuffer",proto:!0},{transferToFixedLength:function(){return bP(this,arguments.length?arguments[0]:void 0,!1)}})});var wl=f(()=>{"use strict";var KX=_0(),RX=dt().exportTypedArrayStaticMethod,FX=F0();RX("from",FX,KX)});var Sl=f(()=>{"use strict";var UX=un();UX("Float32",function(r){return function(e,n,i){return r(this,e,n,i)}})});var EP=f(()=>{"use strict";var GX=Do().charAt,kX=jt(),IP=re(),VX=bu(),xP=ho(),YP="String Iterator",JX=IP.set,LX=IP.getterFor(YP);VX(String,"String",function(r){JX(this,{type:YP,string:kX(r),index:0})},function(){var t=LX(this),e=t.string,n=t.index,i;return n>=e.length?xP(void 0,!0):(i=GX(e,n),t.index+=i.length,xP(i,!1))})});var bl=f((IJ,XP)=>{"use strict";var BX=X(),QX=J(),HX=F(),DP=Ne(),qX=QX("iterator");XP.exports=!BX(function(){var r=new URL("b?a=1&b=2&c=3","https://a"),t=r.searchParams,e=new URLSearchParams("a=1&a=2&b=3"),n="";return r.pathname="c%20d",t.forEach(function(i,o){t.delete("b"),n+=o+i}),e.delete("a",2),e.delete("b",void 0),DP&&(!r.toJSON||!e.has("a",1)||e.has("a",2)||!e.has("a",void 0)||e.has("b"))||!t.size&&(DP||!HX)||!t.sort||r.href!=="https://a/c%20d?a=1&c=3"||t.get("c")!=="3"||String(new URLSearchParams("?a=1"))!=="a=1"||!t[qX]||new URL("https://a@b").username!=="a"||new URLSearchParams(new URLSearchParams("a=b")).get("a")!=="b"||new URL("https://\u0442\u0435\u0441\u0442").host!=="xn--e1aybc"||new URL("https://a#\u0431").hash!=="#%D0%B1"||n!=="a1c3"||new URL("https://x",void 0).host!=="x"})});var KP=f((YJ,OP)=>{"use strict";var ZP=F(),$X=Y(),tZ=k(),eZ=X(),vl=pu(),nZ=lu(),rZ=Ya(),iZ=it(),oZ=xr(),or=Object.assign,CP=Object.defineProperty,sZ=$X([].concat);OP.exports=!or||eZ(function(){if(ZP&&or({b:1},or(CP({},"a",{enumerable:!0,get:function(){CP(this,"b",{value:3,enumerable:!1})}}),{b:2})).b!==1)return!0;var r={},t={},e=Symbol("assign detection"),n="abcdefghijklmnopqrst";return r[e]=7,n.split("").forEach(function(i){t[i]=i}),or({},r)[e]!==7||vl(or({},t)).join("")!==n})?function(t,e){for(var n=iZ(t),i=arguments.length,o=1,s=nZ.f,a=rZ.f;i>o;)for(var u=oZ(arguments[o++]),l=s?sZ(vl(u),s(u)):vl(u),c=l.length,h=0,p;c>h;)p=l[h++],(!ZP||tZ(a,u,p))&&(n[p]=u[p]);return n}:or});var FP=f((EJ,RP)=>{"use strict";var aZ=rt(),uZ=jo();RP.exports=function(r,t,e,n){try{return n?t(aZ(e)[0],e[1]):t(e)}catch(i){uZ(r,"throw",i)}}});var NP=f((DJ,zP)=>{"use strict";var lZ=F(),cZ=vt(),hZ=ze();zP.exports=function(r,t,e){lZ?cZ.f(r,t,hZ(0,e)):r[t]=e}});var VP=f((XJ,kP)=>{"use strict";var pZ=qe(),fZ=k(),dZ=it(),mZ=FP(),gZ=K0(),yZ=Ko(),MZ=et(),UP=NP(),PZ=$o(),jZ=ni(),GP=Array;kP.exports=function(t){var e=dZ(t),n=yZ(this),i=arguments.length,o=i>1?arguments[1]:void 0,s=o!==void 0;s&&(o=pZ(o,i>2?arguments[2]:void 0));var a=jZ(e),u=0,l,c,h,p,m,g;if(a&&!(this===GP&&gZ(a)))for(c=n?new this:[],p=PZ(e,a),m=p.next;!(h=fZ(m,p)).done;u++)g=s?mZ(p,o,[h.value,u],!0):h.value,UP(c,u,g);else for(l=MZ(e),c=n?new this(l):GP(l);l>u;u++)g=s?o(e[u],u):e[u],UP(c,u,g);return c.length=u,c}});var ej=f((ZJ,tj)=>{"use strict";var Sn=Y(),_l=2147483647,Si=36,HP=1,Il=26,AZ=38,TZ=700,wZ=72,SZ=128,bZ="-",vZ=/[^\0-\u007E]/,qP=/[.\u3002\uFF0E\uFF61]/g,JP="Overflow: input needs wider integers to process",Wl=Si-HP,LP=RangeError,_Z=Sn(qP.exec),sr=Math.floor,xl=String.fromCharCode,BP=Sn("".charCodeAt),$P=Sn([].join),ln=Sn([].push),WZ=Sn("".replace),xZ=Sn("".split),IZ=Sn("".toLowerCase),YZ=function(r){for(var t=[],e=0,n=r.length;e<n;){var i=BP(r,e++);if(i>=55296&&i<=56319&&e<n){var o=BP(r,e++);(o&64512)===56320?ln(t,((i&1023)<<10)+(o&1023)+65536):(ln(t,i),e--)}else ln(t,i)}return t},QP=function(r){return r+22+75*(r<26)},EZ=function(r,t,e){var n=0;for(r=e?sr(r/TZ):r>>1,r+=sr(r/t);r>Wl*Il>>1;)r=sr(r/Wl),n+=Si;return sr(n+(Wl+1)*r/(r+AZ))},DZ=function(r){var t=[];r=YZ(r);var e=r.length,n=SZ,i=0,o=wZ,s,a;for(s=0;s<r.length;s++)a=r[s],a<128&&ln(t,xl(a));var u=t.length,l=u;for(u&&ln(t,bZ);l<e;){var c=_l;for(s=0;s<r.length;s++)a=r[s],a>=n&&a<c&&(c=a);var h=l+1;if(c-n>sr((_l-i)/h))throw new LP(JP);for(i+=(c-n)*h,n=c,s=0;s<r.length;s++){if(a=r[s],a<n&&++i>_l)throw new LP(JP);if(a===n){for(var p=i,m=Si;;){var g=m<=o?HP:m>=o+Il?Il:m-o;if(p<g)break;var M=p-g,P=Si-g;ln(t,xl(QP(g+M%P))),p=sr(M/P),m+=Si}ln(t,xl(QP(p))),o=EZ(i,h,l===u),i=0,l++}}i++,n++}return $P(t,"")};tj.exports=function(r){var t=[],e=xZ(WZ(IZ(r),qP,"."),"."),n,i;for(n=0;n<e.length;n++)i=e[n],ln(t,_Z(vZ,i)?"xn--"+DZ(i):i);return $P(t,".")}});var bi=f((CJ,nj)=>{"use strict";var XZ=TypeError;nj.exports=function(r,t){if(r<t)throw new XZ("Not enough arguments");return r}});var oj=f(()=>{"use strict";var ZZ=C(),CZ=Y(),OZ=Zr(),KZ=RangeError,rj=String.fromCharCode,ij=String.fromCodePoint,RZ=CZ([].join),FZ=!!ij&&ij.length!==1;ZZ({target:"String",stat:!0,arity:1,forced:FZ},{fromCodePoint:function(t){for(var e=[],n=arguments.length,i=0,o;n>i;){if(o=+arguments[i++],OZ(o,1114111)!==o)throw new KZ(o+" is not a valid code point");e[i]=o<65536?rj(o):rj(((o-=65536)>>10)+55296,o%1024+56320)}return RZ(e,"")}})});var uj=f((RJ,aj)=>{"use strict";var sj=E(),zZ=F(),NZ=Object.getOwnPropertyDescriptor;aj.exports=function(r){if(!zZ)return sj[r];var t=NZ(sj,r);return t&&t.value}});var Rl=f((FJ,Yj)=>{"use strict";_u();oj();var Cl=C(),Aj=E(),Ol=uj(),UZ=Ut(),hs=k(),Qt=Y(),vi=F(),Tj=bl(),wj=Wt(),GZ=Ie(),kZ=W0(),VZ=Ue(),JZ=wu(),Kl=re(),Sj=$r(),Yl=z(),LZ=ot(),BZ=qe(),QZ=be(),HZ=rt(),bj=tt(),lt=jt(),qZ=Mn(),lj=ze(),cj=$o(),$Z=ni(),ps=ho(),ar=bi(),tC=J(),eC=Zo(),nC=tC("iterator"),lr="URLSearchParams",vj=lr+"Iterator",_j=Kl.set,Dt=Kl.getterFor(lr),rC=Kl.getterFor(vj),hj=Ol("fetch"),ms=Ol("Request"),_i=Ol("Headers"),El=ms&&ms.prototype,pj=_i&&_i.prototype,iC=Aj.TypeError,oC=Aj.encodeURIComponent,sC=String.fromCharCode,aC=UZ("String","fromCodePoint"),uC=parseInt,ds=Qt("".charAt),fj=Qt([].join),cn=Qt([].push),Wj=Qt("".replace),lC=Qt([].shift),dj=Qt([].splice),mj=Qt("".split),xj=Qt("".slice),cC=Qt(/./.exec),hC=/\+/g,Dl="\uFFFD",pC=/^[0-9a-f]+$/i,gj=function(r,t){var e=xj(r,t,t+2);return cC(pC,e)?uC(e,16):NaN},fC=function(r){for(var t=0,e=128;e>0&&r&e;e>>=1)t++;return t},dC=function(r){var t=null;switch(r.length){case 1:t=r[0];break;case 2:t=(r[0]&31)<<6|r[1]&63;break;case 3:t=(r[0]&15)<<12|(r[1]&63)<<6|r[2]&63;break;case 4:t=(r[0]&7)<<18|(r[1]&63)<<12|(r[2]&63)<<6|r[3]&63;break}return t>1114111?null:t},yj=function(r){r=Wj(r,hC," ");for(var t=r.length,e="",n=0;n<t;){var i=ds(r,n);if(i==="%"){if(ds(r,n+1)==="%"||n+3>t){e+="%",n++;continue}var o=gj(r,n+1);if(o!==o){e+=i,n++;continue}n+=2;var s=fC(o);if(s===0)i=sC(o);else{if(s===1||s>4){e+=Dl,n++;continue}for(var a=[o],u=1;u<s&&(n++,!(n+3>t||ds(r,n)!=="%"));){var l=gj(r,n+1);if(l!==l){n+=3;break}if(l>191||l<128)break;cn(a,l),n+=2,u++}if(a.length!==s){e+=Dl;continue}var c=dC(a);c===null?e+=Dl:i=aC(c)}}e+=i,n++}return e},mC=/[!'()~]|%20/g,gC={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},yC=function(r){return gC[r]},Mj=function(r){return Wj(oC(r),mC,yC)},Xl=JZ(function(t,e){_j(this,{type:vj,target:Dt(t).entries,index:0,kind:e})},lr,function(){var t=rC(this),e=t.target,n=t.index++;if(!e||n>=e.length)return t.target=null,ps(void 0,!0);var i=e[n];switch(t.kind){case"keys":return ps(i.key,!1);case"values":return ps(i.value,!1)}return ps([i.key,i.value],!1)},!0),Ij=function(r){this.entries=[],this.url=null,r!==void 0&&(bj(r)?this.parseObject(r):this.parseQuery(typeof r=="string"?ds(r,0)==="?"?xj(r,1):r:lt(r)))};Ij.prototype={type:lr,bindURL:function(r){this.url=r,this.update()},parseObject:function(r){var t=this.entries,e=$Z(r),n,i,o,s,a,u,l;if(e)for(n=cj(r,e),i=n.next;!(o=hs(i,n)).done;){if(s=cj(HZ(o.value)),a=s.next,(u=hs(a,s)).done||(l=hs(a,s)).done||!hs(a,s).done)throw new iC("Expected sequence with length 2");cn(t,{key:lt(u.value),value:lt(l.value)})}else for(var c in r)LZ(r,c)&&cn(t,{key:c,value:lt(r[c])})},parseQuery:function(r){if(r)for(var t=this.entries,e=mj(r,"&"),n=0,i,o;n<e.length;)i=e[n++],i.length&&(o=mj(i,"="),cn(t,{key:yj(lC(o)),value:yj(fj(o,"="))}))},serialize:function(){for(var r=this.entries,t=[],e=0,n;e<r.length;)n=r[e++],cn(t,Mj(n.key)+"="+Mj(n.value));return fj(t,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var gs=function(){Sj(this,ur);var t=arguments.length>0?arguments[0]:void 0,e=_j(this,new Ij(t));vi||(this.size=e.entries.length)},ur=gs.prototype;kZ(ur,{append:function(t,e){var n=Dt(this);ar(arguments.length,2),cn(n.entries,{key:lt(t),value:lt(e)}),vi||this.length++,n.updateURL()},delete:function(r){for(var t=Dt(this),e=ar(arguments.length,1),n=t.entries,i=lt(r),o=e<2?void 0:arguments[1],s=o===void 0?o:lt(o),a=0;a<n.length;){var u=n[a];if(u.key===i&&(s===void 0||u.value===s)){if(dj(n,a,1),s!==void 0)break}else a++}vi||(this.size=n.length),t.updateURL()},get:function(t){var e=Dt(this).entries;ar(arguments.length,1);for(var n=lt(t),i=0;i<e.length;i++)if(e[i].key===n)return e[i].value;return null},getAll:function(t){var e=Dt(this).entries;ar(arguments.length,1);for(var n=lt(t),i=[],o=0;o<e.length;o++)e[o].key===n&&cn(i,e[o].value);return i},has:function(t){for(var e=Dt(this).entries,n=ar(arguments.length,1),i=lt(t),o=n<2?void 0:arguments[1],s=o===void 0?o:lt(o),a=0;a<e.length;){var u=e[a++];if(u.key===i&&(s===void 0||u.value===s))return!0}return!1},set:function(t,e){var n=Dt(this);ar(arguments.length,1);for(var i=n.entries,o=!1,s=lt(t),a=lt(e),u=0,l;u<i.length;u++)l=i[u],l.key===s&&(o?dj(i,u--,1):(o=!0,l.value=a));o||cn(i,{key:s,value:a}),vi||(this.size=i.length),n.updateURL()},sort:function(){var t=Dt(this);eC(t.entries,function(e,n){return e.key>n.key?1:-1}),t.updateURL()},forEach:function(t){for(var e=Dt(this).entries,n=BZ(t,arguments.length>1?arguments[1]:void 0),i=0,o;i<e.length;)o=e[i++],n(o.value,o.key,this)},keys:function(){return new Xl(this,"keys")},values:function(){return new Xl(this,"values")},entries:function(){return new Xl(this,"entries")}},{enumerable:!0});wj(ur,nC,ur.entries,{name:"entries"});wj(ur,"toString",function(){return Dt(this).serialize()},{enumerable:!0});vi&&GZ(ur,"size",{get:function(){return Dt(this).entries.length},configurable:!0,enumerable:!0});VZ(gs,lr);Cl({global:!0,constructor:!0,forced:!Tj},{URLSearchParams:gs});!Tj&&Yl(_i)&&(Pj=Qt(pj.has),jj=Qt(pj.set),Zl=function(r){if(bj(r)){var t=r.body,e;if(QZ(t)===lr)return e=r.headers?new _i(r.headers):new _i,Pj(e,"content-type")||jj(e,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),qZ(r,{body:lj(0,lt(t)),headers:lj(0,e)})}return r},Yl(hj)&&Cl({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(t){return hj(t,arguments.length>1?Zl(arguments[1]):{})}}),Yl(ms)&&(fs=function(t){return Sj(this,El),new ms(t,arguments.length>1?Zl(arguments[1]):{})},El.constructor=fs,fs.prototype=El,Cl({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:fs})));var Pj,jj,Zl,fs;Yj.exports={URLSearchParams:gs,getState:Dt}});var Bj=f(()=>{"use strict";EP();var MC=C(),nc=F(),PC=bl(),rc=E(),Ej=qe(),Kt=Y(),As=Wt(),Xt=Ie(),jC=$r(),$l=ot(),ic=KP(),cr=VP(),Ht=Gr(),AC=Do().codeAt,TC=ej(),Ze=jt(),wC=Ue(),SC=bi(),Uj=Rl(),Gj=re(),bC=Gj.set,Ts=Gj.getterFor("URL"),vC=Uj.URLSearchParams,_C=Uj.getState,Wi=rc.URL,tc=rc.TypeError,ws=rc.parseInt,WC=Math.floor,Dj=Math.pow,Ot=Kt("".charAt),qt=Kt(/./.exec),Ii=Kt([].join),xC=Kt(1 .toString),IC=Kt([].pop),pr=Kt([].push),Fl=Kt("".replace),YC=Kt([].shift),EC=Kt("".split),Ei=Kt("".slice),Ss=Kt("".toLowerCase),DC=Kt([].unshift),XC="Invalid authority",zl="Invalid scheme",bn="Invalid host",Xj="Invalid port",kj=/[a-z]/i,ZC=/[\d+-.a-z]/i,ec=/\d/,CC=/^0x/i,OC=/^[0-7]+$/,KC=/^\d+$/,Vj=/^[\da-f]+$/i,RC=/[\0\t\n\r #%/:<>?@[\\\]^|]/,FC=/[\0\t\n\r #/:<>?@[\\\]^|]/,zC=/^[\u0000-\u0020]+/,NC=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,UC=/[\t\n\r]/g,Zt,GC=function(r){var t=EC(r,"."),e,n,i,o,s,a,u;if(t.length&&t[t.length-1]===""&&t.length--,e=t.length,e>4)return r;for(n=[],i=0;i<e;i++){if(o=t[i],o==="")return r;if(s=10,o.length>1&&Ot(o,0)==="0"&&(s=qt(CC,o)?16:8,o=Ei(o,s===8?1:2)),o==="")a=0;else{if(!qt(s===10?KC:s===8?OC:Vj,o))return r;a=ws(o,s)}pr(n,a)}for(i=0;i<e;i++)if(a=n[i],i===e-1){if(a>=Dj(256,5-e))return null}else if(a>255)return null;for(u=IC(n),i=0;i<n.length;i++)u+=n[i]*Dj(256,3-i);return u},kC=function(r){var t=[0,0,0,0,0,0,0,0],e=0,n=null,i=0,o,s,a,u,l,c,h,p=function(){return Ot(r,i)};if(p()===":"){if(Ot(r,1)!==":")return;i+=2,e++,n=e}for(;p();){if(e===8)return;if(p()===":"){if(n!==null)return;i++,e++,n=e;continue}for(o=s=0;s<4&&qt(Vj,p());)o=o*16+ws(p(),16),i++,s++;if(p()==="."){if(s===0||(i-=s,e>6))return;for(a=0;p();){if(u=null,a>0)if(p()==="."&&a<4)i++;else return;if(!qt(ec,p()))return;for(;qt(ec,p());){if(l=ws(p(),10),u===null)u=l;else{if(u===0)return;u=u*10+l}if(u>255)return;i++}t[e]=t[e]*256+u,a++,(a===2||a===4)&&e++}if(a!==4)return;break}else if(p()===":"){if(i++,!p())return}else if(p())return;t[e++]=o}if(n!==null)for(c=e-n,e=7;e!==0&&c>0;)h=t[e],t[e--]=t[n+c-1],t[n+--c]=h;else if(e!==8)return;return t},VC=function(r){for(var t=null,e=1,n=null,i=0,o=0;o<8;o++)r[o]!==0?(i>e&&(t=n,e=i),n=null,i=0):(n===null&&(n=o),++i);return i>e?n:t},xi=function(r){var t,e,n,i;if(typeof r=="number"){for(t=[],e=0;e<4;e++)DC(t,r%256),r=WC(r/256);return Ii(t,".")}if(typeof r=="object"){for(t="",n=VC(r),e=0;e<8;e++)i&&r[e]===0||(i&&(i=!1),n===e?(t+=e?":":"::",i=!0):(t+=xC(r[e],16),e<7&&(t+=":")));return"["+t+"]"}return r},js={},Jj=ic({},js,{" ":1,'"':1,"<":1,">":1,"`":1}),Lj=ic({},Jj,{"#":1,"?":1,"{":1,"}":1}),Nl=ic({},Lj,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),hn=function(r,t){var e=AC(r,0);return e>32&&e<127&&!$l(t,r)?r:encodeURIComponent(r)},ys={ftp:21,file:null,http:80,https:443,ws:80,wss:443},Yi=function(r,t){var e;return r.length===2&&qt(kj,Ot(r,0))&&((e=Ot(r,1))===":"||!t&&e==="|")},Zj=function(r){var t;return r.length>1&&Yi(Ei(r,0,2))&&(r.length===2||(t=Ot(r,2))==="/"||t==="\\"||t==="?"||t==="#")},JC=function(r){return r==="."||Ss(r)==="%2e"},LC=function(r){return r=Ss(r),r===".."||r==="%2e."||r===".%2e"||r==="%2e%2e"},Ul={},Cj={},Gl={},Oj={},Kj={},kl={},Rj={},Fj={},Ms={},Ps={},Vl={},Jl={},Ll={},Bl={},zj={},Ql={},hr={},ye={},Nj={},vn={},Xe={},oc=function(r,t,e){var n=Ze(r),i,o,s;if(t){if(o=this.parse(n),o)throw new tc(o);this.searchParams=null}else{if(e!==void 0&&(i=new oc(e,!0)),o=this.parse(n,null,i),o)throw new tc(o);s=_C(new vC),s.bindURL(this),this.searchParams=s}};oc.prototype={type:"URL",parse:function(r,t,e){var n=this,i=t||Ul,o=0,s="",a=!1,u=!1,l=!1,c,h,p,m;for(r=Ze(r),t||(n.scheme="",n.username="",n.password="",n.host=null,n.port=null,n.path=[],n.query=null,n.fragment=null,n.cannotBeABaseURL=!1,r=Fl(r,zC,""),r=Fl(r,NC,"$1")),r=Fl(r,UC,""),c=cr(r);o<=c.length;){switch(h=c[o],i){case Ul:if(h&&qt(kj,h))s+=Ss(h),i=Cj;else{if(t)return zl;i=Gl;continue}break;case Cj:if(h&&(qt(ZC,h)||h==="+"||h==="-"||h==="."))s+=Ss(h);else if(h===":"){if(t&&(n.isSpecial()!==$l(ys,s)||s==="file"&&(n.includesCredentials()||n.port!==null)||n.scheme==="file"&&!n.host))return;if(n.scheme=s,t){n.isSpecial()&&ys[n.scheme]===n.port&&(n.port=null);return}s="",n.scheme==="file"?i=Bl:n.isSpecial()&&e&&e.scheme===n.scheme?i=Oj:n.isSpecial()?i=Fj:c[o+1]==="/"?(i=Kj,o++):(n.cannotBeABaseURL=!0,pr(n.path,""),i=Nj)}else{if(t)return zl;s="",i=Gl,o=0;continue}break;case Gl:if(!e||e.cannotBeABaseURL&&h!=="#")return zl;if(e.cannotBeABaseURL&&h==="#"){n.scheme=e.scheme,n.path=Ht(e.path),n.query=e.query,n.fragment="",n.cannotBeABaseURL=!0,i=Xe;break}i=e.scheme==="file"?Bl:kl;continue;case Oj:if(h==="/"&&c[o+1]==="/")i=Ms,o++;else{i=kl;continue}break;case Kj:if(h==="/"){i=Ps;break}else{i=ye;continue}case kl:if(n.scheme=e.scheme,h===Zt)n.username=e.username,n.password=e.password,n.host=e.host,n.port=e.port,n.path=Ht(e.path),n.query=e.query;else if(h==="/"||h==="\\"&&n.isSpecial())i=Rj;else if(h==="?")n.username=e.username,n.password=e.password,n.host=e.host,n.port=e.port,n.path=Ht(e.path),n.query="",i=vn;else if(h==="#")n.username=e.username,n.password=e.password,n.host=e.host,n.port=e.port,n.path=Ht(e.path),n.query=e.query,n.fragment="",i=Xe;else{n.username=e.username,n.password=e.password,n.host=e.host,n.port=e.port,n.path=Ht(e.path),n.path.length--,i=ye;continue}break;case Rj:if(n.isSpecial()&&(h==="/"||h==="\\"))i=Ms;else if(h==="/")i=Ps;else{n.username=e.username,n.password=e.password,n.host=e.host,n.port=e.port,i=ye;continue}break;case Fj:if(i=Ms,h!=="/"||Ot(s,o+1)!=="/")continue;o++;break;case Ms:if(h!=="/"&&h!=="\\"){i=Ps;continue}break;case Ps:if(h==="@"){a&&(s="%40"+s),a=!0,p=cr(s);for(var g=0;g<p.length;g++){var M=p[g];if(M===":"&&!l){l=!0;continue}var P=hn(M,Nl);l?n.password+=P:n.username+=P}s=""}else if(h===Zt||h==="/"||h==="?"||h==="#"||h==="\\"&&n.isSpecial()){if(a&&s==="")return XC;o-=cr(s).length+1,s="",i=Vl}else s+=h;break;case Vl:case Jl:if(t&&n.scheme==="file"){i=Ql;continue}else if(h===":"&&!u){if(s==="")return bn;if(m=n.parseHost(s),m)return m;if(s="",i=Ll,t===Jl)return}else if(h===Zt||h==="/"||h==="?"||h==="#"||h==="\\"&&n.isSpecial()){if(n.isSpecial()&&s==="")return bn;if(t&&s===""&&(n.includesCredentials()||n.port!==null))return;if(m=n.parseHost(s),m)return m;if(s="",i=hr,t)return;continue}else h==="["?u=!0:h==="]"&&(u=!1),s+=h;break;case Ll:if(qt(ec,h))s+=h;else if(h===Zt||h==="/"||h==="?"||h==="#"||h==="\\"&&n.isSpecial()||t){if(s!==""){var A=ws(s,10);if(A>65535)return Xj;n.port=n.isSpecial()&&A===ys[n.scheme]?null:A,s=""}if(t)return;i=hr;continue}else return Xj;break;case Bl:if(n.scheme="file",h==="/"||h==="\\")i=zj;else if(e&&e.scheme==="file")switch(h){case Zt:n.host=e.host,n.path=Ht(e.path),n.query=e.query;break;case"?":n.host=e.host,n.path=Ht(e.path),n.query="",i=vn;break;case"#":n.host=e.host,n.path=Ht(e.path),n.query=e.query,n.fragment="",i=Xe;break;default:Zj(Ii(Ht(c,o),""))||(n.host=e.host,n.path=Ht(e.path),n.shortenPath()),i=ye;continue}else{i=ye;continue}break;case zj:if(h==="/"||h==="\\"){i=Ql;break}e&&e.scheme==="file"&&!Zj(Ii(Ht(c,o),""))&&(Yi(e.path[0],!0)?pr(n.path,e.path[0]):n.host=e.host),i=ye;continue;case Ql:if(h===Zt||h==="/"||h==="\\"||h==="?"||h==="#"){if(!t&&Yi(s))i=ye;else if(s===""){if(n.host="",t)return;i=hr}else{if(m=n.parseHost(s),m)return m;if(n.host==="localhost"&&(n.host=""),t)return;s="",i=hr}continue}else s+=h;break;case hr:if(n.isSpecial()){if(i=ye,h!=="/"&&h!=="\\")continue}else if(!t&&h==="?")n.query="",i=vn;else if(!t&&h==="#")n.fragment="",i=Xe;else if(h!==Zt&&(i=ye,h!=="/"))continue;break;case ye:if(h===Zt||h==="/"||h==="\\"&&n.isSpecial()||!t&&(h==="?"||h==="#")){if(LC(s)?(n.shortenPath(),h!=="/"&&!(h==="\\"&&n.isSpecial())&&pr(n.path,"")):JC(s)?h!=="/"&&!(h==="\\"&&n.isSpecial())&&pr(n.path,""):(n.scheme==="file"&&!n.path.length&&Yi(s)&&(n.host&&(n.host=""),s=Ot(s,0)+":"),pr(n.path,s)),s="",n.scheme==="file"&&(h===Zt||h==="?"||h==="#"))for(;n.path.length>1&&n.path[0]==="";)YC(n.path);h==="?"?(n.query="",i=vn):h==="#"&&(n.fragment="",i=Xe)}else s+=hn(h,Lj);break;case Nj:h==="?"?(n.query="",i=vn):h==="#"?(n.fragment="",i=Xe):h!==Zt&&(n.path[0]+=hn(h,js));break;case vn:!t&&h==="#"?(n.fragment="",i=Xe):h!==Zt&&(h==="'"&&n.isSpecial()?n.query+="%27":h==="#"?n.query+="%23":n.query+=hn(h,js));break;case Xe:h!==Zt&&(n.fragment+=hn(h,Jj));break}o++}},parseHost:function(r){var t,e,n;if(Ot(r,0)==="["){if(Ot(r,r.length-1)!=="]"||(t=kC(Ei(r,1,-1)),!t))return bn;this.host=t}else if(this.isSpecial()){if(r=TC(r),qt(RC,r)||(t=GC(r),t===null))return bn;this.host=t}else{if(qt(FC,r))return bn;for(t="",e=cr(r),n=0;n<e.length;n++)t+=hn(e[n],js);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||this.scheme==="file"},includesCredentials:function(){return this.username!==""||this.password!==""},isSpecial:function(){return $l(ys,this.scheme)},shortenPath:function(){var r=this.path,t=r.length;t&&(this.scheme!=="file"||t!==1||!Yi(r[0],!0))&&r.length--},serialize:function(){var r=this,t=r.scheme,e=r.username,n=r.password,i=r.host,o=r.port,s=r.path,a=r.query,u=r.fragment,l=t+":";return i!==null?(l+="//",r.includesCredentials()&&(l+=e+(n?":"+n:"")+"@"),l+=xi(i),o!==null&&(l+=":"+o)):t==="file"&&(l+="//"),l+=r.cannotBeABaseURL?s[0]:s.length?"/"+Ii(s,"/"):"",a!==null&&(l+="?"+a),u!==null&&(l+="#"+u),l},setHref:function(r){var t=this.parse(r);if(t)throw new tc(t);this.searchParams.update()},getOrigin:function(){var r=this.scheme,t=this.port;if(r==="blob")try{return new fr(r.path[0]).origin}catch(e){return"null"}return r==="file"||!this.isSpecial()?"null":r+"://"+xi(this.host)+(t!==null?":"+t:"")},getProtocol:function(){return this.scheme+":"},setProtocol:function(r){this.parse(Ze(r)+":",Ul)},getUsername:function(){return this.username},setUsername:function(r){var t=cr(Ze(r));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var e=0;e<t.length;e++)this.username+=hn(t[e],Nl)}},getPassword:function(){return this.password},setPassword:function(r){var t=cr(Ze(r));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var e=0;e<t.length;e++)this.password+=hn(t[e],Nl)}},getHost:function(){var r=this.host,t=this.port;return r===null?"":t===null?xi(r):xi(r)+":"+t},setHost:function(r){this.cannotBeABaseURL||this.parse(r,Vl)},getHostname:function(){var r=this.host;return r===null?"":xi(r)},setHostname:function(r){this.cannotBeABaseURL||this.parse(r,Jl)},getPort:function(){var r=this.port;return r===null?"":Ze(r)},setPort:function(r){this.cannotHaveUsernamePasswordPort()||(r=Ze(r),r===""?this.port=null:this.parse(r,Ll))},getPathname:function(){var r=this.path;return this.cannotBeABaseURL?r[0]:r.length?"/"+Ii(r,"/"):""},setPathname:function(r){this.cannotBeABaseURL||(this.path=[],this.parse(r,hr))},getSearch:function(){var r=this.query;return r?"?"+r:""},setSearch:function(r){r=Ze(r),r===""?this.query=null:(Ot(r,0)==="?"&&(r=Ei(r,1)),this.query="",this.parse(r,vn)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var r=this.fragment;return r?"#"+r:""},setHash:function(r){if(r=Ze(r),r===""){this.fragment=null;return}Ot(r,0)==="#"&&(r=Ei(r,1)),this.fragment="",this.parse(r,Xe)},update:function(){this.query=this.searchParams.serialize()||null}};var fr=function(t){var e=jC(this,ct),n=SC(arguments.length,1)>1?arguments[1]:void 0,i=bC(e,new oc(t,!1,n));nc||(e.href=i.serialize(),e.origin=i.getOrigin(),e.protocol=i.getProtocol(),e.username=i.getUsername(),e.password=i.getPassword(),e.host=i.getHost(),e.hostname=i.getHostname(),e.port=i.getPort(),e.pathname=i.getPathname(),e.search=i.getSearch(),e.searchParams=i.getSearchParams(),e.hash=i.getHash())},ct=fr.prototype,Ct=function(r,t){return{get:function(){return Ts(this)[r]()},set:t&&function(e){return Ts(this)[t](e)},configurable:!0,enumerable:!0}};nc&&(Xt(ct,"href",Ct("serialize","setHref")),Xt(ct,"origin",Ct("getOrigin")),Xt(ct,"protocol",Ct("getProtocol","setProtocol")),Xt(ct,"username",Ct("getUsername","setUsername")),Xt(ct,"password",Ct("getPassword","setPassword")),Xt(ct,"host",Ct("getHost","setHost")),Xt(ct,"hostname",Ct("getHostname","setHostname")),Xt(ct,"port",Ct("getPort","setPort")),Xt(ct,"pathname",Ct("getPathname","setPathname")),Xt(ct,"search",Ct("getSearch","setSearch")),Xt(ct,"searchParams",Ct("getSearchParams")),Xt(ct,"hash",Ct("getHash","setHash")));As(ct,"toJSON",function(){return Ts(this).serialize()},{enumerable:!0});As(ct,"toString",function(){return Ts(this).serialize()},{enumerable:!0});Wi&&(Hl=Wi.createObjectURL,ql=Wi.revokeObjectURL,Hl&&As(fr,"createObjectURL",Ej(Hl,Wi)),ql&&As(fr,"revokeObjectURL",Ej(ql,Wi)));var Hl,ql;wC(fr,"URL");MC({global:!0,constructor:!0,forced:!PC,sham:!nc},{URL:fr})});var Qj=f(()=>{"use strict";Bj()});var Hj=f(()=>{"use strict";var BC=C(),QC=k();BC({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return QC(URL.prototype.toString,this)}})});var qj=f(()=>{"use strict";Rl()});var nA=f(()=>{"use strict";var HC=Wt(),bs=Y(),$j=jt(),qC=bi(),eA=URLSearchParams,vs=eA.prototype,$C=bs(vs.append),tA=bs(vs.delete),t4=bs(vs.forEach),e4=bs([].push),sc=new eA("a=1&a=2&b=3");sc.delete("a",1);sc.delete("b",void 0);sc+""!="a=2"&&HC(vs,"delete",function(r){var t=arguments.length,e=t<2?void 0:arguments[1];if(t&&e===void 0)return tA(this,r);var n=[];t4(this,function(h,p){e4(n,{key:p,value:h})}),qC(t,1);for(var i=$j(r),o=$j(e),s=0,a=0,u=!1,l=n.length,c;s<l;)c=n[s++],u||c.key===i?(u=!0,tA(this,c.key)):a++;for(;a<l;)c=n[a++],c.key===i&&c.value===o||$C(this,c.key,c.value)},{enumerable:!0,unsafe:!0})});var sA=f(()=>{"use strict";var n4=Wt(),iA=Y(),r4=jt(),i4=bi(),oA=URLSearchParams,ac=oA.prototype,o4=iA(ac.getAll),s4=iA(ac.has),rA=new oA("a=1");(rA.has("a",2)||!rA.has("a",void 0))&&n4(ac,"has",function(t){var e=arguments.length,n=e<2?void 0:arguments[1];if(e&&n===void 0)return s4(this,t);var i=o4(this,t);i4(e,1);for(var o=r4(n),s=0;s<i.length;)if(i[s++]===o)return!0;return!1},{enumerable:!0,unsafe:!0})});var aA=f(()=>{"use strict";var a4=F(),u4=Y(),l4=Ie(),uc=URLSearchParams.prototype,c4=u4(uc.forEach);a4&&!("size"in uc)&&l4(uc,"size",{get:function(){var t=0;return c4(this,function(){t++}),t},configurable:!0,enumerable:!0})});var uA=f(()=>{"use strict";var h4=un();h4("Int8",function(r){return function(e,n,i){return r(this,e,n,i)}})});var lA=f(()=>{"use strict";var p4=un();p4("Uint32",function(r){return function(e,n,i){return r(this,e,n,i)}})});var cA=f(()=>{"use strict";var f4=un();f4("Int16",function(r){return function(e,n,i){return r(this,e,n,i)}})});var hA=f(()=>{"use strict";var d4=un();d4("Int32",function(r){return function(e,n,i){return r(this,e,n,i)}})});var lc=f(()=>{"use strict";var m4=un();m4("Uint16",function(r){return function(e,n,i){return r(this,e,n,i)}})});var Zs=f(()=>{"use strict";var p9=C(),f9=it(),d9=et(),m9=cu(),g9=n0(),y9=so(),M9=[].unshift(0)!==1,P9=function(){try{Object.defineProperty([],"length",{writable:!1}).unshift()}catch(r){return r instanceof TypeError}},j9=M9||!P9();p9({target:"Array",proto:!0,arity:1,forced:j9},{unshift:function(t){var e=f9(this),n=d9(e),i=arguments.length;if(i){y9(n+i);for(var o=n;o--;){var s=o+i;o in e?e[s]=e[o]:g9(e,s)}for(var a=0;a<i;a++)e[a]=arguments[a]}return m9(e,n+i)}})});var t1=f((qQ,$A)=>{"use strict";var vO=E();$A.exports=vO.Promise});var r1=f(($Q,n1)=>{"use strict";var e1=rt(),_O=O0(),WO=Zn(),xO=J(),IO=xO("species");n1.exports=function(r,t){var e=e1(r).constructor,n;return e===void 0||WO(n=e1(e)[IO])?t:_O(n)}});var s1=f((t5,o1)=>{"use strict";var i1=ne(),YO=TypeError,EO=function(r){var t,e;this.promise=new r(function(n,i){if(t!==void 0||e!==void 0)throw new YO("Bad Promise constructor");t=n,e=i}),this.resolve=i1(t),this.reject=i1(e)};o1.exports.f=function(r){return new EO(r)}});var u1=f((e5,a1)=>{"use strict";var DO=rt(),XO=tt(),ZO=s1();a1.exports=function(r,t){if(DO(r),XO(t)&&t.constructor===r)return t;var e=ZO.f(r),n=e.resolve;return n(t),e.promise}});var Ac=f(()=>{"use strict";var CO=C(),OO=Ne(),$s=t1(),KO=X(),c1=Ut(),h1=z(),RO=r1(),l1=u1(),FO=Wt(),jc=$s&&$s.prototype,zO=!!$s&&KO(function(){jc.finally.call({then:function(){}},function(){})});CO({target:"Promise",proto:!0,real:!0,forced:zO},{finally:function(r){var t=RO(this,c1("Promise")),e=h1(r);return this.then(e?function(n){return l1(t,r()).then(function(){return n})}:r,e?function(n){return l1(t,r()).then(function(){throw n})}:r)}});!OO&&h1($s)&&(Pc=c1("Promise").prototype.finally,jc.finally!==Pc&&FO(jc,"finally",Pc,{unsafe:!0}));var Pc});var G1=f(()=>{"use strict";var IR=C(),YR=li().findLastIndex,ER=Kr();IR({target:"Array",proto:!0},{findLastIndex:function(t){return YR(this,t,arguments.length>1?arguments[1]:void 0)}});ER("findLastIndex")});var k1=f(()=>{"use strict";var DR=C(),XR=li().findLast,ZR=Kr();DR({target:"Array",proto:!0},{findLast:function(t){return XR(this,t,arguments.length>1?arguments[1]:void 0)}});ZR("findLast")});function T(){return T=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},T.apply(this,arguments)}var gH=d(Z(),1),yH=d(v(),1),MH=d(Vr(),1);import{EventDispatcher as _K,Vector3 as WK}from"three";var b5=d(v(),1);var cN=d(ie(),1),hN=d(oe(),1),pN=d(se(),1),fN=d(ae(),1),dN=d(ue(),1),mN=d(le(),1),gN=d(ce(),1),yN=d(v(),1),H=class{requestAnimationFrame(t){let e=window.requestAnimationFrame(()=>{this.tasks.requestAnimation.delete(e),t()});return this.tasks.requestAnimation.add(e),e}cancelAnimationFrame(t){this.tasks.requestAnimation.delete(t),window.cancelAnimationFrame(t)}setTimeout(t,e){let n=window.setTimeout(()=>{this.tasks.timeout.delete(n),t()},e);return this.tasks.timeout.add(n),n}clearTimeout(t){this.tasks.timeout.delete(t),window.clearTimeout(t)}setInterval(t,e){let n=window.setInterval(()=>{t()},e);return this.tasks.interval.add(n),n}clearInterval(t){this.tasks.interval.delete(t),window.clearInterval(t)}dispose(){this.tasks.requestAnimation.forEach(t=>{window.cancelAnimationFrame(t)}),this.tasks.requestAnimation.clear(),this.tasks.timeout.forEach(t=>{window.clearTimeout(t)}),this.tasks.timeout.clear(),this.tasks.interval.forEach(t=>{window.clearInterval(t)}),this.tasks.interval.clear()}constructor(){this.tasks={requestAnimation:new Set,timeout:new Set,interval:new Set}}};var PN=d(v(),1),jN=d(Z(),1);import{Shape as sx,Group as ax,DirectionalLight as ux,AmbientLight as lx,Path as cx,Vector2 as om}from"three";function sm(){let r=new ax,t=new lx(16777215,2.6);return r.add(t),r}function he(r,t){t===void 0&&(t=[]);let e=new sx(r.map(n=>new om(...n)));return t.length&&t.forEach(n=>{var i=new cx(n.map(o=>new om(...o)));e.holes.push(i)}),e}function am(r,t){r===void 0&&(r=16777215),t===void 0&&(t=1);let e=new ux(r,t);return e.castShadow=!0,e.shadow.radius=8,e.shadow.bias=-.001,e.shadow.mapSize.set(256,256),e.shadow.camera.left=-200,e.shadow.camera.right=200,e.shadow.camera.top=200,e.shadow.camera.bottom=-200,e}function L(r,t){if(t&&r.children&&r.children.length&&r.children.forEach(e=>{L(e,t)}),r.isMesh){let e=r;e.geometry&&e.geometry.dispose(),e.material&&(Array.isArray(e.material)?e.material.forEach(n=>{n.dispose()}):e.material.dispose())}r.isLight&&(r.dispose==null||r.dispose.call(r))}var YN=d(pe(),1);function Fu(r){return/[\u4E00-\u9FA5]+/g.test(r)}var DN=d(v(),1);import{Vector3 as bo,Vector2 as ve,Matrix3 as So}from"three";import{point as Zx,featureCollection as Cx,center as Ox}from"@turf/turf";function W(r,t,e,n){let i=r.clone().project(t),o=e/2,s=n/2,a=Math.round(i.x*o+o),u=Math.round(-i.y*s+s);return{x:a,y:u}}function CN(r,t,e,n,i){if(!i)return null;e=Math.min(1,e),n=Math.min(1,n);let o=r/e*2-1,s=1-t/n*2;return new bo(o,s,0).unproject(i)}function vo(r){let t=Cx(r.map(n=>Zx(n)));return Ox(t).geometry.coordinates}function Be(r,t,e){return r.x>=t.x&&r.x<=e.x&&r.y>=t.y&&r.y<=e.y}function ON(r){let t=0,e=new bo;for(let n=1;n<r.length;n++){let i=new bo(r[n-1][0],r[n-1][1],0),o=new bo(r[n][0],r[n][1],0),s=o.distanceTo(i);s>t&&(t=s,e=o.clone().sub(i).normalize())}return e}function K(r,t){return Math.sqrt((t[0]-r[0])**2+(t[1]-r[1])**2)}function xt(r){let t=0;for(let e=0;e<r.length-1;e++)t+=K(r[e],r[e+1]);return t}function _o(r,t,e){let n=new ve(t[0]-r[0],t[1]-r[1]),i=new ve(t[0]-e[0],t[1]-e[1]),s=n.angleTo(i)*180/Math.PI,a=new ve(t[0]-r[0],t[1]-r[1]);return new ve(e[0]-r[0],e[1]-r[1]).cross(a)>0?s:-s}function Pm(r,t){let e=Math.min(K(r[0][0],r[0][1]),K(r[0][2],r[0][1]))-1;t||(t=vo(r[0]));let n=Kx(t,e),i=new ve(r[0][0][0],r[0][0][1]),o=new ve(r[0][1][0],r[0][1][1]),s=new ve(r[0][2][0],r[0][2][1]),u=(i.distanceTo(o)>o.distanceTo(s)?o.clone().sub(i):s.clone().sub(o)).angleTo(new ve(0,1)),l=new So;return l.multiply(new So().translate(t[0],t[1])).multiply(new So().rotate(u)).multiply(new So().translate(-t[0],-t[1])),[n.map(c=>{let h=new ve(c[0],c[1]).applyMatrix3(l);return[h.x,h.y]})]}function Kx(r,t){let e=t/2;return[[r[0]-e,r[1]+e],[r[0]+e,r[1]+e],[r[0]+e,r[1]-e],[r[0]-e,r[1]-e],[r[0]-e,r[1]+e]]}function _e(r,t){let e=0,n=1/0,[i,o]=t;for(let s=0;s<r.length-1;s++){let[a,u]=r[s],[l,c]=r[s+1],h=Math.min(a,l)<=i&&i<=Math.max(a,l),p=Math.min(u,c)<=o&&o<=Math.max(u,c);if(h&&p){let m=Math.abs((l-a)*(o-u)-(c-u)*(i-a));m<n&&(n=m,e=s)}}return e}function jm(r,t){let e=r[0],n=r[1],i=!1;for(let o=0,s=t.length-1;o<t.length;s=o++){let a=t[o][0],u=t[o][1],l=t[s][0],c=t[s][1];u>n!=c>n&&e<(l-a)*(n-u)/(c-u)+a&&(i=!i)}return i}var zN=d(Am(),1);function kn(r,t){return new Proxy(r,{get:(e,n,i)=>Reflect.get(e,n,i),set:(e,n,i,o)=>{let s=Reflect.get(e,n,o),a=Reflect.set(e,n,i,o);return s!==i&&t.dispatchEvent({type:"change-"+n,value:i}),a}})}var $N=d(v(),1),tU=d(Uu(),1);function It(r,t){return Promise.race([r,new Promise((e,n)=>{setTimeout(()=>n(new Error("Promise timeout")),t)})])}function Io(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function Qm(r,t){let e=Io("svg");return e.setAttribute("width",r),e.setAttribute("height",t),e.style.cssText="position: absolute; left: 0; top: 0; pointer-events: none;",e}function Jr(r,t){r===void 0&&(r="2");let e=Io("circle");return e.setAttribute("r",r),e.setAttribute("fill",t),e}function Yo(r){let t=Io("line");return t.setAttribute("stroke",r),t}function Qe(r,t){let e=Io("rect");return e.setAttribute("stroke",r),e.setAttribute("fill",t),e}function An(r,t,e){r.setAttribute("cx",""+t),r.setAttribute("cy",""+e)}function Jt(r,t,e){t&&(r.setAttribute("x1",""+t.x),r.setAttribute("y1",""+t.y)),e&&(r.setAttribute("x2",""+e.x),r.setAttribute("y2",""+e.y))}function st(r,t,e,n,i){r.setAttribute("x",""+t),r.setAttribute("y",""+e),r.setAttribute("width",""+n),r.setAttribute("height",""+i)}function Hm(){return Promise.resolve()}function Eo(){return new Promise(r=>{requestAnimationFrame(r)})}function qm(r){return r===void 0&&(r=1),new Promise(t=>{function e(){r<=0?t(!0):(r--,window.requestAnimationFrame(e))}window.requestAnimationFrame(e)})}var gU=d(Lr(),1),yU=d(pe(),1),MU=d(_2(),1);function PU(r){return parseInt(r.replace("#","0x"),16)}function jU(r,t){let e=parseInt(r.substring(1,3),16),n=parseInt(r.substring(3,5),16),i=parseInt(r.substring(5,7),16),o=Math.round(e*t),s=Math.round(n*t),a=Math.round(i*t);return"#"+(1<<24|o<<16|s<<8|a).toString(16).slice(1)}function We(r,t){t===void 0&&(t=.85);let e,n,i;if(r.startsWith("#"))e=parseInt(r.substring(1,3),16),n=parseInt(r.substring(3,5),16),i=parseInt(r.substring(5,7),16);else{let s=r.slice(4,-1).split(",");e=parseInt(s[0].trim()),n=parseInt(s[1].trim()),i=parseInt(s[2].trim())}return e=Math.min(Math.floor(e*t),255),n=Math.min(Math.floor(n*t),255),i=Math.min(Math.floor(i*t),255),"#"+((1<<24)+(e<<16)+(n<<8)+i).toString(16).slice(1)}function t0(r,t){r=r.replace(/^#/,"");let e=parseInt(r.substring(0,2),16),n=parseInt(r.substring(2,4),16),i=parseInt(r.substring(4,6),16);return t!==void 0?"rgba("+e+", "+n+", "+i+", "+t+")":"rgb("+e+", "+n+", "+i+")"}var TU=d(pe(),1),Jn=navigator.userAgent.toUpperCase().indexOf("MAC")>=0,W2=(navigator.userAgent||"").toLocaleLowerCase(),Br=/ios|iphone/i.test(W2),wU=/android|adr|linux/gi.test(W2);function Ln(r){return Jn?r==="Meta":r==="Control"}var _U=d(ie(),1),WU=d(oe(),1),xU=d(se(),1),IU=d(ae(),1),YU=d(ue(),1),EU=d(le(),1),DU=d(ce(),1),XU=d(v(),1),e0="__once__",x2=class{on(t,e){if(typeof e!="function")return;let n=this.events.get(t);return n?n.add(e):this.events.set(t,new Set([e]))}once(t,e){if(typeof e!="function")return;let n=""+e0+t,i=this.events.get(n);return i?i.add(e):this.events.set(n,new Set([e]))}off(t,e){let n=this.events.get(t),i=this.events.get(""+e0+t);!n&&!i||(e===void 0&&(n==null||n.clear(),i==null||i.clear()),n!=null&&n.has(e)&&n.delete(e),i!=null&&i.has(e)&&i.delete(e))}offAll(){this.events.clear()}emit(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i<e;i++)n[i-1]=arguments[i];let o=this.events.get(t),s=this.events.get(""+e0+t);!o&&!s||(o==null||o.forEach(a=>{typeof a=="function"&&a(...n)}),s==null||s.forEach(a=>{typeof a=="function"&&a(...n)}),s==null||s.clear())}constructor(){this.events=new Map}};var at=function(r){return r.SWITCH_FLOOR_BEFORE="switch_floor_before",r.SWITCH_FLOOR_AFTER="switch_floor_after",r}({});var kU=d(Co(),1);function Bn(r){return Object.keys(r).sort().map(t=>t+"="+r[t]).join("&")}function JU(r,t){return new Promise((e,n)=>{let i=new XMLHttpRequest;i.open("GET",r,!0),Object.keys(t.headers||{}).forEach(o=>{i.setRequestHeader(o,t.headers[o])}),t.responseType&&(i.responseType=t.responseType),i.onload=()=>{if(i.status>=200&&i.status<300)if(t.responseType==="arraybuffer")e(i.response);else try{let o=JSON.parse(i.responseText);e(o)}catch(o){n(o)}else n(i.statusText)},i.onerror=()=>{n(i.statusText)},i.send()})}var HU=d(v(),1),qU=d(Z(),1),tg=d($2(),1);import{Vector2 as Qr}from"three";function bY(r,t){let e=r.clone().normalize(),n=t.clone().normalize();return Math.acos(e.dot(n))}function vY(r){let t=0;return r.reduce((e,n)=>{let[i,o]=e,[s,a]=n;return t+=Math.sqrt((s-i)**2+(a-o)**2),[s,a]}),t/r.length}function eg(r,t){if(t===void 0&&(t=.25),vY(r)<t)return r;let e=(0,tg.default)(r);return eg(e,t)}function Oo(r,t,e,n,i,o){t===void 0&&(t=!1),e===void 0&&(e=!0),n===void 0&&(n=5),i===void 0&&(i=150),o===void 0&&(o=3);let s=[],a=!t;if(s.push(r[0]),r.length<2)return s;for(let l=0;l<r.length-2;l+=1){let c=r[l],h=r[l+1],p=r[l+2],m=new Qr(c[0]-h[0],c[1]-h[1]),g=new Qr(p[0]-h[0],p[1]-h[1]),M=bY(m,g)/Math.PI*180,P=m.length()+g.length();(!a||M<i&&P>.01||P>n)&&(s.push(r[l+1]),a=!0)}if(s.push(r[r.length-1]),!e)return s;let u=[];u.push(s[0]);for(let l=0;l<s.length-2;l+=1){let c=new Qr(s[l][0],s[l][1]),h=new Qr(s[l+1][0],s[l+1][1]),p=new Qr(s[l+2][0],s[l+2][1]),m=c.distanceTo(h)/2,g=p.distanceTo(h)/2,M=h.clone(),P=h.clone();M.add(c.clone().sub(h).normalize().multiplyScalar(m>o?o/2:m)),P.add(p.clone().sub(h).normalize().multiplyScalar(g>o?o/2:g));let A=[[M.x,M.y],[h.x,h.y],[P.x,P.y]];u.push(...eg(A,o/25))}return u.push(s[s.length-1]),_Y(u)}function _Y(r){if(r.length<=1)return r;let t=[],e;return r.forEach(n=>{let[i,o]=n;e?i===e[0]&&o===e[1]||(e=[i,o],t.push([i,o])):(e=[i,o],t.push([i,o]))}),t}function ng(r,t,e){let n=Math.sqrt((e[0]-t[0])**2+(e[1]-t[1])**2);if(n===0)return{distance:Math.sqrt((r[0]-t[0])**2+(r[1]-t[1])**2),closestPoint:t.slice(0)};let i=Math.max(0,Math.min(1,((r[0]-t[0])*(e[0]-t[0])+(r[1]-t[1])*(e[1]-t[1]))/n**2)),o=[t[0]+i*(e[0]-t[0]),t[1]+i*(e[1]-t[1])];return{distance:Math.sqrt((r[0]-o[0])**2+(r[1]-o[1])**2),closestPoint:o}}function eG(r,t,e){let[n,i]=r,[o,s]=t,a=Math.sqrt(Math.pow(o-n,2)+Math.pow(s-i,2));if(a===0||a<e)return[...t];let u=e/a,l=n+(o-n)*u,c=i+(s-i)*u;return[l,c]}var xe=function(r){return r.START="start",r.END="end",r.FRONT="front",r.RIGHT="right",r.LEFT="left",r.RIGHT_FRONT="right_front",r.LEFT_FRONT="left_front",r.RIGHT_BACK="right_back",r.LEFT_BACK="left_back",r}({});function u0(r,t,e){let n=_o(r,t,e);return 180-Math.abs(n)<15?"front":n>135?"right_front":n<-135?"left_front":n<=135&&n>=60?"right":n>=-135&&n<=-60?"left":n<60&&n>0?"right_back":n>-60&&n<0?"left_back":"front"}function nG(r){if(!r.length)return[];if(r.length===1)return[{direction:"start",distance:0,points:r}];let t=[{direction:"start",distance:K(r[0],r[1]),points:[r[0],r[1]]}];for(let e=2;e<r.length;e++){let n=u0(r[e-2],r[e-1],r[e]);if(n==="front"){let i=t[t.length-1],o=K(r[e-1],r[e]);i.distance+=o,e!==2&&i.points.push(r[e-1])}else t.push({direction:n,distance:K(r[e-1],r[e]),points:[r[e-1],r[e]]})}return t.push({direction:"end",distance:0,points:[r[r.length-1]]}),t}function rg(r,t){if(r.length<2)return-1;let e=0;for(let n=1;n<r.length;n++){let i=r[n-1],o=r[n],s=[t[0]-i[0],t[1]-i[1]],a=[o[0]-i[0],o[1]-i[1]],u=Math.min(o[0],i[0])<=t[0]&&t[0]<=Math.max(o[0],i[0]),l=Math.min(o[1],i[1])<=t[1]&&t[1]<=Math.max(o[1],i[1]);if(u&&l){let c=s[0]*a[1]-s[1]*a[0];if(Math.abs(c)<1e-6){let h=Math.sqrt((t[0]-i[0])**2+(t[1]-i[1])**2);return e+h}}e+=Math.sqrt((o[0]-i[0])**2+(o[1]-i[1])**2)}return-1}function Qn(r,t){if(r.length<2){var e;return(e=r[0])!=null?e:null}let n=0;for(let i=1;i<r.length;i++){let o=r[i-1],s=r[i],a=Math.sqrt((s[0]-o[0])**2+(s[1]-o[1])**2);if(n+=a,n>=t){let u=(t-(n-a))/a,l=o[0]+(s[0]-o[0])*u,c=o[1]+(s[1]-o[1])*u;return[l,c]}}return null}var cG=d(Z(),1),hG=d(v(),1),pG=d(pe(),1),de=d(h0(),1);var Yt="___",Mg=class{initRoute(t){this.clear(),this.roadInfo=t,t.length&&(t.forEach(e=>{e.points.forEach(n=>{let i=""+e.floor+Yt+n.id;if(this.pointMap.set(i,n),this.nodeMap.set(""+n.floor+Yt+n.nodeId,i),n.type==="straightLadder"){let o=this.straightLadderMap.get(n.name)||[];o.push(T({},n)),this.straightLadderMap.set(n.name,o)}if(n.type==="staircase"){let o=this.staircaseMap.get(n.name)||[];o.push(T({},n)),this.staircaseMap.set(n.name,o)}if(n.type==="escalator"){let o=this.escalatorMap.get(n.name)||{};n.escalatorDirection==="exit"?o.end={floor:n.floor,id:n.id}:o.start={floor:n.floor,id:n.id},this.escalatorMap.set(n.name,o)}if(n.type==="facility"){let o=this.facilityMap.get(n.targetId)||[];o.push(T({},n)),this.facilityMap.set(n.targetId,o)}}),e.lines.filter(n=>n.direction!=="no").forEach(n=>{var i,o;let s=""+e.floor+Yt+n.from,a=""+e.floor+Yt+n.to,u=(i=this.pointMap.get(s))==null?void 0:i.cds,l=(o=this.pointMap.get(a))==null?void 0:o.cds;if(u!=null&&u.length&&(l!=null&&l.length)){let c=K(u,l);this.addLineItem(s,a,c),n.direction==="double"&&this.addLineItem(a,s,c)}})}),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute())}addLineItem(t,e,n,i){i===void 0&&(i=this.lineMap);let o=i.get(t)||new Map;o.set(e,n),i.set(t,o)}addFacilityToLineMap(t,e,n,i){[...this.straightLadderMap,...this.staircaseMap].forEach(o=>{let[s,a]=o;if(!(a.length<2))for(let c=0;c<a.length;c++){let h=""+a[c].floor+Yt+a[c].id;for(let p=0;p<a.length;p++)if(c!==p){var u,l;let m=""+a[p].floor+Yt+a[p].id,g=(u=this.pointMap.get(h))==null?void 0:u.cds,M=(l=this.pointMap.get(m))==null?void 0:l.cds;if(g!=null&&g.length&&(M!=null&&M.length))if(a[c].type==="straightLadder"){let P=e;this.addLineItem(h,m,P,i)}else{let P=n;this.addLineItem(h,m,P,i)}}}}),this.escalatorMap.forEach((o,s)=>{if(o.start&&o.end){var a,u;let l=""+o.start.floor+Yt+o.start.id,c=""+o.end.floor+Yt+o.end.id,h=(a=this.pointMap.get(l))==null?void 0:a.cds,p=(u=this.pointMap.get(c))==null?void 0:u.cds;if(h!=null&&h.length&&(p!=null&&p.length)){let m=t;this.addLineItem(l,c,m,i)}}})}initBaseRoute(){let t=new Map([...this.lineMap]);this.addFacilityToLineMap(1,this.lift_priority,3e4,t),this.baseRoute=new de.default(t)}initEscalatorRoute(){let t=new Map([...this.lineMap]),e=1e4;this.addFacilityToLineMap(1*e,this.lift_priority*e,3e4*e,t),this.escalatorRoute=new de.default(t)}initStraightLadderRoute(){let t=new Map([...this.lineMap]),e=1e4;this.addFacilityToLineMap(3*e,1*e,3e4*e,t),this.straightLadderRoute=new de.default(t)}checkStart(t){return!(!t.floor||!t.nodeId&&(!t.coord||t.coord.length<2))}checkEnd(t){return t.facility?!0:this.checkStart(t)}transformStart(t){var e;if(t.nodeId){let n=this.nodeMap.get(""+t.floor+Yt+t.nodeId);if(n){let[i,o]=n.split(Yt);return{floor:i,id:o}}}if((e=t.coord)!=null&&e.length){let n=this.roadInfo.find(o=>o.floor===t.floor);if(!n)return null;let i=n.points.reduce((o,s)=>{let a=K(t.coord,s.cds);return a<o.min&&(o.min=a,o.point=s),o},{min:1/0,point:n.points[0]});return{floor:i.point.floor,id:i.point.id}}return null}transformEnd(t){if(t.floor){let e=this.transformStart(t);if(e)return e}if(t.facility){let e=this.facilityMap.get(t.facility);if(e!=null&&e.length)return{floor:t.floor,facility:t.facility}}return null}getPath(t,e,n){if(n===void 0&&(n=""),!this.checkStart(t))return"start-error";if(!this.checkEnd(e))return"end-error";let i=this.transformStart(t);if(!i)return"no-start";let o=this.transformEnd(e);if(!o)return"no-end";let s=this.getBasePath.bind(this);switch(n){case"escalator":s=this.getEscalatorPath.bind(this);break;case"straightLadder":s=this.getStraightLadderPath.bind(this);break;default:s=this.getBasePath.bind(this);break}if(o.id)return s(i,o);if(o.facility){let a=this.facilityMap.get(o.facility).filter(l=>o.floor?l.floor===o.floor:!0);if(!a.length)return null;let u=a.map(l=>s(i,{floor:l.floor,id:l.id})).filter(l=>!!l);return u.reduce((l,c)=>{let h=c.reduce((p,m)=>p+xt(m.points),0);return h<l.distance&&(l.distance=h,l.path=c),l},{distance:1/0,path:u[0]}).path}}getRoutePath(t,e,n){let i=""+t.floor+Yt+t.id,o=""+e.floor+Yt+e.id,s=n.path(i,o);if(!s)return null;let a=[];return s.map(u=>{let l=this.pointMap.get(u);if(l){var c;let{floor:h}=l;if(((c=a[a.length-1])==null?void 0:c.floor)===h){let p=a[a.length-1];p.points.push(l.cds),p.endType=l.type,p.destId=l.nodeId,p.distance=xt(p.points)}else a.push({floor:h,points:[l.cds],endType:l.type,destId:l.nodeId,distance:0})}}),a}getBasePath(t,e){return this.getRoutePath(t,e,this.baseRoute)}getEscalatorPath(t,e){return this.getRoutePath(t,e,this.escalatorRoute)}getStraightLadderPath(t,e){return this.getRoutePath(t,e,this.straightLadderRoute)}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new de.default,this.escalatorRoute=new de.default,this.straightLadderRoute=new de.default}constructor(t=3){this.lift_priority=t,this.roadInfo=[],this.pointMap=new Map,this.nodeMap=new Map,this.facilityMap=new Map,this.straightLadderMap=new Map,this.escalatorMap=new Map,this.staircaseMap=new Map,this.lineMap=new Map,this.baseRoute=new de.default,this.escalatorRoute=new de.default,this.straightLadderRoute=new de.default}};var vG=d(v(),1),_G=d(pe(),1),WG=d(Z(),1),xG=d(ie(),1),IG=d(oe(),1),YG=d(se(),1),EG=d(ae(),1),DG=d(ue(),1),XG=d(le(),1),ZG=d(ce(),1),CG=d(d0(),1),OG=d(m0(),1),nt=d(h0(),1);import{cloneDeep as $e,isNil as Zg}from"lodash";import{Vector2 as g0}from"three";var D="___",Cg=class{isFacilityByType(t){return["facility","escalator","straightLadder","staircase","ramp","connectionPoint"].includes(t)}initFacilities(t){this.facilities=t.map(e=>{let n=[];try{n=JSON.parse(e.entry_end_floor)}catch(o){n=[]}let i=[];try{i=JSON.parse(e.entry_start_floor)}catch(o){i=[]}return T({},e,{entry_start_floor:i,entry_end_floor:n})})}getParkingSpaceInfo(t,e){let n=""+t+D+e;var i;return(i=this.parkingMap.get(n))!=null?i:null}getNodeInfo(t,e){let n=""+t+D+e,i=this.nodeMap.get(n);if(!i)return null;let o=this.pointMap.get(i);return o!=null?o:null}initRoute(t,e){this.clear(),this.roadInfo=t,this.initFacilities(e);let n=new Date,i=n.getHours()*60+n.getMinutes();t.length&&(t.forEach(o=>{(o.points||[]).filter(s=>s.openStatus!==!1).filter(s=>{if(!s.startTime||!s.endTime)return!0;let[a,u]=s.startTime.split(":").map(m=>+m),[l,c]=s.endTime.split(":").map(m=>+m),h=a*60+u,p=l*60+c;return i>=h&&i<=p}).forEach(s=>{s.floor=o.floor;let a=""+o.floor+D+s.id;if(this.nodeMap.set(""+o.floor+D+s.nodeId,""+o.floor+D+(s.relatedId||s.id)),this.pointMap.set(a,s),this.isFacilityByType(s.type)){let u=this.facilities.find(l=>l.id===+s.targetId);if(u){switch(u.entry_infra_type){case"straightLadder":if(u.entry_end_floor.find(p=>p.floor===o.floor)&&u.entry_start_floor.find(p=>p.floor===o.floor)){let p=this.straightLadderMap.get(s.targetId)||[];p.push(T({},s)),this.straightLadderMap.set(s.targetId,p)}break;case"staircase":if(u.entry_end_floor.find(p=>p.floor===o.floor)&&u.entry_start_floor.find(p=>p.floor===o.floor)){let p=this.staircaseMap.get(s.targetId)||[];p.push(T({},s)),this.staircaseMap.set(s.targetId,p)}break;case"escalator":let c=this.escalatorMap.get(s.targetId)||[];if(u.entry_start_floor.find(p=>p.floor===o.floor)){let p=c.find(m=>{var g;return((g=m.end)==null?void 0:g.floor)!==o.floor&&!m.start});p?p.start=s:c.push({start:s})}if(u.entry_end_floor.find(p=>p.floor===o.floor)){let p=c.find(m=>{var g;return((g=m.start)==null?void 0:g.floor)!==o.floor&&!m.end});p?p.end=s:c.push({end:s})}this.escalatorMap.set(s.targetId,c);break;case"ramp":let h=this.rampMap.get(s.targetId)||[];if(u.entry_start_floor.find(p=>p.floor===o.floor)){let p=h.find(m=>{var g;return((g=m.end)==null?void 0:g.floor)!==o.floor&&!m.start});p?p.start=s:h.push({start:s})}if(u.entry_end_floor.find(p=>p.floor===o.floor)){let p=h.find(m=>{var g;return((g=m.start)==null?void 0:g.floor)!==o.floor&&!m.end});p?p.end=s:h.push({end:s})}this.rampMap.set(s.targetId,h);break;case"connectionPoint":if(u.entry_end_floor.find(p=>p.floor===o.floor)&&u.entry_start_floor.find(p=>p.floor===o.floor)){let p=this.connectionPointMap.get(s.targetId)||[];p.push(T({},s)),this.connectionPointMap.set(s.targetId,p)}break}let l=this.facilityMap.get(s.targetId)||[];l.push(T({},s)),this.facilityMap.set(s.targetId,l)}}s.type==="parkingSpace"&&this.parkingMap.set(""+o.floor+D+s.name,s)}),(o.lines||[]).filter(s=>s.to!==s.from).forEach(s=>{let a=""+o.floor+D+s.from,u=""+o.floor+D+s.to,l=this.pointMap.get(a),c=this.pointMap.get(u);if(!l||!c)return;let h=l.cds,p=c.cds,m=K(h,p);if(!l.permission&&!c.permission){switch(this.addLineItem(a,u,m),this.addLineItem(u,a,m),s.direction){case"double":this.addLineItem(a,u,m,this.forwardLineMap),this.addLineItem(u,a,m,this.forwardLineMap);break;case"single":this.addLineItem(a,u,m,this.forwardLineMap);break;case"back":this.addLineItem(u,a,m,this.forwardLineMap);break}(l.type==="parkingSpace"||c.type==="parkingSpace")&&s.direction==="noDir"&&(this.addLineItem(a,u,m,this.forwardLineMap),this.addLineItem(u,a,m,this.forwardLineMap))}else l.permission&&(this.setPermissionLine(a,u,l.permission,m,""),this.setPermissionLine(u,a,l.permission,m,"")),c.permission&&c.permission!==l.permission&&(this.setPermissionLine(a,u,c.permission,m,""),this.setPermissionLine(u,a,c.permission,m,""))})}),this.addPermissionFacility(),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute(),this.initForwardRoute())}getPermissionMap(t){return this["permission_"+t]||(this["permission_"+t]=new Set),this["permission_"+t]}setPermissionLine(t,e,n,i,o){this.getPermissionMap(n).add({fromKey:t,toKey:e,distance:i,type:o})}addPermissionFacility(){this.straightLadderMap.forEach((t,e)=>{if(t.length<2){this.straightLadderMap.delete(e);return}for(let n=0;n<t.length;n++){let i=""+t[n].floor+D+t[n].id,o=this.pointMap.get(i);if(o){for(let s=0;s<t.length;s++)if(n!==s){let a=""+t[s].floor+D+t[s].id,u=this.pointMap.get(a);if(!u)continue;o.permission&&this.setPermissionLine(i,a,o.permission,1,"straightLadder"),u.permission&&u.permission!==o.permission&&this.setPermissionLine(i,a,u.permission,1,"straightLadder")}}}}),this.staircaseMap.forEach((t,e)=>{if(t.length<2){this.staircaseMap.delete(e);return}for(let n=0;n<t.length;n++){let i=""+t[n].floor+D+t[n].id,o=this.pointMap.get(i);if(o){for(let s=0;s<t.length;s++)if(n!==s){let a=""+t[s].floor+D+t[s].id,u=this.pointMap.get(a);if(!u)continue;o.permission&&this.setPermissionLine(i,a,o.permission,1,"staircase"),u.permission&&u.permission!==o.permission&&this.setPermissionLine(i,a,u.permission,1,"staircase")}}}}),this.escalatorMap.forEach((t,e)=>{t.forEach(n=>{if(n.start&&n.end){let i=""+n.start.floor+D+n.start.id,o=""+n.end.floor+D+n.end.id,s=this.pointMap.get(i),a=this.pointMap.get(o);s&&a&&(s.permission&&this.setPermissionLine(i,o,s.permission,1,"escalator"),a.permission&&a.permission!==s.permission&&this.setPermissionLine(i,o,a.permission,1,"escalator"))}})}),this.rampMap.forEach((t,e)=>{t.forEach(n=>{if(n.start&&n.end){let i=""+n.start.floor+D+n.start.id,o=""+n.end.floor+D+n.end.id,s=this.pointMap.get(i),a=this.pointMap.get(o);s&&a&&(s.permission&&this.setPermissionLine(i,o,s.permission,10,"ramp"),a.permission&&a.permission!==s.permission&&this.setPermissionLine(i,o,a.permission,10,"ramp"))}})}),this.connectionPointMap.forEach((t,e)=>{if(t.length<2){this.connectionPointMap.delete(e);return}for(let n=0;n<t.length;n++){let i=""+t[n].floor+D+t[n].id,o=this.pointMap.get(i);if(o){for(let s=0;s<t.length;s++)if(n!==s){let a=""+t[s].floor+D+t[s].id,u=this.pointMap.get(a);if(!u)continue;o.permission&&this.setPermissionLine(i,a,o.permission,1,"connectionPoint"),u.permission&&u.permission!==o.permission&&this.setPermissionLine(i,a,u.permission,1,"connectionPoint")}}}})}addPermissionLineToMap(t,e,n,i){let o=this.getPermissionMap(t);console.log(o),o.forEach(s=>{e.includes(s.type)&&(s.type===""?this.addLineItem(s.fromKey,s.toKey,s.distance,n):this.addLineItem(s.fromKey,s.toKey,i.get(s.type),n))})}addLineItem(t,e,n,i){i===void 0&&(i=this.lineMap);let o=i.get(t)||new Map;o.set(e,n),i.set(t,o)}addFacilityToLineMap(t,e,n,i){[...this.straightLadderMap,...this.staircaseMap].forEach(o=>{let[s,a]=o;if(!(a.length<2))for(let u=0;u<a.length;u++){let l=""+a[u].floor+D+a[u].id,c=this.pointMap.get(l);if(!(!c||c.permission)){for(let h=0;h<a.length;h++)if(u!==h){let p=""+a[h].floor+D+a[h].id,m=this.pointMap.get(p);if(!m||m.permission)continue;if(a[u].type==="straightLadder"){let g=e;this.addLineItem(l,p,g,i)}else{let g=n;this.addLineItem(l,p,g,i)}}}}}),this.escalatorMap.forEach((o,s)=>{o.forEach(a=>{if(a.start&&a.end){let u=""+a.start.floor+D+a.start.id,l=""+a.end.floor+D+a.end.id,c=this.pointMap.get(u),h=this.pointMap.get(l);if(c&&h&&!c.permission&&!h.permission){let p=t;this.addLineItem(u,l,p,i)}}})}),this.connectionPointMap.forEach((o,s)=>{if(!(o.length<2))for(let a=0;a<o.length;a++){let u=""+o[a].floor+D+o[a].id,l=this.pointMap.get(u);if(!(!l||l.permission)){for(let c=0;c<o.length;c++)if(a!==c){let h=""+o[c].floor+D+o[c].id,p=this.pointMap.get(h);if(!p||p.permission)continue;this.addLineItem(u,h,100,i)}}}})}initBaseRoute(){let t=new Map($e([...this.lineMap]));this.addFacilityToLineMap(100,100+this.lift_priority,3e4,t),this.baseRoute=new nt.default(t)}initEscalatorRoute(){let t=new Map($e([...this.lineMap])),e=1e4;this.addFacilityToLineMap(1*e,this.lift_priority*e,3e4*e,t),this.escalatorRoute=new nt.default(t)}initStraightLadderRoute(){let t=new Map($e([...this.lineMap])),e=1e4;this.addFacilityToLineMap(3*e,1*e,3e4*e,t),this.straightLadderRoute=new nt.default(t)}initForwardRoute(){this.rampMap.forEach((t,e)=>{t.forEach(n=>{if(n.start&&n.end){let i=""+n.start.floor+D+n.start.id,o=""+n.end.floor+D+n.end.id,s=this.pointMap.get(i),a=this.pointMap.get(o);s&&a&&!s.permission&&!a.permission&&this.addLineItem(i,o,10,this.forwardLineMap)}})}),this.connectionPointMap.forEach((t,e)=>{if(!(t.length<2))for(let n=0;n<t.length;n++){let i=""+t[n].floor+D+t[n].id,o=this.pointMap.get(i);if(!(!o||o.permission)){for(let s=0;s<t.length;s++)if(n!==s){let a=""+t[s].floor+D+t[s].id,u=this.pointMap.get(a);if(!u||u.permission)continue;this.addLineItem(i,a,100,this.forwardLineMap)}}}}),this.forwardRoute=new nt.default(this.forwardLineMap)}checkStart(t){return!(!t.floor||!t.nodeId&&(!t.coord||t.coord.length<2))}checkEnd(t){return t.facility||t.parkingSpace&&t.floor?!0:this.checkStart(t)}transformStart(t,e){var n;if(t.nodeId){let i=this.nodeMap.get(""+t.floor+D+t.nodeId);if(i){let[o,s]=i.split(D);return{floor:o,id:s}}}if((n=t.coord)!=null&&n.length){let i=this.roadInfo.find(s=>s.floor===t.floor);if(!i)return null;let o=i.points.reduce((s,a)=>{if(a.relatedId)return s;let u=""+a.floor+D+a.id;if(e==="forward"){if(!this.forwardLineMap.has(u))return s}else if(!this.lineMap.has(u))return s;let l=K(t.coord,a.cds);return l<s.min&&(s.min=l,s.point=a),s},{min:1/0,point:i.points[0]});return{floor:i.floor,id:o.point.id}}return null}transformEnd(t,e){if(t.floor){if(t.parkingSpace){let i=this.parkingMap.get(""+t.floor+D+t.parkingSpace);if(i)return{floor:t.floor,id:i.id}}let n=this.transformStart(t,e);if(n)return n}if(t.facility){let i=this.facilities.filter(o=>+o.type_id==+t.facility).map(o=>o.id).map(o=>this.facilityMap.get(""+o)).flat(2);if(i!=null&&i.length)return{floor:t.floor,facility:t.facility}}return null}getPath(t,e,n,i,o){if(n===void 0&&(n=""),!this.checkStart(t))return"start-error";if(!this.checkEnd(e))return"end-error";let s=this.transformStart(t,n);if(!s)return"no-start";let a=this.transformEnd(e,n);if(!a)return"no-end";let u;switch(n){case"escalator":u=this.getEscalatorPath.bind(this);break;case"straightLadder":u=this.getStraightLadderPath.bind(this);break;case"forward":u=this.getForwardPath.bind(this);break;default:u=this.getBasePath.bind(this);break}if(a.id)return u(s,a,i,o);if(a.facility){let c=this.facilities.filter(p=>+p.type_id==+e.facility).map(p=>p.id).map(p=>this.facilityMap.get(""+p)).flat(2).filter(p=>p).filter(p=>a.floor?p.floor===a.floor:!0);if(!c.length)return null;let h=c.map(p=>u(s,{floor:p.floor,id:p.id},i,o)).filter(p=>!!p);return h.reduce((p,m)=>{let g=m[0].consume;return g<p.distance&&(p.distance=g,p.path=m),p},{distance:1/0,path:h[0]}).path}}getRoutePath(t,e,n){let i=""+t.floor+D+t.id,o=""+e.floor+D+e.id,s=n.path(i,o);if(!s)return null;let a=[],u=s.reduce((l,c,h,p)=>{if(h===0)return 0;let m=p[h-1],g=n.graph.get(m).get(c);return l+g},0);return s.map(l=>{let c=this.pointMap.get(l);if(c){var h;let{floor:p}=c,m=c.type;if(this.isFacilityByType(c.type)){let g=this.facilities.find(M=>M.id===+c.targetId);g&&(m=g.entry_infra_type)}if(((h=a[a.length-1])==null?void 0:h.floor)===p){let g=a[a.length-1];g.points.push(c.cds),g.pointInfos.push(c),g.endType=m,g.destId=c.nodeId,g.distance=xt(g.points)}else a.push({floor:p,points:[c.cds],pointInfos:[c],endType:m,destId:c.nodeId,distance:0,consume:u})}}),a}getBasePath(t,e,n){if(!n)return this.getRoutePath(t,e,this.baseRoute);let i=$e(this.baseRoute.graph);this.addPermissionLineToMap(n,["","escalator","staircase","straightLadder","connectionPoint"],i,new Map([["escalator",100],["connectionPoint",100],["straightLadder",100+this.lift_priority],["staircase",3e4]]));let o=new nt.default(i);return this.getRoutePath(t,e,o)}getEscalatorPath(t,e,n){if(!n)return this.getRoutePath(t,e,this.escalatorRoute);let i=$e(this.escalatorRoute.graph),o=1e4;this.addPermissionLineToMap(n,["","escalator","staircase","straightLadder","connectionPoint"],i,new Map([["escalator",1*o],["connectionPoint",100],["straightLadder",this.lift_priority*o],["staircase",3e4*o]]));let s=new nt.default(i);return this.getRoutePath(t,e,s)}getStraightLadderPath(t,e,n){if(!n)return this.getRoutePath(t,e,this.straightLadderRoute);let i=$e(this.straightLadderRoute.graph),o=1e4;this.addPermissionLineToMap(n,["","escalator","staircase","straightLadder","connectionPoint"],i,new Map([["escalator",3*o],["connectionPoint",100],["straightLadder",1*o],["staircase",3e4*o]]));let s=new nt.default(i);return this.getRoutePath(t,e,s)}getForwardPath(t,e,n,i){let o=new Map,s=p=>{let m=this.forwardRoute.graph.get(u);p.forEach(g=>{let M=m.get(g);Zg(M)||(o.set(g,M),m.delete(g))})},a=()=>{let p=this.forwardRoute.graph.get(u);o.forEach((m,g)=>{p.set(g,m)})},u=""+t.floor+D+t.id;if(!Zg(i)){let p=this.forwardLineMap.get(u),m=this.pointMap.get(u);if(m&&(p!=null&&p.size)&&p.size>1){let g=new g0(m.cds[0],m.cds[1]),M=new Map;p.forEach((A,S)=>{let _=this.pointMap.get(S);if(_){let I=new g0(_.cds[0],_.cds[1]),O=360-(new g0().subVectors(I,g).angle()/Math.PI*180-90+360)%360;M.set(S,O)}});let P=Array.from(M).filter(A=>{let[S,_]=A;return Math.abs(_-i)<=60}).map(A=>{let[S]=A;return S});if(P.length)P.forEach(A=>M.delete(A)),s([...M.keys()]);else{let A=Array.from(M).reduce((S,_)=>{let I=Math.abs(_[1]-i);return I<S.diff?{diff:I,key:_[0]}:S},{diff:1/0,key:""});M.delete(A.key),s([...M.keys()])}}}if(!n){let p=this.getRoutePath(t,e,this.forwardRoute);return a(),p||this.getRoutePath(t,e,this.forwardRoute)}let l=$e(this.forwardRoute.graph);this.addPermissionLineToMap(n,["","ramp"],l,new Map([["ramp",10]]));let c=new nt.default(l),h=this.getRoutePath(t,e,c);if(a(),h)return h;{let p=$e(this.forwardRoute.graph);this.addPermissionLineToMap(n,["","ramp"],p,new Map([["ramp",10]]));let m=new nt.default(p);return this.getRoutePath(t,e,m)}}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new nt.default,this.escalatorRoute=new nt.default,this.straightLadderRoute=new nt.default}constructor(t=3){this.lift_priority=t,this.roadInfo=[],this.facilities=[],this.pointMap=new Map,this.nodeMap=new Map,this.facilityMap=new Map,this.straightLadderMap=new Map,this.escalatorMap=new Map,this.rampMap=new Map,this.staircaseMap=new Map,this.connectionPointMap=new Map,this.parkingMap=new Map,this.lineMap=new Map,this.baseRoute=new nt.default,this.escalatorRoute=new nt.default,this.straightLadderRoute=new nt.default,this.forwardLineMap=new Map,this.forwardRoute=new nt.default}};var NG=d(ie(),1),UG=d(oe(),1),GG=d(se(),1),kG=d(ae(),1),VG=d(ue(),1),JG=d(le(),1),LG=d(ce(),1),BG=d(v(),1),tn=class{static createKey(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}static genUniqueKey(){let t=this.createKey();for(;this.keySet.has(t);)t=this.createKey();return t}static removeKey(t){this.keySet.delete(t)}static dispose(){this.keySet.clear()}};tn.keySet=new Set;var HG=d(Lr(),1),qG=d(pe(),1);function Og(r){return r.replace(/[A-Z]/g,t=>"_"+t.toLowerCase()).replace(/^_/,"")}function At(r,t,e){return new Promise((n,i)=>{let o=tn.genUniqueKey(),s=a=>{let{data:u}=a;u.type===""+t+"_result"&&u.key===o&&(tn.removeKey(o),self.removeEventListener("message",s),u.error?i(u.error):n(u.data))};r.addEventListener("message",s),r.postMessage({type:t,key:o,data:e})})}function nk(r){let t={};for(let n in r)n.startsWith("on")&&(t[Og(n.slice(2))]=r[n]);let e=n=>j(this,null,function*(){let{data:i}=n;if(t[i.type])try{let o=yield t[i.type](i.data);self.postMessage({type:""+i.type+"_result",key:i.key,data:o})}catch(o){self.postMessage({type:""+i.type+"_result",key:i.key,error:o})}else self.postMessage({type:""+i.type+"_result",key:i.key,error:"no_event"})});return self.addEventListener("message",e),()=>{self.removeEventListener("message",e)}}import{BoxGeometry as oE,BufferGeometry as sE,Line as aE,LineBasicMaterial as Kg,Mesh as uE}from"three";function sk(r,t){t===void 0&&(t=16711680);let e=new Kg({color:t}),n=new sE().setFromPoints(r);return new aE(n,e)}function ak(r,t){t===void 0&&(t=16711680);let e=new Kg({color:t}),n=new oE(1,1,1),i=new uE(n,e);return i.position.copy(r),i}var lk=d(Vr(),1),ck=d(v(),1);function pt(r,t,e){e===void 0&&(e=0),r.forEach(n=>{if(n.geometry.coords=JSON.parse(JSON.stringify(n.geometry.cds)),n.geometry.type==="polygon"){var i;n.geometry.coords.map(o=>{Array.isArray(o)&&o.forEach(s=>{s[0]-=t[0],s[1]-=t[1]})}),n.geometry.otherCds&&(n.geometry.otherCoords=n.geometry.otherCds.map(o=>o.map(s=>Hn(s,t)))),(i=n.doors)!=null&&i.length&&n.doors.map(o=>{o.coord=Hn(o.coordinate,t)}),n.center&&(n.centerCoords=Hn(n.center,t))}else n.geometry.coords=Hn(n.geometry.cds,t),n.center&&(n.centerCoords=Hn(n.center,t));if(n.center_x&&n.center_y){let[o,s]=Hn([n.center_x,n.center_y],t);n.center_coord_x=o,n.center_coord_y=s}});for(let n=0;n<r.length;n++){let i=r[n];i.deltaHeight=1e-5*(e+n+1)}}function Hn(r,t){return[r[0]-t[0],r[1]-t[1]]}var pk=d(ie(),1),fk=d(oe(),1),dk=d(se(),1),mk=d(ae(),1),gk=d(ue(),1),yk=d(le(),1),Mk=d(ce(),1),Pk=d(v(),1);import{Group as lE}from"@tweenjs/tween.js";var en=class{update(){this.group.update()}pause(){this.pauseTween=!0,this.getAll().forEach(t=>{this.tweenStore.add(t),t.pause()})}continue(){this.pauseTween&&(this.tweenStore.forEach(t=>{t.resume()}),this.tweenStore.clear(),this.pauseTween=!1)}remove(t){this.group.remove(t)}getAll(){return this.group.getAll()}clear(){this.getAll().forEach(t=>t.stop()),this.group.removeAll()}dispose(){this.clear()}constructor(){this.pauseTween=!1,this.tweenStore=new Set,this.group=new lE}};import{EventDispatcher as cE}from"three";var Ro=class extends cE{registryEvent(){this.ctn.addEventListener("pointerdown",this._pointerDown),this.ctn.addEventListener("pointerup",this._pointerUp)}unRegistryEvent(){this.ctn.removeEventListener("pointerdown",this._pointerDown),this.ctn.removeEventListener("pointerup",this._pointerUp)}dispose(){this.unRegistryEvent()}constructor(t){super(),this.ctn=t,this._pointerDown=e=>{this.point={x:e.offsetX,y:e.offsetY}},this._pointerUp=e=>{if(!this.point)return;let{offsetX:n,offsetY:i}=e,{x:o,y:s}=this.point;Math.hypot(o-n+(s-i))>3||this.dispatchEvent({type:"click",e})},this.registryEvent()}};var bk=d(v(),1),vk=d(Z(),1),_k=d(Lr(),1),Wk=d(pe(),1);import{isNil as hE}from"lodash";import{EventDispatcher as pE}from"three";var qn=class extends pE{_isEffectiveTask(t){return t&&typeof t.run=="function"}_getIndexByTid(t){return this._task.findIndex(e=>e.tid===t)}_createTask(t){return this._isEffectiveTask(t)?T({},t,{tid:++this._id,meta:t.meta||{}}):!1}get task(){return[...this._task]}getTasks(){return[...this._task]}add(t){if(this._isEffectiveTask(t)){let e=this._createTask(t);return this._task.push(e),this.started&&!this.activeTask&&this.start(),e.tid}return!1}replace(t,e){if(!this._isEffectiveTask(e))return console.warn("[TaskQueue] replace\u65B9\u6CD5\u4F20\u5165\u7684task\u53C2\u6570\u683C\u5F0F\u4E0D\u6B63\u786E"),!1;let n=this._getIndexByTid(t);if(n===-1)return console.warn("[TaskQueue] \u6CA1\u6709\u627E\u5230id="+t+"\u7684\u4EFB\u52A1"),!1;let i=this._createTask(e);return this._task.splice(n,1,i),i.tid}replaceByMetaType(t){var e;let n=(e=t.meta)==null?void 0:e.type;if(hE(n))return this.add(t);{let i=this._task.find(o=>o.meta.type===n);return i?this.replace(i.tid,t):this.add(t)}}remove(t){let e=this._getIndexByTid(t);return e===-1?(console.warn("[TaskQueue] remove\u65B9\u6CD5\u4F20\u5165\u7684id\uFF1A"+t+"\u627E\u4E0D\u5230\u5BF9\u5E94\u7684task"),!1):(this._task.splice(e,1),!0)}clear(){this._task.length=0}start(){this.started=!0,!this.activeTask&&this._task.length&&this.exec()}stop(){this.started=!1}exec(){return j(this,null,function*(){if(!this.started||!this._task.length)return!1;let t=this._task.shift();this.activeTask=t,this.dispatchEvent({type:"active-task-start",task:t});let e;try{e=yield t.run()}catch(n){console.warn("[task run err]",n,t)}return this.activeTask=null,this.dispatchEvent({type:"active-task-end",task:t,res:e}),this.exec()})}constructor(t=!0){super(),this._task=[],this.started=!1,this.activeTask=null,this._id=0,t&&this.start()}};import{EventDispatcher as rK,Box2 as iK,Vector3 as Oe,Vector2 as Pr,Raycaster as oK,Box3 as sK,Color as aK,AmbientLight as uK}from"three";var TQ=d(v(),1),wQ=d(ie(),1),SQ=d(oe(),1),bQ=d(se(),1),vQ=d(ae(),1),_Q=d(ue(),1),WQ=d(le(),1),xQ=d(ce(),1),IQ=d(Z(),1);import{EventDispatcher as TO}from"three";var b7=d(v(),1),v7=d(Z(),1);import{Object3D as I4,ExtrudeGeometry as Y4,Mesh as E4,Box3 as xs,Vector3 as $t,BufferGeometry as D4,LineSegments as X4,Ray as KA,Vector2 as Ce,DoubleSide as Z4,RepeatWrapping as RA}from"three";var Dk=d(v(),1);import{LineMaterial as fE}from"three/examples/jsm/lines/LineMaterial";import{Color as Fo,LineBasicMaterial as dE,MeshStandardMaterial as mE,MeshBasicMaterial as gE,ShaderMaterial as yE,DoubleSide as ME}from"three";function Rg(r){return r.x+"-"+r.y+"-"+r.z}var G=class{static generateLineMaterialKey(t){let{color:e,opacity:n}=t;return e+"-"+n}static createLineMaterial(t){let{color:e,opacity:n}=t,i=this.generateLineMaterialKey({color:e,opacity:n});if(this.lineMaterialMap.has(i))return this.lineMaterialMap.get(i);let o=new dE({color:new Fo(e).convertLinearToSRGB(),transparent:!0,opacity:n});return this.lineMaterialMap.set(i,o),o}static createMeshStandardMaterial(t){let{color:e,opacity:n}=t,i=e+"-"+n;if(this.meshStandardMaterialMap.has(i))return this.meshStandardMaterialMap.get(i);let o=new mE({color:new Fo(e).convertLinearToSRGB(),roughness:1,transparent:!0,opacity:n,depthWrite:!0});return this.meshStandardMaterialMap.set(i,o),o}static createMeshBasicMaterial(t){let{color:e,opacity:n}=t,i=e+"-"+n;if(this.meshBasicMaterialMap.has(i))return this.meshBasicMaterialMap.get(i);let o=new gE({color:e,transparent:!0,opacity:n,depthWrite:!0});return this.meshBasicMaterialMap.set(i,o),o}static createShaderMaterial(t){let{gradualColor:e,center:n,maxValue:i,opacity:o,direction:s,max:a,min:u}=t,l=e.toString()+"-"+Rg(n)+"-"+i+"-"+o+"-"+Rg(s);if(this.shaderMaterialMap.has(l))return this.shaderMaterialMap.get(l);let c=`
4
+ \v\f\r \xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF`});var T2=f((pU,A2)=>{"use strict";var QI=Y(),HI=mn(),qI=jt(),$u=Hu(),j2=QI("".replace),$I=RegExp("^["+$u+"]+"),tY=RegExp("(^|[^"+$u+"])["+$u+"]+$"),qu=function(r){return function(t){var e=qI(HI(t));return r&1&&(e=j2(e,$I,"")),r&2&&(e=j2(e,tY,"$1")),e}};A2.exports={start:qu(1),end:qu(2),trim:qu(3)}});var v2=f((fU,b2)=>{"use strict";var eY=Dr().PROPER,nY=X(),w2=Hu(),S2="\u200B\x85\u180E";b2.exports=function(r){return nY(function(){return!!w2[r]()||S2[r]()!==S2||eY&&w2[r].name!==r})}});var _2=f(()=>{"use strict";var rY=C(),iY=T2().trim,oY=v2();rY({target:"String",proto:!0,forced:oY("trim")},{trim:function(){return iY(this)}})});var n0=f((OU,Y2)=>{"use strict";var I2=Rn(),sY=TypeError;Y2.exports=function(r,t){if(!delete r[t])throw new sY("Cannot delete property "+I2(t)+" of "+I2(r))}});var Zo=f((KU,D2)=>{"use strict";var E2=Gr(),aY=Math.floor,r0=function(r,t){var e=r.length;if(e<8)for(var n=1,i,o;n<e;){for(o=n,i=r[n];o&&t(r[o-1],i)>0;)r[o]=r[--o];o!==n++&&(r[o]=i)}else for(var s=aY(e/2),a=r0(E2(r,0,s),t),u=r0(E2(r,s),t),l=a.length,c=u.length,h=0,p=0;h<l||p<c;)r[h+p]=h<l&&p<c?t(a[h],u[p])<=0?a[h++]:u[p++]:h<l?a[h++]:u[p++];return r};D2.exports=r0});var Z2=f((RU,X2)=>{"use strict";var uY=X();X2.exports=function(r,t){var e=[][r];return!!e&&uY(function(){e.call(null,t||function(){return 1},1)})}});var i0=f((FU,O2)=>{"use strict";var lY=Kn(),C2=lY.match(/firefox\/(\d+)/i);O2.exports=!!C2&&+C2[1]});var o0=f((zU,K2)=>{"use strict";var cY=Kn();K2.exports=/MSIE|Trident/.test(cY)});var s0=f((NU,F2)=>{"use strict";var hY=Kn(),R2=hY.match(/AppleWebKit\/(\d+)\./);F2.exports=!!R2&&+R2[1]});var Co=f(()=>{"use strict";var pY=C(),J2=Y(),fY=ne(),dY=it(),z2=et(),mY=n0(),N2=jt(),a0=X(),gY=Zo(),yY=Z2(),U2=i0(),MY=o0(),G2=Ir(),k2=s0(),He=[],V2=J2(He.sort),PY=J2(He.push),jY=a0(function(){He.sort(void 0)}),AY=a0(function(){He.sort(null)}),TY=yY("sort"),L2=!a0(function(){if(G2)return G2<70;if(!(U2&&U2>3)){if(MY)return!0;if(k2)return k2<603;var r="",t,e,n,i;for(t=65;t<76;t++){switch(e=String.fromCharCode(t),t){case 66:case 69:case 70:case 72:n=3;break;case 68:case 71:n=4;break;default:n=2}for(i=0;i<47;i++)He.push({k:e+i,v:n})}for(He.sort(function(o,s){return s.v-o.v}),i=0;i<He.length;i++)e=He[i].k.charAt(0),r.charAt(r.length-1)!==e&&(r+=e);return r!=="DGBEFHACIJK"}}),wY=jY||!AY||!TY||!L2,SY=function(r){return function(t,e){return e===void 0?-1:t===void 0?1:r!==void 0?+r(t,e)||0:N2(t)>N2(e)?1:-1}};pY({target:"Array",proto:!0,forced:wY},{sort:function(t){t!==void 0&&fY(t);var e=dY(this);if(L2)return t===void 0?V2(e):V2(e,t);var n=[],i=z2(e),o,s;for(s=0;s<i;s++)s in e&&PY(n,e[s]);for(gY(n,SY(t)),o=z2(n),s=0;s<o;)e[s]=n[s++];for(;s<i;)mY(e,s++);return e}})});var Q2=f((BU,B2)=>{B2.exports=function(t,e){return t[0]=e[0],t[1]=e[1],t}});var $2=f((QU,q2)=>{var H2=Q2();q2.exports=function(r,t){Array.isArray(t)||(t=[]),r.length>0&&t.push(H2([0,0],r[0]));for(var e=0;e<r.length-1;e++){var n=r[e],i=r[e+1],o=n[0],s=n[1],a=i[0],u=i[1],l=[.75*o+.25*a,.75*s+.25*u],c=[.25*o+.75*a,.25*s+.75*u];t.push(l),t.push(c)}return r.length>1&&t.push(H2([0,0],r[r.length-1])),t}});var og=f((iG,ig)=>{var l0=class{constructor(){this.keys=new Set,this.queue=[]}sort(){this.queue.sort((t,e)=>t.priority-e.priority)}set(t,e){let n=Number(e);if(isNaN(n))throw new TypeError('"priority" must be a number');return this.keys.has(t)?this.queue.map(i=>(i.key===t&&Object.assign(i,{priority:n}),i)):(this.keys.add(t),this.queue.push({key:t,priority:n})),this.sort(),this.queue.length}next(){let t=this.queue.shift();return this.keys.delete(t.key),t}isEmpty(){return this.queue.length===0}has(t){return this.keys.has(t)}get(t){return this.queue.find(e=>e.key===t)}};ig.exports=l0});var ug=f((oG,ag)=>{function sg(r,t){let e=new Map;for(let[n,i]of r)n!==t&&i instanceof Map?e.set(n,sg(i,t)):n!==t&&e.set(n,i);return e}ag.exports=sg});var hg=f((sG,cg)=>{function WY(r){let t=Number(r);return!(isNaN(t)||t<=0)}function lg(r){let t=new Map;return Object.keys(r).forEach(n=>{let i=r[n];if(i!==null&&typeof i=="object"&&!Array.isArray(i))return t.set(n,lg(i));if(!WY(i))throw new Error(`Could not add node at key "${n}", make sure it's a valid node`,i);return t.set(n,Number(i))}),t}cg.exports=lg});var dg=f((aG,fg)=>{function pg(r){if(!(r instanceof Map))throw new Error(`Invalid graph: Expected Map instead found ${typeof r}`);r.forEach((t,e)=>{if(typeof t=="object"&&t instanceof Map){pg(t);return}if(typeof t!="number"||t<=0)throw new Error(`Values must be numbers greater than 0. Found value ${t} at ${e}`)})}fg.exports=pg});var h0=f((uG,yg)=>{var xY=og(),IY=ug(),mg=hg(),gg=dg(),c0=class{constructor(t){t instanceof Map?(gg(t),this.graph=t):t?this.graph=mg(t):this.graph=new Map}addNode(t,e){let n;return e instanceof Map?(gg(e),n=e):n=mg(e),this.graph.set(t,n),this}addVertex(t,e){return this.addNode(t,e)}removeNode(t){return this.graph=IY(this.graph,t),this}path(t,e,n={}){if(!this.graph.size)return n.cost?{path:null,cost:0}:null;let i=new Set,o=new xY,s=new Map,a=[],u=0,l=[];if(n.avoid&&(l=[].concat(n.avoid)),l.includes(t))throw new Error(`Starting node (${t}) cannot be avoided`);if(l.includes(e))throw new Error(`Ending node (${e}) cannot be avoided`);for(o.set(t,0);!o.isEmpty();){let c=o.next();if(c.key===e){u=c.priority;let p=c.key;for(;s.has(p);)a.push(p),p=s.get(p);break}i.add(c.key),(this.graph.get(c.key)||new Map).forEach((p,m)=>{if(i.has(m)||l.includes(m))return null;if(!o.has(m))return s.set(m,c.key),o.set(m,c.priority+p);let g=o.get(m).priority,M=c.priority+p;return M<g?(s.set(m,c.key),o.set(m,M)):null})}return a.length?(n.trim?a.shift():a=a.concat([t]),n.reverse||(a=a.reverse()),n.cost?{path:a,cost:u}:a):n.cost?{path:null,cost:0}:null}shortestPath(...t){return this.path(...t)}};yg.exports=c0});var Hr=f((mG,Pg)=>{"use strict";var YY=we(),EY=Y();Pg.exports=function(r){if(YY(r)==="Function")return EY(r)}});var qe=f((gG,Ag)=>{"use strict";var jg=Hr(),DY=ne(),XY=Wr(),ZY=jg(jg.bind);Ag.exports=function(r,t){return DY(r),t===void 0?r:XY?ZY(r,t):function(){return r.apply(t,arguments)}}});var Sg=f((yG,wg)=>{"use strict";var CY=Or(),OY=et(),KY=so(),RY=qe(),Tg=function(r,t,e,n,i,o,s,a){for(var u=i,l=0,c=s?RY(s,a):!1,h,p;l<n;)l in e&&(h=c?c(e[l],l,t):e[l],o>0&&CY(h)?(p=OY(h),u=Tg(r,t,h,p,u,o-1)-1):(KY(u+1),r[u]=h),u++),l++;return u};wg.exports=Tg});var Ko=f((MG,xg)=>{"use strict";var FY=Y(),zY=X(),bg=z(),NY=be(),UY=Ut(),GY=$a(),vg=function(){},_g=UY("Reflect","construct"),p0=/^\s*(?:class|function)\b/,kY=FY(p0.exec),VY=!p0.test(vg),qr=function(t){if(!bg(t))return!1;try{return _g(vg,[],t),!0}catch(e){return!1}},Wg=function(t){if(!bg(t))return!1;switch(NY(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return VY||!!kY(p0,GY(t))}catch(e){return!0}};Wg.sham=!0;xg.exports=!_g||zY(function(){var r;return qr(qr.call)||!qr(Object)||!qr(function(){r=!0})||r})?Wg:qr});var Dg=f((PG,Eg)=>{"use strict";var Ig=Or(),JY=Ko(),LY=tt(),BY=J(),QY=BY("species"),Yg=Array;Eg.exports=function(r){var t;return Ig(r)&&(t=r.constructor,JY(t)&&(t===Yg||Ig(t.prototype))?t=void 0:LY(t)&&(t=t[QY],t===null&&(t=void 0))),t===void 0?Yg:t}});var f0=f((jG,Xg)=>{"use strict";var HY=Dg();Xg.exports=function(r,t){return new(HY(r))(t===0?0:t)}});var d0=f(()=>{"use strict";var qY=C(),$Y=Sg(),tE=it(),eE=et(),nE=Pt(),rE=f0();qY({target:"Array",proto:!0},{flat:function(){var t=arguments.length?arguments[0]:void 0,e=tE(this),n=eE(e),i=rE(e,0);return i.length=$Y(i,e,e,n,0,t===void 0?1:nE(t)),i}})});var m0=f(()=>{"use strict";var iE=Kr();iE("flat")});var Gg=f((Ok,Ug)=>{"use strict";var PE=J(),zg=PE("iterator"),Ng=!1;try{Fg=0,y0={next:function(){return{done:!!Fg++}},return:function(){Ng=!0}},y0[zg]=function(){return this},Array.from(y0,function(){throw 2})}catch(r){}var Fg,y0;Ug.exports=function(r,t){try{if(!t&&!Ng)return!1}catch(i){return!1}var e=!1;try{var n={};n[zg]=function(){return{next:function(){return{done:e=!0}}}},r(n)}catch(i){}return e}});var M0=f((Kk,kg)=>{"use strict";kg.exports=typeof ArrayBuffer!="undefined"&&typeof DataView!="undefined"});var Ie=f((Rk,Jg)=>{"use strict";var Vg=ou(),jE=vt();Jg.exports=function(r,t,e){return e.get&&Vg(e.get,t,{getter:!0}),e.set&&Vg(e.set,t,{setter:!0}),jE.f(r,t,e)}});var dt=f((Fk,ry)=>{"use strict";var AE=M0(),T0=F(),ut=E(),Hg=z(),Uo=tt(),rn=ot(),w0=be(),TE=Rn(),wE=_t(),P0=Wt(),SE=Ie(),bE=On(),Go=Rr(),tr=Pn(),vE=J(),_E=Vi(),qg=re(),$g=qg.enforce,WE=qg.get,zo=ut.Int8Array,j0=zo&&zo.prototype,Lg=ut.Uint8ClampedArray,Bg=Lg&&Lg.prototype,me=zo&&Go(zo),Lt=j0&&Go(j0),xE=Object.prototype,S0=ut.TypeError,Qg=vE("toStringTag"),A0=_E("TYPED_ARRAY_TAG"),No="TypedArrayConstructor",Ye=AE&&!!tr&&w0(ut.opera)!=="Opera",ty=!1,ft,nn,$n,Ee={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},b0={BigInt64Array:8,BigUint64Array:8},IE=function(t){if(!Uo(t))return!1;var e=w0(t);return e==="DataView"||rn(Ee,e)||rn(b0,e)},ey=function(r){var t=Go(r);if(Uo(t)){var e=WE(t);return e&&rn(e,No)?e[No]:ey(t)}},ny=function(r){if(!Uo(r))return!1;var t=w0(r);return rn(Ee,t)||rn(b0,t)},YE=function(r){if(ny(r))return r;throw new S0("Target is not a typed array")},EE=function(r){if(Hg(r)&&(!tr||bE(me,r)))return r;throw new S0(TE(r)+" is not a typed array constructor")},DE=function(r,t,e,n){if(T0){if(e)for(var i in Ee){var o=ut[i];if(o&&rn(o.prototype,r))try{delete o.prototype[r]}catch(s){try{o.prototype[r]=t}catch(a){}}}(!Lt[r]||e)&&P0(Lt,r,e?t:Ye&&j0[r]||t,n)}},XE=function(r,t,e){var n,i;if(T0){if(tr){if(e){for(n in Ee)if(i=ut[n],i&&rn(i,r))try{delete i[r]}catch(o){}}if(!me[r]||e)try{return P0(me,r,e?t:Ye&&me[r]||t)}catch(o){}else return}for(n in Ee)i=ut[n],i&&(!i[r]||e)&&P0(i,r,t)}};for(ft in Ee)nn=ut[ft],$n=nn&&nn.prototype,$n?$g($n)[No]=nn:Ye=!1;for(ft in b0)nn=ut[ft],$n=nn&&nn.prototype,$n&&($g($n)[No]=nn);if((!Ye||!Hg(me)||me===Function.prototype)&&(me=function(){throw new S0("Incorrect invocation")},Ye))for(ft in Ee)ut[ft]&&tr(ut[ft],me);if((!Ye||!Lt||Lt===xE)&&(Lt=me.prototype,Ye))for(ft in Ee)ut[ft]&&tr(ut[ft].prototype,Lt);Ye&&Go(Bg)!==Lt&&tr(Bg,Lt);if(T0&&!rn(Lt,Qg)){ty=!0,SE(Lt,Qg,{configurable:!0,get:function(){return Uo(this)?this[A0]:void 0}});for(ft in Ee)ut[ft]&&wE(ut[ft],A0,ft)}ry.exports={NATIVE_ARRAY_BUFFER_VIEWS:Ye,TYPED_ARRAY_TAG:ty&&A0,aTypedArray:YE,aTypedArrayConstructor:EE,exportTypedArrayMethod:DE,exportTypedArrayStaticMethod:XE,getTypedArrayConstructor:ey,isView:IE,isTypedArray:ny,TypedArray:me,TypedArrayPrototype:Lt}});var _0=f((zk,oy)=>{"use strict";var iy=E(),v0=X(),ZE=Gg(),CE=dt().NATIVE_ARRAY_BUFFER_VIEWS,OE=iy.ArrayBuffer,Tn=iy.Int8Array;oy.exports=!CE||!v0(function(){Tn(1)})||!v0(function(){new Tn(-1)})||!ZE(function(r){new Tn,new Tn(null),new Tn(1.5),new Tn(r)},!0)||v0(function(){return new Tn(new OE(2),1,void 0).length!==1})});var W0=f((Nk,sy)=>{"use strict";var KE=Wt();sy.exports=function(r,t,e){for(var n in t)KE(r,n,t[n],e);return r}});var $r=f((Uk,ay)=>{"use strict";var RE=On(),FE=TypeError;ay.exports=function(r,t){if(RE(t,r))return r;throw new FE("Incorrect invocation")}});var ko=f((Gk,uy)=>{"use strict";var zE=Pt(),NE=yn(),UE=RangeError;uy.exports=function(r){if(r===void 0)return 0;var t=zE(r),e=NE(t);if(t!==e)throw new UE("Wrong length or index");return e}});var cy=f((kk,ly)=>{"use strict";ly.exports=Math.sign||function(t){var e=+t;return e===0||e!==e?e:e<0?-1:1}});var dy=f((Vk,fy)=>{"use strict";var GE=cy(),kE=Math.abs,py=2220446049250313e-31,hy=1/py,VE=function(r){return r+hy-hy};fy.exports=function(r,t,e,n){var i=+r,o=kE(i),s=GE(i);if(o<n)return s*VE(o/n/t)*n*t;var a=(1+t/py)*o,u=a-(a-o);return u>e||u!==u?s*(1/0):s*u}});var gy=f((Jk,my)=>{"use strict";var JE=dy(),LE=11920928955078125e-23,BE=34028234663852886e22,QE=11754943508222875e-54;my.exports=Math.fround||function(t){return JE(t,LE,BE,QE)}});var My=f((Lk,yy)=>{"use strict";var HE=Array,qE=Math.abs,De=Math.pow,$E=Math.floor,tD=Math.log,eD=Math.LN2,nD=function(r,t,e){var n=HE(e),i=e*8-t-1,o=(1<<i)-1,s=o>>1,a=t===23?De(2,-24)-De(2,-77):0,u=r<0||r===0&&1/r<0?1:0,l=0,c,h,p;for(r=qE(r),r!==r||r===1/0?(h=r!==r?1:0,c=o):(c=$E(tD(r)/eD),p=De(2,-c),r*p<1&&(c--,p*=2),c+s>=1?r+=a/p:r+=a*De(2,1-s),r*p>=2&&(c++,p/=2),c+s>=o?(h=0,c=o):c+s>=1?(h=(r*p-1)*De(2,t),c+=s):(h=r*De(2,s-1)*De(2,t),c=0));t>=8;)n[l++]=h&255,h/=256,t-=8;for(c=c<<t|h,i+=t;i>0;)n[l++]=c&255,c/=256,i-=8;return n[l-1]|=u*128,n},rD=function(r,t){var e=r.length,n=e*8-t-1,i=(1<<n)-1,o=i>>1,s=n-7,a=e-1,u=r[a--],l=u&127,c;for(u>>=7;s>0;)l=l*256+r[a--],s-=8;for(c=l&(1<<-s)-1,l>>=-s,s+=t;s>0;)c=c*256+r[a--],s-=8;if(l===0)l=1-o;else{if(l===i)return c?NaN:u?-1/0:1/0;c+=De(2,t),l-=o}return(u?-1:1)*c*De(2,l-t)};yy.exports={pack:nD,unpack:rD}});var x0=f((Bk,jy)=>{"use strict";var iD=it(),Py=Zr(),oD=et();jy.exports=function(t){for(var e=iD(this),n=oD(e),i=arguments.length,o=Py(i>1?arguments[1]:void 0,n),s=i>2?arguments[2]:void 0,a=s===void 0?n:Py(s,n);a>o;)e[o++]=t;return e}});var qo=f((Qk,Oy)=>{"use strict";var Qo=E(),X0=Y(),I0=F(),sD=M0(),Ey=Dr(),aD=_t(),uD=Ie(),Ay=W0(),Y0=X(),Vo=$r(),lD=Pt(),cD=yn(),Lo=ko(),hD=gy(),Dy=My(),pD=Rr(),Ty=Pn(),fD=x0(),dD=Gr(),mD=Wo(),gD=io(),Xy=Ue(),Z0=re(),yD=Ey.PROPER,wy=Ey.CONFIGURABLE,nr="ArrayBuffer",Ho="DataView",rr="prototype",MD="Wrong length",Zy="Wrong index",Sy=Z0.getterFor(nr),ei=Z0.getterFor(Ho),by=Z0.set,Bt=Qo[nr],Tt=Bt,er=Tt&&Tt[rr],ge=Qo[Ho],wn=ge&&ge[rr],vy=Object.prototype,PD=Qo.Array,Bo=Qo.RangeError,jD=X0(fD),AD=X0([].reverse),Cy=Dy.pack,_y=Dy.unpack,Wy=function(r){return[r&255]},xy=function(r){return[r&255,r>>8&255]},Iy=function(r){return[r&255,r>>8&255,r>>16&255,r>>24&255]},Yy=function(r){return r[3]<<24|r[2]<<16|r[1]<<8|r[0]},TD=function(r){return Cy(hD(r),23,4)},wD=function(r){return Cy(r,52,8)},Jo=function(r,t,e){uD(r[rr],t,{configurable:!0,get:function(){return e(this)[t]}})},on=function(r,t,e,n){var i=ei(r),o=Lo(e),s=!!n;if(o+t>i.byteLength)throw new Bo(Zy);var a=i.bytes,u=o+i.byteOffset,l=dD(a,u,u+t);return s?l:AD(l)},sn=function(r,t,e,n,i,o){var s=ei(r),a=Lo(e),u=n(+i),l=!!o;if(a+t>s.byteLength)throw new Bo(Zy);for(var c=s.bytes,h=a+s.byteOffset,p=0;p<t;p++)c[h+p]=u[l?p:t-p-1]};sD?(E0=yD&&Bt.name!==nr,!Y0(function(){Bt(1)})||!Y0(function(){new Bt(-1)})||Y0(function(){return new Bt,new Bt(1.5),new Bt(NaN),Bt.length!==1||E0&&!wy})?(Tt=function(t){return Vo(this,er),mD(new Bt(Lo(t)),this,Tt)},Tt[rr]=er,er.constructor=Tt,gD(Tt,Bt)):E0&&wy&&aD(Bt,"name",nr),Ty&&pD(wn)!==vy&&Ty(wn,vy),ti=new ge(new Tt(2)),D0=X0(wn.setInt8),ti.setInt8(0,2147483648),ti.setInt8(1,2147483649),(ti.getInt8(0)||!ti.getInt8(1))&&Ay(wn,{setInt8:function(t,e){D0(this,t,e<<24>>24)},setUint8:function(t,e){D0(this,t,e<<24>>24)}},{unsafe:!0})):(Tt=function(t){Vo(this,er);var e=Lo(t);by(this,{type:nr,bytes:jD(PD(e),0),byteLength:e}),I0||(this.byteLength=e,this.detached=!1)},er=Tt[rr],ge=function(t,e,n){Vo(this,wn),Vo(t,er);var i=Sy(t),o=i.byteLength,s=lD(e);if(s<0||s>o)throw new Bo("Wrong offset");if(n=n===void 0?o-s:cD(n),s+n>o)throw new Bo(MD);by(this,{type:Ho,buffer:t,byteLength:n,byteOffset:s,bytes:i.bytes}),I0||(this.buffer=t,this.byteLength=n,this.byteOffset=s)},wn=ge[rr],I0&&(Jo(Tt,"byteLength",Sy),Jo(ge,"buffer",ei),Jo(ge,"byteLength",ei),Jo(ge,"byteOffset",ei)),Ay(wn,{getInt8:function(t){return on(this,1,t)[0]<<24>>24},getUint8:function(t){return on(this,1,t)[0]},getInt16:function(t){var e=on(this,2,t,arguments.length>1?arguments[1]:!1);return(e[1]<<8|e[0])<<16>>16},getUint16:function(t){var e=on(this,2,t,arguments.length>1?arguments[1]:!1);return e[1]<<8|e[0]},getInt32:function(t){return Yy(on(this,4,t,arguments.length>1?arguments[1]:!1))},getUint32:function(t){return Yy(on(this,4,t,arguments.length>1?arguments[1]:!1))>>>0},getFloat32:function(t){return _y(on(this,4,t,arguments.length>1?arguments[1]:!1),23)},getFloat64:function(t){return _y(on(this,8,t,arguments.length>1?arguments[1]:!1),52)},setInt8:function(t,e){sn(this,1,t,Wy,e)},setUint8:function(t,e){sn(this,1,t,Wy,e)},setInt16:function(t,e){sn(this,2,t,xy,e,arguments.length>2?arguments[2]:!1)},setUint16:function(t,e){sn(this,2,t,xy,e,arguments.length>2?arguments[2]:!1)},setInt32:function(t,e){sn(this,4,t,Iy,e,arguments.length>2?arguments[2]:!1)},setUint32:function(t,e){sn(this,4,t,Iy,e,arguments.length>2?arguments[2]:!1)},setFloat32:function(t,e){sn(this,4,t,TD,e,arguments.length>2?arguments[2]:!1)},setFloat64:function(t,e){sn(this,8,t,wD,e,arguments.length>2?arguments[2]:!1)}}));var E0,ti,D0;Xy(Tt,nr);Xy(ge,Ho);Oy.exports={ArrayBuffer:Tt,DataView:ge}});var Ry=f((Hk,Ky)=>{"use strict";var SD=tt(),bD=Math.floor;Ky.exports=Number.isInteger||function(t){return!SD(t)&&isFinite(t)&&bD(t)===t}});var zy=f((qk,Fy)=>{"use strict";var vD=Pt(),_D=RangeError;Fy.exports=function(r){var t=vD(r);if(t<0)throw new _D("The argument can't be less than 0");return t}});var C0=f(($k,Ny)=>{"use strict";var WD=zy(),xD=RangeError;Ny.exports=function(r,t){var e=WD(r);if(e%t)throw new xD("Wrong offset");return e}});var Gy=f((tV,Uy)=>{"use strict";var ID=Math.round;Uy.exports=function(r){var t=ID(r);return t<0?0:t>255?255:t&255}});var O0=f((eV,ky)=>{"use strict";var YD=Ko(),ED=Rn(),DD=TypeError;ky.exports=function(r){if(YD(r))return r;throw new DD(ED(r)+" is not a constructor")}});var ni=f((nV,Jy)=>{"use strict";var XD=be(),Vy=Er(),ZD=Zn(),CD=zn(),OD=J(),KD=OD("iterator");Jy.exports=function(r){if(!ZD(r))return Vy(r,KD)||Vy(r,"@@iterator")||CD[XD(r)]}});var $o=f((rV,Ly)=>{"use strict";var RD=k(),FD=ne(),zD=rt(),ND=Rn(),UD=ni(),GD=TypeError;Ly.exports=function(r,t){var e=arguments.length<2?UD(r):t;if(FD(e))return zD(RD(e,r));throw new GD(ND(r)+" is not iterable")}});var K0=f((iV,By)=>{"use strict";var kD=J(),VD=zn(),JD=kD("iterator"),LD=Array.prototype;By.exports=function(r){return r!==void 0&&(VD.Array===r||LD[JD]===r)}});var R0=f((oV,Qy)=>{"use strict";var BD=be();Qy.exports=function(r){var t=BD(r);return t==="BigInt64Array"||t==="BigUint64Array"}});var ts=f((sV,Hy)=>{"use strict";var QD=Na(),HD=TypeError;Hy.exports=function(r){var t=QD(r,"number");if(typeof t=="number")throw new HD("Can't convert number to bigint");return BigInt(t)}});var F0=f((aV,qy)=>{"use strict";var qD=qe(),$D=k(),t6=O0(),e6=it(),n6=et(),r6=$o(),i6=ni(),o6=K0(),s6=R0(),a6=dt().aTypedArrayConstructor,u6=ts();qy.exports=function(t){var e=t6(this),n=e6(t),i=arguments.length,o=i>1?arguments[1]:void 0,s=o!==void 0,a=i6(n),u,l,c,h,p,m,g,M;if(a&&!o6(a))for(g=r6(n,a),M=g.next,n=[];!(m=$D(M,g)).done;)n.push(m.value);for(s&&i>2&&(o=qD(o,arguments[2])),l=n6(n),c=new(a6(e))(l),h=s6(c),u=0;l>u;u++)p=s?o(n[u],u):n[u],c[u]=h?u6(p):+p;return c}});var eM=f((uV,tM)=>{"use strict";var l6=qe(),c6=Y(),h6=xr(),p6=it(),f6=et(),d6=f0(),$y=c6([].push),an=function(r){var t=r===1,e=r===2,n=r===3,i=r===4,o=r===6,s=r===7,a=r===5||o;return function(u,l,c,h){for(var p=p6(u),m=h6(p),g=f6(m),M=l6(l,c),P=0,A=h||d6,S=t?A(u,g):e||s?A(u,0):void 0,_,I;g>P;P++)if((a||P in m)&&(_=m[P],I=M(_,P,p),r))if(t)S[P]=I;else if(I)switch(r){case 3:return!0;case 5:return _;case 6:return P;case 2:$y(S,_)}else switch(r){case 4:return!1;case 7:$y(S,_)}return o?-1:n||i?i:S}};tM.exports={forEach:an(0),map:an(1),filter:an(2),some:an(3),every:an(4),find:an(5),findIndex:an(6),filterReject:an(7)}});var z0=f((lV,rM)=>{"use strict";var m6=Ut(),g6=Ie(),y6=J(),M6=F(),nM=y6("species");rM.exports=function(r){var t=m6(r);M6&&t&&!t[nM]&&g6(t,nM,{configurable:!0,get:function(){return this}})}});var N0=f((cV,iM)=>{"use strict";var P6=et();iM.exports=function(r,t,e){for(var n=0,i=arguments.length>2?e:P6(t),o=new r(i);i>n;)o[n]=t[n++];return o}});var un=f((hV,B0)=>{"use strict";var oM=C(),gM=E(),sM=k(),j6=F(),A6=_0(),si=dt(),yM=qo(),aM=$r(),T6=ze(),ri=_t(),w6=Ry(),S6=yn(),uM=ko(),U0=C0(),b6=Gy(),MM=Ji(),ii=ot(),v6=be(),V0=tt(),_6=Yr(),W6=Mn(),x6=On(),es=Pn(),I6=uu().f,lM=F0(),Y6=eM().forEach,E6=z0(),D6=Ie(),PM=vt(),jM=Bi(),cM=N0(),Q0=re(),X6=Wo(),J0=Q0.get,Z6=Q0.set,C6=Q0.enforce,AM=PM.f,O6=jM.f,G0=gM.RangeError,TM=yM.ArrayBuffer,K6=TM.prototype,R6=yM.DataView,ns=si.NATIVE_ARRAY_BUFFER_VIEWS,hM=si.TYPED_ARRAY_TAG,pM=si.TypedArray,oi=si.TypedArrayPrototype,L0=si.isTypedArray,rs="BYTES_PER_ELEMENT",k0="Wrong length",is=function(r,t){D6(r,t,{configurable:!0,get:function(){return J0(this)[t]}})},fM=function(r){var t;return x6(K6,r)||(t=v6(r))==="ArrayBuffer"||t==="SharedArrayBuffer"},wM=function(r,t){return L0(r)&&!_6(t)&&t in r&&w6(+t)&&t>=0},dM=function(t,e){return e=MM(e),wM(t,e)?T6(2,t[e]):O6(t,e)},mM=function(t,e,n){return e=MM(e),wM(t,e)&&V0(n)&&ii(n,"value")&&!ii(n,"get")&&!ii(n,"set")&&!n.configurable&&(!ii(n,"writable")||n.writable)&&(!ii(n,"enumerable")||n.enumerable)?(t[e]=n.value,t):AM(t,e,n)};j6?(ns||(jM.f=dM,PM.f=mM,is(oi,"buffer"),is(oi,"byteOffset"),is(oi,"byteLength"),is(oi,"length")),oM({target:"Object",stat:!0,forced:!ns},{getOwnPropertyDescriptor:dM,defineProperty:mM}),B0.exports=function(r,t,e){var n=r.match(/\d+/)[0]/8,i=r+(e?"Clamped":"")+"Array",o="get"+r,s="set"+r,a=gM[i],u=a,l=u&&u.prototype,c={},h=function(M,P){var A=J0(M);return A.view[o](P*n+A.byteOffset,!0)},p=function(M,P,A){var S=J0(M);S.view[s](P*n+S.byteOffset,e?b6(A):A,!0)},m=function(M,P){AM(M,P,{get:function(){return h(this,P)},set:function(A){return p(this,P,A)},enumerable:!0})};ns?A6&&(u=t(function(M,P,A,S){return aM(M,l),X6(function(){return V0(P)?fM(P)?S!==void 0?new a(P,U0(A,n),S):A!==void 0?new a(P,U0(A,n)):new a(P):L0(P)?cM(u,P):sM(lM,u,P):new a(uM(P))}(),M,u)}),es&&es(u,pM),Y6(I6(a),function(M){M in u||ri(u,M,a[M])}),u.prototype=l):(u=t(function(M,P,A,S){aM(M,l);var _=0,I=0,x,O,b;if(!V0(P))b=uM(P),O=b*n,x=new TM(O);else if(fM(P)){x=P,I=U0(A,n);var U=P.byteLength;if(S===void 0){if(U%n)throw new G0(k0);if(O=U-I,O<0)throw new G0(k0)}else if(O=S6(S)*n,O+I>U)throw new G0(k0);b=O/n}else return L0(P)?cM(u,P):sM(lM,u,P);for(Z6(M,{buffer:x,byteOffset:I,byteLength:O,length:b,view:new R6(x)});_<b;)m(M,_++)}),es&&es(u,pM),l=u.prototype=W6(oi)),l.constructor!==u&&ri(l,"constructor",u),C6(l).TypedArrayConstructor=u,hM&&ri(l,hM,i);var g=u!==a;c[i]=u,oM({global:!0,constructor:!0,forced:g,sham:!ns},c),rs in u||ri(u,rs,n),rs in l||ri(l,rs,n),E6(i)}):B0.exports=function(){}});var os=f(()=>{"use strict";var F6=un();F6("Uint8",function(r){return function(e,n,i){return r(this,e,n,i)}})});var ai=f(()=>{"use strict";var SM=dt(),z6=et(),N6=Pt(),U6=SM.aTypedArray,G6=SM.exportTypedArrayMethod;G6("at",function(t){var e=U6(this),n=z6(e),i=N6(t),o=i>=0?i:n+i;return o<0||o>=n?void 0:e[o]})});var ui=f(()=>{"use strict";var bM=dt(),k6=x0(),V6=ts(),J6=be(),L6=k(),B6=Y(),Q6=X(),H6=bM.aTypedArray,q6=bM.exportTypedArrayMethod,$6=B6("".slice),t3=Q6(function(){var r=0;return new Int8Array(2).fill({valueOf:function(){return r++}}),r!==1});q6("fill",function(t){var e=arguments.length;H6(this);var n=$6(J6(this),0,3)==="Big"?V6(t):+t;return L6(k6,this,n,e>1?arguments[1]:void 0,e>2?arguments[2]:void 0)},t3)});var li=f((MV,_M)=>{"use strict";var e3=qe(),n3=xr(),r3=it(),i3=et(),vM=function(r){var t=r===1;return function(e,n,i){for(var o=r3(e),s=n3(o),a=i3(s),u=e3(n,i),l,c;a-- >0;)if(l=s[a],c=u(l,a,o),c)switch(r){case 0:return l;case 1:return a}return t?-1:void 0}};_M.exports={findLast:vM(0),findLastIndex:vM(1)}});var ci=f(()=>{"use strict";var WM=dt(),o3=li().findLast,s3=WM.aTypedArray,a3=WM.exportTypedArrayMethod;a3("findLast",function(t){return o3(s3(this),t,arguments.length>1?arguments[1]:void 0)})});var hi=f(()=>{"use strict";var xM=dt(),u3=li().findLastIndex,l3=xM.aTypedArray,c3=xM.exportTypedArrayMethod;c3("findLastIndex",function(t){return u3(l3(this),t,arguments.length>1?arguments[1]:void 0)})});var pi=f(()=>{"use strict";var YM=E(),EM=k(),$0=dt(),h3=et(),p3=C0(),f3=it(),DM=X(),d3=YM.RangeError,H0=YM.Int8Array,IM=H0&&H0.prototype,XM=IM&&IM.set,m3=$0.aTypedArray,g3=$0.exportTypedArrayMethod,q0=!DM(function(){var r=new Uint8ClampedArray(2);return EM(XM,r,{length:1,0:3},1),r[1]!==3}),y3=q0&&$0.NATIVE_ARRAY_BUFFER_VIEWS&&DM(function(){var r=new H0(2);return r.set(1),r.set("2",1),r[0]!==0||r[1]!==2});g3("set",function(t){m3(this);var e=p3(arguments.length>1?arguments[1]:void 0,1),n=f3(t);if(q0)return EM(XM,this,n,e);var i=this.length,o=h3(n),s=0;if(o+e>i)throw new d3("Wrong length");for(;s<o;)this[e+s]=n[s++]},!q0||y3)});var di=f(()=>{"use strict";var M3=E(),P3=Hr(),tl=X(),j3=ne(),A3=Zo(),RM=dt(),ZM=i0(),T3=o0(),CM=Ir(),OM=s0(),w3=RM.aTypedArray,S3=RM.exportTypedArrayMethod,fi=M3.Uint16Array,ir=fi&&P3(fi.prototype.sort),b3=!!ir&&!(tl(function(){ir(new fi(2),null)})&&tl(function(){ir(new fi(2),{})})),KM=!!ir&&!tl(function(){if(CM)return CM<74;if(ZM)return ZM<67;if(T3)return!0;if(OM)return OM<602;var r=new fi(516),t=Array(516),e,n;for(e=0;e<516;e++)n=e%4,r[e]=515-e,t[e]=e-2*n+3;for(ir(r,function(i,o){return(i/4|0)-(o/4|0)}),e=0;e<516;e++)if(r[e]!==t[e])return!0}),v3=function(r){return function(t,e){return r!==void 0?+r(t,e)||0:e!==e?-1:t!==t?1:t===0&&e===0?1/t>0&&1/e<0?1:-1:t>e}};S3("sort",function(t){return t!==void 0&&j3(t),KM?ir(this,t):A3(w3(this),v3(t))},!KM||b3)});var zM=f((_V,FM)=>{"use strict";var _3=et();FM.exports=function(r,t){for(var e=_3(r),n=new t(e),i=0;i<e;i++)n[i]=r[e-i-1];return n}});var mi=f(()=>{"use strict";var W3=zM(),el=dt(),x3=el.aTypedArray,I3=el.exportTypedArrayMethod,Y3=el.getTypedArrayConstructor;I3("toReversed",function(){return W3(x3(this),Y3(this))})});var gi=f(()=>{"use strict";var ss=dt(),E3=Y(),D3=ne(),X3=N0(),Z3=ss.aTypedArray,C3=ss.getTypedArrayConstructor,O3=ss.exportTypedArrayMethod,K3=E3(ss.TypedArrayPrototype.sort);O3("toSorted",function(t){t!==void 0&&D3(t);var e=Z3(this),n=X3(C3(e),e);return K3(n,t)})});var UM=f((EV,NM)=>{"use strict";var R3=et(),F3=Pt(),z3=RangeError;NM.exports=function(r,t,e,n){var i=R3(r),o=F3(e),s=o<0?i+o:o;if(s>=i||s<0)throw new z3("Incorrect index");for(var a=new t(i),u=0;u<i;u++)a[u]=u===s?n:r[u];return a}});var yi=f(()=>{"use strict";var N3=UM(),nl=dt(),U3=R0(),G3=Pt(),k3=ts(),V3=nl.aTypedArray,J3=nl.getTypedArrayConstructor,L3=nl.exportTypedArrayMethod,B3=!!function(){try{new Int8Array(1).with(2,{valueOf:function(){throw 8}})}catch(r){return r===8}}();L3("with",function(r,t){var e=V3(this),n=G3(r),i=U3(e)?k3(t):+t;return N3(e,J3(e),n,i)},!B3)});var Mi=f(()=>{"use strict";var Q3=C(),H3=E(),q3=qo(),$3=z0(),rl="ArrayBuffer",GM=q3[rl],tX=H3[rl];Q3({global:!0,constructor:!0,forced:tX!==GM},{ArrayBuffer:GM});$3(rl)});var Pi=f(()=>{"use strict";var eX=C(),ol=Hr(),nX=X(),LM=qo(),kM=rt(),VM=Zr(),rX=yn(),sl=LM.ArrayBuffer,il=LM.DataView,BM=il.prototype,JM=ol(sl.prototype.slice),iX=ol(BM.getUint8),oX=ol(BM.setUint8),sX=nX(function(){return!new sl(2).slice(1,void 0).byteLength});eX({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:sX},{slice:function(t,e){if(JM&&e===void 0)return JM(kM(this),t);for(var n=kM(this).byteLength,i=VM(t,n),o=VM(e===void 0?n:e,n),s=new sl(rX(o-i)),a=new il(this),u=new il(s),l=0;i<o;)oX(u,l++,iX(a,i++));return s}})});var al=f((RV,qM)=>{"use strict";var HM=E(),aX=Fr(),uX=we(),QM=HM.ArrayBuffer,lX=HM.TypeError;qM.exports=QM&&aX(QM.prototype,"byteLength","get")||function(r){if(uX(r)!=="ArrayBuffer")throw new lX("ArrayBuffer expected");return r.byteLength}});var ul=f((FV,nP)=>{"use strict";var cX=E(),hX=Hr(),pX=al(),$M=cX.ArrayBuffer,tP=$M&&$M.prototype,eP=tP&&hX(tP.slice);nP.exports=function(r){if(pX(r)!==0||!eP)return!1;try{return eP(r,0,0),!1}catch(t){return!0}}});var ji=f(()=>{"use strict";var fX=F(),dX=Ie(),mX=ul(),rP=ArrayBuffer.prototype;fX&&!("detached"in rP)&&dX(rP,"detached",{configurable:!0,get:function(){return mX(this)}})});var oP=f((UV,iP)=>{"use strict";var gX=ul(),yX=TypeError;iP.exports=function(r){if(gX(r))throw new yX("ArrayBuffer is detached");return r}});var ll=f((GV,sP)=>{"use strict";var Ai=E(),MX=Kn(),PX=we(),as=function(r){return MX.slice(0,r.length)===r};sP.exports=function(){return as("Bun/")?"BUN":as("Cloudflare-Workers")?"CLOUDFLARE":as("Deno/")?"DENO":as("Node.js/")?"NODE":Ai.Bun&&typeof Bun.version=="string"?"BUN":Ai.Deno&&typeof Deno.version=="object"?"DENO":PX(Ai.process)==="process"?"NODE":Ai.window&&Ai.document?"BROWSER":"REST"}()});var uP=f((kV,aP)=>{"use strict";var jX=ll();aP.exports=jX==="NODE"});var cP=f((VV,lP)=>{"use strict";var AX=E(),TX=uP();lP.exports=function(r){if(TX){try{return AX.process.getBuiltinModule(r)}catch(t){}try{return Function('return require("'+r+'")')()}catch(t){}}}});var pl=f((JV,pP)=>{"use strict";var wX=E(),SX=X(),cl=Ir(),hl=ll(),hP=wX.structuredClone;pP.exports=!!hP&&!SX(function(){if(hl==="DENO"&&cl>92||hl==="NODE"&&cl>94||hl==="BROWSER"&&cl>97)return!1;var r=new ArrayBuffer(8),t=hP(r,{transfer:[r]});return r.byteLength!==0||t.byteLength!==8})});var gP=f((LV,mP)=>{"use strict";var gl=E(),bX=cP(),vX=pl(),_X=gl.structuredClone,fP=gl.ArrayBuffer,us=gl.MessageChannel,ml=!1,fl,dP,ls,dl;if(vX)ml=function(r){_X(r,{transfer:[r]})};else if(fP)try{us||(fl=bX("worker_threads"),fl&&(us=fl.MessageChannel)),us&&(dP=new us,ls=new fP(2),dl=function(r){dP.port1.postMessage(null,[r])},ls.byteLength===2&&(dl(ls),ls.byteLength===0&&(ml=dl)))}catch(r){}mP.exports=ml});var Tl=f((BV,wP)=>{"use strict";var Pl=E(),jl=Y(),jP=Fr(),WX=ko(),xX=oP(),IX=al(),yP=gP(),yl=pl(),YX=Pl.structuredClone,AP=Pl.ArrayBuffer,Ml=Pl.DataView,EX=Math.min,Al=AP.prototype,TP=Ml.prototype,DX=jl(Al.slice),MP=jP(Al,"resizable","get"),PP=jP(Al,"maxByteLength","get"),XX=jl(TP.getInt8),ZX=jl(TP.setInt8);wP.exports=(yl||yP)&&function(r,t,e){var n=IX(r),i=t===void 0?n:WX(t),o=!MP||!MP(r),s;if(xX(r),yl&&(r=YX(r,{transfer:[r]}),n===i&&(e||o)))return r;if(n>=i&&(!e||o))s=DX(r,0,i);else{var a=e&&!o&&PP?{maxByteLength:PP(r)}:void 0;s=new AP(i,a);for(var u=new Ml(r),l=new Ml(s),c=EX(i,n),h=0;h<c;h++)ZX(l,h,XX(u,h))}return yl||yP(r),s}});var Ti=f(()=>{"use strict";var CX=C(),SP=Tl();SP&&CX({target:"ArrayBuffer",proto:!0},{transfer:function(){return SP(this,arguments.length?arguments[0]:void 0,!0)}})});var wi=f(()=>{"use strict";var OX=C(),bP=Tl();bP&&OX({target:"ArrayBuffer",proto:!0},{transferToFixedLength:function(){return bP(this,arguments.length?arguments[0]:void 0,!1)}})});var wl=f(()=>{"use strict";var KX=_0(),RX=dt().exportTypedArrayStaticMethod,FX=F0();RX("from",FX,KX)});var Sl=f(()=>{"use strict";var UX=un();UX("Float32",function(r){return function(e,n,i){return r(this,e,n,i)}})});var EP=f(()=>{"use strict";var GX=Do().charAt,kX=jt(),IP=re(),VX=bu(),xP=ho(),YP="String Iterator",JX=IP.set,LX=IP.getterFor(YP);VX(String,"String",function(r){JX(this,{type:YP,string:kX(r),index:0})},function(){var t=LX(this),e=t.string,n=t.index,i;return n>=e.length?xP(void 0,!0):(i=GX(e,n),t.index+=i.length,xP(i,!1))})});var bl=f((IJ,XP)=>{"use strict";var BX=X(),QX=J(),HX=F(),DP=Ne(),qX=QX("iterator");XP.exports=!BX(function(){var r=new URL("b?a=1&b=2&c=3","https://a"),t=r.searchParams,e=new URLSearchParams("a=1&a=2&b=3"),n="";return r.pathname="c%20d",t.forEach(function(i,o){t.delete("b"),n+=o+i}),e.delete("a",2),e.delete("b",void 0),DP&&(!r.toJSON||!e.has("a",1)||e.has("a",2)||!e.has("a",void 0)||e.has("b"))||!t.size&&(DP||!HX)||!t.sort||r.href!=="https://a/c%20d?a=1&c=3"||t.get("c")!=="3"||String(new URLSearchParams("?a=1"))!=="a=1"||!t[qX]||new URL("https://a@b").username!=="a"||new URLSearchParams(new URLSearchParams("a=b")).get("a")!=="b"||new URL("https://\u0442\u0435\u0441\u0442").host!=="xn--e1aybc"||new URL("https://a#\u0431").hash!=="#%D0%B1"||n!=="a1c3"||new URL("https://x",void 0).host!=="x"})});var KP=f((YJ,OP)=>{"use strict";var ZP=F(),$X=Y(),tZ=k(),eZ=X(),vl=pu(),nZ=lu(),rZ=Ya(),iZ=it(),oZ=xr(),or=Object.assign,CP=Object.defineProperty,sZ=$X([].concat);OP.exports=!or||eZ(function(){if(ZP&&or({b:1},or(CP({},"a",{enumerable:!0,get:function(){CP(this,"b",{value:3,enumerable:!1})}}),{b:2})).b!==1)return!0;var r={},t={},e=Symbol("assign detection"),n="abcdefghijklmnopqrst";return r[e]=7,n.split("").forEach(function(i){t[i]=i}),or({},r)[e]!==7||vl(or({},t)).join("")!==n})?function(t,e){for(var n=iZ(t),i=arguments.length,o=1,s=nZ.f,a=rZ.f;i>o;)for(var u=oZ(arguments[o++]),l=s?sZ(vl(u),s(u)):vl(u),c=l.length,h=0,p;c>h;)p=l[h++],(!ZP||tZ(a,u,p))&&(n[p]=u[p]);return n}:or});var FP=f((EJ,RP)=>{"use strict";var aZ=rt(),uZ=jo();RP.exports=function(r,t,e,n){try{return n?t(aZ(e)[0],e[1]):t(e)}catch(i){uZ(r,"throw",i)}}});var NP=f((DJ,zP)=>{"use strict";var lZ=F(),cZ=vt(),hZ=ze();zP.exports=function(r,t,e){lZ?cZ.f(r,t,hZ(0,e)):r[t]=e}});var VP=f((XJ,kP)=>{"use strict";var pZ=qe(),fZ=k(),dZ=it(),mZ=FP(),gZ=K0(),yZ=Ko(),MZ=et(),UP=NP(),PZ=$o(),jZ=ni(),GP=Array;kP.exports=function(t){var e=dZ(t),n=yZ(this),i=arguments.length,o=i>1?arguments[1]:void 0,s=o!==void 0;s&&(o=pZ(o,i>2?arguments[2]:void 0));var a=jZ(e),u=0,l,c,h,p,m,g;if(a&&!(this===GP&&gZ(a)))for(c=n?new this:[],p=PZ(e,a),m=p.next;!(h=fZ(m,p)).done;u++)g=s?mZ(p,o,[h.value,u],!0):h.value,UP(c,u,g);else for(l=MZ(e),c=n?new this(l):GP(l);l>u;u++)g=s?o(e[u],u):e[u],UP(c,u,g);return c.length=u,c}});var ej=f((ZJ,tj)=>{"use strict";var Sn=Y(),_l=2147483647,Si=36,HP=1,Il=26,AZ=38,TZ=700,wZ=72,SZ=128,bZ="-",vZ=/[^\0-\u007E]/,qP=/[.\u3002\uFF0E\uFF61]/g,JP="Overflow: input needs wider integers to process",Wl=Si-HP,LP=RangeError,_Z=Sn(qP.exec),sr=Math.floor,xl=String.fromCharCode,BP=Sn("".charCodeAt),$P=Sn([].join),ln=Sn([].push),WZ=Sn("".replace),xZ=Sn("".split),IZ=Sn("".toLowerCase),YZ=function(r){for(var t=[],e=0,n=r.length;e<n;){var i=BP(r,e++);if(i>=55296&&i<=56319&&e<n){var o=BP(r,e++);(o&64512)===56320?ln(t,((i&1023)<<10)+(o&1023)+65536):(ln(t,i),e--)}else ln(t,i)}return t},QP=function(r){return r+22+75*(r<26)},EZ=function(r,t,e){var n=0;for(r=e?sr(r/TZ):r>>1,r+=sr(r/t);r>Wl*Il>>1;)r=sr(r/Wl),n+=Si;return sr(n+(Wl+1)*r/(r+AZ))},DZ=function(r){var t=[];r=YZ(r);var e=r.length,n=SZ,i=0,o=wZ,s,a;for(s=0;s<r.length;s++)a=r[s],a<128&&ln(t,xl(a));var u=t.length,l=u;for(u&&ln(t,bZ);l<e;){var c=_l;for(s=0;s<r.length;s++)a=r[s],a>=n&&a<c&&(c=a);var h=l+1;if(c-n>sr((_l-i)/h))throw new LP(JP);for(i+=(c-n)*h,n=c,s=0;s<r.length;s++){if(a=r[s],a<n&&++i>_l)throw new LP(JP);if(a===n){for(var p=i,m=Si;;){var g=m<=o?HP:m>=o+Il?Il:m-o;if(p<g)break;var M=p-g,P=Si-g;ln(t,xl(QP(g+M%P))),p=sr(M/P),m+=Si}ln(t,xl(QP(p))),o=EZ(i,h,l===u),i=0,l++}}i++,n++}return $P(t,"")};tj.exports=function(r){var t=[],e=xZ(WZ(IZ(r),qP,"."),"."),n,i;for(n=0;n<e.length;n++)i=e[n],ln(t,_Z(vZ,i)?"xn--"+DZ(i):i);return $P(t,".")}});var bi=f((CJ,nj)=>{"use strict";var XZ=TypeError;nj.exports=function(r,t){if(r<t)throw new XZ("Not enough arguments");return r}});var oj=f(()=>{"use strict";var ZZ=C(),CZ=Y(),OZ=Zr(),KZ=RangeError,rj=String.fromCharCode,ij=String.fromCodePoint,RZ=CZ([].join),FZ=!!ij&&ij.length!==1;ZZ({target:"String",stat:!0,arity:1,forced:FZ},{fromCodePoint:function(t){for(var e=[],n=arguments.length,i=0,o;n>i;){if(o=+arguments[i++],OZ(o,1114111)!==o)throw new KZ(o+" is not a valid code point");e[i]=o<65536?rj(o):rj(((o-=65536)>>10)+55296,o%1024+56320)}return RZ(e,"")}})});var uj=f((RJ,aj)=>{"use strict";var sj=E(),zZ=F(),NZ=Object.getOwnPropertyDescriptor;aj.exports=function(r){if(!zZ)return sj[r];var t=NZ(sj,r);return t&&t.value}});var Rl=f((FJ,Yj)=>{"use strict";_u();oj();var Cl=C(),Aj=E(),Ol=uj(),UZ=Ut(),hs=k(),Qt=Y(),vi=F(),Tj=bl(),wj=Wt(),GZ=Ie(),kZ=W0(),VZ=Ue(),JZ=wu(),Kl=re(),Sj=$r(),Yl=z(),LZ=ot(),BZ=qe(),QZ=be(),HZ=rt(),bj=tt(),lt=jt(),qZ=Mn(),lj=ze(),cj=$o(),$Z=ni(),ps=ho(),ar=bi(),tC=J(),eC=Zo(),nC=tC("iterator"),lr="URLSearchParams",vj=lr+"Iterator",_j=Kl.set,Dt=Kl.getterFor(lr),rC=Kl.getterFor(vj),hj=Ol("fetch"),ms=Ol("Request"),_i=Ol("Headers"),El=ms&&ms.prototype,pj=_i&&_i.prototype,iC=Aj.TypeError,oC=Aj.encodeURIComponent,sC=String.fromCharCode,aC=UZ("String","fromCodePoint"),uC=parseInt,ds=Qt("".charAt),fj=Qt([].join),cn=Qt([].push),Wj=Qt("".replace),lC=Qt([].shift),dj=Qt([].splice),mj=Qt("".split),xj=Qt("".slice),cC=Qt(/./.exec),hC=/\+/g,Dl="\uFFFD",pC=/^[0-9a-f]+$/i,gj=function(r,t){var e=xj(r,t,t+2);return cC(pC,e)?uC(e,16):NaN},fC=function(r){for(var t=0,e=128;e>0&&r&e;e>>=1)t++;return t},dC=function(r){var t=null;switch(r.length){case 1:t=r[0];break;case 2:t=(r[0]&31)<<6|r[1]&63;break;case 3:t=(r[0]&15)<<12|(r[1]&63)<<6|r[2]&63;break;case 4:t=(r[0]&7)<<18|(r[1]&63)<<12|(r[2]&63)<<6|r[3]&63;break}return t>1114111?null:t},yj=function(r){r=Wj(r,hC," ");for(var t=r.length,e="",n=0;n<t;){var i=ds(r,n);if(i==="%"){if(ds(r,n+1)==="%"||n+3>t){e+="%",n++;continue}var o=gj(r,n+1);if(o!==o){e+=i,n++;continue}n+=2;var s=fC(o);if(s===0)i=sC(o);else{if(s===1||s>4){e+=Dl,n++;continue}for(var a=[o],u=1;u<s&&(n++,!(n+3>t||ds(r,n)!=="%"));){var l=gj(r,n+1);if(l!==l){n+=3;break}if(l>191||l<128)break;cn(a,l),n+=2,u++}if(a.length!==s){e+=Dl;continue}var c=dC(a);c===null?e+=Dl:i=aC(c)}}e+=i,n++}return e},mC=/[!'()~]|%20/g,gC={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},yC=function(r){return gC[r]},Mj=function(r){return Wj(oC(r),mC,yC)},Xl=JZ(function(t,e){_j(this,{type:vj,target:Dt(t).entries,index:0,kind:e})},lr,function(){var t=rC(this),e=t.target,n=t.index++;if(!e||n>=e.length)return t.target=null,ps(void 0,!0);var i=e[n];switch(t.kind){case"keys":return ps(i.key,!1);case"values":return ps(i.value,!1)}return ps([i.key,i.value],!1)},!0),Ij=function(r){this.entries=[],this.url=null,r!==void 0&&(bj(r)?this.parseObject(r):this.parseQuery(typeof r=="string"?ds(r,0)==="?"?xj(r,1):r:lt(r)))};Ij.prototype={type:lr,bindURL:function(r){this.url=r,this.update()},parseObject:function(r){var t=this.entries,e=$Z(r),n,i,o,s,a,u,l;if(e)for(n=cj(r,e),i=n.next;!(o=hs(i,n)).done;){if(s=cj(HZ(o.value)),a=s.next,(u=hs(a,s)).done||(l=hs(a,s)).done||!hs(a,s).done)throw new iC("Expected sequence with length 2");cn(t,{key:lt(u.value),value:lt(l.value)})}else for(var c in r)LZ(r,c)&&cn(t,{key:c,value:lt(r[c])})},parseQuery:function(r){if(r)for(var t=this.entries,e=mj(r,"&"),n=0,i,o;n<e.length;)i=e[n++],i.length&&(o=mj(i,"="),cn(t,{key:yj(lC(o)),value:yj(fj(o,"="))}))},serialize:function(){for(var r=this.entries,t=[],e=0,n;e<r.length;)n=r[e++],cn(t,Mj(n.key)+"="+Mj(n.value));return fj(t,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var gs=function(){Sj(this,ur);var t=arguments.length>0?arguments[0]:void 0,e=_j(this,new Ij(t));vi||(this.size=e.entries.length)},ur=gs.prototype;kZ(ur,{append:function(t,e){var n=Dt(this);ar(arguments.length,2),cn(n.entries,{key:lt(t),value:lt(e)}),vi||this.length++,n.updateURL()},delete:function(r){for(var t=Dt(this),e=ar(arguments.length,1),n=t.entries,i=lt(r),o=e<2?void 0:arguments[1],s=o===void 0?o:lt(o),a=0;a<n.length;){var u=n[a];if(u.key===i&&(s===void 0||u.value===s)){if(dj(n,a,1),s!==void 0)break}else a++}vi||(this.size=n.length),t.updateURL()},get:function(t){var e=Dt(this).entries;ar(arguments.length,1);for(var n=lt(t),i=0;i<e.length;i++)if(e[i].key===n)return e[i].value;return null},getAll:function(t){var e=Dt(this).entries;ar(arguments.length,1);for(var n=lt(t),i=[],o=0;o<e.length;o++)e[o].key===n&&cn(i,e[o].value);return i},has:function(t){for(var e=Dt(this).entries,n=ar(arguments.length,1),i=lt(t),o=n<2?void 0:arguments[1],s=o===void 0?o:lt(o),a=0;a<e.length;){var u=e[a++];if(u.key===i&&(s===void 0||u.value===s))return!0}return!1},set:function(t,e){var n=Dt(this);ar(arguments.length,1);for(var i=n.entries,o=!1,s=lt(t),a=lt(e),u=0,l;u<i.length;u++)l=i[u],l.key===s&&(o?dj(i,u--,1):(o=!0,l.value=a));o||cn(i,{key:s,value:a}),vi||(this.size=i.length),n.updateURL()},sort:function(){var t=Dt(this);eC(t.entries,function(e,n){return e.key>n.key?1:-1}),t.updateURL()},forEach:function(t){for(var e=Dt(this).entries,n=BZ(t,arguments.length>1?arguments[1]:void 0),i=0,o;i<e.length;)o=e[i++],n(o.value,o.key,this)},keys:function(){return new Xl(this,"keys")},values:function(){return new Xl(this,"values")},entries:function(){return new Xl(this,"entries")}},{enumerable:!0});wj(ur,nC,ur.entries,{name:"entries"});wj(ur,"toString",function(){return Dt(this).serialize()},{enumerable:!0});vi&&GZ(ur,"size",{get:function(){return Dt(this).entries.length},configurable:!0,enumerable:!0});VZ(gs,lr);Cl({global:!0,constructor:!0,forced:!Tj},{URLSearchParams:gs});!Tj&&Yl(_i)&&(Pj=Qt(pj.has),jj=Qt(pj.set),Zl=function(r){if(bj(r)){var t=r.body,e;if(QZ(t)===lr)return e=r.headers?new _i(r.headers):new _i,Pj(e,"content-type")||jj(e,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),qZ(r,{body:lj(0,lt(t)),headers:lj(0,e)})}return r},Yl(hj)&&Cl({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(t){return hj(t,arguments.length>1?Zl(arguments[1]):{})}}),Yl(ms)&&(fs=function(t){return Sj(this,El),new ms(t,arguments.length>1?Zl(arguments[1]):{})},El.constructor=fs,fs.prototype=El,Cl({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:fs})));var Pj,jj,Zl,fs;Yj.exports={URLSearchParams:gs,getState:Dt}});var Bj=f(()=>{"use strict";EP();var MC=C(),nc=F(),PC=bl(),rc=E(),Ej=qe(),Kt=Y(),As=Wt(),Xt=Ie(),jC=$r(),$l=ot(),ic=KP(),cr=VP(),Ht=Gr(),AC=Do().codeAt,TC=ej(),Ze=jt(),wC=Ue(),SC=bi(),Uj=Rl(),Gj=re(),bC=Gj.set,Ts=Gj.getterFor("URL"),vC=Uj.URLSearchParams,_C=Uj.getState,Wi=rc.URL,tc=rc.TypeError,ws=rc.parseInt,WC=Math.floor,Dj=Math.pow,Ot=Kt("".charAt),qt=Kt(/./.exec),Ii=Kt([].join),xC=Kt(1 .toString),IC=Kt([].pop),pr=Kt([].push),Fl=Kt("".replace),YC=Kt([].shift),EC=Kt("".split),Ei=Kt("".slice),Ss=Kt("".toLowerCase),DC=Kt([].unshift),XC="Invalid authority",zl="Invalid scheme",bn="Invalid host",Xj="Invalid port",kj=/[a-z]/i,ZC=/[\d+-.a-z]/i,ec=/\d/,CC=/^0x/i,OC=/^[0-7]+$/,KC=/^\d+$/,Vj=/^[\da-f]+$/i,RC=/[\0\t\n\r #%/:<>?@[\\\]^|]/,FC=/[\0\t\n\r #/:<>?@[\\\]^|]/,zC=/^[\u0000-\u0020]+/,NC=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,UC=/[\t\n\r]/g,Zt,GC=function(r){var t=EC(r,"."),e,n,i,o,s,a,u;if(t.length&&t[t.length-1]===""&&t.length--,e=t.length,e>4)return r;for(n=[],i=0;i<e;i++){if(o=t[i],o==="")return r;if(s=10,o.length>1&&Ot(o,0)==="0"&&(s=qt(CC,o)?16:8,o=Ei(o,s===8?1:2)),o==="")a=0;else{if(!qt(s===10?KC:s===8?OC:Vj,o))return r;a=ws(o,s)}pr(n,a)}for(i=0;i<e;i++)if(a=n[i],i===e-1){if(a>=Dj(256,5-e))return null}else if(a>255)return null;for(u=IC(n),i=0;i<n.length;i++)u+=n[i]*Dj(256,3-i);return u},kC=function(r){var t=[0,0,0,0,0,0,0,0],e=0,n=null,i=0,o,s,a,u,l,c,h,p=function(){return Ot(r,i)};if(p()===":"){if(Ot(r,1)!==":")return;i+=2,e++,n=e}for(;p();){if(e===8)return;if(p()===":"){if(n!==null)return;i++,e++,n=e;continue}for(o=s=0;s<4&&qt(Vj,p());)o=o*16+ws(p(),16),i++,s++;if(p()==="."){if(s===0||(i-=s,e>6))return;for(a=0;p();){if(u=null,a>0)if(p()==="."&&a<4)i++;else return;if(!qt(ec,p()))return;for(;qt(ec,p());){if(l=ws(p(),10),u===null)u=l;else{if(u===0)return;u=u*10+l}if(u>255)return;i++}t[e]=t[e]*256+u,a++,(a===2||a===4)&&e++}if(a!==4)return;break}else if(p()===":"){if(i++,!p())return}else if(p())return;t[e++]=o}if(n!==null)for(c=e-n,e=7;e!==0&&c>0;)h=t[e],t[e--]=t[n+c-1],t[n+--c]=h;else if(e!==8)return;return t},VC=function(r){for(var t=null,e=1,n=null,i=0,o=0;o<8;o++)r[o]!==0?(i>e&&(t=n,e=i),n=null,i=0):(n===null&&(n=o),++i);return i>e?n:t},xi=function(r){var t,e,n,i;if(typeof r=="number"){for(t=[],e=0;e<4;e++)DC(t,r%256),r=WC(r/256);return Ii(t,".")}if(typeof r=="object"){for(t="",n=VC(r),e=0;e<8;e++)i&&r[e]===0||(i&&(i=!1),n===e?(t+=e?":":"::",i=!0):(t+=xC(r[e],16),e<7&&(t+=":")));return"["+t+"]"}return r},js={},Jj=ic({},js,{" ":1,'"':1,"<":1,">":1,"`":1}),Lj=ic({},Jj,{"#":1,"?":1,"{":1,"}":1}),Nl=ic({},Lj,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),hn=function(r,t){var e=AC(r,0);return e>32&&e<127&&!$l(t,r)?r:encodeURIComponent(r)},ys={ftp:21,file:null,http:80,https:443,ws:80,wss:443},Yi=function(r,t){var e;return r.length===2&&qt(kj,Ot(r,0))&&((e=Ot(r,1))===":"||!t&&e==="|")},Zj=function(r){var t;return r.length>1&&Yi(Ei(r,0,2))&&(r.length===2||(t=Ot(r,2))==="/"||t==="\\"||t==="?"||t==="#")},JC=function(r){return r==="."||Ss(r)==="%2e"},LC=function(r){return r=Ss(r),r===".."||r==="%2e."||r===".%2e"||r==="%2e%2e"},Ul={},Cj={},Gl={},Oj={},Kj={},kl={},Rj={},Fj={},Ms={},Ps={},Vl={},Jl={},Ll={},Bl={},zj={},Ql={},hr={},ye={},Nj={},vn={},Xe={},oc=function(r,t,e){var n=Ze(r),i,o,s;if(t){if(o=this.parse(n),o)throw new tc(o);this.searchParams=null}else{if(e!==void 0&&(i=new oc(e,!0)),o=this.parse(n,null,i),o)throw new tc(o);s=_C(new vC),s.bindURL(this),this.searchParams=s}};oc.prototype={type:"URL",parse:function(r,t,e){var n=this,i=t||Ul,o=0,s="",a=!1,u=!1,l=!1,c,h,p,m;for(r=Ze(r),t||(n.scheme="",n.username="",n.password="",n.host=null,n.port=null,n.path=[],n.query=null,n.fragment=null,n.cannotBeABaseURL=!1,r=Fl(r,zC,""),r=Fl(r,NC,"$1")),r=Fl(r,UC,""),c=cr(r);o<=c.length;){switch(h=c[o],i){case Ul:if(h&&qt(kj,h))s+=Ss(h),i=Cj;else{if(t)return zl;i=Gl;continue}break;case Cj:if(h&&(qt(ZC,h)||h==="+"||h==="-"||h==="."))s+=Ss(h);else if(h===":"){if(t&&(n.isSpecial()!==$l(ys,s)||s==="file"&&(n.includesCredentials()||n.port!==null)||n.scheme==="file"&&!n.host))return;if(n.scheme=s,t){n.isSpecial()&&ys[n.scheme]===n.port&&(n.port=null);return}s="",n.scheme==="file"?i=Bl:n.isSpecial()&&e&&e.scheme===n.scheme?i=Oj:n.isSpecial()?i=Fj:c[o+1]==="/"?(i=Kj,o++):(n.cannotBeABaseURL=!0,pr(n.path,""),i=Nj)}else{if(t)return zl;s="",i=Gl,o=0;continue}break;case Gl:if(!e||e.cannotBeABaseURL&&h!=="#")return zl;if(e.cannotBeABaseURL&&h==="#"){n.scheme=e.scheme,n.path=Ht(e.path),n.query=e.query,n.fragment="",n.cannotBeABaseURL=!0,i=Xe;break}i=e.scheme==="file"?Bl:kl;continue;case Oj:if(h==="/"&&c[o+1]==="/")i=Ms,o++;else{i=kl;continue}break;case Kj:if(h==="/"){i=Ps;break}else{i=ye;continue}case kl:if(n.scheme=e.scheme,h===Zt)n.username=e.username,n.password=e.password,n.host=e.host,n.port=e.port,n.path=Ht(e.path),n.query=e.query;else if(h==="/"||h==="\\"&&n.isSpecial())i=Rj;else if(h==="?")n.username=e.username,n.password=e.password,n.host=e.host,n.port=e.port,n.path=Ht(e.path),n.query="",i=vn;else if(h==="#")n.username=e.username,n.password=e.password,n.host=e.host,n.port=e.port,n.path=Ht(e.path),n.query=e.query,n.fragment="",i=Xe;else{n.username=e.username,n.password=e.password,n.host=e.host,n.port=e.port,n.path=Ht(e.path),n.path.length--,i=ye;continue}break;case Rj:if(n.isSpecial()&&(h==="/"||h==="\\"))i=Ms;else if(h==="/")i=Ps;else{n.username=e.username,n.password=e.password,n.host=e.host,n.port=e.port,i=ye;continue}break;case Fj:if(i=Ms,h!=="/"||Ot(s,o+1)!=="/")continue;o++;break;case Ms:if(h!=="/"&&h!=="\\"){i=Ps;continue}break;case Ps:if(h==="@"){a&&(s="%40"+s),a=!0,p=cr(s);for(var g=0;g<p.length;g++){var M=p[g];if(M===":"&&!l){l=!0;continue}var P=hn(M,Nl);l?n.password+=P:n.username+=P}s=""}else if(h===Zt||h==="/"||h==="?"||h==="#"||h==="\\"&&n.isSpecial()){if(a&&s==="")return XC;o-=cr(s).length+1,s="",i=Vl}else s+=h;break;case Vl:case Jl:if(t&&n.scheme==="file"){i=Ql;continue}else if(h===":"&&!u){if(s==="")return bn;if(m=n.parseHost(s),m)return m;if(s="",i=Ll,t===Jl)return}else if(h===Zt||h==="/"||h==="?"||h==="#"||h==="\\"&&n.isSpecial()){if(n.isSpecial()&&s==="")return bn;if(t&&s===""&&(n.includesCredentials()||n.port!==null))return;if(m=n.parseHost(s),m)return m;if(s="",i=hr,t)return;continue}else h==="["?u=!0:h==="]"&&(u=!1),s+=h;break;case Ll:if(qt(ec,h))s+=h;else if(h===Zt||h==="/"||h==="?"||h==="#"||h==="\\"&&n.isSpecial()||t){if(s!==""){var A=ws(s,10);if(A>65535)return Xj;n.port=n.isSpecial()&&A===ys[n.scheme]?null:A,s=""}if(t)return;i=hr;continue}else return Xj;break;case Bl:if(n.scheme="file",h==="/"||h==="\\")i=zj;else if(e&&e.scheme==="file")switch(h){case Zt:n.host=e.host,n.path=Ht(e.path),n.query=e.query;break;case"?":n.host=e.host,n.path=Ht(e.path),n.query="",i=vn;break;case"#":n.host=e.host,n.path=Ht(e.path),n.query=e.query,n.fragment="",i=Xe;break;default:Zj(Ii(Ht(c,o),""))||(n.host=e.host,n.path=Ht(e.path),n.shortenPath()),i=ye;continue}else{i=ye;continue}break;case zj:if(h==="/"||h==="\\"){i=Ql;break}e&&e.scheme==="file"&&!Zj(Ii(Ht(c,o),""))&&(Yi(e.path[0],!0)?pr(n.path,e.path[0]):n.host=e.host),i=ye;continue;case Ql:if(h===Zt||h==="/"||h==="\\"||h==="?"||h==="#"){if(!t&&Yi(s))i=ye;else if(s===""){if(n.host="",t)return;i=hr}else{if(m=n.parseHost(s),m)return m;if(n.host==="localhost"&&(n.host=""),t)return;s="",i=hr}continue}else s+=h;break;case hr:if(n.isSpecial()){if(i=ye,h!=="/"&&h!=="\\")continue}else if(!t&&h==="?")n.query="",i=vn;else if(!t&&h==="#")n.fragment="",i=Xe;else if(h!==Zt&&(i=ye,h!=="/"))continue;break;case ye:if(h===Zt||h==="/"||h==="\\"&&n.isSpecial()||!t&&(h==="?"||h==="#")){if(LC(s)?(n.shortenPath(),h!=="/"&&!(h==="\\"&&n.isSpecial())&&pr(n.path,"")):JC(s)?h!=="/"&&!(h==="\\"&&n.isSpecial())&&pr(n.path,""):(n.scheme==="file"&&!n.path.length&&Yi(s)&&(n.host&&(n.host=""),s=Ot(s,0)+":"),pr(n.path,s)),s="",n.scheme==="file"&&(h===Zt||h==="?"||h==="#"))for(;n.path.length>1&&n.path[0]==="";)YC(n.path);h==="?"?(n.query="",i=vn):h==="#"&&(n.fragment="",i=Xe)}else s+=hn(h,Lj);break;case Nj:h==="?"?(n.query="",i=vn):h==="#"?(n.fragment="",i=Xe):h!==Zt&&(n.path[0]+=hn(h,js));break;case vn:!t&&h==="#"?(n.fragment="",i=Xe):h!==Zt&&(h==="'"&&n.isSpecial()?n.query+="%27":h==="#"?n.query+="%23":n.query+=hn(h,js));break;case Xe:h!==Zt&&(n.fragment+=hn(h,Jj));break}o++}},parseHost:function(r){var t,e,n;if(Ot(r,0)==="["){if(Ot(r,r.length-1)!=="]"||(t=kC(Ei(r,1,-1)),!t))return bn;this.host=t}else if(this.isSpecial()){if(r=TC(r),qt(RC,r)||(t=GC(r),t===null))return bn;this.host=t}else{if(qt(FC,r))return bn;for(t="",e=cr(r),n=0;n<e.length;n++)t+=hn(e[n],js);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||this.scheme==="file"},includesCredentials:function(){return this.username!==""||this.password!==""},isSpecial:function(){return $l(ys,this.scheme)},shortenPath:function(){var r=this.path,t=r.length;t&&(this.scheme!=="file"||t!==1||!Yi(r[0],!0))&&r.length--},serialize:function(){var r=this,t=r.scheme,e=r.username,n=r.password,i=r.host,o=r.port,s=r.path,a=r.query,u=r.fragment,l=t+":";return i!==null?(l+="//",r.includesCredentials()&&(l+=e+(n?":"+n:"")+"@"),l+=xi(i),o!==null&&(l+=":"+o)):t==="file"&&(l+="//"),l+=r.cannotBeABaseURL?s[0]:s.length?"/"+Ii(s,"/"):"",a!==null&&(l+="?"+a),u!==null&&(l+="#"+u),l},setHref:function(r){var t=this.parse(r);if(t)throw new tc(t);this.searchParams.update()},getOrigin:function(){var r=this.scheme,t=this.port;if(r==="blob")try{return new fr(r.path[0]).origin}catch(e){return"null"}return r==="file"||!this.isSpecial()?"null":r+"://"+xi(this.host)+(t!==null?":"+t:"")},getProtocol:function(){return this.scheme+":"},setProtocol:function(r){this.parse(Ze(r)+":",Ul)},getUsername:function(){return this.username},setUsername:function(r){var t=cr(Ze(r));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var e=0;e<t.length;e++)this.username+=hn(t[e],Nl)}},getPassword:function(){return this.password},setPassword:function(r){var t=cr(Ze(r));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var e=0;e<t.length;e++)this.password+=hn(t[e],Nl)}},getHost:function(){var r=this.host,t=this.port;return r===null?"":t===null?xi(r):xi(r)+":"+t},setHost:function(r){this.cannotBeABaseURL||this.parse(r,Vl)},getHostname:function(){var r=this.host;return r===null?"":xi(r)},setHostname:function(r){this.cannotBeABaseURL||this.parse(r,Jl)},getPort:function(){var r=this.port;return r===null?"":Ze(r)},setPort:function(r){this.cannotHaveUsernamePasswordPort()||(r=Ze(r),r===""?this.port=null:this.parse(r,Ll))},getPathname:function(){var r=this.path;return this.cannotBeABaseURL?r[0]:r.length?"/"+Ii(r,"/"):""},setPathname:function(r){this.cannotBeABaseURL||(this.path=[],this.parse(r,hr))},getSearch:function(){var r=this.query;return r?"?"+r:""},setSearch:function(r){r=Ze(r),r===""?this.query=null:(Ot(r,0)==="?"&&(r=Ei(r,1)),this.query="",this.parse(r,vn)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var r=this.fragment;return r?"#"+r:""},setHash:function(r){if(r=Ze(r),r===""){this.fragment=null;return}Ot(r,0)==="#"&&(r=Ei(r,1)),this.fragment="",this.parse(r,Xe)},update:function(){this.query=this.searchParams.serialize()||null}};var fr=function(t){var e=jC(this,ct),n=SC(arguments.length,1)>1?arguments[1]:void 0,i=bC(e,new oc(t,!1,n));nc||(e.href=i.serialize(),e.origin=i.getOrigin(),e.protocol=i.getProtocol(),e.username=i.getUsername(),e.password=i.getPassword(),e.host=i.getHost(),e.hostname=i.getHostname(),e.port=i.getPort(),e.pathname=i.getPathname(),e.search=i.getSearch(),e.searchParams=i.getSearchParams(),e.hash=i.getHash())},ct=fr.prototype,Ct=function(r,t){return{get:function(){return Ts(this)[r]()},set:t&&function(e){return Ts(this)[t](e)},configurable:!0,enumerable:!0}};nc&&(Xt(ct,"href",Ct("serialize","setHref")),Xt(ct,"origin",Ct("getOrigin")),Xt(ct,"protocol",Ct("getProtocol","setProtocol")),Xt(ct,"username",Ct("getUsername","setUsername")),Xt(ct,"password",Ct("getPassword","setPassword")),Xt(ct,"host",Ct("getHost","setHost")),Xt(ct,"hostname",Ct("getHostname","setHostname")),Xt(ct,"port",Ct("getPort","setPort")),Xt(ct,"pathname",Ct("getPathname","setPathname")),Xt(ct,"search",Ct("getSearch","setSearch")),Xt(ct,"searchParams",Ct("getSearchParams")),Xt(ct,"hash",Ct("getHash","setHash")));As(ct,"toJSON",function(){return Ts(this).serialize()},{enumerable:!0});As(ct,"toString",function(){return Ts(this).serialize()},{enumerable:!0});Wi&&(Hl=Wi.createObjectURL,ql=Wi.revokeObjectURL,Hl&&As(fr,"createObjectURL",Ej(Hl,Wi)),ql&&As(fr,"revokeObjectURL",Ej(ql,Wi)));var Hl,ql;wC(fr,"URL");MC({global:!0,constructor:!0,forced:!PC,sham:!nc},{URL:fr})});var Qj=f(()=>{"use strict";Bj()});var Hj=f(()=>{"use strict";var BC=C(),QC=k();BC({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return QC(URL.prototype.toString,this)}})});var qj=f(()=>{"use strict";Rl()});var nA=f(()=>{"use strict";var HC=Wt(),bs=Y(),$j=jt(),qC=bi(),eA=URLSearchParams,vs=eA.prototype,$C=bs(vs.append),tA=bs(vs.delete),t4=bs(vs.forEach),e4=bs([].push),sc=new eA("a=1&a=2&b=3");sc.delete("a",1);sc.delete("b",void 0);sc+""!="a=2"&&HC(vs,"delete",function(r){var t=arguments.length,e=t<2?void 0:arguments[1];if(t&&e===void 0)return tA(this,r);var n=[];t4(this,function(h,p){e4(n,{key:p,value:h})}),qC(t,1);for(var i=$j(r),o=$j(e),s=0,a=0,u=!1,l=n.length,c;s<l;)c=n[s++],u||c.key===i?(u=!0,tA(this,c.key)):a++;for(;a<l;)c=n[a++],c.key===i&&c.value===o||$C(this,c.key,c.value)},{enumerable:!0,unsafe:!0})});var sA=f(()=>{"use strict";var n4=Wt(),iA=Y(),r4=jt(),i4=bi(),oA=URLSearchParams,ac=oA.prototype,o4=iA(ac.getAll),s4=iA(ac.has),rA=new oA("a=1");(rA.has("a",2)||!rA.has("a",void 0))&&n4(ac,"has",function(t){var e=arguments.length,n=e<2?void 0:arguments[1];if(e&&n===void 0)return s4(this,t);var i=o4(this,t);i4(e,1);for(var o=r4(n),s=0;s<i.length;)if(i[s++]===o)return!0;return!1},{enumerable:!0,unsafe:!0})});var aA=f(()=>{"use strict";var a4=F(),u4=Y(),l4=Ie(),uc=URLSearchParams.prototype,c4=u4(uc.forEach);a4&&!("size"in uc)&&l4(uc,"size",{get:function(){var t=0;return c4(this,function(){t++}),t},configurable:!0,enumerable:!0})});var uA=f(()=>{"use strict";var h4=un();h4("Int8",function(r){return function(e,n,i){return r(this,e,n,i)}})});var lA=f(()=>{"use strict";var p4=un();p4("Uint32",function(r){return function(e,n,i){return r(this,e,n,i)}})});var cA=f(()=>{"use strict";var f4=un();f4("Int16",function(r){return function(e,n,i){return r(this,e,n,i)}})});var hA=f(()=>{"use strict";var d4=un();d4("Int32",function(r){return function(e,n,i){return r(this,e,n,i)}})});var lc=f(()=>{"use strict";var m4=un();m4("Uint16",function(r){return function(e,n,i){return r(this,e,n,i)}})});var Zs=f(()=>{"use strict";var p9=C(),f9=it(),d9=et(),m9=cu(),g9=n0(),y9=so(),M9=[].unshift(0)!==1,P9=function(){try{Object.defineProperty([],"length",{writable:!1}).unshift()}catch(r){return r instanceof TypeError}},j9=M9||!P9();p9({target:"Array",proto:!0,arity:1,forced:j9},{unshift:function(t){var e=f9(this),n=d9(e),i=arguments.length;if(i){y9(n+i);for(var o=n;o--;){var s=o+i;o in e?e[s]=e[o]:g9(e,s)}for(var a=0;a<i;a++)e[a]=arguments[a]}return m9(e,n+i)}})});var t1=f((e5,$A)=>{"use strict";var vO=E();$A.exports=vO.Promise});var r1=f((n5,n1)=>{"use strict";var e1=rt(),_O=O0(),WO=Zn(),xO=J(),IO=xO("species");n1.exports=function(r,t){var e=e1(r).constructor,n;return e===void 0||WO(n=e1(e)[IO])?t:_O(n)}});var s1=f((r5,o1)=>{"use strict";var i1=ne(),YO=TypeError,EO=function(r){var t,e;this.promise=new r(function(n,i){if(t!==void 0||e!==void 0)throw new YO("Bad Promise constructor");t=n,e=i}),this.resolve=i1(t),this.reject=i1(e)};o1.exports.f=function(r){return new EO(r)}});var u1=f((i5,a1)=>{"use strict";var DO=rt(),XO=tt(),ZO=s1();a1.exports=function(r,t){if(DO(r),XO(t)&&t.constructor===r)return t;var e=ZO.f(r),n=e.resolve;return n(t),e.promise}});var Ac=f(()=>{"use strict";var CO=C(),OO=Ne(),$s=t1(),KO=X(),c1=Ut(),h1=z(),RO=r1(),l1=u1(),FO=Wt(),jc=$s&&$s.prototype,zO=!!$s&&KO(function(){jc.finally.call({then:function(){}},function(){})});CO({target:"Promise",proto:!0,real:!0,forced:zO},{finally:function(r){var t=RO(this,c1("Promise")),e=h1(r);return this.then(e?function(n){return l1(t,r()).then(function(){return n})}:r,e?function(n){return l1(t,r()).then(function(){throw n})}:r)}});!OO&&h1($s)&&(Pc=c1("Promise").prototype.finally,jc.finally!==Pc&&FO(jc,"finally",Pc,{unsafe:!0}));var Pc});var G1=f(()=>{"use strict";var IR=C(),YR=li().findLastIndex,ER=Kr();IR({target:"Array",proto:!0},{findLastIndex:function(t){return YR(this,t,arguments.length>1?arguments[1]:void 0)}});ER("findLastIndex")});var k1=f(()=>{"use strict";var DR=C(),XR=li().findLast,ZR=Kr();DR({target:"Array",proto:!0},{findLast:function(t){return XR(this,t,arguments.length>1?arguments[1]:void 0)}});ZR("findLast")});function T(){return T=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},T.apply(this,arguments)}var PH=d(Z(),1),jH=d(v(),1),AH=d(Vr(),1);import{EventDispatcher as _K,Vector3 as WK}from"three";var W5=d(v(),1);var cN=d(ie(),1),hN=d(oe(),1),pN=d(se(),1),fN=d(ae(),1),dN=d(ue(),1),mN=d(le(),1),gN=d(ce(),1),yN=d(v(),1),H=class{requestAnimationFrame(t){let e=window.requestAnimationFrame(()=>{this.tasks.requestAnimation.delete(e),t()});return this.tasks.requestAnimation.add(e),e}cancelAnimationFrame(t){this.tasks.requestAnimation.delete(t),window.cancelAnimationFrame(t)}setTimeout(t,e){let n=window.setTimeout(()=>{this.tasks.timeout.delete(n),t()},e);return this.tasks.timeout.add(n),n}clearTimeout(t){this.tasks.timeout.delete(t),window.clearTimeout(t)}setInterval(t,e){let n=window.setInterval(()=>{t()},e);return this.tasks.interval.add(n),n}clearInterval(t){this.tasks.interval.delete(t),window.clearInterval(t)}dispose(){this.tasks.requestAnimation.forEach(t=>{window.cancelAnimationFrame(t)}),this.tasks.requestAnimation.clear(),this.tasks.timeout.forEach(t=>{window.clearTimeout(t)}),this.tasks.timeout.clear(),this.tasks.interval.forEach(t=>{window.clearInterval(t)}),this.tasks.interval.clear()}constructor(){this.tasks={requestAnimation:new Set,timeout:new Set,interval:new Set}}};var PN=d(v(),1),jN=d(Z(),1);import{Shape as sx,Group as ax,DirectionalLight as ux,AmbientLight as lx,Path as cx,Vector2 as om}from"three";function sm(){let r=new ax,t=new lx(16777215,2.6);return r.add(t),r}function he(r,t){t===void 0&&(t=[]);let e=new sx(r.map(n=>new om(...n)));return t.length&&t.forEach(n=>{var i=new cx(n.map(o=>new om(...o)));e.holes.push(i)}),e}function am(r,t){r===void 0&&(r=16777215),t===void 0&&(t=1);let e=new ux(r,t);return e.castShadow=!0,e.shadow.radius=8,e.shadow.bias=-.001,e.shadow.mapSize.set(256,256),e.shadow.camera.left=-200,e.shadow.camera.right=200,e.shadow.camera.top=200,e.shadow.camera.bottom=-200,e}function L(r,t){if(t&&r.children&&r.children.length&&r.children.forEach(e=>{L(e,t)}),r.isMesh){let e=r;e.geometry&&e.geometry.dispose(),e.material&&(Array.isArray(e.material)?e.material.forEach(n=>{n.dispose()}):e.material.dispose())}r.isLight&&(r.dispose==null||r.dispose.call(r))}var YN=d(pe(),1);function Fu(r){return/[\u4E00-\u9FA5]+/g.test(r)}var DN=d(v(),1);import{Vector3 as bo,Vector2 as ve,Matrix3 as So}from"three";import{point as Zx,featureCollection as Cx,center as Ox}from"@turf/turf";function W(r,t,e,n){let i=r.clone().project(t),o=e/2,s=n/2,a=Math.round(i.x*o+o),u=Math.round(-i.y*s+s);return{x:a,y:u}}function CN(r,t,e,n,i){if(!i)return null;e=Math.min(1,e),n=Math.min(1,n);let o=r/e*2-1,s=1-t/n*2;return new bo(o,s,0).unproject(i)}function vo(r){let t=Cx(r.map(n=>Zx(n)));return Ox(t).geometry.coordinates}function Be(r,t,e){return r.x>=t.x&&r.x<=e.x&&r.y>=t.y&&r.y<=e.y}function ON(r){let t=0,e=new bo;for(let n=1;n<r.length;n++){let i=new bo(r[n-1][0],r[n-1][1],0),o=new bo(r[n][0],r[n][1],0),s=o.distanceTo(i);s>t&&(t=s,e=o.clone().sub(i).normalize())}return e}function K(r,t){return Math.sqrt((t[0]-r[0])**2+(t[1]-r[1])**2)}function xt(r){let t=0;for(let e=0;e<r.length-1;e++)t+=K(r[e],r[e+1]);return t}function _o(r,t,e){let n=new ve(t[0]-r[0],t[1]-r[1]),i=new ve(t[0]-e[0],t[1]-e[1]),s=n.angleTo(i)*180/Math.PI,a=new ve(t[0]-r[0],t[1]-r[1]);return new ve(e[0]-r[0],e[1]-r[1]).cross(a)>0?s:-s}function Pm(r,t){let e=Math.min(K(r[0][0],r[0][1]),K(r[0][2],r[0][1]))-1;t||(t=vo(r[0]));let n=Kx(t,e),i=new ve(r[0][0][0],r[0][0][1]),o=new ve(r[0][1][0],r[0][1][1]),s=new ve(r[0][2][0],r[0][2][1]),u=(i.distanceTo(o)>o.distanceTo(s)?o.clone().sub(i):s.clone().sub(o)).angleTo(new ve(0,1)),l=new So;return l.multiply(new So().translate(t[0],t[1])).multiply(new So().rotate(u)).multiply(new So().translate(-t[0],-t[1])),[n.map(c=>{let h=new ve(c[0],c[1]).applyMatrix3(l);return[h.x,h.y]})]}function Kx(r,t){let e=t/2;return[[r[0]-e,r[1]+e],[r[0]+e,r[1]+e],[r[0]+e,r[1]-e],[r[0]-e,r[1]-e],[r[0]-e,r[1]+e]]}function _e(r,t){let e=0,n=1/0,[i,o]=t;for(let s=0;s<r.length-1;s++){let[a,u]=r[s],[l,c]=r[s+1],h=Math.min(a,l)<=i&&i<=Math.max(a,l),p=Math.min(u,c)<=o&&o<=Math.max(u,c);if(h&&p){let m=Math.abs((l-a)*(o-u)-(c-u)*(i-a));m<n&&(n=m,e=s)}}return e}function jm(r,t){let e=r[0],n=r[1],i=!1;for(let o=0,s=t.length-1;o<t.length;s=o++){let a=t[o][0],u=t[o][1],l=t[s][0],c=t[s][1];u>n!=c>n&&e<(l-a)*(n-u)/(c-u)+a&&(i=!i)}return i}var zN=d(Am(),1);function kn(r,t){return new Proxy(r,{get:(e,n,i)=>Reflect.get(e,n,i),set:(e,n,i,o)=>{let s=Reflect.get(e,n,o),a=Reflect.set(e,n,i,o);return s!==i&&t.dispatchEvent({type:"change-"+n,value:i}),a}})}var $N=d(v(),1),tU=d(Uu(),1);function It(r,t){return Promise.race([r,new Promise((e,n)=>{setTimeout(()=>n(new Error("Promise timeout")),t)})])}function Io(r){return document.createElementNS("http://www.w3.org/2000/svg",r)}function Qm(r,t){let e=Io("svg");return e.setAttribute("width",r),e.setAttribute("height",t),e.style.cssText="position: absolute; left: 0; top: 0; pointer-events: none;",e}function Jr(r,t){r===void 0&&(r="2");let e=Io("circle");return e.setAttribute("r",r),e.setAttribute("fill",t),e}function Yo(r){let t=Io("line");return t.setAttribute("stroke",r),t}function Qe(r,t){let e=Io("rect");return e.setAttribute("stroke",r),e.setAttribute("fill",t),e}function An(r,t,e){r.setAttribute("cx",""+t),r.setAttribute("cy",""+e)}function Jt(r,t,e){t&&(r.setAttribute("x1",""+t.x),r.setAttribute("y1",""+t.y)),e&&(r.setAttribute("x2",""+e.x),r.setAttribute("y2",""+e.y))}function st(r,t,e,n,i){r.setAttribute("x",""+t),r.setAttribute("y",""+e),r.setAttribute("width",""+n),r.setAttribute("height",""+i)}function Hm(){return Promise.resolve()}function Eo(){return new Promise(r=>{requestAnimationFrame(r)})}function qm(r){return r===void 0&&(r=1),new Promise(t=>{function e(){r<=0?t(!0):(r--,window.requestAnimationFrame(e))}window.requestAnimationFrame(e)})}var gU=d(Lr(),1),yU=d(pe(),1),MU=d(_2(),1);function PU(r){return parseInt(r.replace("#","0x"),16)}function jU(r,t){let e=parseInt(r.substring(1,3),16),n=parseInt(r.substring(3,5),16),i=parseInt(r.substring(5,7),16),o=Math.round(e*t),s=Math.round(n*t),a=Math.round(i*t);return"#"+(1<<24|o<<16|s<<8|a).toString(16).slice(1)}function We(r,t){t===void 0&&(t=.85);let e,n,i;if(r.startsWith("#"))e=parseInt(r.substring(1,3),16),n=parseInt(r.substring(3,5),16),i=parseInt(r.substring(5,7),16);else{let s=r.slice(4,-1).split(",");e=parseInt(s[0].trim()),n=parseInt(s[1].trim()),i=parseInt(s[2].trim())}return e=Math.min(Math.floor(e*t),255),n=Math.min(Math.floor(n*t),255),i=Math.min(Math.floor(i*t),255),"#"+((1<<24)+(e<<16)+(n<<8)+i).toString(16).slice(1)}function t0(r,t){r=r.replace(/^#/,"");let e=parseInt(r.substring(0,2),16),n=parseInt(r.substring(2,4),16),i=parseInt(r.substring(4,6),16);return t!==void 0?"rgba("+e+", "+n+", "+i+", "+t+")":"rgb("+e+", "+n+", "+i+")"}var TU=d(pe(),1),Jn=navigator.userAgent.toUpperCase().indexOf("MAC")>=0,W2=(navigator.userAgent||"").toLocaleLowerCase(),Br=/ios|iphone/i.test(W2),wU=/android|adr|linux/gi.test(W2);function Ln(r){return Jn?r==="Meta":r==="Control"}var _U=d(ie(),1),WU=d(oe(),1),xU=d(se(),1),IU=d(ae(),1),YU=d(ue(),1),EU=d(le(),1),DU=d(ce(),1),XU=d(v(),1),e0="__once__",x2=class{on(t,e){if(typeof e!="function")return;let n=this.events.get(t);return n?n.add(e):this.events.set(t,new Set([e]))}once(t,e){if(typeof e!="function")return;let n=""+e0+t,i=this.events.get(n);return i?i.add(e):this.events.set(n,new Set([e]))}off(t,e){let n=this.events.get(t),i=this.events.get(""+e0+t);!n&&!i||(e===void 0&&(n==null||n.clear(),i==null||i.clear()),n!=null&&n.has(e)&&n.delete(e),i!=null&&i.has(e)&&i.delete(e))}offAll(){this.events.clear()}emit(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i<e;i++)n[i-1]=arguments[i];let o=this.events.get(t),s=this.events.get(""+e0+t);!o&&!s||(o==null||o.forEach(a=>{typeof a=="function"&&a(...n)}),s==null||s.forEach(a=>{typeof a=="function"&&a(...n)}),s==null||s.clear())}constructor(){this.events=new Map}};var at=function(r){return r.SWITCH_FLOOR_BEFORE="switch_floor_before",r.SWITCH_FLOOR_AFTER="switch_floor_after",r}({});var kU=d(Co(),1);function Bn(r){return Object.keys(r).sort().map(t=>t+"="+r[t]).join("&")}function JU(r,t){return new Promise((e,n)=>{let i=new XMLHttpRequest;i.open("GET",r,!0),Object.keys(t.headers||{}).forEach(o=>{i.setRequestHeader(o,t.headers[o])}),t.responseType&&(i.responseType=t.responseType),i.onload=()=>{if(i.status>=200&&i.status<300)if(t.responseType==="arraybuffer")e(i.response);else try{let o=JSON.parse(i.responseText);e(o)}catch(o){n(o)}else n(i.statusText)},i.onerror=()=>{n(i.statusText)},i.send()})}var HU=d(v(),1),qU=d(Z(),1),tg=d($2(),1);import{Vector2 as Qr}from"three";function bY(r,t){let e=r.clone().normalize(),n=t.clone().normalize();return Math.acos(e.dot(n))}function vY(r){let t=0;return r.reduce((e,n)=>{let[i,o]=e,[s,a]=n;return t+=Math.sqrt((s-i)**2+(a-o)**2),[s,a]}),t/r.length}function eg(r,t){if(t===void 0&&(t=.25),vY(r)<t)return r;let e=(0,tg.default)(r);return eg(e,t)}function Oo(r,t,e,n,i,o){t===void 0&&(t=!1),e===void 0&&(e=!0),n===void 0&&(n=5),i===void 0&&(i=150),o===void 0&&(o=3);let s=[],a=!t;if(s.push(r[0]),r.length<2)return s;for(let l=0;l<r.length-2;l+=1){let c=r[l],h=r[l+1],p=r[l+2],m=new Qr(c[0]-h[0],c[1]-h[1]),g=new Qr(p[0]-h[0],p[1]-h[1]),M=bY(m,g)/Math.PI*180,P=m.length()+g.length();(!a||M<i&&P>.01||P>n)&&(s.push(r[l+1]),a=!0)}if(s.push(r[r.length-1]),!e)return s;let u=[];u.push(s[0]);for(let l=0;l<s.length-2;l+=1){let c=new Qr(s[l][0],s[l][1]),h=new Qr(s[l+1][0],s[l+1][1]),p=new Qr(s[l+2][0],s[l+2][1]),m=c.distanceTo(h)/2,g=p.distanceTo(h)/2,M=h.clone(),P=h.clone();M.add(c.clone().sub(h).normalize().multiplyScalar(m>o?o/2:m)),P.add(p.clone().sub(h).normalize().multiplyScalar(g>o?o/2:g));let A=[[M.x,M.y],[h.x,h.y],[P.x,P.y]];u.push(...eg(A,o/25))}return u.push(s[s.length-1]),_Y(u)}function _Y(r){if(r.length<=1)return r;let t=[],e;return r.forEach(n=>{let[i,o]=n;e?i===e[0]&&o===e[1]||(e=[i,o],t.push([i,o])):(e=[i,o],t.push([i,o]))}),t}function ng(r,t,e){let n=Math.sqrt((e[0]-t[0])**2+(e[1]-t[1])**2);if(n===0)return{distance:Math.sqrt((r[0]-t[0])**2+(r[1]-t[1])**2),closestPoint:t.slice(0)};let i=Math.max(0,Math.min(1,((r[0]-t[0])*(e[0]-t[0])+(r[1]-t[1])*(e[1]-t[1]))/n**2)),o=[t[0]+i*(e[0]-t[0]),t[1]+i*(e[1]-t[1])];return{distance:Math.sqrt((r[0]-o[0])**2+(r[1]-o[1])**2),closestPoint:o}}function eG(r,t,e){let[n,i]=r,[o,s]=t,a=Math.sqrt(Math.pow(o-n,2)+Math.pow(s-i,2));if(a===0||a<e)return[...t];let u=e/a,l=n+(o-n)*u,c=i+(s-i)*u;return[l,c]}var xe=function(r){return r.START="start",r.END="end",r.FRONT="front",r.RIGHT="right",r.LEFT="left",r.RIGHT_FRONT="right_front",r.LEFT_FRONT="left_front",r.RIGHT_BACK="right_back",r.LEFT_BACK="left_back",r}({});function u0(r,t,e){let n=_o(r,t,e);return 180-Math.abs(n)<15?"front":n>135?"right_front":n<-135?"left_front":n<=135&&n>=60?"right":n>=-135&&n<=-60?"left":n<60&&n>0?"right_back":n>-60&&n<0?"left_back":"front"}function nG(r){if(!r.length)return[];if(r.length===1)return[{direction:"start",distance:0,points:r}];let t=[{direction:"start",distance:K(r[0],r[1]),points:[r[0],r[1]]}];for(let e=2;e<r.length;e++){let n=u0(r[e-2],r[e-1],r[e]);if(n==="front"){let i=t[t.length-1],o=K(r[e-1],r[e]);i.distance+=o,e!==2&&i.points.push(r[e-1])}else t.push({direction:n,distance:K(r[e-1],r[e]),points:[r[e-1],r[e]]})}return t.push({direction:"end",distance:0,points:[r[r.length-1]]}),t}function rg(r,t){if(r.length<2)return-1;let e=0;for(let n=1;n<r.length;n++){let i=r[n-1],o=r[n],s=[t[0]-i[0],t[1]-i[1]],a=[o[0]-i[0],o[1]-i[1]],u=Math.min(o[0],i[0])<=t[0]&&t[0]<=Math.max(o[0],i[0]),l=Math.min(o[1],i[1])<=t[1]&&t[1]<=Math.max(o[1],i[1]);if(u&&l){let c=s[0]*a[1]-s[1]*a[0];if(Math.abs(c)<1e-6){let h=Math.sqrt((t[0]-i[0])**2+(t[1]-i[1])**2);return e+h}}e+=Math.sqrt((o[0]-i[0])**2+(o[1]-i[1])**2)}return-1}function Qn(r,t){if(r.length<2){var e;return(e=r[0])!=null?e:null}let n=0;for(let i=1;i<r.length;i++){let o=r[i-1],s=r[i],a=Math.sqrt((s[0]-o[0])**2+(s[1]-o[1])**2);if(n+=a,n>=t){let u=(t-(n-a))/a,l=o[0]+(s[0]-o[0])*u,c=o[1]+(s[1]-o[1])*u;return[l,c]}}return null}var cG=d(Z(),1),hG=d(v(),1),pG=d(pe(),1),de=d(h0(),1);var Yt="___",Mg=class{initRoute(t){this.clear(),this.roadInfo=t,t.length&&(t.forEach(e=>{e.points.forEach(n=>{let i=""+e.floor+Yt+n.id;if(this.pointMap.set(i,n),this.nodeMap.set(""+n.floor+Yt+n.nodeId,i),n.type==="straightLadder"){let o=this.straightLadderMap.get(n.name)||[];o.push(T({},n)),this.straightLadderMap.set(n.name,o)}if(n.type==="staircase"){let o=this.staircaseMap.get(n.name)||[];o.push(T({},n)),this.staircaseMap.set(n.name,o)}if(n.type==="escalator"){let o=this.escalatorMap.get(n.name)||{};n.escalatorDirection==="exit"?o.end={floor:n.floor,id:n.id}:o.start={floor:n.floor,id:n.id},this.escalatorMap.set(n.name,o)}if(n.type==="facility"){let o=this.facilityMap.get(n.targetId)||[];o.push(T({},n)),this.facilityMap.set(n.targetId,o)}}),e.lines.filter(n=>n.direction!=="no").forEach(n=>{var i,o;let s=""+e.floor+Yt+n.from,a=""+e.floor+Yt+n.to,u=(i=this.pointMap.get(s))==null?void 0:i.cds,l=(o=this.pointMap.get(a))==null?void 0:o.cds;if(u!=null&&u.length&&(l!=null&&l.length)){let c=K(u,l);this.addLineItem(s,a,c),n.direction==="double"&&this.addLineItem(a,s,c)}})}),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute())}addLineItem(t,e,n,i){i===void 0&&(i=this.lineMap);let o=i.get(t)||new Map;o.set(e,n),i.set(t,o)}addFacilityToLineMap(t,e,n,i){[...this.straightLadderMap,...this.staircaseMap].forEach(o=>{let[s,a]=o;if(!(a.length<2))for(let c=0;c<a.length;c++){let h=""+a[c].floor+Yt+a[c].id;for(let p=0;p<a.length;p++)if(c!==p){var u,l;let m=""+a[p].floor+Yt+a[p].id,g=(u=this.pointMap.get(h))==null?void 0:u.cds,M=(l=this.pointMap.get(m))==null?void 0:l.cds;if(g!=null&&g.length&&(M!=null&&M.length))if(a[c].type==="straightLadder"){let P=e;this.addLineItem(h,m,P,i)}else{let P=n;this.addLineItem(h,m,P,i)}}}}),this.escalatorMap.forEach((o,s)=>{if(o.start&&o.end){var a,u;let l=""+o.start.floor+Yt+o.start.id,c=""+o.end.floor+Yt+o.end.id,h=(a=this.pointMap.get(l))==null?void 0:a.cds,p=(u=this.pointMap.get(c))==null?void 0:u.cds;if(h!=null&&h.length&&(p!=null&&p.length)){let m=t;this.addLineItem(l,c,m,i)}}})}initBaseRoute(){let t=new Map([...this.lineMap]);this.addFacilityToLineMap(1,this.lift_priority,3e4,t),this.baseRoute=new de.default(t)}initEscalatorRoute(){let t=new Map([...this.lineMap]),e=1e4;this.addFacilityToLineMap(1*e,this.lift_priority*e,3e4*e,t),this.escalatorRoute=new de.default(t)}initStraightLadderRoute(){let t=new Map([...this.lineMap]),e=1e4;this.addFacilityToLineMap(3*e,1*e,3e4*e,t),this.straightLadderRoute=new de.default(t)}checkStart(t){return!(!t.floor||!t.nodeId&&(!t.coord||t.coord.length<2))}checkEnd(t){return t.facility?!0:this.checkStart(t)}transformStart(t){var e;if(t.nodeId){let n=this.nodeMap.get(""+t.floor+Yt+t.nodeId);if(n){let[i,o]=n.split(Yt);return{floor:i,id:o}}}if((e=t.coord)!=null&&e.length){let n=this.roadInfo.find(o=>o.floor===t.floor);if(!n)return null;let i=n.points.reduce((o,s)=>{let a=K(t.coord,s.cds);return a<o.min&&(o.min=a,o.point=s),o},{min:1/0,point:n.points[0]});return{floor:i.point.floor,id:i.point.id}}return null}transformEnd(t){if(t.floor){let e=this.transformStart(t);if(e)return e}if(t.facility){let e=this.facilityMap.get(t.facility);if(e!=null&&e.length)return{floor:t.floor,facility:t.facility}}return null}getPath(t,e,n){if(n===void 0&&(n=""),!this.checkStart(t))return"start-error";if(!this.checkEnd(e))return"end-error";let i=this.transformStart(t);if(!i)return"no-start";let o=this.transformEnd(e);if(!o)return"no-end";let s=this.getBasePath.bind(this);switch(n){case"escalator":s=this.getEscalatorPath.bind(this);break;case"straightLadder":s=this.getStraightLadderPath.bind(this);break;default:s=this.getBasePath.bind(this);break}if(o.id)return s(i,o);if(o.facility){let a=this.facilityMap.get(o.facility).filter(l=>o.floor?l.floor===o.floor:!0);if(!a.length)return null;let u=a.map(l=>s(i,{floor:l.floor,id:l.id})).filter(l=>!!l);return u.reduce((l,c)=>{let h=c.reduce((p,m)=>p+xt(m.points),0);return h<l.distance&&(l.distance=h,l.path=c),l},{distance:1/0,path:u[0]}).path}}getRoutePath(t,e,n){let i=""+t.floor+Yt+t.id,o=""+e.floor+Yt+e.id,s=n.path(i,o);if(!s)return null;let a=[];return s.map(u=>{let l=this.pointMap.get(u);if(l){var c;let{floor:h}=l;if(((c=a[a.length-1])==null?void 0:c.floor)===h){let p=a[a.length-1];p.points.push(l.cds),p.endType=l.type,p.destId=l.nodeId,p.distance=xt(p.points)}else a.push({floor:h,points:[l.cds],endType:l.type,destId:l.nodeId,distance:0})}}),a}getBasePath(t,e){return this.getRoutePath(t,e,this.baseRoute)}getEscalatorPath(t,e){return this.getRoutePath(t,e,this.escalatorRoute)}getStraightLadderPath(t,e){return this.getRoutePath(t,e,this.straightLadderRoute)}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new de.default,this.escalatorRoute=new de.default,this.straightLadderRoute=new de.default}constructor(t=3){this.lift_priority=t,this.roadInfo=[],this.pointMap=new Map,this.nodeMap=new Map,this.facilityMap=new Map,this.straightLadderMap=new Map,this.escalatorMap=new Map,this.staircaseMap=new Map,this.lineMap=new Map,this.baseRoute=new de.default,this.escalatorRoute=new de.default,this.straightLadderRoute=new de.default}};var vG=d(v(),1),_G=d(pe(),1),WG=d(Z(),1),xG=d(ie(),1),IG=d(oe(),1),YG=d(se(),1),EG=d(ae(),1),DG=d(ue(),1),XG=d(le(),1),ZG=d(ce(),1),CG=d(d0(),1),OG=d(m0(),1),nt=d(h0(),1);import{cloneDeep as $e,isNil as Zg}from"lodash";import{Vector2 as g0}from"three";var D="___",Cg=class{isFacilityByType(t){return["facility","escalator","straightLadder","staircase","ramp","connectionPoint"].includes(t)}initFacilities(t){this.facilities=t.map(e=>{let n=[];try{n=JSON.parse(e.entry_end_floor)}catch(o){n=[]}let i=[];try{i=JSON.parse(e.entry_start_floor)}catch(o){i=[]}return T({},e,{entry_start_floor:i,entry_end_floor:n})})}getParkingSpaceInfo(t,e){let n=""+t+D+e;var i;return(i=this.parkingMap.get(n))!=null?i:null}getNodeInfo(t,e){let n=""+t+D+e,i=this.nodeMap.get(n);if(!i)return null;let o=this.pointMap.get(i);return o!=null?o:null}initRoute(t,e){this.clear(),this.roadInfo=t,this.initFacilities(e);let n=new Date,i=n.getHours()*60+n.getMinutes();t.length&&(t.forEach(o=>{(o.points||[]).filter(s=>s.openStatus!==!1).filter(s=>{if(!s.startTime||!s.endTime)return!0;let[a,u]=s.startTime.split(":").map(m=>+m),[l,c]=s.endTime.split(":").map(m=>+m),h=a*60+u,p=l*60+c;return i>=h&&i<=p}).forEach(s=>{s.floor=o.floor;let a=""+o.floor+D+s.id;if(this.nodeMap.set(""+o.floor+D+s.nodeId,""+o.floor+D+(s.relatedId||s.id)),this.pointMap.set(a,s),this.isFacilityByType(s.type)){let u=this.facilities.find(l=>l.id===+s.targetId);if(u){switch(u.entry_infra_type){case"straightLadder":if(u.entry_end_floor.find(p=>p.floor===o.floor)&&u.entry_start_floor.find(p=>p.floor===o.floor)){let p=this.straightLadderMap.get(s.targetId)||[];p.push(T({},s)),this.straightLadderMap.set(s.targetId,p)}break;case"staircase":if(u.entry_end_floor.find(p=>p.floor===o.floor)&&u.entry_start_floor.find(p=>p.floor===o.floor)){let p=this.staircaseMap.get(s.targetId)||[];p.push(T({},s)),this.staircaseMap.set(s.targetId,p)}break;case"escalator":let c=this.escalatorMap.get(s.targetId)||[];if(u.entry_start_floor.find(p=>p.floor===o.floor)){let p=c.find(m=>{var g;return((g=m.end)==null?void 0:g.floor)!==o.floor&&!m.start});p?p.start=s:c.push({start:s})}if(u.entry_end_floor.find(p=>p.floor===o.floor)){let p=c.find(m=>{var g;return((g=m.start)==null?void 0:g.floor)!==o.floor&&!m.end});p?p.end=s:c.push({end:s})}this.escalatorMap.set(s.targetId,c);break;case"ramp":let h=this.rampMap.get(s.targetId)||[];if(u.entry_start_floor.find(p=>p.floor===o.floor)){let p=h.find(m=>{var g;return((g=m.end)==null?void 0:g.floor)!==o.floor&&!m.start});p?p.start=s:h.push({start:s})}if(u.entry_end_floor.find(p=>p.floor===o.floor)){let p=h.find(m=>{var g;return((g=m.start)==null?void 0:g.floor)!==o.floor&&!m.end});p?p.end=s:h.push({end:s})}this.rampMap.set(s.targetId,h);break;case"connectionPoint":if(u.entry_end_floor.find(p=>p.floor===o.floor)&&u.entry_start_floor.find(p=>p.floor===o.floor)){let p=this.connectionPointMap.get(s.targetId)||[];p.push(T({},s)),this.connectionPointMap.set(s.targetId,p)}break}let l=this.facilityMap.get(s.targetId)||[];l.push(T({},s)),this.facilityMap.set(s.targetId,l)}}s.type==="parkingSpace"&&this.parkingMap.set(""+o.floor+D+s.name,s)}),(o.lines||[]).filter(s=>s.to!==s.from).forEach(s=>{let a=""+o.floor+D+s.from,u=""+o.floor+D+s.to,l=this.pointMap.get(a),c=this.pointMap.get(u);if(!l||!c)return;let h=l.cds,p=c.cds,m=K(h,p);if(!l.permission&&!c.permission){switch(this.addLineItem(a,u,m),this.addLineItem(u,a,m),s.direction){case"double":this.addLineItem(a,u,m,this.forwardLineMap),this.addLineItem(u,a,m,this.forwardLineMap);break;case"single":this.addLineItem(a,u,m,this.forwardLineMap);break;case"back":this.addLineItem(u,a,m,this.forwardLineMap);break}(l.type==="parkingSpace"||c.type==="parkingSpace")&&s.direction==="noDir"&&(this.addLineItem(a,u,m,this.forwardLineMap),this.addLineItem(u,a,m,this.forwardLineMap))}else l.permission&&(this.setPermissionLine(a,u,l.permission,m,""),this.setPermissionLine(u,a,l.permission,m,"")),c.permission&&c.permission!==l.permission&&(this.setPermissionLine(a,u,c.permission,m,""),this.setPermissionLine(u,a,c.permission,m,""))})}),this.addPermissionFacility(),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute(),this.initForwardRoute())}getPermissionMap(t){return this["permission_"+t]||(this["permission_"+t]=new Set),this["permission_"+t]}setPermissionLine(t,e,n,i,o){this.getPermissionMap(n).add({fromKey:t,toKey:e,distance:i,type:o})}addPermissionFacility(){this.straightLadderMap.forEach((t,e)=>{if(t.length<2){this.straightLadderMap.delete(e);return}for(let n=0;n<t.length;n++){let i=""+t[n].floor+D+t[n].id,o=this.pointMap.get(i);if(o){for(let s=0;s<t.length;s++)if(n!==s){let a=""+t[s].floor+D+t[s].id,u=this.pointMap.get(a);if(!u)continue;o.permission&&this.setPermissionLine(i,a,o.permission,1,"straightLadder"),u.permission&&u.permission!==o.permission&&this.setPermissionLine(i,a,u.permission,1,"straightLadder")}}}}),this.staircaseMap.forEach((t,e)=>{if(t.length<2){this.staircaseMap.delete(e);return}for(let n=0;n<t.length;n++){let i=""+t[n].floor+D+t[n].id,o=this.pointMap.get(i);if(o){for(let s=0;s<t.length;s++)if(n!==s){let a=""+t[s].floor+D+t[s].id,u=this.pointMap.get(a);if(!u)continue;o.permission&&this.setPermissionLine(i,a,o.permission,1,"staircase"),u.permission&&u.permission!==o.permission&&this.setPermissionLine(i,a,u.permission,1,"staircase")}}}}),this.escalatorMap.forEach((t,e)=>{t.forEach(n=>{if(n.start&&n.end){let i=""+n.start.floor+D+n.start.id,o=""+n.end.floor+D+n.end.id,s=this.pointMap.get(i),a=this.pointMap.get(o);s&&a&&(s.permission&&this.setPermissionLine(i,o,s.permission,1,"escalator"),a.permission&&a.permission!==s.permission&&this.setPermissionLine(i,o,a.permission,1,"escalator"))}})}),this.rampMap.forEach((t,e)=>{t.forEach(n=>{if(n.start&&n.end){let i=""+n.start.floor+D+n.start.id,o=""+n.end.floor+D+n.end.id,s=this.pointMap.get(i),a=this.pointMap.get(o);s&&a&&(s.permission&&this.setPermissionLine(i,o,s.permission,10,"ramp"),a.permission&&a.permission!==s.permission&&this.setPermissionLine(i,o,a.permission,10,"ramp"))}})}),this.connectionPointMap.forEach((t,e)=>{if(t.length<2){this.connectionPointMap.delete(e);return}for(let n=0;n<t.length;n++){let i=""+t[n].floor+D+t[n].id,o=this.pointMap.get(i);if(o){for(let s=0;s<t.length;s++)if(n!==s){let a=""+t[s].floor+D+t[s].id,u=this.pointMap.get(a);if(!u)continue;o.permission&&this.setPermissionLine(i,a,o.permission,1,"connectionPoint"),u.permission&&u.permission!==o.permission&&this.setPermissionLine(i,a,u.permission,1,"connectionPoint")}}}})}addPermissionLineToMap(t,e,n,i){let o=this.getPermissionMap(t);console.log(o),o.forEach(s=>{e.includes(s.type)&&(s.type===""?this.addLineItem(s.fromKey,s.toKey,s.distance,n):this.addLineItem(s.fromKey,s.toKey,i.get(s.type),n))})}addLineItem(t,e,n,i){i===void 0&&(i=this.lineMap);let o=i.get(t)||new Map;o.set(e,n),i.set(t,o)}addFacilityToLineMap(t,e,n,i){[...this.straightLadderMap,...this.staircaseMap].forEach(o=>{let[s,a]=o;if(!(a.length<2))for(let u=0;u<a.length;u++){let l=""+a[u].floor+D+a[u].id,c=this.pointMap.get(l);if(!(!c||c.permission)){for(let h=0;h<a.length;h++)if(u!==h){let p=""+a[h].floor+D+a[h].id,m=this.pointMap.get(p);if(!m||m.permission)continue;if(a[u].type==="straightLadder"){let g=e;this.addLineItem(l,p,g,i)}else{let g=n;this.addLineItem(l,p,g,i)}}}}}),this.escalatorMap.forEach((o,s)=>{o.forEach(a=>{if(a.start&&a.end){let u=""+a.start.floor+D+a.start.id,l=""+a.end.floor+D+a.end.id,c=this.pointMap.get(u),h=this.pointMap.get(l);if(c&&h&&!c.permission&&!h.permission){let p=t;this.addLineItem(u,l,p,i)}}})}),this.connectionPointMap.forEach((o,s)=>{if(!(o.length<2))for(let a=0;a<o.length;a++){let u=""+o[a].floor+D+o[a].id,l=this.pointMap.get(u);if(!(!l||l.permission)){for(let c=0;c<o.length;c++)if(a!==c){let h=""+o[c].floor+D+o[c].id,p=this.pointMap.get(h);if(!p||p.permission)continue;this.addLineItem(u,h,100,i)}}}})}initBaseRoute(){let t=new Map($e([...this.lineMap]));this.addFacilityToLineMap(100,100+this.lift_priority,3e4,t),this.baseRoute=new nt.default(t)}initEscalatorRoute(){let t=new Map($e([...this.lineMap])),e=1e4;this.addFacilityToLineMap(1*e,this.lift_priority*e,3e4*e,t),this.escalatorRoute=new nt.default(t)}initStraightLadderRoute(){let t=new Map($e([...this.lineMap])),e=1e4;this.addFacilityToLineMap(3*e,1*e,3e4*e,t),this.straightLadderRoute=new nt.default(t)}initForwardRoute(){this.rampMap.forEach((t,e)=>{t.forEach(n=>{if(n.start&&n.end){let i=""+n.start.floor+D+n.start.id,o=""+n.end.floor+D+n.end.id,s=this.pointMap.get(i),a=this.pointMap.get(o);s&&a&&!s.permission&&!a.permission&&this.addLineItem(i,o,10,this.forwardLineMap)}})}),this.connectionPointMap.forEach((t,e)=>{if(!(t.length<2))for(let n=0;n<t.length;n++){let i=""+t[n].floor+D+t[n].id,o=this.pointMap.get(i);if(!(!o||o.permission)){for(let s=0;s<t.length;s++)if(n!==s){let a=""+t[s].floor+D+t[s].id,u=this.pointMap.get(a);if(!u||u.permission)continue;this.addLineItem(i,a,100,this.forwardLineMap)}}}}),this.forwardRoute=new nt.default(this.forwardLineMap)}checkStart(t){return!(!t.floor||!t.nodeId&&(!t.coord||t.coord.length<2))}checkEnd(t){return t.facility||t.parkingSpace&&t.floor?!0:this.checkStart(t)}transformStart(t,e){var n;if(t.nodeId){let i=this.nodeMap.get(""+t.floor+D+t.nodeId);if(i){let[o,s]=i.split(D);return{floor:o,id:s}}}if((n=t.coord)!=null&&n.length){let i=this.roadInfo.find(s=>s.floor===t.floor);if(!i)return null;let o=i.points.reduce((s,a)=>{if(a.relatedId)return s;let u=""+a.floor+D+a.id;if(e==="forward"){if(!this.forwardLineMap.has(u))return s}else if(!this.lineMap.has(u))return s;let l=K(t.coord,a.cds);return l<s.min&&(s.min=l,s.point=a),s},{min:1/0,point:i.points[0]});return{floor:i.floor,id:o.point.id}}return null}transformEnd(t,e){if(t.floor){if(t.parkingSpace){let i=this.parkingMap.get(""+t.floor+D+t.parkingSpace);if(i)return{floor:t.floor,id:i.id}}let n=this.transformStart(t,e);if(n)return n}if(t.facility){let i=this.facilities.filter(o=>+o.type_id==+t.facility).map(o=>o.id).map(o=>this.facilityMap.get(""+o)).flat(2);if(i!=null&&i.length)return{floor:t.floor,facility:t.facility}}return null}getPath(t,e,n,i,o){if(n===void 0&&(n=""),!this.checkStart(t))return"start-error";if(!this.checkEnd(e))return"end-error";let s=this.transformStart(t,n);if(!s)return"no-start";let a=this.transformEnd(e,n);if(!a)return"no-end";let u;switch(n){case"escalator":u=this.getEscalatorPath.bind(this);break;case"straightLadder":u=this.getStraightLadderPath.bind(this);break;case"forward":u=this.getForwardPath.bind(this);break;default:u=this.getBasePath.bind(this);break}if(a.id)return u(s,a,i,o);if(a.facility){let c=this.facilities.filter(p=>+p.type_id==+e.facility).map(p=>p.id).map(p=>this.facilityMap.get(""+p)).flat(2).filter(p=>p).filter(p=>a.floor?p.floor===a.floor:!0);if(!c.length)return null;let h=c.map(p=>u(s,{floor:p.floor,id:p.id},i,o)).filter(p=>!!p);return h.reduce((p,m)=>{let g=m[0].consume;return g<p.distance&&(p.distance=g,p.path=m),p},{distance:1/0,path:h[0]}).path}}getRoutePath(t,e,n){let i=""+t.floor+D+t.id,o=""+e.floor+D+e.id,s=n.path(i,o);if(!s)return null;let a=[],u=s.reduce((l,c,h,p)=>{if(h===0)return 0;let m=p[h-1],g=n.graph.get(m).get(c);return l+g},0);return s.map(l=>{let c=this.pointMap.get(l);if(c){var h;let{floor:p}=c,m=c.type;if(this.isFacilityByType(c.type)){let g=this.facilities.find(M=>M.id===+c.targetId);g&&(m=g.entry_infra_type)}if(((h=a[a.length-1])==null?void 0:h.floor)===p){let g=a[a.length-1];g.points.push(c.cds),g.pointInfos.push(c),g.endType=m,g.destId=c.nodeId,g.distance=xt(g.points)}else a.push({floor:p,points:[c.cds],pointInfos:[c],endType:m,destId:c.nodeId,distance:0,consume:u})}}),a}getBasePath(t,e,n){if(!n)return this.getRoutePath(t,e,this.baseRoute);let i=$e(this.baseRoute.graph);this.addPermissionLineToMap(n,["","escalator","staircase","straightLadder","connectionPoint"],i,new Map([["escalator",100],["connectionPoint",100],["straightLadder",100+this.lift_priority],["staircase",3e4]]));let o=new nt.default(i);return this.getRoutePath(t,e,o)}getEscalatorPath(t,e,n){if(!n)return this.getRoutePath(t,e,this.escalatorRoute);let i=$e(this.escalatorRoute.graph),o=1e4;this.addPermissionLineToMap(n,["","escalator","staircase","straightLadder","connectionPoint"],i,new Map([["escalator",1*o],["connectionPoint",100],["straightLadder",this.lift_priority*o],["staircase",3e4*o]]));let s=new nt.default(i);return this.getRoutePath(t,e,s)}getStraightLadderPath(t,e,n){if(!n)return this.getRoutePath(t,e,this.straightLadderRoute);let i=$e(this.straightLadderRoute.graph),o=1e4;this.addPermissionLineToMap(n,["","escalator","staircase","straightLadder","connectionPoint"],i,new Map([["escalator",3*o],["connectionPoint",100],["straightLadder",1*o],["staircase",3e4*o]]));let s=new nt.default(i);return this.getRoutePath(t,e,s)}getForwardPath(t,e,n,i){let o=new Map,s=p=>{let m=this.forwardRoute.graph.get(u);p.forEach(g=>{let M=m.get(g);Zg(M)||(o.set(g,M),m.delete(g))})},a=()=>{let p=this.forwardRoute.graph.get(u);o.forEach((m,g)=>{p.set(g,m)})},u=""+t.floor+D+t.id;if(!Zg(i)){let p=this.forwardLineMap.get(u),m=this.pointMap.get(u);if(m&&(p!=null&&p.size)&&p.size>1){let g=new g0(m.cds[0],m.cds[1]),M=new Map;p.forEach((A,S)=>{let _=this.pointMap.get(S);if(_){let I=new g0(_.cds[0],_.cds[1]),O=360-(new g0().subVectors(I,g).angle()/Math.PI*180-90+360)%360;M.set(S,O)}});let P=Array.from(M).filter(A=>{let[S,_]=A;return Math.abs(_-i)<=60}).map(A=>{let[S]=A;return S});if(P.length)P.forEach(A=>M.delete(A)),s([...M.keys()]);else{let A=Array.from(M).reduce((S,_)=>{let I=Math.abs(_[1]-i);return I<S.diff?{diff:I,key:_[0]}:S},{diff:1/0,key:""});M.delete(A.key),s([...M.keys()])}}}if(!n){let p=this.getRoutePath(t,e,this.forwardRoute);return a(),p||this.getRoutePath(t,e,this.forwardRoute)}let l=$e(this.forwardRoute.graph);this.addPermissionLineToMap(n,["","ramp"],l,new Map([["ramp",10]]));let c=new nt.default(l),h=this.getRoutePath(t,e,c);if(a(),h)return h;{let p=$e(this.forwardRoute.graph);this.addPermissionLineToMap(n,["","ramp"],p,new Map([["ramp",10]]));let m=new nt.default(p);return this.getRoutePath(t,e,m)}}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new nt.default,this.escalatorRoute=new nt.default,this.straightLadderRoute=new nt.default}constructor(t=3){this.lift_priority=t,this.roadInfo=[],this.facilities=[],this.pointMap=new Map,this.nodeMap=new Map,this.facilityMap=new Map,this.straightLadderMap=new Map,this.escalatorMap=new Map,this.rampMap=new Map,this.staircaseMap=new Map,this.connectionPointMap=new Map,this.parkingMap=new Map,this.lineMap=new Map,this.baseRoute=new nt.default,this.escalatorRoute=new nt.default,this.straightLadderRoute=new nt.default,this.forwardLineMap=new Map,this.forwardRoute=new nt.default}};var NG=d(ie(),1),UG=d(oe(),1),GG=d(se(),1),kG=d(ae(),1),VG=d(ue(),1),JG=d(le(),1),LG=d(ce(),1),BG=d(v(),1),tn=class{static createKey(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}static genUniqueKey(){let t=this.createKey();for(;this.keySet.has(t);)t=this.createKey();return t}static removeKey(t){this.keySet.delete(t)}static dispose(){this.keySet.clear()}};tn.keySet=new Set;var HG=d(Lr(),1),qG=d(pe(),1);function Og(r){return r.replace(/[A-Z]/g,t=>"_"+t.toLowerCase()).replace(/^_/,"")}function At(r,t,e){return new Promise((n,i)=>{let o=tn.genUniqueKey(),s=a=>{let{data:u}=a;u.type===""+t+"_result"&&u.key===o&&(tn.removeKey(o),self.removeEventListener("message",s),u.error?i(u.error):n(u.data))};r.addEventListener("message",s),r.postMessage({type:t,key:o,data:e})})}function nk(r){let t={};for(let n in r)n.startsWith("on")&&(t[Og(n.slice(2))]=r[n]);let e=n=>j(this,null,function*(){let{data:i}=n;if(t[i.type])try{let o=yield t[i.type](i.data);self.postMessage({type:""+i.type+"_result",key:i.key,data:o})}catch(o){self.postMessage({type:""+i.type+"_result",key:i.key,error:o})}else self.postMessage({type:""+i.type+"_result",key:i.key,error:"no_event"})});return self.addEventListener("message",e),()=>{self.removeEventListener("message",e)}}import{BoxGeometry as oE,BufferGeometry as sE,Line as aE,LineBasicMaterial as Kg,Mesh as uE}from"three";function sk(r,t){t===void 0&&(t=16711680);let e=new Kg({color:t}),n=new sE().setFromPoints(r);return new aE(n,e)}function ak(r,t){t===void 0&&(t=16711680);let e=new Kg({color:t}),n=new oE(1,1,1),i=new uE(n,e);return i.position.copy(r),i}var lk=d(Vr(),1),ck=d(v(),1);function pt(r,t,e){e===void 0&&(e=0),r.forEach(n=>{if(n.geometry.coords=JSON.parse(JSON.stringify(n.geometry.cds)),n.geometry.type==="polygon"){var i;n.geometry.coords.map(o=>{Array.isArray(o)&&o.forEach(s=>{s[0]-=t[0],s[1]-=t[1]})}),n.geometry.otherCds&&(n.geometry.otherCoords=n.geometry.otherCds.map(o=>o.map(s=>Hn(s,t)))),(i=n.doors)!=null&&i.length&&n.doors.map(o=>{o.coord=Hn(o.coordinate,t)}),n.center&&(n.centerCoords=Hn(n.center,t))}else n.geometry.coords=Hn(n.geometry.cds,t),n.center&&(n.centerCoords=Hn(n.center,t));if(n.center_x&&n.center_y){let[o,s]=Hn([n.center_x,n.center_y],t);n.center_coord_x=o,n.center_coord_y=s}});for(let n=0;n<r.length;n++){let i=r[n];i.deltaHeight=1e-5*(e+n+1)}}function Hn(r,t){return[r[0]-t[0],r[1]-t[1]]}var pk=d(ie(),1),fk=d(oe(),1),dk=d(se(),1),mk=d(ae(),1),gk=d(ue(),1),yk=d(le(),1),Mk=d(ce(),1),Pk=d(v(),1);import{Group as lE}from"@tweenjs/tween.js";var en=class{update(){this.group.update()}pause(){this.pauseTween=!0,this.getAll().forEach(t=>{this.tweenStore.add(t),t.pause()})}continue(){this.pauseTween&&(this.tweenStore.forEach(t=>{t.resume()}),this.tweenStore.clear(),this.pauseTween=!1)}remove(t){this.group.remove(t)}getAll(){return this.group.getAll()}clear(){this.getAll().forEach(t=>t.stop()),this.group.removeAll()}dispose(){this.clear()}constructor(){this.pauseTween=!1,this.tweenStore=new Set,this.group=new lE}};import{EventDispatcher as cE}from"three";var Ro=class extends cE{registryEvent(){this.ctn.addEventListener("pointerdown",this._pointerDown),this.ctn.addEventListener("pointerup",this._pointerUp)}unRegistryEvent(){this.ctn.removeEventListener("pointerdown",this._pointerDown),this.ctn.removeEventListener("pointerup",this._pointerUp)}dispose(){this.unRegistryEvent()}constructor(t){super(),this.ctn=t,this._pointerDown=e=>{this.point={x:e.offsetX,y:e.offsetY}},this._pointerUp=e=>{if(!this.point)return;let{offsetX:n,offsetY:i}=e,{x:o,y:s}=this.point;Math.hypot(o-n+(s-i))>3||this.dispatchEvent({type:"click",e})},this.registryEvent()}};var bk=d(v(),1),vk=d(Z(),1),_k=d(Lr(),1),Wk=d(pe(),1);import{isNil as hE}from"lodash";import{EventDispatcher as pE}from"three";var qn=class extends pE{_isEffectiveTask(t){return t&&typeof t.run=="function"}_getIndexByTid(t){return this._task.findIndex(e=>e.tid===t)}_createTask(t){return this._isEffectiveTask(t)?T({},t,{tid:++this._id,meta:t.meta||{}}):!1}get task(){return[...this._task]}getTasks(){return[...this._task]}add(t){if(this._isEffectiveTask(t)){let e=this._createTask(t);return this._task.push(e),this.started&&!this.activeTask&&this.start(),e.tid}return!1}replace(t,e){if(!this._isEffectiveTask(e))return console.warn("[TaskQueue] replace\u65B9\u6CD5\u4F20\u5165\u7684task\u53C2\u6570\u683C\u5F0F\u4E0D\u6B63\u786E"),!1;let n=this._getIndexByTid(t);if(n===-1)return console.warn("[TaskQueue] \u6CA1\u6709\u627E\u5230id="+t+"\u7684\u4EFB\u52A1"),!1;let i=this._createTask(e);return this._task.splice(n,1,i),i.tid}replaceByMetaType(t){var e;let n=(e=t.meta)==null?void 0:e.type;if(hE(n))return this.add(t);{let i=this._task.find(o=>o.meta.type===n);return i?this.replace(i.tid,t):this.add(t)}}remove(t){let e=this._getIndexByTid(t);return e===-1?(console.warn("[TaskQueue] remove\u65B9\u6CD5\u4F20\u5165\u7684id\uFF1A"+t+"\u627E\u4E0D\u5230\u5BF9\u5E94\u7684task"),!1):(this._task.splice(e,1),!0)}clear(){this._task.length=0}start(){this.started=!0,!this.activeTask&&this._task.length&&this.exec()}stop(){this.started=!1}exec(){return j(this,null,function*(){if(!this.started||!this._task.length)return!1;let t=this._task.shift();this.activeTask=t,this.dispatchEvent({type:"active-task-start",task:t});let e;try{e=yield t.run()}catch(n){console.warn("[task run err]",n,t)}return this.activeTask=null,this.dispatchEvent({type:"active-task-end",task:t,res:e}),this.exec()})}constructor(t=!0){super(),this._task=[],this.started=!1,this.activeTask=null,this._id=0,t&&this.start()}};import{EventDispatcher as rK,Box2 as iK,Vector3 as Oe,Vector2 as Pr,Raycaster as oK,Box3 as sK,Color as aK,AmbientLight as uK}from"three";var bQ=d(v(),1),vQ=d(ie(),1),_Q=d(oe(),1),WQ=d(se(),1),xQ=d(ae(),1),IQ=d(ue(),1),YQ=d(le(),1),EQ=d(ce(),1),DQ=d(Z(),1);import{EventDispatcher as TO}from"three";var b7=d(v(),1),v7=d(Z(),1);import{Object3D as I4,ExtrudeGeometry as Y4,Mesh as E4,Box3 as xs,Vector3 as $t,BufferGeometry as D4,LineSegments as X4,Ray as KA,Vector2 as Ce,DoubleSide as Z4,RepeatWrapping as RA}from"three";var Dk=d(v(),1);import{LineMaterial as fE}from"three/examples/jsm/lines/LineMaterial";import{Color as Fo,LineBasicMaterial as dE,MeshStandardMaterial as mE,MeshBasicMaterial as gE,ShaderMaterial as yE,DoubleSide as ME}from"three";function Rg(r){return r.x+"-"+r.y+"-"+r.z}var G=class{static generateLineMaterialKey(t){let{color:e,opacity:n}=t;return e+"-"+n}static createLineMaterial(t){let{color:e,opacity:n}=t,i=this.generateLineMaterialKey({color:e,opacity:n});if(this.lineMaterialMap.has(i))return this.lineMaterialMap.get(i);let o=new dE({color:new Fo(e).convertLinearToSRGB(),transparent:!0,opacity:n});return this.lineMaterialMap.set(i,o),o}static createMeshStandardMaterial(t){let{color:e,opacity:n}=t,i=e+"-"+n;if(this.meshStandardMaterialMap.has(i))return this.meshStandardMaterialMap.get(i);let o=new mE({color:new Fo(e).convertLinearToSRGB(),roughness:1,transparent:!0,opacity:n,depthWrite:!0});return this.meshStandardMaterialMap.set(i,o),o}static createMeshBasicMaterial(t){let{color:e,opacity:n}=t,i=e+"-"+n;if(this.meshBasicMaterialMap.has(i))return this.meshBasicMaterialMap.get(i);let o=new gE({color:e,transparent:!0,opacity:n,depthWrite:!0});return this.meshBasicMaterialMap.set(i,o),o}static createShaderMaterial(t){let{gradualColor:e,center:n,maxValue:i,opacity:o,direction:s,max:a,min:u}=t,l=e.toString()+"-"+Rg(n)+"-"+i+"-"+o+"-"+Rg(s);if(this.shaderMaterialMap.has(l))return this.shaderMaterialMap.get(l);let c=`
5
5
  uniform vec3 uColor;
6
6
  uniform vec3 uGradualColor;
7
7
  uniform vec3 center;
@@ -104,14 +104,14 @@ var hT=Object.create;var kc=Object.defineProperty;var pT=Object.getOwnPropertyDe
104
104
  gl_FragColor = vec4(uColor2, uOpacity); // \u5176\u4ED6\u9762\u989C\u8272\uFF09
105
105
  }
106
106
  }
107
- `,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 sO({uniforms:{maxZ:{value:n},uColor:{value:new BA(this.options[0].fillColor).convertLinearToSRGB()},uColor2:{value:new BA(We(this.options[0].fillColor)).convertLinearToSRGB()},uOpacity:{value:this.options[0].fillOpacity}},vertexShader:t,fragmentShader:e,transparent:!0});this.material=o}initLineMaterial(){let t=G.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 rO(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 LA(u[0],u[1],e)),t.push(new LA(l[0],l[1],e))}}}),t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new iO().setFromPoints(t);this.lineGeometry=e}createBorder(){this.line&&this.remove(this.line);let t=new oO(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=>T({},mc,n)),this.init()}};var tQ=d(v(),1);import{Box2 as Mc,Object3D as uO,Sprite as QA,SpriteMaterial as HA,Vector2 as ks}from"three";import{isNil as Di}from"lodash";var lO={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},$=class extends uO{get durIconAndText(){return this.options.icon&&this.options.text?2:0}get offset(){return this.options.icon&&this.options.text?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.options.text?this.options.text_font_size*this.textAspect:0}get textHeight(){return this.options.text?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!Di(t)&&!Di(e)&&!Di(n)&&!Di(i)&&!Di(o)}get deltaZ(){return!this.options.icon&&this.options.text?.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=>j(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._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 j(this,null,function*(){if(this.options.icon)return this._initIconPromise=new Promise(t=>j(this,null,function*(){let e=yield Et.getTextureByUrl(this.options.icon),n=new QA(new HA({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.options.text){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=wt.getTextureByText(this.options.text),this.textAspect=t.image.width/t.image.height;let e=new QA(new HA({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,text:s}=this.options;o?s?(n=0,i=n*(this.iconHeight/this.textHeight)-this.iconHeight/this.textHeight-this.durIconAndText/this.textHeight):(n=.5,i=0):s?(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 j(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 Mc(new ks(i-s,o-this.iconHeight),new ks(i+s,o)),u=this.textWidth/2,l=new Mc(new ks(i-u,o-this.textHeight-this.durIconAndText-this.iconHeight),new ks(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 Mc,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(T({},lO,e),this),this.position.set(this.options.position.x,this.options.position.y,this.options.position.z),this.registryEvent(),this.init()}};import{DoubleSide as cO,Matrix4 as qA,Mesh as hO,MeshBasicMaterial as pO,Object3D as fO,PlaneGeometry as dO}from"three";import{mergeGeometries as mO}from"three/examples/jsm/utils/BufferGeometryUtils";var gO={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},Vs=class extends fO{init(){return j(this,null,function*(){let t=this.options.map(s=>wt.getTextureByText(s.texts[0],{fillStyle:t0(s.fillColor,s.fillOpacity),strokeStyle:t0(s.strokeColor,s.strokeOpacity),lineWidth:6,font:"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,m=new dO(p,u.secondHeight),g=new qA().makeTranslation(u.center_x,u.center_y,u.airHeight+u.deltaHeight+u.height).multiply(new qA().makeRotationZ(u.secondRotate));return m.applyMatrix4(g),m}),n=mO(e,!0);e.forEach(s=>s.dispose());let i=t.map(s=>{let a=new pO({map:s,alphaTest:1,side:cO});return s.needsUpdate=!0,a}),o=new hO(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=>T({},gO,n)),this.init()}};import{BufferGeometry as yO,Line as MO,LineBasicMaterial as PO,Object3D as jO}from"three";var Js=class extends jO{setPosition(t,e){this.geometry.setFromPoints([t,e]),this.line||this.createLine()}createLine(){this.line=new MO(this.geometry,this.material),this.add(this.line)}dispose(){this.line&&L(this.line),this.geometry=null,this.material=null}constructor(t,e,n){super(),this.context=t,this.geometry=new yO,this.material=new PO({color:0}),e&&n&&this.setPosition(e,n)}};import{Frustum as AO}from"three";var Ls=class extends Ft{setEnable(t){super.setEnable(t),st(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=W(this.startPoint,e,n,i),s=W(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 Q&&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 m=W(p,i,o,s);return Be(m,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=W(u,i,o,s),h=W(l,i,o,s);return!(!Be(c,e,n)||!Be(h,e,n))}dispose(){super.dispose(),this.rect=null,this.unRegistryEvent()}constructor(t){super(t),this.frustum=new AO,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=T({},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);st(this.rect,s.x,s.y,a,u)}else st(this.rect,0,0,0,0)};let{config:{selectBox:{fill:e,stroke:n}}}=t;this.rect=Qe(n,e),this.svg.appendChild(this.rect),this.registryEvent()}};var Bs=class extends TO{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))}}),(Jn?e.metaKey:e.ctrlKey)||this._list.clear(),a.forEach(c=>this._list.add(c)),this.selectEnd(),this.downPoint=null},this.onPointerOut=e=>{this.disableBoxSelection()},this.onKeyDown=e=>{Ln(e.key)&&this.enableBoxSelection()},this.onKeyUp=e=>{Ln(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 Ls(t),this.boxSelection.setEnable(!1),this.registryEvent()}};var ZQ=d(ie(),1),CQ=d(oe(),1),OQ=d(se(),1),KQ=d(ae(),1),RQ=d(ue(),1),FQ=d(le(),1),zQ=d(ce(),1),NQ=d(v(),1);import{EventDispatcher as wO,Vector2 as SO}from"three";var Qs=class extends wO{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 H,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 m=i.find(g=>g.options.id===p.options.id);if(m instanceof Wn){let{x:g,y:M}=m.clientPos,P=Math.sqrt((g-o.offsetX)**2+(M-o.offsetY)**2);P<h&&(h=P,c=p)}else if(m instanceof $){let{x:g,y:M}=m.box.getCenter(new SO),P=Math.sqrt((g-o.offsetX)**2+(M-o.offsetY)**2);P<h&&(h=P,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 JQ=d(v(),1);import{Box3 as bO,Vector3 as Hs}from"three";var qs=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(P=>P instanceof Rt).length)return null;let e=this.box,{camera:n,clientSize:{width:i,height:o}}=this.context,{min:s,max:a}=e,u=W(s,n,i,o),l=W(a,n,i,o),c=W(new Hs(s.x,a.y,a.z),n,i,o),h=W(new Hs(a.x,s.y,s.z),n,i,o),p=Math.min(u.x,l.x,c.x,h.x),m=Math.max(u.x,l.x,c.x,h.x),g=Math.min(u.y,l.y,c.y,h.y),M=Math.max(u.y,l.y,c.y,h.y);return{left:p,right:m,top:g,bottom:M}}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,m=s-e>=l,g=a-i>=c,M=o>=u;return p&&m&&g&&M}dispose(){this.unRegistryEvent()}constructor(t){this.context=t,this.prevCamera={position:new Hs,zoom:1,target:new Hs},this.enable=!0,this.box=new bO,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 u5=d(Ac(),1);import{Vector3 as d1}from"three";import{Tween as ra,Group as JO}from"@tweenjs/tween.js";var i5=d(v(),1),o5=d(Z(),1);import{EventDispatcher as NO,MOUSE as yr,Quaternion as p1,Spherical as ta,TOUCH as Mr,Vector2 as St,Vector3 as zt,Plane as UO,Ray as GO,MathUtils as kO}from"three";var ea=new GO,f1=new UO,VO=Math.cos(70*kO.DEG2RAD),na=class extends NO{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 St,this.rotateLineEnd=new St,this.spherical=new ta,this.sphericalDelta=new ta,this.object=t,this.domElement=e,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new zt,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.screenSpacePanning=!1,this.mouseButtons={LEFT:yr.PAN,MIDDLE:yr.DOLLY,RIGHT:yr.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(y){y.addEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=y},this.stopListenToKeyEvents=function(){var y;(y=this._domElementKeyEvents)==null||y.removeEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=null},this.saveState=function(){n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=function(){n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent({type:"change"}),n.update(),o=i.NONE},this.update=function(){let y=new zt,w=new p1().setFromUnitVectors(t.up,new zt(0,1,0)),R=w.clone().invert(),V=new zt,Mt=new p1,ee=new zt,Nt=2*Math.PI;return function(Sr){Sr===void 0&&(Sr=null);let je=n.object.position;y.copy(je).sub(n.target),y.applyQuaternion(w),a.setFromVector3(y),n.autoRotate&&o===i.NONE&&Me(Ar(Sr)),n.enableDamping?(a.theta+=u.theta*n.dampingFactor,a.phi+=u.phi*n.dampingFactor):(a.theta+=u.theta,a.phi+=u.phi);let Ae=n.minAzimuthAngle,Te=n.maxAzimuthAngle;isFinite(Ae)&&isFinite(Te)&&(Ae<-Math.PI?Ae+=Nt:Ae>Math.PI&&(Ae-=Nt),Te<-Math.PI?Te+=Nt:Te>Math.PI&&(Te-=Nt),Ae<=Te?a.theta=Math.max(Ae,Math.min(Te,a.theta)):a.theta=a.theta>(Ae+Te)/2?Math.max(Ae,a.theta):Math.min(Te,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&&O||n.object.isOrthographicCamera?a.radius=yt(a.radius):a.radius=yt(a.radius*l),y.setFromSpherical(a),y.applyQuaternion(R),je.copy(n.target).add(y),n.object.lookAt(n.target),n.enableDamping===!0?(u.theta*=1-n.dampingFactor,u.phi*=1-n.dampingFactor,c.multiplyScalar(1-n.dampingFactor)):(u.set(0,0,0),c.set(0,0,0));let Ki=!1;if(n.zoomToCursor&&O){let br=null;if(n.object.isPerspectiveCamera){let vr=y.length();br=yt(vr*l);let Ri=vr-br;n.object.position.addScaledVector(I,Ri),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){let vr=new zt(x.x,x.y,0);vr.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/l)),n.object.updateProjectionMatrix(),Ki=!0;let Ri=new zt(x.x,x.y,0);Ri.unproject(n.object),n.object.position.sub(Ri).add(vr),n.object.updateMatrixWorld(),br=y.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;br!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(br).add(n.object.position):(ea.origin.copy(n.object.position),ea.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(ea.direction))<VO?t.lookAt(n.target):(f1.setFromNormalAndCoplanarPoint(n.object.up,n.target),ea.intersectPlane(f1,n.target))))}else n.object.isOrthographicCamera&&(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/l)),n.object.updateProjectionMatrix(),Ki=!0);return l=1,O=!1,Ki||V.distanceToSquared(n.object.position)>s||8*(1-Mt.dot(n.object.quaternion))>s||ee.distanceToSquared(n.target)>0?(n.dispatchEvent({type:"change"}),V.copy(n.object.position),Mt.copy(n.object.quaternion),ee.copy(n.target),Ki=!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 ta,u=new ta,l=1,c=new zt,h=new St,p=new St,m=new St,g=new St,M=new St,P=new St,A=new St,S=new St,_=new St,I=new zt,x=new St,O=!1,b=[],U={};function Ar(y){return y!==null?2*Math.PI/60*n.autoRotateSpeed*y:2*Math.PI/60/60*n.autoRotateSpeed}function En(){return Math.pow(.95,n.zoomSpeed)}function Me(y){u.theta-=y}function Fe(y){u.phi-=y}let Dn=function(){let y=new zt;return function(R,V){y.setFromMatrixColumn(V,0),y.multiplyScalar(-R),c.add(y)}}(),dn=function(){let y=new zt;return function(R,V){n.screenSpacePanning===!0?y.setFromMatrixColumn(V,1):(y.setFromMatrixColumn(V,0),y.crossVectors(n.object.up,y)),y.multiplyScalar(R),c.add(y)}}(),Pe=function(){let y=new zt;return function(R,V){let Mt=n.domElement;if(n.object.isPerspectiveCamera){let ee=n.object.position;y.copy(ee).sub(n.target);let Nt=y.length();Nt*=Math.tan(n.object.fov/2*Math.PI/180),Dn(2*R*Nt/Mt.clientHeight,n.object.matrix),dn(2*V*Nt/Mt.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(Dn(R*(n.object.right-n.object.left)/n.object.zoom/Mt.clientWidth,n.object.matrix),dn(V*(n.object.top-n.object.bottom)/n.object.zoom/Mt.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function Xn(y){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?l/=y:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Tr(y){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?l*=y:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function wr(y){if(!n.zoomToCursor)return;O=!0;let w=n.domElement.getBoundingClientRect(),R=y.clientX-w.left,V=y.clientY-w.top,Mt=w.width,ee=w.height;x.x=R/Mt*2-1,x.y=-(V/ee)*2+1,I.set(x.x,x.y,1).unproject(n.object).sub(n.object.position).normalize()}function yt(y){return Math.max(n.minDistance,Math.min(n.maxDistance,y))}function Cc(y){h.set(y.clientX,y.clientY)}function B1(y){wr(y),A.set(y.clientX,y.clientY)}function Oc(y){g.set(y.clientX,y.clientY)}function Q1(y){p.set(y.clientX,y.clientY),m.subVectors(p,h).multiplyScalar(n.rotateSpeed);let w=n.domElement;Me(2*Math.PI*m.x/w.clientHeight),Fe(2*Math.PI*m.y/w.clientHeight),h.copy(p),n.update()}function H1(y){S.set(y.clientX,y.clientY),_.subVectors(S,A),_.y>0?Xn(En()):_.y<0&&Tr(En()),A.copy(S),n.update()}function q1(y){M.set(y.clientX,y.clientY),P.subVectors(M,g).multiplyScalar(n.panSpeed),Pe(P.x,P.y),g.copy(M),n.update()}function $1(y){wr(y),y.deltaY<0?Tr(En()):y.deltaY>0&&Xn(En()),n.update()}function tT(y){let w=!1;switch(y.code){case n.keys.UP:y.ctrlKey||y.metaKey||y.shiftKey?Fe(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Pe(0,n.keyPanSpeed),w=!0;break;case n.keys.BOTTOM:y.ctrlKey||y.metaKey||y.shiftKey?Fe(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Pe(0,-n.keyPanSpeed),w=!0;break;case n.keys.LEFT:y.ctrlKey||y.metaKey||y.shiftKey?Me(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Pe(n.keyPanSpeed,0),w=!0;break;case n.keys.RIGHT:y.ctrlKey||y.metaKey||y.shiftKey?Me(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Pe(-n.keyPanSpeed,0),w=!0;break}w&&(y.preventDefault(),n.update())}function Kc(){if(b.length===1)h.set(b[0].pageX,b[0].pageY);else{let y=(b[0].pageX-b[0].pageY)/(b[1].pageX-b[1].pageY),w=b[0].pageY-y*b[0].pageX;n.rotateLineStart.set(y,w);let R=.5*(b[0].pageX+b[1].pageX),V=.5*(b[0].pageY+b[1].pageY);h.set(R,V)}}function Rc(){if(b.length===1)g.set(b[0].pageX,b[0].pageY);else{let y=.5*(b[0].pageX+b[1].pageX),w=.5*(b[0].pageY+b[1].pageY);g.set(y,w)}}function Fc(){let y=b[0].pageX-b[1].pageX,w=b[0].pageY-b[1].pageY,R=Math.sqrt(y*y+w*w);A.set(0,R)}function eT(){n.enableZoom&&Fc(),n.enablePan&&Rc()}function nT(){n.enableZoom&&Fc(),n.enableRotate&&Kc()}function zc(y){if(b.length==1)p.set(y.pageX,y.pageY);else{let R=Wa(y),V=.5*(y.pageX+R.x),Mt=.5*(y.pageY+R.y);p.set(V,Mt);let ee=(y.pageY-R.y)/(y.pageX-R.x),Nt=R.y-ee*R.x;if(n.rotateLineEnd.set(ee,Nt),Number.isFinite(n.rotateLineEnd.x)&&Number.isFinite(n.rotateLineStart.x)){let xa=(n.rotateLineStart.y-n.rotateLineEnd.y)/(n.rotateLineEnd.x-n.rotateLineStart.x),Sr=ee*xa+Nt;if(Number.isFinite(xa)&&Number.isFinite(Sr)){let je=Math.atan(n.rotateLineEnd.x)-Math.atan(n.rotateLineStart.x);Math.PI-Math.abs(je)<.5&&(je=-Math.sign(je)*(Math.PI-Math.abs(je))),Math.abs(je)<.1&&(u.theta+=je)}}n.rotateLineStart.copy(n.rotateLineEnd)}m.subVectors(p,h).multiplyScalar(n.rotateSpeed);let w=n.domElement;Fe(2*Math.PI*m.y/w.clientHeight),h.copy(p)}function Nc(y){if(b.length===1)M.set(y.pageX,y.pageY);else{let w=Wa(y),R=.5*(y.pageX+w.x),V=.5*(y.pageY+w.y);M.set(R,V)}P.subVectors(M,g).multiplyScalar(n.panSpeed),Pe(P.x,P.y),g.copy(M)}function Uc(y){let w=Wa(y),R=y.pageX-w.x,V=y.pageY-w.y,Mt=Math.sqrt(R*R+V*V);S.set(0,Mt),_.set(0,Math.pow(S.y/A.y,n.zoomSpeed)),Xn(_.y),A.copy(S)}function rT(y){n.enableZoom&&Uc(y),n.enablePan&&Nc(y)}function iT(y){n.enableZoom&&Uc(y),n.enableRotate&&zc(y)}this.onPointerDown=function(w){n.enabled!==!1&&(b.length===0&&(n.domElement.setPointerCapture(w.pointerId),n.domElement.addEventListener("pointermove",n.onPointerMove),n.domElement.addEventListener("pointerup",n.onPointerUp)),lT(w),w.pointerType==="touch"?aT(w):oT(w))},this.onPointerMove=function(w){n.enabled!==!1&&(w.pointerType==="touch"?uT(w):sT(w))},this.onPointerUp=function(w){cT(w),b.length===0&&(n.domElement.releasePointerCapture(w.pointerId),n.domElement.removeEventListener("pointermove",n.onPointerMove),n.domElement.removeEventListener("pointerup",n.onPointerUp)),n.dispatchEvent({type:"end"}),o=i.NONE};function oT(y){let w;switch(y.button){case 0:w=n.mouseButtons.LEFT;break;case 1:w=n.mouseButtons.MIDDLE;break;case 2:w=n.mouseButtons.RIGHT;break;default:w=-1}switch(w){case yr.DOLLY:if(n.enableZoom===!1)return;B1(y),o=i.DOLLY;break;case yr.ROTATE:if(y.ctrlKey||y.metaKey||y.shiftKey){if(n.enablePan===!1)return;Oc(y),o=i.PAN}else{if(n.enableRotate===!1)return;Cc(y),o=i.ROTATE}break;case yr.PAN:if(y.ctrlKey||y.metaKey||y.shiftKey){if(n.enableRotate===!1)return;Cc(y),o=i.ROTATE}else{if(n.enablePan===!1)return;Oc(y),o=i.PAN}break;default:o=i.NONE}o!==i.NONE&&n.dispatchEvent({type:"start"})}function sT(y){switch(o){case i.ROTATE:if(n.enableRotate===!1)return;Q1(y);break;case i.DOLLY:if(n.enableZoom===!1)return;H1(y);break;case i.PAN:if(n.enablePan===!1)return;q1(y);break}}this.onMouseWheel=function(w){n.enabled===!1||n.enableZoom===!1||o!==i.NONE||(w.preventDefault(),n.dispatchEvent({type:"start"}),$1(w),n.dispatchEvent({type:"end"}))},this.onKeyDown=function(w){n.enabled===!1||n.enablePan===!1||tT(w)};function aT(y){switch(Gc(y),b.length){case 1:switch(n.touches.ONE){case Mr.ROTATE:if(n.enableRotate===!1)return;Kc(),o=i.TOUCH_ROTATE;break;case Mr.PAN:if(n.enablePan===!1)return;Rc(),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;eT(),o=i.TOUCH_DOLLY_PAN;break;case Mr.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;nT(),o=i.TOUCH_DOLLY_ROTATE;break;default:o=i.NONE}break;default:o=i.NONE}o!==i.NONE&&n.dispatchEvent({type:"start"})}function uT(y){switch(Gc(y),o){case i.TOUCH_ROTATE:if(n.enableRotate===!1)return;zc(y),n.update();break;case i.TOUCH_PAN:if(n.enablePan===!1)return;Nc(y),n.update();break;case i.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;rT(y),n.update();break;case i.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;iT(y),n.update();break;default:o=i.NONE}}this.onContextMenu=function(w){n.enabled!==!1&&w.preventDefault()};function lT(y){b.push(y)}function cT(y){delete U[y.pointerId];for(let w=0;w<b.length;w++)if(b[w].pointerId==y.pointerId){b.splice(w,1);return}}function Gc(y){let w=U[y.pointerId];w===void 0&&(w=new St,U[y.pointerId]=w),w.set(y.pageX,y.pageY)}function Wa(y){let w=y.pointerId===b[0].pointerId?b[1]:b[0];return U[w.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 ia=class extends na{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 j(this,null,function*(){return e===void 0&&(e=!1),n===void 0&&(n=500),n<=0?this.setPolarAngle(t,e):It(new Promise(i=>{let o={polar:this.getPolarAngle()},s={polar:t},a=new ra(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):It(new Promise(i=>{let o={azimuthal:this.getAzimuthalAngle()},s={azimuthal:t},a=new ra(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 d1().subVectors(this.target,this.camera.position)}setCameraPositionByTarget(t,e){return j(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 It(new Promise(o=>{let s=new ra(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 j(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?It(new Promise(s=>{let a=new ra(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()),!t)return;this.camera.updateMatrix();let n=new d1;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 JO,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 LO,PCFSoftShadowMap as BO,WebGLRenderer as QO}from"three";var oa=class extends QO{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(T({antialias:!0,alpha:!0},t)),this.event=new LO,this.enable=!0,this.timer=new H,this.autoClear=!0,this.setPixelRatio(window.devicePixelRatio),this.shadowMap.enabled=!0,this.shadowMap.autoUpdate=!0,this.shadowMap.type=BO}};import{Euler as HO,Matrix4 as qO,Scene as $O,EquirectangularReflectionMapping as tK}from"three";import{RGBELoader as eK}from"three/examples/jsm/loaders/RGBELoader.js";var sa=class extends $O{constructor(){super(),new eK().load(XA,t=>{t.mapping=tK,this.environment=t;let e=new qO;e.makeRotationX(Math.PI/2),this.environmentRotation=new HO().setFromRotationMatrix(e)})}};import{OrthographicCamera as nK}from"three";var aa=class extends nK{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 ua=class extends rK{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 aa(t,e),this.renderer.setSize(t,e),this.renderer.setCameraAndScene(this.scene,this.camera),this.renderer.autoRender(),this.control=new ia(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 qs(this)}getRatio(t,e){t===void 0&&(t=new Oe(0,0,0)),e===void 0&&(e=new Oe(100,0,0));let{clientWidth:n,clientHeight:i}=this.container,o=W(t,this.camera,n,i),s=W(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 uK&&(e.color=new aK(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 Pr;i.x=t/this.clientSize.width*2-1,i.y=e/this.clientSize.height*-2+1;let o=new oK;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 sK().setFromObject(t);this.setPolarAngle(h,0);let{max:m,min:g}=p,M=new Oe(g.x,m.y,m.z),P=new Oe(m.x,m.y,m.z),A=new Oe(m.x,g.y,g.z),S=new Oe(g.x,g.y,g.z),_=W(M,this.camera,l,c),I=W(P,this.camera,l,c),x=W(S,this.camera,l,c),O=W(A,this.camera,l,c),U=new iK().setFromPoints([new Pr(_.x,_.y),new Pr(I.x,I.y),new Pr(x.x,x.y),new Pr(O.x,O.y)]).getSize(new Pr),Ar=(l-s-u)/U.x,En=(c-o-a)/U.y,Me=Math.min(Ar,En),Fe=new Oe((m.x+g.x)/2,(m.y+g.y)/2,(m.z+g.z)/2),Dn=Me*this.camera.zoom,dn=this.camera.clone();dn.zoom=Dn,dn.updateMatrix();let Pe=(l-U.x*Me)/2,Xn=(c-U.y*Me)/2,Tr=Pe<s||Pe<u?(s-u)/2:0,wr=Xn<o||Xn<a?(o-a)/2:0;if(Tr){let yt=new Oe;yt.setFromMatrixColumn(dn.matrix,0),yt.normalize(),yt.multiplyScalar(Tr/Dn),Fe.add(yt)}if(wr){let yt=new Oe;yt.setFromMatrixColumn(dn.matrix,1),yt.normalize(),yt.multiplyScalar(wr/Dn),Fe.add(yt)}return{zoom:Me*this.camera.zoom,center:Fe}}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 j(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()),L(this.scene),this.scene.clear(),this.container=null}constructor(t,e){super(),this.container=t,this.config=e,this.scene=new sa,this.renderer=new oa,this.lights=sm(),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 Bs(this),this.hoverHelper=new Qs(this),this.resizeClientSize(),this.registryEvent()}};import{merge as lK}from"lodash";var cK={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 m1(r){return lK({},cK,r)}import{debounce as xK}from"lodash";var Q5=d(v(),1);var te;function g1(r,t){return r===void 0&&(r="aibee_map"),t===void 0&&(t=1),new Promise((e,n)=>{if(te)return e({db:te,type:"success"});let i=indexedDB.open(r,t);i.onupgradeneeded=function(o){te=o.target.result,console.log("onupgradeneeded"),e({db:te,type:"onupgradeneeded"})},i.onsuccess=o=>{te=o.target.result,e({db:te,type:"success"})},i.onerror=o=>{n(o)}})}function Tc(r,t,e){return e===void 0&&(e=te),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 y1(r,t,e,n){return n===void 0&&(n=te),new Promise((i,o)=>(n||o("\u6CA1\u6709db"),new Promise((s,a)=>j(this,null,function*(){let u=yield Tc(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 xn(r,t){t===void 0&&(t=te),t&&(t.objectStoreNames.contains(r)||t.createObjectStore(r,{keyPath:"key"}))}function M1(r){r===void 0&&(r=te),r==null||r.close(),te=null}import{Vector3 as wK,EventDispatcher as SK}from"three";var U5=d(Z(),1),G5=d(v(),1);function la(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 ca(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 P1(r,t,e){switch(r.l_type){case"graph":return hK(r,t);case"wall":return pK(r,t);case"lane":return fK(r,t);case"texture2d":case"texture3d":return dK(r,t);case"glb":return mK(r,t);case"store":return gK(r,t);case"facility":return MK(r,t);case"parkingSpace":return jK(r,t,e);case"text":return TK(r,t)}}function j1(r,t,e){switch(r.l_type){case"store":return yK(r,t,e);case"facility":return PK(r,t,e);case"parkingSpace":return AK(r,t)}}function hK(r,t){let e=t.userData.center;pt(r.elements,e);let n=[];r.elements.forEach(o=>{o.group==="ground"?t.createGround(o):n.push(o)});let i=n.reduce((o,s)=>{let{fillColor:a,fillOpacity:u,strokeColor:l,strokeOpacity:c,height:h,airHeight:p}=s,m=a.toLowerCase()+"-"+u+"-"+l.toLowerCase()+"-"+c+"-"+h+"-"+p;return c===0&&(m=a.toLowerCase()+"-"+u+"-"+h+"-"+p),o[m]?o[m].push(s):o[m]=[s],o},{});Object.values(i).forEach(o=>{let s=new gr(t.context,o);t.mergeGraphicLayer.add(s)})}function pK(r,t){let e=t.userData.center;pt(r.elements,e);let n=r.elements.reduce((i,o)=>{let{fillColor:s,fillOpacity:a,strokeColor:u,strokeOpacity:l,height:c}=o,h=s.toLowerCase()+"-"+a+"-"+u.toLowerCase()+"-"+l+"-"+c;return l===0&&(h=s.toLowerCase()+"-"+a+"-"+c),i[h]?i[h].push(o):i[h]=[o],i},{});Object.values(n).forEach(i=>{let o=new Ns(t.context,i);t.wallLayer.add(o)})}function fK(r,t){let e=t.userData.center;pt(r.elements,e);let n=r.elements.reduce((i,o)=>{let{fillColor:s,fillOpacity:a,strokeColor:u,strokeOpacity:l}=o,c=s.toLowerCase()+"-"+a+"-"+u.toLowerCase()+"-"+l;return l===0&&(c=s.toLowerCase()+"-"+a),i[c]?i[c].push(o):i[c]=[o],i},{});Object.values(n).forEach(i=>{let o=new Gs(t.context,i);t.laneLayer.add(o)})}function dK(r,t){let e=t.userData.center;if(pt(r.elements,e),r.elements.length){let n=new mr(t.context,r.elements);t.textureLayer.add(n)}}function mK(r,t){let e=t.userData.center;pt(r.elements,e),r.elements.forEach(n=>{let i=new Us(t.context,T({},n,{url:n.secondUrl,rotate:n.secondRotate,width:n.secondWidth,center_x:n.center_coord_x,center_y:n.center_coord_y}));t.glbModelLayer.add(i)})}function gK(r,t){let e=t.userData.center;pt(r.elements,e),r.elements.map(n=>{let i=t.addGraphic(n);t.userData.graphics.push(i),t.userData.graphicMap.set(n.id,i)})}function yK(r,t,e){r.elements.map(n=>{try{let i=la(n,e),o=new $(t.context,{id:n.id,icon:n.poi_info.icon,text:i,position:{x:n.center_coord_x,y:n.center_coord_y,z:n.airHeight+n.height},icon_size:[24,24],level:n.poi_info.level||0});t.poiLayer2.pushPoi(o),o&&(o.userData.type="store",o.userData.data=n,o.userData.floor=t.name)}catch(i){console.log("\u521B\u5EFA\u5E97\u94FApoi\u5931\u8D25",i,n)}})}function MK(r,t){let e=t.userData.center;pt(r.elements,e),r.elements.map(n=>{let i=t.addGraphic(n);t.userData.graphics.push(i),t.userData.graphicMap.set(n.id,i)})}function PK(r,t,e){r.elements.filter(i=>i.poi_info).map(i=>{try{let o=ca(i,e),s=new $(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});t.poiLayer2.pushPoi(s),s.userData.type="facility",s.userData.data=i,s.userData.floor=t.name}catch(o){console.log("\u6DFB\u52A0facility\u5931\u8D25",o,i)}})}function jK(r,t,e){let n=t.userData.center;pt(r.elements,n),t.parkingSpaceLayer.createParkings(r.elements,e.mergeParkingSpace),t.userData.parkingSpaces=t.parkingSpaceLayer.graphicMap.values(),t.userData.parkingSpacesGraphicMap=t.parkingSpaceLayer.graphicMap}function AK(r,t){r.elements.filter(n=>n.texts[0]).forEach(n=>{try{let i=new $(t.context,{id:n.id,text:n.texts[0],position:{x:n.center_coord_x,y:n.center_coord_y,z:n.airHeight+n.height}});i&&(i.userData.type="parkingSpace",i.userData.data=n,i.userData.floor=t.name),t.poiLayer2.pushPoi(i)}catch(i){console.log("\u6DFB\u52A0\u8F66\u4F4Dpoi\u5931\u8D25",i,n)}})}function TK(r,t){let e=t.userData.center;pt(r.elements,e);let n=new Vs(t.context,r.elements.map(i=>T({},i,{center_x:i.center_coord_x,center_y:i.center_coord_y})));t.textTextureLayer.add(n)}var wc="map_version",Sc="route_version",bc="facility_version",vc="map_data",ha="road_network_data",_c="facility_data",bK={mergeParkingSpace:!0},pa=class extends SK{initDb(){return j(this,null,function*(){try{let{db:t,type:e}=yield g1("aibee_map",2);e==="onupgradeneeded"&&(xn(wc),xn(Sc),xn(bc),xn(vc),xn(ha),xn(_c)),this.db=t}catch(t){console.log("[\u6253\u5F00indexDb\u9519\u8BEF]",t)}})}load(t){return j(this,null,function*(){if(Array.isArray(t))this.floors=t;else{let e=yield fetch(t).then(n=>n.json());e.code===200&&(this.floors=e.data.list)}})}setCacheData(t,e,n){return this.initDbPromise.then(()=>y1(t,""+e,n,this.db))}getCacheData(t,e){return this.initDbPromise.then(()=>Tc(t,""+e,this.db))}getFloorCacheKey(t){return""+t.floor_id}getFloorData(t){return j(this,null,function*(){let e=yield this.getFloorJsonData(t);return e?this.getDataByJson(e):null})}getFloorDataByFloorInfo(t){return j(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=la(e.userData.data,t)),e.userData.type==="facility"&&(e.options.text=ca(e.userData.data,t))})}getFloorJsonDataByFloorInfo(t){return j(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(vc,e,n),this.setCacheData(wc,e,t.version_id),n})}getFloorJsonData(t){return j(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(wc,n))===e.version_id){let o=yield this.getCacheData(vc,n);if(o)return o}return this.getFloorJsonDataByFloorInfo(e)}catch(i){return console.log("[get floor data error]",i),this.getFloorJsonDataByFloorInfo(e)}})}getRoadNetworkData(){return j(this,null,function*(){return(yield Promise.all(this.floors.map(e=>j(this,null,function*(){let n=this.getFloorCacheKey(e);try{if((yield this.getCacheData(Sc,n))===e.version_id){let s=yield this.getCacheData(ha,n);if(s)return s}let o=yield fetch(e.route_url).then(s=>s.json());return this.setCacheData(ha,n,o),this.setCacheData(Sc,n,e.version_id),o}catch(i){let o=yield fetch(e.route_url).then(s=>s.json());return this.setCacheData(ha,n,o),o}})))).filter(e=>e.points)})}getFacilitiesData(){return j(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=()=>j(this,null,function*(){let i=yield fetch(t.entry_infra_url).then(o=>o.json());return i&&(this.setCacheData(_c,e,i),this.setCacheData(bc,e,t.version_id)),i});try{if((yield this.getCacheData(bc,e))===t.version_id){let o=yield this.getCacheData(_c,e);if(o)return o}return n()}catch(i){return console.log("[get facility error]",i),n()}})}getOtherDataByFreeTime(){return j(this,null,function*(){})}getMulFloorsData(t){return j(this,null,function*(){return Promise.all(t.map(e=>this.getFloorData(e))).then(e=>e.filter(n=>n))})}getDataByUrl(t){return j(this,null,function*(){let e=yield fetch(t).then(n=>n.json());return this.getDataByJson(e)})}getDataByJson(t,e){return j(this,null,function*(){return e=this.getFloorBaseLayer(t,e),yield this.getFloorContentLayer(t,e),this.getFloorPoi(t,e),this.changeFloorBox(t,e),e})}changeFloorBox(t,e){e.updateBox();let n=e.box.getSize(new wK),i=Math.max(n.x,n.y,n.z);e.userData.height=i/4+t.floorHeight}switchFloor(t){return j(this,null,function*(){return new Promise(e=>{let n={run:()=>this._switchFloor(t),meta:{type:"switchFloor"}},i=this.taskQueue.replaceByMetaType(n),o=s=>{let{task:a,res:u}=s;a.tid===i&&(this.taskQueue.removeEventListener("active-task-end",o),e(u))};this.taskQueue.addEventListener("active-task-end",o)})})}_switchFloor(t){return j(this,null,function*(){var e;let n=t;if(typeof t=="string"){let u=yield this.getFloorJsonData(t);if(u)n=u;else return null}let i=new Rt(this.bmap.context),o=this.floors.find(u=>u.floor===n.floor);var s;let a=(s=o==null?void 0:o.map_angle)!=null?s:0;return this.bmap.dispatchEvent({type:at.SWITCH_FLOOR_BEFORE,data:{curFloor:i,graphics:[]}}),this.dispatchEvent({type:"switch-floor-before",data:{curFloor:i,graphics:[]}}),this.bmap.context.control.setAzimuthalAngle(a/180*Math.PI,!0),this.getFloorBaseLayer(n,i),this.changeFloorBox(n,i),this.bmap.buildingCenter=i.userData.center,this.bmap.currentBuildGround=(e=i.userData.data.layers.find(u=>u.l_type==="range"))==null?void 0:e.elements[0],this.bmap.context.switchFloor(i),this.bmap.initialFloorCamera(),this.bmap.context.cameraBound.updateBox(),this.dispatchEvent({type:"switch-floor-ground",data:{curFloor:i,graphics:[]}}),yield Eo(),yield this.getFloorContentLayer(n,i),this.changeFloorBox(n,i),this.dispatchEvent({type:"switch-floor-content",data:{curFloor:i,graphics:[]}}),yield qm(2),this.getFloorPoi(n,i),this.dispatchEvent({type:"switch-floor-after",data:{curFloor:i,graphics:i.graphicLayer.children}}),this.bmap.dispatchEvent({type:at.SWITCH_FLOOR_AFTER,data:{curFloor:i,graphics:i.graphicLayer.children}}),i})}getFloorBaseLayer(t,e){e||(e=new Rt(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":pt(i.elements,n);let s=i.elements.map(a=>new Q(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 j(this,null,function*(){e||(e=new Rt(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)||(P1(o,e,this.options),console.log("time",Date.now()-n,o.l_type),Date.now()-n>50&&(yield Eo(),n=Date.now()))}return e})}getFloorPoi(t,e){let n=Date.now();t.layers.map(o=>{j1(o,e,this.locale)}),console.log("poi time",Date.now()-n);let i=Date.now();Eo().then(()=>{console.log("poi render time",Date.now()-i)})}clear(){return j(this,null,function*(){var t;M1((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 qn,this.locale="zh-cn",this.options=T({},bK,e),this.initDbPromise=this.initDb()}};var lH=d(v(),1);function A1(r,t){return j(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 T1(r,t){return j(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(m=>m.info=JSON.parse(m.info)),p||[]))})}function oH(r,t){return j(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?vK(u.fileId,t):null)})}function vK(r,t){return j(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 w1=class{load(t){return j(this,null,function*(){let e=Bn(t);if(this.cacheData.has(e))return this.cacheData.get(e);let[,n]=yield Promise.all([this.loadBuildGround(t),T1(t,this.bmap.config)]),i=Bn({floor:t.floor,ts:t.ts});pt(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 j(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(at.SWITCH_FLOOR_BEFORE,{curFloor:e,graphics:e.graphicLayer.children}),this.bmap.initialFloorCamera(),this.bmap.triggerHooks(at.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 j(this,null,function*(){let n=yield this.load(T({},t,{resource_type_list:"6"})),i=this.filterData(n,e);this.switchFloorByData(i,e)})}switchFloorByOtherData(t,e){return j(this,null,function*(){let n=yield this.load(T({},t,{resource_type_list:"1,2,3,4"})),i=this.filterData(n,e);this.switchFloorByData(i,e)})}loadBuildGround(t){return j(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 j(this,null,function*(){let{brand:e,project:n}=t,i=Bn({brand:e,project:n});if(this.buildingGroundMap.has(i))return this.buildingGroundMap.get(i);let o=A1({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 j(this,null,function*(){let e=new Rt(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 WH=function(r){return r[r.D2=0]="D2",r[r.D3=1.1]="D3",r}({}),S1=class extends _K{changeBuildingCenter(t,e){let{brand:n,project:i}=e,o=t?vo(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 j(this,null,function*(){return this.loader||(this.loader=new pa(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(at.SWITCH_FLOOR_BEFORE,{curFloor:t,graphics:e}),this.context.switchFloor(t),this.initialFloorCamera(),this.triggerHooks(at.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(T({},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 Q))||[]}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(T({},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){e===void 0&&(e=500);let n=t.getPosition();return this.context.setCameraPosition(n,e)}translateElementToCenterX(t,e){return j(this,null,function*(){return e===void 0&&(e=500),It(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=W(o,u,s,a).x-s/2,h=new WK;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 W(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 j(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 j(this,null,function*(){return this.cancelDistance(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgLine=new Fs(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 zs(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=vo(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,wt.dispose(),Et.dispose(),tn.dispose(),mt.dispose(),G.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 H,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=m1(e),this.context=new ua(t,this.config),this.debounceResize=xK(this.resize,5),this.registryEvent()}};var DH=d(v(),1);import{EventDispatcher as IK}from"three";var gt=class extends IK{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 b1=class extends gt{fetchEquipment(){return j(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(at.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(at.SWITCH_FLOOR_AFTER,this.onSwitchFloor)}};var Nq=d(Lr(),1),Uq=d(pe(),1),Gq=d(v(),1),kq=d(Ac(),1);var rq=d(v(),1),iq=d(Z(),1);import{Mesh as KK,Object3D as RK,TextureLoader as FK,Color as zK,Vector2 as xc,Vector3 as NK,NormalBlending as UK,RepeatWrapping as GK}from"three";var KH=d(Sl(),1),RH=d(ai(),1),FH=d(ui(),1),zH=d(ci(),1),NH=d(hi(),1),UH=d(pi(),1),GH=d(di(),1),kH=d(mi(),1),VH=d(gi(),1),JH=d(yi(),1),LH=d(Mi(),1),BH=d(Pi(),1),QH=d(ji(),1),HH=d(Ti(),1),qH=d(wi(),1),$H=d(Z(),1),tq=d(lc(),1);import{BufferGeometry as YK,Matrix4 as _1,Vector3 as In,Ray as EK,Sphere as DK,LineSegments as XK,BufferAttribute as pn,ShaderChunk as bt,ShaderMaterial as W1,UniformsLib as ZK,Color as CK,Vector2 as v1}from"three";var ht=class extends YK{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 _1,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)}}})}};ht.prototype.setMatrixWorld=function(r){this.matrixWorld=r};ht.prototype.setGeometry=function(r,t){this._geometry=r,this.setPoints(r.getAttribute("position").array,t)};ht.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 In)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 OK(r,t){var e=new _1,n=new EK,i=new DK,o=new In,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 In,u=new In,l=new In,c=this instanceof XK?2:1,h=s.index,p=s.attributes;if(h!==null)for(var m=h.array,g=p.position.array,M=p.width.array,P=0,A=m.length-1;P<A;P+=c){var S=m[P],_=m[P+1];a.fromArray(g,S*3),u.fromArray(g,_*3);var I=M[Math.floor(P/3)]!==void 0?M[Math.floor(P/3)]:1,x=r.params.Line.threshold+this.material.lineWidth*I/2,O=x*x,b=n.distanceSqToSegment(a,u,o,l);if(!(b>O)){o.applyMatrix4(this.matrixWorld);var U=r.ray.origin.distanceTo(o);U<r.near||U>r.far||(t.push({distance:U,point:l.clone().applyMatrix4(this.matrixWorld),index:P,face:null,faceIndex:null,object:this}),P=A)}}}}ht.prototype.raycast=OK;ht.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]};ht.prototype.copyV3=function(r){var t=r*6;return[this.positions[t],this.positions[t+1],this.positions[t+2]]};ht.prototype.getDistance=function(r){let t=0;for(let e=0;e<r;e++){let n=6*e,i=new In(this.positions[n],this.positions[n+1],this.positions[n+2]),o=new In(this.positions[n+6],this.positions[n+7],this.positions[n+8]),s=i.distanceTo(o);t+=s}return t};ht.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 pn(new Float32Array(this.positions),3),previous:new pn(new Float32Array(this.previous),3),next:new pn(new Float32Array(this.next),3),side:new pn(new Float32Array(this.side),1),width:new pn(new Float32Array(this.width),1),uv:new pn(new Float32Array(this.uvs),2),index:new pn(new Uint16Array(this.indices_array),1),counters:new pn(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 Wc(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}ht.prototype.advance=function(r){var t=this._attributes.position.array,e=this._attributes.previous.array,n=this._attributes.next.array,i=t.length;Wc(t,0,e,0,i),Wc(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,Wc(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};bt.meshline_vert=["",bt.logdepthbuf_pars_vertex,bt.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;","",bt.logdepthbuf_vertex,bt.fog_vertex&&" vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",bt.fog_vertex,"}"].join(`
107
+ `,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 sO({uniforms:{maxZ:{value:n},uColor:{value:new BA(this.options[0].fillColor).convertLinearToSRGB()},uColor2:{value:new BA(We(this.options[0].fillColor)).convertLinearToSRGB()},uOpacity:{value:this.options[0].fillOpacity}},vertexShader:t,fragmentShader:e,transparent:!0});this.material=o}initLineMaterial(){let t=G.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 rO(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 LA(u[0],u[1],e)),t.push(new LA(l[0],l[1],e))}}}),t}initLineGeometry(){this.lineGeometry&&this.lineGeometry.dispose();let t=this.getBorderPoints(),e=new iO().setFromPoints(t);this.lineGeometry=e}createBorder(){this.line&&this.remove(this.line);let t=new oO(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=>T({},mc,n)),this.init()}};var tQ=d(v(),1);import{Box2 as Mc,Object3D as uO,Sprite as QA,SpriteMaterial as HA,Vector2 as ks}from"three";import{isNil as Di}from"lodash";var lO={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},$=class extends uO{get durIconAndText(){return this.options.icon&&this.options.text?2:0}get offset(){return this.options.icon&&this.options.text?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.options.text?this.options.text_font_size*this.textAspect:0}get textHeight(){return this.options.text?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!Di(t)&&!Di(e)&&!Di(n)&&!Di(i)&&!Di(o)}get deltaZ(){return!this.options.icon&&this.options.text?.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=>j(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._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 j(this,null,function*(){if(this.options.icon)return this._initIconPromise=new Promise(t=>j(this,null,function*(){let e=yield Et.getTextureByUrl(this.options.icon),n=new QA(new HA({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.options.text){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=wt.getTextureByText(this.options.text),this.textAspect=t.image.width/t.image.height;let e=new QA(new HA({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,text:s}=this.options;o?s?(n=0,i=n*(this.iconHeight/this.textHeight)-this.iconHeight/this.textHeight-this.durIconAndText/this.textHeight):(n=.5,i=0):s?(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 j(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 Mc(new ks(i-s,o-this.iconHeight),new ks(i+s,o)),u=this.textWidth/2,l=new Mc(new ks(i-u,o-this.textHeight-this.durIconAndText-this.iconHeight),new ks(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 Mc,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(T({},lO,e),this),this.position.set(this.options.position.x,this.options.position.y,this.options.position.z),this.registryEvent(),this.init()}};import{DoubleSide as cO,Matrix4 as qA,Mesh as hO,MeshBasicMaterial as pO,Object3D as fO,PlaneGeometry as dO}from"three";import{mergeGeometries as mO}from"three/examples/jsm/utils/BufferGeometryUtils";var gO={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},Vs=class extends fO{init(){return j(this,null,function*(){let t=this.options.map(s=>wt.getTextureByText(s.texts[0],{fillStyle:t0(s.fillColor,s.fillOpacity),strokeStyle:t0(s.strokeColor,s.strokeOpacity),lineWidth:6,font:"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,m=new dO(p,u.secondHeight),g=new qA().makeTranslation(u.center_x,u.center_y,u.airHeight+u.deltaHeight+u.height).multiply(new qA().makeRotationZ(u.secondRotate));return m.applyMatrix4(g),m}),n=mO(e,!0);e.forEach(s=>s.dispose());let i=t.map(s=>{let a=new pO({map:s,alphaTest:1,side:cO});return s.needsUpdate=!0,a}),o=new hO(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=>T({},gO,n)),this.init()}};import{Object3D as yO}from"three";import{Line2 as MO}from"three/examples/jsm/lines/Line2";import{LineGeometry as PO}from"three/examples/jsm/lines/LineGeometry";import{LineMaterial as jO}from"three/examples/jsm/lines/LineMaterial";var Js=class extends yO{registryEvent(){this.context.addEventListener("resize",this.onResize)}setPosition(t,e){this.geometry.setPositions([t.x,t.y,t.z,e.x,e.y,e.z]),this.line||this.createLine()}createLine(){this.line=new MO(this.geometry,this.material),this.line.renderOrder=100003,this.add(this.line)}dispose(){var t;this.line&&L(this.line),this.geometry=null,this.material=null,(t=this.line)==null||t.clear(),this.line=null}constructor(t,e,n){super(),this.context=t,this.geometry=new PO,this.material=new jO({color:0,transparent:!0,depthTest:!1,linewidth:2}),this.line=null,this.onResize=()=>{let{width:i,height:o}=this.context.clientSize;this.material.resolution.set(i,o)},this.onResize(),this.registryEvent(),e&&n&&this.setPosition(e,n)}};import{Frustum as AO}from"three";var Ls=class extends Ft{setEnable(t){super.setEnable(t),st(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=W(this.startPoint,e,n,i),s=W(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 Q&&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 m=W(p,i,o,s);return Be(m,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=W(u,i,o,s),h=W(l,i,o,s);return!(!Be(c,e,n)||!Be(h,e,n))}dispose(){super.dispose(),this.rect=null,this.unRegistryEvent()}constructor(t){super(t),this.frustum=new AO,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=T({},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);st(this.rect,s.x,s.y,a,u)}else st(this.rect,0,0,0,0)};let{config:{selectBox:{fill:e,stroke:n}}}=t;this.rect=Qe(n,e),this.svg.appendChild(this.rect),this.registryEvent()}};var Bs=class extends TO{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))}}),(Jn?e.metaKey:e.ctrlKey)||this._list.clear(),a.forEach(c=>this._list.add(c)),this.selectEnd(),this.downPoint=null},this.onPointerOut=e=>{this.disableBoxSelection()},this.onKeyDown=e=>{Ln(e.key)&&this.enableBoxSelection()},this.onKeyUp=e=>{Ln(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 Ls(t),this.boxSelection.setEnable(!1),this.registryEvent()}};var KQ=d(ie(),1),RQ=d(oe(),1),FQ=d(se(),1),zQ=d(ae(),1),NQ=d(ue(),1),UQ=d(le(),1),GQ=d(ce(),1),kQ=d(v(),1);import{EventDispatcher as wO,Vector2 as SO}from"three";var Qs=class extends wO{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 H,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 m=i.find(g=>g.options.id===p.options.id);if(m instanceof Wn){let{x:g,y:M}=m.clientPos,P=Math.sqrt((g-o.offsetX)**2+(M-o.offsetY)**2);P<h&&(h=P,c=p)}else if(m instanceof $){let{x:g,y:M}=m.box.getCenter(new SO),P=Math.sqrt((g-o.offsetX)**2+(M-o.offsetY)**2);P<h&&(h=P,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 QQ=d(v(),1);import{Box3 as bO,Vector3 as Hs}from"three";var qs=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(P=>P instanceof Rt).length)return null;let e=this.box,{camera:n,clientSize:{width:i,height:o}}=this.context,{min:s,max:a}=e,u=W(s,n,i,o),l=W(a,n,i,o),c=W(new Hs(s.x,a.y,a.z),n,i,o),h=W(new Hs(a.x,s.y,s.z),n,i,o),p=Math.min(u.x,l.x,c.x,h.x),m=Math.max(u.x,l.x,c.x,h.x),g=Math.min(u.y,l.y,c.y,h.y),M=Math.max(u.y,l.y,c.y,h.y);return{left:p,right:m,top:g,bottom:M}}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,m=s-e>=l,g=a-i>=c,M=o>=u;return p&&m&&g&&M}dispose(){this.unRegistryEvent()}constructor(t){this.context=t,this.prevCamera={position:new Hs,zoom:1,target:new Hs},this.enable=!0,this.box=new bO,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 h5=d(Ac(),1);import{Vector3 as d1}from"three";import{Tween as ra,Group as JO}from"@tweenjs/tween.js";var a5=d(v(),1),u5=d(Z(),1);import{EventDispatcher as NO,MOUSE as yr,Quaternion as p1,Spherical as ta,TOUCH as Mr,Vector2 as St,Vector3 as zt,Plane as UO,Ray as GO,MathUtils as kO}from"three";var ea=new GO,f1=new UO,VO=Math.cos(70*kO.DEG2RAD),na=class extends NO{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 St,this.rotateLineEnd=new St,this.spherical=new ta,this.sphericalDelta=new ta,this.object=t,this.domElement=e,this.domElement.style.touchAction="none",this.enabled=!0,this.target=new zt,this.minDistance=0,this.maxDistance=1/0,this.minZoom=0,this.maxZoom=1/0,this.minPolarAngle=0,this.maxPolarAngle=Math.PI,this.minAzimuthAngle=-1/0,this.maxAzimuthAngle=1/0,this.enableDamping=!1,this.dampingFactor=.05,this.enableZoom=!0,this.zoomSpeed=1,this.enableRotate=!0,this.rotateSpeed=1,this.enablePan=!0,this.panSpeed=1,this.keyPanSpeed=7,this.zoomToCursor=!1,this.autoRotate=!1,this.autoRotateSpeed=2,this.keys={LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"},this.screenSpacePanning=!1,this.mouseButtons={LEFT:yr.PAN,MIDDLE:yr.DOLLY,RIGHT:yr.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(y){y.addEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=y},this.stopListenToKeyEvents=function(){var y;(y=this._domElementKeyEvents)==null||y.removeEventListener("keydown",this.onKeyDown),this._domElementKeyEvents=null},this.saveState=function(){n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=function(){n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent({type:"change"}),n.update(),o=i.NONE},this.update=function(){let y=new zt,w=new p1().setFromUnitVectors(t.up,new zt(0,1,0)),R=w.clone().invert(),V=new zt,Mt=new p1,ee=new zt,Nt=2*Math.PI;return function(Sr){Sr===void 0&&(Sr=null);let je=n.object.position;y.copy(je).sub(n.target),y.applyQuaternion(w),a.setFromVector3(y),n.autoRotate&&o===i.NONE&&Me(Ar(Sr)),n.enableDamping?(a.theta+=u.theta*n.dampingFactor,a.phi+=u.phi*n.dampingFactor):(a.theta+=u.theta,a.phi+=u.phi);let Ae=n.minAzimuthAngle,Te=n.maxAzimuthAngle;isFinite(Ae)&&isFinite(Te)&&(Ae<-Math.PI?Ae+=Nt:Ae>Math.PI&&(Ae-=Nt),Te<-Math.PI?Te+=Nt:Te>Math.PI&&(Te-=Nt),Ae<=Te?a.theta=Math.max(Ae,Math.min(Te,a.theta)):a.theta=a.theta>(Ae+Te)/2?Math.max(Ae,a.theta):Math.min(Te,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&&O||n.object.isOrthographicCamera?a.radius=yt(a.radius):a.radius=yt(a.radius*l),y.setFromSpherical(a),y.applyQuaternion(R),je.copy(n.target).add(y),n.object.lookAt(n.target),n.enableDamping===!0?(u.theta*=1-n.dampingFactor,u.phi*=1-n.dampingFactor,c.multiplyScalar(1-n.dampingFactor)):(u.set(0,0,0),c.set(0,0,0));let Ki=!1;if(n.zoomToCursor&&O){let br=null;if(n.object.isPerspectiveCamera){let vr=y.length();br=yt(vr*l);let Ri=vr-br;n.object.position.addScaledVector(I,Ri),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){let vr=new zt(x.x,x.y,0);vr.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/l)),n.object.updateProjectionMatrix(),Ki=!0;let Ri=new zt(x.x,x.y,0);Ri.unproject(n.object),n.object.position.sub(Ri).add(vr),n.object.updateMatrixWorld(),br=y.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;br!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(br).add(n.object.position):(ea.origin.copy(n.object.position),ea.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(ea.direction))<VO?t.lookAt(n.target):(f1.setFromNormalAndCoplanarPoint(n.object.up,n.target),ea.intersectPlane(f1,n.target))))}else n.object.isOrthographicCamera&&(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/l)),n.object.updateProjectionMatrix(),Ki=!0);return l=1,O=!1,Ki||V.distanceToSquared(n.object.position)>s||8*(1-Mt.dot(n.object.quaternion))>s||ee.distanceToSquared(n.target)>0?(n.dispatchEvent({type:"change"}),V.copy(n.object.position),Mt.copy(n.object.quaternion),ee.copy(n.target),Ki=!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 ta,u=new ta,l=1,c=new zt,h=new St,p=new St,m=new St,g=new St,M=new St,P=new St,A=new St,S=new St,_=new St,I=new zt,x=new St,O=!1,b=[],U={};function Ar(y){return y!==null?2*Math.PI/60*n.autoRotateSpeed*y:2*Math.PI/60/60*n.autoRotateSpeed}function En(){return Math.pow(.95,n.zoomSpeed)}function Me(y){u.theta-=y}function Fe(y){u.phi-=y}let Dn=function(){let y=new zt;return function(R,V){y.setFromMatrixColumn(V,0),y.multiplyScalar(-R),c.add(y)}}(),dn=function(){let y=new zt;return function(R,V){n.screenSpacePanning===!0?y.setFromMatrixColumn(V,1):(y.setFromMatrixColumn(V,0),y.crossVectors(n.object.up,y)),y.multiplyScalar(R),c.add(y)}}(),Pe=function(){let y=new zt;return function(R,V){let Mt=n.domElement;if(n.object.isPerspectiveCamera){let ee=n.object.position;y.copy(ee).sub(n.target);let Nt=y.length();Nt*=Math.tan(n.object.fov/2*Math.PI/180),Dn(2*R*Nt/Mt.clientHeight,n.object.matrix),dn(2*V*Nt/Mt.clientHeight,n.object.matrix)}else n.object.isOrthographicCamera?(Dn(R*(n.object.right-n.object.left)/n.object.zoom/Mt.clientWidth,n.object.matrix),dn(V*(n.object.top-n.object.bottom)/n.object.zoom/Mt.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}}();function Xn(y){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?l/=y:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function Tr(y){n.object.isPerspectiveCamera||n.object.isOrthographicCamera?l*=y:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function wr(y){if(!n.zoomToCursor)return;O=!0;let w=n.domElement.getBoundingClientRect(),R=y.clientX-w.left,V=y.clientY-w.top,Mt=w.width,ee=w.height;x.x=R/Mt*2-1,x.y=-(V/ee)*2+1,I.set(x.x,x.y,1).unproject(n.object).sub(n.object.position).normalize()}function yt(y){return Math.max(n.minDistance,Math.min(n.maxDistance,y))}function Cc(y){h.set(y.clientX,y.clientY)}function B1(y){wr(y),A.set(y.clientX,y.clientY)}function Oc(y){g.set(y.clientX,y.clientY)}function Q1(y){p.set(y.clientX,y.clientY),m.subVectors(p,h).multiplyScalar(n.rotateSpeed);let w=n.domElement;Me(2*Math.PI*m.x/w.clientHeight),Fe(2*Math.PI*m.y/w.clientHeight),h.copy(p),n.update()}function H1(y){S.set(y.clientX,y.clientY),_.subVectors(S,A),_.y>0?Xn(En()):_.y<0&&Tr(En()),A.copy(S),n.update()}function q1(y){M.set(y.clientX,y.clientY),P.subVectors(M,g).multiplyScalar(n.panSpeed),Pe(P.x,P.y),g.copy(M),n.update()}function $1(y){wr(y),y.deltaY<0?Tr(En()):y.deltaY>0&&Xn(En()),n.update()}function tT(y){let w=!1;switch(y.code){case n.keys.UP:y.ctrlKey||y.metaKey||y.shiftKey?Fe(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Pe(0,n.keyPanSpeed),w=!0;break;case n.keys.BOTTOM:y.ctrlKey||y.metaKey||y.shiftKey?Fe(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Pe(0,-n.keyPanSpeed),w=!0;break;case n.keys.LEFT:y.ctrlKey||y.metaKey||y.shiftKey?Me(2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Pe(n.keyPanSpeed,0),w=!0;break;case n.keys.RIGHT:y.ctrlKey||y.metaKey||y.shiftKey?Me(-2*Math.PI*n.rotateSpeed/n.domElement.clientHeight):Pe(-n.keyPanSpeed,0),w=!0;break}w&&(y.preventDefault(),n.update())}function Kc(){if(b.length===1)h.set(b[0].pageX,b[0].pageY);else{let y=(b[0].pageX-b[0].pageY)/(b[1].pageX-b[1].pageY),w=b[0].pageY-y*b[0].pageX;n.rotateLineStart.set(y,w);let R=.5*(b[0].pageX+b[1].pageX),V=.5*(b[0].pageY+b[1].pageY);h.set(R,V)}}function Rc(){if(b.length===1)g.set(b[0].pageX,b[0].pageY);else{let y=.5*(b[0].pageX+b[1].pageX),w=.5*(b[0].pageY+b[1].pageY);g.set(y,w)}}function Fc(){let y=b[0].pageX-b[1].pageX,w=b[0].pageY-b[1].pageY,R=Math.sqrt(y*y+w*w);A.set(0,R)}function eT(){n.enableZoom&&Fc(),n.enablePan&&Rc()}function nT(){n.enableZoom&&Fc(),n.enableRotate&&Kc()}function zc(y){if(b.length==1)p.set(y.pageX,y.pageY);else{let R=Wa(y),V=.5*(y.pageX+R.x),Mt=.5*(y.pageY+R.y);p.set(V,Mt);let ee=(y.pageY-R.y)/(y.pageX-R.x),Nt=R.y-ee*R.x;if(n.rotateLineEnd.set(ee,Nt),Number.isFinite(n.rotateLineEnd.x)&&Number.isFinite(n.rotateLineStart.x)){let xa=(n.rotateLineStart.y-n.rotateLineEnd.y)/(n.rotateLineEnd.x-n.rotateLineStart.x),Sr=ee*xa+Nt;if(Number.isFinite(xa)&&Number.isFinite(Sr)){let je=Math.atan(n.rotateLineEnd.x)-Math.atan(n.rotateLineStart.x);Math.PI-Math.abs(je)<.5&&(je=-Math.sign(je)*(Math.PI-Math.abs(je))),Math.abs(je)<.1&&(u.theta+=je)}}n.rotateLineStart.copy(n.rotateLineEnd)}m.subVectors(p,h).multiplyScalar(n.rotateSpeed);let w=n.domElement;Fe(2*Math.PI*m.y/w.clientHeight),h.copy(p)}function Nc(y){if(b.length===1)M.set(y.pageX,y.pageY);else{let w=Wa(y),R=.5*(y.pageX+w.x),V=.5*(y.pageY+w.y);M.set(R,V)}P.subVectors(M,g).multiplyScalar(n.panSpeed),Pe(P.x,P.y),g.copy(M)}function Uc(y){let w=Wa(y),R=y.pageX-w.x,V=y.pageY-w.y,Mt=Math.sqrt(R*R+V*V);S.set(0,Mt),_.set(0,Math.pow(S.y/A.y,n.zoomSpeed)),Xn(_.y),A.copy(S)}function rT(y){n.enableZoom&&Uc(y),n.enablePan&&Nc(y)}function iT(y){n.enableZoom&&Uc(y),n.enableRotate&&zc(y)}this.onPointerDown=function(w){n.enabled!==!1&&(b.length===0&&(n.domElement.setPointerCapture(w.pointerId),n.domElement.addEventListener("pointermove",n.onPointerMove),n.domElement.addEventListener("pointerup",n.onPointerUp)),lT(w),w.pointerType==="touch"?aT(w):oT(w))},this.onPointerMove=function(w){n.enabled!==!1&&(w.pointerType==="touch"?uT(w):sT(w))},this.onPointerUp=function(w){cT(w),b.length===0&&(n.domElement.releasePointerCapture(w.pointerId),n.domElement.removeEventListener("pointermove",n.onPointerMove),n.domElement.removeEventListener("pointerup",n.onPointerUp)),n.dispatchEvent({type:"end"}),o=i.NONE};function oT(y){let w;switch(y.button){case 0:w=n.mouseButtons.LEFT;break;case 1:w=n.mouseButtons.MIDDLE;break;case 2:w=n.mouseButtons.RIGHT;break;default:w=-1}switch(w){case yr.DOLLY:if(n.enableZoom===!1)return;B1(y),o=i.DOLLY;break;case yr.ROTATE:if(y.ctrlKey||y.metaKey||y.shiftKey){if(n.enablePan===!1)return;Oc(y),o=i.PAN}else{if(n.enableRotate===!1)return;Cc(y),o=i.ROTATE}break;case yr.PAN:if(y.ctrlKey||y.metaKey||y.shiftKey){if(n.enableRotate===!1)return;Cc(y),o=i.ROTATE}else{if(n.enablePan===!1)return;Oc(y),o=i.PAN}break;default:o=i.NONE}o!==i.NONE&&n.dispatchEvent({type:"start"})}function sT(y){switch(o){case i.ROTATE:if(n.enableRotate===!1)return;Q1(y);break;case i.DOLLY:if(n.enableZoom===!1)return;H1(y);break;case i.PAN:if(n.enablePan===!1)return;q1(y);break}}this.onMouseWheel=function(w){n.enabled===!1||n.enableZoom===!1||o!==i.NONE||(w.preventDefault(),n.dispatchEvent({type:"start"}),$1(w),n.dispatchEvent({type:"end"}))},this.onKeyDown=function(w){n.enabled===!1||n.enablePan===!1||tT(w)};function aT(y){switch(Gc(y),b.length){case 1:switch(n.touches.ONE){case Mr.ROTATE:if(n.enableRotate===!1)return;Kc(),o=i.TOUCH_ROTATE;break;case Mr.PAN:if(n.enablePan===!1)return;Rc(),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;eT(),o=i.TOUCH_DOLLY_PAN;break;case Mr.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;nT(),o=i.TOUCH_DOLLY_ROTATE;break;default:o=i.NONE}break;default:o=i.NONE}o!==i.NONE&&n.dispatchEvent({type:"start"})}function uT(y){switch(Gc(y),o){case i.TOUCH_ROTATE:if(n.enableRotate===!1)return;zc(y),n.update();break;case i.TOUCH_PAN:if(n.enablePan===!1)return;Nc(y),n.update();break;case i.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;rT(y),n.update();break;case i.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;iT(y),n.update();break;default:o=i.NONE}}this.onContextMenu=function(w){n.enabled!==!1&&w.preventDefault()};function lT(y){b.push(y)}function cT(y){delete U[y.pointerId];for(let w=0;w<b.length;w++)if(b[w].pointerId==y.pointerId){b.splice(w,1);return}}function Gc(y){let w=U[y.pointerId];w===void 0&&(w=new St,U[y.pointerId]=w),w.set(y.pageX,y.pageY)}function Wa(y){let w=y.pointerId===b[0].pointerId?b[1]:b[0];return U[w.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 ia=class extends na{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 j(this,null,function*(){return e===void 0&&(e=!1),n===void 0&&(n=500),n<=0?this.setPolarAngle(t,e):It(new Promise(i=>{let o={polar:this.getPolarAngle()},s={polar:t},a=new ra(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):It(new Promise(i=>{let o={azimuthal:this.getAzimuthalAngle()},s={azimuthal:t},a=new ra(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 d1().subVectors(this.target,this.camera.position)}setCameraPositionByTarget(t,e){return j(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 It(new Promise(o=>{let s=new ra(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 j(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?It(new Promise(s=>{let a=new ra(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()),!t)return;this.camera.updateMatrix();let n=new d1;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 JO,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 LO,PCFSoftShadowMap as BO,WebGLRenderer as QO}from"three";var oa=class extends QO{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(T({antialias:!0,alpha:!0},t)),this.event=new LO,this.enable=!0,this.timer=new H,this.autoClear=!0,this.setPixelRatio(window.devicePixelRatio),this.shadowMap.enabled=!0,this.shadowMap.autoUpdate=!0,this.shadowMap.type=BO}};import{Euler as HO,Matrix4 as qO,Scene as $O,EquirectangularReflectionMapping as tK}from"three";import{RGBELoader as eK}from"three/examples/jsm/loaders/RGBELoader.js";var sa=class extends $O{constructor(){super(),new eK().load(XA,t=>{t.mapping=tK,this.environment=t;let e=new qO;e.makeRotationX(Math.PI/2),this.environmentRotation=new HO().setFromRotationMatrix(e)})}};import{OrthographicCamera as nK}from"three";var aa=class extends nK{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 ua=class extends rK{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 aa(t,e),this.renderer.setSize(t,e),this.renderer.setCameraAndScene(this.scene,this.camera),this.renderer.autoRender(),this.control=new ia(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 qs(this)}getRatio(t,e){t===void 0&&(t=new Oe(0,0,0)),e===void 0&&(e=new Oe(100,0,0));let{clientWidth:n,clientHeight:i}=this.container,o=W(t,this.camera,n,i),s=W(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 uK&&(e.color=new aK(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 Pr;i.x=t/this.clientSize.width*2-1,i.y=e/this.clientSize.height*-2+1;let o=new oK;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 sK().setFromObject(t);this.setPolarAngle(h,0);let{max:m,min:g}=p,M=new Oe(g.x,m.y,m.z),P=new Oe(m.x,m.y,m.z),A=new Oe(m.x,g.y,g.z),S=new Oe(g.x,g.y,g.z),_=W(M,this.camera,l,c),I=W(P,this.camera,l,c),x=W(S,this.camera,l,c),O=W(A,this.camera,l,c),U=new iK().setFromPoints([new Pr(_.x,_.y),new Pr(I.x,I.y),new Pr(x.x,x.y),new Pr(O.x,O.y)]).getSize(new Pr),Ar=(l-s-u)/U.x,En=(c-o-a)/U.y,Me=Math.min(Ar,En),Fe=new Oe((m.x+g.x)/2,(m.y+g.y)/2,(m.z+g.z)/2),Dn=Me*this.camera.zoom,dn=this.camera.clone();dn.zoom=Dn,dn.updateMatrix();let Pe=(l-U.x*Me)/2,Xn=(c-U.y*Me)/2,Tr=Pe<s||Pe<u?(s-u)/2:0,wr=Xn<o||Xn<a?(o-a)/2:0;if(Tr){let yt=new Oe;yt.setFromMatrixColumn(dn.matrix,0),yt.normalize(),yt.multiplyScalar(Tr/Dn),Fe.add(yt)}if(wr){let yt=new Oe;yt.setFromMatrixColumn(dn.matrix,1),yt.normalize(),yt.multiplyScalar(wr/Dn),Fe.add(yt)}return{zoom:Me*this.camera.zoom,center:Fe}}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 j(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()),L(this.scene),this.scene.clear(),this.container=null}constructor(t,e){super(),this.container=t,this.config=e,this.scene=new sa,this.renderer=new oa,this.lights=sm(),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 Bs(this),this.hoverHelper=new Qs(this),this.resizeClientSize(),this.registryEvent()}};import{merge as lK}from"lodash";var cK={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 m1(r){return lK({},cK,r)}import{debounce as xK}from"lodash";var $5=d(v(),1);var te;function g1(r,t){return r===void 0&&(r="aibee_map"),t===void 0&&(t=1),new Promise((e,n)=>{if(te)return e({db:te,type:"success"});let i=indexedDB.open(r,t);i.onupgradeneeded=function(o){te=o.target.result,console.log("onupgradeneeded"),e({db:te,type:"onupgradeneeded"})},i.onsuccess=o=>{te=o.target.result,e({db:te,type:"success"})},i.onerror=o=>{n(o)}})}function Tc(r,t,e){return e===void 0&&(e=te),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 y1(r,t,e,n){return n===void 0&&(n=te),new Promise((i,o)=>(n||o("\u6CA1\u6709db"),new Promise((s,a)=>j(this,null,function*(){let u=yield Tc(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 xn(r,t){t===void 0&&(t=te),t&&(t.objectStoreNames.contains(r)||t.createObjectStore(r,{keyPath:"key"}))}function M1(r){r===void 0&&(r=te),r==null||r.close(),te=null}import{Vector3 as wK,EventDispatcher as SK}from"three";var V5=d(Z(),1),J5=d(v(),1);function la(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 ca(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 P1(r,t,e){switch(r.l_type){case"graph":return hK(r,t);case"wall":return pK(r,t);case"lane":return fK(r,t);case"texture2d":case"texture3d":return dK(r,t);case"glb":return mK(r,t);case"store":return gK(r,t);case"facility":return MK(r,t);case"parkingSpace":return jK(r,t,e);case"text":return TK(r,t)}}function j1(r,t,e){switch(r.l_type){case"store":return yK(r,t,e);case"facility":return PK(r,t,e);case"parkingSpace":return AK(r,t)}}function hK(r,t){let e=t.userData.center;pt(r.elements,e);let n=[];r.elements.forEach(o=>{o.group==="ground"?t.createGround(o):n.push(o)});let i=n.reduce((o,s)=>{let{fillColor:a,fillOpacity:u,strokeColor:l,strokeOpacity:c,height:h,airHeight:p}=s,m=a.toLowerCase()+"-"+u+"-"+l.toLowerCase()+"-"+c+"-"+h+"-"+p;return c===0&&(m=a.toLowerCase()+"-"+u+"-"+h+"-"+p),o[m]?o[m].push(s):o[m]=[s],o},{});Object.values(i).forEach(o=>{let s=new gr(t.context,o);t.mergeGraphicLayer.add(s)})}function pK(r,t){let e=t.userData.center;pt(r.elements,e);let n=r.elements.reduce((i,o)=>{let{fillColor:s,fillOpacity:a,strokeColor:u,strokeOpacity:l,height:c}=o,h=s.toLowerCase()+"-"+a+"-"+u.toLowerCase()+"-"+l+"-"+c;return l===0&&(h=s.toLowerCase()+"-"+a+"-"+c),i[h]?i[h].push(o):i[h]=[o],i},{});Object.values(n).forEach(i=>{let o=new Ns(t.context,i);t.wallLayer.add(o)})}function fK(r,t){let e=t.userData.center;pt(r.elements,e);let n=r.elements.reduce((i,o)=>{let{fillColor:s,fillOpacity:a,strokeColor:u,strokeOpacity:l}=o,c=s.toLowerCase()+"-"+a+"-"+u.toLowerCase()+"-"+l;return l===0&&(c=s.toLowerCase()+"-"+a),i[c]?i[c].push(o):i[c]=[o],i},{});Object.values(n).forEach(i=>{let o=new Gs(t.context,i);t.laneLayer.add(o)})}function dK(r,t){let e=t.userData.center;if(pt(r.elements,e),r.elements.length){let n=new mr(t.context,r.elements);t.textureLayer.add(n)}}function mK(r,t){let e=t.userData.center;pt(r.elements,e),r.elements.forEach(n=>{let i=new Us(t.context,T({},n,{url:n.secondUrl,rotate:n.secondRotate,width:n.secondWidth,center_x:n.center_coord_x,center_y:n.center_coord_y}));t.glbModelLayer.add(i)})}function gK(r,t){let e=t.userData.center;pt(r.elements,e),r.elements.map(n=>{let i=t.addGraphic(n);t.userData.graphics.push(i),t.userData.graphicMap.set(n.id,i)})}function yK(r,t,e){r.elements.map(n=>{try{let i=la(n,e),o=new $(t.context,{id:n.id,icon:n.poi_info.icon,text:i,position:{x:n.center_coord_x,y:n.center_coord_y,z:n.airHeight+n.height},icon_size:[24,24],level:n.poi_info.level||0});t.poiLayer2.pushPoi(o),o&&(o.userData.type="store",o.userData.data=n,o.userData.floor=t.name)}catch(i){console.log("\u521B\u5EFA\u5E97\u94FApoi\u5931\u8D25",i,n)}})}function MK(r,t){let e=t.userData.center;pt(r.elements,e),r.elements.map(n=>{let i=t.addGraphic(n);t.userData.graphics.push(i),t.userData.graphicMap.set(n.id,i)})}function PK(r,t,e){r.elements.filter(i=>i.poi_info).map(i=>{try{let o=ca(i,e),s=new $(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});t.poiLayer2.pushPoi(s),s.userData.type="facility",s.userData.data=i,s.userData.floor=t.name}catch(o){console.log("\u6DFB\u52A0facility\u5931\u8D25",o,i)}})}function jK(r,t,e){let n=t.userData.center;pt(r.elements,n),t.parkingSpaceLayer.createParkings(r.elements,e.mergeParkingSpace),t.userData.parkingSpaces=t.parkingSpaceLayer.graphicMap.values(),t.userData.parkingSpacesGraphicMap=t.parkingSpaceLayer.graphicMap}function AK(r,t){r.elements.filter(n=>n.texts[0]).forEach(n=>{try{let i=new $(t.context,{id:n.id,text:n.texts[0],position:{x:n.center_coord_x,y:n.center_coord_y,z:n.airHeight+n.height}});i&&(i.userData.type="parkingSpace",i.userData.data=n,i.userData.floor=t.name),t.poiLayer2.pushPoi(i)}catch(i){console.log("\u6DFB\u52A0\u8F66\u4F4Dpoi\u5931\u8D25",i,n)}})}function TK(r,t){let e=t.userData.center;pt(r.elements,e);let n=new Vs(t.context,r.elements.map(i=>T({},i,{center_x:i.center_coord_x,center_y:i.center_coord_y})));t.textTextureLayer.add(n)}var wc="map_version",Sc="route_version",bc="facility_version",vc="map_data",ha="road_network_data",_c="facility_data",bK={mergeParkingSpace:!0},pa=class extends SK{initDb(){return j(this,null,function*(){try{let{db:t,type:e}=yield g1("aibee_map",2);e==="onupgradeneeded"&&(xn(wc),xn(Sc),xn(bc),xn(vc),xn(ha),xn(_c)),this.db=t}catch(t){console.log("[\u6253\u5F00indexDb\u9519\u8BEF]",t)}})}load(t){return j(this,null,function*(){if(Array.isArray(t))this.floors=t;else{let e=yield fetch(t).then(n=>n.json());e.code===200&&(this.floors=e.data.list)}})}setCacheData(t,e,n){return this.initDbPromise.then(()=>y1(t,""+e,n,this.db))}getCacheData(t,e){return this.initDbPromise.then(()=>Tc(t,""+e,this.db))}getFloorCacheKey(t){return""+t.floor_id}getFloorData(t){return j(this,null,function*(){let e=yield this.getFloorJsonData(t);return e?this.getDataByJson(e):null})}getFloorDataByFloorInfo(t){return j(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=la(e.userData.data,t)),e.userData.type==="facility"&&(e.options.text=ca(e.userData.data,t))})}getFloorJsonDataByFloorInfo(t){return j(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(vc,e,n),this.setCacheData(wc,e,t.version_id),n})}getFloorJsonData(t){return j(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(wc,n))===e.version_id){let o=yield this.getCacheData(vc,n);if(o)return o}return this.getFloorJsonDataByFloorInfo(e)}catch(i){return console.log("[get floor data error]",i),this.getFloorJsonDataByFloorInfo(e)}})}getRoadNetworkData(){return j(this,null,function*(){return(yield Promise.all(this.floors.map(e=>j(this,null,function*(){let n=this.getFloorCacheKey(e);try{if((yield this.getCacheData(Sc,n))===e.version_id){let s=yield this.getCacheData(ha,n);if(s)return s}let o=yield fetch(e.route_url).then(s=>s.json());return this.setCacheData(ha,n,o),this.setCacheData(Sc,n,e.version_id),o}catch(i){let o=yield fetch(e.route_url).then(s=>s.json());return this.setCacheData(ha,n,o),o}})))).filter(e=>e.points)})}getFacilitiesData(){return j(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=()=>j(this,null,function*(){let i=yield fetch(t.entry_infra_url).then(o=>o.json());return i&&(this.setCacheData(_c,e,i),this.setCacheData(bc,e,t.version_id)),i});try{if((yield this.getCacheData(bc,e))===t.version_id){let o=yield this.getCacheData(_c,e);if(o)return o}return n()}catch(i){return console.log("[get facility error]",i),n()}})}getOtherDataByFreeTime(){return j(this,null,function*(){})}getMulFloorsData(t){return j(this,null,function*(){return Promise.all(t.map(e=>this.getFloorData(e))).then(e=>e.filter(n=>n))})}getDataByUrl(t){return j(this,null,function*(){let e=yield fetch(t).then(n=>n.json());return this.getDataByJson(e)})}getDataByJson(t,e){return j(this,null,function*(){return e=this.getFloorBaseLayer(t,e),yield this.getFloorContentLayer(t,e),this.getFloorPoi(t,e),this.changeFloorBox(t,e),e})}changeFloorBox(t,e){e.updateBox();let n=e.box.getSize(new wK),i=Math.max(n.x,n.y,n.z);e.userData.height=i/4+t.floorHeight}switchFloor(t){return j(this,null,function*(){return new Promise(e=>{let n={run:()=>this._switchFloor(t),meta:{type:"switchFloor"}},i=this.taskQueue.replaceByMetaType(n),o=s=>{let{task:a,res:u}=s;a.tid===i&&(this.taskQueue.removeEventListener("active-task-end",o),e(u))};this.taskQueue.addEventListener("active-task-end",o)})})}_switchFloor(t){return j(this,null,function*(){var e;let n=t;if(typeof t=="string"){let u=yield this.getFloorJsonData(t);if(u)n=u;else return null}let i=new Rt(this.bmap.context),o=this.floors.find(u=>u.floor===n.floor);var s;let a=(s=o==null?void 0:o.map_angle)!=null?s:0;return this.bmap.dispatchEvent({type:at.SWITCH_FLOOR_BEFORE,data:{curFloor:i,graphics:[]}}),this.dispatchEvent({type:"switch-floor-before",data:{curFloor:i,graphics:[]}}),this.bmap.context.control.setAzimuthalAngle(a/180*Math.PI,!0),this.getFloorBaseLayer(n,i),this.changeFloorBox(n,i),this.bmap.buildingCenter=i.userData.center,this.bmap.currentBuildGround=(e=i.userData.data.layers.find(u=>u.l_type==="range"))==null?void 0:e.elements[0],this.bmap.context.switchFloor(i),this.bmap.initialFloorCamera(),this.bmap.context.cameraBound.updateBox(),this.dispatchEvent({type:"switch-floor-ground",data:{curFloor:i,graphics:[]}}),yield Eo(),yield this.getFloorContentLayer(n,i),this.changeFloorBox(n,i),this.dispatchEvent({type:"switch-floor-content",data:{curFloor:i,graphics:[]}}),yield qm(2),this.getFloorPoi(n,i),this.dispatchEvent({type:"switch-floor-after",data:{curFloor:i,graphics:i.graphicLayer.children}}),this.bmap.dispatchEvent({type:at.SWITCH_FLOOR_AFTER,data:{curFloor:i,graphics:i.graphicLayer.children}}),i})}getFloorBaseLayer(t,e){e||(e=new Rt(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":pt(i.elements,n);let s=i.elements.map(a=>new Q(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 j(this,null,function*(){e||(e=new Rt(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)||(P1(o,e,this.options),console.log("time",Date.now()-n,o.l_type),Date.now()-n>50&&(yield Eo(),n=Date.now()))}return e})}getFloorPoi(t,e){let n=Date.now();t.layers.map(o=>{j1(o,e,this.locale)}),console.log("poi time",Date.now()-n);let i=Date.now();Eo().then(()=>{console.log("poi render time",Date.now()-i)})}clear(){return j(this,null,function*(){var t;M1((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 qn,this.locale="zh-cn",this.options=T({},bK,e),this.initDbPromise=this.initDb()}};var pH=d(v(),1);function A1(r,t){return j(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 T1(r,t){return j(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(m=>m.info=JSON.parse(m.info)),p||[]))})}function uH(r,t){return j(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?vK(u.fileId,t):null)})}function vK(r,t){return j(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 w1=class{load(t){return j(this,null,function*(){let e=Bn(t);if(this.cacheData.has(e))return this.cacheData.get(e);let[,n]=yield Promise.all([this.loadBuildGround(t),T1(t,this.bmap.config)]),i=Bn({floor:t.floor,ts:t.ts});pt(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 j(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(at.SWITCH_FLOOR_BEFORE,{curFloor:e,graphics:e.graphicLayer.children}),this.bmap.initialFloorCamera(),this.bmap.triggerHooks(at.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 j(this,null,function*(){let n=yield this.load(T({},t,{resource_type_list:"6"})),i=this.filterData(n,e);this.switchFloorByData(i,e)})}switchFloorByOtherData(t,e){return j(this,null,function*(){let n=yield this.load(T({},t,{resource_type_list:"1,2,3,4"})),i=this.filterData(n,e);this.switchFloorByData(i,e)})}loadBuildGround(t){return j(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 j(this,null,function*(){let{brand:e,project:n}=t,i=Bn({brand:e,project:n});if(this.buildingGroundMap.has(i))return this.buildingGroundMap.get(i);let o=A1({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 j(this,null,function*(){let e=new Rt(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 YH=function(r){return r[r.D2=0]="D2",r[r.D3=1.1]="D3",r}({}),S1=class extends _K{changeBuildingCenter(t,e){let{brand:n,project:i}=e,o=t?vo(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 j(this,null,function*(){return this.loader||(this.loader=new pa(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(at.SWITCH_FLOOR_BEFORE,{curFloor:t,graphics:e}),this.context.switchFloor(t),this.initialFloorCamera(),this.triggerHooks(at.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(T({},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 Q))||[]}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(T({},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){e===void 0&&(e=500);let n=t.getPosition();return this.context.setCameraPosition(n,e)}translateElementToCenterX(t,e){return j(this,null,function*(){return e===void 0&&(e=500),It(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=W(o,u,s,a).x-s/2,h=new WK;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 W(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 j(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 j(this,null,function*(){return this.cancelDistance(),new Promise((t,e)=>{this.changeMapType("2d",0),this.context.control.enableRotate=!1,this.svgLine=new Fs(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 zs(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=vo(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,wt.dispose(),Et.dispose(),tn.dispose(),mt.dispose(),G.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 H,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=m1(e),this.context=new ua(t,this.config),this.debounceResize=xK(this.resize,5),this.registryEvent()}};var CH=d(v(),1);import{EventDispatcher as IK}from"three";var gt=class extends IK{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 b1=class extends gt{fetchEquipment(){return j(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(at.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(at.SWITCH_FLOOR_AFTER,this.onSwitchFloor)}};var kq=d(Lr(),1),Vq=d(pe(),1),Jq=d(v(),1),Lq=d(Ac(),1);var sq=d(v(),1),aq=d(Z(),1);import{Mesh as KK,Object3D as RK,TextureLoader as FK,Color as zK,Vector2 as xc,Vector3 as NK,NormalBlending as UK,RepeatWrapping as GK}from"three";var zH=d(Sl(),1),NH=d(ai(),1),UH=d(ui(),1),GH=d(ci(),1),kH=d(hi(),1),VH=d(pi(),1),JH=d(di(),1),LH=d(mi(),1),BH=d(gi(),1),QH=d(yi(),1),HH=d(Mi(),1),qH=d(Pi(),1),$H=d(ji(),1),tq=d(Ti(),1),eq=d(wi(),1),nq=d(Z(),1),rq=d(lc(),1);import{BufferGeometry as YK,Matrix4 as _1,Vector3 as In,Ray as EK,Sphere as DK,LineSegments as XK,BufferAttribute as pn,ShaderChunk as bt,ShaderMaterial as W1,UniformsLib as ZK,Color as CK,Vector2 as v1}from"three";var ht=class extends YK{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 _1,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)}}})}};ht.prototype.setMatrixWorld=function(r){this.matrixWorld=r};ht.prototype.setGeometry=function(r,t){this._geometry=r,this.setPoints(r.getAttribute("position").array,t)};ht.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 In)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 OK(r,t){var e=new _1,n=new EK,i=new DK,o=new In,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 In,u=new In,l=new In,c=this instanceof XK?2:1,h=s.index,p=s.attributes;if(h!==null)for(var m=h.array,g=p.position.array,M=p.width.array,P=0,A=m.length-1;P<A;P+=c){var S=m[P],_=m[P+1];a.fromArray(g,S*3),u.fromArray(g,_*3);var I=M[Math.floor(P/3)]!==void 0?M[Math.floor(P/3)]:1,x=r.params.Line.threshold+this.material.lineWidth*I/2,O=x*x,b=n.distanceSqToSegment(a,u,o,l);if(!(b>O)){o.applyMatrix4(this.matrixWorld);var U=r.ray.origin.distanceTo(o);U<r.near||U>r.far||(t.push({distance:U,point:l.clone().applyMatrix4(this.matrixWorld),index:P,face:null,faceIndex:null,object:this}),P=A)}}}}ht.prototype.raycast=OK;ht.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]};ht.prototype.copyV3=function(r){var t=r*6;return[this.positions[t],this.positions[t+1],this.positions[t+2]]};ht.prototype.getDistance=function(r){let t=0;for(let e=0;e<r;e++){let n=6*e,i=new In(this.positions[n],this.positions[n+1],this.positions[n+2]),o=new In(this.positions[n+6],this.positions[n+7],this.positions[n+8]),s=i.distanceTo(o);t+=s}return t};ht.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 pn(new Float32Array(this.positions),3),previous:new pn(new Float32Array(this.previous),3),next:new pn(new Float32Array(this.next),3),side:new pn(new Float32Array(this.side),1),width:new pn(new Float32Array(this.width),1),uv:new pn(new Float32Array(this.uvs),2),index:new pn(new Uint16Array(this.indices_array),1),counters:new pn(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 Wc(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}ht.prototype.advance=function(r){var t=this._attributes.position.array,e=this._attributes.previous.array,n=this._attributes.next.array,i=t.length;Wc(t,0,e,0,i),Wc(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,Wc(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};bt.meshline_vert=["",bt.logdepthbuf_pars_vertex,bt.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;","",bt.logdepthbuf_vertex,bt.fog_vertex&&" vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",bt.fog_vertex,"}"].join(`
108
108
  `);bt.meshline_frag=["",bt.fog_pars_fragment,bt.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() {","",bt.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);","",bt.fog_fragment,"if (vUV.x <= thresholdRatio) {","gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);","}","}"].join(`
109
- `);var Yn=class extends W1{constructor(t){super({uniforms:Object.assign({},ZK.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new CK(16777215)},opacity:{value:1},resolution:{value:new v1(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 v1(1,1)},thresholdRatio:{value:0},transparent:{value:!0},depthTest:{vale:!1},depthWrite:{value:!1}}),vertexShader:bt.meshline_vert,fragmentShader:bt.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)}};Yn.prototype.copy=function(r){return W1.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 x1={texture_url:_s,lineWidth:10,color:16777215},fa=class extends RK{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 W(new NK(u,l,0),e,n,i)}).map(a=>{let{x:u,y:l}=a;return[u,l]});return xt(o)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new xc(t,1)}loadTexture(t){return new Promise((e,n)=>{new FK().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 j(this,null,function*(){let e=this.geometry=new ht;if(this.updatePoints(t),!this.texture){let o=this.texture=yield this.loadTexture(this.config.texture_url);o.wrapS=o.wrapT=GK}let n=this.material=new Yn({useMap:!0,color:new zK(this.config.color),transparent:!0,resolution:new xc(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:UK,repeat:new xc(this.getRepeat(),1)}),i=this.mesh=new KK(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=x1,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({},x1,e),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}};import{Tween as Ic,Easing as $K}from"@tweenjs/tween.js";import{Vector2 as tR,Vector3 as Re}from"three";var pq=d(Zs(),1),fq=d(v(),1),dq=d(Z(),1);import{EventDispatcher as kK,Vector2 as VK}from"three";import{Tween as JK}from"@tweenjs/tween.js";import{throttle as LK}from"lodash";var BK={offsetDistance:15,offsetToResetTime:3e3,directionEmitThreshold:5,simulationSpeed:1},da=class extends kK{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)}resetStatus(t){this.offset=!1,this.reset=!1,this.routeIndex=0,this.pointIndex=0,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;if(i){let g=_e(n,i);u=u.slice(g+1),u.unshift(i)}let l=[{floor:o==null?void 0:o.floor,points:u},...s.slice(a+1)],{distance:c,closestPoint:h,index:p,i:m}=l.reduce((g,M,P)=>{if(M.floor!==t)return g;let{distance:A,closestPoint:S,index:_}=M.points.reduce((I,x,O,b)=>{if(!b[O+1])return T({},I,{distance:I.distance===1/0?K(x,e):I.distance});let{distance:U,closestPoint:Ar}=ng(e,x,b[O+1]);return U<I.distance?{distance:U,closestPoint:Ar,index:O}:I},{distance:1/0,closestPoint:M.points[0],index:0});return A<g.distance?{distance:A,closestPoint:S,index:P,i:_}:g},{distance:1/0,closestPoint:u[0],index:0,i:0});return{distance:c,closestPoint:h,routeIndex:p+a,pointIndex:p===0?m+this.pointIndex:m}}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 j(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=LK(l=>{let c=Qn(i,l.distance);c&&(e.push({floor:t.floor,pos:c}),this.toPosition(t.floor,c))},100),u=this.simulationTween=new JK({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 xt(i)}getCurRouteToStartDistance(){let{curRoutePathPoints:t,pointIndex:e,position:n}=this;if(!t.length)return 0;let i=[...t.slice(0,e+1),n];return xt(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=xe.FRONT,u=(o==null||(t=o.pointInfos[s])==null?void 0:t.crossName)||"",l=0,c=0,h=0;for(;a===xe.FRONT&&s<=n.length;){let g=n[s],M=n[s+1],P=n[s+2];if(!g||!M)a=xe.END;else if(l+=K(g,M),!P)a=xe.END;else{a=u0(g,M,P),c=_o(g,M,P),h=(new VK(P[0]-M[0],P[1]-M[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=K(i,n[s])),a===xe.END&&l<=this.options.directionEmitThreshold)return{dir:a,distance:l,crossName:u,angle:c,nextAngle:h};let m=this.getCurRouteToStartDistance();return e===0&&m<=5?{dir:xe.START,distance:l,crossName:u,angle:c,nextAngle:h}:(l>=this.options.directionEmitThreshold&&(a=xe.FRONT),{dir:a,distance:l,crossName:u,angle:c,nextAngle:h})}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;return e<=10&&(i=xe.END),{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}}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 H,this.resetTimer=null,this.tweenUtil=new en,this.paused=!1,this.onAddPaths=i=>{let{paths:o}=i;this.paths=o,this.resetStatus(o)},this.onUpdate=()=>{this.tweenUtil.update()},this.options=Object.assign({},BK,e),this.roadData=n,this.registryEvent()}};var Aq=d(os(),1),Tq=d(ai(),1),wq=d(ui(),1),Sq=d(ci(),1),bq=d(hi(),1),vq=d(pi(),1),_q=d(di(),1),Wq=d(mi(),1),xq=d(gi(),1),Iq=d(yi(),1),Yq=d(Mi(),1),Eq=d(Pi(),1),Dq=d(ji(),1),Xq=d(Ti(),1),Zq=d(wi(),1),Cq=d(wl(),1),Oq=d(v(),1);import{DataTexture as QK,LinearFilter as I1,RGBAFormat as Y1,Sprite as HK,SpriteMaterial as qK}from"three";var Ke=class r extends ${addDebug(){r.canvas.style.cssText=`
109
+ `);var Yn=class extends W1{constructor(t){super({uniforms:Object.assign({},ZK.fog,{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new CK(16777215)},opacity:{value:1},resolution:{value:new v1(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 v1(1,1)},thresholdRatio:{value:0},transparent:{value:!0},depthTest:{vale:!1},depthWrite:{value:!1}}),vertexShader:bt.meshline_vert,fragmentShader:bt.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)}};Yn.prototype.copy=function(r){return W1.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 x1={texture_url:_s,lineWidth:10,color:16777215},fa=class extends RK{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 W(new NK(u,l,0),e,n,i)}).map(a=>{let{x:u,y:l}=a;return[u,l]});return xt(o)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new xc(t,1)}loadTexture(t){return new Promise((e,n)=>{new FK().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 j(this,null,function*(){let e=this.geometry=new ht;if(this.updatePoints(t),!this.texture){let o=this.texture=yield this.loadTexture(this.config.texture_url);o.wrapS=o.wrapT=GK}let n=this.material=new Yn({useMap:!0,color:new zK(this.config.color),transparent:!0,resolution:new xc(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:UK,repeat:new xc(this.getRepeat(),1)}),i=this.mesh=new KK(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=x1,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({},x1,e),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}};import{Tween as Ic,Easing as $K}from"@tweenjs/tween.js";import{Vector2 as tR,Vector3 as Re}from"three";var mq=d(Zs(),1),gq=d(v(),1),yq=d(Z(),1);import{EventDispatcher as kK,Vector2 as VK}from"three";import{Tween as JK}from"@tweenjs/tween.js";import{throttle as LK}from"lodash";var BK={offsetDistance:15,offsetToResetTime:3e3,directionEmitThreshold:5,simulationSpeed:1},da=class extends kK{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)}resetStatus(t){this.offset=!1,this.reset=!1,this.routeIndex=0,this.pointIndex=0,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;if(i){let g=_e(n,i);u=u.slice(g+1),u.unshift(i)}let l=[{floor:o==null?void 0:o.floor,points:u},...s.slice(a+1)],{distance:c,closestPoint:h,index:p,i:m}=l.reduce((g,M,P)=>{if(M.floor!==t)return g;let{distance:A,closestPoint:S,index:_}=M.points.reduce((I,x,O,b)=>{if(!b[O+1])return T({},I,{distance:I.distance===1/0?K(x,e):I.distance});let{distance:U,closestPoint:Ar}=ng(e,x,b[O+1]);return U<I.distance?{distance:U,closestPoint:Ar,index:O}:I},{distance:1/0,closestPoint:M.points[0],index:0});return A<g.distance?{distance:A,closestPoint:S,index:P,i:_}:g},{distance:1/0,closestPoint:u[0],index:0,i:0});return{distance:c,closestPoint:h,routeIndex:p+a,pointIndex:p===0?m+this.pointIndex:m}}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 j(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=LK(l=>{let c=Qn(i,l.distance);c&&(e.push({floor:t.floor,pos:c}),this.toPosition(t.floor,c))},100),u=this.simulationTween=new JK({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 xt(i)}getCurRouteToStartDistance(){let{curRoutePathPoints:t,pointIndex:e,position:n}=this;if(!t.length)return 0;let i=[...t.slice(0,e+1),n];return xt(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=xe.FRONT,u=(o==null||(t=o.pointInfos[s])==null?void 0:t.crossName)||"",l=0,c=0,h=0;for(;a===xe.FRONT&&s<=n.length;){let g=n[s],M=n[s+1],P=n[s+2];if(!g||!M)a=xe.END;else if(l+=K(g,M),!P)a=xe.END;else{a=u0(g,M,P),c=_o(g,M,P),h=(new VK(P[0]-M[0],P[1]-M[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=K(i,n[s])),a===xe.END&&l<=this.options.directionEmitThreshold)return{dir:a,distance:l,crossName:u,angle:c,nextAngle:h};let m=this.getCurRouteToStartDistance();return e===0&&m<=5?{dir:xe.START,distance:l,crossName:u,angle:c,nextAngle:h}:(l>=this.options.directionEmitThreshold&&(a=xe.FRONT),{dir:a,distance:l,crossName:u,angle:c,nextAngle:h})}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;return e<=10&&(i=xe.END),{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}}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 H,this.resetTimer=null,this.tweenUtil=new en,this.paused=!1,this.onAddPaths=i=>{let{paths:o}=i;this.paths=o,this.resetStatus(o)},this.onUpdate=()=>{this.tweenUtil.update()},this.options=Object.assign({},BK,e),this.roadData=n,this.registryEvent()}};var Sq=d(os(),1),bq=d(ai(),1),vq=d(ui(),1),_q=d(ci(),1),Wq=d(hi(),1),xq=d(pi(),1),Iq=d(di(),1),Yq=d(mi(),1),Eq=d(gi(),1),Dq=d(yi(),1),Xq=d(Mi(),1),Zq=d(Pi(),1),Cq=d(ji(),1),Oq=d(Ti(),1),Kq=d(wi(),1),Rq=d(wl(),1),Fq=d(v(),1);import{DataTexture as QK,LinearFilter as I1,RGBAFormat as Y1,Sprite as HK,SpriteMaterial as qK}from"three";var Ke=class r extends ${addDebug(){r.canvas.style.cssText=`
110
110
  position: fixed;
111
111
  top: 0;
112
112
  left: 0;
113
113
  z-index: 9999;
114
- `,document.body.appendChild(r.canvas)}setAngle(t){if(console.log("angle",t),r.textureMap.has(t))this._initIcon(r.textureMap.get(t));else{this.draw(t);let e=this.getTexture(this.getImageData());r.textureMap.set(t,e),this._initIcon(e),this._initScale({zoom:this.bmap.context.camera.zoom})}}_initIcon(t){if(this.spriteIcon)this.spriteIcon.material.map=t,t.needsUpdate=!0;else{let e=new HK(new qK({map:t,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test,rotation:this.options.icon_rotate/180*Math.PI}));e.renderOrder=1e5+this.options.level,t.needsUpdate=!0,this.add(e),e.center.set(.5,.5),this.spriteIcon=e}}initSize(){this.spriteIcon&&this.spriteIcon.center.set(.5,.5)}draw(t){let{ctx:e}=r,{config:{size:n}}=this,i=n[0]/2,o=n[1]/2,s=4,a=1,u=s+a;if(e.clearRect(0,0,n[0],n[1]),e.setLineDash([10,10]),e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),e.arc(i,o,o-u,-Math.PI/2,Math.PI*2-Math.PI/2,t<Math.PI),e.stroke(),e.strokeStyle="#0A7AFF",t<Math.PI){let l=-Math.PI/2,c=l-t;e.beginPath(),e.arc(i,o,o-u,l,c,!0)}else{let l=-Math.PI/2,c=l+Math.PI*2-t;e.beginPath(),e.arc(i,o,o-u,l,c,!1)}e.stroke(),e.clearRect(i-u*2,0,u*4,u*4),e.beginPath(),e.arc(i,u,s,0,Math.PI*2),e.fillStyle="#0A7AFF",e.fill(),e.setLineDash([10,0]),e.strokeStyle="#fff",e.lineWidth=a,e.stroke(),e.clearRect(0,o-5,10,10),e.clearRect(i-5,n[1]-10,10,10),e.clearRect(n[0]-10,o-5,10,10),t>Math.PI/2&&t<Math.PI?e.fillStyle="#0A7AFF":e.fillStyle="#fff",e.fillRect(0,o-1,10,2),e.fillStyle="#fff",e.fillRect(i-1,n[1]-10,2,10),t>Math.PI&&t<Math.PI/2*3?e.fillStyle="#0A7AFF":e.fillStyle="#fff",e.fillRect(n[0]-10,o-1,10,2)}getImageData(){let{ctx:t}=r,{config:{size:e}}=this;return t.getImageData(0,0,e[0],e[1])}getTexture(t){let{config:{size:e}}=this,n=new QK(Uint8Array.from(t.data),e[0],e[1],Y1);return n.format=Y1,n.magFilter=I1,n.minFilter=I1,n.colorSpace="srgb",n.flipY=!0,n}dispose(){var t;super.dispose(),(t=this.spriteIcon)==null||t.material.dispose()}static dispose(){this.textureMap.forEach(t=>{t.dispose()}),this.textureMap.clear(),this.ctx=null,this.canvas=null}constructor(t,e){super(t.context,{icon_size:e.size,collision_enable:!1,level:2}),this.bmap=t,this.config=e,r.canvas.width=e.size[0],r.canvas.height=e.size[1]}};Ke.canvas=document.createElement("canvas");Ke.ctx=Ke.canvas.getContext("2d",{willReadFrequently:!0});Ke.textureMap=new Map;var eR={path:{},cheapMaximumDistance:20,needStartPoi:!1,startPoi:{},positionNavigation:{},offsetY:150,directionEmitThreshold:5,disablePathAnimation:!1,speed:1,roadData:[],runAnimationMaxTime:1,navigationCameraBasic:45},E1=class extends gt{get curFloorPathLength(){var t,e;return(e=(t=this.curFloorPath)==null?void 0:t.distance)!=null?e:0}get curFloorPathPoints(){var t,e;return(e=(t=this.curFloorPath)==null?void 0:t.points)!=null?e:[]}registryEvent(){this.bmap.context.addEventListener("update",this.onUpdate),this.bmap.addEventListener(at.SWITCH_FLOOR_AFTER,this.onSwitchFloor),this.positionNavigation.addEventListener("navigation-info",this.onNavigationInfo),this.bmap.context.addEventListener("control-change",this.onControlChangeForStartPoi)}showStartRotateHelperPoi(){var t;if(this.needStartRotateHelperPoi=!0,!this.startPoi||this.startRotateHelperPoi)return;let e=this.startPoi.options.icon_size;this.startRotateHelperPoi=new Ke(this.bmap,{size:[e[0]+20,e[1]+20]}),this.startRotateHelperPoi.setAngle(0),this.startRotateHelperPoi.position.setZ(.51),(t=this.bmap.context.currentFloor)==null||t.poiLayer2.pushPoi(this.startRotateHelperPoi)}hideStartRotateHelperPoi(){if(this.needStartRotateHelperPoi=!1,this.startRotateHelperPoi){var t;(t=this.bmap.context.currentFloor)==null||t.poiLayer2.removePoi(this.startRotateHelperPoi),this.startRotateHelperPoi=null}}setStartPoiPosition(t,e){this.startPoi&&(this.startPoi.position.setX(t).setY(e),this.startRotateHelperPoi&&this.startRotateHelperPoi.position.setX(t).setY(e),this.detachLine&&this.detachLine.setPosition(this.startPoi.position,this.detachStartPoi.position))}toPositionByTask(t){var e;let i=(e=this.taskQueue.getTasks().find(s=>s.meta.type==="toPosition"))==null?void 0:e.tid,o={run:()=>this.toPositionBySpeed(t,this.options.speed),meta:{type:"toPosition"}};i?this.taskQueue.replace(i,o):this.taskQueue.add(o)}pauseAnimation(){this.taskQueue.clear(),this.positionNavigation.pause(),this.tweenUtil.pause()}continueAnimation(){this.tweenUtil.continue(),this.positionNavigation.continue()}clearTween(){this.tweenUtil.clear(),this.taskQueue.clear(),this.bmap.context.control.enabled=!0}unRegistryEvent(){this.bmap.context.removeEventListener("update",this.onUpdate),this.bmap.removeEventListener(at.SWITCH_FLOOR_AFTER,this.onSwitchFloor),this.positionNavigation.removeEventListener("navigation-info",this.onNavigationInfo),this.bmap.context.removeEventListener("control-change",this.onControlChangeForStartPoi)}clearPath(){if(this.path&&(this.bmap.context.scene.remove(this.path),this.path.dispose(),this.path=null,this.clearTween()),this.startPoi){var t;if((t=this.bmap.context.currentFloor)==null||t.poiLayer2.removePoi(this.startPoi),this.startPoi=null,this.startRotateHelperPoi){var e;(e=this.bmap.context.currentFloor)==null||e.poiLayer2.removePoi(this.startRotateHelperPoi),this.startRotateHelperPoi=null}}this.translatePath=null}setCurFloorPath(t){t===null?(this.curFloorPath=null,this.currentPathPosition=null,this.toPointPosition=null):(this.curFloorPath=t,this.currentPathPosition=t.points[0],this.toPointPosition=t.points[0]),this.movedDistance=0,this.clearTween()}setCurPathIndex(t){var e,n;this.curPathIndex=t,((e=this.paths[t])==null?void 0:e.floor)===((n=this.bmap.context.currentFloor)==null?void 0:n.name)?(this.setCurFloorPath(this.paths[t]),this.renderPath(this.translatePoints(this.curFloorPathPoints))):this.clearPath()}addPath(t,e){e===void 0&&(e=0);var n;this.paths=t,this.curPathIndex=e,this.clearTween();let i=(n=this.bmap.context.currentFloor)==null?void 0:n.name,o=t[e];if(i&&(o==null?void 0:o.floor)===i)if(this.setCurFloorPath(o),this.bmap.currentBuildGround)this.renderPath(this.translatePoints(o.points));else{let s=()=>{this.bmap.removeEventListener("center-change",s),this.renderPath(this.translatePoints(o.points))};this.bmap.addEventListener("center-change",s)}else this.clearPath();this.dispatchEvent({type:"add-path",paths:t})}translatePoints(t){let[e,n]=this.bmap.buildingCenter;return t.map(i=>[i[0]-e,i[1]-n])}renderPath(t){this.translatePath=t;let e=this.catmullRomCurve3(t);if(this.cPath=e,this.animationPathOptions={cPathIndex:0},this.pathStart=e[0],this.path?this.path.updatePoints(e):(this.path=new fa(this,this.options.path),this.path.create(e),this.path.position.z=this.bmap.context.currentFloor.groundMaxHeight+.5,this.bmap.context.scene.add(this.path)),this.path.movePath(0),this.startPoi){var n;if((n=this.bmap.context.currentFloor)==null||n.poiLayer2.removePoi(this.startPoi),this.startPoi=null,this.startRotateHelperPoi){var i;(i=this.bmap.context.currentFloor)==null||i.poiLayer2.removePoi(this.startRotateHelperPoi),this.startRotateHelperPoi=null}}if(this.detachStartPoi){var o;(o=this.bmap.context.currentFloor)==null||o.poiLayer2.removePoi(this.detachStartPoi),this.detachStartPoi=null}if(this.detachLine&&(this.bmap.context.scene.remove(this.detachLine),this.detachLine=null),this.options.detachStartPoi){var s;this.detachStartPoi=new $(this.bmap.context,T({},this.options.detachStartPoi,{id:"navigation_detach_start_poi",position:{x:e[0][0],y:e[0][1],z:.51},collision_enable:!1}))||null,(s=this.bmap.context.currentFloor)==null||s.poiLayer2.pushPoi(this.detachStartPoi),this.detachLine=new Js(this.bmap.context,new Re(e[0][0],e[0][1],.51),new Re(e[0][0],e[0][1],.51)),this.bmap.context.scene.add(this.detachLine)}if(this.options.needStartPoi){var a;this.startPoi=new $(this.bmap.context,T({},this.options.startPoi,{id:"navigation_start_poi",position:{x:e[0][0],y:e[0][1],z:.51},collision_enable:!1}))||null,(a=this.bmap.context.currentFloor)==null||a.poiLayer2.pushPoi(this.startPoi),this.needStartRotateHelperPoi&&this.showStartRotateHelperPoi(),console.log(this.startRotateHelperPoi)}this.dispatchEvent({type:"render-path",path:this.path})}catmullRomCurve3(t){return Oo(t,!1,!0,.1,170,2.5)}getPathDirection(){if(!this.curFloorPath||!this.currentPathPosition||this.curFloorPathPoints.length<2)return null;let t=_e(this.curFloorPathPoints,this.currentPathPosition),e=this.curFloorPathPoints[t],n=this.curFloorPathPoints[t+1],i=new Re(n[0]-e[0],n[1]-e[1],0).normalize(),o=new Re(0,1,0).normalize(),s=i.angleTo(o),a=new Re().crossVectors(o,i);return(Object.is(a.y,0)?-1:1)*s}getPathDirection2(){if(!this.curFloorPath||!this.toPointPosition||this.curFloorPathPoints.length<2)return null;let t=_e(this.curFloorPathPoints,this.toPointPosition),e=this.curFloorPathPoints[t],n=this.curFloorPathPoints[t+1];return(new tR(n[0]-e[0],n[1]-e[1]).normalize().angle()*180/Math.PI-90+360)%360}changeCameraToPathUp(t){return j(this,null,function*(){t===void 0&&(t=100);let e=this.getPathDirection();if(e===null)return;let n=this.bmap.context.control.getAzimuthalAngle();Math.abs(n-e)>Math.PI&&(n>0?e=Math.PI*2+e:e=e-Math.PI*2);let i=Math.abs(e-this.bmap.context.control.getAzimuthalAngle());if(i<.01)return;let{control:o}=this.bmap.context,s=t/Math.PI*6*i;return It(new Promise(a=>{let u={azimuthal:o.getAzimuthalAngle()},l={azimuthal:e},c=o.getPolarAngle(),{maxPolarAngle:h,minPolarAngle:p}=o;o.maxPolarAngle=c,o.minPolarAngle=c;let m=new Ic(u,this.tweenUtil.group).to(l,s).easing($K.Quadratic.InOut).onUpdate(()=>j(this,null,function*(){this.startPoi&&o.target.copy(this.startPoi.position),o.setAzimuthalAngle(u.azimuthal,!0),o.setTargetByOffset(this.options.offsetY)})).onComplete(()=>{o.enabled=!0,this.tweenUtil.remove(m),o.maxPolarAngle=h,o.minPolarAngle=p,a(!0)}).onStart(()=>{o.enabled=!1}).start()}),s+500).finally(()=>{this.bmap.context.control.enabled=!0})})}initNavigationCamera(t){return j(this,null,function*(){t===void 0&&(t=1e3);var e;let i=(e=this.taskQueue.getTasks().find(s=>s.meta.type==="initNavigationCamera"))==null?void 0:e.tid,o={run:()=>It(j(this,null,function*(){yield this.initCameraZoom(t/2),yield this.changeCameraToPathUp(t/4),yield this.translateCameraToStartPoi(t/4)}),t+500).finally(()=>{this.bmap.context.control.enabled=!0}),meta:{type:"initNavigationCamera"}};i?this.taskQueue.replace(i,o):this.taskQueue.add(o)})}translateCameraToStartPoi(t){return j(this,null,function*(){if(t===void 0&&(t=100),!this.startPoi)return;let{clientSize:{width:e,height:n},camera:i,control:o}=this.bmap.context,s=Math.round(e/2),a=Math.round(n/2),u=o.target.clone(),l=W(this.startPoi.position,i,e,n),c=l.x-s,h=a-l.y+this.options.offsetY;if(!(Math.abs(c)<=1&&Math.abs(h)<=1)){if(Math.abs(c)>=1){let p=new Re;p.setFromMatrixColumn(i.matrix,0),p.normalize(),p.multiplyScalar(c/i.zoom),u.add(new Re(p.x,p.y,0))}if(Math.abs(h)>=1){let p=new Re;p.setFromMatrixColumn(i.matrix,1),p.normalize(),p.multiplyScalar(h/i.zoom),u.add(new Re(p.x,p.y,0))}return It(new Promise(p=>{let m=o.target.clone();console.log(m,u,t);let g=new Ic(m,this.tweenUtil.group).to(u,t).onUpdate(()=>{this.bmap.context.control.setCameraPositionByTarget(m,0)}).onComplete(()=>{this.bmap.context.control.setCameraPositionByTarget(u,0),this.tweenUtil.remove(g),this.bmap.context.control.enabled=!0,p(!0)}).onStart(()=>{this.bmap.context.control.enabled=!1}).start()}),t+500).then(()=>{this.bmap.context.control.enabled=!0})}})}initCameraZoom(t){return j(this,null,function*(){if(t===void 0&&(t=100),!this.startPoi)return;let{clientSize:{width:e,height:n},currentFloor:i}=this.bmap.context,{max:o,min:s}=i.box,u=Math.min(e/(o.x-s.x),n/(o.y-s.y))*(o.x-s.x)/this.options.navigationCameraBasic;return this.bmap.context.setZoom(u,this.startPoi.position,t).finally(()=>{this.bmap.context.control.enabled=!0})})}toPosition(t,e){if(this.paths[this.curPathIndex].floor===t&&this.detachStartPoi){let n=this.translatePoints([e]);this.detachStartPoi.position.setX(n[0][0]),this.detachStartPoi.position.setY(n[0][1]),this.detachLine&&this.startPoi&&this.detachLine.setPosition(this.startPoi.position,this.detachStartPoi.position)}this.positionNavigation.toPosition(t,e)}startSimulation(){this.positionNavigation.startSimulation()}setSimulationSpeed(t){this.positionNavigation.changeSimulationSpeed(t)}toPositionBySpeed(t,e){return j(this,null,function*(){let{currentPathPosition:n,curFloorPath:i,curFloorPathPoints:o}=this;if(!i||!n)return null;let s=this.movedDistance,a=rg(o,t);if(s===-1||a===-1||a<=s)return null;let u=a-s;if(!u)return;let l=Math.min(u/e,this.options.runAnimationMaxTime);return this.pathTween&&this.clearTween(),It(new Promise(c=>{let h=this.pathTween=new Ic({distance:0},this.tweenUtil.group).to({distance:u},l*1e3).onUpdate(p=>j(this,null,function*(){this.moveDistance(p.distance+s,h)})).onComplete(()=>{this.tweenUtil.remove(h),c(!0)}).start()}),l*1e3+500).finally(()=>{this.bmap.context.control.enabled=!0})})}moveDistance(t,e){return j(this,null,function*(){var n;this.movedDistance=t,(n=this.path)==null||n.movePath(this.movedDistance/this.curFloorPathLength);let i=Qn(this.curFloorPathPoints,this.movedDistance);if(i===null)return;this.currentPathPosition=i;let o=this.translatePoints([i])[0];this.startPoi&&(this.setStartPoiPosition(o[0],o[1]),this.options.disablePathAnimation||this.bmap.context.control.setTargetByOffset(this.options.offsetY,this.startPoi.position.clone())),this.options.disablePathAnimation||(e==null||e.pause(),yield this.changeCameraToPathUp(500/this.options.speed),e==null||e.resume())})}setStartPoiRotate(t){this.startPoiRotate=t;let n=(this.bmap.context.control.getAzimuthalAngle()*180/Math.PI+360)%360,i=(360-t-n)%360;this.detachStartPoi&&(this.detachStartPoi.options.icon_rotate=i),this.startPoi&&this.startRotateHelperPoi&&this.startRotateHelperPoi.setAngle(i)}dispose(){var t,e,n,i;this.path&&(this.bmap.context.scene.remove(this.path),this.path.dispose()),this.tweenUtil.dispose(),this.unRegistryEvent(),(t=this.startPoi)==null||t.dispose(),(e=this.detachStartPoi)==null||e.dispose(),(n=this.detachLine)==null||n.dispose(),(i=this.startRotateHelperPoi)==null||i.dispose(),Ke.dispose(),this.positionNavigation.dispose(),this.startRotateHelperPoi=null,this.detachStartPoi=null,this.detachLine=null,super.dispose()}constructor(t,e={},n){super(t),this.path=null,this.fetchRoadStatus=!1,this.paths=[],this.curPathIndex=0,this.curFloorPath=null,this.translatePath=null,this.currentPathPosition=null,this.toPointPosition=null,this.pathTween=null,this.startPoi=null,this.detachStartPoi=null,this.detachLine=null,this.startPoiRotate=0,this.startRotateHelperPoi=null,this.needStartRotateHelperPoi=!1,this.movedDistance=0,this.pathStart=[0,0],this.tweenUtil=new en,this.taskQueue=new qn,this.animationPathOptions={cPathIndex:0},this.cPath=[],this.onNavigationInfo=i=>{let{info:o}=i;if(this.dispatchEvent({type:"navigation-info",info:o}),!o.offset){if(o.routeIndex!==this.curPathIndex)return;this.toPointPosition=o.pos,this.toPositionByTask(o.pos)}},this.onUpdate=()=>{this.tweenUtil.update()},this.onSwitchFloor=i=>{let{data:{curFloor:o}}=i;if(this.clearTween(),this.paths[this.curPathIndex]){let s=this.paths[this.curPathIndex];this.setCurFloorPath(s!=null?s:null),s?this.renderPath(this.translatePoints(s.points)):this.clearPath()}else this.clearPath()},this.onControlChangeForStartPoi=()=>{this.startPoi&&this.setStartPoiRotate(this.startPoiRotate)},!n&&typeof e=="object"&&(n=e),this.options=Object.assign({},eR,n),this.positionNavigation=new da(this,T({simulationSpeed:this.options.speed},this.options.positionNavigation),this.options.roadData),this.registryEvent()}};var i$=d(v(),1);import{Group as nR,Box3 as rR,Vector3 as iR}from"three";var D1=class extends gt{show(t){let e=0;t.forEach(o=>{o.poiLayer2.pois.forEach(s=>{let a=new iR().setFromMatrixPosition(s.matrixWorld).z;s.position.setZ(a+e),s.options.depth_test=!0,this.poiLayer.pushPoi(s)}),o.poiLayer2.pois.length=0,o.poiLayer2.dispose(),o.position.z=e,e+=o.userData.height});let{scene:n,currentFloor:i}=this.bmap.context;i&&(n.remove(i),i.dispose()),this.group.add(this.poiLayer,...t),n.add(this.group),this.floors=t,this.fitCamera(),this.bmap.context.cameraBound.updateBox(),this.showStatus=!0}hide(){let{scene:t}=this.bmap.context;t.remove(this.group),this.poiLayer.clear(),this.floors.forEach(e=>{e.dispose()}),this.floors=[],this.group.clear(),this.showStatus=!1}fitCamera(){let{context:t,config:e,type:n}=this.bmap;t.cameraBound.setEnable(!1),t.control.minZoom=0,t.control.maxZoom=1/0,t.camera.zoom=1,t.setAzimuthalAngle(e.control.defaultAzimuthal,0),t.setPolarAngle(e.control.defaultPolar,0),t.fitCameraToObject(this.group,e.defaultPadding,0);let i=t.camera.zoom;t.control.minZoom=i,t.control.maxZoom=i*25,n==="3d"&&t.fitCameraToObject(this.group,e.defaultPadding,0,!1),this.bmap.basicZoom=t.camera.zoom,t.control.addEventListener("change",this.bmap.onControlChange.bind(this.bmap)),this.bmap.onControlChange(),t.cameraBound.setEnable(!0)}dispose(){this.poiLayer.dispose(),this.floors.forEach(t=>t.dispose()),this.floors=[],super.dispose()}constructor(t){super(t),this.floors=[],this.group=new nR,this.showStatus=!1,this.group.name="mul-floor-group",this.poiLayer=new dr(t.context),this.poiLayer.changeParkingSpaceVisibleByZoom=()=>{let e=new rR().setFromObject(this.group),{clientSize:{width:n,height:i}}=this.bmap.context,{max:o,min:s}=e,u=Math.min(n/(o.x-s.x),i/(o.y-s.y))*(o.x-s.x)/45;this.poiLayer.pois.filter(l=>l.userData.type==="parkingSpace").map(l=>{let c=this.bmap.context.camera.zoom>=u;l.visible=c,c||l.parentSetVisible(c)})}}};import{EventDispatcher as oR}from"three";function Yc(){let r=new Blob([`var xF=Object.create;var $x=Object.defineProperty;var EF=Object.getOwnPropertyDescriptor;var wF=Object.getOwnPropertyNames;var SF=Object.getPrototypeOf,MF=Object.prototype.hasOwnProperty;var at=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports);var bF=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of wF(t))!MF.call(n,s)&&s!==e&&$x(n,s,{get:()=>t[s],enumerable:!(o=EF(t,s))||o.enumerable});return n};var Ze=(n,t,e)=>(e=n!=null?xF(SF(n)):{},bF(t||!n||!n.__esModule?$x(e,"default",{value:n,enumerable:!0}):e,n));var np=(n,t,e)=>new Promise((o,s)=>{var c=g=>{try{p(e.next(g))}catch(m){s(m)}},h=g=>{try{p(e.throw(g))}catch(m){s(m)}},p=g=>g.done?o(g.value):Promise.resolve(g.value).then(c,h);p((e=e.apply(n,t)).next())});var oo=at((Im,Zx)=>{"use strict";var If=function(n){return n&&n.Math===Math&&n};Zx.exports=If(typeof globalThis=="object"&&globalThis)||If(typeof window=="object"&&window)||If(typeof self=="object"&&self)||If(typeof global=="object"&&global)||If(typeof Im=="object"&&Im)||function(){return this}()||Function("return this")()});var Kx=at((bJ,Jx)=>{"use strict";Jx.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 Di=at((AJ,jx)=>{"use strict";var Rm=typeof document=="object"&&document.all;jx.exports=typeof Rm=="undefined"&&Rm!==void 0?function(n){return typeof n=="function"||n===Rm}:function(n){return typeof n=="function"}});var Ea=at((TJ,Qx)=>{"use strict";var AF=Di();Qx.exports=function(n){return typeof n=="object"?n!==null:AF(n)}});var rp=at((CJ,eE)=>{"use strict";var TF=oo(),tE=Ea(),Lm=TF.document,CF=tE(Lm)&&tE(Lm.createElement);eE.exports=function(n){return CF?Lm.createElement(n):{}}});var iE=at((PJ,rE)=>{"use strict";var PF=rp(),Nm=PF("span").classList,nE=Nm&&Nm.constructor&&Nm.constructor.prototype;rE.exports=nE===Object.prototype?void 0:nE});var gi=at((IJ,oE)=>{"use strict";oE.exports=function(n){try{return!!n()}catch(t){return!0}}});var Rf=at((RJ,sE)=>{"use strict";var IF=gi();sE.exports=!IF(function(){var n=function(){}.bind();return typeof n!="function"||n.hasOwnProperty("prototype")})});var mi=at((LJ,lE)=>{"use strict";var aE=Rf(),uE=Function.prototype,Om=uE.call,RF=aE&&uE.bind.bind(Om,Om);lE.exports=aE?RF:function(n){return function(){return Om.apply(n,arguments)}}});var ec=at((NJ,fE)=>{"use strict";var cE=mi(),LF=cE({}.toString),NF=cE("".slice);fE.exports=function(n){return NF(LF(n),8,-1)}});var pE=at((OJ,hE)=>{"use strict";var OF=mi(),DF=gi(),FF=ec(),Dm=Object,UF=OF("".split);hE.exports=DF(function(){return!Dm("z").propertyIsEnumerable(0)})?function(n){return FF(n)==="String"?UF(n,""):Dm(n)}:Dm});var ip=at((DJ,dE)=>{"use strict";dE.exports=function(n){return n==null}});var nc=at((FJ,gE)=>{"use strict";var BF=ip(),zF=TypeError;gE.exports=function(n){if(BF(n))throw new zF("Can't call method on "+n);return n}});var rc=at((UJ,mE)=>{"use strict";var GF=pE(),kF=nc();mE.exports=function(n){return GF(kF(n))}});var Lf=at((BJ,yE)=>{"use strict";yE.exports=!1});var op=at((zJ,_E)=>{"use strict";var vE=oo(),qF=Object.defineProperty;_E.exports=function(n,t){try{qF(vE,n,{value:t,configurable:!0,writable:!0})}catch(e){vE[n]=t}return t}});var sp=at((GJ,wE)=>{"use strict";var HF=Lf(),VF=oo(),WF=op(),xE="__core-js_shared__",EE=wE.exports=VF[xE]||WF(xE,{});(EE.versions||(EE.versions=[])).push({version:"3.39.0",mode:HF?"pure":"global",copyright:"\\xA9 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.39.0/LICENSE",source:"https://github.com/zloirock/core-js"})});var ap=at((kJ,ME)=>{"use strict";var SE=sp();ME.exports=function(n,t){return SE[n]||(SE[n]=t||{})}});var ic=at((qJ,bE)=>{"use strict";var XF=nc(),YF=Object;bE.exports=function(n){return YF(XF(n))}});var wa=at((HJ,AE)=>{"use strict";var $F=mi(),ZF=ic(),JF=$F({}.hasOwnProperty);AE.exports=Object.hasOwn||function(t,e){return JF(ZF(t),e)}});var Fm=at((VJ,TE)=>{"use strict";var KF=mi(),jF=0,QF=Math.random(),tU=KF(1 .toString);TE.exports=function(n){return"Symbol("+(n===void 0?"":n)+")_"+tU(++jF+QF,36)}});var RE=at((WJ,IE)=>{"use strict";var eU=oo(),CE=eU.navigator,PE=CE&&CE.userAgent;IE.exports=PE?String(PE):""});var BE=at((XJ,UE)=>{"use strict";var FE=oo(),Um=RE(),LE=FE.process,NE=FE.Deno,OE=LE&&LE.versions||NE&&NE.version,DE=OE&&OE.v8,Xs,up;DE&&(Xs=DE.split("."),up=Xs[0]>0&&Xs[0]<4?1:+(Xs[0]+Xs[1]));!up&&Um&&(Xs=Um.match(/Edge\\/(\\d+)/),(!Xs||Xs[1]>=74)&&(Xs=Um.match(/Chrome\\/(\\d+)/),Xs&&(up=+Xs[1])));UE.exports=up});var Bm=at((YJ,GE)=>{"use strict";var zE=BE(),nU=gi(),rU=oo(),iU=rU.String;GE.exports=!!Object.getOwnPropertySymbols&&!nU(function(){var n=Symbol("symbol detection");return!iU(n)||!(Object(n)instanceof Symbol)||!Symbol.sham&&zE&&zE<41})});var zm=at(($J,kE)=>{"use strict";var oU=Bm();kE.exports=oU&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Is=at((ZJ,HE)=>{"use strict";var sU=oo(),aU=ap(),qE=wa(),uU=Fm(),lU=Bm(),cU=zm(),oc=sU.Symbol,Gm=aU("wks"),fU=cU?oc.for||oc:oc&&oc.withoutSetter||uU;HE.exports=function(n){return qE(Gm,n)||(Gm[n]=lU&&qE(oc,n)?oc[n]:fU("Symbol."+n)),Gm[n]}});var Sa=at((JJ,VE)=>{"use strict";var hU=Ea(),pU=String,dU=TypeError;VE.exports=function(n){if(hU(n))return n;throw new dU(pU(n)+" is not an object")}});var Ys=at((KJ,WE)=>{"use strict";var gU=gi();WE.exports=!gU(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var km=at((jJ,XE)=>{"use strict";var mU=Ys(),yU=gi();XE.exports=mU&&yU(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var qm=at((QJ,YE)=>{"use strict";var vU=Ys(),_U=gi(),xU=rp();YE.exports=!vU&&!_U(function(){return Object.defineProperty(xU("div"),"a",{get:function(){return 7}}).a!==7})});var Rs=at((tK,$E)=>{"use strict";var EU=Rf(),lp=Function.prototype.call;$E.exports=EU?lp.bind(lp):function(){return lp.apply(lp,arguments)}});var sc=at((eK,ZE)=>{"use strict";var Hm=oo(),wU=Di(),SU=function(n){return wU(n)?n:void 0};ZE.exports=function(n,t){return arguments.length<2?SU(Hm[n]):Hm[n]&&Hm[n][t]}});var KE=at((nK,JE)=>{"use strict";var MU=mi();JE.exports=MU({}.isPrototypeOf)});var Vm=at((rK,jE)=>{"use strict";var bU=sc(),AU=Di(),TU=KE(),CU=zm(),PU=Object;jE.exports=CU?function(n){return typeof n=="symbol"}:function(n){var t=bU("Symbol");return AU(t)&&TU(t.prototype,PU(n))}});var tw=at((iK,QE)=>{"use strict";var IU=String;QE.exports=function(n){try{return IU(n)}catch(t){return"Object"}}});var Nf=at((oK,ew)=>{"use strict";var RU=Di(),LU=tw(),NU=TypeError;ew.exports=function(n){if(RU(n))return n;throw new NU(LU(n)+" is not a function")}});var cp=at((sK,nw)=>{"use strict";var OU=Nf(),DU=ip();nw.exports=function(n,t){var e=n[t];return DU(e)?void 0:OU(e)}});var iw=at((aK,rw)=>{"use strict";var Wm=Rs(),Xm=Di(),Ym=Ea(),FU=TypeError;rw.exports=function(n,t){var e,o;if(t==="string"&&Xm(e=n.toString)&&!Ym(o=Wm(e,n))||Xm(e=n.valueOf)&&!Ym(o=Wm(e,n))||t!=="string"&&Xm(e=n.toString)&&!Ym(o=Wm(e,n)))return o;throw new FU("Can't convert object to primitive value")}});var uw=at((uK,aw)=>{"use strict";var UU=Rs(),ow=Ea(),sw=Vm(),BU=cp(),zU=iw(),GU=Is(),kU=TypeError,qU=GU("toPrimitive");aw.exports=function(n,t){if(!ow(n)||sw(n))return n;var e=BU(n,qU),o;if(e){if(t===void 0&&(t="default"),o=UU(e,n,t),!ow(o)||sw(o))return o;throw new kU("Can't convert object to primitive value")}return t===void 0&&(t="number"),zU(n,t)}});var $m=at((lK,lw)=>{"use strict";var HU=uw(),VU=Vm();lw.exports=function(n){var t=HU(n,"string");return VU(t)?t:t+""}});var Pu=at(fw=>{"use strict";var WU=Ys(),XU=qm(),YU=km(),fp=Sa(),cw=$m(),$U=TypeError,Zm=Object.defineProperty,ZU=Object.getOwnPropertyDescriptor,Jm="enumerable",Km="configurable",jm="writable";fw.f=WU?YU?function(t,e,o){if(fp(t),e=cw(e),fp(o),typeof t=="function"&&e==="prototype"&&"value"in o&&jm in o&&!o[jm]){var s=ZU(t,e);s&&s[jm]&&(t[e]=o.value,o={configurable:Km in o?o[Km]:s[Km],enumerable:Jm in o?o[Jm]:s[Jm],writable:!1})}return Zm(t,e,o)}:Zm:function(t,e,o){if(fp(t),e=cw(e),fp(o),XU)try{return Zm(t,e,o)}catch(s){}if("get"in o||"set"in o)throw new $U("Accessors not supported");return"value"in o&&(t[e]=o.value),t}});var pw=at((fK,hw)=>{"use strict";var JU=Math.ceil,KU=Math.floor;hw.exports=Math.trunc||function(t){var e=+t;return(e>0?KU:JU)(e)}});var ml=at((hK,dw)=>{"use strict";var jU=pw();dw.exports=function(n){var t=+n;return t!==t||t===0?0:jU(t)}});var mw=at((pK,gw)=>{"use strict";var QU=ml(),tB=Math.max,eB=Math.min;gw.exports=function(n,t){var e=QU(n);return e<0?tB(e+t,0):eB(e,t)}});var Qm=at((dK,yw)=>{"use strict";var nB=ml(),rB=Math.min;yw.exports=function(n){var t=nB(n);return t>0?rB(t,9007199254740991):0}});var Of=at((gK,vw)=>{"use strict";var iB=Qm();vw.exports=function(n){return iB(n.length)}});var Ew=at((mK,xw)=>{"use strict";var oB=rc(),sB=mw(),aB=Of(),_w=function(n){return function(t,e,o){var s=oB(t),c=aB(s);if(c===0)return!n&&-1;var h=sB(o,c),p;if(n&&e!==e){for(;c>h;)if(p=s[h++],p!==p)return!0}else for(;c>h;h++)if((n||h in s)&&s[h]===e)return n||h||0;return!n&&-1}};xw.exports={includes:_w(!0),indexOf:_w(!1)}});var hp=at((yK,ww)=>{"use strict";ww.exports={}});var e0=at((vK,Mw)=>{"use strict";var uB=mi(),t0=wa(),lB=rc(),cB=Ew().indexOf,fB=hp(),Sw=uB([].push);Mw.exports=function(n,t){var e=lB(n),o=0,s=[],c;for(c in e)!t0(fB,c)&&t0(e,c)&&Sw(s,c);for(;t.length>o;)t0(e,c=t[o++])&&(~cB(s,c)||Sw(s,c));return s}});var pp=at((_K,bw)=>{"use strict";bw.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var Tw=at((xK,Aw)=>{"use strict";var hB=e0(),pB=pp();Aw.exports=Object.keys||function(t){return hB(t,pB)}});var Pw=at(Cw=>{"use strict";var dB=Ys(),gB=km(),mB=Pu(),yB=Sa(),vB=rc(),_B=Tw();Cw.f=dB&&!gB?Object.defineProperties:function(t,e){yB(t);for(var o=vB(e),s=_B(e),c=s.length,h=0,p;c>h;)mB.f(t,p=s[h++],o[p]);return t}});var Rw=at((wK,Iw)=>{"use strict";var xB=sc();Iw.exports=xB("document","documentElement")});var dp=at((SK,Nw)=>{"use strict";var EB=ap(),wB=Fm(),Lw=EB("keys");Nw.exports=function(n){return Lw[n]||(Lw[n]=wB(n))}});var Df=at((MK,Gw)=>{"use strict";var SB=Sa(),MB=Pw(),Ow=pp(),bB=hp(),AB=Rw(),TB=rp(),CB=dp(),Dw=">",Fw="<",r0="prototype",i0="script",Bw=CB("IE_PROTO"),n0=function(){},zw=function(n){return Fw+i0+Dw+n+Fw+"/"+i0+Dw},Uw=function(n){n.write(zw("")),n.close();var t=n.parentWindow.Object;return n=null,t},PB=function(){var n=TB("iframe"),t="java"+i0+":",e;return n.style.display="none",AB.appendChild(n),n.src=String(t),e=n.contentWindow.document,e.open(),e.write(zw("document.F=Object")),e.close(),e.F},gp,mp=function(){try{gp=new ActiveXObject("htmlfile")}catch(t){}mp=typeof document!="undefined"?document.domain&&gp?Uw(gp):PB():Uw(gp);for(var n=Ow.length;n--;)delete mp[r0][Ow[n]];return mp()};bB[Bw]=!0;Gw.exports=Object.create||function(t,e){var o;return t!==null?(n0[r0]=SB(t),o=new n0,n0[r0]=null,o[Bw]=t):o=mp(),e===void 0?o:MB.f(o,e)}});var a0=at((bK,kw)=>{"use strict";var IB=Is(),RB=Df(),LB=Pu().f,o0=IB("unscopables"),s0=Array.prototype;s0[o0]===void 0&&LB(s0,o0,{configurable:!0,value:RB(null)});kw.exports=function(n){s0[o0][n]=!0}});var yp=at((AK,qw)=>{"use strict";qw.exports={}});var Ww=at((TK,Vw)=>{"use strict";var NB=oo(),OB=Di(),Hw=NB.WeakMap;Vw.exports=OB(Hw)&&/native code/.test(String(Hw))});var vp=at((CK,Xw)=>{"use strict";Xw.exports=function(n,t){return{enumerable:!(n&1),configurable:!(n&2),writable:!(n&4),value:t}}});var ac=at((PK,Yw)=>{"use strict";var DB=Ys(),FB=Pu(),UB=vp();Yw.exports=DB?function(n,t,e){return FB.f(n,t,UB(1,e))}:function(n,t,e){return n[t]=e,n}});var Ep=at((IK,Jw)=>{"use strict";var BB=Ww(),Zw=oo(),zB=Ea(),GB=ac(),u0=wa(),l0=sp(),kB=dp(),qB=hp(),$w="Object already initialized",c0=Zw.TypeError,HB=Zw.WeakMap,_p,Ff,xp,VB=function(n){return xp(n)?Ff(n):_p(n,{})},WB=function(n){return function(t){var e;if(!zB(t)||(e=Ff(t)).type!==n)throw new c0("Incompatible receiver, "+n+" required");return e}};BB||l0.state?($s=l0.state||(l0.state=new HB),$s.get=$s.get,$s.has=$s.has,$s.set=$s.set,_p=function(n,t){if($s.has(n))throw new c0($w);return t.facade=n,$s.set(n,t),t},Ff=function(n){return $s.get(n)||{}},xp=function(n){return $s.has(n)}):(yl=kB("state"),qB[yl]=!0,_p=function(n,t){if(u0(n,yl))throw new c0($w);return t.facade=n,GB(n,yl,t),t},Ff=function(n){return u0(n,yl)?n[yl]:{}},xp=function(n){return u0(n,yl)});var $s,yl;Jw.exports={set:_p,get:Ff,has:xp,enforce:VB,getterFor:WB}});var tS=at(Qw=>{"use strict";var Kw={}.propertyIsEnumerable,jw=Object.getOwnPropertyDescriptor,XB=jw&&!Kw.call({1:2},1);Qw.f=XB?function(t){var e=jw(this,t);return!!e&&e.enumerable}:Kw});var f0=at(nS=>{"use strict";var YB=Ys(),$B=Rs(),ZB=tS(),JB=vp(),KB=rc(),jB=$m(),QB=wa(),tz=qm(),eS=Object.getOwnPropertyDescriptor;nS.f=YB?eS:function(t,e){if(t=KB(t),e=jB(e),tz)try{return eS(t,e)}catch(o){}if(QB(t,e))return JB(!$B(ZB.f,t,e),t[e])}});var d0=at((NK,iS)=>{"use strict";var h0=Ys(),ez=wa(),rS=Function.prototype,nz=h0&&Object.getOwnPropertyDescriptor,p0=ez(rS,"name"),rz=p0&&function(){}.name==="something",iz=p0&&(!h0||h0&&nz(rS,"name").configurable);iS.exports={EXISTS:p0,PROPER:rz,CONFIGURABLE:iz}});var m0=at((OK,oS)=>{"use strict";var oz=mi(),sz=Di(),g0=sp(),az=oz(Function.toString);sz(g0.inspectSource)||(g0.inspectSource=function(n){return az(n)});oS.exports=g0.inspectSource});var lS=at((DK,uS)=>{"use strict";var v0=mi(),uz=gi(),lz=Di(),wp=wa(),y0=Ys(),cz=d0().CONFIGURABLE,fz=m0(),aS=Ep(),hz=aS.enforce,pz=aS.get,sS=String,Sp=Object.defineProperty,dz=v0("".slice),gz=v0("".replace),mz=v0([].join),yz=y0&&!uz(function(){return Sp(function(){},"length",{value:8}).length!==8}),vz=String(String).split("String"),_z=uS.exports=function(n,t,e){dz(sS(t),0,7)==="Symbol("&&(t="["+gz(sS(t),/^Symbol\\(([^)]*)\\).*$/,"$1")+"]"),e&&e.getter&&(t="get "+t),e&&e.setter&&(t="set "+t),(!wp(n,"name")||cz&&n.name!==t)&&(y0?Sp(n,"name",{value:t,configurable:!0}):n.name=t),yz&&e&&wp(e,"arity")&&n.length!==e.arity&&Sp(n,"length",{value:e.arity});try{e&&wp(e,"constructor")&&e.constructor?y0&&Sp(n,"prototype",{writable:!1}):n.prototype&&(n.prototype=void 0)}catch(s){}var o=hz(n);return wp(o,"source")||(o.source=mz(vz,typeof t=="string"?t:"")),n};Function.prototype.toString=_z(function(){return lz(this)&&pz(this).source||fz(this)},"toString")});var Uf=at((FK,cS)=>{"use strict";var xz=Di(),Ez=Pu(),wz=lS(),Sz=op();cS.exports=function(n,t,e,o){o||(o={});var s=o.enumerable,c=o.name!==void 0?o.name:t;if(xz(e)&&wz(e,c,o),o.global)s?n[t]=e:Sz(t,e);else{try{o.unsafe?n[t]&&(s=!0):delete n[t]}catch(h){}s?n[t]=e:Ez.f(n,t,{value:e,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return n}});var hS=at(fS=>{"use strict";var Mz=e0(),bz=pp(),Az=bz.concat("length","prototype");fS.f=Object.getOwnPropertyNames||function(t){return Mz(t,Az)}});var dS=at(pS=>{"use strict";pS.f=Object.getOwnPropertySymbols});var mS=at((zK,gS)=>{"use strict";var Tz=sc(),Cz=mi(),Pz=hS(),Iz=dS(),Rz=Sa(),Lz=Cz([].concat);gS.exports=Tz("Reflect","ownKeys")||function(t){var e=Pz.f(Rz(t)),o=Iz.f;return o?Lz(e,o(t)):e}});var _S=at((GK,vS)=>{"use strict";var yS=wa(),Nz=mS(),Oz=f0(),Dz=Pu();vS.exports=function(n,t,e){for(var o=Nz(t),s=Dz.f,c=Oz.f,h=0;h<o.length;h++){var p=o[h];!yS(n,p)&&!(e&&yS(e,p))&&s(n,p,c(t,p))}}});var ES=at((kK,xS)=>{"use strict";var Fz=gi(),Uz=Di(),Bz=/#|\\.prototype\\./,Bf=function(n,t){var e=Gz[zz(n)];return e===qz?!0:e===kz?!1:Uz(t)?Fz(t):!!t},zz=Bf.normalize=function(n){return String(n).replace(Bz,".").toLowerCase()},Gz=Bf.data={},kz=Bf.NATIVE="N",qz=Bf.POLYFILL="P";xS.exports=Bf});var Ls=at((qK,wS)=>{"use strict";var Mp=oo(),Hz=f0().f,Vz=ac(),Wz=Uf(),Xz=op(),Yz=_S(),$z=ES();wS.exports=function(n,t){var e=n.target,o=n.global,s=n.stat,c,h,p,g,m,_;if(o?h=Mp:s?h=Mp[e]||Xz(e,{}):h=Mp[e]&&Mp[e].prototype,h)for(p in t){if(m=t[p],n.dontCallGetSet?(_=Hz(h,p),g=_&&_.value):g=h[p],c=$z(o?p:e+(s?".":"#")+p,n.forced),!c&&g!==void 0){if(typeof m==typeof g)continue;Yz(m,g)}(n.sham||g&&g.sham)&&Vz(m,"sham",!0),Wz(h,p,m,n)}}});var MS=at((HK,SS)=>{"use strict";var Zz=gi();SS.exports=!Zz(function(){function n(){}return n.prototype.constructor=null,Object.getPrototypeOf(new n)!==n.prototype})});var x0=at((VK,AS)=>{"use strict";var Jz=wa(),Kz=Di(),jz=ic(),Qz=dp(),tG=MS(),bS=Qz("IE_PROTO"),_0=Object,eG=_0.prototype;AS.exports=tG?_0.getPrototypeOf:function(n){var t=jz(n);if(Jz(t,bS))return t[bS];var e=t.constructor;return Kz(e)&&t instanceof e?e.prototype:t instanceof _0?eG:null}});var M0=at((WK,PS)=>{"use strict";var nG=gi(),rG=Di(),iG=Ea(),oG=Df(),TS=x0(),sG=Uf(),aG=Is(),uG=Lf(),S0=aG("iterator"),CS=!1,Qa,E0,w0;[].keys&&(w0=[].keys(),"next"in w0?(E0=TS(TS(w0)),E0!==Object.prototype&&(Qa=E0)):CS=!0);var lG=!iG(Qa)||nG(function(){var n={};return Qa[S0].call(n)!==n});lG?Qa={}:uG&&(Qa=oG(Qa));rG(Qa[S0])||sG(Qa,S0,function(){return this});PS.exports={IteratorPrototype:Qa,BUGGY_SAFARI_ITERATORS:CS}});var bp=at((XK,RS)=>{"use strict";var cG=Pu().f,fG=wa(),hG=Is(),IS=hG("toStringTag");RS.exports=function(n,t,e){n&&!e&&(n=n.prototype),n&&!fG(n,IS)&&cG(n,IS,{configurable:!0,value:t})}});var NS=at((YK,LS)=>{"use strict";var pG=M0().IteratorPrototype,dG=Df(),gG=vp(),mG=bp(),yG=yp(),vG=function(){return this};LS.exports=function(n,t,e,o){var s=t+" Iterator";return n.prototype=dG(pG,{next:gG(+!o,e)}),mG(n,s,!1,!0),yG[s]=vG,n}});var b0=at(($K,OS)=>{"use strict";var _G=mi(),xG=Nf();OS.exports=function(n,t,e){try{return _G(xG(Object.getOwnPropertyDescriptor(n,t)[e]))}catch(o){}}});var FS=at((ZK,DS)=>{"use strict";var EG=Ea();DS.exports=function(n){return EG(n)||n===null}});var BS=at((JK,US)=>{"use strict";var wG=FS(),SG=String,MG=TypeError;US.exports=function(n){if(wG(n))return n;throw new MG("Can't set "+SG(n)+" as a prototype")}});var GS=at((KK,zS)=>{"use strict";var bG=b0(),AG=Ea(),TG=nc(),CG=BS();zS.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var n=!1,t={},e;try{e=bG(Object.prototype,"__proto__","set"),e(t,[]),n=t instanceof Array}catch(o){}return function(s,c){return TG(s),CG(c),AG(s)&&(n?e(s,c):s.__proto__=c),s}}():void 0)});var KS=at((jK,JS)=>{"use strict";var PG=Ls(),IG=Rs(),Ap=Lf(),$S=d0(),RG=Di(),LG=NS(),kS=x0(),qS=GS(),NG=bp(),OG=ac(),A0=Uf(),DG=Is(),HS=yp(),ZS=M0(),FG=$S.PROPER,UG=$S.CONFIGURABLE,VS=ZS.IteratorPrototype,Tp=ZS.BUGGY_SAFARI_ITERATORS,zf=DG("iterator"),WS="keys",Gf="values",XS="entries",YS=function(){return this};JS.exports=function(n,t,e,o,s,c,h){LG(e,t,o);var p=function(E){if(E===s&&x)return x;if(!Tp&&E&&E in _)return _[E];switch(E){case WS:return function(){return new e(this,E)};case Gf:return function(){return new e(this,E)};case XS:return function(){return new e(this,E)}}return function(){return new e(this)}},g=t+" Iterator",m=!1,_=n.prototype,w=_[zf]||_["@@iterator"]||s&&_[s],x=!Tp&&w||p(s),b=t==="Array"&&_.entries||w,P,I,S;if(b&&(P=kS(b.call(new n)),P!==Object.prototype&&P.next&&(!Ap&&kS(P)!==VS&&(qS?qS(P,VS):RG(P[zf])||A0(P,zf,YS)),NG(P,g,!0,!0),Ap&&(HS[g]=YS))),FG&&s===Gf&&w&&w.name!==Gf&&(!Ap&&UG?OG(_,"name",Gf):(m=!0,x=function(){return IG(w,this)})),s)if(I={values:p(Gf),keys:c?x:p(WS),entries:p(XS)},h)for(S in I)(Tp||m||!(S in _))&&A0(_,S,I[S]);else PG({target:t,proto:!0,forced:Tp||m},I);return(!Ap||h)&&_[zf]!==x&&A0(_,zf,x,{name:s}),HS[t]=x,I}});var QS=at((QK,jS)=>{"use strict";jS.exports=function(n,t){return{value:n,done:t}}});var oM=at((tj,iM)=>{"use strict";var BG=rc(),T0=a0(),tM=yp(),nM=Ep(),zG=Pu().f,GG=KS(),Cp=QS(),kG=Lf(),qG=Ys(),rM="Array Iterator",HG=nM.set,VG=nM.getterFor(rM);iM.exports=GG(Array,"Array",function(n,t){HG(this,{type:rM,target:BG(n),index:0,kind:t})},function(){var n=VG(this),t=n.target,e=n.index++;if(!t||e>=t.length)return n.target=null,Cp(void 0,!0);switch(n.kind){case"keys":return Cp(e,!1);case"values":return Cp(t[e],!1)}return Cp([e,t[e]],!1)},"values");var eM=tM.Arguments=tM.Array;T0("keys");T0("values");T0("entries");if(!kG&&qG&&eM.name!=="values")try{zG(eM,"name",{value:"values"})}catch(n){}});var Ip=at(()=>{"use strict";var sM=oo(),uM=Kx(),WG=iE(),kf=oM(),aM=ac(),XG=bp(),YG=Is(),C0=YG("iterator"),P0=kf.values,lM=function(n,t){if(n){if(n[C0]!==P0)try{aM(n,C0,P0)}catch(o){n[C0]=P0}if(XG(n,t,!0),uM[t]){for(var e in kf)if(n[e]!==kf[e])try{aM(n,e,kf[e])}catch(o){n[e]=kf[e]}}}};for(Pp in uM)lM(sM[Pp]&&sM[Pp].prototype,Pp);var Pp;lM(WG,"DOMTokenList")});var hM=at((rj,fM)=>{"use strict";var $G=Is(),ZG=$G("toStringTag"),cM={};cM[ZG]="z";fM.exports=String(cM)==="[object z]"});var I0=at((ij,pM)=>{"use strict";var JG=hM(),KG=Di(),Rp=ec(),jG=Is(),QG=jG("toStringTag"),t4=Object,e4=Rp(function(){return arguments}())==="Arguments",n4=function(n,t){try{return n[t]}catch(e){}};pM.exports=JG?Rp:function(n){var t,e,o;return n===void 0?"Undefined":n===null?"Null":typeof(e=n4(t=t4(n),QG))=="string"?e:e4?Rp(t):(o=Rp(t))==="Object"&&KG(t.callee)?"Arguments":o}});var Lp=at((oj,dM)=>{"use strict";var r4=I0(),i4=String;dM.exports=function(n){if(r4(n)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return i4(n)}});var mM=at((sj,gM)=>{"use strict";var o4=Sa();gM.exports=function(){var n=o4(this),t="";return n.hasIndices&&(t+="d"),n.global&&(t+="g"),n.ignoreCase&&(t+="i"),n.multiline&&(t+="m"),n.dotAll&&(t+="s"),n.unicode&&(t+="u"),n.unicodeSets&&(t+="v"),n.sticky&&(t+="y"),t}});var vM=at((aj,yM)=>{"use strict";var R0=gi(),s4=oo(),L0=s4.RegExp,N0=R0(function(){var n=L0("a","y");return n.lastIndex=2,n.exec("abcd")!==null}),a4=N0||R0(function(){return!L0("a","y").sticky}),u4=N0||R0(function(){var n=L0("^r","gy");return n.lastIndex=2,n.exec("str")!==null});yM.exports={BROKEN_CARET:u4,MISSED_STICKY:a4,UNSUPPORTED_Y:N0}});var xM=at((uj,_M)=>{"use strict";var l4=gi(),c4=oo(),f4=c4.RegExp;_M.exports=l4(function(){var n=f4(".","s");return!(n.dotAll&&n.test(\`
114
+ `,document.body.appendChild(r.canvas)}setAngle(t){if(console.log("angle",t),r.textureMap.has(t))this._initIcon(r.textureMap.get(t));else{this.draw(t);let e=this.getTexture(this.getImageData());r.textureMap.set(t,e),this._initIcon(e),this._initScale({zoom:this.bmap.context.camera.zoom})}}_initIcon(t){if(this.spriteIcon)this.spriteIcon.material.map=t,t.needsUpdate=!0;else{let e=new HK(new qK({map:t,transparent:!0,alphaTest:.2,depthTest:this.options.depth_test,rotation:this.options.icon_rotate/180*Math.PI}));e.renderOrder=1e5+this.options.level,t.needsUpdate=!0,this.add(e),e.center.set(.5,.5),this.spriteIcon=e}}initSize(){this.spriteIcon&&this.spriteIcon.center.set(.5,.5)}draw(t){let{ctx:e}=r,{config:{size:n}}=this,i=n[0]/2,o=n[1]/2,s=4,a=1,u=s+a;if(e.clearRect(0,0,n[0],n[1]),e.setLineDash([10,10]),e.strokeStyle="#fff",e.lineWidth=2,e.beginPath(),e.arc(i,o,o-u,-Math.PI/2,Math.PI*2-Math.PI/2,t<Math.PI),e.stroke(),e.strokeStyle="#0A7AFF",t<Math.PI){let l=-Math.PI/2,c=l-t;e.beginPath(),e.arc(i,o,o-u,l,c,!0)}else{let l=-Math.PI/2,c=l+Math.PI*2-t;e.beginPath(),e.arc(i,o,o-u,l,c,!1)}e.stroke(),e.clearRect(i-u*2,0,u*4,u*4),e.beginPath(),e.arc(i,u,s,0,Math.PI*2),e.fillStyle="#0A7AFF",e.fill(),e.setLineDash([10,0]),e.strokeStyle="#fff",e.lineWidth=a,e.stroke(),e.clearRect(0,o-5,10,10),e.clearRect(i-5,n[1]-10,10,10),e.clearRect(n[0]-10,o-5,10,10),t>Math.PI/2&&t<Math.PI?e.fillStyle="#0A7AFF":e.fillStyle="#fff",e.fillRect(0,o-1,10,2),e.fillStyle="#fff",e.fillRect(i-1,n[1]-10,2,10),t>Math.PI&&t<Math.PI/2*3?e.fillStyle="#0A7AFF":e.fillStyle="#fff",e.fillRect(n[0]-10,o-1,10,2)}getImageData(){let{ctx:t}=r,{config:{size:e}}=this;return t.getImageData(0,0,e[0],e[1])}getTexture(t){let{config:{size:e}}=this,n=new QK(Uint8Array.from(t.data),e[0],e[1],Y1);return n.format=Y1,n.magFilter=I1,n.minFilter=I1,n.colorSpace="srgb",n.flipY=!0,n}dispose(){var t;super.dispose(),(t=this.spriteIcon)==null||t.material.dispose()}static dispose(){this.textureMap.forEach(t=>{t.dispose()}),this.textureMap.clear(),this.ctx=null,this.canvas=null}constructor(t,e){super(t.context,{icon_size:e.size,collision_enable:!1,level:2}),this.bmap=t,this.config=e,r.canvas.width=e.size[0],r.canvas.height=e.size[1]}};Ke.canvas=document.createElement("canvas");Ke.ctx=Ke.canvas.getContext("2d",{willReadFrequently:!0});Ke.textureMap=new Map;var eR={path:{},cheapMaximumDistance:20,needStartPoi:!1,startPoi:{},positionNavigation:{},offsetY:150,directionEmitThreshold:5,disablePathAnimation:!1,speed:1,roadData:[],runAnimationMaxTime:1,navigationCameraBasic:45},E1=class extends gt{get curFloorPathLength(){var t,e;return(e=(t=this.curFloorPath)==null?void 0:t.distance)!=null?e:0}get curFloorPathPoints(){var t,e;return(e=(t=this.curFloorPath)==null?void 0:t.points)!=null?e:[]}registryEvent(){this.bmap.context.addEventListener("update",this.onUpdate),this.bmap.addEventListener(at.SWITCH_FLOOR_AFTER,this.onSwitchFloor),this.positionNavigation.addEventListener("navigation-info",this.onNavigationInfo),this.bmap.context.addEventListener("control-change",this.onControlChangeForStartPoi)}showStartRotateHelperPoi(){var t;if(this.needStartRotateHelperPoi=!0,!this.startPoi||this.startRotateHelperPoi)return;let e=this.startPoi.options.icon_size;this.startRotateHelperPoi=new Ke(this.bmap,{size:[e[0]+20,e[1]+20]}),this.startRotateHelperPoi.setAngle(0),this.startRotateHelperPoi.position.setZ(.51),(t=this.bmap.context.currentFloor)==null||t.poiLayer2.pushPoi(this.startRotateHelperPoi)}hideStartRotateHelperPoi(){if(this.needStartRotateHelperPoi=!1,this.startRotateHelperPoi){var t;(t=this.bmap.context.currentFloor)==null||t.poiLayer2.removePoi(this.startRotateHelperPoi),this.startRotateHelperPoi=null}}setStartPoiPosition(t,e){this.startPoi&&(this.startPoi.position.setX(t).setY(e),this.startRotateHelperPoi&&this.startRotateHelperPoi.position.setX(t).setY(e),this.detachLine&&this.detachLine.setPosition(this.startPoi.position,this.detachStartPoi.position))}toPositionByTask(t){var e;let i=(e=this.taskQueue.getTasks().find(s=>s.meta.type==="toPosition"))==null?void 0:e.tid,o={run:()=>this.toPositionBySpeed(t,this.options.speed),meta:{type:"toPosition"}};i?this.taskQueue.replace(i,o):this.taskQueue.add(o)}pauseAnimation(){this.taskQueue.clear(),this.positionNavigation.pause(),this.tweenUtil.pause()}continueAnimation(){this.tweenUtil.continue(),this.positionNavigation.continue()}clearTween(){this.tweenUtil.clear(),this.taskQueue.clear(),this.bmap.context.control.enabled=!0}unRegistryEvent(){this.bmap.context.removeEventListener("update",this.onUpdate),this.bmap.removeEventListener(at.SWITCH_FLOOR_AFTER,this.onSwitchFloor),this.positionNavigation.removeEventListener("navigation-info",this.onNavigationInfo),this.bmap.context.removeEventListener("control-change",this.onControlChangeForStartPoi)}clearPath(){if(this.path&&(this.bmap.context.scene.remove(this.path),this.path.dispose(),this.path=null,this.clearTween()),this.startPoi){var t;if((t=this.bmap.context.currentFloor)==null||t.poiLayer2.removePoi(this.startPoi),this.startPoi=null,this.startRotateHelperPoi){var e;(e=this.bmap.context.currentFloor)==null||e.poiLayer2.removePoi(this.startRotateHelperPoi),this.startRotateHelperPoi=null}}this.translatePath=null}setCurFloorPath(t){t===null?(this.curFloorPath=null,this.currentPathPosition=null,this.toPointPosition=null):(this.curFloorPath=t,this.currentPathPosition=t.points[0],this.toPointPosition=t.points[0]),this.movedDistance=0,this.clearTween()}setCurPathIndex(t){var e,n;this.curPathIndex=t,((e=this.paths[t])==null?void 0:e.floor)===((n=this.bmap.context.currentFloor)==null?void 0:n.name)?(this.setCurFloorPath(this.paths[t]),this.renderPath(this.translatePoints(this.curFloorPathPoints))):this.clearPath()}addPath(t,e){e===void 0&&(e=0);var n;this.paths=t,this.curPathIndex=e,this.clearTween();let i=(n=this.bmap.context.currentFloor)==null?void 0:n.name,o=t[e];if(i&&(o==null?void 0:o.floor)===i)if(this.setCurFloorPath(o),this.bmap.currentBuildGround)this.renderPath(this.translatePoints(o.points));else{let s=()=>{this.bmap.removeEventListener("center-change",s),this.renderPath(this.translatePoints(o.points))};this.bmap.addEventListener("center-change",s)}else this.clearPath();this.dispatchEvent({type:"add-path",paths:t})}translatePoints(t){let[e,n]=this.bmap.buildingCenter;return t.map(i=>[i[0]-e,i[1]-n])}renderPath(t){this.translatePath=t;let e=this.catmullRomCurve3(t);if(this.cPath=e,this.animationPathOptions={cPathIndex:0},this.pathStart=e[0],this.path?this.path.updatePoints(e):(this.path=new fa(this,this.options.path),this.path.create(e),this.path.position.z=this.bmap.context.currentFloor.groundMaxHeight+.5,this.bmap.context.scene.add(this.path)),this.path.movePath(0),this.startPoi){var n;if((n=this.bmap.context.currentFloor)==null||n.poiLayer2.removePoi(this.startPoi),this.startPoi=null,this.startRotateHelperPoi){var i;(i=this.bmap.context.currentFloor)==null||i.poiLayer2.removePoi(this.startRotateHelperPoi),this.startRotateHelperPoi=null}}if(this.detachStartPoi){var o;(o=this.bmap.context.currentFloor)==null||o.poiLayer2.removePoi(this.detachStartPoi),this.detachStartPoi=null}if(this.detachLine&&(this.bmap.context.scene.remove(this.detachLine),this.detachLine=null),this.options.detachStartPoi){var s;this.detachStartPoi=new $(this.bmap.context,T({},this.options.detachStartPoi,{id:"navigation_detach_start_poi",position:{x:e[0][0],y:e[0][1],z:.51},collision_enable:!1}))||null,(s=this.bmap.context.currentFloor)==null||s.poiLayer2.pushPoi(this.detachStartPoi),this.detachLine=new Js(this.bmap.context,new Re(e[0][0],e[0][1],.51),new Re(e[0][0],e[0][1],.51)),this.bmap.context.scene.add(this.detachLine)}if(this.options.needStartPoi){var a;this.startPoi=new $(this.bmap.context,T({},this.options.startPoi,{id:"navigation_start_poi",position:{x:e[0][0],y:e[0][1],z:.51},collision_enable:!1}))||null,(a=this.bmap.context.currentFloor)==null||a.poiLayer2.pushPoi(this.startPoi),this.needStartRotateHelperPoi&&this.showStartRotateHelperPoi(),console.log(this.startRotateHelperPoi)}this.dispatchEvent({type:"render-path",path:this.path})}catmullRomCurve3(t){return Oo(t,!1,!0,.1,170,2.5)}getPathDirection(){if(!this.curFloorPath||!this.currentPathPosition||this.curFloorPathPoints.length<2)return null;let t=_e(this.curFloorPathPoints,this.currentPathPosition),e=this.curFloorPathPoints[t],n=this.curFloorPathPoints[t+1],i=new Re(n[0]-e[0],n[1]-e[1],0).normalize(),o=new Re(0,1,0).normalize(),s=i.angleTo(o),a=new Re().crossVectors(o,i);return(Object.is(a.y,0)?-1:1)*s}getPathDirection2(){if(!this.curFloorPath||!this.toPointPosition||this.curFloorPathPoints.length<2)return null;let t=_e(this.curFloorPathPoints,this.toPointPosition),e=this.curFloorPathPoints[t],n=this.curFloorPathPoints[t+1];return(new tR(n[0]-e[0],n[1]-e[1]).normalize().angle()*180/Math.PI-90+360)%360}changeCameraToPathUp(t){return j(this,null,function*(){t===void 0&&(t=100);let e=this.getPathDirection();if(e===null)return;let n=this.bmap.context.control.getAzimuthalAngle();Math.abs(n-e)>Math.PI&&(n>0?e=Math.PI*2+e:e=e-Math.PI*2);let i=Math.abs(e-this.bmap.context.control.getAzimuthalAngle());if(i<.01)return;let{control:o}=this.bmap.context,s=t/Math.PI*6*i;return It(new Promise(a=>{let u={azimuthal:o.getAzimuthalAngle()},l={azimuthal:e},c=o.getPolarAngle(),{maxPolarAngle:h,minPolarAngle:p}=o;o.maxPolarAngle=c,o.minPolarAngle=c;let m=new Ic(u,this.tweenUtil.group).to(l,s).easing($K.Quadratic.InOut).onUpdate(()=>j(this,null,function*(){this.startPoi&&o.target.copy(this.startPoi.position),o.setAzimuthalAngle(u.azimuthal,!0),o.setTargetByOffset(this.options.offsetY)})).onComplete(()=>{o.enabled=!0,this.tweenUtil.remove(m),o.maxPolarAngle=h,o.minPolarAngle=p,a(!0)}).onStart(()=>{o.enabled=!1}).start()}),s+500).finally(()=>{this.bmap.context.control.enabled=!0})})}initNavigationCamera(t){return j(this,null,function*(){t===void 0&&(t=1e3);var e;let i=(e=this.taskQueue.getTasks().find(s=>s.meta.type==="initNavigationCamera"))==null?void 0:e.tid,o={run:()=>It(j(this,null,function*(){yield this.initCameraZoom(t/2),yield this.changeCameraToPathUp(t/4),yield this.translateCameraToStartPoi(t/4)}),t+500).finally(()=>{this.bmap.context.control.enabled=!0}),meta:{type:"initNavigationCamera"}};i?this.taskQueue.replace(i,o):this.taskQueue.add(o)})}translateCameraToStartPoi(t){return j(this,null,function*(){if(t===void 0&&(t=100),!this.startPoi)return;let{clientSize:{width:e,height:n},camera:i,control:o}=this.bmap.context,s=Math.round(e/2),a=Math.round(n/2),u=o.target.clone(),l=W(this.startPoi.position,i,e,n),c=l.x-s,h=a-l.y+this.options.offsetY;if(!(Math.abs(c)<=1&&Math.abs(h)<=1)){if(Math.abs(c)>=1){let p=new Re;p.setFromMatrixColumn(i.matrix,0),p.normalize(),p.multiplyScalar(c/i.zoom),u.add(new Re(p.x,p.y,0))}if(Math.abs(h)>=1){let p=new Re;p.setFromMatrixColumn(i.matrix,1),p.normalize(),p.multiplyScalar(h/i.zoom),u.add(new Re(p.x,p.y,0))}return It(new Promise(p=>{let m=o.target.clone();console.log(m,u,t);let g=new Ic(m,this.tweenUtil.group).to(u,t).onUpdate(()=>{this.bmap.context.control.setCameraPositionByTarget(m,0)}).onComplete(()=>{this.bmap.context.control.setCameraPositionByTarget(u,0),this.tweenUtil.remove(g),this.bmap.context.control.enabled=!0,p(!0)}).onStart(()=>{this.bmap.context.control.enabled=!1}).start()}),t+500).then(()=>{this.bmap.context.control.enabled=!0})}})}initCameraZoom(t){return j(this,null,function*(){if(t===void 0&&(t=100),!this.startPoi)return;let{clientSize:{width:e,height:n},currentFloor:i}=this.bmap.context,{max:o,min:s}=i.box,u=Math.min(e/(o.x-s.x),n/(o.y-s.y))*(o.x-s.x)/this.options.navigationCameraBasic;return this.bmap.context.setZoom(u,this.startPoi.position,t).finally(()=>{this.bmap.context.control.enabled=!0})})}toPosition(t,e){if(this.paths[this.curPathIndex]&&this.paths[this.curPathIndex].floor===t&&this.detachStartPoi){let n=this.translatePoints([e]);this.detachStartPoi.position.setX(n[0][0]),this.detachStartPoi.position.setY(n[0][1]),this.detachLine&&this.startPoi&&this.detachLine.setPosition(this.startPoi.position,this.detachStartPoi.position)}this.positionNavigation.toPosition(t,e)}startSimulation(){this.positionNavigation.startSimulation()}setSimulationSpeed(t){this.positionNavigation.changeSimulationSpeed(t)}toPositionBySpeed(t,e){return j(this,null,function*(){let{currentPathPosition:n,curFloorPath:i,curFloorPathPoints:o}=this;if(!i||!n)return null;let s=this.movedDistance,a=rg(o,t);if(s===-1||a===-1||a<=s)return null;let u=a-s;if(!u)return;let l=Math.min(u/e,this.options.runAnimationMaxTime);return this.pathTween&&this.clearTween(),It(new Promise(c=>{let h=this.pathTween=new Ic({distance:0},this.tweenUtil.group).to({distance:u},l*1e3).onUpdate(p=>j(this,null,function*(){this.moveDistance(p.distance+s,h)})).onComplete(()=>{this.tweenUtil.remove(h),c(!0)}).start()}),l*1e3+500).finally(()=>{this.bmap.context.control.enabled=!0})})}moveDistance(t,e){return j(this,null,function*(){var n;this.movedDistance=t,(n=this.path)==null||n.movePath(this.movedDistance/this.curFloorPathLength);let i=Qn(this.curFloorPathPoints,this.movedDistance);if(i===null)return;this.currentPathPosition=i;let o=this.translatePoints([i])[0];this.startPoi&&(this.setStartPoiPosition(o[0],o[1]),this.options.disablePathAnimation||this.bmap.context.control.setTargetByOffset(this.options.offsetY,this.startPoi.position.clone())),this.options.disablePathAnimation||(e==null||e.pause(),yield this.changeCameraToPathUp(500/this.options.speed),e==null||e.resume())})}setStartPoiRotate(t){this.startPoiRotate=t;let n=(this.bmap.context.control.getAzimuthalAngle()*180/Math.PI+360)%360,i=(360-t-n)%360;this.detachStartPoi&&(this.detachStartPoi.options.icon_rotate=i),this.startPoi&&this.startRotateHelperPoi&&this.startRotateHelperPoi.setAngle(i)}dispose(){var t,e,n,i;this.path&&(this.bmap.context.scene.remove(this.path),this.path.dispose()),this.tweenUtil.dispose(),this.unRegistryEvent(),(t=this.startPoi)==null||t.dispose(),(e=this.detachStartPoi)==null||e.dispose(),(n=this.detachLine)==null||n.dispose(),(i=this.startRotateHelperPoi)==null||i.dispose(),Ke.dispose(),this.positionNavigation.dispose(),this.startRotateHelperPoi=null,this.detachStartPoi=null,this.detachLine=null,super.dispose()}constructor(t,e={},n){super(t),this.path=null,this.fetchRoadStatus=!1,this.paths=[],this.curPathIndex=0,this.curFloorPath=null,this.translatePath=null,this.currentPathPosition=null,this.toPointPosition=null,this.pathTween=null,this.startPoi=null,this.detachStartPoi=null,this.detachLine=null,this.startPoiRotate=0,this.startRotateHelperPoi=null,this.needStartRotateHelperPoi=!1,this.movedDistance=0,this.pathStart=[0,0],this.tweenUtil=new en,this.taskQueue=new qn,this.animationPathOptions={cPathIndex:0},this.cPath=[],this.onNavigationInfo=i=>{let{info:o}=i;if(this.dispatchEvent({type:"navigation-info",info:o}),!o.offset){if(o.routeIndex!==this.curPathIndex)return;this.toPointPosition=o.pos,this.toPositionByTask(o.pos)}},this.onUpdate=()=>{this.tweenUtil.update()},this.onSwitchFloor=i=>{let{data:{curFloor:o}}=i;if(this.clearTween(),this.paths[this.curPathIndex]){let s=this.paths[this.curPathIndex];this.setCurFloorPath(s!=null?s:null),s?this.renderPath(this.translatePoints(s.points)):this.clearPath()}else this.clearPath()},this.onControlChangeForStartPoi=()=>{this.startPoi&&this.setStartPoiRotate(this.startPoiRotate)},!n&&typeof e=="object"&&(n=e),this.options=Object.assign({},eR,n),this.positionNavigation=new da(this,T({simulationSpeed:this.options.speed},this.options.positionNavigation),this.options.roadData),this.registryEvent()}};var a$=d(v(),1);import{Group as nR,Box3 as rR,Vector3 as iR}from"three";var D1=class extends gt{show(t){let e=0;t.forEach(o=>{o.poiLayer2.pois.forEach(s=>{let a=new iR().setFromMatrixPosition(s.matrixWorld).z;s.position.setZ(a+e),s.options.depth_test=!0,this.poiLayer.pushPoi(s)}),o.poiLayer2.pois.length=0,o.poiLayer2.dispose(),o.position.z=e,e+=o.userData.height});let{scene:n,currentFloor:i}=this.bmap.context;i&&(n.remove(i),i.dispose()),this.group.add(this.poiLayer,...t),n.add(this.group),this.floors=t,this.fitCamera(),this.bmap.context.cameraBound.updateBox(),this.showStatus=!0}hide(){let{scene:t}=this.bmap.context;t.remove(this.group),this.poiLayer.clear(),this.floors.forEach(e=>{e.dispose()}),this.floors=[],this.group.clear(),this.showStatus=!1}fitCamera(){let{context:t,config:e,type:n}=this.bmap;t.cameraBound.setEnable(!1),t.control.minZoom=0,t.control.maxZoom=1/0,t.camera.zoom=1,t.setAzimuthalAngle(e.control.defaultAzimuthal,0),t.setPolarAngle(e.control.defaultPolar,0),t.fitCameraToObject(this.group,e.defaultPadding,0);let i=t.camera.zoom;t.control.minZoom=i,t.control.maxZoom=i*25,n==="3d"&&t.fitCameraToObject(this.group,e.defaultPadding,0,!1),this.bmap.basicZoom=t.camera.zoom,t.control.addEventListener("change",this.bmap.onControlChange.bind(this.bmap)),this.bmap.onControlChange(),t.cameraBound.setEnable(!0)}dispose(){this.poiLayer.dispose(),this.floors.forEach(t=>t.dispose()),this.floors=[],super.dispose()}constructor(t){super(t),this.floors=[],this.group=new nR,this.showStatus=!1,this.group.name="mul-floor-group",this.poiLayer=new dr(t.context),this.poiLayer.changeParkingSpaceVisibleByZoom=()=>{let e=new rR().setFromObject(this.group),{clientSize:{width:n,height:i}}=this.bmap.context,{max:o,min:s}=e,u=Math.min(n/(o.x-s.x),i/(o.y-s.y))*(o.x-s.x)/45;this.poiLayer.pois.filter(l=>l.userData.type==="parkingSpace").map(l=>{let c=this.bmap.context.camera.zoom>=u;l.visible=c,c||l.parentSetVisible(c)})}}};import{EventDispatcher as oR}from"three";function Yc(){let r=new Blob([`var xF=Object.create;var $x=Object.defineProperty;var EF=Object.getOwnPropertyDescriptor;var wF=Object.getOwnPropertyNames;var SF=Object.getPrototypeOf,MF=Object.prototype.hasOwnProperty;var at=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports);var bF=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of wF(t))!MF.call(n,s)&&s!==e&&$x(n,s,{get:()=>t[s],enumerable:!(o=EF(t,s))||o.enumerable});return n};var Ze=(n,t,e)=>(e=n!=null?xF(SF(n)):{},bF(t||!n||!n.__esModule?$x(e,"default",{value:n,enumerable:!0}):e,n));var np=(n,t,e)=>new Promise((o,s)=>{var c=g=>{try{p(e.next(g))}catch(m){s(m)}},h=g=>{try{p(e.throw(g))}catch(m){s(m)}},p=g=>g.done?o(g.value):Promise.resolve(g.value).then(c,h);p((e=e.apply(n,t)).next())});var oo=at((Im,Zx)=>{"use strict";var If=function(n){return n&&n.Math===Math&&n};Zx.exports=If(typeof globalThis=="object"&&globalThis)||If(typeof window=="object"&&window)||If(typeof self=="object"&&self)||If(typeof global=="object"&&global)||If(typeof Im=="object"&&Im)||function(){return this}()||Function("return this")()});var Kx=at((bJ,Jx)=>{"use strict";Jx.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 Di=at((AJ,jx)=>{"use strict";var Rm=typeof document=="object"&&document.all;jx.exports=typeof Rm=="undefined"&&Rm!==void 0?function(n){return typeof n=="function"||n===Rm}:function(n){return typeof n=="function"}});var Ea=at((TJ,Qx)=>{"use strict";var AF=Di();Qx.exports=function(n){return typeof n=="object"?n!==null:AF(n)}});var rp=at((CJ,eE)=>{"use strict";var TF=oo(),tE=Ea(),Lm=TF.document,CF=tE(Lm)&&tE(Lm.createElement);eE.exports=function(n){return CF?Lm.createElement(n):{}}});var iE=at((PJ,rE)=>{"use strict";var PF=rp(),Nm=PF("span").classList,nE=Nm&&Nm.constructor&&Nm.constructor.prototype;rE.exports=nE===Object.prototype?void 0:nE});var gi=at((IJ,oE)=>{"use strict";oE.exports=function(n){try{return!!n()}catch(t){return!0}}});var Rf=at((RJ,sE)=>{"use strict";var IF=gi();sE.exports=!IF(function(){var n=function(){}.bind();return typeof n!="function"||n.hasOwnProperty("prototype")})});var mi=at((LJ,lE)=>{"use strict";var aE=Rf(),uE=Function.prototype,Om=uE.call,RF=aE&&uE.bind.bind(Om,Om);lE.exports=aE?RF:function(n){return function(){return Om.apply(n,arguments)}}});var ec=at((NJ,fE)=>{"use strict";var cE=mi(),LF=cE({}.toString),NF=cE("".slice);fE.exports=function(n){return NF(LF(n),8,-1)}});var pE=at((OJ,hE)=>{"use strict";var OF=mi(),DF=gi(),FF=ec(),Dm=Object,UF=OF("".split);hE.exports=DF(function(){return!Dm("z").propertyIsEnumerable(0)})?function(n){return FF(n)==="String"?UF(n,""):Dm(n)}:Dm});var ip=at((DJ,dE)=>{"use strict";dE.exports=function(n){return n==null}});var nc=at((FJ,gE)=>{"use strict";var BF=ip(),zF=TypeError;gE.exports=function(n){if(BF(n))throw new zF("Can't call method on "+n);return n}});var rc=at((UJ,mE)=>{"use strict";var GF=pE(),kF=nc();mE.exports=function(n){return GF(kF(n))}});var Lf=at((BJ,yE)=>{"use strict";yE.exports=!1});var op=at((zJ,_E)=>{"use strict";var vE=oo(),qF=Object.defineProperty;_E.exports=function(n,t){try{qF(vE,n,{value:t,configurable:!0,writable:!0})}catch(e){vE[n]=t}return t}});var sp=at((GJ,wE)=>{"use strict";var HF=Lf(),VF=oo(),WF=op(),xE="__core-js_shared__",EE=wE.exports=VF[xE]||WF(xE,{});(EE.versions||(EE.versions=[])).push({version:"3.39.0",mode:HF?"pure":"global",copyright:"\\xA9 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.39.0/LICENSE",source:"https://github.com/zloirock/core-js"})});var ap=at((kJ,ME)=>{"use strict";var SE=sp();ME.exports=function(n,t){return SE[n]||(SE[n]=t||{})}});var ic=at((qJ,bE)=>{"use strict";var XF=nc(),YF=Object;bE.exports=function(n){return YF(XF(n))}});var wa=at((HJ,AE)=>{"use strict";var $F=mi(),ZF=ic(),JF=$F({}.hasOwnProperty);AE.exports=Object.hasOwn||function(t,e){return JF(ZF(t),e)}});var Fm=at((VJ,TE)=>{"use strict";var KF=mi(),jF=0,QF=Math.random(),tU=KF(1 .toString);TE.exports=function(n){return"Symbol("+(n===void 0?"":n)+")_"+tU(++jF+QF,36)}});var RE=at((WJ,IE)=>{"use strict";var eU=oo(),CE=eU.navigator,PE=CE&&CE.userAgent;IE.exports=PE?String(PE):""});var BE=at((XJ,UE)=>{"use strict";var FE=oo(),Um=RE(),LE=FE.process,NE=FE.Deno,OE=LE&&LE.versions||NE&&NE.version,DE=OE&&OE.v8,Xs,up;DE&&(Xs=DE.split("."),up=Xs[0]>0&&Xs[0]<4?1:+(Xs[0]+Xs[1]));!up&&Um&&(Xs=Um.match(/Edge\\/(\\d+)/),(!Xs||Xs[1]>=74)&&(Xs=Um.match(/Chrome\\/(\\d+)/),Xs&&(up=+Xs[1])));UE.exports=up});var Bm=at((YJ,GE)=>{"use strict";var zE=BE(),nU=gi(),rU=oo(),iU=rU.String;GE.exports=!!Object.getOwnPropertySymbols&&!nU(function(){var n=Symbol("symbol detection");return!iU(n)||!(Object(n)instanceof Symbol)||!Symbol.sham&&zE&&zE<41})});var zm=at(($J,kE)=>{"use strict";var oU=Bm();kE.exports=oU&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Is=at((ZJ,HE)=>{"use strict";var sU=oo(),aU=ap(),qE=wa(),uU=Fm(),lU=Bm(),cU=zm(),oc=sU.Symbol,Gm=aU("wks"),fU=cU?oc.for||oc:oc&&oc.withoutSetter||uU;HE.exports=function(n){return qE(Gm,n)||(Gm[n]=lU&&qE(oc,n)?oc[n]:fU("Symbol."+n)),Gm[n]}});var Sa=at((JJ,VE)=>{"use strict";var hU=Ea(),pU=String,dU=TypeError;VE.exports=function(n){if(hU(n))return n;throw new dU(pU(n)+" is not an object")}});var Ys=at((KJ,WE)=>{"use strict";var gU=gi();WE.exports=!gU(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var km=at((jJ,XE)=>{"use strict";var mU=Ys(),yU=gi();XE.exports=mU&&yU(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var qm=at((QJ,YE)=>{"use strict";var vU=Ys(),_U=gi(),xU=rp();YE.exports=!vU&&!_U(function(){return Object.defineProperty(xU("div"),"a",{get:function(){return 7}}).a!==7})});var Rs=at((tK,$E)=>{"use strict";var EU=Rf(),lp=Function.prototype.call;$E.exports=EU?lp.bind(lp):function(){return lp.apply(lp,arguments)}});var sc=at((eK,ZE)=>{"use strict";var Hm=oo(),wU=Di(),SU=function(n){return wU(n)?n:void 0};ZE.exports=function(n,t){return arguments.length<2?SU(Hm[n]):Hm[n]&&Hm[n][t]}});var KE=at((nK,JE)=>{"use strict";var MU=mi();JE.exports=MU({}.isPrototypeOf)});var Vm=at((rK,jE)=>{"use strict";var bU=sc(),AU=Di(),TU=KE(),CU=zm(),PU=Object;jE.exports=CU?function(n){return typeof n=="symbol"}:function(n){var t=bU("Symbol");return AU(t)&&TU(t.prototype,PU(n))}});var tw=at((iK,QE)=>{"use strict";var IU=String;QE.exports=function(n){try{return IU(n)}catch(t){return"Object"}}});var Nf=at((oK,ew)=>{"use strict";var RU=Di(),LU=tw(),NU=TypeError;ew.exports=function(n){if(RU(n))return n;throw new NU(LU(n)+" is not a function")}});var cp=at((sK,nw)=>{"use strict";var OU=Nf(),DU=ip();nw.exports=function(n,t){var e=n[t];return DU(e)?void 0:OU(e)}});var iw=at((aK,rw)=>{"use strict";var Wm=Rs(),Xm=Di(),Ym=Ea(),FU=TypeError;rw.exports=function(n,t){var e,o;if(t==="string"&&Xm(e=n.toString)&&!Ym(o=Wm(e,n))||Xm(e=n.valueOf)&&!Ym(o=Wm(e,n))||t!=="string"&&Xm(e=n.toString)&&!Ym(o=Wm(e,n)))return o;throw new FU("Can't convert object to primitive value")}});var uw=at((uK,aw)=>{"use strict";var UU=Rs(),ow=Ea(),sw=Vm(),BU=cp(),zU=iw(),GU=Is(),kU=TypeError,qU=GU("toPrimitive");aw.exports=function(n,t){if(!ow(n)||sw(n))return n;var e=BU(n,qU),o;if(e){if(t===void 0&&(t="default"),o=UU(e,n,t),!ow(o)||sw(o))return o;throw new kU("Can't convert object to primitive value")}return t===void 0&&(t="number"),zU(n,t)}});var $m=at((lK,lw)=>{"use strict";var HU=uw(),VU=Vm();lw.exports=function(n){var t=HU(n,"string");return VU(t)?t:t+""}});var Pu=at(fw=>{"use strict";var WU=Ys(),XU=qm(),YU=km(),fp=Sa(),cw=$m(),$U=TypeError,Zm=Object.defineProperty,ZU=Object.getOwnPropertyDescriptor,Jm="enumerable",Km="configurable",jm="writable";fw.f=WU?YU?function(t,e,o){if(fp(t),e=cw(e),fp(o),typeof t=="function"&&e==="prototype"&&"value"in o&&jm in o&&!o[jm]){var s=ZU(t,e);s&&s[jm]&&(t[e]=o.value,o={configurable:Km in o?o[Km]:s[Km],enumerable:Jm in o?o[Jm]:s[Jm],writable:!1})}return Zm(t,e,o)}:Zm:function(t,e,o){if(fp(t),e=cw(e),fp(o),XU)try{return Zm(t,e,o)}catch(s){}if("get"in o||"set"in o)throw new $U("Accessors not supported");return"value"in o&&(t[e]=o.value),t}});var pw=at((fK,hw)=>{"use strict";var JU=Math.ceil,KU=Math.floor;hw.exports=Math.trunc||function(t){var e=+t;return(e>0?KU:JU)(e)}});var ml=at((hK,dw)=>{"use strict";var jU=pw();dw.exports=function(n){var t=+n;return t!==t||t===0?0:jU(t)}});var mw=at((pK,gw)=>{"use strict";var QU=ml(),tB=Math.max,eB=Math.min;gw.exports=function(n,t){var e=QU(n);return e<0?tB(e+t,0):eB(e,t)}});var Qm=at((dK,yw)=>{"use strict";var nB=ml(),rB=Math.min;yw.exports=function(n){var t=nB(n);return t>0?rB(t,9007199254740991):0}});var Of=at((gK,vw)=>{"use strict";var iB=Qm();vw.exports=function(n){return iB(n.length)}});var Ew=at((mK,xw)=>{"use strict";var oB=rc(),sB=mw(),aB=Of(),_w=function(n){return function(t,e,o){var s=oB(t),c=aB(s);if(c===0)return!n&&-1;var h=sB(o,c),p;if(n&&e!==e){for(;c>h;)if(p=s[h++],p!==p)return!0}else for(;c>h;h++)if((n||h in s)&&s[h]===e)return n||h||0;return!n&&-1}};xw.exports={includes:_w(!0),indexOf:_w(!1)}});var hp=at((yK,ww)=>{"use strict";ww.exports={}});var e0=at((vK,Mw)=>{"use strict";var uB=mi(),t0=wa(),lB=rc(),cB=Ew().indexOf,fB=hp(),Sw=uB([].push);Mw.exports=function(n,t){var e=lB(n),o=0,s=[],c;for(c in e)!t0(fB,c)&&t0(e,c)&&Sw(s,c);for(;t.length>o;)t0(e,c=t[o++])&&(~cB(s,c)||Sw(s,c));return s}});var pp=at((_K,bw)=>{"use strict";bw.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var Tw=at((xK,Aw)=>{"use strict";var hB=e0(),pB=pp();Aw.exports=Object.keys||function(t){return hB(t,pB)}});var Pw=at(Cw=>{"use strict";var dB=Ys(),gB=km(),mB=Pu(),yB=Sa(),vB=rc(),_B=Tw();Cw.f=dB&&!gB?Object.defineProperties:function(t,e){yB(t);for(var o=vB(e),s=_B(e),c=s.length,h=0,p;c>h;)mB.f(t,p=s[h++],o[p]);return t}});var Rw=at((wK,Iw)=>{"use strict";var xB=sc();Iw.exports=xB("document","documentElement")});var dp=at((SK,Nw)=>{"use strict";var EB=ap(),wB=Fm(),Lw=EB("keys");Nw.exports=function(n){return Lw[n]||(Lw[n]=wB(n))}});var Df=at((MK,Gw)=>{"use strict";var SB=Sa(),MB=Pw(),Ow=pp(),bB=hp(),AB=Rw(),TB=rp(),CB=dp(),Dw=">",Fw="<",r0="prototype",i0="script",Bw=CB("IE_PROTO"),n0=function(){},zw=function(n){return Fw+i0+Dw+n+Fw+"/"+i0+Dw},Uw=function(n){n.write(zw("")),n.close();var t=n.parentWindow.Object;return n=null,t},PB=function(){var n=TB("iframe"),t="java"+i0+":",e;return n.style.display="none",AB.appendChild(n),n.src=String(t),e=n.contentWindow.document,e.open(),e.write(zw("document.F=Object")),e.close(),e.F},gp,mp=function(){try{gp=new ActiveXObject("htmlfile")}catch(t){}mp=typeof document!="undefined"?document.domain&&gp?Uw(gp):PB():Uw(gp);for(var n=Ow.length;n--;)delete mp[r0][Ow[n]];return mp()};bB[Bw]=!0;Gw.exports=Object.create||function(t,e){var o;return t!==null?(n0[r0]=SB(t),o=new n0,n0[r0]=null,o[Bw]=t):o=mp(),e===void 0?o:MB.f(o,e)}});var a0=at((bK,kw)=>{"use strict";var IB=Is(),RB=Df(),LB=Pu().f,o0=IB("unscopables"),s0=Array.prototype;s0[o0]===void 0&&LB(s0,o0,{configurable:!0,value:RB(null)});kw.exports=function(n){s0[o0][n]=!0}});var yp=at((AK,qw)=>{"use strict";qw.exports={}});var Ww=at((TK,Vw)=>{"use strict";var NB=oo(),OB=Di(),Hw=NB.WeakMap;Vw.exports=OB(Hw)&&/native code/.test(String(Hw))});var vp=at((CK,Xw)=>{"use strict";Xw.exports=function(n,t){return{enumerable:!(n&1),configurable:!(n&2),writable:!(n&4),value:t}}});var ac=at((PK,Yw)=>{"use strict";var DB=Ys(),FB=Pu(),UB=vp();Yw.exports=DB?function(n,t,e){return FB.f(n,t,UB(1,e))}:function(n,t,e){return n[t]=e,n}});var Ep=at((IK,Jw)=>{"use strict";var BB=Ww(),Zw=oo(),zB=Ea(),GB=ac(),u0=wa(),l0=sp(),kB=dp(),qB=hp(),$w="Object already initialized",c0=Zw.TypeError,HB=Zw.WeakMap,_p,Ff,xp,VB=function(n){return xp(n)?Ff(n):_p(n,{})},WB=function(n){return function(t){var e;if(!zB(t)||(e=Ff(t)).type!==n)throw new c0("Incompatible receiver, "+n+" required");return e}};BB||l0.state?($s=l0.state||(l0.state=new HB),$s.get=$s.get,$s.has=$s.has,$s.set=$s.set,_p=function(n,t){if($s.has(n))throw new c0($w);return t.facade=n,$s.set(n,t),t},Ff=function(n){return $s.get(n)||{}},xp=function(n){return $s.has(n)}):(yl=kB("state"),qB[yl]=!0,_p=function(n,t){if(u0(n,yl))throw new c0($w);return t.facade=n,GB(n,yl,t),t},Ff=function(n){return u0(n,yl)?n[yl]:{}},xp=function(n){return u0(n,yl)});var $s,yl;Jw.exports={set:_p,get:Ff,has:xp,enforce:VB,getterFor:WB}});var tS=at(Qw=>{"use strict";var Kw={}.propertyIsEnumerable,jw=Object.getOwnPropertyDescriptor,XB=jw&&!Kw.call({1:2},1);Qw.f=XB?function(t){var e=jw(this,t);return!!e&&e.enumerable}:Kw});var f0=at(nS=>{"use strict";var YB=Ys(),$B=Rs(),ZB=tS(),JB=vp(),KB=rc(),jB=$m(),QB=wa(),tz=qm(),eS=Object.getOwnPropertyDescriptor;nS.f=YB?eS:function(t,e){if(t=KB(t),e=jB(e),tz)try{return eS(t,e)}catch(o){}if(QB(t,e))return JB(!$B(ZB.f,t,e),t[e])}});var d0=at((NK,iS)=>{"use strict";var h0=Ys(),ez=wa(),rS=Function.prototype,nz=h0&&Object.getOwnPropertyDescriptor,p0=ez(rS,"name"),rz=p0&&function(){}.name==="something",iz=p0&&(!h0||h0&&nz(rS,"name").configurable);iS.exports={EXISTS:p0,PROPER:rz,CONFIGURABLE:iz}});var m0=at((OK,oS)=>{"use strict";var oz=mi(),sz=Di(),g0=sp(),az=oz(Function.toString);sz(g0.inspectSource)||(g0.inspectSource=function(n){return az(n)});oS.exports=g0.inspectSource});var lS=at((DK,uS)=>{"use strict";var v0=mi(),uz=gi(),lz=Di(),wp=wa(),y0=Ys(),cz=d0().CONFIGURABLE,fz=m0(),aS=Ep(),hz=aS.enforce,pz=aS.get,sS=String,Sp=Object.defineProperty,dz=v0("".slice),gz=v0("".replace),mz=v0([].join),yz=y0&&!uz(function(){return Sp(function(){},"length",{value:8}).length!==8}),vz=String(String).split("String"),_z=uS.exports=function(n,t,e){dz(sS(t),0,7)==="Symbol("&&(t="["+gz(sS(t),/^Symbol\\(([^)]*)\\).*$/,"$1")+"]"),e&&e.getter&&(t="get "+t),e&&e.setter&&(t="set "+t),(!wp(n,"name")||cz&&n.name!==t)&&(y0?Sp(n,"name",{value:t,configurable:!0}):n.name=t),yz&&e&&wp(e,"arity")&&n.length!==e.arity&&Sp(n,"length",{value:e.arity});try{e&&wp(e,"constructor")&&e.constructor?y0&&Sp(n,"prototype",{writable:!1}):n.prototype&&(n.prototype=void 0)}catch(s){}var o=hz(n);return wp(o,"source")||(o.source=mz(vz,typeof t=="string"?t:"")),n};Function.prototype.toString=_z(function(){return lz(this)&&pz(this).source||fz(this)},"toString")});var Uf=at((FK,cS)=>{"use strict";var xz=Di(),Ez=Pu(),wz=lS(),Sz=op();cS.exports=function(n,t,e,o){o||(o={});var s=o.enumerable,c=o.name!==void 0?o.name:t;if(xz(e)&&wz(e,c,o),o.global)s?n[t]=e:Sz(t,e);else{try{o.unsafe?n[t]&&(s=!0):delete n[t]}catch(h){}s?n[t]=e:Ez.f(n,t,{value:e,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return n}});var hS=at(fS=>{"use strict";var Mz=e0(),bz=pp(),Az=bz.concat("length","prototype");fS.f=Object.getOwnPropertyNames||function(t){return Mz(t,Az)}});var dS=at(pS=>{"use strict";pS.f=Object.getOwnPropertySymbols});var mS=at((zK,gS)=>{"use strict";var Tz=sc(),Cz=mi(),Pz=hS(),Iz=dS(),Rz=Sa(),Lz=Cz([].concat);gS.exports=Tz("Reflect","ownKeys")||function(t){var e=Pz.f(Rz(t)),o=Iz.f;return o?Lz(e,o(t)):e}});var _S=at((GK,vS)=>{"use strict";var yS=wa(),Nz=mS(),Oz=f0(),Dz=Pu();vS.exports=function(n,t,e){for(var o=Nz(t),s=Dz.f,c=Oz.f,h=0;h<o.length;h++){var p=o[h];!yS(n,p)&&!(e&&yS(e,p))&&s(n,p,c(t,p))}}});var ES=at((kK,xS)=>{"use strict";var Fz=gi(),Uz=Di(),Bz=/#|\\.prototype\\./,Bf=function(n,t){var e=Gz[zz(n)];return e===qz?!0:e===kz?!1:Uz(t)?Fz(t):!!t},zz=Bf.normalize=function(n){return String(n).replace(Bz,".").toLowerCase()},Gz=Bf.data={},kz=Bf.NATIVE="N",qz=Bf.POLYFILL="P";xS.exports=Bf});var Ls=at((qK,wS)=>{"use strict";var Mp=oo(),Hz=f0().f,Vz=ac(),Wz=Uf(),Xz=op(),Yz=_S(),$z=ES();wS.exports=function(n,t){var e=n.target,o=n.global,s=n.stat,c,h,p,g,m,_;if(o?h=Mp:s?h=Mp[e]||Xz(e,{}):h=Mp[e]&&Mp[e].prototype,h)for(p in t){if(m=t[p],n.dontCallGetSet?(_=Hz(h,p),g=_&&_.value):g=h[p],c=$z(o?p:e+(s?".":"#")+p,n.forced),!c&&g!==void 0){if(typeof m==typeof g)continue;Yz(m,g)}(n.sham||g&&g.sham)&&Vz(m,"sham",!0),Wz(h,p,m,n)}}});var MS=at((HK,SS)=>{"use strict";var Zz=gi();SS.exports=!Zz(function(){function n(){}return n.prototype.constructor=null,Object.getPrototypeOf(new n)!==n.prototype})});var x0=at((VK,AS)=>{"use strict";var Jz=wa(),Kz=Di(),jz=ic(),Qz=dp(),tG=MS(),bS=Qz("IE_PROTO"),_0=Object,eG=_0.prototype;AS.exports=tG?_0.getPrototypeOf:function(n){var t=jz(n);if(Jz(t,bS))return t[bS];var e=t.constructor;return Kz(e)&&t instanceof e?e.prototype:t instanceof _0?eG:null}});var M0=at((WK,PS)=>{"use strict";var nG=gi(),rG=Di(),iG=Ea(),oG=Df(),TS=x0(),sG=Uf(),aG=Is(),uG=Lf(),S0=aG("iterator"),CS=!1,Qa,E0,w0;[].keys&&(w0=[].keys(),"next"in w0?(E0=TS(TS(w0)),E0!==Object.prototype&&(Qa=E0)):CS=!0);var lG=!iG(Qa)||nG(function(){var n={};return Qa[S0].call(n)!==n});lG?Qa={}:uG&&(Qa=oG(Qa));rG(Qa[S0])||sG(Qa,S0,function(){return this});PS.exports={IteratorPrototype:Qa,BUGGY_SAFARI_ITERATORS:CS}});var bp=at((XK,RS)=>{"use strict";var cG=Pu().f,fG=wa(),hG=Is(),IS=hG("toStringTag");RS.exports=function(n,t,e){n&&!e&&(n=n.prototype),n&&!fG(n,IS)&&cG(n,IS,{configurable:!0,value:t})}});var NS=at((YK,LS)=>{"use strict";var pG=M0().IteratorPrototype,dG=Df(),gG=vp(),mG=bp(),yG=yp(),vG=function(){return this};LS.exports=function(n,t,e,o){var s=t+" Iterator";return n.prototype=dG(pG,{next:gG(+!o,e)}),mG(n,s,!1,!0),yG[s]=vG,n}});var b0=at(($K,OS)=>{"use strict";var _G=mi(),xG=Nf();OS.exports=function(n,t,e){try{return _G(xG(Object.getOwnPropertyDescriptor(n,t)[e]))}catch(o){}}});var FS=at((ZK,DS)=>{"use strict";var EG=Ea();DS.exports=function(n){return EG(n)||n===null}});var BS=at((JK,US)=>{"use strict";var wG=FS(),SG=String,MG=TypeError;US.exports=function(n){if(wG(n))return n;throw new MG("Can't set "+SG(n)+" as a prototype")}});var GS=at((KK,zS)=>{"use strict";var bG=b0(),AG=Ea(),TG=nc(),CG=BS();zS.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var n=!1,t={},e;try{e=bG(Object.prototype,"__proto__","set"),e(t,[]),n=t instanceof Array}catch(o){}return function(s,c){return TG(s),CG(c),AG(s)&&(n?e(s,c):s.__proto__=c),s}}():void 0)});var KS=at((jK,JS)=>{"use strict";var PG=Ls(),IG=Rs(),Ap=Lf(),$S=d0(),RG=Di(),LG=NS(),kS=x0(),qS=GS(),NG=bp(),OG=ac(),A0=Uf(),DG=Is(),HS=yp(),ZS=M0(),FG=$S.PROPER,UG=$S.CONFIGURABLE,VS=ZS.IteratorPrototype,Tp=ZS.BUGGY_SAFARI_ITERATORS,zf=DG("iterator"),WS="keys",Gf="values",XS="entries",YS=function(){return this};JS.exports=function(n,t,e,o,s,c,h){LG(e,t,o);var p=function(E){if(E===s&&x)return x;if(!Tp&&E&&E in _)return _[E];switch(E){case WS:return function(){return new e(this,E)};case Gf:return function(){return new e(this,E)};case XS:return function(){return new e(this,E)}}return function(){return new e(this)}},g=t+" Iterator",m=!1,_=n.prototype,w=_[zf]||_["@@iterator"]||s&&_[s],x=!Tp&&w||p(s),b=t==="Array"&&_.entries||w,P,I,S;if(b&&(P=kS(b.call(new n)),P!==Object.prototype&&P.next&&(!Ap&&kS(P)!==VS&&(qS?qS(P,VS):RG(P[zf])||A0(P,zf,YS)),NG(P,g,!0,!0),Ap&&(HS[g]=YS))),FG&&s===Gf&&w&&w.name!==Gf&&(!Ap&&UG?OG(_,"name",Gf):(m=!0,x=function(){return IG(w,this)})),s)if(I={values:p(Gf),keys:c?x:p(WS),entries:p(XS)},h)for(S in I)(Tp||m||!(S in _))&&A0(_,S,I[S]);else PG({target:t,proto:!0,forced:Tp||m},I);return(!Ap||h)&&_[zf]!==x&&A0(_,zf,x,{name:s}),HS[t]=x,I}});var QS=at((QK,jS)=>{"use strict";jS.exports=function(n,t){return{value:n,done:t}}});var oM=at((tj,iM)=>{"use strict";var BG=rc(),T0=a0(),tM=yp(),nM=Ep(),zG=Pu().f,GG=KS(),Cp=QS(),kG=Lf(),qG=Ys(),rM="Array Iterator",HG=nM.set,VG=nM.getterFor(rM);iM.exports=GG(Array,"Array",function(n,t){HG(this,{type:rM,target:BG(n),index:0,kind:t})},function(){var n=VG(this),t=n.target,e=n.index++;if(!t||e>=t.length)return n.target=null,Cp(void 0,!0);switch(n.kind){case"keys":return Cp(e,!1);case"values":return Cp(t[e],!1)}return Cp([e,t[e]],!1)},"values");var eM=tM.Arguments=tM.Array;T0("keys");T0("values");T0("entries");if(!kG&&qG&&eM.name!=="values")try{zG(eM,"name",{value:"values"})}catch(n){}});var Ip=at(()=>{"use strict";var sM=oo(),uM=Kx(),WG=iE(),kf=oM(),aM=ac(),XG=bp(),YG=Is(),C0=YG("iterator"),P0=kf.values,lM=function(n,t){if(n){if(n[C0]!==P0)try{aM(n,C0,P0)}catch(o){n[C0]=P0}if(XG(n,t,!0),uM[t]){for(var e in kf)if(n[e]!==kf[e])try{aM(n,e,kf[e])}catch(o){n[e]=kf[e]}}}};for(Pp in uM)lM(sM[Pp]&&sM[Pp].prototype,Pp);var Pp;lM(WG,"DOMTokenList")});var hM=at((rj,fM)=>{"use strict";var $G=Is(),ZG=$G("toStringTag"),cM={};cM[ZG]="z";fM.exports=String(cM)==="[object z]"});var I0=at((ij,pM)=>{"use strict";var JG=hM(),KG=Di(),Rp=ec(),jG=Is(),QG=jG("toStringTag"),t4=Object,e4=Rp(function(){return arguments}())==="Arguments",n4=function(n,t){try{return n[t]}catch(e){}};pM.exports=JG?Rp:function(n){var t,e,o;return n===void 0?"Undefined":n===null?"Null":typeof(e=n4(t=t4(n),QG))=="string"?e:e4?Rp(t):(o=Rp(t))==="Object"&&KG(t.callee)?"Arguments":o}});var Lp=at((oj,dM)=>{"use strict";var r4=I0(),i4=String;dM.exports=function(n){if(r4(n)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return i4(n)}});var mM=at((sj,gM)=>{"use strict";var o4=Sa();gM.exports=function(){var n=o4(this),t="";return n.hasIndices&&(t+="d"),n.global&&(t+="g"),n.ignoreCase&&(t+="i"),n.multiline&&(t+="m"),n.dotAll&&(t+="s"),n.unicode&&(t+="u"),n.unicodeSets&&(t+="v"),n.sticky&&(t+="y"),t}});var vM=at((aj,yM)=>{"use strict";var R0=gi(),s4=oo(),L0=s4.RegExp,N0=R0(function(){var n=L0("a","y");return n.lastIndex=2,n.exec("abcd")!==null}),a4=N0||R0(function(){return!L0("a","y").sticky}),u4=N0||R0(function(){var n=L0("^r","gy");return n.lastIndex=2,n.exec("str")!==null});yM.exports={BROKEN_CARET:u4,MISSED_STICKY:a4,UNSUPPORTED_Y:N0}});var xM=at((uj,_M)=>{"use strict";var l4=gi(),c4=oo(),f4=c4.RegExp;_M.exports=l4(function(){var n=f4(".","s");return!(n.dotAll&&n.test(\`
115
115
  \`)&&n.flags==="s")})});var wM=at((lj,EM)=>{"use strict";var h4=gi(),p4=oo(),d4=p4.RegExp;EM.exports=h4(function(){var n=d4("(?<a>b)","g");return n.exec("b").groups.a!=="b"||"b".replace(n,"$<a>c")!=="bc"})});var Dp=at((cj,MM)=>{"use strict";var uc=Rs(),Op=mi(),g4=Lp(),m4=mM(),y4=vM(),v4=ap(),_4=Df(),x4=Ep().get,E4=xM(),w4=wM(),S4=v4("native-string-replace",String.prototype.replace),Np=RegExp.prototype.exec,D0=Np,M4=Op("".charAt),b4=Op("".indexOf),A4=Op("".replace),O0=Op("".slice),F0=function(){var n=/a/,t=/b*/g;return uc(Np,n,"a"),uc(Np,t,"a"),n.lastIndex!==0||t.lastIndex!==0}(),SM=y4.BROKEN_CARET,U0=/()??/.exec("")[1]!==void 0,T4=F0||U0||SM||E4||w4;T4&&(D0=function(t){var e=this,o=x4(e),s=g4(t),c=o.raw,h,p,g,m,_,w,x;if(c)return c.lastIndex=e.lastIndex,h=uc(D0,c,s),e.lastIndex=c.lastIndex,h;var b=o.groups,P=SM&&e.sticky,I=uc(m4,e),S=e.source,E=0,R=s;if(P&&(I=A4(I,"y",""),b4(I,"g")===-1&&(I+="g"),R=O0(s,e.lastIndex),e.lastIndex>0&&(!e.multiline||e.multiline&&M4(s,e.lastIndex-1)!==\`
116
116
  \`)&&(S="(?: "+S+")",R=" "+R,E++),p=new RegExp("^(?:"+S+")",I)),U0&&(p=new RegExp("^"+S+"$(?!\\\\s)",I)),F0&&(g=e.lastIndex),m=uc(Np,P?p:e,R),P?m?(m.input=O0(m.input,E),m[0]=O0(m[0],E),m.index=e.lastIndex,e.lastIndex+=m[0].length):e.lastIndex=0:F0&&m&&(e.lastIndex=e.global?m.index+m[0].length:g),U0&&m&&m.length>1&&uc(S4,m[0],p,function(){for(_=1;_<arguments.length-2;_++)arguments[_]===void 0&&(m[_]=void 0)}),m&&b)for(m.groups=w=_4(null),_=0;_<b.length;_++)x=b[_],w[x[0]]=m[x[1]];return m});MM.exports=D0});var Fp=at(()=>{"use strict";var C4=Ls(),bM=Dp();C4({target:"RegExp",proto:!0,forced:/./.exec!==bM},{exec:bM})});var Up=at((pj,AM)=>{"use strict";var P4=ec();AM.exports=Array.isArray||function(t){return P4(t)==="Array"}});var CM=at((dj,TM)=>{"use strict";var I4=Ys(),R4=Up(),L4=TypeError,N4=Object.getOwnPropertyDescriptor,O4=I4&&!function(){if(this!==void 0)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(n){return n instanceof TypeError}}();TM.exports=O4?function(n,t){if(R4(n)&&!N4(n,"length").writable)throw new L4("Cannot set read only .length");return n.length=t}:function(n,t){return n.length=t}});var B0=at((gj,PM)=>{"use strict";var D4=TypeError,F4=9007199254740991;PM.exports=function(n){if(n>F4)throw D4("Maximum allowed index exceeded");return n}});var z0=at(()=>{"use strict";var U4=Ls(),B4=ic(),z4=Of(),G4=CM(),k4=B0(),q4=gi(),H4=q4(function(){return[].push.call({length:4294967296},1)!==4294967297}),V4=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(n){return n instanceof TypeError}},W4=H4||!V4();U4({target:"Array",proto:!0,arity:1,forced:W4},{push:function(t){var e=B4(this),o=z4(e),s=arguments.length;k4(o+s);for(var c=0;c<s;c++)e[o]=arguments[c],o++;return G4(e,o),o}})});var Zs=at((vj,IM)=>{"use strict";var G0=mi(),Bp=Set.prototype;IM.exports={Set,add:G0(Bp.add),has:G0(Bp.has),remove:G0(Bp.delete),proto:Bp}});var Iu=at((_j,RM)=>{"use strict";var X4=Zs().has;RM.exports=function(n){return X4(n),n}});var Ru=at((xj,LM)=>{"use strict";var Y4=Rs();LM.exports=function(n,t,e){for(var o=e?n:n.iterator,s=n.next,c,h;!(c=Y4(s,o)).done;)if(h=t(c.value),h!==void 0)return h}});var lc=at((Ej,UM)=>{"use strict";var NM=mi(),$4=Ru(),OM=Zs(),Z4=OM.Set,DM=OM.proto,J4=NM(DM.forEach),FM=NM(DM.keys),K4=FM(new Z4).next;UM.exports=function(n,t,e){return e?$4({iterator:FM(n),next:K4},t):J4(n,t)}});var zp=at((wj,zM)=>{"use strict";var BM=Zs(),j4=lc(),Q4=BM.Set,tk=BM.add;zM.exports=function(n){var t=new Q4;return j4(n,function(e){tk(t,e)}),t}});var cc=at((Sj,GM)=>{"use strict";var ek=b0(),nk=Zs();GM.exports=ek(nk.proto,"size","get")||function(n){return n.size}});var qM=at((Mj,kM)=>{"use strict";kM.exports=function(n){return{iterator:n,next:n.next,done:!1}}});var Lu=at((bj,$M)=>{"use strict";var HM=Nf(),XM=Sa(),VM=Rs(),rk=ml(),ik=qM(),WM="Invalid size",ok=RangeError,sk=TypeError,ak=Math.max,YM=function(n,t){this.set=n,this.size=ak(t,0),this.has=HM(n.has),this.keys=HM(n.keys)};YM.prototype={getIterator:function(){return ik(XM(VM(this.keys,this.set)))},includes:function(n){return VM(this.has,this.set,n)}};$M.exports=function(n){XM(n);var t=+n.size;if(t!==t)throw new sk(WM);var e=rk(t);if(e<0)throw new ok(WM);return new YM(n,e)}});var jM=at((Aj,KM)=>{"use strict";var uk=Iu(),JM=Zs(),lk=zp(),ck=cc(),fk=Lu(),hk=lc(),pk=Ru(),dk=JM.has,ZM=JM.remove;KM.exports=function(t){var e=uk(this),o=fk(t),s=lk(e);return ck(e)<=o.size?hk(e,function(c){o.includes(c)&&ZM(s,c)}):pk(o.getIterator(),function(c){dk(e,c)&&ZM(s,c)}),s}});var Nu=at((Tj,tb)=>{"use strict";var gk=sc(),QM=function(n){return{size:n,has:function(){return!1},keys:function(){return{next:function(){return{done:!0}}}}}};tb.exports=function(n){var t=gk("Set");try{new t()[n](QM(0));try{return new t()[n](QM(-1)),!1}catch(e){return!0}}catch(e){return!1}}});var eb=at(()=>{"use strict";var mk=Ls(),yk=jM(),vk=Nu();mk({target:"Set",proto:!0,real:!0,forced:!vk("difference")},{difference:yk})});var ib=at((Ij,rb)=>{"use strict";var _k=Iu(),k0=Zs(),xk=cc(),Ek=Lu(),wk=lc(),Sk=Ru(),Mk=k0.Set,nb=k0.add,bk=k0.has;rb.exports=function(t){var e=_k(this),o=Ek(t),s=new Mk;return xk(e)>o.size?Sk(o.getIterator(),function(c){bk(e,c)&&nb(s,c)}):wk(e,function(c){o.includes(c)&&nb(s,c)}),s}});var ob=at(()=>{"use strict";var Ak=Ls(),Tk=gi(),Ck=ib(),Pk=Nu(),Ik=!Pk("intersection")||Tk(function(){return String(Array.from(new Set([1,2,3]).intersection(new Set([3,2]))))!=="3,2"});Ak({target:"Set",proto:!0,real:!0,forced:Ik},{intersection:Ck})});var q0=at((Nj,ab)=>{"use strict";var Rk=Rs(),sb=Sa(),Lk=cp();ab.exports=function(n,t,e){var o,s;sb(n);try{if(o=Lk(n,"return"),!o){if(t==="throw")throw e;return e}o=Rk(o,n)}catch(c){s=!0,o=c}if(t==="throw")throw e;if(s)throw o;return sb(o),e}});var lb=at((Oj,ub)=>{"use strict";var Nk=Iu(),Ok=Zs().has,Dk=cc(),Fk=Lu(),Uk=lc(),Bk=Ru(),zk=q0();ub.exports=function(t){var e=Nk(this),o=Fk(t);if(Dk(e)<=o.size)return Uk(e,function(c){if(o.includes(c))return!1},!0)!==!1;var s=o.getIterator();return Bk(s,function(c){if(Ok(e,c))return zk(s,"normal",!1)})!==!1}});var cb=at(()=>{"use strict";var Gk=Ls(),kk=lb(),qk=Nu();Gk({target:"Set",proto:!0,real:!0,forced:!qk("isDisjointFrom")},{isDisjointFrom:kk})});var hb=at((Uj,fb)=>{"use strict";var Hk=Iu(),Vk=cc(),Wk=lc(),Xk=Lu();fb.exports=function(t){var e=Hk(this),o=Xk(t);return Vk(e)>o.size?!1:Wk(e,function(s){if(!o.includes(s))return!1},!0)!==!1}});var pb=at(()=>{"use strict";var Yk=Ls(),$k=hb(),Zk=Nu();Yk({target:"Set",proto:!0,real:!0,forced:!Zk("isSubsetOf")},{isSubsetOf:$k})});var gb=at((Gj,db)=>{"use strict";var Jk=Iu(),Kk=Zs().has,jk=cc(),Qk=Lu(),tq=Ru(),eq=q0();db.exports=function(t){var e=Jk(this),o=Qk(t);if(jk(e)<o.size)return!1;var s=o.getIterator();return tq(s,function(c){if(!Kk(e,c))return eq(s,"normal",!1)})!==!1}});var mb=at(()=>{"use strict";var nq=Ls(),rq=gb(),iq=Nu();nq({target:"Set",proto:!0,real:!0,forced:!iq("isSupersetOf")},{isSupersetOf:rq})});var vb=at((Hj,yb)=>{"use strict";var oq=Iu(),H0=Zs(),sq=zp(),aq=Lu(),uq=Ru(),lq=H0.add,cq=H0.has,fq=H0.remove;yb.exports=function(t){var e=oq(this),o=aq(t).getIterator(),s=sq(e);return uq(o,function(c){cq(e,c)?fq(s,c):lq(s,c)}),s}});var _b=at(()=>{"use strict";var hq=Ls(),pq=vb(),dq=Nu();hq({target:"Set",proto:!0,real:!0,forced:!dq("symmetricDifference")},{symmetricDifference:pq})});var Eb=at((Xj,xb)=>{"use strict";var gq=Iu(),mq=Zs().add,yq=zp(),vq=Lu(),_q=Ru();xb.exports=function(t){var e=gq(this),o=vq(t).getIterator(),s=yq(e);return _q(o,function(c){mq(s,c)}),s}});var wb=at(()=>{"use strict";var xq=Ls(),Eq=Eb(),wq=Nu();xq({target:"Set",proto:!0,real:!0,forced:!wq("union")},{union:Eq})});var Mb=at((Zj,Sb)=>{"use strict";var Sq=ec(),Mq=mi();Sb.exports=function(n){if(Sq(n)==="Function")return Mq(n)}});var Tb=at((Jj,Ab)=>{"use strict";var bb=Mb(),bq=Nf(),Aq=Rf(),Tq=bb(bb.bind);Ab.exports=function(n,t){return bq(n),t===void 0?n:Aq?Tq(n,t):function(){return n.apply(t,arguments)}}});var Ib=at((Kj,Pb)=>{"use strict";var Cq=Up(),Pq=Of(),Iq=B0(),Rq=Tb(),Cb=function(n,t,e,o,s,c,h,p){for(var g=s,m=0,_=h?Rq(h,p):!1,w,x;m<o;)m in e&&(w=_?_(e[m],m,t):e[m],c>0&&Cq(w)?(x=Pq(w),g=Cb(n,t,w,x,g,c-1)-1):(Iq(g+1),n[g]=w),g++),m++;return g};Pb.exports=Cb});var Fb=at((jj,Db)=>{"use strict";var Lq=mi(),Nq=gi(),Rb=Di(),Oq=I0(),Dq=sc(),Fq=m0(),Lb=function(){},Nb=Dq("Reflect","construct"),V0=/^\\s*(?:class|function)\\b/,Uq=Lq(V0.exec),Bq=!V0.test(Lb),qf=function(t){if(!Rb(t))return!1;try{return Nb(Lb,[],t),!0}catch(e){return!1}},Ob=function(t){if(!Rb(t))return!1;switch(Oq(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Bq||!!Uq(V0,Fq(t))}catch(e){return!0}};Ob.sham=!0;Db.exports=!Nb||Nq(function(){var n;return qf(qf.call)||!qf(Object)||!qf(function(){n=!0})||n})?Ob:qf});var Gb=at((Qj,zb)=>{"use strict";var Ub=Up(),zq=Fb(),Gq=Ea(),kq=Is(),qq=kq("species"),Bb=Array;zb.exports=function(n){var t;return Ub(n)&&(t=n.constructor,zq(t)&&(t===Bb||Ub(t.prototype))?t=void 0:Gq(t)&&(t=t[qq],t===null&&(t=void 0))),t===void 0?Bb:t}});var qb=at((tQ,kb)=>{"use strict";var Hq=Gb();kb.exports=function(n,t){return new(Hq(n))(t===0?0:t)}});var Hb=at(()=>{"use strict";var Vq=Ls(),Wq=Ib(),Xq=ic(),Yq=Of(),$q=ml(),Zq=qb();Vq({target:"Array",proto:!0},{flat:function(){var t=arguments.length?arguments[0]:void 0,e=Xq(this),o=Yq(e),s=Zq(e,0);return s.length=Wq(s,e,e,o,0,t===void 0?1:$q(t)),s}})});var Vb=at(()=>{"use strict";var Jq=a0();Jq("flat")});var Xb=at((oQ,Wb)=>{var W0=class{constructor(){this.keys=new Set,this.queue=[]}sort(){this.queue.sort((t,e)=>t.priority-e.priority)}set(t,e){let o=Number(e);if(isNaN(o))throw new TypeError('"priority" must be a number');return this.keys.has(t)?this.queue.map(s=>(s.key===t&&Object.assign(s,{priority:o}),s)):(this.keys.add(t),this.queue.push({key:t,priority:o})),this.sort(),this.queue.length}next(){let t=this.queue.shift();return this.keys.delete(t.key),t}isEmpty(){return this.queue.length===0}has(t){return this.keys.has(t)}get(t){return this.queue.find(e=>e.key===t)}};Wb.exports=W0});var Zb=at((sQ,$b)=>{function Yb(n,t){let e=new Map;for(let[o,s]of n)o!==t&&s instanceof Map?e.set(o,Yb(s,t)):o!==t&&e.set(o,s);return e}$b.exports=Yb});var jb=at((aQ,Kb)=>{function Kq(n){let t=Number(n);return!(isNaN(t)||t<=0)}function Jb(n){let t=new Map;return Object.keys(n).forEach(o=>{let s=n[o];if(s!==null&&typeof s=="object"&&!Array.isArray(s))return t.set(o,Jb(s));if(!Kq(s))throw new Error(\`Could not add node at key "\${o}", make sure it's a valid node\`,s);return t.set(o,Number(s))}),t}Kb.exports=Jb});var eA=at((uQ,tA)=>{function Qb(n){if(!(n instanceof Map))throw new Error(\`Invalid graph: Expected Map instead found \${typeof n}\`);n.forEach((t,e)=>{if(typeof t=="object"&&t instanceof Map){Qb(t);return}if(typeof t!="number"||t<=0)throw new Error(\`Values must be numbers greater than 0. Found value \${t} at \${e}\`)})}tA.exports=Qb});var oA=at((lQ,iA)=>{var jq=Xb(),Qq=Zb(),nA=jb(),rA=eA(),X0=class{constructor(t){t instanceof Map?(rA(t),this.graph=t):t?this.graph=nA(t):this.graph=new Map}addNode(t,e){let o;return e instanceof Map?(rA(e),o=e):o=nA(e),this.graph.set(t,o),this}addVertex(t,e){return this.addNode(t,e)}removeNode(t){return this.graph=Qq(this.graph,t),this}path(t,e,o={}){if(!this.graph.size)return o.cost?{path:null,cost:0}:null;let s=new Set,c=new jq,h=new Map,p=[],g=0,m=[];if(o.avoid&&(m=[].concat(o.avoid)),m.includes(t))throw new Error(\`Starting node (\${t}) cannot be avoided\`);if(m.includes(e))throw new Error(\`Ending node (\${e}) cannot be avoided\`);for(c.set(t,0);!c.isEmpty();){let _=c.next();if(_.key===e){g=_.priority;let x=_.key;for(;h.has(x);)p.push(x),x=h.get(x);break}s.add(_.key),(this.graph.get(_.key)||new Map).forEach((x,b)=>{if(s.has(b)||m.includes(b))return null;if(!c.has(b))return h.set(b,_.key),c.set(b,_.priority+x);let P=c.get(b).priority,I=_.priority+x;return I<P?(h.set(b,_.key),c.set(b,I)):null})}return p.length?(o.trim?p.shift():p=p.concat([t]),o.reverse||(p=p.reverse()),o.cost?{path:p,cost:g}:p):o.cost?{path:null,cost:0}:null}shortestPath(...t){return this.path(...t)}};iA.exports=X0});var Ld=at((EQ,jT)=>{"use strict";var KT=Object.getOwnPropertySymbols,h9=Object.prototype.hasOwnProperty,p9=Object.prototype.propertyIsEnumerable;function d9(n){if(n==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(n)}function g9(){try{if(!Object.assign)return!1;var n=new String("abc");if(n[5]="de",Object.getOwnPropertyNames(n)[0]==="5")return!1;for(var t={},e=0;e<10;e++)t["_"+String.fromCharCode(e)]=e;var o=Object.getOwnPropertyNames(t).map(function(c){return t[c]});if(o.join("")!=="0123456789")return!1;var s={};return"abcdefghijklmnopqrst".split("").forEach(function(c){s[c]=c}),Object.keys(Object.assign({},s)).join("")==="abcdefghijklmnopqrst"}catch(c){return!1}}jT.exports=g9()?Object.assign:function(n,t){for(var e,o=d9(n),s,c=1;c<arguments.length;c++){e=Object(arguments[c]);for(var h in e)h9.call(e,h)&&(o[h]=e[h]);if(KT){s=KT(e);for(var p=0;p<s.length;p++)p9.call(e,s[p])&&(o[s[p]]=e[s[p]])}}return o}});var Ev=at((_v,xv)=>{(function(n,t){typeof _v=="object"&&typeof xv!="undefined"?xv.exports=t():typeof define=="function"&&define.amd?define(t):(n=n||self).RBush=t()})(_v,function(){"use strict";function n(S,E,R,T,F){(function W(X,q,D,xt,B){for(;xt>D;){if(xt-D>600){var j=xt-D+1,J=q-D+1,Dt=Math.log(j),Q=.5*Math.exp(2*Dt/3),At=.5*Math.sqrt(Dt*Q*(j-Q)/j)*(J-j/2<0?-1:1),Mt=Math.max(D,Math.floor(q-J*Q/j+At)),Rt=Math.min(xt,Math.floor(q+(j-J)*Q/j+At));W(X,q,Mt,Rt,B)}var pt=X[q],yt=D,K=xt;for(t(X,D,q),B(X[xt],pt)>0&&t(X,D,xt);yt<K;){for(t(X,yt,K),yt++,K--;B(X[yt],pt)<0;)yt++;for(;B(X[K],pt)>0;)K--}B(X[D],pt)===0?t(X,D,K):t(X,++K,xt),K<=q&&(D=K+1),q<=K&&(xt=K-1)}})(S,E,R||0,T||S.length-1,F||e)}function t(S,E,R){var T=S[E];S[E]=S[R],S[R]=T}function e(S,E){return S<E?-1:S>E?1:0}var o=function(S){S===void 0&&(S=9),this._maxEntries=Math.max(4,S),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function s(S,E,R){if(!R)return E.indexOf(S);for(var T=0;T<E.length;T++)if(R(S,E[T]))return T;return-1}function c(S,E){h(S,0,S.children.length,E,S)}function h(S,E,R,T,F){F||(F=P(null)),F.minX=1/0,F.minY=1/0,F.maxX=-1/0,F.maxY=-1/0;for(var W=E;W<R;W++){var X=S.children[W];p(F,S.leaf?T(X):X)}return F}function p(S,E){return S.minX=Math.min(S.minX,E.minX),S.minY=Math.min(S.minY,E.minY),S.maxX=Math.max(S.maxX,E.maxX),S.maxY=Math.max(S.maxY,E.maxY),S}function g(S,E){return S.minX-E.minX}function m(S,E){return S.minY-E.minY}function _(S){return(S.maxX-S.minX)*(S.maxY-S.minY)}function w(S){return S.maxX-S.minX+(S.maxY-S.minY)}function x(S,E){return S.minX<=E.minX&&S.minY<=E.minY&&E.maxX<=S.maxX&&E.maxY<=S.maxY}function b(S,E){return E.minX<=S.maxX&&E.minY<=S.maxY&&E.maxX>=S.minX&&E.maxY>=S.minY}function P(S){return{children:S,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function I(S,E,R,T,F){for(var W=[E,R];W.length;)if(!((R=W.pop())-(E=W.pop())<=T)){var X=E+Math.ceil((R-E)/T/2)*T;n(S,X,E,R,F),W.push(E,X,X,R)}}return o.prototype.all=function(){return this._all(this.data,[])},o.prototype.search=function(S){var E=this.data,R=[];if(!b(S,E))return R;for(var T=this.toBBox,F=[];E;){for(var W=0;W<E.children.length;W++){var X=E.children[W],q=E.leaf?T(X):X;b(S,q)&&(E.leaf?R.push(X):x(S,q)?this._all(X,R):F.push(X))}E=F.pop()}return R},o.prototype.collides=function(S){var E=this.data;if(!b(S,E))return!1;for(var R=[];E;){for(var T=0;T<E.children.length;T++){var F=E.children[T],W=E.leaf?this.toBBox(F):F;if(b(S,W)){if(E.leaf||x(S,W))return!0;R.push(F)}}E=R.pop()}return!1},o.prototype.load=function(S){if(!S||!S.length)return this;if(S.length<this._minEntries){for(var E=0;E<S.length;E++)this.insert(S[E]);return this}var R=this._build(S.slice(),0,S.length-1,0);if(this.data.children.length)if(this.data.height===R.height)this._splitRoot(this.data,R);else{if(this.data.height<R.height){var T=this.data;this.data=R,R=T}this._insert(R,this.data.height-R.height-1,!0)}else this.data=R;return this},o.prototype.insert=function(S){return S&&this._insert(S,this.data.height-1),this},o.prototype.clear=function(){return this.data=P([]),this},o.prototype.remove=function(S,E){if(!S)return this;for(var R,T,F,W=this.data,X=this.toBBox(S),q=[],D=[];W||q.length;){if(W||(W=q.pop(),T=q[q.length-1],R=D.pop(),F=!0),W.leaf){var xt=s(S,W.children,E);if(xt!==-1)return W.children.splice(xt,1),q.push(W),this._condense(q),this}F||W.leaf||!x(W,X)?T?(R++,W=T.children[R],F=!1):W=null:(q.push(W),D.push(R),R=0,T=W,W=W.children[0])}return this},o.prototype.toBBox=function(S){return S},o.prototype.compareMinX=function(S,E){return S.minX-E.minX},o.prototype.compareMinY=function(S,E){return S.minY-E.minY},o.prototype.toJSON=function(){return this.data},o.prototype.fromJSON=function(S){return this.data=S,this},o.prototype._all=function(S,E){for(var R=[];S;)S.leaf?E.push.apply(E,S.children):R.push.apply(R,S.children),S=R.pop();return E},o.prototype._build=function(S,E,R,T){var F,W=R-E+1,X=this._maxEntries;if(W<=X)return c(F=P(S.slice(E,R+1)),this.toBBox),F;T||(T=Math.ceil(Math.log(W)/Math.log(X)),X=Math.ceil(W/Math.pow(X,T-1))),(F=P([])).leaf=!1,F.height=T;var q=Math.ceil(W/X),D=q*Math.ceil(Math.sqrt(X));I(S,E,R,D,this.compareMinX);for(var xt=E;xt<=R;xt+=D){var B=Math.min(xt+D-1,R);I(S,xt,B,q,this.compareMinY);for(var j=xt;j<=B;j+=q){var J=Math.min(j+q-1,B);F.children.push(this._build(S,j,J,T-1))}}return c(F,this.toBBox),F},o.prototype._chooseSubtree=function(S,E,R,T){for(;T.push(E),!E.leaf&&T.length-1!==R;){for(var F=1/0,W=1/0,X=void 0,q=0;q<E.children.length;q++){var D=E.children[q],xt=_(D),B=(j=S,J=D,(Math.max(J.maxX,j.maxX)-Math.min(J.minX,j.minX))*(Math.max(J.maxY,j.maxY)-Math.min(J.minY,j.minY))-xt);B<W?(W=B,F=xt<F?xt:F,X=D):B===W&&xt<F&&(F=xt,X=D)}E=X||E.children[0]}var j,J;return E},o.prototype._insert=function(S,E,R){var T=R?S:this.toBBox(S),F=[],W=this._chooseSubtree(T,this.data,E,F);for(W.children.push(S),p(W,T);E>=0&&F[E].children.length>this._maxEntries;)this._split(F,E),E--;this._adjustParentBBoxes(T,F,E)},o.prototype._split=function(S,E){var R=S[E],T=R.children.length,F=this._minEntries;this._chooseSplitAxis(R,F,T);var W=this._chooseSplitIndex(R,F,T),X=P(R.children.splice(W,R.children.length-W));X.height=R.height,X.leaf=R.leaf,c(R,this.toBBox),c(X,this.toBBox),E?S[E-1].children.push(X):this._splitRoot(R,X)},o.prototype._splitRoot=function(S,E){this.data=P([S,E]),this.data.height=S.height+1,this.data.leaf=!1,c(this.data,this.toBBox)},o.prototype._chooseSplitIndex=function(S,E,R){for(var T,F,W,X,q,D,xt,B=1/0,j=1/0,J=E;J<=R-E;J++){var Dt=h(S,0,J,this.toBBox),Q=h(S,J,R,this.toBBox),At=(F=Dt,W=Q,X=void 0,q=void 0,D=void 0,xt=void 0,X=Math.max(F.minX,W.minX),q=Math.max(F.minY,W.minY),D=Math.min(F.maxX,W.maxX),xt=Math.min(F.maxY,W.maxY),Math.max(0,D-X)*Math.max(0,xt-q)),Mt=_(Dt)+_(Q);At<B?(B=At,T=J,j=Mt<j?Mt:j):At===B&&Mt<j&&(j=Mt,T=J)}return T||R-E},o.prototype._chooseSplitAxis=function(S,E,R){var T=S.leaf?this.compareMinX:g,F=S.leaf?this.compareMinY:m;this._allDistMargin(S,E,R,T)<this._allDistMargin(S,E,R,F)&&S.children.sort(T)},o.prototype._allDistMargin=function(S,E,R,T){S.children.sort(T);for(var F=this.toBBox,W=h(S,0,E,F),X=h(S,R-E,R,F),q=w(W)+w(X),D=E;D<R-E;D++){var xt=S.children[D];p(W,S.leaf?F(xt):xt),q+=w(W)}for(var B=R-E-1;B>=E;B--){var j=S.children[B];p(X,S.leaf?F(j):j),q+=w(X)}return q},o.prototype._adjustParentBBoxes=function(S,E,R){for(var T=R;T>=0;T--)p(E[T],S)},o.prototype._condense=function(S){for(var E=S.length-1,R=void 0;E>=0;E--)S[E].children.length===0?E>0?(R=S[E-1].children).splice(R.indexOf(S[E]),1):this.clear():c(S[E],this.toBBox)},o})});var QT=at((wv,Sv)=>{(function(n,t){typeof wv=="object"&&typeof Sv!="undefined"?Sv.exports=t():typeof define=="function"&&define.amd?define(t):(n=n||self,n.TinyQueue=t())})(wv,function(){"use strict";var n=function(o,s){if(o===void 0&&(o=[]),s===void 0&&(s=t),this.data=o,this.length=this.data.length,this.compare=s,this.length>0)for(var c=(this.length>>1)-1;c>=0;c--)this._down(c)};n.prototype.push=function(o){this.data.push(o),this.length++,this._up(this.length-1)},n.prototype.pop=function(){if(this.length!==0){var o=this.data[0],s=this.data.pop();return this.length--,this.length>0&&(this.data[0]=s,this._down(0)),o}},n.prototype.peek=function(){return this.data[0]},n.prototype._up=function(o){for(var s=this,c=s.data,h=s.compare,p=c[o];o>0;){var g=o-1>>1,m=c[g];if(h(p,m)>=0)break;c[o]=m,o=g}c[o]=p},n.prototype._down=function(o){for(var s=this,c=s.data,h=s.compare,p=this.length>>1,g=c[o];o<p;){var m=(o<<1)+1,_=c[m],w=m+1;if(w<this.length&&h(c[w],_)<0&&(m=w,_=c[w]),h(_,g)>=0)break;c[o]=_,o=m}c[o]=g};function t(e,o){return e<o?-1:e>o?1:0}return n})});var eC=at((TQ,tC)=>{tC.exports=function(t,e,o,s){var c=t[0],h=t[1],p=!1;o===void 0&&(o=0),s===void 0&&(s=e.length);for(var g=(s-o)/2,m=0,_=g-1;m<g;_=m++){var w=e[o+m*2+0],x=e[o+m*2+1],b=e[o+_*2+0],P=e[o+_*2+1],I=x>h!=P>h&&c<(b-w)*(h-x)/(P-x)+w;I&&(p=!p)}return p}});var rC=at((CQ,nC)=>{nC.exports=function(t,e,o,s){var c=t[0],h=t[1],p=!1;o===void 0&&(o=0),s===void 0&&(s=e.length);for(var g=s-o,m=0,_=g-1;m<g;_=m++){var w=e[m+o][0],x=e[m+o][1],b=e[_+o][0],P=e[_+o][1],I=x>h!=P>h&&c<(b-w)*(h-x)/(P-x)+w;I&&(p=!p)}return p}});var sC=at((PQ,Dd)=>{var iC=eC(),oC=rC();Dd.exports=function(t,e,o,s){return e.length>0&&Array.isArray(e[0])?oC(t,e,o,s):iC(t,e,o,s)};Dd.exports.nested=oC;Dd.exports.flat=iC});var uC=at((Fd,aC)=>{(function(n,t){typeof Fd=="object"&&typeof aC!="undefined"?t(Fd):typeof define=="function"&&define.amd?define(["exports"],t):t((n=n||self).predicates={})})(Fd,function(n){"use strict";let e=33306690738754706e-32;function o(b,P,I,S,E){let R,T,F,W,X=P[0],q=S[0],D=0,xt=0;q>X==q>-X?(R=X,X=P[++D]):(R=q,q=S[++xt]);let B=0;if(D<b&&xt<I)for(q>X==q>-X?(F=R-((T=X+R)-X),X=P[++D]):(F=R-((T=q+R)-q),q=S[++xt]),R=T,F!==0&&(E[B++]=F);D<b&&xt<I;)q>X==q>-X?(F=R-((T=R+X)-(W=T-R))+(X-W),X=P[++D]):(F=R-((T=R+q)-(W=T-R))+(q-W),q=S[++xt]),R=T,F!==0&&(E[B++]=F);for(;D<b;)F=R-((T=R+X)-(W=T-R))+(X-W),X=P[++D],R=T,F!==0&&(E[B++]=F);for(;xt<I;)F=R-((T=R+q)-(W=T-R))+(q-W),q=S[++xt],R=T,F!==0&&(E[B++]=F);return R===0&&B!==0||(E[B++]=R),B}function s(b){return new Float64Array(b)}let c=33306690738754716e-32,h=22204460492503146e-32,p=11093356479670487e-47,g=s(4),m=s(8),_=s(12),w=s(16),x=s(4);n.orient2d=function(b,P,I,S,E,R){let T=(P-R)*(I-E),F=(b-E)*(S-R),W=T-F;if(T===0||F===0||T>0!=F>0)return W;let X=Math.abs(T+F);return Math.abs(W)>=c*X?W:-function(q,D,xt,B,j,J,Dt){let Q,At,Mt,Rt,pt,yt,K,Bt,Gt,ae,ut,Ut,jt,ce,te,$t,qt,xe,ft=q-j,We=xt-j,ee=D-J,ge=B-J;pt=(te=(Bt=ft-(K=(yt=134217729*ft)-(yt-ft)))*(ae=ge-(Gt=(yt=134217729*ge)-(yt-ge)))-((ce=ft*ge)-K*Gt-Bt*Gt-K*ae))-(ut=te-(qt=(Bt=ee-(K=(yt=134217729*ee)-(yt-ee)))*(ae=We-(Gt=(yt=134217729*We)-(yt-We)))-(($t=ee*We)-K*Gt-Bt*Gt-K*ae))),g[0]=te-(ut+pt)+(pt-qt),pt=(jt=ce-((Ut=ce+ut)-(pt=Ut-ce))+(ut-pt))-(ut=jt-$t),g[1]=jt-(ut+pt)+(pt-$t),pt=(xe=Ut+ut)-Ut,g[2]=Ut-(xe-pt)+(ut-pt),g[3]=xe;let fe=function(tt,z){let Pt=z[0];for(let Ot=1;Ot<tt;Ot++)Pt+=z[Ot];return Pt}(4,g),Te=h*Dt;if(fe>=Te||-fe>=Te||(Q=q-(ft+(pt=q-ft))+(pt-j),Mt=xt-(We+(pt=xt-We))+(pt-j),At=D-(ee+(pt=D-ee))+(pt-J),Rt=B-(ge+(pt=B-ge))+(pt-J),Q===0&&At===0&&Mt===0&&Rt===0)||(Te=p*Dt+e*Math.abs(fe),(fe+=ft*Rt+ge*Q-(ee*Mt+We*At))>=Te||-fe>=Te))return fe;pt=(te=(Bt=Q-(K=(yt=134217729*Q)-(yt-Q)))*(ae=ge-(Gt=(yt=134217729*ge)-(yt-ge)))-((ce=Q*ge)-K*Gt-Bt*Gt-K*ae))-(ut=te-(qt=(Bt=At-(K=(yt=134217729*At)-(yt-At)))*(ae=We-(Gt=(yt=134217729*We)-(yt-We)))-(($t=At*We)-K*Gt-Bt*Gt-K*ae))),x[0]=te-(ut+pt)+(pt-qt),pt=(jt=ce-((Ut=ce+ut)-(pt=Ut-ce))+(ut-pt))-(ut=jt-$t),x[1]=jt-(ut+pt)+(pt-$t),pt=(xe=Ut+ut)-Ut,x[2]=Ut-(xe-pt)+(ut-pt),x[3]=xe;let be=o(4,g,4,x,m);pt=(te=(Bt=ft-(K=(yt=134217729*ft)-(yt-ft)))*(ae=Rt-(Gt=(yt=134217729*Rt)-(yt-Rt)))-((ce=ft*Rt)-K*Gt-Bt*Gt-K*ae))-(ut=te-(qt=(Bt=ee-(K=(yt=134217729*ee)-(yt-ee)))*(ae=Mt-(Gt=(yt=134217729*Mt)-(yt-Mt)))-(($t=ee*Mt)-K*Gt-Bt*Gt-K*ae))),x[0]=te-(ut+pt)+(pt-qt),pt=(jt=ce-((Ut=ce+ut)-(pt=Ut-ce))+(ut-pt))-(ut=jt-$t),x[1]=jt-(ut+pt)+(pt-$t),pt=(xe=Ut+ut)-Ut,x[2]=Ut-(xe-pt)+(ut-pt),x[3]=xe;let Wt=o(be,m,4,x,_);pt=(te=(Bt=Q-(K=(yt=134217729*Q)-(yt-Q)))*(ae=Rt-(Gt=(yt=134217729*Rt)-(yt-Rt)))-((ce=Q*Rt)-K*Gt-Bt*Gt-K*ae))-(ut=te-(qt=(Bt=At-(K=(yt=134217729*At)-(yt-At)))*(ae=Mt-(Gt=(yt=134217729*Mt)-(yt-Mt)))-(($t=At*Mt)-K*Gt-Bt*Gt-K*ae))),x[0]=te-(ut+pt)+(pt-qt),pt=(jt=ce-((Ut=ce+ut)-(pt=Ut-ce))+(ut-pt))-(ut=jt-$t),x[1]=jt-(ut+pt)+(pt-$t),pt=(xe=Ut+ut)-Ut,x[2]=Ut-(xe-pt)+(ut-pt),x[3]=xe;let Me=o(Wt,_,4,x,w);return w[Me-1]}(b,P,I,S,E,R,X)},n.orient2dfast=function(b,P,I,S,E,R){return(P-R)*(I-E)-(b-E)*(S-R)},Object.defineProperty(n,"__esModule",{value:!0})})});var dC=at((IQ,Tv)=>{"use strict";var lC=Ev(),Bd=QT(),y9=sC(),v9=uC().orient2d;Bd.default&&(Bd=Bd.default);Tv.exports=pC;Tv.exports.default=pC;function pC(n,t,e){t=Math.max(0,t===void 0?2:t),e=e||0;var o=S9(n),s=new lC(16);s.toBBox=function(R){return{minX:R[0],minY:R[1],maxX:R[0],maxY:R[1]}},s.compareMinX=function(R,T){return R[0]-T[0]},s.compareMinY=function(R,T){return R[1]-T[1]},s.load(n);for(var c=[],h=0,p;h<o.length;h++){var g=o[h];s.remove(g),p=hC(g,p),c.push(p)}var m=new lC(16);for(h=0;h<c.length;h++)m.insert(Mv(c[h]));for(var _=t*t,w=e*e;c.length;){var x=c.shift(),b=x.p,P=x.next.p,I=bv(b,P);if(!(I<w)){var S=I/_;g=_9(s,x.prev.p,b,P,x.next.next.p,S,m),g&&Math.min(bv(g,b),bv(g,P))<=S&&(c.push(x),c.push(hC(g,x)),s.remove(g),m.remove(x),m.insert(Mv(x)),m.insert(Mv(x.next)))}}x=p;var E=[];do E.push(x.p),x=x.next;while(x!==p);return E.push(x.p),E}function _9(n,t,e,o,s,c,h){for(var p=new Bd([],x9),g=n.data;g;){for(var m=0;m<g.children.length;m++){var _=g.children[m],w=g.leaf?Av(_,e,o):E9(e,o,_);w>c||p.push({node:_,dist:w})}for(;p.length&&!p.peek().node.children;){var x=p.pop(),b=x.node,P=Av(b,t,e),I=Av(b,o,s);if(x.dist<P&&x.dist<I&&fC(e,b,h)&&fC(o,b,h))return b}g=p.pop(),g&&(g=g.node)}return null}function x9(n,t){return n.dist-t.dist}function E9(n,t,e){if(cC(n,e)||cC(t,e))return 0;var o=Ud(n[0],n[1],t[0],t[1],e.minX,e.minY,e.maxX,e.minY);if(o===0)return 0;var s=Ud(n[0],n[1],t[0],t[1],e.minX,e.minY,e.minX,e.maxY);if(s===0)return 0;var c=Ud(n[0],n[1],t[0],t[1],e.maxX,e.minY,e.maxX,e.maxY);if(c===0)return 0;var h=Ud(n[0],n[1],t[0],t[1],e.minX,e.maxY,e.maxX,e.maxY);return h===0?0:Math.min(o,s,c,h)}function cC(n,t){return n[0]>=t.minX&&n[0]<=t.maxX&&n[1]>=t.minY&&n[1]<=t.maxY}function fC(n,t,e){for(var o=Math.min(n[0],t[0]),s=Math.min(n[1],t[1]),c=Math.max(n[0],t[0]),h=Math.max(n[1],t[1]),p=e.search({minX:o,minY:s,maxX:c,maxY:h}),g=0;g<p.length;g++)if(w9(p[g].p,p[g].next.p,n,t))return!1;return!0}function kc(n,t,e){return v9(n[0],n[1],t[0],t[1],e[0],e[1])}function w9(n,t,e,o){return n!==o&&t!==e&&kc(n,t,e)>0!=kc(n,t,o)>0&&kc(e,o,n)>0!=kc(e,o,t)>0}function Mv(n){var t=n.p,e=n.next.p;return n.minX=Math.min(t[0],e[0]),n.minY=Math.min(t[1],e[1]),n.maxX=Math.max(t[0],e[0]),n.maxY=Math.max(t[1],e[1]),n}function S9(n){for(var t=n[0],e=n[0],o=n[0],s=n[0],c=0;c<n.length;c++){var h=n[c];h[0]<t[0]&&(t=h),h[0]>o[0]&&(o=h),h[1]<e[1]&&(e=h),h[1]>s[1]&&(s=h)}var p=[t,e,o,s],g=p.slice();for(c=0;c<n.length;c++)y9(n[c],p)||g.push(n[c]);return b9(g)}function hC(n,t){var e={p:n,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return t?(e.next=t.next,e.prev=t,t.next.prev=e,t.next=e):(e.prev=e,e.next=e),e}function bv(n,t){var e=n[0]-t[0],o=n[1]-t[1];return e*e+o*o}function Av(n,t,e){var o=t[0],s=t[1],c=e[0]-o,h=e[1]-s;if(c!==0||h!==0){var p=((n[0]-o)*c+(n[1]-s)*h)/(c*c+h*h);p>1?(o=e[0],s=e[1]):p>0&&(o+=c*p,s+=h*p)}return c=n[0]-o,h=n[1]-s,c*c+h*h}function Ud(n,t,e,o,s,c,h,p){var g=e-n,m=o-t,_=h-s,w=p-c,x=n-s,b=t-c,P=g*g+m*m,I=g*_+m*w,S=_*_+w*w,E=g*x+m*b,R=_*x+w*b,T=P*S-I*I,F,W,X,q,D=T,xt=T;T===0?(W=0,D=1,q=R,xt=S):(W=I*R-S*E,q=P*R-I*E,W<0?(W=0,q=R,xt=S):W>D&&(W=D,q=R+I,xt=S)),q<0?(q=0,-E<0?W=0:-E>P?W=D:(W=-E,D=P)):q>xt&&(q=xt,-E+I<0?W=0:-E+I>P?W=D:(W=-E+I,D=P)),F=W===0?0:W/D,X=q===0?0:q/xt;var B=(1-F)*n+F*e,j=(1-F)*t+F*o,J=(1-X)*s+X*h,Dt=(1-X)*c+X*p,Q=J-B,At=Dt-j;return Q*Q+At*At}function M9(n,t){return n[0]===t[0]?n[1]-t[1]:n[0]-t[0]}function b9(n){n.sort(M9);for(var t=[],e=0;e<n.length;e++){for(;t.length>=2&&kc(t[t.length-2],t[t.length-1],n[e])<=0;)t.pop();t.push(n[e])}for(var o=[],s=n.length-1;s>=0;s--){for(;o.length>=2&&kc(o[o.length-2],o[o.length-1],n[s])<=0;)o.pop();o.push(n[s])}return o.pop(),t.pop(),t.concat(o)}});var xC=at((Pv,Iv)=>{(function(n,t){typeof Pv=="object"&&typeof Iv!="undefined"?Iv.exports=t():typeof define=="function"&&define.amd?define(t):n.quickselect=t()})(Pv,function(){"use strict";function n(s,c,h,p,g){t(s,c,h||0,p||s.length-1,g||o)}function t(s,c,h,p,g){for(;p>h;){if(p-h>600){var m=p-h+1,_=c-h+1,w=Math.log(m),x=.5*Math.exp(2*w/3),b=.5*Math.sqrt(w*x*(m-x)/m)*(_-m/2<0?-1:1),P=Math.max(h,Math.floor(c-_*x/m+b)),I=Math.min(p,Math.floor(c+(m-_)*x/m+b));t(s,c,P,I,g)}var S=s[c],E=h,R=p;for(e(s,h,c),g(s[p],S)>0&&e(s,h,p);E<R;){for(e(s,E,R),E++,R--;g(s[E],S)<0;)E++;for(;g(s[R],S)>0;)R--}g(s[h],S)===0?e(s,h,R):(R++,e(s,R,p)),R<=c&&(h=R+1),c<=R&&(p=R-1)}}function e(s,c,h){var p=s[c];s[c]=s[h],s[h]=p}function o(s,c){return s<c?-1:s>c?1:0}return n})});var Ov=at((int,Nv)=>{"use strict";Nv.exports=rh;Nv.exports.default=rh;var B9=xC();function rh(n,t){if(!(this instanceof rh))return new rh(n,t);this._maxEntries=Math.max(4,n||9),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),t&&this._initFormat(t),this.clear()}rh.prototype={all:function(){return this._all(this.data,[])},search:function(n){var t=this.data,e=[],o=this.toBBox;if(!Gd(n,t))return e;for(var s=[],c,h,p,g;t;){for(c=0,h=t.children.length;c<h;c++)p=t.children[c],g=t.leaf?o(p):p,Gd(n,g)&&(t.leaf?e.push(p):Lv(n,g)?this._all(p,e):s.push(p));t=s.pop()}return e},collides:function(n){var t=this.data,e=this.toBBox;if(!Gd(n,t))return!1;for(var o=[],s,c,h,p;t;){for(s=0,c=t.children.length;s<c;s++)if(h=t.children[s],p=t.leaf?e(h):h,Gd(n,p)){if(t.leaf||Lv(n,p))return!0;o.push(h)}t=o.pop()}return!1},load:function(n){if(!(n&&n.length))return this;if(n.length<this._minEntries){for(var t=0,e=n.length;t<e;t++)this.insert(n[t]);return this}var o=this._build(n.slice(),0,n.length-1,0);if(!this.data.children.length)this.data=o;else if(this.data.height===o.height)this._splitRoot(this.data,o);else{if(this.data.height<o.height){var s=this.data;this.data=o,o=s}this._insert(o,this.data.height-o.height-1,!0)}return this},insert:function(n){return n&&this._insert(n,this.data.height-1),this},clear:function(){return this.data=Vc([]),this},remove:function(n,t){if(!n)return this;for(var e=this.data,o=this.toBBox(n),s=[],c=[],h,p,g,m;e||s.length;){if(e||(e=s.pop(),p=s[s.length-1],h=c.pop(),m=!0),e.leaf&&(g=z9(n,e.children,t),g!==-1))return e.children.splice(g,1),s.push(e),this._condense(s),this;!m&&!e.leaf&&Lv(e,o)?(s.push(e),c.push(h),h=0,p=e,e=e.children[0]):p?(h++,e=p.children[h],m=!1):e=null}return this},toBBox:function(n){return n},compareMinX:EC,compareMinY:wC,toJSON:function(){return this.data},fromJSON:function(n){return this.data=n,this},_all:function(n,t){for(var e=[];n;)n.leaf?t.push.apply(t,n.children):e.push.apply(e,n.children),n=e.pop();return t},_build:function(n,t,e,o){var s=e-t+1,c=this._maxEntries,h;if(s<=c)return h=Vc(n.slice(t,e+1)),Hc(h,this.toBBox),h;o||(o=Math.ceil(Math.log(s)/Math.log(c)),c=Math.ceil(s/Math.pow(c,o-1))),h=Vc([]),h.leaf=!1,h.height=o;var p=Math.ceil(s/c),g=p*Math.ceil(Math.sqrt(c)),m,_,w,x;for(SC(n,t,e,g,this.compareMinX),m=t;m<=e;m+=g)for(w=Math.min(m+g-1,e),SC(n,m,w,p,this.compareMinY),_=m;_<=w;_+=p)x=Math.min(_+p-1,w),h.children.push(this._build(n,_,x,o-1));return Hc(h,this.toBBox),h},_chooseSubtree:function(n,t,e,o){for(var s,c,h,p,g,m,_,w;o.push(t),!(t.leaf||o.length-1===e);){for(_=w=1/0,s=0,c=t.children.length;s<c;s++)h=t.children[s],g=Rv(h),m=G9(n,h)-g,m<w?(w=m,_=g<_?g:_,p=h):m===w&&g<_&&(_=g,p=h);t=p||t.children[0]}return t},_insert:function(n,t,e){var o=this.toBBox,s=e?n:o(n),c=[],h=this._chooseSubtree(s,this.data,t,c);for(h.children.push(n),nh(h,s);t>=0&&c[t].children.length>this._maxEntries;)this._split(c,t),t--;this._adjustParentBBoxes(s,c,t)},_split:function(n,t){var e=n[t],o=e.children.length,s=this._minEntries;this._chooseSplitAxis(e,s,o);var c=this._chooseSplitIndex(e,s,o),h=Vc(e.children.splice(c,e.children.length-c));h.height=e.height,h.leaf=e.leaf,Hc(e,this.toBBox),Hc(h,this.toBBox),t?n[t-1].children.push(h):this._splitRoot(e,h)},_splitRoot:function(n,t){this.data=Vc([n,t]),this.data.height=n.height+1,this.data.leaf=!1,Hc(this.data,this.toBBox)},_chooseSplitIndex:function(n,t,e){var o,s,c,h,p,g,m,_;for(g=m=1/0,o=t;o<=e-t;o++)s=eh(n,0,o,this.toBBox),c=eh(n,o,e,this.toBBox),h=k9(s,c),p=Rv(s)+Rv(c),h<g?(g=h,_=o,m=p<m?p:m):h===g&&p<m&&(m=p,_=o);return _},_chooseSplitAxis:function(n,t,e){var o=n.leaf?this.compareMinX:EC,s=n.leaf?this.compareMinY:wC,c=this._allDistMargin(n,t,e,o),h=this._allDistMargin(n,t,e,s);c<h&&n.children.sort(o)},_allDistMargin:function(n,t,e,o){n.children.sort(o);var s=this.toBBox,c=eh(n,0,t,s),h=eh(n,e-t,e,s),p=zd(c)+zd(h),g,m;for(g=t;g<e-t;g++)m=n.children[g],nh(c,n.leaf?s(m):m),p+=zd(c);for(g=e-t-1;g>=t;g--)m=n.children[g],nh(h,n.leaf?s(m):m),p+=zd(h);return p},_adjustParentBBoxes:function(n,t,e){for(var o=e;o>=0;o--)nh(t[o],n)},_condense:function(n){for(var t=n.length-1,e;t>=0;t--)n[t].children.length===0?t>0?(e=n[t-1].children,e.splice(e.indexOf(n[t]),1)):this.clear():Hc(n[t],this.toBBox)},_initFormat:function(n){var t=["return a"," - b",";"];this.compareMinX=new Function("a","b",t.join(n[0])),this.compareMinY=new Function("a","b",t.join(n[1])),this.toBBox=new Function("a","return {minX: a"+n[0]+", minY: a"+n[1]+", maxX: a"+n[2]+", maxY: a"+n[3]+"};")}};function z9(n,t,e){if(!e)return t.indexOf(n);for(var o=0;o<t.length;o++)if(e(n,t[o]))return o;return-1}function Hc(n,t){eh(n,0,n.children.length,t,n)}function eh(n,t,e,o,s){s||(s=Vc(null)),s.minX=1/0,s.minY=1/0,s.maxX=-1/0,s.maxY=-1/0;for(var c=t,h;c<e;c++)h=n.children[c],nh(s,n.leaf?o(h):h);return s}function nh(n,t){return n.minX=Math.min(n.minX,t.minX),n.minY=Math.min(n.minY,t.minY),n.maxX=Math.max(n.maxX,t.maxX),n.maxY=Math.max(n.maxY,t.maxY),n}function EC(n,t){return n.minX-t.minX}function wC(n,t){return n.minY-t.minY}function Rv(n){return(n.maxX-n.minX)*(n.maxY-n.minY)}function zd(n){return n.maxX-n.minX+(n.maxY-n.minY)}function G9(n,t){return(Math.max(t.maxX,n.maxX)-Math.min(t.minX,n.minX))*(Math.max(t.maxY,n.maxY)-Math.min(t.minY,n.minY))}function k9(n,t){var e=Math.max(n.minX,t.minX),o=Math.max(n.minY,t.minY),s=Math.min(n.maxX,t.maxX),c=Math.min(n.maxY,t.maxY);return Math.max(0,s-e)*Math.max(0,c-o)}function Lv(n,t){return n.minX<=t.minX&&n.minY<=t.minY&&t.maxX<=n.maxX&&t.maxY<=n.maxY}function Gd(n,t){return t.minX<=n.maxX&&t.minY<=n.maxY&&t.maxX>=n.minX&&t.maxY>=n.minY}function Vc(n){return{children:n,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function SC(n,t,e,o,s){for(var c=[t,e],h;c.length;)e=c.pop(),t=c.pop(),!(e-t<=o)&&(h=t+Math.ceil((e-t)/o/2)*o,B9(n,h,t,e,s),c.push(t,h,h,e))}});var PC=at((yrt,Gv)=>{"use strict";Gv.exports=Vd;Gv.exports.default=Vd;function Vd(n,t,e){e=e||2;var o=t&&t.length,s=o?t[0]*e:n.length,c=AC(n,0,s,e,!0),h=[];if(!c||c.next===c.prev)return h;var p,g,m,_,w,x,b;if(o&&(c=K9(n,t,c,e)),n.length>80*e){p=m=n[0],g=_=n[1];for(var P=e;P<s;P+=e)w=n[P],x=n[P+1],w<p&&(p=w),x<g&&(g=x),w>m&&(m=w),x>_&&(_=x);b=Math.max(m-p,_-g),b=b!==0?32767/b:0}return sh(c,h,e,p,g,b,0),h}function AC(n,t,e,o,s){var c,h;if(s===zv(n,t,e,o)>0)for(c=t;c<e;c+=o)h=bC(c,n[c],n[c+1],h);else for(c=e-o;c>=t;c-=o)h=bC(c,n[c],n[c+1],h);return h&&Wd(h,h.next)&&(uh(h),h=h.next),h}function Dl(n,t){if(!n)return n;t||(t=n);var e=n,o;do if(o=!1,!e.steiner&&(Wd(e,e.next)||qr(e.prev,e,e.next)===0)){if(uh(e),e=t=e.prev,e===e.next)break;o=!0}else e=e.next;while(o||e!==t);return t}function sh(n,t,e,o,s,c,h){if(n){!h&&c&&nX(n,o,s,c);for(var p=n,g,m;n.prev!==n.next;){if(g=n.prev,m=n.next,c?$9(n,o,s,c):Y9(n)){t.push(g.i/e|0),t.push(n.i/e|0),t.push(m.i/e|0),uh(n),n=m.next,p=m.next;continue}if(n=m,n===p){h?h===1?(n=Z9(Dl(n),t,e),sh(n,t,e,o,s,c,2)):h===2&&J9(n,t,e,o,s,c):sh(Dl(n),t,e,o,s,c,1);break}}}}function Y9(n){var t=n.prev,e=n,o=n.next;if(qr(t,e,o)>=0)return!1;for(var s=t.x,c=e.x,h=o.x,p=t.y,g=e.y,m=o.y,_=s<c?s<h?s:h:c<h?c:h,w=p<g?p<m?p:m:g<m?g:m,x=s>c?s>h?s:h:c>h?c:h,b=p>g?p>m?p:m:g>m?g:m,P=o.next;P!==t;){if(P.x>=_&&P.x<=x&&P.y>=w&&P.y<=b&&Yc(s,p,c,g,h,m,P.x,P.y)&&qr(P.prev,P,P.next)>=0)return!1;P=P.next}return!0}function $9(n,t,e,o){var s=n.prev,c=n,h=n.next;if(qr(s,c,h)>=0)return!1;for(var p=s.x,g=c.x,m=h.x,_=s.y,w=c.y,x=h.y,b=p<g?p<m?p:m:g<m?g:m,P=_<w?_<x?_:x:w<x?w:x,I=p>g?p>m?p:m:g>m?g:m,S=_>w?_>x?_:x:w>x?w:x,E=Uv(b,P,t,e,o),R=Uv(I,S,t,e,o),T=n.prevZ,F=n.nextZ;T&&T.z>=E&&F&&F.z<=R;){if(T.x>=b&&T.x<=I&&T.y>=P&&T.y<=S&&T!==s&&T!==h&&Yc(p,_,g,w,m,x,T.x,T.y)&&qr(T.prev,T,T.next)>=0||(T=T.prevZ,F.x>=b&&F.x<=I&&F.y>=P&&F.y<=S&&F!==s&&F!==h&&Yc(p,_,g,w,m,x,F.x,F.y)&&qr(F.prev,F,F.next)>=0))return!1;F=F.nextZ}for(;T&&T.z>=E;){if(T.x>=b&&T.x<=I&&T.y>=P&&T.y<=S&&T!==s&&T!==h&&Yc(p,_,g,w,m,x,T.x,T.y)&&qr(T.prev,T,T.next)>=0)return!1;T=T.prevZ}for(;F&&F.z<=R;){if(F.x>=b&&F.x<=I&&F.y>=P&&F.y<=S&&F!==s&&F!==h&&Yc(p,_,g,w,m,x,F.x,F.y)&&qr(F.prev,F,F.next)>=0)return!1;F=F.nextZ}return!0}function Z9(n,t,e){var o=n;do{var s=o.prev,c=o.next.next;!Wd(s,c)&&TC(s,o,o.next,c)&&ah(s,c)&&ah(c,s)&&(t.push(s.i/e|0),t.push(o.i/e|0),t.push(c.i/e|0),uh(o),uh(o.next),o=n=c),o=o.next}while(o!==n);return Dl(o)}function J9(n,t,e,o,s,c){var h=n;do{for(var p=h.next.next;p!==h.prev;){if(h.i!==p.i&&oX(h,p)){var g=CC(h,p);h=Dl(h,h.next),g=Dl(g,g.next),sh(h,t,e,o,s,c,0),sh(g,t,e,o,s,c,0);return}p=p.next}h=h.next}while(h!==n)}function K9(n,t,e,o){var s=[],c,h,p,g,m;for(c=0,h=t.length;c<h;c++)p=t[c]*o,g=c<h-1?t[c+1]*o:n.length,m=AC(n,p,g,o,!1),m===m.next&&(m.steiner=!0),s.push(iX(m));for(s.sort(j9),c=0;c<s.length;c++)e=Q9(s[c],e);return e}function j9(n,t){return n.x-t.x}function Q9(n,t){var e=tX(n,t);if(!e)return t;var o=CC(e,n);return Dl(o,o.next),Dl(e,e.next)}function tX(n,t){var e=t,o=n.x,s=n.y,c=-1/0,h;do{if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){var p=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(p<=o&&p>c&&(c=p,h=e.x<e.next.x?e:e.next,p===o))return h}e=e.next}while(e!==t);if(!h)return null;var g=h,m=h.x,_=h.y,w=1/0,x;e=h;do o>=e.x&&e.x>=m&&o!==e.x&&Yc(s<_?o:c,s,m,_,s<_?c:o,s,e.x,e.y)&&(x=Math.abs(s-e.y)/(o-e.x),ah(e,n)&&(x<w||x===w&&(e.x>h.x||e.x===h.x&&eX(h,e)))&&(h=e,w=x)),e=e.next;while(e!==g);return h}function eX(n,t){return qr(n.prev,n,t.prev)<0&&qr(t.next,n,n.next)<0}function nX(n,t,e,o){var s=n;do s.z===0&&(s.z=Uv(s.x,s.y,t,e,o)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==n);s.prevZ.nextZ=null,s.prevZ=null,rX(s)}function rX(n){var t,e,o,s,c,h,p,g,m=1;do{for(e=n,n=null,c=null,h=0;e;){for(h++,o=e,p=0,t=0;t<m&&(p++,o=o.nextZ,!!o);t++);for(g=m;p>0||g>0&&o;)p!==0&&(g===0||!o||e.z<=o.z)?(s=e,e=e.nextZ,p--):(s=o,o=o.nextZ,g--),c?c.nextZ=s:n=s,s.prevZ=c,c=s;e=o}c.nextZ=null,m*=2}while(h>1);return n}function Uv(n,t,e,o,s){return n=(n-e)*s|0,t=(t-o)*s|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,n|t<<1}function iX(n){var t=n,e=n;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==n);return e}function Yc(n,t,e,o,s,c,h,p){return(s-h)*(t-p)>=(n-h)*(c-p)&&(n-h)*(o-p)>=(e-h)*(t-p)&&(e-h)*(c-p)>=(s-h)*(o-p)}function oX(n,t){return n.next.i!==t.i&&n.prev.i!==t.i&&!sX(n,t)&&(ah(n,t)&&ah(t,n)&&aX(n,t)&&(qr(n.prev,n,t.prev)||qr(n,t.prev,t))||Wd(n,t)&&qr(n.prev,n,n.next)>0&&qr(t.prev,t,t.next)>0)}function qr(n,t,e){return(t.y-n.y)*(e.x-t.x)-(t.x-n.x)*(e.y-t.y)}function Wd(n,t){return n.x===t.x&&n.y===t.y}function TC(n,t,e,o){var s=Hd(qr(n,t,e)),c=Hd(qr(n,t,o)),h=Hd(qr(e,o,n)),p=Hd(qr(e,o,t));return!!(s!==c&&h!==p||s===0&&qd(n,e,t)||c===0&&qd(n,o,t)||h===0&&qd(e,n,o)||p===0&&qd(e,t,o))}function qd(n,t,e){return t.x<=Math.max(n.x,e.x)&&t.x>=Math.min(n.x,e.x)&&t.y<=Math.max(n.y,e.y)&&t.y>=Math.min(n.y,e.y)}function Hd(n){return n>0?1:n<0?-1:0}function sX(n,t){var e=n;do{if(e.i!==n.i&&e.next.i!==n.i&&e.i!==t.i&&e.next.i!==t.i&&TC(e,e.next,n,t))return!0;e=e.next}while(e!==n);return!1}function ah(n,t){return qr(n.prev,n,n.next)<0?qr(n,t,n.next)>=0&&qr(n,n.prev,t)>=0:qr(n,t,n.prev)<0||qr(n,n.next,t)<0}function aX(n,t){var e=n,o=!1,s=(n.x+t.x)/2,c=(n.y+t.y)/2;do e.y>c!=e.next.y>c&&e.next.y!==e.y&&s<(e.next.x-e.x)*(c-e.y)/(e.next.y-e.y)+e.x&&(o=!o),e=e.next;while(e!==n);return o}function CC(n,t){var e=new Bv(n.i,n.x,n.y),o=new Bv(t.i,t.x,t.y),s=n.next,c=t.prev;return n.next=t,t.prev=n,e.next=s,s.prev=e,o.next=e,e.prev=o,c.next=o,o.prev=c,o}function bC(n,t,e,o){var s=new Bv(n,t,e);return o?(s.next=o.next,s.prev=o,o.next.prev=s,o.next=s):(s.prev=s,s.next=s),s}function uh(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function Bv(n,t,e){this.i=n,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Vd.deviation=function(n,t,e,o){var s=t&&t.length,c=s?t[0]*e:n.length,h=Math.abs(zv(n,0,c,e));if(s)for(var p=0,g=t.length;p<g;p++){var m=t[p]*e,_=p<g-1?t[p+1]*e:n.length;h-=Math.abs(zv(n,m,_,e))}var w=0;for(p=0;p<o.length;p+=3){var x=o[p]*e,b=o[p+1]*e,P=o[p+2]*e;w+=Math.abs((n[x]-n[P])*(n[b+1]-n[x+1])-(n[x]-n[b])*(n[P+1]-n[x+1]))}return h===0&&w===0?0:Math.abs((w-h)/h)};function zv(n,t,e,o){for(var s=0,c=t,h=e-o;c<e;c+=o)s+=(n[h]-n[c])*(n[c+1]+n[h+1]),h=c;return s}Vd.flatten=function(n){for(var t=n[0][0].length,e={vertices:[],holes:[],dimensions:t},o=0,s=0;s<n.length;s++){for(var c=0;c<n[s].length;c++)for(var h=0;h<t;h++)e.vertices.push(n[s][c][h]);s>0&&(o+=n[s-1].length,e.holes.push(o))}return e}});var Wv=at(Oe=>{"use strict";Object.defineProperty(Oe,"__esModule",{value:!0});Oe.earthRadius=63710088e-1;Oe.factors={centimeters:Oe.earthRadius*100,centimetres:Oe.earthRadius*100,degrees:Oe.earthRadius/111325,feet:Oe.earthRadius*3.28084,inches:Oe.earthRadius*39.37,kilometers:Oe.earthRadius/1e3,kilometres:Oe.earthRadius/1e3,meters:Oe.earthRadius,metres:Oe.earthRadius,miles:Oe.earthRadius/1609.344,millimeters:Oe.earthRadius*1e3,millimetres:Oe.earthRadius*1e3,nauticalmiles:Oe.earthRadius/1852,radians:1,yards:Oe.earthRadius*1.0936};Oe.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/Oe.earthRadius,yards:1.0936133};Oe.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function Ju(n,t,e){e===void 0&&(e={});var o={type:"Feature"};return(e.id===0||e.id)&&(o.id=e.id),e.bbox&&(o.bbox=e.bbox),o.properties=t||{},o.geometry=n,o}Oe.feature=Ju;function lX(n,t,e){switch(e===void 0&&(e={}),n){case"Point":return kv(t).geometry;case"LineString":return Hv(t).geometry;case"Polygon":return qv(t).geometry;case"MultiPoint":return RC(t).geometry;case"MultiLineString":return IC(t).geometry;case"MultiPolygon":return LC(t).geometry;default:throw new Error(n+" is invalid")}}Oe.geometry=lX;function kv(n,t,e){if(e===void 0&&(e={}),!n)throw new Error("coordinates is required");if(!Array.isArray(n))throw new Error("coordinates must be an Array");if(n.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Xd(n[0])||!Xd(n[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:n};return Ju(o,t,e)}Oe.point=kv;function cX(n,t,e){return e===void 0&&(e={}),Yd(n.map(function(o){return kv(o,t)}),e)}Oe.points=cX;function qv(n,t,e){e===void 0&&(e={});for(var o=0,s=n;o<s.length;o++){var c=s[o];if(c.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var h=0;h<c[c.length-1].length;h++)if(c[c.length-1][h]!==c[0][h])throw new Error("First and last Position are not equivalent.")}var p={type:"Polygon",coordinates:n};return Ju(p,t,e)}Oe.polygon=qv;function fX(n,t,e){return e===void 0&&(e={}),Yd(n.map(function(o){return qv(o,t)}),e)}Oe.polygons=fX;function Hv(n,t,e){if(e===void 0&&(e={}),n.length<2)throw new Error("coordinates must be an array of two or more positions");var o={type:"LineString",coordinates:n};return Ju(o,t,e)}Oe.lineString=Hv;function hX(n,t,e){return e===void 0&&(e={}),Yd(n.map(function(o){return Hv(o,t)}),e)}Oe.lineStrings=hX;function Yd(n,t){t===void 0&&(t={});var e={type:"FeatureCollection"};return t.id&&(e.id=t.id),t.bbox&&(e.bbox=t.bbox),e.features=n,e}Oe.featureCollection=Yd;function IC(n,t,e){e===void 0&&(e={});var o={type:"MultiLineString",coordinates:n};return Ju(o,t,e)}Oe.multiLineString=IC;function RC(n,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:n};return Ju(o,t,e)}Oe.multiPoint=RC;function LC(n,t,e){e===void 0&&(e={});var o={type:"MultiPolygon",coordinates:n};return Ju(o,t,e)}Oe.multiPolygon=LC;function pX(n,t,e){e===void 0&&(e={});var o={type:"GeometryCollection",geometries:n};return Ju(o,t,e)}Oe.geometryCollection=pX;function dX(n,t){if(t===void 0&&(t=0),t&&!(t>=0))throw new Error("precision must be a positive number");var e=Math.pow(10,t||0);return Math.round(n*e)/e}Oe.round=dX;function NC(n,t){t===void 0&&(t="kilometers");var e=Oe.factors[t];if(!e)throw new Error(t+" units is invalid");return n*e}Oe.radiansToLength=NC;function Vv(n,t){t===void 0&&(t="kilometers");var e=Oe.factors[t];if(!e)throw new Error(t+" units is invalid");return n/e}Oe.lengthToRadians=Vv;function gX(n,t){return OC(Vv(n,t))}Oe.lengthToDegrees=gX;function mX(n){var t=n%360;return t<0&&(t+=360),t}Oe.bearingToAzimuth=mX;function OC(n){var t=n%(2*Math.PI);return t*180/Math.PI}Oe.radiansToDegrees=OC;function yX(n){var t=n%360;return t*Math.PI/180}Oe.degreesToRadians=yX;function vX(n,t,e){if(t===void 0&&(t="kilometers"),e===void 0&&(e="kilometers"),!(n>=0))throw new Error("length must be a positive number");return NC(Vv(n,t),e)}Oe.convertLength=vX;function _X(n,t,e){if(t===void 0&&(t="meters"),e===void 0&&(e="kilometers"),!(n>=0))throw new Error("area must be a positive number");var o=Oe.areaFactors[t];if(!o)throw new Error("invalid original units");var s=Oe.areaFactors[e];if(!s)throw new Error("invalid final units");return n/o*s}Oe.convertArea=_X;function Xd(n){return!isNaN(n)&&n!==null&&!Array.isArray(n)}Oe.isNumber=Xd;function xX(n){return!!n&&n.constructor===Object}Oe.isObject=xX;function EX(n){if(!n)throw new Error("bbox is required");if(!Array.isArray(n))throw new Error("bbox must be an Array");if(n.length!==4&&n.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");n.forEach(function(t){if(!Xd(t))throw new Error("bbox must only contain numbers")})}Oe.validateBBox=EX;function wX(n){if(!n)throw new Error("id is required");if(["string","number"].indexOf(typeof n)===-1)throw new Error("id must be a number or a string")}Oe.validateId=wX});var Yv=at(Ei=>{"use strict";Object.defineProperty(Ei,"__esModule",{value:!0});var lo=Wv();function lh(n,t,e){if(n!==null)for(var o,s,c,h,p,g,m,_=0,w=0,x,b=n.type,P=b==="FeatureCollection",I=b==="Feature",S=P?n.features.length:1,E=0;E<S;E++){m=P?n.features[E].geometry:I?n.geometry:n,x=m?m.type==="GeometryCollection":!1,p=x?m.geometries.length:1;for(var R=0;R<p;R++){var T=0,F=0;if(h=x?m.geometries[R]:m,h!==null){g=h.coordinates;var W=h.type;switch(_=e&&(W==="Polygon"||W==="MultiPolygon")?1:0,W){case null:break;case"Point":if(t(g,w,E,T,F)===!1)return!1;w++,T++;break;case"LineString":case"MultiPoint":for(o=0;o<g.length;o++){if(t(g[o],w,E,T,F)===!1)return!1;w++,W==="MultiPoint"&&T++}W==="LineString"&&T++;break;case"Polygon":case"MultiLineString":for(o=0;o<g.length;o++){for(s=0;s<g[o].length-_;s++){if(t(g[o][s],w,E,T,F)===!1)return!1;w++}W==="MultiLineString"&&T++,W==="Polygon"&&F++}W==="Polygon"&&T++;break;case"MultiPolygon":for(o=0;o<g.length;o++){for(F=0,s=0;s<g[o].length;s++){for(c=0;c<g[o][s].length-_;c++){if(t(g[o][s][c],w,E,T,F)===!1)return!1;w++}F++}T++}break;case"GeometryCollection":for(o=0;o<h.geometries.length;o++)if(lh(h.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function SX(n,t,e,o){var s=e;return lh(n,function(c,h,p,g,m){h===0&&e===void 0?s=c:s=t(s,c,h,p,g,m)},o),s}function DC(n,t){var e;switch(n.type){case"FeatureCollection":for(e=0;e<n.features.length&&t(n.features[e].properties,e)!==!1;e++);break;case"Feature":t(n.properties,0);break}}function MX(n,t,e){var o=e;return DC(n,function(s,c){c===0&&e===void 0?o=s:o=t(o,s,c)}),o}function FC(n,t){if(n.type==="Feature")t(n,0);else if(n.type==="FeatureCollection")for(var e=0;e<n.features.length&&t(n.features[e],e)!==!1;e++);}function bX(n,t,e){var o=e;return FC(n,function(s,c){c===0&&e===void 0?o=s:o=t(o,s,c)}),o}function AX(n){var t=[];return lh(n,function(e){t.push(e)}),t}function Xv(n,t){var e,o,s,c,h,p,g,m,_,w,x=0,b=n.type==="FeatureCollection",P=n.type==="Feature",I=b?n.features.length:1;for(e=0;e<I;e++){for(p=b?n.features[e].geometry:P?n.geometry:n,m=b?n.features[e].properties:P?n.properties:{},_=b?n.features[e].bbox:P?n.bbox:void 0,w=b?n.features[e].id:P?n.id:void 0,g=p?p.type==="GeometryCollection":!1,h=g?p.geometries.length:1,s=0;s<h;s++){if(c=g?p.geometries[s]:p,c===null){if(t(null,x,m,_,w)===!1)return!1;continue}switch(c.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(c,x,m,_,w)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<c.geometries.length;o++)if(t(c.geometries[o],x,m,_,w)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}x++}}function TX(n,t,e){var o=e;return Xv(n,function(s,c,h,p,g){c===0&&e===void 0?o=s:o=t(o,s,c,h,p,g)}),o}function $d(n,t){Xv(n,function(e,o,s,c,h){var p=e===null?null:e.type;switch(p){case null:case"Point":case"LineString":case"Polygon":return t(lo.feature(e,s,{bbox:c,id:h}),o,0)===!1?!1:void 0}var g;switch(p){case"MultiPoint":g="Point";break;case"MultiLineString":g="LineString";break;case"MultiPolygon":g="Polygon";break}for(var m=0;m<e.coordinates.length;m++){var _=e.coordinates[m],w={type:g,coordinates:_};if(t(lo.feature(w,s),o,m)===!1)return!1}})}function CX(n,t,e){var o=e;return $d(n,function(s,c,h){c===0&&h===0&&e===void 0?o=s:o=t(o,s,c,h)}),o}function UC(n,t){$d(n,function(e,o,s){var c=0;if(e.geometry){var h=e.geometry.type;if(!(h==="Point"||h==="MultiPoint")){var p,g=0,m=0,_=0;if(lh(e,function(w,x,b,P,I){if(p===void 0||o>g||P>m||I>_){p=w,g=o,m=P,_=I,c=0;return}var S=lo.lineString([p,w],e.properties);if(t(S,o,s,I,c)===!1)return!1;c++,p=w})===!1)return!1}}})}function PX(n,t,e){var o=e,s=!1;return UC(n,function(c,h,p,g,m){s===!1&&e===void 0?o=c:o=t(o,c,h,p,g,m),s=!0}),o}function BC(n,t){if(!n)throw new Error("geojson is required");$d(n,function(e,o,s){if(e.geometry!==null){var c=e.geometry.type,h=e.geometry.coordinates;switch(c){case"LineString":if(t(e,o,s,0,0)===!1)return!1;break;case"Polygon":for(var p=0;p<h.length;p++)if(t(lo.lineString(h[p],e.properties),o,s,p)===!1)return!1;break}}})}function IX(n,t,e){var o=e;return BC(n,function(s,c,h,p){c===0&&e===void 0?o=s:o=t(o,s,c,h,p)}),o}function RX(n,t){if(t=t||{},!lo.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,s=t.geometryIndex||0,c=t.segmentIndex||0,h=t.properties,p;switch(n.type){case"FeatureCollection":e<0&&(e=n.features.length+e),h=h||n.features[e].properties,p=n.features[e].geometry;break;case"Feature":h=h||n.properties,p=n.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":p=n;break;default:throw new Error("geojson is invalid")}if(p===null)return null;var g=p.coordinates;switch(p.type){case"Point":case"MultiPoint":return null;case"LineString":return c<0&&(c=g.length+c-1),lo.lineString([g[c],g[c+1]],h,t);case"Polygon":return s<0&&(s=g.length+s),c<0&&(c=g[s].length+c-1),lo.lineString([g[s][c],g[s][c+1]],h,t);case"MultiLineString":return o<0&&(o=g.length+o),c<0&&(c=g[o].length+c-1),lo.lineString([g[o][c],g[o][c+1]],h,t);case"MultiPolygon":return o<0&&(o=g.length+o),s<0&&(s=g[o].length+s),c<0&&(c=g[o][s].length-c-1),lo.lineString([g[o][s][c],g[o][s][c+1]],h,t)}throw new Error("geojson is invalid")}function LX(n,t){if(t=t||{},!lo.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,s=t.geometryIndex||0,c=t.coordIndex||0,h=t.properties,p;switch(n.type){case"FeatureCollection":e<0&&(e=n.features.length+e),h=h||n.features[e].properties,p=n.features[e].geometry;break;case"Feature":h=h||n.properties,p=n.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":p=n;break;default:throw new Error("geojson is invalid")}if(p===null)return null;var g=p.coordinates;switch(p.type){case"Point":return lo.point(g,h,t);case"MultiPoint":return o<0&&(o=g.length+o),lo.point(g[o],h,t);case"LineString":return c<0&&(c=g.length+c),lo.point(g[c],h,t);case"Polygon":return s<0&&(s=g.length+s),c<0&&(c=g[s].length+c),lo.point(g[s][c],h,t);case"MultiLineString":return o<0&&(o=g.length+o),c<0&&(c=g[o].length+c),lo.point(g[o][c],h,t);case"MultiPolygon":return o<0&&(o=g.length+o),s<0&&(s=g[o].length+s),c<0&&(c=g[o][s].length-c),lo.point(g[o][s][c],h,t)}throw new Error("geojson is invalid")}Ei.coordAll=AX;Ei.coordEach=lh;Ei.coordReduce=SX;Ei.featureEach=FC;Ei.featureReduce=bX;Ei.findPoint=LX;Ei.findSegment=RX;Ei.flattenEach=$d;Ei.flattenReduce=CX;Ei.geomEach=Xv;Ei.geomReduce=TX;Ei.lineEach=BC;Ei.lineReduce=IX;Ei.propEach=DC;Ei.propReduce=MX;Ei.segmentEach=UC;Ei.segmentReduce=PX});var zC=at(Zv=>{"use strict";Object.defineProperty(Zv,"__esModule",{value:!0});var NX=Yv();function $v(n){var t=[1/0,1/0,-1/0,-1/0];return NX.coordEach(n,function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]<e[0]&&(t[2]=e[0]),t[3]<e[1]&&(t[3]=e[1])}),t}$v.default=$v;Zv.default=$v});var Zd=at((Nrt,Jv)=>{var Pa=Ev(),kC=Wv(),qC=Yv(),$c=zC().default,OX=qC.featureEach,Rrt=qC.coordEach,Lrt=kC.polygon,GC=kC.featureCollection;function HC(n){var t=new Pa(n);return t.insert=function(e){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:$c(e),Pa.prototype.insert.call(this,e)},t.load=function(e){var o=[];return Array.isArray(e)?e.forEach(function(s){if(s.type!=="Feature")throw new Error("invalid features");s.bbox=s.bbox?s.bbox:$c(s),o.push(s)}):OX(e,function(s){if(s.type!=="Feature")throw new Error("invalid features");s.bbox=s.bbox?s.bbox:$c(s),o.push(s)}),Pa.prototype.load.call(this,o)},t.remove=function(e,o){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:$c(e),Pa.prototype.remove.call(this,e,o)},t.clear=function(){return Pa.prototype.clear.call(this)},t.search=function(e){var o=Pa.prototype.search.call(this,this.toBBox(e));return GC(o)},t.collides=function(e){return Pa.prototype.collides.call(this,this.toBBox(e))},t.all=function(){var e=Pa.prototype.all.call(this);return GC(e)},t.toJSON=function(){return Pa.prototype.toJSON.call(this)},t.fromJSON=function(e){return Pa.prototype.fromJSON.call(this,e)},t.toBBox=function(e){var o;if(e.bbox)o=e.bbox;else if(Array.isArray(e)&&e.length===4)o=e;else if(Array.isArray(e)&&e.length===6)o=[e[0],e[1],e[3],e[4]];else if(e.type==="Feature")o=$c(e);else if(e.type==="FeatureCollection")o=$c(e);else throw new Error("invalid geojson");return{minX:o[0],minY:o[1],maxX:o[2],maxY:o[3]}},t}Jv.exports=HC;Jv.exports.default=HC});var n_=at((qot,QC)=>{"use strict";var jC=Object.prototype.toString;QC.exports=function(t){var e=jC.call(t),o=e==="[object Arguments]";return o||(o=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&jC.call(t.callee)==="[object Function]"),o}});var uP=at((Hot,aP)=>{"use strict";var sP;Object.keys||(hh=Object.prototype.hasOwnProperty,r_=Object.prototype.toString,tP=n_(),i_=Object.prototype.propertyIsEnumerable,eP=!i_.call({toString:null},"toString"),nP=i_.call(function(){},"prototype"),ph=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],tg=function(n){var t=n.constructor;return t&&t.prototype===n},rP={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},iP=function(){if(typeof window=="undefined")return!1;for(var n in window)try{if(!rP["$"+n]&&hh.call(window,n)&&window[n]!==null&&typeof window[n]=="object")try{tg(window[n])}catch(t){return!0}}catch(t){return!0}return!1}(),oP=function(n){if(typeof window=="undefined"||!iP)return tg(n);try{return tg(n)}catch(t){return!1}},sP=function(t){var e=t!==null&&typeof t=="object",o=r_.call(t)==="[object Function]",s=tP(t),c=e&&r_.call(t)==="[object String]",h=[];if(!e&&!o&&!s)throw new TypeError("Object.keys called on a non-object");var p=nP&&o;if(c&&t.length>0&&!hh.call(t,0))for(var g=0;g<t.length;++g)h.push(String(g));if(s&&t.length>0)for(var m=0;m<t.length;++m)h.push(String(m));else for(var _ in t)!(p&&_==="prototype")&&hh.call(t,_)&&h.push(String(_));if(eP)for(var w=oP(t),x=0;x<ph.length;++x)!(w&&ph[x]==="constructor")&&hh.call(t,ph[x])&&h.push(ph[x]);return h});var hh,r_,tP,i_,eP,nP,ph,tg,rP,iP,oP;aP.exports=sP});var o_=at((Vot,fP)=>{"use strict";var VX=Array.prototype.slice,WX=n_(),lP=Object.keys,eg=lP?function(t){return lP(t)}:uP(),cP=Object.keys;eg.shim=function(){if(Object.keys){var t=function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2);t||(Object.keys=function(o){return WX(o)?cP(VX.call(o)):cP(o)})}else Object.keys=eg;return Object.keys||eg};fP.exports=eg});var s_=at((Wot,hP)=>{"use strict";hP.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),o=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(o)!=="[object Symbol]")return!1;var s=42;t[e]=s;for(e in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var c=Object.getOwnPropertySymbols(t);if(c.length!==1||c[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var h=Object.getOwnPropertyDescriptor(t,e);if(h.value!==s||h.enumerable!==!0)return!1}return!0}});var ng=at((Xot,pP)=>{"use strict";var XX=s_();pP.exports=function(){return XX()&&!!Symbol.toStringTag}});var gP=at((Yot,dP)=>{"use strict";dP.exports=Error});var yP=at(($ot,mP)=>{"use strict";mP.exports=EvalError});var _P=at((Zot,vP)=>{"use strict";vP.exports=RangeError});var EP=at((Jot,xP)=>{"use strict";xP.exports=ReferenceError});var a_=at((Kot,wP)=>{"use strict";wP.exports=SyntaxError});var Fl=at((jot,SP)=>{"use strict";SP.exports=TypeError});var bP=at((Qot,MP)=>{"use strict";MP.exports=URIError});var CP=at((tst,TP)=>{"use strict";var AP=typeof Symbol!="undefined"&&Symbol,YX=s_();TP.exports=function(){return typeof AP!="function"||typeof Symbol!="function"||typeof AP("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:YX()}});var IP=at((est,PP)=>{"use strict";var u_={__proto__:null,foo:{}},$X=Object;PP.exports=function(){return{__proto__:u_}.foo===u_.foo&&!(u_ instanceof $X)}});var NP=at((nst,LP)=>{"use strict";var ZX="Function.prototype.bind called on incompatible ",JX=Object.prototype.toString,KX=Math.max,jX="[object Function]",RP=function(t,e){for(var o=[],s=0;s<t.length;s+=1)o[s]=t[s];for(var c=0;c<e.length;c+=1)o[c+t.length]=e[c];return o},QX=function(t,e){for(var o=[],s=e||0,c=0;s<t.length;s+=1,c+=1)o[c]=t[s];return o},t7=function(n,t){for(var e="",o=0;o<n.length;o+=1)e+=n[o],o+1<n.length&&(e+=t);return e};LP.exports=function(t){var e=this;if(typeof e!="function"||JX.apply(e)!==jX)throw new TypeError(ZX+e);for(var o=QX(arguments,1),s,c=function(){if(this instanceof s){var _=e.apply(this,RP(o,arguments));return Object(_)===_?_:this}return e.apply(t,RP(o,arguments))},h=KX(0,e.length-o.length),p=[],g=0;g<h;g++)p[g]="$"+g;if(s=Function("binder","return function ("+t7(p,",")+"){ return binder.apply(this,arguments); }")(c),e.prototype){var m=function(){};m.prototype=e.prototype,s.prototype=new m,m.prototype=null}return s}});var rg=at((rst,OP)=>{"use strict";var e7=NP();OP.exports=Function.prototype.bind||e7});var FP=at((ist,DP)=>{"use strict";var n7=Function.prototype.call,r7=Object.prototype.hasOwnProperty,i7=rg();DP.exports=i7.call(n7,r7)});var Qc=at((ost,kP)=>{"use strict";var Vn,o7=gP(),s7=yP(),a7=_P(),u7=EP(),jc=a_(),Kc=Fl(),l7=bP(),GP=Function,l_=function(n){try{return GP('"use strict"; return ('+n+").constructor;")()}catch(t){}},Ul=Object.getOwnPropertyDescriptor;if(Ul)try{Ul({},"")}catch(n){Ul=null}var c_=function(){throw new Kc},c7=Ul?function(){try{return arguments.callee,c_}catch(n){try{return Ul(arguments,"callee").get}catch(t){return c_}}}():c_,Zc=CP()(),f7=IP()(),ki=Object.getPrototypeOf||(f7?function(n){return n.__proto__}:null),Jc={},h7=typeof Uint8Array=="undefined"||!ki?Vn:ki(Uint8Array),Bl={__proto__:null,"%AggregateError%":typeof AggregateError=="undefined"?Vn:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?Vn:ArrayBuffer,"%ArrayIteratorPrototype%":Zc&&ki?ki([][Symbol.iterator]()):Vn,"%AsyncFromSyncIteratorPrototype%":Vn,"%AsyncFunction%":Jc,"%AsyncGenerator%":Jc,"%AsyncGeneratorFunction%":Jc,"%AsyncIteratorPrototype%":Jc,"%Atomics%":typeof Atomics=="undefined"?Vn:Atomics,"%BigInt%":typeof BigInt=="undefined"?Vn:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?Vn:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?Vn:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?Vn:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":o7,"%eval%":eval,"%EvalError%":s7,"%Float32Array%":typeof Float32Array=="undefined"?Vn:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?Vn:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?Vn:FinalizationRegistry,"%Function%":GP,"%GeneratorFunction%":Jc,"%Int8Array%":typeof Int8Array=="undefined"?Vn:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?Vn:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?Vn:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Zc&&ki?ki(ki([][Symbol.iterator]())):Vn,"%JSON%":typeof JSON=="object"?JSON:Vn,"%Map%":typeof Map=="undefined"?Vn:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!Zc||!ki?Vn:ki(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?Vn:Promise,"%Proxy%":typeof Proxy=="undefined"?Vn:Proxy,"%RangeError%":a7,"%ReferenceError%":u7,"%Reflect%":typeof Reflect=="undefined"?Vn:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?Vn:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!Zc||!ki?Vn:ki(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?Vn:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Zc&&ki?ki(""[Symbol.iterator]()):Vn,"%Symbol%":Zc?Symbol:Vn,"%SyntaxError%":jc,"%ThrowTypeError%":c7,"%TypedArray%":h7,"%TypeError%":Kc,"%Uint8Array%":typeof Uint8Array=="undefined"?Vn:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?Vn:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?Vn:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?Vn:Uint32Array,"%URIError%":l7,"%WeakMap%":typeof WeakMap=="undefined"?Vn:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?Vn:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?Vn:WeakSet};if(ki)try{null.error}catch(n){UP=ki(ki(n)),Bl["%Error.prototype%"]=UP}var UP,p7=function n(t){var e;if(t==="%AsyncFunction%")e=l_("async function () {}");else if(t==="%GeneratorFunction%")e=l_("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=l_("async function* () {}");else if(t==="%AsyncGenerator%"){var o=n("%AsyncGeneratorFunction%");o&&(e=o.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=n("%AsyncGenerator%");s&&ki&&(e=ki(s.prototype))}return Bl[t]=e,e},BP={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},dh=rg(),ig=FP(),d7=dh.call(Function.call,Array.prototype.concat),g7=dh.call(Function.apply,Array.prototype.splice),zP=dh.call(Function.call,String.prototype.replace),og=dh.call(Function.call,String.prototype.slice),m7=dh.call(Function.call,RegExp.prototype.exec),y7=/[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g,v7=/\\\\(\\\\)?/g,_7=function(t){var e=og(t,0,1),o=og(t,-1);if(e==="%"&&o!=="%")throw new jc("invalid intrinsic syntax, expected closing \`%\`");if(o==="%"&&e!=="%")throw new jc("invalid intrinsic syntax, expected opening \`%\`");var s=[];return zP(t,y7,function(c,h,p,g){s[s.length]=p?zP(g,v7,"$1"):h||c}),s},x7=function(t,e){var o=t,s;if(ig(BP,o)&&(s=BP[o],o="%"+s[0]+"%"),ig(Bl,o)){var c=Bl[o];if(c===Jc&&(c=p7(o)),typeof c=="undefined"&&!e)throw new Kc("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:o,value:c}}throw new jc("intrinsic "+t+" does not exist!")};kP.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new Kc("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new Kc('"allowMissing" argument must be a boolean');if(m7(/^%?[^%]*%?$/,t)===null)throw new jc("\`%\` may not be present anywhere but at the beginning and end of the intrinsic name");var o=_7(t),s=o.length>0?o[0]:"",c=x7("%"+s+"%",e),h=c.name,p=c.value,g=!1,m=c.alias;m&&(s=m[0],g7(o,d7([0,1],m)));for(var _=1,w=!0;_<o.length;_+=1){var x=o[_],b=og(x,0,1),P=og(x,-1);if((b==='"'||b==="'"||b==="\`"||P==='"'||P==="'"||P==="\`")&&b!==P)throw new jc("property names with quotes must have matching quotes");if((x==="constructor"||!w)&&(g=!0),s+="."+x,h="%"+s+"%",ig(Bl,h))p=Bl[h];else if(p!=null){if(!(x in p)){if(!e)throw new Kc("base intrinsic for "+t+" exists, but the property is not available.");return}if(Ul&&_+1>=o.length){var I=Ul(p,x);w=!!I,w&&"get"in I&&!("originalValue"in I.get)?p=I.get:p=p[x]}else w=ig(p,x),p=p[x];w&&!g&&(Bl[h]=p)}}return p}});var ag=at((sst,qP)=>{"use strict";var E7=Qc(),sg=E7("%Object.defineProperty%",!0)||!1;if(sg)try{sg({},"a",{value:1})}catch(n){sg=!1}qP.exports=sg});var f_=at((ast,HP)=>{"use strict";var w7=Qc(),ug=w7("%Object.getOwnPropertyDescriptor%",!0);if(ug)try{ug([],"length")}catch(n){ug=null}HP.exports=ug});var lg=at((ust,XP)=>{"use strict";var VP=ag(),S7=a_(),tf=Fl(),WP=f_();XP.exports=function(t,e,o){if(!t||typeof t!="object"&&typeof t!="function")throw new tf("\`obj\` must be an object or a function\`");if(typeof e!="string"&&typeof e!="symbol")throw new tf("\`property\` must be a string or a symbol\`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new tf("\`nonEnumerable\`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new tf("\`nonWritable\`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new tf("\`nonConfigurable\`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new tf("\`loose\`, if provided, must be a boolean");var s=arguments.length>3?arguments[3]:null,c=arguments.length>4?arguments[4]:null,h=arguments.length>5?arguments[5]:null,p=arguments.length>6?arguments[6]:!1,g=!!WP&&WP(t,e);if(VP)VP(t,e,{configurable:h===null&&g?g.configurable:!h,enumerable:s===null&&g?g.enumerable:!s,value:o,writable:c===null&&g?g.writable:!c});else if(p||!s&&!c&&!h)t[e]=o;else throw new S7("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var cg=at((lst,$P)=>{"use strict";var h_=ag(),YP=function(){return!!h_};YP.hasArrayLengthDefineBug=function(){if(!h_)return null;try{return h_([],"length",{value:1}).length!==1}catch(t){return!0}};$P.exports=YP});var QP=at((cst,jP)=>{"use strict";var M7=Qc(),ZP=lg(),b7=cg()(),JP=f_(),KP=Fl(),A7=M7("%Math.floor%");jP.exports=function(t,e){if(typeof t!="function")throw new KP("\`fn\` is not a function");if(typeof e!="number"||e<0||e>4294967295||A7(e)!==e)throw new KP("\`length\` must be a positive 32-bit integer");var o=arguments.length>2&&!!arguments[2],s=!0,c=!0;if("length"in t&&JP){var h=JP(t,"length");h&&!h.configurable&&(s=!1),h&&!h.writable&&(c=!1)}return(s||c||!o)&&(b7?ZP(t,"length",e,!0,!0):ZP(t,"length",e)),t}});var pg=at((fst,fg)=>{"use strict";var p_=rg(),hg=Qc(),T7=QP(),C7=Fl(),nI=hg("%Function.prototype.apply%"),rI=hg("%Function.prototype.call%"),iI=hg("%Reflect.apply%",!0)||p_.call(rI,nI),tI=ag(),P7=hg("%Math.max%");fg.exports=function(t){if(typeof t!="function")throw new C7("a function is required");var e=iI(p_,rI,arguments);return T7(e,1+P7(0,t.length-(arguments.length-1)),!0)};var eI=function(){return iI(p_,nI,arguments)};tI?tI(fg.exports,"apply",{value:eI}):fg.exports.apply=eI});var d_=at((hst,aI)=>{"use strict";var oI=Qc(),sI=pg(),I7=sI(oI("String.prototype.indexOf"));aI.exports=function(t,e){var o=oI(t,!!e);return typeof o=="function"&&I7(t,".prototype.")>-1?sI(o):o}});var cI=at((pst,lI)=>{"use strict";var R7=ng()(),L7=d_(),g_=L7("Object.prototype.toString"),dg=function(t){return R7&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:g_(t)==="[object Arguments]"},uI=function(t){return dg(t)?!0:t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&g_(t)!=="[object Array]"&&g_(t.callee)==="[object Function]"},N7=function(){return dg(arguments)}();dg.isLegacyArguments=uI;lI.exports=N7?dg:uI});var ef=at((dst,dI)=>{"use strict";var O7=o_(),D7=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",F7=Object.prototype.toString,U7=Array.prototype.concat,fI=lg(),B7=function(n){return typeof n=="function"&&F7.call(n)==="[object Function]"},hI=cg()(),z7=function(n,t,e,o){if(t in n){if(o===!0){if(n[t]===e)return}else if(!B7(o)||!o())return}hI?fI(n,t,e,!0):fI(n,t,e)},pI=function(n,t){var e=arguments.length>2?arguments[2]:{},o=O7(t);D7&&(o=U7.call(o,Object.getOwnPropertySymbols(t)));for(var s=0;s<o.length;s+=1)z7(n,o[s],t[o[s]],e[o[s]])};pI.supportsDescriptors=!!hI;dI.exports=pI});var m_=at((gst,mI)=>{"use strict";var gI=function(n){return n!==n};mI.exports=function(t,e){return t===0&&e===0?1/t===1/e:!!(t===e||gI(t)&&gI(e))}});var y_=at((mst,yI)=>{"use strict";var G7=m_();yI.exports=function(){return typeof Object.is=="function"?Object.is:G7}});var _I=at((yst,vI)=>{"use strict";var k7=y_(),q7=ef();vI.exports=function(){var t=k7();return q7(Object,{is:t},{is:function(){return Object.is!==t}}),t}});var SI=at((vst,wI)=>{"use strict";var H7=ef(),V7=pg(),W7=m_(),xI=y_(),X7=_I(),EI=V7(xI(),Object);H7(EI,{getPolyfill:xI,implementation:W7,shim:X7});wI.exports=EI});var CI=at((_st,TI)=>{"use strict";var v_=d_(),MI=ng()(),bI,AI,__,x_;MI&&(bI=v_("Object.prototype.hasOwnProperty"),AI=v_("RegExp.prototype.exec"),__={},gg=function(){throw __},x_={toString:gg,valueOf:gg},typeof Symbol.toPrimitive=="symbol"&&(x_[Symbol.toPrimitive]=gg));var gg,Y7=v_("Object.prototype.toString"),$7=Object.getOwnPropertyDescriptor,Z7="[object RegExp]";TI.exports=MI?function(t){if(!t||typeof t!="object")return!1;var e=$7(t,"lastIndex"),o=e&&bI(e,"value");if(!o)return!1;try{AI(t,x_)}catch(s){return s===__}}:function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:Y7(t)===Z7}});var II=at((xst,PI)=>{"use strict";var mh=function(){return typeof function(){}.name=="string"},gh=Object.getOwnPropertyDescriptor;if(gh)try{gh([],"length")}catch(n){gh=null}mh.functionsHaveConfigurableNames=function(){if(!mh()||!gh)return!1;var t=gh(function(){},"name");return!!t&&!!t.configurable};var J7=Function.prototype.bind;mh.boundFunctionsHaveNames=function(){return mh()&&typeof J7=="function"&&function(){}.bind().name!==""};PI.exports=mh});var NI=at((Est,LI)=>{"use strict";var RI=lg(),K7=cg()(),j7=II().functionsHaveConfigurableNames(),Q7=Fl();LI.exports=function(t,e){if(typeof t!="function")throw new Q7("\`fn\` is not a function");var o=arguments.length>2&&!!arguments[2];return(!o||j7)&&(K7?RI(t,"name",e,!0,!0):RI(t,"name",e)),t}});var E_=at((wst,OI)=>{"use strict";var tY=NI(),eY=Fl(),nY=Object;OI.exports=tY(function(){if(this==null||this!==nY(this))throw new eY("RegExp.prototype.flags getter called on non-object");var t="";return this.hasIndices&&(t+="d"),this.global&&(t+="g"),this.ignoreCase&&(t+="i"),this.multiline&&(t+="m"),this.dotAll&&(t+="s"),this.unicode&&(t+="u"),this.unicodeSets&&(t+="v"),this.sticky&&(t+="y"),t},"get flags",!0)});var w_=at((Sst,DI)=>{"use strict";var rY=E_(),iY=ef().supportsDescriptors,oY=Object.getOwnPropertyDescriptor;DI.exports=function(){if(iY&&/a/mig.flags==="gim"){var t=oY(RegExp.prototype,"flags");if(t&&typeof t.get=="function"&&"dotAll"in RegExp.prototype&&"hasIndices"in RegExp.prototype){var e="",o={};if(Object.defineProperty(o,"hasIndices",{get:function(){e+="d"}}),Object.defineProperty(o,"sticky",{get:function(){e+="y"}}),t.get.call(o),e==="dy")return t.get}}return rY}});var BI=at((Mst,UI)=>{"use strict";var sY=ef().supportsDescriptors,aY=w_(),uY=Object.getOwnPropertyDescriptor,lY=Object.defineProperty,cY=TypeError,FI=Object.getPrototypeOf,fY=/a/;UI.exports=function(){if(!sY||!FI)throw new cY("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=aY(),e=FI(fY),o=uY(e,"flags");return(!o||o.get!==t)&&lY(e,"flags",{configurable:!0,enumerable:!1,get:t}),t}});var qI=at((bst,kI)=>{"use strict";var hY=ef(),pY=pg(),dY=E_(),zI=w_(),gY=BI(),GI=pY(zI());hY(GI,{getPolyfill:zI,implementation:dY,shim:gY});kI.exports=GI});var VI=at((Ast,HI)=>{"use strict";var mY=Date.prototype.getDay,yY=function(t){try{return mY.call(t),!0}catch(e){return!1}},vY=Object.prototype.toString,_Y="[object Date]",xY=ng()();HI.exports=function(t){return typeof t!="object"||t===null?!1:xY?yY(t):vY.call(t)===_Y}});var S_=at((Tst,eR)=>{var WI=o_(),XI=cI(),YI=SI(),$I=CI(),ZI=qI(),JI=VI(),KI=Date.prototype.getTime;function tR(n,t,e){var o=e||{};return(o.strict?YI(n,t):n===t)?!0:!n||!t||typeof n!="object"&&typeof t!="object"?o.strict?YI(n,t):n==t:EY(n,t,o)}function jI(n){return n==null}function QI(n){return!(!n||typeof n!="object"||typeof n.length!="number"||typeof n.copy!="function"||typeof n.slice!="function"||n.length>0&&typeof n[0]!="number")}function EY(n,t,e){var o,s;if(typeof n!=typeof t||jI(n)||jI(t)||n.prototype!==t.prototype||XI(n)!==XI(t))return!1;var c=$I(n),h=$I(t);if(c!==h)return!1;if(c||h)return n.source===t.source&&ZI(n)===ZI(t);if(JI(n)&&JI(t))return KI.call(n)===KI.call(t);var p=QI(n),g=QI(t);if(p!==g)return!1;if(p||g){if(n.length!==t.length)return!1;for(o=0;o<n.length;o++)if(n[o]!==t[o])return!1;return!0}if(typeof n!=typeof t)return!1;try{var m=WI(n),_=WI(t)}catch(w){return!1}if(m.length!==_.length)return!1;for(m.sort(),_.sort(),o=m.length-1;o>=0;o--)if(m[o]!=_[o])return!1;for(o=m.length-1;o>=0;o--)if(s=m[o],!tR(n[s],t[s],e))return!1;return!0}eR.exports=tR});var D_=at((Nut,uR)=>{var f$=S_(),Ia=function(n){this.precision=n&&n.precision?n.precision:17,this.direction=n&&n.direction?n.direction:!1,this.pseudoNode=n&&n.pseudoNode?n.pseudoNode:!1,this.objectComparator=n&&n.objectComparator?n.objectComparator:h$};Ia.prototype.compare=function(n,t){if(n.type!==t.type||!aR(n,t))return!1;switch(n.type){case"Point":return this.compareCoord(n.coordinates,t.coordinates);case"LineString":return this.compareLine(n.coordinates,t.coordinates,0,!1);case"Polygon":return this.comparePolygon(n,t);case"Feature":return this.compareFeature(n,t);default:if(n.type.indexOf("Multi")===0){var e=this,o=sR(n),s=sR(t);return o.every(function(c){return this.some(function(h){return e.compare(c,h)})},s)}}return!1};function sR(n){return n.coordinates.map(function(t){return{type:n.type.replace("Multi",""),coordinates:t}})}function aR(n,t){return n.hasOwnProperty("coordinates")?n.coordinates.length===t.coordinates.length:n.length===t.length}Ia.prototype.compareCoord=function(n,t){if(n.length!==t.length)return!1;for(var e=0;e<n.length;e++)if(n[e].toFixed(this.precision)!==t[e].toFixed(this.precision))return!1;return!0};Ia.prototype.compareLine=function(n,t,e,o){if(!aR(n,t))return!1;var s=this.pseudoNode?n:this.removePseudo(n),c=this.pseudoNode?t:this.removePseudo(t);if(!(o&&!this.compareCoord(s[0],c[0])&&(c=this.fixStartIndex(c,s),!c))){var h=this.compareCoord(s[e],c[e]);return this.direction||h?this.comparePath(s,c):this.compareCoord(s[e],c[c.length-(1+e)])?this.comparePath(s.slice().reverse(),c):!1}};Ia.prototype.fixStartIndex=function(n,t){for(var e,o=-1,s=0;s<n.length;s++)if(this.compareCoord(n[s],t[0])){o=s;break}return o>=0&&(e=[].concat(n.slice(o,n.length),n.slice(1,o+1))),e};Ia.prototype.comparePath=function(n,t){var e=this;return n.every(function(o,s){return e.compareCoord(o,this[s])},t)};Ia.prototype.comparePolygon=function(n,t){if(this.compareLine(n.coordinates[0],t.coordinates[0],1,!0)){var e=n.coordinates.slice(1,n.coordinates.length),o=t.coordinates.slice(1,t.coordinates.length),s=this;return e.every(function(c){return this.some(function(h){return s.compareLine(c,h,1,!0)})},o)}else return!1};Ia.prototype.compareFeature=function(n,t){return n.id!==t.id||!this.objectComparator(n.properties,t.properties)||!this.compareBBox(n,t)?!1:this.compare(n.geometry,t.geometry)};Ia.prototype.compareBBox=function(n,t){return!!(!n.bbox&&!t.bbox||n.bbox&&t.bbox&&this.compareCoord(n.bbox,t.bbox))};Ia.prototype.removePseudo=function(n){return n};function h$(n,t){return f$(n,t,{strict:!0})}uR.exports=Ia});var lR=at((Wut,vg)=>{function ju(n,t,e,o){this.dataset=[],this.epsilon=1,this.minPts=2,this.distance=this._euclideanDistance,this.clusters=[],this.noise=[],this._visited=[],this._assigned=[],this._datasetLength=0,this._init(n,t,e,o)}ju.prototype.run=function(n,t,e,o){this._init(n,t,e,o);for(var s=0;s<this._datasetLength;s++)if(this._visited[s]!==1){this._visited[s]=1;var c=this._regionQuery(s);if(c.length<this.minPts)this.noise.push(s);else{var h=this.clusters.length;this.clusters.push([]),this._addToCluster(s,h),this._expandCluster(h,c)}}return this.clusters};ju.prototype._init=function(n,t,e,o){if(n){if(!(n instanceof Array))throw Error("Dataset must be of type array, "+typeof n+" given");this.dataset=n,this.clusters=[],this.noise=[],this._datasetLength=n.length,this._visited=new Array(this._datasetLength),this._assigned=new Array(this._datasetLength)}t&&(this.epsilon=t),e&&(this.minPts=e),o&&(this.distance=o)};ju.prototype._expandCluster=function(n,t){for(var e=0;e<t.length;e++){var o=t[e];if(this._visited[o]!==1){this._visited[o]=1;var s=this._regionQuery(o);s.length>=this.minPts&&(t=this._mergeArrays(t,s))}this._assigned[o]!==1&&this._addToCluster(o,n)}};ju.prototype._addToCluster=function(n,t){this.clusters[t].push(n),this._assigned[n]=1};ju.prototype._regionQuery=function(n){for(var t=[],e=0;e<this._datasetLength;e++){var o=this.distance(this.dataset[n],this.dataset[e]);o<this.epsilon&&t.push(e)}return t};ju.prototype._mergeArrays=function(n,t){for(var e=t.length,o=0;o<e;o++){var s=t[o];n.indexOf(s)<0&&n.push(s)}return n};ju.prototype._euclideanDistance=function(n,t){for(var e=0,o=Math.min(n.length,t.length);o--;)e+=(n[o]-t[o])*(n[o]-t[o]);return Math.sqrt(e)};typeof vg!="undefined"&&vg.exports&&(vg.exports=ju)});var cR=at((Xut,_g)=>{function Qu(n,t,e){this.k=3,this.dataset=[],this.assignments=[],this.centroids=[],this.init(n,t,e)}Qu.prototype.init=function(n,t,e){this.assignments=[],this.centroids=[],typeof n!="undefined"&&(this.dataset=n),typeof t!="undefined"&&(this.k=t),typeof e!="undefined"&&(this.distance=e)};Qu.prototype.run=function(n,t){this.init(n,t);for(var e=this.dataset.length,o=0;o<this.k;o++)this.centroids[o]=this.randomCentroid();for(var s=!0;s;){s=this.assign();for(var c=0;c<this.k;c++){for(var h=new Array(_),p=0,g=0;g<_;g++)h[g]=0;for(var m=0;m<e;m++){var _=this.dataset[m].length;if(c===this.assignments[m]){for(var g=0;g<_;g++)h[g]+=this.dataset[m][g];p++}}if(p>0){for(var g=0;g<_;g++)h[g]/=p;this.centroids[c]=h}else this.centroids[c]=this.randomCentroid(),s=!0}}return this.getClusters()};Qu.prototype.randomCentroid=function(){var n=this.dataset.length-1,t,e;do e=Math.round(Math.random()*n),t=this.dataset[e];while(this.centroids.indexOf(t)>=0);return t};Qu.prototype.assign=function(){for(var n=!1,t=this.dataset.length,e,o=0;o<t;o++)e=this.argmin(this.dataset[o],this.centroids,this.distance),e!=this.assignments[o]&&(this.assignments[o]=e,n=!0);return n};Qu.prototype.getClusters=function(){for(var n=new Array(this.k),t,e=0;e<this.assignments.length;e++)t=this.assignments[e],typeof n[t]=="undefined"&&(n[t]=[]),n[t].push(e);return n};Qu.prototype.argmin=function(n,t,e){for(var o=Number.MAX_VALUE,s=0,c=t.length,h,p=0;p<c;p++)h=e(n,t[p]),h<o&&(o=h,s=p);return s};Qu.prototype.distance=function(n,t){for(var e=0,o=Math.min(n.length,t.length);o--;){var s=n[o]-t[o];e+=s*s}return Math.sqrt(e)};typeof _g!="undefined"&&_g.exports&&(_g.exports=Qu)});var F_=at((Yut,xg)=>{function Ra(n,t,e){this._queue=[],this._priorities=[],this._sorting="desc",this._init(n,t,e)}Ra.prototype.insert=function(n,t){for(var e=this._queue.length,o=e;o--;){var s=this._priorities[o];this._sorting==="desc"?t>s&&(e=o):t<s&&(e=o)}this._insertAt(n,t,e)};Ra.prototype.remove=function(n){for(var t=this._queue.length;t--;){var e=this._queue[t];if(n===e){this._queue.splice(t,1),this._priorities.splice(t,1);break}}};Ra.prototype.forEach=function(n){this._queue.forEach(n)};Ra.prototype.getElements=function(){return this._queue};Ra.prototype.getElementPriority=function(n){return this._priorities[n]};Ra.prototype.getPriorities=function(){return this._priorities};Ra.prototype.getElementsWithPriorities=function(){for(var n=[],t=0,e=this._queue.length;t<e;t++)n.push([this._queue[t],this._priorities[t]]);return n};Ra.prototype._init=function(n,t,e){if(n&&t){if(this._queue=[],this._priorities=[],n.length!==t.length)throw new Error("Arrays must have the same length");for(var o=0;o<n.length;o++)this.insert(n[o],t[o])}e&&(this._sorting=e)};Ra.prototype._insertAt=function(n,t,e){this._queue.length===e?(this._queue.push(n),this._priorities.push(t)):(this._queue.splice(e,0,n),this._priorities.splice(e,0,t))};typeof xg!="undefined"&&xg.exports&&(xg.exports=Ra)});var hR=at(($ut,rf)=>{typeof rf!="undefined"&&rf.exports&&(fR=F_());var fR;function hu(n,t,e,o){this.epsilon=1,this.minPts=1,this.distance=this._euclideanDistance,this._reachability=[],this._processed=[],this._coreDistance=0,this._orderedList=[],this._init(n,t,e,o)}hu.prototype.run=function(n,t,e,o){this._init(n,t,e,o);for(var s=0,c=this.dataset.length;s<c;s++)if(this._processed[s]!==1){this._processed[s]=1,this.clusters.push([s]);var h=this.clusters.length-1;this._orderedList.push(s);var p=new fR(null,null,"asc"),g=this._regionQuery(s);this._distanceToCore(s)!==void 0&&(this._updateQueue(s,g,p),this._expandCluster(h,p))}return this.clusters};hu.prototype.getReachabilityPlot=function(){for(var n=[],t=0,e=this._orderedList.length;t<e;t++){var o=this._orderedList[t],s=this._reachability[o];n.push([o,s])}return n};hu.prototype._init=function(n,t,e,o){if(n){if(!(n instanceof Array))throw Error("Dataset must be of type array, "+typeof n+" given");this.dataset=n,this.clusters=[],this._reachability=new Array(this.dataset.length),this._processed=new Array(this.dataset.length),this._coreDistance=0,this._orderedList=[]}t&&(this.epsilon=t),e&&(this.minPts=e),o&&(this.distance=o)};hu.prototype._updateQueue=function(n,t,e){var o=this;this._coreDistance=this._distanceToCore(n),t.forEach(function(s){if(o._processed[s]===void 0){var c=o.distance(o.dataset[n],o.dataset[s]),h=Math.max(o._coreDistance,c);o._reachability[s]===void 0?(o._reachability[s]=h,e.insert(s,h)):h<o._reachability[s]&&(o._reachability[s]=h,e.remove(s),e.insert(s,h))}})};hu.prototype._expandCluster=function(n,t){for(var e=t.getElements(),o=0,s=e.length;o<s;o++){var c=e[o];if(this._processed[c]===void 0){var h=this._regionQuery(c);this._processed[c]=1,this.clusters[n].push(c),this._orderedList.push(c),this._distanceToCore(c)!==void 0&&(this._updateQueue(c,h,t),this._expandCluster(n,t))}}};hu.prototype._distanceToCore=function(n){for(var t=this.epsilon,e=0;e<t;e++){var o=this._regionQuery(n,e);if(o.length>=this.minPts)return e}};hu.prototype._regionQuery=function(n,t){t=t||this.epsilon;for(var e=[],o=0,s=this.dataset.length;o<s;o++)this.distance(this.dataset[n],this.dataset[o])<t&&e.push(o);return e};hu.prototype._euclideanDistance=function(n,t){for(var e=0,o=Math.min(n.length,t.length);o--;)e+=(n[o]-t[o])*(n[o]-t[o]);return Math.sqrt(e)};typeof rf!="undefined"&&rf.exports&&(rf.exports=hu)});var pR=at((Zut,Eg)=>{typeof Eg!="undefined"&&Eg.exports&&(Eg.exports={DBSCAN:lR(),KMEANS:cR(),OPTICS:hR(),PriorityQueue:F_()})});var U_=at((elt,gR)=>{"use strict";gR.exports={eudist:function(t,e,o){for(var s=t.length,c=0,h=0;h<s;h++){var p=(t[h]||0)-(e[h]||0);c+=p*p}return o?Math.sqrt(c):c},mandist:function(t,e,o){for(var s=t.length,c=0,h=0;h<s;h++)c+=Math.abs((t[h]||0)-(e[h]||0));return o?Math.sqrt(c):c},dist:function(t,e,o){var s=Math.abs(t-e);return o?s:s*s}}});var vR=at((nlt,yR)=>{"use strict";var mR=U_(),v$=mR.eudist,_$=mR.dist;yR.exports={kmrand:function(t,e){for(var o={},s=[],c=e<<2,h=t.length,p=t[0].length>0;s.length<e&&c-- >0;){var g=t[Math.floor(Math.random()*h)],m=p?g.join("_"):""+g;o[m]||(o[m]=!0,s.push(g))}if(s.length<e)throw new Error("Error initializating clusters");return s},kmpp:function(t,e){var o=t[0].length?v$:_$,s=[],c=t.length,h=t[0].length>0,p={},g=t[Math.floor(Math.random()*c)],m=h?g.join("_"):""+g;for(s.push(g),p[m]=!0;s.length<e;){for(var _=[],w=s.length,x=0,b=[],P=0;P<c;P++){for(var I=1/0,S=0;S<w;S++){var E=o(t[P],s[S]);E<=I&&(I=E)}_[P]=I}for(var R=0;R<c;R++)x+=_[R];for(var T=0;T<c;T++)b[T]={i:T,v:t[T],pr:_[T]/x,cs:0};b.sort(function(q,D){return q.pr-D.pr}),b[0].cs=b[0].pr;for(var F=1;F<c;F++)b[F].cs=b[F-1].cs+b[F].pr;for(var W=Math.random(),X=0;X<c-1&&b[X++].cs<W;);s.push(b[X-1].v)}return s}}});var SR=at((olt,wR)=>{"use strict";var B_=U_(),ER=vR(),x$=B_.eudist,rlt=B_.mandist,ilt=B_.dist,E$=ER.kmrand,w$=ER.kmpp,_R=1e4;function xR(n,t,e){e=e||[];for(var o=0;o<n;o++)e[o]=t;return e}function S$(n,t,e,o){var s=[],c=[],h=[],p=[],g=!1,m=o||_R,_=n.length,w=n[0].length,x=w>0,b=[];if(e)e=="kmrand"?s=E$(n,t):e=="kmpp"?s=w$(n,t):s=e;else for(var P={};s.length<t;){var I=Math.floor(Math.random()*_);P[I]||(P[I]=!0,s.push(n[I]))}do{xR(t,0,b);for(var S=0;S<_;S++){for(var E=1/0,R=0,T=0;T<t;T++){var p=x?x$(n[S],s[T]):Math.abs(n[S]-s[T]);p<=E&&(E=p,R=T)}h[S]=R,b[R]++}for(var F=[],c=[],W=0,X=0;X<t;X++)F[X]=x?xR(w,0,F[X]):0,c[X]=s[X];if(x){for(var q=0;q<t;q++)s[q]=[];for(var D=0;D<_;D++)for(var xt=h[D],B=F[xt],j=n[D],J=0;J<w;J++)B[J]+=j[J];g=!0;for(var Dt=0;Dt<t;Dt++){for(var Q=s[Dt],At=F[Dt],Mt=c[Dt],Rt=b[Dt],pt=0;pt<w;pt++)Q[pt]=At[pt]/Rt||0;if(g){for(var yt=0;yt<w;yt++)if(Mt[yt]!=Q[yt]){g=!1;break}}}}else{for(var K=0;K<_;K++){var Bt=h[K];F[Bt]+=n[K]}for(var Gt=0;Gt<t;Gt++)s[Gt]=F[Gt]/b[Gt]||0;g=!0;for(var ae=0;ae<t;ae++)if(c[ae]!=s[ae]){g=!1;break}}g=g||--m<=0}while(!g);return{it:_R-m,k:t,idxs:h,centroids:s}}wR.exports=S$});var lf=at((V_,W_)=>{(function(n,t){typeof V_=="object"&&typeof W_!="undefined"?W_.exports=t():typeof define=="function"&&define.amd?define(t):(n=typeof globalThis!="undefined"?globalThis:n||self,n.polygonClipping=t())})(V_,function(){"use strict";function n(rt,C){var N={label:0,sent:function(){if(V[0]&1)throw V[1];return V[1]},trys:[],ops:[]},k,$,V,ht;return ht={next:st(0),throw:st(1),return:st(2)},typeof Symbol=="function"&&(ht[Symbol.iterator]=function(){return this}),ht;function st(Et){return function(G){return wt([Et,G])}}function wt(Et){if(k)throw new TypeError("Generator is already executing.");for(;N;)try{if(k=1,$&&(V=Et[0]&2?$.return:Et[0]?$.throw||((V=$.return)&&V.call($),0):$.next)&&!(V=V.call($,Et[1])).done)return V;switch($=0,V&&(Et=[Et[0]&2,V.value]),Et[0]){case 0:case 1:V=Et;break;case 4:return N.label++,{value:Et[1],done:!1};case 5:N.label++,$=Et[1],Et=[0];continue;case 7:Et=N.ops.pop(),N.trys.pop();continue;default:if(V=N.trys,!(V=V.length>0&&V[V.length-1])&&(Et[0]===6||Et[0]===2)){N=0;continue}if(Et[0]===3&&(!V||Et[1]>V[0]&&Et[1]<V[3])){N.label=Et[1];break}if(Et[0]===6&&N.label<V[1]){N.label=V[1],V=Et;break}if(V&&N.label<V[2]){N.label=V[2],N.ops.push(Et);break}V[2]&&N.ops.pop(),N.trys.pop();continue}Et=C.call(rt,N)}catch(G){Et=[6,G],$=0}finally{k=V=0}if(Et[0]&5)throw Et[1];return{value:Et[0]?Et[1]:void 0,done:!0}}}var t=function(){function rt(C,N){this.next=null,this.key=C,this.data=N,this.left=null,this.right=null}return rt}();function e(rt,C){return rt>C?1:rt<C?-1:0}function o(rt,C,N){for(var k=new t(null,null),$=k,V=k;;){var ht=N(rt,C.key);if(ht<0){if(C.left===null)break;if(N(rt,C.left.key)<0){var st=C.left;if(C.left=st.right,st.right=C,C=st,C.left===null)break}V.left=C,V=C,C=C.left}else if(ht>0){if(C.right===null)break;if(N(rt,C.right.key)>0){var st=C.right;if(C.right=st.left,st.left=C,C=st,C.right===null)break}$.right=C,$=C,C=C.right}else break}return $.right=C.left,V.left=C.right,C.left=k.right,C.right=k.left,C}function s(rt,C,N,k){var $=new t(rt,C);if(N===null)return $.left=$.right=null,$;N=o(rt,N,k);var V=k(rt,N.key);return V<0?($.left=N.left,$.right=N,N.left=null):V>=0&&($.right=N.right,$.left=N,N.right=null),$}function c(rt,C,N){var k=null,$=null;if(C){C=o(rt,C,N);var V=N(C.key,rt);V===0?(k=C.left,$=C.right):V<0?($=C.right,C.right=null,k=C):(k=C.left,C.left=null,$=C)}return{left:k,right:$}}function h(rt,C,N){return C===null?rt:(rt===null||(C=o(rt.key,C,N),C.left=rt),C)}function p(rt,C,N,k,$){if(rt){k(""+C+(N?"\\u2514\\u2500\\u2500 ":"\\u251C\\u2500\\u2500 ")+$(rt)+\`
117
117
  \`);var V=C+(N?" ":"\\u2502 ");rt.left&&p(rt.left,V,!1,k,$),rt.right&&p(rt.right,V,!0,k,$)}}var g=function(){function rt(C){C===void 0&&(C=e),this._root=null,this._size=0,this._comparator=C}return rt.prototype.insert=function(C,N){return this._size++,this._root=s(C,N,this._root,this._comparator)},rt.prototype.add=function(C,N){var k=new t(C,N);this._root===null&&(k.left=k.right=null,this._size++,this._root=k);var $=this._comparator,V=o(C,this._root,$),ht=$(C,V.key);return ht===0?this._root=V:(ht<0?(k.left=V.left,k.right=V,V.left=null):ht>0&&(k.right=V.right,k.left=V,V.right=null),this._size++,this._root=k),this._root},rt.prototype.remove=function(C){this._root=this._remove(C,this._root,this._comparator)},rt.prototype._remove=function(C,N,k){var $;if(N===null)return null;N=o(C,N,k);var V=k(C,N.key);return V===0?(N.left===null?$=N.right:($=o(C,N.left,k),$.right=N.right),this._size--,$):N},rt.prototype.pop=function(){var C=this._root;if(C){for(;C.left;)C=C.left;return this._root=o(C.key,this._root,this._comparator),this._root=this._remove(C.key,this._root,this._comparator),{key:C.key,data:C.data}}return null},rt.prototype.findStatic=function(C){for(var N=this._root,k=this._comparator;N;){var $=k(C,N.key);if($===0)return N;$<0?N=N.left:N=N.right}return null},rt.prototype.find=function(C){return this._root&&(this._root=o(C,this._root,this._comparator),this._comparator(C,this._root.key)!==0)?null:this._root},rt.prototype.contains=function(C){for(var N=this._root,k=this._comparator;N;){var $=k(C,N.key);if($===0)return!0;$<0?N=N.left:N=N.right}return!1},rt.prototype.forEach=function(C,N){for(var k=this._root,$=[],V=!1;!V;)k!==null?($.push(k),k=k.left):$.length!==0?(k=$.pop(),C.call(N,k),k=k.right):V=!0;return this},rt.prototype.range=function(C,N,k,$){for(var V=[],ht=this._comparator,st=this._root,wt;V.length!==0||st;)if(st)V.push(st),st=st.left;else{if(st=V.pop(),wt=ht(st.key,N),wt>0)break;if(ht(st.key,C)>=0&&k.call($,st))return this;st=st.right}return this},rt.prototype.keys=function(){var C=[];return this.forEach(function(N){var k=N.key;return C.push(k)}),C},rt.prototype.values=function(){var C=[];return this.forEach(function(N){var k=N.data;return C.push(k)}),C},rt.prototype.min=function(){return this._root?this.minNode(this._root).key:null},rt.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},rt.prototype.minNode=function(C){if(C===void 0&&(C=this._root),C)for(;C.left;)C=C.left;return C},rt.prototype.maxNode=function(C){if(C===void 0&&(C=this._root),C)for(;C.right;)C=C.right;return C},rt.prototype.at=function(C){for(var N=this._root,k=!1,$=0,V=[];!k;)if(N)V.push(N),N=N.left;else if(V.length>0){if(N=V.pop(),$===C)return N;$++,N=N.right}else k=!0;return null},rt.prototype.next=function(C){var N=this._root,k=null;if(C.right){for(k=C.right;k.left;)k=k.left;return k}for(var $=this._comparator;N;){var V=$(C.key,N.key);if(V===0)break;V<0?(k=N,N=N.left):N=N.right}return k},rt.prototype.prev=function(C){var N=this._root,k=null;if(C.left!==null){for(k=C.left;k.right;)k=k.right;return k}for(var $=this._comparator;N;){var V=$(C.key,N.key);if(V===0)break;V<0?N=N.left:(k=N,N=N.right)}return k},rt.prototype.clear=function(){return this._root=null,this._size=0,this},rt.prototype.toList=function(){return w(this._root)},rt.prototype.load=function(C,N,k){N===void 0&&(N=[]),k===void 0&&(k=!1);var $=C.length,V=this._comparator;if(k&&P(C,N,0,$-1,V),this._root===null)this._root=m(C,N,0,$),this._size=$;else{var ht=b(this.toList(),_(C,N),V);$=this._size+$,this._root=x({head:ht},0,$)}return this},rt.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(rt.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(rt.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),rt.prototype.toString=function(C){C===void 0&&(C=function(k){return String(k.key)});var N=[];return p(this._root,"",!0,function(k){return N.push(k)},C),N.join("")},rt.prototype.update=function(C,N,k){var $=this._comparator,V=c(C,this._root,$),ht=V.left,st=V.right;$(C,N)<0?st=s(N,k,st,$):ht=s(N,k,ht,$),this._root=h(ht,st,$)},rt.prototype.split=function(C){return c(C,this._root,this._comparator)},rt.prototype[Symbol.iterator]=function(){var C,N,k;return n(this,function($){switch($.label){case 0:C=this._root,N=[],k=!1,$.label=1;case 1:return k?[3,6]:C===null?[3,2]:(N.push(C),C=C.left,[3,5]);case 2:return N.length===0?[3,4]:(C=N.pop(),[4,C]);case 3:return $.sent(),C=C.right,[3,5];case 4:k=!0,$.label=5;case 5:return[3,1];case 6:return[2]}})},rt}();function m(rt,C,N,k){var $=k-N;if($>0){var V=N+Math.floor($/2),ht=rt[V],st=C[V],wt=new t(ht,st);return wt.left=m(rt,C,N,V),wt.right=m(rt,C,V+1,k),wt}return null}function _(rt,C){for(var N=new t(null,null),k=N,$=0;$<rt.length;$++)k=k.next=new t(rt[$],C[$]);return k.next=null,N.next}function w(rt){for(var C=rt,N=[],k=!1,$=new t(null,null),V=$;!k;)C?(N.push(C),C=C.left):N.length>0?(C=V=V.next=N.pop(),C=C.right):k=!0;return V.next=null,$.next}function x(rt,C,N){var k=N-C;if(k>0){var $=C+Math.floor(k/2),V=x(rt,C,$),ht=rt.head;return ht.left=V,rt.head=rt.head.next,ht.right=x(rt,$+1,N),ht}return null}function b(rt,C,N){for(var k=new t(null,null),$=k,V=rt,ht=C;V!==null&&ht!==null;)N(V.key,ht.key)<0?($.next=V,V=V.next):($.next=ht,ht=ht.next),$=$.next;return V!==null?$.next=V:ht!==null&&($.next=ht),k.next}function P(rt,C,N,k,$){if(!(N>=k)){for(var V=rt[N+k>>1],ht=N-1,st=k+1;;){do ht++;while($(rt[ht],V)<0);do st--;while($(rt[st],V)>0);if(ht>=st)break;var wt=rt[ht];rt[ht]=rt[st],rt[st]=wt,wt=C[ht],C[ht]=C[st],C[st]=wt}P(rt,C,N,st,$),P(rt,C,st+1,k,$)}}let I=(rt,C)=>rt.ll.x<=C.x&&C.x<=rt.ur.x&&rt.ll.y<=C.y&&C.y<=rt.ur.y,S=(rt,C)=>{if(C.ur.x<rt.ll.x||rt.ur.x<C.ll.x||C.ur.y<rt.ll.y||rt.ur.y<C.ll.y)return null;let N=rt.ll.x<C.ll.x?C.ll.x:rt.ll.x,k=rt.ur.x<C.ur.x?rt.ur.x:C.ur.x,$=rt.ll.y<C.ll.y?C.ll.y:rt.ll.y,V=rt.ur.y<C.ur.y?rt.ur.y:C.ur.y;return{ll:{x:N,y:$},ur:{x:k,y:V}}},E=Number.EPSILON;E===void 0&&(E=Math.pow(2,-52));let R=E*E,T=(rt,C)=>{if(-E<rt&&rt<E&&-E<C&&C<E)return 0;let N=rt-C;return N*N<R*rt*C?0:rt<C?-1:1};class F{constructor(){this.reset()}reset(){this.xRounder=new W,this.yRounder=new W}round(C,N){return{x:this.xRounder.round(C),y:this.yRounder.round(N)}}}class W{constructor(){this.tree=new g,this.round(0)}round(C){let N=this.tree.add(C),k=this.tree.prev(N);if(k!==null&&T(N.key,k.key)===0)return this.tree.remove(C),k.key;let $=this.tree.next(N);return $!==null&&T(N.key,$.key)===0?(this.tree.remove(C),$.key):C}}let X=new F,q=11102230246251565e-32,D=134217729,xt=(3+8*q)*q;function B(rt,C,N,k,$){let V,ht,st,wt,Et=C[0],G=k[0],ot=0,et=0;G>Et==G>-Et?(V=Et,Et=C[++ot]):(V=G,G=k[++et]);let lt=0;if(ot<rt&&et<N)for(G>Et==G>-Et?(ht=Et+V,st=V-(ht-Et),Et=C[++ot]):(ht=G+V,st=V-(ht-G),G=k[++et]),V=ht,st!==0&&($[lt++]=st);ot<rt&&et<N;)G>Et==G>-Et?(ht=V+Et,wt=ht-V,st=V-(ht-wt)+(Et-wt),Et=C[++ot]):(ht=V+G,wt=ht-V,st=V-(ht-wt)+(G-wt),G=k[++et]),V=ht,st!==0&&($[lt++]=st);for(;ot<rt;)ht=V+Et,wt=ht-V,st=V-(ht-wt)+(Et-wt),Et=C[++ot],V=ht,st!==0&&($[lt++]=st);for(;et<N;)ht=V+G,wt=ht-V,st=V-(ht-wt)+(G-wt),G=k[++et],V=ht,st!==0&&($[lt++]=st);return(V!==0||lt===0)&&($[lt++]=V),lt}function j(rt,C){let N=C[0];for(let k=1;k<rt;k++)N+=C[k];return N}function J(rt){return new Float64Array(rt)}let Dt=(3+16*q)*q,Q=(2+12*q)*q,At=(9+64*q)*q*q,Mt=J(4),Rt=J(8),pt=J(12),yt=J(16),K=J(4);function Bt(rt,C,N,k,$,V,ht){let st,wt,Et,G,ot,et,lt,Ft,Kt,me,ve,qe,Ue,Xe,Ke,Er,Zr,nr,Ie=rt-$,rr=N-$,pr=C-V,ar=k-V;Xe=Ie*ar,et=D*Ie,lt=et-(et-Ie),Ft=Ie-lt,et=D*ar,Kt=et-(et-ar),me=ar-Kt,Ke=Ft*me-(Xe-lt*Kt-Ft*Kt-lt*me),Er=pr*rr,et=D*pr,lt=et-(et-pr),Ft=pr-lt,et=D*rr,Kt=et-(et-rr),me=rr-Kt,Zr=Ft*me-(Er-lt*Kt-Ft*Kt-lt*me),ve=Ke-Zr,ot=Ke-ve,Mt[0]=Ke-(ve+ot)+(ot-Zr),qe=Xe+ve,ot=qe-Xe,Ue=Xe-(qe-ot)+(ve-ot),ve=Ue-Er,ot=Ue-ve,Mt[1]=Ue-(ve+ot)+(ot-Er),nr=qe+ve,ot=nr-qe,Mt[2]=qe-(nr-ot)+(ve-ot),Mt[3]=nr;let Qn=j(4,Mt),Si=Q*ht;if(Qn>=Si||-Qn>=Si||(ot=rt-Ie,st=rt-(Ie+ot)+(ot-$),ot=N-rr,Et=N-(rr+ot)+(ot-$),ot=C-pr,wt=C-(pr+ot)+(ot-V),ot=k-ar,G=k-(ar+ot)+(ot-V),st===0&&wt===0&&Et===0&&G===0)||(Si=At*ht+xt*Math.abs(Qn),Qn+=Ie*G+ar*st-(pr*Et+rr*wt),Qn>=Si||-Qn>=Si))return Qn;Xe=st*ar,et=D*st,lt=et-(et-st),Ft=st-lt,et=D*ar,Kt=et-(et-ar),me=ar-Kt,Ke=Ft*me-(Xe-lt*Kt-Ft*Kt-lt*me),Er=wt*rr,et=D*wt,lt=et-(et-wt),Ft=wt-lt,et=D*rr,Kt=et-(et-rr),me=rr-Kt,Zr=Ft*me-(Er-lt*Kt-Ft*Kt-lt*me),ve=Ke-Zr,ot=Ke-ve,K[0]=Ke-(ve+ot)+(ot-Zr),qe=Xe+ve,ot=qe-Xe,Ue=Xe-(qe-ot)+(ve-ot),ve=Ue-Er,ot=Ue-ve,K[1]=Ue-(ve+ot)+(ot-Er),nr=qe+ve,ot=nr-qe,K[2]=qe-(nr-ot)+(ve-ot),K[3]=nr;let ii=B(4,Mt,4,K,Rt);Xe=Ie*G,et=D*Ie,lt=et-(et-Ie),Ft=Ie-lt,et=D*G,Kt=et-(et-G),me=G-Kt,Ke=Ft*me-(Xe-lt*Kt-Ft*Kt-lt*me),Er=pr*Et,et=D*pr,lt=et-(et-pr),Ft=pr-lt,et=D*Et,Kt=et-(et-Et),me=Et-Kt,Zr=Ft*me-(Er-lt*Kt-Ft*Kt-lt*me),ve=Ke-Zr,ot=Ke-ve,K[0]=Ke-(ve+ot)+(ot-Zr),qe=Xe+ve,ot=qe-Xe,Ue=Xe-(qe-ot)+(ve-ot),ve=Ue-Er,ot=Ue-ve,K[1]=Ue-(ve+ot)+(ot-Er),nr=qe+ve,ot=nr-qe,K[2]=qe-(nr-ot)+(ve-ot),K[3]=nr;let Z=B(ii,Rt,4,K,pt);Xe=st*G,et=D*st,lt=et-(et-st),Ft=st-lt,et=D*G,Kt=et-(et-G),me=G-Kt,Ke=Ft*me-(Xe-lt*Kt-Ft*Kt-lt*me),Er=wt*Et,et=D*wt,lt=et-(et-wt),Ft=wt-lt,et=D*Et,Kt=et-(et-Et),me=Et-Kt,Zr=Ft*me-(Er-lt*Kt-Ft*Kt-lt*me),ve=Ke-Zr,ot=Ke-ve,K[0]=Ke-(ve+ot)+(ot-Zr),qe=Xe+ve,ot=qe-Xe,Ue=Xe-(qe-ot)+(ve-ot),ve=Ue-Er,ot=Ue-ve,K[1]=Ue-(ve+ot)+(ot-Er),nr=qe+ve,ot=nr-qe,K[2]=qe-(nr-ot)+(ve-ot),K[3]=nr;let mt=B(Z,pt,4,K,yt);return yt[mt-1]}function Gt(rt,C,N,k,$,V){let ht=(C-V)*(N-$),st=(rt-$)*(k-V),wt=ht-st,Et=Math.abs(ht+st);return Math.abs(wt)>=Dt*Et?wt:-Bt(rt,C,N,k,$,V,Et)}let ae=(rt,C)=>rt.x*C.y-rt.y*C.x,ut=(rt,C)=>rt.x*C.x+rt.y*C.y,Ut=(rt,C,N)=>{let k=Gt(rt.x,rt.y,C.x,C.y,N.x,N.y);return k>0?-1:k<0?1:0},jt=rt=>Math.sqrt(ut(rt,rt)),ce=(rt,C,N)=>{let k={x:C.x-rt.x,y:C.y-rt.y},$={x:N.x-rt.x,y:N.y-rt.y};return ae($,k)/jt($)/jt(k)},te=(rt,C,N)=>{let k={x:C.x-rt.x,y:C.y-rt.y},$={x:N.x-rt.x,y:N.y-rt.y};return ut($,k)/jt($)/jt(k)},$t=(rt,C,N)=>C.y===0?null:{x:rt.x+C.x/C.y*(N-rt.y),y:N},qt=(rt,C,N)=>C.x===0?null:{x:N,y:rt.y+C.y/C.x*(N-rt.x)},xe=(rt,C,N,k)=>{if(C.x===0)return qt(N,k,rt.x);if(k.x===0)return qt(rt,C,N.x);if(C.y===0)return $t(N,k,rt.y);if(k.y===0)return $t(rt,C,N.y);let $=ae(C,k);if($==0)return null;let V={x:N.x-rt.x,y:N.y-rt.y},ht=ae(V,C)/$,st=ae(V,k)/$,wt=rt.x+st*C.x,Et=N.x+ht*k.x,G=rt.y+st*C.y,ot=N.y+ht*k.y,et=(wt+Et)/2,lt=(G+ot)/2;return{x:et,y:lt}};class ft{static compare(C,N){let k=ft.comparePoints(C.point,N.point);return k!==0?k:(C.point!==N.point&&C.link(N),C.isLeft!==N.isLeft?C.isLeft?1:-1:ee.compare(C.segment,N.segment))}static comparePoints(C,N){return C.x<N.x?-1:C.x>N.x?1:C.y<N.y?-1:C.y>N.y?1:0}constructor(C,N){C.events===void 0?C.events=[this]:C.events.push(this),this.point=C,this.isLeft=N}link(C){if(C.point===this.point)throw new Error("Tried to link already linked events");let N=C.point.events;for(let k=0,$=N.length;k<$;k++){let V=N[k];this.point.events.push(V),V.point=this.point}this.checkForConsuming()}checkForConsuming(){let C=this.point.events.length;for(let N=0;N<C;N++){let k=this.point.events[N];if(k.segment.consumedBy===void 0)for(let $=N+1;$<C;$++){let V=this.point.events[$];V.consumedBy===void 0&&k.otherSE.point.events===V.otherSE.point.events&&k.segment.consume(V.segment)}}}getAvailableLinkedEvents(){let C=[];for(let N=0,k=this.point.events.length;N<k;N++){let $=this.point.events[N];$!==this&&!$.segment.ringOut&&$.segment.isInResult()&&C.push($)}return C}getLeftmostComparator(C){let N=new Map,k=$=>{let V=$.otherSE;N.set($,{sine:ce(this.point,C.point,V.point),cosine:te(this.point,C.point,V.point)})};return($,V)=>{N.has($)||k($),N.has(V)||k(V);let{sine:ht,cosine:st}=N.get($),{sine:wt,cosine:Et}=N.get(V);return ht>=0&&wt>=0?st<Et?1:st>Et?-1:0:ht<0&&wt<0?st<Et?-1:st>Et?1:0:wt<ht?-1:wt>ht?1:0}}}let We=0;class ee{static compare(C,N){let k=C.leftSE.point.x,$=N.leftSE.point.x,V=C.rightSE.point.x,ht=N.rightSE.point.x;if(ht<k)return 1;if(V<$)return-1;let st=C.leftSE.point.y,wt=N.leftSE.point.y,Et=C.rightSE.point.y,G=N.rightSE.point.y;if(k<$){if(wt<st&&wt<Et)return 1;if(wt>st&&wt>Et)return-1;let ot=C.comparePoint(N.leftSE.point);if(ot<0)return 1;if(ot>0)return-1;let et=N.comparePoint(C.rightSE.point);return et!==0?et:-1}if(k>$){if(st<wt&&st<G)return-1;if(st>wt&&st>G)return 1;let ot=N.comparePoint(C.leftSE.point);if(ot!==0)return ot;let et=C.comparePoint(N.rightSE.point);return et<0?1:et>0?-1:1}if(st<wt)return-1;if(st>wt)return 1;if(V<ht){let ot=N.comparePoint(C.rightSE.point);if(ot!==0)return ot}if(V>ht){let ot=C.comparePoint(N.rightSE.point);if(ot<0)return 1;if(ot>0)return-1}if(V!==ht){let ot=Et-st,et=V-k,lt=G-wt,Ft=ht-$;if(ot>et&&lt<Ft)return 1;if(ot<et&&lt>Ft)return-1}return V>ht?1:V<ht||Et<G?-1:Et>G?1:C.id<N.id?-1:C.id>N.id?1:0}constructor(C,N,k,$){this.id=++We,this.leftSE=C,C.segment=this,C.otherSE=N,this.rightSE=N,N.segment=this,N.otherSE=C,this.rings=k,this.windings=$}static fromRing(C,N,k){let $,V,ht,st=ft.comparePoints(C,N);if(st<0)$=C,V=N,ht=1;else if(st>0)$=N,V=C,ht=-1;else throw new Error(\`Tried to create degenerate segment at [\${C.x}, \${C.y}]\`);let wt=new ft($,!0),Et=new ft(V,!1);return new ee(wt,Et,[k],[ht])}replaceRightSE(C){this.rightSE=C,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){let C=this.leftSE.point.y,N=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:C<N?C:N},ur:{x:this.rightSE.point.x,y:C>N?C:N}}}vector(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}isAnEndpoint(C){return C.x===this.leftSE.point.x&&C.y===this.leftSE.point.y||C.x===this.rightSE.point.x&&C.y===this.rightSE.point.y}comparePoint(C){if(this.isAnEndpoint(C))return 0;let N=this.leftSE.point,k=this.rightSE.point,$=this.vector();if(N.x===k.x)return C.x===N.x?0:C.x<N.x?1:-1;let V=(C.y-N.y)/$.y,ht=N.x+V*$.x;if(C.x===ht)return 0;let st=(C.x-N.x)/$.x,wt=N.y+st*$.y;return C.y===wt?0:C.y<wt?-1:1}getIntersection(C){let N=this.bbox(),k=C.bbox(),$=S(N,k);if($===null)return null;let V=this.leftSE.point,ht=this.rightSE.point,st=C.leftSE.point,wt=C.rightSE.point,Et=I(N,st)&&this.comparePoint(st)===0,G=I(k,V)&&C.comparePoint(V)===0,ot=I(N,wt)&&this.comparePoint(wt)===0,et=I(k,ht)&&C.comparePoint(ht)===0;if(G&&Et)return et&&!ot?ht:!et&&ot?wt:null;if(G)return ot&&V.x===wt.x&&V.y===wt.y?null:V;if(Et)return et&&ht.x===st.x&&ht.y===st.y?null:st;if(et&&ot)return null;if(et)return ht;if(ot)return wt;let lt=xe(V,this.vector(),st,C.vector());return lt===null||!I($,lt)?null:X.round(lt.x,lt.y)}split(C){let N=[],k=C.events!==void 0,$=new ft(C,!0),V=new ft(C,!1),ht=this.rightSE;this.replaceRightSE(V),N.push(V),N.push($);let st=new ee($,ht,this.rings.slice(),this.windings.slice());return ft.comparePoints(st.leftSE.point,st.rightSE.point)>0&&st.swapEvents(),ft.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),k&&($.checkForConsuming(),V.checkForConsuming()),N}swapEvents(){let C=this.rightSE;this.rightSE=this.leftSE,this.leftSE=C,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let N=0,k=this.windings.length;N<k;N++)this.windings[N]*=-1}consume(C){let N=this,k=C;for(;N.consumedBy;)N=N.consumedBy;for(;k.consumedBy;)k=k.consumedBy;let $=ee.compare(N,k);if($!==0){if($>0){let V=N;N=k,k=V}if(N.prev===k){let V=N;N=k,k=V}for(let V=0,ht=k.rings.length;V<ht;V++){let st=k.rings[V],wt=k.windings[V],Et=N.rings.indexOf(st);Et===-1?(N.rings.push(st),N.windings.push(wt)):N.windings[Et]+=wt}k.rings=null,k.windings=null,k.consumedBy=N,k.leftSE.consumedBy=N.leftSE,k.rightSE.consumedBy=N.rightSE}}prevInResult(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}beforeState(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{let C=this.prev.consumedBy||this.prev;this._beforeState=C.afterState()}return this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;let C=this.beforeState();this._afterState={rings:C.rings.slice(0),windings:C.windings.slice(0),multiPolys:[]};let N=this._afterState.rings,k=this._afterState.windings,$=this._afterState.multiPolys;for(let st=0,wt=this.rings.length;st<wt;st++){let Et=this.rings[st],G=this.windings[st],ot=N.indexOf(Et);ot===-1?(N.push(Et),k.push(G)):k[ot]+=G}let V=[],ht=[];for(let st=0,wt=N.length;st<wt;st++){if(k[st]===0)continue;let Et=N[st],G=Et.poly;if(ht.indexOf(G)===-1)if(Et.isExterior)V.push(G);else{ht.indexOf(G)===-1&&ht.push(G);let ot=V.indexOf(Et.poly);ot!==-1&&V.splice(ot,1)}}for(let st=0,wt=V.length;st<wt;st++){let Et=V[st].multiPoly;$.indexOf(Et)===-1&&$.push(Et)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;let C=this.beforeState().multiPolys,N=this.afterState().multiPolys;switch(dt.type){case"union":{let k=C.length===0,$=N.length===0;this._isInResult=k!==$;break}case"intersection":{let k,$;C.length<N.length?(k=C.length,$=N.length):(k=N.length,$=C.length),this._isInResult=$===dt.numMultiPolys&&k<$;break}case"xor":{let k=Math.abs(C.length-N.length);this._isInResult=k%2===1;break}case"difference":{let k=$=>$.length===1&&$[0].isSubject;this._isInResult=k(C)!==k(N);break}default:throw new Error(\`Unrecognized operation type found \${dt.type}\`)}return this._isInResult}}class ge{constructor(C,N,k){if(!Array.isArray(C)||C.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=N,this.isExterior=k,this.segments=[],typeof C[0][0]!="number"||typeof C[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let $=X.round(C[0][0],C[0][1]);this.bbox={ll:{x:$.x,y:$.y},ur:{x:$.x,y:$.y}};let V=$;for(let ht=1,st=C.length;ht<st;ht++){if(typeof C[ht][0]!="number"||typeof C[ht][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let wt=X.round(C[ht][0],C[ht][1]);wt.x===V.x&&wt.y===V.y||(this.segments.push(ee.fromRing(V,wt,this)),wt.x<this.bbox.ll.x&&(this.bbox.ll.x=wt.x),wt.y<this.bbox.ll.y&&(this.bbox.ll.y=wt.y),wt.x>this.bbox.ur.x&&(this.bbox.ur.x=wt.x),wt.y>this.bbox.ur.y&&(this.bbox.ur.y=wt.y),V=wt)}($.x!==V.x||$.y!==V.y)&&this.segments.push(ee.fromRing(V,$,this))}getSweepEvents(){let C=[];for(let N=0,k=this.segments.length;N<k;N++){let $=this.segments[N];C.push($.leftSE),C.push($.rightSE)}return C}}class fe{constructor(C,N){if(!Array.isArray(C))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new ge(C[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(let k=1,$=C.length;k<$;k++){let V=new ge(C[k],this,!1);V.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=V.bbox.ll.x),V.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=V.bbox.ll.y),V.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=V.bbox.ur.x),V.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=V.bbox.ur.y),this.interiorRings.push(V)}this.multiPoly=N}getSweepEvents(){let C=this.exteriorRing.getSweepEvents();for(let N=0,k=this.interiorRings.length;N<k;N++){let $=this.interiorRings[N].getSweepEvents();for(let V=0,ht=$.length;V<ht;V++)C.push($[V])}return C}}class Te{constructor(C,N){if(!Array.isArray(C))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof C[0][0][0]=="number"&&(C=[C])}catch(k){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(let k=0,$=C.length;k<$;k++){let V=new fe(C[k],this);V.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=V.bbox.ll.x),V.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=V.bbox.ll.y),V.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=V.bbox.ur.x),V.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=V.bbox.ur.y),this.polys.push(V)}this.isSubject=N}getSweepEvents(){let C=[];for(let N=0,k=this.polys.length;N<k;N++){let $=this.polys[N].getSweepEvents();for(let V=0,ht=$.length;V<ht;V++)C.push($[V])}return C}}class be{static factory(C){let N=[];for(let k=0,$=C.length;k<$;k++){let V=C[k];if(!V.isInResult()||V.ringOut)continue;let ht=null,st=V.leftSE,wt=V.rightSE,Et=[st],G=st.point,ot=[];for(;ht=st,st=wt,Et.push(st),st.point!==G;)for(;;){let et=st.getAvailableLinkedEvents();if(et.length===0){let Kt=Et[0].point,me=Et[Et.length-1].point;throw new Error(\`Unable to complete output ring starting at [\${Kt.x}, \${Kt.y}]. Last matching segment found ends at [\${me.x}, \${me.y}].\`)}if(et.length===1){wt=et[0].otherSE;break}let lt=null;for(let Kt=0,me=ot.length;Kt<me;Kt++)if(ot[Kt].point===st.point){lt=Kt;break}if(lt!==null){let Kt=ot.splice(lt)[0],me=Et.splice(Kt.index);me.unshift(me[0].otherSE),N.push(new be(me.reverse()));continue}ot.push({index:Et.length,point:st.point});let Ft=st.getLeftmostComparator(ht);wt=et.sort(Ft)[0].otherSE;break}N.push(new be(Et))}return N}constructor(C){this.events=C;for(let N=0,k=C.length;N<k;N++)C[N].segment.ringOut=this;this.poly=null}getGeom(){let C=this.events[0].point,N=[C];for(let Et=1,G=this.events.length-1;Et<G;Et++){let ot=this.events[Et].point,et=this.events[Et+1].point;Ut(ot,C,et)!==0&&(N.push(ot),C=ot)}if(N.length===1)return null;let k=N[0],$=N[1];Ut(k,C,$)===0&&N.shift(),N.push(N[0]);let V=this.isExteriorRing()?1:-1,ht=this.isExteriorRing()?0:N.length-1,st=this.isExteriorRing()?N.length:-1,wt=[];for(let Et=ht;Et!=st;Et+=V)wt.push([N[Et].x,N[Et].y]);return wt}isExteriorRing(){if(this._isExteriorRing===void 0){let C=this.enclosingRing();this._isExteriorRing=C?!C.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let C=this.events[0];for(let $=1,V=this.events.length;$<V;$++){let ht=this.events[$];ft.compare(C,ht)>0&&(C=ht)}let N=C.segment.prevInResult(),k=N?N.prevInResult():null;for(;;){if(!N)return null;if(!k)return N.ringOut;if(k.ringOut!==N.ringOut)return k.ringOut.enclosingRing()!==N.ringOut?N.ringOut:N.ringOut.enclosingRing();N=k.prevInResult(),k=N?N.prevInResult():null}}}class Wt{constructor(C){this.exteriorRing=C,C.poly=this,this.interiorRings=[]}addInterior(C){this.interiorRings.push(C),C.poly=this}getGeom(){let C=[this.exteriorRing.getGeom()];if(C[0]===null)return null;for(let N=0,k=this.interiorRings.length;N<k;N++){let $=this.interiorRings[N].getGeom();$!==null&&C.push($)}return C}}class Me{constructor(C){this.rings=C,this.polys=this._composePolys(C)}getGeom(){let C=[];for(let N=0,k=this.polys.length;N<k;N++){let $=this.polys[N].getGeom();$!==null&&C.push($)}return C}_composePolys(C){let N=[];for(let k=0,$=C.length;k<$;k++){let V=C[k];if(!V.poly)if(V.isExteriorRing())N.push(new Wt(V));else{let ht=V.enclosingRing();ht.poly||N.push(new Wt(ht)),ht.poly.addInterior(V)}}return N}}class tt{constructor(C){let N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ee.compare;this.queue=C,this.tree=new g(N),this.segments=[]}process(C){let N=C.segment,k=[];if(C.consumedBy)return C.isLeft?this.queue.remove(C.otherSE):this.tree.remove(N),k;let $=C.isLeft?this.tree.add(N):this.tree.find(N);if(!$)throw new Error(\`Unable to find segment #\${N.id} [\${N.leftSE.point.x}, \${N.leftSE.point.y}] -> [\${N.rightSE.point.x}, \${N.rightSE.point.y}] in SweepLine tree.\`);let V=$,ht=$,st,wt;for(;st===void 0;)V=this.tree.prev(V),V===null?st=null:V.key.consumedBy===void 0&&(st=V.key);for(;wt===void 0;)ht=this.tree.next(ht),ht===null?wt=null:ht.key.consumedBy===void 0&&(wt=ht.key);if(C.isLeft){let Et=null;if(st){let ot=st.getIntersection(N);if(ot!==null&&(N.isAnEndpoint(ot)||(Et=ot),!st.isAnEndpoint(ot))){let et=this._splitSafely(st,ot);for(let lt=0,Ft=et.length;lt<Ft;lt++)k.push(et[lt])}}let G=null;if(wt){let ot=wt.getIntersection(N);if(ot!==null&&(N.isAnEndpoint(ot)||(G=ot),!wt.isAnEndpoint(ot))){let et=this._splitSafely(wt,ot);for(let lt=0,Ft=et.length;lt<Ft;lt++)k.push(et[lt])}}if(Et!==null||G!==null){let ot=null;Et===null?ot=G:G===null?ot=Et:ot=ft.comparePoints(Et,G)<=0?Et:G,this.queue.remove(N.rightSE),k.push(N.rightSE);let et=N.split(ot);for(let lt=0,Ft=et.length;lt<Ft;lt++)k.push(et[lt])}k.length>0?(this.tree.remove(N),k.push(C)):(this.segments.push(N),N.prev=st)}else{if(st&&wt){let Et=st.getIntersection(wt);if(Et!==null){if(!st.isAnEndpoint(Et)){let G=this._splitSafely(st,Et);for(let ot=0,et=G.length;ot<et;ot++)k.push(G[ot])}if(!wt.isAnEndpoint(Et)){let G=this._splitSafely(wt,Et);for(let ot=0,et=G.length;ot<et;ot++)k.push(G[ot])}}}this.tree.remove(N)}return k}_splitSafely(C,N){this.tree.remove(C);let k=C.rightSE;this.queue.remove(k);let $=C.split(N);return $.push(k),C.consumedBy===void 0&&this.tree.add(C),$}}let z=typeof process!="undefined"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,Pt=typeof process!="undefined"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6;class Ot{run(C,N,k){dt.type=C,X.reset();let $=[new Te(N,!0)];for(let ot=0,et=k.length;ot<et;ot++)$.push(new Te(k[ot],!1));if(dt.numMultiPolys=$.length,dt.type==="difference"){let ot=$[0],et=1;for(;et<$.length;)S($[et].bbox,ot.bbox)!==null?et++:$.splice(et,1)}if(dt.type==="intersection")for(let ot=0,et=$.length;ot<et;ot++){let lt=$[ot];for(let Ft=ot+1,Kt=$.length;Ft<Kt;Ft++)if(S(lt.bbox,$[Ft].bbox)===null)return[]}let V=new g(ft.compare);for(let ot=0,et=$.length;ot<et;ot++){let lt=$[ot].getSweepEvents();for(let Ft=0,Kt=lt.length;Ft<Kt;Ft++)if(V.insert(lt[Ft]),V.size>z)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}let ht=new tt(V),st=V.size,wt=V.pop();for(;wt;){let ot=wt.key;if(V.size===st){let lt=ot.segment;throw new Error(\`Unable to pop() \${ot.isLeft?"left":"right"} SweepEvent [\${ot.point.x}, \${ot.point.y}] from segment #\${lt.id} [\${lt.leftSE.point.x}, \${lt.leftSE.point.y}] -> [\${lt.rightSE.point.x}, \${lt.rightSE.point.y}] from queue.\`)}if(V.size>z)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if(ht.segments.length>Pt)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");let et=ht.process(ot);for(let lt=0,Ft=et.length;lt<Ft;lt++){let Kt=et[lt];Kt.consumedBy===void 0&&V.insert(Kt)}st=V.size,wt=V.pop()}X.reset();let Et=be.factory(ht.segments);return new Me(Et).getGeom()}}let dt=new Ot;var ne={union:function(rt){for(var C=arguments.length,N=new Array(C>1?C-1:0),k=1;k<C;k++)N[k-1]=arguments[k];return dt.run("union",rt,N)},intersection:function(rt){for(var C=arguments.length,N=new Array(C>1?C-1:0),k=1;k<C;k++)N[k-1]=arguments[k];return dt.run("intersection",rt,N)},xor:function(rt){for(var C=arguments.length,N=new Array(C>1?C-1:0),k=1;k<C;k++)N[k-1]=arguments[k];return dt.run("xor",rt,N)},difference:function(rt){for(var C=arguments.length,N=new Array(C>1?C-1:0),k=1;k<C;k++)N[k-1]=arguments[k];return dt.run("difference",rt,N)}};return ne})});var qR=at((bg,kR)=>{(function(n,t){typeof bg=="object"&&typeof kR!="undefined"?t(bg):typeof define=="function"&&define.amd?define(["exports"],t):t(n.jsts={})})(bg,function(n){"use strict";function t(){}function e(r){this.message=r||""}function o(r){this.message=r||""}function s(r){this.message=r||""}function c(){}function h(r){return r===null?Ke:r.color}function p(r){return r===null?null:r.parent}function g(r,i){r!==null&&(r.color=i)}function m(r){return r===null?null:r.left}function _(r){return r===null?null:r.right}function w(){this.root_=null,this.size_=0}function x(){}function b(){this.array_=[],arguments[0]instanceof st&&this.addAll(arguments[0])}function P(){}function I(r){this.message=r||""}function S(){this.array_=[]}"fill"in Array.prototype||Object.defineProperty(Array.prototype,"fill",{configurable:!0,value:function(r){if(this===void 0||this===null)throw new TypeError(this+" is not an object");var i=Object(this),a=Math.max(Math.min(i.length,9007199254740991),0)||0,l=1 in arguments&&parseInt(Number(arguments[1]),10)||0;l=l<0?Math.max(a+l,0):Math.min(l,a);var d=2 in arguments&&arguments[2]!==void 0?parseInt(Number(arguments[2]),10)||0:a;for(d=d<0?Math.max(a+arguments[2],0):Math.min(d,a);l<d;)i[l]=r,++l;return i},writable:!0}),Number.isFinite=Number.isFinite||function(r){return typeof r=="number"&&isFinite(r)},Number.isInteger=Number.isInteger||function(r){return typeof r=="number"&&isFinite(r)&&Math.floor(r)===r},Number.parseFloat=Number.parseFloat||parseFloat,Number.isNaN=Number.isNaN||function(r){return r!=r},Math.trunc=Math.trunc||function(r){return r<0?Math.ceil(r):Math.floor(r)};var E=function(){};E.prototype.interfaces_=function(){return[]},E.prototype.getClass=function(){return E},E.prototype.equalsWithTolerance=function(r,i,a){return Math.abs(r-i)<=a};var R=function(r){function i(a){r.call(this,a),this.name="IllegalArgumentException",this.message=a,this.stack=new r().stack}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i}(Error),T=function(){},F={MAX_VALUE:{configurable:!0}};T.isNaN=function(r){return Number.isNaN(r)},T.doubleToLongBits=function(r){return r},T.longBitsToDouble=function(r){return r},T.isInfinite=function(r){return!Number.isFinite(r)},F.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(T,F);var W=function(){},X=function(){},q=function(){},D=function r(){if(this.x=null,this.y=null,this.z=null,arguments.length===0)this.x=0,this.y=0,this.z=r.NULL_ORDINATE;else if(arguments.length===1){var i=arguments[0];this.x=i.x,this.y=i.y,this.z=i.z}else arguments.length===2?(this.x=arguments[0],this.y=arguments[1],this.z=r.NULL_ORDINATE):arguments.length===3&&(this.x=arguments[0],this.y=arguments[1],this.z=arguments[2])},xt={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};D.prototype.setOrdinate=function(r,i){switch(r){case D.X:this.x=i;break;case D.Y:this.y=i;break;case D.Z:this.z=i;break;default:throw new R("Invalid ordinate index: "+r)}},D.prototype.equals2D=function(){if(arguments.length===1){var r=arguments[0];return this.x===r.x&&this.y===r.y}if(arguments.length===2){var i=arguments[0],a=arguments[1];return!!E.equalsWithTolerance(this.x,i.x,a)&&!!E.equalsWithTolerance(this.y,i.y,a)}},D.prototype.getOrdinate=function(r){switch(r){case D.X:return this.x;case D.Y:return this.y;case D.Z:return this.z}throw new R("Invalid ordinate index: "+r)},D.prototype.equals3D=function(r){return this.x===r.x&&this.y===r.y&&(this.z===r.z||T.isNaN(this.z))&&T.isNaN(r.z)},D.prototype.equals=function(r){return r instanceof D&&this.equals2D(r)},D.prototype.equalInZ=function(r,i){return E.equalsWithTolerance(this.z,r.z,i)},D.prototype.compareTo=function(r){var i=r;return this.x<i.x?-1:this.x>i.x?1:this.y<i.y?-1:this.y>i.y?1:0},D.prototype.clone=function(){},D.prototype.copy=function(){return new D(this)},D.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},D.prototype.distance3D=function(r){var i=this.x-r.x,a=this.y-r.y,l=this.z-r.z;return Math.sqrt(i*i+a*a+l*l)},D.prototype.distance=function(r){var i=this.x-r.x,a=this.y-r.y;return Math.sqrt(i*i+a*a)},D.prototype.hashCode=function(){var r=17;return r=37*r+D.hashCode(this.x),r=37*r+D.hashCode(this.y)},D.prototype.setCoordinate=function(r){this.x=r.x,this.y=r.y,this.z=r.z},D.prototype.interfaces_=function(){return[W,X,t]},D.prototype.getClass=function(){return D},D.hashCode=function(){if(arguments.length===1){var r=arguments[0],i=T.doubleToLongBits(r);return Math.trunc((i^i)>>>32)}},xt.DimensionalComparator.get=function(){return B},xt.serialVersionUID.get=function(){return 6683108902428367e3},xt.NULL_ORDINATE.get=function(){return T.NaN},xt.X.get=function(){return 0},xt.Y.get=function(){return 1},xt.Z.get=function(){return 2},Object.defineProperties(D,xt);var B=function(r){if(this._dimensionsToTest=2,arguments.length!==0){if(arguments.length===1){var i=arguments[0];if(i!==2&&i!==3)throw new R("only 2 or 3 dimensions may be specified");this._dimensionsToTest=i}}};B.prototype.compare=function(r,i){var a=r,l=i,d=B.compare(a.x,l.x);if(d!==0)return d;var v=B.compare(a.y,l.y);return v!==0?v:this._dimensionsToTest<=2?0:B.compare(a.z,l.z)},B.prototype.interfaces_=function(){return[q]},B.prototype.getClass=function(){return B},B.compare=function(r,i){return r<i?-1:r>i?1:T.isNaN(r)?T.isNaN(i)?0:-1:T.isNaN(i)?1:0};var j=function(){};j.prototype.create=function(){},j.prototype.interfaces_=function(){return[]},j.prototype.getClass=function(){return j};var J=function(){},Dt={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};J.prototype.interfaces_=function(){return[]},J.prototype.getClass=function(){return J},J.toLocationSymbol=function(r){switch(r){case J.EXTERIOR:return"e";case J.BOUNDARY:return"b";case J.INTERIOR:return"i";case J.NONE:return"-"}throw new R("Unknown location value: "+r)},Dt.INTERIOR.get=function(){return 0},Dt.BOUNDARY.get=function(){return 1},Dt.EXTERIOR.get=function(){return 2},Dt.NONE.get=function(){return-1},Object.defineProperties(J,Dt);var Q=function(r,i){return r.interfaces_&&r.interfaces_().indexOf(i)>-1},At=function(){},Mt={LOG_10:{configurable:!0}};At.prototype.interfaces_=function(){return[]},At.prototype.getClass=function(){return At},At.log10=function(r){var i=Math.log(r);return T.isInfinite(i)||T.isNaN(i)?i:i/At.LOG_10},At.min=function(r,i,a,l){var d=r;return i<d&&(d=i),a<d&&(d=a),l<d&&(d=l),d},At.clamp=function(){if(typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var r=arguments[0],i=arguments[1],a=arguments[2];return r<i?i:r>a?a:r}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var l=arguments[0],d=arguments[1],v=arguments[2];return l<d?d:l>v?v:l}},At.wrap=function(r,i){return r<0?i- -r%i:r%i},At.max=function(){if(arguments.length===3){var r=arguments[0],i=arguments[1],a=arguments[2],l=r;return i>l&&(l=i),a>l&&(l=a),l}if(arguments.length===4){var d=arguments[0],v=arguments[1],M=arguments[2],L=arguments[3],H=d;return v>H&&(H=v),M>H&&(H=M),L>H&&(H=L),H}},At.average=function(r,i){return(r+i)/2},Mt.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(At,Mt);var Rt=function(r){this.str=r};Rt.prototype.append=function(r){this.str+=r},Rt.prototype.setCharAt=function(r,i){this.str=this.str.substr(0,r)+i+this.str.substr(r+1)},Rt.prototype.toString=function(r){return this.str};var pt=function(r){this.value=r};pt.prototype.intValue=function(){return this.value},pt.prototype.compareTo=function(r){return this.value<r?-1:this.value>r?1:0},pt.isNaN=function(r){return Number.isNaN(r)};var yt=function(){};yt.isWhitespace=function(r){return r<=32&&r>=0||r===127},yt.toUpperCase=function(r){return r.toUpperCase()};var K=function r(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var i=arguments[0];this.init(i)}else if(arguments[0]instanceof r){var a=arguments[0];this.init(a)}else if(typeof arguments[0]=="string"){var l=arguments[0];r.call(this,r.parse(l))}}else if(arguments.length===2){var d=arguments[0],v=arguments[1];this.init(d,v)}},Bt={PI:{configurable:!0},TWO_PI:{configurable:!0},PI_2:{configurable:!0},E:{configurable:!0},NaN:{configurable:!0},EPS:{configurable:!0},SPLIT:{configurable:!0},MAX_PRINT_DIGITS:{configurable:!0},TEN:{configurable:!0},ONE:{configurable:!0},SCI_NOT_EXPONENT_CHAR:{configurable:!0},SCI_NOT_ZERO:{configurable:!0}};K.prototype.le=function(r){return(this._hi<r._hi||this._hi===r._hi)&&this._lo<=r._lo},K.prototype.extractSignificantDigits=function(r,i){var a=this.abs(),l=K.magnitude(a._hi),d=K.TEN.pow(l);(a=a.divide(d)).gt(K.TEN)?(a=a.divide(K.TEN),l+=1):a.lt(K.ONE)&&(a=a.multiply(K.TEN),l-=1);for(var v=l+1,M=new Rt,L=K.MAX_PRINT_DIGITS-1,H=0;H<=L;H++){r&&H===v&&M.append(".");var it=Math.trunc(a._hi);if(it<0)break;var bt=!1,Tt=0;it>9?(bt=!0,Tt="9"):Tt="0"+it,M.append(Tt),a=a.subtract(K.valueOf(it)).multiply(K.TEN),bt&&a.selfAdd(K.TEN);var Jt=!0,Qt=K.magnitude(a._hi);if(Qt<0&&Math.abs(Qt)>=L-H&&(Jt=!1),!Jt)break}return i[0]=l,M.toString()},K.prototype.sqr=function(){return this.multiply(this)},K.prototype.doubleValue=function(){return this._hi+this._lo},K.prototype.subtract=function(){if(arguments[0]instanceof K){var r=arguments[0];return this.add(r.negate())}if(typeof arguments[0]=="number"){var i=arguments[0];return this.add(-i)}},K.prototype.equals=function(){if(arguments.length===1){var r=arguments[0];return this._hi===r._hi&&this._lo===r._lo}},K.prototype.isZero=function(){return this._hi===0&&this._lo===0},K.prototype.selfSubtract=function(){if(arguments[0]instanceof K){var r=arguments[0];return this.isNaN()?this:this.selfAdd(-r._hi,-r._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.isNaN()?this:this.selfAdd(-i,0)}},K.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},K.prototype.min=function(r){return this.le(r)?this:r},K.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof K){var r=arguments[0];return this.selfDivide(r._hi,r._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.selfDivide(i,0)}}else if(arguments.length===2){var a=arguments[0],l=arguments[1],d=null,v=null,M=null,L=null,H=null,it=null,bt=null,Tt=null;return H=this._hi/a,it=K.SPLIT*H,d=it-H,Tt=K.SPLIT*a,d=it-d,v=H-d,M=Tt-a,bt=H*a,M=Tt-M,L=a-M,Tt=d*M-bt+d*L+v*M+v*L,it=(this._hi-bt-Tt+this._lo-H*l)/a,Tt=H+it,this._hi=Tt,this._lo=H-Tt+it,this}},K.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},K.prototype.divide=function(){if(arguments[0]instanceof K){var r=arguments[0],i=null,a=null,l=null,d=null,v=null,M=null,L=null,H=null;return a=(v=this._hi/r._hi)-(i=(M=K.SPLIT*v)-(i=M-v)),H=i*(l=(H=K.SPLIT*r._hi)-(l=H-r._hi))-(L=v*r._hi)+i*(d=r._hi-l)+a*l+a*d,M=(this._hi-L-H+this._lo-v*r._lo)/r._hi,new K(H=v+M,v-H+M)}if(typeof arguments[0]=="number"){var it=arguments[0];return T.isNaN(it)?K.createNaN():K.copy(this).selfDivide(it,0)}},K.prototype.ge=function(r){return(this._hi>r._hi||this._hi===r._hi)&&this._lo>=r._lo},K.prototype.pow=function(r){if(r===0)return K.valueOf(1);var i=new K(this),a=K.valueOf(1),l=Math.abs(r);if(l>1)for(;l>0;)l%2==1&&a.selfMultiply(i),(l/=2)>0&&(i=i.sqr());else a=i;return r<0?a.reciprocal():a},K.prototype.ceil=function(){if(this.isNaN())return K.NaN;var r=Math.ceil(this._hi),i=0;return r===this._hi&&(i=Math.ceil(this._lo)),new K(r,i)},K.prototype.compareTo=function(r){var i=r;return this._hi<i._hi?-1:this._hi>i._hi?1:this._lo<i._lo?-1:this._lo>i._lo?1:0},K.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},K.prototype.setValue=function(){if(arguments[0]instanceof K){var r=arguments[0];return this.init(r),this}if(typeof arguments[0]=="number"){var i=arguments[0];return this.init(i),this}},K.prototype.max=function(r){return this.ge(r)?this:r},K.prototype.sqrt=function(){if(this.isZero())return K.valueOf(0);if(this.isNegative())return K.NaN;var r=1/Math.sqrt(this._hi),i=this._hi*r,a=K.valueOf(i),l=this.subtract(a.sqr())._hi*(.5*r);return a.add(l)},K.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof K){var r=arguments[0];return this.selfAdd(r._hi,r._lo)}if(typeof arguments[0]=="number"){var i=arguments[0],a=null,l=null,d=null,v=null,M=null,L=null;return d=this._hi+i,M=d-this._hi,v=d-M,v=i-M+(this._hi-v),L=v+this._lo,a=d+L,l=L+(d-a),this._hi=a+l,this._lo=l+(a-this._hi),this}}else if(arguments.length===2){var H=arguments[0],it=arguments[1],bt=null,Tt=null,Jt=null,Qt=null,le=null,Ee=null,On=null;Qt=this._hi+H,Tt=this._lo+it,le=Qt-(Ee=Qt-this._hi),Jt=Tt-(On=Tt-this._lo);var Kn=(bt=Qt+(Ee=(le=H-Ee+(this._hi-le))+Tt))+(Ee=(Jt=it-On+(this._lo-Jt))+(Ee+(Qt-bt))),ci=Ee+(bt-Kn);return this._hi=Kn,this._lo=ci,this}},K.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof K){var r=arguments[0];return this.selfMultiply(r._hi,r._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.selfMultiply(i,0)}}else if(arguments.length===2){var a=arguments[0],l=arguments[1],d=null,v=null,M=null,L=null,H=null,it=null;d=(H=K.SPLIT*this._hi)-this._hi,it=K.SPLIT*a,d=H-d,v=this._hi-d,M=it-a;var bt=(H=this._hi*a)+(it=d*(M=it-M)-H+d*(L=a-M)+v*M+v*L+(this._hi*l+this._lo*a)),Tt=it+(d=H-bt);return this._hi=bt,this._lo=Tt,this}},K.prototype.selfSqr=function(){return this.selfMultiply(this)},K.prototype.floor=function(){if(this.isNaN())return K.NaN;var r=Math.floor(this._hi),i=0;return r===this._hi&&(i=Math.floor(this._lo)),new K(r,i)},K.prototype.negate=function(){return this.isNaN()?this:new K(-this._hi,-this._lo)},K.prototype.clone=function(){},K.prototype.multiply=function(){if(arguments[0]instanceof K){var r=arguments[0];return r.isNaN()?K.createNaN():K.copy(this).selfMultiply(r)}if(typeof arguments[0]=="number"){var i=arguments[0];return T.isNaN(i)?K.createNaN():K.copy(this).selfMultiply(i,0)}},K.prototype.isNaN=function(){return T.isNaN(this._hi)},K.prototype.intValue=function(){return Math.trunc(this._hi)},K.prototype.toString=function(){var r=K.magnitude(this._hi);return r>=-3&&r<=20?this.toStandardNotation():this.toSciNotation()},K.prototype.toStandardNotation=function(){var r=this.getSpecialNumberString();if(r!==null)return r;var i=new Array(1).fill(null),a=this.extractSignificantDigits(!0,i),l=i[0]+1,d=a;if(a.charAt(0)===".")d="0"+a;else if(l<0)d="0."+K.stringOfChar("0",-l)+a;else if(a.indexOf(".")===-1){var v=l-a.length;d=a+K.stringOfChar("0",v)+".0"}return this.isNegative()?"-"+d:d},K.prototype.reciprocal=function(){var r=null,i=null,a=null,l=null,d=null,v=null,M=null,L=null;i=(d=1/this._hi)-(r=(v=K.SPLIT*d)-(r=v-d)),a=(L=K.SPLIT*this._hi)-this._hi;var H=d+(v=(1-(M=d*this._hi)-(L=r*(a=L-a)-M+r*(l=this._hi-a)+i*a+i*l)-d*this._lo)/this._hi);return new K(H,d-H+v)},K.prototype.toSciNotation=function(){if(this.isZero())return K.SCI_NOT_ZERO;var r=this.getSpecialNumberString();if(r!==null)return r;var i=new Array(1).fill(null),a=this.extractSignificantDigits(!1,i),l=K.SCI_NOT_EXPONENT_CHAR+i[0];if(a.charAt(0)==="0")throw new Error("Found leading zero: "+a);var d="";a.length>1&&(d=a.substring(1));var v=a.charAt(0)+"."+d;return this.isNegative()?"-"+v+l:v+l},K.prototype.abs=function(){return this.isNaN()?K.NaN:this.isNegative()?this.negate():new K(this)},K.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0},K.prototype.lt=function(r){return(this._hi<r._hi||this._hi===r._hi)&&this._lo<r._lo},K.prototype.add=function(){if(arguments[0]instanceof K){var r=arguments[0];return K.copy(this).selfAdd(r)}if(typeof arguments[0]=="number"){var i=arguments[0];return K.copy(this).selfAdd(i)}},K.prototype.init=function(){if(arguments.length===1){if(typeof arguments[0]=="number"){var r=arguments[0];this._hi=r,this._lo=0}else if(arguments[0]instanceof K){var i=arguments[0];this._hi=i._hi,this._lo=i._lo}}else if(arguments.length===2){var a=arguments[0],l=arguments[1];this._hi=a,this._lo=l}},K.prototype.gt=function(r){return(this._hi>r._hi||this._hi===r._hi)&&this._lo>r._lo},K.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0},K.prototype.trunc=function(){return this.isNaN()?K.NaN:this.isPositive()?this.floor():this.ceil()},K.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},K.prototype.interfaces_=function(){return[t,W,X]},K.prototype.getClass=function(){return K},K.sqr=function(r){return K.valueOf(r).selfMultiply(r)},K.valueOf=function(){if(typeof arguments[0]=="string"){var r=arguments[0];return K.parse(r)}if(typeof arguments[0]=="number"){var i=arguments[0];return new K(i)}},K.sqrt=function(r){return K.valueOf(r).sqrt()},K.parse=function(r){for(var i=0,a=r.length;yt.isWhitespace(r.charAt(i));)i++;var l=!1;if(i<a){var d=r.charAt(i);d!=="-"&&d!=="+"||(i++,d==="-"&&(l=!0))}for(var v=new K,M=0,L=0,H=0;!(i>=a);){var it=r.charAt(i);if(i++,yt.isDigit(it)){var bt=it-"0";v.selfMultiply(K.TEN),v.selfAdd(bt),M++}else{if(it!=="."){if(it==="e"||it==="E"){var Tt=r.substring(i);try{H=pt.parseInt(Tt)}catch(On){throw On instanceof Error?new Error("Invalid exponent "+Tt+" in string "+r):On}break}throw new Error("Unexpected character '"+it+"' at position "+i+" in string "+r)}L=M}}var Jt=v,Qt=M-L-H;if(Qt===0)Jt=v;else if(Qt>0){var le=K.TEN.pow(Qt);Jt=v.divide(le)}else if(Qt<0){var Ee=K.TEN.pow(-Qt);Jt=v.multiply(Ee)}return l?Jt.negate():Jt},K.createNaN=function(){return new K(T.NaN,T.NaN)},K.copy=function(r){return new K(r)},K.magnitude=function(r){var i=Math.abs(r),a=Math.log(i)/Math.log(10),l=Math.trunc(Math.floor(a));return 10*Math.pow(10,l)<=i&&(l+=1),l},K.stringOfChar=function(r,i){for(var a=new Rt,l=0;l<i;l++)a.append(r);return a.toString()},Bt.PI.get=function(){return new K(3.141592653589793,12246467991473532e-32)},Bt.TWO_PI.get=function(){return new K(6.283185307179586,24492935982947064e-32)},Bt.PI_2.get=function(){return new K(1.5707963267948966,6123233995736766e-32)},Bt.E.get=function(){return new K(2.718281828459045,14456468917292502e-32)},Bt.NaN.get=function(){return new K(T.NaN,T.NaN)},Bt.EPS.get=function(){return 123259516440783e-46},Bt.SPLIT.get=function(){return 134217729},Bt.MAX_PRINT_DIGITS.get=function(){return 32},Bt.TEN.get=function(){return K.valueOf(10)},Bt.ONE.get=function(){return K.valueOf(1)},Bt.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},Bt.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(K,Bt);var Gt=function(){},ae={DP_SAFE_EPSILON:{configurable:!0}};Gt.prototype.interfaces_=function(){return[]},Gt.prototype.getClass=function(){return Gt},Gt.orientationIndex=function(r,i,a){var l=Gt.orientationIndexFilter(r,i,a);if(l<=1)return l;var d=K.valueOf(i.x).selfAdd(-r.x),v=K.valueOf(i.y).selfAdd(-r.y),M=K.valueOf(a.x).selfAdd(-i.x),L=K.valueOf(a.y).selfAdd(-i.y);return d.selfMultiply(L).selfSubtract(v.selfMultiply(M)).signum()},Gt.signOfDet2x2=function(r,i,a,l){return r.multiply(l).selfSubtract(i.multiply(a)).signum()},Gt.intersection=function(r,i,a,l){var d=K.valueOf(l.y).selfSubtract(a.y).selfMultiply(K.valueOf(i.x).selfSubtract(r.x)),v=K.valueOf(l.x).selfSubtract(a.x).selfMultiply(K.valueOf(i.y).selfSubtract(r.y)),M=d.subtract(v),L=K.valueOf(l.x).selfSubtract(a.x).selfMultiply(K.valueOf(r.y).selfSubtract(a.y)),H=K.valueOf(l.y).selfSubtract(a.y).selfMultiply(K.valueOf(r.x).selfSubtract(a.x)),it=L.subtract(H).selfDivide(M).doubleValue(),bt=K.valueOf(r.x).selfAdd(K.valueOf(i.x).selfSubtract(r.x).selfMultiply(it)).doubleValue(),Tt=K.valueOf(i.x).selfSubtract(r.x).selfMultiply(K.valueOf(r.y).selfSubtract(a.y)),Jt=K.valueOf(i.y).selfSubtract(r.y).selfMultiply(K.valueOf(r.x).selfSubtract(a.x)),Qt=Tt.subtract(Jt).selfDivide(M).doubleValue(),le=K.valueOf(a.y).selfAdd(K.valueOf(l.y).selfSubtract(a.y).selfMultiply(Qt)).doubleValue();return new D(bt,le)},Gt.orientationIndexFilter=function(r,i,a){var l=null,d=(r.x-a.x)*(i.y-a.y),v=(r.y-a.y)*(i.x-a.x),M=d-v;if(d>0){if(v<=0)return Gt.signum(M);l=d+v}else{if(!(d<0)||v>=0)return Gt.signum(M);l=-d-v}var L=Gt.DP_SAFE_EPSILON*l;return M>=L||-M>=L?Gt.signum(M):2},Gt.signum=function(r){return r>0?1:r<0?-1:0},ae.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(Gt,ae);var ut=function(){},Ut={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};Ut.X.get=function(){return 0},Ut.Y.get=function(){return 1},Ut.Z.get=function(){return 2},Ut.M.get=function(){return 3},ut.prototype.setOrdinate=function(r,i,a){},ut.prototype.size=function(){},ut.prototype.getOrdinate=function(r,i){},ut.prototype.getCoordinate=function(){},ut.prototype.getCoordinateCopy=function(r){},ut.prototype.getDimension=function(){},ut.prototype.getX=function(r){},ut.prototype.clone=function(){},ut.prototype.expandEnvelope=function(r){},ut.prototype.copy=function(){},ut.prototype.getY=function(r){},ut.prototype.toCoordinateArray=function(){},ut.prototype.interfaces_=function(){return[X]},ut.prototype.getClass=function(){return ut},Object.defineProperties(ut,Ut);var jt=function(){},ce=function(r){function i(){r.call(this,"Projective point not representable on the Cartesian plane.")}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(jt),te=function(){};te.arraycopy=function(r,i,a,l,d){for(var v=0,M=i;M<i+d;M++)a[l+v]=r[M],v++},te.getProperty=function(r){return{"line.separator":\`
@@ -7742,7 +7742,7 @@ void main() {
7742
7742
 
7743
7743
  }\`,fm=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e,o){if(this.texture===null){let a=new Vi,l=t.properties.get(a);l.__webglTexture=e.texture,(e.depthNear!=o.depthNear||e.depthFar!=o.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=a}}render(t,e){if(this.texture!==null){if(this.mesh===null){let o=e.cameras[0].viewport,a=new Ao({extensions:{fragDepth:!0},vertexShader:gF,fragmentShader:yF,uniforms:{depthColor:{value:this.texture},depthWidth:{value:o.z},depthHeight:{value:o.w}}});this.mesh=new fo(new Pf(20,20),a)}t.render(this.mesh,e)}}reset(){this.texture=null,this.mesh=null}},hm=class extends Rs{constructor(t,e){super();let o=this,a=null,l=1,h=null,f="local-floor",p=1,d=null,g=null,x=null,v=null,S=null,b=null,T=new fm,_=e.getContextAttributes(),y=null,A=null,M=[],L=[],G=new un,z=null,F=new Ri;F.layers.enable(1),F.viewport=new Br;let I=new Ri;I.layers.enable(2),I.viewport=new Br;let ut=[F,I],R=new cm;R.layers.enable(1),R.layers.enable(2);let W=null,V=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(tt){let wt=M[tt];return wt===void 0&&(wt=new Ml,M[tt]=wt),wt.getTargetRaySpace()},this.getControllerGrip=function(tt){let wt=M[tt];return wt===void 0&&(wt=new Ml,M[tt]=wt),wt.getGripSpace()},this.getHand=function(tt){let wt=M[tt];return wt===void 0&&(wt=new Ml,M[tt]=wt),wt.getHandSpace()};function St(tt){let wt=L.indexOf(tt.inputSource);if(wt===-1)return;let Bt=M[wt];Bt!==void 0&&(Bt.update(tt.inputSource,tt.frame,d||h),Bt.dispatchEvent({type:tt.type,data:tt.inputSource}))}function X(){a.removeEventListener("select",St),a.removeEventListener("selectstart",St),a.removeEventListener("selectend",St),a.removeEventListener("squeeze",St),a.removeEventListener("squeezestart",St),a.removeEventListener("squeezeend",St),a.removeEventListener("end",X),a.removeEventListener("inputsourceschange",mt);for(let tt=0;tt<M.length;tt++){let wt=L[tt];wt!==null&&(L[tt]=null,M[tt].disconnect(wt))}W=null,V=null,T.reset(),t.setRenderTarget(y),S=null,v=null,x=null,a=null,A=null,Yt.stop(),o.isPresenting=!1,t.setPixelRatio(z),t.setSize(G.width,G.height,!1),o.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(tt){l=tt,o.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(tt){f=tt,o.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return d||h},this.setReferenceSpace=function(tt){d=tt},this.getBaseLayer=function(){return v!==null?v:S},this.getBinding=function(){return x},this.getFrame=function(){return b},this.getSession=function(){return a},this.setSession=function(tt){return oc(this,null,function*(){if(a=tt,a!==null){if(y=t.getRenderTarget(),a.addEventListener("select",St),a.addEventListener("selectstart",St),a.addEventListener("selectend",St),a.addEventListener("squeeze",St),a.addEventListener("squeezestart",St),a.addEventListener("squeezeend",St),a.addEventListener("end",X),a.addEventListener("inputsourceschange",mt),_.xrCompatible!==!0&&(yield e.makeXRCompatible()),z=t.getPixelRatio(),t.getSize(G),a.renderState.layers===void 0||t.capabilities.isWebGL2===!1){let wt={antialias:a.renderState.layers===void 0?_.antialias:!0,alpha:!0,depth:_.depth,stencil:_.stencil,framebufferScaleFactor:l};S=new XRWebGLLayer(a,e,wt),a.updateRenderState({baseLayer:S}),t.setPixelRatio(1),t.setSize(S.framebufferWidth,S.framebufferHeight,!1),A=new ss(S.framebufferWidth,S.framebufferHeight,{format:co,type:Ps,colorSpace:t.outputColorSpace,stencilBuffer:_.stencil})}else{let wt=null,Bt=null,$t=null;_.depth&&($t=_.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,wt=_.stencil?yu:ha,Bt=_.stencil?fa:Ts);let Ut={colorFormat:e.RGBA8,depthFormat:$t,scaleFactor:l};x=new XRWebGLBinding(a,e),v=x.createProjectionLayer(Ut),a.updateRenderState({layers:[v]}),t.setPixelRatio(1),t.setSize(v.textureWidth,v.textureHeight,!1),A=new ss(v.textureWidth,v.textureHeight,{format:co,type:Ps,depthTexture:new Rf(v.textureWidth,v.textureHeight,Bt,void 0,void 0,void 0,void 0,void 0,void 0,wt),stencilBuffer:_.stencil,colorSpace:t.outputColorSpace,samples:_.antialias?4:0});let Dt=t.properties.get(A);Dt.__ignoreDepthValues=v.ignoreDepthValues}A.isXRRenderTarget=!0,this.setFoveation(p),d=null,h=yield a.requestReferenceSpace(f),Yt.setContext(a),Yt.start(),o.isPresenting=!0,o.dispatchEvent({type:"sessionstart"})}})},this.getEnvironmentBlendMode=function(){if(a!==null)return a.environmentBlendMode};function mt(tt){for(let wt=0;wt<tt.removed.length;wt++){let Bt=tt.removed[wt],$t=L.indexOf(Bt);$t>=0&&(L[$t]=null,M[$t].disconnect(Bt))}for(let wt=0;wt<tt.added.length;wt++){let Bt=tt.added[wt],$t=L.indexOf(Bt);if($t===-1){for(let Dt=0;Dt<M.length;Dt++)if(Dt>=L.length){L.push(Bt),$t=Dt;break}else if(L[Dt]===null){L[Dt]=Bt,$t=Dt;break}if($t===-1)break}let Ut=M[$t];Ut&&Ut.connect(Bt)}}let dt=new xt,vt=new xt;function rt(tt,wt,Bt){dt.setFromMatrixPosition(wt.matrixWorld),vt.setFromMatrixPosition(Bt.matrixWorld);let $t=dt.distanceTo(vt),Ut=wt.projectionMatrix.elements,Dt=Bt.projectionMatrix.elements,At=Ut[14]/(Ut[10]-1),te=Ut[14]/(Ut[10]+1),nt=(Ut[9]+1)/Ut[5],on=(Ut[9]-1)/Ut[5],zt=(Ut[8]-1)/Ut[0],ne=(Dt[8]+1)/Dt[0],Wt=At*zt,ie=At*ne,ce=$t/(-zt+ne),Lt=ce*-zt;wt.matrixWorld.decompose(tt.position,tt.quaternion,tt.scale),tt.translateX(Lt),tt.translateZ(ce),tt.matrixWorld.compose(tt.position,tt.quaternion,tt.scale),tt.matrixWorldInverse.copy(tt.matrixWorld).invert();let se=At+ce,Y=te+ce,N=Wt-Lt,_t=ie+($t-Lt),Et=nt*te/Y*se,it=on*te/Y*se;tt.projectionMatrix.makePerspective(N,_t,Et,it,se,Y),tt.projectionMatrixInverse.copy(tt.projectionMatrix).invert()}function lt(tt,wt){wt===null?tt.matrixWorld.copy(tt.matrix):tt.matrixWorld.multiplyMatrices(wt.matrixWorld,tt.matrix),tt.matrixWorldInverse.copy(tt.matrixWorld).invert()}this.updateCamera=function(tt){if(a===null)return;T.texture!==null&&(tt.near=T.depthNear,tt.far=T.depthFar),R.near=I.near=F.near=tt.near,R.far=I.far=F.far=tt.far,(W!==R.near||V!==R.far)&&(a.updateRenderState({depthNear:R.near,depthFar:R.far}),W=R.near,V=R.far,F.near=W,F.far=V,I.near=W,I.far=V,F.updateProjectionMatrix(),I.updateProjectionMatrix(),tt.updateProjectionMatrix());let wt=tt.parent,Bt=R.cameras;lt(R,wt);for(let $t=0;$t<Bt.length;$t++)lt(Bt[$t],wt);Bt.length===2?rt(R,F,I):R.projectionMatrix.copy(F.projectionMatrix),H(tt,R,wt)};function H(tt,wt,Bt){Bt===null?tt.matrix.copy(wt.matrixWorld):(tt.matrix.copy(Bt.matrixWorld),tt.matrix.invert(),tt.matrix.multiply(wt.matrixWorld)),tt.matrix.decompose(tt.position,tt.quaternion,tt.scale),tt.updateMatrixWorld(!0),tt.projectionMatrix.copy(wt.projectionMatrix),tt.projectionMatrixInverse.copy(wt.projectionMatrixInverse),tt.isPerspectiveCamera&&(tt.fov=$d*2*Math.atan(1/tt.projectionMatrix.elements[5]),tt.zoom=1)}this.getCamera=function(){return R},this.getFoveation=function(){if(!(v===null&&S===null))return p},this.setFoveation=function(tt){p=tt,v!==null&&(v.fixedFoveation=tt),S!==null&&S.fixedFoveation!==void 0&&(S.fixedFoveation=tt)},this.hasDepthSensing=function(){return T.texture!==null};let bt=null;function Tt(tt,wt){if(g=wt.getViewerPose(d||h),b=wt,g!==null){let Bt=g.views;S!==null&&(t.setRenderTargetFramebuffer(A,S.framebuffer),t.setRenderTarget(A));let $t=!1;Bt.length!==R.cameras.length&&(R.cameras.length=0,$t=!0);for(let Dt=0;Dt<Bt.length;Dt++){let At=Bt[Dt],te=null;if(S!==null)te=S.getViewport(At);else{let on=x.getViewSubImage(v,At);te=on.viewport,Dt===0&&(t.setRenderTargetTextures(A,on.colorTexture,v.ignoreDepthValues?void 0:on.depthStencilTexture),t.setRenderTarget(A))}let nt=ut[Dt];nt===void 0&&(nt=new Ri,nt.layers.enable(Dt),nt.viewport=new Br,ut[Dt]=nt),nt.matrix.fromArray(At.transform.matrix),nt.matrix.decompose(nt.position,nt.quaternion,nt.scale),nt.projectionMatrix.fromArray(At.projectionMatrix),nt.projectionMatrixInverse.copy(nt.projectionMatrix).invert(),nt.viewport.set(te.x,te.y,te.width,te.height),Dt===0&&(R.matrix.copy(nt.matrix),R.matrix.decompose(R.position,R.quaternion,R.scale)),$t===!0&&R.cameras.push(nt)}let Ut=a.enabledFeatures;if(Ut&&Ut.includes("depth-sensing")){let Dt=x.getDepthInformation(Bt[0]);Dt&&Dt.isValid&&Dt.texture&&T.init(t,Dt,a.renderState)}}for(let Bt=0;Bt<M.length;Bt++){let $t=L[Bt],Ut=M[Bt];$t!==null&&Ut!==void 0&&Ut.update($t,wt,d||h)}T.render(t,R),bt&&bt(tt,wt),wt.detectedPlanes&&o.dispatchEvent({type:"planesdetected",data:wt}),b=null}let Yt=new FE;Yt.setAnimationLoop(Tt),this.setAnimationLoop=function(tt){bt=tt},this.dispose=function(){}}},sa=new da,vF=new Tr;function _F(r,t){function e(_,y){_.matrixAutoUpdate===!0&&_.updateMatrix(),y.value.copy(_.matrix)}function o(_,y){y.color.getRGB(_.fogColor.value,DE(r)),y.isFog?(_.fogNear.value=y.near,_.fogFar.value=y.far):y.isFogExp2&&(_.fogDensity.value=y.density)}function a(_,y,A,M,L){y.isMeshBasicMaterial||y.isMeshLambertMaterial?l(_,y):y.isMeshToonMaterial?(l(_,y),x(_,y)):y.isMeshPhongMaterial?(l(_,y),g(_,y)):y.isMeshStandardMaterial?(l(_,y),v(_,y),y.isMeshPhysicalMaterial&&S(_,y,L)):y.isMeshMatcapMaterial?(l(_,y),b(_,y)):y.isMeshDepthMaterial?l(_,y):y.isMeshDistanceMaterial?(l(_,y),T(_,y)):y.isMeshNormalMaterial?l(_,y):y.isLineBasicMaterial?(h(_,y),y.isLineDashedMaterial&&f(_,y)):y.isPointsMaterial?p(_,y,A,M):y.isSpriteMaterial?d(_,y):y.isShadowMaterial?(_.color.value.copy(y.color),_.opacity.value=y.opacity):y.isShaderMaterial&&(y.uniformsNeedUpdate=!1)}function l(_,y){_.opacity.value=y.opacity,y.color&&_.diffuse.value.copy(y.color),y.emissive&&_.emissive.value.copy(y.emissive).multiplyScalar(y.emissiveIntensity),y.map&&(_.map.value=y.map,e(y.map,_.mapTransform)),y.alphaMap&&(_.alphaMap.value=y.alphaMap,e(y.alphaMap,_.alphaMapTransform)),y.bumpMap&&(_.bumpMap.value=y.bumpMap,e(y.bumpMap,_.bumpMapTransform),_.bumpScale.value=y.bumpScale,y.side===xi&&(_.bumpScale.value*=-1)),y.normalMap&&(_.normalMap.value=y.normalMap,e(y.normalMap,_.normalMapTransform),_.normalScale.value.copy(y.normalScale),y.side===xi&&_.normalScale.value.negate()),y.displacementMap&&(_.displacementMap.value=y.displacementMap,e(y.displacementMap,_.displacementMapTransform),_.displacementScale.value=y.displacementScale,_.displacementBias.value=y.displacementBias),y.emissiveMap&&(_.emissiveMap.value=y.emissiveMap,e(y.emissiveMap,_.emissiveMapTransform)),y.specularMap&&(_.specularMap.value=y.specularMap,e(y.specularMap,_.specularMapTransform)),y.alphaTest>0&&(_.alphaTest.value=y.alphaTest);let A=t.get(y),M=A.envMap,L=A.envMapRotation;if(M&&(_.envMap.value=M,sa.copy(L),sa.x*=-1,sa.y*=-1,sa.z*=-1,M.isCubeTexture&&M.isRenderTargetTexture===!1&&(sa.y*=-1,sa.z*=-1),_.envMapRotation.value.setFromMatrix4(vF.makeRotationFromEuler(sa)),_.flipEnvMap.value=M.isCubeTexture&&M.isRenderTargetTexture===!1?-1:1,_.reflectivity.value=y.reflectivity,_.ior.value=y.ior,_.refractionRatio.value=y.refractionRatio),y.lightMap){_.lightMap.value=y.lightMap;let G=r._useLegacyLights===!0?Math.PI:1;_.lightMapIntensity.value=y.lightMapIntensity*G,e(y.lightMap,_.lightMapTransform)}y.aoMap&&(_.aoMap.value=y.aoMap,_.aoMapIntensity.value=y.aoMapIntensity,e(y.aoMap,_.aoMapTransform))}function h(_,y){_.diffuse.value.copy(y.color),_.opacity.value=y.opacity,y.map&&(_.map.value=y.map,e(y.map,_.mapTransform))}function f(_,y){_.dashSize.value=y.dashSize,_.totalSize.value=y.dashSize+y.gapSize,_.scale.value=y.scale}function p(_,y,A,M){_.diffuse.value.copy(y.color),_.opacity.value=y.opacity,_.size.value=y.size*A,_.scale.value=M*.5,y.map&&(_.map.value=y.map,e(y.map,_.uvTransform)),y.alphaMap&&(_.alphaMap.value=y.alphaMap,e(y.alphaMap,_.alphaMapTransform)),y.alphaTest>0&&(_.alphaTest.value=y.alphaTest)}function d(_,y){_.diffuse.value.copy(y.color),_.opacity.value=y.opacity,_.rotation.value=y.rotation,y.map&&(_.map.value=y.map,e(y.map,_.mapTransform)),y.alphaMap&&(_.alphaMap.value=y.alphaMap,e(y.alphaMap,_.alphaMapTransform)),y.alphaTest>0&&(_.alphaTest.value=y.alphaTest)}function g(_,y){_.specular.value.copy(y.specular),_.shininess.value=Math.max(y.shininess,1e-4)}function x(_,y){y.gradientMap&&(_.gradientMap.value=y.gradientMap)}function v(_,y){_.metalness.value=y.metalness,y.metalnessMap&&(_.metalnessMap.value=y.metalnessMap,e(y.metalnessMap,_.metalnessMapTransform)),_.roughness.value=y.roughness,y.roughnessMap&&(_.roughnessMap.value=y.roughnessMap,e(y.roughnessMap,_.roughnessMapTransform)),t.get(y).envMap&&(_.envMapIntensity.value=y.envMapIntensity)}function S(_,y,A){_.ior.value=y.ior,y.sheen>0&&(_.sheenColor.value.copy(y.sheenColor).multiplyScalar(y.sheen),_.sheenRoughness.value=y.sheenRoughness,y.sheenColorMap&&(_.sheenColorMap.value=y.sheenColorMap,e(y.sheenColorMap,_.sheenColorMapTransform)),y.sheenRoughnessMap&&(_.sheenRoughnessMap.value=y.sheenRoughnessMap,e(y.sheenRoughnessMap,_.sheenRoughnessMapTransform))),y.clearcoat>0&&(_.clearcoat.value=y.clearcoat,_.clearcoatRoughness.value=y.clearcoatRoughness,y.clearcoatMap&&(_.clearcoatMap.value=y.clearcoatMap,e(y.clearcoatMap,_.clearcoatMapTransform)),y.clearcoatRoughnessMap&&(_.clearcoatRoughnessMap.value=y.clearcoatRoughnessMap,e(y.clearcoatRoughnessMap,_.clearcoatRoughnessMapTransform)),y.clearcoatNormalMap&&(_.clearcoatNormalMap.value=y.clearcoatNormalMap,e(y.clearcoatNormalMap,_.clearcoatNormalMapTransform),_.clearcoatNormalScale.value.copy(y.clearcoatNormalScale),y.side===xi&&_.clearcoatNormalScale.value.negate())),y.iridescence>0&&(_.iridescence.value=y.iridescence,_.iridescenceIOR.value=y.iridescenceIOR,_.iridescenceThicknessMinimum.value=y.iridescenceThicknessRange[0],_.iridescenceThicknessMaximum.value=y.iridescenceThicknessRange[1],y.iridescenceMap&&(_.iridescenceMap.value=y.iridescenceMap,e(y.iridescenceMap,_.iridescenceMapTransform)),y.iridescenceThicknessMap&&(_.iridescenceThicknessMap.value=y.iridescenceThicknessMap,e(y.iridescenceThicknessMap,_.iridescenceThicknessMapTransform))),y.transmission>0&&(_.transmission.value=y.transmission,_.transmissionSamplerMap.value=A.texture,_.transmissionSamplerSize.value.set(A.width,A.height),y.transmissionMap&&(_.transmissionMap.value=y.transmissionMap,e(y.transmissionMap,_.transmissionMapTransform)),_.thickness.value=y.thickness,y.thicknessMap&&(_.thicknessMap.value=y.thicknessMap,e(y.thicknessMap,_.thicknessMapTransform)),_.attenuationDistance.value=y.attenuationDistance,_.attenuationColor.value.copy(y.attenuationColor)),y.anisotropy>0&&(_.anisotropyVector.value.set(y.anisotropy*Math.cos(y.anisotropyRotation),y.anisotropy*Math.sin(y.anisotropyRotation)),y.anisotropyMap&&(_.anisotropyMap.value=y.anisotropyMap,e(y.anisotropyMap,_.anisotropyMapTransform))),_.specularIntensity.value=y.specularIntensity,_.specularColor.value.copy(y.specularColor),y.specularColorMap&&(_.specularColorMap.value=y.specularColorMap,e(y.specularColorMap,_.specularColorMapTransform)),y.specularIntensityMap&&(_.specularIntensityMap.value=y.specularIntensityMap,e(y.specularIntensityMap,_.specularIntensityMapTransform))}function b(_,y){y.matcap&&(_.matcap.value=y.matcap)}function T(_,y){let A=t.get(y).light;_.referencePosition.value.setFromMatrixPosition(A.matrixWorld),_.nearDistance.value=A.shadow.camera.near,_.farDistance.value=A.shadow.camera.far}return{refreshFogUniforms:o,refreshMaterialUniforms:a}}function xF(r,t,e,o){let a={},l={},h=[],f=e.isWebGL2?r.getParameter(r.MAX_UNIFORM_BUFFER_BINDINGS):0;function p(A,M){let L=M.program;o.uniformBlockBinding(A,L)}function d(A,M){let L=a[A.id];L===void 0&&(b(A),L=g(A),a[A.id]=L,A.addEventListener("dispose",_));let G=M.program;o.updateUBOMapping(A,G);let z=t.render.frame;l[A.id]!==z&&(v(A),l[A.id]=z)}function g(A){let M=x();A.__bindingPointIndex=M;let L=r.createBuffer(),G=A.__size,z=A.usage;return r.bindBuffer(r.UNIFORM_BUFFER,L),r.bufferData(r.UNIFORM_BUFFER,G,z),r.bindBuffer(r.UNIFORM_BUFFER,null),r.bindBufferBase(r.UNIFORM_BUFFER,M,L),L}function x(){for(let A=0;A<f;A++)if(h.indexOf(A)===-1)return h.push(A),A;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function v(A){let M=a[A.id],L=A.uniforms,G=A.__cache;r.bindBuffer(r.UNIFORM_BUFFER,M);for(let z=0,F=L.length;z<F;z++){let I=Array.isArray(L[z])?L[z]:[L[z]];for(let ut=0,R=I.length;ut<R;ut++){let W=I[ut];if(S(W,z,ut,G)===!0){let V=W.__offset,St=Array.isArray(W.value)?W.value:[W.value],X=0;for(let mt=0;mt<St.length;mt++){let dt=St[mt],vt=T(dt);typeof dt=="number"||typeof dt=="boolean"?(W.__data[0]=dt,r.bufferSubData(r.UNIFORM_BUFFER,V+X,W.__data)):dt.isMatrix3?(W.__data[0]=dt.elements[0],W.__data[1]=dt.elements[1],W.__data[2]=dt.elements[2],W.__data[3]=0,W.__data[4]=dt.elements[3],W.__data[5]=dt.elements[4],W.__data[6]=dt.elements[5],W.__data[7]=0,W.__data[8]=dt.elements[6],W.__data[9]=dt.elements[7],W.__data[10]=dt.elements[8],W.__data[11]=0):(dt.toArray(W.__data,X),X+=vt.storage/Float32Array.BYTES_PER_ELEMENT)}r.bufferSubData(r.UNIFORM_BUFFER,V,W.__data)}}}r.bindBuffer(r.UNIFORM_BUFFER,null)}function S(A,M,L,G){let z=A.value,F=M+"_"+L;if(G[F]===void 0)return typeof z=="number"||typeof z=="boolean"?G[F]=z:G[F]=z.clone(),!0;{let I=G[F];if(typeof z=="number"||typeof z=="boolean"){if(I!==z)return G[F]=z,!0}else if(I.equals(z)===!1)return I.copy(z),!0}return!1}function b(A){let M=A.uniforms,L=0,G=16;for(let F=0,I=M.length;F<I;F++){let ut=Array.isArray(M[F])?M[F]:[M[F]];for(let R=0,W=ut.length;R<W;R++){let V=ut[R],St=Array.isArray(V.value)?V.value:[V.value];for(let X=0,mt=St.length;X<mt;X++){let dt=St[X],vt=T(dt),rt=L%G;rt!==0&&G-rt<vt.boundary&&(L+=G-rt),V.__data=new Float32Array(vt.storage/Float32Array.BYTES_PER_ELEMENT),V.__offset=L,L+=vt.storage}}}let z=L%G;return z>0&&(L+=G-z),A.__size=L,A.__cache={},this}function T(A){let M={boundary:0,storage:0};return typeof A=="number"||typeof A=="boolean"?(M.boundary=4,M.storage=4):A.isVector2?(M.boundary=8,M.storage=8):A.isVector3||A.isColor?(M.boundary=16,M.storage=12):A.isVector4?(M.boundary=16,M.storage=16):A.isMatrix3?(M.boundary=48,M.storage=48):A.isMatrix4?(M.boundary=64,M.storage=64):A.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",A),M}function _(A){let M=A.target;M.removeEventListener("dispose",_);let L=h.indexOf(M.__bindingPointIndex);h.splice(L,1),r.deleteBuffer(a[M.id]),delete a[M.id],delete l[M.id]}function y(){for(let A in a)r.deleteBuffer(a[A]);h=[],a={},l={}}return{bind:p,update:d,dispose:y}}var pm=class{constructor(t={}){let{canvas:e=MN(),context:o=null,depth:a=!0,stencil:l=!0,alpha:h=!1,antialias:f=!1,premultipliedAlpha:p=!0,preserveDrawingBuffer:d=!1,powerPreference:g="default",failIfMajorPerformanceCaveat:x=!1}=t;this.isWebGLRenderer=!0;let v;o!==null?v=o.getContextAttributes().alpha:v=h;let S=new Uint32Array(4),b=new Int32Array(4),T=null,_=null,y=[],A=[];this.domElement=e,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=wo,this._useLegacyLights=!1,this.toneMapping=Cs,this.toneMappingExposure=1;let M=this,L=!1,G=0,z=0,F=null,I=-1,ut=null,R=new Br,W=new Br,V=null,St=new En(0),X=0,mt=e.width,dt=e.height,vt=1,rt=null,lt=null,H=new Br(0,0,mt,dt),bt=new Br(0,0,mt,dt),Tt=!1,Yt=new Cf,tt=!1,wt=!1,Bt=null,$t=new Tr,Ut=new un,Dt=new xt,At={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function te(){return F===null?vt:1}let nt=o;function on(q,ot){for(let yt=0;yt<q.length;yt++){let ht=q[yt],at=e.getContext(ht,ot);if(at!==null)return at}return null}try{let q={alpha:!0,depth:a,stencil:l,antialias:f,premultipliedAlpha:p,preserveDrawingBuffer:d,powerPreference:g,failIfMajorPerformanceCaveat:x};if("setAttribute"in e&&e.setAttribute("data-engine",\`three.js r\${bm}\`),e.addEventListener("webglcontextlost",ct,!1),e.addEventListener("webglcontextrestored",O,!1),e.addEventListener("webglcontextcreationerror",K,!1),nt===null){let ot=["webgl2","webgl","experimental-webgl"];if(M.isWebGL1Renderer===!0&&ot.shift(),nt=on(ot,q),nt===null)throw on(ot)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext!="undefined"&&nt instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),nt.getShaderPrecisionFormat===void 0&&(nt.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(q){throw console.error("THREE.WebGLRenderer: "+q.message),q}let zt,ne,Wt,ie,ce,Lt,se,Y,N,_t,Et,it,Pt,ue,Ct,Ot,qt,J,w,P,D,k,B,et;function j(){zt=new FD(nt),ne=new ID(nt,zt,t),zt.init(ne),k=new dF(nt,zt,ne),Wt=new hF(nt,zt,ne),ie=new zD(nt),ce=new tF,Lt=new pF(nt,zt,Wt,ce,ne,k,ie),se=new LD(M),Y=new DD(M),N=new WN(nt,ne),B=new CD(nt,zt,N,ne),_t=new UD(nt,N,ie,B),Et=new VD(nt,_t,N,ie),w=new qD(nt,ne,Lt),Ot=new RD(ce),it=new Q3(M,se,Y,zt,ne,B,Ot),Pt=new _F(M,ce),ue=new nF,Ct=new uF(zt,ne),J=new AD(M,se,Y,Wt,Et,v,p),qt=new fF(M,Et,ne),et=new xF(nt,ie,ne,Wt),P=new PD(nt,zt,ie,ne),D=new BD(nt,zt,ie,ne),ie.programs=it.programs,M.capabilities=ne,M.extensions=zt,M.properties=ce,M.renderLists=ue,M.shadowMap=qt,M.state=Wt,M.info=ie}j();let ft=new hm(M,nt);this.xr=ft,this.getContext=function(){return nt},this.getContextAttributes=function(){return nt.getContextAttributes()},this.forceContextLoss=function(){let q=zt.get("WEBGL_lose_context");q&&q.loseContext()},this.forceContextRestore=function(){let q=zt.get("WEBGL_lose_context");q&&q.restoreContext()},this.getPixelRatio=function(){return vt},this.setPixelRatio=function(q){q!==void 0&&(vt=q,this.setSize(mt,dt,!1))},this.getSize=function(q){return q.set(mt,dt)},this.setSize=function(q,ot,yt=!0){if(ft.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}mt=q,dt=ot,e.width=Math.floor(q*vt),e.height=Math.floor(ot*vt),yt===!0&&(e.style.width=q+"px",e.style.height=ot+"px"),this.setViewport(0,0,q,ot)},this.getDrawingBufferSize=function(q){return q.set(mt*vt,dt*vt).floor()},this.setDrawingBufferSize=function(q,ot,yt){mt=q,dt=ot,vt=yt,e.width=Math.floor(q*yt),e.height=Math.floor(ot*yt),this.setViewport(0,0,q,ot)},this.getCurrentViewport=function(q){return q.copy(R)},this.getViewport=function(q){return q.copy(H)},this.setViewport=function(q,ot,yt,ht){q.isVector4?H.set(q.x,q.y,q.z,q.w):H.set(q,ot,yt,ht),Wt.viewport(R.copy(H).multiplyScalar(vt).round())},this.getScissor=function(q){return q.copy(bt)},this.setScissor=function(q,ot,yt,ht){q.isVector4?bt.set(q.x,q.y,q.z,q.w):bt.set(q,ot,yt,ht),Wt.scissor(W.copy(bt).multiplyScalar(vt).round())},this.getScissorTest=function(){return Tt},this.setScissorTest=function(q){Wt.setScissorTest(Tt=q)},this.setOpaqueSort=function(q){rt=q},this.setTransparentSort=function(q){lt=q},this.getClearColor=function(q){return q.copy(J.getClearColor())},this.setClearColor=function(){J.setClearColor.apply(J,arguments)},this.getClearAlpha=function(){return J.getClearAlpha()},this.setClearAlpha=function(){J.setClearAlpha.apply(J,arguments)},this.clear=function(q=!0,ot=!0,yt=!0){let ht=0;if(q){let at=!1;if(F!==null){let Ht=F.texture.format;at=Ht===IE||Ht===PE||Ht===CE}if(at){let Ht=F.texture.type,Xt=Ht===Ps||Ht===Ts||Ht===Tm||Ht===fa||Ht===TE||Ht===AE,re=J.getClearColor(),Zt=J.getClearAlpha(),me=re.r,oe=re.g,ae=re.b;Xt?(S[0]=me,S[1]=oe,S[2]=ae,S[3]=Zt,nt.clearBufferuiv(nt.COLOR,0,S)):(b[0]=me,b[1]=oe,b[2]=ae,b[3]=Zt,nt.clearBufferiv(nt.COLOR,0,b))}else ht|=nt.COLOR_BUFFER_BIT}ot&&(ht|=nt.DEPTH_BUFFER_BIT),yt&&(ht|=nt.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),nt.clear(ht)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",ct,!1),e.removeEventListener("webglcontextrestored",O,!1),e.removeEventListener("webglcontextcreationerror",K,!1),ue.dispose(),Ct.dispose(),ce.dispose(),se.dispose(),Y.dispose(),Et.dispose(),B.dispose(),et.dispose(),it.dispose(),ft.dispose(),ft.removeEventListener("sessionstart",xe),ft.removeEventListener("sessionend",de),Bt&&(Bt.dispose(),Bt=null),Se.stop()};function ct(q){q.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),L=!0}function O(){console.log("THREE.WebGLRenderer: Context Restored."),L=!1;let q=ie.autoReset,ot=qt.enabled,yt=qt.autoUpdate,ht=qt.needsUpdate,at=qt.type;j(),ie.autoReset=q,qt.enabled=ot,qt.autoUpdate=yt,qt.needsUpdate=ht,qt.type=at}function K(q){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",q.statusMessage)}function $(q){let ot=q.target;ot.removeEventListener("dispose",$),Q(ot)}function Q(q){Mt(q),ce.remove(q)}function Mt(q){let ot=ce.get(q).programs;ot!==void 0&&(ot.forEach(function(yt){it.releaseProgram(yt)}),q.isShaderMaterial&&it.releaseShaderCache(q))}this.renderBufferDirect=function(q,ot,yt,ht,at,Ht){ot===null&&(ot=At);let Xt=at.isMesh&&at.matrixWorld.determinant()<0,re=xn(q,ot,yt,ht,at);Wt.setMaterial(ht,Xt);let Zt=yt.index,me=1;if(ht.wireframe===!0){if(Zt=_t.getWireframeAttribute(yt),Zt===void 0)return;me=2}let oe=yt.drawRange,ae=yt.attributes.position,sn=oe.start*me,gr=(oe.start+oe.count)*me;Ht!==null&&(sn=Math.max(sn,Ht.start*me),gr=Math.min(gr,(Ht.start+Ht.count)*me)),Zt!==null?(sn=Math.max(sn,0),gr=Math.min(gr,Zt.count)):ae!=null&&(sn=Math.max(sn,0),gr=Math.min(gr,ae.count));let Un=gr-sn;if(Un<0||Un===1/0)return;B.setup(at,ht,re,yt,Zt);let Qr,Sn=P;if(Zt!==null&&(Qr=N.get(Zt),Sn=D,Sn.setIndex(Qr)),at.isMesh)ht.wireframe===!0?(Wt.setLineWidth(ht.wireframeLinewidth*te()),Sn.setMode(nt.LINES)):Sn.setMode(nt.TRIANGLES);else if(at.isLine){let jt=ht.linewidth;jt===void 0&&(jt=1),Wt.setLineWidth(jt*te()),at.isLineSegments?Sn.setMode(nt.LINES):at.isLineLoop?Sn.setMode(nt.LINE_LOOP):Sn.setMode(nt.LINE_STRIP)}else at.isPoints?Sn.setMode(nt.POINTS):at.isSprite&&Sn.setMode(nt.TRIANGLES);if(at.isBatchedMesh)Sn.renderMultiDraw(at._multiDrawStarts,at._multiDrawCounts,at._multiDrawCount);else if(at.isInstancedMesh)Sn.renderInstances(sn,Un,at.count);else if(yt.isInstancedBufferGeometry){let jt=yt._maxInstanceCount!==void 0?yt._maxInstanceCount:1/0,Aa=Math.min(yt.instanceCount,jt);Sn.renderInstances(sn,Un,Aa)}else Sn.render(sn,Un)};function Nt(q,ot,yt){q.transparent===!0&&q.side===ns&&q.forceSinglePass===!1?(q.side=xi,q.needsUpdate=!0,_n(q,ot,yt),q.side=Is,q.needsUpdate=!0,_n(q,ot,yt),q.side=ns):_n(q,ot,yt)}this.compile=function(q,ot,yt=null){yt===null&&(yt=q),_=Ct.get(yt),_.init(),A.push(_),yt.traverseVisible(function(at){at.isLight&&at.layers.test(ot.layers)&&(_.pushLight(at),at.castShadow&&_.pushShadow(at))}),q!==yt&&q.traverseVisible(function(at){at.isLight&&at.layers.test(ot.layers)&&(_.pushLight(at),at.castShadow&&_.pushShadow(at))}),_.setupLights(M._useLegacyLights);let ht=new Set;return q.traverse(function(at){let Ht=at.material;if(Ht)if(Array.isArray(Ht))for(let Xt=0;Xt<Ht.length;Xt++){let re=Ht[Xt];Nt(re,yt,at),ht.add(re)}else Nt(Ht,yt,at),ht.add(Ht)}),A.pop(),_=null,ht},this.compileAsync=function(q,ot,yt=null){let ht=this.compile(q,ot,yt);return new Promise(at=>{function Ht(){if(ht.forEach(function(Xt){ce.get(Xt).currentProgram.isReady()&&ht.delete(Xt)}),ht.size===0){at(q);return}setTimeout(Ht,10)}zt.get("KHR_parallel_shader_compile")!==null?Ht():setTimeout(Ht,10)})};let Jt=null;function Kt(q){Jt&&Jt(q)}function xe(){Se.stop()}function de(){Se.start()}let Se=new FE;Se.setAnimationLoop(Kt),typeof self!="undefined"&&Se.setContext(self),this.setAnimationLoop=function(q){Jt=q,ft.setAnimationLoop(q),q===null?Se.stop():Se.start()},ft.addEventListener("sessionstart",xe),ft.addEventListener("sessionend",de),this.render=function(q,ot){if(ot!==void 0&&ot.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(L===!0)return;q.matrixWorldAutoUpdate===!0&&q.updateMatrixWorld(),ot.parent===null&&ot.matrixWorldAutoUpdate===!0&&ot.updateMatrixWorld(),ft.enabled===!0&&ft.isPresenting===!0&&(ft.cameraAutoUpdate===!0&&ft.updateCamera(ot),ot=ft.getCamera()),q.isScene===!0&&q.onBeforeRender(M,q,ot,F),_=Ct.get(q,A.length),_.init(),A.push(_),$t.multiplyMatrices(ot.projectionMatrix,ot.matrixWorldInverse),Yt.setFromProjectionMatrix($t),wt=this.localClippingEnabled,tt=Ot.init(this.clippingPlanes,wt),T=ue.get(q,y.length),T.init(),y.push(T),Me(q,ot,0,M.sortObjects),T.finish(),M.sortObjects===!0&&T.sort(rt,lt),this.info.render.frame++,tt===!0&&Ot.beginShadows();let yt=_.state.shadowsArray;if(qt.render(yt,q,ot),tt===!0&&Ot.endShadows(),this.info.autoReset===!0&&this.info.reset(),(ft.enabled===!1||ft.isPresenting===!1||ft.hasDepthSensing()===!1)&&J.render(T,q),_.setupLights(M._useLegacyLights),ot.isArrayCamera){let ht=ot.cameras;for(let at=0,Ht=ht.length;at<Ht;at++){let Xt=ht[at];Nn(T,q,Xt,Xt.viewport)}}else Nn(T,q,ot);F!==null&&(Lt.updateMultisampleRenderTarget(F),Lt.updateRenderTargetMipmap(F)),q.isScene===!0&&q.onAfterRender(M,q,ot),B.resetDefaultState(),I=-1,ut=null,A.pop(),A.length>0?_=A[A.length-1]:_=null,y.pop(),y.length>0?T=y[y.length-1]:T=null};function Me(q,ot,yt,ht){if(q.visible===!1)return;if(q.layers.test(ot.layers)){if(q.isGroup)yt=q.renderOrder;else if(q.isLOD)q.autoUpdate===!0&&q.update(ot);else if(q.isLight)_.pushLight(q),q.castShadow&&_.pushShadow(q);else if(q.isSprite){if(!q.frustumCulled||Yt.intersectsSprite(q)){ht&&Dt.setFromMatrixPosition(q.matrixWorld).applyMatrix4($t);let Xt=Et.update(q),re=q.material;re.visible&&T.push(q,Xt,re,yt,Dt.z,null)}}else if((q.isMesh||q.isLine||q.isPoints)&&(!q.frustumCulled||Yt.intersectsObject(q))){let Xt=Et.update(q),re=q.material;if(ht&&(q.boundingSphere!==void 0?(q.boundingSphere===null&&q.computeBoundingSphere(),Dt.copy(q.boundingSphere.center)):(Xt.boundingSphere===null&&Xt.computeBoundingSphere(),Dt.copy(Xt.boundingSphere.center)),Dt.applyMatrix4(q.matrixWorld).applyMatrix4($t)),Array.isArray(re)){let Zt=Xt.groups;for(let me=0,oe=Zt.length;me<oe;me++){let ae=Zt[me],sn=re[ae.materialIndex];sn&&sn.visible&&T.push(q,Xt,sn,yt,Dt.z,ae)}}else re.visible&&T.push(q,Xt,re,yt,Dt.z,null)}}let Ht=q.children;for(let Xt=0,re=Ht.length;Xt<re;Xt++)Me(Ht[Xt],ot,yt,ht)}function Nn(q,ot,yt,ht){let at=q.opaque,Ht=q.transmissive,Xt=q.transparent;_.setupLightsView(yt),tt===!0&&Ot.setGlobalState(M.clippingPlanes,yt),Ht.length>0&&or(at,Ht,ot,yt),ht&&Wt.viewport(R.copy(ht)),at.length>0&&vn(at,ot,yt),Ht.length>0&&vn(Ht,ot,yt),Xt.length>0&&vn(Xt,ot,yt),Wt.buffers.depth.setTest(!0),Wt.buffers.depth.setMask(!0),Wt.buffers.color.setMask(!0),Wt.setPolygonOffset(!1)}function or(q,ot,yt,ht){if((yt.isScene===!0?yt.overrideMaterial:null)!==null)return;let Ht=ne.isWebGL2;Bt===null&&(Bt=new ss(1,1,{generateMipmaps:!0,type:zt.has("EXT_color_buffer_half_float")?wl:Ps,minFilter:ca,samples:Ht?4:0})),M.getDrawingBufferSize(Ut),Ht?Bt.setSize(Ut.x,Ut.y):Bt.setSize(Zd(Ut.x),Zd(Ut.y));let Xt=M.getRenderTarget();M.setRenderTarget(Bt),M.getClearColor(St),X=M.getClearAlpha(),X<1&&M.setClearColor(16777215,.5),M.clear();let re=M.toneMapping;M.toneMapping=Cs,vn(q,yt,ht),Lt.updateMultisampleRenderTarget(Bt),Lt.updateRenderTargetMipmap(Bt);let Zt=!1;for(let me=0,oe=ot.length;me<oe;me++){let ae=ot[me],sn=ae.object,gr=ae.geometry,Un=ae.material,Qr=ae.group;if(Un.side===ns&&sn.layers.test(ht.layers)){let Sn=Un.side;Un.side=xi,Un.needsUpdate=!0,le(sn,yt,ht,gr,Un,Qr),Un.side=Sn,Un.needsUpdate=!0,Zt=!0}}Zt===!0&&(Lt.updateMultisampleRenderTarget(Bt),Lt.updateRenderTargetMipmap(Bt)),M.setRenderTarget(Xt),M.setClearColor(St,X),M.toneMapping=re}function vn(q,ot,yt){let ht=ot.isScene===!0?ot.overrideMaterial:null;for(let at=0,Ht=q.length;at<Ht;at++){let Xt=q[at],re=Xt.object,Zt=Xt.geometry,me=ht===null?Xt.material:ht,oe=Xt.group;re.layers.test(yt.layers)&&le(re,ot,yt,Zt,me,oe)}}function le(q,ot,yt,ht,at,Ht){q.onBeforeRender(M,ot,yt,ht,at,Ht),q.modelViewMatrix.multiplyMatrices(yt.matrixWorldInverse,q.matrixWorld),q.normalMatrix.getNormalMatrix(q.modelViewMatrix),at.onBeforeRender(M,ot,yt,ht,q,Ht),at.transparent===!0&&at.side===ns&&at.forceSinglePass===!1?(at.side=xi,at.needsUpdate=!0,M.renderBufferDirect(yt,ot,ht,at,q,Ht),at.side=Is,at.needsUpdate=!0,M.renderBufferDirect(yt,ot,ht,at,q,Ht),at.side=ns):M.renderBufferDirect(yt,ot,ht,at,q,Ht),q.onAfterRender(M,ot,yt,ht,at,Ht)}function _n(q,ot,yt){ot.isScene!==!0&&(ot=At);let ht=ce.get(q),at=_.state.lights,Ht=_.state.shadowsArray,Xt=at.state.version,re=it.getParameters(q,at.state,Ht,ot,yt),Zt=it.getProgramCacheKey(re),me=ht.programs;ht.environment=q.isMeshStandardMaterial?ot.environment:null,ht.fog=ot.fog,ht.envMap=(q.isMeshStandardMaterial?Y:se).get(q.envMap||ht.environment),ht.envMapRotation=ht.environment!==null&&q.envMap===null?ot.environmentRotation:q.envMapRotation,me===void 0&&(q.addEventListener("dispose",$),me=new Map,ht.programs=me);let oe=me.get(Zt);if(oe!==void 0){if(ht.currentProgram===oe&&ht.lightsStateVersion===Xt)return Tn(q,re),oe}else re.uniforms=it.getUniforms(q),q.onBuild(yt,re,M),q.onBeforeCompile(re,M),oe=it.acquireProgram(re,Zt),me.set(Zt,oe),ht.uniforms=re.uniforms;let ae=ht.uniforms;return(!q.isShaderMaterial&&!q.isRawShaderMaterial||q.clipping===!0)&&(ae.clippingPlanes=Ot.uniform),Tn(q,re),ht.needsLights=mr(q),ht.lightsStateVersion=Xt,ht.needsLights&&(ae.ambientLightColor.value=at.state.ambient,ae.lightProbe.value=at.state.probe,ae.directionalLights.value=at.state.directional,ae.directionalLightShadows.value=at.state.directionalShadow,ae.spotLights.value=at.state.spot,ae.spotLightShadows.value=at.state.spotShadow,ae.rectAreaLights.value=at.state.rectArea,ae.ltc_1.value=at.state.rectAreaLTC1,ae.ltc_2.value=at.state.rectAreaLTC2,ae.pointLights.value=at.state.point,ae.pointLightShadows.value=at.state.pointShadow,ae.hemisphereLights.value=at.state.hemi,ae.directionalShadowMap.value=at.state.directionalShadowMap,ae.directionalShadowMatrix.value=at.state.directionalShadowMatrix,ae.spotShadowMap.value=at.state.spotShadowMap,ae.spotLightMatrix.value=at.state.spotLightMatrix,ae.spotLightMap.value=at.state.spotLightMap,ae.pointShadowMap.value=at.state.pointShadowMap,ae.pointShadowMatrix.value=at.state.pointShadowMatrix),ht.currentProgram=oe,ht.uniformsList=null,oe}function Pn(q){if(q.uniformsList===null){let ot=q.currentProgram.getUniforms();q.uniformsList=du.seqWithValue(ot.seq,q.uniforms)}return q.uniformsList}function Tn(q,ot){let yt=ce.get(q);yt.outputColorSpace=ot.outputColorSpace,yt.batching=ot.batching,yt.instancing=ot.instancing,yt.instancingColor=ot.instancingColor,yt.instancingMorph=ot.instancingMorph,yt.skinning=ot.skinning,yt.morphTargets=ot.morphTargets,yt.morphNormals=ot.morphNormals,yt.morphColors=ot.morphColors,yt.morphTargetsCount=ot.morphTargetsCount,yt.numClippingPlanes=ot.numClippingPlanes,yt.numIntersection=ot.numClipIntersection,yt.vertexAlphas=ot.vertexAlphas,yt.vertexTangents=ot.vertexTangents,yt.toneMapping=ot.toneMapping}function xn(q,ot,yt,ht,at){ot.isScene!==!0&&(ot=At),Lt.resetTextureUnits();let Ht=ot.fog,Xt=ht.isMeshStandardMaterial?ot.environment:null,re=F===null?M.outputColorSpace:F.isXRRenderTarget===!0?F.texture.colorSpace:Ns,Zt=(ht.isMeshStandardMaterial?Y:se).get(ht.envMap||Xt),me=ht.vertexColors===!0&&!!yt.attributes.color&&yt.attributes.color.itemSize===4,oe=!!yt.attributes.tangent&&(!!ht.normalMap||ht.anisotropy>0),ae=!!yt.morphAttributes.position,sn=!!yt.morphAttributes.normal,gr=!!yt.morphAttributes.color,Un=Cs;ht.toneMapped&&(F===null||F.isXRRenderTarget===!0)&&(Un=M.toneMapping);let Qr=yt.morphAttributes.position||yt.morphAttributes.normal||yt.morphAttributes.color,Sn=Qr!==void 0?Qr.length:0,jt=ce.get(ht),Aa=_.state.lights;if(tt===!0&&(wt===!0||q!==ut)){let ti=q===ut&&ht.id===I;Ot.setState(ht,q,ti)}let an=!1;ht.version===jt.__version?(jt.needsLights&&jt.lightsStateVersion!==Aa.state.version||jt.outputColorSpace!==re||at.isBatchedMesh&&jt.batching===!1||!at.isBatchedMesh&&jt.batching===!0||at.isInstancedMesh&&jt.instancing===!1||!at.isInstancedMesh&&jt.instancing===!0||at.isSkinnedMesh&&jt.skinning===!1||!at.isSkinnedMesh&&jt.skinning===!0||at.isInstancedMesh&&jt.instancingColor===!0&&at.instanceColor===null||at.isInstancedMesh&&jt.instancingColor===!1&&at.instanceColor!==null||at.isInstancedMesh&&jt.instancingMorph===!0&&at.morphTexture===null||at.isInstancedMesh&&jt.instancingMorph===!1&&at.morphTexture!==null||jt.envMap!==Zt||ht.fog===!0&&jt.fog!==Ht||jt.numClippingPlanes!==void 0&&(jt.numClippingPlanes!==Ot.numPlanes||jt.numIntersection!==Ot.numIntersection)||jt.vertexAlphas!==me||jt.vertexTangents!==oe||jt.morphTargets!==ae||jt.morphNormals!==sn||jt.morphColors!==gr||jt.toneMapping!==Un||ne.isWebGL2===!0&&jt.morphTargetsCount!==Sn)&&(an=!0):(an=!0,jt.__version=ht.version);let Wi=jt.currentProgram;an===!0&&(Wi=_n(ht,ot,at));let Xu=!1,ge=!1,qs=!1,Mn=Wi.getUniforms(),Xi=jt.uniforms;if(Wt.useProgram(Wi.program)&&(Xu=!0,ge=!0,qs=!0),ht.id!==I&&(I=ht.id,ge=!0),Xu||ut!==q){Mn.setValue(nt,"projectionMatrix",q.projectionMatrix),Mn.setValue(nt,"viewMatrix",q.matrixWorldInverse);let ti=Mn.map.cameraPosition;ti!==void 0&&ti.setValue(nt,Dt.setFromMatrixPosition(q.matrixWorld)),ne.logarithmicDepthBuffer&&Mn.setValue(nt,"logDepthBufFC",2/(Math.log(q.far+1)/Math.LN2)),(ht.isMeshPhongMaterial||ht.isMeshToonMaterial||ht.isMeshLambertMaterial||ht.isMeshBasicMaterial||ht.isMeshStandardMaterial||ht.isShaderMaterial)&&Mn.setValue(nt,"isOrthographic",q.isOrthographicCamera===!0),ut!==q&&(ut=q,ge=!0,qs=!0)}if(at.isSkinnedMesh){Mn.setOptional(nt,at,"bindMatrix"),Mn.setOptional(nt,at,"bindMatrixInverse");let ti=at.skeleton;ti&&(ne.floatVertexTextures?(ti.boneTexture===null&&ti.computeBoneTexture(),Mn.setValue(nt,"boneTexture",ti.boneTexture,Lt)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}at.isBatchedMesh&&(Mn.setOptional(nt,at,"batchingTexture"),Mn.setValue(nt,"batchingTexture",at._matricesTexture,Lt));let pe=yt.morphAttributes;if((pe.position!==void 0||pe.normal!==void 0||pe.color!==void 0&&ne.isWebGL2===!0)&&w.update(at,yt,Wi),(ge||jt.receiveShadow!==at.receiveShadow)&&(jt.receiveShadow=at.receiveShadow,Mn.setValue(nt,"receiveShadow",at.receiveShadow)),ht.isMeshGouraudMaterial&&ht.envMap!==null&&(Xi.envMap.value=Zt,Xi.flipEnvMap.value=Zt.isCubeTexture&&Zt.isRenderTargetTexture===!1?-1:1),ge&&(Mn.setValue(nt,"toneMappingExposure",M.toneMappingExposure),jt.needsLights&&Vr(Xi,qs),Ht&&ht.fog===!0&&Pt.refreshFogUniforms(Xi,Ht),Pt.refreshMaterialUniforms(Xi,ht,vt,dt,Bt),du.upload(nt,Pn(jt),Xi,Lt)),ht.isShaderMaterial&&ht.uniformsNeedUpdate===!0&&(du.upload(nt,Pn(jt),Xi,Lt),ht.uniformsNeedUpdate=!1),ht.isSpriteMaterial&&Mn.setValue(nt,"center",at.center),Mn.setValue(nt,"modelViewMatrix",at.modelViewMatrix),Mn.setValue(nt,"normalMatrix",at.normalMatrix),Mn.setValue(nt,"modelMatrix",at.matrixWorld),ht.isShaderMaterial||ht.isRawShaderMaterial){let ti=ht.uniformsGroups;for(let Yu=0,Ca=ti.length;Yu<Ca;Yu++)if(ne.isWebGL2){let ei=ti[Yu];et.update(ei,Wi),et.bind(ei,Wi)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return Wi}function Vr(q,ot){q.ambientLightColor.needsUpdate=ot,q.lightProbe.needsUpdate=ot,q.directionalLights.needsUpdate=ot,q.directionalLightShadows.needsUpdate=ot,q.pointLights.needsUpdate=ot,q.pointLightShadows.needsUpdate=ot,q.spotLights.needsUpdate=ot,q.spotLightShadows.needsUpdate=ot,q.rectAreaLights.needsUpdate=ot,q.hemisphereLights.needsUpdate=ot}function mr(q){return q.isMeshLambertMaterial||q.isMeshToonMaterial||q.isMeshPhongMaterial||q.isMeshStandardMaterial||q.isShadowMaterial||q.isShaderMaterial&&q.lights===!0}this.getActiveCubeFace=function(){return G},this.getActiveMipmapLevel=function(){return z},this.getRenderTarget=function(){return F},this.setRenderTargetTextures=function(q,ot,yt){ce.get(q.texture).__webglTexture=ot,ce.get(q.depthTexture).__webglTexture=yt;let ht=ce.get(q);ht.__hasExternalTextures=!0,ht.__autoAllocateDepthBuffer=yt===void 0,ht.__autoAllocateDepthBuffer||zt.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),ht.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(q,ot){let yt=ce.get(q);yt.__webglFramebuffer=ot,yt.__useDefaultFramebuffer=ot===void 0},this.setRenderTarget=function(q,ot=0,yt=0){F=q,G=ot,z=yt;let ht=!0,at=null,Ht=!1,Xt=!1;if(q){let Zt=ce.get(q);Zt.__useDefaultFramebuffer!==void 0?(Wt.bindFramebuffer(nt.FRAMEBUFFER,null),ht=!1):Zt.__webglFramebuffer===void 0?Lt.setupRenderTarget(q):Zt.__hasExternalTextures&&Lt.rebindTextures(q,ce.get(q.texture).__webglTexture,ce.get(q.depthTexture).__webglTexture);let me=q.texture;(me.isData3DTexture||me.isDataArrayTexture||me.isCompressedArrayTexture)&&(Xt=!0);let oe=ce.get(q).__webglFramebuffer;q.isWebGLCubeRenderTarget?(Array.isArray(oe[ot])?at=oe[ot][yt]:at=oe[ot],Ht=!0):ne.isWebGL2&&q.samples>0&&Lt.useMultisampledRTT(q)===!1?at=ce.get(q).__webglMultisampledFramebuffer:Array.isArray(oe)?at=oe[yt]:at=oe,R.copy(q.viewport),W.copy(q.scissor),V=q.scissorTest}else R.copy(H).multiplyScalar(vt).floor(),W.copy(bt).multiplyScalar(vt).floor(),V=Tt;if(Wt.bindFramebuffer(nt.FRAMEBUFFER,at)&&ne.drawBuffers&&ht&&Wt.drawBuffers(q,at),Wt.viewport(R),Wt.scissor(W),Wt.setScissorTest(V),Ht){let Zt=ce.get(q.texture);nt.framebufferTexture2D(nt.FRAMEBUFFER,nt.COLOR_ATTACHMENT0,nt.TEXTURE_CUBE_MAP_POSITIVE_X+ot,Zt.__webglTexture,yt)}else if(Xt){let Zt=ce.get(q.texture),me=ot||0;nt.framebufferTextureLayer(nt.FRAMEBUFFER,nt.COLOR_ATTACHMENT0,Zt.__webglTexture,yt||0,me)}I=-1},this.readRenderTargetPixels=function(q,ot,yt,ht,at,Ht,Xt){if(!(q&&q.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let re=ce.get(q).__webglFramebuffer;if(q.isWebGLCubeRenderTarget&&Xt!==void 0&&(re=re[Xt]),re){Wt.bindFramebuffer(nt.FRAMEBUFFER,re);try{let Zt=q.texture,me=Zt.format,oe=Zt.type;if(me!==co&&k.convert(me)!==nt.getParameter(nt.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let ae=oe===wl&&(zt.has("EXT_color_buffer_half_float")||ne.isWebGL2&&zt.has("EXT_color_buffer_float"));if(oe!==Ps&&k.convert(oe)!==nt.getParameter(nt.IMPLEMENTATION_COLOR_READ_TYPE)&&!(oe===rs&&(ne.isWebGL2||zt.has("OES_texture_float")||zt.has("WEBGL_color_buffer_float")))&&!ae){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}ot>=0&&ot<=q.width-ht&&yt>=0&&yt<=q.height-at&&nt.readPixels(ot,yt,ht,at,k.convert(me),k.convert(oe),Ht)}finally{let Zt=F!==null?ce.get(F).__webglFramebuffer:null;Wt.bindFramebuffer(nt.FRAMEBUFFER,Zt)}}},this.copyFramebufferToTexture=function(q,ot,yt=0){let ht=Math.pow(2,-yt),at=Math.floor(ot.image.width*ht),Ht=Math.floor(ot.image.height*ht);Lt.setTexture2D(ot,0),nt.copyTexSubImage2D(nt.TEXTURE_2D,yt,0,0,q.x,q.y,at,Ht),Wt.unbindTexture()},this.copyTextureToTexture=function(q,ot,yt,ht=0){let at=ot.image.width,Ht=ot.image.height,Xt=k.convert(yt.format),re=k.convert(yt.type);Lt.setTexture2D(yt,0),nt.pixelStorei(nt.UNPACK_FLIP_Y_WEBGL,yt.flipY),nt.pixelStorei(nt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,yt.premultiplyAlpha),nt.pixelStorei(nt.UNPACK_ALIGNMENT,yt.unpackAlignment),ot.isDataTexture?nt.texSubImage2D(nt.TEXTURE_2D,ht,q.x,q.y,at,Ht,Xt,re,ot.image.data):ot.isCompressedTexture?nt.compressedTexSubImage2D(nt.TEXTURE_2D,ht,q.x,q.y,ot.mipmaps[0].width,ot.mipmaps[0].height,Xt,ot.mipmaps[0].data):nt.texSubImage2D(nt.TEXTURE_2D,ht,q.x,q.y,Xt,re,ot.image),ht===0&&yt.generateMipmaps&&nt.generateMipmap(nt.TEXTURE_2D),Wt.unbindTexture()},this.copyTextureToTexture3D=function(q,ot,yt,ht,at=0){if(M.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let Ht=Math.round(q.max.x-q.min.x),Xt=Math.round(q.max.y-q.min.y),re=q.max.z-q.min.z+1,Zt=k.convert(ht.format),me=k.convert(ht.type),oe;if(ht.isData3DTexture)Lt.setTexture3D(ht,0),oe=nt.TEXTURE_3D;else if(ht.isDataArrayTexture||ht.isCompressedArrayTexture)Lt.setTexture2DArray(ht,0),oe=nt.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}nt.pixelStorei(nt.UNPACK_FLIP_Y_WEBGL,ht.flipY),nt.pixelStorei(nt.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ht.premultiplyAlpha),nt.pixelStorei(nt.UNPACK_ALIGNMENT,ht.unpackAlignment);let ae=nt.getParameter(nt.UNPACK_ROW_LENGTH),sn=nt.getParameter(nt.UNPACK_IMAGE_HEIGHT),gr=nt.getParameter(nt.UNPACK_SKIP_PIXELS),Un=nt.getParameter(nt.UNPACK_SKIP_ROWS),Qr=nt.getParameter(nt.UNPACK_SKIP_IMAGES),Sn=yt.isCompressedTexture?yt.mipmaps[at]:yt.image;nt.pixelStorei(nt.UNPACK_ROW_LENGTH,Sn.width),nt.pixelStorei(nt.UNPACK_IMAGE_HEIGHT,Sn.height),nt.pixelStorei(nt.UNPACK_SKIP_PIXELS,q.min.x),nt.pixelStorei(nt.UNPACK_SKIP_ROWS,q.min.y),nt.pixelStorei(nt.UNPACK_SKIP_IMAGES,q.min.z),yt.isDataTexture||yt.isData3DTexture?nt.texSubImage3D(oe,at,ot.x,ot.y,ot.z,Ht,Xt,re,Zt,me,Sn.data):ht.isCompressedArrayTexture?nt.compressedTexSubImage3D(oe,at,ot.x,ot.y,ot.z,Ht,Xt,re,Zt,Sn.data):nt.texSubImage3D(oe,at,ot.x,ot.y,ot.z,Ht,Xt,re,Zt,me,Sn),nt.pixelStorei(nt.UNPACK_ROW_LENGTH,ae),nt.pixelStorei(nt.UNPACK_IMAGE_HEIGHT,sn),nt.pixelStorei(nt.UNPACK_SKIP_PIXELS,gr),nt.pixelStorei(nt.UNPACK_SKIP_ROWS,Un),nt.pixelStorei(nt.UNPACK_SKIP_IMAGES,Qr),at===0&&ht.generateMipmaps&&nt.generateMipmap(oe),Wt.unbindTexture()},this.initTexture=function(q){q.isCubeTexture?Lt.setTextureCube(q,0):q.isData3DTexture?Lt.setTexture3D(q,0):q.isDataArrayTexture||q.isCompressedArrayTexture?Lt.setTexture2DArray(q,0):Lt.setTexture2D(q,0),Wt.unbindTexture()},this.resetState=function(){G=0,z=0,F=null,Wt.reset(),B.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return is}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;let e=this.getContext();e.drawingBufferColorSpace=t===Am?"display-p3":"srgb",e.unpackColorSpace=An.workingColorSpace===Nf?"display-p3":"srgb"}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(t){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=t}},dm=class extends pm{};dm.prototype.isWebGL1Renderer=!0;function cf(r,t,e){return!r||!e&&r.constructor===t?r:typeof t.BYTES_PER_ELEMENT=="number"?new t(r):Array.prototype.slice.call(r)}function EF(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}var xu=class{constructor(t,e,o,a){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=a!==void 0?a:new e.constructor(o),this.sampleValues=e,this.valueSize=o,this.settings=null,this.DefaultSettings_={}}evaluate(t){let e=this.parameterPositions,o=this._cachedIndex,a=e[o],l=e[o-1];n:{t:{let h;e:{r:if(!(t<a)){for(let f=o+2;;){if(a===void 0){if(t<l)break r;return o=e.length,this._cachedIndex=o,this.copySampleValue_(o-1)}if(o===f)break;if(l=a,a=e[++o],t<a)break t}h=e.length;break e}if(!(t>=l)){let f=e[1];t<f&&(o=2,l=f);for(let p=o-2;;){if(l===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(o===p)break;if(a=l,l=e[--o-1],t>=l)break t}h=o,o=0;break e}break n}for(;o<h;){let f=o+h>>>1;t<e[f]?h=f:o=f+1}if(a=e[o],l=e[o-1],l===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(a===void 0)return o=e.length,this._cachedIndex=o,this.copySampleValue_(o-1)}this._cachedIndex=o,this.intervalChanged_(o,l,a)}return this.interpolate_(o,l,t,a)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){let e=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=t*a;for(let h=0;h!==a;++h)e[h]=o[l+h];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},mm=class extends xu{constructor(t,e,o,a){super(t,e,o,a),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:I1,endingEnd:I1}}intervalChanged_(t,e,o){let a=this.parameterPositions,l=t-2,h=t+1,f=a[l],p=a[h];if(f===void 0)switch(this.getSettings_().endingStart){case R1:l=t,f=2*e-o;break;case L1:l=a.length-2,f=e+a[l]-a[l+1];break;default:l=t,f=o}if(p===void 0)switch(this.getSettings_().endingEnd){case R1:h=t,p=2*o-e;break;case L1:h=1,p=o+a[1]-a[0];break;default:h=t-1,p=e}let d=(o-e)*.5,g=this.valueSize;this._weightPrev=d/(e-f),this._weightNext=d/(p-o),this._offsetPrev=l*g,this._offsetNext=h*g}interpolate_(t,e,o,a){let l=this.resultBuffer,h=this.sampleValues,f=this.valueSize,p=t*f,d=p-f,g=this._offsetPrev,x=this._offsetNext,v=this._weightPrev,S=this._weightNext,b=(o-e)/(a-e),T=b*b,_=T*b,y=-v*_+2*v*T-v*b,A=(1+v)*_+(-1.5-2*v)*T+(-.5+v)*b+1,M=(-1-S)*_+(1.5+S)*T+.5*b,L=S*_-S*T;for(let G=0;G!==f;++G)l[G]=y*h[g+G]+A*h[d+G]+M*h[p+G]+L*h[x+G];return l}},gm=class extends xu{constructor(t,e,o,a){super(t,e,o,a)}interpolate_(t,e,o,a){let l=this.resultBuffer,h=this.sampleValues,f=this.valueSize,p=t*f,d=p-f,g=(o-e)/(a-e),x=1-g;for(let v=0;v!==f;++v)l[v]=h[d+v]*x+h[p+v]*g;return l}},ym=class extends xu{constructor(t,e,o,a){super(t,e,o,a)}interpolate_(t){return this.copySampleValue_(t-1)}},ho=class{constructor(t,e,o,a){if(t===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(e===void 0||e.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=cf(e,this.TimeBufferType),this.values=cf(o,this.ValueBufferType),this.setInterpolation(a||this.DefaultInterpolation)}static toJSON(t){let e=t.constructor,o;if(e.toJSON!==this.toJSON)o=e.toJSON(t);else{o={name:t.name,times:cf(t.times,Array),values:cf(t.values,Array)};let a=t.getInterpolation();a!==t.DefaultInterpolation&&(o.interpolation=a)}return o.type=t.ValueTypeName,o}InterpolantFactoryMethodDiscrete(t){return new ym(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new gm(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new mm(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case hf:e=this.InterpolantFactoryMethodDiscrete;break;case pf:e=this.InterpolantFactoryMethodLinear;break;case dd:e=this.InterpolantFactoryMethodSmooth;break}if(e===void 0){let o="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(t!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(o);return console.warn("THREE.KeyframeTrack:",o),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return hf;case this.InterpolantFactoryMethodLinear:return pf;case this.InterpolantFactoryMethodSmooth:return dd}}getValueSize(){return this.values.length/this.times.length}shift(t){if(t!==0){let e=this.times;for(let o=0,a=e.length;o!==a;++o)e[o]+=t}return this}scale(t){if(t!==1){let e=this.times;for(let o=0,a=e.length;o!==a;++o)e[o]*=t}return this}trim(t,e){let o=this.times,a=o.length,l=0,h=a-1;for(;l!==a&&o[l]<t;)++l;for(;h!==-1&&o[h]>e;)--h;if(++h,l!==0||h!==a){l>=h&&(h=Math.max(h,1),l=h-1);let f=this.getValueSize();this.times=o.slice(l,h),this.values=this.values.slice(l*f,h*f)}return this}validate(){let t=!0,e=this.getValueSize();e-Math.floor(e)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);let o=this.times,a=this.values,l=o.length;l===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let h=null;for(let f=0;f!==l;f++){let p=o[f];if(typeof p=="number"&&isNaN(p)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,f,p),t=!1;break}if(h!==null&&h>p){console.error("THREE.KeyframeTrack: Out of order keys.",this,f,p,h),t=!1;break}h=p}if(a!==void 0&&EF(a))for(let f=0,p=a.length;f!==p;++f){let d=a[f];if(isNaN(d)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,f,d),t=!1;break}}return t}optimize(){let t=this.times.slice(),e=this.values.slice(),o=this.getValueSize(),a=this.getInterpolation()===dd,l=t.length-1,h=1;for(let f=1;f<l;++f){let p=!1,d=t[f],g=t[f+1];if(d!==g&&(f!==1||d!==t[0]))if(a)p=!0;else{let x=f*o,v=x-o,S=x+o;for(let b=0;b!==o;++b){let T=e[x+b];if(T!==e[v+b]||T!==e[S+b]){p=!0;break}}}if(p){if(f!==h){t[h]=t[f];let x=f*o,v=h*o;for(let S=0;S!==o;++S)e[v+S]=e[x+S]}++h}}if(l>0){t[h]=t[l];for(let f=l*o,p=h*o,d=0;d!==o;++d)e[p+d]=e[f+d];++h}return h!==t.length?(this.times=t.slice(0,h),this.values=e.slice(0,h*o)):(this.times=t,this.values=e),this}clone(){let t=this.times.slice(),e=this.values.slice(),o=this.constructor,a=new o(this.name,t,e);return a.createInterpolant=this.createInterpolant,a}};ho.prototype.TimeBufferType=Float32Array;ho.prototype.ValueBufferType=Float32Array;ho.prototype.DefaultInterpolation=pf;var ga=class extends ho{};ga.prototype.ValueTypeName="bool";ga.prototype.ValueBufferType=Array;ga.prototype.DefaultInterpolation=hf;ga.prototype.InterpolantFactoryMethodLinear=void 0;ga.prototype.InterpolantFactoryMethodSmooth=void 0;var vm=class extends ho{};vm.prototype.ValueTypeName="color";var _m=class extends ho{};_m.prototype.ValueTypeName="number";var xm=class extends xu{constructor(t,e,o,a){super(t,e,o,a)}interpolate_(t,e,o,a){let l=this.resultBuffer,h=this.sampleValues,f=this.valueSize,p=(o-e)/(a-e),d=t*f;for(let g=d+f;d!==g;d+=4)Ls.slerpFlat(l,0,h,d-f,h,d,p);return l}},Al=class extends ho{InterpolantFactoryMethodLinear(t){return new xm(this.times,this.values,this.getValueSize(),t)}};Al.prototype.ValueTypeName="quaternion";Al.prototype.DefaultInterpolation=pf;Al.prototype.InterpolantFactoryMethodSmooth=void 0;var ya=class extends ho{};ya.prototype.ValueTypeName="string";ya.prototype.ValueBufferType=Array;ya.prototype.DefaultInterpolation=hf;ya.prototype.InterpolantFactoryMethodLinear=void 0;ya.prototype.InterpolantFactoryMethodSmooth=void 0;var Em=class extends ho{};Em.prototype.ValueTypeName="vector";var Sm=class{constructor(t,e,o){let a=this,l=!1,h=0,f=0,p,d=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=o,this.itemStart=function(g){f++,l===!1&&a.onStart!==void 0&&a.onStart(g,h,f),l=!0},this.itemEnd=function(g){h++,a.onProgress!==void 0&&a.onProgress(g,h,f),h===f&&(l=!1,a.onLoad!==void 0&&a.onLoad())},this.itemError=function(g){a.onError!==void 0&&a.onError(g)},this.resolveURL=function(g){return p?p(g):g},this.setURLModifier=function(g){return p=g,this},this.addHandler=function(g,x){return d.push(g,x),this},this.removeHandler=function(g){let x=d.indexOf(g);return x!==-1&&d.splice(x,2),this},this.getHandler=function(g){for(let x=0,v=d.length;x<v;x+=2){let S=d[x],b=d[x+1];if(S.global&&(S.lastIndex=0),S.test(g))return b}return null}}},SF=new Sm,Mm=class{constructor(t){this.manager=t!==void 0?t:SF,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){let o=this;return new Promise(function(a,l){o.load(t,a,e,l)})}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}};Mm.DEFAULT_MATERIAL_NAME="__DEFAULT";var Pm="\\\\[\\\\]\\\\.:\\\\/",MF=new RegExp("["+Pm+"]","g"),Im="[^"+Pm+"]",wF="[^"+Pm.replace("\\\\.","")+"]",bF=/((?:WC+[\\/:])*)/.source.replace("WC",Im),TF=/(WCOD+)?/.source.replace("WCOD",wF),AF=/(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace("WC",Im),CF=/\\.(WC+)(?:\\[(.+)\\])?/.source.replace("WC",Im),PF=new RegExp("^"+bF+TF+AF+CF+"$"),IF=["material","materials","bones","map"],wm=class{constructor(t,e,o){let a=o||qn.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,a)}getValue(t,e){this.bind();let o=this._targetGroup.nCachedObjects_,a=this._bindings[o];a!==void 0&&a.getValue(t,e)}setValue(t,e){let o=this._bindings;for(let a=this._targetGroup.nCachedObjects_,l=o.length;a!==l;++a)o[a].setValue(t,e)}bind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,o=t.length;e!==o;++e)t[e].bind()}unbind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,o=t.length;e!==o;++e)t[e].unbind()}},qn=class r{constructor(t,e,o){this.path=e,this.parsedPath=o||r.parseTrackName(e),this.node=r.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,o){return t&&t.isAnimationObjectGroup?new r.Composite(t,e,o):new r(t,e,o)}static sanitizeNodeName(t){return t.replace(/\\s/g,"_").replace(MF,"")}static parseTrackName(t){let e=PF.exec(t);if(e===null)throw new Error("PropertyBinding: Cannot parse trackName: "+t);let o={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},a=o.nodeName&&o.nodeName.lastIndexOf(".");if(a!==void 0&&a!==-1){let l=o.nodeName.substring(a+1);IF.indexOf(l)!==-1&&(o.nodeName=o.nodeName.substring(0,a),o.objectName=l)}if(o.propertyName===null||o.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return o}static findNode(t,e){if(e===void 0||e===""||e==="."||e===-1||e===t.name||e===t.uuid)return t;if(t.skeleton){let o=t.skeleton.getBoneByName(e);if(o!==void 0)return o}if(t.children){let o=function(l){for(let h=0;h<l.length;h++){let f=l[h];if(f.name===e||f.uuid===e)return f;let p=o(f.children);if(p)return p}return null},a=o(t.children);if(a)return a}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){let o=this.resolvedProperty;for(let a=0,l=o.length;a!==l;++a)t[e++]=o[a]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){let o=this.resolvedProperty;for(let a=0,l=o.length;a!==l;++a)o[a]=t[e++]}_setValue_array_setNeedsUpdate(t,e){let o=this.resolvedProperty;for(let a=0,l=o.length;a!==l;++a)o[a]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){let o=this.resolvedProperty;for(let a=0,l=o.length;a!==l;++a)o[a]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node,e=this.parsedPath,o=e.objectName,a=e.propertyName,l=e.propertyIndex;if(t||(t=r.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(o){let d=e.objectIndex;switch(o){case"materials":if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}t=t.material.materials;break;case"bones":if(!t.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}t=t.skeleton.bones;for(let g=0;g<t.length;g++)if(t[g].name===d){d=g;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}t=t.material.map;break;default:if(t[o]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}t=t[o]}if(d!==void 0){if(t[d]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);return}t=t[d]}}let h=t[a];if(h===void 0){let d=e.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+d+"."+a+" but it wasn't found.",t);return}let f=this.Versioning.None;this.targetObject=t,t.needsUpdate!==void 0?f=this.Versioning.NeedsUpdate:t.matrixWorldNeedsUpdate!==void 0&&(f=this.Versioning.MatrixWorldNeedsUpdate);let p=this.BindingType.Direct;if(l!==void 0){if(a==="morphTargetInfluences"){if(!t.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!t.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}t.morphTargetDictionary[l]!==void 0&&(l=t.morphTargetDictionary[l])}p=this.BindingType.ArrayElement,this.resolvedProperty=h,this.propertyIndex=l}else h.fromArray!==void 0&&h.toArray!==void 0?(p=this.BindingType.HasFromToArray,this.resolvedProperty=h):Array.isArray(h)?(p=this.BindingType.EntireArray,this.resolvedProperty=h):this.propertyName=a;this.getValue=this.GetterByBindingType[p],this.setValue=this.SetterByBindingTypeAndVersioning[p][f]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};qn.Composite=wm;qn.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};qn.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};qn.prototype.GetterByBindingType=[qn.prototype._getValue_direct,qn.prototype._getValue_array,qn.prototype._getValue_arrayElement,qn.prototype._getValue_toArray];qn.prototype.SetterByBindingTypeAndVersioning=[[qn.prototype._setValue_direct,qn.prototype._setValue_direct_setNeedsUpdate,qn.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[qn.prototype._setValue_array,qn.prototype._setValue_array_setNeedsUpdate,qn.prototype._setValue_array_setMatrixWorldNeedsUpdate],[qn.prototype._setValue_arrayElement,qn.prototype._setValue_arrayElement_setNeedsUpdate,qn.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[qn.prototype._setValue_fromArray,qn.prototype._setValue_fromArray_setNeedsUpdate,qn.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var Yq=new Float32Array(1);typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:bm}}));typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=bm);var Ar=63710088e-1,Jq={centimeters:Ar*100,centimetres:Ar*100,degrees:Ar/111325,feet:Ar*3.28084,inches:Ar*39.37,kilometers:Ar/1e3,kilometres:Ar/1e3,meters:Ar,metres:Ar,miles:Ar/1609.344,millimeters:Ar*1e3,millimetres:Ar*1e3,nauticalmiles:Ar/1852,radians:1,yards:Ar*1.0936},Kq={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/Ar,yards:1.0936133};function fi(r,t,e){e===void 0&&(e={});var o={type:"Feature"};return(e.id===0||e.id)&&(o.id=e.id),e.bbox&&(o.bbox=e.bbox),o.properties=t||{},o.geometry=r,o}function Ln(r,t,e){if(e===void 0&&(e={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Co(r[0])||!Co(r[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:r};return fi(o,t,e)}function Vn(r,t,e){e===void 0&&(e={});for(var o=0,a=r;o<a.length;o++){var l=a[o];if(l.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var h=0;h<l[l.length-1].length;h++)if(l[l.length-1][h]!==l[0][h])throw new Error("First and last Position are not equivalent.")}var f={type:"Polygon",coordinates:r};return fi(f,t,e)}function Cr(r,t,e){if(e===void 0&&(e={}),r.length<2)throw new Error("coordinates must be an array of two or more positions");var o={type:"LineString",coordinates:r};return fi(o,t,e)}function Rm(r,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:r};return fi(o,t,e)}function Co(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}function fr(r,t,e){if(r!==null)for(var o,a,l,h,f,p,d,g=0,x=0,v,S=r.type,b=S==="FeatureCollection",T=S==="Feature",_=b?r.features.length:1,y=0;y<_;y++){d=b?r.features[y].geometry:T?r.geometry:r,v=d?d.type==="GeometryCollection":!1,f=v?d.geometries.length:1;for(var A=0;A<f;A++){var M=0,L=0;if(h=v?d.geometries[A]:d,h!==null){p=h.coordinates;var G=h.type;switch(g=e&&(G==="Polygon"||G==="MultiPolygon")?1:0,G){case null:break;case"Point":if(t(p,x,y,M,L)===!1)return!1;x++,M++;break;case"LineString":case"MultiPoint":for(o=0;o<p.length;o++){if(t(p[o],x,y,M,L)===!1)return!1;x++,G==="MultiPoint"&&M++}G==="LineString"&&M++;break;case"Polygon":case"MultiLineString":for(o=0;o<p.length;o++){for(a=0;a<p[o].length-g;a++){if(t(p[o][a],x,y,M,L)===!1)return!1;x++}G==="MultiLineString"&&M++,G==="Polygon"&&L++}G==="Polygon"&&M++;break;case"MultiPolygon":for(o=0;o<p.length;o++){for(L=0,a=0;a<p[o].length;a++){for(l=0;l<p[o][a].length-g;l++){if(t(p[o][a][l],x,y,M,L)===!1)return!1;x++}L++}M++}break;case"GeometryCollection":for(o=0;o<h.geometries.length;o++)if(fr(h.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function qE(r,t,e,o){var a=e;return fr(r,function(l,h,f,p,d){h===0&&e===void 0?a=l:a=t(a,l,h,f,p,d)},o),a}function Os(r,t){var e,o,a,l,h,f,p,d,g,x,v=0,S=r.type==="FeatureCollection",b=r.type==="Feature",T=S?r.features.length:1;for(e=0;e<T;e++){for(f=S?r.features[e].geometry:b?r.geometry:r,d=S?r.features[e].properties:b?r.properties:{},g=S?r.features[e].bbox:b?r.bbox:void 0,x=S?r.features[e].id:b?r.id:void 0,p=f?f.type==="GeometryCollection":!1,h=p?f.geometries.length:1,a=0;a<h;a++){if(l=p?f.geometries[a]:f,l===null){if(t(null,v,d,g,x)===!1)return!1;continue}switch(l.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(l,v,d,g,x)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<l.geometries.length;o++)if(t(l.geometries[o],v,d,g,x)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}v++}}function Li(r,t){Os(r,function(e,o,a,l,h){var f=e===null?null:e.type;switch(f){case null:case"Point":case"LineString":case"Polygon":return t(fi(e,a,{bbox:l,id:h}),o,0)===!1?!1:void 0}var p;switch(f){case"MultiPoint":p="Point";break;case"MultiLineString":p="LineString";break;case"MultiPolygon":p="Polygon";break}for(var d=0;d<e.coordinates.length;d++){var g=e.coordinates[d],x={type:p,coordinates:g};if(t(fi(x,a),o,d)===!1)return!1}})}function Lm(r){var t=[1/0,1/0,-1/0,-1/0];return fr(r,function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]<e[0]&&(t[2]=e[0]),t[3]<e[1]&&(t[3]=e[1])}),t}Lm.default=Lm;var hi=Lm;function zr(r){if(!r)throw new Error("coord is required");if(!Array.isArray(r)){if(r.type==="Feature"&&r.geometry!==null&&r.geometry.type==="Point")return r.geometry.coordinates;if(r.type==="Point")return r.coordinates}if(Array.isArray(r)&&r.length>=2&&!Array.isArray(r[0])&&!Array.isArray(r[1]))return r;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Nm(r,t,e){if(!r)throw new Error("No feature passed");if(!e)throw new Error(".featureOf() requires a name");if(!r||r.type!=="Feature"||!r.geometry)throw new Error("Invalid input to "+e+", Feature with geometry required");if(!r.geometry||r.geometry.type!==t)throw new Error("Invalid input to "+e+": must be a "+t+", given "+r.geometry.type)}function Gr(r){return r.type==="Feature"?r.geometry:r}var BF=yn(Df(),1);var $F=yn(sS(),1);function Pr(r,t,e){if(e===void 0&&(e={}),!r)throw new Error("point is required");if(!t)throw new Error("polygon is required");var o=zr(r),a=Gr(t),l=a.type,h=t.bbox,f=a.coordinates;if(h&&ZF(o,h)===!1)return!1;l==="Polygon"&&(f=[f]);for(var p=!1,d=0;d<f.length&&!p;d++)if(aS(o,f[d][0],e.ignoreBoundary)){for(var g=!1,x=1;x<f[d].length&&!g;)aS(o,f[d][x],!e.ignoreBoundary)&&(g=!0),x++;g||(p=!0)}return p}function aS(r,t,e){var o=!1;t[0][0]===t[t.length-1][0]&&t[0][1]===t[t.length-1][1]&&(t=t.slice(0,t.length-1));for(var a=0,l=t.length-1;a<t.length;l=a++){var h=t[a][0],f=t[a][1],p=t[l][0],d=t[l][1],g=r[1]*(h-p)+f*(p-r[0])+d*(r[0]-h)===0&&(h-r[0])*(p-r[0])<=0&&(f-r[1])*(d-r[1])<=0;if(g)return!e;var x=f>r[1]!=d>r[1]&&r[0]<(p-h)*(r[1]-f)/(d-f)+h;x&&(o=!o)}return o}function ZF(r,t){return t[0]<=r[0]&&t[1]<=r[1]&&t[2]>=r[0]&&t[3]>=r[1]}var cS=new ArrayBuffer(16),TH=new Float64Array(cS),AH=new Uint32Array(cS);var cU=yn(Zm(),1);var Q6=function(){function r(t){this.points=t.points||[],this.duration=t.duration||1e4,this.sharpness=t.sharpness||.85,this.centers=[],this.controls=[],this.stepLength=t.stepLength||60,this.length=this.points.length,this.delay=0;for(var e=0;e<this.length;e++)this.points[e].z=this.points[e].z||0;for(var e=0;e<this.length-1;e++){var o=this.points[e],a=this.points[e+1];this.centers.push({x:(o.x+a.x)/2,y:(o.y+a.y)/2,z:(o.z+a.z)/2})}this.controls.push([this.points[0],this.points[0]]);for(var e=0;e<this.centers.length-1;e++){var l=this.points[e+1].x-(this.centers[e].x+this.centers[e+1].x)/2,h=this.points[e+1].y-(this.centers[e].y+this.centers[e+1].y)/2,f=this.points[e+1].z-(this.centers[e].y+this.centers[e+1].z)/2;this.controls.push([{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e].x+l),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e].y+h),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e].z+f)},{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e+1].x+l),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e+1].y+h),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e+1].z+f)}])}return this.controls.push([this.points[this.length-1],this.points[this.length-1]]),this.steps=this.cacheSteps(this.stepLength),this}return r.prototype.cacheSteps=function(t){var e=[],o=this.pos(0);e.push(0);for(var a=0;a<this.duration;a+=10){var l=this.pos(a),h=Math.sqrt((l.x-o.x)*(l.x-o.x)+(l.y-o.y)*(l.y-o.y)+(l.z-o.z)*(l.z-o.z));h>t&&(e.push(a),o=l)}return e},r.prototype.vector=function(t){var e=this.pos(t+10),o=this.pos(t-10);return{angle:180*Math.atan2(e.y-o.y,e.x-o.x)/3.14,speed:Math.sqrt((o.x-e.x)*(o.x-e.x)+(o.y-e.y)*(o.y-e.y)+(o.z-e.z)*(o.z-e.z))}},r.prototype.pos=function(t){var e=t-this.delay;e<0&&(e=0),e>this.duration&&(e=this.duration-1);var o=e/this.duration;if(o>=1)return this.points[this.length-1];var a=Math.floor((this.points.length-1)*o),l=(this.length-1)*o-a;return fU(l,this.points[a],this.controls[a][1],this.controls[a+1][0],this.points[a+1])},r}();function fU(r,t,e,o,a){var l=hU(r),h={x:a.x*l[0]+o.x*l[1]+e.x*l[2]+t.x*l[3],y:a.y*l[0]+o.y*l[1]+e.y*l[2]+t.y*l[3],z:a.z*l[0]+o.z*l[1]+e.z*l[2]+t.z*l[3]};return h}function hU(r){var t=r*r,e=t*r;return[e,3*t*(1-r),3*r*(1-r)*(1-r),(1-r)*(1-r)*(1-r)]}function Ll(r,t){t===void 0&&(t={});var e=Number(r[0]),o=Number(r[1]),a=Number(r[2]),l=Number(r[3]);if(r.length===6)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var h=[e,o],f=[e,l],p=[a,l],d=[a,o];return Vn([[h,d,p,f,h]],t.properties,{bbox:r,id:t.id})}function pU(r){return Ll(hi(r))}var Jm=pU;var IU=yn(ES(),1);var rB=yn(jf(),1);var oB=yn(Df(),1);var uB=yn(Zm(),1);var zS=Math.PI/180,GS=180/Math.PI,zl=function(r,t){this.lon=r,this.lat=t,this.x=zS*r,this.y=zS*t};zl.prototype.view=function(){return String(this.lon).slice(0,4)+","+String(this.lat).slice(0,4)};zl.prototype.antipode=function(){var r=-1*this.lat,t=this.lon<0?180+this.lon:(180-this.lon)*-1;return new zl(t,r)};var kS=function(){this.coords=[],this.length=0};kS.prototype.move_to=function(r){this.length++,this.coords.push(r)};var gg=function(r){this.properties=r||{},this.geometries=[]};gg.prototype.json=function(){if(this.geometries.length<=0)return{geometry:{type:"LineString",coordinates:null},type:"Feature",properties:this.properties};if(this.geometries.length===1)return{geometry:{type:"LineString",coordinates:this.geometries[0].coords},type:"Feature",properties:this.properties};for(var r=[],t=0;t<this.geometries.length;t++)r.push(this.geometries[t].coords);return{geometry:{type:"MultiLineString",coordinates:r},type:"Feature",properties:this.properties}};gg.prototype.wkt=function(){for(var r="",t="LINESTRING(",e=function(l){t+=l[0]+" "+l[1]+","},o=0;o<this.geometries.length;o++){if(this.geometries[o].coords.length===0)return"LINESTRING(empty)";var a=this.geometries[o].coords;a.forEach(e),r+=t.substring(0,t.length-1)+")"}return r};var qS=function(r,t,e){if(!r||r.x===void 0||r.y===void 0)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");if(!t||t.x===void 0||t.y===void 0)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");this.start=new zl(r.x,r.y),this.end=new zl(t.x,t.y),this.properties=e||{};var o=this.start.x-this.end.x,a=this.start.y-this.end.y,l=Math.pow(Math.sin(a/2),2)+Math.cos(this.start.y)*Math.cos(this.end.y)*Math.pow(Math.sin(o/2),2);if(this.g=2*Math.asin(Math.sqrt(l)),this.g===Math.PI)throw new Error("it appears "+r.view()+" and "+t.view()+" are 'antipodal', e.g diametrically opposite, thus there is no single route but rather infinite");if(isNaN(this.g))throw new Error("could not calculate great circle between "+r+" and "+t)};qS.prototype.interpolate=function(r){var t=Math.sin((1-r)*this.g)/Math.sin(this.g),e=Math.sin(r*this.g)/Math.sin(this.g),o=t*Math.cos(this.start.y)*Math.cos(this.start.x)+e*Math.cos(this.end.y)*Math.cos(this.end.x),a=t*Math.cos(this.start.y)*Math.sin(this.start.x)+e*Math.cos(this.end.y)*Math.sin(this.end.x),l=t*Math.sin(this.start.y)+e*Math.sin(this.end.y),h=GS*Math.atan2(l,Math.sqrt(Math.pow(o,2)+Math.pow(a,2))),f=GS*Math.atan2(a,o);return[f,h]};qS.prototype.Arc=function(r,t){var e=[];if(!r||r<=2)e.push([this.start.lon,this.start.lat]),e.push([this.end.lon,this.end.lat]);else for(var o=1/(r-1),a=0;a<r;++a){var l=o*a,h=this.interpolate(l);e.push(h)}for(var f=!1,p=0,d=t&&t.offset?t.offset:10,g=180-d,x=-180+d,v=360-d,S=1;S<e.length;++S){var b=e[S-1][0],T=e[S][0],_=Math.abs(T-b);_>v&&(T>g&&b<x||b>g&&T<x)?f=!0:_>p&&(p=_)}var y=[];if(f&&p<d){var A=[];y.push(A);for(var M=0;M<e.length;++M){var L=parseFloat(e[M][0]);if(M>0&&Math.abs(L-e[M-1][0])>v){var G=parseFloat(e[M-1][0]),z=parseFloat(e[M-1][1]),F=parseFloat(e[M][0]),I=parseFloat(e[M][1]);if(G>-180&&G<x&&F===180&&M+1<e.length&&e[M-1][0]>-180&&e[M-1][0]<x){A.push([-180,e[M][1]]),M++,A.push([e[M][0],e[M][1]]);continue}else if(G>g&&G<180&&F===-180&&M+1<e.length&&e[M-1][0]>g&&e[M-1][0]<180){A.push([180,e[M][1]]),M++,A.push([e[M][0],e[M][1]]);continue}if(G<x&&F>g){var ut=G;G=F,F=ut;var R=z;z=I,I=R}if(G>g&&F<x&&(F+=360),G<=180&&F>=180&&G<F){var W=(180-G)/(F-G),V=W*I+(1-W)*z;A.push([e[M-1][0]>g?180:-180,V]),A=[],A.push([e[M-1][0]>g?-180:180,V]),y.push(A)}else A=[],y.push(A);A.push([L,e[M][1]])}else A.push([e[M][0],e[M][1]])}}else{var St=[];y.push(St);for(var X=0;X<e.length;++X)St.push([e[X][0],e[X][1]])}for(var mt=new gg(this.properties),dt=0;dt<y.length;++dt){var vt=new kS;mt.geometries.push(vt);for(var rt=y[dt],lt=0;lt<rt.length;++lt)vt.move_to(rt[lt])}return mt};var fB=yn(jf(),1);var Hz=yn(jf(),1);var Wz=yn(Bg(),1);var $z=yn(Df(),1);var we=[],be=[],Te=[],Ae=[],Ce=[],Pe=[],Ie=[],Re=[],Le=[],Ne=[],Oe=[],De=[],Fe=[],Ue=[],Be=[],ze=[],Ge=[],ke=[],qe=[],Ve=[],He=[],We=[],Xe=[],Ye=[];Ie[85]=Ne[85]=-1;Re[85]=Oe[85]=0;Le[85]=De[85]=1;qe[85]=We[85]=1;Ve[85]=Xe[85]=0;He[85]=Ye[85]=1;we[85]=Ae[85]=0;be[85]=Ce[85]=-1;Te[85]=Be[85]=0;ze[85]=Fe[85]=0;Ge[85]=Ue[85]=1;Pe[85]=ke[85]=1;We[1]=We[169]=0;Xe[1]=Xe[169]=-1;Ye[1]=Ye[169]=0;Fe[1]=Fe[169]=-1;Ue[1]=Ue[169]=0;Be[1]=Be[169]=0;Ne[4]=Ne[166]=0;Oe[4]=Oe[166]=-1;De[4]=De[166]=1;ze[4]=ze[166]=1;Ge[4]=Ge[166]=0;ke[4]=ke[166]=0;Ie[16]=Ie[154]=0;Re[16]=Re[154]=1;Le[16]=Le[154]=1;Ae[16]=Ae[154]=1;Ce[16]=Ce[154]=0;Pe[16]=Pe[154]=1;qe[64]=qe[106]=0;Ve[64]=Ve[106]=1;He[64]=He[106]=0;we[64]=we[106]=-1;be[64]=be[106]=0;Te[64]=Te[106]=1;qe[2]=qe[168]=0;Ve[2]=Ve[168]=-1;He[2]=He[168]=1;We[2]=We[168]=0;Xe[2]=Xe[168]=-1;Ye[2]=Ye[168]=0;Fe[2]=Fe[168]=-1;Ue[2]=Ue[168]=0;Be[2]=Be[168]=0;ze[2]=ze[168]=-1;Ge[2]=Ge[168]=0;ke[2]=ke[168]=1;Ie[8]=Ie[162]=0;Re[8]=Re[162]=-1;Le[8]=Le[162]=0;Ne[8]=Ne[162]=0;Oe[8]=Oe[162]=-1;De[8]=De[162]=1;Fe[8]=Fe[162]=1;Ue[8]=Ue[162]=0;Be[8]=Be[162]=1;ze[8]=ze[162]=1;Ge[8]=Ge[162]=0;ke[8]=ke[162]=0;Ie[32]=Ie[138]=0;Re[32]=Re[138]=1;Le[32]=Le[138]=1;Ne[32]=Ne[138]=0;Oe[32]=Oe[138]=1;De[32]=De[138]=0;we[32]=we[138]=1;be[32]=be[138]=0;Te[32]=Te[138]=0;Ae[32]=Ae[138]=1;Ce[32]=Ce[138]=0;Pe[32]=Pe[138]=1;We[128]=We[42]=0;Xe[128]=Xe[42]=1;Ye[128]=Ye[42]=1;qe[128]=qe[42]=0;Ve[128]=Ve[42]=1;He[128]=He[42]=0;we[128]=we[42]=-1;be[128]=be[42]=0;Te[128]=Te[42]=1;Ae[128]=Ae[42]=-1;Ce[128]=Ce[42]=0;Pe[128]=Pe[42]=0;Ne[5]=Ne[165]=-1;Oe[5]=Oe[165]=0;De[5]=De[165]=0;We[5]=We[165]=1;Xe[5]=Xe[165]=0;Ye[5]=Ye[165]=0;ze[20]=ze[150]=0;Ge[20]=Ge[150]=1;ke[20]=ke[150]=1;Ae[20]=Ae[150]=0;Ce[20]=Ce[150]=-1;Pe[20]=Pe[150]=1;Ie[80]=Ie[90]=-1;Re[80]=Re[90]=0;Le[80]=Le[90]=1;qe[80]=qe[90]=1;Ve[80]=Ve[90]=0;He[80]=He[90]=1;Fe[65]=Fe[105]=0;Ue[65]=Ue[105]=1;Be[65]=Be[105]=0;we[65]=we[105]=0;be[65]=be[105]=-1;Te[65]=Te[105]=0;Ie[160]=Ie[10]=-1;Re[160]=Re[10]=0;Le[160]=Le[10]=1;Ne[160]=Ne[10]=-1;Oe[160]=Oe[10]=0;De[160]=De[10]=0;We[160]=We[10]=1;Xe[160]=Xe[10]=0;Ye[160]=Ye[10]=0;qe[160]=qe[10]=1;Ve[160]=Ve[10]=0;He[160]=He[10]=1;ze[130]=ze[40]=0;Ge[130]=Ge[40]=1;ke[130]=ke[40]=1;Fe[130]=Fe[40]=0;Ue[130]=Ue[40]=1;Be[130]=Be[40]=0;we[130]=we[40]=0;be[130]=be[40]=-1;Te[130]=Te[40]=0;Ae[130]=Ae[40]=0;Ce[130]=Ce[40]=-1;Pe[130]=Pe[40]=1;Ne[37]=Ne[133]=0;Oe[37]=Oe[133]=1;De[37]=De[133]=1;We[37]=We[133]=0;Xe[37]=Xe[133]=1;Ye[37]=Ye[133]=0;we[37]=we[133]=-1;be[37]=be[133]=0;Te[37]=Te[133]=0;Ae[37]=Ae[133]=1;Ce[37]=Ce[133]=0;Pe[37]=Pe[133]=0;ze[148]=ze[22]=-1;Ge[148]=Ge[22]=0;ke[148]=ke[22]=0;We[148]=We[22]=0;Xe[148]=Xe[22]=-1;Ye[148]=Ye[22]=1;qe[148]=qe[22]=0;Ve[148]=Ve[22]=1;He[148]=He[22]=1;Ae[148]=Ae[22]=-1;Ce[148]=Ce[22]=0;Pe[148]=Pe[22]=1;Ie[82]=Ie[88]=0;Re[82]=Re[88]=-1;Le[82]=Le[88]=1;ze[82]=ze[88]=1;Ge[82]=Ge[88]=0;ke[82]=ke[88]=1;Fe[82]=Fe[88]=-1;Ue[82]=Ue[88]=0;Be[82]=Be[88]=1;qe[82]=qe[88]=0;Ve[82]=Ve[88]=-1;He[82]=He[88]=0;Ie[73]=Ie[97]=0;Re[73]=Re[97]=1;Le[73]=Le[97]=0;Ne[73]=Ne[97]=0;Oe[73]=Oe[97]=-1;De[73]=De[97]=0;Fe[73]=Fe[97]=1;Ue[73]=Ue[97]=0;Be[73]=Be[97]=0;we[73]=we[97]=1;be[73]=be[97]=0;Te[73]=Te[97]=1;Ie[145]=Ie[25]=0;Re[145]=Re[25]=-1;Le[145]=Le[25]=0;Fe[145]=Fe[25]=1;Ue[145]=Ue[25]=0;Be[145]=Be[25]=1;We[145]=We[25]=0;Xe[145]=Xe[25]=1;Ye[145]=Ye[25]=1;Ae[145]=Ae[25]=-1;Ce[145]=Ce[25]=0;Pe[145]=Pe[25]=0;Ne[70]=Ne[100]=0;Oe[70]=Oe[100]=1;De[70]=De[100]=0;ze[70]=ze[100]=-1;Ge[70]=Ge[100]=0;ke[70]=ke[100]=1;qe[70]=qe[100]=0;Ve[70]=Ve[100]=-1;He[70]=He[100]=1;we[70]=we[100]=1;be[70]=be[100]=0;Te[70]=Te[100]=0;Ne[101]=Ne[69]=0;Oe[101]=Oe[69]=1;De[101]=De[69]=0;we[101]=we[69]=1;be[101]=be[69]=0;Te[101]=Te[69]=0;We[149]=We[21]=0;Xe[149]=Xe[21]=1;Ye[149]=Ye[21]=1;Ae[149]=Ae[21]=-1;Ce[149]=Ce[21]=0;Pe[149]=Pe[21]=0;ze[86]=ze[84]=-1;Ge[86]=Ge[84]=0;ke[86]=ke[84]=1;qe[86]=qe[84]=0;Ve[86]=Ve[84]=-1;He[86]=He[84]=1;Ie[89]=Ie[81]=0;Re[89]=Re[81]=-1;Le[89]=Le[81]=0;Fe[89]=Fe[81]=1;Ue[89]=Ue[81]=0;Be[89]=Be[81]=1;Ie[96]=Ie[74]=0;Re[96]=Re[74]=1;Le[96]=Le[74]=0;Ne[96]=Ne[74]=-1;Oe[96]=Oe[74]=0;De[96]=De[74]=1;qe[96]=qe[74]=1;Ve[96]=Ve[74]=0;He[96]=He[74]=0;we[96]=we[74]=1;be[96]=be[74]=0;Te[96]=Te[74]=1;Ie[24]=Ie[146]=0;Re[24]=Re[146]=-1;Le[24]=Le[146]=1;ze[24]=ze[146]=1;Ge[24]=Ge[146]=0;ke[24]=ke[146]=1;Fe[24]=Fe[146]=0;Ue[24]=Ue[146]=1;Be[24]=Be[146]=1;Ae[24]=Ae[146]=0;Ce[24]=Ce[146]=-1;Pe[24]=Pe[146]=0;Ne[6]=Ne[164]=-1;Oe[6]=Oe[164]=0;De[6]=De[164]=1;ze[6]=ze[164]=-1;Ge[6]=Ge[164]=0;ke[6]=ke[164]=0;We[6]=We[164]=0;Xe[6]=Xe[164]=-1;Ye[6]=Ye[164]=1;qe[6]=qe[164]=1;Ve[6]=Ve[164]=0;He[6]=He[164]=0;Fe[129]=Fe[41]=0;Ue[129]=Ue[41]=1;Be[129]=Be[41]=1;We[129]=We[41]=0;Xe[129]=Xe[41]=1;Ye[129]=Ye[41]=0;we[129]=we[41]=-1;be[129]=be[41]=0;Te[129]=Te[41]=0;Ae[129]=Ae[41]=0;Ce[129]=Ce[41]=-1;Pe[129]=Pe[41]=0;ze[66]=ze[104]=0;Ge[66]=Ge[104]=1;ke[66]=ke[104]=0;Fe[66]=Fe[104]=-1;Ue[66]=Ue[104]=0;Be[66]=Be[104]=1;qe[66]=qe[104]=0;Ve[66]=Ve[104]=-1;He[66]=He[104]=0;we[66]=we[104]=0;be[66]=be[104]=-1;Te[66]=Te[104]=1;Ie[144]=Ie[26]=-1;Re[144]=Re[26]=0;Le[144]=Le[26]=0;We[144]=We[26]=1;Xe[144]=Xe[26]=0;Ye[144]=Ye[26]=1;qe[144]=qe[26]=0;Ve[144]=Ve[26]=1;He[144]=He[26]=1;Ae[144]=Ae[26]=-1;Ce[144]=Ce[26]=0;Pe[144]=Pe[26]=1;Ne[36]=Ne[134]=0;Oe[36]=Oe[134]=1;De[36]=De[134]=1;ze[36]=ze[134]=0;Ge[36]=Ge[134]=1;ke[36]=ke[134]=0;we[36]=we[134]=0;be[36]=be[134]=-1;Te[36]=Te[134]=1;Ae[36]=Ae[134]=1;Ce[36]=Ce[134]=0;Pe[36]=Pe[134]=0;Ie[9]=Ie[161]=-1;Re[9]=Re[161]=0;Le[9]=Le[161]=0;Ne[9]=Ne[161]=0;Oe[9]=Oe[161]=-1;De[9]=De[161]=0;Fe[9]=Fe[161]=1;Ue[9]=Ue[161]=0;Be[9]=Be[161]=0;We[9]=We[161]=1;Xe[9]=Xe[161]=0;Ye[9]=Ye[161]=1;Ie[136]=0;Re[136]=1;Le[136]=1;Ne[136]=0;Oe[136]=1;De[136]=0;ze[136]=-1;Ge[136]=0;ke[136]=1;Fe[136]=-1;Ue[136]=0;Be[136]=0;We[136]=0;Xe[136]=-1;Ye[136]=0;qe[136]=0;Ve[136]=-1;He[136]=1;we[136]=1;be[136]=0;Te[136]=0;Ae[136]=1;Ce[136]=0;Pe[136]=1;Ie[34]=0;Re[34]=-1;Le[34]=0;Ne[34]=0;Oe[34]=-1;De[34]=1;ze[34]=1;Ge[34]=0;ke[34]=0;Fe[34]=1;Ue[34]=0;Be[34]=1;We[34]=0;Xe[34]=1;Ye[34]=1;qe[34]=0;Ve[34]=1;He[34]=0;we[34]=-1;be[34]=0;Te[34]=1;Ae[34]=-1;Ce[34]=0;Pe[34]=0;Ie[35]=0;Re[35]=1;Le[35]=1;Ne[35]=0;Oe[35]=-1;De[35]=1;ze[35]=1;Ge[35]=0;ke[35]=0;Fe[35]=-1;Ue[35]=0;Be[35]=0;We[35]=0;Xe[35]=-1;Ye[35]=0;qe[35]=0;Ve[35]=1;He[35]=0;we[35]=-1;be[35]=0;Te[35]=1;Ae[35]=1;Ce[35]=0;Pe[35]=1;Ie[153]=0;Re[153]=1;Le[153]=1;Fe[153]=-1;Ue[153]=0;Be[153]=0;We[153]=0;Xe[153]=-1;Ye[153]=0;Ae[153]=1;Ce[153]=0;Pe[153]=1;Ne[102]=0;Oe[102]=-1;De[102]=1;ze[102]=1;Ge[102]=0;ke[102]=0;qe[102]=0;Ve[102]=1;He[102]=0;we[102]=-1;be[102]=0;Te[102]=1;Ie[155]=0;Re[155]=-1;Le[155]=0;Fe[155]=1;Ue[155]=0;Be[155]=1;We[155]=0;Xe[155]=1;Ye[155]=1;Ae[155]=-1;Ce[155]=0;Pe[155]=0;Ne[103]=0;Oe[103]=1;De[103]=0;ze[103]=-1;Ge[103]=0;ke[103]=1;qe[103]=0;Ve[103]=-1;He[103]=1;we[103]=1;be[103]=0;Te[103]=0;Ie[152]=0;Re[152]=1;Le[152]=1;ze[152]=-1;Ge[152]=0;ke[152]=1;Fe[152]=-1;Ue[152]=0;Be[152]=0;We[152]=0;Xe[152]=-1;Ye[152]=0;qe[152]=0;Ve[152]=-1;He[152]=1;Ae[152]=1;Ce[152]=0;Pe[152]=1;Ie[156]=0;Re[156]=-1;Le[156]=1;ze[156]=1;Ge[156]=0;ke[156]=1;Fe[156]=-1;Ue[156]=0;Be[156]=0;We[156]=0;Xe[156]=-1;Ye[156]=0;qe[156]=0;Ve[156]=1;He[156]=1;Ae[156]=-1;Ce[156]=0;Pe[156]=1;Ie[137]=0;Re[137]=1;Le[137]=1;Ne[137]=0;Oe[137]=1;De[137]=0;Fe[137]=-1;Ue[137]=0;Be[137]=0;We[137]=0;Xe[137]=-1;Ye[137]=0;we[137]=1;be[137]=0;Te[137]=0;Ae[137]=1;Ce[137]=0;Pe[137]=1;Ie[139]=0;Re[139]=1;Le[139]=1;Ne[139]=0;Oe[139]=-1;De[139]=0;Fe[139]=1;Ue[139]=0;Be[139]=0;We[139]=0;Xe[139]=1;Ye[139]=0;we[139]=-1;be[139]=0;Te[139]=0;Ae[139]=1;Ce[139]=0;Pe[139]=1;Ie[98]=0;Re[98]=-1;Le[98]=0;Ne[98]=0;Oe[98]=-1;De[98]=1;ze[98]=1;Ge[98]=0;ke[98]=0;Fe[98]=1;Ue[98]=0;Be[98]=1;qe[98]=0;Ve[98]=1;He[98]=0;we[98]=-1;be[98]=0;Te[98]=1;Ie[99]=0;Re[99]=1;Le[99]=0;Ne[99]=0;Oe[99]=-1;De[99]=1;ze[99]=1;Ge[99]=0;ke[99]=0;Fe[99]=-1;Ue[99]=0;Be[99]=1;qe[99]=0;Ve[99]=-1;He[99]=0;we[99]=1;be[99]=0;Te[99]=1;Ne[38]=0;Oe[38]=-1;De[38]=1;ze[38]=1;Ge[38]=0;ke[38]=0;We[38]=0;Xe[38]=1;Ye[38]=1;qe[38]=0;Ve[38]=1;He[38]=0;we[38]=-1;be[38]=0;Te[38]=1;Ae[38]=-1;Ce[38]=0;Pe[38]=0;Ne[39]=0;Oe[39]=1;De[39]=1;ze[39]=-1;Ge[39]=0;ke[39]=0;We[39]=0;Xe[39]=-1;Ye[39]=1;qe[39]=0;Ve[39]=1;He[39]=0;we[39]=-1;be[39]=0;Te[39]=1;Ae[39]=1;Ce[39]=0;Pe[39]=0;var zg=function(r){return[[r.bottomleft,0],[0,0],[0,r.leftbottom]]},Gg=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0]]},kg=function(r){return[[r.topright,1],[1,1],[1,r.righttop]]},qg=function(r){return[[0,r.lefttop],[0,1],[r.topleft,1]]},Vg=function(r){return[[r.bottomright,0],[r.bottomleft,0],[0,r.leftbottom],[0,r.lefttop]]},Hg=function(r){return[[r.bottomright,0],[r.bottomleft,0],[1,r.righttop],[1,r.rightbottom]]},Wg=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.topleft,1],[r.topright,1]]},Xg=function(r){return[[0,r.leftbottom],[0,r.lefttop],[r.topleft,1],[r.topright,1]]},Zz=function(r){return[[0,0],[0,r.leftbottom],[1,r.rightbottom],[1,0]]},Jz=function(r){return[[1,0],[r.bottomright,0],[r.topright,1],[1,1]]},Kz=function(r){return[[1,1],[1,r.righttop],[0,r.lefttop],[0,1]]},jz=function(r){return[[r.bottomleft,0],[0,0],[0,1],[r.topleft,1]]},Qz=function(r){return[[1,r.righttop],[1,r.rightbottom],[0,r.leftbottom],[0,r.lefttop]]},tG=function(r){return[[r.topleft,1],[r.topright,1],[r.bottomright,0],[r.bottomleft,0]]},eG=function(){return[[0,0],[0,1],[1,1],[1,0]]},nG=function(r){return[[1,r.rightbottom],[1,0],[0,0],[0,1],[r.topleft,1]]},rG=function(r){return[[r.topright,1],[1,1],[1,0],[0,0],[0,r.leftbottom]]},iG=function(r){return[[1,0],[r.bottomright,0],[0,r.lefttop],[0,1],[1,1]]},oG=function(r){return[[1,1],[1,r.righttop],[r.bottomleft,0],[0,0],[0,1]]},sG=function(r){return[[1,r.righttop],[1,r.rightbottom],[0,r.lefttop],[0,1],[r.topleft,1]]},aG=function(r){return[[1,1],[1,r.righttop],[r.bottomright,0],[r.bottomleft,0],[r.topright,1]]},uG=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.leftbottom],[0,r.lefttop]]},lG=function(r){return[[r.topright,1],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topleft,1]]},cG=function(r){return[[r.bottomright,0],[r.bottomleft,0],[0,r.lefttop],[0,1],[r.topleft,1]]},fG=function(r){return[[1,1],[1,r.righttop],[0,r.leftbottom],[0,r.lefttop],[r.topright,1]]},hG=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[r.topleft,1],[r.topright,1]]},pG=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomleft,0],[0,0],[0,r.leftbottom]]},dG=function(r){return[[1,r.rightbottom],[1,0],[0,0],[0,r.leftbottom],[r.topleft,1],[r.topright,1]]},mG=function(r){return[[1,1],[1,0],[r.bottomright,0],[0,r.leftbottom],[0,r.lefttop],[r.topright,1]]},gG=function(r){return[[1,1],[1,r.righttop],[r.bottomright,0],[r.bottomleft,0],[0,r.lefttop],[0,1]]},yG=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomleft,0],[0,0],[0,1],[r.topleft,1]]},vG=function(r){return[[1,1],[1,r.righttop],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topright,1]]},_G=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.lefttop],[0,1],[r.topleft,1]]},xG=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomright,0],[r.bottomleft,0],[0,r.leftbottom],[0,r.lefttop],[r.topleft,1],[r.topright,1]]},EG=function(r){return[[1,1],[1,r.righttop],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topright,1]]},SG=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.lefttop],[0,1],[r.topleft,1]]},MG=function(r){return[[1,1],[1,r.righttop],[r.bottomright,0],[r.bottomleft,0],[0,r.leftbottom],[0,r.lefttop],[r.topright,1]]},wG=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomleft,0],[0,0],[0,r.leftbottom],[r.topleft,1],[r.topright,1]]},bG=function(r){return[[1,r.righttop],[1,r.rightbottom],[r.bottomright,0],[r.bottomleft,0],[0,r.lefttop],[0,1],[r.topleft,1]]},TG=function(r){return[[1,r.rightbottom],[1,0],[r.bottomright,0],[0,r.leftbottom],[0,r.lefttop],[r.topleft,1],[r.topright,1]]},Je=[],Ke=[],je=[],Qe=[],tn=[],en=[],nn=[],rn=[];Qe[1]=tn[1]=18;Qe[169]=tn[169]=18;je[4]=Ke[4]=12;je[166]=Ke[166]=12;Je[16]=rn[16]=4;Je[154]=rn[154]=4;en[64]=nn[64]=22;en[106]=nn[106]=22;je[2]=en[2]=17;Qe[2]=tn[2]=18;je[168]=en[168]=17;Qe[168]=tn[168]=18;Je[8]=Qe[8]=9;Ke[8]=je[8]=12;Je[162]=Qe[162]=9;Ke[162]=je[162]=12;Je[32]=rn[32]=4;Ke[32]=nn[32]=1;Je[138]=rn[138]=4;Ke[138]=nn[138]=1;tn[128]=rn[128]=21;en[128]=nn[128]=22;tn[42]=rn[42]=21;en[42]=nn[42]=22;Ke[5]=tn[5]=14;Ke[165]=tn[165]=14;je[20]=rn[20]=6;je[150]=rn[150]=6;Je[80]=en[80]=11;Je[90]=en[90]=11;Qe[65]=nn[65]=3;Qe[105]=nn[105]=3;Je[160]=en[160]=11;Ke[160]=tn[160]=14;Je[10]=en[10]=11;Ke[10]=tn[10]=14;je[130]=rn[130]=6;Qe[130]=nn[130]=3;je[40]=rn[40]=6;Qe[40]=nn[40]=3;Ke[101]=nn[101]=1;Ke[69]=nn[69]=1;tn[149]=rn[149]=21;tn[21]=rn[21]=21;je[86]=en[86]=17;je[84]=en[84]=17;Je[89]=Qe[89]=9;Je[81]=Qe[81]=9;Je[96]=nn[96]=0;Ke[96]=en[96]=15;Je[74]=nn[74]=0;Ke[74]=en[74]=15;Je[24]=je[24]=8;Qe[24]=rn[24]=7;Je[146]=je[146]=8;Qe[146]=rn[146]=7;Ke[6]=en[6]=15;je[6]=tn[6]=16;Ke[164]=en[164]=15;je[164]=tn[164]=16;Qe[129]=rn[129]=7;tn[129]=nn[129]=20;Qe[41]=rn[41]=7;tn[41]=nn[41]=20;je[66]=nn[66]=2;Qe[66]=en[66]=19;je[104]=nn[104]=2;Qe[104]=en[104]=19;Je[144]=tn[144]=10;en[144]=rn[144]=23;Je[26]=tn[26]=10;en[26]=rn[26]=23;Ke[36]=rn[36]=5;je[36]=nn[36]=2;Ke[134]=rn[134]=5;je[134]=nn[134]=2;Je[9]=tn[9]=10;Ke[9]=Qe[9]=13;Je[161]=tn[161]=10;Ke[161]=Qe[161]=13;Ke[37]=rn[37]=5;tn[37]=nn[37]=20;Ke[133]=rn[133]=5;tn[133]=nn[133]=20;je[148]=tn[148]=16;en[148]=rn[148]=23;je[22]=tn[22]=16;en[22]=rn[22]=23;Je[82]=je[82]=8;Qe[82]=en[82]=19;Je[88]=je[88]=8;Qe[88]=en[88]=19;Je[73]=nn[73]=0;Ke[73]=Qe[73]=13;Je[97]=nn[97]=0;Ke[97]=Qe[97]=13;Je[145]=Qe[145]=9;tn[145]=rn[145]=21;Je[25]=Qe[25]=9;tn[25]=rn[25]=21;Ke[70]=nn[70]=1;je[70]=en[70]=17;Ke[100]=nn[100]=1;je[100]=en[100]=17;Je[34]=Qe[34]=9;Ke[34]=je[34]=12;tn[34]=rn[34]=21;en[34]=nn[34]=22;Je[136]=rn[136]=4;Ke[136]=nn[136]=1;je[136]=en[136]=17;Qe[136]=tn[136]=18;Je[35]=rn[35]=4;Ke[35]=je[35]=12;Qe[35]=tn[35]=18;en[35]=nn[35]=22;Je[153]=rn[153]=4;Qe[153]=tn[153]=18;Ke[102]=je[102]=12;en[102]=nn[102]=22;Je[155]=Qe[155]=9;tn[155]=rn[155]=23;Ke[103]=nn[103]=1;je[103]=en[103]=17;Je[152]=rn[152]=4;je[152]=en[152]=17;Qe[152]=tn[152]=18;Je[156]=je[156]=8;Qe[156]=tn[156]=18;en[156]=rn[156]=23;Je[137]=rn[137]=4;Ke[137]=nn[137]=1;Qe[137]=tn[137]=18;Je[139]=rn[139]=4;Ke[139]=Qe[139]=13;tn[139]=nn[139]=20;Je[98]=Qe[98]=9;Ke[98]=je[98]=12;en[98]=nn[98]=22;Je[99]=nn[99]=0;Ke[99]=je[99]=12;Qe[99]=en[99]=19;Ke[38]=je[38]=12;tn[38]=rn[38]=21;en[38]=nn[38]=22;Ke[39]=rn[39]=5;je[39]=tn[39]=16;en[39]=nn[39]=22;var Gt=[];Gt[1]=Gt[169]=zg;Gt[4]=Gt[166]=Gg;Gt[16]=Gt[154]=kg;Gt[64]=Gt[106]=qg;Gt[168]=Gt[2]=Vg;Gt[162]=Gt[8]=Hg;Gt[138]=Gt[32]=Wg;Gt[42]=Gt[128]=Xg;Gt[5]=Gt[165]=Zz;Gt[20]=Gt[150]=Jz;Gt[80]=Gt[90]=Kz;Gt[65]=Gt[105]=jz;Gt[160]=Gt[10]=Qz;Gt[130]=Gt[40]=tG;Gt[85]=eG;Gt[101]=Gt[69]=nG;Gt[149]=Gt[21]=rG;Gt[86]=Gt[84]=iG;Gt[89]=Gt[81]=oG;Gt[96]=Gt[74]=sG;Gt[24]=Gt[146]=aG;Gt[6]=Gt[164]=uG;Gt[129]=Gt[41]=lG;Gt[66]=Gt[104]=cG;Gt[144]=Gt[26]=fG;Gt[36]=Gt[134]=hG;Gt[9]=Gt[161]=pG;Gt[37]=Gt[133]=dG;Gt[148]=Gt[22]=mG;Gt[82]=Gt[88]=gG;Gt[73]=Gt[97]=yG;Gt[145]=Gt[25]=vG;Gt[70]=Gt[100]=_G;Gt[34]=function(r){return[Xg(r),Hg(r)]};Gt[35]=xG;Gt[136]=function(r){return[Wg(r),Vg(r)]};Gt[153]=function(r){return[kg(r),zg(r)]};Gt[102]=function(r){return[Gg(r),qg(r)]};Gt[155]=EG;Gt[103]=SG;Gt[152]=function(r){return[kg(r),Vg(r)]};Gt[156]=MG;Gt[137]=function(r){return[Wg(r),zg(r)]};Gt[139]=wG;Gt[98]=function(r){return[Hg(r),qg(r)]};Gt[99]=bG;Gt[38]=function(r){return[Gg(r),Xg(r)]};Gt[39]=TG;function CG(r){return(r>0)-(r<0)||+r}function Uu(r,t,e){var o=t[0]-r[0],a=t[1]-r[1],l=e[0]-t[0],h=e[1]-t[1];return CG(o*h-l*a)}function $w(r,t){var e=r.geometry.coordinates[0].map(function(h){return h[0]}),o=r.geometry.coordinates[0].map(function(h){return h[1]}),a=t.geometry.coordinates[0].map(function(h){return h[0]}),l=t.geometry.coordinates[0].map(function(h){return h[1]});return Math.max.apply(null,e)===Math.max.apply(null,a)&&Math.max.apply(null,o)===Math.max.apply(null,l)&&Math.min.apply(null,e)===Math.min.apply(null,a)&&Math.min.apply(null,o)===Math.min.apply(null,l)}function Yg(r,t){return t.geometry.coordinates[0].every(function(e){return Pr(Ln(e),r)})}function Zw(r,t){return r[0]===t[0]&&r[1]===t[1]}var PG=function(){function r(t){this.id=r.buildId(t),this.coordinates=t,this.innerEdges=[],this.outerEdges=[],this.outerEdgesSorted=!1}return r.buildId=function(t){return t.join(",")},r.prototype.removeInnerEdge=function(t){this.innerEdges=this.innerEdges.filter(function(e){return e.from.id!==t.from.id})},r.prototype.removeOuterEdge=function(t){this.outerEdges=this.outerEdges.filter(function(e){return e.to.id!==t.to.id})},r.prototype.addOuterEdge=function(t){this.outerEdges.push(t),this.outerEdgesSorted=!1},r.prototype.sortOuterEdges=function(){var t=this;this.outerEdgesSorted||(this.outerEdges.sort(function(e,o){var a=e.to,l=o.to;if(a.coordinates[0]-t.coordinates[0]>=0&&l.coordinates[0]-t.coordinates[0]<0)return 1;if(a.coordinates[0]-t.coordinates[0]<0&&l.coordinates[0]-t.coordinates[0]>=0)return-1;if(a.coordinates[0]-t.coordinates[0]===0&&l.coordinates[0]-t.coordinates[0]===0)return a.coordinates[1]-t.coordinates[1]>=0||l.coordinates[1]-t.coordinates[1]>=0?a.coordinates[1]-l.coordinates[1]:l.coordinates[1]-a.coordinates[1];var h=Uu(t.coordinates,a.coordinates,l.coordinates);if(h<0)return 1;if(h>0)return-1;var f=Math.pow(a.coordinates[0]-t.coordinates[0],2)+Math.pow(a.coordinates[1]-t.coordinates[1],2),p=Math.pow(l.coordinates[0]-t.coordinates[0],2)+Math.pow(l.coordinates[1]-t.coordinates[1],2);return f-p}),this.outerEdgesSorted=!0)},r.prototype.getOuterEdges=function(){return this.sortOuterEdges(),this.outerEdges},r.prototype.getOuterEdge=function(t){return this.sortOuterEdges(),this.outerEdges[t]},r.prototype.addInnerEdge=function(t){this.innerEdges.push(t)},r}(),$g=PG;var IG=function(){function r(t,e){this.from=t,this.to=e,this.next=void 0,this.label=void 0,this.symetric=void 0,this.ring=void 0,this.from.addOuterEdge(this),this.to.addInnerEdge(this)}return r.prototype.getSymetric=function(){return this.symetric||(this.symetric=new r(this.to,this.from),this.symetric.symetric=this),this.symetric},r.prototype.deleteEdge=function(){this.from.removeOuterEdge(this),this.to.removeInnerEdge(this)},r.prototype.isEqual=function(t){return this.from.id===t.from.id&&this.to.id===t.to.id},r.prototype.toString=function(){return"Edge { "+this.from.id+" -> "+this.to.id+" }"},r.prototype.toLineString=function(){return Cr([this.from.coordinates,this.to.coordinates])},r.prototype.compareTo=function(t){return Uu(t.from.coordinates,t.to.coordinates,this.to.coordinates)},r}(),Jw=IG;var RG=function(){function r(){this.edges=[],this.polygon=void 0,this.envelope=void 0}return r.prototype.push=function(t){this.edges.push(t),this.polygon=this.envelope=void 0},r.prototype.get=function(t){return this.edges[t]},Object.defineProperty(r.prototype,"length",{get:function(){return this.edges.length},enumerable:!0,configurable:!0}),r.prototype.forEach=function(t){this.edges.forEach(t)},r.prototype.map=function(t){return this.edges.map(t)},r.prototype.some=function(t){return this.edges.some(t)},r.prototype.isValid=function(){return!0},r.prototype.isHole=function(){var t=this,e=this.edges.reduce(function(h,f,p){return f.from.coordinates[1]>t.edges[h].from.coordinates[1]&&(h=p),h},0),o=(e===0?this.length:e)-1,a=(e+1)%this.length,l=Uu(this.edges[o].from.coordinates,this.edges[e].from.coordinates,this.edges[a].from.coordinates);return l===0?this.edges[o].from.coordinates[0]>this.edges[a].from.coordinates[0]:l>0},r.prototype.toMultiPoint=function(){return Rm(this.edges.map(function(t){return t.from.coordinates}))},r.prototype.toPolygon=function(){if(this.polygon)return this.polygon;var t=this.edges.map(function(e){return e.from.coordinates});return t.push(this.edges[0].from.coordinates),this.polygon=Vn([t])},r.prototype.getEnvelope=function(){return this.envelope?this.envelope:this.envelope=Jm(this.toPolygon())},r.findEdgeRingContaining=function(t,e){var o=t.getEnvelope(),a,l;return e.forEach(function(h){var f=h.getEnvelope();if(l&&(a=l.getEnvelope()),!$w(f,o)&&Yg(f,o)){for(var p=t.map(function(b){return b.from.coordinates}),d=void 0,g=function(b){h.some(function(T){return Zw(b,T.from.coordinates)})||(d=b)},x=0,v=p;x<v.length;x++){var S=v[x];g(S)}d&&h.inside(Ln(d))&&(!l||Yg(a,f))&&(l=h)}}),l},r.prototype.inside=function(t){return Pr(t,this.toPolygon())},r}(),Zg=RG;function LG(r){if(!r)throw new Error("No geojson passed");if(r.type!=="FeatureCollection"&&r.type!=="GeometryCollection"&&r.type!=="MultiLineString"&&r.type!=="LineString"&&r.type!=="Feature")throw new Error("Invalid input type '"+r.type+"'. Geojson must be FeatureCollection, GeometryCollection, LineString, MultiLineString or Feature")}var qY=function(){function r(){this.edges=[],this.nodes={}}return r.fromGeoJson=function(t){LG(t);var e=new r;return Li(t,function(o){Nm(o,"LineString","Graph::fromGeoJson"),qE(o,function(a,l){if(a){var h=e.getNode(a),f=e.getNode(l);e.addEdge(h,f)}return l})}),e},r.prototype.getNode=function(t){var e=$g.buildId(t),o=this.nodes[e];return o||(o=this.nodes[e]=new $g(t)),o},r.prototype.addEdge=function(t,e){var o=new Jw(t,e),a=o.getSymetric();this.edges.push(o),this.edges.push(a)},r.prototype.deleteDangles=function(){var t=this;Object.keys(this.nodes).map(function(e){return t.nodes[e]}).forEach(function(e){return t._removeIfDangle(e)})},r.prototype._removeIfDangle=function(t){var e=this;if(t.innerEdges.length<=1){var o=t.getOuterEdges().map(function(a){return a.to});this.removeNode(t),o.forEach(function(a){return e._removeIfDangle(a)})}},r.prototype.deleteCutEdges=function(){var t=this;this._computeNextCWEdges(),this._findLabeledEdgeRings(),this.edges.forEach(function(e){e.label===e.symetric.label&&(t.removeEdge(e.symetric),t.removeEdge(e))})},r.prototype._computeNextCWEdges=function(t){var e=this;typeof t=="undefined"?Object.keys(this.nodes).forEach(function(o){return e._computeNextCWEdges(e.nodes[o])}):t.getOuterEdges().forEach(function(o,a){t.getOuterEdge((a===0?t.getOuterEdges().length:a)-1).symetric.next=o})},r.prototype._computeNextCCWEdges=function(t,e){for(var o=t.getOuterEdges(),a,l,h=o.length-1;h>=0;--h){var f=o[h],p=f.symetric,d=void 0,g=void 0;f.label===e&&(d=f),p.label===e&&(g=p),!(!d||!g)&&(g&&(l=g),d&&(l&&(l.next=d,l=void 0),a||(a=d)))}l&&(l.next=a)},r.prototype._findLabeledEdgeRings=function(){var t=[],e=0;return this.edges.forEach(function(o){if(!(o.label>=0)){t.push(o);var a=o;do a.label=e,a=a.next;while(!o.isEqual(a));e++}}),t},r.prototype.getEdgeRings=function(){var t=this;this._computeNextCWEdges(),this.edges.forEach(function(o){o.label=void 0}),this._findLabeledEdgeRings().forEach(function(o){t._findIntersectionNodes(o).forEach(function(a){t._computeNextCCWEdges(a,o.label)})});var e=[];return this.edges.forEach(function(o){o.ring||e.push(t._findEdgeRing(o))}),e},r.prototype._findIntersectionNodes=function(t){var e=[],o=t,a=function(){var l=0;o.from.getOuterEdges().forEach(function(h){h.label===t.label&&++l}),l>1&&e.push(o.from),o=o.next};do a();while(!t.isEqual(o));return e},r.prototype._findEdgeRing=function(t){var e=t,o=new Zg;do o.push(e),e.ring=o,e=e.next;while(!t.isEqual(e));return o},r.prototype.removeNode=function(t){var e=this;t.getOuterEdges().forEach(function(o){return e.removeEdge(o)}),t.innerEdges.forEach(function(o){return e.removeEdge(o)}),delete this.nodes[t.id]},r.prototype.removeEdge=function(t){this.edges=this.edges.filter(function(e){return!e.isEqual(t)}),t.deleteEdge()},r}();var FG=yn(Jg(),1);var UG=yn(Jg(),1);var zG=yn(ob(),1);var XG=yn(mb(),1);function yb(r){for(var t=r,e=[];t.parent;)e.unshift(t),t=t.parent;return e}function $G(){return new vb(function(r){return r.f})}var t0={search:function(r,t,e,o){r.cleanDirty(),o=o||{};var a=o.heuristic||t0.heuristics.manhattan,l=o.closest||!1,h=$G(),f=t;for(t.h=a(t,e),h.push(t);h.size()>0;){var p=h.pop();if(p===e)return yb(p);p.closed=!0;for(var d=r.neighbors(p),g=0,x=d.length;g<x;++g){var v=d[g];if(!(v.closed||v.isWall())){var S=p.g+v.getCost(p),b=v.visited;(!b||S<v.g)&&(v.visited=!0,v.parent=p,v.h=v.h||a(v,e),v.g=S,v.f=v.g+v.h,r.markDirty(v),l&&(v.h<f.h||v.h===f.h&&v.g<f.g)&&(f=v),b?h.rescoreElement(v):h.push(v))}}}return l?yb(f):[]},heuristics:{manhattan:function(r,t){var e=Math.abs(t.x-r.x),o=Math.abs(t.y-r.y);return e+o},diagonal:function(r,t){var e=1,o=Math.sqrt(2),a=Math.abs(t.x-r.x),l=Math.abs(t.y-r.y);return e*(a+l)+(o-2*e)*Math.min(a,l)}},cleanNode:function(r){r.f=0,r.g=0,r.h=0,r.visited=!1,r.closed=!1,r.parent=null}};function Wl(r,t){t=t||{},this.nodes=[],this.diagonal=!!t.diagonal,this.grid=[];for(var e=0;e<r.length;e++){this.grid[e]=[];for(var o=0,a=r[e];o<a.length;o++){var l=new bh(e,o,a[o]);this.grid[e][o]=l,this.nodes.push(l)}}this.init()}Wl.prototype.init=function(){this.dirtyNodes=[];for(var r=0;r<this.nodes.length;r++)t0.cleanNode(this.nodes[r])};Wl.prototype.cleanDirty=function(){for(var r=0;r<this.dirtyNodes.length;r++)t0.cleanNode(this.dirtyNodes[r]);this.dirtyNodes=[]};Wl.prototype.markDirty=function(r){this.dirtyNodes.push(r)};Wl.prototype.neighbors=function(r){var t=[],e=r.x,o=r.y,a=this.grid;return a[e-1]&&a[e-1][o]&&t.push(a[e-1][o]),a[e+1]&&a[e+1][o]&&t.push(a[e+1][o]),a[e]&&a[e][o-1]&&t.push(a[e][o-1]),a[e]&&a[e][o+1]&&t.push(a[e][o+1]),this.diagonal&&(a[e-1]&&a[e-1][o-1]&&t.push(a[e-1][o-1]),a[e+1]&&a[e+1][o-1]&&t.push(a[e+1][o-1]),a[e-1]&&a[e-1][o+1]&&t.push(a[e-1][o+1]),a[e+1]&&a[e+1][o+1]&&t.push(a[e+1][o+1])),t};Wl.prototype.toString=function(){for(var r=[],t=this.grid,e,o,a,l,h=0,f=t.length;h<f;h++){for(e=[],o=t[h],a=0,l=o.length;a<l;a++)e.push(o[a].weight);r.push(e.join(" "))}return r.join(\`
7744
7744
  \`)};function bh(r,t,e){this.x=r,this.y=t,this.weight=e}bh.prototype.toString=function(){return"["+this.x+" "+this.y+"]"};bh.prototype.getCost=function(r){return r&&r.x!==this.x&&r.y!==this.y?this.weight*1.41421:this.weight};bh.prototype.isWall=function(){return this.weight===0};function vb(r){this.content=[],this.scoreFunction=r}vb.prototype={push:function(r){this.content.push(r),this.sinkDown(this.content.length-1)},pop:function(){var r=this.content[0],t=this.content.pop();return this.content.length>0&&(this.content[0]=t,this.bubbleUp(0)),r},remove:function(r){var t=this.content.indexOf(r),e=this.content.pop();t!==this.content.length-1&&(this.content[t]=e,this.scoreFunction(e)<this.scoreFunction(r)?this.sinkDown(t):this.bubbleUp(t))},size:function(){return this.content.length},rescoreElement:function(r){this.sinkDown(this.content.indexOf(r))},sinkDown:function(r){for(var t=this.content[r];r>0;){var e=(r+1>>1)-1,o=this.content[e];if(this.scoreFunction(t)<this.scoreFunction(o))this.content[e]=t,this.content[r]=o,r=e;else break}},bubbleUp:function(r){for(var t=this.content.length,e=this.content[r],o=this.scoreFunction(e);;){var a=r+1<<1,l=a-1,h=null,f;if(l<t){var p=this.content[l];f=this.scoreFunction(p),f<o&&(h=l)}if(a<t){var d=this.content[a],g=this.scoreFunction(d);g<(h===null?o:f)&&(h=a)}if(h!==null)this.content[r]=this.content[h],this.content[h]=e,r=h;else break}}};function e0(){this._=null}function zu(r){r.U=r.C=r.L=r.R=r.P=r.N=null}e0.prototype={constructor:e0,insert:function(r,t){var e,o,a;if(r){if(t.P=r,t.N=r.N,r.N&&(r.N.P=t),r.N=t,r.R){for(r=r.R;r.L;)r=r.L;r.L=t}else r.R=t;e=r}else this._?(r=_b(this._),t.P=null,t.N=r,r.P=r.L=t,e=r):(t.P=t.N=null,this._=t,e=null);for(t.L=t.R=null,t.U=e,t.C=!0,r=t;e&&e.C;)o=e.U,e===o.L?(a=o.R,a&&a.C?(e.C=a.C=!1,o.C=!0,r=o):(r===e.R&&(Xl(this,e),r=e,e=r.U),e.C=!1,o.C=!0,Yl(this,o))):(a=o.L,a&&a.C?(e.C=a.C=!1,o.C=!0,r=o):(r===e.L&&(Yl(this,e),r=e,e=r.U),e.C=!1,o.C=!0,Xl(this,o))),e=r.U;this._.C=!1},remove:function(r){r.N&&(r.N.P=r.P),r.P&&(r.P.N=r.N),r.N=r.P=null;var t=r.U,e,o=r.L,a=r.R,l,h;if(o?a?l=_b(a):l=o:l=a,t?t.L===r?t.L=l:t.R=l:this._=l,o&&a?(h=l.C,l.C=r.C,l.L=o,o.U=l,l!==a?(t=l.U,l.U=r.U,r=l.R,t.L=r,l.R=a,a.U=l):(l.U=t,t=l,r=l.R)):(h=r.C,r=l),r&&(r.U=t),!h){if(r&&r.C){r.C=!1;return}do{if(r===this._)break;if(r===t.L){if(e=t.R,e.C&&(e.C=!1,t.C=!0,Xl(this,t),e=t.R),e.L&&e.L.C||e.R&&e.R.C){(!e.R||!e.R.C)&&(e.L.C=!1,e.C=!0,Yl(this,e),e=t.R),e.C=t.C,t.C=e.R.C=!1,Xl(this,t),r=this._;break}}else if(e=t.L,e.C&&(e.C=!1,t.C=!0,Yl(this,t),e=t.L),e.L&&e.L.C||e.R&&e.R.C){(!e.L||!e.L.C)&&(e.R.C=!1,e.C=!0,Xl(this,e),e=t.L),e.C=t.C,t.C=e.L.C=!1,Yl(this,t),r=this._;break}e.C=!0,r=t,t=t.U}while(!r.C);r&&(r.C=!1)}}};function Xl(r,t){var e=t,o=t.R,a=e.U;a?a.L===e?a.L=o:a.R=o:r._=o,o.U=a,e.U=o,e.R=o.L,e.R&&(e.R.U=e),o.L=e}function Yl(r,t){var e=t,o=t.L,a=e.U;a?a.L===e?a.L=o:a.R=o:r._=o,o.U=a,e.U=o,e.L=o.R,e.L&&(e.L.U=e),o.R=e}function _b(r){for(;r.L;)r=r.L;return r}var n0=e0;function Gu(r,t,e,o){var a=[null,null],l=Rr.push(a)-1;return a.left=r,a.right=t,e&&$l(a,r,t,e),o&&$l(a,t,r,o),pi[r.index].halfedges.push(l),pi[t.index].halfedges.push(l),a}function ku(r,t,e){var o=[t,e];return o.left=r,o}function $l(r,t,e,o){!r[0]&&!r[1]?(r[0]=o,r.left=t,r.right=e):r.left===e?r[1]=o:r[0]=o}function ZG(r,t,e,o,a){var l=r[0],h=r[1],f=l[0],p=l[1],d=h[0],g=h[1],x=0,v=1,S=d-f,b=g-p,T;if(T=t-f,!(!S&&T>0)){if(T/=S,S<0){if(T<x)return;T<v&&(v=T)}else if(S>0){if(T>v)return;T>x&&(x=T)}if(T=o-f,!(!S&&T<0)){if(T/=S,S<0){if(T>v)return;T>x&&(x=T)}else if(S>0){if(T<x)return;T<v&&(v=T)}if(T=e-p,!(!b&&T>0)){if(T/=b,b<0){if(T<x)return;T<v&&(v=T)}else if(b>0){if(T>v)return;T>x&&(x=T)}if(T=a-p,!(!b&&T<0)){if(T/=b,b<0){if(T>v)return;T>x&&(x=T)}else if(b>0){if(T<x)return;T<v&&(v=T)}return!(x>0)&&!(v<1)||(x>0&&(r[0]=[f+x*S,p+x*b]),v<1&&(r[1]=[f+v*S,p+v*b])),!0}}}}}function JG(r,t,e,o,a){var l=r[1];if(l)return!0;var h=r[0],f=r.left,p=r.right,d=f[0],g=f[1],x=p[0],v=p[1],S=(d+x)/2,b=(g+v)/2,T,_;if(v===g){if(S<t||S>=o)return;if(d>x){if(!h)h=[S,e];else if(h[1]>=a)return;l=[S,a]}else{if(!h)h=[S,a];else if(h[1]<e)return;l=[S,e]}}else if(T=(d-x)/(v-g),_=b-T*S,T<-1||T>1)if(d>x){if(!h)h=[(e-_)/T,e];else if(h[1]>=a)return;l=[(a-_)/T,a]}else{if(!h)h=[(a-_)/T,a];else if(h[1]<e)return;l=[(e-_)/T,e]}else if(g<v){if(!h)h=[t,T*t+_];else if(h[0]>=o)return;l=[o,T*o+_]}else{if(!h)h=[o,T*o+_];else if(h[0]<t)return;l=[t,T*t+_]}return r[0]=h,r[1]=l,!0}function xb(r,t,e,o){for(var a=Rr.length,l;a--;)(!JG(l=Rr[a],r,t,e,o)||!ZG(l,r,t,e,o)||!(Math.abs(l[0][0]-l[1][0])>Cn||Math.abs(l[0][1]-l[1][1])>Cn))&&delete Rr[a]}function Eb(r){return pi[r.index]={site:r,halfedges:[]}}function KG(r,t){var e=r.site,o=t.left,a=t.right;return e===a&&(a=o,o=e),a?Math.atan2(a[1]-o[1],a[0]-o[0]):(e===o?(o=t[1],a=t[0]):(o=t[0],a=t[1]),Math.atan2(o[0]-a[0],a[1]-o[1]))}function r0(r,t){return t[+(t.left!==r.site)]}function jG(r,t){return t[+(t.left===r.site)]}function Sb(){for(var r=0,t=pi.length,e,o,a,l;r<t;++r)if((e=pi[r])&&(l=(o=e.halfedges).length)){var h=new Array(l),f=new Array(l);for(a=0;a<l;++a)h[a]=a,f[a]=KG(e,Rr[o[a]]);for(h.sort(function(p,d){return f[d]-f[p]}),a=0;a<l;++a)f[a]=o[h[a]];for(a=0;a<l;++a)o[a]=f[a]}}function Mb(r,t,e,o){var a=pi.length,l,h,f,p,d,g,x,v,S,b,T,_,y=!0;for(l=0;l<a;++l)if(h=pi[l]){for(f=h.site,d=h.halfedges,p=d.length;p--;)Rr[d[p]]||d.splice(p,1);for(p=0,g=d.length;p<g;)b=jG(h,Rr[d[p]]),T=b[0],_=b[1],x=r0(h,Rr[d[++p%g]]),v=x[0],S=x[1],(Math.abs(T-v)>Cn||Math.abs(_-S)>Cn)&&(d.splice(p,0,Rr.push(ku(f,b,Math.abs(T-r)<Cn&&o-_>Cn?[r,Math.abs(v-r)<Cn?S:o]:Math.abs(_-o)<Cn&&e-T>Cn?[Math.abs(S-o)<Cn?v:e,o]:Math.abs(T-e)<Cn&&_-t>Cn?[e,Math.abs(v-e)<Cn?S:t]:Math.abs(_-t)<Cn&&T-r>Cn?[Math.abs(S-t)<Cn?v:r,t]:null))-1),++g);g&&(y=!1)}if(y){var A,M,L,G=1/0;for(l=0,y=null;l<a;++l)(h=pi[l])&&(f=h.site,A=f[0]-r,M=f[1]-t,L=A*A+M*M,L<G&&(G=L,y=h));if(y){var z=[r,t],F=[r,o],I=[e,o],ut=[e,t];y.halfedges.push(Rr.push(ku(f=y.site,z,F))-1,Rr.push(ku(f,F,I))-1,Rr.push(ku(f,I,ut))-1,Rr.push(ku(f,ut,z))-1)}}for(l=0;l<a;++l)(h=pi[l])&&(h.halfedges.length||delete pi[l])}var wb=[],Th;function QG(){zu(this),this.x=this.y=this.arc=this.site=this.cy=null}function Sa(r){var t=r.P,e=r.N;if(!(!t||!e)){var o=t.site,a=r.site,l=e.site;if(o!==l){var h=a[0],f=a[1],p=o[0]-h,d=o[1]-f,g=l[0]-h,x=l[1]-f,v=2*(p*x-d*g);if(!(v>=-bb)){var S=p*p+d*d,b=g*g+x*x,T=(x*S-d*b)/v,_=(p*b-g*S)/v,y=wb.pop()||new QG;y.arc=r,y.site=a,y.x=T+h,y.y=(y.cy=_+f)+Math.sqrt(T*T+_*_),r.circle=y;for(var A=null,M=qu._;M;)if(y.y<M.y||y.y===M.y&&y.x<=M.x)if(M.L)M=M.L;else{A=M.P;break}else if(M.R)M=M.R;else{A=M;break}qu.insert(A,y),A||(Th=y)}}}}function Ma(r){var t=r.circle;t&&(t.P||(Th=t.N),qu.remove(t),wb.push(t),zu(t),r.circle=null)}var Ab=[];function tk(){zu(this),this.edge=this.site=this.circle=null}function Tb(r){var t=Ab.pop()||new tk;return t.site=r,t}function i0(r){Ma(r),wa.remove(r),Ab.push(r),zu(r)}function Cb(r){var t=r.circle,e=t.x,o=t.cy,a=[e,o],l=r.P,h=r.N,f=[r];i0(r);for(var p=l;p.circle&&Math.abs(e-p.circle.x)<Cn&&Math.abs(o-p.circle.cy)<Cn;)l=p.P,f.unshift(p),i0(p),p=l;f.unshift(p),Ma(p);for(var d=h;d.circle&&Math.abs(e-d.circle.x)<Cn&&Math.abs(o-d.circle.cy)<Cn;)h=d.N,f.push(d),i0(d),d=h;f.push(d),Ma(d);var g=f.length,x;for(x=1;x<g;++x)d=f[x],p=f[x-1],$l(d.edge,p.site,d.site,a);p=f[0],d=f[g-1],d.edge=Gu(p.site,d.site,null,a),Sa(p),Sa(d)}function Pb(r){for(var t=r[0],e=r[1],o,a,l,h,f=wa._;f;)if(l=Ib(f,e)-t,l>Cn)f=f.L;else if(h=t-ek(f,e),h>Cn){if(!f.R){o=f;break}f=f.R}else{l>-Cn?(o=f.P,a=f):h>-Cn?(o=f,a=f.N):o=a=f;break}Eb(r);var p=Tb(r);if(wa.insert(o,p),!(!o&&!a)){if(o===a){Ma(o),a=Tb(o.site),wa.insert(p,a),p.edge=a.edge=Gu(o.site,p.site),Sa(o),Sa(a);return}if(!a){p.edge=Gu(o.site,p.site);return}Ma(o),Ma(a);var d=o.site,g=d[0],x=d[1],v=r[0]-g,S=r[1]-x,b=a.site,T=b[0]-g,_=b[1]-x,y=2*(v*_-S*T),A=v*v+S*S,M=T*T+_*_,L=[(_*A-S*M)/y+g,(v*M-T*A)/y+x];$l(a.edge,d,b,L),p.edge=Gu(d,r,null,L),a.edge=Gu(r,b,null,L),Sa(o),Sa(a)}}function Ib(r,t){var e=r.site,o=e[0],a=e[1],l=a-t;if(!l)return o;var h=r.P;if(!h)return-1/0;e=h.site;var f=e[0],p=e[1],d=p-t;if(!d)return f;var g=f-o,x=1/l-1/d,v=g/d;return x?(-v+Math.sqrt(v*v-2*x*(g*g/(-2*d)-p+d/2+a-l/2)))/x+o:(o+f)/2}function ek(r,t){var e=r.N;if(e)return Ib(e,t);var o=r.site;return o[1]===t?o[0]:1/0}var Cn=1e-6,bb=1e-12,wa,pi,qu,Rr;function nk(r,t,e){return(r[0]-e[0])*(t[1]-r[1])-(r[0]-t[0])*(e[1]-r[1])}function rk(r,t){return t[1]-r[1]||t[0]-r[0]}function Ah(r,t){var e=r.sort(rk).pop(),o,a,l;for(Rr=[],pi=new Array(r.length),wa=new n0,qu=new n0;;)if(l=Th,e&&(!l||e[1]<l.y||e[1]===l.y&&e[0]<l.x))(e[0]!==o||e[1]!==a)&&(Pb(e),o=e[0],a=e[1]),e=r.pop();else if(l)Cb(l.arc);else break;if(Sb(),t){var h=+t[0][0],f=+t[0][1],p=+t[1][0],d=+t[1][1];xb(h,f,p,d),Mb(h,f,p,d)}this.edges=Rr,this.cells=pi,wa=qu=Rr=pi=null}Ah.prototype={constructor:Ah,polygons:function(){var r=this.edges;return this.cells.map(function(t){var e=t.halfedges.map(function(o){return r0(t,r[o])});return e.data=t.site.data,e})},triangles:function(){var r=[],t=this.edges;return this.cells.forEach(function(e,o){if(f=(l=e.halfedges).length)for(var a=e.site,l,h=-1,f,p,d=t[l[f-1]],g=d.left===a?d.right:d.left;++h<f;)p=g,d=t[l[h]],g=d.left===a?d.right:d.left,p&&g&&o<p.index&&o<g.index&&nk(a,p,g)<0&&r.push([a.data,p.data,g.data])}),r},links:function(){return this.edges.filter(function(r){return r.right}).map(function(r){return{source:r.left.data,target:r.right.data}})},find:function(r,t,e){for(var o=this,a,l=o._found||0,h=o.cells.length,f;!(f=o.cells[l]);)if(++l>=h)return null;var p=r-f.site[0],d=t-f.site[1],g=p*p+d*d;do f=o.cells[a=l],l=null,f.halfedges.forEach(function(x){var v=o.edges[x],S=v.left;if(!((S===f.site||!S)&&!(S=v.right))){var b=r-S[0],T=t-S[1],_=b*b+T*T;_<g&&(g=_,l=S.index)}});while(l!==null);return o._found=a,e==null||g<=e*e?f.site:null}};var fk=yn(Vu(),1);var _0=yn(Ob(),1);function Ei(){return new Ih}function Ih(){this.reset()}Ih.prototype={constructor:Ih,reset:function(){this.s=this.t=0},add:function(r){Db(Ph,r,this.t),Db(this,Ph.s,this.s),this.s?this.t+=Ph.t:this.s=Ph.t},valueOf:function(){return this.s}};var Ph=new Ih;function Db(r,t,e){var o=r.s=t+e,a=o-t,l=o-a;r.t=t-l+(e-a)}var mn=1e-6;var bn=Math.PI,dr=bn/2,Rh=bn/4,Lo=bn*2,ba=180/bn,Si=bn/180,$n=Math.abs,mo=Math.atan,Mi=Math.atan2,cn=Math.cos;var Lh=Math.exp;var Zl=Math.log;var Ee=Math.sin;var qr=Math.sqrt,Jl=Math.tan;function a0(r){return r>1?0:r<-1?bn:Math.acos(r)}function di(r){return r>1?dr:r<-1?-dr:Math.asin(r)}function go(){}var hk=Ei(),FJ=Ei();function Ta(r){var t=r[0],e=r[1],o=cn(e);return[o*cn(t),o*Ee(t),Ee(e)]}function Kl(r,t){return[r[1]*t[2]-r[2]*t[1],r[2]*t[0]-r[0]*t[2],r[0]*t[1]-r[1]*t[0]]}function jl(r){var t=qr(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]);r[0]/=t,r[1]/=t,r[2]/=t}var XJ=Ei();function Ub(r,t){return[r>bn?r-Lo:r<-bn?r+Lo:r,t]}Ub.invert=Ub;function u0(){var r=[],t;return{point:function(e,o){t.push([e,o])},lineStart:function(){r.push(t=[])},lineEnd:go,rejoin:function(){r.length>1&&r.push(r.pop().concat(r.shift()))},result:function(){var e=r;return r=[],t=null,e}}}function l0(r,t){return $n(r[0]-t[0])<mn&&$n(r[1]-t[1])<mn}function Nh(r,t,e,o){this.x=r,this.z=t,this.o=e,this.e=o,this.v=!1,this.n=this.p=null}function c0(r,t,e,o,a){var l=[],h=[],f,p;if(r.forEach(function(b){if(!((T=b.length-1)<=0)){var T,_=b[0],y=b[T],A;if(l0(_,y)){for(a.lineStart(),f=0;f<T;++f)a.point((_=b[f])[0],_[1]);a.lineEnd();return}l.push(A=new Nh(_,b,null,!0)),h.push(A.o=new Nh(_,null,A,!1)),l.push(A=new Nh(y,b,null,!1)),h.push(A.o=new Nh(y,null,A,!0))}}),!!l.length){for(h.sort(t),Bb(l),Bb(h),f=0,p=h.length;f<p;++f)h[f].e=e=!e;for(var d=l[0],g,x;;){for(var v=d,S=!0;v.v;)if((v=v.n)===d)return;g=v.z,a.lineStart();do{if(v.v=v.o.v=!0,v.e){if(S)for(f=0,p=g.length;f<p;++f)a.point((x=g[f])[0],x[1]);else o(v.x,v.n.x,1,a);v=v.n}else{if(S)for(g=v.p.z,f=g.length-1;f>=0;--f)a.point((x=g[f])[0],x[1]);else o(v.x,v.p.x,-1,a);v=v.p}v=v.o,g=v.z,S=!S}while(!v.v);a.lineEnd()}}}function Bb(r){if(t=r.length){for(var t,e=0,o=r[0],a;++e<t;)o.n=a=r[e],a.p=o,o=a;o.n=a=r[0],a.p=o}}function zs(r,t){return r<t?-1:r>t?1:r>=t?0:NaN}function f0(r){return r.length===1&&(r=mk(r)),{left:function(t,e,o,a){for(o==null&&(o=0),a==null&&(a=t.length);o<a;){var l=o+a>>>1;r(t[l],e)<0?o=l+1:a=l}return o},right:function(t,e,o,a){for(o==null&&(o=0),a==null&&(a=t.length);o<a;){var l=o+a>>>1;r(t[l],e)>0?a=l:o=l+1}return o}}}function mk(r){return function(t,e){return zs(r(t),e)}}var zb=f0(zs),gk=zb.right,yk=zb.left;var Gb=Array.prototype,_k=Gb.slice,xk=Gb.map;var BK=Math.sqrt(50),zK=Math.sqrt(10),GK=Math.sqrt(2);function Dh(r){for(var t=r.length,e,o=-1,a=0,l,h;++o<t;)a+=r[o].length;for(l=new Array(a);--t>=0;)for(h=r[t],e=h.length;--e>=0;)l[--a]=h[e];return l}var Ck=1e9,MQ=-Ck;var h0=Ei();function p0(r,t){var e=t[0],o=t[1],a=[Ee(e),-cn(e),0],l=0,h=0;h0.reset();for(var f=0,p=r.length;f<p;++f)if(g=(d=r[f]).length)for(var d,g,x=d[g-1],v=x[0],S=x[1]/2+Rh,b=Ee(S),T=cn(S),_=0;_<g;++_,v=A,b=L,T=G,x=y){var y=d[_],A=y[0],M=y[1]/2+Rh,L=Ee(M),G=cn(M),z=A-v,F=z>=0?1:-1,I=F*z,ut=I>bn,R=b*L;if(h0.add(Mi(R*F*Ee(I),T*G+R*cn(I))),l+=ut?z+F*Lo:z,ut^v>=e^A>=e){var W=Kl(Ta(x),Ta(y));jl(W);var V=Kl(a,W);jl(V);var St=(ut^z>=0?-1:1)*di(V[2]);(o>St||o===St&&(W[0]||W[1]))&&(h+=ut^z>=0?1:-1)}}return(l<-mn||l<mn&&h0<-mn)^h&1}var NQ=Ei();var jQ=Ei(),QQ=Ei();var Rk=1/0;var ntt=-Rk;function d0(r){this._context=r}d0.prototype={_radius:4.5,pointRadius:function(r){return this._radius=r,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(r,t){switch(this._point){case 0:{this._context.moveTo(r,t),this._point=1;break}case 1:{this._context.lineTo(r,t);break}default:{this._context.moveTo(r+this._radius,t),this._context.arc(r,t,this._radius,0,Lo);break}}},result:go};var htt=Ei();function m0(){this._string=[]}m0.prototype={_radius:4.5,_circle:Vb(4.5),pointRadius:function(r){return(r=+r)!==this._radius&&(this._radius=r,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._string.push("Z"),this._point=NaN},point:function(r,t){switch(this._point){case 0:{this._string.push("M",r,",",t),this._point=1;break}case 1:{this._string.push("L",r,",",t);break}default:{this._circle==null&&(this._circle=Vb(this._radius)),this._string.push("M",r,",",t,this._circle);break}}},result:function(){if(this._string.length){var r=this._string.join("");return this._string=[],r}else return null}};function Vb(r){return"m0,"+r+"a"+r+","+r+" 0 1,1 0,"+-2*r+"a"+r+","+r+" 0 1,1 0,"+2*r+"z"}function g0(r,t,e,o){return function(a,l){var h=t(l),f=a.invert(o[0],o[1]),p=u0(),d=t(p),g=!1,x,v,S,b={point:T,lineStart:y,lineEnd:A,polygonStart:function(){b.point=M,b.lineStart=L,b.lineEnd=G,v=[],x=[]},polygonEnd:function(){b.point=T,b.lineStart=y,b.lineEnd=A,v=Dh(v);var z=p0(x,f);v.length?(g||(l.polygonStart(),g=!0),c0(v,Ok,z,e,l)):z&&(g||(l.polygonStart(),g=!0),l.lineStart(),e(null,null,1,l),l.lineEnd()),g&&(l.polygonEnd(),g=!1),v=x=null},sphere:function(){l.polygonStart(),l.lineStart(),e(null,null,1,l),l.lineEnd(),l.polygonEnd()}};function T(z,F){var I=a(z,F);r(z=I[0],F=I[1])&&l.point(z,F)}function _(z,F){var I=a(z,F);h.point(I[0],I[1])}function y(){b.point=_,h.lineStart()}function A(){b.point=T,h.lineEnd()}function M(z,F){S.push([z,F]);var I=a(z,F);d.point(I[0],I[1])}function L(){d.lineStart(),S=[]}function G(){M(S[0][0],S[0][1]),d.lineEnd();var z=d.clean(),F=p.result(),I,ut=F.length,R,W,V;if(S.pop(),x.push(S),S=null,!!ut){if(z&1){if(W=F[0],(R=W.length-1)>0){for(g||(l.polygonStart(),g=!0),l.lineStart(),I=0;I<R;++I)l.point((V=W[I])[0],V[1]);l.lineEnd()}return}ut>1&&z&2&&F.push(F.pop().concat(F.shift())),v.push(F.filter(Nk))}}return b}}function Nk(r){return r.length>1}function Ok(r,t){return((r=r.x)[0]<0?r[1]-dr-mn:dr-r[1])-((t=t.x)[0]<0?t[1]-dr-mn:dr-t[1])}var Dk=g0(function(){return!0},Fk,Bk,[-bn,-dr]);function Fk(r){var t=NaN,e=NaN,o=NaN,a;return{lineStart:function(){r.lineStart(),a=1},point:function(l,h){var f=l>0?bn:-bn,p=$n(l-t);$n(p-bn)<mn?(r.point(t,e=(e+h)/2>0?dr:-dr),r.point(o,e),r.lineEnd(),r.lineStart(),r.point(f,e),r.point(l,e),a=0):o!==f&&p>=bn&&($n(t-o)<mn&&(t-=o*mn),$n(l-f)<mn&&(l-=f*mn),e=Uk(t,e,l,h),r.point(o,e),r.lineEnd(),r.lineStart(),r.point(f,e),a=0),r.point(t=l,e=h),o=f},lineEnd:function(){r.lineEnd(),t=e=NaN},clean:function(){return 2-a}}}function Uk(r,t,e,o){var a,l,h=Ee(r-e);return $n(h)>mn?mo((Ee(t)*(l=cn(o))*Ee(e)-Ee(o)*(a=cn(t))*Ee(r))/(a*l*h)):(t+o)/2}function Bk(r,t,e,o){var a;if(r==null)a=e*dr,o.point(-bn,a),o.point(0,a),o.point(bn,a),o.point(bn,0),o.point(bn,-a),o.point(0,-a),o.point(-bn,-a),o.point(-bn,0),o.point(-bn,a);else if($n(r[0]-t[0])>mn){var l=r[0]<t[0]?bn:-bn;a=e*l/2,o.point(-l,a),o.point(0,a),o.point(l,a)}else o.point(t[0],t[1])}function Fh(r){return function(t){var e=new y0;for(var o in r)e[o]=r[o];return e.stream=t,e}}function y0(){}y0.prototype={constructor:y0,point:function(r,t){this.stream.point(r,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Qtt=cn(30*Si);var det=Fh({point:function(r,t){this.stream.point(r*Si,t*Si)}});function Uh(r){return function(t,e){var o=cn(t),a=cn(e),l=r(o*a);return[l*a*Ee(t),l*Ee(e)]}}function No(r){return function(t,e){var o=qr(t*t+e*e),a=r(o),l=Ee(a),h=cn(a);return[Mi(t*l,o*h),di(o&&e*l/o)]}}var Jb=Uh(function(r){return qr(2/(1+r))});Jb.invert=No(function(r){return 2*di(r/2)});var Kb=Uh(function(r){return(r=a0(r))&&r/Ee(r)});Kb.invert=No(function(r){return r});function v0(r,t){return[r,Zl(Jl((dr+t)/2))]}v0.invert=function(r,t){return[r,2*mo(Lh(t))-dr]};function Bh(r,t){return[r,t]}Bh.invert=Bh;function jb(r,t){var e=cn(t),o=cn(r)*e;return[e*Ee(r)/o,Ee(t)/o]}jb.invert=No(mo);function Qb(r,t){var e=t*t,o=e*e;return[r*(.8707-.131979*e+o*(-.013791+o*(.003971*e-.001529*o))),t*(1.007226+e*(.015085+o*(-.044475+.028874*e-.005916*o)))]}Qb.invert=function(r,t){var e=t,o=25,a;do{var l=e*e,h=l*l;e-=a=(e*(1.007226+l*(.015085+h*(-.044475+.028874*l-.005916*h)))-t)/(1.007226+l*(.015085*3+h*(-.044475*7+.028874*9*l-.005916*11*h)))}while($n(a)>mn&&--o>0);return[r/(.8707+(l=e*e)*(-.131979+l*(-.013791+l*l*l*(.003971-.001529*l)))),e]};function tT(r,t){return[cn(t)*Ee(r),Ee(t)]}tT.invert=No(di);function eT(r,t){var e=cn(t),o=1+cn(r)*e;return[e*Ee(r)/o,Ee(t)/o]}eT.invert=No(function(r){return 2*mo(r)});function nT(r,t){return[Zl(Jl((dr+t)/2)),-r]}nT.invert=function(r,t){return[-t,2*mo(Lh(r))-dr]};var Hk=yn(Vu(),1);var Wk=yn(Vu(),1);var Yk=yn(Vu(),1);var $k=yn(Vu(),1);function ks(r,t){return Math.sqrt((t[0]-r[0])**2+(t[1]-r[1])**2)}function x0(r){let t=0;for(let e=0;e<r.length-1;e++)t+=ks(r[e],r[e+1]);return t}function iT(r,t,e){let o=new un(t[0]-r[0],t[1]-r[1]),a=new un(t[0]-e[0],t[1]-e[1]),h=o.angleTo(a)*180/Math.PI,f=new un(t[0]-r[0],t[1]-r[1]);return new un(e[0]-r[0],e[1]-r[1]).cross(f)>0?h:-h}var Hi="___",zh=class{initRoute(t){this.clear(),this.roadInfo=t,t.length&&(t.forEach(e=>{e.points.forEach(o=>{let a=""+e.floor+Hi+o.id;if(this.pointMap.set(a,o),this.nodeMap.set(""+o.floor+Hi+o.nodeId,a),o.type==="straightLadder"){let l=this.straightLadderMap.get(o.name)||[];l.push(Ga({},o)),this.straightLadderMap.set(o.name,l)}if(o.type==="staircase"){let l=this.staircaseMap.get(o.name)||[];l.push(Ga({},o)),this.staircaseMap.set(o.name,l)}if(o.type==="escalator"){let l=this.escalatorMap.get(o.name)||{};o.escalatorDirection==="exit"?l.end={floor:o.floor,id:o.id}:l.start={floor:o.floor,id:o.id},this.escalatorMap.set(o.name,l)}if(o.type==="facility"){let l=this.facilityMap.get(o.targetId)||[];l.push(Ga({},o)),this.facilityMap.set(o.targetId,l)}}),e.lines.filter(o=>o.direction!=="no").forEach(o=>{var a,l;let h=""+e.floor+Hi+o.from,f=""+e.floor+Hi+o.to,p=(a=this.pointMap.get(h))==null?void 0:a.cds,d=(l=this.pointMap.get(f))==null?void 0:l.cds;if(p!=null&&p.length&&(d!=null&&d.length)){let g=ks(p,d);this.addLineItem(h,f,g),o.direction==="double"&&this.addLineItem(f,h,g)}})}),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute())}addLineItem(t,e,o,a){a===void 0&&(a=this.lineMap);let l=a.get(t)||new Map;l.set(e,o),a.set(t,l)}addFacilityToLineMap(t,e,o,a){[...this.straightLadderMap,...this.staircaseMap].forEach(l=>{let[h,f]=l;if(!(f.length<2))for(let g=0;g<f.length;g++){let x=""+f[g].floor+Hi+f[g].id;for(let v=0;v<f.length;v++)if(g!==v){var p,d;let S=""+f[v].floor+Hi+f[v].id,b=(p=this.pointMap.get(x))==null?void 0:p.cds,T=(d=this.pointMap.get(S))==null?void 0:d.cds;if(b!=null&&b.length&&(T!=null&&T.length))if(f[g].type==="straightLadder"){let _=e;this.addLineItem(x,S,_,a)}else{let _=o;this.addLineItem(x,S,_,a)}}}}),this.escalatorMap.forEach((l,h)=>{if(l.start&&l.end){var f,p;let d=""+l.start.floor+Hi+l.start.id,g=""+l.end.floor+Hi+l.end.id,x=(f=this.pointMap.get(d))==null?void 0:f.cds,v=(p=this.pointMap.get(g))==null?void 0:p.cds;if(x!=null&&x.length&&(v!=null&&v.length)){let S=t;this.addLineItem(d,g,S,a)}}})}initBaseRoute(){let t=new Map([...this.lineMap]);this.addFacilityToLineMap(1,this.lift_priority,3e4,t),this.baseRoute=new Oo.default(t)}initEscalatorRoute(){let t=new Map([...this.lineMap]),e=1e4;this.addFacilityToLineMap(1*e,this.lift_priority*e,3e4*e,t),this.escalatorRoute=new Oo.default(t)}initStraightLadderRoute(){let t=new Map([...this.lineMap]),e=1e4;this.addFacilityToLineMap(3*e,1*e,3e4*e,t),this.straightLadderRoute=new Oo.default(t)}checkStart(t){return!(!t.floor||!t.nodeId&&(!t.coord||t.coord.length<2))}checkEnd(t){return t.facility?!0:this.checkStart(t)}transformStart(t){var e;if(t.nodeId){let o=this.nodeMap.get(""+t.floor+Hi+t.nodeId);if(o){let[a,l]=o.split(Hi);return{floor:a,id:l}}}if((e=t.coord)!=null&&e.length){let o=this.roadInfo.find(l=>l.floor===t.floor);if(!o)return null;let a=o.points.reduce((l,h)=>{let f=ks(t.coord,h.cds);return f<l.min&&(l.min=f,l.point=h),l},{min:1/0,point:o.points[0]});return{floor:a.point.floor,id:a.point.id}}return null}transformEnd(t){if(t.floor){let e=this.transformStart(t);if(e)return e}if(t.facility){let e=this.facilityMap.get(t.facility);if(e!=null&&e.length)return{floor:t.floor,facility:t.facility}}return null}getPath(t,e,o){if(o===void 0&&(o=""),!this.checkStart(t))return"start-error";if(!this.checkEnd(e))return"end-error";let a=this.transformStart(t);if(!a)return"no-start";let l=this.transformEnd(e);if(!l)return"no-end";let h=this.getBasePath.bind(this);switch(o){case"escalator":h=this.getEscalatorPath.bind(this);break;case"straightLadder":h=this.getStraightLadderPath.bind(this);break;default:h=this.getBasePath.bind(this);break}if(l.id)return h(a,l);if(l.facility){let f=this.facilityMap.get(l.facility).filter(d=>l.floor?d.floor===l.floor:!0);if(!f.length)return null;let p=f.map(d=>h(a,{floor:d.floor,id:d.id})).filter(d=>!!d);return p.reduce((d,g)=>{let x=g.reduce((v,S)=>v+x0(S.points),0);return x<d.distance&&(d.distance=x,d.path=g),d},{distance:1/0,path:p[0]}).path}}getRoutePath(t,e,o){let a=""+t.floor+Hi+t.id,l=""+e.floor+Hi+e.id,h=o.path(a,l);if(!h)return null;let f=[];return h.map(p=>{let d=this.pointMap.get(p);if(d){var g;let{floor:x}=d;if(((g=f[f.length-1])==null?void 0:g.floor)===x){let v=f[f.length-1];v.points.push(d.cds),v.endType=d.type,v.destId=d.nodeId,v.distance=x0(v.points)}else f.push({floor:x,points:[d.cds],endType:d.type,destId:d.nodeId,distance:0})}}),f}getBasePath(t,e){return this.getRoutePath(t,e,this.baseRoute)}getEscalatorPath(t,e){return this.getRoutePath(t,e,this.escalatorRoute)}getStraightLadderPath(t,e){return this.getRoutePath(t,e,this.straightLadderRoute)}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new Oo.default,this.escalatorRoute=new Oo.default,this.straightLadderRoute=new Oo.default}constructor(t=3){this.lift_priority=t,this.roadInfo=[],this.pointMap=new Map,this.nodeMap=new Map,this.facilityMap=new Map,this.straightLadderMap=new Map,this.escalatorMap=new Map,this.staircaseMap=new Map,this.lineMap=new Map,this.baseRoute=new Oo.default,this.escalatorRoute=new Oo.default,this.straightLadderRoute=new Oo.default}};var Cat=yn(Dc(),1),Pat=yn(Fp(),1);var r4=yn(lT(),1);function i4(r,t,e){let o=iT(r,t,e);return 180-Math.abs(o)<15?"front":o>135?"right_front":o<-135?"left_front":o<=135&&o>=60?"right":o>=-135&&o<=-60?"left":o<60&&o>0?"right_back":o>-60&&o<0?"left_back":"front"}function cT(r){if(!r.length)return[];if(r.length===1)return[{direction:"start",distance:0,points:r}];let t=[{direction:"start",distance:ks(r[0],r[1]),points:[r[0],r[1]]}];for(let e=2;e<r.length;e++){let o=i4(r[e-2],r[e-1],r[e]);if(o==="front"){let a=t[t.length-1],l=ks(r[e-1],r[e]);a.distance+=l,e!==2&&a.points.push(r[e-1])}else t.push({direction:o,distance:ks(r[e-1],r[e]),points:[r[e-1],r[e]]})}return t.push({direction:"end",distance:0,points:[r[r.length-1]]}),t}var Gat=yn(UT(),1),kat=yn(kc(),1);function BT(r){return r.replace(/[A-Z]/g,t=>"_"+t.toLowerCase()).replace(/^_/,"")}function zT(r){let t={};for(let o in r)o.startsWith("on")&&(t[BT(o.slice(2))]=r[o]);let e=o=>oc(this,null,function*(){let{data:a}=o;if(t[a.type])try{let l=yield t[a.type](a.data);self.postMessage({type:""+a.type+"_result",key:a.key,data:l})}catch(l){self.postMessage({type:""+a.type+"_result",key:a.key,error:l})}else self.postMessage({type:""+a.type+"_result",key:a.key,error:"no_event"})});return self.addEventListener("message",e),()=>{self.removeEventListener("message",e)}}var C0=new zh;zT({onSetRoadInfo(r){let{roadData:t}=r;C0.initRoute(t)},onGetPath(r){let{start:t,end:e,type:o}=r;return C0.getPath(t,e,o)},onGetDirectionPath(r){return cT(r)},onClear(){C0.clear()}});
7745
- `],{type:"text/javascript"}),t=URL.createObjectURL(r),e=new Worker(t);return URL.revokeObjectURL(t),e}var Z1=class extends sR{setRoadData(t){return j(this,null,function*(){this.initRoadStatus=!1,this.dispatchEvent({type:"init-road-status",status:!1}),yield At(this.worker,"set_road_info",{roadData:t}),this.initRoadStatus=!0,this.dispatchEvent({type:"init-road-status",status:!0})})}getPath(t,e,n){return j(this,null,function*(){return n===void 0&&(n=""),new Promise((i,o)=>{let s=()=>{At(this.worker,"get_path",{start:t,end:e,type:n}).then(a=>{a?typeof a=="string"?o(a):i(a):o("no-path")})};if(this.initRoadStatus)s();else{let a=u=>{let{status:l}=u;l&&(this.removeEventListener("init-road-status",a),s())};this.addEventListener("init-road-status",a)}})})}getDirectionPath(t){return At(this.worker,"get_direction_path",t)}dispose(){return j(this,null,function*(){At(this.worker,"clear",""),this.worker.terminate()})}constructor(){super(),this.worker=Ec(),this.initRoadStatus=!1}};var _$=d(v(),1),W$=d(ie(),1),x$=d(oe(),1),I$=d(se(),1),Y$=d(ae(),1),E$=d(ue(),1),D$=d(le(),1),X$=d(ce(),1),Z$=d(Z(),1);import{Frustum as aR}from"three";var ma=class extends Ft{setEnable(t){super.setEnable(t),st(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=W(this.startPoint,e,n,i),s=W(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 Q&&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 m=W(p,i,o,s);return Be(m,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=W(u,i,o,s),h=W(l,i,o,s);return!(!Be(c,e,n)||!Be(h,e,n))}dispose(){super.dispose(),this.rect=null,this.unRegistryEvent()}constructor(t){super(t),this.frustum=new aR,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=T({},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);st(this.rect,s.x,s.y,a,u)}else st(this.rect,0,0,0,0)};let{config:{selectBox:{fill:e,stroke:n}}}=t;this.rect=Qe(n,e),this.svg.appendChild(this.rect),this.registryEvent()}};var uR={boxSelection:!1,elements:["graphic","poi"]},C1=class extends gt{get list(){return this._list}enableBoxSelection(){this.isMultipleSelect||!this.options.boxSelection||(this.isMultipleSelect=!0,this.boxSelection.setEnable(!0),this.prevPanStatus=this.bmap.context.control.enablePan,this.prevRotateStatus=this.bmap.context.control.enableRotate,this.bmap.context.control.enablePan=!1,this.bmap.context.control.enableRotate=!1)}disableBoxSelection(){this.isMultipleSelect&&(this.isMultipleSelect=!1,this.boxSelection.setEnable(!1),this.bmap.context.control.enablePan=!!this.prevPanStatus,this.bmap.context.control.enableRotate=!!this.prevRotateStatus)}selectEnd(){this.dispatchEvent({type:"select",graphics:[...this._list],pois:[...this._poiList],isMultipleSelect:this.isMultipleSelect})}registryEvent(){this.bmap.context.container.addEventListener("pointerdown",this.onPointerDown),this.bmap.context.container.addEventListener("pointerup",this.onPointerUp),this.bmap.context.container.addEventListener("pointerout",this.onPointerOut),this.bmap.context.container.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp),this.boxSelection.addEventListener("selected",this.onBoxSelected)}unRegistryEvent(){this.bmap.context.container.removeEventListener("pointerdown",this.onPointerDown),this.bmap.context.container.removeEventListener("pointerup",this.onPointerUp),this.bmap.context.container.removeEventListener("pointerout",this.onPointerOut),this.bmap.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(),super.dispose()}constructor(t,e={}){super(t),this._list=new Set,this._poiList=new Set,this.downPoint=null,this.isMultipleSelect=!1,this.onPointerDown=n=>{this.downPoint={x:n.offsetX,y:n.offsetY}},this.onPointerUp=n=>{if(!this.downPoint)return;let{offsetX:i,offsetY:o}=n,{x:s,y:a}=this.downPoint;if(Math.sqrt((s-i)**2+(a-o)**2)>3)return;let u=new Set,l=[],c=[];if(this.options.elements.includes("graphic")){let{graphics:h}=this.bmap.context.getGraphicsByDeviceXy(i,o);h.map(p=>u.add(p.options.id)),l.push(...h)}if(this.options.elements.includes("poi")){let h=this.bmap.context.getPoisByDeviceXy(i,o);c.push(...h),h.forEach(p=>{if(!u.has(p.options.id)){var m;let g=((m=this.bmap.context.currentFloor)==null?void 0:m.graphicLayer.graphicMap.get(p.options.id))||null;g&&(u.add(p.options.id),l.push(g))}})}(!this.options.boxSelection||!(Jn?n.metaKey:n.ctrlKey))&&(this._list.clear(),this._poiList.clear()),l.forEach(h=>this._list.add(h)),c.forEach(h=>this._poiList.add(h)),this.selectEnd(),this.downPoint=null},this.onPointerOut=n=>{this.disableBoxSelection()},this.onKeyDown=n=>{Ln(n.key)&&this.enableBoxSelection()},this.onKeyUp=n=>{Ln(n.key)&&this.disableBoxSelection()},this.onBoxSelected=n=>{let{list:i}=n;this._list.clear(),this._poiList.clear(),i.forEach(o=>{if(this.options.elements.includes("graphic")&&this._list.add(o),this.options.elements.includes("poi")){let s=this.bmap.getPoiById(o.options.id);s&&this._poiList.add(s)}}),this.selectEnd()},this.options=T({},uR,e),this.boxSelection=new ma(this.bmap.context),this.boxSelection.setEnable(!1),this.registryEvent()}};var N$=d(Z(),1);import{cloneDeep as lR,isNil as fn,throttle as O1}from"lodash";import{EventDispatcher as cR}from"three";var N=function(r){return r.COMPASS="compass",r.DEVICE_MOTION="deviceMotion",r.ACCELERATION="acceleration",r.GPS="gps",r}({});var hR={time:1e3,elements:[N.COMPASS,N.DEVICE_MOTION,N.ACCELERATION,N.GPS]},ga=class extends cR{start(){this.options.elements.some(t=>[N.DEVICE_MOTION,N.COMPASS].includes(t))&&this.listenDeviceOrientation(),this.options.elements.includes(N.ACCELERATION)&&this.listenAcceleration(),this.options.elements.includes(N.GPS)&&this.listenGps(),this.dispatchEvent({type:"start"}),this.dispatchTimer=this.timer.setInterval(()=>{this.dispatchEvent({type:"sensor-data",data:lR(this.data)}),this.data=[]},this.options.time)}addDataItem(t){this.data.push(t),this.dispatchEvent({type:"add-data-item",item:t})}listenDeviceOrientation(){Br?window.addEventListener("deviceorientation",this.deviceOrientationAbsHandler,!1):window.addEventListener("deviceorientationabsolute",this.deviceOrientationAbsHandler,{absolute:!0})}listenAcceleration(){window.addEventListener("devicemotion",this.handleAcceleration,!1)}listenGps(){this.gpsTimer=navigator.geolocation.watchPosition(t=>{this.addDataItem({type:N.GPS,timestamp:Date.now(),res:[t.coords.longitude,t.coords.latitude,t.coords.accuracy]})},t=>{console.log("\u83B7\u53D6gps\u5931\u8D25",t)},{enableHighAccuracy:!0})}checkSensor(){return j(this,null,function*(){return{deviceOrientation:yield this.checkDeviceOrientation()}})}checkDeviceOrientation(){return j(this,null,function*(){var t;if(!Br)return!0;if(typeof window.DeviceOrientationEvent!="undefined"&&typeof((t=window.DeviceOrientationEvent)==null?void 0:t.requestPermission)=="function")try{var e;return(yield(e=window.DeviceOrientationEvent)==null?void 0:e.requestPermission())==="granted"}catch(n){return!1}return!1})}stop(){window.removeEventListener("devicemotion",this.handleAcceleration,!1),Br?window.removeEventListener("deviceorientation",this.deviceOrientationAbsHandler,!1):window.removeEventListener("deviceorientationabsolute",this.deviceOrientationAbsHandler,{absolute:!0}),fn(this.gpsTimer)||navigator.geolocation.clearWatch(this.gpsTimer),this.dispatchTimer&&this.timer.clearInterval(this.dispatchTimer),this.data=[],this.dispatchEvent({type:"stop"})}constructor(t={}){super(),this.gpsTimer=null,this.data=[],this.timer=new H,this.dispatchTimer=null,this.addAcceleration=O1(e=>{this.addDataItem(e)},20),this.deviceOrientationAbsHandler=O1(e=>{let n=Date.now(),{alpha:i,beta:o,gamma:s}=e;if(fn(i)||fn(o)||fn(s))return;let a;Br?a=e.webkitCompassHeading:a=360-i,this.options.elements.includes(N.DEVICE_MOTION)&&this.addDataItem({type:N.DEVICE_MOTION,timestamp:n,res:[i,o,s]}),this.options.elements.includes(N.COMPASS)&&this.addDataItem({type:N.COMPASS,timestamp:n,res:a})},200),this.handleAcceleration=e=>{let n=e.accelerationIncludingGravity;fn(n)||fn(n.x)||fn(n.y)||fn(n.z)||this.addAcceleration({type:N.ACCELERATION,timestamp:Date.now(),res:[n.x,n.y,n.z]})},this.options=T({},hR,t)}};var htt=d(v(),1);import{EventDispatcher as mR}from"three";var ott=d(Z(),1);var Q$=d(Z(),1),H$=d(v(),1);function ya(r,t){return 1/Math.sqrt(2*Math.PI*Math.pow(t,2))*Math.exp(-Math.pow(r,2)/(2*Math.pow(t,2)))}function Xi(r){return(r+360)%360}function K1(r,t){let n=6378137*r*Math.PI/180,i=6378137*Math.log(Math.tan(Math.PI/4+t*Math.PI/180/2));return{x:n,y:i}}function jr(r,t,e,n){return Math.sqrt(Math.pow(Math.abs(r-e),2)+Math.pow(Math.abs(t-n),2))}import{reshape as pR,multiply as fR}from"mathjs";var Ma=class{motionModelRotYaw(t){if(!(Math.abs(t)<.001)){this.last_yaw_compass=Xi(this.last_yaw_compass+t);for(let e=0;e<this.NumParticle;e++){let n=Math.random()*this.yaw_noise_sigma;this.particleX[2][e]=this.particleX[2][e]+t+n,this.particleX[2][e]=Xi(this.particleX[2][e])}}}motionModelStepLength(t,e){if(t===0)return;for(let i=0;i<this.NumParticle;i++){let o=Math.random()*this.step_noise_sigma;this.particleX[0][i]+=(.65+o)*Math.sin(-this.particleX[2][i]/180*Math.PI),this.particleX[1][i]+=(.65+o)*Math.cos(this.particleX[2][i]/180*Math.PI),e(this.particleX[0][i],this.particleX[1][i])||(this.particleWeight[0][i]*=this.unaccess_weight)}let n=this.particleWeight[0].reduce((i,o)=>i+o,0);this.particleWeight[0]=this.particleWeight[0].map(i=>i/n)}motionModelCompassYaw(t,e){if(e-this.last_compass_time>this.compass_update_interval){let n=360-t;n+=this.delta_yaw,n=Xi(n),Math.abs(n-this.last_yaw_compass)>60?this.compass_consecutive_offset_count++:this.compass_consecutive_offset_count=0;for(let o=0;o<this.NumParticle;o++){let s=Math.abs(this.particleX[2][o]-n);s>180&&(s=360-s),this.particleWeight[0][o]*=ya(s,this.sigmaCompass)}let i=this.particleWeight[0].reduce((o,s)=>o+s,0);this.particleWeight[0]=this.particleWeight[0].map(o=>o/i),this.setLastCompassTime(e)}}resampling(){if(1/this.particleWeight[0].reduce((e,n)=>e+n*n,0)<this.reSampNumParticle){let e=this.particleWeight[0].reduce((a,u,l)=>a.concat(a[l]+u),[0]),i=this.particleWeight[0].map(()=>1/this.NumParticle).map((a,u)=>a+Math.random()/this.NumParticle),o=[],s=0;for(let a=0;a<this.NumParticle;a++){for(;i[a]>e[s];)s++;o.push(s)}this.particleX=this.particleX.map((a,u)=>o.map(l=>a[l])),this.particleWeight[0]=Array(this.NumParticle).fill(1/this.NumParticle)}}update(t,e){for(let i=0;i<this.NumParticle;i++){let o=jr(this.particleX[0][i],this.particleX[1][i],t.x,t.y);this.particleWeight[0][i]=Math.max(1e-7,this.particleWeight[0][i]*ya(o,e))}let n=this.particleWeight[0].reduce((i,o)=>i+o,0);this.particleWeight[0]=this.particleWeight[0].map(i=>i/n)}updateCar(t,e){let n=t.x-this.xEst[0][0],i=t.y-this.xEst[1][0];for(let s=0;s<this.NumParticle;s++){let a=jr(this.particleX[0][s],this.particleX[1][s],t.x,t.y);this.particleWeight[0][s]=Math.max(1e-7,this.particleWeight[0][s]*ya(a,e)),this.particleX[0][s]+=n,this.particleX[1][s]+=i}let o=this.particleWeight[0].reduce((s,a)=>s+a,0);this.particleWeight[0]=this.particleWeight[0].map(s=>s/o)}getPosInitFlag(){return this.particle_PosInitFlag}getYawInitFlag(){return this.particle_yawInitFlag}setPosInitFlag(t){this.particle_PosInitFlag=t}setYawInitFlag(t){this.particle_yawInitFlag=t}getResultX(){let t=pR(this.particleWeight,[this.NumParticle,1]),e=fR(this.particleX,t);return this.xEst=e,this.xEst[0][0]}getResultY(){return this.xEst[1][0]}getResultYaw(){let t=this.particleWeight[0].indexOf(Math.max(...this.particleWeight[0]));return this.particleX[2][t]}getEstConfidence(){let t=this.particleWeight[0].indexOf(Math.max(...this.particleWeight[0])),e=this.particleWeight[0].indexOf(Math.min(...this.particleWeight[0])),n=[this.particleX[0][t],this.particleX[1][t]],i=[this.particleX[0][e],this.particleX[1][e]],o=jr(n[0],n[1],i[0],i[1]),s=o*.67;return console.log(o,s),s}getParticleNum(){return this.NumParticle}getParticleX(){return this.particleX}setLastCompassTime(t){this.last_compass_time=t}getLastCompassTime(){return this.last_compass_time}initParticlesByPos(t,e,n){if(!this.particle_PosInitFlag){this.particleWeight[0]=Array(this.NumParticle).fill(1/this.NumParticle);let i=0;for(;i<this.NumParticle;){let s=(2*Math.random()-1)*this.initial_xy_uncertainty,a=(2*Math.random()-1)*this.initial_xy_uncertainty;n(t+s,e+a)||(this.particleWeight[0][i]*=this.unaccess_weight),this.particleX[0][i]=t+s,this.particleX[1][i]=e+a,i++}let o=this.particleWeight[0].reduce((s,a)=>s+a,0);this.particleWeight[0]=this.particleWeight[0].map(s=>s/o),this.particle_PosInitFlag=!0,this.xEst[0][0]=t,this.xEst[1][0]=e,this.xEst[2][0]=0}}initParticlesByCompass(t){console.log("Init compass: "+t);let e=360-t;e+=this.delta_yaw,e=Xi(e),console.log("Init Yaw: "+e);for(let n=0;n<this.NumParticle;n++){let i=(2*Math.random()-1)*this.initial_yaw_uncertainty;this.particleX[2][n]=e+i}this.particle_yawInitFlag=!0,this.xEst[2][0]=e,this.last_yaw_compass=e,this.compass_consecutive_offset_count=0}constructor(t){this.last_yaw_compass=0,this.compass_consecutive_offset_count=0,this.NumParticle=t.NumParticle,this.reSampNumParticle=t.reSampNumParticle,this.initial_xy_uncertainty=t.initial_xy_uncertainty,this.initial_yaw_uncertainty=t.initial_yaw_uncertainty,this.step_noise_sigma=t.step_noise_sigma,this.yaw_noise_sigma=t.yaw_noise_sigma,this.compass_update_interval=t.compass_update_interval,this.sigmaCompass=t.sigmaCompass,this.delta_yaw=t.delta_yaw,this.sigmaBeacon=t.sigmaBeacon,this.unaccess_weight=t.unaccess_weight,this.particle_PosInitFlag=!1,this.particle_yawInitFlag=!1,this.xEst=[[0],[0],[0]],this.particleX=Array.from({length:3},()=>Array(this.NumParticle).fill(0)),this.particleWeight=Array.from({length:1},()=>Array(this.NumParticle).fill(1/this.NumParticle)),this.last_compass_time=0}};var ett=d(Z(),1),ntt=d(v(),1),Pa=class{init(){this.fre=100,this.accH_fifo=[],this.accH_time_fifo=[],this.accH_fifo_len=Math.floor(1*this.fre)+1,this.step_count=0,this.state_count=0,this.last_valley_time=0,this.last_peak_time=0,this.last_step_time=0,this.min_step_time=.3,this.max_step_time=1,this.min_peak=10+.5,this.max_valley=10-.5,this.peak_num=0,this.valley_num=0,this.fft_min_amp=.3,this.fft_min_fre=0,this.fft_max_fre=4,this.last_fft_amp=0,this.abnor_start_time=0,this.abnor_fft_detected=!1,this.abnor_peak_time=0,this.abnor_peak_accH=0,this.const_step_length=.65,this.last_rot=[0,0,0],this.delta_rot=[0,0,0],this.last_yaw=0,this.delta_yaw=null,this.delta_rot_sum_fifo=[],this.delta_rot_sum_time_fifo=[],this.delta_yaw_accum=0,this.delta_yaw_accum_timestamp=0,this.delta_yaw_time_threshold=.5,this.last_px=0,this.last_py=0,this.delta_px=0,this.delta_py=0}reset(){this.init()}setInitPose(t){t===void 0&&(t=[0,0]),this.last_px=t[0],this.last_py=t[1],console.info("pdr init pos: "+this.last_px+", "+this.last_py)}setInitYaw(t){t===void 0&&(t=0),this.last_yaw=t}getPos(t,e,n){let i=0;return n.length===3&&(this.delta_yaw=this.getDeltaYawFromRot(t,n)),e.length===3&&(i=this.getStepLength(t,e)),i!==0&&(this.last_px+=this.delta_px,this.last_py+=this.delta_py),[this.last_px,this.last_py]}getDeltaPose(){return[this.delta_px,this.delta_py]}getStepLength(t,e){if(e.length<3)return console.warn("acc data less than 3"),0;let n=!1,i=Math.sqrt(Math.pow(e[0],2)+Math.pow(e[1],2)+Math.pow(e[2],2));if(this.accH_fifo.push(i),this.accH_time_fifo.push(t),this.imuFreUpdate(),this.accH_fifo.length<this.accH_fifo_len+1)n=!1;else{for(;this.accH_fifo.length>=this.accH_fifo_len+1;)this.accH_fifo.shift(),this.accH_time_fifo.shift();let o=this.PVStepDetec(),s=this.FFTStepDetec(),a=this.recheckState(),u=this.accH_time_fifo[Math.floor(this.accH_time_fifo.length*3/4)];Math.abs(this.abnor_start_time)<.001&&this.abnor_fft_detected?this.abnor_start_time=u:this.abnor_fft_detected||(this.abnor_start_time=0),o&&s&&a?(this.step_count+=1,this.last_step_time=u,n=!0):Math.abs(this.abnor_start_time)>.001&&this.abnor_peak_time-this.abnor_start_time>this.abnor_time_threshold&&this.step_count>1&&this.abnor_peak_time-this.last_step_time>1?(this.step_count+=1,this.last_step_time=u,n=!0):(u-this.last_step_time>2&&(this.state_count=0),n=!1)}if(n){let o=this.last_yaw/180*Math.PI;return this.delta_px=this.const_step_length*Math.cos(o),this.delta_py=this.const_step_length*Math.sin(o),this.const_step_length}else return 0}imuFreUpdate(){if(this.accH_time_fifo.length>2&&(this.accH_time_fifo[this.accH_time_fifo.length-1]-this.accH_time_fifo[this.accH_time_fifo.length-2]<0||this.accH_time_fifo[this.accH_time_fifo.length-1]-this.accH_time_fifo[this.accH_time_fifo.length-2]>10||this.accH_time_fifo[this.accH_time_fifo.length-1]===this.accH_time_fifo[0])&&(console.warn("pdr reset last one time "+this.accH_time_fifo[this.accH_time_fifo.length-1]+" last two time "+this.accH_time_fifo[this.accH_time_fifo.length-2]),this.reset()),this.accH_fifo.length>9||this.fre<15){let t=(this.accH_fifo.length-1)/(this.accH_time_fifo[this.accH_time_fifo.length-1]-this.accH_time_fifo[0]);Math.abs(this.fre-t)>8&&(this.fre=Math.round((t-3)/10)*10,(this.fre<=10||this.fre>=100)&&(console.warn("Frequency Error "+this.fre),this.fre=100),console.debug("Frequency change to "+this.fre),this.accH_fifo_len=Math.floor(1*this.fre)+1)}}recheckState(){return!0}PVStepDetec(){let t=!1,e=this.accH_fifo.slice(Math.floor(this.accH_fifo_len/2)),n=this.accH_time_fifo.slice(Math.floor(this.accH_fifo_len/2)),i=e[Math.floor(e.length/2)],o=n[Math.floor(n.length/2)],s=Math.max(...e),a=Math.min(...e),u=!1,l=!1;return Math.abs(i-a)<.01&&i<this.max_valley&&this.valley_num<=this.peak_num&&(this.last_valley_time===0?l=!0:l=o-this.last_valley_time>this.min_step_time,l&&(this.last_valley_time=o,this.valley_num+=1)),Math.abs(i-s)<.01&&i>this.min_peak&&this.peak_num<=this.valley_num&&(this.last_peak_time===0?u=!0:u=o-this.last_peak_time>this.min_step_time,u&&(this.last_peak_time=o,this.peak_num+=1)),i===s&&i>this.min_peak&&(this.abnor_peak_time=o,this.abnor_peak_accH=i),this.peak_num===this.valley_num&&(u||l)&&(t=!0),t}FFTStepDetec(){return!0}getDeltaYawFromRot(t,e){if(e.length<3)return console.warn("rot data less than 3"),0;let n=[0,0,0];this.last_rot.length===3&&(n=e.map((a,u)=>a-this.last_rot[u]));for(let a=0;a<e.length;a++)n[a]<-180?n[a]+=360:n[a]>180&&(n[a]-=360);let i=.2;this.delta_rot.length===3?this.delta_rot=this.delta_rot.map((a,u)=>i*a+(1-i)*n[u]):this.delta_rot=n,this.last_rot=e,this.delta_yaw=this.delta_rot[0],this.last_yaw+=this.delta_yaw,this.last_yaw=this.limitYaw(this.last_yaw);let o=this.delta_rot.reduce((a,u)=>a+Math.abs(u),0);this.delta_rot_sum_fifo.push(o),this.delta_rot_sum_time_fifo.push(t),Math.abs(this.delta_rot_sum_time_fifo[this.delta_rot_sum_time_fifo.length-1]-this.delta_rot_sum_time_fifo[0])>1&&(this.delta_rot_sum_fifo.shift(),this.delta_rot_sum_time_fifo.shift()),this.delta_yaw_accum+=this.delta_yaw;let s=0;return Math.abs(this.delta_yaw_accum_timestamp-t)>this.delta_yaw_time_threshold?(s=this.delta_yaw_accum,this.delta_yaw_accum=0,this.delta_yaw_accum_timestamp=t,s):null}limitYaw(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}constructor(){this.fre=100,this.accH_fifo=[],this.accH_time_fifo=[],this.accH_fifo_len=Math.floor(1*this.fre)+1,this.step_count=0,this.state_count=0,this.last_valley_time=0,this.last_peak_time=0,this.last_step_time=0,this.min_step_time=.3,this.max_step_time=1,this.min_peak=10.5,this.max_valley=9.5,this.peak_num=0,this.valley_num=0,this.fft_min_amp=.3,this.fft_min_fre=0,this.fft_max_fre=4,this.last_fft_amp=0,this.abnor_start_time=0,this.abnor_fft_detected=!1,this.abnor_time_threshold=4,this.abnor_peak_time=0,this.abnor_peak_accH=0,this.const_step_length=.85,this.last_rot=[],this.delta_rot=[],this.last_yaw=0,this.delta_yaw=null,this.delta_rot_sum_fifo=[],this.delta_rot_sum_time_fifo=[],this.delta_yaw_accum=0,this.delta_yaw_accum_timestamp=0,this.delta_yaw_time_threshold=.5,this.last_px=0,this.last_py=0,this.delta_px=0,this.delta_py=0}};var dR={using_gps:!0},ja=class{pfFusionPDRiBeacon(t){let{type:e,timestamp:n,res:i}=t,o=!1;if(this.cacheSensorData.push(t),this.particleFilter.getPosInitFlag()&&this.particleFilter.getYawInitFlag()){if(e===N.ACCELERATION){let s=i,a=this.pdr.getStepLength(n/1e3,s);a!==0&&(this.particleFilter.motionModelStepLength(a,()=>!0),this.particleFilter.resampling(),this.position_count+=1,o=!0)}if(this.using_gps&&e===N.GPS&&(this.last_beacon_time===null||n-this.last_beacon_time>5e3)){let s=this.getGpsPosition(i);o=s!==null,s&&(this.particleFilter.update(s,this.gps_horizontalAccuracy),this.resetParticleFilterDist(s,"gps",i[2]),this.particleFilter.resampling(),this.position_count+=1,this.cacheSensorData.length=0)}if(e===N.DEVICE_MOTION){let s=this.pdr.getDeltaYawFromRot(n/1e3,i);s!==null&&this.particleFilter.motionModelRotYaw(s)}e===N.COMPASS&&this.particleFilter.motionModelCompassYaw(i,n),this.last_pos_time&&n-this.last_pos_time>500&&(this.position_count+=1,o=!0)}else if(!this.particleFilter.getPosInitFlag()&&this.using_gps&&e===N.GPS){if(this.startTime&&Date.now()-this.startTime>3e3){let s=this.getGpsPosition(i);o=s!==null,console.log("gps_pos",s,i),s?(this.particleFilter.initParticlesByPos(s.x,s.y,()=>!0),this.last_pos_time=n,console.log("init Pos by gps success time "+n),this.cacheSensorData.length=0):console.log("init Pos by gps fail time "+n)}}else if(!this.particleFilter.getYawInitFlag()&&e===N.COMPASS){let s=i;this.particleFilter.initParticlesByCompass(s),this.particleFilter.setLastCompassTime(n),console.log("init yaw by compass success time "+n)}return o&&(this.last_pos_time=n),[o,this.particleFilter.getResultX(),this.particleFilter.getResultY()]}setBeaconPosition(t,e){if(this.last_beacon_time=e,this.particleFilter.getPosInitFlag())this.particleFilter.update(t,this.sigmaBeacon);else{this.particleFilter.initParticlesByPos(t.x,t.y,()=>!0);let n=this.cacheSensorData.filter(i=>i.timestamp>e);console.log("\u521D\u59CBsensorData",n),n.map(i=>this.pfFusionPDRiBeacon(i))}return this.resetParticleFilterDist(t),this.particleFilter.resampling(),this.position_count+=1,this.cacheSensorData.length=0,[this.particleFilter.getResultX(),this.particleFilter.getResultY()]}getGpsPosition(t){return t[2]>this.gps_max_horizontalAccuracy?null:K1(t[0],t[1])}resetParticleFilterDist(t,e,n){let i=this.particleFilter.getResultX(),o=this.particleFilter.getResultY(),s=jr(i,o,t.x,t.y);(e==="gps"?n&&s>n||s>this.GpsMaxEstimateErr:s>this.MaxEstimateErr)?(this.outTrustRegionNum+=1,this.outTrustRegionNum>=this.TrustNum&&(console.info("\u8D85\u51FA\u53EF\u4FE1\u533A\u57DF\uFF0C\u91CD\u7F6E\u7C92\u5B50\u8FC7\u6EE4\u5668\u5230: "+t.x+", "+t.y),this.particleFilter.setPosInitFlag(!1),this.particleFilter.setYawInitFlag(!1),this.outTrustRegionNum=0)):this.outTrustRegionNum=0}constructor(t){this.sigmaBeacon=5,this.gps_horizontalAccuracy=10,this.using_gps=!0,this.last_beacon_time=Date.now(),this.position_count=0,this.gps_max_horizontalAccuracy=20,this.MaxEstimateErr=5,this.GpsMaxEstimateErr=30,this.outTrustRegionNum=0,this.TrustNum=4,this.cacheSensorData=[],this.startTime=null;let e=T({},dR,t);this.using_gps=e.using_gps,this.particleFilter=new Ma({NumParticle:200,reSampNumParticle:.65,initial_xy_uncertainty:12,initial_yaw_uncertainty:100,step_noise_sigma:.5,yaw_noise_sigma:2,compass_update_interval:3e3,sigmaCompass:80,delta_yaw:2,sigmaBeacon:5,unaccess_weight:.7}),this.pdr=new Pa}};var R1=class extends mR{checkSensor(){return this.sensor.checkSensor()}start(){this.sensor.start(),this.pdr.startTime=Date.now(),this.sensor.addEventListener("add-data-item",t=>{let{item:e}=t;this.getPositionBySensorItem(e,!this._pause)})}pause(){this._pause=!0}continue(){this._pause=!1}getPositionBySensorItem(t,e){e===void 0&&(e=!0);let[n,i,o]=this.pdr.pfFusionPDRiBeacon(t);return n&&e&&this.dispatchEvent({type:"position",x:i,y:o,_type:t.type===N.GPS?"gps":"pdr"}),[n,i,o]}setBeaconPosition(t,e){let[n,i]=this.pdr.setBeaconPosition(t,e);this.dispatchEvent({type:"position",x:n,y:i,_type:"beacon"})}dispose(){this.sensor.stop()}constructor(t={}){super(),this._pause=!1,this.sensor=new ga(t.sensor),this.pdr=new ja(t.pdr||{})}};var Itt=d(v(),1),Ytt=d(Z(),1);var ytt=d(v(),1),Mtt=d(Z(),1);import{Mesh as gR,Object3D as yR,TextureLoader as MR,Color as PR,Vector2 as Dc,Vector3 as jR,NormalBlending as AR,RepeatWrapping as TR}from"three";var F1={texture_url:_s,lineWidth:8,color:16777215},Aa=class extends yR{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,c]=a;return W(new jR(u,l,c),e,n,i)}).map(a=>{let{x:u,y:l}=a;return[u,l]});return xt(o)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new Dc(t,1)}loadTexture(t){return new Promise((e,n)=>{new MR().load(t,e,void 0,n)})}transformPoints(t){let e=[];for(let n=0;n<t.length;n++)e.push(...t[n]);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 j(this,null,function*(){let e=this.geometry=new ht;if(this.updatePoints(t),!this.texture){let o=this.texture=yield this.loadTexture(this.config.texture_url);o.wrapS=o.wrapT=TR}let n=this.material=new Yn({useMap:!0,color:new PR(this.config.color),transparent:!0,resolution:new Dc(this.navigation.bmap.context.clientSize.width,this.navigation.bmap.context.clientSize.height),depthTest:!0,sizeAttenuation:!1,lineWidth:this.config.lineWidth*2,map:this.texture,blending:AR,repeat:new Dc(this.getRepeat(),1)}),i=this.mesh=new gR(e,n);return i.renderOrder=9,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=F1,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({},F1,e),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}};import{Tween as vR}from"@tweenjs/tween.js";import{AnimationMixer as wR,Box3 as SR,Object3D as z1,Box2 as bR,Vector3 as Ta,Vector2 as Zi}from"three";var wa=class extends z1{getBaseScale(t){let{clientSize:{width:e,height:n},camera:i}=this.bmap.context,o=new SR().setFromObject(t),{max:s,min:a}=o,u=new Ta(a.x,s.y,s.z),l=new Ta(s.x,s.y,s.z),c=new Ta(s.x,a.y,a.z),h=new Ta(a.x,a.y,a.z),p=W(u,i,e,n),m=W(l,i,e,n),g=W(h,i,e,n),M=W(c,i,e,n),A=new bR().setFromPoints([new Zi(p.x,p.y),new Zi(m.x,m.y),new Zi(g.x,g.y),new Zi(M.x,M.y)]).getSize(new Zi),S=40/A.x,_=40/A.y,I=Math.min(S,_),x=i.zoom;return I*x}registryEvent(){this.bmap.context.addEventListener("update",this._update),this.bmap.context.addEventListener("control-zoom-change",this._onChangeZoom)}unRegistryEvent(){this.bmap.context.removeEventListener("update",this._update),this.bmap.context.removeEventListener("control-zoom-change",this._onChangeZoom)}printGraph(t){console.group(" <"+t.type+"> "+t.name),t.children.forEach(e=>this.printGraph(e)),console.groupEnd()}setClips(t){this.clearClips(),t.length&&(this.mixer=new wR(this.model.scene),t.forEach(e=>this.mixer.clipAction(e).play()))}startClips(){var t;this.setClips(((t=this.model)==null?void 0:t.animations)||[])}clearClips(){this.mixer&&(this.mixer.stopAllAction(),this.mixer.uncacheRoot(this.mixer.getRoot()),this.mixer=null)}dispose(){this.unRegistryEvent(),this.clearClips(),this.clear(),this.model&&L(this.model.scene),this.bmap=null}constructor(t,e){super(),this.bmap=t,this.group=new z1,this.mixer=null,this.previewTime=0,this.basicScale=1,this._update=()=>{let n=Date.now();if(!this.previewTime)this.previewTime=n;else{var i;let o=n-this.previewTime;this.previewTime=n,(i=this.mixer)==null||i.update(o/1e3)}},this._onChangeZoom=n=>{let{zoom:i}=n;var o;let s=this.basicScale/i;(o=this.model)==null||o.scene.scale.set(s,s,s)},this.add(this.group),mt.loadModel(e,!1).then(n=>{this.model=n;let i=this.getBaseScale(n.scene);this.basicScale=i;let o=this.bmap.context.camera.zoom;n.scene.scale.set(i/o,i/o,i/o),this.group.add(n.scene),this.setClips(n.animations),this.group.rotation.set(Math.PI/2,Math.PI,0),this.dispatchEvent({type:"loaded"})}),this.registryEvent()}};import{Vector3 as Sa}from"three";import{isNil as _R}from"lodash";var N1=class extends gt{registryEvent(){this.bmap.context.addEventListener("update",this.onUpdate)}pauseAnimation(){this.tweenUtil.pause()}continueAnimation(){this.tweenUtil.continue()}clearTween(){this.tweenUtil.clear(),this.bmap.context.control.enabled=!0}unRegistryEvent(){this.bmap.context.removeEventListener("update",this.onUpdate)}clearPath(){this.path&&(this.bmap.context.scene.remove(this.path),this.path.dispose(),this.path=null,this.movedDistance=0,this.clearTween()),this.startModel&&(this.startModel.visible=!1),this.translatePath=null}addPath(t){this.paths=t;let e=t.map(n=>T({},n,{points:this.translatePoints(n.points)}));if(this.clearTween(),this.movedDistance=0,this.bmap.currentBuildGround)this.renderPath(e);else{let n=()=>{this.bmap.removeEventListener("center-change",n),this.renderPath(e)};this.bmap.addEventListener("center-change",n)}this.dispatchEvent({type:"add-path",paths:t})}translatePoints(t){let[e,n]=this.bmap.buildingCenter;return t.map(i=>[i[0]-e,i[1]-n])}renderPath(t){if(!t.length)return this.clearPath();let e=[];t.forEach((n,i,o)=>{let s=this.catmullRomCurve3(n.points),a=this.mulFloor.floors.find(u=>u.name===n.floor);if(e.push(...s.map(u=>{let[l,c]=u;return[l,c,a.position.z+a.groundMaxHeight]})),i!==o.length-1){let u=this.mulFloor.floors.find(l=>l.name===o[i+1].floor);e.push([...o[i+1].points[0],u.position.z])}}),this.cPath=e,this.animationPathOptions={cPathIndex:0},this.path?this.path.updatePoints(e):(this.path=new Aa(this),this.path.create(e),this.path.position.z=.5,this.bmap.context.scene.add(this.path)),this.startModel&&(this.startModel.position.set(e[0][0],e[0][1],e[0][2]),this.startModel.visible=!0),this.dispatchEvent({type:"render-path",path:this.path})}catmullRomCurve3(t){return Oo(t,!1,!0,.1,170,2.5)}getPathDirection(t,e){if(t.length<2)return null;let n=_e(t,e),i=t[n],o=t[n+1],s=new Sa(o[0]-i[0],o[1]-i[1],0).normalize(),a=new Sa(0,1,0).normalize(),u=s.angleTo(a),l=new Sa().crossVectors(a,s);return(Object.is(l.y,0)?-1:1)*u}startSimulation(t){return j(this,null,function*(){t===void 0&&(t=1);let{paths:e,movedDistance:n}=this;if(!e.length)return;let i=e.reduce((s,a)=>s+a.distance,0);if(!i||n>=i)return;this.simulationTween&&this.tweenUtil.remove(this.simulationTween);let o=i/t;return this.startModel.startClips(),new Promise(s=>{let a=this.simulationTween=new vR({distance:this.movedDistance},this.tweenUtil.group).to({distance:i},o*1e3).onUpdate(u=>{var l;this.movedDistance=u.distance;let c=u.distance,h=0;for(let A=0;A<e.length;A++)if(e[A].distance>=c){h=A;break}else c-=e[A].distance;let p=Qn(e[h].points,c);if(p===null)return;this.currentPathPosition=p;let m=this.translatePoints([p])[0],g=this.mulFloor.floors.find(A=>A.name===e[h].floor),M=g?g.position.z+g.groundMaxHeight:(l=this.startModel)==null?void 0:l.position.z;this.startModel&&this.startModel.position.set(m[0],m[1],M);let P=this.getPathDirection(e[h].points,p);_R(P)||this.startModel.setRotationFromAxisAngle(new Sa(0,0,1),P)}).onComplete(()=>{this.tweenUtil.remove(a),this.startModel.clearClips(),s(!0)}).start()})})}setStartPoiRotate(t){if(this.startPoi){let n=(this.bmap.context.control.getAzimuthalAngle()*180/Math.PI+360)%360;this.startPoi.options.icon_rotate=(360-t-n)%360}}dispose(){this.path&&(this.bmap.context.scene.remove(this.path),this.path.dispose()),this.startModel&&(this.bmap.context.scene.remove(this.startModel),this.startModel.dispose()),this.tweenUtil.dispose(),this.unRegistryEvent(),super.dispose()}constructor(t,e){super(t),this.mulFloor=e,this.path=null,this.fetchRoadStatus=!1,this.paths=[],this.curFloorPath=null,this.translatePath=null,this.currentPathPosition=null,this.pathTween=null,this.startPoi=null,this.movedDistance=0,this.tweenUtil=new en,this.animationPathOptions={cPathIndex:0},this.cPath=[],this.onUpdate=()=>{this.tweenUtil.update()},this.startModel=new wa(t,IA),this.startModel.visible=!1,this.bmap.context.scene.add(this.startModel),this.registryEvent()}};import{Raycaster as WR,Vector2 as xR}from"three";var U1=class extends gt{registryEvent(){this.clickHelper.addEventListener("click",this._click)}unRegistryEvent(){this.clickHelper.removeEventListener("click",this._click)}dispose(){this.unRegistryEvent(),this.clickHelper.dispose(),this.mulFloors=null,super.dispose()}constructor(t,e){super(t),this.mulFloors=e,this._click=n=>{let{e:i}=n;if(!this.mulFloors.showStatus)return;let o=new xR,{offsetX:s,offsetY:a}=i,{clientSize:u}=this.bmap.context;o.x=s/u.width*2-1,o.y=a/u.height*-2+1;let l=new WR;l.setFromCamera(o,this.bmap.context.camera),l.ray.origin.sub(l.ray.direction.clone().multiplyScalar(1e4));let h=this.mulFloors.poiLayer.pois.map(m=>{if(!m.canSelect)return null;let g=l.intersectObjects(m.children,!0);return g.length?g[0]:null}).reduce((m,g)=>g&&(!m||g.distance<m.distance)?g:m,null),p=h==null?void 0:h.object;h&&h.object.isSprite&&(p=h.object.parent),p&&p instanceof $&&this.dispatchEvent({type:"select",pois:[p]})},this.clickHelper=new Ro(this.bmap.context.container),this.registryEvent()}};var cet=d(G1(),1),het=d(k1(),1),pet=d(Z(),1);import{EventDispatcher as KR}from"three";var qtt=d(v(),1),$tt=d(Z(),1),tet=d(Co(),1);import{Vector2 as Ci}from"three";function CR(r){let t=r.length,e=0,n=0,i=0,o=0;r.forEach(u=>{e+=u[0],n+=u[1],i+=u[0]*u[1],o+=u[0]*u[0]});let s=(t*i-e*n)/(t*o-e*e),a=(n-s*e)/t;return{m:s,b:a}}function OR(r,t,e){let n=e[0][0],i=e.slice(-1)[0][0],o=r*n+t,s=r*i+t;return{start:[n,o],end:[i,s]}}function ba(r){if(r.length<2)return null;let t=r.filter((u,l)=>{let c=[...r];return c.splice(l,1),c.every(h=>h[0]!==u[0]&&h[1]!==u[1])});if(t.length<2)return null;let{m:e,b:n}=CR(t),{start:i,end:o}=OR(e,n,t),a=360-(new Ci().subVectors(new Ci(o[0],o[1]),new Ci(i[0],i[1])).angle()/Math.PI*180-90+360)%360;return Number.isNaN(a)?null:a}function ret(r){let t=[];for(let e=1;e<r.length;e++){let n=r[e-1],i=r[e],o=i.position[0]-n.position[0],s=i.position[1]-n.position[1],a=Math.sqrt(o**2+s**2),u=i.time-n.time;if(u>0){let l=a/u;console.log("speedDelta",n.type,i.type,Xc(l),a,u),t.push(l)}else t.push(0)}return t}function iet(r,t){let e=r[0],n=r.slice(-1)[0],i=K(n.position,e.position),o=n.time-e.time;return o<100||i<3?null:i/o}function Xc(r){return r*60*60}function Oi(r,t,e,n){let i=(e+90)%360*(Math.PI/180),o=t*n,s=new Ci(r[0],r[1]),a=Math.cos(i),u=Math.sin(i),l=new Ci(a,u);return s.add(l.normalize().multiplyScalar(o)),[s.x,s.y]}function oet(r){let t=[...r].sort((l,c)=>l-c),e=V1(t,25),n=V1(t,75),i=n-e,o=e-1.5*i,s=n+1.5*i,a=t.filter(l=>l>=o&&l<=s);return r.filter(l=>a.includes(l))}function V1(r,t){let e=t/100*(r.length-1),n=Math.floor(e),i=Math.ceil(e);if(n===i)return r[n];let o=e-n;return r[n]*(1-o)+r[i]*o}var va=class{filter(t){let e=this.estimate,n=this.errorEstimate+this.processNoise,i=n/(n+this.measurementNoise);return this.estimate=e+i*(t-e),this.errorEstimate=(1-i)*n,this.estimate}constructor(t={}){this.estimate=0,this.errorEstimate=1,this.processNoise=.1,this.measurementNoise=1,this.measurementNoise=t.measurementNoise||1,this.processNoise=t.processNoise||.1,this.errorEstimate=t.errorEstimate||1}};import{isNil as _a}from"lodash";var J1=class extends KR{setPathAngle(t){this.pathAngle=t,this.dispatchEvent({type:"change-compass",value:this.pathAngle}),_a(this.angle)&&(this.angle=t)}changeSpeed(){let t=this.history.filter(u=>["vision"].includes(u.type));if(t.length<2){this.speedFilter.filter(0),this.speed=0;return}let e=t[0],n=t.slice(-1)[0],i=K(n.position,e.position),o=n.time-e.time,s=o>0?i/o:0,a=this.speedFilter.filter(s);this.speed=a}changeAngle(t){t===void 0&&(t=this.visionHistory),t.length<2&&(this.angle=null);let e=ba(t.map(n=>n.position));e!==null&&this.setAngle(e)}setAngle(t,e){e===void 0&&(e=!0),this.angle=t,e&&this.dispatchEvent({type:"change-position-compass",value:t})}setPosition(t,e,n){let i={position:t,time:e,clientTime:Date.now()-n,type:"vision"};if(this._setVisionHistoryForAngle(i),_a(this.angle)||!this.speed){this.addHistory(i);return}let o=this.history.findLastIndex(a=>a.type==="vision"),s=this.history[o];if(s){if(s.time>e)return;let a=ba([this.history.slice(-1)[0].position,t]);if(a&&Math.abs(a-this.angle)<60){this.addHistory(i);return}let u=Oi(t,this.speed,360-this.pathAngle,n);K(u,this.history.slice(-1)[0].position)>5?this.visionExcessesCount++:this.visionExcessesCount=0,this.visionExcessesCount>3&&(console.warn("\u8FDE\u7EED\u4E09\u6B21\u89C6\u89C9\u548Cpdr\u5DEE\u8DDD\u5927\u4E8E5\u7C73\uFF0C\u4F7F\u7528\u89C6\u89C9\u6821\u51C6"),this.addHistory(i),this.visionExcessesCount=0)}}resetPdrPosition(){let t=this.history.findLast(e=>e.type==="vision");if(t&&this.speed){let e=Oi(t.position,this.speed,360-this.pathAngle,Date.now()-t.clientTime);e&&this.history.push({position:e,time:Date.now(),clientTime:Date.now(),type:"pdr"})}}getLastVisionPdrPos(){let t=this.history.findLastIndex(n=>n.type==="vision");if(t!==-1){var e;return(e=this.history[t+1])!=null?e:this.history[t]}return null}_setVisionHistoryForAngle(t){if(!this.visionHistory.length){this.visionHistory.push(t);return}let e=ba([this.visionHistory.slice(-1)[0].position,t.position]);if(e!==null&&(this.angle&&Math.abs(this.angle-e)>60?this.angleExcessesCount++:(this.angleExcessesCount=0,this.visionHistory.push(t))),this.angleExcessesCount>3)console.warn("\u8FDE\u7EED\u4E09\u6B21\u89D2\u5EA6\u6BD4\u8F83\u6B6A\uFF0C\u91CD\u65B0\u77EB\u6B63"),this.visionHistory=[t],this.angleExcessesCount=0;else{let n=K(this.visionHistory[0].position,this.visionHistory.slice(-1)[0].position);for(;n>5&&this.visionHistory.length>15;)this.visionHistory.shift(),n=K(this.visionHistory[0].position,this.visionHistory.slice(-1)[0].position)}this.changeAngle()}addHistory(t){this.history.push(t);let e=this.history.filter(a=>a.type==="vision"),n=e.length?Date.now()-e.slice(-1)[0].clientTime:0,i=K(this.history[0].position,this.history.slice(-1)[0].position),o=n>5e3?10:3,s=n>5e3?0:5;for(n>5e3&&console.warn("\u89C6\u89C9\u7ED3\u679C\u8D85\u51FA5s\u4E0D\u53EF\u7528\uFF0C\u5168\u90E8\u6E05\u7A7A");e.length>s&&i>o;)this.history.shift(),e=this.history.filter(a=>a.type==="vision"),i=K(this.history[0].position,this.history.slice(-1)[0].position);s===0?this.changeSpeed():t.type==="vision"&&this.changeSpeed(),this.changePosition(t.type)}setBeaconPosition(t,e,n){let i=Date.now()-n,o={position:t,time:e,clientTime:i,type:"beacon"},s=this.history.findLastIndex(c=>c.type!=="pdr"),a=this.history[s];if(!a){this.addHistory(o);return}if(_a(this.pathAngle)||!this.speed){this.addHistory(o);return}if(a&&a.time>e)return;let u=Oi(t,this.speed,360-this.pathAngle,n);K(u,this.history.slice(-1)[0].position)>5?this.beaconExcessesCount++:this.beaconExcessesCount=0,this.beaconExcessesCount>3&&(console.warn("\u8FDE\u7EED\u4E09\u6B21beacon\u548Cpdr\u5DEE\u8DDD\u5927\u4E8E5\u7C73\uFF0C\u4F7F\u7528beacon\u6821\u51C6"),this.addHistory(o),this.beaconExcessesCount=0)}startPositionTimer(){this.positionTimer&&this.timer.clearInterval(this.positionTimer),this.positionTimer=this.timer.setInterval(()=>{this.changePosition()},20)}stopPositionTimer(){this.positionTimer&&(this.timer.clearInterval(this.positionTimer),this.positionTimer=null)}changePosition(t){t===void 0&&(t="pdr");let e=this.getPosition(t);e.success&&(this.history.push({position:e.pos,time:Date.now(),clientTime:Date.now(),type:"pdr"}),this.speed?this.dispatchEvent({type:"change-pos",value:T({},e)}):this.dispatchEvent({type:"change-pos",value:e}))}getPosition(t){if(this.history.length===0)return{success:!1,pos:[0,0],compass:null,speed:0};let e=this.history.slice(-1)[0];if(this.history.length<2)return{success:!0,pos:e.position,compass:this.pathAngle,speed:this.speed};if(_a(this.pathAngle)||!this.speed)return{success:!0,pos:e.position,compass:this.pathAngle,speed:this.speed};let n=e.clientTime,i=Date.now()-n;return{success:!0,pos:this.pathAngle?Oi(e.position,this.speed,360-this.pathAngle,i):e.position,compass:this.pathAngle,speed:Xc(this.speed)}}dispose(){this.timer.dispose()}constructor(){super(),this.history=[],this.visionHistory=[],this.speed=0,this.angle=null,this.timer=new H,this.positionTimer=null,this.speedFilter=new va,this.visionExcessesCount=0,this.beaconExcessesCount=0,this.angleExcessesCount=0,this.pathAngle=0,this.startPositionTimer()}};var Aet=d(Vr(),1);function Zc(){let r=new Blob([`var mF=Object.create;var Zx=Object.defineProperty;var yF=Object.getOwnPropertyDescriptor;var vF=Object.getOwnPropertyNames;var _F=Object.getPrototypeOf,xF=Object.prototype.hasOwnProperty;var lt=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports);var EF=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of vF(t))!xF.call(n,s)&&s!==e&&Zx(n,s,{get:()=>t[s],enumerable:!(o=yF(t,s))||o.enumerable});return n};var on=(n,t,e)=>(e=n!=null?mF(_F(n)):{},EF(t||!n||!n.__esModule?Zx(e,"default",{value:n,enumerable:!0}):e,n));var ec=(n,t,e)=>new Promise((o,s)=>{var c=g=>{try{p(e.next(g))}catch(m){s(m)}},h=g=>{try{p(e.throw(g))}catch(m){s(m)}},p=g=>g.done?o(g.value):Promise.resolve(g.value).then(c,h);p((e=e.apply(n,t)).next())});var oo=lt((Im,Jx)=>{"use strict";var Rf=function(n){return n&&n.Math===Math&&n};Jx.exports=Rf(typeof globalThis=="object"&&globalThis)||Rf(typeof window=="object"&&window)||Rf(typeof self=="object"&&self)||Rf(typeof global=="object"&&global)||Rf(typeof Im=="object"&&Im)||function(){return this}()||Function("return this")()});var gi=lt((bJ,Kx)=>{"use strict";Kx.exports=function(n){try{return!!n()}catch(t){return!0}}});var Xs=lt((AJ,jx)=>{"use strict";var wF=gi();jx.exports=!wF(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var Lf=lt((TJ,Qx)=>{"use strict";var SF=gi();Qx.exports=!SF(function(){var n=function(){}.bind();return typeof n!="function"||n.hasOwnProperty("prototype")})});var Is=lt((CJ,tE)=>{"use strict";var MF=Lf(),rp=Function.prototype.call;tE.exports=MF?rp.bind(rp):function(){return rp.apply(rp,arguments)}});var iE=lt(rE=>{"use strict";var eE={}.propertyIsEnumerable,nE=Object.getOwnPropertyDescriptor,bF=nE&&!eE.call({1:2},1);rE.f=bF?function(t){var e=nE(this,t);return!!e&&e.enumerable}:eE});var ip=lt((IJ,oE)=>{"use strict";oE.exports=function(n,t){return{enumerable:!(n&1),configurable:!(n&2),writable:!(n&4),value:t}}});var mi=lt((RJ,uE)=>{"use strict";var sE=Lf(),aE=Function.prototype,Rm=aE.call,AF=sE&&aE.bind.bind(Rm,Rm);uE.exports=sE?AF:function(n){return function(){return Rm.apply(n,arguments)}}});var nc=lt((LJ,cE)=>{"use strict";var lE=mi(),TF=lE({}.toString),CF=lE("".slice);cE.exports=function(n){return CF(TF(n),8,-1)}});var hE=lt((NJ,fE)=>{"use strict";var PF=mi(),IF=gi(),RF=nc(),Lm=Object,LF=PF("".split);fE.exports=IF(function(){return!Lm("z").propertyIsEnumerable(0)})?function(n){return RF(n)==="String"?LF(n,""):Lm(n)}:Lm});var op=lt((OJ,pE)=>{"use strict";pE.exports=function(n){return n==null}});var rc=lt((DJ,dE)=>{"use strict";var NF=op(),OF=TypeError;dE.exports=function(n){if(NF(n))throw new OF("Can't call method on "+n);return n}});var ic=lt((FJ,gE)=>{"use strict";var DF=hE(),FF=rc();gE.exports=function(n){return DF(FF(n))}});var Di=lt((UJ,mE)=>{"use strict";var Nm=typeof document=="object"&&document.all;mE.exports=typeof Nm=="undefined"&&Nm!==void 0?function(n){return typeof n=="function"||n===Nm}:function(n){return typeof n=="function"}});var wa=lt((BJ,yE)=>{"use strict";var UF=Di();yE.exports=function(n){return typeof n=="object"?n!==null:UF(n)}});var oc=lt((zJ,vE)=>{"use strict";var Om=oo(),BF=Di(),zF=function(n){return BF(n)?n:void 0};vE.exports=function(n,t){return arguments.length<2?zF(Om[n]):Om[n]&&Om[n][t]}});var xE=lt((GJ,_E)=>{"use strict";var GF=mi();_E.exports=GF({}.isPrototypeOf)});var ME=lt((kJ,SE)=>{"use strict";var kF=oo(),EE=kF.navigator,wE=EE&&EE.userAgent;SE.exports=wE?String(wE):""});var RE=lt((qJ,IE)=>{"use strict";var PE=oo(),Dm=ME(),bE=PE.process,AE=PE.Deno,TE=bE&&bE.versions||AE&&AE.version,CE=TE&&TE.v8,Ys,sp;CE&&(Ys=CE.split("."),sp=Ys[0]>0&&Ys[0]<4?1:+(Ys[0]+Ys[1]));!sp&&Dm&&(Ys=Dm.match(/Edge\\/(\\d+)/),(!Ys||Ys[1]>=74)&&(Ys=Dm.match(/Chrome\\/(\\d+)/),Ys&&(sp=+Ys[1])));IE.exports=sp});var Fm=lt((HJ,NE)=>{"use strict";var LE=RE(),qF=gi(),HF=oo(),VF=HF.String;NE.exports=!!Object.getOwnPropertySymbols&&!qF(function(){var n=Symbol("symbol detection");return!VF(n)||!(Object(n)instanceof Symbol)||!Symbol.sham&&LE&&LE<41})});var Um=lt((VJ,OE)=>{"use strict";var WF=Fm();OE.exports=WF&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Bm=lt((WJ,DE)=>{"use strict";var XF=oc(),YF=Di(),$F=xE(),ZF=Um(),JF=Object;DE.exports=ZF?function(n){return typeof n=="symbol"}:function(n){var t=XF("Symbol");return YF(t)&&$F(t.prototype,JF(n))}});var UE=lt((XJ,FE)=>{"use strict";var KF=String;FE.exports=function(n){try{return KF(n)}catch(t){return"Object"}}});var Nf=lt((YJ,BE)=>{"use strict";var jF=Di(),QF=UE(),tU=TypeError;BE.exports=function(n){if(jF(n))return n;throw new tU(QF(n)+" is not a function")}});var ap=lt(($J,zE)=>{"use strict";var eU=Nf(),nU=op();zE.exports=function(n,t){var e=n[t];return nU(e)?void 0:eU(e)}});var kE=lt((ZJ,GE)=>{"use strict";var zm=Is(),Gm=Di(),km=wa(),rU=TypeError;GE.exports=function(n,t){var e,o;if(t==="string"&&Gm(e=n.toString)&&!km(o=zm(e,n))||Gm(e=n.valueOf)&&!km(o=zm(e,n))||t!=="string"&&Gm(e=n.toString)&&!km(o=zm(e,n)))return o;throw new rU("Can't convert object to primitive value")}});var Of=lt((JJ,qE)=>{"use strict";qE.exports=!1});var up=lt((KJ,VE)=>{"use strict";var HE=oo(),iU=Object.defineProperty;VE.exports=function(n,t){try{iU(HE,n,{value:t,configurable:!0,writable:!0})}catch(e){HE[n]=t}return t}});var lp=lt((jJ,YE)=>{"use strict";var oU=Of(),sU=oo(),aU=up(),WE="__core-js_shared__",XE=YE.exports=sU[WE]||aU(WE,{});(XE.versions||(XE.versions=[])).push({version:"3.39.0",mode:oU?"pure":"global",copyright:"\\xA9 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.39.0/LICENSE",source:"https://github.com/zloirock/core-js"})});var cp=lt((QJ,ZE)=>{"use strict";var $E=lp();ZE.exports=function(n,t){return $E[n]||($E[n]=t||{})}});var sc=lt((tK,JE)=>{"use strict";var uU=rc(),lU=Object;JE.exports=function(n){return lU(uU(n))}});var Sa=lt((eK,KE)=>{"use strict";var cU=mi(),fU=sc(),hU=cU({}.hasOwnProperty);KE.exports=Object.hasOwn||function(t,e){return hU(fU(t),e)}});var qm=lt((nK,jE)=>{"use strict";var pU=mi(),dU=0,gU=Math.random(),mU=pU(1 .toString);jE.exports=function(n){return"Symbol("+(n===void 0?"":n)+")_"+mU(++dU+gU,36)}});var Rs=lt((rK,tw)=>{"use strict";var yU=oo(),vU=cp(),QE=Sa(),_U=qm(),xU=Fm(),EU=Um(),ac=yU.Symbol,Hm=vU("wks"),wU=EU?ac.for||ac:ac&&ac.withoutSetter||_U;tw.exports=function(n){return QE(Hm,n)||(Hm[n]=xU&&QE(ac,n)?ac[n]:wU("Symbol."+n)),Hm[n]}});var iw=lt((iK,rw)=>{"use strict";var SU=Is(),ew=wa(),nw=Bm(),MU=ap(),bU=kE(),AU=Rs(),TU=TypeError,CU=AU("toPrimitive");rw.exports=function(n,t){if(!ew(n)||nw(n))return n;var e=MU(n,CU),o;if(e){if(t===void 0&&(t="default"),o=SU(e,n,t),!ew(o)||nw(o))return o;throw new TU("Can't convert object to primitive value")}return t===void 0&&(t="number"),bU(n,t)}});var Vm=lt((oK,ow)=>{"use strict";var PU=iw(),IU=Bm();ow.exports=function(n){var t=PU(n,"string");return IU(t)?t:t+""}});var fp=lt((sK,aw)=>{"use strict";var RU=oo(),sw=wa(),Wm=RU.document,LU=sw(Wm)&&sw(Wm.createElement);aw.exports=function(n){return LU?Wm.createElement(n):{}}});var Xm=lt((aK,uw)=>{"use strict";var NU=Xs(),OU=gi(),DU=fp();uw.exports=!NU&&!OU(function(){return Object.defineProperty(DU("div"),"a",{get:function(){return 7}}).a!==7})});var Ym=lt(cw=>{"use strict";var FU=Xs(),UU=Is(),BU=iE(),zU=ip(),GU=ic(),kU=Vm(),qU=Sa(),HU=Xm(),lw=Object.getOwnPropertyDescriptor;cw.f=FU?lw:function(t,e){if(t=GU(t),e=kU(e),HU)try{return lw(t,e)}catch(o){}if(qU(t,e))return zU(!UU(BU.f,t,e),t[e])}});var $m=lt((lK,fw)=>{"use strict";var VU=Xs(),WU=gi();fw.exports=VU&&WU(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var Ma=lt((cK,hw)=>{"use strict";var XU=wa(),YU=String,$U=TypeError;hw.exports=function(n){if(XU(n))return n;throw new $U(YU(n)+" is not an object")}});var Pu=lt(dw=>{"use strict";var ZU=Xs(),JU=Xm(),KU=$m(),hp=Ma(),pw=Vm(),jU=TypeError,Zm=Object.defineProperty,QU=Object.getOwnPropertyDescriptor,Jm="enumerable",Km="configurable",jm="writable";dw.f=ZU?KU?function(t,e,o){if(hp(t),e=pw(e),hp(o),typeof t=="function"&&e==="prototype"&&"value"in o&&jm in o&&!o[jm]){var s=QU(t,e);s&&s[jm]&&(t[e]=o.value,o={configurable:Km in o?o[Km]:s[Km],enumerable:Jm in o?o[Jm]:s[Jm],writable:!1})}return Zm(t,e,o)}:Zm:function(t,e,o){if(hp(t),e=pw(e),hp(o),JU)try{return Zm(t,e,o)}catch(s){}if("get"in o||"set"in o)throw new jU("Accessors not supported");return"value"in o&&(t[e]=o.value),t}});var uc=lt((hK,gw)=>{"use strict";var tB=Xs(),eB=Pu(),nB=ip();gw.exports=tB?function(n,t,e){return eB.f(n,t,nB(1,e))}:function(n,t,e){return n[t]=e,n}});var e0=lt((pK,yw)=>{"use strict";var Qm=Xs(),rB=Sa(),mw=Function.prototype,iB=Qm&&Object.getOwnPropertyDescriptor,t0=rB(mw,"name"),oB=t0&&function(){}.name==="something",sB=t0&&(!Qm||Qm&&iB(mw,"name").configurable);yw.exports={EXISTS:t0,PROPER:oB,CONFIGURABLE:sB}});var r0=lt((dK,vw)=>{"use strict";var aB=mi(),uB=Di(),n0=lp(),lB=aB(Function.toString);uB(n0.inspectSource)||(n0.inspectSource=function(n){return lB(n)});vw.exports=n0.inspectSource});var Ew=lt((gK,xw)=>{"use strict";var cB=oo(),fB=Di(),_w=cB.WeakMap;xw.exports=fB(_w)&&/native code/.test(String(_w))});var pp=lt((mK,Sw)=>{"use strict";var hB=cp(),pB=qm(),ww=hB("keys");Sw.exports=function(n){return ww[n]||(ww[n]=pB(n))}});var dp=lt((yK,Mw)=>{"use strict";Mw.exports={}});var yp=lt((vK,Tw)=>{"use strict";var dB=Ew(),Aw=oo(),gB=wa(),mB=uc(),i0=Sa(),o0=lp(),yB=pp(),vB=dp(),bw="Object already initialized",s0=Aw.TypeError,_B=Aw.WeakMap,gp,Df,mp,xB=function(n){return mp(n)?Df(n):gp(n,{})},EB=function(n){return function(t){var e;if(!gB(t)||(e=Df(t)).type!==n)throw new s0("Incompatible receiver, "+n+" required");return e}};dB||o0.state?($s=o0.state||(o0.state=new _B),$s.get=$s.get,$s.has=$s.has,$s.set=$s.set,gp=function(n,t){if($s.has(n))throw new s0(bw);return t.facade=n,$s.set(n,t),t},Df=function(n){return $s.get(n)||{}},mp=function(n){return $s.has(n)}):(ml=yB("state"),vB[ml]=!0,gp=function(n,t){if(i0(n,ml))throw new s0(bw);return t.facade=n,mB(n,ml,t),t},Df=function(n){return i0(n,ml)?n[ml]:{}},mp=function(n){return i0(n,ml)});var $s,ml;Tw.exports={set:gp,get:Df,has:mp,enforce:xB,getterFor:EB}});var Rw=lt((_K,Iw)=>{"use strict";var u0=mi(),wB=gi(),SB=Di(),vp=Sa(),a0=Xs(),MB=e0().CONFIGURABLE,bB=r0(),Pw=yp(),AB=Pw.enforce,TB=Pw.get,Cw=String,_p=Object.defineProperty,CB=u0("".slice),PB=u0("".replace),IB=u0([].join),RB=a0&&!wB(function(){return _p(function(){},"length",{value:8}).length!==8}),LB=String(String).split("String"),NB=Iw.exports=function(n,t,e){CB(Cw(t),0,7)==="Symbol("&&(t="["+PB(Cw(t),/^Symbol\\(([^)]*)\\).*$/,"$1")+"]"),e&&e.getter&&(t="get "+t),e&&e.setter&&(t="set "+t),(!vp(n,"name")||MB&&n.name!==t)&&(a0?_p(n,"name",{value:t,configurable:!0}):n.name=t),RB&&e&&vp(e,"arity")&&n.length!==e.arity&&_p(n,"length",{value:e.arity});try{e&&vp(e,"constructor")&&e.constructor?a0&&_p(n,"prototype",{writable:!1}):n.prototype&&(n.prototype=void 0)}catch(s){}var o=AB(n);return vp(o,"source")||(o.source=IB(LB,typeof t=="string"?t:"")),n};Function.prototype.toString=NB(function(){return SB(this)&&TB(this).source||bB(this)},"toString")});var Ff=lt((xK,Lw)=>{"use strict";var OB=Di(),DB=Pu(),FB=Rw(),UB=up();Lw.exports=function(n,t,e,o){o||(o={});var s=o.enumerable,c=o.name!==void 0?o.name:t;if(OB(e)&&FB(e,c,o),o.global)s?n[t]=e:UB(t,e);else{try{o.unsafe?n[t]&&(s=!0):delete n[t]}catch(h){}s?n[t]=e:DB.f(n,t,{value:e,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return n}});var Ow=lt((EK,Nw)=>{"use strict";var BB=Math.ceil,zB=Math.floor;Nw.exports=Math.trunc||function(t){var e=+t;return(e>0?zB:BB)(e)}});var yl=lt((wK,Dw)=>{"use strict";var GB=Ow();Dw.exports=function(n){var t=+n;return t!==t||t===0?0:GB(t)}});var Uw=lt((SK,Fw)=>{"use strict";var kB=yl(),qB=Math.max,HB=Math.min;Fw.exports=function(n,t){var e=kB(n);return e<0?qB(e+t,0):HB(e,t)}});var l0=lt((MK,Bw)=>{"use strict";var VB=yl(),WB=Math.min;Bw.exports=function(n){var t=VB(n);return t>0?WB(t,9007199254740991):0}});var Uf=lt((bK,zw)=>{"use strict";var XB=l0();zw.exports=function(n){return XB(n.length)}});var qw=lt((AK,kw)=>{"use strict";var YB=ic(),$B=Uw(),ZB=Uf(),Gw=function(n){return function(t,e,o){var s=YB(t),c=ZB(s);if(c===0)return!n&&-1;var h=$B(o,c),p;if(n&&e!==e){for(;c>h;)if(p=s[h++],p!==p)return!0}else for(;c>h;h++)if((n||h in s)&&s[h]===e)return n||h||0;return!n&&-1}};kw.exports={includes:Gw(!0),indexOf:Gw(!1)}});var f0=lt((TK,Vw)=>{"use strict";var JB=mi(),c0=Sa(),KB=ic(),jB=qw().indexOf,QB=dp(),Hw=JB([].push);Vw.exports=function(n,t){var e=KB(n),o=0,s=[],c;for(c in e)!c0(QB,c)&&c0(e,c)&&Hw(s,c);for(;t.length>o;)c0(e,c=t[o++])&&(~jB(s,c)||Hw(s,c));return s}});var xp=lt((CK,Ww)=>{"use strict";Ww.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var Yw=lt(Xw=>{"use strict";var tz=f0(),ez=xp(),nz=ez.concat("length","prototype");Xw.f=Object.getOwnPropertyNames||function(t){return tz(t,nz)}});var Zw=lt($w=>{"use strict";$w.f=Object.getOwnPropertySymbols});var Kw=lt((RK,Jw)=>{"use strict";var rz=oc(),iz=mi(),oz=Yw(),sz=Zw(),az=Ma(),uz=iz([].concat);Jw.exports=rz("Reflect","ownKeys")||function(t){var e=oz.f(az(t)),o=sz.f;return o?uz(e,o(t)):e}});var tS=lt((LK,Qw)=>{"use strict";var jw=Sa(),lz=Kw(),cz=Ym(),fz=Pu();Qw.exports=function(n,t,e){for(var o=lz(t),s=fz.f,c=cz.f,h=0;h<o.length;h++){var p=o[h];!jw(n,p)&&!(e&&jw(e,p))&&s(n,p,c(t,p))}}});var nS=lt((NK,eS)=>{"use strict";var hz=gi(),pz=Di(),dz=/#|\\.prototype\\./,Bf=function(n,t){var e=mz[gz(n)];return e===vz?!0:e===yz?!1:pz(t)?hz(t):!!t},gz=Bf.normalize=function(n){return String(n).replace(dz,".").toLowerCase()},mz=Bf.data={},yz=Bf.NATIVE="N",vz=Bf.POLYFILL="P";eS.exports=Bf});var Ls=lt((OK,rS)=>{"use strict";var Ep=oo(),_z=Ym().f,xz=uc(),Ez=Ff(),wz=up(),Sz=tS(),Mz=nS();rS.exports=function(n,t){var e=n.target,o=n.global,s=n.stat,c,h,p,g,m,_;if(o?h=Ep:s?h=Ep[e]||wz(e,{}):h=Ep[e]&&Ep[e].prototype,h)for(p in t){if(m=t[p],n.dontCallGetSet?(_=_z(h,p),g=_&&_.value):g=h[p],c=Mz(o?p:e+(s?".":"#")+p,n.forced),!c&&g!==void 0){if(typeof m==typeof g)continue;Sz(m,g)}(n.sham||g&&g.sham)&&xz(m,"sham",!0),Ez(h,p,m,n)}}});var wp=lt((DK,iS)=>{"use strict";var bz=nc();iS.exports=Array.isArray||function(t){return bz(t)==="Array"}});var sS=lt((FK,oS)=>{"use strict";var Az=Xs(),Tz=wp(),Cz=TypeError,Pz=Object.getOwnPropertyDescriptor,Iz=Az&&!function(){if(this!==void 0)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(n){return n instanceof TypeError}}();oS.exports=Iz?function(n,t){if(Tz(n)&&!Pz(n,"length").writable)throw new Cz("Cannot set read only .length");return n.length=t}:function(n,t){return n.length=t}});var h0=lt((UK,aS)=>{"use strict";var Rz=TypeError,Lz=9007199254740991;aS.exports=function(n){if(n>Lz)throw Rz("Maximum allowed index exceeded");return n}});var p0=lt(()=>{"use strict";var Nz=Ls(),Oz=sc(),Dz=Uf(),Fz=sS(),Uz=h0(),Bz=gi(),zz=Bz(function(){return[].push.call({length:4294967296},1)!==4294967297}),Gz=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(n){return n instanceof TypeError}},kz=zz||!Gz();Nz({target:"Array",proto:!0,arity:1,forced:kz},{push:function(t){var e=Oz(this),o=Dz(e),s=arguments.length;Uz(o+s);for(var c=0;c<s;c++)e[o]=arguments[c],o++;return Fz(e,o),o}})});var lS=lt((kK,uS)=>{"use strict";uS.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 hS=lt((qK,fS)=>{"use strict";var qz=fp(),d0=qz("span").classList,cS=d0&&d0.constructor&&d0.constructor.prototype;fS.exports=cS===Object.prototype?void 0:cS});var dS=lt((HK,pS)=>{"use strict";var Hz=f0(),Vz=xp();pS.exports=Object.keys||function(t){return Hz(t,Vz)}});var mS=lt(gS=>{"use strict";var Wz=Xs(),Xz=$m(),Yz=Pu(),$z=Ma(),Zz=ic(),Jz=dS();gS.f=Wz&&!Xz?Object.defineProperties:function(t,e){$z(t);for(var o=Zz(e),s=Jz(e),c=s.length,h=0,p;c>h;)Yz.f(t,p=s[h++],o[p]);return t}});var vS=lt((WK,yS)=>{"use strict";var Kz=oc();yS.exports=Kz("document","documentElement")});var zf=lt((XK,bS)=>{"use strict";var jz=Ma(),Qz=mS(),_S=xp(),tG=dp(),eG=vS(),nG=fp(),rG=pp(),xS=">",ES="<",m0="prototype",y0="script",SS=rG("IE_PROTO"),g0=function(){},MS=function(n){return ES+y0+xS+n+ES+"/"+y0+xS},wS=function(n){n.write(MS("")),n.close();var t=n.parentWindow.Object;return n=null,t},iG=function(){var n=nG("iframe"),t="java"+y0+":",e;return n.style.display="none",eG.appendChild(n),n.src=String(t),e=n.contentWindow.document,e.open(),e.write(MS("document.F=Object")),e.close(),e.F},Sp,Mp=function(){try{Sp=new ActiveXObject("htmlfile")}catch(t){}Mp=typeof document!="undefined"?document.domain&&Sp?wS(Sp):iG():wS(Sp);for(var n=_S.length;n--;)delete Mp[m0][_S[n]];return Mp()};tG[SS]=!0;bS.exports=Object.create||function(t,e){var o;return t!==null?(g0[m0]=jz(t),o=new g0,g0[m0]=null,o[SS]=t):o=Mp(),e===void 0?o:Qz.f(o,e)}});var x0=lt((YK,AS)=>{"use strict";var oG=Rs(),sG=zf(),aG=Pu().f,v0=oG("unscopables"),_0=Array.prototype;_0[v0]===void 0&&aG(_0,v0,{configurable:!0,value:sG(null)});AS.exports=function(n){_0[v0][n]=!0}});var bp=lt(($K,TS)=>{"use strict";TS.exports={}});var PS=lt((ZK,CS)=>{"use strict";var uG=gi();CS.exports=!uG(function(){function n(){}return n.prototype.constructor=null,Object.getPrototypeOf(new n)!==n.prototype})});var w0=lt((JK,RS)=>{"use strict";var lG=Sa(),cG=Di(),fG=sc(),hG=pp(),pG=PS(),IS=hG("IE_PROTO"),E0=Object,dG=E0.prototype;RS.exports=pG?E0.getPrototypeOf:function(n){var t=fG(n);if(lG(t,IS))return t[IS];var e=t.constructor;return cG(e)&&t instanceof e?e.prototype:t instanceof E0?dG:null}});var A0=lt((KK,OS)=>{"use strict";var gG=gi(),mG=Di(),yG=wa(),vG=zf(),LS=w0(),_G=Ff(),xG=Rs(),EG=Of(),b0=xG("iterator"),NS=!1,tu,S0,M0;[].keys&&(M0=[].keys(),"next"in M0?(S0=LS(LS(M0)),S0!==Object.prototype&&(tu=S0)):NS=!0);var wG=!yG(tu)||gG(function(){var n={};return tu[b0].call(n)!==n});wG?tu={}:EG&&(tu=vG(tu));mG(tu[b0])||_G(tu,b0,function(){return this});OS.exports={IteratorPrototype:tu,BUGGY_SAFARI_ITERATORS:NS}});var Ap=lt((jK,FS)=>{"use strict";var SG=Pu().f,MG=Sa(),bG=Rs(),DS=bG("toStringTag");FS.exports=function(n,t,e){n&&!e&&(n=n.prototype),n&&!MG(n,DS)&&SG(n,DS,{configurable:!0,value:t})}});var BS=lt((QK,US)=>{"use strict";var AG=A0().IteratorPrototype,TG=zf(),CG=ip(),PG=Ap(),IG=bp(),RG=function(){return this};US.exports=function(n,t,e,o){var s=t+" Iterator";return n.prototype=TG(AG,{next:CG(+!o,e)}),PG(n,s,!1,!0),IG[s]=RG,n}});var T0=lt((tj,zS)=>{"use strict";var LG=mi(),NG=Nf();zS.exports=function(n,t,e){try{return LG(NG(Object.getOwnPropertyDescriptor(n,t)[e]))}catch(o){}}});var kS=lt((ej,GS)=>{"use strict";var OG=wa();GS.exports=function(n){return OG(n)||n===null}});var HS=lt((nj,qS)=>{"use strict";var DG=kS(),FG=String,UG=TypeError;qS.exports=function(n){if(DG(n))return n;throw new UG("Can't set "+FG(n)+" as a prototype")}});var WS=lt((rj,VS)=>{"use strict";var BG=T0(),zG=wa(),GG=rc(),kG=HS();VS.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var n=!1,t={},e;try{e=BG(Object.prototype,"__proto__","set"),e(t,[]),n=t instanceof Array}catch(o){}return function(s,c){return GG(s),kG(c),zG(s)&&(n?e(s,c):s.__proto__=c),s}}():void 0)});var nM=lt((ij,eM)=>{"use strict";var qG=Ls(),HG=Is(),Tp=Of(),QS=e0(),VG=Di(),WG=BS(),XS=w0(),YS=WS(),XG=Ap(),YG=uc(),C0=Ff(),$G=Rs(),$S=bp(),tM=A0(),ZG=QS.PROPER,JG=QS.CONFIGURABLE,ZS=tM.IteratorPrototype,Cp=tM.BUGGY_SAFARI_ITERATORS,Gf=$G("iterator"),JS="keys",kf="values",KS="entries",jS=function(){return this};eM.exports=function(n,t,e,o,s,c,h){WG(e,t,o);var p=function(w){if(w===s&&x)return x;if(!Cp&&w&&w in _)return _[w];switch(w){case JS:return function(){return new e(this,w)};case kf:return function(){return new e(this,w)};case KS:return function(){return new e(this,w)}}return function(){return new e(this)}},g=t+" Iterator",m=!1,_=n.prototype,E=_[Gf]||_["@@iterator"]||s&&_[s],x=!Cp&&E||p(s),b=t==="Array"&&_.entries||E,P,I,S;if(b&&(P=XS(b.call(new n)),P!==Object.prototype&&P.next&&(!Tp&&XS(P)!==ZS&&(YS?YS(P,ZS):VG(P[Gf])||C0(P,Gf,jS)),XG(P,g,!0,!0),Tp&&($S[g]=jS))),ZG&&s===kf&&E&&E.name!==kf&&(!Tp&&JG?YG(_,"name",kf):(m=!0,x=function(){return HG(E,this)})),s)if(I={values:p(kf),keys:c?x:p(JS),entries:p(KS)},h)for(S in I)(Cp||m||!(S in _))&&C0(_,S,I[S]);else qG({target:t,proto:!0,forced:Cp||m},I);return(!Tp||h)&&_[Gf]!==x&&C0(_,Gf,x,{name:s}),$S[t]=x,I}});var iM=lt((oj,rM)=>{"use strict";rM.exports=function(n,t){return{value:n,done:t}}});var cM=lt((sj,lM)=>{"use strict";var KG=ic(),P0=x0(),oM=bp(),aM=yp(),jG=Pu().f,QG=nM(),Pp=iM(),t4=Of(),e4=Xs(),uM="Array Iterator",n4=aM.set,r4=aM.getterFor(uM);lM.exports=QG(Array,"Array",function(n,t){n4(this,{type:uM,target:KG(n),index:0,kind:t})},function(){var n=r4(this),t=n.target,e=n.index++;if(!t||e>=t.length)return n.target=null,Pp(void 0,!0);switch(n.kind){case"keys":return Pp(e,!1);case"values":return Pp(t[e],!1)}return Pp([e,t[e]],!1)},"values");var sM=oM.Arguments=oM.Array;P0("keys");P0("values");P0("entries");if(!t4&&e4&&sM.name!=="values")try{jG(sM,"name",{value:"values"})}catch(n){}});var L0=lt(()=>{"use strict";var fM=oo(),pM=lS(),i4=hS(),qf=cM(),hM=uc(),o4=Ap(),s4=Rs(),I0=s4("iterator"),R0=qf.values,dM=function(n,t){if(n){if(n[I0]!==R0)try{hM(n,I0,R0)}catch(o){n[I0]=R0}if(o4(n,t,!0),pM[t]){for(var e in qf)if(n[e]!==qf[e])try{hM(n,e,qf[e])}catch(o){n[e]=qf[e]}}}};for(Ip in pM)dM(fM[Ip]&&fM[Ip].prototype,Ip);var Ip;dM(i4,"DOMTokenList")});var yM=lt((lj,mM)=>{"use strict";var a4=Rs(),u4=a4("toStringTag"),gM={};gM[u4]="z";mM.exports=String(gM)==="[object z]"});var N0=lt((cj,vM)=>{"use strict";var l4=yM(),c4=Di(),Rp=nc(),f4=Rs(),h4=f4("toStringTag"),p4=Object,d4=Rp(function(){return arguments}())==="Arguments",g4=function(n,t){try{return n[t]}catch(e){}};vM.exports=l4?Rp:function(n){var t,e,o;return n===void 0?"Undefined":n===null?"Null":typeof(e=g4(t=p4(n),h4))=="string"?e:d4?Rp(t):(o=Rp(t))==="Object"&&c4(t.callee)?"Arguments":o}});var Lp=lt((fj,_M)=>{"use strict";var m4=N0(),y4=String;_M.exports=function(n){if(m4(n)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return y4(n)}});var EM=lt((hj,xM)=>{"use strict";var v4=Ma();xM.exports=function(){var n=v4(this),t="";return n.hasIndices&&(t+="d"),n.global&&(t+="g"),n.ignoreCase&&(t+="i"),n.multiline&&(t+="m"),n.dotAll&&(t+="s"),n.unicode&&(t+="u"),n.unicodeSets&&(t+="v"),n.sticky&&(t+="y"),t}});var SM=lt((pj,wM)=>{"use strict";var O0=gi(),_4=oo(),D0=_4.RegExp,F0=O0(function(){var n=D0("a","y");return n.lastIndex=2,n.exec("abcd")!==null}),x4=F0||O0(function(){return!D0("a","y").sticky}),E4=F0||O0(function(){var n=D0("^r","gy");return n.lastIndex=2,n.exec("str")!==null});wM.exports={BROKEN_CARET:E4,MISSED_STICKY:x4,UNSUPPORTED_Y:F0}});var bM=lt((dj,MM)=>{"use strict";var w4=gi(),S4=oo(),M4=S4.RegExp;MM.exports=w4(function(){var n=M4(".","s");return!(n.dotAll&&n.test(\`
7745
+ `],{type:"text/javascript"}),t=URL.createObjectURL(r),e=new Worker(t);return URL.revokeObjectURL(t),e}var Z1=class extends sR{setRoadData(t){return j(this,null,function*(){this.initRoadStatus=!1,this.dispatchEvent({type:"init-road-status",status:!1}),yield At(this.worker,"set_road_info",{roadData:t}),this.initRoadStatus=!0,this.dispatchEvent({type:"init-road-status",status:!0})})}getPath(t,e,n){return j(this,null,function*(){return n===void 0&&(n=""),new Promise((i,o)=>{let s=()=>{At(this.worker,"get_path",{start:t,end:e,type:n}).then(a=>{a?typeof a=="string"?o(a):i(a):o("no-path")})};if(this.initRoadStatus)s();else{let a=u=>{let{status:l}=u;l&&(this.removeEventListener("init-road-status",a),s())};this.addEventListener("init-road-status",a)}})})}getDirectionPath(t){return At(this.worker,"get_direction_path",t)}dispose(){return j(this,null,function*(){At(this.worker,"clear",""),this.worker.terminate()})}constructor(){super(),this.worker=Ec(),this.initRoadStatus=!1}};var I$=d(v(),1),Y$=d(ie(),1),E$=d(oe(),1),D$=d(se(),1),X$=d(ae(),1),Z$=d(ue(),1),C$=d(le(),1),O$=d(ce(),1),K$=d(Z(),1);import{Frustum as aR}from"three";var ma=class extends Ft{setEnable(t){super.setEnable(t),st(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=W(this.startPoint,e,n,i),s=W(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 Q&&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 m=W(p,i,o,s);return Be(m,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=W(u,i,o,s),h=W(l,i,o,s);return!(!Be(c,e,n)||!Be(h,e,n))}dispose(){super.dispose(),this.rect=null,this.unRegistryEvent()}constructor(t){super(t),this.frustum=new aR,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=T({},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);st(this.rect,s.x,s.y,a,u)}else st(this.rect,0,0,0,0)};let{config:{selectBox:{fill:e,stroke:n}}}=t;this.rect=Qe(n,e),this.svg.appendChild(this.rect),this.registryEvent()}};var uR={boxSelection:!1,elements:["graphic","poi"]},C1=class extends gt{get list(){return this._list}enableBoxSelection(){this.isMultipleSelect||!this.options.boxSelection||(this.isMultipleSelect=!0,this.boxSelection.setEnable(!0),this.prevPanStatus=this.bmap.context.control.enablePan,this.prevRotateStatus=this.bmap.context.control.enableRotate,this.bmap.context.control.enablePan=!1,this.bmap.context.control.enableRotate=!1)}disableBoxSelection(){this.isMultipleSelect&&(this.isMultipleSelect=!1,this.boxSelection.setEnable(!1),this.bmap.context.control.enablePan=!!this.prevPanStatus,this.bmap.context.control.enableRotate=!!this.prevRotateStatus)}selectEnd(){this.dispatchEvent({type:"select",graphics:[...this._list],pois:[...this._poiList],isMultipleSelect:this.isMultipleSelect})}registryEvent(){this.bmap.context.container.addEventListener("pointerdown",this.onPointerDown),this.bmap.context.container.addEventListener("pointerup",this.onPointerUp),this.bmap.context.container.addEventListener("pointerout",this.onPointerOut),this.bmap.context.container.addEventListener("pointercancel",this.onPointerOut),window.addEventListener("keydown",this.onKeyDown),window.addEventListener("keyup",this.onKeyUp),this.boxSelection.addEventListener("selected",this.onBoxSelected)}unRegistryEvent(){this.bmap.context.container.removeEventListener("pointerdown",this.onPointerDown),this.bmap.context.container.removeEventListener("pointerup",this.onPointerUp),this.bmap.context.container.removeEventListener("pointerout",this.onPointerOut),this.bmap.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(),super.dispose()}constructor(t,e={}){super(t),this._list=new Set,this._poiList=new Set,this.downPoint=null,this.isMultipleSelect=!1,this.onPointerDown=n=>{this.downPoint={x:n.offsetX,y:n.offsetY}},this.onPointerUp=n=>{if(!this.downPoint)return;let{offsetX:i,offsetY:o}=n,{x:s,y:a}=this.downPoint;if(Math.sqrt((s-i)**2+(a-o)**2)>3)return;let u=new Set,l=[],c=[];if(this.options.elements.includes("graphic")){let{graphics:h}=this.bmap.context.getGraphicsByDeviceXy(i,o);h.map(p=>u.add(p.options.id)),l.push(...h)}if(this.options.elements.includes("poi")){let h=this.bmap.context.getPoisByDeviceXy(i,o);c.push(...h),h.forEach(p=>{if(!u.has(p.options.id)){var m;let g=((m=this.bmap.context.currentFloor)==null?void 0:m.graphicLayer.graphicMap.get(p.options.id))||null;g&&(u.add(p.options.id),l.push(g))}})}(!this.options.boxSelection||!(Jn?n.metaKey:n.ctrlKey))&&(this._list.clear(),this._poiList.clear()),l.forEach(h=>this._list.add(h)),c.forEach(h=>this._poiList.add(h)),this.selectEnd(),this.downPoint=null},this.onPointerOut=n=>{this.disableBoxSelection()},this.onKeyDown=n=>{Ln(n.key)&&this.enableBoxSelection()},this.onKeyUp=n=>{Ln(n.key)&&this.disableBoxSelection()},this.onBoxSelected=n=>{let{list:i}=n;this._list.clear(),this._poiList.clear(),i.forEach(o=>{if(this.options.elements.includes("graphic")&&this._list.add(o),this.options.elements.includes("poi")){let s=this.bmap.getPoiById(o.options.id);s&&this._poiList.add(s)}}),this.selectEnd()},this.options=T({},uR,e),this.boxSelection=new ma(this.bmap.context),this.boxSelection.setEnable(!1),this.registryEvent()}};var k$=d(Z(),1);import{cloneDeep as lR,isNil as fn,throttle as O1}from"lodash";import{EventDispatcher as cR}from"three";var N=function(r){return r.COMPASS="compass",r.DEVICE_MOTION="deviceMotion",r.ACCELERATION="acceleration",r.GPS="gps",r}({});var hR={time:1e3,elements:[N.COMPASS,N.DEVICE_MOTION,N.ACCELERATION,N.GPS]},ga=class extends cR{start(){this.options.elements.some(t=>[N.DEVICE_MOTION,N.COMPASS].includes(t))&&this.listenDeviceOrientation(),this.options.elements.includes(N.ACCELERATION)&&this.listenAcceleration(),this.options.elements.includes(N.GPS)&&this.listenGps(),this.dispatchEvent({type:"start"}),this.dispatchTimer=this.timer.setInterval(()=>{this.dispatchEvent({type:"sensor-data",data:lR(this.data)}),this.data=[]},this.options.time)}addDataItem(t){this.data.push(t),this.dispatchEvent({type:"add-data-item",item:t})}listenDeviceOrientation(){Br?window.addEventListener("deviceorientation",this.deviceOrientationAbsHandler,!1):window.addEventListener("deviceorientationabsolute",this.deviceOrientationAbsHandler,{absolute:!0})}listenAcceleration(){window.addEventListener("devicemotion",this.handleAcceleration,!1)}listenGps(){this.gpsTimer=navigator.geolocation.watchPosition(t=>{this.addDataItem({type:N.GPS,timestamp:Date.now(),res:[t.coords.longitude,t.coords.latitude,t.coords.accuracy]})},t=>{console.log("\u83B7\u53D6gps\u5931\u8D25",t)},{enableHighAccuracy:!0})}checkSensor(){return j(this,null,function*(){return{deviceOrientation:yield this.checkDeviceOrientation()}})}checkDeviceOrientation(){return j(this,null,function*(){var t;if(!Br)return!0;if(typeof window.DeviceOrientationEvent!="undefined"&&typeof((t=window.DeviceOrientationEvent)==null?void 0:t.requestPermission)=="function")try{var e;return(yield(e=window.DeviceOrientationEvent)==null?void 0:e.requestPermission())==="granted"}catch(n){return!1}return!1})}stop(){window.removeEventListener("devicemotion",this.handleAcceleration,!1),Br?window.removeEventListener("deviceorientation",this.deviceOrientationAbsHandler,!1):window.removeEventListener("deviceorientationabsolute",this.deviceOrientationAbsHandler,{absolute:!0}),fn(this.gpsTimer)||navigator.geolocation.clearWatch(this.gpsTimer),this.dispatchTimer&&this.timer.clearInterval(this.dispatchTimer),this.data=[],this.dispatchEvent({type:"stop"})}constructor(t={}){super(),this.gpsTimer=null,this.data=[],this.timer=new H,this.dispatchTimer=null,this.addAcceleration=O1(e=>{this.addDataItem(e)},20),this.deviceOrientationAbsHandler=O1(e=>{let n=Date.now(),{alpha:i,beta:o,gamma:s}=e;if(fn(i)||fn(o)||fn(s))return;let a;Br?a=e.webkitCompassHeading:a=360-i,this.options.elements.includes(N.DEVICE_MOTION)&&this.addDataItem({type:N.DEVICE_MOTION,timestamp:n,res:[i,o,s]}),this.options.elements.includes(N.COMPASS)&&this.addDataItem({type:N.COMPASS,timestamp:n,res:a})},200),this.handleAcceleration=e=>{let n=e.accelerationIncludingGravity;fn(n)||fn(n.x)||fn(n.y)||fn(n.z)||this.addAcceleration({type:N.ACCELERATION,timestamp:Date.now(),res:[n.x,n.y,n.z]})},this.options=T({},hR,t)}};var dtt=d(v(),1);import{EventDispatcher as mR}from"three";var utt=d(Z(),1);var $$=d(Z(),1),ttt=d(v(),1);function ya(r,t){return 1/Math.sqrt(2*Math.PI*Math.pow(t,2))*Math.exp(-Math.pow(r,2)/(2*Math.pow(t,2)))}function Xi(r){return(r+360)%360}function K1(r,t){let n=6378137*r*Math.PI/180,i=6378137*Math.log(Math.tan(Math.PI/4+t*Math.PI/180/2));return{x:n,y:i}}function jr(r,t,e,n){return Math.sqrt(Math.pow(Math.abs(r-e),2)+Math.pow(Math.abs(t-n),2))}import{reshape as pR,multiply as fR}from"mathjs";var Ma=class{motionModelRotYaw(t){if(!(Math.abs(t)<.001)){this.last_yaw_compass=Xi(this.last_yaw_compass+t);for(let e=0;e<this.NumParticle;e++){let n=Math.random()*this.yaw_noise_sigma;this.particleX[2][e]=this.particleX[2][e]+t+n,this.particleX[2][e]=Xi(this.particleX[2][e])}}}motionModelStepLength(t,e){if(t===0)return;for(let i=0;i<this.NumParticle;i++){let o=Math.random()*this.step_noise_sigma;this.particleX[0][i]+=(.65+o)*Math.sin(-this.particleX[2][i]/180*Math.PI),this.particleX[1][i]+=(.65+o)*Math.cos(this.particleX[2][i]/180*Math.PI),e(this.particleX[0][i],this.particleX[1][i])||(this.particleWeight[0][i]*=this.unaccess_weight)}let n=this.particleWeight[0].reduce((i,o)=>i+o,0);this.particleWeight[0]=this.particleWeight[0].map(i=>i/n)}motionModelCompassYaw(t,e){if(e-this.last_compass_time>this.compass_update_interval){let n=360-t;n+=this.delta_yaw,n=Xi(n),Math.abs(n-this.last_yaw_compass)>60?this.compass_consecutive_offset_count++:this.compass_consecutive_offset_count=0;for(let o=0;o<this.NumParticle;o++){let s=Math.abs(this.particleX[2][o]-n);s>180&&(s=360-s),this.particleWeight[0][o]*=ya(s,this.sigmaCompass)}let i=this.particleWeight[0].reduce((o,s)=>o+s,0);this.particleWeight[0]=this.particleWeight[0].map(o=>o/i),this.setLastCompassTime(e)}}resampling(){if(1/this.particleWeight[0].reduce((e,n)=>e+n*n,0)<this.reSampNumParticle){let e=this.particleWeight[0].reduce((a,u,l)=>a.concat(a[l]+u),[0]),i=this.particleWeight[0].map(()=>1/this.NumParticle).map((a,u)=>a+Math.random()/this.NumParticle),o=[],s=0;for(let a=0;a<this.NumParticle;a++){for(;i[a]>e[s];)s++;o.push(s)}this.particleX=this.particleX.map((a,u)=>o.map(l=>a[l])),this.particleWeight[0]=Array(this.NumParticle).fill(1/this.NumParticle)}}update(t,e){for(let i=0;i<this.NumParticle;i++){let o=jr(this.particleX[0][i],this.particleX[1][i],t.x,t.y);this.particleWeight[0][i]=Math.max(1e-7,this.particleWeight[0][i]*ya(o,e))}let n=this.particleWeight[0].reduce((i,o)=>i+o,0);this.particleWeight[0]=this.particleWeight[0].map(i=>i/n)}updateCar(t,e){let n=t.x-this.xEst[0][0],i=t.y-this.xEst[1][0];for(let s=0;s<this.NumParticle;s++){let a=jr(this.particleX[0][s],this.particleX[1][s],t.x,t.y);this.particleWeight[0][s]=Math.max(1e-7,this.particleWeight[0][s]*ya(a,e)),this.particleX[0][s]+=n,this.particleX[1][s]+=i}let o=this.particleWeight[0].reduce((s,a)=>s+a,0);this.particleWeight[0]=this.particleWeight[0].map(s=>s/o)}getPosInitFlag(){return this.particle_PosInitFlag}getYawInitFlag(){return this.particle_yawInitFlag}setPosInitFlag(t){this.particle_PosInitFlag=t}setYawInitFlag(t){this.particle_yawInitFlag=t}getResultX(){let t=pR(this.particleWeight,[this.NumParticle,1]),e=fR(this.particleX,t);return this.xEst=e,this.xEst[0][0]}getResultY(){return this.xEst[1][0]}getResultYaw(){let t=this.particleWeight[0].indexOf(Math.max(...this.particleWeight[0]));return this.particleX[2][t]}getEstConfidence(){let t=this.particleWeight[0].indexOf(Math.max(...this.particleWeight[0])),e=this.particleWeight[0].indexOf(Math.min(...this.particleWeight[0])),n=[this.particleX[0][t],this.particleX[1][t]],i=[this.particleX[0][e],this.particleX[1][e]],o=jr(n[0],n[1],i[0],i[1]),s=o*.67;return console.log(o,s),s}getParticleNum(){return this.NumParticle}getParticleX(){return this.particleX}setLastCompassTime(t){this.last_compass_time=t}getLastCompassTime(){return this.last_compass_time}initParticlesByPos(t,e,n){if(!this.particle_PosInitFlag){this.particleWeight[0]=Array(this.NumParticle).fill(1/this.NumParticle);let i=0;for(;i<this.NumParticle;){let s=(2*Math.random()-1)*this.initial_xy_uncertainty,a=(2*Math.random()-1)*this.initial_xy_uncertainty;n(t+s,e+a)||(this.particleWeight[0][i]*=this.unaccess_weight),this.particleX[0][i]=t+s,this.particleX[1][i]=e+a,i++}let o=this.particleWeight[0].reduce((s,a)=>s+a,0);this.particleWeight[0]=this.particleWeight[0].map(s=>s/o),this.particle_PosInitFlag=!0,this.xEst[0][0]=t,this.xEst[1][0]=e,this.xEst[2][0]=0}}initParticlesByCompass(t){console.log("Init compass: "+t);let e=360-t;e+=this.delta_yaw,e=Xi(e),console.log("Init Yaw: "+e);for(let n=0;n<this.NumParticle;n++){let i=(2*Math.random()-1)*this.initial_yaw_uncertainty;this.particleX[2][n]=e+i}this.particle_yawInitFlag=!0,this.xEst[2][0]=e,this.last_yaw_compass=e,this.compass_consecutive_offset_count=0}constructor(t){this.last_yaw_compass=0,this.compass_consecutive_offset_count=0,this.NumParticle=t.NumParticle,this.reSampNumParticle=t.reSampNumParticle,this.initial_xy_uncertainty=t.initial_xy_uncertainty,this.initial_yaw_uncertainty=t.initial_yaw_uncertainty,this.step_noise_sigma=t.step_noise_sigma,this.yaw_noise_sigma=t.yaw_noise_sigma,this.compass_update_interval=t.compass_update_interval,this.sigmaCompass=t.sigmaCompass,this.delta_yaw=t.delta_yaw,this.sigmaBeacon=t.sigmaBeacon,this.unaccess_weight=t.unaccess_weight,this.particle_PosInitFlag=!1,this.particle_yawInitFlag=!1,this.xEst=[[0],[0],[0]],this.particleX=Array.from({length:3},()=>Array(this.NumParticle).fill(0)),this.particleWeight=Array.from({length:1},()=>Array(this.NumParticle).fill(1/this.NumParticle)),this.last_compass_time=0}};var itt=d(Z(),1),ott=d(v(),1),Pa=class{init(){this.fre=100,this.accH_fifo=[],this.accH_time_fifo=[],this.accH_fifo_len=Math.floor(1*this.fre)+1,this.step_count=0,this.state_count=0,this.last_valley_time=0,this.last_peak_time=0,this.last_step_time=0,this.min_step_time=.3,this.max_step_time=1,this.min_peak=10+.5,this.max_valley=10-.5,this.peak_num=0,this.valley_num=0,this.fft_min_amp=.3,this.fft_min_fre=0,this.fft_max_fre=4,this.last_fft_amp=0,this.abnor_start_time=0,this.abnor_fft_detected=!1,this.abnor_peak_time=0,this.abnor_peak_accH=0,this.const_step_length=.65,this.last_rot=[0,0,0],this.delta_rot=[0,0,0],this.last_yaw=0,this.delta_yaw=null,this.delta_rot_sum_fifo=[],this.delta_rot_sum_time_fifo=[],this.delta_yaw_accum=0,this.delta_yaw_accum_timestamp=0,this.delta_yaw_time_threshold=.5,this.last_px=0,this.last_py=0,this.delta_px=0,this.delta_py=0}reset(){this.init()}setInitPose(t){t===void 0&&(t=[0,0]),this.last_px=t[0],this.last_py=t[1],console.info("pdr init pos: "+this.last_px+", "+this.last_py)}setInitYaw(t){t===void 0&&(t=0),this.last_yaw=t}getPos(t,e,n){let i=0;return n.length===3&&(this.delta_yaw=this.getDeltaYawFromRot(t,n)),e.length===3&&(i=this.getStepLength(t,e)),i!==0&&(this.last_px+=this.delta_px,this.last_py+=this.delta_py),[this.last_px,this.last_py]}getDeltaPose(){return[this.delta_px,this.delta_py]}getStepLength(t,e){if(e.length<3)return console.warn("acc data less than 3"),0;let n=!1,i=Math.sqrt(Math.pow(e[0],2)+Math.pow(e[1],2)+Math.pow(e[2],2));if(this.accH_fifo.push(i),this.accH_time_fifo.push(t),this.imuFreUpdate(),this.accH_fifo.length<this.accH_fifo_len+1)n=!1;else{for(;this.accH_fifo.length>=this.accH_fifo_len+1;)this.accH_fifo.shift(),this.accH_time_fifo.shift();let o=this.PVStepDetec(),s=this.FFTStepDetec(),a=this.recheckState(),u=this.accH_time_fifo[Math.floor(this.accH_time_fifo.length*3/4)];Math.abs(this.abnor_start_time)<.001&&this.abnor_fft_detected?this.abnor_start_time=u:this.abnor_fft_detected||(this.abnor_start_time=0),o&&s&&a?(this.step_count+=1,this.last_step_time=u,n=!0):Math.abs(this.abnor_start_time)>.001&&this.abnor_peak_time-this.abnor_start_time>this.abnor_time_threshold&&this.step_count>1&&this.abnor_peak_time-this.last_step_time>1?(this.step_count+=1,this.last_step_time=u,n=!0):(u-this.last_step_time>2&&(this.state_count=0),n=!1)}if(n){let o=this.last_yaw/180*Math.PI;return this.delta_px=this.const_step_length*Math.cos(o),this.delta_py=this.const_step_length*Math.sin(o),this.const_step_length}else return 0}imuFreUpdate(){if(this.accH_time_fifo.length>2&&(this.accH_time_fifo[this.accH_time_fifo.length-1]-this.accH_time_fifo[this.accH_time_fifo.length-2]<0||this.accH_time_fifo[this.accH_time_fifo.length-1]-this.accH_time_fifo[this.accH_time_fifo.length-2]>10||this.accH_time_fifo[this.accH_time_fifo.length-1]===this.accH_time_fifo[0])&&(console.warn("pdr reset last one time "+this.accH_time_fifo[this.accH_time_fifo.length-1]+" last two time "+this.accH_time_fifo[this.accH_time_fifo.length-2]),this.reset()),this.accH_fifo.length>9||this.fre<15){let t=(this.accH_fifo.length-1)/(this.accH_time_fifo[this.accH_time_fifo.length-1]-this.accH_time_fifo[0]);Math.abs(this.fre-t)>8&&(this.fre=Math.round((t-3)/10)*10,(this.fre<=10||this.fre>=100)&&(console.warn("Frequency Error "+this.fre),this.fre=100),console.debug("Frequency change to "+this.fre),this.accH_fifo_len=Math.floor(1*this.fre)+1)}}recheckState(){return!0}PVStepDetec(){let t=!1,e=this.accH_fifo.slice(Math.floor(this.accH_fifo_len/2)),n=this.accH_time_fifo.slice(Math.floor(this.accH_fifo_len/2)),i=e[Math.floor(e.length/2)],o=n[Math.floor(n.length/2)],s=Math.max(...e),a=Math.min(...e),u=!1,l=!1;return Math.abs(i-a)<.01&&i<this.max_valley&&this.valley_num<=this.peak_num&&(this.last_valley_time===0?l=!0:l=o-this.last_valley_time>this.min_step_time,l&&(this.last_valley_time=o,this.valley_num+=1)),Math.abs(i-s)<.01&&i>this.min_peak&&this.peak_num<=this.valley_num&&(this.last_peak_time===0?u=!0:u=o-this.last_peak_time>this.min_step_time,u&&(this.last_peak_time=o,this.peak_num+=1)),i===s&&i>this.min_peak&&(this.abnor_peak_time=o,this.abnor_peak_accH=i),this.peak_num===this.valley_num&&(u||l)&&(t=!0),t}FFTStepDetec(){return!0}getDeltaYawFromRot(t,e){if(e.length<3)return console.warn("rot data less than 3"),0;let n=[0,0,0];this.last_rot.length===3&&(n=e.map((a,u)=>a-this.last_rot[u]));for(let a=0;a<e.length;a++)n[a]<-180?n[a]+=360:n[a]>180&&(n[a]-=360);let i=.2;this.delta_rot.length===3?this.delta_rot=this.delta_rot.map((a,u)=>i*a+(1-i)*n[u]):this.delta_rot=n,this.last_rot=e,this.delta_yaw=this.delta_rot[0],this.last_yaw+=this.delta_yaw,this.last_yaw=this.limitYaw(this.last_yaw);let o=this.delta_rot.reduce((a,u)=>a+Math.abs(u),0);this.delta_rot_sum_fifo.push(o),this.delta_rot_sum_time_fifo.push(t),Math.abs(this.delta_rot_sum_time_fifo[this.delta_rot_sum_time_fifo.length-1]-this.delta_rot_sum_time_fifo[0])>1&&(this.delta_rot_sum_fifo.shift(),this.delta_rot_sum_time_fifo.shift()),this.delta_yaw_accum+=this.delta_yaw;let s=0;return Math.abs(this.delta_yaw_accum_timestamp-t)>this.delta_yaw_time_threshold?(s=this.delta_yaw_accum,this.delta_yaw_accum=0,this.delta_yaw_accum_timestamp=t,s):null}limitYaw(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}constructor(){this.fre=100,this.accH_fifo=[],this.accH_time_fifo=[],this.accH_fifo_len=Math.floor(1*this.fre)+1,this.step_count=0,this.state_count=0,this.last_valley_time=0,this.last_peak_time=0,this.last_step_time=0,this.min_step_time=.3,this.max_step_time=1,this.min_peak=10.5,this.max_valley=9.5,this.peak_num=0,this.valley_num=0,this.fft_min_amp=.3,this.fft_min_fre=0,this.fft_max_fre=4,this.last_fft_amp=0,this.abnor_start_time=0,this.abnor_fft_detected=!1,this.abnor_time_threshold=4,this.abnor_peak_time=0,this.abnor_peak_accH=0,this.const_step_length=.85,this.last_rot=[],this.delta_rot=[],this.last_yaw=0,this.delta_yaw=null,this.delta_rot_sum_fifo=[],this.delta_rot_sum_time_fifo=[],this.delta_yaw_accum=0,this.delta_yaw_accum_timestamp=0,this.delta_yaw_time_threshold=.5,this.last_px=0,this.last_py=0,this.delta_px=0,this.delta_py=0}};var dR={using_gps:!0},ja=class{pfFusionPDRiBeacon(t){let{type:e,timestamp:n,res:i}=t,o=!1;if(this.cacheSensorData.push(t),this.particleFilter.getPosInitFlag()&&this.particleFilter.getYawInitFlag()){if(e===N.ACCELERATION){let s=i,a=this.pdr.getStepLength(n/1e3,s);a!==0&&(this.particleFilter.motionModelStepLength(a,()=>!0),this.particleFilter.resampling(),this.position_count+=1,o=!0)}if(this.using_gps&&e===N.GPS&&(this.last_beacon_time===null||n-this.last_beacon_time>5e3)){let s=this.getGpsPosition(i);o=s!==null,s&&(this.particleFilter.update(s,this.gps_horizontalAccuracy),this.resetParticleFilterDist(s,"gps",i[2]),this.particleFilter.resampling(),this.position_count+=1,this.cacheSensorData.length=0)}if(e===N.DEVICE_MOTION){let s=this.pdr.getDeltaYawFromRot(n/1e3,i);s!==null&&this.particleFilter.motionModelRotYaw(s)}e===N.COMPASS&&this.particleFilter.motionModelCompassYaw(i,n),this.last_pos_time&&n-this.last_pos_time>500&&(this.position_count+=1,o=!0)}else if(!this.particleFilter.getPosInitFlag()&&this.using_gps&&e===N.GPS){if(this.startTime&&Date.now()-this.startTime>3e3){let s=this.getGpsPosition(i);o=s!==null,console.log("gps_pos",s,i),s?(this.particleFilter.initParticlesByPos(s.x,s.y,()=>!0),this.last_pos_time=n,console.log("init Pos by gps success time "+n),this.cacheSensorData.length=0):console.log("init Pos by gps fail time "+n)}}else if(!this.particleFilter.getYawInitFlag()&&e===N.COMPASS){let s=i;this.particleFilter.initParticlesByCompass(s),this.particleFilter.setLastCompassTime(n),console.log("init yaw by compass success time "+n)}return o&&(this.last_pos_time=n),[o,this.particleFilter.getResultX(),this.particleFilter.getResultY()]}setBeaconPosition(t,e){if(this.last_beacon_time=e,this.particleFilter.getPosInitFlag())this.particleFilter.update(t,this.sigmaBeacon);else{this.particleFilter.initParticlesByPos(t.x,t.y,()=>!0);let n=this.cacheSensorData.filter(i=>i.timestamp>e);console.log("\u521D\u59CBsensorData",n),n.map(i=>this.pfFusionPDRiBeacon(i))}return this.resetParticleFilterDist(t),this.particleFilter.resampling(),this.position_count+=1,this.cacheSensorData.length=0,[this.particleFilter.getResultX(),this.particleFilter.getResultY()]}getGpsPosition(t){return t[2]>this.gps_max_horizontalAccuracy?null:K1(t[0],t[1])}resetParticleFilterDist(t,e,n){let i=this.particleFilter.getResultX(),o=this.particleFilter.getResultY(),s=jr(i,o,t.x,t.y);(e==="gps"?n&&s>n||s>this.GpsMaxEstimateErr:s>this.MaxEstimateErr)?(this.outTrustRegionNum+=1,this.outTrustRegionNum>=this.TrustNum&&(console.info("\u8D85\u51FA\u53EF\u4FE1\u533A\u57DF\uFF0C\u91CD\u7F6E\u7C92\u5B50\u8FC7\u6EE4\u5668\u5230: "+t.x+", "+t.y),this.particleFilter.setPosInitFlag(!1),this.particleFilter.setYawInitFlag(!1),this.outTrustRegionNum=0)):this.outTrustRegionNum=0}constructor(t){this.sigmaBeacon=5,this.gps_horizontalAccuracy=10,this.using_gps=!0,this.last_beacon_time=Date.now(),this.position_count=0,this.gps_max_horizontalAccuracy=20,this.MaxEstimateErr=5,this.GpsMaxEstimateErr=30,this.outTrustRegionNum=0,this.TrustNum=4,this.cacheSensorData=[],this.startTime=null;let e=T({},dR,t);this.using_gps=e.using_gps,this.particleFilter=new Ma({NumParticle:200,reSampNumParticle:.65,initial_xy_uncertainty:12,initial_yaw_uncertainty:100,step_noise_sigma:.5,yaw_noise_sigma:2,compass_update_interval:3e3,sigmaCompass:80,delta_yaw:2,sigmaBeacon:5,unaccess_weight:.7}),this.pdr=new Pa}};var R1=class extends mR{checkSensor(){return this.sensor.checkSensor()}start(){this.sensor.start(),this.pdr.startTime=Date.now(),this.sensor.addEventListener("add-data-item",t=>{let{item:e}=t;this.getPositionBySensorItem(e,!this._pause)})}pause(){this._pause=!0}continue(){this._pause=!1}getPositionBySensorItem(t,e){e===void 0&&(e=!0);let[n,i,o]=this.pdr.pfFusionPDRiBeacon(t);return n&&e&&this.dispatchEvent({type:"position",x:i,y:o,_type:t.type===N.GPS?"gps":"pdr"}),[n,i,o]}setBeaconPosition(t,e){let[n,i]=this.pdr.setBeaconPosition(t,e);this.dispatchEvent({type:"position",x:n,y:i,_type:"beacon"})}dispose(){this.sensor.stop()}constructor(t={}){super(),this._pause=!1,this.sensor=new ga(t.sensor),this.pdr=new ja(t.pdr||{})}};var Dtt=d(v(),1),Xtt=d(Z(),1);var jtt=d(v(),1),Att=d(Z(),1);import{Mesh as gR,Object3D as yR,TextureLoader as MR,Color as PR,Vector2 as Dc,Vector3 as jR,NormalBlending as AR,RepeatWrapping as TR}from"three";var F1={texture_url:_s,lineWidth:8,color:16777215},Aa=class extends yR{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,c]=a;return W(new jR(u,l,c),e,n,i)}).map(a=>{let{x:u,y:l}=a;return[u,l]});return xt(o)/32}changeRepeat(){if(!this.material)return;let t=this.getRepeat();this.material.repeat=new Dc(t,1)}loadTexture(t){return new Promise((e,n)=>{new MR().load(t,e,void 0,n)})}transformPoints(t){let e=[];for(let n=0;n<t.length;n++)e.push(...t[n]);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 j(this,null,function*(){let e=this.geometry=new ht;if(this.updatePoints(t),!this.texture){let o=this.texture=yield this.loadTexture(this.config.texture_url);o.wrapS=o.wrapT=TR}let n=this.material=new Yn({useMap:!0,color:new PR(this.config.color),transparent:!0,resolution:new Dc(this.navigation.bmap.context.clientSize.width,this.navigation.bmap.context.clientSize.height),depthTest:!0,sizeAttenuation:!1,lineWidth:this.config.lineWidth*2,map:this.texture,blending:AR,repeat:new Dc(this.getRepeat(),1)}),i=this.mesh=new gR(e,n);return i.renderOrder=9,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=F1,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({},F1,e),this.registryEvent(),this.prevCameraZoom=this.navigation.bmap.context.camera.zoom}};import{Tween as vR}from"@tweenjs/tween.js";import{AnimationMixer as wR,Box3 as SR,Object3D as z1,Box2 as bR,Vector3 as Ta,Vector2 as Zi}from"three";var wa=class extends z1{getBaseScale(t){let{clientSize:{width:e,height:n},camera:i}=this.bmap.context,o=new SR().setFromObject(t),{max:s,min:a}=o,u=new Ta(a.x,s.y,s.z),l=new Ta(s.x,s.y,s.z),c=new Ta(s.x,a.y,a.z),h=new Ta(a.x,a.y,a.z),p=W(u,i,e,n),m=W(l,i,e,n),g=W(h,i,e,n),M=W(c,i,e,n),A=new bR().setFromPoints([new Zi(p.x,p.y),new Zi(m.x,m.y),new Zi(g.x,g.y),new Zi(M.x,M.y)]).getSize(new Zi),S=40/A.x,_=40/A.y,I=Math.min(S,_),x=i.zoom;return I*x}registryEvent(){this.bmap.context.addEventListener("update",this._update),this.bmap.context.addEventListener("control-zoom-change",this._onChangeZoom)}unRegistryEvent(){this.bmap.context.removeEventListener("update",this._update),this.bmap.context.removeEventListener("control-zoom-change",this._onChangeZoom)}printGraph(t){console.group(" <"+t.type+"> "+t.name),t.children.forEach(e=>this.printGraph(e)),console.groupEnd()}setClips(t){this.clearClips(),t.length&&(this.mixer=new wR(this.model.scene),t.forEach(e=>this.mixer.clipAction(e).play()))}startClips(){var t;this.setClips(((t=this.model)==null?void 0:t.animations)||[])}clearClips(){this.mixer&&(this.mixer.stopAllAction(),this.mixer.uncacheRoot(this.mixer.getRoot()),this.mixer=null)}dispose(){this.unRegistryEvent(),this.clearClips(),this.clear(),this.model&&L(this.model.scene),this.bmap=null}constructor(t,e){super(),this.bmap=t,this.group=new z1,this.mixer=null,this.previewTime=0,this.basicScale=1,this._update=()=>{let n=Date.now();if(!this.previewTime)this.previewTime=n;else{var i;let o=n-this.previewTime;this.previewTime=n,(i=this.mixer)==null||i.update(o/1e3)}},this._onChangeZoom=n=>{let{zoom:i}=n;var o;let s=this.basicScale/i;(o=this.model)==null||o.scene.scale.set(s,s,s)},this.add(this.group),mt.loadModel(e,!1).then(n=>{this.model=n;let i=this.getBaseScale(n.scene);this.basicScale=i;let o=this.bmap.context.camera.zoom;n.scene.scale.set(i/o,i/o,i/o),this.group.add(n.scene),this.setClips(n.animations),this.group.rotation.set(Math.PI/2,Math.PI,0),this.dispatchEvent({type:"loaded"})}),this.registryEvent()}};import{Vector3 as Sa}from"three";import{isNil as _R}from"lodash";var N1=class extends gt{registryEvent(){this.bmap.context.addEventListener("update",this.onUpdate)}pauseAnimation(){this.tweenUtil.pause()}continueAnimation(){this.tweenUtil.continue()}clearTween(){this.tweenUtil.clear(),this.bmap.context.control.enabled=!0}unRegistryEvent(){this.bmap.context.removeEventListener("update",this.onUpdate)}clearPath(){this.path&&(this.bmap.context.scene.remove(this.path),this.path.dispose(),this.path=null,this.movedDistance=0,this.clearTween()),this.startModel&&(this.startModel.visible=!1),this.translatePath=null}addPath(t){this.paths=t;let e=t.map(n=>T({},n,{points:this.translatePoints(n.points)}));if(this.clearTween(),this.movedDistance=0,this.bmap.currentBuildGround)this.renderPath(e);else{let n=()=>{this.bmap.removeEventListener("center-change",n),this.renderPath(e)};this.bmap.addEventListener("center-change",n)}this.dispatchEvent({type:"add-path",paths:t})}translatePoints(t){let[e,n]=this.bmap.buildingCenter;return t.map(i=>[i[0]-e,i[1]-n])}renderPath(t){if(!t.length)return this.clearPath();let e=[];t.forEach((n,i,o)=>{let s=this.catmullRomCurve3(n.points),a=this.mulFloor.floors.find(u=>u.name===n.floor);if(e.push(...s.map(u=>{let[l,c]=u;return[l,c,a.position.z+a.groundMaxHeight]})),i!==o.length-1){let u=this.mulFloor.floors.find(l=>l.name===o[i+1].floor);e.push([...o[i+1].points[0],u.position.z])}}),this.cPath=e,this.animationPathOptions={cPathIndex:0},this.path?this.path.updatePoints(e):(this.path=new Aa(this),this.path.create(e),this.path.position.z=.5,this.bmap.context.scene.add(this.path)),this.startModel&&(this.startModel.position.set(e[0][0],e[0][1],e[0][2]),this.startModel.visible=!0),this.dispatchEvent({type:"render-path",path:this.path})}catmullRomCurve3(t){return Oo(t,!1,!0,.1,170,2.5)}getPathDirection(t,e){if(t.length<2)return null;let n=_e(t,e),i=t[n],o=t[n+1],s=new Sa(o[0]-i[0],o[1]-i[1],0).normalize(),a=new Sa(0,1,0).normalize(),u=s.angleTo(a),l=new Sa().crossVectors(a,s);return(Object.is(l.y,0)?-1:1)*u}startSimulation(t){return j(this,null,function*(){t===void 0&&(t=1);let{paths:e,movedDistance:n}=this;if(!e.length)return;let i=e.reduce((s,a)=>s+a.distance,0);if(!i||n>=i)return;this.simulationTween&&this.tweenUtil.remove(this.simulationTween);let o=i/t;return this.startModel.startClips(),new Promise(s=>{let a=this.simulationTween=new vR({distance:this.movedDistance},this.tweenUtil.group).to({distance:i},o*1e3).onUpdate(u=>{var l;this.movedDistance=u.distance;let c=u.distance,h=0;for(let A=0;A<e.length;A++)if(e[A].distance>=c){h=A;break}else c-=e[A].distance;let p=Qn(e[h].points,c);if(p===null)return;this.currentPathPosition=p;let m=this.translatePoints([p])[0],g=this.mulFloor.floors.find(A=>A.name===e[h].floor),M=g?g.position.z+g.groundMaxHeight:(l=this.startModel)==null?void 0:l.position.z;this.startModel&&this.startModel.position.set(m[0],m[1],M);let P=this.getPathDirection(e[h].points,p);_R(P)||this.startModel.setRotationFromAxisAngle(new Sa(0,0,1),P)}).onComplete(()=>{this.tweenUtil.remove(a),this.startModel.clearClips(),s(!0)}).start()})})}setStartPoiRotate(t){if(this.startPoi){let n=(this.bmap.context.control.getAzimuthalAngle()*180/Math.PI+360)%360;this.startPoi.options.icon_rotate=(360-t-n)%360}}dispose(){this.path&&(this.bmap.context.scene.remove(this.path),this.path.dispose()),this.startModel&&(this.bmap.context.scene.remove(this.startModel),this.startModel.dispose()),this.tweenUtil.dispose(),this.unRegistryEvent(),super.dispose()}constructor(t,e){super(t),this.mulFloor=e,this.path=null,this.fetchRoadStatus=!1,this.paths=[],this.curFloorPath=null,this.translatePath=null,this.currentPathPosition=null,this.pathTween=null,this.startPoi=null,this.movedDistance=0,this.tweenUtil=new en,this.animationPathOptions={cPathIndex:0},this.cPath=[],this.onUpdate=()=>{this.tweenUtil.update()},this.startModel=new wa(t,IA),this.startModel.visible=!1,this.bmap.context.scene.add(this.startModel),this.registryEvent()}};import{Raycaster as WR,Vector2 as xR}from"three";var U1=class extends gt{registryEvent(){this.clickHelper.addEventListener("click",this._click)}unRegistryEvent(){this.clickHelper.removeEventListener("click",this._click)}dispose(){this.unRegistryEvent(),this.clickHelper.dispose(),this.mulFloors=null,super.dispose()}constructor(t,e){super(t),this.mulFloors=e,this._click=n=>{let{e:i}=n;if(!this.mulFloors.showStatus)return;let o=new xR,{offsetX:s,offsetY:a}=i,{clientSize:u}=this.bmap.context;o.x=s/u.width*2-1,o.y=a/u.height*-2+1;let l=new WR;l.setFromCamera(o,this.bmap.context.camera),l.ray.origin.sub(l.ray.direction.clone().multiplyScalar(1e4));let h=this.mulFloors.poiLayer.pois.map(m=>{if(!m.canSelect)return null;let g=l.intersectObjects(m.children,!0);return g.length?g[0]:null}).reduce((m,g)=>g&&(!m||g.distance<m.distance)?g:m,null),p=h==null?void 0:h.object;h&&h.object.isSprite&&(p=h.object.parent),p&&p instanceof $&&this.dispatchEvent({type:"select",pois:[p]})},this.clickHelper=new Ro(this.bmap.context.container),this.registryEvent()}};var fet=d(G1(),1),det=d(k1(),1),met=d(Z(),1);import{EventDispatcher as KR}from"three";var eet=d(v(),1),net=d(Z(),1),ret=d(Co(),1);import{Vector2 as Ci}from"three";function CR(r){let t=r.length,e=0,n=0,i=0,o=0;r.forEach(u=>{e+=u[0],n+=u[1],i+=u[0]*u[1],o+=u[0]*u[0]});let s=(t*i-e*n)/(t*o-e*e),a=(n-s*e)/t;return{m:s,b:a}}function OR(r,t,e){let n=e[0][0],i=e.slice(-1)[0][0],o=r*n+t,s=r*i+t;return{start:[n,o],end:[i,s]}}function ba(r){if(r.length<2)return null;let t=r.filter((u,l)=>{let c=[...r];return c.splice(l,1),c.every(h=>h[0]!==u[0]&&h[1]!==u[1])});if(t.length<2)return null;let{m:e,b:n}=CR(t),{start:i,end:o}=OR(e,n,t),a=360-(new Ci().subVectors(new Ci(o[0],o[1]),new Ci(i[0],i[1])).angle()/Math.PI*180-90+360)%360;return Number.isNaN(a)?null:a}function set(r){let t=[];for(let e=1;e<r.length;e++){let n=r[e-1],i=r[e],o=i.position[0]-n.position[0],s=i.position[1]-n.position[1],a=Math.sqrt(o**2+s**2),u=i.time-n.time;if(u>0){let l=a/u;console.log("speedDelta",n.type,i.type,Xc(l),a,u),t.push(l)}else t.push(0)}return t}function aet(r,t){let e=r[0],n=r.slice(-1)[0],i=K(n.position,e.position),o=n.time-e.time;return o<100||i<3?null:i/o}function Xc(r){return r*60*60}function Oi(r,t,e,n){let i=(e+90)%360*(Math.PI/180),o=t*n,s=new Ci(r[0],r[1]),a=Math.cos(i),u=Math.sin(i),l=new Ci(a,u);return s.add(l.normalize().multiplyScalar(o)),[s.x,s.y]}function uet(r){let t=[...r].sort((l,c)=>l-c),e=V1(t,25),n=V1(t,75),i=n-e,o=e-1.5*i,s=n+1.5*i,a=t.filter(l=>l>=o&&l<=s);return r.filter(l=>a.includes(l))}function V1(r,t){let e=t/100*(r.length-1),n=Math.floor(e),i=Math.ceil(e);if(n===i)return r[n];let o=e-n;return r[n]*(1-o)+r[i]*o}var va=class{filter(t){let e=this.estimate,n=this.errorEstimate+this.processNoise,i=n/(n+this.measurementNoise);return this.estimate=e+i*(t-e),this.errorEstimate=(1-i)*n,this.estimate}constructor(t={}){this.estimate=0,this.errorEstimate=1,this.processNoise=.1,this.measurementNoise=1,this.measurementNoise=t.measurementNoise||1,this.processNoise=t.processNoise||.1,this.errorEstimate=t.errorEstimate||1}};import{isNil as _a}from"lodash";var J1=class extends KR{setPathAngle(t){this.pathAngle=t,this.dispatchEvent({type:"change-compass",value:this.pathAngle}),_a(this.angle)&&(this.angle=t)}changeSpeed(){let t=this.history.filter(u=>["vision"].includes(u.type));if(t.length<2){this.speedFilter.filter(0),this.speed=0;return}let e=t[0],n=t.slice(-1)[0],i=K(n.position,e.position),o=n.time-e.time,s=o>0?i/o:0,a=this.speedFilter.filter(s);this.speed=a}changeAngle(t){t===void 0&&(t=this.visionHistory),t.length<2&&(this.angle=null);let e=ba(t.map(n=>n.position));e!==null&&this.setAngle(e)}setAngle(t,e){e===void 0&&(e=!0),this.angle=t,e&&this.dispatchEvent({type:"change-position-compass",value:t})}setPosition(t,e,n){let i={position:t,time:e,clientTime:Date.now()-n,type:"vision"};if(this._setVisionHistoryForAngle(i),_a(this.angle)||!this.speed){this.addHistory(i);return}let o=this.history.findLastIndex(a=>a.type==="vision"),s=this.history[o];if(s){if(s.time>e)return;let a=ba([this.history.slice(-1)[0].position,t]);if(a&&Math.abs(a-this.angle)<60){this.addHistory(i);return}let u=Oi(t,this.speed,360-this.pathAngle,n);K(u,this.history.slice(-1)[0].position)>5?this.visionExcessesCount++:this.visionExcessesCount=0,this.visionExcessesCount>3&&(console.warn("\u8FDE\u7EED\u4E09\u6B21\u89C6\u89C9\u548Cpdr\u5DEE\u8DDD\u5927\u4E8E5\u7C73\uFF0C\u4F7F\u7528\u89C6\u89C9\u6821\u51C6"),this.addHistory(i),this.visionExcessesCount=0)}}resetPdrPosition(){let t=this.history.findLast(e=>e.type==="vision");if(t&&this.speed){let e=Oi(t.position,this.speed,360-this.pathAngle,Date.now()-t.clientTime);e&&this.history.push({position:e,time:Date.now(),clientTime:Date.now(),type:"pdr"})}}getLastVisionPdrPos(){let t=this.history.findLastIndex(n=>n.type==="vision");if(t!==-1){var e;return(e=this.history[t+1])!=null?e:this.history[t]}return null}_setVisionHistoryForAngle(t){if(!this.visionHistory.length){this.visionHistory.push(t);return}let e=ba([this.visionHistory.slice(-1)[0].position,t.position]);if(e!==null&&(this.angle&&Math.abs(this.angle-e)>60?this.angleExcessesCount++:(this.angleExcessesCount=0,this.visionHistory.push(t))),this.angleExcessesCount>3)console.warn("\u8FDE\u7EED\u4E09\u6B21\u89D2\u5EA6\u6BD4\u8F83\u6B6A\uFF0C\u91CD\u65B0\u77EB\u6B63"),this.visionHistory=[t],this.angleExcessesCount=0;else{let n=K(this.visionHistory[0].position,this.visionHistory.slice(-1)[0].position);for(;n>5&&this.visionHistory.length>15;)this.visionHistory.shift(),n=K(this.visionHistory[0].position,this.visionHistory.slice(-1)[0].position)}this.changeAngle()}addHistory(t){this.history.push(t);let e=this.history.filter(a=>a.type==="vision"),n=e.length?Date.now()-e.slice(-1)[0].clientTime:0,i=K(this.history[0].position,this.history.slice(-1)[0].position),o=n>5e3?10:3,s=n>5e3?0:5;for(n>5e3&&console.warn("\u89C6\u89C9\u7ED3\u679C\u8D85\u51FA5s\u4E0D\u53EF\u7528\uFF0C\u5168\u90E8\u6E05\u7A7A");e.length>s&&i>o;)this.history.shift(),e=this.history.filter(a=>a.type==="vision"),i=K(this.history[0].position,this.history.slice(-1)[0].position);s===0?this.changeSpeed():t.type==="vision"&&this.changeSpeed(),this.changePosition(t.type)}setBeaconPosition(t,e,n){let i=Date.now()-n,o={position:t,time:e,clientTime:i,type:"beacon"},s=this.history.findLastIndex(c=>c.type!=="pdr"),a=this.history[s];if(!a){this.addHistory(o);return}if(_a(this.pathAngle)||!this.speed){this.addHistory(o);return}if(a&&a.time>e)return;let u=Oi(t,this.speed,360-this.pathAngle,n);K(u,this.history.slice(-1)[0].position)>5?this.beaconExcessesCount++:this.beaconExcessesCount=0,this.beaconExcessesCount>3&&(console.warn("\u8FDE\u7EED\u4E09\u6B21beacon\u548Cpdr\u5DEE\u8DDD\u5927\u4E8E5\u7C73\uFF0C\u4F7F\u7528beacon\u6821\u51C6"),this.addHistory(o),this.beaconExcessesCount=0)}startPositionTimer(){this.positionTimer&&this.timer.clearInterval(this.positionTimer),this.positionTimer=this.timer.setInterval(()=>{this.changePosition()},20)}stopPositionTimer(){this.positionTimer&&(this.timer.clearInterval(this.positionTimer),this.positionTimer=null)}changePosition(t){t===void 0&&(t="pdr");let e=this.getPosition(t);e.success&&(this.history.push({position:e.pos,time:Date.now(),clientTime:Date.now(),type:"pdr"}),this.speed?this.dispatchEvent({type:"change-pos",value:T({},e)}):this.dispatchEvent({type:"change-pos",value:e}))}getPosition(t){if(this.history.length===0)return{success:!1,pos:[0,0],compass:null,speed:0};let e=this.history.slice(-1)[0];if(this.history.length<2)return{success:!0,pos:e.position,compass:this.pathAngle,speed:this.speed};if(_a(this.pathAngle)||!this.speed)return{success:!0,pos:e.position,compass:this.pathAngle,speed:this.speed};let n=e.clientTime,i=Date.now()-n;return{success:!0,pos:this.pathAngle?Oi(e.position,this.speed,360-this.pathAngle,i):e.position,compass:this.pathAngle,speed:Xc(this.speed)}}dispose(){this.timer.dispose()}constructor(){super(),this.history=[],this.visionHistory=[],this.speed=0,this.angle=null,this.timer=new H,this.positionTimer=null,this.speedFilter=new va,this.visionExcessesCount=0,this.beaconExcessesCount=0,this.angleExcessesCount=0,this.pathAngle=0,this.startPositionTimer()}};var bet=d(Vr(),1);function Zc(){let r=new Blob([`var mF=Object.create;var Zx=Object.defineProperty;var yF=Object.getOwnPropertyDescriptor;var vF=Object.getOwnPropertyNames;var _F=Object.getPrototypeOf,xF=Object.prototype.hasOwnProperty;var lt=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports);var EF=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of vF(t))!xF.call(n,s)&&s!==e&&Zx(n,s,{get:()=>t[s],enumerable:!(o=yF(t,s))||o.enumerable});return n};var on=(n,t,e)=>(e=n!=null?mF(_F(n)):{},EF(t||!n||!n.__esModule?Zx(e,"default",{value:n,enumerable:!0}):e,n));var ec=(n,t,e)=>new Promise((o,s)=>{var c=g=>{try{p(e.next(g))}catch(m){s(m)}},h=g=>{try{p(e.throw(g))}catch(m){s(m)}},p=g=>g.done?o(g.value):Promise.resolve(g.value).then(c,h);p((e=e.apply(n,t)).next())});var oo=lt((Im,Jx)=>{"use strict";var Rf=function(n){return n&&n.Math===Math&&n};Jx.exports=Rf(typeof globalThis=="object"&&globalThis)||Rf(typeof window=="object"&&window)||Rf(typeof self=="object"&&self)||Rf(typeof global=="object"&&global)||Rf(typeof Im=="object"&&Im)||function(){return this}()||Function("return this")()});var gi=lt((bJ,Kx)=>{"use strict";Kx.exports=function(n){try{return!!n()}catch(t){return!0}}});var Xs=lt((AJ,jx)=>{"use strict";var wF=gi();jx.exports=!wF(function(){return Object.defineProperty({},1,{get:function(){return 7}})[1]!==7})});var Lf=lt((TJ,Qx)=>{"use strict";var SF=gi();Qx.exports=!SF(function(){var n=function(){}.bind();return typeof n!="function"||n.hasOwnProperty("prototype")})});var Is=lt((CJ,tE)=>{"use strict";var MF=Lf(),rp=Function.prototype.call;tE.exports=MF?rp.bind(rp):function(){return rp.apply(rp,arguments)}});var iE=lt(rE=>{"use strict";var eE={}.propertyIsEnumerable,nE=Object.getOwnPropertyDescriptor,bF=nE&&!eE.call({1:2},1);rE.f=bF?function(t){var e=nE(this,t);return!!e&&e.enumerable}:eE});var ip=lt((IJ,oE)=>{"use strict";oE.exports=function(n,t){return{enumerable:!(n&1),configurable:!(n&2),writable:!(n&4),value:t}}});var mi=lt((RJ,uE)=>{"use strict";var sE=Lf(),aE=Function.prototype,Rm=aE.call,AF=sE&&aE.bind.bind(Rm,Rm);uE.exports=sE?AF:function(n){return function(){return Rm.apply(n,arguments)}}});var nc=lt((LJ,cE)=>{"use strict";var lE=mi(),TF=lE({}.toString),CF=lE("".slice);cE.exports=function(n){return CF(TF(n),8,-1)}});var hE=lt((NJ,fE)=>{"use strict";var PF=mi(),IF=gi(),RF=nc(),Lm=Object,LF=PF("".split);fE.exports=IF(function(){return!Lm("z").propertyIsEnumerable(0)})?function(n){return RF(n)==="String"?LF(n,""):Lm(n)}:Lm});var op=lt((OJ,pE)=>{"use strict";pE.exports=function(n){return n==null}});var rc=lt((DJ,dE)=>{"use strict";var NF=op(),OF=TypeError;dE.exports=function(n){if(NF(n))throw new OF("Can't call method on "+n);return n}});var ic=lt((FJ,gE)=>{"use strict";var DF=hE(),FF=rc();gE.exports=function(n){return DF(FF(n))}});var Di=lt((UJ,mE)=>{"use strict";var Nm=typeof document=="object"&&document.all;mE.exports=typeof Nm=="undefined"&&Nm!==void 0?function(n){return typeof n=="function"||n===Nm}:function(n){return typeof n=="function"}});var wa=lt((BJ,yE)=>{"use strict";var UF=Di();yE.exports=function(n){return typeof n=="object"?n!==null:UF(n)}});var oc=lt((zJ,vE)=>{"use strict";var Om=oo(),BF=Di(),zF=function(n){return BF(n)?n:void 0};vE.exports=function(n,t){return arguments.length<2?zF(Om[n]):Om[n]&&Om[n][t]}});var xE=lt((GJ,_E)=>{"use strict";var GF=mi();_E.exports=GF({}.isPrototypeOf)});var ME=lt((kJ,SE)=>{"use strict";var kF=oo(),EE=kF.navigator,wE=EE&&EE.userAgent;SE.exports=wE?String(wE):""});var RE=lt((qJ,IE)=>{"use strict";var PE=oo(),Dm=ME(),bE=PE.process,AE=PE.Deno,TE=bE&&bE.versions||AE&&AE.version,CE=TE&&TE.v8,Ys,sp;CE&&(Ys=CE.split("."),sp=Ys[0]>0&&Ys[0]<4?1:+(Ys[0]+Ys[1]));!sp&&Dm&&(Ys=Dm.match(/Edge\\/(\\d+)/),(!Ys||Ys[1]>=74)&&(Ys=Dm.match(/Chrome\\/(\\d+)/),Ys&&(sp=+Ys[1])));IE.exports=sp});var Fm=lt((HJ,NE)=>{"use strict";var LE=RE(),qF=gi(),HF=oo(),VF=HF.String;NE.exports=!!Object.getOwnPropertySymbols&&!qF(function(){var n=Symbol("symbol detection");return!VF(n)||!(Object(n)instanceof Symbol)||!Symbol.sham&&LE&&LE<41})});var Um=lt((VJ,OE)=>{"use strict";var WF=Fm();OE.exports=WF&&!Symbol.sham&&typeof Symbol.iterator=="symbol"});var Bm=lt((WJ,DE)=>{"use strict";var XF=oc(),YF=Di(),$F=xE(),ZF=Um(),JF=Object;DE.exports=ZF?function(n){return typeof n=="symbol"}:function(n){var t=XF("Symbol");return YF(t)&&$F(t.prototype,JF(n))}});var UE=lt((XJ,FE)=>{"use strict";var KF=String;FE.exports=function(n){try{return KF(n)}catch(t){return"Object"}}});var Nf=lt((YJ,BE)=>{"use strict";var jF=Di(),QF=UE(),tU=TypeError;BE.exports=function(n){if(jF(n))return n;throw new tU(QF(n)+" is not a function")}});var ap=lt(($J,zE)=>{"use strict";var eU=Nf(),nU=op();zE.exports=function(n,t){var e=n[t];return nU(e)?void 0:eU(e)}});var kE=lt((ZJ,GE)=>{"use strict";var zm=Is(),Gm=Di(),km=wa(),rU=TypeError;GE.exports=function(n,t){var e,o;if(t==="string"&&Gm(e=n.toString)&&!km(o=zm(e,n))||Gm(e=n.valueOf)&&!km(o=zm(e,n))||t!=="string"&&Gm(e=n.toString)&&!km(o=zm(e,n)))return o;throw new rU("Can't convert object to primitive value")}});var Of=lt((JJ,qE)=>{"use strict";qE.exports=!1});var up=lt((KJ,VE)=>{"use strict";var HE=oo(),iU=Object.defineProperty;VE.exports=function(n,t){try{iU(HE,n,{value:t,configurable:!0,writable:!0})}catch(e){HE[n]=t}return t}});var lp=lt((jJ,YE)=>{"use strict";var oU=Of(),sU=oo(),aU=up(),WE="__core-js_shared__",XE=YE.exports=sU[WE]||aU(WE,{});(XE.versions||(XE.versions=[])).push({version:"3.39.0",mode:oU?"pure":"global",copyright:"\\xA9 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.39.0/LICENSE",source:"https://github.com/zloirock/core-js"})});var cp=lt((QJ,ZE)=>{"use strict";var $E=lp();ZE.exports=function(n,t){return $E[n]||($E[n]=t||{})}});var sc=lt((tK,JE)=>{"use strict";var uU=rc(),lU=Object;JE.exports=function(n){return lU(uU(n))}});var Sa=lt((eK,KE)=>{"use strict";var cU=mi(),fU=sc(),hU=cU({}.hasOwnProperty);KE.exports=Object.hasOwn||function(t,e){return hU(fU(t),e)}});var qm=lt((nK,jE)=>{"use strict";var pU=mi(),dU=0,gU=Math.random(),mU=pU(1 .toString);jE.exports=function(n){return"Symbol("+(n===void 0?"":n)+")_"+mU(++dU+gU,36)}});var Rs=lt((rK,tw)=>{"use strict";var yU=oo(),vU=cp(),QE=Sa(),_U=qm(),xU=Fm(),EU=Um(),ac=yU.Symbol,Hm=vU("wks"),wU=EU?ac.for||ac:ac&&ac.withoutSetter||_U;tw.exports=function(n){return QE(Hm,n)||(Hm[n]=xU&&QE(ac,n)?ac[n]:wU("Symbol."+n)),Hm[n]}});var iw=lt((iK,rw)=>{"use strict";var SU=Is(),ew=wa(),nw=Bm(),MU=ap(),bU=kE(),AU=Rs(),TU=TypeError,CU=AU("toPrimitive");rw.exports=function(n,t){if(!ew(n)||nw(n))return n;var e=MU(n,CU),o;if(e){if(t===void 0&&(t="default"),o=SU(e,n,t),!ew(o)||nw(o))return o;throw new TU("Can't convert object to primitive value")}return t===void 0&&(t="number"),bU(n,t)}});var Vm=lt((oK,ow)=>{"use strict";var PU=iw(),IU=Bm();ow.exports=function(n){var t=PU(n,"string");return IU(t)?t:t+""}});var fp=lt((sK,aw)=>{"use strict";var RU=oo(),sw=wa(),Wm=RU.document,LU=sw(Wm)&&sw(Wm.createElement);aw.exports=function(n){return LU?Wm.createElement(n):{}}});var Xm=lt((aK,uw)=>{"use strict";var NU=Xs(),OU=gi(),DU=fp();uw.exports=!NU&&!OU(function(){return Object.defineProperty(DU("div"),"a",{get:function(){return 7}}).a!==7})});var Ym=lt(cw=>{"use strict";var FU=Xs(),UU=Is(),BU=iE(),zU=ip(),GU=ic(),kU=Vm(),qU=Sa(),HU=Xm(),lw=Object.getOwnPropertyDescriptor;cw.f=FU?lw:function(t,e){if(t=GU(t),e=kU(e),HU)try{return lw(t,e)}catch(o){}if(qU(t,e))return zU(!UU(BU.f,t,e),t[e])}});var $m=lt((lK,fw)=>{"use strict";var VU=Xs(),WU=gi();fw.exports=VU&&WU(function(){return Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype!==42})});var Ma=lt((cK,hw)=>{"use strict";var XU=wa(),YU=String,$U=TypeError;hw.exports=function(n){if(XU(n))return n;throw new $U(YU(n)+" is not an object")}});var Pu=lt(dw=>{"use strict";var ZU=Xs(),JU=Xm(),KU=$m(),hp=Ma(),pw=Vm(),jU=TypeError,Zm=Object.defineProperty,QU=Object.getOwnPropertyDescriptor,Jm="enumerable",Km="configurable",jm="writable";dw.f=ZU?KU?function(t,e,o){if(hp(t),e=pw(e),hp(o),typeof t=="function"&&e==="prototype"&&"value"in o&&jm in o&&!o[jm]){var s=QU(t,e);s&&s[jm]&&(t[e]=o.value,o={configurable:Km in o?o[Km]:s[Km],enumerable:Jm in o?o[Jm]:s[Jm],writable:!1})}return Zm(t,e,o)}:Zm:function(t,e,o){if(hp(t),e=pw(e),hp(o),JU)try{return Zm(t,e,o)}catch(s){}if("get"in o||"set"in o)throw new jU("Accessors not supported");return"value"in o&&(t[e]=o.value),t}});var uc=lt((hK,gw)=>{"use strict";var tB=Xs(),eB=Pu(),nB=ip();gw.exports=tB?function(n,t,e){return eB.f(n,t,nB(1,e))}:function(n,t,e){return n[t]=e,n}});var e0=lt((pK,yw)=>{"use strict";var Qm=Xs(),rB=Sa(),mw=Function.prototype,iB=Qm&&Object.getOwnPropertyDescriptor,t0=rB(mw,"name"),oB=t0&&function(){}.name==="something",sB=t0&&(!Qm||Qm&&iB(mw,"name").configurable);yw.exports={EXISTS:t0,PROPER:oB,CONFIGURABLE:sB}});var r0=lt((dK,vw)=>{"use strict";var aB=mi(),uB=Di(),n0=lp(),lB=aB(Function.toString);uB(n0.inspectSource)||(n0.inspectSource=function(n){return lB(n)});vw.exports=n0.inspectSource});var Ew=lt((gK,xw)=>{"use strict";var cB=oo(),fB=Di(),_w=cB.WeakMap;xw.exports=fB(_w)&&/native code/.test(String(_w))});var pp=lt((mK,Sw)=>{"use strict";var hB=cp(),pB=qm(),ww=hB("keys");Sw.exports=function(n){return ww[n]||(ww[n]=pB(n))}});var dp=lt((yK,Mw)=>{"use strict";Mw.exports={}});var yp=lt((vK,Tw)=>{"use strict";var dB=Ew(),Aw=oo(),gB=wa(),mB=uc(),i0=Sa(),o0=lp(),yB=pp(),vB=dp(),bw="Object already initialized",s0=Aw.TypeError,_B=Aw.WeakMap,gp,Df,mp,xB=function(n){return mp(n)?Df(n):gp(n,{})},EB=function(n){return function(t){var e;if(!gB(t)||(e=Df(t)).type!==n)throw new s0("Incompatible receiver, "+n+" required");return e}};dB||o0.state?($s=o0.state||(o0.state=new _B),$s.get=$s.get,$s.has=$s.has,$s.set=$s.set,gp=function(n,t){if($s.has(n))throw new s0(bw);return t.facade=n,$s.set(n,t),t},Df=function(n){return $s.get(n)||{}},mp=function(n){return $s.has(n)}):(ml=yB("state"),vB[ml]=!0,gp=function(n,t){if(i0(n,ml))throw new s0(bw);return t.facade=n,mB(n,ml,t),t},Df=function(n){return i0(n,ml)?n[ml]:{}},mp=function(n){return i0(n,ml)});var $s,ml;Tw.exports={set:gp,get:Df,has:mp,enforce:xB,getterFor:EB}});var Rw=lt((_K,Iw)=>{"use strict";var u0=mi(),wB=gi(),SB=Di(),vp=Sa(),a0=Xs(),MB=e0().CONFIGURABLE,bB=r0(),Pw=yp(),AB=Pw.enforce,TB=Pw.get,Cw=String,_p=Object.defineProperty,CB=u0("".slice),PB=u0("".replace),IB=u0([].join),RB=a0&&!wB(function(){return _p(function(){},"length",{value:8}).length!==8}),LB=String(String).split("String"),NB=Iw.exports=function(n,t,e){CB(Cw(t),0,7)==="Symbol("&&(t="["+PB(Cw(t),/^Symbol\\(([^)]*)\\).*$/,"$1")+"]"),e&&e.getter&&(t="get "+t),e&&e.setter&&(t="set "+t),(!vp(n,"name")||MB&&n.name!==t)&&(a0?_p(n,"name",{value:t,configurable:!0}):n.name=t),RB&&e&&vp(e,"arity")&&n.length!==e.arity&&_p(n,"length",{value:e.arity});try{e&&vp(e,"constructor")&&e.constructor?a0&&_p(n,"prototype",{writable:!1}):n.prototype&&(n.prototype=void 0)}catch(s){}var o=AB(n);return vp(o,"source")||(o.source=IB(LB,typeof t=="string"?t:"")),n};Function.prototype.toString=NB(function(){return SB(this)&&TB(this).source||bB(this)},"toString")});var Ff=lt((xK,Lw)=>{"use strict";var OB=Di(),DB=Pu(),FB=Rw(),UB=up();Lw.exports=function(n,t,e,o){o||(o={});var s=o.enumerable,c=o.name!==void 0?o.name:t;if(OB(e)&&FB(e,c,o),o.global)s?n[t]=e:UB(t,e);else{try{o.unsafe?n[t]&&(s=!0):delete n[t]}catch(h){}s?n[t]=e:DB.f(n,t,{value:e,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return n}});var Ow=lt((EK,Nw)=>{"use strict";var BB=Math.ceil,zB=Math.floor;Nw.exports=Math.trunc||function(t){var e=+t;return(e>0?zB:BB)(e)}});var yl=lt((wK,Dw)=>{"use strict";var GB=Ow();Dw.exports=function(n){var t=+n;return t!==t||t===0?0:GB(t)}});var Uw=lt((SK,Fw)=>{"use strict";var kB=yl(),qB=Math.max,HB=Math.min;Fw.exports=function(n,t){var e=kB(n);return e<0?qB(e+t,0):HB(e,t)}});var l0=lt((MK,Bw)=>{"use strict";var VB=yl(),WB=Math.min;Bw.exports=function(n){var t=VB(n);return t>0?WB(t,9007199254740991):0}});var Uf=lt((bK,zw)=>{"use strict";var XB=l0();zw.exports=function(n){return XB(n.length)}});var qw=lt((AK,kw)=>{"use strict";var YB=ic(),$B=Uw(),ZB=Uf(),Gw=function(n){return function(t,e,o){var s=YB(t),c=ZB(s);if(c===0)return!n&&-1;var h=$B(o,c),p;if(n&&e!==e){for(;c>h;)if(p=s[h++],p!==p)return!0}else for(;c>h;h++)if((n||h in s)&&s[h]===e)return n||h||0;return!n&&-1}};kw.exports={includes:Gw(!0),indexOf:Gw(!1)}});var f0=lt((TK,Vw)=>{"use strict";var JB=mi(),c0=Sa(),KB=ic(),jB=qw().indexOf,QB=dp(),Hw=JB([].push);Vw.exports=function(n,t){var e=KB(n),o=0,s=[],c;for(c in e)!c0(QB,c)&&c0(e,c)&&Hw(s,c);for(;t.length>o;)c0(e,c=t[o++])&&(~jB(s,c)||Hw(s,c));return s}});var xp=lt((CK,Ww)=>{"use strict";Ww.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]});var Yw=lt(Xw=>{"use strict";var tz=f0(),ez=xp(),nz=ez.concat("length","prototype");Xw.f=Object.getOwnPropertyNames||function(t){return tz(t,nz)}});var Zw=lt($w=>{"use strict";$w.f=Object.getOwnPropertySymbols});var Kw=lt((RK,Jw)=>{"use strict";var rz=oc(),iz=mi(),oz=Yw(),sz=Zw(),az=Ma(),uz=iz([].concat);Jw.exports=rz("Reflect","ownKeys")||function(t){var e=oz.f(az(t)),o=sz.f;return o?uz(e,o(t)):e}});var tS=lt((LK,Qw)=>{"use strict";var jw=Sa(),lz=Kw(),cz=Ym(),fz=Pu();Qw.exports=function(n,t,e){for(var o=lz(t),s=fz.f,c=cz.f,h=0;h<o.length;h++){var p=o[h];!jw(n,p)&&!(e&&jw(e,p))&&s(n,p,c(t,p))}}});var nS=lt((NK,eS)=>{"use strict";var hz=gi(),pz=Di(),dz=/#|\\.prototype\\./,Bf=function(n,t){var e=mz[gz(n)];return e===vz?!0:e===yz?!1:pz(t)?hz(t):!!t},gz=Bf.normalize=function(n){return String(n).replace(dz,".").toLowerCase()},mz=Bf.data={},yz=Bf.NATIVE="N",vz=Bf.POLYFILL="P";eS.exports=Bf});var Ls=lt((OK,rS)=>{"use strict";var Ep=oo(),_z=Ym().f,xz=uc(),Ez=Ff(),wz=up(),Sz=tS(),Mz=nS();rS.exports=function(n,t){var e=n.target,o=n.global,s=n.stat,c,h,p,g,m,_;if(o?h=Ep:s?h=Ep[e]||wz(e,{}):h=Ep[e]&&Ep[e].prototype,h)for(p in t){if(m=t[p],n.dontCallGetSet?(_=_z(h,p),g=_&&_.value):g=h[p],c=Mz(o?p:e+(s?".":"#")+p,n.forced),!c&&g!==void 0){if(typeof m==typeof g)continue;Sz(m,g)}(n.sham||g&&g.sham)&&xz(m,"sham",!0),Ez(h,p,m,n)}}});var wp=lt((DK,iS)=>{"use strict";var bz=nc();iS.exports=Array.isArray||function(t){return bz(t)==="Array"}});var sS=lt((FK,oS)=>{"use strict";var Az=Xs(),Tz=wp(),Cz=TypeError,Pz=Object.getOwnPropertyDescriptor,Iz=Az&&!function(){if(this!==void 0)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(n){return n instanceof TypeError}}();oS.exports=Iz?function(n,t){if(Tz(n)&&!Pz(n,"length").writable)throw new Cz("Cannot set read only .length");return n.length=t}:function(n,t){return n.length=t}});var h0=lt((UK,aS)=>{"use strict";var Rz=TypeError,Lz=9007199254740991;aS.exports=function(n){if(n>Lz)throw Rz("Maximum allowed index exceeded");return n}});var p0=lt(()=>{"use strict";var Nz=Ls(),Oz=sc(),Dz=Uf(),Fz=sS(),Uz=h0(),Bz=gi(),zz=Bz(function(){return[].push.call({length:4294967296},1)!==4294967297}),Gz=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(n){return n instanceof TypeError}},kz=zz||!Gz();Nz({target:"Array",proto:!0,arity:1,forced:kz},{push:function(t){var e=Oz(this),o=Dz(e),s=arguments.length;Uz(o+s);for(var c=0;c<s;c++)e[o]=arguments[c],o++;return Fz(e,o),o}})});var lS=lt((kK,uS)=>{"use strict";uS.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 hS=lt((qK,fS)=>{"use strict";var qz=fp(),d0=qz("span").classList,cS=d0&&d0.constructor&&d0.constructor.prototype;fS.exports=cS===Object.prototype?void 0:cS});var dS=lt((HK,pS)=>{"use strict";var Hz=f0(),Vz=xp();pS.exports=Object.keys||function(t){return Hz(t,Vz)}});var mS=lt(gS=>{"use strict";var Wz=Xs(),Xz=$m(),Yz=Pu(),$z=Ma(),Zz=ic(),Jz=dS();gS.f=Wz&&!Xz?Object.defineProperties:function(t,e){$z(t);for(var o=Zz(e),s=Jz(e),c=s.length,h=0,p;c>h;)Yz.f(t,p=s[h++],o[p]);return t}});var vS=lt((WK,yS)=>{"use strict";var Kz=oc();yS.exports=Kz("document","documentElement")});var zf=lt((XK,bS)=>{"use strict";var jz=Ma(),Qz=mS(),_S=xp(),tG=dp(),eG=vS(),nG=fp(),rG=pp(),xS=">",ES="<",m0="prototype",y0="script",SS=rG("IE_PROTO"),g0=function(){},MS=function(n){return ES+y0+xS+n+ES+"/"+y0+xS},wS=function(n){n.write(MS("")),n.close();var t=n.parentWindow.Object;return n=null,t},iG=function(){var n=nG("iframe"),t="java"+y0+":",e;return n.style.display="none",eG.appendChild(n),n.src=String(t),e=n.contentWindow.document,e.open(),e.write(MS("document.F=Object")),e.close(),e.F},Sp,Mp=function(){try{Sp=new ActiveXObject("htmlfile")}catch(t){}Mp=typeof document!="undefined"?document.domain&&Sp?wS(Sp):iG():wS(Sp);for(var n=_S.length;n--;)delete Mp[m0][_S[n]];return Mp()};tG[SS]=!0;bS.exports=Object.create||function(t,e){var o;return t!==null?(g0[m0]=jz(t),o=new g0,g0[m0]=null,o[SS]=t):o=Mp(),e===void 0?o:Qz.f(o,e)}});var x0=lt((YK,AS)=>{"use strict";var oG=Rs(),sG=zf(),aG=Pu().f,v0=oG("unscopables"),_0=Array.prototype;_0[v0]===void 0&&aG(_0,v0,{configurable:!0,value:sG(null)});AS.exports=function(n){_0[v0][n]=!0}});var bp=lt(($K,TS)=>{"use strict";TS.exports={}});var PS=lt((ZK,CS)=>{"use strict";var uG=gi();CS.exports=!uG(function(){function n(){}return n.prototype.constructor=null,Object.getPrototypeOf(new n)!==n.prototype})});var w0=lt((JK,RS)=>{"use strict";var lG=Sa(),cG=Di(),fG=sc(),hG=pp(),pG=PS(),IS=hG("IE_PROTO"),E0=Object,dG=E0.prototype;RS.exports=pG?E0.getPrototypeOf:function(n){var t=fG(n);if(lG(t,IS))return t[IS];var e=t.constructor;return cG(e)&&t instanceof e?e.prototype:t instanceof E0?dG:null}});var A0=lt((KK,OS)=>{"use strict";var gG=gi(),mG=Di(),yG=wa(),vG=zf(),LS=w0(),_G=Ff(),xG=Rs(),EG=Of(),b0=xG("iterator"),NS=!1,tu,S0,M0;[].keys&&(M0=[].keys(),"next"in M0?(S0=LS(LS(M0)),S0!==Object.prototype&&(tu=S0)):NS=!0);var wG=!yG(tu)||gG(function(){var n={};return tu[b0].call(n)!==n});wG?tu={}:EG&&(tu=vG(tu));mG(tu[b0])||_G(tu,b0,function(){return this});OS.exports={IteratorPrototype:tu,BUGGY_SAFARI_ITERATORS:NS}});var Ap=lt((jK,FS)=>{"use strict";var SG=Pu().f,MG=Sa(),bG=Rs(),DS=bG("toStringTag");FS.exports=function(n,t,e){n&&!e&&(n=n.prototype),n&&!MG(n,DS)&&SG(n,DS,{configurable:!0,value:t})}});var BS=lt((QK,US)=>{"use strict";var AG=A0().IteratorPrototype,TG=zf(),CG=ip(),PG=Ap(),IG=bp(),RG=function(){return this};US.exports=function(n,t,e,o){var s=t+" Iterator";return n.prototype=TG(AG,{next:CG(+!o,e)}),PG(n,s,!1,!0),IG[s]=RG,n}});var T0=lt((tj,zS)=>{"use strict";var LG=mi(),NG=Nf();zS.exports=function(n,t,e){try{return LG(NG(Object.getOwnPropertyDescriptor(n,t)[e]))}catch(o){}}});var kS=lt((ej,GS)=>{"use strict";var OG=wa();GS.exports=function(n){return OG(n)||n===null}});var HS=lt((nj,qS)=>{"use strict";var DG=kS(),FG=String,UG=TypeError;qS.exports=function(n){if(DG(n))return n;throw new UG("Can't set "+FG(n)+" as a prototype")}});var WS=lt((rj,VS)=>{"use strict";var BG=T0(),zG=wa(),GG=rc(),kG=HS();VS.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var n=!1,t={},e;try{e=BG(Object.prototype,"__proto__","set"),e(t,[]),n=t instanceof Array}catch(o){}return function(s,c){return GG(s),kG(c),zG(s)&&(n?e(s,c):s.__proto__=c),s}}():void 0)});var nM=lt((ij,eM)=>{"use strict";var qG=Ls(),HG=Is(),Tp=Of(),QS=e0(),VG=Di(),WG=BS(),XS=w0(),YS=WS(),XG=Ap(),YG=uc(),C0=Ff(),$G=Rs(),$S=bp(),tM=A0(),ZG=QS.PROPER,JG=QS.CONFIGURABLE,ZS=tM.IteratorPrototype,Cp=tM.BUGGY_SAFARI_ITERATORS,Gf=$G("iterator"),JS="keys",kf="values",KS="entries",jS=function(){return this};eM.exports=function(n,t,e,o,s,c,h){WG(e,t,o);var p=function(w){if(w===s&&x)return x;if(!Cp&&w&&w in _)return _[w];switch(w){case JS:return function(){return new e(this,w)};case kf:return function(){return new e(this,w)};case KS:return function(){return new e(this,w)}}return function(){return new e(this)}},g=t+" Iterator",m=!1,_=n.prototype,E=_[Gf]||_["@@iterator"]||s&&_[s],x=!Cp&&E||p(s),b=t==="Array"&&_.entries||E,P,I,S;if(b&&(P=XS(b.call(new n)),P!==Object.prototype&&P.next&&(!Tp&&XS(P)!==ZS&&(YS?YS(P,ZS):VG(P[Gf])||C0(P,Gf,jS)),XG(P,g,!0,!0),Tp&&($S[g]=jS))),ZG&&s===kf&&E&&E.name!==kf&&(!Tp&&JG?YG(_,"name",kf):(m=!0,x=function(){return HG(E,this)})),s)if(I={values:p(kf),keys:c?x:p(JS),entries:p(KS)},h)for(S in I)(Cp||m||!(S in _))&&C0(_,S,I[S]);else qG({target:t,proto:!0,forced:Cp||m},I);return(!Tp||h)&&_[Gf]!==x&&C0(_,Gf,x,{name:s}),$S[t]=x,I}});var iM=lt((oj,rM)=>{"use strict";rM.exports=function(n,t){return{value:n,done:t}}});var cM=lt((sj,lM)=>{"use strict";var KG=ic(),P0=x0(),oM=bp(),aM=yp(),jG=Pu().f,QG=nM(),Pp=iM(),t4=Of(),e4=Xs(),uM="Array Iterator",n4=aM.set,r4=aM.getterFor(uM);lM.exports=QG(Array,"Array",function(n,t){n4(this,{type:uM,target:KG(n),index:0,kind:t})},function(){var n=r4(this),t=n.target,e=n.index++;if(!t||e>=t.length)return n.target=null,Pp(void 0,!0);switch(n.kind){case"keys":return Pp(e,!1);case"values":return Pp(t[e],!1)}return Pp([e,t[e]],!1)},"values");var sM=oM.Arguments=oM.Array;P0("keys");P0("values");P0("entries");if(!t4&&e4&&sM.name!=="values")try{jG(sM,"name",{value:"values"})}catch(n){}});var L0=lt(()=>{"use strict";var fM=oo(),pM=lS(),i4=hS(),qf=cM(),hM=uc(),o4=Ap(),s4=Rs(),I0=s4("iterator"),R0=qf.values,dM=function(n,t){if(n){if(n[I0]!==R0)try{hM(n,I0,R0)}catch(o){n[I0]=R0}if(o4(n,t,!0),pM[t]){for(var e in qf)if(n[e]!==qf[e])try{hM(n,e,qf[e])}catch(o){n[e]=qf[e]}}}};for(Ip in pM)dM(fM[Ip]&&fM[Ip].prototype,Ip);var Ip;dM(i4,"DOMTokenList")});var yM=lt((lj,mM)=>{"use strict";var a4=Rs(),u4=a4("toStringTag"),gM={};gM[u4]="z";mM.exports=String(gM)==="[object z]"});var N0=lt((cj,vM)=>{"use strict";var l4=yM(),c4=Di(),Rp=nc(),f4=Rs(),h4=f4("toStringTag"),p4=Object,d4=Rp(function(){return arguments}())==="Arguments",g4=function(n,t){try{return n[t]}catch(e){}};vM.exports=l4?Rp:function(n){var t,e,o;return n===void 0?"Undefined":n===null?"Null":typeof(e=g4(t=p4(n),h4))=="string"?e:d4?Rp(t):(o=Rp(t))==="Object"&&c4(t.callee)?"Arguments":o}});var Lp=lt((fj,_M)=>{"use strict";var m4=N0(),y4=String;_M.exports=function(n){if(m4(n)==="Symbol")throw new TypeError("Cannot convert a Symbol value to a string");return y4(n)}});var EM=lt((hj,xM)=>{"use strict";var v4=Ma();xM.exports=function(){var n=v4(this),t="";return n.hasIndices&&(t+="d"),n.global&&(t+="g"),n.ignoreCase&&(t+="i"),n.multiline&&(t+="m"),n.dotAll&&(t+="s"),n.unicode&&(t+="u"),n.unicodeSets&&(t+="v"),n.sticky&&(t+="y"),t}});var SM=lt((pj,wM)=>{"use strict";var O0=gi(),_4=oo(),D0=_4.RegExp,F0=O0(function(){var n=D0("a","y");return n.lastIndex=2,n.exec("abcd")!==null}),x4=F0||O0(function(){return!D0("a","y").sticky}),E4=F0||O0(function(){var n=D0("^r","gy");return n.lastIndex=2,n.exec("str")!==null});wM.exports={BROKEN_CARET:E4,MISSED_STICKY:x4,UNSUPPORTED_Y:F0}});var bM=lt((dj,MM)=>{"use strict";var w4=gi(),S4=oo(),M4=S4.RegExp;MM.exports=w4(function(){var n=M4(".","s");return!(n.dotAll&&n.test(\`
7746
7746
  \`)&&n.flags==="s")})});var TM=lt((gj,AM)=>{"use strict";var b4=gi(),A4=oo(),T4=A4.RegExp;AM.exports=b4(function(){var n=T4("(?<a>b)","g");return n.exec("b").groups.a!=="b"||"b".replace(n,"$<a>c")!=="bc"})});var Dp=lt((mj,PM)=>{"use strict";var lc=Is(),Op=mi(),C4=Lp(),P4=EM(),I4=SM(),R4=cp(),L4=zf(),N4=yp().get,O4=bM(),D4=TM(),F4=R4("native-string-replace",String.prototype.replace),Np=RegExp.prototype.exec,B0=Np,U4=Op("".charAt),B4=Op("".indexOf),z4=Op("".replace),U0=Op("".slice),z0=function(){var n=/a/,t=/b*/g;return lc(Np,n,"a"),lc(Np,t,"a"),n.lastIndex!==0||t.lastIndex!==0}(),CM=I4.BROKEN_CARET,G0=/()??/.exec("")[1]!==void 0,G4=z0||G0||CM||O4||D4;G4&&(B0=function(t){var e=this,o=N4(e),s=C4(t),c=o.raw,h,p,g,m,_,E,x;if(c)return c.lastIndex=e.lastIndex,h=lc(B0,c,s),e.lastIndex=c.lastIndex,h;var b=o.groups,P=CM&&e.sticky,I=lc(P4,e),S=e.source,w=0,R=s;if(P&&(I=z4(I,"y",""),B4(I,"g")===-1&&(I+="g"),R=U0(s,e.lastIndex),e.lastIndex>0&&(!e.multiline||e.multiline&&U4(s,e.lastIndex-1)!==\`
7747
7747
  \`)&&(S="(?: "+S+")",R=" "+R,w++),p=new RegExp("^(?:"+S+")",I)),G0&&(p=new RegExp("^"+S+"$(?!\\\\s)",I)),z0&&(g=e.lastIndex),m=lc(Np,P?p:e,R),P?m?(m.input=U0(m.input,w),m[0]=U0(m[0],w),m.index=e.lastIndex,e.lastIndex+=m[0].length):e.lastIndex=0:z0&&m&&(e.lastIndex=e.global?m.index+m[0].length:g),G0&&m&&m.length>1&&lc(F4,m[0],p,function(){for(_=1;_<arguments.length-2;_++)arguments[_]===void 0&&(m[_]=void 0)}),m&&b)for(m.groups=E=L4(null),_=0;_<b.length;_++)x=b[_],E[x[0]]=m[x[1]];return m});PM.exports=B0});var Fp=lt(()=>{"use strict";var k4=Ls(),IM=Dp();k4({target:"RegExp",proto:!0,forced:/./.exec!==IM},{exec:IM})});var Zs=lt((_j,RM)=>{"use strict";var k0=mi(),Up=Set.prototype;RM.exports={Set,add:k0(Up.add),has:k0(Up.has),remove:k0(Up.delete),proto:Up}});var Ru=lt((xj,LM)=>{"use strict";var q4=Zs().has;LM.exports=function(n){return q4(n),n}});var Lu=lt((Ej,NM)=>{"use strict";var H4=Is();NM.exports=function(n,t,e){for(var o=e?n:n.iterator,s=n.next,c,h;!(c=H4(s,o)).done;)if(h=t(c.value),h!==void 0)return h}});var cc=lt((wj,BM)=>{"use strict";var OM=mi(),V4=Lu(),DM=Zs(),W4=DM.Set,FM=DM.proto,X4=OM(FM.forEach),UM=OM(FM.keys),Y4=UM(new W4).next;BM.exports=function(n,t,e){return e?V4({iterator:UM(n),next:Y4},t):X4(n,t)}});var Bp=lt((Sj,GM)=>{"use strict";var zM=Zs(),$4=cc(),Z4=zM.Set,J4=zM.add;GM.exports=function(n){var t=new Z4;return $4(n,function(e){J4(t,e)}),t}});var fc=lt((Mj,kM)=>{"use strict";var K4=T0(),j4=Zs();kM.exports=K4(j4.proto,"size","get")||function(n){return n.size}});var HM=lt((bj,qM)=>{"use strict";qM.exports=function(n){return{iterator:n,next:n.next,done:!1}}});var Nu=lt((Aj,ZM)=>{"use strict";var VM=Nf(),YM=Ma(),WM=Is(),Q4=yl(),tk=HM(),XM="Invalid size",ek=RangeError,nk=TypeError,rk=Math.max,$M=function(n,t){this.set=n,this.size=rk(t,0),this.has=VM(n.has),this.keys=VM(n.keys)};$M.prototype={getIterator:function(){return tk(YM(WM(this.keys,this.set)))},includes:function(n){return WM(this.has,this.set,n)}};ZM.exports=function(n){YM(n);var t=+n.size;if(t!==t)throw new nk(XM);var e=Q4(t);if(e<0)throw new ek(XM);return new $M(n,e)}});var QM=lt((Tj,jM)=>{"use strict";var ik=Ru(),KM=Zs(),ok=Bp(),sk=fc(),ak=Nu(),uk=cc(),lk=Lu(),ck=KM.has,JM=KM.remove;jM.exports=function(t){var e=ik(this),o=ak(t),s=ok(e);return sk(e)<=o.size?uk(e,function(c){o.includes(c)&&JM(s,c)}):lk(o.getIterator(),function(c){ck(e,c)&&JM(s,c)}),s}});var Ou=lt((Cj,eb)=>{"use strict";var fk=oc(),tb=function(n){return{size:n,has:function(){return!1},keys:function(){return{next:function(){return{done:!0}}}}}};eb.exports=function(n){var t=fk("Set");try{new t()[n](tb(0));try{return new t()[n](tb(-1)),!1}catch(e){return!0}}catch(e){return!1}}});var nb=lt(()=>{"use strict";var hk=Ls(),pk=QM(),dk=Ou();hk({target:"Set",proto:!0,real:!0,forced:!dk("difference")},{difference:pk})});var ob=lt((Rj,ib)=>{"use strict";var gk=Ru(),q0=Zs(),mk=fc(),yk=Nu(),vk=cc(),_k=Lu(),xk=q0.Set,rb=q0.add,Ek=q0.has;ib.exports=function(t){var e=gk(this),o=yk(t),s=new xk;return mk(e)>o.size?_k(o.getIterator(),function(c){Ek(e,c)&&rb(s,c)}):vk(e,function(c){o.includes(c)&&rb(s,c)}),s}});var sb=lt(()=>{"use strict";var wk=Ls(),Sk=gi(),Mk=ob(),bk=Ou(),Ak=!bk("intersection")||Sk(function(){return String(Array.from(new Set([1,2,3]).intersection(new Set([3,2]))))!=="3,2"});wk({target:"Set",proto:!0,real:!0,forced:Ak},{intersection:Mk})});var H0=lt((Oj,ub)=>{"use strict";var Tk=Is(),ab=Ma(),Ck=ap();ub.exports=function(n,t,e){var o,s;ab(n);try{if(o=Ck(n,"return"),!o){if(t==="throw")throw e;return e}o=Tk(o,n)}catch(c){s=!0,o=c}if(t==="throw")throw e;if(s)throw o;return ab(o),e}});var cb=lt((Dj,lb)=>{"use strict";var Pk=Ru(),Ik=Zs().has,Rk=fc(),Lk=Nu(),Nk=cc(),Ok=Lu(),Dk=H0();lb.exports=function(t){var e=Pk(this),o=Lk(t);if(Rk(e)<=o.size)return Nk(e,function(c){if(o.includes(c))return!1},!0)!==!1;var s=o.getIterator();return Ok(s,function(c){if(Ik(e,c))return Dk(s,"normal",!1)})!==!1}});var fb=lt(()=>{"use strict";var Fk=Ls(),Uk=cb(),Bk=Ou();Fk({target:"Set",proto:!0,real:!0,forced:!Bk("isDisjointFrom")},{isDisjointFrom:Uk})});var pb=lt((Bj,hb)=>{"use strict";var zk=Ru(),Gk=fc(),kk=cc(),qk=Nu();hb.exports=function(t){var e=zk(this),o=qk(t);return Gk(e)>o.size?!1:kk(e,function(s){if(!o.includes(s))return!1},!0)!==!1}});var db=lt(()=>{"use strict";var Hk=Ls(),Vk=pb(),Wk=Ou();Hk({target:"Set",proto:!0,real:!0,forced:!Wk("isSubsetOf")},{isSubsetOf:Vk})});var mb=lt((kj,gb)=>{"use strict";var Xk=Ru(),Yk=Zs().has,$k=fc(),Zk=Nu(),Jk=Lu(),Kk=H0();gb.exports=function(t){var e=Xk(this),o=Zk(t);if($k(e)<o.size)return!1;var s=o.getIterator();return Jk(s,function(c){if(!Yk(e,c))return Kk(s,"normal",!1)})!==!1}});var yb=lt(()=>{"use strict";var jk=Ls(),Qk=mb(),tq=Ou();jk({target:"Set",proto:!0,real:!0,forced:!tq("isSupersetOf")},{isSupersetOf:Qk})});var _b=lt((Vj,vb)=>{"use strict";var eq=Ru(),V0=Zs(),nq=Bp(),rq=Nu(),iq=Lu(),oq=V0.add,sq=V0.has,aq=V0.remove;vb.exports=function(t){var e=eq(this),o=rq(t).getIterator(),s=nq(e);return iq(o,function(c){sq(e,c)?aq(s,c):oq(s,c)}),s}});var xb=lt(()=>{"use strict";var uq=Ls(),lq=_b(),cq=Ou();uq({target:"Set",proto:!0,real:!0,forced:!cq("symmetricDifference")},{symmetricDifference:lq})});var wb=lt((Yj,Eb)=>{"use strict";var fq=Ru(),hq=Zs().add,pq=Bp(),dq=Nu(),gq=Lu();Eb.exports=function(t){var e=fq(this),o=dq(t).getIterator(),s=pq(e);return gq(o,function(c){hq(s,c)}),s}});var Sb=lt(()=>{"use strict";var mq=Ls(),yq=wb(),vq=Ou();mq({target:"Set",proto:!0,real:!0,forced:!vq("union")},{union:yq})});var bb=lt((Jj,Mb)=>{"use strict";var _q=nc(),xq=mi();Mb.exports=function(n){if(_q(n)==="Function")return xq(n)}});var Cb=lt((Kj,Tb)=>{"use strict";var Ab=bb(),Eq=Nf(),wq=Lf(),Sq=Ab(Ab.bind);Tb.exports=function(n,t){return Eq(n),t===void 0?n:wq?Sq(n,t):function(){return n.apply(t,arguments)}}});var Rb=lt((jj,Ib)=>{"use strict";var Mq=wp(),bq=Uf(),Aq=h0(),Tq=Cb(),Pb=function(n,t,e,o,s,c,h,p){for(var g=s,m=0,_=h?Tq(h,p):!1,E,x;m<o;)m in e&&(E=_?_(e[m],m,t):e[m],c>0&&Mq(E)?(x=bq(E),g=Pb(n,t,E,x,g,c-1)-1):(Aq(g+1),n[g]=E),g++),m++;return g};Ib.exports=Pb});var Ub=lt((Qj,Fb)=>{"use strict";var Cq=mi(),Pq=gi(),Lb=Di(),Iq=N0(),Rq=oc(),Lq=r0(),Nb=function(){},Ob=Rq("Reflect","construct"),W0=/^\\s*(?:class|function)\\b/,Nq=Cq(W0.exec),Oq=!W0.test(Nb),Hf=function(t){if(!Lb(t))return!1;try{return Ob(Nb,[],t),!0}catch(e){return!1}},Db=function(t){if(!Lb(t))return!1;switch(Iq(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Oq||!!Nq(W0,Lq(t))}catch(e){return!0}};Db.sham=!0;Fb.exports=!Ob||Pq(function(){var n;return Hf(Hf.call)||!Hf(Object)||!Hf(function(){n=!0})||n})?Db:Hf});var kb=lt((tQ,Gb)=>{"use strict";var Bb=wp(),Dq=Ub(),Fq=wa(),Uq=Rs(),Bq=Uq("species"),zb=Array;Gb.exports=function(n){var t;return Bb(n)&&(t=n.constructor,Dq(t)&&(t===zb||Bb(t.prototype))?t=void 0:Fq(t)&&(t=t[Bq],t===null&&(t=void 0))),t===void 0?zb:t}});var Hb=lt((eQ,qb)=>{"use strict";var zq=kb();qb.exports=function(n,t){return new(zq(n))(t===0?0:t)}});var Vb=lt(()=>{"use strict";var Gq=Ls(),kq=Rb(),qq=sc(),Hq=Uf(),Vq=yl(),Wq=Hb();Gq({target:"Array",proto:!0},{flat:function(){var t=arguments.length?arguments[0]:void 0,e=qq(this),o=Hq(e),s=Wq(e,0);return s.length=kq(s,e,e,o,0,t===void 0?1:Vq(t)),s}})});var Wb=lt(()=>{"use strict";var Xq=x0();Xq("flat")});var Yb=lt((sQ,Xb)=>{var X0=class{constructor(){this.keys=new Set,this.queue=[]}sort(){this.queue.sort((t,e)=>t.priority-e.priority)}set(t,e){let o=Number(e);if(isNaN(o))throw new TypeError('"priority" must be a number');return this.keys.has(t)?this.queue.map(s=>(s.key===t&&Object.assign(s,{priority:o}),s)):(this.keys.add(t),this.queue.push({key:t,priority:o})),this.sort(),this.queue.length}next(){let t=this.queue.shift();return this.keys.delete(t.key),t}isEmpty(){return this.queue.length===0}has(t){return this.keys.has(t)}get(t){return this.queue.find(e=>e.key===t)}};Xb.exports=X0});var Jb=lt((aQ,Zb)=>{function $b(n,t){let e=new Map;for(let[o,s]of n)o!==t&&s instanceof Map?e.set(o,$b(s,t)):o!==t&&e.set(o,s);return e}Zb.exports=$b});var Qb=lt((uQ,jb)=>{function Yq(n){let t=Number(n);return!(isNaN(t)||t<=0)}function Kb(n){let t=new Map;return Object.keys(n).forEach(o=>{let s=n[o];if(s!==null&&typeof s=="object"&&!Array.isArray(s))return t.set(o,Kb(s));if(!Yq(s))throw new Error(\`Could not add node at key "\${o}", make sure it's a valid node\`,s);return t.set(o,Number(s))}),t}jb.exports=Kb});var nA=lt((lQ,eA)=>{function tA(n){if(!(n instanceof Map))throw new Error(\`Invalid graph: Expected Map instead found \${typeof n}\`);n.forEach((t,e)=>{if(typeof t=="object"&&t instanceof Map){tA(t);return}if(typeof t!="number"||t<=0)throw new Error(\`Values must be numbers greater than 0. Found value \${t} at \${e}\`)})}eA.exports=tA});var sA=lt((cQ,oA)=>{var $q=Yb(),Zq=Jb(),rA=Qb(),iA=nA(),Y0=class{constructor(t){t instanceof Map?(iA(t),this.graph=t):t?this.graph=rA(t):this.graph=new Map}addNode(t,e){let o;return e instanceof Map?(iA(e),o=e):o=rA(e),this.graph.set(t,o),this}addVertex(t,e){return this.addNode(t,e)}removeNode(t){return this.graph=Zq(this.graph,t),this}path(t,e,o={}){if(!this.graph.size)return o.cost?{path:null,cost:0}:null;let s=new Set,c=new $q,h=new Map,p=[],g=0,m=[];if(o.avoid&&(m=[].concat(o.avoid)),m.includes(t))throw new Error(\`Starting node (\${t}) cannot be avoided\`);if(m.includes(e))throw new Error(\`Ending node (\${e}) cannot be avoided\`);for(c.set(t,0);!c.isEmpty();){let _=c.next();if(_.key===e){g=_.priority;let x=_.key;for(;h.has(x);)p.push(x),x=h.get(x);break}s.add(_.key),(this.graph.get(_.key)||new Map).forEach((x,b)=>{if(s.has(b)||m.includes(b))return null;if(!c.has(b))return h.set(b,_.key),c.set(b,_.priority+x);let P=c.get(b).priority,I=_.priority+x;return I<P?(h.set(b,_.key),c.set(b,I)):null})}return p.length?(o.trim?p.shift():p=p.concat([t]),o.reverse||(p=p.reverse()),o.cost?{path:p,cost:g}:p):o.cost?{path:null,cost:0}:null}shortestPath(...t){return this.path(...t)}};oA.exports=Y0});var Rd=lt((wQ,QT)=>{"use strict";var jT=Object.getOwnPropertySymbols,u9=Object.prototype.hasOwnProperty,l9=Object.prototype.propertyIsEnumerable;function c9(n){if(n==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(n)}function f9(){try{if(!Object.assign)return!1;var n=new String("abc");if(n[5]="de",Object.getOwnPropertyNames(n)[0]==="5")return!1;for(var t={},e=0;e<10;e++)t["_"+String.fromCharCode(e)]=e;var o=Object.getOwnPropertyNames(t).map(function(c){return t[c]});if(o.join("")!=="0123456789")return!1;var s={};return"abcdefghijklmnopqrst".split("").forEach(function(c){s[c]=c}),Object.keys(Object.assign({},s)).join("")==="abcdefghijklmnopqrst"}catch(c){return!1}}QT.exports=f9()?Object.assign:function(n,t){for(var e,o=c9(n),s,c=1;c<arguments.length;c++){e=Object(arguments[c]);for(var h in e)u9.call(e,h)&&(o[h]=e[h]);if(jT){s=jT(e);for(var p=0;p<s.length;p++)l9.call(e,s[p])&&(o[s[p]]=e[s[p]])}}return o}});var wv=lt((xv,Ev)=>{(function(n,t){typeof xv=="object"&&typeof Ev!="undefined"?Ev.exports=t():typeof define=="function"&&define.amd?define(t):(n=n||self).RBush=t()})(xv,function(){"use strict";function n(S,w,R,T,F){(function W(X,q,D,xt,B){for(;xt>D;){if(xt-D>600){var j=xt-D+1,J=q-D+1,Dt=Math.log(j),Q=.5*Math.exp(2*Dt/3),At=.5*Math.sqrt(Dt*Q*(j-Q)/j)*(J-j/2<0?-1:1),Mt=Math.max(D,Math.floor(q-J*Q/j+At)),Rt=Math.min(xt,Math.floor(q+(j-J)*Q/j+At));W(X,q,Mt,Rt,B)}var pt=X[q],yt=D,K=xt;for(t(X,D,q),B(X[xt],pt)>0&&t(X,D,xt);yt<K;){for(t(X,yt,K),yt++,K--;B(X[yt],pt)<0;)yt++;for(;B(X[K],pt)>0;)K--}B(X[D],pt)===0?t(X,D,K):t(X,++K,xt),K<=q&&(D=K+1),q<=K&&(xt=K-1)}})(S,w,R||0,T||S.length-1,F||e)}function t(S,w,R){var T=S[w];S[w]=S[R],S[R]=T}function e(S,w){return S<w?-1:S>w?1:0}var o=function(S){S===void 0&&(S=9),this._maxEntries=Math.max(4,S),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function s(S,w,R){if(!R)return w.indexOf(S);for(var T=0;T<w.length;T++)if(R(S,w[T]))return T;return-1}function c(S,w){h(S,0,S.children.length,w,S)}function h(S,w,R,T,F){F||(F=P(null)),F.minX=1/0,F.minY=1/0,F.maxX=-1/0,F.maxY=-1/0;for(var W=w;W<R;W++){var X=S.children[W];p(F,S.leaf?T(X):X)}return F}function p(S,w){return S.minX=Math.min(S.minX,w.minX),S.minY=Math.min(S.minY,w.minY),S.maxX=Math.max(S.maxX,w.maxX),S.maxY=Math.max(S.maxY,w.maxY),S}function g(S,w){return S.minX-w.minX}function m(S,w){return S.minY-w.minY}function _(S){return(S.maxX-S.minX)*(S.maxY-S.minY)}function E(S){return S.maxX-S.minX+(S.maxY-S.minY)}function x(S,w){return S.minX<=w.minX&&S.minY<=w.minY&&w.maxX<=S.maxX&&w.maxY<=S.maxY}function b(S,w){return w.minX<=S.maxX&&w.minY<=S.maxY&&w.maxX>=S.minX&&w.maxY>=S.minY}function P(S){return{children:S,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function I(S,w,R,T,F){for(var W=[w,R];W.length;)if(!((R=W.pop())-(w=W.pop())<=T)){var X=w+Math.ceil((R-w)/T/2)*T;n(S,X,w,R,F),W.push(w,X,X,R)}}return o.prototype.all=function(){return this._all(this.data,[])},o.prototype.search=function(S){var w=this.data,R=[];if(!b(S,w))return R;for(var T=this.toBBox,F=[];w;){for(var W=0;W<w.children.length;W++){var X=w.children[W],q=w.leaf?T(X):X;b(S,q)&&(w.leaf?R.push(X):x(S,q)?this._all(X,R):F.push(X))}w=F.pop()}return R},o.prototype.collides=function(S){var w=this.data;if(!b(S,w))return!1;for(var R=[];w;){for(var T=0;T<w.children.length;T++){var F=w.children[T],W=w.leaf?this.toBBox(F):F;if(b(S,W)){if(w.leaf||x(S,W))return!0;R.push(F)}}w=R.pop()}return!1},o.prototype.load=function(S){if(!S||!S.length)return this;if(S.length<this._minEntries){for(var w=0;w<S.length;w++)this.insert(S[w]);return this}var R=this._build(S.slice(),0,S.length-1,0);if(this.data.children.length)if(this.data.height===R.height)this._splitRoot(this.data,R);else{if(this.data.height<R.height){var T=this.data;this.data=R,R=T}this._insert(R,this.data.height-R.height-1,!0)}else this.data=R;return this},o.prototype.insert=function(S){return S&&this._insert(S,this.data.height-1),this},o.prototype.clear=function(){return this.data=P([]),this},o.prototype.remove=function(S,w){if(!S)return this;for(var R,T,F,W=this.data,X=this.toBBox(S),q=[],D=[];W||q.length;){if(W||(W=q.pop(),T=q[q.length-1],R=D.pop(),F=!0),W.leaf){var xt=s(S,W.children,w);if(xt!==-1)return W.children.splice(xt,1),q.push(W),this._condense(q),this}F||W.leaf||!x(W,X)?T?(R++,W=T.children[R],F=!1):W=null:(q.push(W),D.push(R),R=0,T=W,W=W.children[0])}return this},o.prototype.toBBox=function(S){return S},o.prototype.compareMinX=function(S,w){return S.minX-w.minX},o.prototype.compareMinY=function(S,w){return S.minY-w.minY},o.prototype.toJSON=function(){return this.data},o.prototype.fromJSON=function(S){return this.data=S,this},o.prototype._all=function(S,w){for(var R=[];S;)S.leaf?w.push.apply(w,S.children):R.push.apply(R,S.children),S=R.pop();return w},o.prototype._build=function(S,w,R,T){var F,W=R-w+1,X=this._maxEntries;if(W<=X)return c(F=P(S.slice(w,R+1)),this.toBBox),F;T||(T=Math.ceil(Math.log(W)/Math.log(X)),X=Math.ceil(W/Math.pow(X,T-1))),(F=P([])).leaf=!1,F.height=T;var q=Math.ceil(W/X),D=q*Math.ceil(Math.sqrt(X));I(S,w,R,D,this.compareMinX);for(var xt=w;xt<=R;xt+=D){var B=Math.min(xt+D-1,R);I(S,xt,B,q,this.compareMinY);for(var j=xt;j<=B;j+=q){var J=Math.min(j+q-1,B);F.children.push(this._build(S,j,J,T-1))}}return c(F,this.toBBox),F},o.prototype._chooseSubtree=function(S,w,R,T){for(;T.push(w),!w.leaf&&T.length-1!==R;){for(var F=1/0,W=1/0,X=void 0,q=0;q<w.children.length;q++){var D=w.children[q],xt=_(D),B=(j=S,J=D,(Math.max(J.maxX,j.maxX)-Math.min(J.minX,j.minX))*(Math.max(J.maxY,j.maxY)-Math.min(J.minY,j.minY))-xt);B<W?(W=B,F=xt<F?xt:F,X=D):B===W&&xt<F&&(F=xt,X=D)}w=X||w.children[0]}var j,J;return w},o.prototype._insert=function(S,w,R){var T=R?S:this.toBBox(S),F=[],W=this._chooseSubtree(T,this.data,w,F);for(W.children.push(S),p(W,T);w>=0&&F[w].children.length>this._maxEntries;)this._split(F,w),w--;this._adjustParentBBoxes(T,F,w)},o.prototype._split=function(S,w){var R=S[w],T=R.children.length,F=this._minEntries;this._chooseSplitAxis(R,F,T);var W=this._chooseSplitIndex(R,F,T),X=P(R.children.splice(W,R.children.length-W));X.height=R.height,X.leaf=R.leaf,c(R,this.toBBox),c(X,this.toBBox),w?S[w-1].children.push(X):this._splitRoot(R,X)},o.prototype._splitRoot=function(S,w){this.data=P([S,w]),this.data.height=S.height+1,this.data.leaf=!1,c(this.data,this.toBBox)},o.prototype._chooseSplitIndex=function(S,w,R){for(var T,F,W,X,q,D,xt,B=1/0,j=1/0,J=w;J<=R-w;J++){var Dt=h(S,0,J,this.toBBox),Q=h(S,J,R,this.toBBox),At=(F=Dt,W=Q,X=void 0,q=void 0,D=void 0,xt=void 0,X=Math.max(F.minX,W.minX),q=Math.max(F.minY,W.minY),D=Math.min(F.maxX,W.maxX),xt=Math.min(F.maxY,W.maxY),Math.max(0,D-X)*Math.max(0,xt-q)),Mt=_(Dt)+_(Q);At<B?(B=At,T=J,j=Mt<j?Mt:j):At===B&&Mt<j&&(j=Mt,T=J)}return T||R-w},o.prototype._chooseSplitAxis=function(S,w,R){var T=S.leaf?this.compareMinX:g,F=S.leaf?this.compareMinY:m;this._allDistMargin(S,w,R,T)<this._allDistMargin(S,w,R,F)&&S.children.sort(T)},o.prototype._allDistMargin=function(S,w,R,T){S.children.sort(T);for(var F=this.toBBox,W=h(S,0,w,F),X=h(S,R-w,R,F),q=E(W)+E(X),D=w;D<R-w;D++){var xt=S.children[D];p(W,S.leaf?F(xt):xt),q+=E(W)}for(var B=R-w-1;B>=w;B--){var j=S.children[B];p(X,S.leaf?F(j):j),q+=E(X)}return q},o.prototype._adjustParentBBoxes=function(S,w,R){for(var T=R;T>=0;T--)p(w[T],S)},o.prototype._condense=function(S){for(var w=S.length-1,R=void 0;w>=0;w--)S[w].children.length===0?w>0?(R=S[w-1].children).splice(R.indexOf(S[w]),1):this.clear():c(S[w],this.toBBox)},o})});var tC=lt((Sv,Mv)=>{(function(n,t){typeof Sv=="object"&&typeof Mv!="undefined"?Mv.exports=t():typeof define=="function"&&define.amd?define(t):(n=n||self,n.TinyQueue=t())})(Sv,function(){"use strict";var n=function(o,s){if(o===void 0&&(o=[]),s===void 0&&(s=t),this.data=o,this.length=this.data.length,this.compare=s,this.length>0)for(var c=(this.length>>1)-1;c>=0;c--)this._down(c)};n.prototype.push=function(o){this.data.push(o),this.length++,this._up(this.length-1)},n.prototype.pop=function(){if(this.length!==0){var o=this.data[0],s=this.data.pop();return this.length--,this.length>0&&(this.data[0]=s,this._down(0)),o}},n.prototype.peek=function(){return this.data[0]},n.prototype._up=function(o){for(var s=this,c=s.data,h=s.compare,p=c[o];o>0;){var g=o-1>>1,m=c[g];if(h(p,m)>=0)break;c[o]=m,o=g}c[o]=p},n.prototype._down=function(o){for(var s=this,c=s.data,h=s.compare,p=this.length>>1,g=c[o];o<p;){var m=(o<<1)+1,_=c[m],E=m+1;if(E<this.length&&h(c[E],_)<0&&(m=E,_=c[E]),h(_,g)>=0)break;c[o]=_,o=m}c[o]=g};function t(e,o){return e<o?-1:e>o?1:0}return n})});var nC=lt((CQ,eC)=>{eC.exports=function(t,e,o,s){var c=t[0],h=t[1],p=!1;o===void 0&&(o=0),s===void 0&&(s=e.length);for(var g=(s-o)/2,m=0,_=g-1;m<g;_=m++){var E=e[o+m*2+0],x=e[o+m*2+1],b=e[o+_*2+0],P=e[o+_*2+1],I=x>h!=P>h&&c<(b-E)*(h-x)/(P-x)+E;I&&(p=!p)}return p}});var iC=lt((PQ,rC)=>{rC.exports=function(t,e,o,s){var c=t[0],h=t[1],p=!1;o===void 0&&(o=0),s===void 0&&(s=e.length);for(var g=s-o,m=0,_=g-1;m<g;_=m++){var E=e[m+o][0],x=e[m+o][1],b=e[_+o][0],P=e[_+o][1],I=x>h!=P>h&&c<(b-E)*(h-x)/(P-x)+E;I&&(p=!p)}return p}});var aC=lt((IQ,Od)=>{var oC=nC(),sC=iC();Od.exports=function(t,e,o,s){return e.length>0&&Array.isArray(e[0])?sC(t,e,o,s):oC(t,e,o,s)};Od.exports.nested=sC;Od.exports.flat=oC});var lC=lt((Dd,uC)=>{(function(n,t){typeof Dd=="object"&&typeof uC!="undefined"?t(Dd):typeof define=="function"&&define.amd?define(["exports"],t):t((n=n||self).predicates={})})(Dd,function(n){"use strict";let e=33306690738754706e-32;function o(b,P,I,S,w){let R,T,F,W,X=P[0],q=S[0],D=0,xt=0;q>X==q>-X?(R=X,X=P[++D]):(R=q,q=S[++xt]);let B=0;if(D<b&&xt<I)for(q>X==q>-X?(F=R-((T=X+R)-X),X=P[++D]):(F=R-((T=q+R)-q),q=S[++xt]),R=T,F!==0&&(w[B++]=F);D<b&&xt<I;)q>X==q>-X?(F=R-((T=R+X)-(W=T-R))+(X-W),X=P[++D]):(F=R-((T=R+q)-(W=T-R))+(q-W),q=S[++xt]),R=T,F!==0&&(w[B++]=F);for(;D<b;)F=R-((T=R+X)-(W=T-R))+(X-W),X=P[++D],R=T,F!==0&&(w[B++]=F);for(;xt<I;)F=R-((T=R+q)-(W=T-R))+(q-W),q=S[++xt],R=T,F!==0&&(w[B++]=F);return R===0&&B!==0||(w[B++]=R),B}function s(b){return new Float64Array(b)}let c=33306690738754716e-32,h=22204460492503146e-32,p=11093356479670487e-47,g=s(4),m=s(8),_=s(12),E=s(16),x=s(4);n.orient2d=function(b,P,I,S,w,R){let T=(P-R)*(I-w),F=(b-w)*(S-R),W=T-F;if(T===0||F===0||T>0!=F>0)return W;let X=Math.abs(T+F);return Math.abs(W)>=c*X?W:-function(q,D,xt,B,j,J,Dt){let Q,At,Mt,Rt,pt,yt,K,Bt,Gt,ae,at,Ut,jt,ce,te,$t,qt,xe,ft=q-j,We=xt-j,ee=D-J,ge=B-J;pt=(te=(Bt=ft-(K=(yt=134217729*ft)-(yt-ft)))*(ae=ge-(Gt=(yt=134217729*ge)-(yt-ge)))-((ce=ft*ge)-K*Gt-Bt*Gt-K*ae))-(at=te-(qt=(Bt=ee-(K=(yt=134217729*ee)-(yt-ee)))*(ae=We-(Gt=(yt=134217729*We)-(yt-We)))-(($t=ee*We)-K*Gt-Bt*Gt-K*ae))),g[0]=te-(at+pt)+(pt-qt),pt=(jt=ce-((Ut=ce+at)-(pt=Ut-ce))+(at-pt))-(at=jt-$t),g[1]=jt-(at+pt)+(pt-$t),pt=(xe=Ut+at)-Ut,g[2]=Ut-(xe-pt)+(at-pt),g[3]=xe;let fe=function(tt,z){let Pt=z[0];for(let Ot=1;Ot<tt;Ot++)Pt+=z[Ot];return Pt}(4,g),Te=h*Dt;if(fe>=Te||-fe>=Te||(Q=q-(ft+(pt=q-ft))+(pt-j),Mt=xt-(We+(pt=xt-We))+(pt-j),At=D-(ee+(pt=D-ee))+(pt-J),Rt=B-(ge+(pt=B-ge))+(pt-J),Q===0&&At===0&&Mt===0&&Rt===0)||(Te=p*Dt+e*Math.abs(fe),(fe+=ft*Rt+ge*Q-(ee*Mt+We*At))>=Te||-fe>=Te))return fe;pt=(te=(Bt=Q-(K=(yt=134217729*Q)-(yt-Q)))*(ae=ge-(Gt=(yt=134217729*ge)-(yt-ge)))-((ce=Q*ge)-K*Gt-Bt*Gt-K*ae))-(at=te-(qt=(Bt=At-(K=(yt=134217729*At)-(yt-At)))*(ae=We-(Gt=(yt=134217729*We)-(yt-We)))-(($t=At*We)-K*Gt-Bt*Gt-K*ae))),x[0]=te-(at+pt)+(pt-qt),pt=(jt=ce-((Ut=ce+at)-(pt=Ut-ce))+(at-pt))-(at=jt-$t),x[1]=jt-(at+pt)+(pt-$t),pt=(xe=Ut+at)-Ut,x[2]=Ut-(xe-pt)+(at-pt),x[3]=xe;let be=o(4,g,4,x,m);pt=(te=(Bt=ft-(K=(yt=134217729*ft)-(yt-ft)))*(ae=Rt-(Gt=(yt=134217729*Rt)-(yt-Rt)))-((ce=ft*Rt)-K*Gt-Bt*Gt-K*ae))-(at=te-(qt=(Bt=ee-(K=(yt=134217729*ee)-(yt-ee)))*(ae=Mt-(Gt=(yt=134217729*Mt)-(yt-Mt)))-(($t=ee*Mt)-K*Gt-Bt*Gt-K*ae))),x[0]=te-(at+pt)+(pt-qt),pt=(jt=ce-((Ut=ce+at)-(pt=Ut-ce))+(at-pt))-(at=jt-$t),x[1]=jt-(at+pt)+(pt-$t),pt=(xe=Ut+at)-Ut,x[2]=Ut-(xe-pt)+(at-pt),x[3]=xe;let Wt=o(be,m,4,x,_);pt=(te=(Bt=Q-(K=(yt=134217729*Q)-(yt-Q)))*(ae=Rt-(Gt=(yt=134217729*Rt)-(yt-Rt)))-((ce=Q*Rt)-K*Gt-Bt*Gt-K*ae))-(at=te-(qt=(Bt=At-(K=(yt=134217729*At)-(yt-At)))*(ae=Mt-(Gt=(yt=134217729*Mt)-(yt-Mt)))-(($t=At*Mt)-K*Gt-Bt*Gt-K*ae))),x[0]=te-(at+pt)+(pt-qt),pt=(jt=ce-((Ut=ce+at)-(pt=Ut-ce))+(at-pt))-(at=jt-$t),x[1]=jt-(at+pt)+(pt-$t),pt=(xe=Ut+at)-Ut,x[2]=Ut-(xe-pt)+(at-pt),x[3]=xe;let Me=o(Wt,_,4,x,E);return E[Me-1]}(b,P,I,S,w,R,X)},n.orient2dfast=function(b,P,I,S,w,R){return(P-R)*(I-w)-(b-w)*(S-R)},Object.defineProperty(n,"__esModule",{value:!0})})});var gC=lt((RQ,Cv)=>{"use strict";var cC=wv(),Ud=tC(),p9=aC(),d9=lC().orient2d;Ud.default&&(Ud=Ud.default);Cv.exports=dC;Cv.exports.default=dC;function dC(n,t,e){t=Math.max(0,t===void 0?2:t),e=e||0;var o=_9(n),s=new cC(16);s.toBBox=function(R){return{minX:R[0],minY:R[1],maxX:R[0],maxY:R[1]}},s.compareMinX=function(R,T){return R[0]-T[0]},s.compareMinY=function(R,T){return R[1]-T[1]},s.load(n);for(var c=[],h=0,p;h<o.length;h++){var g=o[h];s.remove(g),p=pC(g,p),c.push(p)}var m=new cC(16);for(h=0;h<c.length;h++)m.insert(bv(c[h]));for(var _=t*t,E=e*e;c.length;){var x=c.shift(),b=x.p,P=x.next.p,I=Av(b,P);if(!(I<E)){var S=I/_;g=g9(s,x.prev.p,b,P,x.next.next.p,S,m),g&&Math.min(Av(g,b),Av(g,P))<=S&&(c.push(x),c.push(pC(g,x)),s.remove(g),m.remove(x),m.insert(bv(x)),m.insert(bv(x.next)))}}x=p;var w=[];do w.push(x.p),x=x.next;while(x!==p);return w.push(x.p),w}function g9(n,t,e,o,s,c,h){for(var p=new Ud([],m9),g=n.data;g;){for(var m=0;m<g.children.length;m++){var _=g.children[m],E=g.leaf?Tv(_,e,o):y9(e,o,_);E>c||p.push({node:_,dist:E})}for(;p.length&&!p.peek().node.children;){var x=p.pop(),b=x.node,P=Tv(b,t,e),I=Tv(b,o,s);if(x.dist<P&&x.dist<I&&hC(e,b,h)&&hC(o,b,h))return b}g=p.pop(),g&&(g=g.node)}return null}function m9(n,t){return n.dist-t.dist}function y9(n,t,e){if(fC(n,e)||fC(t,e))return 0;var o=Fd(n[0],n[1],t[0],t[1],e.minX,e.minY,e.maxX,e.minY);if(o===0)return 0;var s=Fd(n[0],n[1],t[0],t[1],e.minX,e.minY,e.minX,e.maxY);if(s===0)return 0;var c=Fd(n[0],n[1],t[0],t[1],e.maxX,e.minY,e.maxX,e.maxY);if(c===0)return 0;var h=Fd(n[0],n[1],t[0],t[1],e.minX,e.maxY,e.maxX,e.maxY);return h===0?0:Math.min(o,s,c,h)}function fC(n,t){return n[0]>=t.minX&&n[0]<=t.maxX&&n[1]>=t.minY&&n[1]<=t.maxY}function hC(n,t,e){for(var o=Math.min(n[0],t[0]),s=Math.min(n[1],t[1]),c=Math.max(n[0],t[0]),h=Math.max(n[1],t[1]),p=e.search({minX:o,minY:s,maxX:c,maxY:h}),g=0;g<p.length;g++)if(v9(p[g].p,p[g].next.p,n,t))return!1;return!0}function qc(n,t,e){return d9(n[0],n[1],t[0],t[1],e[0],e[1])}function v9(n,t,e,o){return n!==o&&t!==e&&qc(n,t,e)>0!=qc(n,t,o)>0&&qc(e,o,n)>0!=qc(e,o,t)>0}function bv(n){var t=n.p,e=n.next.p;return n.minX=Math.min(t[0],e[0]),n.minY=Math.min(t[1],e[1]),n.maxX=Math.max(t[0],e[0]),n.maxY=Math.max(t[1],e[1]),n}function _9(n){for(var t=n[0],e=n[0],o=n[0],s=n[0],c=0;c<n.length;c++){var h=n[c];h[0]<t[0]&&(t=h),h[0]>o[0]&&(o=h),h[1]<e[1]&&(e=h),h[1]>s[1]&&(s=h)}var p=[t,e,o,s],g=p.slice();for(c=0;c<n.length;c++)p9(n[c],p)||g.push(n[c]);return E9(g)}function pC(n,t){var e={p:n,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return t?(e.next=t.next,e.prev=t,t.next.prev=e,t.next=e):(e.prev=e,e.next=e),e}function Av(n,t){var e=n[0]-t[0],o=n[1]-t[1];return e*e+o*o}function Tv(n,t,e){var o=t[0],s=t[1],c=e[0]-o,h=e[1]-s;if(c!==0||h!==0){var p=((n[0]-o)*c+(n[1]-s)*h)/(c*c+h*h);p>1?(o=e[0],s=e[1]):p>0&&(o+=c*p,s+=h*p)}return c=n[0]-o,h=n[1]-s,c*c+h*h}function Fd(n,t,e,o,s,c,h,p){var g=e-n,m=o-t,_=h-s,E=p-c,x=n-s,b=t-c,P=g*g+m*m,I=g*_+m*E,S=_*_+E*E,w=g*x+m*b,R=_*x+E*b,T=P*S-I*I,F,W,X,q,D=T,xt=T;T===0?(W=0,D=1,q=R,xt=S):(W=I*R-S*w,q=P*R-I*w,W<0?(W=0,q=R,xt=S):W>D&&(W=D,q=R+I,xt=S)),q<0?(q=0,-w<0?W=0:-w>P?W=D:(W=-w,D=P)):q>xt&&(q=xt,-w+I<0?W=0:-w+I>P?W=D:(W=-w+I,D=P)),F=W===0?0:W/D,X=q===0?0:q/xt;var B=(1-F)*n+F*e,j=(1-F)*t+F*o,J=(1-X)*s+X*h,Dt=(1-X)*c+X*p,Q=J-B,At=Dt-j;return Q*Q+At*At}function x9(n,t){return n[0]===t[0]?n[1]-t[1]:n[0]-t[0]}function E9(n){n.sort(x9);for(var t=[],e=0;e<n.length;e++){for(;t.length>=2&&qc(t[t.length-2],t[t.length-1],n[e])<=0;)t.pop();t.push(n[e])}for(var o=[],s=n.length-1;s>=0;s--){for(;o.length>=2&&qc(o[o.length-2],o[o.length-1],n[s])<=0;)o.pop();o.push(n[s])}return o.pop(),t.pop(),t.concat(o)}});var EC=lt((Iv,Rv)=>{(function(n,t){typeof Iv=="object"&&typeof Rv!="undefined"?Rv.exports=t():typeof define=="function"&&define.amd?define(t):n.quickselect=t()})(Iv,function(){"use strict";function n(s,c,h,p,g){t(s,c,h||0,p||s.length-1,g||o)}function t(s,c,h,p,g){for(;p>h;){if(p-h>600){var m=p-h+1,_=c-h+1,E=Math.log(m),x=.5*Math.exp(2*E/3),b=.5*Math.sqrt(E*x*(m-x)/m)*(_-m/2<0?-1:1),P=Math.max(h,Math.floor(c-_*x/m+b)),I=Math.min(p,Math.floor(c+(m-_)*x/m+b));t(s,c,P,I,g)}var S=s[c],w=h,R=p;for(e(s,h,c),g(s[p],S)>0&&e(s,h,p);w<R;){for(e(s,w,R),w++,R--;g(s[w],S)<0;)w++;for(;g(s[R],S)>0;)R--}g(s[h],S)===0?e(s,h,R):(R++,e(s,R,p)),R<=c&&(h=R+1),c<=R&&(p=R-1)}}function e(s,c,h){var p=s[c];s[c]=s[h],s[h]=p}function o(s,c){return s<c?-1:s>c?1:0}return n})});var Dv=lt((ont,Ov)=>{"use strict";Ov.exports=ih;Ov.exports.default=ih;var O9=EC();function ih(n,t){if(!(this instanceof ih))return new ih(n,t);this._maxEntries=Math.max(4,n||9),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),t&&this._initFormat(t),this.clear()}ih.prototype={all:function(){return this._all(this.data,[])},search:function(n){var t=this.data,e=[],o=this.toBBox;if(!zd(n,t))return e;for(var s=[],c,h,p,g;t;){for(c=0,h=t.children.length;c<h;c++)p=t.children[c],g=t.leaf?o(p):p,zd(n,g)&&(t.leaf?e.push(p):Nv(n,g)?this._all(p,e):s.push(p));t=s.pop()}return e},collides:function(n){var t=this.data,e=this.toBBox;if(!zd(n,t))return!1;for(var o=[],s,c,h,p;t;){for(s=0,c=t.children.length;s<c;s++)if(h=t.children[s],p=t.leaf?e(h):h,zd(n,p)){if(t.leaf||Nv(n,p))return!0;o.push(h)}t=o.pop()}return!1},load:function(n){if(!(n&&n.length))return this;if(n.length<this._minEntries){for(var t=0,e=n.length;t<e;t++)this.insert(n[t]);return this}var o=this._build(n.slice(),0,n.length-1,0);if(!this.data.children.length)this.data=o;else if(this.data.height===o.height)this._splitRoot(this.data,o);else{if(this.data.height<o.height){var s=this.data;this.data=o,o=s}this._insert(o,this.data.height-o.height-1,!0)}return this},insert:function(n){return n&&this._insert(n,this.data.height-1),this},clear:function(){return this.data=Wc([]),this},remove:function(n,t){if(!n)return this;for(var e=this.data,o=this.toBBox(n),s=[],c=[],h,p,g,m;e||s.length;){if(e||(e=s.pop(),p=s[s.length-1],h=c.pop(),m=!0),e.leaf&&(g=D9(n,e.children,t),g!==-1))return e.children.splice(g,1),s.push(e),this._condense(s),this;!m&&!e.leaf&&Nv(e,o)?(s.push(e),c.push(h),h=0,p=e,e=e.children[0]):p?(h++,e=p.children[h],m=!1):e=null}return this},toBBox:function(n){return n},compareMinX:wC,compareMinY:SC,toJSON:function(){return this.data},fromJSON:function(n){return this.data=n,this},_all:function(n,t){for(var e=[];n;)n.leaf?t.push.apply(t,n.children):e.push.apply(e,n.children),n=e.pop();return t},_build:function(n,t,e,o){var s=e-t+1,c=this._maxEntries,h;if(s<=c)return h=Wc(n.slice(t,e+1)),Vc(h,this.toBBox),h;o||(o=Math.ceil(Math.log(s)/Math.log(c)),c=Math.ceil(s/Math.pow(c,o-1))),h=Wc([]),h.leaf=!1,h.height=o;var p=Math.ceil(s/c),g=p*Math.ceil(Math.sqrt(c)),m,_,E,x;for(MC(n,t,e,g,this.compareMinX),m=t;m<=e;m+=g)for(E=Math.min(m+g-1,e),MC(n,m,E,p,this.compareMinY),_=m;_<=E;_+=p)x=Math.min(_+p-1,E),h.children.push(this._build(n,_,x,o-1));return Vc(h,this.toBBox),h},_chooseSubtree:function(n,t,e,o){for(var s,c,h,p,g,m,_,E;o.push(t),!(t.leaf||o.length-1===e);){for(_=E=1/0,s=0,c=t.children.length;s<c;s++)h=t.children[s],g=Lv(h),m=F9(n,h)-g,m<E?(E=m,_=g<_?g:_,p=h):m===E&&g<_&&(_=g,p=h);t=p||t.children[0]}return t},_insert:function(n,t,e){var o=this.toBBox,s=e?n:o(n),c=[],h=this._chooseSubtree(s,this.data,t,c);for(h.children.push(n),rh(h,s);t>=0&&c[t].children.length>this._maxEntries;)this._split(c,t),t--;this._adjustParentBBoxes(s,c,t)},_split:function(n,t){var e=n[t],o=e.children.length,s=this._minEntries;this._chooseSplitAxis(e,s,o);var c=this._chooseSplitIndex(e,s,o),h=Wc(e.children.splice(c,e.children.length-c));h.height=e.height,h.leaf=e.leaf,Vc(e,this.toBBox),Vc(h,this.toBBox),t?n[t-1].children.push(h):this._splitRoot(e,h)},_splitRoot:function(n,t){this.data=Wc([n,t]),this.data.height=n.height+1,this.data.leaf=!1,Vc(this.data,this.toBBox)},_chooseSplitIndex:function(n,t,e){var o,s,c,h,p,g,m,_;for(g=m=1/0,o=t;o<=e-t;o++)s=nh(n,0,o,this.toBBox),c=nh(n,o,e,this.toBBox),h=U9(s,c),p=Lv(s)+Lv(c),h<g?(g=h,_=o,m=p<m?p:m):h===g&&p<m&&(m=p,_=o);return _},_chooseSplitAxis:function(n,t,e){var o=n.leaf?this.compareMinX:wC,s=n.leaf?this.compareMinY:SC,c=this._allDistMargin(n,t,e,o),h=this._allDistMargin(n,t,e,s);c<h&&n.children.sort(o)},_allDistMargin:function(n,t,e,o){n.children.sort(o);var s=this.toBBox,c=nh(n,0,t,s),h=nh(n,e-t,e,s),p=Bd(c)+Bd(h),g,m;for(g=t;g<e-t;g++)m=n.children[g],rh(c,n.leaf?s(m):m),p+=Bd(c);for(g=e-t-1;g>=t;g--)m=n.children[g],rh(h,n.leaf?s(m):m),p+=Bd(h);return p},_adjustParentBBoxes:function(n,t,e){for(var o=e;o>=0;o--)rh(t[o],n)},_condense:function(n){for(var t=n.length-1,e;t>=0;t--)n[t].children.length===0?t>0?(e=n[t-1].children,e.splice(e.indexOf(n[t]),1)):this.clear():Vc(n[t],this.toBBox)},_initFormat:function(n){var t=["return a"," - b",";"];this.compareMinX=new Function("a","b",t.join(n[0])),this.compareMinY=new Function("a","b",t.join(n[1])),this.toBBox=new Function("a","return {minX: a"+n[0]+", minY: a"+n[1]+", maxX: a"+n[2]+", maxY: a"+n[3]+"};")}};function D9(n,t,e){if(!e)return t.indexOf(n);for(var o=0;o<t.length;o++)if(e(n,t[o]))return o;return-1}function Vc(n,t){nh(n,0,n.children.length,t,n)}function nh(n,t,e,o,s){s||(s=Wc(null)),s.minX=1/0,s.minY=1/0,s.maxX=-1/0,s.maxY=-1/0;for(var c=t,h;c<e;c++)h=n.children[c],rh(s,n.leaf?o(h):h);return s}function rh(n,t){return n.minX=Math.min(n.minX,t.minX),n.minY=Math.min(n.minY,t.minY),n.maxX=Math.max(n.maxX,t.maxX),n.maxY=Math.max(n.maxY,t.maxY),n}function wC(n,t){return n.minX-t.minX}function SC(n,t){return n.minY-t.minY}function Lv(n){return(n.maxX-n.minX)*(n.maxY-n.minY)}function Bd(n){return n.maxX-n.minX+(n.maxY-n.minY)}function F9(n,t){return(Math.max(t.maxX,n.maxX)-Math.min(t.minX,n.minX))*(Math.max(t.maxY,n.maxY)-Math.min(t.minY,n.minY))}function U9(n,t){var e=Math.max(n.minX,t.minX),o=Math.max(n.minY,t.minY),s=Math.min(n.maxX,t.maxX),c=Math.min(n.maxY,t.maxY);return Math.max(0,s-e)*Math.max(0,c-o)}function Nv(n,t){return n.minX<=t.minX&&n.minY<=t.minY&&t.maxX<=n.maxX&&t.maxY<=n.maxY}function zd(n,t){return t.minX<=n.maxX&&t.minY<=n.maxY&&t.maxX>=n.minX&&t.maxY>=n.minY}function Wc(n){return{children:n,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function MC(n,t,e,o,s){for(var c=[t,e],h;c.length;)e=c.pop(),t=c.pop(),!(e-t<=o)&&(h=t+Math.ceil((e-t)/o/2)*o,O9(n,h,t,e,s),c.push(t,h,h,e))}});var IC=lt((vrt,kv)=>{"use strict";kv.exports=Hd;kv.exports.default=Hd;function Hd(n,t,e){e=e||2;var o=t&&t.length,s=o?t[0]*e:n.length,c=TC(n,0,s,e,!0),h=[];if(!c||c.next===c.prev)return h;var p,g,m,_,E,x,b;if(o&&(c=Y9(n,t,c,e)),n.length>80*e){p=m=n[0],g=_=n[1];for(var P=e;P<s;P+=e)E=n[P],x=n[P+1],E<p&&(p=E),x<g&&(g=x),E>m&&(m=E),x>_&&(_=x);b=Math.max(m-p,_-g),b=b!==0?32767/b:0}return ah(c,h,e,p,g,b,0),h}function TC(n,t,e,o,s){var c,h;if(s===Gv(n,t,e,o)>0)for(c=t;c<e;c+=o)h=AC(c,n[c],n[c+1],h);else for(c=e-o;c>=t;c-=o)h=AC(c,n[c],n[c+1],h);return h&&Vd(h,h.next)&&(lh(h),h=h.next),h}function Dl(n,t){if(!n)return n;t||(t=n);var e=n,o;do if(o=!1,!e.steiner&&(Vd(e,e.next)||qr(e.prev,e,e.next)===0)){if(lh(e),e=t=e.prev,e===e.next)break;o=!0}else e=e.next;while(o||e!==t);return t}function ah(n,t,e,o,s,c,h){if(n){!h&&c&&j9(n,o,s,c);for(var p=n,g,m;n.prev!==n.next;){if(g=n.prev,m=n.next,c?V9(n,o,s,c):H9(n)){t.push(g.i/e|0),t.push(n.i/e|0),t.push(m.i/e|0),lh(n),n=m.next,p=m.next;continue}if(n=m,n===p){h?h===1?(n=W9(Dl(n),t,e),ah(n,t,e,o,s,c,2)):h===2&&X9(n,t,e,o,s,c):ah(Dl(n),t,e,o,s,c,1);break}}}}function H9(n){var t=n.prev,e=n,o=n.next;if(qr(t,e,o)>=0)return!1;for(var s=t.x,c=e.x,h=o.x,p=t.y,g=e.y,m=o.y,_=s<c?s<h?s:h:c<h?c:h,E=p<g?p<m?p:m:g<m?g:m,x=s>c?s>h?s:h:c>h?c:h,b=p>g?p>m?p:m:g>m?g:m,P=o.next;P!==t;){if(P.x>=_&&P.x<=x&&P.y>=E&&P.y<=b&&$c(s,p,c,g,h,m,P.x,P.y)&&qr(P.prev,P,P.next)>=0)return!1;P=P.next}return!0}function V9(n,t,e,o){var s=n.prev,c=n,h=n.next;if(qr(s,c,h)>=0)return!1;for(var p=s.x,g=c.x,m=h.x,_=s.y,E=c.y,x=h.y,b=p<g?p<m?p:m:g<m?g:m,P=_<E?_<x?_:x:E<x?E:x,I=p>g?p>m?p:m:g>m?g:m,S=_>E?_>x?_:x:E>x?E:x,w=Bv(b,P,t,e,o),R=Bv(I,S,t,e,o),T=n.prevZ,F=n.nextZ;T&&T.z>=w&&F&&F.z<=R;){if(T.x>=b&&T.x<=I&&T.y>=P&&T.y<=S&&T!==s&&T!==h&&$c(p,_,g,E,m,x,T.x,T.y)&&qr(T.prev,T,T.next)>=0||(T=T.prevZ,F.x>=b&&F.x<=I&&F.y>=P&&F.y<=S&&F!==s&&F!==h&&$c(p,_,g,E,m,x,F.x,F.y)&&qr(F.prev,F,F.next)>=0))return!1;F=F.nextZ}for(;T&&T.z>=w;){if(T.x>=b&&T.x<=I&&T.y>=P&&T.y<=S&&T!==s&&T!==h&&$c(p,_,g,E,m,x,T.x,T.y)&&qr(T.prev,T,T.next)>=0)return!1;T=T.prevZ}for(;F&&F.z<=R;){if(F.x>=b&&F.x<=I&&F.y>=P&&F.y<=S&&F!==s&&F!==h&&$c(p,_,g,E,m,x,F.x,F.y)&&qr(F.prev,F,F.next)>=0)return!1;F=F.nextZ}return!0}function W9(n,t,e){var o=n;do{var s=o.prev,c=o.next.next;!Vd(s,c)&&CC(s,o,o.next,c)&&uh(s,c)&&uh(c,s)&&(t.push(s.i/e|0),t.push(o.i/e|0),t.push(c.i/e|0),lh(o),lh(o.next),o=n=c),o=o.next}while(o!==n);return Dl(o)}function X9(n,t,e,o,s,c){var h=n;do{for(var p=h.next.next;p!==h.prev;){if(h.i!==p.i&&eX(h,p)){var g=PC(h,p);h=Dl(h,h.next),g=Dl(g,g.next),ah(h,t,e,o,s,c,0),ah(g,t,e,o,s,c,0);return}p=p.next}h=h.next}while(h!==n)}function Y9(n,t,e,o){var s=[],c,h,p,g,m;for(c=0,h=t.length;c<h;c++)p=t[c]*o,g=c<h-1?t[c+1]*o:n.length,m=TC(n,p,g,o,!1),m===m.next&&(m.steiner=!0),s.push(tX(m));for(s.sort($9),c=0;c<s.length;c++)e=Z9(s[c],e);return e}function $9(n,t){return n.x-t.x}function Z9(n,t){var e=J9(n,t);if(!e)return t;var o=PC(e,n);return Dl(o,o.next),Dl(e,e.next)}function J9(n,t){var e=t,o=n.x,s=n.y,c=-1/0,h;do{if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){var p=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(p<=o&&p>c&&(c=p,h=e.x<e.next.x?e:e.next,p===o))return h}e=e.next}while(e!==t);if(!h)return null;var g=h,m=h.x,_=h.y,E=1/0,x;e=h;do o>=e.x&&e.x>=m&&o!==e.x&&$c(s<_?o:c,s,m,_,s<_?c:o,s,e.x,e.y)&&(x=Math.abs(s-e.y)/(o-e.x),uh(e,n)&&(x<E||x===E&&(e.x>h.x||e.x===h.x&&K9(h,e)))&&(h=e,E=x)),e=e.next;while(e!==g);return h}function K9(n,t){return qr(n.prev,n,t.prev)<0&&qr(t.next,n,n.next)<0}function j9(n,t,e,o){var s=n;do s.z===0&&(s.z=Bv(s.x,s.y,t,e,o)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==n);s.prevZ.nextZ=null,s.prevZ=null,Q9(s)}function Q9(n){var t,e,o,s,c,h,p,g,m=1;do{for(e=n,n=null,c=null,h=0;e;){for(h++,o=e,p=0,t=0;t<m&&(p++,o=o.nextZ,!!o);t++);for(g=m;p>0||g>0&&o;)p!==0&&(g===0||!o||e.z<=o.z)?(s=e,e=e.nextZ,p--):(s=o,o=o.nextZ,g--),c?c.nextZ=s:n=s,s.prevZ=c,c=s;e=o}c.nextZ=null,m*=2}while(h>1);return n}function Bv(n,t,e,o,s){return n=(n-e)*s|0,t=(t-o)*s|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,n|t<<1}function tX(n){var t=n,e=n;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==n);return e}function $c(n,t,e,o,s,c,h,p){return(s-h)*(t-p)>=(n-h)*(c-p)&&(n-h)*(o-p)>=(e-h)*(t-p)&&(e-h)*(c-p)>=(s-h)*(o-p)}function eX(n,t){return n.next.i!==t.i&&n.prev.i!==t.i&&!nX(n,t)&&(uh(n,t)&&uh(t,n)&&rX(n,t)&&(qr(n.prev,n,t.prev)||qr(n,t.prev,t))||Vd(n,t)&&qr(n.prev,n,n.next)>0&&qr(t.prev,t,t.next)>0)}function qr(n,t,e){return(t.y-n.y)*(e.x-t.x)-(t.x-n.x)*(e.y-t.y)}function Vd(n,t){return n.x===t.x&&n.y===t.y}function CC(n,t,e,o){var s=qd(qr(n,t,e)),c=qd(qr(n,t,o)),h=qd(qr(e,o,n)),p=qd(qr(e,o,t));return!!(s!==c&&h!==p||s===0&&kd(n,e,t)||c===0&&kd(n,o,t)||h===0&&kd(e,n,o)||p===0&&kd(e,t,o))}function kd(n,t,e){return t.x<=Math.max(n.x,e.x)&&t.x>=Math.min(n.x,e.x)&&t.y<=Math.max(n.y,e.y)&&t.y>=Math.min(n.y,e.y)}function qd(n){return n>0?1:n<0?-1:0}function nX(n,t){var e=n;do{if(e.i!==n.i&&e.next.i!==n.i&&e.i!==t.i&&e.next.i!==t.i&&CC(e,e.next,n,t))return!0;e=e.next}while(e!==n);return!1}function uh(n,t){return qr(n.prev,n,n.next)<0?qr(n,t,n.next)>=0&&qr(n,n.prev,t)>=0:qr(n,t,n.prev)<0||qr(n,n.next,t)<0}function rX(n,t){var e=n,o=!1,s=(n.x+t.x)/2,c=(n.y+t.y)/2;do e.y>c!=e.next.y>c&&e.next.y!==e.y&&s<(e.next.x-e.x)*(c-e.y)/(e.next.y-e.y)+e.x&&(o=!o),e=e.next;while(e!==n);return o}function PC(n,t){var e=new zv(n.i,n.x,n.y),o=new zv(t.i,t.x,t.y),s=n.next,c=t.prev;return n.next=t,t.prev=n,e.next=s,s.prev=e,o.next=e,e.prev=o,c.next=o,o.prev=c,o}function AC(n,t,e,o){var s=new zv(n,t,e);return o?(s.next=o.next,s.prev=o,o.next.prev=s,o.next=s):(s.prev=s,s.next=s),s}function lh(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function zv(n,t,e){this.i=n,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Hd.deviation=function(n,t,e,o){var s=t&&t.length,c=s?t[0]*e:n.length,h=Math.abs(Gv(n,0,c,e));if(s)for(var p=0,g=t.length;p<g;p++){var m=t[p]*e,_=p<g-1?t[p+1]*e:n.length;h-=Math.abs(Gv(n,m,_,e))}var E=0;for(p=0;p<o.length;p+=3){var x=o[p]*e,b=o[p+1]*e,P=o[p+2]*e;E+=Math.abs((n[x]-n[P])*(n[b+1]-n[x+1])-(n[x]-n[b])*(n[P+1]-n[x+1]))}return h===0&&E===0?0:Math.abs((E-h)/h)};function Gv(n,t,e,o){for(var s=0,c=t,h=e-o;c<e;c+=o)s+=(n[h]-n[c])*(n[c+1]+n[h+1]),h=c;return s}Hd.flatten=function(n){for(var t=n[0][0].length,e={vertices:[],holes:[],dimensions:t},o=0,s=0;s<n.length;s++){for(var c=0;c<n[s].length;c++)for(var h=0;h<t;h++)e.vertices.push(n[s][c][h]);s>0&&(o+=n[s-1].length,e.holes.push(o))}return e}});var Xv=lt(Oe=>{"use strict";Object.defineProperty(Oe,"__esModule",{value:!0});Oe.earthRadius=63710088e-1;Oe.factors={centimeters:Oe.earthRadius*100,centimetres:Oe.earthRadius*100,degrees:Oe.earthRadius/111325,feet:Oe.earthRadius*3.28084,inches:Oe.earthRadius*39.37,kilometers:Oe.earthRadius/1e3,kilometres:Oe.earthRadius/1e3,meters:Oe.earthRadius,metres:Oe.earthRadius,miles:Oe.earthRadius/1609.344,millimeters:Oe.earthRadius*1e3,millimetres:Oe.earthRadius*1e3,nauticalmiles:Oe.earthRadius/1852,radians:1,yards:Oe.earthRadius*1.0936};Oe.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/Oe.earthRadius,yards:1.0936133};Oe.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function Ku(n,t,e){e===void 0&&(e={});var o={type:"Feature"};return(e.id===0||e.id)&&(o.id=e.id),e.bbox&&(o.bbox=e.bbox),o.properties=t||{},o.geometry=n,o}Oe.feature=Ku;function oX(n,t,e){switch(e===void 0&&(e={}),n){case"Point":return qv(t).geometry;case"LineString":return Vv(t).geometry;case"Polygon":return Hv(t).geometry;case"MultiPoint":return LC(t).geometry;case"MultiLineString":return RC(t).geometry;case"MultiPolygon":return NC(t).geometry;default:throw new Error(n+" is invalid")}}Oe.geometry=oX;function qv(n,t,e){if(e===void 0&&(e={}),!n)throw new Error("coordinates is required");if(!Array.isArray(n))throw new Error("coordinates must be an Array");if(n.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Wd(n[0])||!Wd(n[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:n};return Ku(o,t,e)}Oe.point=qv;function sX(n,t,e){return e===void 0&&(e={}),Xd(n.map(function(o){return qv(o,t)}),e)}Oe.points=sX;function Hv(n,t,e){e===void 0&&(e={});for(var o=0,s=n;o<s.length;o++){var c=s[o];if(c.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var h=0;h<c[c.length-1].length;h++)if(c[c.length-1][h]!==c[0][h])throw new Error("First and last Position are not equivalent.")}var p={type:"Polygon",coordinates:n};return Ku(p,t,e)}Oe.polygon=Hv;function aX(n,t,e){return e===void 0&&(e={}),Xd(n.map(function(o){return Hv(o,t)}),e)}Oe.polygons=aX;function Vv(n,t,e){if(e===void 0&&(e={}),n.length<2)throw new Error("coordinates must be an array of two or more positions");var o={type:"LineString",coordinates:n};return Ku(o,t,e)}Oe.lineString=Vv;function uX(n,t,e){return e===void 0&&(e={}),Xd(n.map(function(o){return Vv(o,t)}),e)}Oe.lineStrings=uX;function Xd(n,t){t===void 0&&(t={});var e={type:"FeatureCollection"};return t.id&&(e.id=t.id),t.bbox&&(e.bbox=t.bbox),e.features=n,e}Oe.featureCollection=Xd;function RC(n,t,e){e===void 0&&(e={});var o={type:"MultiLineString",coordinates:n};return Ku(o,t,e)}Oe.multiLineString=RC;function LC(n,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:n};return Ku(o,t,e)}Oe.multiPoint=LC;function NC(n,t,e){e===void 0&&(e={});var o={type:"MultiPolygon",coordinates:n};return Ku(o,t,e)}Oe.multiPolygon=NC;function lX(n,t,e){e===void 0&&(e={});var o={type:"GeometryCollection",geometries:n};return Ku(o,t,e)}Oe.geometryCollection=lX;function cX(n,t){if(t===void 0&&(t=0),t&&!(t>=0))throw new Error("precision must be a positive number");var e=Math.pow(10,t||0);return Math.round(n*e)/e}Oe.round=cX;function OC(n,t){t===void 0&&(t="kilometers");var e=Oe.factors[t];if(!e)throw new Error(t+" units is invalid");return n*e}Oe.radiansToLength=OC;function Wv(n,t){t===void 0&&(t="kilometers");var e=Oe.factors[t];if(!e)throw new Error(t+" units is invalid");return n/e}Oe.lengthToRadians=Wv;function fX(n,t){return DC(Wv(n,t))}Oe.lengthToDegrees=fX;function hX(n){var t=n%360;return t<0&&(t+=360),t}Oe.bearingToAzimuth=hX;function DC(n){var t=n%(2*Math.PI);return t*180/Math.PI}Oe.radiansToDegrees=DC;function pX(n){var t=n%360;return t*Math.PI/180}Oe.degreesToRadians=pX;function dX(n,t,e){if(t===void 0&&(t="kilometers"),e===void 0&&(e="kilometers"),!(n>=0))throw new Error("length must be a positive number");return OC(Wv(n,t),e)}Oe.convertLength=dX;function gX(n,t,e){if(t===void 0&&(t="meters"),e===void 0&&(e="kilometers"),!(n>=0))throw new Error("area must be a positive number");var o=Oe.areaFactors[t];if(!o)throw new Error("invalid original units");var s=Oe.areaFactors[e];if(!s)throw new Error("invalid final units");return n/o*s}Oe.convertArea=gX;function Wd(n){return!isNaN(n)&&n!==null&&!Array.isArray(n)}Oe.isNumber=Wd;function mX(n){return!!n&&n.constructor===Object}Oe.isObject=mX;function yX(n){if(!n)throw new Error("bbox is required");if(!Array.isArray(n))throw new Error("bbox must be an Array");if(n.length!==4&&n.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");n.forEach(function(t){if(!Wd(t))throw new Error("bbox must only contain numbers")})}Oe.validateBBox=yX;function vX(n){if(!n)throw new Error("id is required");if(["string","number"].indexOf(typeof n)===-1)throw new Error("id must be a number or a string")}Oe.validateId=vX});var $v=lt(Ei=>{"use strict";Object.defineProperty(Ei,"__esModule",{value:!0});var lo=Xv();function ch(n,t,e){if(n!==null)for(var o,s,c,h,p,g,m,_=0,E=0,x,b=n.type,P=b==="FeatureCollection",I=b==="Feature",S=P?n.features.length:1,w=0;w<S;w++){m=P?n.features[w].geometry:I?n.geometry:n,x=m?m.type==="GeometryCollection":!1,p=x?m.geometries.length:1;for(var R=0;R<p;R++){var T=0,F=0;if(h=x?m.geometries[R]:m,h!==null){g=h.coordinates;var W=h.type;switch(_=e&&(W==="Polygon"||W==="MultiPolygon")?1:0,W){case null:break;case"Point":if(t(g,E,w,T,F)===!1)return!1;E++,T++;break;case"LineString":case"MultiPoint":for(o=0;o<g.length;o++){if(t(g[o],E,w,T,F)===!1)return!1;E++,W==="MultiPoint"&&T++}W==="LineString"&&T++;break;case"Polygon":case"MultiLineString":for(o=0;o<g.length;o++){for(s=0;s<g[o].length-_;s++){if(t(g[o][s],E,w,T,F)===!1)return!1;E++}W==="MultiLineString"&&T++,W==="Polygon"&&F++}W==="Polygon"&&T++;break;case"MultiPolygon":for(o=0;o<g.length;o++){for(F=0,s=0;s<g[o].length;s++){for(c=0;c<g[o][s].length-_;c++){if(t(g[o][s][c],E,w,T,F)===!1)return!1;E++}F++}T++}break;case"GeometryCollection":for(o=0;o<h.geometries.length;o++)if(ch(h.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function _X(n,t,e,o){var s=e;return ch(n,function(c,h,p,g,m){h===0&&e===void 0?s=c:s=t(s,c,h,p,g,m)},o),s}function FC(n,t){var e;switch(n.type){case"FeatureCollection":for(e=0;e<n.features.length&&t(n.features[e].properties,e)!==!1;e++);break;case"Feature":t(n.properties,0);break}}function xX(n,t,e){var o=e;return FC(n,function(s,c){c===0&&e===void 0?o=s:o=t(o,s,c)}),o}function UC(n,t){if(n.type==="Feature")t(n,0);else if(n.type==="FeatureCollection")for(var e=0;e<n.features.length&&t(n.features[e],e)!==!1;e++);}function EX(n,t,e){var o=e;return UC(n,function(s,c){c===0&&e===void 0?o=s:o=t(o,s,c)}),o}function wX(n){var t=[];return ch(n,function(e){t.push(e)}),t}function Yv(n,t){var e,o,s,c,h,p,g,m,_,E,x=0,b=n.type==="FeatureCollection",P=n.type==="Feature",I=b?n.features.length:1;for(e=0;e<I;e++){for(p=b?n.features[e].geometry:P?n.geometry:n,m=b?n.features[e].properties:P?n.properties:{},_=b?n.features[e].bbox:P?n.bbox:void 0,E=b?n.features[e].id:P?n.id:void 0,g=p?p.type==="GeometryCollection":!1,h=g?p.geometries.length:1,s=0;s<h;s++){if(c=g?p.geometries[s]:p,c===null){if(t(null,x,m,_,E)===!1)return!1;continue}switch(c.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(c,x,m,_,E)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<c.geometries.length;o++)if(t(c.geometries[o],x,m,_,E)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}x++}}function SX(n,t,e){var o=e;return Yv(n,function(s,c,h,p,g){c===0&&e===void 0?o=s:o=t(o,s,c,h,p,g)}),o}function Yd(n,t){Yv(n,function(e,o,s,c,h){var p=e===null?null:e.type;switch(p){case null:case"Point":case"LineString":case"Polygon":return t(lo.feature(e,s,{bbox:c,id:h}),o,0)===!1?!1:void 0}var g;switch(p){case"MultiPoint":g="Point";break;case"MultiLineString":g="LineString";break;case"MultiPolygon":g="Polygon";break}for(var m=0;m<e.coordinates.length;m++){var _=e.coordinates[m],E={type:g,coordinates:_};if(t(lo.feature(E,s),o,m)===!1)return!1}})}function MX(n,t,e){var o=e;return Yd(n,function(s,c,h){c===0&&h===0&&e===void 0?o=s:o=t(o,s,c,h)}),o}function BC(n,t){Yd(n,function(e,o,s){var c=0;if(e.geometry){var h=e.geometry.type;if(!(h==="Point"||h==="MultiPoint")){var p,g=0,m=0,_=0;if(ch(e,function(E,x,b,P,I){if(p===void 0||o>g||P>m||I>_){p=E,g=o,m=P,_=I,c=0;return}var S=lo.lineString([p,E],e.properties);if(t(S,o,s,I,c)===!1)return!1;c++,p=E})===!1)return!1}}})}function bX(n,t,e){var o=e,s=!1;return BC(n,function(c,h,p,g,m){s===!1&&e===void 0?o=c:o=t(o,c,h,p,g,m),s=!0}),o}function zC(n,t){if(!n)throw new Error("geojson is required");Yd(n,function(e,o,s){if(e.geometry!==null){var c=e.geometry.type,h=e.geometry.coordinates;switch(c){case"LineString":if(t(e,o,s,0,0)===!1)return!1;break;case"Polygon":for(var p=0;p<h.length;p++)if(t(lo.lineString(h[p],e.properties),o,s,p)===!1)return!1;break}}})}function AX(n,t,e){var o=e;return zC(n,function(s,c,h,p){c===0&&e===void 0?o=s:o=t(o,s,c,h,p)}),o}function TX(n,t){if(t=t||{},!lo.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,s=t.geometryIndex||0,c=t.segmentIndex||0,h=t.properties,p;switch(n.type){case"FeatureCollection":e<0&&(e=n.features.length+e),h=h||n.features[e].properties,p=n.features[e].geometry;break;case"Feature":h=h||n.properties,p=n.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":p=n;break;default:throw new Error("geojson is invalid")}if(p===null)return null;var g=p.coordinates;switch(p.type){case"Point":case"MultiPoint":return null;case"LineString":return c<0&&(c=g.length+c-1),lo.lineString([g[c],g[c+1]],h,t);case"Polygon":return s<0&&(s=g.length+s),c<0&&(c=g[s].length+c-1),lo.lineString([g[s][c],g[s][c+1]],h,t);case"MultiLineString":return o<0&&(o=g.length+o),c<0&&(c=g[o].length+c-1),lo.lineString([g[o][c],g[o][c+1]],h,t);case"MultiPolygon":return o<0&&(o=g.length+o),s<0&&(s=g[o].length+s),c<0&&(c=g[o][s].length-c-1),lo.lineString([g[o][s][c],g[o][s][c+1]],h,t)}throw new Error("geojson is invalid")}function CX(n,t){if(t=t||{},!lo.isObject(t))throw new Error("options is invalid");var e=t.featureIndex||0,o=t.multiFeatureIndex||0,s=t.geometryIndex||0,c=t.coordIndex||0,h=t.properties,p;switch(n.type){case"FeatureCollection":e<0&&(e=n.features.length+e),h=h||n.features[e].properties,p=n.features[e].geometry;break;case"Feature":h=h||n.properties,p=n.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":p=n;break;default:throw new Error("geojson is invalid")}if(p===null)return null;var g=p.coordinates;switch(p.type){case"Point":return lo.point(g,h,t);case"MultiPoint":return o<0&&(o=g.length+o),lo.point(g[o],h,t);case"LineString":return c<0&&(c=g.length+c),lo.point(g[c],h,t);case"Polygon":return s<0&&(s=g.length+s),c<0&&(c=g[s].length+c),lo.point(g[s][c],h,t);case"MultiLineString":return o<0&&(o=g.length+o),c<0&&(c=g[o].length+c),lo.point(g[o][c],h,t);case"MultiPolygon":return o<0&&(o=g.length+o),s<0&&(s=g[o].length+s),c<0&&(c=g[o][s].length-c),lo.point(g[o][s][c],h,t)}throw new Error("geojson is invalid")}Ei.coordAll=wX;Ei.coordEach=ch;Ei.coordReduce=_X;Ei.featureEach=UC;Ei.featureReduce=EX;Ei.findPoint=CX;Ei.findSegment=TX;Ei.flattenEach=Yd;Ei.flattenReduce=MX;Ei.geomEach=Yv;Ei.geomReduce=SX;Ei.lineEach=zC;Ei.lineReduce=AX;Ei.propEach=FC;Ei.propReduce=xX;Ei.segmentEach=BC;Ei.segmentReduce=bX});var GC=lt(Jv=>{"use strict";Object.defineProperty(Jv,"__esModule",{value:!0});var PX=$v();function Zv(n){var t=[1/0,1/0,-1/0,-1/0];return PX.coordEach(n,function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]<e[0]&&(t[2]=e[0]),t[3]<e[1]&&(t[3]=e[1])}),t}Zv.default=Zv;Jv.default=Zv});var $d=lt((Ort,Kv)=>{var Ia=wv(),qC=Xv(),HC=$v(),Zc=GC().default,IX=HC.featureEach,Lrt=HC.coordEach,Nrt=qC.polygon,kC=qC.featureCollection;function VC(n){var t=new Ia(n);return t.insert=function(e){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:Zc(e),Ia.prototype.insert.call(this,e)},t.load=function(e){var o=[];return Array.isArray(e)?e.forEach(function(s){if(s.type!=="Feature")throw new Error("invalid features");s.bbox=s.bbox?s.bbox:Zc(s),o.push(s)}):IX(e,function(s){if(s.type!=="Feature")throw new Error("invalid features");s.bbox=s.bbox?s.bbox:Zc(s),o.push(s)}),Ia.prototype.load.call(this,o)},t.remove=function(e,o){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:Zc(e),Ia.prototype.remove.call(this,e,o)},t.clear=function(){return Ia.prototype.clear.call(this)},t.search=function(e){var o=Ia.prototype.search.call(this,this.toBBox(e));return kC(o)},t.collides=function(e){return Ia.prototype.collides.call(this,this.toBBox(e))},t.all=function(){var e=Ia.prototype.all.call(this);return kC(e)},t.toJSON=function(){return Ia.prototype.toJSON.call(this)},t.fromJSON=function(e){return Ia.prototype.fromJSON.call(this,e)},t.toBBox=function(e){var o;if(e.bbox)o=e.bbox;else if(Array.isArray(e)&&e.length===4)o=e;else if(Array.isArray(e)&&e.length===6)o=[e[0],e[1],e[3],e[4]];else if(e.type==="Feature")o=Zc(e);else if(e.type==="FeatureCollection")o=Zc(e);else throw new Error("invalid geojson");return{minX:o[0],minY:o[1],maxX:o[2],maxY:o[3]}},t}Kv.exports=VC;Kv.exports.default=VC});var r_=lt((Hot,tP)=>{"use strict";var QC=Object.prototype.toString;tP.exports=function(t){var e=QC.call(t),o=e==="[object Arguments]";return o||(o=e!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&QC.call(t.callee)==="[object Function]"),o}});var lP=lt((Vot,uP)=>{"use strict";var aP;Object.keys||(ph=Object.prototype.hasOwnProperty,i_=Object.prototype.toString,eP=r_(),o_=Object.prototype.propertyIsEnumerable,nP=!o_.call({toString:null},"toString"),rP=o_.call(function(){},"prototype"),dh=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],Qd=function(n){var t=n.constructor;return t&&t.prototype===n},iP={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},oP=function(){if(typeof window=="undefined")return!1;for(var n in window)try{if(!iP["$"+n]&&ph.call(window,n)&&window[n]!==null&&typeof window[n]=="object")try{Qd(window[n])}catch(t){return!0}}catch(t){return!0}return!1}(),sP=function(n){if(typeof window=="undefined"||!oP)return Qd(n);try{return Qd(n)}catch(t){return!1}},aP=function(t){var e=t!==null&&typeof t=="object",o=i_.call(t)==="[object Function]",s=eP(t),c=e&&i_.call(t)==="[object String]",h=[];if(!e&&!o&&!s)throw new TypeError("Object.keys called on a non-object");var p=rP&&o;if(c&&t.length>0&&!ph.call(t,0))for(var g=0;g<t.length;++g)h.push(String(g));if(s&&t.length>0)for(var m=0;m<t.length;++m)h.push(String(m));else for(var _ in t)!(p&&_==="prototype")&&ph.call(t,_)&&h.push(String(_));if(nP)for(var E=sP(t),x=0;x<dh.length;++x)!(E&&dh[x]==="constructor")&&ph.call(t,dh[x])&&h.push(dh[x]);return h});var ph,i_,eP,o_,nP,rP,dh,Qd,iP,oP,sP;uP.exports=aP});var s_=lt((Wot,hP)=>{"use strict";var GX=Array.prototype.slice,kX=r_(),cP=Object.keys,tg=cP?function(t){return cP(t)}:lP(),fP=Object.keys;tg.shim=function(){if(Object.keys){var t=function(){var e=Object.keys(arguments);return e&&e.length===arguments.length}(1,2);t||(Object.keys=function(o){return kX(o)?fP(GX.call(o)):fP(o)})}else Object.keys=tg;return Object.keys||tg};hP.exports=tg});var a_=lt((Xot,pP)=>{"use strict";pP.exports=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var t={},e=Symbol("test"),o=Object(e);if(typeof e=="string"||Object.prototype.toString.call(e)!=="[object Symbol]"||Object.prototype.toString.call(o)!=="[object Symbol]")return!1;var s=42;t[e]=s;for(e in t)return!1;if(typeof Object.keys=="function"&&Object.keys(t).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(t).length!==0)return!1;var c=Object.getOwnPropertySymbols(t);if(c.length!==1||c[0]!==e||!Object.prototype.propertyIsEnumerable.call(t,e))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var h=Object.getOwnPropertyDescriptor(t,e);if(h.value!==s||h.enumerable!==!0)return!1}return!0}});var eg=lt((Yot,dP)=>{"use strict";var qX=a_();dP.exports=function(){return qX()&&!!Symbol.toStringTag}});var mP=lt(($ot,gP)=>{"use strict";gP.exports=Error});var vP=lt((Zot,yP)=>{"use strict";yP.exports=EvalError});var xP=lt((Jot,_P)=>{"use strict";_P.exports=RangeError});var wP=lt((Kot,EP)=>{"use strict";EP.exports=ReferenceError});var u_=lt((jot,SP)=>{"use strict";SP.exports=SyntaxError});var Fl=lt((Qot,MP)=>{"use strict";MP.exports=TypeError});var AP=lt((tst,bP)=>{"use strict";bP.exports=URIError});var PP=lt((est,CP)=>{"use strict";var TP=typeof Symbol!="undefined"&&Symbol,HX=a_();CP.exports=function(){return typeof TP!="function"||typeof Symbol!="function"||typeof TP("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:HX()}});var RP=lt((nst,IP)=>{"use strict";var l_={__proto__:null,foo:{}},VX=Object;IP.exports=function(){return{__proto__:l_}.foo===l_.foo&&!(l_ instanceof VX)}});var OP=lt((rst,NP)=>{"use strict";var WX="Function.prototype.bind called on incompatible ",XX=Object.prototype.toString,YX=Math.max,$X="[object Function]",LP=function(t,e){for(var o=[],s=0;s<t.length;s+=1)o[s]=t[s];for(var c=0;c<e.length;c+=1)o[c+t.length]=e[c];return o},ZX=function(t,e){for(var o=[],s=e||0,c=0;s<t.length;s+=1,c+=1)o[c]=t[s];return o},JX=function(n,t){for(var e="",o=0;o<n.length;o+=1)e+=n[o],o+1<n.length&&(e+=t);return e};NP.exports=function(t){var e=this;if(typeof e!="function"||XX.apply(e)!==$X)throw new TypeError(WX+e);for(var o=ZX(arguments,1),s,c=function(){if(this instanceof s){var _=e.apply(this,LP(o,arguments));return Object(_)===_?_:this}return e.apply(t,LP(o,arguments))},h=YX(0,e.length-o.length),p=[],g=0;g<h;g++)p[g]="$"+g;if(s=Function("binder","return function ("+JX(p,",")+"){ return binder.apply(this,arguments); }")(c),e.prototype){var m=function(){};m.prototype=e.prototype,s.prototype=new m,m.prototype=null}return s}});var ng=lt((ist,DP)=>{"use strict";var KX=OP();DP.exports=Function.prototype.bind||KX});var UP=lt((ost,FP)=>{"use strict";var jX=Function.prototype.call,QX=Object.prototype.hasOwnProperty,t7=ng();FP.exports=t7.call(jX,QX)});var tf=lt((sst,qP)=>{"use strict";var Hn,e7=mP(),n7=vP(),r7=xP(),i7=wP(),Qc=u_(),jc=Fl(),o7=AP(),kP=Function,c_=function(n){try{return kP('"use strict"; return ('+n+").constructor;")()}catch(t){}},Ul=Object.getOwnPropertyDescriptor;if(Ul)try{Ul({},"")}catch(n){Ul=null}var f_=function(){throw new jc},s7=Ul?function(){try{return arguments.callee,f_}catch(n){try{return Ul(arguments,"callee").get}catch(t){return f_}}}():f_,Jc=PP()(),a7=RP()(),ki=Object.getPrototypeOf||(a7?function(n){return n.__proto__}:null),Kc={},u7=typeof Uint8Array=="undefined"||!ki?Hn:ki(Uint8Array),Bl={__proto__:null,"%AggregateError%":typeof AggregateError=="undefined"?Hn:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer=="undefined"?Hn:ArrayBuffer,"%ArrayIteratorPrototype%":Jc&&ki?ki([][Symbol.iterator]()):Hn,"%AsyncFromSyncIteratorPrototype%":Hn,"%AsyncFunction%":Kc,"%AsyncGenerator%":Kc,"%AsyncGeneratorFunction%":Kc,"%AsyncIteratorPrototype%":Kc,"%Atomics%":typeof Atomics=="undefined"?Hn:Atomics,"%BigInt%":typeof BigInt=="undefined"?Hn:BigInt,"%BigInt64Array%":typeof BigInt64Array=="undefined"?Hn:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array=="undefined"?Hn:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView=="undefined"?Hn:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":e7,"%eval%":eval,"%EvalError%":n7,"%Float32Array%":typeof Float32Array=="undefined"?Hn:Float32Array,"%Float64Array%":typeof Float64Array=="undefined"?Hn:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry=="undefined"?Hn:FinalizationRegistry,"%Function%":kP,"%GeneratorFunction%":Kc,"%Int8Array%":typeof Int8Array=="undefined"?Hn:Int8Array,"%Int16Array%":typeof Int16Array=="undefined"?Hn:Int16Array,"%Int32Array%":typeof Int32Array=="undefined"?Hn:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Jc&&ki?ki(ki([][Symbol.iterator]())):Hn,"%JSON%":typeof JSON=="object"?JSON:Hn,"%Map%":typeof Map=="undefined"?Hn:Map,"%MapIteratorPrototype%":typeof Map=="undefined"||!Jc||!ki?Hn:ki(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise=="undefined"?Hn:Promise,"%Proxy%":typeof Proxy=="undefined"?Hn:Proxy,"%RangeError%":r7,"%ReferenceError%":i7,"%Reflect%":typeof Reflect=="undefined"?Hn:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set=="undefined"?Hn:Set,"%SetIteratorPrototype%":typeof Set=="undefined"||!Jc||!ki?Hn:ki(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer=="undefined"?Hn:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Jc&&ki?ki(""[Symbol.iterator]()):Hn,"%Symbol%":Jc?Symbol:Hn,"%SyntaxError%":Qc,"%ThrowTypeError%":s7,"%TypedArray%":u7,"%TypeError%":jc,"%Uint8Array%":typeof Uint8Array=="undefined"?Hn:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray=="undefined"?Hn:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array=="undefined"?Hn:Uint16Array,"%Uint32Array%":typeof Uint32Array=="undefined"?Hn:Uint32Array,"%URIError%":o7,"%WeakMap%":typeof WeakMap=="undefined"?Hn:WeakMap,"%WeakRef%":typeof WeakRef=="undefined"?Hn:WeakRef,"%WeakSet%":typeof WeakSet=="undefined"?Hn:WeakSet};if(ki)try{null.error}catch(n){BP=ki(ki(n)),Bl["%Error.prototype%"]=BP}var BP,l7=function n(t){var e;if(t==="%AsyncFunction%")e=c_("async function () {}");else if(t==="%GeneratorFunction%")e=c_("function* () {}");else if(t==="%AsyncGeneratorFunction%")e=c_("async function* () {}");else if(t==="%AsyncGenerator%"){var o=n("%AsyncGeneratorFunction%");o&&(e=o.prototype)}else if(t==="%AsyncIteratorPrototype%"){var s=n("%AsyncGenerator%");s&&ki&&(e=ki(s.prototype))}return Bl[t]=e,e},zP={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},gh=ng(),rg=UP(),c7=gh.call(Function.call,Array.prototype.concat),f7=gh.call(Function.apply,Array.prototype.splice),GP=gh.call(Function.call,String.prototype.replace),ig=gh.call(Function.call,String.prototype.slice),h7=gh.call(Function.call,RegExp.prototype.exec),p7=/[^%.[\\]]+|\\[(?:(-?\\d+(?:\\.\\d+)?)|(["'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2)\\]|(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|%$))/g,d7=/\\\\(\\\\)?/g,g7=function(t){var e=ig(t,0,1),o=ig(t,-1);if(e==="%"&&o!=="%")throw new Qc("invalid intrinsic syntax, expected closing \`%\`");if(o==="%"&&e!=="%")throw new Qc("invalid intrinsic syntax, expected opening \`%\`");var s=[];return GP(t,p7,function(c,h,p,g){s[s.length]=p?GP(g,d7,"$1"):h||c}),s},m7=function(t,e){var o=t,s;if(rg(zP,o)&&(s=zP[o],o="%"+s[0]+"%"),rg(Bl,o)){var c=Bl[o];if(c===Kc&&(c=l7(o)),typeof c=="undefined"&&!e)throw new jc("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:s,name:o,value:c}}throw new Qc("intrinsic "+t+" does not exist!")};qP.exports=function(t,e){if(typeof t!="string"||t.length===0)throw new jc("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof e!="boolean")throw new jc('"allowMissing" argument must be a boolean');if(h7(/^%?[^%]*%?$/,t)===null)throw new Qc("\`%\` may not be present anywhere but at the beginning and end of the intrinsic name");var o=g7(t),s=o.length>0?o[0]:"",c=m7("%"+s+"%",e),h=c.name,p=c.value,g=!1,m=c.alias;m&&(s=m[0],f7(o,c7([0,1],m)));for(var _=1,E=!0;_<o.length;_+=1){var x=o[_],b=ig(x,0,1),P=ig(x,-1);if((b==='"'||b==="'"||b==="\`"||P==='"'||P==="'"||P==="\`")&&b!==P)throw new Qc("property names with quotes must have matching quotes");if((x==="constructor"||!E)&&(g=!0),s+="."+x,h="%"+s+"%",rg(Bl,h))p=Bl[h];else if(p!=null){if(!(x in p)){if(!e)throw new jc("base intrinsic for "+t+" exists, but the property is not available.");return}if(Ul&&_+1>=o.length){var I=Ul(p,x);E=!!I,E&&"get"in I&&!("originalValue"in I.get)?p=I.get:p=p[x]}else E=rg(p,x),p=p[x];E&&!g&&(Bl[h]=p)}}return p}});var sg=lt((ast,HP)=>{"use strict";var y7=tf(),og=y7("%Object.defineProperty%",!0)||!1;if(og)try{og({},"a",{value:1})}catch(n){og=!1}HP.exports=og});var h_=lt((ust,VP)=>{"use strict";var v7=tf(),ag=v7("%Object.getOwnPropertyDescriptor%",!0);if(ag)try{ag([],"length")}catch(n){ag=null}VP.exports=ag});var ug=lt((lst,YP)=>{"use strict";var WP=sg(),_7=u_(),ef=Fl(),XP=h_();YP.exports=function(t,e,o){if(!t||typeof t!="object"&&typeof t!="function")throw new ef("\`obj\` must be an object or a function\`");if(typeof e!="string"&&typeof e!="symbol")throw new ef("\`property\` must be a string or a symbol\`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new ef("\`nonEnumerable\`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new ef("\`nonWritable\`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new ef("\`nonConfigurable\`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new ef("\`loose\`, if provided, must be a boolean");var s=arguments.length>3?arguments[3]:null,c=arguments.length>4?arguments[4]:null,h=arguments.length>5?arguments[5]:null,p=arguments.length>6?arguments[6]:!1,g=!!XP&&XP(t,e);if(WP)WP(t,e,{configurable:h===null&&g?g.configurable:!h,enumerable:s===null&&g?g.enumerable:!s,value:o,writable:c===null&&g?g.writable:!c});else if(p||!s&&!c&&!h)t[e]=o;else throw new _7("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")}});var lg=lt((cst,ZP)=>{"use strict";var p_=sg(),$P=function(){return!!p_};$P.hasArrayLengthDefineBug=function(){if(!p_)return null;try{return p_([],"length",{value:1}).length!==1}catch(t){return!0}};ZP.exports=$P});var tI=lt((fst,QP)=>{"use strict";var x7=tf(),JP=ug(),E7=lg()(),KP=h_(),jP=Fl(),w7=x7("%Math.floor%");QP.exports=function(t,e){if(typeof t!="function")throw new jP("\`fn\` is not a function");if(typeof e!="number"||e<0||e>4294967295||w7(e)!==e)throw new jP("\`length\` must be a positive 32-bit integer");var o=arguments.length>2&&!!arguments[2],s=!0,c=!0;if("length"in t&&KP){var h=KP(t,"length");h&&!h.configurable&&(s=!1),h&&!h.writable&&(c=!1)}return(s||c||!o)&&(E7?JP(t,"length",e,!0,!0):JP(t,"length",e)),t}});var hg=lt((hst,cg)=>{"use strict";var d_=ng(),fg=tf(),S7=tI(),M7=Fl(),rI=fg("%Function.prototype.apply%"),iI=fg("%Function.prototype.call%"),oI=fg("%Reflect.apply%",!0)||d_.call(iI,rI),eI=sg(),b7=fg("%Math.max%");cg.exports=function(t){if(typeof t!="function")throw new M7("a function is required");var e=oI(d_,iI,arguments);return S7(e,1+b7(0,t.length-(arguments.length-1)),!0)};var nI=function(){return oI(d_,rI,arguments)};eI?eI(cg.exports,"apply",{value:nI}):cg.exports.apply=nI});var g_=lt((pst,uI)=>{"use strict";var sI=tf(),aI=hg(),A7=aI(sI("String.prototype.indexOf"));uI.exports=function(t,e){var o=sI(t,!!e);return typeof o=="function"&&A7(t,".prototype.")>-1?aI(o):o}});var fI=lt((dst,cI)=>{"use strict";var T7=eg()(),C7=g_(),m_=C7("Object.prototype.toString"),pg=function(t){return T7&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:m_(t)==="[object Arguments]"},lI=function(t){return pg(t)?!0:t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&m_(t)!=="[object Array]"&&m_(t.callee)==="[object Function]"},P7=function(){return pg(arguments)}();pg.isLegacyArguments=lI;cI.exports=P7?pg:lI});var nf=lt((gst,gI)=>{"use strict";var I7=s_(),R7=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",L7=Object.prototype.toString,N7=Array.prototype.concat,hI=ug(),O7=function(n){return typeof n=="function"&&L7.call(n)==="[object Function]"},pI=lg()(),D7=function(n,t,e,o){if(t in n){if(o===!0){if(n[t]===e)return}else if(!O7(o)||!o())return}pI?hI(n,t,e,!0):hI(n,t,e)},dI=function(n,t){var e=arguments.length>2?arguments[2]:{},o=I7(t);R7&&(o=N7.call(o,Object.getOwnPropertySymbols(t)));for(var s=0;s<o.length;s+=1)D7(n,o[s],t[o[s]],e[o[s]])};dI.supportsDescriptors=!!pI;gI.exports=dI});var y_=lt((mst,yI)=>{"use strict";var mI=function(n){return n!==n};yI.exports=function(t,e){return t===0&&e===0?1/t===1/e:!!(t===e||mI(t)&&mI(e))}});var v_=lt((yst,vI)=>{"use strict";var F7=y_();vI.exports=function(){return typeof Object.is=="function"?Object.is:F7}});var xI=lt((vst,_I)=>{"use strict";var U7=v_(),B7=nf();_I.exports=function(){var t=U7();return B7(Object,{is:t},{is:function(){return Object.is!==t}}),t}});var MI=lt((_st,SI)=>{"use strict";var z7=nf(),G7=hg(),k7=y_(),EI=v_(),q7=xI(),wI=G7(EI(),Object);z7(wI,{getPolyfill:EI,implementation:k7,shim:q7});SI.exports=wI});var PI=lt((xst,CI)=>{"use strict";var __=g_(),bI=eg()(),AI,TI,x_,E_;bI&&(AI=__("Object.prototype.hasOwnProperty"),TI=__("RegExp.prototype.exec"),x_={},dg=function(){throw x_},E_={toString:dg,valueOf:dg},typeof Symbol.toPrimitive=="symbol"&&(E_[Symbol.toPrimitive]=dg));var dg,H7=__("Object.prototype.toString"),V7=Object.getOwnPropertyDescriptor,W7="[object RegExp]";CI.exports=bI?function(t){if(!t||typeof t!="object")return!1;var e=V7(t,"lastIndex"),o=e&&AI(e,"value");if(!o)return!1;try{TI(t,E_)}catch(s){return s===x_}}:function(t){return!t||typeof t!="object"&&typeof t!="function"?!1:H7(t)===W7}});var RI=lt((Est,II)=>{"use strict";var yh=function(){return typeof function(){}.name=="string"},mh=Object.getOwnPropertyDescriptor;if(mh)try{mh([],"length")}catch(n){mh=null}yh.functionsHaveConfigurableNames=function(){if(!yh()||!mh)return!1;var t=mh(function(){},"name");return!!t&&!!t.configurable};var X7=Function.prototype.bind;yh.boundFunctionsHaveNames=function(){return yh()&&typeof X7=="function"&&function(){}.bind().name!==""};II.exports=yh});var OI=lt((wst,NI)=>{"use strict";var LI=ug(),Y7=lg()(),$7=RI().functionsHaveConfigurableNames(),Z7=Fl();NI.exports=function(t,e){if(typeof t!="function")throw new Z7("\`fn\` is not a function");var o=arguments.length>2&&!!arguments[2];return(!o||$7)&&(Y7?LI(t,"name",e,!0,!0):LI(t,"name",e)),t}});var w_=lt((Sst,DI)=>{"use strict";var J7=OI(),K7=Fl(),j7=Object;DI.exports=J7(function(){if(this==null||this!==j7(this))throw new K7("RegExp.prototype.flags getter called on non-object");var t="";return this.hasIndices&&(t+="d"),this.global&&(t+="g"),this.ignoreCase&&(t+="i"),this.multiline&&(t+="m"),this.dotAll&&(t+="s"),this.unicode&&(t+="u"),this.unicodeSets&&(t+="v"),this.sticky&&(t+="y"),t},"get flags",!0)});var S_=lt((Mst,FI)=>{"use strict";var Q7=w_(),tY=nf().supportsDescriptors,eY=Object.getOwnPropertyDescriptor;FI.exports=function(){if(tY&&/a/mig.flags==="gim"){var t=eY(RegExp.prototype,"flags");if(t&&typeof t.get=="function"&&"dotAll"in RegExp.prototype&&"hasIndices"in RegExp.prototype){var e="",o={};if(Object.defineProperty(o,"hasIndices",{get:function(){e+="d"}}),Object.defineProperty(o,"sticky",{get:function(){e+="y"}}),t.get.call(o),e==="dy")return t.get}}return Q7}});var zI=lt((bst,BI)=>{"use strict";var nY=nf().supportsDescriptors,rY=S_(),iY=Object.getOwnPropertyDescriptor,oY=Object.defineProperty,sY=TypeError,UI=Object.getPrototypeOf,aY=/a/;BI.exports=function(){if(!nY||!UI)throw new sY("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var t=rY(),e=UI(aY),o=iY(e,"flags");return(!o||o.get!==t)&&oY(e,"flags",{configurable:!0,enumerable:!1,get:t}),t}});var HI=lt((Ast,qI)=>{"use strict";var uY=nf(),lY=hg(),cY=w_(),GI=S_(),fY=zI(),kI=lY(GI());uY(kI,{getPolyfill:GI,implementation:cY,shim:fY});qI.exports=kI});var WI=lt((Tst,VI)=>{"use strict";var hY=Date.prototype.getDay,pY=function(t){try{return hY.call(t),!0}catch(e){return!1}},dY=Object.prototype.toString,gY="[object Date]",mY=eg()();VI.exports=function(t){return typeof t!="object"||t===null?!1:mY?pY(t):dY.call(t)===gY}});var M_=lt((Cst,nR)=>{var XI=s_(),YI=fI(),$I=MI(),ZI=PI(),JI=HI(),KI=WI(),jI=Date.prototype.getTime;function eR(n,t,e){var o=e||{};return(o.strict?$I(n,t):n===t)?!0:!n||!t||typeof n!="object"&&typeof t!="object"?o.strict?$I(n,t):n==t:yY(n,t,o)}function QI(n){return n==null}function tR(n){return!(!n||typeof n!="object"||typeof n.length!="number"||typeof n.copy!="function"||typeof n.slice!="function"||n.length>0&&typeof n[0]!="number")}function yY(n,t,e){var o,s;if(typeof n!=typeof t||QI(n)||QI(t)||n.prototype!==t.prototype||YI(n)!==YI(t))return!1;var c=ZI(n),h=ZI(t);if(c!==h)return!1;if(c||h)return n.source===t.source&&JI(n)===JI(t);if(KI(n)&&KI(t))return jI.call(n)===jI.call(t);var p=tR(n),g=tR(t);if(p!==g)return!1;if(p||g){if(n.length!==t.length)return!1;for(o=0;o<n.length;o++)if(n[o]!==t[o])return!1;return!0}if(typeof n!=typeof t)return!1;try{var m=XI(n),_=XI(t)}catch(E){return!1}if(m.length!==_.length)return!1;for(m.sort(),_.sort(),o=m.length-1;o>=0;o--)if(m[o]!=_[o])return!1;for(o=m.length-1;o>=0;o--)if(s=m[o],!eR(n[s],t[s],e))return!1;return!0}nR.exports=eR});var F_=lt((Out,lR)=>{var a$=M_(),Ra=function(n){this.precision=n&&n.precision?n.precision:17,this.direction=n&&n.direction?n.direction:!1,this.pseudoNode=n&&n.pseudoNode?n.pseudoNode:!1,this.objectComparator=n&&n.objectComparator?n.objectComparator:u$};Ra.prototype.compare=function(n,t){if(n.type!==t.type||!uR(n,t))return!1;switch(n.type){case"Point":return this.compareCoord(n.coordinates,t.coordinates);case"LineString":return this.compareLine(n.coordinates,t.coordinates,0,!1);case"Polygon":return this.comparePolygon(n,t);case"Feature":return this.compareFeature(n,t);default:if(n.type.indexOf("Multi")===0){var e=this,o=aR(n),s=aR(t);return o.every(function(c){return this.some(function(h){return e.compare(c,h)})},s)}}return!1};function aR(n){return n.coordinates.map(function(t){return{type:n.type.replace("Multi",""),coordinates:t}})}function uR(n,t){return n.hasOwnProperty("coordinates")?n.coordinates.length===t.coordinates.length:n.length===t.length}Ra.prototype.compareCoord=function(n,t){if(n.length!==t.length)return!1;for(var e=0;e<n.length;e++)if(n[e].toFixed(this.precision)!==t[e].toFixed(this.precision))return!1;return!0};Ra.prototype.compareLine=function(n,t,e,o){if(!uR(n,t))return!1;var s=this.pseudoNode?n:this.removePseudo(n),c=this.pseudoNode?t:this.removePseudo(t);if(!(o&&!this.compareCoord(s[0],c[0])&&(c=this.fixStartIndex(c,s),!c))){var h=this.compareCoord(s[e],c[e]);return this.direction||h?this.comparePath(s,c):this.compareCoord(s[e],c[c.length-(1+e)])?this.comparePath(s.slice().reverse(),c):!1}};Ra.prototype.fixStartIndex=function(n,t){for(var e,o=-1,s=0;s<n.length;s++)if(this.compareCoord(n[s],t[0])){o=s;break}return o>=0&&(e=[].concat(n.slice(o,n.length),n.slice(1,o+1))),e};Ra.prototype.comparePath=function(n,t){var e=this;return n.every(function(o,s){return e.compareCoord(o,this[s])},t)};Ra.prototype.comparePolygon=function(n,t){if(this.compareLine(n.coordinates[0],t.coordinates[0],1,!0)){var e=n.coordinates.slice(1,n.coordinates.length),o=t.coordinates.slice(1,t.coordinates.length),s=this;return e.every(function(c){return this.some(function(h){return s.compareLine(c,h,1,!0)})},o)}else return!1};Ra.prototype.compareFeature=function(n,t){return n.id!==t.id||!this.objectComparator(n.properties,t.properties)||!this.compareBBox(n,t)?!1:this.compare(n.geometry,t.geometry)};Ra.prototype.compareBBox=function(n,t){return!!(!n.bbox&&!t.bbox||n.bbox&&t.bbox&&this.compareCoord(n.bbox,t.bbox))};Ra.prototype.removePseudo=function(n){return n};function u$(n,t){return a$(n,t,{strict:!0})}lR.exports=Ra});var cR=lt((Xut,yg)=>{function Qu(n,t,e,o){this.dataset=[],this.epsilon=1,this.minPts=2,this.distance=this._euclideanDistance,this.clusters=[],this.noise=[],this._visited=[],this._assigned=[],this._datasetLength=0,this._init(n,t,e,o)}Qu.prototype.run=function(n,t,e,o){this._init(n,t,e,o);for(var s=0;s<this._datasetLength;s++)if(this._visited[s]!==1){this._visited[s]=1;var c=this._regionQuery(s);if(c.length<this.minPts)this.noise.push(s);else{var h=this.clusters.length;this.clusters.push([]),this._addToCluster(s,h),this._expandCluster(h,c)}}return this.clusters};Qu.prototype._init=function(n,t,e,o){if(n){if(!(n instanceof Array))throw Error("Dataset must be of type array, "+typeof n+" given");this.dataset=n,this.clusters=[],this.noise=[],this._datasetLength=n.length,this._visited=new Array(this._datasetLength),this._assigned=new Array(this._datasetLength)}t&&(this.epsilon=t),e&&(this.minPts=e),o&&(this.distance=o)};Qu.prototype._expandCluster=function(n,t){for(var e=0;e<t.length;e++){var o=t[e];if(this._visited[o]!==1){this._visited[o]=1;var s=this._regionQuery(o);s.length>=this.minPts&&(t=this._mergeArrays(t,s))}this._assigned[o]!==1&&this._addToCluster(o,n)}};Qu.prototype._addToCluster=function(n,t){this.clusters[t].push(n),this._assigned[n]=1};Qu.prototype._regionQuery=function(n){for(var t=[],e=0;e<this._datasetLength;e++){var o=this.distance(this.dataset[n],this.dataset[e]);o<this.epsilon&&t.push(e)}return t};Qu.prototype._mergeArrays=function(n,t){for(var e=t.length,o=0;o<e;o++){var s=t[o];n.indexOf(s)<0&&n.push(s)}return n};Qu.prototype._euclideanDistance=function(n,t){for(var e=0,o=Math.min(n.length,t.length);o--;)e+=(n[o]-t[o])*(n[o]-t[o]);return Math.sqrt(e)};typeof yg!="undefined"&&yg.exports&&(yg.exports=Qu)});var fR=lt((Yut,vg)=>{function tl(n,t,e){this.k=3,this.dataset=[],this.assignments=[],this.centroids=[],this.init(n,t,e)}tl.prototype.init=function(n,t,e){this.assignments=[],this.centroids=[],typeof n!="undefined"&&(this.dataset=n),typeof t!="undefined"&&(this.k=t),typeof e!="undefined"&&(this.distance=e)};tl.prototype.run=function(n,t){this.init(n,t);for(var e=this.dataset.length,o=0;o<this.k;o++)this.centroids[o]=this.randomCentroid();for(var s=!0;s;){s=this.assign();for(var c=0;c<this.k;c++){for(var h=new Array(_),p=0,g=0;g<_;g++)h[g]=0;for(var m=0;m<e;m++){var _=this.dataset[m].length;if(c===this.assignments[m]){for(var g=0;g<_;g++)h[g]+=this.dataset[m][g];p++}}if(p>0){for(var g=0;g<_;g++)h[g]/=p;this.centroids[c]=h}else this.centroids[c]=this.randomCentroid(),s=!0}}return this.getClusters()};tl.prototype.randomCentroid=function(){var n=this.dataset.length-1,t,e;do e=Math.round(Math.random()*n),t=this.dataset[e];while(this.centroids.indexOf(t)>=0);return t};tl.prototype.assign=function(){for(var n=!1,t=this.dataset.length,e,o=0;o<t;o++)e=this.argmin(this.dataset[o],this.centroids,this.distance),e!=this.assignments[o]&&(this.assignments[o]=e,n=!0);return n};tl.prototype.getClusters=function(){for(var n=new Array(this.k),t,e=0;e<this.assignments.length;e++)t=this.assignments[e],typeof n[t]=="undefined"&&(n[t]=[]),n[t].push(e);return n};tl.prototype.argmin=function(n,t,e){for(var o=Number.MAX_VALUE,s=0,c=t.length,h,p=0;p<c;p++)h=e(n,t[p]),h<o&&(o=h,s=p);return s};tl.prototype.distance=function(n,t){for(var e=0,o=Math.min(n.length,t.length);o--;){var s=n[o]-t[o];e+=s*s}return Math.sqrt(e)};typeof vg!="undefined"&&vg.exports&&(vg.exports=tl)});var U_=lt(($ut,_g)=>{function La(n,t,e){this._queue=[],this._priorities=[],this._sorting="desc",this._init(n,t,e)}La.prototype.insert=function(n,t){for(var e=this._queue.length,o=e;o--;){var s=this._priorities[o];this._sorting==="desc"?t>s&&(e=o):t<s&&(e=o)}this._insertAt(n,t,e)};La.prototype.remove=function(n){for(var t=this._queue.length;t--;){var e=this._queue[t];if(n===e){this._queue.splice(t,1),this._priorities.splice(t,1);break}}};La.prototype.forEach=function(n){this._queue.forEach(n)};La.prototype.getElements=function(){return this._queue};La.prototype.getElementPriority=function(n){return this._priorities[n]};La.prototype.getPriorities=function(){return this._priorities};La.prototype.getElementsWithPriorities=function(){for(var n=[],t=0,e=this._queue.length;t<e;t++)n.push([this._queue[t],this._priorities[t]]);return n};La.prototype._init=function(n,t,e){if(n&&t){if(this._queue=[],this._priorities=[],n.length!==t.length)throw new Error("Arrays must have the same length");for(var o=0;o<n.length;o++)this.insert(n[o],t[o])}e&&(this._sorting=e)};La.prototype._insertAt=function(n,t,e){this._queue.length===e?(this._queue.push(n),this._priorities.push(t)):(this._queue.splice(e,0,n),this._priorities.splice(e,0,t))};typeof _g!="undefined"&&_g.exports&&(_g.exports=La)});var pR=lt((Zut,of)=>{typeof of!="undefined"&&of.exports&&(hR=U_());var hR;function pu(n,t,e,o){this.epsilon=1,this.minPts=1,this.distance=this._euclideanDistance,this._reachability=[],this._processed=[],this._coreDistance=0,this._orderedList=[],this._init(n,t,e,o)}pu.prototype.run=function(n,t,e,o){this._init(n,t,e,o);for(var s=0,c=this.dataset.length;s<c;s++)if(this._processed[s]!==1){this._processed[s]=1,this.clusters.push([s]);var h=this.clusters.length-1;this._orderedList.push(s);var p=new hR(null,null,"asc"),g=this._regionQuery(s);this._distanceToCore(s)!==void 0&&(this._updateQueue(s,g,p),this._expandCluster(h,p))}return this.clusters};pu.prototype.getReachabilityPlot=function(){for(var n=[],t=0,e=this._orderedList.length;t<e;t++){var o=this._orderedList[t],s=this._reachability[o];n.push([o,s])}return n};pu.prototype._init=function(n,t,e,o){if(n){if(!(n instanceof Array))throw Error("Dataset must be of type array, "+typeof n+" given");this.dataset=n,this.clusters=[],this._reachability=new Array(this.dataset.length),this._processed=new Array(this.dataset.length),this._coreDistance=0,this._orderedList=[]}t&&(this.epsilon=t),e&&(this.minPts=e),o&&(this.distance=o)};pu.prototype._updateQueue=function(n,t,e){var o=this;this._coreDistance=this._distanceToCore(n),t.forEach(function(s){if(o._processed[s]===void 0){var c=o.distance(o.dataset[n],o.dataset[s]),h=Math.max(o._coreDistance,c);o._reachability[s]===void 0?(o._reachability[s]=h,e.insert(s,h)):h<o._reachability[s]&&(o._reachability[s]=h,e.remove(s),e.insert(s,h))}})};pu.prototype._expandCluster=function(n,t){for(var e=t.getElements(),o=0,s=e.length;o<s;o++){var c=e[o];if(this._processed[c]===void 0){var h=this._regionQuery(c);this._processed[c]=1,this.clusters[n].push(c),this._orderedList.push(c),this._distanceToCore(c)!==void 0&&(this._updateQueue(c,h,t),this._expandCluster(n,t))}}};pu.prototype._distanceToCore=function(n){for(var t=this.epsilon,e=0;e<t;e++){var o=this._regionQuery(n,e);if(o.length>=this.minPts)return e}};pu.prototype._regionQuery=function(n,t){t=t||this.epsilon;for(var e=[],o=0,s=this.dataset.length;o<s;o++)this.distance(this.dataset[n],this.dataset[o])<t&&e.push(o);return e};pu.prototype._euclideanDistance=function(n,t){for(var e=0,o=Math.min(n.length,t.length);o--;)e+=(n[o]-t[o])*(n[o]-t[o]);return Math.sqrt(e)};typeof of!="undefined"&&of.exports&&(of.exports=pu)});var dR=lt((Jut,xg)=>{typeof xg!="undefined"&&xg.exports&&(xg.exports={DBSCAN:cR(),KMEANS:fR(),OPTICS:pR(),PriorityQueue:U_()})});var B_=lt((nlt,mR)=>{"use strict";mR.exports={eudist:function(t,e,o){for(var s=t.length,c=0,h=0;h<s;h++){var p=(t[h]||0)-(e[h]||0);c+=p*p}return o?Math.sqrt(c):c},mandist:function(t,e,o){for(var s=t.length,c=0,h=0;h<s;h++)c+=Math.abs((t[h]||0)-(e[h]||0));return o?Math.sqrt(c):c},dist:function(t,e,o){var s=Math.abs(t-e);return o?s:s*s}}});var _R=lt((rlt,vR)=>{"use strict";var yR=B_(),d$=yR.eudist,g$=yR.dist;vR.exports={kmrand:function(t,e){for(var o={},s=[],c=e<<2,h=t.length,p=t[0].length>0;s.length<e&&c-- >0;){var g=t[Math.floor(Math.random()*h)],m=p?g.join("_"):""+g;o[m]||(o[m]=!0,s.push(g))}if(s.length<e)throw new Error("Error initializating clusters");return s},kmpp:function(t,e){var o=t[0].length?d$:g$,s=[],c=t.length,h=t[0].length>0,p={},g=t[Math.floor(Math.random()*c)],m=h?g.join("_"):""+g;for(s.push(g),p[m]=!0;s.length<e;){for(var _=[],E=s.length,x=0,b=[],P=0;P<c;P++){for(var I=1/0,S=0;S<E;S++){var w=o(t[P],s[S]);w<=I&&(I=w)}_[P]=I}for(var R=0;R<c;R++)x+=_[R];for(var T=0;T<c;T++)b[T]={i:T,v:t[T],pr:_[T]/x,cs:0};b.sort(function(q,D){return q.pr-D.pr}),b[0].cs=b[0].pr;for(var F=1;F<c;F++)b[F].cs=b[F-1].cs+b[F].pr;for(var W=Math.random(),X=0;X<c-1&&b[X++].cs<W;);s.push(b[X-1].v)}return s}}});var MR=lt((slt,SR)=>{"use strict";var z_=B_(),wR=_R(),m$=z_.eudist,ilt=z_.mandist,olt=z_.dist,y$=wR.kmrand,v$=wR.kmpp,xR=1e4;function ER(n,t,e){e=e||[];for(var o=0;o<n;o++)e[o]=t;return e}function _$(n,t,e,o){var s=[],c=[],h=[],p=[],g=!1,m=o||xR,_=n.length,E=n[0].length,x=E>0,b=[];if(e)e=="kmrand"?s=y$(n,t):e=="kmpp"?s=v$(n,t):s=e;else for(var P={};s.length<t;){var I=Math.floor(Math.random()*_);P[I]||(P[I]=!0,s.push(n[I]))}do{ER(t,0,b);for(var S=0;S<_;S++){for(var w=1/0,R=0,T=0;T<t;T++){var p=x?m$(n[S],s[T]):Math.abs(n[S]-s[T]);p<=w&&(w=p,R=T)}h[S]=R,b[R]++}for(var F=[],c=[],W=0,X=0;X<t;X++)F[X]=x?ER(E,0,F[X]):0,c[X]=s[X];if(x){for(var q=0;q<t;q++)s[q]=[];for(var D=0;D<_;D++)for(var xt=h[D],B=F[xt],j=n[D],J=0;J<E;J++)B[J]+=j[J];g=!0;for(var Dt=0;Dt<t;Dt++){for(var Q=s[Dt],At=F[Dt],Mt=c[Dt],Rt=b[Dt],pt=0;pt<E;pt++)Q[pt]=At[pt]/Rt||0;if(g){for(var yt=0;yt<E;yt++)if(Mt[yt]!=Q[yt]){g=!1;break}}}}else{for(var K=0;K<_;K++){var Bt=h[K];F[Bt]+=n[K]}for(var Gt=0;Gt<t;Gt++)s[Gt]=F[Gt]/b[Gt]||0;g=!0;for(var ae=0;ae<t;ae++)if(c[ae]!=s[ae]){g=!1;break}}g=g||--m<=0}while(!g);return{it:xR-m,k:t,idxs:h,centroids:s}}SR.exports=_$});var cf=lt((W_,X_)=>{(function(n,t){typeof W_=="object"&&typeof X_!="undefined"?X_.exports=t():typeof define=="function"&&define.amd?define(t):(n=typeof globalThis!="undefined"?globalThis:n||self,n.polygonClipping=t())})(W_,function(){"use strict";function n(rt,C){var N={label:0,sent:function(){if(V[0]&1)throw V[1];return V[1]},trys:[],ops:[]},k,$,V,ht;return ht={next:st(0),throw:st(1),return:st(2)},typeof Symbol=="function"&&(ht[Symbol.iterator]=function(){return this}),ht;function st(Et){return function(G){return wt([Et,G])}}function wt(Et){if(k)throw new TypeError("Generator is already executing.");for(;N;)try{if(k=1,$&&(V=Et[0]&2?$.return:Et[0]?$.throw||((V=$.return)&&V.call($),0):$.next)&&!(V=V.call($,Et[1])).done)return V;switch($=0,V&&(Et=[Et[0]&2,V.value]),Et[0]){case 0:case 1:V=Et;break;case 4:return N.label++,{value:Et[1],done:!1};case 5:N.label++,$=Et[1],Et=[0];continue;case 7:Et=N.ops.pop(),N.trys.pop();continue;default:if(V=N.trys,!(V=V.length>0&&V[V.length-1])&&(Et[0]===6||Et[0]===2)){N=0;continue}if(Et[0]===3&&(!V||Et[1]>V[0]&&Et[1]<V[3])){N.label=Et[1];break}if(Et[0]===6&&N.label<V[1]){N.label=V[1],V=Et;break}if(V&&N.label<V[2]){N.label=V[2],N.ops.push(Et);break}V[2]&&N.ops.pop(),N.trys.pop();continue}Et=C.call(rt,N)}catch(G){Et=[6,G],$=0}finally{k=V=0}if(Et[0]&5)throw Et[1];return{value:Et[0]?Et[1]:void 0,done:!0}}}var t=function(){function rt(C,N){this.next=null,this.key=C,this.data=N,this.left=null,this.right=null}return rt}();function e(rt,C){return rt>C?1:rt<C?-1:0}function o(rt,C,N){for(var k=new t(null,null),$=k,V=k;;){var ht=N(rt,C.key);if(ht<0){if(C.left===null)break;if(N(rt,C.left.key)<0){var st=C.left;if(C.left=st.right,st.right=C,C=st,C.left===null)break}V.left=C,V=C,C=C.left}else if(ht>0){if(C.right===null)break;if(N(rt,C.right.key)>0){var st=C.right;if(C.right=st.left,st.left=C,C=st,C.right===null)break}$.right=C,$=C,C=C.right}else break}return $.right=C.left,V.left=C.right,C.left=k.right,C.right=k.left,C}function s(rt,C,N,k){var $=new t(rt,C);if(N===null)return $.left=$.right=null,$;N=o(rt,N,k);var V=k(rt,N.key);return V<0?($.left=N.left,$.right=N,N.left=null):V>=0&&($.right=N.right,$.left=N,N.right=null),$}function c(rt,C,N){var k=null,$=null;if(C){C=o(rt,C,N);var V=N(C.key,rt);V===0?(k=C.left,$=C.right):V<0?($=C.right,C.right=null,k=C):(k=C.left,C.left=null,$=C)}return{left:k,right:$}}function h(rt,C,N){return C===null?rt:(rt===null||(C=o(rt.key,C,N),C.left=rt),C)}function p(rt,C,N,k,$){if(rt){k(""+C+(N?"\\u2514\\u2500\\u2500 ":"\\u251C\\u2500\\u2500 ")+$(rt)+\`
7748
7748
  \`);var V=C+(N?" ":"\\u2502 ");rt.left&&p(rt.left,V,!1,k,$),rt.right&&p(rt.right,V,!0,k,$)}}var g=function(){function rt(C){C===void 0&&(C=e),this._root=null,this._size=0,this._comparator=C}return rt.prototype.insert=function(C,N){return this._size++,this._root=s(C,N,this._root,this._comparator)},rt.prototype.add=function(C,N){var k=new t(C,N);this._root===null&&(k.left=k.right=null,this._size++,this._root=k);var $=this._comparator,V=o(C,this._root,$),ht=$(C,V.key);return ht===0?this._root=V:(ht<0?(k.left=V.left,k.right=V,V.left=null):ht>0&&(k.right=V.right,k.left=V,V.right=null),this._size++,this._root=k),this._root},rt.prototype.remove=function(C){this._root=this._remove(C,this._root,this._comparator)},rt.prototype._remove=function(C,N,k){var $;if(N===null)return null;N=o(C,N,k);var V=k(C,N.key);return V===0?(N.left===null?$=N.right:($=o(C,N.left,k),$.right=N.right),this._size--,$):N},rt.prototype.pop=function(){var C=this._root;if(C){for(;C.left;)C=C.left;return this._root=o(C.key,this._root,this._comparator),this._root=this._remove(C.key,this._root,this._comparator),{key:C.key,data:C.data}}return null},rt.prototype.findStatic=function(C){for(var N=this._root,k=this._comparator;N;){var $=k(C,N.key);if($===0)return N;$<0?N=N.left:N=N.right}return null},rt.prototype.find=function(C){return this._root&&(this._root=o(C,this._root,this._comparator),this._comparator(C,this._root.key)!==0)?null:this._root},rt.prototype.contains=function(C){for(var N=this._root,k=this._comparator;N;){var $=k(C,N.key);if($===0)return!0;$<0?N=N.left:N=N.right}return!1},rt.prototype.forEach=function(C,N){for(var k=this._root,$=[],V=!1;!V;)k!==null?($.push(k),k=k.left):$.length!==0?(k=$.pop(),C.call(N,k),k=k.right):V=!0;return this},rt.prototype.range=function(C,N,k,$){for(var V=[],ht=this._comparator,st=this._root,wt;V.length!==0||st;)if(st)V.push(st),st=st.left;else{if(st=V.pop(),wt=ht(st.key,N),wt>0)break;if(ht(st.key,C)>=0&&k.call($,st))return this;st=st.right}return this},rt.prototype.keys=function(){var C=[];return this.forEach(function(N){var k=N.key;return C.push(k)}),C},rt.prototype.values=function(){var C=[];return this.forEach(function(N){var k=N.data;return C.push(k)}),C},rt.prototype.min=function(){return this._root?this.minNode(this._root).key:null},rt.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},rt.prototype.minNode=function(C){if(C===void 0&&(C=this._root),C)for(;C.left;)C=C.left;return C},rt.prototype.maxNode=function(C){if(C===void 0&&(C=this._root),C)for(;C.right;)C=C.right;return C},rt.prototype.at=function(C){for(var N=this._root,k=!1,$=0,V=[];!k;)if(N)V.push(N),N=N.left;else if(V.length>0){if(N=V.pop(),$===C)return N;$++,N=N.right}else k=!0;return null},rt.prototype.next=function(C){var N=this._root,k=null;if(C.right){for(k=C.right;k.left;)k=k.left;return k}for(var $=this._comparator;N;){var V=$(C.key,N.key);if(V===0)break;V<0?(k=N,N=N.left):N=N.right}return k},rt.prototype.prev=function(C){var N=this._root,k=null;if(C.left!==null){for(k=C.left;k.right;)k=k.right;return k}for(var $=this._comparator;N;){var V=$(C.key,N.key);if(V===0)break;V<0?N=N.left:(k=N,N=N.right)}return k},rt.prototype.clear=function(){return this._root=null,this._size=0,this},rt.prototype.toList=function(){return E(this._root)},rt.prototype.load=function(C,N,k){N===void 0&&(N=[]),k===void 0&&(k=!1);var $=C.length,V=this._comparator;if(k&&P(C,N,0,$-1,V),this._root===null)this._root=m(C,N,0,$),this._size=$;else{var ht=b(this.toList(),_(C,N),V);$=this._size+$,this._root=x({head:ht},0,$)}return this},rt.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(rt.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(rt.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),rt.prototype.toString=function(C){C===void 0&&(C=function(k){return String(k.key)});var N=[];return p(this._root,"",!0,function(k){return N.push(k)},C),N.join("")},rt.prototype.update=function(C,N,k){var $=this._comparator,V=c(C,this._root,$),ht=V.left,st=V.right;$(C,N)<0?st=s(N,k,st,$):ht=s(N,k,ht,$),this._root=h(ht,st,$)},rt.prototype.split=function(C){return c(C,this._root,this._comparator)},rt.prototype[Symbol.iterator]=function(){var C,N,k;return n(this,function($){switch($.label){case 0:C=this._root,N=[],k=!1,$.label=1;case 1:return k?[3,6]:C===null?[3,2]:(N.push(C),C=C.left,[3,5]);case 2:return N.length===0?[3,4]:(C=N.pop(),[4,C]);case 3:return $.sent(),C=C.right,[3,5];case 4:k=!0,$.label=5;case 5:return[3,1];case 6:return[2]}})},rt}();function m(rt,C,N,k){var $=k-N;if($>0){var V=N+Math.floor($/2),ht=rt[V],st=C[V],wt=new t(ht,st);return wt.left=m(rt,C,N,V),wt.right=m(rt,C,V+1,k),wt}return null}function _(rt,C){for(var N=new t(null,null),k=N,$=0;$<rt.length;$++)k=k.next=new t(rt[$],C[$]);return k.next=null,N.next}function E(rt){for(var C=rt,N=[],k=!1,$=new t(null,null),V=$;!k;)C?(N.push(C),C=C.left):N.length>0?(C=V=V.next=N.pop(),C=C.right):k=!0;return V.next=null,$.next}function x(rt,C,N){var k=N-C;if(k>0){var $=C+Math.floor(k/2),V=x(rt,C,$),ht=rt.head;return ht.left=V,rt.head=rt.head.next,ht.right=x(rt,$+1,N),ht}return null}function b(rt,C,N){for(var k=new t(null,null),$=k,V=rt,ht=C;V!==null&&ht!==null;)N(V.key,ht.key)<0?($.next=V,V=V.next):($.next=ht,ht=ht.next),$=$.next;return V!==null?$.next=V:ht!==null&&($.next=ht),k.next}function P(rt,C,N,k,$){if(!(N>=k)){for(var V=rt[N+k>>1],ht=N-1,st=k+1;;){do ht++;while($(rt[ht],V)<0);do st--;while($(rt[st],V)>0);if(ht>=st)break;var wt=rt[ht];rt[ht]=rt[st],rt[st]=wt,wt=C[ht],C[ht]=C[st],C[st]=wt}P(rt,C,N,st,$),P(rt,C,st+1,k,$)}}let I=(rt,C)=>rt.ll.x<=C.x&&C.x<=rt.ur.x&&rt.ll.y<=C.y&&C.y<=rt.ur.y,S=(rt,C)=>{if(C.ur.x<rt.ll.x||rt.ur.x<C.ll.x||C.ur.y<rt.ll.y||rt.ur.y<C.ll.y)return null;let N=rt.ll.x<C.ll.x?C.ll.x:rt.ll.x,k=rt.ur.x<C.ur.x?rt.ur.x:C.ur.x,$=rt.ll.y<C.ll.y?C.ll.y:rt.ll.y,V=rt.ur.y<C.ur.y?rt.ur.y:C.ur.y;return{ll:{x:N,y:$},ur:{x:k,y:V}}},w=Number.EPSILON;w===void 0&&(w=Math.pow(2,-52));let R=w*w,T=(rt,C)=>{if(-w<rt&&rt<w&&-w<C&&C<w)return 0;let N=rt-C;return N*N<R*rt*C?0:rt<C?-1:1};class F{constructor(){this.reset()}reset(){this.xRounder=new W,this.yRounder=new W}round(C,N){return{x:this.xRounder.round(C),y:this.yRounder.round(N)}}}class W{constructor(){this.tree=new g,this.round(0)}round(C){let N=this.tree.add(C),k=this.tree.prev(N);if(k!==null&&T(N.key,k.key)===0)return this.tree.remove(C),k.key;let $=this.tree.next(N);return $!==null&&T(N.key,$.key)===0?(this.tree.remove(C),$.key):C}}let X=new F,q=11102230246251565e-32,D=134217729,xt=(3+8*q)*q;function B(rt,C,N,k,$){let V,ht,st,wt,Et=C[0],G=k[0],ot=0,et=0;G>Et==G>-Et?(V=Et,Et=C[++ot]):(V=G,G=k[++et]);let ut=0;if(ot<rt&&et<N)for(G>Et==G>-Et?(ht=Et+V,st=V-(ht-Et),Et=C[++ot]):(ht=G+V,st=V-(ht-G),G=k[++et]),V=ht,st!==0&&($[ut++]=st);ot<rt&&et<N;)G>Et==G>-Et?(ht=V+Et,wt=ht-V,st=V-(ht-wt)+(Et-wt),Et=C[++ot]):(ht=V+G,wt=ht-V,st=V-(ht-wt)+(G-wt),G=k[++et]),V=ht,st!==0&&($[ut++]=st);for(;ot<rt;)ht=V+Et,wt=ht-V,st=V-(ht-wt)+(Et-wt),Et=C[++ot],V=ht,st!==0&&($[ut++]=st);for(;et<N;)ht=V+G,wt=ht-V,st=V-(ht-wt)+(G-wt),G=k[++et],V=ht,st!==0&&($[ut++]=st);return(V!==0||ut===0)&&($[ut++]=V),ut}function j(rt,C){let N=C[0];for(let k=1;k<rt;k++)N+=C[k];return N}function J(rt){return new Float64Array(rt)}let Dt=(3+16*q)*q,Q=(2+12*q)*q,At=(9+64*q)*q*q,Mt=J(4),Rt=J(8),pt=J(12),yt=J(16),K=J(4);function Bt(rt,C,N,k,$,V,ht){let st,wt,Et,G,ot,et,ut,Ft,Kt,me,ve,qe,Ue,Xe,Ze,Er,Zr,nr,Ie=rt-$,rr=N-$,pr=C-V,ar=k-V;Xe=Ie*ar,et=D*Ie,ut=et-(et-Ie),Ft=Ie-ut,et=D*ar,Kt=et-(et-ar),me=ar-Kt,Ze=Ft*me-(Xe-ut*Kt-Ft*Kt-ut*me),Er=pr*rr,et=D*pr,ut=et-(et-pr),Ft=pr-ut,et=D*rr,Kt=et-(et-rr),me=rr-Kt,Zr=Ft*me-(Er-ut*Kt-Ft*Kt-ut*me),ve=Ze-Zr,ot=Ze-ve,Mt[0]=Ze-(ve+ot)+(ot-Zr),qe=Xe+ve,ot=qe-Xe,Ue=Xe-(qe-ot)+(ve-ot),ve=Ue-Er,ot=Ue-ve,Mt[1]=Ue-(ve+ot)+(ot-Er),nr=qe+ve,ot=nr-qe,Mt[2]=qe-(nr-ot)+(ve-ot),Mt[3]=nr;let Qn=j(4,Mt),Si=Q*ht;if(Qn>=Si||-Qn>=Si||(ot=rt-Ie,st=rt-(Ie+ot)+(ot-$),ot=N-rr,Et=N-(rr+ot)+(ot-$),ot=C-pr,wt=C-(pr+ot)+(ot-V),ot=k-ar,G=k-(ar+ot)+(ot-V),st===0&&wt===0&&Et===0&&G===0)||(Si=At*ht+xt*Math.abs(Qn),Qn+=Ie*G+ar*st-(pr*Et+rr*wt),Qn>=Si||-Qn>=Si))return Qn;Xe=st*ar,et=D*st,ut=et-(et-st),Ft=st-ut,et=D*ar,Kt=et-(et-ar),me=ar-Kt,Ze=Ft*me-(Xe-ut*Kt-Ft*Kt-ut*me),Er=wt*rr,et=D*wt,ut=et-(et-wt),Ft=wt-ut,et=D*rr,Kt=et-(et-rr),me=rr-Kt,Zr=Ft*me-(Er-ut*Kt-Ft*Kt-ut*me),ve=Ze-Zr,ot=Ze-ve,K[0]=Ze-(ve+ot)+(ot-Zr),qe=Xe+ve,ot=qe-Xe,Ue=Xe-(qe-ot)+(ve-ot),ve=Ue-Er,ot=Ue-ve,K[1]=Ue-(ve+ot)+(ot-Er),nr=qe+ve,ot=nr-qe,K[2]=qe-(nr-ot)+(ve-ot),K[3]=nr;let ii=B(4,Mt,4,K,Rt);Xe=Ie*G,et=D*Ie,ut=et-(et-Ie),Ft=Ie-ut,et=D*G,Kt=et-(et-G),me=G-Kt,Ze=Ft*me-(Xe-ut*Kt-Ft*Kt-ut*me),Er=pr*Et,et=D*pr,ut=et-(et-pr),Ft=pr-ut,et=D*Et,Kt=et-(et-Et),me=Et-Kt,Zr=Ft*me-(Er-ut*Kt-Ft*Kt-ut*me),ve=Ze-Zr,ot=Ze-ve,K[0]=Ze-(ve+ot)+(ot-Zr),qe=Xe+ve,ot=qe-Xe,Ue=Xe-(qe-ot)+(ve-ot),ve=Ue-Er,ot=Ue-ve,K[1]=Ue-(ve+ot)+(ot-Er),nr=qe+ve,ot=nr-qe,K[2]=qe-(nr-ot)+(ve-ot),K[3]=nr;let Z=B(ii,Rt,4,K,pt);Xe=st*G,et=D*st,ut=et-(et-st),Ft=st-ut,et=D*G,Kt=et-(et-G),me=G-Kt,Ze=Ft*me-(Xe-ut*Kt-Ft*Kt-ut*me),Er=wt*Et,et=D*wt,ut=et-(et-wt),Ft=wt-ut,et=D*Et,Kt=et-(et-Et),me=Et-Kt,Zr=Ft*me-(Er-ut*Kt-Ft*Kt-ut*me),ve=Ze-Zr,ot=Ze-ve,K[0]=Ze-(ve+ot)+(ot-Zr),qe=Xe+ve,ot=qe-Xe,Ue=Xe-(qe-ot)+(ve-ot),ve=Ue-Er,ot=Ue-ve,K[1]=Ue-(ve+ot)+(ot-Er),nr=qe+ve,ot=nr-qe,K[2]=qe-(nr-ot)+(ve-ot),K[3]=nr;let mt=B(Z,pt,4,K,yt);return yt[mt-1]}function Gt(rt,C,N,k,$,V){let ht=(C-V)*(N-$),st=(rt-$)*(k-V),wt=ht-st,Et=Math.abs(ht+st);return Math.abs(wt)>=Dt*Et?wt:-Bt(rt,C,N,k,$,V,Et)}let ae=(rt,C)=>rt.x*C.y-rt.y*C.x,at=(rt,C)=>rt.x*C.x+rt.y*C.y,Ut=(rt,C,N)=>{let k=Gt(rt.x,rt.y,C.x,C.y,N.x,N.y);return k>0?-1:k<0?1:0},jt=rt=>Math.sqrt(at(rt,rt)),ce=(rt,C,N)=>{let k={x:C.x-rt.x,y:C.y-rt.y},$={x:N.x-rt.x,y:N.y-rt.y};return ae($,k)/jt($)/jt(k)},te=(rt,C,N)=>{let k={x:C.x-rt.x,y:C.y-rt.y},$={x:N.x-rt.x,y:N.y-rt.y};return at($,k)/jt($)/jt(k)},$t=(rt,C,N)=>C.y===0?null:{x:rt.x+C.x/C.y*(N-rt.y),y:N},qt=(rt,C,N)=>C.x===0?null:{x:N,y:rt.y+C.y/C.x*(N-rt.x)},xe=(rt,C,N,k)=>{if(C.x===0)return qt(N,k,rt.x);if(k.x===0)return qt(rt,C,N.x);if(C.y===0)return $t(N,k,rt.y);if(k.y===0)return $t(rt,C,N.y);let $=ae(C,k);if($==0)return null;let V={x:N.x-rt.x,y:N.y-rt.y},ht=ae(V,C)/$,st=ae(V,k)/$,wt=rt.x+st*C.x,Et=N.x+ht*k.x,G=rt.y+st*C.y,ot=N.y+ht*k.y,et=(wt+Et)/2,ut=(G+ot)/2;return{x:et,y:ut}};class ft{static compare(C,N){let k=ft.comparePoints(C.point,N.point);return k!==0?k:(C.point!==N.point&&C.link(N),C.isLeft!==N.isLeft?C.isLeft?1:-1:ee.compare(C.segment,N.segment))}static comparePoints(C,N){return C.x<N.x?-1:C.x>N.x?1:C.y<N.y?-1:C.y>N.y?1:0}constructor(C,N){C.events===void 0?C.events=[this]:C.events.push(this),this.point=C,this.isLeft=N}link(C){if(C.point===this.point)throw new Error("Tried to link already linked events");let N=C.point.events;for(let k=0,$=N.length;k<$;k++){let V=N[k];this.point.events.push(V),V.point=this.point}this.checkForConsuming()}checkForConsuming(){let C=this.point.events.length;for(let N=0;N<C;N++){let k=this.point.events[N];if(k.segment.consumedBy===void 0)for(let $=N+1;$<C;$++){let V=this.point.events[$];V.consumedBy===void 0&&k.otherSE.point.events===V.otherSE.point.events&&k.segment.consume(V.segment)}}}getAvailableLinkedEvents(){let C=[];for(let N=0,k=this.point.events.length;N<k;N++){let $=this.point.events[N];$!==this&&!$.segment.ringOut&&$.segment.isInResult()&&C.push($)}return C}getLeftmostComparator(C){let N=new Map,k=$=>{let V=$.otherSE;N.set($,{sine:ce(this.point,C.point,V.point),cosine:te(this.point,C.point,V.point)})};return($,V)=>{N.has($)||k($),N.has(V)||k(V);let{sine:ht,cosine:st}=N.get($),{sine:wt,cosine:Et}=N.get(V);return ht>=0&&wt>=0?st<Et?1:st>Et?-1:0:ht<0&&wt<0?st<Et?-1:st>Et?1:0:wt<ht?-1:wt>ht?1:0}}}let We=0;class ee{static compare(C,N){let k=C.leftSE.point.x,$=N.leftSE.point.x,V=C.rightSE.point.x,ht=N.rightSE.point.x;if(ht<k)return 1;if(V<$)return-1;let st=C.leftSE.point.y,wt=N.leftSE.point.y,Et=C.rightSE.point.y,G=N.rightSE.point.y;if(k<$){if(wt<st&&wt<Et)return 1;if(wt>st&&wt>Et)return-1;let ot=C.comparePoint(N.leftSE.point);if(ot<0)return 1;if(ot>0)return-1;let et=N.comparePoint(C.rightSE.point);return et!==0?et:-1}if(k>$){if(st<wt&&st<G)return-1;if(st>wt&&st>G)return 1;let ot=N.comparePoint(C.leftSE.point);if(ot!==0)return ot;let et=C.comparePoint(N.rightSE.point);return et<0?1:et>0?-1:1}if(st<wt)return-1;if(st>wt)return 1;if(V<ht){let ot=N.comparePoint(C.rightSE.point);if(ot!==0)return ot}if(V>ht){let ot=C.comparePoint(N.rightSE.point);if(ot<0)return 1;if(ot>0)return-1}if(V!==ht){let ot=Et-st,et=V-k,ut=G-wt,Ft=ht-$;if(ot>et&&ut<Ft)return 1;if(ot<et&&ut>Ft)return-1}return V>ht?1:V<ht||Et<G?-1:Et>G?1:C.id<N.id?-1:C.id>N.id?1:0}constructor(C,N,k,$){this.id=++We,this.leftSE=C,C.segment=this,C.otherSE=N,this.rightSE=N,N.segment=this,N.otherSE=C,this.rings=k,this.windings=$}static fromRing(C,N,k){let $,V,ht,st=ft.comparePoints(C,N);if(st<0)$=C,V=N,ht=1;else if(st>0)$=N,V=C,ht=-1;else throw new Error(\`Tried to create degenerate segment at [\${C.x}, \${C.y}]\`);let wt=new ft($,!0),Et=new ft(V,!1);return new ee(wt,Et,[k],[ht])}replaceRightSE(C){this.rightSE=C,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){let C=this.leftSE.point.y,N=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:C<N?C:N},ur:{x:this.rightSE.point.x,y:C>N?C:N}}}vector(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}isAnEndpoint(C){return C.x===this.leftSE.point.x&&C.y===this.leftSE.point.y||C.x===this.rightSE.point.x&&C.y===this.rightSE.point.y}comparePoint(C){if(this.isAnEndpoint(C))return 0;let N=this.leftSE.point,k=this.rightSE.point,$=this.vector();if(N.x===k.x)return C.x===N.x?0:C.x<N.x?1:-1;let V=(C.y-N.y)/$.y,ht=N.x+V*$.x;if(C.x===ht)return 0;let st=(C.x-N.x)/$.x,wt=N.y+st*$.y;return C.y===wt?0:C.y<wt?-1:1}getIntersection(C){let N=this.bbox(),k=C.bbox(),$=S(N,k);if($===null)return null;let V=this.leftSE.point,ht=this.rightSE.point,st=C.leftSE.point,wt=C.rightSE.point,Et=I(N,st)&&this.comparePoint(st)===0,G=I(k,V)&&C.comparePoint(V)===0,ot=I(N,wt)&&this.comparePoint(wt)===0,et=I(k,ht)&&C.comparePoint(ht)===0;if(G&&Et)return et&&!ot?ht:!et&&ot?wt:null;if(G)return ot&&V.x===wt.x&&V.y===wt.y?null:V;if(Et)return et&&ht.x===st.x&&ht.y===st.y?null:st;if(et&&ot)return null;if(et)return ht;if(ot)return wt;let ut=xe(V,this.vector(),st,C.vector());return ut===null||!I($,ut)?null:X.round(ut.x,ut.y)}split(C){let N=[],k=C.events!==void 0,$=new ft(C,!0),V=new ft(C,!1),ht=this.rightSE;this.replaceRightSE(V),N.push(V),N.push($);let st=new ee($,ht,this.rings.slice(),this.windings.slice());return ft.comparePoints(st.leftSE.point,st.rightSE.point)>0&&st.swapEvents(),ft.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),k&&($.checkForConsuming(),V.checkForConsuming()),N}swapEvents(){let C=this.rightSE;this.rightSE=this.leftSE,this.leftSE=C,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let N=0,k=this.windings.length;N<k;N++)this.windings[N]*=-1}consume(C){let N=this,k=C;for(;N.consumedBy;)N=N.consumedBy;for(;k.consumedBy;)k=k.consumedBy;let $=ee.compare(N,k);if($!==0){if($>0){let V=N;N=k,k=V}if(N.prev===k){let V=N;N=k,k=V}for(let V=0,ht=k.rings.length;V<ht;V++){let st=k.rings[V],wt=k.windings[V],Et=N.rings.indexOf(st);Et===-1?(N.rings.push(st),N.windings.push(wt)):N.windings[Et]+=wt}k.rings=null,k.windings=null,k.consumedBy=N,k.leftSE.consumedBy=N.leftSE,k.rightSE.consumedBy=N.rightSE}}prevInResult(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}beforeState(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{let C=this.prev.consumedBy||this.prev;this._beforeState=C.afterState()}return this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;let C=this.beforeState();this._afterState={rings:C.rings.slice(0),windings:C.windings.slice(0),multiPolys:[]};let N=this._afterState.rings,k=this._afterState.windings,$=this._afterState.multiPolys;for(let st=0,wt=this.rings.length;st<wt;st++){let Et=this.rings[st],G=this.windings[st],ot=N.indexOf(Et);ot===-1?(N.push(Et),k.push(G)):k[ot]+=G}let V=[],ht=[];for(let st=0,wt=N.length;st<wt;st++){if(k[st]===0)continue;let Et=N[st],G=Et.poly;if(ht.indexOf(G)===-1)if(Et.isExterior)V.push(G);else{ht.indexOf(G)===-1&&ht.push(G);let ot=V.indexOf(Et.poly);ot!==-1&&V.splice(ot,1)}}for(let st=0,wt=V.length;st<wt;st++){let Et=V[st].multiPoly;$.indexOf(Et)===-1&&$.push(Et)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;let C=this.beforeState().multiPolys,N=this.afterState().multiPolys;switch(dt.type){case"union":{let k=C.length===0,$=N.length===0;this._isInResult=k!==$;break}case"intersection":{let k,$;C.length<N.length?(k=C.length,$=N.length):(k=N.length,$=C.length),this._isInResult=$===dt.numMultiPolys&&k<$;break}case"xor":{let k=Math.abs(C.length-N.length);this._isInResult=k%2===1;break}case"difference":{let k=$=>$.length===1&&$[0].isSubject;this._isInResult=k(C)!==k(N);break}default:throw new Error(\`Unrecognized operation type found \${dt.type}\`)}return this._isInResult}}class ge{constructor(C,N,k){if(!Array.isArray(C)||C.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=N,this.isExterior=k,this.segments=[],typeof C[0][0]!="number"||typeof C[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let $=X.round(C[0][0],C[0][1]);this.bbox={ll:{x:$.x,y:$.y},ur:{x:$.x,y:$.y}};let V=$;for(let ht=1,st=C.length;ht<st;ht++){if(typeof C[ht][0]!="number"||typeof C[ht][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let wt=X.round(C[ht][0],C[ht][1]);wt.x===V.x&&wt.y===V.y||(this.segments.push(ee.fromRing(V,wt,this)),wt.x<this.bbox.ll.x&&(this.bbox.ll.x=wt.x),wt.y<this.bbox.ll.y&&(this.bbox.ll.y=wt.y),wt.x>this.bbox.ur.x&&(this.bbox.ur.x=wt.x),wt.y>this.bbox.ur.y&&(this.bbox.ur.y=wt.y),V=wt)}($.x!==V.x||$.y!==V.y)&&this.segments.push(ee.fromRing(V,$,this))}getSweepEvents(){let C=[];for(let N=0,k=this.segments.length;N<k;N++){let $=this.segments[N];C.push($.leftSE),C.push($.rightSE)}return C}}class fe{constructor(C,N){if(!Array.isArray(C))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new ge(C[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(let k=1,$=C.length;k<$;k++){let V=new ge(C[k],this,!1);V.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=V.bbox.ll.x),V.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=V.bbox.ll.y),V.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=V.bbox.ur.x),V.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=V.bbox.ur.y),this.interiorRings.push(V)}this.multiPoly=N}getSweepEvents(){let C=this.exteriorRing.getSweepEvents();for(let N=0,k=this.interiorRings.length;N<k;N++){let $=this.interiorRings[N].getSweepEvents();for(let V=0,ht=$.length;V<ht;V++)C.push($[V])}return C}}class Te{constructor(C,N){if(!Array.isArray(C))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof C[0][0][0]=="number"&&(C=[C])}catch(k){}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(let k=0,$=C.length;k<$;k++){let V=new fe(C[k],this);V.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=V.bbox.ll.x),V.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=V.bbox.ll.y),V.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=V.bbox.ur.x),V.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=V.bbox.ur.y),this.polys.push(V)}this.isSubject=N}getSweepEvents(){let C=[];for(let N=0,k=this.polys.length;N<k;N++){let $=this.polys[N].getSweepEvents();for(let V=0,ht=$.length;V<ht;V++)C.push($[V])}return C}}class be{static factory(C){let N=[];for(let k=0,$=C.length;k<$;k++){let V=C[k];if(!V.isInResult()||V.ringOut)continue;let ht=null,st=V.leftSE,wt=V.rightSE,Et=[st],G=st.point,ot=[];for(;ht=st,st=wt,Et.push(st),st.point!==G;)for(;;){let et=st.getAvailableLinkedEvents();if(et.length===0){let Kt=Et[0].point,me=Et[Et.length-1].point;throw new Error(\`Unable to complete output ring starting at [\${Kt.x}, \${Kt.y}]. Last matching segment found ends at [\${me.x}, \${me.y}].\`)}if(et.length===1){wt=et[0].otherSE;break}let ut=null;for(let Kt=0,me=ot.length;Kt<me;Kt++)if(ot[Kt].point===st.point){ut=Kt;break}if(ut!==null){let Kt=ot.splice(ut)[0],me=Et.splice(Kt.index);me.unshift(me[0].otherSE),N.push(new be(me.reverse()));continue}ot.push({index:Et.length,point:st.point});let Ft=st.getLeftmostComparator(ht);wt=et.sort(Ft)[0].otherSE;break}N.push(new be(Et))}return N}constructor(C){this.events=C;for(let N=0,k=C.length;N<k;N++)C[N].segment.ringOut=this;this.poly=null}getGeom(){let C=this.events[0].point,N=[C];for(let Et=1,G=this.events.length-1;Et<G;Et++){let ot=this.events[Et].point,et=this.events[Et+1].point;Ut(ot,C,et)!==0&&(N.push(ot),C=ot)}if(N.length===1)return null;let k=N[0],$=N[1];Ut(k,C,$)===0&&N.shift(),N.push(N[0]);let V=this.isExteriorRing()?1:-1,ht=this.isExteriorRing()?0:N.length-1,st=this.isExteriorRing()?N.length:-1,wt=[];for(let Et=ht;Et!=st;Et+=V)wt.push([N[Et].x,N[Et].y]);return wt}isExteriorRing(){if(this._isExteriorRing===void 0){let C=this.enclosingRing();this._isExteriorRing=C?!C.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let C=this.events[0];for(let $=1,V=this.events.length;$<V;$++){let ht=this.events[$];ft.compare(C,ht)>0&&(C=ht)}let N=C.segment.prevInResult(),k=N?N.prevInResult():null;for(;;){if(!N)return null;if(!k)return N.ringOut;if(k.ringOut!==N.ringOut)return k.ringOut.enclosingRing()!==N.ringOut?N.ringOut:N.ringOut.enclosingRing();N=k.prevInResult(),k=N?N.prevInResult():null}}}class Wt{constructor(C){this.exteriorRing=C,C.poly=this,this.interiorRings=[]}addInterior(C){this.interiorRings.push(C),C.poly=this}getGeom(){let C=[this.exteriorRing.getGeom()];if(C[0]===null)return null;for(let N=0,k=this.interiorRings.length;N<k;N++){let $=this.interiorRings[N].getGeom();$!==null&&C.push($)}return C}}class Me{constructor(C){this.rings=C,this.polys=this._composePolys(C)}getGeom(){let C=[];for(let N=0,k=this.polys.length;N<k;N++){let $=this.polys[N].getGeom();$!==null&&C.push($)}return C}_composePolys(C){let N=[];for(let k=0,$=C.length;k<$;k++){let V=C[k];if(!V.poly)if(V.isExteriorRing())N.push(new Wt(V));else{let ht=V.enclosingRing();ht.poly||N.push(new Wt(ht)),ht.poly.addInterior(V)}}return N}}class tt{constructor(C){let N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ee.compare;this.queue=C,this.tree=new g(N),this.segments=[]}process(C){let N=C.segment,k=[];if(C.consumedBy)return C.isLeft?this.queue.remove(C.otherSE):this.tree.remove(N),k;let $=C.isLeft?this.tree.add(N):this.tree.find(N);if(!$)throw new Error(\`Unable to find segment #\${N.id} [\${N.leftSE.point.x}, \${N.leftSE.point.y}] -> [\${N.rightSE.point.x}, \${N.rightSE.point.y}] in SweepLine tree.\`);let V=$,ht=$,st,wt;for(;st===void 0;)V=this.tree.prev(V),V===null?st=null:V.key.consumedBy===void 0&&(st=V.key);for(;wt===void 0;)ht=this.tree.next(ht),ht===null?wt=null:ht.key.consumedBy===void 0&&(wt=ht.key);if(C.isLeft){let Et=null;if(st){let ot=st.getIntersection(N);if(ot!==null&&(N.isAnEndpoint(ot)||(Et=ot),!st.isAnEndpoint(ot))){let et=this._splitSafely(st,ot);for(let ut=0,Ft=et.length;ut<Ft;ut++)k.push(et[ut])}}let G=null;if(wt){let ot=wt.getIntersection(N);if(ot!==null&&(N.isAnEndpoint(ot)||(G=ot),!wt.isAnEndpoint(ot))){let et=this._splitSafely(wt,ot);for(let ut=0,Ft=et.length;ut<Ft;ut++)k.push(et[ut])}}if(Et!==null||G!==null){let ot=null;Et===null?ot=G:G===null?ot=Et:ot=ft.comparePoints(Et,G)<=0?Et:G,this.queue.remove(N.rightSE),k.push(N.rightSE);let et=N.split(ot);for(let ut=0,Ft=et.length;ut<Ft;ut++)k.push(et[ut])}k.length>0?(this.tree.remove(N),k.push(C)):(this.segments.push(N),N.prev=st)}else{if(st&&wt){let Et=st.getIntersection(wt);if(Et!==null){if(!st.isAnEndpoint(Et)){let G=this._splitSafely(st,Et);for(let ot=0,et=G.length;ot<et;ot++)k.push(G[ot])}if(!wt.isAnEndpoint(Et)){let G=this._splitSafely(wt,Et);for(let ot=0,et=G.length;ot<et;ot++)k.push(G[ot])}}}this.tree.remove(N)}return k}_splitSafely(C,N){this.tree.remove(C);let k=C.rightSE;this.queue.remove(k);let $=C.split(N);return $.push(k),C.consumedBy===void 0&&this.tree.add(C),$}}let z=typeof process!="undefined"&&process.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,Pt=typeof process!="undefined"&&process.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6;class Ot{run(C,N,k){dt.type=C,X.reset();let $=[new Te(N,!0)];for(let ot=0,et=k.length;ot<et;ot++)$.push(new Te(k[ot],!1));if(dt.numMultiPolys=$.length,dt.type==="difference"){let ot=$[0],et=1;for(;et<$.length;)S($[et].bbox,ot.bbox)!==null?et++:$.splice(et,1)}if(dt.type==="intersection")for(let ot=0,et=$.length;ot<et;ot++){let ut=$[ot];for(let Ft=ot+1,Kt=$.length;Ft<Kt;Ft++)if(S(ut.bbox,$[Ft].bbox)===null)return[]}let V=new g(ft.compare);for(let ot=0,et=$.length;ot<et;ot++){let ut=$[ot].getSweepEvents();for(let Ft=0,Kt=ut.length;Ft<Kt;Ft++)if(V.insert(ut[Ft]),V.size>z)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}let ht=new tt(V),st=V.size,wt=V.pop();for(;wt;){let ot=wt.key;if(V.size===st){let ut=ot.segment;throw new Error(\`Unable to pop() \${ot.isLeft?"left":"right"} SweepEvent [\${ot.point.x}, \${ot.point.y}] from segment #\${ut.id} [\${ut.leftSE.point.x}, \${ut.leftSE.point.y}] -> [\${ut.rightSE.point.x}, \${ut.rightSE.point.y}] from queue.\`)}if(V.size>z)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if(ht.segments.length>Pt)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");let et=ht.process(ot);for(let ut=0,Ft=et.length;ut<Ft;ut++){let Kt=et[ut];Kt.consumedBy===void 0&&V.insert(Kt)}st=V.size,wt=V.pop()}X.reset();let Et=be.factory(ht.segments);return new Me(Et).getGeom()}}let dt=new Ot;var ne={union:function(rt){for(var C=arguments.length,N=new Array(C>1?C-1:0),k=1;k<C;k++)N[k-1]=arguments[k];return dt.run("union",rt,N)},intersection:function(rt){for(var C=arguments.length,N=new Array(C>1?C-1:0),k=1;k<C;k++)N[k-1]=arguments[k];return dt.run("intersection",rt,N)},xor:function(rt){for(var C=arguments.length,N=new Array(C>1?C-1:0),k=1;k<C;k++)N[k-1]=arguments[k];return dt.run("xor",rt,N)},difference:function(rt){for(var C=arguments.length,N=new Array(C>1?C-1:0),k=1;k<C;k++)N[k-1]=arguments[k];return dt.run("difference",rt,N)}};return ne})});var HR=lt((Mg,qR)=>{(function(n,t){typeof Mg=="object"&&typeof qR!="undefined"?t(Mg):typeof define=="function"&&define.amd?define(["exports"],t):t(n.jsts={})})(Mg,function(n){"use strict";function t(){}function e(r){this.message=r||""}function o(r){this.message=r||""}function s(r){this.message=r||""}function c(){}function h(r){return r===null?Ze:r.color}function p(r){return r===null?null:r.parent}function g(r,i){r!==null&&(r.color=i)}function m(r){return r===null?null:r.left}function _(r){return r===null?null:r.right}function E(){this.root_=null,this.size_=0}function x(){}function b(){this.array_=[],arguments[0]instanceof st&&this.addAll(arguments[0])}function P(){}function I(r){this.message=r||""}function S(){this.array_=[]}"fill"in Array.prototype||Object.defineProperty(Array.prototype,"fill",{configurable:!0,value:function(r){if(this===void 0||this===null)throw new TypeError(this+" is not an object");var i=Object(this),a=Math.max(Math.min(i.length,9007199254740991),0)||0,l=1 in arguments&&parseInt(Number(arguments[1]),10)||0;l=l<0?Math.max(a+l,0):Math.min(l,a);var d=2 in arguments&&arguments[2]!==void 0?parseInt(Number(arguments[2]),10)||0:a;for(d=d<0?Math.max(a+arguments[2],0):Math.min(d,a);l<d;)i[l]=r,++l;return i},writable:!0}),Number.isFinite=Number.isFinite||function(r){return typeof r=="number"&&isFinite(r)},Number.isInteger=Number.isInteger||function(r){return typeof r=="number"&&isFinite(r)&&Math.floor(r)===r},Number.parseFloat=Number.parseFloat||parseFloat,Number.isNaN=Number.isNaN||function(r){return r!=r},Math.trunc=Math.trunc||function(r){return r<0?Math.ceil(r):Math.floor(r)};var w=function(){};w.prototype.interfaces_=function(){return[]},w.prototype.getClass=function(){return w},w.prototype.equalsWithTolerance=function(r,i,a){return Math.abs(r-i)<=a};var R=function(r){function i(a){r.call(this,a),this.name="IllegalArgumentException",this.message=a,this.stack=new r().stack}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i}(Error),T=function(){},F={MAX_VALUE:{configurable:!0}};T.isNaN=function(r){return Number.isNaN(r)},T.doubleToLongBits=function(r){return r},T.longBitsToDouble=function(r){return r},T.isInfinite=function(r){return!Number.isFinite(r)},F.MAX_VALUE.get=function(){return Number.MAX_VALUE},Object.defineProperties(T,F);var W=function(){},X=function(){},q=function(){},D=function r(){if(this.x=null,this.y=null,this.z=null,arguments.length===0)this.x=0,this.y=0,this.z=r.NULL_ORDINATE;else if(arguments.length===1){var i=arguments[0];this.x=i.x,this.y=i.y,this.z=i.z}else arguments.length===2?(this.x=arguments[0],this.y=arguments[1],this.z=r.NULL_ORDINATE):arguments.length===3&&(this.x=arguments[0],this.y=arguments[1],this.z=arguments[2])},xt={DimensionalComparator:{configurable:!0},serialVersionUID:{configurable:!0},NULL_ORDINATE:{configurable:!0},X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0}};D.prototype.setOrdinate=function(r,i){switch(r){case D.X:this.x=i;break;case D.Y:this.y=i;break;case D.Z:this.z=i;break;default:throw new R("Invalid ordinate index: "+r)}},D.prototype.equals2D=function(){if(arguments.length===1){var r=arguments[0];return this.x===r.x&&this.y===r.y}if(arguments.length===2){var i=arguments[0],a=arguments[1];return!!w.equalsWithTolerance(this.x,i.x,a)&&!!w.equalsWithTolerance(this.y,i.y,a)}},D.prototype.getOrdinate=function(r){switch(r){case D.X:return this.x;case D.Y:return this.y;case D.Z:return this.z}throw new R("Invalid ordinate index: "+r)},D.prototype.equals3D=function(r){return this.x===r.x&&this.y===r.y&&(this.z===r.z||T.isNaN(this.z))&&T.isNaN(r.z)},D.prototype.equals=function(r){return r instanceof D&&this.equals2D(r)},D.prototype.equalInZ=function(r,i){return w.equalsWithTolerance(this.z,r.z,i)},D.prototype.compareTo=function(r){var i=r;return this.x<i.x?-1:this.x>i.x?1:this.y<i.y?-1:this.y>i.y?1:0},D.prototype.clone=function(){},D.prototype.copy=function(){return new D(this)},D.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.z+")"},D.prototype.distance3D=function(r){var i=this.x-r.x,a=this.y-r.y,l=this.z-r.z;return Math.sqrt(i*i+a*a+l*l)},D.prototype.distance=function(r){var i=this.x-r.x,a=this.y-r.y;return Math.sqrt(i*i+a*a)},D.prototype.hashCode=function(){var r=17;return r=37*r+D.hashCode(this.x),r=37*r+D.hashCode(this.y)},D.prototype.setCoordinate=function(r){this.x=r.x,this.y=r.y,this.z=r.z},D.prototype.interfaces_=function(){return[W,X,t]},D.prototype.getClass=function(){return D},D.hashCode=function(){if(arguments.length===1){var r=arguments[0],i=T.doubleToLongBits(r);return Math.trunc((i^i)>>>32)}},xt.DimensionalComparator.get=function(){return B},xt.serialVersionUID.get=function(){return 6683108902428367e3},xt.NULL_ORDINATE.get=function(){return T.NaN},xt.X.get=function(){return 0},xt.Y.get=function(){return 1},xt.Z.get=function(){return 2},Object.defineProperties(D,xt);var B=function(r){if(this._dimensionsToTest=2,arguments.length!==0){if(arguments.length===1){var i=arguments[0];if(i!==2&&i!==3)throw new R("only 2 or 3 dimensions may be specified");this._dimensionsToTest=i}}};B.prototype.compare=function(r,i){var a=r,l=i,d=B.compare(a.x,l.x);if(d!==0)return d;var v=B.compare(a.y,l.y);return v!==0?v:this._dimensionsToTest<=2?0:B.compare(a.z,l.z)},B.prototype.interfaces_=function(){return[q]},B.prototype.getClass=function(){return B},B.compare=function(r,i){return r<i?-1:r>i?1:T.isNaN(r)?T.isNaN(i)?0:-1:T.isNaN(i)?1:0};var j=function(){};j.prototype.create=function(){},j.prototype.interfaces_=function(){return[]},j.prototype.getClass=function(){return j};var J=function(){},Dt={INTERIOR:{configurable:!0},BOUNDARY:{configurable:!0},EXTERIOR:{configurable:!0},NONE:{configurable:!0}};J.prototype.interfaces_=function(){return[]},J.prototype.getClass=function(){return J},J.toLocationSymbol=function(r){switch(r){case J.EXTERIOR:return"e";case J.BOUNDARY:return"b";case J.INTERIOR:return"i";case J.NONE:return"-"}throw new R("Unknown location value: "+r)},Dt.INTERIOR.get=function(){return 0},Dt.BOUNDARY.get=function(){return 1},Dt.EXTERIOR.get=function(){return 2},Dt.NONE.get=function(){return-1},Object.defineProperties(J,Dt);var Q=function(r,i){return r.interfaces_&&r.interfaces_().indexOf(i)>-1},At=function(){},Mt={LOG_10:{configurable:!0}};At.prototype.interfaces_=function(){return[]},At.prototype.getClass=function(){return At},At.log10=function(r){var i=Math.log(r);return T.isInfinite(i)||T.isNaN(i)?i:i/At.LOG_10},At.min=function(r,i,a,l){var d=r;return i<d&&(d=i),a<d&&(d=a),l<d&&(d=l),d},At.clamp=function(){if(typeof arguments[2]=="number"&&typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var r=arguments[0],i=arguments[1],a=arguments[2];return r<i?i:r>a?a:r}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var l=arguments[0],d=arguments[1],v=arguments[2];return l<d?d:l>v?v:l}},At.wrap=function(r,i){return r<0?i- -r%i:r%i},At.max=function(){if(arguments.length===3){var r=arguments[0],i=arguments[1],a=arguments[2],l=r;return i>l&&(l=i),a>l&&(l=a),l}if(arguments.length===4){var d=arguments[0],v=arguments[1],M=arguments[2],L=arguments[3],H=d;return v>H&&(H=v),M>H&&(H=M),L>H&&(H=L),H}},At.average=function(r,i){return(r+i)/2},Mt.LOG_10.get=function(){return Math.log(10)},Object.defineProperties(At,Mt);var Rt=function(r){this.str=r};Rt.prototype.append=function(r){this.str+=r},Rt.prototype.setCharAt=function(r,i){this.str=this.str.substr(0,r)+i+this.str.substr(r+1)},Rt.prototype.toString=function(r){return this.str};var pt=function(r){this.value=r};pt.prototype.intValue=function(){return this.value},pt.prototype.compareTo=function(r){return this.value<r?-1:this.value>r?1:0},pt.isNaN=function(r){return Number.isNaN(r)};var yt=function(){};yt.isWhitespace=function(r){return r<=32&&r>=0||r===127},yt.toUpperCase=function(r){return r.toUpperCase()};var K=function r(){if(this._hi=0,this._lo=0,arguments.length===0)this.init(0);else if(arguments.length===1){if(typeof arguments[0]=="number"){var i=arguments[0];this.init(i)}else if(arguments[0]instanceof r){var a=arguments[0];this.init(a)}else if(typeof arguments[0]=="string"){var l=arguments[0];r.call(this,r.parse(l))}}else if(arguments.length===2){var d=arguments[0],v=arguments[1];this.init(d,v)}},Bt={PI:{configurable:!0},TWO_PI:{configurable:!0},PI_2:{configurable:!0},E:{configurable:!0},NaN:{configurable:!0},EPS:{configurable:!0},SPLIT:{configurable:!0},MAX_PRINT_DIGITS:{configurable:!0},TEN:{configurable:!0},ONE:{configurable:!0},SCI_NOT_EXPONENT_CHAR:{configurable:!0},SCI_NOT_ZERO:{configurable:!0}};K.prototype.le=function(r){return(this._hi<r._hi||this._hi===r._hi)&&this._lo<=r._lo},K.prototype.extractSignificantDigits=function(r,i){var a=this.abs(),l=K.magnitude(a._hi),d=K.TEN.pow(l);(a=a.divide(d)).gt(K.TEN)?(a=a.divide(K.TEN),l+=1):a.lt(K.ONE)&&(a=a.multiply(K.TEN),l-=1);for(var v=l+1,M=new Rt,L=K.MAX_PRINT_DIGITS-1,H=0;H<=L;H++){r&&H===v&&M.append(".");var it=Math.trunc(a._hi);if(it<0)break;var bt=!1,Tt=0;it>9?(bt=!0,Tt="9"):Tt="0"+it,M.append(Tt),a=a.subtract(K.valueOf(it)).multiply(K.TEN),bt&&a.selfAdd(K.TEN);var Jt=!0,Qt=K.magnitude(a._hi);if(Qt<0&&Math.abs(Qt)>=L-H&&(Jt=!1),!Jt)break}return i[0]=l,M.toString()},K.prototype.sqr=function(){return this.multiply(this)},K.prototype.doubleValue=function(){return this._hi+this._lo},K.prototype.subtract=function(){if(arguments[0]instanceof K){var r=arguments[0];return this.add(r.negate())}if(typeof arguments[0]=="number"){var i=arguments[0];return this.add(-i)}},K.prototype.equals=function(){if(arguments.length===1){var r=arguments[0];return this._hi===r._hi&&this._lo===r._lo}},K.prototype.isZero=function(){return this._hi===0&&this._lo===0},K.prototype.selfSubtract=function(){if(arguments[0]instanceof K){var r=arguments[0];return this.isNaN()?this:this.selfAdd(-r._hi,-r._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.isNaN()?this:this.selfAdd(-i,0)}},K.prototype.getSpecialNumberString=function(){return this.isZero()?"0.0":this.isNaN()?"NaN ":null},K.prototype.min=function(r){return this.le(r)?this:r},K.prototype.selfDivide=function(){if(arguments.length===1){if(arguments[0]instanceof K){var r=arguments[0];return this.selfDivide(r._hi,r._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.selfDivide(i,0)}}else if(arguments.length===2){var a=arguments[0],l=arguments[1],d=null,v=null,M=null,L=null,H=null,it=null,bt=null,Tt=null;return H=this._hi/a,it=K.SPLIT*H,d=it-H,Tt=K.SPLIT*a,d=it-d,v=H-d,M=Tt-a,bt=H*a,M=Tt-M,L=a-M,Tt=d*M-bt+d*L+v*M+v*L,it=(this._hi-bt-Tt+this._lo-H*l)/a,Tt=H+it,this._hi=Tt,this._lo=H-Tt+it,this}},K.prototype.dump=function(){return"DD<"+this._hi+", "+this._lo+">"},K.prototype.divide=function(){if(arguments[0]instanceof K){var r=arguments[0],i=null,a=null,l=null,d=null,v=null,M=null,L=null,H=null;return a=(v=this._hi/r._hi)-(i=(M=K.SPLIT*v)-(i=M-v)),H=i*(l=(H=K.SPLIT*r._hi)-(l=H-r._hi))-(L=v*r._hi)+i*(d=r._hi-l)+a*l+a*d,M=(this._hi-L-H+this._lo-v*r._lo)/r._hi,new K(H=v+M,v-H+M)}if(typeof arguments[0]=="number"){var it=arguments[0];return T.isNaN(it)?K.createNaN():K.copy(this).selfDivide(it,0)}},K.prototype.ge=function(r){return(this._hi>r._hi||this._hi===r._hi)&&this._lo>=r._lo},K.prototype.pow=function(r){if(r===0)return K.valueOf(1);var i=new K(this),a=K.valueOf(1),l=Math.abs(r);if(l>1)for(;l>0;)l%2==1&&a.selfMultiply(i),(l/=2)>0&&(i=i.sqr());else a=i;return r<0?a.reciprocal():a},K.prototype.ceil=function(){if(this.isNaN())return K.NaN;var r=Math.ceil(this._hi),i=0;return r===this._hi&&(i=Math.ceil(this._lo)),new K(r,i)},K.prototype.compareTo=function(r){var i=r;return this._hi<i._hi?-1:this._hi>i._hi?1:this._lo<i._lo?-1:this._lo>i._lo?1:0},K.prototype.rint=function(){return this.isNaN()?this:this.add(.5).floor()},K.prototype.setValue=function(){if(arguments[0]instanceof K){var r=arguments[0];return this.init(r),this}if(typeof arguments[0]=="number"){var i=arguments[0];return this.init(i),this}},K.prototype.max=function(r){return this.ge(r)?this:r},K.prototype.sqrt=function(){if(this.isZero())return K.valueOf(0);if(this.isNegative())return K.NaN;var r=1/Math.sqrt(this._hi),i=this._hi*r,a=K.valueOf(i),l=this.subtract(a.sqr())._hi*(.5*r);return a.add(l)},K.prototype.selfAdd=function(){if(arguments.length===1){if(arguments[0]instanceof K){var r=arguments[0];return this.selfAdd(r._hi,r._lo)}if(typeof arguments[0]=="number"){var i=arguments[0],a=null,l=null,d=null,v=null,M=null,L=null;return d=this._hi+i,M=d-this._hi,v=d-M,v=i-M+(this._hi-v),L=v+this._lo,a=d+L,l=L+(d-a),this._hi=a+l,this._lo=l+(a-this._hi),this}}else if(arguments.length===2){var H=arguments[0],it=arguments[1],bt=null,Tt=null,Jt=null,Qt=null,le=null,Ee=null,Nn=null;Qt=this._hi+H,Tt=this._lo+it,le=Qt-(Ee=Qt-this._hi),Jt=Tt-(Nn=Tt-this._lo);var Kn=(bt=Qt+(Ee=(le=H-Ee+(this._hi-le))+Tt))+(Ee=(Jt=it-Nn+(this._lo-Jt))+(Ee+(Qt-bt))),ci=Ee+(bt-Kn);return this._hi=Kn,this._lo=ci,this}},K.prototype.selfMultiply=function(){if(arguments.length===1){if(arguments[0]instanceof K){var r=arguments[0];return this.selfMultiply(r._hi,r._lo)}if(typeof arguments[0]=="number"){var i=arguments[0];return this.selfMultiply(i,0)}}else if(arguments.length===2){var a=arguments[0],l=arguments[1],d=null,v=null,M=null,L=null,H=null,it=null;d=(H=K.SPLIT*this._hi)-this._hi,it=K.SPLIT*a,d=H-d,v=this._hi-d,M=it-a;var bt=(H=this._hi*a)+(it=d*(M=it-M)-H+d*(L=a-M)+v*M+v*L+(this._hi*l+this._lo*a)),Tt=it+(d=H-bt);return this._hi=bt,this._lo=Tt,this}},K.prototype.selfSqr=function(){return this.selfMultiply(this)},K.prototype.floor=function(){if(this.isNaN())return K.NaN;var r=Math.floor(this._hi),i=0;return r===this._hi&&(i=Math.floor(this._lo)),new K(r,i)},K.prototype.negate=function(){return this.isNaN()?this:new K(-this._hi,-this._lo)},K.prototype.clone=function(){},K.prototype.multiply=function(){if(arguments[0]instanceof K){var r=arguments[0];return r.isNaN()?K.createNaN():K.copy(this).selfMultiply(r)}if(typeof arguments[0]=="number"){var i=arguments[0];return T.isNaN(i)?K.createNaN():K.copy(this).selfMultiply(i,0)}},K.prototype.isNaN=function(){return T.isNaN(this._hi)},K.prototype.intValue=function(){return Math.trunc(this._hi)},K.prototype.toString=function(){var r=K.magnitude(this._hi);return r>=-3&&r<=20?this.toStandardNotation():this.toSciNotation()},K.prototype.toStandardNotation=function(){var r=this.getSpecialNumberString();if(r!==null)return r;var i=new Array(1).fill(null),a=this.extractSignificantDigits(!0,i),l=i[0]+1,d=a;if(a.charAt(0)===".")d="0"+a;else if(l<0)d="0."+K.stringOfChar("0",-l)+a;else if(a.indexOf(".")===-1){var v=l-a.length;d=a+K.stringOfChar("0",v)+".0"}return this.isNegative()?"-"+d:d},K.prototype.reciprocal=function(){var r=null,i=null,a=null,l=null,d=null,v=null,M=null,L=null;i=(d=1/this._hi)-(r=(v=K.SPLIT*d)-(r=v-d)),a=(L=K.SPLIT*this._hi)-this._hi;var H=d+(v=(1-(M=d*this._hi)-(L=r*(a=L-a)-M+r*(l=this._hi-a)+i*a+i*l)-d*this._lo)/this._hi);return new K(H,d-H+v)},K.prototype.toSciNotation=function(){if(this.isZero())return K.SCI_NOT_ZERO;var r=this.getSpecialNumberString();if(r!==null)return r;var i=new Array(1).fill(null),a=this.extractSignificantDigits(!1,i),l=K.SCI_NOT_EXPONENT_CHAR+i[0];if(a.charAt(0)==="0")throw new Error("Found leading zero: "+a);var d="";a.length>1&&(d=a.substring(1));var v=a.charAt(0)+"."+d;return this.isNegative()?"-"+v+l:v+l},K.prototype.abs=function(){return this.isNaN()?K.NaN:this.isNegative()?this.negate():new K(this)},K.prototype.isPositive=function(){return(this._hi>0||this._hi===0)&&this._lo>0},K.prototype.lt=function(r){return(this._hi<r._hi||this._hi===r._hi)&&this._lo<r._lo},K.prototype.add=function(){if(arguments[0]instanceof K){var r=arguments[0];return K.copy(this).selfAdd(r)}if(typeof arguments[0]=="number"){var i=arguments[0];return K.copy(this).selfAdd(i)}},K.prototype.init=function(){if(arguments.length===1){if(typeof arguments[0]=="number"){var r=arguments[0];this._hi=r,this._lo=0}else if(arguments[0]instanceof K){var i=arguments[0];this._hi=i._hi,this._lo=i._lo}}else if(arguments.length===2){var a=arguments[0],l=arguments[1];this._hi=a,this._lo=l}},K.prototype.gt=function(r){return(this._hi>r._hi||this._hi===r._hi)&&this._lo>r._lo},K.prototype.isNegative=function(){return(this._hi<0||this._hi===0)&&this._lo<0},K.prototype.trunc=function(){return this.isNaN()?K.NaN:this.isPositive()?this.floor():this.ceil()},K.prototype.signum=function(){return this._hi>0?1:this._hi<0?-1:this._lo>0?1:this._lo<0?-1:0},K.prototype.interfaces_=function(){return[t,W,X]},K.prototype.getClass=function(){return K},K.sqr=function(r){return K.valueOf(r).selfMultiply(r)},K.valueOf=function(){if(typeof arguments[0]=="string"){var r=arguments[0];return K.parse(r)}if(typeof arguments[0]=="number"){var i=arguments[0];return new K(i)}},K.sqrt=function(r){return K.valueOf(r).sqrt()},K.parse=function(r){for(var i=0,a=r.length;yt.isWhitespace(r.charAt(i));)i++;var l=!1;if(i<a){var d=r.charAt(i);d!=="-"&&d!=="+"||(i++,d==="-"&&(l=!0))}for(var v=new K,M=0,L=0,H=0;!(i>=a);){var it=r.charAt(i);if(i++,yt.isDigit(it)){var bt=it-"0";v.selfMultiply(K.TEN),v.selfAdd(bt),M++}else{if(it!=="."){if(it==="e"||it==="E"){var Tt=r.substring(i);try{H=pt.parseInt(Tt)}catch(Nn){throw Nn instanceof Error?new Error("Invalid exponent "+Tt+" in string "+r):Nn}break}throw new Error("Unexpected character '"+it+"' at position "+i+" in string "+r)}L=M}}var Jt=v,Qt=M-L-H;if(Qt===0)Jt=v;else if(Qt>0){var le=K.TEN.pow(Qt);Jt=v.divide(le)}else if(Qt<0){var Ee=K.TEN.pow(-Qt);Jt=v.multiply(Ee)}return l?Jt.negate():Jt},K.createNaN=function(){return new K(T.NaN,T.NaN)},K.copy=function(r){return new K(r)},K.magnitude=function(r){var i=Math.abs(r),a=Math.log(i)/Math.log(10),l=Math.trunc(Math.floor(a));return 10*Math.pow(10,l)<=i&&(l+=1),l},K.stringOfChar=function(r,i){for(var a=new Rt,l=0;l<i;l++)a.append(r);return a.toString()},Bt.PI.get=function(){return new K(3.141592653589793,12246467991473532e-32)},Bt.TWO_PI.get=function(){return new K(6.283185307179586,24492935982947064e-32)},Bt.PI_2.get=function(){return new K(1.5707963267948966,6123233995736766e-32)},Bt.E.get=function(){return new K(2.718281828459045,14456468917292502e-32)},Bt.NaN.get=function(){return new K(T.NaN,T.NaN)},Bt.EPS.get=function(){return 123259516440783e-46},Bt.SPLIT.get=function(){return 134217729},Bt.MAX_PRINT_DIGITS.get=function(){return 32},Bt.TEN.get=function(){return K.valueOf(10)},Bt.ONE.get=function(){return K.valueOf(1)},Bt.SCI_NOT_EXPONENT_CHAR.get=function(){return"E"},Bt.SCI_NOT_ZERO.get=function(){return"0.0E0"},Object.defineProperties(K,Bt);var Gt=function(){},ae={DP_SAFE_EPSILON:{configurable:!0}};Gt.prototype.interfaces_=function(){return[]},Gt.prototype.getClass=function(){return Gt},Gt.orientationIndex=function(r,i,a){var l=Gt.orientationIndexFilter(r,i,a);if(l<=1)return l;var d=K.valueOf(i.x).selfAdd(-r.x),v=K.valueOf(i.y).selfAdd(-r.y),M=K.valueOf(a.x).selfAdd(-i.x),L=K.valueOf(a.y).selfAdd(-i.y);return d.selfMultiply(L).selfSubtract(v.selfMultiply(M)).signum()},Gt.signOfDet2x2=function(r,i,a,l){return r.multiply(l).selfSubtract(i.multiply(a)).signum()},Gt.intersection=function(r,i,a,l){var d=K.valueOf(l.y).selfSubtract(a.y).selfMultiply(K.valueOf(i.x).selfSubtract(r.x)),v=K.valueOf(l.x).selfSubtract(a.x).selfMultiply(K.valueOf(i.y).selfSubtract(r.y)),M=d.subtract(v),L=K.valueOf(l.x).selfSubtract(a.x).selfMultiply(K.valueOf(r.y).selfSubtract(a.y)),H=K.valueOf(l.y).selfSubtract(a.y).selfMultiply(K.valueOf(r.x).selfSubtract(a.x)),it=L.subtract(H).selfDivide(M).doubleValue(),bt=K.valueOf(r.x).selfAdd(K.valueOf(i.x).selfSubtract(r.x).selfMultiply(it)).doubleValue(),Tt=K.valueOf(i.x).selfSubtract(r.x).selfMultiply(K.valueOf(r.y).selfSubtract(a.y)),Jt=K.valueOf(i.y).selfSubtract(r.y).selfMultiply(K.valueOf(r.x).selfSubtract(a.x)),Qt=Tt.subtract(Jt).selfDivide(M).doubleValue(),le=K.valueOf(a.y).selfAdd(K.valueOf(l.y).selfSubtract(a.y).selfMultiply(Qt)).doubleValue();return new D(bt,le)},Gt.orientationIndexFilter=function(r,i,a){var l=null,d=(r.x-a.x)*(i.y-a.y),v=(r.y-a.y)*(i.x-a.x),M=d-v;if(d>0){if(v<=0)return Gt.signum(M);l=d+v}else{if(!(d<0)||v>=0)return Gt.signum(M);l=-d-v}var L=Gt.DP_SAFE_EPSILON*l;return M>=L||-M>=L?Gt.signum(M):2},Gt.signum=function(r){return r>0?1:r<0?-1:0},ae.DP_SAFE_EPSILON.get=function(){return 1e-15},Object.defineProperties(Gt,ae);var at=function(){},Ut={X:{configurable:!0},Y:{configurable:!0},Z:{configurable:!0},M:{configurable:!0}};Ut.X.get=function(){return 0},Ut.Y.get=function(){return 1},Ut.Z.get=function(){return 2},Ut.M.get=function(){return 3},at.prototype.setOrdinate=function(r,i,a){},at.prototype.size=function(){},at.prototype.getOrdinate=function(r,i){},at.prototype.getCoordinate=function(){},at.prototype.getCoordinateCopy=function(r){},at.prototype.getDimension=function(){},at.prototype.getX=function(r){},at.prototype.clone=function(){},at.prototype.expandEnvelope=function(r){},at.prototype.copy=function(){},at.prototype.getY=function(r){},at.prototype.toCoordinateArray=function(){},at.prototype.interfaces_=function(){return[X]},at.prototype.getClass=function(){return at},Object.defineProperties(at,Ut);var jt=function(){},ce=function(r){function i(){r.call(this,"Projective point not representable on the Cartesian plane.")}return r&&(i.__proto__=r),i.prototype=Object.create(r&&r.prototype),i.prototype.constructor=i,i.prototype.interfaces_=function(){return[]},i.prototype.getClass=function(){return i},i}(jt),te=function(){};te.arraycopy=function(r,i,a,l,d){for(var v=0,M=i;M<i+d;M++)a[l+v]=r[M],v++},te.getProperty=function(r){return{"line.separator":\`
@@ -11567,4 +11567,4 @@ void main() {
11567
11567
 
11568
11568
  }\`,Ky=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(t,e,o){if(this.texture===null){let s=new Ds,c=t.properties.get(s);c.__webglTexture=e.texture,(e.depthNear!=o.depthNear||e.depthFar!=o.depthFar)&&(this.depthNear=e.depthNear,this.depthFar=e.depthFar),this.texture=s}}render(t,e){if(this.texture!==null){if(this.mesh===null){let o=e.cameras[0].viewport,s=new Ca({extensions:{fragDepth:!0},vertexShader:VW,fragmentShader:WW,uniforms:{depthColor:{value:this.texture},depthWidth:{value:o.z},depthHeight:{value:o.w}}});this.mesh=new ea(new bd(20,20),s)}t.render(this.mesh,e)}}reset(){this.texture=null,this.mesh=null}},jy=class extends Yu{constructor(t,e){super();let o=this,s=null,c=1,h=null,p="local-floor",g=1,m=null,_=null,E=null,x=null,b=null,P=null,I=new Ky,S=e.getContextAttributes(),w=null,R=null,T=[],F=[],W=new Yn,X=null,q=new ps;q.layers.enable(1),q.viewport=new Ki;let D=new ps;D.layers.enable(2),D.viewport=new Ki;let xt=[q,D],B=new Jy;B.layers.enable(1),B.layers.enable(2);let j=null,J=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(at){let Ut=T[at];return Ut===void 0&&(Ut=new Jf,T[at]=Ut),Ut.getTargetRaySpace()},this.getControllerGrip=function(at){let Ut=T[at];return Ut===void 0&&(Ut=new Jf,T[at]=Ut),Ut.getGripSpace()},this.getHand=function(at){let Ut=T[at];return Ut===void 0&&(Ut=new Jf,T[at]=Ut),Ut.getHandSpace()};function Dt(at){let Ut=F.indexOf(at.inputSource);if(Ut===-1)return;let jt=T[Ut];jt!==void 0&&(jt.update(at.inputSource,at.frame,m||h),jt.dispatchEvent({type:at.type,data:at.inputSource}))}function Q(){s.removeEventListener("select",Dt),s.removeEventListener("selectstart",Dt),s.removeEventListener("selectend",Dt),s.removeEventListener("squeeze",Dt),s.removeEventListener("squeezestart",Dt),s.removeEventListener("squeezeend",Dt),s.removeEventListener("end",Q),s.removeEventListener("inputsourceschange",At);for(let at=0;at<T.length;at++){let Ut=F[at];Ut!==null&&(F[at]=null,T[at].disconnect(Ut))}j=null,J=null,I.reset(),t.setRenderTarget(w),b=null,x=null,E=null,s=null,R=null,ae.stop(),o.isPresenting=!1,t.setPixelRatio(X),t.setSize(W.width,W.height,!1),o.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(at){c=at,o.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change framebuffer scale while presenting.")},this.setReferenceSpaceType=function(at){p=at,o.isPresenting===!0&&console.warn("THREE.WebXRManager: Cannot change reference space type while presenting.")},this.getReferenceSpace=function(){return m||h},this.setReferenceSpace=function(at){m=at},this.getBaseLayer=function(){return x!==null?x:b},this.getBinding=function(){return E},this.getFrame=function(){return P},this.getSession=function(){return s},this.setSession=function(at){return ec(this,null,function*(){if(s=at,s!==null){if(w=t.getRenderTarget(),s.addEventListener("select",Dt),s.addEventListener("selectstart",Dt),s.addEventListener("selectend",Dt),s.addEventListener("squeeze",Dt),s.addEventListener("squeezestart",Dt),s.addEventListener("squeezeend",Dt),s.addEventListener("end",Q),s.addEventListener("inputsourceschange",At),S.xrCompatible!==!0&&(yield e.makeXRCompatible()),X=t.getPixelRatio(),t.getSize(W),s.renderState.layers===void 0||t.capabilities.isWebGL2===!1){let Ut={antialias:s.renderState.layers===void 0?S.antialias:!0,alpha:!0,depth:S.depth,stencil:S.stencil,framebufferScaleFactor:c};b=new XRWebGLLayer(s,e,Ut),s.updateRenderState({baseLayer:b}),t.setPixelRatio(1),t.setSize(b.framebufferWidth,b.framebufferHeight,!1),R=new hu(b.framebufferWidth,b.framebufferHeight,{format:ta,type:Wu,colorSpace:t.outputColorSpace,stencilBuffer:S.stencil})}else{let Ut=null,jt=null,ce=null;S.depth&&(ce=S.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,Ut=S.stencil?Uc:Pl,jt=S.stencil?Cl:qu);let te={colorFormat:e.RGBA8,depthFormat:ce,scaleFactor:c};E=new XRWebGLBinding(s,e),x=E.createProjectionLayer(te),s.updateRenderState({layers:[x]}),t.setPixelRatio(1),t.setSize(x.textureWidth,x.textureHeight,!1),R=new hu(x.textureWidth,x.textureHeight,{format:ta,type:Wu,depthTexture:new Td(x.textureWidth,x.textureHeight,jt,void 0,void 0,void 0,void 0,void 0,void 0,Ut),stencilBuffer:S.stencil,colorSpace:t.outputColorSpace,samples:S.antialias?4:0});let $t=t.properties.get(R);$t.__ignoreDepthValues=x.ignoreDepthValues}R.isXRRenderTarget=!0,this.setFoveation(g),m=null,h=yield s.requestReferenceSpace(p),ae.setContext(s),ae.start(),o.isPresenting=!0,o.dispatchEvent({type:"sessionstart"})}})},this.getEnvironmentBlendMode=function(){if(s!==null)return s.environmentBlendMode};function At(at){for(let Ut=0;Ut<at.removed.length;Ut++){let jt=at.removed[Ut],ce=F.indexOf(jt);ce>=0&&(F[ce]=null,T[ce].disconnect(jt))}for(let Ut=0;Ut<at.added.length;Ut++){let jt=at.added[Ut],ce=F.indexOf(jt);if(ce===-1){for(let $t=0;$t<T.length;$t++)if($t>=F.length){F.push(jt),ce=$t;break}else if(F[$t]===null){F[$t]=jt,ce=$t;break}if(ce===-1)break}let te=T[ce];te&&te.connect(jt)}}let Mt=new Lt,Rt=new Lt;function pt(at,Ut,jt){Mt.setFromMatrixPosition(Ut.matrixWorld),Rt.setFromMatrixPosition(jt.matrixWorld);let ce=Mt.distanceTo(Rt),te=Ut.projectionMatrix.elements,$t=jt.projectionMatrix.elements,qt=te[14]/(te[10]-1),xe=te[14]/(te[10]+1),ft=(te[9]+1)/te[5],We=(te[9]-1)/te[5],ee=(te[8]-1)/te[0],ge=($t[8]+1)/$t[0],fe=qt*ee,Te=qt*ge,be=ce/(-ee+ge),Wt=be*-ee;Ut.matrixWorld.decompose(at.position,at.quaternion,at.scale),at.translateX(Wt),at.translateZ(be),at.matrixWorld.compose(at.position,at.quaternion,at.scale),at.matrixWorldInverse.copy(at.matrixWorld).invert();let Me=qt+be,tt=xe+be,z=fe-Wt,Pt=Te+(ce-Wt),Ot=ft*xe/tt*Me,dt=We*xe/tt*Me;at.projectionMatrix.makePerspective(z,Pt,Ot,dt,Me,tt),at.projectionMatrixInverse.copy(at.projectionMatrix).invert()}function yt(at,Ut){Ut===null?at.matrixWorld.copy(at.matrix):at.matrixWorld.multiplyMatrices(Ut.matrixWorld,at.matrix),at.matrixWorldInverse.copy(at.matrixWorld).invert()}this.updateCamera=function(at){if(s===null)return;I.texture!==null&&(at.near=I.depthNear,at.far=I.depthFar),B.near=D.near=q.near=at.near,B.far=D.far=q.far=at.far,(j!==B.near||J!==B.far)&&(s.updateRenderState({depthNear:B.near,depthFar:B.far}),j=B.near,J=B.far,q.near=j,q.far=J,D.near=j,D.far=J,q.updateProjectionMatrix(),D.updateProjectionMatrix(),at.updateProjectionMatrix());let Ut=at.parent,jt=B.cameras;yt(B,Ut);for(let ce=0;ce<jt.length;ce++)yt(jt[ce],Ut);jt.length===2?pt(B,q,D):B.projectionMatrix.copy(q.projectionMatrix),K(at,B,Ut)};function K(at,Ut,jt){jt===null?at.matrix.copy(Ut.matrixWorld):(at.matrix.copy(jt.matrixWorld),at.matrix.invert(),at.matrix.multiply(Ut.matrixWorld)),at.matrix.decompose(at.position,at.quaternion,at.scale),at.updateMatrixWorld(!0),at.projectionMatrix.copy(Ut.projectionMatrix),at.projectionMatrixInverse.copy(Ut.projectionMatrixInverse),at.isPerspectiveCamera&&(at.fov=Oy*2*Math.atan(1/at.projectionMatrix.elements[5]),at.zoom=1)}this.getCamera=function(){return B},this.getFoveation=function(){if(!(x===null&&b===null))return g},this.setFoveation=function(at){g=at,x!==null&&(x.fixedFoveation=at),b!==null&&b.fixedFoveation!==void 0&&(b.fixedFoveation=at)},this.hasDepthSensing=function(){return I.texture!==null};let Bt=null;function Gt(at,Ut){if(_=Ut.getViewerPose(m||h),P=Ut,_!==null){let jt=_.views;b!==null&&(t.setRenderTargetFramebuffer(R,b.framebuffer),t.setRenderTarget(R));let ce=!1;jt.length!==B.cameras.length&&(B.cameras.length=0,ce=!0);for(let $t=0;$t<jt.length;$t++){let qt=jt[$t],xe=null;if(b!==null)xe=b.getViewport(qt);else{let We=E.getViewSubImage(x,qt);xe=We.viewport,$t===0&&(t.setRenderTargetTextures(R,We.colorTexture,x.ignoreDepthValues?void 0:We.depthStencilTexture),t.setRenderTarget(R))}let ft=xt[$t];ft===void 0&&(ft=new ps,ft.layers.enable($t),ft.viewport=new Ki,xt[$t]=ft),ft.matrix.fromArray(qt.transform.matrix),ft.matrix.decompose(ft.position,ft.quaternion,ft.scale),ft.projectionMatrix.fromArray(qt.projectionMatrix),ft.projectionMatrixInverse.copy(ft.projectionMatrix).invert(),ft.viewport.set(xe.x,xe.y,xe.width,xe.height),$t===0&&(B.matrix.copy(ft.matrix),B.matrix.decompose(B.position,B.quaternion,B.scale)),ce===!0&&B.cameras.push(ft)}let te=s.enabledFeatures;if(te&&te.includes("depth-sensing")){let $t=E.getDepthInformation(jt[0]);$t&&$t.isValid&&$t.texture&&I.init(t,$t,s.renderState)}}for(let jt=0;jt<T.length;jt++){let ce=F[jt],te=T[jt];ce!==null&&te!==void 0&&te.update(ce,Ut,m||h)}I.render(t,B),Bt&&Bt(at,Ut),Ut.detectedPlanes&&o.dispatchEvent({type:"planesdetected",data:Ut}),P=null}let ae=new WT;ae.setAnimationLoop(Gt),this.setAnimationLoop=function(at){Bt=at},this.dispose=function(){}}},Sl=new Rl,XW=new Ui;function YW(n,t){function e(S,w){S.matrixAutoUpdate===!0&&S.updateMatrix(),w.value.copy(S.matrix)}function o(S,w){w.color.getRGB(S.fogColor.value,VT(n)),w.isFog?(S.fogNear.value=w.near,S.fogFar.value=w.far):w.isFogExp2&&(S.fogDensity.value=w.density)}function s(S,w,R,T,F){w.isMeshBasicMaterial||w.isMeshLambertMaterial?c(S,w):w.isMeshToonMaterial?(c(S,w),E(S,w)):w.isMeshPhongMaterial?(c(S,w),_(S,w)):w.isMeshStandardMaterial?(c(S,w),x(S,w),w.isMeshPhysicalMaterial&&b(S,w,F)):w.isMeshMatcapMaterial?(c(S,w),P(S,w)):w.isMeshDepthMaterial?c(S,w):w.isMeshDistanceMaterial?(c(S,w),I(S,w)):w.isMeshNormalMaterial?c(S,w):w.isLineBasicMaterial?(h(S,w),w.isLineDashedMaterial&&p(S,w)):w.isPointsMaterial?g(S,w,R,T):w.isSpriteMaterial?m(S,w):w.isShadowMaterial?(S.color.value.copy(w.color),S.opacity.value=w.opacity):w.isShaderMaterial&&(w.uniformsNeedUpdate=!1)}function c(S,w){S.opacity.value=w.opacity,w.color&&S.diffuse.value.copy(w.color),w.emissive&&S.emissive.value.copy(w.emissive).multiplyScalar(w.emissiveIntensity),w.map&&(S.map.value=w.map,e(w.map,S.mapTransform)),w.alphaMap&&(S.alphaMap.value=w.alphaMap,e(w.alphaMap,S.alphaMapTransform)),w.bumpMap&&(S.bumpMap.value=w.bumpMap,e(w.bumpMap,S.bumpMapTransform),S.bumpScale.value=w.bumpScale,w.side===Yo&&(S.bumpScale.value*=-1)),w.normalMap&&(S.normalMap.value=w.normalMap,e(w.normalMap,S.normalMapTransform),S.normalScale.value.copy(w.normalScale),w.side===Yo&&S.normalScale.value.negate()),w.displacementMap&&(S.displacementMap.value=w.displacementMap,e(w.displacementMap,S.displacementMapTransform),S.displacementScale.value=w.displacementScale,S.displacementBias.value=w.displacementBias),w.emissiveMap&&(S.emissiveMap.value=w.emissiveMap,e(w.emissiveMap,S.emissiveMapTransform)),w.specularMap&&(S.specularMap.value=w.specularMap,e(w.specularMap,S.specularMapTransform)),w.alphaTest>0&&(S.alphaTest.value=w.alphaTest);let R=t.get(w),T=R.envMap,F=R.envMapRotation;if(T&&(S.envMap.value=T,Sl.copy(F),Sl.x*=-1,Sl.y*=-1,Sl.z*=-1,T.isCubeTexture&&T.isRenderTargetTexture===!1&&(Sl.y*=-1,Sl.z*=-1),S.envMapRotation.value.setFromMatrix4(XW.makeRotationFromEuler(Sl)),S.flipEnvMap.value=T.isCubeTexture&&T.isRenderTargetTexture===!1?-1:1,S.reflectivity.value=w.reflectivity,S.ior.value=w.ior,S.refractionRatio.value=w.refractionRatio),w.lightMap){S.lightMap.value=w.lightMap;let W=n._useLegacyLights===!0?Math.PI:1;S.lightMapIntensity.value=w.lightMapIntensity*W,e(w.lightMap,S.lightMapTransform)}w.aoMap&&(S.aoMap.value=w.aoMap,S.aoMapIntensity.value=w.aoMapIntensity,e(w.aoMap,S.aoMapTransform))}function h(S,w){S.diffuse.value.copy(w.color),S.opacity.value=w.opacity,w.map&&(S.map.value=w.map,e(w.map,S.mapTransform))}function p(S,w){S.dashSize.value=w.dashSize,S.totalSize.value=w.dashSize+w.gapSize,S.scale.value=w.scale}function g(S,w,R,T){S.diffuse.value.copy(w.color),S.opacity.value=w.opacity,S.size.value=w.size*R,S.scale.value=T*.5,w.map&&(S.map.value=w.map,e(w.map,S.uvTransform)),w.alphaMap&&(S.alphaMap.value=w.alphaMap,e(w.alphaMap,S.alphaMapTransform)),w.alphaTest>0&&(S.alphaTest.value=w.alphaTest)}function m(S,w){S.diffuse.value.copy(w.color),S.opacity.value=w.opacity,S.rotation.value=w.rotation,w.map&&(S.map.value=w.map,e(w.map,S.mapTransform)),w.alphaMap&&(S.alphaMap.value=w.alphaMap,e(w.alphaMap,S.alphaMapTransform)),w.alphaTest>0&&(S.alphaTest.value=w.alphaTest)}function _(S,w){S.specular.value.copy(w.specular),S.shininess.value=Math.max(w.shininess,1e-4)}function E(S,w){w.gradientMap&&(S.gradientMap.value=w.gradientMap)}function x(S,w){S.metalness.value=w.metalness,w.metalnessMap&&(S.metalnessMap.value=w.metalnessMap,e(w.metalnessMap,S.metalnessMapTransform)),S.roughness.value=w.roughness,w.roughnessMap&&(S.roughnessMap.value=w.roughnessMap,e(w.roughnessMap,S.roughnessMapTransform)),t.get(w).envMap&&(S.envMapIntensity.value=w.envMapIntensity)}function b(S,w,R){S.ior.value=w.ior,w.sheen>0&&(S.sheenColor.value.copy(w.sheenColor).multiplyScalar(w.sheen),S.sheenRoughness.value=w.sheenRoughness,w.sheenColorMap&&(S.sheenColorMap.value=w.sheenColorMap,e(w.sheenColorMap,S.sheenColorMapTransform)),w.sheenRoughnessMap&&(S.sheenRoughnessMap.value=w.sheenRoughnessMap,e(w.sheenRoughnessMap,S.sheenRoughnessMapTransform))),w.clearcoat>0&&(S.clearcoat.value=w.clearcoat,S.clearcoatRoughness.value=w.clearcoatRoughness,w.clearcoatMap&&(S.clearcoatMap.value=w.clearcoatMap,e(w.clearcoatMap,S.clearcoatMapTransform)),w.clearcoatRoughnessMap&&(S.clearcoatRoughnessMap.value=w.clearcoatRoughnessMap,e(w.clearcoatRoughnessMap,S.clearcoatRoughnessMapTransform)),w.clearcoatNormalMap&&(S.clearcoatNormalMap.value=w.clearcoatNormalMap,e(w.clearcoatNormalMap,S.clearcoatNormalMapTransform),S.clearcoatNormalScale.value.copy(w.clearcoatNormalScale),w.side===Yo&&S.clearcoatNormalScale.value.negate())),w.iridescence>0&&(S.iridescence.value=w.iridescence,S.iridescenceIOR.value=w.iridescenceIOR,S.iridescenceThicknessMinimum.value=w.iridescenceThicknessRange[0],S.iridescenceThicknessMaximum.value=w.iridescenceThicknessRange[1],w.iridescenceMap&&(S.iridescenceMap.value=w.iridescenceMap,e(w.iridescenceMap,S.iridescenceMapTransform)),w.iridescenceThicknessMap&&(S.iridescenceThicknessMap.value=w.iridescenceThicknessMap,e(w.iridescenceThicknessMap,S.iridescenceThicknessMapTransform))),w.transmission>0&&(S.transmission.value=w.transmission,S.transmissionSamplerMap.value=R.texture,S.transmissionSamplerSize.value.set(R.width,R.height),w.transmissionMap&&(S.transmissionMap.value=w.transmissionMap,e(w.transmissionMap,S.transmissionMapTransform)),S.thickness.value=w.thickness,w.thicknessMap&&(S.thicknessMap.value=w.thicknessMap,e(w.thicknessMap,S.thicknessMapTransform)),S.attenuationDistance.value=w.attenuationDistance,S.attenuationColor.value.copy(w.attenuationColor)),w.anisotropy>0&&(S.anisotropyVector.value.set(w.anisotropy*Math.cos(w.anisotropyRotation),w.anisotropy*Math.sin(w.anisotropyRotation)),w.anisotropyMap&&(S.anisotropyMap.value=w.anisotropyMap,e(w.anisotropyMap,S.anisotropyMapTransform))),S.specularIntensity.value=w.specularIntensity,S.specularColor.value.copy(w.specularColor),w.specularColorMap&&(S.specularColorMap.value=w.specularColorMap,e(w.specularColorMap,S.specularColorMapTransform)),w.specularIntensityMap&&(S.specularIntensityMap.value=w.specularIntensityMap,e(w.specularIntensityMap,S.specularIntensityMapTransform))}function P(S,w){w.matcap&&(S.matcap.value=w.matcap)}function I(S,w){let R=t.get(w).light;S.referencePosition.value.setFromMatrixPosition(R.matrixWorld),S.nearDistance.value=R.shadow.camera.near,S.farDistance.value=R.shadow.camera.far}return{refreshFogUniforms:o,refreshMaterialUniforms:s}}function $W(n,t,e,o){let s={},c={},h=[],p=e.isWebGL2?n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS):0;function g(R,T){let F=T.program;o.uniformBlockBinding(R,F)}function m(R,T){let F=s[R.id];F===void 0&&(P(R),F=_(R),s[R.id]=F,R.addEventListener("dispose",S));let W=T.program;o.updateUBOMapping(R,W);let X=t.render.frame;c[R.id]!==X&&(x(R),c[R.id]=X)}function _(R){let T=E();R.__bindingPointIndex=T;let F=n.createBuffer(),W=R.__size,X=R.usage;return n.bindBuffer(n.UNIFORM_BUFFER,F),n.bufferData(n.UNIFORM_BUFFER,W,X),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,T,F),F}function E(){for(let R=0;R<p;R++)if(h.indexOf(R)===-1)return h.push(R),R;return console.error("THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached."),0}function x(R){let T=s[R.id],F=R.uniforms,W=R.__cache;n.bindBuffer(n.UNIFORM_BUFFER,T);for(let X=0,q=F.length;X<q;X++){let D=Array.isArray(F[X])?F[X]:[F[X]];for(let xt=0,B=D.length;xt<B;xt++){let j=D[xt];if(b(j,X,xt,W)===!0){let J=j.__offset,Dt=Array.isArray(j.value)?j.value:[j.value],Q=0;for(let At=0;At<Dt.length;At++){let Mt=Dt[At],Rt=I(Mt);typeof Mt=="number"||typeof Mt=="boolean"?(j.__data[0]=Mt,n.bufferSubData(n.UNIFORM_BUFFER,J+Q,j.__data)):Mt.isMatrix3?(j.__data[0]=Mt.elements[0],j.__data[1]=Mt.elements[1],j.__data[2]=Mt.elements[2],j.__data[3]=0,j.__data[4]=Mt.elements[3],j.__data[5]=Mt.elements[4],j.__data[6]=Mt.elements[5],j.__data[7]=0,j.__data[8]=Mt.elements[6],j.__data[9]=Mt.elements[7],j.__data[10]=Mt.elements[8],j.__data[11]=0):(Mt.toArray(j.__data,Q),Q+=Rt.storage/Float32Array.BYTES_PER_ELEMENT)}n.bufferSubData(n.UNIFORM_BUFFER,J,j.__data)}}}n.bindBuffer(n.UNIFORM_BUFFER,null)}function b(R,T,F,W){let X=R.value,q=T+"_"+F;if(W[q]===void 0)return typeof X=="number"||typeof X=="boolean"?W[q]=X:W[q]=X.clone(),!0;{let D=W[q];if(typeof X=="number"||typeof X=="boolean"){if(D!==X)return W[q]=X,!0}else if(D.equals(X)===!1)return D.copy(X),!0}return!1}function P(R){let T=R.uniforms,F=0,W=16;for(let q=0,D=T.length;q<D;q++){let xt=Array.isArray(T[q])?T[q]:[T[q]];for(let B=0,j=xt.length;B<j;B++){let J=xt[B],Dt=Array.isArray(J.value)?J.value:[J.value];for(let Q=0,At=Dt.length;Q<At;Q++){let Mt=Dt[Q],Rt=I(Mt),pt=F%W;pt!==0&&W-pt<Rt.boundary&&(F+=W-pt),J.__data=new Float32Array(Rt.storage/Float32Array.BYTES_PER_ELEMENT),J.__offset=F,F+=Rt.storage}}}let X=F%W;return X>0&&(F+=W-X),R.__size=F,R.__cache={},this}function I(R){let T={boundary:0,storage:0};return typeof R=="number"||typeof R=="boolean"?(T.boundary=4,T.storage=4):R.isVector2?(T.boundary=8,T.storage=8):R.isVector3||R.isColor?(T.boundary=16,T.storage=12):R.isVector4?(T.boundary=16,T.storage=16):R.isMatrix3?(T.boundary=48,T.storage=48):R.isMatrix4?(T.boundary=64,T.storage=64):R.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",R),T}function S(R){let T=R.target;T.removeEventListener("dispose",S);let F=h.indexOf(T.__bindingPointIndex);h.splice(F,1),n.deleteBuffer(s[T.id]),delete s[T.id],delete c[T.id]}function w(){for(let R in s)n.deleteBuffer(s[R]);h=[],s={},c={}}return{bind:g,update:m,dispose:w}}var Qy=class{constructor(t={}){let{canvas:e=K5(),context:o=null,depth:s=!0,stencil:c=!0,alpha:h=!1,antialias:p=!1,premultipliedAlpha:g=!0,preserveDrawingBuffer:m=!1,powerPreference:_="default",failIfMajorPerformanceCaveat:E=!1}=t;this.isWebGLRenderer=!0;let x;o!==null?x=o.getContextAttributes().alpha:x=h;let b=new Uint32Array(4),P=new Int32Array(4),I=null,S=null,w=[],R=[];this.domElement=e,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=ba,this._useLegacyLights=!1,this.toneMapping=Vu,this.toneMappingExposure=1;let T=this,F=!1,W=0,X=0,q=null,D=-1,xt=null,B=new Ki,j=new Ki,J=null,Dt=new hr(0),Q=0,At=e.width,Mt=e.height,Rt=1,pt=null,yt=null,K=new Ki(0,0,At,Mt),Bt=new Ki(0,0,At,Mt),Gt=!1,ae=new Md,at=!1,Ut=!1,jt=null,ce=new Ui,te=new Yn,$t=new Lt,qt={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function xe(){return q===null?Rt:1}let ft=o;function We(Z,mt){for(let It=0;It<Z.length;It++){let St=Z[It],vt=e.getContext(St,mt);if(vt!==null)return vt}return null}try{let Z={alpha:!0,depth:s,stencil:c,antialias:p,premultipliedAlpha:g,preserveDrawingBuffer:m,powerPreference:_,failIfMajorPerformanceCaveat:E};if("setAttribute"in e&&e.setAttribute("data-engine",\`three.js r\${fv}\`),e.addEventListener("webglcontextlost",Et,!1),e.addEventListener("webglcontextrestored",G,!1),e.addEventListener("webglcontextcreationerror",ot,!1),ft===null){let mt=["webgl2","webgl","experimental-webgl"];if(T.isWebGL1Renderer===!0&&mt.shift(),ft=We(mt,Z),ft===null)throw We(mt)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}typeof WebGLRenderingContext!="undefined"&&ft instanceof WebGLRenderingContext&&console.warn("THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163."),ft.getShaderPrecisionFormat===void 0&&(ft.getShaderPrecisionFormat=function(){return{rangeMin:1,rangeMax:1,precision:1}})}catch(Z){throw console.error("THREE.WebGLRenderer: "+Z.message),Z}let ee,ge,fe,Te,be,Wt,Me,tt,z,Pt,Ot,dt,Ht,Ce,Vt,Zt,ne,rt,C,N,k,$,V,ht;function st(){ee=new c8(ft),ge=new i8(ft,ee,t),ee.init(ge),$=new qW(ft,ee,ge),fe=new GW(ft,ee,ge),Te=new p8(ft),be=new CW,Wt=new kW(ft,ee,fe,be,ge,$,Te),Me=new s8(T),tt=new l8(T),z=new _H(ft,ge),V=new n8(ft,ee,z,ge),Pt=new f8(ft,z,Te,V),Ot=new y8(ft,Pt,z,Te),C=new m8(ft,ge,Wt),Zt=new o8(be),dt=new TW(T,Me,tt,ee,ge,V,Zt),Ht=new YW(T,be),Ce=new IW,Vt=new FW(ee,ge),rt=new e8(T,Me,tt,fe,Ot,x,g),ne=new zW(T,Ot,ge),ht=new $W(ft,Te,ge,fe),N=new r8(ft,ee,Te,ge),k=new h8(ft,ee,Te,ge),Te.programs=dt.programs,T.capabilities=ge,T.extensions=ee,T.properties=be,T.renderLists=Ce,T.shadowMap=ne,T.state=fe,T.info=Te}st();let wt=new jy(T,ft);this.xr=wt,this.getContext=function(){return ft},this.getContextAttributes=function(){return ft.getContextAttributes()},this.forceContextLoss=function(){let Z=ee.get("WEBGL_lose_context");Z&&Z.loseContext()},this.forceContextRestore=function(){let Z=ee.get("WEBGL_lose_context");Z&&Z.restoreContext()},this.getPixelRatio=function(){return Rt},this.setPixelRatio=function(Z){Z!==void 0&&(Rt=Z,this.setSize(At,Mt,!1))},this.getSize=function(Z){return Z.set(At,Mt)},this.setSize=function(Z,mt,It=!0){if(wt.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}At=Z,Mt=mt,e.width=Math.floor(Z*Rt),e.height=Math.floor(mt*Rt),It===!0&&(e.style.width=Z+"px",e.style.height=mt+"px"),this.setViewport(0,0,Z,mt)},this.getDrawingBufferSize=function(Z){return Z.set(At*Rt,Mt*Rt).floor()},this.setDrawingBufferSize=function(Z,mt,It){At=Z,Mt=mt,Rt=It,e.width=Math.floor(Z*It),e.height=Math.floor(mt*It),this.setViewport(0,0,Z,mt)},this.getCurrentViewport=function(Z){return Z.copy(B)},this.getViewport=function(Z){return Z.copy(K)},this.setViewport=function(Z,mt,It,St){Z.isVector4?K.set(Z.x,Z.y,Z.z,Z.w):K.set(Z,mt,It,St),fe.viewport(B.copy(K).multiplyScalar(Rt).round())},this.getScissor=function(Z){return Z.copy(Bt)},this.setScissor=function(Z,mt,It,St){Z.isVector4?Bt.set(Z.x,Z.y,Z.z,Z.w):Bt.set(Z,mt,It,St),fe.scissor(j.copy(Bt).multiplyScalar(Rt).round())},this.getScissorTest=function(){return Gt},this.setScissorTest=function(Z){fe.setScissorTest(Gt=Z)},this.setOpaqueSort=function(Z){pt=Z},this.setTransparentSort=function(Z){yt=Z},this.getClearColor=function(Z){return Z.copy(rt.getClearColor())},this.setClearColor=function(){rt.setClearColor.apply(rt,arguments)},this.getClearAlpha=function(){return rt.getClearAlpha()},this.setClearAlpha=function(){rt.setClearAlpha.apply(rt,arguments)},this.clear=function(Z=!0,mt=!0,It=!0){let St=0;if(Z){let vt=!1;if(q!==null){let he=q.texture.format;vt=he===zT||he===BT||he===UT}if(vt){let he=q.texture.type,ue=he===Wu||he===qu||he===hv||he===Cl||he===DT||he===FT,we=rt.getClearColor(),de=rt.getClearAlpha(),Be=we.r,Ae=we.g,Pe=we.b;ue?(b[0]=Be,b[1]=Ae,b[2]=Pe,b[3]=de,ft.clearBufferuiv(ft.COLOR,0,b)):(P[0]=Be,P[1]=Ae,P[2]=Pe,P[3]=de,ft.clearBufferiv(ft.COLOR,0,P))}else St|=ft.COLOR_BUFFER_BIT}mt&&(St|=ft.DEPTH_BUFFER_BIT),It&&(St|=ft.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),ft.clear(St)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",Et,!1),e.removeEventListener("webglcontextrestored",G,!1),e.removeEventListener("webglcontextcreationerror",ot,!1),Ce.dispose(),Vt.dispose(),be.dispose(),Me.dispose(),tt.dispose(),Ot.dispose(),V.dispose(),ht.dispose(),dt.dispose(),wt.dispose(),wt.removeEventListener("sessionstart",qe),wt.removeEventListener("sessionend",Ue),jt&&(jt.dispose(),jt=null),Xe.stop()};function Et(Z){Z.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),F=!0}function G(){console.log("THREE.WebGLRenderer: Context Restored."),F=!1;let Z=Te.autoReset,mt=ne.enabled,It=ne.autoUpdate,St=ne.needsUpdate,vt=ne.type;st(),Te.autoReset=Z,ne.enabled=mt,ne.autoUpdate=It,ne.needsUpdate=St,ne.type=vt}function ot(Z){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",Z.statusMessage)}function et(Z){let mt=Z.target;mt.removeEventListener("dispose",et),ut(mt)}function ut(Z){Ft(Z),be.remove(Z)}function Ft(Z){let mt=be.get(Z).programs;mt!==void 0&&(mt.forEach(function(It){dt.releaseProgram(It)}),Z.isShaderMaterial&&dt.releaseShaderCache(Z))}this.renderBufferDirect=function(Z,mt,It,St,vt,he){mt===null&&(mt=qt);let ue=vt.isMesh&&vt.matrixWorld.determinant()<0,we=Qn(Z,mt,It,St,vt);fe.setMaterial(St,ue);let de=It.index,Be=1;if(St.wireframe===!0){if(de=Pt.getWireframeAttribute(It),de===void 0)return;Be=2}let Ae=It.drawRange,Pe=It.attributes.position,tn=Ae.start*Be,oi=(Ae.start+Ae.count)*Be;he!==null&&(tn=Math.max(tn,he.start*Be),oi=Math.min(oi,(he.start+he.count)*Be)),de!==null?(tn=Math.max(tn,0),oi=Math.min(oi,de.count)):Pe!=null&&(tn=Math.max(tn,0),oi=Math.min(oi,Pe.count));let Mr=oi-tn;if(Mr<0||Mr===1/0)return;V.setup(vt,St,we,It,de);let Hi,sr=N;if(de!==null&&(Hi=z.get(de),sr=k,sr.setIndex(Hi)),vt.isMesh)St.wireframe===!0?(fe.setLineWidth(St.wireframeLinewidth*xe()),sr.setMode(ft.LINES)):sr.setMode(ft.TRIANGLES);else if(vt.isLine){let ye=St.linewidth;ye===void 0&&(ye=1),fe.setLineWidth(ye*xe()),vt.isLineSegments?sr.setMode(ft.LINES):vt.isLineLoop?sr.setMode(ft.LINE_LOOP):sr.setMode(ft.LINE_STRIP)}else vt.isPoints?sr.setMode(ft.POINTS):vt.isSprite&&sr.setMode(ft.TRIANGLES);if(vt.isBatchedMesh)sr.renderMultiDraw(vt._multiDrawStarts,vt._multiDrawCounts,vt._multiDrawCount);else if(vt.isInstancedMesh)sr.renderInstances(tn,Mr,vt.count);else if(It.isInstancedBufferGeometry){let ye=It._maxInstanceCount!==void 0?It._maxInstanceCount:1/0,Da=Math.min(It.instanceCount,ye);sr.renderInstances(tn,Mr,Da)}else sr.render(tn,Mr)};function Kt(Z,mt,It){Z.transparent===!0&&Z.side===uu&&Z.forceSinglePass===!1?(Z.side=Yo,Z.needsUpdate=!0,rr(Z,mt,It),Z.side=Xu,Z.needsUpdate=!0,rr(Z,mt,It),Z.side=uu):rr(Z,mt,It)}this.compile=function(Z,mt,It=null){It===null&&(It=Z),S=Vt.get(It),S.init(),R.push(S),It.traverseVisible(function(vt){vt.isLight&&vt.layers.test(mt.layers)&&(S.pushLight(vt),vt.castShadow&&S.pushShadow(vt))}),Z!==It&&Z.traverseVisible(function(vt){vt.isLight&&vt.layers.test(mt.layers)&&(S.pushLight(vt),vt.castShadow&&S.pushShadow(vt))}),S.setupLights(T._useLegacyLights);let St=new Set;return Z.traverse(function(vt){let he=vt.material;if(he)if(Array.isArray(he))for(let ue=0;ue<he.length;ue++){let we=he[ue];Kt(we,It,vt),St.add(we)}else Kt(he,It,vt),St.add(he)}),R.pop(),S=null,St},this.compileAsync=function(Z,mt,It=null){let St=this.compile(Z,mt,It);return new Promise(vt=>{function he(){if(St.forEach(function(ue){be.get(ue).currentProgram.isReady()&&St.delete(ue)}),St.size===0){vt(Z);return}setTimeout(he,10)}ee.get("KHR_parallel_shader_compile")!==null?he():setTimeout(he,10)})};let me=null;function ve(Z){me&&me(Z)}function qe(){Xe.stop()}function Ue(){Xe.start()}let Xe=new WT;Xe.setAnimationLoop(ve),typeof self!="undefined"&&Xe.setContext(self),this.setAnimationLoop=function(Z){me=Z,wt.setAnimationLoop(Z),Z===null?Xe.stop():Xe.start()},wt.addEventListener("sessionstart",qe),wt.addEventListener("sessionend",Ue),this.render=function(Z,mt){if(mt!==void 0&&mt.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(F===!0)return;Z.matrixWorldAutoUpdate===!0&&Z.updateMatrixWorld(),mt.parent===null&&mt.matrixWorldAutoUpdate===!0&&mt.updateMatrixWorld(),wt.enabled===!0&&wt.isPresenting===!0&&(wt.cameraAutoUpdate===!0&&wt.updateCamera(mt),mt=wt.getCamera()),Z.isScene===!0&&Z.onBeforeRender(T,Z,mt,q),S=Vt.get(Z,R.length),S.init(),R.push(S),ce.multiplyMatrices(mt.projectionMatrix,mt.matrixWorldInverse),ae.setFromProjectionMatrix(ce),Ut=this.localClippingEnabled,at=Zt.init(this.clippingPlanes,Ut),I=Ce.get(Z,w.length),I.init(),w.push(I),Ze(Z,mt,0,T.sortObjects),I.finish(),T.sortObjects===!0&&I.sort(pt,yt),this.info.render.frame++,at===!0&&Zt.beginShadows();let It=S.state.shadowsArray;if(ne.render(It,Z,mt),at===!0&&Zt.endShadows(),this.info.autoReset===!0&&this.info.reset(),(wt.enabled===!1||wt.isPresenting===!1||wt.hasDepthSensing()===!1)&&rt.render(I,Z),S.setupLights(T._useLegacyLights),mt.isArrayCamera){let St=mt.cameras;for(let vt=0,he=St.length;vt<he;vt++){let ue=St[vt];Er(I,Z,ue,ue.viewport)}}else Er(I,Z,mt);q!==null&&(Wt.updateMultisampleRenderTarget(q),Wt.updateRenderTargetMipmap(q)),Z.isScene===!0&&Z.onAfterRender(T,Z,mt),V.resetDefaultState(),D=-1,xt=null,R.pop(),R.length>0?S=R[R.length-1]:S=null,w.pop(),w.length>0?I=w[w.length-1]:I=null};function Ze(Z,mt,It,St){if(Z.visible===!1)return;if(Z.layers.test(mt.layers)){if(Z.isGroup)It=Z.renderOrder;else if(Z.isLOD)Z.autoUpdate===!0&&Z.update(mt);else if(Z.isLight)S.pushLight(Z),Z.castShadow&&S.pushShadow(Z);else if(Z.isSprite){if(!Z.frustumCulled||ae.intersectsSprite(Z)){St&&$t.setFromMatrixPosition(Z.matrixWorld).applyMatrix4(ce);let ue=Ot.update(Z),we=Z.material;we.visible&&I.push(Z,ue,we,It,$t.z,null)}}else if((Z.isMesh||Z.isLine||Z.isPoints)&&(!Z.frustumCulled||ae.intersectsObject(Z))){let ue=Ot.update(Z),we=Z.material;if(St&&(Z.boundingSphere!==void 0?(Z.boundingSphere===null&&Z.computeBoundingSphere(),$t.copy(Z.boundingSphere.center)):(ue.boundingSphere===null&&ue.computeBoundingSphere(),$t.copy(ue.boundingSphere.center)),$t.applyMatrix4(Z.matrixWorld).applyMatrix4(ce)),Array.isArray(we)){let de=ue.groups;for(let Be=0,Ae=de.length;Be<Ae;Be++){let Pe=de[Be],tn=we[Pe.materialIndex];tn&&tn.visible&&I.push(Z,ue,tn,It,$t.z,Pe)}}else we.visible&&I.push(Z,ue,we,It,$t.z,null)}}let he=Z.children;for(let ue=0,we=he.length;ue<we;ue++)Ze(he[ue],mt,It,St)}function Er(Z,mt,It,St){let vt=Z.opaque,he=Z.transmissive,ue=Z.transparent;S.setupLightsView(It),at===!0&&Zt.setGlobalState(T.clippingPlanes,It),he.length>0&&Zr(vt,he,mt,It),St&&fe.viewport(B.copy(St)),vt.length>0&&nr(vt,mt,It),he.length>0&&nr(he,mt,It),ue.length>0&&nr(ue,mt,It),fe.buffers.depth.setTest(!0),fe.buffers.depth.setMask(!0),fe.buffers.color.setMask(!0),fe.setPolygonOffset(!1)}function Zr(Z,mt,It,St){if((It.isScene===!0?It.overrideMaterial:null)!==null)return;let he=ge.isWebGL2;jt===null&&(jt=new hu(1,1,{generateMipmaps:!0,type:ee.has("EXT_color_buffer_half_float")?Kf:Wu,minFilter:Tl,samples:he?4:0})),T.getDrawingBufferSize(te),he?jt.setSize(te.x,te.y):jt.setSize(Dy(te.x),Dy(te.y));let ue=T.getRenderTarget();T.setRenderTarget(jt),T.getClearColor(Dt),Q=T.getClearAlpha(),Q<1&&T.setClearColor(16777215,.5),T.clear();let we=T.toneMapping;T.toneMapping=Vu,nr(Z,It,St),Wt.updateMultisampleRenderTarget(jt),Wt.updateRenderTargetMipmap(jt);let de=!1;for(let Be=0,Ae=mt.length;Be<Ae;Be++){let Pe=mt[Be],tn=Pe.object,oi=Pe.geometry,Mr=Pe.material,Hi=Pe.group;if(Mr.side===uu&&tn.layers.test(St.layers)){let sr=Mr.side;Mr.side=Yo,Mr.needsUpdate=!0,Ie(tn,It,St,oi,Mr,Hi),Mr.side=sr,Mr.needsUpdate=!0,de=!0}}de===!0&&(Wt.updateMultisampleRenderTarget(jt),Wt.updateRenderTargetMipmap(jt)),T.setRenderTarget(ue),T.setClearColor(Dt,Q),T.toneMapping=we}function nr(Z,mt,It){let St=mt.isScene===!0?mt.overrideMaterial:null;for(let vt=0,he=Z.length;vt<he;vt++){let ue=Z[vt],we=ue.object,de=ue.geometry,Be=St===null?ue.material:St,Ae=ue.group;we.layers.test(It.layers)&&Ie(we,mt,It,de,Be,Ae)}}function Ie(Z,mt,It,St,vt,he){Z.onBeforeRender(T,mt,It,St,vt,he),Z.modelViewMatrix.multiplyMatrices(It.matrixWorldInverse,Z.matrixWorld),Z.normalMatrix.getNormalMatrix(Z.modelViewMatrix),vt.onBeforeRender(T,mt,It,St,Z,he),vt.transparent===!0&&vt.side===uu&&vt.forceSinglePass===!1?(vt.side=Yo,vt.needsUpdate=!0,T.renderBufferDirect(It,mt,St,vt,Z,he),vt.side=Xu,vt.needsUpdate=!0,T.renderBufferDirect(It,mt,St,vt,Z,he),vt.side=uu):T.renderBufferDirect(It,mt,St,vt,Z,he),Z.onAfterRender(T,mt,It,St,vt,he)}function rr(Z,mt,It){mt.isScene!==!0&&(mt=qt);let St=be.get(Z),vt=S.state.lights,he=S.state.shadowsArray,ue=vt.state.version,we=dt.getParameters(Z,vt.state,he,mt,It),de=dt.getProgramCacheKey(we),Be=St.programs;St.environment=Z.isMeshStandardMaterial?mt.environment:null,St.fog=mt.fog,St.envMap=(Z.isMeshStandardMaterial?tt:Me).get(Z.envMap||St.environment),St.envMapRotation=St.environment!==null&&Z.envMap===null?mt.environmentRotation:Z.envMapRotation,Be===void 0&&(Z.addEventListener("dispose",et),Be=new Map,St.programs=Be);let Ae=Be.get(de);if(Ae!==void 0){if(St.currentProgram===Ae&&St.lightsStateVersion===ue)return ar(Z,we),Ae}else we.uniforms=dt.getUniforms(Z),Z.onBuild(It,we,T),Z.onBeforeCompile(we,T),Ae=dt.acquireProgram(we,de),Be.set(de,Ae),St.uniforms=we.uniforms;let Pe=St.uniforms;return(!Z.isShaderMaterial&&!Z.isRawShaderMaterial||Z.clipping===!0)&&(Pe.clippingPlanes=Zt.uniform),ar(Z,we),St.needsLights=ii(Z),St.lightsStateVersion=ue,St.needsLights&&(Pe.ambientLightColor.value=vt.state.ambient,Pe.lightProbe.value=vt.state.probe,Pe.directionalLights.value=vt.state.directional,Pe.directionalLightShadows.value=vt.state.directionalShadow,Pe.spotLights.value=vt.state.spot,Pe.spotLightShadows.value=vt.state.spotShadow,Pe.rectAreaLights.value=vt.state.rectArea,Pe.ltc_1.value=vt.state.rectAreaLTC1,Pe.ltc_2.value=vt.state.rectAreaLTC2,Pe.pointLights.value=vt.state.point,Pe.pointLightShadows.value=vt.state.pointShadow,Pe.hemisphereLights.value=vt.state.hemi,Pe.directionalShadowMap.value=vt.state.directionalShadowMap,Pe.directionalShadowMatrix.value=vt.state.directionalShadowMatrix,Pe.spotShadowMap.value=vt.state.spotShadowMap,Pe.spotLightMatrix.value=vt.state.spotLightMatrix,Pe.spotLightMap.value=vt.state.spotLightMap,Pe.pointShadowMap.value=vt.state.pointShadowMap,Pe.pointShadowMatrix.value=vt.state.pointShadowMatrix),St.currentProgram=Ae,St.uniformsList=null,Ae}function pr(Z){if(Z.uniformsList===null){let mt=Z.currentProgram.getUniforms();Z.uniformsList=Oc.seqWithValue(mt.seq,Z.uniforms)}return Z.uniformsList}function ar(Z,mt){let It=be.get(Z);It.outputColorSpace=mt.outputColorSpace,It.batching=mt.batching,It.instancing=mt.instancing,It.instancingColor=mt.instancingColor,It.instancingMorph=mt.instancingMorph,It.skinning=mt.skinning,It.morphTargets=mt.morphTargets,It.morphNormals=mt.morphNormals,It.morphColors=mt.morphColors,It.morphTargetsCount=mt.morphTargetsCount,It.numClippingPlanes=mt.numClippingPlanes,It.numIntersection=mt.numClipIntersection,It.vertexAlphas=mt.vertexAlphas,It.vertexTangents=mt.vertexTangents,It.toneMapping=mt.toneMapping}function Qn(Z,mt,It,St,vt){mt.isScene!==!0&&(mt=qt),Wt.resetTextureUnits();let he=mt.fog,ue=St.isMeshStandardMaterial?mt.environment:null,we=q===null?T.outputColorSpace:q.isXRRenderTarget===!0?q.texture.colorSpace:Zu,de=(St.isMeshStandardMaterial?tt:Me).get(St.envMap||ue),Be=St.vertexColors===!0&&!!It.attributes.color&&It.attributes.color.itemSize===4,Ae=!!It.attributes.tangent&&(!!St.normalMap||St.anisotropy>0),Pe=!!It.morphAttributes.position,tn=!!It.morphAttributes.normal,oi=!!It.morphAttributes.color,Mr=Vu;St.toneMapped&&(q===null||q.isXRRenderTarget===!0)&&(Mr=T.toneMapping);let Hi=It.morphAttributes.position||It.morphAttributes.normal||It.morphAttributes.color,sr=Hi!==void 0?Hi.length:0,ye=be.get(St),Da=S.state.lights;if(at===!0&&(Ut===!0||Z!==xt)){let Mi=Z===xt&&St.id===D;Zt.setState(St,Z,Mi)}let en=!1;St.version===ye.__version?(ye.needsLights&&ye.lightsStateVersion!==Da.state.version||ye.outputColorSpace!==we||vt.isBatchedMesh&&ye.batching===!1||!vt.isBatchedMesh&&ye.batching===!0||vt.isInstancedMesh&&ye.instancing===!1||!vt.isInstancedMesh&&ye.instancing===!0||vt.isSkinnedMesh&&ye.skinning===!1||!vt.isSkinnedMesh&&ye.skinning===!0||vt.isInstancedMesh&&ye.instancingColor===!0&&vt.instanceColor===null||vt.isInstancedMesh&&ye.instancingColor===!1&&vt.instanceColor!==null||vt.isInstancedMesh&&ye.instancingMorph===!0&&vt.morphTexture===null||vt.isInstancedMesh&&ye.instancingMorph===!1&&vt.morphTexture!==null||ye.envMap!==de||St.fog===!0&&ye.fog!==he||ye.numClippingPlanes!==void 0&&(ye.numClippingPlanes!==Zt.numPlanes||ye.numIntersection!==Zt.numIntersection)||ye.vertexAlphas!==Be||ye.vertexTangents!==Ae||ye.morphTargets!==Pe||ye.morphNormals!==tn||ye.morphColors!==oi||ye.toneMapping!==Mr||ge.isWebGL2===!0&&ye.morphTargetsCount!==sr)&&(en=!0):(en=!0,ye.__version=St.version);let co=ye.currentProgram;en===!0&&(co=rr(St,mt,vt));let rl=!1,ze=!1,gs=!1,ir=co.getUniforms(),Ko=ye.uniforms;if(fe.useProgram(co.program)&&(rl=!0,ze=!0,gs=!0),St.id!==D&&(D=St.id,ze=!0),rl||xt!==Z){ir.setValue(ft,"projectionMatrix",Z.projectionMatrix),ir.setValue(ft,"viewMatrix",Z.matrixWorldInverse);let Mi=ir.map.cameraPosition;Mi!==void 0&&Mi.setValue(ft,$t.setFromMatrixPosition(Z.matrixWorld)),ge.logarithmicDepthBuffer&&ir.setValue(ft,"logDepthBufFC",2/(Math.log(Z.far+1)/Math.LN2)),(St.isMeshPhongMaterial||St.isMeshToonMaterial||St.isMeshLambertMaterial||St.isMeshBasicMaterial||St.isMeshStandardMaterial||St.isShaderMaterial)&&ir.setValue(ft,"isOrthographic",Z.isOrthographicCamera===!0),xt!==Z&&(xt=Z,ze=!0,gs=!0)}if(vt.isSkinnedMesh){ir.setOptional(ft,vt,"bindMatrix"),ir.setOptional(ft,vt,"bindMatrixInverse");let Mi=vt.skeleton;Mi&&(ge.floatVertexTextures?(Mi.boneTexture===null&&Mi.computeBoneTexture(),ir.setValue(ft,"boneTexture",Mi.boneTexture,Wt)):console.warn("THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required."))}vt.isBatchedMesh&&(ir.setOptional(ft,vt,"batchingTexture"),ir.setValue(ft,"batchingTexture",vt._matricesTexture,Wt));let Le=It.morphAttributes;if((Le.position!==void 0||Le.normal!==void 0||Le.color!==void 0&&ge.isWebGL2===!0)&&C.update(vt,It,co),(ze||ye.receiveShadow!==vt.receiveShadow)&&(ye.receiveShadow=vt.receiveShadow,ir.setValue(ft,"receiveShadow",vt.receiveShadow)),St.isMeshGouraudMaterial&&St.envMap!==null&&(Ko.envMap.value=de,Ko.flipEnvMap.value=de.isCubeTexture&&de.isRenderTargetTexture===!1?-1:1),ze&&(ir.setValue(ft,"toneMappingExposure",T.toneMappingExposure),ye.needsLights&&Si(Ko,gs),he&&St.fog===!0&&Ht.refreshFogUniforms(Ko,he),Ht.refreshMaterialUniforms(Ko,St,Rt,Mt,jt),Oc.upload(ft,pr(ye),Ko,Wt)),St.isShaderMaterial&&St.uniformsNeedUpdate===!0&&(Oc.upload(ft,pr(ye),Ko,Wt),St.uniformsNeedUpdate=!1),St.isSpriteMaterial&&ir.setValue(ft,"center",vt.center),ir.setValue(ft,"modelViewMatrix",vt.modelViewMatrix),ir.setValue(ft,"normalMatrix",vt.normalMatrix),ir.setValue(ft,"modelMatrix",vt.matrixWorld),St.isShaderMaterial||St.isRawShaderMaterial){let Mi=St.uniformsGroups;for(let Fa=0,du=Mi.length;Fa<du;Fa++)if(ge.isWebGL2){let bi=Mi[Fa];ht.update(bi,co),ht.bind(bi,co)}else console.warn("THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.")}return co}function Si(Z,mt){Z.ambientLightColor.needsUpdate=mt,Z.lightProbe.needsUpdate=mt,Z.directionalLights.needsUpdate=mt,Z.directionalLightShadows.needsUpdate=mt,Z.pointLights.needsUpdate=mt,Z.pointLightShadows.needsUpdate=mt,Z.spotLights.needsUpdate=mt,Z.spotLightShadows.needsUpdate=mt,Z.rectAreaLights.needsUpdate=mt,Z.hemisphereLights.needsUpdate=mt}function ii(Z){return Z.isMeshLambertMaterial||Z.isMeshToonMaterial||Z.isMeshPhongMaterial||Z.isMeshStandardMaterial||Z.isShadowMaterial||Z.isShaderMaterial&&Z.lights===!0}this.getActiveCubeFace=function(){return W},this.getActiveMipmapLevel=function(){return X},this.getRenderTarget=function(){return q},this.setRenderTargetTextures=function(Z,mt,It){be.get(Z.texture).__webglTexture=mt,be.get(Z.depthTexture).__webglTexture=It;let St=be.get(Z);St.__hasExternalTextures=!0,St.__autoAllocateDepthBuffer=It===void 0,St.__autoAllocateDepthBuffer||ee.has("WEBGL_multisampled_render_to_texture")===!0&&(console.warn("THREE.WebGLRenderer: Render-to-texture extension was disabled because an external texture was provided"),St.__useRenderToTexture=!1)},this.setRenderTargetFramebuffer=function(Z,mt){let It=be.get(Z);It.__webglFramebuffer=mt,It.__useDefaultFramebuffer=mt===void 0},this.setRenderTarget=function(Z,mt=0,It=0){q=Z,W=mt,X=It;let St=!0,vt=null,he=!1,ue=!1;if(Z){let de=be.get(Z);de.__useDefaultFramebuffer!==void 0?(fe.bindFramebuffer(ft.FRAMEBUFFER,null),St=!1):de.__webglFramebuffer===void 0?Wt.setupRenderTarget(Z):de.__hasExternalTextures&&Wt.rebindTextures(Z,be.get(Z.texture).__webglTexture,be.get(Z.depthTexture).__webglTexture);let Be=Z.texture;(Be.isData3DTexture||Be.isDataArrayTexture||Be.isCompressedArrayTexture)&&(ue=!0);let Ae=be.get(Z).__webglFramebuffer;Z.isWebGLCubeRenderTarget?(Array.isArray(Ae[mt])?vt=Ae[mt][It]:vt=Ae[mt],he=!0):ge.isWebGL2&&Z.samples>0&&Wt.useMultisampledRTT(Z)===!1?vt=be.get(Z).__webglMultisampledFramebuffer:Array.isArray(Ae)?vt=Ae[It]:vt=Ae,B.copy(Z.viewport),j.copy(Z.scissor),J=Z.scissorTest}else B.copy(K).multiplyScalar(Rt).floor(),j.copy(Bt).multiplyScalar(Rt).floor(),J=Gt;if(fe.bindFramebuffer(ft.FRAMEBUFFER,vt)&&ge.drawBuffers&&St&&fe.drawBuffers(Z,vt),fe.viewport(B),fe.scissor(j),fe.setScissorTest(J),he){let de=be.get(Z.texture);ft.framebufferTexture2D(ft.FRAMEBUFFER,ft.COLOR_ATTACHMENT0,ft.TEXTURE_CUBE_MAP_POSITIVE_X+mt,de.__webglTexture,It)}else if(ue){let de=be.get(Z.texture),Be=mt||0;ft.framebufferTextureLayer(ft.FRAMEBUFFER,ft.COLOR_ATTACHMENT0,de.__webglTexture,It||0,Be)}D=-1},this.readRenderTargetPixels=function(Z,mt,It,St,vt,he,ue){if(!(Z&&Z.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let we=be.get(Z).__webglFramebuffer;if(Z.isWebGLCubeRenderTarget&&ue!==void 0&&(we=we[ue]),we){fe.bindFramebuffer(ft.FRAMEBUFFER,we);try{let de=Z.texture,Be=de.format,Ae=de.type;if(Be!==ta&&$.convert(Be)!==ft.getParameter(ft.IMPLEMENTATION_COLOR_READ_FORMAT)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}let Pe=Ae===Kf&&(ee.has("EXT_color_buffer_half_float")||ge.isWebGL2&&ee.has("EXT_color_buffer_float"));if(Ae!==Wu&&$.convert(Ae)!==ft.getParameter(ft.IMPLEMENTATION_COLOR_READ_TYPE)&&!(Ae===lu&&(ge.isWebGL2||ee.has("OES_texture_float")||ee.has("WEBGL_color_buffer_float")))&&!Pe){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}mt>=0&&mt<=Z.width-St&&It>=0&&It<=Z.height-vt&&ft.readPixels(mt,It,St,vt,$.convert(Be),$.convert(Ae),he)}finally{let de=q!==null?be.get(q).__webglFramebuffer:null;fe.bindFramebuffer(ft.FRAMEBUFFER,de)}}},this.copyFramebufferToTexture=function(Z,mt,It=0){let St=Math.pow(2,-It),vt=Math.floor(mt.image.width*St),he=Math.floor(mt.image.height*St);Wt.setTexture2D(mt,0),ft.copyTexSubImage2D(ft.TEXTURE_2D,It,0,0,Z.x,Z.y,vt,he),fe.unbindTexture()},this.copyTextureToTexture=function(Z,mt,It,St=0){let vt=mt.image.width,he=mt.image.height,ue=$.convert(It.format),we=$.convert(It.type);Wt.setTexture2D(It,0),ft.pixelStorei(ft.UNPACK_FLIP_Y_WEBGL,It.flipY),ft.pixelStorei(ft.UNPACK_PREMULTIPLY_ALPHA_WEBGL,It.premultiplyAlpha),ft.pixelStorei(ft.UNPACK_ALIGNMENT,It.unpackAlignment),mt.isDataTexture?ft.texSubImage2D(ft.TEXTURE_2D,St,Z.x,Z.y,vt,he,ue,we,mt.image.data):mt.isCompressedTexture?ft.compressedTexSubImage2D(ft.TEXTURE_2D,St,Z.x,Z.y,mt.mipmaps[0].width,mt.mipmaps[0].height,ue,mt.mipmaps[0].data):ft.texSubImage2D(ft.TEXTURE_2D,St,Z.x,Z.y,ue,we,mt.image),St===0&&It.generateMipmaps&&ft.generateMipmap(ft.TEXTURE_2D),fe.unbindTexture()},this.copyTextureToTexture3D=function(Z,mt,It,St,vt=0){if(T.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}let he=Math.round(Z.max.x-Z.min.x),ue=Math.round(Z.max.y-Z.min.y),we=Z.max.z-Z.min.z+1,de=$.convert(St.format),Be=$.convert(St.type),Ae;if(St.isData3DTexture)Wt.setTexture3D(St,0),Ae=ft.TEXTURE_3D;else if(St.isDataArrayTexture||St.isCompressedArrayTexture)Wt.setTexture2DArray(St,0),Ae=ft.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}ft.pixelStorei(ft.UNPACK_FLIP_Y_WEBGL,St.flipY),ft.pixelStorei(ft.UNPACK_PREMULTIPLY_ALPHA_WEBGL,St.premultiplyAlpha),ft.pixelStorei(ft.UNPACK_ALIGNMENT,St.unpackAlignment);let Pe=ft.getParameter(ft.UNPACK_ROW_LENGTH),tn=ft.getParameter(ft.UNPACK_IMAGE_HEIGHT),oi=ft.getParameter(ft.UNPACK_SKIP_PIXELS),Mr=ft.getParameter(ft.UNPACK_SKIP_ROWS),Hi=ft.getParameter(ft.UNPACK_SKIP_IMAGES),sr=It.isCompressedTexture?It.mipmaps[vt]:It.image;ft.pixelStorei(ft.UNPACK_ROW_LENGTH,sr.width),ft.pixelStorei(ft.UNPACK_IMAGE_HEIGHT,sr.height),ft.pixelStorei(ft.UNPACK_SKIP_PIXELS,Z.min.x),ft.pixelStorei(ft.UNPACK_SKIP_ROWS,Z.min.y),ft.pixelStorei(ft.UNPACK_SKIP_IMAGES,Z.min.z),It.isDataTexture||It.isData3DTexture?ft.texSubImage3D(Ae,vt,mt.x,mt.y,mt.z,he,ue,we,de,Be,sr.data):St.isCompressedArrayTexture?ft.compressedTexSubImage3D(Ae,vt,mt.x,mt.y,mt.z,he,ue,we,de,sr.data):ft.texSubImage3D(Ae,vt,mt.x,mt.y,mt.z,he,ue,we,de,Be,sr),ft.pixelStorei(ft.UNPACK_ROW_LENGTH,Pe),ft.pixelStorei(ft.UNPACK_IMAGE_HEIGHT,tn),ft.pixelStorei(ft.UNPACK_SKIP_PIXELS,oi),ft.pixelStorei(ft.UNPACK_SKIP_ROWS,Mr),ft.pixelStorei(ft.UNPACK_SKIP_IMAGES,Hi),vt===0&&St.generateMipmaps&&ft.generateMipmap(Ae),fe.unbindTexture()},this.initTexture=function(Z){Z.isCubeTexture?Wt.setTextureCube(Z,0):Z.isData3DTexture?Wt.setTexture3D(Z,0):Z.isDataArrayTexture||Z.isCompressedArrayTexture?Wt.setTexture2DArray(Z,0):Wt.setTexture2D(Z,0),fe.unbindTexture()},this.resetState=function(){W=0,X=0,q=null,fe.reset(),V.reset()},typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return cu}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(t){this._outputColorSpace=t;let e=this.getContext();e.drawingBufferColorSpace=t===pv?"display-p3":"srgb",e.unpackColorSpace=_r.workingColorSpace===Pd?"display-p3":"srgb"}get useLegacyLights(){return console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights}set useLegacyLights(t){console.warn("THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733."),this._useLegacyLights=t}},tv=class extends Qy{};tv.prototype.isWebGL1Renderer=!0;function sd(n,t,e){return!n||!e&&n.constructor===t?n:typeof t.BYTES_PER_ELEMENT=="number"?new t(n):Array.prototype.slice.call(n)}function ZW(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}var Gc=class{constructor(t,e,o,s){this.parameterPositions=t,this._cachedIndex=0,this.resultBuffer=s!==void 0?s:new e.constructor(o),this.sampleValues=e,this.valueSize=o,this.settings=null,this.DefaultSettings_={}}evaluate(t){let e=this.parameterPositions,o=this._cachedIndex,s=e[o],c=e[o-1];t:{e:{let h;n:{r:if(!(t<s)){for(let p=o+2;;){if(s===void 0){if(t<c)break r;return o=e.length,this._cachedIndex=o,this.copySampleValue_(o-1)}if(o===p)break;if(c=s,s=e[++o],t<s)break e}h=e.length;break n}if(!(t>=c)){let p=e[1];t<p&&(o=2,c=p);for(let g=o-2;;){if(c===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(o===g)break;if(s=c,c=e[--o-1],t>=c)break e}h=o,o=0;break n}break t}for(;o<h;){let p=o+h>>>1;t<e[p]?h=p:o=p+1}if(s=e[o],c=e[o-1],c===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(s===void 0)return o=e.length,this._cachedIndex=o,this.copySampleValue_(o-1)}this._cachedIndex=o,this.intervalChanged_(o,c,s)}return this.interpolate_(o,c,t,s)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(t){let e=this.resultBuffer,o=this.sampleValues,s=this.valueSize,c=t*s;for(let h=0;h!==s;++h)e[h]=o[c+h];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}},ev=class extends Gc{constructor(t,e,o,s){super(t,e,o,s),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:zA,endingEnd:zA}}intervalChanged_(t,e,o){let s=this.parameterPositions,c=t-2,h=t+1,p=s[c],g=s[h];if(p===void 0)switch(this.getSettings_().endingStart){case GA:c=t,p=2*e-o;break;case kA:c=s.length-2,p=e+s[c]-s[c+1];break;default:c=t,p=o}if(g===void 0)switch(this.getSettings_().endingEnd){case GA:h=t,g=2*o-e;break;case kA:h=1,g=o+s[1]-s[0];break;default:h=t-1,g=e}let m=(o-e)*.5,_=this.valueSize;this._weightPrev=m/(e-p),this._weightNext=m/(g-o),this._offsetPrev=c*_,this._offsetNext=h*_}interpolate_(t,e,o,s){let c=this.resultBuffer,h=this.sampleValues,p=this.valueSize,g=t*p,m=g-p,_=this._offsetPrev,E=this._offsetNext,x=this._weightPrev,b=this._weightNext,P=(o-e)/(s-e),I=P*P,S=I*P,w=-x*S+2*x*I-x*P,R=(1+x)*S+(-1.5-2*x)*I+(-.5+x)*P+1,T=(-1-b)*S+(1.5+b)*I+.5*P,F=b*S-b*I;for(let W=0;W!==p;++W)c[W]=w*h[_+W]+R*h[m+W]+T*h[g+W]+F*h[E+W];return c}},nv=class extends Gc{constructor(t,e,o,s){super(t,e,o,s)}interpolate_(t,e,o,s){let c=this.resultBuffer,h=this.sampleValues,p=this.valueSize,g=t*p,m=g-p,_=(o-e)/(s-e),E=1-_;for(let x=0;x!==p;++x)c[x]=h[m+x]*E+h[g+x]*_;return c}},rv=class extends Gc{constructor(t,e,o,s){super(t,e,o,s)}interpolate_(t){return this.copySampleValue_(t-1)}},na=class{constructor(t,e,o,s){if(t===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(e===void 0||e.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+t);this.name=t,this.times=sd(e,this.TimeBufferType),this.values=sd(o,this.ValueBufferType),this.setInterpolation(s||this.DefaultInterpolation)}static toJSON(t){let e=t.constructor,o;if(e.toJSON!==this.toJSON)o=e.toJSON(t);else{o={name:t.name,times:sd(t.times,Array),values:sd(t.values,Array)};let s=t.getInterpolation();s!==t.DefaultInterpolation&&(o.interpolation=s)}return o.type=t.ValueTypeName,o}InterpolantFactoryMethodDiscrete(t){return new rv(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodLinear(t){return new nv(this.times,this.values,this.getValueSize(),t)}InterpolantFactoryMethodSmooth(t){return new ev(this.times,this.values,this.getValueSize(),t)}setInterpolation(t){let e;switch(t){case ud:e=this.InterpolantFactoryMethodDiscrete;break;case ld:e=this.InterpolantFactoryMethodLinear;break;case ty:e=this.InterpolantFactoryMethodSmooth;break}if(e===void 0){let o="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(t!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(o);return console.warn("THREE.KeyframeTrack:",o),this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return ud;case this.InterpolantFactoryMethodLinear:return ld;case this.InterpolantFactoryMethodSmooth:return ty}}getValueSize(){return this.values.length/this.times.length}shift(t){if(t!==0){let e=this.times;for(let o=0,s=e.length;o!==s;++o)e[o]+=t}return this}scale(t){if(t!==1){let e=this.times;for(let o=0,s=e.length;o!==s;++o)e[o]*=t}return this}trim(t,e){let o=this.times,s=o.length,c=0,h=s-1;for(;c!==s&&o[c]<t;)++c;for(;h!==-1&&o[h]>e;)--h;if(++h,c!==0||h!==s){c>=h&&(h=Math.max(h,1),c=h-1);let p=this.getValueSize();this.times=o.slice(c,h),this.values=this.values.slice(c*p,h*p)}return this}validate(){let t=!0,e=this.getValueSize();e-Math.floor(e)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),t=!1);let o=this.times,s=this.values,c=o.length;c===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),t=!1);let h=null;for(let p=0;p!==c;p++){let g=o[p];if(typeof g=="number"&&isNaN(g)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,p,g),t=!1;break}if(h!==null&&h>g){console.error("THREE.KeyframeTrack: Out of order keys.",this,p,g,h),t=!1;break}h=g}if(s!==void 0&&ZW(s))for(let p=0,g=s.length;p!==g;++p){let m=s[p];if(isNaN(m)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,p,m),t=!1;break}}return t}optimize(){let t=this.times.slice(),e=this.values.slice(),o=this.getValueSize(),s=this.getInterpolation()===ty,c=t.length-1,h=1;for(let p=1;p<c;++p){let g=!1,m=t[p],_=t[p+1];if(m!==_&&(p!==1||m!==t[0]))if(s)g=!0;else{let E=p*o,x=E-o,b=E+o;for(let P=0;P!==o;++P){let I=e[E+P];if(I!==e[x+P]||I!==e[b+P]){g=!0;break}}}if(g){if(p!==h){t[h]=t[p];let E=p*o,x=h*o;for(let b=0;b!==o;++b)e[x+b]=e[E+b]}++h}}if(c>0){t[h]=t[c];for(let p=c*o,g=h*o,m=0;m!==o;++m)e[g+m]=e[p+m];++h}return h!==t.length?(this.times=t.slice(0,h),this.values=e.slice(0,h*o)):(this.times=t,this.values=e),this}clone(){let t=this.times.slice(),e=this.values.slice(),o=this.constructor,s=new o(this.name,t,e);return s.createInterpolant=this.createInterpolant,s}};na.prototype.TimeBufferType=Float32Array;na.prototype.ValueBufferType=Float32Array;na.prototype.DefaultInterpolation=ld;var Nl=class extends na{};Nl.prototype.ValueTypeName="bool";Nl.prototype.ValueBufferType=Array;Nl.prototype.DefaultInterpolation=ud;Nl.prototype.InterpolantFactoryMethodLinear=void 0;Nl.prototype.InterpolantFactoryMethodSmooth=void 0;var iv=class extends na{};iv.prototype.ValueTypeName="color";var ov=class extends na{};ov.prototype.ValueTypeName="number";var sv=class extends Gc{constructor(t,e,o,s){super(t,e,o,s)}interpolate_(t,e,o,s){let c=this.resultBuffer,h=this.sampleValues,p=this.valueSize,g=(o-e)/(s-e),m=t*p;for(let _=m+p;m!==_;m+=4)$u.slerpFlat(c,0,h,m-p,h,m,g);return c}},th=class extends na{InterpolantFactoryMethodLinear(t){return new sv(this.times,this.values,this.getValueSize(),t)}};th.prototype.ValueTypeName="quaternion";th.prototype.DefaultInterpolation=ld;th.prototype.InterpolantFactoryMethodSmooth=void 0;var Ol=class extends na{};Ol.prototype.ValueTypeName="string";Ol.prototype.ValueBufferType=Array;Ol.prototype.DefaultInterpolation=ud;Ol.prototype.InterpolantFactoryMethodLinear=void 0;Ol.prototype.InterpolantFactoryMethodSmooth=void 0;var av=class extends na{};av.prototype.ValueTypeName="vector";var uv=class{constructor(t,e,o){let s=this,c=!1,h=0,p=0,g,m=[];this.onStart=void 0,this.onLoad=t,this.onProgress=e,this.onError=o,this.itemStart=function(_){p++,c===!1&&s.onStart!==void 0&&s.onStart(_,h,p),c=!0},this.itemEnd=function(_){h++,s.onProgress!==void 0&&s.onProgress(_,h,p),h===p&&(c=!1,s.onLoad!==void 0&&s.onLoad())},this.itemError=function(_){s.onError!==void 0&&s.onError(_)},this.resolveURL=function(_){return g?g(_):_},this.setURLModifier=function(_){return g=_,this},this.addHandler=function(_,E){return m.push(_,E),this},this.removeHandler=function(_){let E=m.indexOf(_);return E!==-1&&m.splice(E,2),this},this.getHandler=function(_){for(let E=0,x=m.length;E<x;E+=2){let b=m[E],P=m[E+1];if(b.global&&(b.lastIndex=0),b.test(_))return P}return null}}},JW=new uv,lv=class{constructor(t){this.manager=t!==void 0?t:JW,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(t,e){let o=this;return new Promise(function(s,c){o.load(t,s,e,c)})}parse(){}setCrossOrigin(t){return this.crossOrigin=t,this}setWithCredentials(t){return this.withCredentials=t,this}setPath(t){return this.path=t,this}setResourcePath(t){return this.resourcePath=t,this}setRequestHeader(t){return this.requestHeader=t,this}};lv.DEFAULT_MATERIAL_NAME="__DEFAULT";var gv="\\\\[\\\\]\\\\.:\\\\/",KW=new RegExp("["+gv+"]","g"),mv="[^"+gv+"]",jW="[^"+gv.replace("\\\\.","")+"]",QW=/((?:WC+[\\/:])*)/.source.replace("WC",mv),t9=/(WCOD+)?/.source.replace("WCOD",jW),e9=/(?:\\.(WC+)(?:\\[(.+)\\])?)?/.source.replace("WC",mv),n9=/\\.(WC+)(?:\\[(.+)\\])?/.source.replace("WC",mv),r9=new RegExp("^"+QW+t9+e9+n9+"$"),i9=["material","materials","bones","map"],cv=class{constructor(t,e,o){let s=o||Nr.parseTrackName(e);this._targetGroup=t,this._bindings=t.subscribe_(e,s)}getValue(t,e){this.bind();let o=this._targetGroup.nCachedObjects_,s=this._bindings[o];s!==void 0&&s.getValue(t,e)}setValue(t,e){let o=this._bindings;for(let s=this._targetGroup.nCachedObjects_,c=o.length;s!==c;++s)o[s].setValue(t,e)}bind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,o=t.length;e!==o;++e)t[e].bind()}unbind(){let t=this._bindings;for(let e=this._targetGroup.nCachedObjects_,o=t.length;e!==o;++e)t[e].unbind()}},Nr=class n{constructor(t,e,o){this.path=e,this.parsedPath=o||n.parseTrackName(e),this.node=n.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,e,o){return t&&t.isAnimationObjectGroup?new n.Composite(t,e,o):new n(t,e,o)}static sanitizeNodeName(t){return t.replace(/\\s/g,"_").replace(KW,"")}static parseTrackName(t){let e=r9.exec(t);if(e===null)throw new Error("PropertyBinding: Cannot parse trackName: "+t);let o={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},s=o.nodeName&&o.nodeName.lastIndexOf(".");if(s!==void 0&&s!==-1){let c=o.nodeName.substring(s+1);i9.indexOf(c)!==-1&&(o.nodeName=o.nodeName.substring(0,s),o.objectName=c)}if(o.propertyName===null||o.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+t);return o}static findNode(t,e){if(e===void 0||e===""||e==="."||e===-1||e===t.name||e===t.uuid)return t;if(t.skeleton){let o=t.skeleton.getBoneByName(e);if(o!==void 0)return o}if(t.children){let o=function(c){for(let h=0;h<c.length;h++){let p=c[h];if(p.name===e||p.uuid===e)return p;let g=o(p.children);if(g)return g}return null},s=o(t.children);if(s)return s}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(t,e){t[e]=this.targetObject[this.propertyName]}_getValue_array(t,e){let o=this.resolvedProperty;for(let s=0,c=o.length;s!==c;++s)t[e++]=o[s]}_getValue_arrayElement(t,e){t[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(t,e){this.resolvedProperty.toArray(t,e)}_setValue_direct(t,e){this.targetObject[this.propertyName]=t[e]}_setValue_direct_setNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(t,e){this.targetObject[this.propertyName]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(t,e){let o=this.resolvedProperty;for(let s=0,c=o.length;s!==c;++s)o[s]=t[e++]}_setValue_array_setNeedsUpdate(t,e){let o=this.resolvedProperty;for(let s=0,c=o.length;s!==c;++s)o[s]=t[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(t,e){let o=this.resolvedProperty;for(let s=0,c=o.length;s!==c;++s)o[s]=t[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(t,e){this.resolvedProperty[this.propertyIndex]=t[e]}_setValue_arrayElement_setNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty[this.propertyIndex]=t[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(t,e){this.resolvedProperty.fromArray(t,e)}_setValue_fromArray_setNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(t,e){this.resolvedProperty.fromArray(t,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(t,e){this.bind(),this.getValue(t,e)}_setValue_unbound(t,e){this.bind(),this.setValue(t,e)}bind(){let t=this.node,e=this.parsedPath,o=e.objectName,s=e.propertyName,c=e.propertyIndex;if(t||(t=n.findNode(this.rootNode,e.nodeName),this.node=t),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!t){console.warn("THREE.PropertyBinding: No target node found for track: "+this.path+".");return}if(o){let m=e.objectIndex;switch(o){case"materials":if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.materials){console.error("THREE.PropertyBinding: Can not bind to material.materials as node.material does not have a materials array.",this);return}t=t.material.materials;break;case"bones":if(!t.skeleton){console.error("THREE.PropertyBinding: Can not bind to bones as node does not have a skeleton.",this);return}t=t.skeleton.bones;for(let _=0;_<t.length;_++)if(t[_].name===m){m=_;break}break;case"map":if("map"in t){t=t.map;break}if(!t.material){console.error("THREE.PropertyBinding: Can not bind to material as node does not have a material.",this);return}if(!t.material.map){console.error("THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.",this);return}t=t.material.map;break;default:if(t[o]===void 0){console.error("THREE.PropertyBinding: Can not bind to objectName of node undefined.",this);return}t=t[o]}if(m!==void 0){if(t[m]===void 0){console.error("THREE.PropertyBinding: Trying to bind to objectIndex of objectName, but is undefined.",this,t);return}t=t[m]}}let h=t[s];if(h===void 0){let m=e.nodeName;console.error("THREE.PropertyBinding: Trying to update property for track: "+m+"."+s+" but it wasn't found.",t);return}let p=this.Versioning.None;this.targetObject=t,t.needsUpdate!==void 0?p=this.Versioning.NeedsUpdate:t.matrixWorldNeedsUpdate!==void 0&&(p=this.Versioning.MatrixWorldNeedsUpdate);let g=this.BindingType.Direct;if(c!==void 0){if(s==="morphTargetInfluences"){if(!t.geometry){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.",this);return}if(!t.geometry.morphAttributes){console.error("THREE.PropertyBinding: Can not bind to morphTargetInfluences because node does not have a geometry.morphAttributes.",this);return}t.morphTargetDictionary[c]!==void 0&&(c=t.morphTargetDictionary[c])}g=this.BindingType.ArrayElement,this.resolvedProperty=h,this.propertyIndex=c}else h.fromArray!==void 0&&h.toArray!==void 0?(g=this.BindingType.HasFromToArray,this.resolvedProperty=h):Array.isArray(h)?(g=this.BindingType.EntireArray,this.resolvedProperty=h):this.propertyName=s;this.getValue=this.GetterByBindingType[g],this.setValue=this.SetterByBindingTypeAndVersioning[g][p]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}};Nr.Composite=cv;Nr.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};Nr.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};Nr.prototype.GetterByBindingType=[Nr.prototype._getValue_direct,Nr.prototype._getValue_array,Nr.prototype._getValue_arrayElement,Nr.prototype._getValue_toArray];Nr.prototype.SetterByBindingTypeAndVersioning=[[Nr.prototype._setValue_direct,Nr.prototype._setValue_direct_setNeedsUpdate,Nr.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[Nr.prototype._setValue_array,Nr.prototype._setValue_array_setNeedsUpdate,Nr.prototype._setValue_array_setMatrixWorldNeedsUpdate],[Nr.prototype._setValue_arrayElement,Nr.prototype._setValue_arrayElement_setNeedsUpdate,Nr.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[Nr.prototype._setValue_fromArray,Nr.prototype._setValue_fromArray_setNeedsUpdate,Nr.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];var pQ=new Float32Array(1);typeof __THREE_DEVTOOLS__!="undefined"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:fv}}));typeof window!="undefined"&&(window.__THREE__?console.warn("WARNING: Multiple instances of Three.js being imported."):window.__THREE__=fv);var Bi=63710088e-1,mQ={centimeters:Bi*100,centimetres:Bi*100,degrees:Bi/111325,feet:Bi*3.28084,inches:Bi*39.37,kilometers:Bi/1e3,kilometres:Bi/1e3,meters:Bi,metres:Bi,miles:Bi/1609.344,millimeters:Bi*1e3,millimetres:Bi*1e3,nauticalmiles:Bi/1852,radians:1,yards:Bi*1.0936},yQ={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/Bi,yards:1.0936133};function So(n,t,e){e===void 0&&(e={});var o={type:"Feature"};return(e.id===0||e.id)&&(o.id=e.id),e.bbox&&(o.bbox=e.bbox),o.properties=t||{},o.geometry=n,o}function Cr(n,t,e){if(e===void 0&&(e={}),!n)throw new Error("coordinates is required");if(!Array.isArray(n))throw new Error("coordinates must be an Array");if(n.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Pa(n[0])||!Pa(n[1]))throw new Error("coordinates must contain numbers");var o={type:"Point",coordinates:n};return So(o,t,e)}function Or(n,t,e){e===void 0&&(e={});for(var o=0,s=n;o<s.length;o++){var c=s[o];if(c.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var h=0;h<c[c.length-1].length;h++)if(c[c.length-1][h]!==c[0][h])throw new Error("First and last Position are not equivalent.")}var p={type:"Polygon",coordinates:n};return So(p,t,e)}function zi(n,t,e){if(e===void 0&&(e={}),n.length<2)throw new Error("coordinates must be an array of two or more positions");var o={type:"LineString",coordinates:n};return So(o,t,e)}function yv(n,t,e){e===void 0&&(e={});var o={type:"MultiPoint",coordinates:n};return So(o,t,e)}function Pa(n){return!isNaN(n)&&n!==null&&!Array.isArray(n)}function _i(n,t,e){if(n!==null)for(var o,s,c,h,p,g,m,_=0,E=0,x,b=n.type,P=b==="FeatureCollection",I=b==="Feature",S=P?n.features.length:1,w=0;w<S;w++){m=P?n.features[w].geometry:I?n.geometry:n,x=m?m.type==="GeometryCollection":!1,p=x?m.geometries.length:1;for(var R=0;R<p;R++){var T=0,F=0;if(h=x?m.geometries[R]:m,h!==null){g=h.coordinates;var W=h.type;switch(_=e&&(W==="Polygon"||W==="MultiPolygon")?1:0,W){case null:break;case"Point":if(t(g,E,w,T,F)===!1)return!1;E++,T++;break;case"LineString":case"MultiPoint":for(o=0;o<g.length;o++){if(t(g[o],E,w,T,F)===!1)return!1;E++,W==="MultiPoint"&&T++}W==="LineString"&&T++;break;case"Polygon":case"MultiLineString":for(o=0;o<g.length;o++){for(s=0;s<g[o].length-_;s++){if(t(g[o][s],E,w,T,F)===!1)return!1;E++}W==="MultiLineString"&&T++,W==="Polygon"&&F++}W==="Polygon"&&T++;break;case"MultiPolygon":for(o=0;o<g.length;o++){for(F=0,s=0;s<g[o].length;s++){for(c=0;c<g[o][s].length-_;c++){if(t(g[o][s][c],E,w,T,F)===!1)return!1;E++}F++}T++}break;case"GeometryCollection":for(o=0;o<h.geometries.length;o++)if(_i(h.geometries[o],t,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function KT(n,t,e,o){var s=e;return _i(n,function(c,h,p,g,m){h===0&&e===void 0?s=c:s=t(s,c,h,p,g,m)},o),s}function Ju(n,t){var e,o,s,c,h,p,g,m,_,E,x=0,b=n.type==="FeatureCollection",P=n.type==="Feature",I=b?n.features.length:1;for(e=0;e<I;e++){for(p=b?n.features[e].geometry:P?n.geometry:n,m=b?n.features[e].properties:P?n.properties:{},_=b?n.features[e].bbox:P?n.bbox:void 0,E=b?n.features[e].id:P?n.id:void 0,g=p?p.type==="GeometryCollection":!1,h=g?p.geometries.length:1,s=0;s<h;s++){if(c=g?p.geometries[s]:p,c===null){if(t(null,x,m,_,E)===!1)return!1;continue}switch(c.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(c,x,m,_,E)===!1)return!1;break}case"GeometryCollection":{for(o=0;o<c.geometries.length;o++)if(t(c.geometries[o],x,m,_,E)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}x++}}function ds(n,t){Ju(n,function(e,o,s,c,h){var p=e===null?null:e.type;switch(p){case null:case"Point":case"LineString":case"Polygon":return t(So(e,s,{bbox:c,id:h}),o,0)===!1?!1:void 0}var g;switch(p){case"MultiPoint":g="Point";break;case"MultiLineString":g="LineString";break;case"MultiPolygon":g="Polygon";break}for(var m=0;m<e.coordinates.length;m++){var _=e.coordinates[m],E={type:g,coordinates:_};if(t(So(E,s),o,m)===!1)return!1}})}function vv(n){var t=[1/0,1/0,-1/0,-1/0];return _i(n,function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]<e[0]&&(t[2]=e[0]),t[3]<e[1]&&(t[3]=e[1])}),t}vv.default=vv;var Mo=vv;function ji(n){if(!n)throw new Error("coord is required");if(!Array.isArray(n)){if(n.type==="Feature"&&n.geometry!==null&&n.geometry.type==="Point")return n.geometry.coordinates;if(n.type==="Point")return n.coordinates}if(Array.isArray(n)&&n.length>=2&&!Array.isArray(n[0])&&!Array.isArray(n[1]))return n;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function _v(n,t,e){if(!n)throw new Error("No feature passed");if(!e)throw new Error(".featureOf() requires a name");if(!n||n.type!=="Feature"||!n.geometry)throw new Error("Invalid input to "+e+", Feature with geometry required");if(!n.geometry||n.geometry.type!==t)throw new Error("Invalid input to "+e+": must be a "+t+", given "+n.geometry.type)}function Qi(n){return n.type==="Feature"?n.geometry:n}var h9=on(Rd(),1);var w9=on(gC(),1);function Gi(n,t,e){if(e===void 0&&(e={}),!n)throw new Error("point is required");if(!t)throw new Error("polygon is required");var o=ji(n),s=Qi(t),c=s.type,h=t.bbox,p=s.coordinates;if(h&&S9(o,h)===!1)return!1;c==="Polygon"&&(p=[p]);for(var g=!1,m=0;m<p.length&&!g;m++)if(mC(o,p[m][0],e.ignoreBoundary)){for(var _=!1,E=1;E<p[m].length&&!_;)mC(o,p[m][E],!e.ignoreBoundary)&&(_=!0),E++;_||(g=!0)}return g}function mC(n,t,e){var o=!1;t[0][0]===t[t.length-1][0]&&t[0][1]===t[t.length-1][1]&&(t=t.slice(0,t.length-1));for(var s=0,c=t.length-1;s<t.length;c=s++){var h=t[s][0],p=t[s][1],g=t[c][0],m=t[c][1],_=n[1]*(h-g)+p*(g-n[0])+m*(n[0]-h)===0&&(h-n[0])*(g-n[0])<=0&&(p-n[1])*(m-n[1])<=0;if(_)return!e;var E=p>n[1]!=m>n[1]&&n[0]<(g-h)*(n[1]-p)/(m-p)+h;E&&(o=!o)}return o}function S9(n,t){return t[0]<=n[0]&&t[1]<=n[1]&&t[2]>=n[0]&&t[3]>=n[1]}var _C=new ArrayBuffer(16),Xtt=new Float64Array(_C),Ytt=new Uint32Array(_C);var B9=on(Dv(),1);var Ent=function(){function n(t){this.points=t.points||[],this.duration=t.duration||1e4,this.sharpness=t.sharpness||.85,this.centers=[],this.controls=[],this.stepLength=t.stepLength||60,this.length=this.points.length,this.delay=0;for(var e=0;e<this.length;e++)this.points[e].z=this.points[e].z||0;for(var e=0;e<this.length-1;e++){var o=this.points[e],s=this.points[e+1];this.centers.push({x:(o.x+s.x)/2,y:(o.y+s.y)/2,z:(o.z+s.z)/2})}this.controls.push([this.points[0],this.points[0]]);for(var e=0;e<this.centers.length-1;e++){var c=this.points[e+1].x-(this.centers[e].x+this.centers[e+1].x)/2,h=this.points[e+1].y-(this.centers[e].y+this.centers[e+1].y)/2,p=this.points[e+1].z-(this.centers[e].y+this.centers[e+1].z)/2;this.controls.push([{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e].x+c),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e].y+h),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e].z+p)},{x:(1-this.sharpness)*this.points[e+1].x+this.sharpness*(this.centers[e+1].x+c),y:(1-this.sharpness)*this.points[e+1].y+this.sharpness*(this.centers[e+1].y+h),z:(1-this.sharpness)*this.points[e+1].z+this.sharpness*(this.centers[e+1].z+p)}])}return this.controls.push([this.points[this.length-1],this.points[this.length-1]]),this.steps=this.cacheSteps(this.stepLength),this}return n.prototype.cacheSteps=function(t){var e=[],o=this.pos(0);e.push(0);for(var s=0;s<this.duration;s+=10){var c=this.pos(s),h=Math.sqrt((c.x-o.x)*(c.x-o.x)+(c.y-o.y)*(c.y-o.y)+(c.z-o.z)*(c.z-o.z));h>t&&(e.push(s),o=c)}return e},n.prototype.vector=function(t){var e=this.pos(t+10),o=this.pos(t-10);return{angle:180*Math.atan2(e.y-o.y,e.x-o.x)/3.14,speed:Math.sqrt((o.x-e.x)*(o.x-e.x)+(o.y-e.y)*(o.y-e.y)+(o.z-e.z)*(o.z-e.z))}},n.prototype.pos=function(t){var e=t-this.delay;e<0&&(e=0),e>this.duration&&(e=this.duration-1);var o=e/this.duration;if(o>=1)return this.points[this.length-1];var s=Math.floor((this.points.length-1)*o),c=(this.length-1)*o-s;return z9(c,this.points[s],this.controls[s][1],this.controls[s+1][0],this.points[s+1])},n}();function z9(n,t,e,o,s){var c=G9(n),h={x:s.x*c[0]+o.x*c[1]+e.x*c[2]+t.x*c[3],y:s.y*c[0]+o.y*c[1]+e.y*c[2]+t.y*c[3],z:s.z*c[0]+o.z*c[1]+e.z*c[2]+t.z*c[3]};return h}function G9(n){var t=n*n,e=t*n;return[e,3*t*(1-n),3*n*(1-n)*(1-n),(1-n)*(1-n)*(1-n)]}function oh(n,t){t===void 0&&(t={});var e=Number(n[0]),o=Number(n[1]),s=Number(n[2]),c=Number(n[3]);if(n.length===6)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var h=[e,o],p=[e,c],g=[s,c],m=[s,o];return Or([[h,m,g,p,h]],t.properties,{bbox:n,id:t.id})}function k9(n){return oh(Mo(n))}var Fv=k9;var iX=on(IC(),1);var RX=on($d(),1);var NX=on(Rd(),1);var FX=on(Dv(),1);var $C=Math.PI/180,ZC=180/Math.PI,hh=function(n,t){this.lon=n,this.lat=t,this.x=$C*n,this.y=$C*t};hh.prototype.view=function(){return String(this.lon).slice(0,4)+","+String(this.lat).slice(0,4)};hh.prototype.antipode=function(){var n=-1*this.lat,t=this.lon<0?180+this.lon:(180-this.lon)*-1;return new hh(t,n)};var JC=function(){this.coords=[],this.length=0};JC.prototype.move_to=function(n){this.length++,this.coords.push(n)};var n_=function(n){this.properties=n||{},this.geometries=[]};n_.prototype.json=function(){if(this.geometries.length<=0)return{geometry:{type:"LineString",coordinates:null},type:"Feature",properties:this.properties};if(this.geometries.length===1)return{geometry:{type:"LineString",coordinates:this.geometries[0].coords},type:"Feature",properties:this.properties};for(var n=[],t=0;t<this.geometries.length;t++)n.push(this.geometries[t].coords);return{geometry:{type:"MultiLineString",coordinates:n},type:"Feature",properties:this.properties}};n_.prototype.wkt=function(){for(var n="",t="LINESTRING(",e=function(c){t+=c[0]+" "+c[1]+","},o=0;o<this.geometries.length;o++){if(this.geometries[o].coords.length===0)return"LINESTRING(empty)";var s=this.geometries[o].coords;s.forEach(e),n+=t.substring(0,t.length-1)+")"}return n};var KC=function(n,t,e){if(!n||n.x===void 0||n.y===void 0)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");if(!t||t.x===void 0||t.y===void 0)throw new Error("GreatCircle constructor expects two args: start and end objects with x and y properties");this.start=new hh(n.x,n.y),this.end=new hh(t.x,t.y),this.properties=e||{};var o=this.start.x-this.end.x,s=this.start.y-this.end.y,c=Math.pow(Math.sin(s/2),2)+Math.cos(this.start.y)*Math.cos(this.end.y)*Math.pow(Math.sin(o/2),2);if(this.g=2*Math.asin(Math.sqrt(c)),this.g===Math.PI)throw new Error("it appears "+n.view()+" and "+t.view()+" are 'antipodal', e.g diametrically opposite, thus there is no single route but rather infinite");if(isNaN(this.g))throw new Error("could not calculate great circle between "+n+" and "+t)};KC.prototype.interpolate=function(n){var t=Math.sin((1-n)*this.g)/Math.sin(this.g),e=Math.sin(n*this.g)/Math.sin(this.g),o=t*Math.cos(this.start.y)*Math.cos(this.start.x)+e*Math.cos(this.end.y)*Math.cos(this.end.x),s=t*Math.cos(this.start.y)*Math.sin(this.start.x)+e*Math.cos(this.end.y)*Math.sin(this.end.x),c=t*Math.sin(this.start.y)+e*Math.sin(this.end.y),h=ZC*Math.atan2(c,Math.sqrt(Math.pow(o,2)+Math.pow(s,2))),p=ZC*Math.atan2(s,o);return[p,h]};KC.prototype.Arc=function(n,t){var e=[];if(!n||n<=2)e.push([this.start.lon,this.start.lat]),e.push([this.end.lon,this.end.lat]);else for(var o=1/(n-1),s=0;s<n;++s){var c=o*s,h=this.interpolate(c);e.push(h)}for(var p=!1,g=0,m=t&&t.offset?t.offset:10,_=180-m,E=-180+m,x=360-m,b=1;b<e.length;++b){var P=e[b-1][0],I=e[b][0],S=Math.abs(I-P);S>x&&(I>_&&P<E||P>_&&I<E)?p=!0:S>g&&(g=S)}var w=[];if(p&&g<m){var R=[];w.push(R);for(var T=0;T<e.length;++T){var F=parseFloat(e[T][0]);if(T>0&&Math.abs(F-e[T-1][0])>x){var W=parseFloat(e[T-1][0]),X=parseFloat(e[T-1][1]),q=parseFloat(e[T][0]),D=parseFloat(e[T][1]);if(W>-180&&W<E&&q===180&&T+1<e.length&&e[T-1][0]>-180&&e[T-1][0]<E){R.push([-180,e[T][1]]),T++,R.push([e[T][0],e[T][1]]);continue}else if(W>_&&W<180&&q===-180&&T+1<e.length&&e[T-1][0]>_&&e[T-1][0]<180){R.push([180,e[T][1]]),T++,R.push([e[T][0],e[T][1]]);continue}if(W<E&&q>_){var xt=W;W=q,q=xt;var B=X;X=D,D=B}if(W>_&&q<E&&(q+=360),W<=180&&q>=180&&W<q){var j=(180-W)/(q-W),J=j*D+(1-j)*X;R.push([e[T-1][0]>_?180:-180,J]),R=[],R.push([e[T-1][0]>_?-180:180,J]),w.push(R)}else R=[],w.push(R);R.push([F,e[T][1]])}else R.push([e[T][0],e[T][1]])}}else{var Dt=[];w.push(Dt);for(var Q=0;Q<e.length;++Q)Dt.push([e[Q][0],e[Q][1]])}for(var At=new n_(this.properties),Mt=0;Mt<w.length;++Mt){var Rt=new JC;At.geometries.push(Rt);for(var pt=w[Mt],yt=0;yt<pt.length;++yt)Rt.move_to(pt[yt])}return At};var zX=on($d(),1);var vY=on($d(),1);var _Y=on(M_(),1);var wY=on(Rd(),1);var un=[],ln=[],cn=[],fn=[],hn=[],pn=[],dn=[],gn=[],mn=[],yn=[],vn=[],_n=[],xn=[],En=[],wn=[],Sn=[],Mn=[],bn=[],An=[],Tn=[],Cn=[],Pn=[],In=[],Rn=[];dn[85]=yn[85]=-1;gn[85]=vn[85]=0;mn[85]=_n[85]=1;An[85]=Pn[85]=1;Tn[85]=In[85]=0;Cn[85]=Rn[85]=1;un[85]=fn[85]=0;ln[85]=hn[85]=-1;cn[85]=wn[85]=0;Sn[85]=xn[85]=0;Mn[85]=En[85]=1;pn[85]=bn[85]=1;Pn[1]=Pn[169]=0;In[1]=In[169]=-1;Rn[1]=Rn[169]=0;xn[1]=xn[169]=-1;En[1]=En[169]=0;wn[1]=wn[169]=0;yn[4]=yn[166]=0;vn[4]=vn[166]=-1;_n[4]=_n[166]=1;Sn[4]=Sn[166]=1;Mn[4]=Mn[166]=0;bn[4]=bn[166]=0;dn[16]=dn[154]=0;gn[16]=gn[154]=1;mn[16]=mn[154]=1;fn[16]=fn[154]=1;hn[16]=hn[154]=0;pn[16]=pn[154]=1;An[64]=An[106]=0;Tn[64]=Tn[106]=1;Cn[64]=Cn[106]=0;un[64]=un[106]=-1;ln[64]=ln[106]=0;cn[64]=cn[106]=1;An[2]=An[168]=0;Tn[2]=Tn[168]=-1;Cn[2]=Cn[168]=1;Pn[2]=Pn[168]=0;In[2]=In[168]=-1;Rn[2]=Rn[168]=0;xn[2]=xn[168]=-1;En[2]=En[168]=0;wn[2]=wn[168]=0;Sn[2]=Sn[168]=-1;Mn[2]=Mn[168]=0;bn[2]=bn[168]=1;dn[8]=dn[162]=0;gn[8]=gn[162]=-1;mn[8]=mn[162]=0;yn[8]=yn[162]=0;vn[8]=vn[162]=-1;_n[8]=_n[162]=1;xn[8]=xn[162]=1;En[8]=En[162]=0;wn[8]=wn[162]=1;Sn[8]=Sn[162]=1;Mn[8]=Mn[162]=0;bn[8]=bn[162]=0;dn[32]=dn[138]=0;gn[32]=gn[138]=1;mn[32]=mn[138]=1;yn[32]=yn[138]=0;vn[32]=vn[138]=1;_n[32]=_n[138]=0;un[32]=un[138]=1;ln[32]=ln[138]=0;cn[32]=cn[138]=0;fn[32]=fn[138]=1;hn[32]=hn[138]=0;pn[32]=pn[138]=1;Pn[128]=Pn[42]=0;In[128]=In[42]=1;Rn[128]=Rn[42]=1;An[128]=An[42]=0;Tn[128]=Tn[42]=1;Cn[128]=Cn[42]=0;un[128]=un[42]=-1;ln[128]=ln[42]=0;cn[128]=cn[42]=1;fn[128]=fn[42]=-1;hn[128]=hn[42]=0;pn[128]=pn[42]=0;yn[5]=yn[165]=-1;vn[5]=vn[165]=0;_n[5]=_n[165]=0;Pn[5]=Pn[165]=1;In[5]=In[165]=0;Rn[5]=Rn[165]=0;Sn[20]=Sn[150]=0;Mn[20]=Mn[150]=1;bn[20]=bn[150]=1;fn[20]=fn[150]=0;hn[20]=hn[150]=-1;pn[20]=pn[150]=1;dn[80]=dn[90]=-1;gn[80]=gn[90]=0;mn[80]=mn[90]=1;An[80]=An[90]=1;Tn[80]=Tn[90]=0;Cn[80]=Cn[90]=1;xn[65]=xn[105]=0;En[65]=En[105]=1;wn[65]=wn[105]=0;un[65]=un[105]=0;ln[65]=ln[105]=-1;cn[65]=cn[105]=0;dn[160]=dn[10]=-1;gn[160]=gn[10]=0;mn[160]=mn[10]=1;yn[160]=yn[10]=-1;vn[160]=vn[10]=0;_n[160]=_n[10]=0;Pn[160]=Pn[10]=1;In[160]=In[10]=0;Rn[160]=Rn[10]=0;An[160]=An[10]=1;Tn[160]=Tn[10]=0;Cn[160]=Cn[10]=1;Sn[130]=Sn[40]=0;Mn[130]=Mn[40]=1;bn[130]=bn[40]=1;xn[130]=xn[40]=0;En[130]=En[40]=1;wn[130]=wn[40]=0;un[130]=un[40]=0;ln[130]=ln[40]=-1;cn[130]=cn[40]=0;fn[130]=fn[40]=0;hn[130]=hn[40]=-1;pn[130]=pn[40]=1;yn[37]=yn[133]=0;vn[37]=vn[133]=1;_n[37]=_n[133]=1;Pn[37]=Pn[133]=0;In[37]=In[133]=1;Rn[37]=Rn[133]=0;un[37]=un[133]=-1;ln[37]=ln[133]=0;cn[37]=cn[133]=0;fn[37]=fn[133]=1;hn[37]=hn[133]=0;pn[37]=pn[133]=0;Sn[148]=Sn[22]=-1;Mn[148]=Mn[22]=0;bn[148]=bn[22]=0;Pn[148]=Pn[22]=0;In[148]=In[22]=-1;Rn[148]=Rn[22]=1;An[148]=An[22]=0;Tn[148]=Tn[22]=1;Cn[148]=Cn[22]=1;fn[148]=fn[22]=-1;hn[148]=hn[22]=0;pn[148]=pn[22]=1;dn[82]=dn[88]=0;gn[82]=gn[88]=-1;mn[82]=mn[88]=1;Sn[82]=Sn[88]=1;Mn[82]=Mn[88]=0;bn[82]=bn[88]=1;xn[82]=xn[88]=-1;En[82]=En[88]=0;wn[82]=wn[88]=1;An[82]=An[88]=0;Tn[82]=Tn[88]=-1;Cn[82]=Cn[88]=0;dn[73]=dn[97]=0;gn[73]=gn[97]=1;mn[73]=mn[97]=0;yn[73]=yn[97]=0;vn[73]=vn[97]=-1;_n[73]=_n[97]=0;xn[73]=xn[97]=1;En[73]=En[97]=0;wn[73]=wn[97]=0;un[73]=un[97]=1;ln[73]=ln[97]=0;cn[73]=cn[97]=1;dn[145]=dn[25]=0;gn[145]=gn[25]=-1;mn[145]=mn[25]=0;xn[145]=xn[25]=1;En[145]=En[25]=0;wn[145]=wn[25]=1;Pn[145]=Pn[25]=0;In[145]=In[25]=1;Rn[145]=Rn[25]=1;fn[145]=fn[25]=-1;hn[145]=hn[25]=0;pn[145]=pn[25]=0;yn[70]=yn[100]=0;vn[70]=vn[100]=1;_n[70]=_n[100]=0;Sn[70]=Sn[100]=-1;Mn[70]=Mn[100]=0;bn[70]=bn[100]=1;An[70]=An[100]=0;Tn[70]=Tn[100]=-1;Cn[70]=Cn[100]=1;un[70]=un[100]=1;ln[70]=ln[100]=0;cn[70]=cn[100]=0;yn[101]=yn[69]=0;vn[101]=vn[69]=1;_n[101]=_n[69]=0;un[101]=un[69]=1;ln[101]=ln[69]=0;cn[101]=cn[69]=0;Pn[149]=Pn[21]=0;In[149]=In[21]=1;Rn[149]=Rn[21]=1;fn[149]=fn[21]=-1;hn[149]=hn[21]=0;pn[149]=pn[21]=0;Sn[86]=Sn[84]=-1;Mn[86]=Mn[84]=0;bn[86]=bn[84]=1;An[86]=An[84]=0;Tn[86]=Tn[84]=-1;Cn[86]=Cn[84]=1;dn[89]=dn[81]=0;gn[89]=gn[81]=-1;mn[89]=mn[81]=0;xn[89]=xn[81]=1;En[89]=En[81]=0;wn[89]=wn[81]=1;dn[96]=dn[74]=0;gn[96]=gn[74]=1;mn[96]=mn[74]=0;yn[96]=yn[74]=-1;vn[96]=vn[74]=0;_n[96]=_n[74]=1;An[96]=An[74]=1;Tn[96]=Tn[74]=0;Cn[96]=Cn[74]=0;un[96]=un[74]=1;ln[96]=ln[74]=0;cn[96]=cn[74]=1;dn[24]=dn[146]=0;gn[24]=gn[146]=-1;mn[24]=mn[146]=1;Sn[24]=Sn[146]=1;Mn[24]=Mn[146]=0;bn[24]=bn[146]=1;xn[24]=xn[146]=0;En[24]=En[146]=1;wn[24]=wn[146]=1;fn[24]=fn[146]=0;hn[24]=hn[146]=-1;pn[24]=pn[146]=0;yn[6]=yn[164]=-1;vn[6]=vn[164]=0;_n[6]=_n[164]=1;Sn[6]=Sn[164]=-1;Mn[6]=Mn[164]=0;bn[6]=bn[164]=0;Pn[6]=Pn[164]=0;In[6]=In[164]=-1;Rn[6]=Rn[164]=1;An[6]=An[164]=1;Tn[6]=Tn[164]=0;Cn[6]=Cn[164]=0;xn[129]=xn[41]=0;En[129]=En[41]=1;wn[129]=wn[41]=1;Pn[129]=Pn[41]=0;In[129]=In[41]=1;Rn[129]=Rn[41]=0;un[129]=un[41]=-1;ln[129]=ln[41]=0;cn[129]=cn[41]=0;fn[129]=fn[41]=0;hn[129]=hn[41]=-1;pn[129]=pn[41]=0;Sn[66]=Sn[104]=0;Mn[66]=Mn[104]=1;bn[66]=bn[104]=0;xn[66]=xn[104]=-1;En[66]=En[104]=0;wn[66]=wn[104]=1;An[66]=An[104]=0;Tn[66]=Tn[104]=-1;Cn[66]=Cn[104]=0;un[66]=un[104]=0;ln[66]=ln[104]=-1;cn[66]=cn[104]=1;dn[144]=dn[26]=-1;gn[144]=gn[26]=0;mn[144]=mn[26]=0;Pn[144]=Pn[26]=1;In[144]=In[26]=0;Rn[144]=Rn[26]=1;An[144]=An[26]=0;Tn[144]=Tn[26]=1;Cn[144]=Cn[26]=1;fn[144]=fn[26]=-1;hn[144]=hn[26]=0;pn[144]=pn[26]=1;yn[36]=yn[134]=0;vn[36]=vn[134]=1;_n[36]=_n[134]=1;Sn[36]=Sn[134]=0;Mn[36]=Mn[134]=1;bn[36]=bn[134]=0;un[36]=un[134]=0;ln[36]=ln[134]=-1;cn[36]=cn[134]=1;fn[36]=fn[134]=1;hn[36]=hn[134]=0;pn[36]=pn[134]=0;dn[9]=dn[161]=-1;gn[9]=gn[161]=0;mn[9]=mn[161]=0;yn[9]=yn[161]=0;vn[9]=vn[161]=-1;_n[9]=_n[161]=0;xn[9]=xn[161]=1;En[9]=En[161]=0;wn[9]=wn[161]=0;Pn[9]=Pn[161]=1;In[9]=In[161]=0;Rn[9]=Rn[161]=1;dn[136]=0;gn[136]=1;mn[136]=1;yn[136]=0;vn[136]=1;_n[136]=0;Sn[136]=-1;Mn[136]=0;bn[136]=1;xn[136]=-1;En[136]=0;wn[136]=0;Pn[136]=0;In[136]=-1;Rn[136]=0;An[136]=0;Tn[136]=-1;Cn[136]=1;un[136]=1;ln[136]=0;cn[136]=0;fn[136]=1;hn[136]=0;pn[136]=1;dn[34]=0;gn[34]=-1;mn[34]=0;yn[34]=0;vn[34]=-1;_n[34]=1;Sn[34]=1;Mn[34]=0;bn[34]=0;xn[34]=1;En[34]=0;wn[34]=1;Pn[34]=0;In[34]=1;Rn[34]=1;An[34]=0;Tn[34]=1;Cn[34]=0;un[34]=-1;ln[34]=0;cn[34]=1;fn[34]=-1;hn[34]=0;pn[34]=0;dn[35]=0;gn[35]=1;mn[35]=1;yn[35]=0;vn[35]=-1;_n[35]=1;Sn[35]=1;Mn[35]=0;bn[35]=0;xn[35]=-1;En[35]=0;wn[35]=0;Pn[35]=0;In[35]=-1;Rn[35]=0;An[35]=0;Tn[35]=1;Cn[35]=0;un[35]=-1;ln[35]=0;cn[35]=1;fn[35]=1;hn[35]=0;pn[35]=1;dn[153]=0;gn[153]=1;mn[153]=1;xn[153]=-1;En[153]=0;wn[153]=0;Pn[153]=0;In[153]=-1;Rn[153]=0;fn[153]=1;hn[153]=0;pn[153]=1;yn[102]=0;vn[102]=-1;_n[102]=1;Sn[102]=1;Mn[102]=0;bn[102]=0;An[102]=0;Tn[102]=1;Cn[102]=0;un[102]=-1;ln[102]=0;cn[102]=1;dn[155]=0;gn[155]=-1;mn[155]=0;xn[155]=1;En[155]=0;wn[155]=1;Pn[155]=0;In[155]=1;Rn[155]=1;fn[155]=-1;hn[155]=0;pn[155]=0;yn[103]=0;vn[103]=1;_n[103]=0;Sn[103]=-1;Mn[103]=0;bn[103]=1;An[103]=0;Tn[103]=-1;Cn[103]=1;un[103]=1;ln[103]=0;cn[103]=0;dn[152]=0;gn[152]=1;mn[152]=1;Sn[152]=-1;Mn[152]=0;bn[152]=1;xn[152]=-1;En[152]=0;wn[152]=0;Pn[152]=0;In[152]=-1;Rn[152]=0;An[152]=0;Tn[152]=-1;Cn[152]=1;fn[152]=1;hn[152]=0;pn[152]=1;dn[156]=0;gn[156]=-1;mn[156]=1;Sn[156]=1;Mn[156]=0;bn[156]=1;xn[156]=-1;En[156]=0;wn[156]=0;Pn[156]=0;In[156]=-1;Rn[156]=0;An[156]=0;Tn[156]=1;Cn[156]=1;fn[156]=-1;hn[156]=0;pn[156]=1;dn[137]=0;gn[137]=1;mn[137]=1;yn[137]=0;vn[137]=1;_n[137]=0;xn[137]=-1;En[137]=0;wn[137]=0;Pn[137]=0;In[137]=-1;Rn[137]=0;un[137]=1;ln[137]=0;cn[137]=0;fn[137]=1;hn[137]=0;pn[137]=1;dn[139]=0;gn[139]=1;mn[139]=1;yn[139]=0;vn[139]=-1;_n[139]=0;xn[139]=1;En[139]=0;wn[139]=0;Pn[139]=0;In[139]=1;Rn[139]=0;un[139]=-1;ln[139]=0;cn[139]=0;fn[139]=1;hn[139]=0;pn[139]=1;dn[98]=0;gn[98]=-1;mn[98]=0;yn[98]=0;vn[98]=-1;_n[98]=1;Sn[98]=1;Mn[98]=0;bn[98]=0;xn[98]=1;En[98]=0;wn[98]=1;An[98]=0;Tn[98]=1;Cn[98]=0;un[98]=-1;ln[98]=0;cn[98]=1;dn[99]=0;gn[99]=1;mn[99]=0;yn[99]=0;vn[99]=-1;_n[99]=1;Sn[99]=1;Mn[99]=0;bn[99]=0;xn[99]=-1;En[99]=0;wn[99]=1;An[99]=0;Tn[99]=-1;Cn[99]=0;un[99]=1;ln[99]=0;cn[99]=1;yn[38]=0;vn[38]=-1;_n[38]=1;Sn[38]=1;Mn[38]=0;bn[38]=0;Pn[38]=0;In[38]=1;Rn[38]=1;An[38]=0;Tn[38]=1;Cn[38]=0;un[38]=-1;ln[38]=0;cn[38]=1;fn[38]=-1;hn[38]=0;pn[38]=0;yn[39]=0;vn[39]=1;_n[39]=1;Sn[39]=-1;Mn[39]=0;bn[39]=0;Pn[39]=0;In[39]=-1;Rn[39]=1;An[39]=0;Tn[39]=1;Cn[39]=0;un[39]=-1;ln[39]=0;cn[39]=1;fn[39]=1;hn[39]=0;pn[39]=0;var b_=function(n){return[[n.bottomleft,0],[0,0],[0,n.leftbottom]]},A_=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0]]},T_=function(n){return[[n.topright,1],[1,1],[1,n.righttop]]},C_=function(n){return[[0,n.lefttop],[0,1],[n.topleft,1]]},P_=function(n){return[[n.bottomright,0],[n.bottomleft,0],[0,n.leftbottom],[0,n.lefttop]]},I_=function(n){return[[n.bottomright,0],[n.bottomleft,0],[1,n.righttop],[1,n.rightbottom]]},R_=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.topleft,1],[n.topright,1]]},L_=function(n){return[[0,n.leftbottom],[0,n.lefttop],[n.topleft,1],[n.topright,1]]},SY=function(n){return[[0,0],[0,n.leftbottom],[1,n.rightbottom],[1,0]]},MY=function(n){return[[1,0],[n.bottomright,0],[n.topright,1],[1,1]]},bY=function(n){return[[1,1],[1,n.righttop],[0,n.lefttop],[0,1]]},AY=function(n){return[[n.bottomleft,0],[0,0],[0,1],[n.topleft,1]]},TY=function(n){return[[1,n.righttop],[1,n.rightbottom],[0,n.leftbottom],[0,n.lefttop]]},CY=function(n){return[[n.topleft,1],[n.topright,1],[n.bottomright,0],[n.bottomleft,0]]},PY=function(){return[[0,0],[0,1],[1,1],[1,0]]},IY=function(n){return[[1,n.rightbottom],[1,0],[0,0],[0,1],[n.topleft,1]]},RY=function(n){return[[n.topright,1],[1,1],[1,0],[0,0],[0,n.leftbottom]]},LY=function(n){return[[1,0],[n.bottomright,0],[0,n.lefttop],[0,1],[1,1]]},NY=function(n){return[[1,1],[1,n.righttop],[n.bottomleft,0],[0,0],[0,1]]},OY=function(n){return[[1,n.righttop],[1,n.rightbottom],[0,n.lefttop],[0,1],[n.topleft,1]]},DY=function(n){return[[1,1],[1,n.righttop],[n.bottomright,0],[n.bottomleft,0],[n.topright,1]]},FY=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[0,n.leftbottom],[0,n.lefttop]]},UY=function(n){return[[n.topright,1],[n.bottomleft,0],[0,0],[0,n.leftbottom],[n.topleft,1]]},BY=function(n){return[[n.bottomright,0],[n.bottomleft,0],[0,n.lefttop],[0,1],[n.topleft,1]]},zY=function(n){return[[1,1],[1,n.righttop],[0,n.leftbottom],[0,n.lefttop],[n.topright,1]]},GY=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[n.topleft,1],[n.topright,1]]},kY=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomleft,0],[0,0],[0,n.leftbottom]]},qY=function(n){return[[1,n.rightbottom],[1,0],[0,0],[0,n.leftbottom],[n.topleft,1],[n.topright,1]]},HY=function(n){return[[1,1],[1,0],[n.bottomright,0],[0,n.leftbottom],[0,n.lefttop],[n.topright,1]]},VY=function(n){return[[1,1],[1,n.righttop],[n.bottomright,0],[n.bottomleft,0],[0,n.lefttop],[0,1]]},WY=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomleft,0],[0,0],[0,1],[n.topleft,1]]},XY=function(n){return[[1,1],[1,n.righttop],[n.bottomleft,0],[0,0],[0,n.leftbottom],[n.topright,1]]},YY=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[0,n.lefttop],[0,1],[n.topleft,1]]},$Y=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomright,0],[n.bottomleft,0],[0,n.leftbottom],[0,n.lefttop],[n.topleft,1],[n.topright,1]]},ZY=function(n){return[[1,1],[1,n.righttop],[n.bottomleft,0],[0,0],[0,n.leftbottom],[n.topright,1]]},JY=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[0,n.lefttop],[0,1],[n.topleft,1]]},KY=function(n){return[[1,1],[1,n.righttop],[n.bottomright,0],[n.bottomleft,0],[0,n.leftbottom],[0,n.lefttop],[n.topright,1]]},jY=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomleft,0],[0,0],[0,n.leftbottom],[n.topleft,1],[n.topright,1]]},QY=function(n){return[[1,n.righttop],[1,n.rightbottom],[n.bottomright,0],[n.bottomleft,0],[0,n.lefttop],[0,1],[n.topleft,1]]},t$=function(n){return[[1,n.rightbottom],[1,0],[n.bottomright,0],[0,n.leftbottom],[0,n.lefttop],[n.topleft,1],[n.topright,1]]},Dn=[],Fn=[],Un=[],Bn=[],zn=[],Gn=[],kn=[],qn=[];Bn[1]=zn[1]=18;Bn[169]=zn[169]=18;Un[4]=Fn[4]=12;Un[166]=Fn[166]=12;Dn[16]=qn[16]=4;Dn[154]=qn[154]=4;Gn[64]=kn[64]=22;Gn[106]=kn[106]=22;Un[2]=Gn[2]=17;Bn[2]=zn[2]=18;Un[168]=Gn[168]=17;Bn[168]=zn[168]=18;Dn[8]=Bn[8]=9;Fn[8]=Un[8]=12;Dn[162]=Bn[162]=9;Fn[162]=Un[162]=12;Dn[32]=qn[32]=4;Fn[32]=kn[32]=1;Dn[138]=qn[138]=4;Fn[138]=kn[138]=1;zn[128]=qn[128]=21;Gn[128]=kn[128]=22;zn[42]=qn[42]=21;Gn[42]=kn[42]=22;Fn[5]=zn[5]=14;Fn[165]=zn[165]=14;Un[20]=qn[20]=6;Un[150]=qn[150]=6;Dn[80]=Gn[80]=11;Dn[90]=Gn[90]=11;Bn[65]=kn[65]=3;Bn[105]=kn[105]=3;Dn[160]=Gn[160]=11;Fn[160]=zn[160]=14;Dn[10]=Gn[10]=11;Fn[10]=zn[10]=14;Un[130]=qn[130]=6;Bn[130]=kn[130]=3;Un[40]=qn[40]=6;Bn[40]=kn[40]=3;Fn[101]=kn[101]=1;Fn[69]=kn[69]=1;zn[149]=qn[149]=21;zn[21]=qn[21]=21;Un[86]=Gn[86]=17;Un[84]=Gn[84]=17;Dn[89]=Bn[89]=9;Dn[81]=Bn[81]=9;Dn[96]=kn[96]=0;Fn[96]=Gn[96]=15;Dn[74]=kn[74]=0;Fn[74]=Gn[74]=15;Dn[24]=Un[24]=8;Bn[24]=qn[24]=7;Dn[146]=Un[146]=8;Bn[146]=qn[146]=7;Fn[6]=Gn[6]=15;Un[6]=zn[6]=16;Fn[164]=Gn[164]=15;Un[164]=zn[164]=16;Bn[129]=qn[129]=7;zn[129]=kn[129]=20;Bn[41]=qn[41]=7;zn[41]=kn[41]=20;Un[66]=kn[66]=2;Bn[66]=Gn[66]=19;Un[104]=kn[104]=2;Bn[104]=Gn[104]=19;Dn[144]=zn[144]=10;Gn[144]=qn[144]=23;Dn[26]=zn[26]=10;Gn[26]=qn[26]=23;Fn[36]=qn[36]=5;Un[36]=kn[36]=2;Fn[134]=qn[134]=5;Un[134]=kn[134]=2;Dn[9]=zn[9]=10;Fn[9]=Bn[9]=13;Dn[161]=zn[161]=10;Fn[161]=Bn[161]=13;Fn[37]=qn[37]=5;zn[37]=kn[37]=20;Fn[133]=qn[133]=5;zn[133]=kn[133]=20;Un[148]=zn[148]=16;Gn[148]=qn[148]=23;Un[22]=zn[22]=16;Gn[22]=qn[22]=23;Dn[82]=Un[82]=8;Bn[82]=Gn[82]=19;Dn[88]=Un[88]=8;Bn[88]=Gn[88]=19;Dn[73]=kn[73]=0;Fn[73]=Bn[73]=13;Dn[97]=kn[97]=0;Fn[97]=Bn[97]=13;Dn[145]=Bn[145]=9;zn[145]=qn[145]=21;Dn[25]=Bn[25]=9;zn[25]=qn[25]=21;Fn[70]=kn[70]=1;Un[70]=Gn[70]=17;Fn[100]=kn[100]=1;Un[100]=Gn[100]=17;Dn[34]=Bn[34]=9;Fn[34]=Un[34]=12;zn[34]=qn[34]=21;Gn[34]=kn[34]=22;Dn[136]=qn[136]=4;Fn[136]=kn[136]=1;Un[136]=Gn[136]=17;Bn[136]=zn[136]=18;Dn[35]=qn[35]=4;Fn[35]=Un[35]=12;Bn[35]=zn[35]=18;Gn[35]=kn[35]=22;Dn[153]=qn[153]=4;Bn[153]=zn[153]=18;Fn[102]=Un[102]=12;Gn[102]=kn[102]=22;Dn[155]=Bn[155]=9;zn[155]=qn[155]=23;Fn[103]=kn[103]=1;Un[103]=Gn[103]=17;Dn[152]=qn[152]=4;Un[152]=Gn[152]=17;Bn[152]=zn[152]=18;Dn[156]=Un[156]=8;Bn[156]=zn[156]=18;Gn[156]=qn[156]=23;Dn[137]=qn[137]=4;Fn[137]=kn[137]=1;Bn[137]=zn[137]=18;Dn[139]=qn[139]=4;Fn[139]=Bn[139]=13;zn[139]=kn[139]=20;Dn[98]=Bn[98]=9;Fn[98]=Un[98]=12;Gn[98]=kn[98]=22;Dn[99]=kn[99]=0;Fn[99]=Un[99]=12;Bn[99]=Gn[99]=19;Fn[38]=Un[38]=12;zn[38]=qn[38]=21;Gn[38]=kn[38]=22;Fn[39]=qn[39]=5;Un[39]=zn[39]=16;Gn[39]=kn[39]=22;var re=[];re[1]=re[169]=b_;re[4]=re[166]=A_;re[16]=re[154]=T_;re[64]=re[106]=C_;re[168]=re[2]=P_;re[162]=re[8]=I_;re[138]=re[32]=R_;re[42]=re[128]=L_;re[5]=re[165]=SY;re[20]=re[150]=MY;re[80]=re[90]=bY;re[65]=re[105]=AY;re[160]=re[10]=TY;re[130]=re[40]=CY;re[85]=PY;re[101]=re[69]=IY;re[149]=re[21]=RY;re[86]=re[84]=LY;re[89]=re[81]=NY;re[96]=re[74]=OY;re[24]=re[146]=DY;re[6]=re[164]=FY;re[129]=re[41]=UY;re[66]=re[104]=BY;re[144]=re[26]=zY;re[36]=re[134]=GY;re[9]=re[161]=kY;re[37]=re[133]=qY;re[148]=re[22]=HY;re[82]=re[88]=VY;re[73]=re[97]=WY;re[145]=re[25]=XY;re[70]=re[100]=YY;re[34]=function(n){return[L_(n),I_(n)]};re[35]=$Y;re[136]=function(n){return[R_(n),P_(n)]};re[153]=function(n){return[T_(n),b_(n)]};re[102]=function(n){return[A_(n),C_(n)]};re[155]=ZY;re[103]=JY;re[152]=function(n){return[T_(n),P_(n)]};re[156]=KY;re[137]=function(n){return[R_(n),b_(n)]};re[139]=jY;re[98]=function(n){return[I_(n),C_(n)]};re[99]=QY;re[38]=function(n){return[A_(n),L_(n)]};re[39]=t$;function n$(n){return(n>0)-(n<0)||+n}function rf(n,t,e){var o=t[0]-n[0],s=t[1]-n[1],c=e[0]-t[0],h=e[1]-t[1];return n$(o*h-c*s)}function rR(n,t){var e=n.geometry.coordinates[0].map(function(h){return h[0]}),o=n.geometry.coordinates[0].map(function(h){return h[1]}),s=t.geometry.coordinates[0].map(function(h){return h[0]}),c=t.geometry.coordinates[0].map(function(h){return h[1]});return Math.max.apply(null,e)===Math.max.apply(null,s)&&Math.max.apply(null,o)===Math.max.apply(null,c)&&Math.min.apply(null,e)===Math.min.apply(null,s)&&Math.min.apply(null,o)===Math.min.apply(null,c)}function N_(n,t){return t.geometry.coordinates[0].every(function(e){return Gi(Cr(e),n)})}function iR(n,t){return n[0]===t[0]&&n[1]===t[1]}var r$=function(){function n(t){this.id=n.buildId(t),this.coordinates=t,this.innerEdges=[],this.outerEdges=[],this.outerEdgesSorted=!1}return n.buildId=function(t){return t.join(",")},n.prototype.removeInnerEdge=function(t){this.innerEdges=this.innerEdges.filter(function(e){return e.from.id!==t.from.id})},n.prototype.removeOuterEdge=function(t){this.outerEdges=this.outerEdges.filter(function(e){return e.to.id!==t.to.id})},n.prototype.addOuterEdge=function(t){this.outerEdges.push(t),this.outerEdgesSorted=!1},n.prototype.sortOuterEdges=function(){var t=this;this.outerEdgesSorted||(this.outerEdges.sort(function(e,o){var s=e.to,c=o.to;if(s.coordinates[0]-t.coordinates[0]>=0&&c.coordinates[0]-t.coordinates[0]<0)return 1;if(s.coordinates[0]-t.coordinates[0]<0&&c.coordinates[0]-t.coordinates[0]>=0)return-1;if(s.coordinates[0]-t.coordinates[0]===0&&c.coordinates[0]-t.coordinates[0]===0)return s.coordinates[1]-t.coordinates[1]>=0||c.coordinates[1]-t.coordinates[1]>=0?s.coordinates[1]-c.coordinates[1]:c.coordinates[1]-s.coordinates[1];var h=rf(t.coordinates,s.coordinates,c.coordinates);if(h<0)return 1;if(h>0)return-1;var p=Math.pow(s.coordinates[0]-t.coordinates[0],2)+Math.pow(s.coordinates[1]-t.coordinates[1],2),g=Math.pow(c.coordinates[0]-t.coordinates[0],2)+Math.pow(c.coordinates[1]-t.coordinates[1],2);return p-g}),this.outerEdgesSorted=!0)},n.prototype.getOuterEdges=function(){return this.sortOuterEdges(),this.outerEdges},n.prototype.getOuterEdge=function(t){return this.sortOuterEdges(),this.outerEdges[t]},n.prototype.addInnerEdge=function(t){this.innerEdges.push(t)},n}(),O_=r$;var i$=function(){function n(t,e){this.from=t,this.to=e,this.next=void 0,this.label=void 0,this.symetric=void 0,this.ring=void 0,this.from.addOuterEdge(this),this.to.addInnerEdge(this)}return n.prototype.getSymetric=function(){return this.symetric||(this.symetric=new n(this.to,this.from),this.symetric.symetric=this),this.symetric},n.prototype.deleteEdge=function(){this.from.removeOuterEdge(this),this.to.removeInnerEdge(this)},n.prototype.isEqual=function(t){return this.from.id===t.from.id&&this.to.id===t.to.id},n.prototype.toString=function(){return"Edge { "+this.from.id+" -> "+this.to.id+" }"},n.prototype.toLineString=function(){return zi([this.from.coordinates,this.to.coordinates])},n.prototype.compareTo=function(t){return rf(t.from.coordinates,t.to.coordinates,this.to.coordinates)},n}(),oR=i$;var o$=function(){function n(){this.edges=[],this.polygon=void 0,this.envelope=void 0}return n.prototype.push=function(t){this.edges.push(t),this.polygon=this.envelope=void 0},n.prototype.get=function(t){return this.edges[t]},Object.defineProperty(n.prototype,"length",{get:function(){return this.edges.length},enumerable:!0,configurable:!0}),n.prototype.forEach=function(t){this.edges.forEach(t)},n.prototype.map=function(t){return this.edges.map(t)},n.prototype.some=function(t){return this.edges.some(t)},n.prototype.isValid=function(){return!0},n.prototype.isHole=function(){var t=this,e=this.edges.reduce(function(h,p,g){return p.from.coordinates[1]>t.edges[h].from.coordinates[1]&&(h=g),h},0),o=(e===0?this.length:e)-1,s=(e+1)%this.length,c=rf(this.edges[o].from.coordinates,this.edges[e].from.coordinates,this.edges[s].from.coordinates);return c===0?this.edges[o].from.coordinates[0]>this.edges[s].from.coordinates[0]:c>0},n.prototype.toMultiPoint=function(){return yv(this.edges.map(function(t){return t.from.coordinates}))},n.prototype.toPolygon=function(){if(this.polygon)return this.polygon;var t=this.edges.map(function(e){return e.from.coordinates});return t.push(this.edges[0].from.coordinates),this.polygon=Or([t])},n.prototype.getEnvelope=function(){return this.envelope?this.envelope:this.envelope=Fv(this.toPolygon())},n.findEdgeRingContaining=function(t,e){var o=t.getEnvelope(),s,c;return e.forEach(function(h){var p=h.getEnvelope();if(c&&(s=c.getEnvelope()),!rR(p,o)&&N_(p,o)){for(var g=t.map(function(P){return P.from.coordinates}),m=void 0,_=function(P){h.some(function(I){return iR(P,I.from.coordinates)})||(m=P)},E=0,x=g;E<x.length;E++){var b=x[E];_(b)}m&&h.inside(Cr(m))&&(!c||N_(s,p))&&(c=h)}}),c},n.prototype.inside=function(t){return Gi(t,this.toPolygon())},n}(),D_=o$;function s$(n){if(!n)throw new Error("No geojson passed");if(n.type!=="FeatureCollection"&&n.type!=="GeometryCollection"&&n.type!=="MultiLineString"&&n.type!=="LineString"&&n.type!=="Feature")throw new Error("Invalid input type '"+n.type+"'. Geojson must be FeatureCollection, GeometryCollection, LineString, MultiLineString or Feature")}var cut=function(){function n(){this.edges=[],this.nodes={}}return n.fromGeoJson=function(t){s$(t);var e=new n;return ds(t,function(o){_v(o,"LineString","Graph::fromGeoJson"),KT(o,function(s,c){if(s){var h=e.getNode(s),p=e.getNode(c);e.addEdge(h,p)}return c})}),e},n.prototype.getNode=function(t){var e=O_.buildId(t),o=this.nodes[e];return o||(o=this.nodes[e]=new O_(t)),o},n.prototype.addEdge=function(t,e){var o=new oR(t,e),s=o.getSymetric();this.edges.push(o),this.edges.push(s)},n.prototype.deleteDangles=function(){var t=this;Object.keys(this.nodes).map(function(e){return t.nodes[e]}).forEach(function(e){return t._removeIfDangle(e)})},n.prototype._removeIfDangle=function(t){var e=this;if(t.innerEdges.length<=1){var o=t.getOuterEdges().map(function(s){return s.to});this.removeNode(t),o.forEach(function(s){return e._removeIfDangle(s)})}},n.prototype.deleteCutEdges=function(){var t=this;this._computeNextCWEdges(),this._findLabeledEdgeRings(),this.edges.forEach(function(e){e.label===e.symetric.label&&(t.removeEdge(e.symetric),t.removeEdge(e))})},n.prototype._computeNextCWEdges=function(t){var e=this;typeof t=="undefined"?Object.keys(this.nodes).forEach(function(o){return e._computeNextCWEdges(e.nodes[o])}):t.getOuterEdges().forEach(function(o,s){t.getOuterEdge((s===0?t.getOuterEdges().length:s)-1).symetric.next=o})},n.prototype._computeNextCCWEdges=function(t,e){for(var o=t.getOuterEdges(),s,c,h=o.length-1;h>=0;--h){var p=o[h],g=p.symetric,m=void 0,_=void 0;p.label===e&&(m=p),g.label===e&&(_=g),!(!m||!_)&&(_&&(c=_),m&&(c&&(c.next=m,c=void 0),s||(s=m)))}c&&(c.next=s)},n.prototype._findLabeledEdgeRings=function(){var t=[],e=0;return this.edges.forEach(function(o){if(!(o.label>=0)){t.push(o);var s=o;do s.label=e,s=s.next;while(!o.isEqual(s));e++}}),t},n.prototype.getEdgeRings=function(){var t=this;this._computeNextCWEdges(),this.edges.forEach(function(o){o.label=void 0}),this._findLabeledEdgeRings().forEach(function(o){t._findIntersectionNodes(o).forEach(function(s){t._computeNextCCWEdges(s,o.label)})});var e=[];return this.edges.forEach(function(o){o.ring||e.push(t._findEdgeRing(o))}),e},n.prototype._findIntersectionNodes=function(t){var e=[],o=t,s=function(){var c=0;o.from.getOuterEdges().forEach(function(h){h.label===t.label&&++c}),c>1&&e.push(o.from),o=o.next};do s();while(!t.isEqual(o));return e},n.prototype._findEdgeRing=function(t){var e=t,o=new D_;do o.push(e),e.ring=o,e=e.next;while(!t.isEqual(e));return o},n.prototype.removeNode=function(t){var e=this;t.getOuterEdges().forEach(function(o){return e.removeEdge(o)}),t.innerEdges.forEach(function(o){return e.removeEdge(o)}),delete this.nodes[t.id]},n.prototype.removeEdge=function(t){this.edges=this.edges.filter(function(e){return!e.isEqual(t)}),t.deleteEdge()},n}();var c$=on(F_(),1);var f$=on(F_(),1);var p$=on(dR(),1);var x$=on(MR(),1);function AR(n){for(var t=n,e=[];t.parent;)e.unshift(t),t=t.parent;return e}function w$(){return new TR(function(n){return n.f})}var G_={search:function(n,t,e,o){n.cleanDirty(),o=o||{};var s=o.heuristic||G_.heuristics.manhattan,c=o.closest||!1,h=w$(),p=t;for(t.h=s(t,e),h.push(t);h.size()>0;){var g=h.pop();if(g===e)return AR(g);g.closed=!0;for(var m=n.neighbors(g),_=0,E=m.length;_<E;++_){var x=m[_];if(!(x.closed||x.isWall())){var b=g.g+x.getCost(g),P=x.visited;(!P||b<x.g)&&(x.visited=!0,x.parent=g,x.h=x.h||s(x,e),x.g=b,x.f=x.g+x.h,n.markDirty(x),c&&(x.h<p.h||x.h===p.h&&x.g<p.g)&&(p=x),P?h.rescoreElement(x):h.push(x))}}}return c?AR(p):[]},heuristics:{manhattan:function(n,t){var e=Math.abs(t.x-n.x),o=Math.abs(t.y-n.y);return e+o},diagonal:function(n,t){var e=1,o=Math.sqrt(2),s=Math.abs(t.x-n.x),c=Math.abs(t.y-n.y);return e*(s+c)+(o-2*e)*Math.min(s,c)}},cleanNode:function(n){n.f=0,n.g=0,n.h=0,n.visited=!1,n.closed=!1,n.parent=null}};function vh(n,t){t=t||{},this.nodes=[],this.diagonal=!!t.diagonal,this.grid=[];for(var e=0;e<n.length;e++){this.grid[e]=[];for(var o=0,s=n[e];o<s.length;o++){var c=new Eg(e,o,s[o]);this.grid[e][o]=c,this.nodes.push(c)}}this.init()}vh.prototype.init=function(){this.dirtyNodes=[];for(var n=0;n<this.nodes.length;n++)G_.cleanNode(this.nodes[n])};vh.prototype.cleanDirty=function(){for(var n=0;n<this.dirtyNodes.length;n++)G_.cleanNode(this.dirtyNodes[n]);this.dirtyNodes=[]};vh.prototype.markDirty=function(n){this.dirtyNodes.push(n)};vh.prototype.neighbors=function(n){var t=[],e=n.x,o=n.y,s=this.grid;return s[e-1]&&s[e-1][o]&&t.push(s[e-1][o]),s[e+1]&&s[e+1][o]&&t.push(s[e+1][o]),s[e]&&s[e][o-1]&&t.push(s[e][o-1]),s[e]&&s[e][o+1]&&t.push(s[e][o+1]),this.diagonal&&(s[e-1]&&s[e-1][o-1]&&t.push(s[e-1][o-1]),s[e+1]&&s[e+1][o-1]&&t.push(s[e+1][o-1]),s[e-1]&&s[e-1][o+1]&&t.push(s[e-1][o+1]),s[e+1]&&s[e+1][o+1]&&t.push(s[e+1][o+1])),t};vh.prototype.toString=function(){for(var n=[],t=this.grid,e,o,s,c,h=0,p=t.length;h<p;h++){for(e=[],o=t[h],s=0,c=o.length;s<c;s++)e.push(o[s].weight);n.push(e.join(" "))}return n.join(\`
11569
11569
  \`)};function Eg(n,t,e){this.x=n,this.y=t,this.weight=e}Eg.prototype.toString=function(){return"["+this.x+" "+this.y+"]"};Eg.prototype.getCost=function(n){return n&&n.x!==this.x&&n.y!==this.y?this.weight*1.41421:this.weight};Eg.prototype.isWall=function(){return this.weight===0};function TR(n){this.content=[],this.scoreFunction=n}TR.prototype={push:function(n){this.content.push(n),this.sinkDown(this.content.length-1)},pop:function(){var n=this.content[0],t=this.content.pop();return this.content.length>0&&(this.content[0]=t,this.bubbleUp(0)),n},remove:function(n){var t=this.content.indexOf(n),e=this.content.pop();t!==this.content.length-1&&(this.content[t]=e,this.scoreFunction(e)<this.scoreFunction(n)?this.sinkDown(t):this.bubbleUp(t))},size:function(){return this.content.length},rescoreElement:function(n){this.sinkDown(this.content.indexOf(n))},sinkDown:function(n){for(var t=this.content[n];n>0;){var e=(n+1>>1)-1,o=this.content[e];if(this.scoreFunction(t)<this.scoreFunction(o))this.content[e]=t,this.content[n]=o,n=e;else break}},bubbleUp:function(n){for(var t=this.content.length,e=this.content[n],o=this.scoreFunction(e);;){var s=n+1<<1,c=s-1,h=null,p;if(c<t){var g=this.content[c];p=this.scoreFunction(g),p<o&&(h=c)}if(s<t){var m=this.content[s],_=this.scoreFunction(m);_<(h===null?o:p)&&(h=s)}if(h!==null)this.content[n]=this.content[h],this.content[h]=e,n=h;else break}}};function k_(){this._=null}function sf(n){n.U=n.C=n.L=n.R=n.P=n.N=null}k_.prototype={constructor:k_,insert:function(n,t){var e,o,s;if(n){if(t.P=n,t.N=n.N,n.N&&(n.N.P=t),n.N=t,n.R){for(n=n.R;n.L;)n=n.L;n.L=t}else n.R=t;e=n}else this._?(n=CR(this._),t.P=null,t.N=n,n.P=n.L=t,e=n):(t.P=t.N=null,this._=t,e=null);for(t.L=t.R=null,t.U=e,t.C=!0,n=t;e&&e.C;)o=e.U,e===o.L?(s=o.R,s&&s.C?(e.C=s.C=!1,o.C=!0,n=o):(n===e.R&&(_h(this,e),n=e,e=n.U),e.C=!1,o.C=!0,xh(this,o))):(s=o.L,s&&s.C?(e.C=s.C=!1,o.C=!0,n=o):(n===e.L&&(xh(this,e),n=e,e=n.U),e.C=!1,o.C=!0,_h(this,o))),e=n.U;this._.C=!1},remove:function(n){n.N&&(n.N.P=n.P),n.P&&(n.P.N=n.N),n.N=n.P=null;var t=n.U,e,o=n.L,s=n.R,c,h;if(o?s?c=CR(s):c=o:c=s,t?t.L===n?t.L=c:t.R=c:this._=c,o&&s?(h=c.C,c.C=n.C,c.L=o,o.U=c,c!==s?(t=c.U,c.U=n.U,n=c.R,t.L=n,c.R=s,s.U=c):(c.U=t,t=c,n=c.R)):(h=n.C,n=c),n&&(n.U=t),!h){if(n&&n.C){n.C=!1;return}do{if(n===this._)break;if(n===t.L){if(e=t.R,e.C&&(e.C=!1,t.C=!0,_h(this,t),e=t.R),e.L&&e.L.C||e.R&&e.R.C){(!e.R||!e.R.C)&&(e.L.C=!1,e.C=!0,xh(this,e),e=t.R),e.C=t.C,t.C=e.R.C=!1,_h(this,t),n=this._;break}}else if(e=t.L,e.C&&(e.C=!1,t.C=!0,xh(this,t),e=t.L),e.L&&e.L.C||e.R&&e.R.C){(!e.L||!e.L.C)&&(e.R.C=!1,e.C=!0,_h(this,e),e=t.L),e.C=t.C,t.C=e.L.C=!1,xh(this,t),n=this._;break}e.C=!0,n=t,t=t.U}while(!n.C);n&&(n.C=!1)}}};function _h(n,t){var e=t,o=t.R,s=e.U;s?s.L===e?s.L=o:s.R=o:n._=o,o.U=s,e.U=o,e.R=o.L,e.R&&(e.R.U=e),o.L=e}function xh(n,t){var e=t,o=t.L,s=e.U;s?s.L===e?s.L=o:s.R=o:n._=o,o.U=s,e.U=o,e.L=o.R,e.L&&(e.L.U=e),o.R=e}function CR(n){for(;n.L;)n=n.L;return n}var q_=k_;function af(n,t,e,o){var s=[null,null],c=qi.push(s)-1;return s.left=n,s.right=t,e&&Eh(s,n,t,e),o&&Eh(s,t,n,o),bo[n.index].halfedges.push(c),bo[t.index].halfedges.push(c),s}function uf(n,t,e){var o=[t,e];return o.left=n,o}function Eh(n,t,e,o){!n[0]&&!n[1]?(n[0]=o,n.left=t,n.right=e):n.left===e?n[1]=o:n[0]=o}function S$(n,t,e,o,s){var c=n[0],h=n[1],p=c[0],g=c[1],m=h[0],_=h[1],E=0,x=1,b=m-p,P=_-g,I;if(I=t-p,!(!b&&I>0)){if(I/=b,b<0){if(I<E)return;I<x&&(x=I)}else if(b>0){if(I>x)return;I>E&&(E=I)}if(I=o-p,!(!b&&I<0)){if(I/=b,b<0){if(I>x)return;I>E&&(E=I)}else if(b>0){if(I<E)return;I<x&&(x=I)}if(I=e-g,!(!P&&I>0)){if(I/=P,P<0){if(I<E)return;I<x&&(x=I)}else if(P>0){if(I>x)return;I>E&&(E=I)}if(I=s-g,!(!P&&I<0)){if(I/=P,P<0){if(I>x)return;I>E&&(E=I)}else if(P>0){if(I<E)return;I<x&&(x=I)}return!(E>0)&&!(x<1)||(E>0&&(n[0]=[p+E*b,g+E*P]),x<1&&(n[1]=[p+x*b,g+x*P])),!0}}}}}function M$(n,t,e,o,s){var c=n[1];if(c)return!0;var h=n[0],p=n.left,g=n.right,m=p[0],_=p[1],E=g[0],x=g[1],b=(m+E)/2,P=(_+x)/2,I,S;if(x===_){if(b<t||b>=o)return;if(m>E){if(!h)h=[b,e];else if(h[1]>=s)return;c=[b,s]}else{if(!h)h=[b,s];else if(h[1]<e)return;c=[b,e]}}else if(I=(m-E)/(x-_),S=P-I*b,I<-1||I>1)if(m>E){if(!h)h=[(e-S)/I,e];else if(h[1]>=s)return;c=[(s-S)/I,s]}else{if(!h)h=[(s-S)/I,s];else if(h[1]<e)return;c=[(e-S)/I,e]}else if(_<x){if(!h)h=[t,I*t+S];else if(h[0]>=o)return;c=[o,I*o+S]}else{if(!h)h=[o,I*o+S];else if(h[0]<t)return;c=[t,I*t+S]}return n[0]=h,n[1]=c,!0}function PR(n,t,e,o){for(var s=qi.length,c;s--;)(!M$(c=qi[s],n,t,e,o)||!S$(c,n,t,e,o)||!(Math.abs(c[0][0]-c[1][0])>xr||Math.abs(c[0][1]-c[1][1])>xr))&&delete qi[s]}function IR(n){return bo[n.index]={site:n,halfedges:[]}}function b$(n,t){var e=n.site,o=t.left,s=t.right;return e===s&&(s=o,o=e),s?Math.atan2(s[1]-o[1],s[0]-o[0]):(e===o?(o=t[1],s=t[0]):(o=t[0],s=t[1]),Math.atan2(o[0]-s[0],s[1]-o[1]))}function H_(n,t){return t[+(t.left!==n.site)]}function A$(n,t){return t[+(t.left===n.site)]}function RR(){for(var n=0,t=bo.length,e,o,s,c;n<t;++n)if((e=bo[n])&&(c=(o=e.halfedges).length)){var h=new Array(c),p=new Array(c);for(s=0;s<c;++s)h[s]=s,p[s]=b$(e,qi[o[s]]);for(h.sort(function(g,m){return p[m]-p[g]}),s=0;s<c;++s)p[s]=o[h[s]];for(s=0;s<c;++s)o[s]=p[s]}}function LR(n,t,e,o){var s=bo.length,c,h,p,g,m,_,E,x,b,P,I,S,w=!0;for(c=0;c<s;++c)if(h=bo[c]){for(p=h.site,m=h.halfedges,g=m.length;g--;)qi[m[g]]||m.splice(g,1);for(g=0,_=m.length;g<_;)P=A$(h,qi[m[g]]),I=P[0],S=P[1],E=H_(h,qi[m[++g%_]]),x=E[0],b=E[1],(Math.abs(I-x)>xr||Math.abs(S-b)>xr)&&(m.splice(g,0,qi.push(uf(p,P,Math.abs(I-n)<xr&&o-S>xr?[n,Math.abs(x-n)<xr?b:o]:Math.abs(S-o)<xr&&e-I>xr?[Math.abs(b-o)<xr?x:e,o]:Math.abs(I-e)<xr&&S-t>xr?[e,Math.abs(x-e)<xr?b:t]:Math.abs(S-t)<xr&&I-n>xr?[Math.abs(b-t)<xr?x:n,t]:null))-1),++_);_&&(w=!1)}if(w){var R,T,F,W=1/0;for(c=0,w=null;c<s;++c)(h=bo[c])&&(p=h.site,R=p[0]-n,T=p[1]-t,F=R*R+T*T,F<W&&(W=F,w=h));if(w){var X=[n,t],q=[n,o],D=[e,o],xt=[e,t];w.halfedges.push(qi.push(uf(p=w.site,X,q))-1,qi.push(uf(p,q,D))-1,qi.push(uf(p,D,xt))-1,qi.push(uf(p,xt,X))-1)}}for(c=0;c<s;++c)(h=bo[c])&&(h.halfedges.length||delete bo[c])}var NR=[],wg;function T$(){sf(this),this.x=this.y=this.arc=this.site=this.cy=null}function zl(n){var t=n.P,e=n.N;if(!(!t||!e)){var o=t.site,s=n.site,c=e.site;if(o!==c){var h=s[0],p=s[1],g=o[0]-h,m=o[1]-p,_=c[0]-h,E=c[1]-p,x=2*(g*E-m*_);if(!(x>=-OR)){var b=g*g+m*m,P=_*_+E*E,I=(E*b-m*P)/x,S=(g*P-_*b)/x,w=NR.pop()||new T$;w.arc=n,w.site=s,w.x=I+h,w.y=(w.cy=S+p)+Math.sqrt(I*I+S*S),n.circle=w;for(var R=null,T=lf._;T;)if(w.y<T.y||w.y===T.y&&w.x<=T.x)if(T.L)T=T.L;else{R=T.P;break}else if(T.R)T=T.R;else{R=T;break}lf.insert(R,w),R||(wg=w)}}}}function Gl(n){var t=n.circle;t&&(t.P||(wg=t.N),lf.remove(t),NR.push(t),sf(t),n.circle=null)}var FR=[];function C$(){sf(this),this.edge=this.site=this.circle=null}function DR(n){var t=FR.pop()||new C$;return t.site=n,t}function V_(n){Gl(n),kl.remove(n),FR.push(n),sf(n)}function UR(n){var t=n.circle,e=t.x,o=t.cy,s=[e,o],c=n.P,h=n.N,p=[n];V_(n);for(var g=c;g.circle&&Math.abs(e-g.circle.x)<xr&&Math.abs(o-g.circle.cy)<xr;)c=g.P,p.unshift(g),V_(g),g=c;p.unshift(g),Gl(g);for(var m=h;m.circle&&Math.abs(e-m.circle.x)<xr&&Math.abs(o-m.circle.cy)<xr;)h=m.N,p.push(m),V_(m),m=h;p.push(m),Gl(m);var _=p.length,E;for(E=1;E<_;++E)m=p[E],g=p[E-1],Eh(m.edge,g.site,m.site,s);g=p[0],m=p[_-1],m.edge=af(g.site,m.site,null,s),zl(g),zl(m)}function BR(n){for(var t=n[0],e=n[1],o,s,c,h,p=kl._;p;)if(c=zR(p,e)-t,c>xr)p=p.L;else if(h=t-P$(p,e),h>xr){if(!p.R){o=p;break}p=p.R}else{c>-xr?(o=p.P,s=p):h>-xr?(o=p,s=p.N):o=s=p;break}IR(n);var g=DR(n);if(kl.insert(o,g),!(!o&&!s)){if(o===s){Gl(o),s=DR(o.site),kl.insert(g,s),g.edge=s.edge=af(o.site,g.site),zl(o),zl(s);return}if(!s){g.edge=af(o.site,g.site);return}Gl(o),Gl(s);var m=o.site,_=m[0],E=m[1],x=n[0]-_,b=n[1]-E,P=s.site,I=P[0]-_,S=P[1]-E,w=2*(x*S-b*I),R=x*x+b*b,T=I*I+S*S,F=[(S*R-b*T)/w+_,(x*T-I*R)/w+E];Eh(s.edge,m,P,F),g.edge=af(m,n,null,F),s.edge=af(n,P,null,F),zl(o),zl(s)}}function zR(n,t){var e=n.site,o=e[0],s=e[1],c=s-t;if(!c)return o;var h=n.P;if(!h)return-1/0;e=h.site;var p=e[0],g=e[1],m=g-t;if(!m)return p;var _=p-o,E=1/c-1/m,x=_/m;return E?(-x+Math.sqrt(x*x-2*E*(_*_/(-2*m)-g+m/2+s-c/2)))/E+o:(o+p)/2}function P$(n,t){var e=n.N;if(e)return zR(e,t);var o=n.site;return o[1]===t?o[0]:1/0}var xr=1e-6,OR=1e-12,kl,bo,lf,qi;function I$(n,t,e){return(n[0]-e[0])*(t[1]-n[1])-(n[0]-t[0])*(e[1]-n[1])}function R$(n,t){return t[1]-n[1]||t[0]-n[0]}function Sg(n,t){var e=n.sort(R$).pop(),o,s,c;for(qi=[],bo=new Array(n.length),kl=new q_,lf=new q_;;)if(c=wg,e&&(!c||e[1]<c.y||e[1]===c.y&&e[0]<c.x))(e[0]!==o||e[1]!==s)&&(BR(e),o=e[0],s=e[1]),e=n.pop();else if(c)UR(c.arc);else break;if(RR(),t){var h=+t[0][0],p=+t[0][1],g=+t[1][0],m=+t[1][1];PR(h,p,g,m),LR(h,p,g,m)}this.edges=qi,this.cells=bo,kl=lf=qi=bo=null}Sg.prototype={constructor:Sg,polygons:function(){var n=this.edges;return this.cells.map(function(t){var e=t.halfedges.map(function(o){return H_(t,n[o])});return e.data=t.site.data,e})},triangles:function(){var n=[],t=this.edges;return this.cells.forEach(function(e,o){if(p=(c=e.halfedges).length)for(var s=e.site,c,h=-1,p,g,m=t[c[p-1]],_=m.left===s?m.right:m.left;++h<p;)g=_,m=t[c[h]],_=m.left===s?m.right:m.left,g&&_&&o<g.index&&o<_.index&&I$(s,g,_)<0&&n.push([s.data,g.data,_.data])}),n},links:function(){return this.edges.filter(function(n){return n.right}).map(function(n){return{source:n.left.data,target:n.right.data}})},find:function(n,t,e){for(var o=this,s,c=o._found||0,h=o.cells.length,p;!(p=o.cells[c]);)if(++c>=h)return null;var g=n-p.site[0],m=t-p.site[1],_=g*g+m*m;do p=o.cells[s=c],c=null,p.halfedges.forEach(function(E){var x=o.edges[E],b=x.left;if(!((b===p.site||!b)&&!(b=x.right))){var P=n-b[0],I=t-b[1],S=P*P+I*I;S<_&&(_=S,c=b.index)}});while(c!==null);return o._found=s,e==null||_<=e*e?p.site:null}};var z$=on(cf(),1);var o1=on(HR(),1);function $o(){return new Ag}function Ag(){this.reset()}Ag.prototype={constructor:Ag,reset:function(){this.s=this.t=0},add:function(n){VR(bg,n,this.t),VR(this,bg.s,this.s),this.s?this.t+=bg.t:this.s=bg.t},valueOf:function(){return this.s}};var bg=new Ag;function VR(n,t,e){var o=n.s=t+e,s=o-t,c=o-s;n.t=t-c+(e-s)}var er=1e-6;var gr=Math.PI,wi=gr/2,Tg=gr/4,Na=gr*2,ql=180/gr,Zo=gr/180,$r=Math.abs,ia=Math.atan,Jo=Math.atan2,Vn=Math.cos;var Cg=Math.exp;var wh=Math.log;var sn=Math.sin;var eo=Math.sqrt,Sh=Math.tan;function Y_(n){return n>1?0:n<-1?gr:Math.acos(n)}function Ao(n){return n>1?wi:n<-1?-wi:Math.asin(n)}function oa(){}var G$=$o(),ift=$o();function Hl(n){var t=n[0],e=n[1],o=Vn(e);return[o*Vn(t),o*sn(t),sn(e)]}function Mh(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function bh(n){var t=eo(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}var dft=$o();function XR(n,t){return[n>gr?n-Na:n<-gr?n+Na:n,t]}XR.invert=XR;function $_(){var n=[],t;return{point:function(e,o){t.push([e,o])},lineStart:function(){n.push(t=[])},lineEnd:oa,rejoin:function(){n.length>1&&n.push(n.pop().concat(n.shift()))},result:function(){var e=n;return n=[],t=null,e}}}function Z_(n,t){return $r(n[0]-t[0])<er&&$r(n[1]-t[1])<er}function Pg(n,t,e,o){this.x=n,this.z=t,this.o=e,this.e=o,this.v=!1,this.n=this.p=null}function J_(n,t,e,o,s){var c=[],h=[],p,g;if(n.forEach(function(P){if(!((I=P.length-1)<=0)){var I,S=P[0],w=P[I],R;if(Z_(S,w)){for(s.lineStart(),p=0;p<I;++p)s.point((S=P[p])[0],S[1]);s.lineEnd();return}c.push(R=new Pg(S,P,null,!0)),h.push(R.o=new Pg(S,null,R,!1)),c.push(R=new Pg(w,P,null,!1)),h.push(R.o=new Pg(w,null,R,!0))}}),!!c.length){for(h.sort(t),YR(c),YR(h),p=0,g=h.length;p<g;++p)h[p].e=e=!e;for(var m=c[0],_,E;;){for(var x=m,b=!0;x.v;)if((x=x.n)===m)return;_=x.z,s.lineStart();do{if(x.v=x.o.v=!0,x.e){if(b)for(p=0,g=_.length;p<g;++p)s.point((E=_[p])[0],E[1]);else o(x.x,x.n.x,1,s);x=x.n}else{if(b)for(_=x.p.z,p=_.length-1;p>=0;--p)s.point((E=_[p])[0],E[1]);else o(x.x,x.p.x,-1,s);x=x.p}x=x.o,_=x.z,b=!b}while(!x.v);s.lineEnd()}}}function YR(n){if(t=n.length){for(var t,e=0,o=n[0],s;++e<t;)o.n=s=n[e],s.p=o,o=s;o.n=s=n[0],s.p=o}}function el(n,t){return n<t?-1:n>t?1:n>=t?0:NaN}function K_(n){return n.length===1&&(n=H$(n)),{left:function(t,e,o,s){for(o==null&&(o=0),s==null&&(s=t.length);o<s;){var c=o+s>>>1;n(t[c],e)<0?o=c+1:s=c}return o},right:function(t,e,o,s){for(o==null&&(o=0),s==null&&(s=t.length);o<s;){var c=o+s>>>1;n(t[c],e)>0?s=c:o=c+1}return o}}}function H$(n){return function(t,e){return el(n(t),e)}}var $R=K_(el),V$=$R.right,W$=$R.left;var ZR=Array.prototype,Y$=ZR.slice,$$=ZR.map;var sht=Math.sqrt(50),aht=Math.sqrt(10),uht=Math.sqrt(2);function Rg(n){for(var t=n.length,e,o=-1,s=0,c,h;++o<t;)s+=n[o].length;for(c=new Array(s);--t>=0;)for(h=n[t],e=h.length;--e>=0;)c[--s]=h[e];return c}var nZ=1e9,Wpt=-nZ;var j_=$o();function Q_(n,t){var e=t[0],o=t[1],s=[sn(e),-Vn(e),0],c=0,h=0;j_.reset();for(var p=0,g=n.length;p<g;++p)if(_=(m=n[p]).length)for(var m,_,E=m[_-1],x=E[0],b=E[1]/2+Tg,P=sn(b),I=Vn(b),S=0;S<_;++S,x=R,P=F,I=W,E=w){var w=m[S],R=w[0],T=w[1]/2+Tg,F=sn(T),W=Vn(T),X=R-x,q=X>=0?1:-1,D=q*X,xt=D>gr,B=P*F;if(j_.add(Jo(B*q*sn(D),I*W+B*Vn(D))),c+=xt?X+q*Na:X,xt^x>=e^R>=e){var j=Mh(Hl(E),Hl(w));bh(j);var J=Mh(s,j);bh(J);var Dt=(xt^X>=0?-1:1)*Ao(J[2]);(o>Dt||o===Dt&&(j[0]||j[1]))&&(h+=xt^X>=0?1:-1)}}return(c<-er||c<er&&j_<-er)^h&1}var edt=$o();var xdt=$o(),Edt=$o();var oZ=1/0;var Mdt=-oZ;function t1(n){this._context=n}t1.prototype={_radius:4.5,pointRadius:function(n){return this._radius=n,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(n,t){switch(this._point){case 0:{this._context.moveTo(n,t),this._point=1;break}case 1:{this._context.lineTo(n,t);break}default:{this._context.moveTo(n+this._radius,t),this._context.arc(n,t,this._radius,0,Na);break}}},result:oa};var Odt=$o();function e1(){this._string=[]}e1.prototype={_radius:4.5,_circle:jR(4.5),pointRadius:function(n){return(n=+n)!==this._radius&&(this._radius=n,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._string.push("Z"),this._point=NaN},point:function(n,t){switch(this._point){case 0:{this._string.push("M",n,",",t),this._point=1;break}case 1:{this._string.push("L",n,",",t);break}default:{this._circle==null&&(this._circle=jR(this._radius)),this._string.push("M",n,",",t,this._circle);break}}},result:function(){if(this._string.length){var n=this._string.join("");return this._string=[],n}else return null}};function jR(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function n1(n,t,e,o){return function(s,c){var h=t(c),p=s.invert(o[0],o[1]),g=$_(),m=t(g),_=!1,E,x,b,P={point:I,lineStart:w,lineEnd:R,polygonStart:function(){P.point=T,P.lineStart=F,P.lineEnd=W,x=[],E=[]},polygonEnd:function(){P.point=I,P.lineStart=w,P.lineEnd=R,x=Rg(x);var X=Q_(E,p);x.length?(_||(c.polygonStart(),_=!0),J_(x,uZ,X,e,c)):X&&(_||(c.polygonStart(),_=!0),c.lineStart(),e(null,null,1,c),c.lineEnd()),_&&(c.polygonEnd(),_=!1),x=E=null},sphere:function(){c.polygonStart(),c.lineStart(),e(null,null,1,c),c.lineEnd(),c.polygonEnd()}};function I(X,q){var D=s(X,q);n(X=D[0],q=D[1])&&c.point(X,q)}function S(X,q){var D=s(X,q);h.point(D[0],D[1])}function w(){P.point=S,h.lineStart()}function R(){P.point=I,h.lineEnd()}function T(X,q){b.push([X,q]);var D=s(X,q);m.point(D[0],D[1])}function F(){m.lineStart(),b=[]}function W(){T(b[0][0],b[0][1]),m.lineEnd();var X=m.clean(),q=g.result(),D,xt=q.length,B,j,J;if(b.pop(),E.push(b),b=null,!!xt){if(X&1){if(j=q[0],(B=j.length-1)>0){for(_||(c.polygonStart(),_=!0),c.lineStart(),D=0;D<B;++D)c.point((J=j[D])[0],J[1]);c.lineEnd()}return}xt>1&&X&2&&q.push(q.pop().concat(q.shift())),x.push(q.filter(aZ))}}return P}}function aZ(n){return n.length>1}function uZ(n,t){return((n=n.x)[0]<0?n[1]-wi-er:wi-n[1])-((t=t.x)[0]<0?t[1]-wi-er:wi-t[1])}var lZ=n1(function(){return!0},cZ,hZ,[-gr,-wi]);function cZ(n){var t=NaN,e=NaN,o=NaN,s;return{lineStart:function(){n.lineStart(),s=1},point:function(c,h){var p=c>0?gr:-gr,g=$r(c-t);$r(g-gr)<er?(n.point(t,e=(e+h)/2>0?wi:-wi),n.point(o,e),n.lineEnd(),n.lineStart(),n.point(p,e),n.point(c,e),s=0):o!==p&&g>=gr&&($r(t-o)<er&&(t-=o*er),$r(c-p)<er&&(c-=p*er),e=fZ(t,e,c,h),n.point(o,e),n.lineEnd(),n.lineStart(),n.point(p,e),s=0),n.point(t=c,e=h),o=p},lineEnd:function(){n.lineEnd(),t=e=NaN},clean:function(){return 2-s}}}function fZ(n,t,e,o){var s,c,h=sn(n-e);return $r(h)>er?ia((sn(t)*(c=Vn(o))*sn(e)-sn(o)*(s=Vn(t))*sn(n))/(s*c*h)):(t+o)/2}function hZ(n,t,e,o){var s;if(n==null)s=e*wi,o.point(-gr,s),o.point(0,s),o.point(gr,s),o.point(gr,0),o.point(gr,-s),o.point(0,-s),o.point(-gr,-s),o.point(-gr,0),o.point(-gr,s);else if($r(n[0]-t[0])>er){var c=n[0]<t[0]?gr:-gr;s=e*c/2,o.point(-c,s),o.point(0,s),o.point(c,s)}else o.point(t[0],t[1])}function Lg(n){return function(t){var e=new r1;for(var o in n)e[o]=n[o];return e.stream=t,e}}function r1(){}r1.prototype={constructor:r1,point:function(n,t){this.stream.point(n,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Egt=Vn(30*Zo);var Dgt=Lg({point:function(n,t){this.stream.point(n*Zo,t*Zo)}});function Ng(n){return function(t,e){var o=Vn(t),s=Vn(e),c=n(o*s);return[c*s*sn(t),c*sn(e)]}}function Oa(n){return function(t,e){var o=eo(t*t+e*e),s=n(o),c=sn(s),h=Vn(s);return[Jo(t*c,o*h),Ao(o&&e*c/o)]}}var oL=Ng(function(n){return eo(2/(1+n))});oL.invert=Oa(function(n){return 2*Ao(n/2)});var sL=Ng(function(n){return(n=Y_(n))&&n/sn(n)});sL.invert=Oa(function(n){return n});function i1(n,t){return[n,wh(Sh((wi+t)/2))]}i1.invert=function(n,t){return[n,2*ia(Cg(t))-wi]};function Og(n,t){return[n,t]}Og.invert=Og;function aL(n,t){var e=Vn(t),o=Vn(n)*e;return[e*sn(n)/o,sn(t)/o]}aL.invert=Oa(ia);function uL(n,t){var e=t*t,o=e*e;return[n*(.8707-.131979*e+o*(-.013791+o*(.003971*e-.001529*o))),t*(1.007226+e*(.015085+o*(-.044475+.028874*e-.005916*o)))]}uL.invert=function(n,t){var e=t,o=25,s;do{var c=e*e,h=c*c;e-=s=(e*(1.007226+c*(.015085+h*(-.044475+.028874*c-.005916*h)))-t)/(1.007226+c*(.015085*3+h*(-.044475*7+.028874*9*c-.005916*11*h)))}while($r(s)>er&&--o>0);return[n/(.8707+(c=e*e)*(-.131979+c*(-.013791+c*c*c*(.003971-.001529*c)))),e]};function lL(n,t){return[Vn(t)*sn(n),sn(t)]}lL.invert=Oa(Ao);function cL(n,t){var e=Vn(t),o=1+Vn(n)*e;return[e*sn(n)/o,sn(t)/o]}cL.invert=Oa(function(n){return 2*ia(n)});function fL(n,t){return[wh(Sh((wi+t)/2)),-n]}fL.invert=function(n,t){return[-t,2*ia(Cg(n))-wi]};var vZ=on(cf(),1);var _Z=on(cf(),1);var EZ=on(cf(),1);var wZ=on(cf(),1);function Dg(n,t){return Math.sqrt((t[0]-n[0])**2+(t[1]-n[1])**2)}function pL(n){let t=0;for(let e=0;e<n.length-1;e++)t+=Dg(n[e],n[e+1]);return t}var Fs=on(dL(),1);var $n="___",Fg=class{isFacilityByType(t){return["facility","escalator","straightLadder","staircase","ramp","connectionPoint"].includes(t)}initFacilities(t){this.facilities=t.map(e=>{let o=[];try{o=JSON.parse(e.entry_end_floor)}catch(c){o=[]}let s=[];try{s=JSON.parse(e.entry_start_floor)}catch(c){s=[]}return Iu({},e,{entry_start_floor:s,entry_end_floor:o})})}getParkingSpaceInfo(t,e){let o=""+t+$n+e;var s;return(s=this.parkingMap.get(o))!=null?s:null}getNodeInfo(t,e){let o=""+t+$n+e,s=this.nodeMap.get(o);if(!s)return null;let c=this.pointMap.get(s);return c!=null?c:null}initRoute(t,e){this.clear(),this.roadInfo=t,this.initFacilities(e);let o=new Date,s=o.getHours()*60+o.getMinutes();t.length&&(t.forEach(c=>{(c.points||[]).filter(h=>h.openStatus!==!1).filter(h=>{if(!h.startTime||!h.endTime)return!0;let[p,g]=h.startTime.split(":").map(b=>+b),[m,_]=h.endTime.split(":").map(b=>+b),E=p*60+g,x=m*60+_;return s>=E&&s<=x}).forEach(h=>{h.floor=c.floor;let p=""+c.floor+$n+h.id;if(this.nodeMap.set(""+c.floor+$n+h.nodeId,""+c.floor+$n+(h.relatedId||h.id)),this.pointMap.set(p,h),this.isFacilityByType(h.type)){let g=this.facilities.find(m=>m.id===+h.targetId);if(g){switch(g.entry_infra_type){case"straightLadder":if(g.entry_end_floor.find(x=>x.floor===c.floor)&&g.entry_start_floor.find(x=>x.floor===c.floor)){let x=this.straightLadderMap.get(h.targetId)||[];x.push(Iu({},h)),this.straightLadderMap.set(h.targetId,x)}break;case"staircase":if(g.entry_end_floor.find(x=>x.floor===c.floor)&&g.entry_start_floor.find(x=>x.floor===c.floor)){let x=this.staircaseMap.get(h.targetId)||[];x.push(Iu({},h)),this.staircaseMap.set(h.targetId,x)}break;case"escalator":let _=this.escalatorMap.get(h.targetId)||[];if(g.entry_start_floor.find(x=>x.floor===c.floor)){let x=_.find(b=>{var P;return((P=b.end)==null?void 0:P.floor)!==c.floor&&!b.start});x?x.start=h:_.push({start:h})}if(g.entry_end_floor.find(x=>x.floor===c.floor)){let x=_.find(b=>{var P;return((P=b.start)==null?void 0:P.floor)!==c.floor&&!b.end});x?x.end=h:_.push({end:h})}this.escalatorMap.set(h.targetId,_);break;case"ramp":let E=this.rampMap.get(h.targetId)||[];if(g.entry_start_floor.find(x=>x.floor===c.floor)){let x=E.find(b=>{var P;return((P=b.end)==null?void 0:P.floor)!==c.floor&&!b.start});x?x.start=h:E.push({start:h})}if(g.entry_end_floor.find(x=>x.floor===c.floor)){let x=E.find(b=>{var P;return((P=b.start)==null?void 0:P.floor)!==c.floor&&!b.end});x?x.end=h:E.push({end:h})}this.rampMap.set(h.targetId,E);break;case"connectionPoint":if(g.entry_end_floor.find(x=>x.floor===c.floor)&&g.entry_start_floor.find(x=>x.floor===c.floor)){let x=this.connectionPointMap.get(h.targetId)||[];x.push(Iu({},h)),this.connectionPointMap.set(h.targetId,x)}break}let m=this.facilityMap.get(h.targetId)||[];m.push(Iu({},h)),this.facilityMap.set(h.targetId,m)}}h.type==="parkingSpace"&&this.parkingMap.set(""+c.floor+$n+h.name,h)}),(c.lines||[]).filter(h=>h.to!==h.from).forEach(h=>{let p=""+c.floor+$n+h.from,g=""+c.floor+$n+h.to,m=this.pointMap.get(p),_=this.pointMap.get(g);if(!m||!_)return;let E=m.cds,x=_.cds,b=Dg(E,x);if(!m.permission&&!_.permission){switch(this.addLineItem(p,g,b),this.addLineItem(g,p,b),h.direction){case"double":this.addLineItem(p,g,b,this.forwardLineMap),this.addLineItem(g,p,b,this.forwardLineMap);break;case"single":this.addLineItem(p,g,b,this.forwardLineMap);break;case"back":this.addLineItem(g,p,b,this.forwardLineMap);break}(m.type==="parkingSpace"||_.type==="parkingSpace")&&h.direction==="noDir"&&(this.addLineItem(p,g,b,this.forwardLineMap),this.addLineItem(g,p,b,this.forwardLineMap))}else m.permission&&(this.setPermissionLine(p,g,m.permission,b,""),this.setPermissionLine(g,p,m.permission,b,"")),_.permission&&_.permission!==m.permission&&(this.setPermissionLine(p,g,_.permission,b,""),this.setPermissionLine(g,p,_.permission,b,""))})}),this.addPermissionFacility(),this.initBaseRoute(),this.initEscalatorRoute(),this.initStraightLadderRoute(),this.initForwardRoute())}getPermissionMap(t){return this["permission_"+t]||(this["permission_"+t]=new Set),this["permission_"+t]}setPermissionLine(t,e,o,s,c){this.getPermissionMap(o).add({fromKey:t,toKey:e,distance:s,type:c})}addPermissionFacility(){this.straightLadderMap.forEach((t,e)=>{if(t.length<2){this.straightLadderMap.delete(e);return}for(let o=0;o<t.length;o++){let s=""+t[o].floor+$n+t[o].id,c=this.pointMap.get(s);if(c){for(let h=0;h<t.length;h++)if(o!==h){let p=""+t[h].floor+$n+t[h].id,g=this.pointMap.get(p);if(!g)continue;c.permission&&this.setPermissionLine(s,p,c.permission,1,"straightLadder"),g.permission&&g.permission!==c.permission&&this.setPermissionLine(s,p,g.permission,1,"straightLadder")}}}}),this.staircaseMap.forEach((t,e)=>{if(t.length<2){this.staircaseMap.delete(e);return}for(let o=0;o<t.length;o++){let s=""+t[o].floor+$n+t[o].id,c=this.pointMap.get(s);if(c){for(let h=0;h<t.length;h++)if(o!==h){let p=""+t[h].floor+$n+t[h].id,g=this.pointMap.get(p);if(!g)continue;c.permission&&this.setPermissionLine(s,p,c.permission,1,"staircase"),g.permission&&g.permission!==c.permission&&this.setPermissionLine(s,p,g.permission,1,"staircase")}}}}),this.escalatorMap.forEach((t,e)=>{t.forEach(o=>{if(o.start&&o.end){let s=""+o.start.floor+$n+o.start.id,c=""+o.end.floor+$n+o.end.id,h=this.pointMap.get(s),p=this.pointMap.get(c);h&&p&&(h.permission&&this.setPermissionLine(s,c,h.permission,1,"escalator"),p.permission&&p.permission!==h.permission&&this.setPermissionLine(s,c,p.permission,1,"escalator"))}})}),this.rampMap.forEach((t,e)=>{t.forEach(o=>{if(o.start&&o.end){let s=""+o.start.floor+$n+o.start.id,c=""+o.end.floor+$n+o.end.id,h=this.pointMap.get(s),p=this.pointMap.get(c);h&&p&&(h.permission&&this.setPermissionLine(s,c,h.permission,10,"ramp"),p.permission&&p.permission!==h.permission&&this.setPermissionLine(s,c,p.permission,10,"ramp"))}})}),this.connectionPointMap.forEach((t,e)=>{if(t.length<2){this.connectionPointMap.delete(e);return}for(let o=0;o<t.length;o++){let s=""+t[o].floor+$n+t[o].id,c=this.pointMap.get(s);if(c){for(let h=0;h<t.length;h++)if(o!==h){let p=""+t[h].floor+$n+t[h].id,g=this.pointMap.get(p);if(!g)continue;c.permission&&this.setPermissionLine(s,p,c.permission,1,"connectionPoint"),g.permission&&g.permission!==c.permission&&this.setPermissionLine(s,p,g.permission,1,"connectionPoint")}}}})}addPermissionLineToMap(t,e,o,s){let c=this.getPermissionMap(t);console.log(c),c.forEach(h=>{e.includes(h.type)&&(h.type===""?this.addLineItem(h.fromKey,h.toKey,h.distance,o):this.addLineItem(h.fromKey,h.toKey,s.get(h.type),o))})}addLineItem(t,e,o,s){s===void 0&&(s=this.lineMap);let c=s.get(t)||new Map;c.set(e,o),s.set(t,c)}addFacilityToLineMap(t,e,o,s){[...this.straightLadderMap,...this.staircaseMap].forEach(c=>{let[h,p]=c;if(!(p.length<2))for(let g=0;g<p.length;g++){let m=""+p[g].floor+$n+p[g].id,_=this.pointMap.get(m);if(!(!_||_.permission)){for(let E=0;E<p.length;E++)if(g!==E){let x=""+p[E].floor+$n+p[E].id,b=this.pointMap.get(x);if(!b||b.permission)continue;if(p[g].type==="straightLadder"){let P=e;this.addLineItem(m,x,P,s)}else{let P=o;this.addLineItem(m,x,P,s)}}}}}),this.escalatorMap.forEach((c,h)=>{c.forEach(p=>{if(p.start&&p.end){let g=""+p.start.floor+$n+p.start.id,m=""+p.end.floor+$n+p.end.id,_=this.pointMap.get(g),E=this.pointMap.get(m);if(_&&E&&!_.permission&&!E.permission){let x=t;this.addLineItem(g,m,x,s)}}})}),this.connectionPointMap.forEach((c,h)=>{if(!(c.length<2))for(let p=0;p<c.length;p++){let g=""+c[p].floor+$n+c[p].id,m=this.pointMap.get(g);if(!(!m||m.permission)){for(let _=0;_<c.length;_++)if(p!==_){let E=""+c[_].floor+$n+c[_].id,x=this.pointMap.get(E);if(!x||x.permission)continue;this.addLineItem(g,E,100,s)}}}})}initBaseRoute(){let t=new Map((0,Fs.cloneDeep)([...this.lineMap]));this.addFacilityToLineMap(100,100+this.lift_priority,3e4,t),this.baseRoute=new no.default(t)}initEscalatorRoute(){let t=new Map((0,Fs.cloneDeep)([...this.lineMap])),e=1e4;this.addFacilityToLineMap(1*e,this.lift_priority*e,3e4*e,t),this.escalatorRoute=new no.default(t)}initStraightLadderRoute(){let t=new Map((0,Fs.cloneDeep)([...this.lineMap])),e=1e4;this.addFacilityToLineMap(3*e,1*e,3e4*e,t),this.straightLadderRoute=new no.default(t)}initForwardRoute(){this.rampMap.forEach((t,e)=>{t.forEach(o=>{if(o.start&&o.end){let s=""+o.start.floor+$n+o.start.id,c=""+o.end.floor+$n+o.end.id,h=this.pointMap.get(s),p=this.pointMap.get(c);h&&p&&!h.permission&&!p.permission&&this.addLineItem(s,c,10,this.forwardLineMap)}})}),this.connectionPointMap.forEach((t,e)=>{if(!(t.length<2))for(let o=0;o<t.length;o++){let s=""+t[o].floor+$n+t[o].id,c=this.pointMap.get(s);if(!(!c||c.permission)){for(let h=0;h<t.length;h++)if(o!==h){let p=""+t[h].floor+$n+t[h].id,g=this.pointMap.get(p);if(!g||g.permission)continue;this.addLineItem(s,p,100,this.forwardLineMap)}}}}),this.forwardRoute=new no.default(this.forwardLineMap)}checkStart(t){return!(!t.floor||!t.nodeId&&(!t.coord||t.coord.length<2))}checkEnd(t){return t.facility||t.parkingSpace&&t.floor?!0:this.checkStart(t)}transformStart(t,e){var o;if(t.nodeId){let s=this.nodeMap.get(""+t.floor+$n+t.nodeId);if(s){let[c,h]=s.split($n);return{floor:c,id:h}}}if((o=t.coord)!=null&&o.length){let s=this.roadInfo.find(h=>h.floor===t.floor);if(!s)return null;let c=s.points.reduce((h,p)=>{if(p.relatedId)return h;let g=""+p.floor+$n+p.id;if(e==="forward"){if(!this.forwardLineMap.has(g))return h}else if(!this.lineMap.has(g))return h;let m=Dg(t.coord,p.cds);return m<h.min&&(h.min=m,h.point=p),h},{min:1/0,point:s.points[0]});return{floor:s.floor,id:c.point.id}}return null}transformEnd(t,e){if(t.floor){if(t.parkingSpace){let s=this.parkingMap.get(""+t.floor+$n+t.parkingSpace);if(s)return{floor:t.floor,id:s.id}}let o=this.transformStart(t,e);if(o)return o}if(t.facility){let s=this.facilities.filter(c=>+c.type_id==+t.facility).map(c=>c.id).map(c=>this.facilityMap.get(""+c)).flat(2);if(s!=null&&s.length)return{floor:t.floor,facility:t.facility}}return null}getPath(t,e,o,s,c){if(o===void 0&&(o=""),!this.checkStart(t))return"start-error";if(!this.checkEnd(e))return"end-error";let h=this.transformStart(t,o);if(!h)return"no-start";let p=this.transformEnd(e,o);if(!p)return"no-end";let g;switch(o){case"escalator":g=this.getEscalatorPath.bind(this);break;case"straightLadder":g=this.getStraightLadderPath.bind(this);break;case"forward":g=this.getForwardPath.bind(this);break;default:g=this.getBasePath.bind(this);break}if(p.id)return g(h,p,s,c);if(p.facility){let _=this.facilities.filter(x=>+x.type_id==+e.facility).map(x=>x.id).map(x=>this.facilityMap.get(""+x)).flat(2).filter(x=>x).filter(x=>p.floor?x.floor===p.floor:!0);if(!_.length)return null;let E=_.map(x=>g(h,{floor:x.floor,id:x.id},s,c)).filter(x=>!!x);return E.reduce((x,b)=>{let P=b[0].consume;return P<x.distance&&(x.distance=P,x.path=b),x},{distance:1/0,path:E[0]}).path}}getRoutePath(t,e,o){let s=""+t.floor+$n+t.id,c=""+e.floor+$n+e.id,h=o.path(s,c);if(!h)return null;let p=[],g=h.reduce((m,_,E,x)=>{if(E===0)return 0;let b=x[E-1],P=o.graph.get(b).get(_);return m+P},0);return h.map(m=>{let _=this.pointMap.get(m);if(_){var E;let{floor:x}=_,b=_.type;if(this.isFacilityByType(_.type)){let P=this.facilities.find(I=>I.id===+_.targetId);P&&(b=P.entry_infra_type)}if(((E=p[p.length-1])==null?void 0:E.floor)===x){let P=p[p.length-1];P.points.push(_.cds),P.pointInfos.push(_),P.endType=b,P.destId=_.nodeId,P.distance=pL(P.points)}else p.push({floor:x,points:[_.cds],pointInfos:[_],endType:b,destId:_.nodeId,distance:0,consume:g})}}),p}getBasePath(t,e,o){if(!o)return this.getRoutePath(t,e,this.baseRoute);let s=(0,Fs.cloneDeep)(this.baseRoute.graph);this.addPermissionLineToMap(o,["","escalator","staircase","straightLadder","connectionPoint"],s,new Map([["escalator",100],["connectionPoint",100],["straightLadder",100+this.lift_priority],["staircase",3e4]]));let c=new no.default(s);return this.getRoutePath(t,e,c)}getEscalatorPath(t,e,o){if(!o)return this.getRoutePath(t,e,this.escalatorRoute);let s=(0,Fs.cloneDeep)(this.escalatorRoute.graph),c=1e4;this.addPermissionLineToMap(o,["","escalator","staircase","straightLadder","connectionPoint"],s,new Map([["escalator",1*c],["connectionPoint",100],["straightLadder",this.lift_priority*c],["staircase",3e4*c]]));let h=new no.default(s);return this.getRoutePath(t,e,h)}getStraightLadderPath(t,e,o){if(!o)return this.getRoutePath(t,e,this.straightLadderRoute);let s=(0,Fs.cloneDeep)(this.straightLadderRoute.graph),c=1e4;this.addPermissionLineToMap(o,["","escalator","staircase","straightLadder","connectionPoint"],s,new Map([["escalator",3*c],["connectionPoint",100],["straightLadder",1*c],["staircase",3e4*c]]));let h=new no.default(s);return this.getRoutePath(t,e,h)}getForwardPath(t,e,o,s){let c=new Map,h=x=>{let b=this.forwardRoute.graph.get(g);x.forEach(P=>{let I=b.get(P);(0,Fs.isNil)(I)||(c.set(P,I),b.delete(P))})},p=()=>{let x=this.forwardRoute.graph.get(g);c.forEach((b,P)=>{x.set(P,b)})},g=""+t.floor+$n+t.id;if(!(0,Fs.isNil)(s)){let x=this.forwardLineMap.get(g),b=this.pointMap.get(g);if(b&&(x!=null&&x.size)&&x.size>1){let P=new Yn(b.cds[0],b.cds[1]),I=new Map;x.forEach((w,R)=>{let T=this.pointMap.get(R);if(T){let F=new Yn(T.cds[0],T.cds[1]),X=360-(new Yn().subVectors(F,P).angle()/Math.PI*180-90+360)%360;I.set(R,X)}});let S=Array.from(I).filter(w=>{let[R,T]=w;return Math.abs(T-s)<=60}).map(w=>{let[R]=w;return R});if(S.length)S.forEach(w=>I.delete(w)),h([...I.keys()]);else{let w=Array.from(I).reduce((R,T)=>{let F=Math.abs(T[1]-s);return F<R.diff?{diff:F,key:T[0]}:R},{diff:1/0,key:""});I.delete(w.key),h([...I.keys()])}}}if(!o){let x=this.getRoutePath(t,e,this.forwardRoute);return p(),x||this.getRoutePath(t,e,this.forwardRoute)}let m=(0,Fs.cloneDeep)(this.forwardRoute.graph);this.addPermissionLineToMap(o,["","ramp"],m,new Map([["ramp",10]]));let _=new no.default(m),E=this.getRoutePath(t,e,_);if(p(),E)return E;{let x=(0,Fs.cloneDeep)(this.forwardRoute.graph);this.addPermissionLineToMap(o,["","ramp"],x,new Map([["ramp",10]]));let b=new no.default(x);return this.getRoutePath(t,e,b)}}clear(){this.roadInfo=[],this.pointMap.clear(),this.nodeMap.clear(),this.facilityMap.clear(),this.straightLadderMap.clear(),this.escalatorMap.clear(),this.staircaseMap.clear(),this.lineMap.clear(),this.baseRoute=new no.default,this.escalatorRoute=new no.default,this.straightLadderRoute=new no.default}constructor(t=3){this.lift_priority=t,this.roadInfo=[],this.facilities=[],this.pointMap=new Map,this.nodeMap=new Map,this.facilityMap=new Map,this.straightLadderMap=new Map,this.escalatorMap=new Map,this.rampMap=new Map,this.staircaseMap=new Map,this.connectionPointMap=new Map,this.parkingMap=new Map,this.lineMap=new Map,this.baseRoute=new no.default,this.escalatorRoute=new no.default,this.straightLadderRoute=new no.default,this.forwardLineMap=new Map,this.forwardRoute=new no.default}};var lxt=on(kL(),1),cxt=on(Fp(),1);function qL(n){return n.replace(/[A-Z]/g,t=>"_"+t.toLowerCase()).replace(/^_/,"")}function HL(n){let t={};for(let o in n)o.startsWith("on")&&(t[qL(o.slice(2))]=n[o]);let e=o=>ec(this,null,function*(){let{data:s}=o;if(t[s.type])try{let c=yield t[s.type](s.data);self.postMessage({type:""+s.type+"_result",key:s.key,data:c})}catch(c){self.postMessage({type:""+s.type+"_result",key:s.key,error:c})}else self.postMessage({type:""+s.type+"_result",key:s.key,error:"no_event"})});return self.addEventListener("message",e),()=>{self.removeEventListener("message",e)}}var sa=new Fg,VL,yJ=new Promise(n=>{VL=n});function WL(n,t,e){let{floor:o,coord:s}=n,c=null;return(t||[]).forEach(h=>{let p=sa.getPath({floor:o,coord:s},{floor:h.floor,parkingSpace:h.lot_id},"forward",0,e);if(!p||typeof p=="string")return;let g={floor:h.floor,spaceNo:h.lot_id,distance:p[0].consume};c||(c=g),c.distance>g.distance&&(c=g)}),c}function vJ(n,t,e,o,s){let c=WL({floor:n,coord:t},e[n],s);return c||_J(n,t,e,o,s)}function _J(n,t,e,o,s){let c=o.indexOf(n);c===-1&&(c=o.length);let h=1,p=null;for(;h<=o.length;){if(o.filter((m,_)=>_===c-1||_===c+1).forEach(m=>{let _=WL({floor:n,coord:t},e[m],s);p?_&&p.distance>_.distance&&(p=_):p=_}),p)return p;h++}return p}function xJ(n,t,e,o,s){let c=p1(n,t,t.floor,e,s);if(c)return c;let h=p1(n,t,n.floor,e,s);return h||EJ(n,t,n.floor,e,o,s)}function p1(n,t,e,o,s){let c=o[e]||[];if(!c.length)return null;let h=null;return c.forEach(p=>{let g={floor:p.floor,parkingSpace:p.lot_id},m=sa.getPath(n,g,"forward",0,s);if(!m||typeof m=="string")return;let _=sa.getParkingSpaceInfo(p.floor,p.lot_id);if(!_)return;let E=sa.getPath({floor:p.floor,coord:_.cds},t,"",0);if(!E||typeof E=="string")return;let x={floor:p.floor,spaceNo:p.lot_id,distance:E[0].consume};h?h.distance>x.distance&&(h=x):h=x}),h}function EJ(n,t,e,o,s,c){let h=s.indexOf(e);h===-1&&(h=s.length);let p=1,g=null;for(;p<=s.length;){if(s.filter((_,E)=>E===h-1||E===h+1).forEach(_=>{let E=p1(n,t,_,o,c);g?E&&g.distance>E.distance&&(g=E):g=E}),g)return g;p++}return g}function wJ(n){if(n.coord)return{floor:n.floor,coord:n.coord};if(n.nodeId){let t=sa.getNodeInfo(n.floor,n.nodeId);if(t)return{floor:t.floor,coord:t.cds}}return null}function SJ(n){if(n.coord)return{floor:n.floor,coord:n.coord};if(n.nodeId){let t=sa.getNodeInfo(n.floor,n.nodeId);if(t)return{floor:t.floor,coord:t.cds}}if(n.parkingSpace){let t=sa.getParkingSpaceInfo(n.floor,n.parkingSpace);if(t)return{floor:t.floor,coord:t.cds}}return null}HL({onSetRoadInfo(n){let{roadData:t,facilities:e}=n;sa.initRoute(t,e),VL(!0)},onGetPath(n){let{start:t,end:e,type:o,permission:s,travelDirection:c}=n;return sa.getPath(t,e,o,s,c)},onRecommend(n){return ec(this,null,function*(){let{start:t,end:e,travelDirection:o,carLotStatus:s}=n;yield yJ;let c=s.reduce((m,_)=>(m[_.floor]?m[_.floor].push(_):m[_.floor]=[_],m),{}),h=sa.roadInfo.map(m=>m.floor),p=wJ(t);if(!p)return null;let g=e?SJ(e):null;return g?xJ(p,g,c,h,o):vJ(p.floor,p.coord,c,h,o)})},onClear(){sa.clear()}});
11570
- `],{type:"text/javascript"}),t=URL.createObjectURL(r),e=new Worker(t);return URL.revokeObjectURL(t),e}var RR={placeId:0,catLotStatusApi:"https://nav.aibee.cn/aether-walker/parking/cat-lot-status"},L1=class{setRoadData(t,e){return At(this.worker,"set_road_data",{roadData:t,facilities:e})}recommend(t){return j(this,null,function*(){let e=yield fetch(this.options.catLotStatusApi,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({place_id:+this.options.placeId})}).then(n=>n.json()).then(n=>n.data.filter(i=>i.status===0));return At(this.worker,"recommend",T({},t,{carLotStatus:e}))})}dispose(){this.worker.terminate()}constructor(t={}){this.worker=Zc(),this.options=T({},RR,t)}};export{pa as AibeeLoader,S1 as BMap,C1 as BMapSelect,Ft as BaseSvg,J1 as CarInertialPosition,Ro as ClickHelper,ua as Context,w1 as CrLoader,Z1 as CrNavPath,b1 as Equipment,x2 as Events,Rt as Floor,Us as GlbModel,Q as Graphic,Xs as GraphicLayer,mr as GroundTexture,Es as HeatmapElement,at as HooksName,Qs as HoverHelper,Gs as Lane,q as Layer,Js as LineElement,WH as MapTypePolar,gr as MergeGraphic,Ds as Model,N1 as MulFloorNavigation,U1 as MulFloorSelect,D1 as MulFloors,X1 as NavPath,E1 as Navigation,Ys as Overlay,Os as ParkingLayer,xe as PathDirection,R1 as PdrPosition,Wn as Poi,$ as Poi2,Cs as PoiLayer,dr as PoiLayer2,L1 as RecommendParkingSpace,Mg as RoadNetwork,Cg as RoadNetwork2,UA as SelectBox,Bs as Selection,ga as Sensor,Is as Shadow,Fs as SvgLine,zs as SvgPolygon,qn as TaskQueue,Vs as TextTexture,H as Timer,en as TweenUtil,W2 as UA,Ns as Wall,jU as addAlphaToHexColor,_o as calc_angle,u0 as calc_direction,ret as calculateInstantaneousSpeed,ba as calculateLineDirection,Og as convertToSnakeCase,Jr as createCircle,Yo as createLine,Qe as createRect,Qm as createSvg,Io as createSvgElement,ak as createThreeBox,sk as createThreeLine,We as darkenColor,cK as defaultConfig,mc as defaultGraphicOptions,z9 as defaultOptions,gO as defaultTextTextureOptions,CN as deviceToVector3,L as dispose,ng as distancePointToSegment,Bn as generatorKeyByObj,bY as getAngle,vo as getCenter,m1 as getConfig,nG as getDirectPath,rg as getDistanceByPathPos,K as getLength,ON as getLongestSideDir,Pm as getMinEdgeSquare,xt as getPathLength,_e as getPointEdgeIndex,Qn as getPosByPathDistance,Fu as hasChinese,t0 as hexToRgb,am as initDirectionalLight,sm as initLight,he as initShape,wU as isAndroid,Be as isContain,Ln as isControl,Br as isIphone,Jn as isMac,jm as isPointInPolygon,A1 as loadBuildingGround,oH as loadExternalStreet,T1 as loadGraphics,eG as moveOnRoute,Oi as predictFuturePosition,iet as predictFutureSpeed,kn as proxyOptions,oet as removeOutliers,_Y as removeWeightPath,An as setCirclePosition,Jt as setLineStartEnd,st as setRectPosition,Oo as simplifyPath,qm as sleepByRf,Hm as sleepOnePromise,Eo as sleepOneRf,eg as smoothPath,PU as strToNumber,It as timeoutPromise,nk as toWebWorker,pt as transformGraphicData,Xc as transformSpeed,Hn as translatePosToCenter,At as triggerWorker,W as vector3ToDevice,JU as xhrGet};
11570
+ `],{type:"text/javascript"}),t=URL.createObjectURL(r),e=new Worker(t);return URL.revokeObjectURL(t),e}var RR={placeId:0,catLotStatusApi:"https://nav.aibee.cn/aether-walker/parking/cat-lot-status"},L1=class{setRoadData(t,e){return At(this.worker,"set_road_data",{roadData:t,facilities:e})}recommend(t){return j(this,null,function*(){let e=yield fetch(this.options.catLotStatusApi,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({place_id:+this.options.placeId})}).then(n=>n.json()).then(n=>n.data.filter(i=>i.status===0));return At(this.worker,"recommend",T({},t,{carLotStatus:e}))})}dispose(){this.worker.terminate()}constructor(t={}){this.worker=Zc(),this.options=T({},RR,t)}};export{pa as AibeeLoader,S1 as BMap,C1 as BMapSelect,Ft as BaseSvg,J1 as CarInertialPosition,Ro as ClickHelper,ua as Context,w1 as CrLoader,Z1 as CrNavPath,b1 as Equipment,x2 as Events,Rt as Floor,Us as GlbModel,Q as Graphic,Xs as GraphicLayer,mr as GroundTexture,Es as HeatmapElement,at as HooksName,Qs as HoverHelper,Gs as Lane,q as Layer,Js as LineElement,YH as MapTypePolar,gr as MergeGraphic,Ds as Model,N1 as MulFloorNavigation,U1 as MulFloorSelect,D1 as MulFloors,X1 as NavPath,E1 as Navigation,Ys as Overlay,Os as ParkingLayer,xe as PathDirection,R1 as PdrPosition,Wn as Poi,$ as Poi2,Cs as PoiLayer,dr as PoiLayer2,L1 as RecommendParkingSpace,Mg as RoadNetwork,Cg as RoadNetwork2,UA as SelectBox,Bs as Selection,ga as Sensor,Is as Shadow,Fs as SvgLine,zs as SvgPolygon,qn as TaskQueue,Vs as TextTexture,H as Timer,en as TweenUtil,W2 as UA,Ns as Wall,jU as addAlphaToHexColor,_o as calc_angle,u0 as calc_direction,set as calculateInstantaneousSpeed,ba as calculateLineDirection,Og as convertToSnakeCase,Jr as createCircle,Yo as createLine,Qe as createRect,Qm as createSvg,Io as createSvgElement,ak as createThreeBox,sk as createThreeLine,We as darkenColor,cK as defaultConfig,mc as defaultGraphicOptions,z9 as defaultOptions,gO as defaultTextTextureOptions,CN as deviceToVector3,L as dispose,ng as distancePointToSegment,Bn as generatorKeyByObj,bY as getAngle,vo as getCenter,m1 as getConfig,nG as getDirectPath,rg as getDistanceByPathPos,K as getLength,ON as getLongestSideDir,Pm as getMinEdgeSquare,xt as getPathLength,_e as getPointEdgeIndex,Qn as getPosByPathDistance,Fu as hasChinese,t0 as hexToRgb,am as initDirectionalLight,sm as initLight,he as initShape,wU as isAndroid,Be as isContain,Ln as isControl,Br as isIphone,Jn as isMac,jm as isPointInPolygon,A1 as loadBuildingGround,uH as loadExternalStreet,T1 as loadGraphics,eG as moveOnRoute,Oi as predictFuturePosition,aet as predictFutureSpeed,kn as proxyOptions,uet as removeOutliers,_Y as removeWeightPath,An as setCirclePosition,Jt as setLineStartEnd,st as setRectPosition,Oo as simplifyPath,qm as sleepByRf,Hm as sleepOnePromise,Eo as sleepOneRf,eg as smoothPath,PU as strToNumber,It as timeoutPromise,nk as toWebWorker,pt as transformGraphicData,Xc as transformSpeed,Hn as translatePosToCenter,At as triggerWorker,W as vector3ToDevice,JU as xhrGet};